mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Replace all relative imports
This commit is contained in:
28
core/app.py
28
core/app.py
@@ -23,20 +23,20 @@ from hscommon.util import delete_if_empty, first, escape, nonone, allsame
|
||||
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"
|
||||
|
||||
@@ -13,7 +13,7 @@ from hscommon.jobprogress import job
|
||||
from hscommon.util import FileOrPath
|
||||
from hscommon.trans import tr
|
||||
|
||||
from . import fs
|
||||
from core import fs
|
||||
|
||||
__all__ = [
|
||||
"Directories",
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
from hscommon import desktop
|
||||
|
||||
from .problem_table import ProblemTable
|
||||
from core.gui.problem_table import ProblemTable
|
||||
|
||||
|
||||
class ProblemDialog:
|
||||
|
||||
@@ -11,7 +11,7 @@ from operator import attrgetter
|
||||
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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -1 +1 @@
|
||||
from . import fs, prioritize, result_table, scanner # noqa
|
||||
from core.me import fs, prioritize, result_table, scanner # noqa
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from . import ( # noqa
|
||||
from core.pe import ( # noqa
|
||||
block,
|
||||
cache,
|
||||
exif,
|
||||
iphoto_plist,
|
||||
matchblock,
|
||||
matchexif,
|
||||
photo,
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -10,7 +10,7 @@ import shelve
|
||||
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):
|
||||
|
||||
@@ -9,7 +9,7 @@ import os.path as op
|
||||
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:
|
||||
|
||||
@@ -15,7 +15,7 @@ from hscommon.trans import tr
|
||||
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
|
||||
@@ -51,11 +51,11 @@ except Exception:
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from hscommon.util import get_file_ext, format_size
|
||||
|
||||
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
|
||||
|
||||
@@ -8,7 +8,7 @@ from hscommon.trans import tr
|
||||
|
||||
from core.scanner import Scanner, ScanType, ScanOption
|
||||
|
||||
from . import matchblock, matchexif
|
||||
from core.pe import matchblock, matchexif
|
||||
|
||||
|
||||
class ScannerPE(Scanner):
|
||||
|
||||
@@ -17,8 +17,8 @@ from hscommon.conflict import get_conflicted_name
|
||||
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):
|
||||
|
||||
@@ -13,7 +13,7 @@ from hscommon.jobprogress import job
|
||||
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
|
||||
|
||||
@@ -1 +1 @@
|
||||
from . import fs, result_table, scanner # noqa
|
||||
from core.se import fs, result_table, scanner # noqa
|
||||
|
||||
@@ -15,10 +15,10 @@ import hscommon.util
|
||||
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):
|
||||
|
||||
@@ -10,12 +10,11 @@ from hscommon.util import get_file_ext, format_size
|
||||
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:
|
||||
|
||||
@@ -9,7 +9,7 @@ from pytest import raises, skip
|
||||
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.")
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ from pytest import raises, skip
|
||||
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.")
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ from pathlib import Path
|
||||
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):
|
||||
|
||||
@@ -10,9 +10,9 @@ from hscommon.jobprogress import job
|
||||
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,
|
||||
|
||||
@@ -10,8 +10,8 @@ from xml.etree import ElementTree as ET
|
||||
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
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from pathlib import Path
|
||||
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:
|
||||
|
||||
@@ -10,7 +10,7 @@ from xml.etree import ElementTree as ET
|
||||
from pytest import raises
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
from ..ignore import IgnoreList
|
||||
from core.ignore import IgnoreList
|
||||
|
||||
|
||||
def test_empty():
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
from ..markable import MarkableList, Markable
|
||||
from core.markable import MarkableList, Markable
|
||||
|
||||
|
||||
def gen():
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -12,10 +12,9 @@ from xml.etree import ElementTree as ET
|
||||
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:
|
||||
|
||||
@@ -10,11 +10,11 @@ from hscommon.jobprogress import job
|
||||
from pathlib import Path
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
from .. import fs
|
||||
from ..engine import getwords, Match
|
||||
from ..ignore import IgnoreList
|
||||
from ..scanner import Scanner, ScanType
|
||||
from ..me.scanner import ScannerME
|
||||
from core import fs
|
||||
from core.engine import getwords, Match
|
||||
from core.ignore import IgnoreList
|
||||
from core.scanner import Scanner, ScanType
|
||||
from core.me.scanner import ScannerME
|
||||
|
||||
|
||||
class NamedObject:
|
||||
|
||||
Reference in New Issue
Block a user