Skip to content

Commit

Permalink
Reformat with black 23.1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Zamarin <[email protected]>
  • Loading branch information
arthurzam committed Mar 24, 2023
1 parent 9f1bd12 commit 266d2c7
Show file tree
Hide file tree
Showing 30 changed files with 2 additions and 70 deletions.
3 changes: 0 additions & 3 deletions src/snakeoil/chksum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class MissingChksumHandler(Exception):


def get_handler(requested):

"""
get a chksum handler
Expand All @@ -34,7 +33,6 @@ def get_handler(requested):


def get_handlers(requested=None):

"""
get multiple chksum handlers
Expand All @@ -55,7 +53,6 @@ def get_handlers(requested=None):


def init(additional_handlers=None):

"""
init the chksum subsystem.
Expand Down
4 changes: 0 additions & 4 deletions src/snakeoil/cli/arghparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,6 @@ def _parse_optionals(self, arg_strings, namespace):
arg_string_pattern_parts = []
arg_strings_iter = iter(arg_strings)
for i, arg_string in enumerate(arg_strings_iter):

# all args after -- are non-options
if arg_string == "--":
arg_string_pattern_parts.append("-")
Expand Down Expand Up @@ -773,7 +772,6 @@ def take_action(action, argument_strings, option_string=None):

# function to convert arg_strings into an optional action
def consume_optional(start_index):

# get the optional identified at this index
option_tuple = option_string_indices[start_index]
action, option_string, explicit_arg = option_tuple
Expand All @@ -783,7 +781,6 @@ def consume_optional(start_index):
match_argument = self._match_argument
action_tuples = []
while True:

# if we found no optional action, skip it
if action is None:
extras.append(arg_strings[start_index])
Expand Down Expand Up @@ -882,7 +879,6 @@ def consume_positionals(start_index):
else:
max_option_string_index = -1
while start_index <= max_option_string_index:

# consume any Positionals preceding the next option
next_option_string_index = min(
[index for index in option_string_indices if index >= start_index]
Expand Down
1 change: 0 additions & 1 deletion src/snakeoil/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

def sorted_key_from_cmp(cmp_func, key_func=None):
class _key_proxy:

__slots__ = ("_obj",)

if key_func: # done this way for speed reasons.
Expand Down
14 changes: 0 additions & 14 deletions src/snakeoil/compression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def unpack(self, dest=None, **kwargs):


class _Tar(_Archive, ArComp):

exts = frozenset([".tar"])
binary = (
"gtar",
Expand Down Expand Up @@ -179,87 +178,74 @@ def _unpack_cmd(self):


class _TarGZ(_Tar):

exts = frozenset([".tar.gz", ".tgz", ".tar.Z", ".tar.z"])
compress_binary = (("pigz",), ("gzip",))


class _TarBZ2(_Tar):

exts = frozenset([".tar.bz2", ".tbz2", ".tbz"])
compress_binary = (("lbzip2",), ("pbzip2",), ("bzip2",))


class _TarLZMA(_Tar):

exts = frozenset([".tar.lzma"])
compress_binary = ("lzma",)


class _TarXZ(_Tar):

exts = frozenset([".tar.xz", ".txz"])
compress_binary = (("pixz",), ("xz", f"-T{multiprocessing.cpu_count()}"))


class _Zip(_Archive, ArComp):

exts = frozenset([".ZIP", ".zip", ".jar"])
binary = ("unzip",)
default_unpack_cmd = '{binary} -qo "{path}"'


class _GZ(_CompressedStdin, ArComp):

exts = frozenset([".gz", ".Z", ".z"])
binary = ("pigz", "gzip")
default_unpack_cmd = "{binary} -d -c"


class _BZ2(_CompressedStdin, ArComp):

exts = frozenset([".bz2", ".bz"])
binary = ("lbzip2", "pbzip2", "bzip2")
default_unpack_cmd = "{binary} -d -c"


class _XZ(_CompressedStdin, ArComp):

exts = frozenset([".xz"])
binary = ("pixz", "xz")
default_unpack_cmd = "{binary} -d -c"


class _7Z(_Archive, ArComp):

exts = frozenset([".7Z", ".7z"])
binary = ("7z",)
default_unpack_cmd = '{binary} x -y "{path}"'


class _Rar(_Archive, ArComp):

exts = frozenset([".RAR", ".rar"])
binary = ("unrar",)
default_unpack_cmd = '{binary} x -idq -o+ "{path}"'


class _LHA(_Archive, ArComp):

exts = frozenset([".LHa", ".LHA", ".lha", ".lzh"])
binary = ("lha",)
default_unpack_cmd = '{binary} xfq "{path}"'


class _Ar(_Archive, ArComp):

exts = frozenset([".a", ".deb"])
binary = ("ar",)
default_unpack_cmd = '{binary} x "{path}"'


class _LZMA(_CompressedFile, ArComp):

exts = frozenset([".lzma"])
binary = ("lzma",)
default_unpack_cmd = '{binary} -dc "{path}"'
1 change: 0 additions & 1 deletion src/snakeoil/compression/_bzip2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

native = True
except ImportError:

# We need this because if we are not native then TarFile.bz2open will fail
# (and some code needs to be able to check that).
native = False
Expand Down
1 change: 0 additions & 1 deletion src/snakeoil/compression/_xz.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

native = True
except ImportError:

# We need this because if we are not native then TarFile.open will fail
# (and some code needs to be able to check that).
native = False
Expand Down
3 changes: 1 addition & 2 deletions src/snakeoil/fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def touch(fname: str, mode: int = 0o644, dir_fd=None, **kwargs):
os.utime(
f.fileno() if os.utime in os.supports_fd else fname,
dir_fd=None if os.supports_fd else dir_fd,
**kwargs
**kwargs,
)


Expand Down Expand Up @@ -135,7 +135,6 @@ def __del__(self):


class AtomicWriteFile(AtomicWriteFile_mixin):

__doc__ = AtomicWriteFile_mixin.__doc__

def _actual_init(self):
Expand Down
2 changes: 0 additions & 2 deletions src/snakeoil/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ def __setattr__(self, key, value):
raise AttributeError(f"{self.__class__.__name__} instances are immutable")

class TerminfoMode(TerminfoCode):

__doc__ = TerminfoCode.__doc__
__slots__ = ()

Expand All @@ -416,7 +415,6 @@ def __call__(self, formatter: "TerminfoFormatter"):
formatter.stream.write(self.value)

class TerminfoReset(TerminfoCode):

__doc__ = TerminfoCode.__doc__
__slots__ = ()

Expand Down
3 changes: 0 additions & 3 deletions src/snakeoil/process/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def spawn(
cwd: Optional[str] = None,
pgid: Optional[int] = None,
):

"""wrapper around execve
:type mycommand: list or string
Expand Down Expand Up @@ -237,7 +236,6 @@ def spawn(
try:
# Otherwise we clean them up.
while mypids:

# Pull the last reader in the pipe chain. If all processes
# in the pipe are well behaved, it will die when the process
# it is reading from dies.
Expand Down Expand Up @@ -380,7 +378,6 @@ def spawn_get_output(
split_lines: bool = True,
**kwds,
):

"""Call spawn, collecting the output to fd's specified in collect_fds list.
:param spawn_type: the passed in function to call- typically :func:`spawn_bash`
Expand Down
1 change: 0 additions & 1 deletion src/snakeoil/tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def del_uname(self):

# add in a tweaked ExFileObject that is usable by snakeoil.data_source
class ExFileObject(tarfile.ExFileObject):

exceptions = (EnvironmentError,)


Expand Down
1 change: 0 additions & 1 deletion src/snakeoil/test/eq_hash_inheritance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Test(mixins.TargetedNamespaceWalker, mixins.KlassWalker):

target_namespace = "snakeoil"

singleton = object()
Expand Down
2 changes: 0 additions & 2 deletions src/snakeoil/test/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class PythonNamespaceWalker:

ignore_all_import_failures = False

valid_inits = frozenset(f"__init__.{x}" for x in ("py", "pyc", "pyo", "so"))
Expand Down Expand Up @@ -144,7 +143,6 @@ def load_namespaces(self, namespace=None):


class _classWalker:

cls_blacklist = frozenset()

def is_blacklisted(self, cls):
Expand Down
1 change: 0 additions & 1 deletion src/snakeoil/test/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class ExportedModules(mixins.PythonNamespaceWalker):

target_namespace = "snakeoil"

def test__all__accuracy(self):
Expand Down
1 change: 0 additions & 1 deletion src/snakeoil/test/slot_shadowing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class SlotShadowing(mixins.TargetedNamespaceWalker, mixins.SubclassWalker):

target_namespace = "snakeoil"
err_if_slots_is_str = True
err_if_slots_is_mutable = True
Expand Down
2 changes: 0 additions & 2 deletions tests/cli/test_arghparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def test_add_argument_docs(self):


class TestOptionalsParser:

# TODO: move this to a generic argparse fixture
@pytest.fixture(autouse=True)
def __setup_optionals_parser(self):
Expand Down Expand Up @@ -132,7 +131,6 @@ def test_optionals(self):


class TestCsvActionsParser:

# TODO: move this to a generic argparse fixture
@pytest.fixture(autouse=True)
def __setup_csv_actions_parser(self):
Expand Down
1 change: 0 additions & 1 deletion tests/compression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def mock_find_binary(name):


class Base:

module: str = ""
decompressed_test_data: bytes = b""
compressed_test_data: bytes = b""
Expand Down
1 change: 0 additions & 1 deletion tests/compression/test_bzip2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def test_missing_lbzip2_binary():


class Bzip2Base(Base):

module = "bzip2"
decompressed_test_data = b"Some text here\n"
compressed_test_data = (
Expand Down
1 change: 0 additions & 1 deletion tests/compression/test_xz.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def test_missing_xz_binary():


class XzBase(Base):

module = "xz"
decompressed_test_data = b"Some text here\n" * 2
compressed_test_data = (
Expand Down
1 change: 0 additions & 1 deletion tests/test_chksum_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def test_long2str(self):


class TestGetChksums(base):

chfs = [k for k in sorted(checksums) if k in ("md5", "sha1")]
expected_long = [checksums[k][0] for k in chfs]

Expand Down
1 change: 0 additions & 1 deletion tests/test_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def test_len(self):


class TestRefCountingSet:

kls = containers.RefCountingSet

def test_it(self):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_currying.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def documented():


class TestPreCurry:

pre_curry = staticmethod(currying.pre_curry)

def test_pre_curry(self):
Expand Down Expand Up @@ -54,7 +53,6 @@ class Test:


class Test_pretty_docs:

currying_targets = (currying.pre_curry, currying.post_curry)

def test_module_magic(self):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class TestDataSource:

supports_mutable = True

@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -144,7 +143,6 @@ def test_bytes_fileobj(self):


class Test_invokable_data_source(TestDataSource):

supports_mutable = False

def get_obj(self, data="foonani", mutable=False):
Expand All @@ -161,7 +159,6 @@ def _get_data(data, is_text=False):


class Test_invokable_data_source_wrapper_text(Test_invokable_data_source):

supports_mutable = False
text_mode = True

Expand All @@ -180,5 +177,4 @@ def _get_data(self, data="foonani"):


class Test_invokable_data_source_wrapper_bytes(Test_invokable_data_source_wrapper_text):

text_mode = False
1 change: 0 additions & 1 deletion tests/test_demandload_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class TestDemandLoadTargets(mixins.PythonNamespaceWalker):

target_namespace = "snakeoil"
ignore_all_import_failures = False

Expand Down
Loading

0 comments on commit 266d2c7

Please sign in to comment.