Skip to content

Commit

Permalink
Replace all relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenetar committed May 9, 2022
1 parent f7ed1c8 commit e382683
Show file tree
Hide file tree
Showing 79 changed files with 155 additions and 216 deletions.
28 changes: 14 additions & 14 deletions core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
from hscommon.trans import tr
from hscommon import desktop

from . import se, me, pe
from .pe.photo import get_delta_dimensions
from .util import cmp_value, fix_surrogate_encoding
from . import directories, results, export, fs, prioritize
from .ignore import IgnoreList
from .exclude import ExcludeDict as ExcludeList
from .scanner import ScanType
from .gui.deletion_options import DeletionOptions
from .gui.details_panel import DetailsPanel
from .gui.directory_tree import DirectoryTree
from .gui.ignore_list_dialog import IgnoreListDialog
from .gui.exclude_list_dialog import ExcludeListDialogCore
from .gui.problem_dialog import ProblemDialog
from .gui.stats_label import StatsLabel
from core import se, me, pe
from core.pe.photo import get_delta_dimensions
from core.util import cmp_value, fix_surrogate_encoding
from core import directories, results, export, fs, prioritize
from core.ignore import IgnoreList
from core.exclude import ExcludeDict as ExcludeList
from core.scanner import ScanType
from core.gui.deletion_options import DeletionOptions
from core.gui.details_panel import DetailsPanel
from core.gui.directory_tree import DirectoryTree
from core.gui.ignore_list_dialog import IgnoreListDialog
from core.gui.exclude_list_dialog import ExcludeListDialogCore
from core.gui.problem_dialog import ProblemDialog
from core.gui.stats_label import StatsLabel

HAD_FIRST_LAUNCH_PREFERENCE = "HadFirstLaunch"
DEBUG_MODE_PREFERENCE = "DebugMode"
Expand Down
2 changes: 1 addition & 1 deletion core/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hscommon.util import FileOrPath
from hscommon.trans import tr

from . import fs
from core import fs

