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:
@@ -21,7 +21,7 @@ import importlib
|
||||
from datetime import datetime
|
||||
import glob
|
||||
|
||||
from .plat import ISWINDOWS
|
||||
from hscommon.plat import ISWINDOWS
|
||||
|
||||
|
||||
def print_and_do(cmd):
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import copy
|
||||
|
||||
from .base import GUIObject
|
||||
from hscommon.gui.base import GUIObject
|
||||
|
||||
|
||||
class Column:
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..jobprogress.performer import ThreadedJobPerformer
|
||||
from .base import GUIObject
|
||||
from .text_field import TextField
|
||||
from hscommon.jobprogress.performer import ThreadedJobPerformer
|
||||
from hscommon.gui.base import GUIObject
|
||||
from hscommon.gui.text_field import TextField
|
||||
|
||||
|
||||
class ProgressWindowView:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
from collections.abc import Sequence, MutableSequence
|
||||
|
||||
from .base import GUIObject
|
||||
from hscommon.gui.base import GUIObject
|
||||
|
||||
|
||||
class Selectable(Sequence):
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
from collections.abc import MutableSequence
|
||||
from collections import namedtuple
|
||||
|
||||
from .base import GUIObject
|
||||
from .selectable_list import Selectable
|
||||
from hscommon.gui.base import GUIObject
|
||||
from hscommon.gui.selectable_list import Selectable
|
||||
|
||||
|
||||
# We used to directly subclass list, but it caused problems at some point with deepcopy
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
# 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 GUIObject
|
||||
from ..util import nonone
|
||||
from hscommon.gui.base import GUIObject
|
||||
from hscommon.util import nonone
|
||||
|
||||
|
||||
class TextFieldView:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
from collections.abc import MutableSequence
|
||||
|
||||
from .base import GUIObject
|
||||
from hscommon.gui.base import GUIObject
|
||||
|
||||
|
||||
class Node(MutableSequence):
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
from threading import Thread
|
||||
import sys
|
||||
|
||||
from .job import Job, JobInProgressError, JobCancelled
|
||||
from hscommon.jobprogress.job import Job, JobInProgressError, JobCancelled
|
||||
|
||||
|
||||
class ThreadedJobPerformer:
|
||||
|
||||
@@ -5,21 +5,10 @@ import tempfile
|
||||
|
||||
import polib
|
||||
|
||||
from . import pygettext
|
||||
from hscommon import pygettext
|
||||
|
||||
LC_MESSAGES = "LC_MESSAGES"
|
||||
|
||||
# There isn't a 1-on-1 exact fit between .po language codes and cocoa ones
|
||||
PO2COCOA = {
|
||||
"pl_PL": "pl",
|
||||
"pt_BR": "pt-BR",
|
||||
"zh_CN": "zh-Hans",
|
||||
}
|
||||
|
||||
COCOA2PO = {v: k for k, v in PO2COCOA.items()}
|
||||
|
||||
STRING_EXT = ".strings"
|
||||
|
||||
|
||||
def get_langs(folder):
|
||||
return [name for name in os.listdir(folder) if op.isdir(op.join(folder, name))]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
from .build import read_changelog_file, filereplace
|
||||
from hscommon.build import read_changelog_file, filereplace
|
||||
from sphinx.cmd.build import build_main as sphinx_build
|
||||
|
||||
CHANGELOG_FORMAT = """
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from ..conflict import (
|
||||
from hscommon.conflict import (
|
||||
get_conflicted_name,
|
||||
get_unconflicted_name,
|
||||
is_conflicted,
|
||||
@@ -16,7 +16,7 @@ from ..conflict import (
|
||||
smart_move,
|
||||
)
|
||||
from pathlib import Path
|
||||
from ..testutil import eq_
|
||||
from hscommon.testutil import eq_
|
||||
|
||||
|
||||
class TestCaseGetConflictedName:
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import eq_
|
||||
from ..notify import Broadcaster, Listener, Repeater
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.notify import Broadcaster, Listener, Repeater
|
||||
|
||||
|
||||
class HelloListener(Listener):
|
||||
|
||||
@@ -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 ..path import pathify
|
||||
from hscommon.path import pathify
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import eq_, callcounter, CallLogger
|
||||
from ..gui.selectable_list import SelectableList, GUISelectableList
|
||||
from hscommon.testutil import eq_, callcounter, CallLogger
|
||||
from hscommon.gui.selectable_list import SelectableList, GUISelectableList
|
||||
|
||||
|
||||
def test_in():
|
||||
|
||||
@@ -13,8 +13,8 @@ import sqlite3 as sqlite
|
||||
|
||||
from pytest import raises
|
||||
|
||||
from ..testutil import eq_
|
||||
from ..sqlite import ThreadedConn
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.sqlite import ThreadedConn
|
||||
|
||||
# Threading is hard to test. In a lot of those tests, a failure means that the test run will
|
||||
# hang forever. Well... I don't know a better alternative.
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import CallLogger, eq_
|
||||
from ..gui.table import Table, GUITable, Row
|
||||
from hscommon.testutil import CallLogger, eq_
|
||||
from hscommon.gui.table import Table, GUITable, Row
|
||||
|
||||
|
||||
class TestRow(Row):
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from ..testutil import eq_
|
||||
from ..gui.tree import Tree, Node
|
||||
from hscommon.testutil import eq_
|
||||
from hscommon.gui.tree import Tree, Node
|
||||
|
||||
|
||||
def tree_with_some_nodes():
|
||||
|
||||
@@ -10,9 +10,9 @@ from io import StringIO
|
||||
|
||||
from pytest import raises
|
||||
|
||||
from ..testutil import eq_
|
||||
from hscommon.testutil import eq_
|
||||
from pathlib import Path
|
||||
from ..util import (
|
||||
from hscommon.util import (
|
||||
nonone,
|
||||
tryint,
|
||||
first,
|
||||
|
||||
@@ -8,28 +8,12 @@
|
||||
|
||||
import pytest
|
||||
|
||||
import threading
|
||||
import py.path
|
||||
|
||||
|
||||
def eq_(a, b, msg=None):
|
||||
__tracebackhide__ = True
|
||||
assert a == b, msg or "{!r} != {!r}".format(a, b)
|
||||
|
||||
|
||||
def eq_sorted(a, b, msg=None):
|
||||
"""If both a and b are iterable sort them and compare using eq_, otherwise just pass them through to eq_ anyway."""
|
||||
try:
|
||||
eq_(sorted(a), sorted(b), msg)
|
||||
except TypeError:
|
||||
eq_(a, b, msg)
|
||||
|
||||
|
||||
def assert_almost_equal(a, b, places=7):
|
||||
__tracebackhide__ = True
|
||||
assert round(a, ndigits=places) == round(b, ndigits=places)
|
||||
|
||||
|
||||
def callcounter():
|
||||
def f(*args, **kwargs):
|
||||
f.callcount += 1
|
||||
@@ -38,23 +22,6 @@ def callcounter():
|
||||
return f
|
||||
|
||||
|
||||
class TestData:
|
||||
def __init__(self, datadirpath):
|
||||
self.datadirpath = py.path.local(datadirpath)
|
||||
|
||||
def filepath(self, relative_path, *args):
|
||||
"""Returns the path of a file in testdata.
|
||||
|
||||
'relative_path' can be anything that can be added to a Path
|
||||
if args is not empty, it will be joined to relative_path
|
||||
"""
|
||||
resultpath = self.datadirpath.join(relative_path)
|
||||
if args:
|
||||
resultpath = resultpath.join(*args)
|
||||
assert resultpath.check()
|
||||
return str(resultpath)
|
||||
|
||||
|
||||
class CallLogger:
|
||||
"""This is a dummy object that logs all calls made to it.
|
||||
|
||||
@@ -168,20 +135,6 @@ def app(request):
|
||||
return app
|
||||
|
||||
|
||||
def jointhreads():
|
||||
"""Join all threads to the main thread"""
|
||||
for thread in threading.enumerate():
|
||||
if hasattr(thread, "BUGGY"):
|
||||
continue
|
||||
if thread.getName() != "MainThread" and thread.isAlive():
|
||||
if hasattr(thread, "close"):
|
||||
thread.close()
|
||||
thread.join(1)
|
||||
if thread.isAlive():
|
||||
print("Thread problem. Some thread doesn't want to stop.")
|
||||
thread.BUGGY = True
|
||||
|
||||
|
||||
def _unify_args(func, args, kwargs, args_to_ignore=None):
|
||||
"""Unify args and kwargs in the same dictionary.
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import locale
|
||||
import logging
|
||||
import os.path as op
|
||||
|
||||
from .plat import ISLINUX
|
||||
from hscommon.plat import ISLINUX
|
||||
|
||||
_trfunc = None
|
||||
_trget = None
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
from math import ceil
|
||||
from pathlib import Path
|
||||
from .path import pathify, log_io_error
|
||||
from hscommon.path import pathify, log_io_error
|
||||
|
||||
from typing import IO, Any, Callable, Generator, Iterable, List, Tuple, Union
|
||||
|
||||
|
||||
Reference in New Issue
Block a user