__all__ = [
"Directories",
Expand Down
2 changes: 1 addition & 1 deletion core/exclude.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from .markable import Markable
from core.markable import Markable
from xml.etree import ElementTree as ET

# TODO: perhaps use regex module for better Unicode support? https://pypi.org/project/regex/
Expand Down
2 changes: 1 addition & 1 deletion core/gui/details_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# http://www.gnu.org/licenses/gpl-3.0.html

from hscommon.gui.base import GUIObject
from .base import DupeGuruGUIObject
from core.gui.base import DupeGuruGUIObject


class DetailsPanel(GUIObject, DupeGuruGUIObject):
Expand Down
4 changes: 2 additions & 2 deletions core/gui/directory_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from hscommon.gui.tree import Tree, Node

from ..directories import DirectoryState
from .base import DupeGuruGUIObject
from core.directories import DirectoryState
from core.gui.base import DupeGuruGUIObject

STATE_ORDER = [DirectoryState.NORMAL, DirectoryState.REFERENCE, DirectoryState.EXCLUDED]

Expand Down
2 changes: 1 addition & 1 deletion core/gui/exclude_list_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from .exclude_list_table import ExcludeListTable
from core.gui.exclude_list_table import ExcludeListTable
from core.exclude import has_sep
from os import sep
import logging
Expand Down
2 changes: 1 addition & 1 deletion core/gui/exclude_list_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from .base import DupeGuruGUIObject
from core.gui.base import DupeGuruGUIObject
from hscommon.gui.table import GUITable, Row
from hscommon.gui.column import Column, Columns
from hscommon.trans import trget
Expand Down
2 changes: 1 addition & 1 deletion core/gui/ignore_list_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gnu.org/licenses/gpl-3.0.html

from hscommon.trans import tr
from .ignore_list_table import IgnoreListTable
from core.gui.ignore_list_table import IgnoreListTable


class IgnoreListDialog:
Expand Down
2 changes: 1 addition & 1 deletion core/gui/problem_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from hscommon import desktop

from .problem_table import ProblemTable
from core.gui.problem_table import ProblemTable


class ProblemDialog:
Expand Down
2 changes: 1 addition & 1 deletion core/gui/result_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hscommon.gui.table import GUITable, Row
from hscommon.gui.column import Columns

from .base import DupeGuruGUIObject
from core.gui.base import DupeGuruGUIObject


class DupeRow(Row):
Expand Down
2 changes: 1 addition & 1 deletion core/gui/stats_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from .base import DupeGuruGUIObject
from core.gui.base import DupeGuruGUIObject


class StatsLabel(DupeGuruGUIObject):
Expand Down
2 changes: 1 addition & 1 deletion core/me/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import fs, prioritize, result_table, scanner # noqa
from core.me import fs, prioritize, result_table, scanner # noqa
3 changes: 1 addition & 2 deletions core/pe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from . import ( # noqa
from core.pe import ( # noqa
block,
cache,
exif,
iphoto_plist,
matchblock,
matchexif,
photo,
Expand Down
2 changes: 1 addition & 1 deletion core/pe/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from ._block import NoBlocksError, DifferentBlockCountError, avgdiff, getblocks2 # NOQA
from core.pe._block import NoBlocksError, DifferentBlockCountError, avgdiff, getblocks2 # NOQA

# Converted to C
# def getblock(image):
Expand Down
2 changes: 1 addition & 1 deletion core/pe/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from ._cache import string_to_colors # noqa
from core.pe._cache import string_to_colors # noqa


def colors_to_string(colors):
Expand Down
2 changes: 1 addition & 1 deletion core/pe/cache_shelve.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import tempfile
from collections import namedtuple

from .cache import string_to_colors, colors_to_string
from core.pe.cache import string_to_colors, colors_to_string


def wrap_path(path):
Expand Down
2 changes: 1 addition & 1 deletion core/pe/cache_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import logging
import sqlite3 as sqlite

from .cache import string_to_colors, colors_to_string
from core.pe.cache import string_to_colors, colors_to_string


class SqliteCache:
Expand Down
6 changes: 3 additions & 3 deletions core/pe/matchblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from hscommon.jobprogress import job

from core.engine import Match
from .block import avgdiff, DifferentBlockCountError, NoBlocksError
from core.pe.block import avgdiff, DifferentBlockCountError, NoBlocksError

# OPTIMIZATION NOTES:
# The bottleneck of the matching phase is CPU, which is why we use multiprocessing. However, another
Expand Down Expand Up @@ -51,11 +51,11 @@

def get_cache(cache_path, readonly=False):
if cache_path.endswith("shelve"):
from .cache_shelve import ShelveCache
from core.pe.cache_shelve import ShelveCache

return ShelveCache(cache_path, readonly=readonly)
else:
from .cache_sqlite import SqliteCache
from core.pe.cache_sqlite import SqliteCache

return SqliteCache(cache_path, readonly=readonly)

Expand Down
2 changes: 1 addition & 1 deletion core/pe/photo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from core.util import format_timestamp, format_perc, format_dupe_count
from core import fs
from . import exif
from core.pe import exif

# This global value is set by the platform-specific subclasser of the Photo base class
PLAT_SPECIFIC_PHOTO_CLASS = None
Expand Down
2 changes: 1 addition & 1 deletion core/pe/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from core.scanner import Scanner, ScanType, ScanOption

from . import matchblock, matchexif
from core.pe import matchblock, matchexif


class ScannerPE(Scanner):
Expand Down
4 changes: 2 additions & 2 deletions core/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from hscommon.util import flatten, nonone, FileOrPath, format_size
from hscommon.trans import tr

from . import engine
from .markable import Markable
from core import engine
from core.markable import Markable


class Results(Markable):
Expand Down
2 changes: 1 addition & 1 deletion core/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hscommon.util import dedupe, rem_file_ext, get_file_ext
from hscommon.trans import tr

from . import engine
from core import engine

# It's quite ugly to have scan types from all editions all put in the same class, but because there's
# there will be some nasty bugs popping up (ScanType is used in core when in should exclusively be
Expand Down
2 changes: 1 addition & 1 deletion core/se/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import fs, result_table, scanner # noqa
from core.se import fs, result_table, scanner # noqa
8 changes: 4 additions & 4 deletions core/tests/app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
from hscommon.testutil import eq_, log_calls
from hscommon.jobprogress.job import Job

from .base import TestApp
from .results_test import GetTestGroups
from .. import app, fs, engine
from ..scanner import ScanType
from core.tests.base import TestApp
from core.tests.results_test import GetTestGroups
from core import app, fs, engine
from core.scanner import ScanType


def add_fake_files_to_directories(directories, files):
Expand Down
11 changes: 5 additions & 6 deletions core/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
from hscommon.gui.column import Column
from hscommon.jobprogress.job import nulljob, JobCancelled

from .. import engine
from .. import prioritize
from ..engine import getwords
from ..app import DupeGuru as DupeGuruBase
from ..gui.result_table import ResultTable as ResultTableBase
from ..gui.prioritize_dialog import PrioritizeDialog
from core import engine, prioritize
from core.engine import getwords
from core.app import DupeGuru as DupeGuruBase
from core.gui.result_table import ResultTable as ResultTableBase
from core.gui.prioritize_dialog import PrioritizeDialog


class DupeGuruView:
Expand Down
2 changes: 1 addition & 1 deletion core/tests/block_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from hscommon.testutil import eq_

try:
from ..pe.block import avgdiff, getblocks2, NoBlocksError, DifferentBlockCountError
from core.pe.block import avgdiff, getblocks2, NoBlocksError, DifferentBlockCountError
except ImportError:
skip("Can't import the block module, probably hasn't been compiled.")

Expand Down
6 changes: 3 additions & 3 deletions core/tests/cache_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from hscommon.testutil import eq_

try:
from ..pe.cache import colors_to_string, string_to_colors
from ..pe.cache_sqlite import SqliteCache
from ..pe.cache_shelve import ShelveCache
from core.pe.cache import colors_to_string, string_to_colors
from core.pe.cache_sqlite import SqliteCache
from core.pe.cache_shelve import ShelveCache
except ImportError:
skip("Can't import the cache module, probably hasn't been compiled.")

Expand Down
6 changes: 3 additions & 3 deletions core/tests/directories_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
from hscommon.testutil import eq_
from hscommon.plat import ISWINDOWS

from ..fs import File
from ..directories import (
from core.fs import File
from core.directories import (
Directories,
DirectoryState,
AlreadyThereError,
InvalidPathError,
)
from ..exclude import ExcludeList, ExcludeDict
from core.exclude import ExcludeList, ExcludeDict


def create_fake_fs(rootpath):
Expand Down
6 changes: 3 additions & 3 deletions core/tests/engine_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from hscommon.util import first
from hscommon.testutil import eq_, log_calls

from .base import NamedObject
from .. import engine
from ..engine import (
from core.tests.base import NamedObject
from core import engine
from core.engine import (
get_match,
getwords,
Group,
Expand Down
4 changes: 2 additions & 2 deletions core/tests/exclude_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from hscommon.testutil import eq_
from hscommon.plat import ISWINDOWS

from .base import DupeGuru
from ..exclude import ExcludeList, ExcludeDict, default_regexes, AlreadyThereException
from core.tests.base import DupeGuru
from core.exclude import ExcludeList, ExcludeDict, default_regexes, AlreadyThereException

from re import error

Expand Down
2 changes: 1 addition & 1 deletion core/tests/fs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hscommon.testutil import eq_
from core.tests.directories_test import create_fake_fs

from .. import fs
from core import fs

hasher: typing.Callable
try:
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ignore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pytest import raises
from hscommon.testutil import eq_

from ..ignore import IgnoreList
from core.ignore import IgnoreList


def test_empty():
Expand Down
2 changes: 1 addition & 1 deletion core/tests/markable_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from hscommon.testutil import eq_

from ..markable import MarkableList, Markable
from core.markable import MarkableList, Markable


def gen():
Expand Down
4 changes: 2 additions & 2 deletions core/tests/prioritize_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import os.path as op
from itertools import combinations

from .base import TestApp, NamedObject, with_app, eq_
from ..engine import Group, Match
from core.tests.base import TestApp, NamedObject, with_app, eq_
from core.engine import Group, Match

no = NamedObject

Expand Down
2 changes: 1 addition & 1 deletion core/tests/result_table_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html

from .base import TestApp, GetTestGroups
from core.tests.base import TestApp, GetTestGroups


def app_with_results():
Expand Down
7 changes: 3 additions & 4 deletions core/tests/results_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
from pytest import raises
from hscommon.testutil import eq_
from hscommon.util import first

from .. import engine
from .base import NamedObject, GetTestGroups, DupeGuru
from ..results import Results
from core import engine
from core.tests.base import NamedObject, GetTestGroups, DupeGuru
from core.results import Results


class TestCaseResultsEmpty:
Expand Down
Loading

0 comments on commit e382683

Please sign in to comment.