diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-03-24 13:53:55 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-03-24 13:53:55 +0300 |
commit | 266d2c7b8b975ccc6361eb47bcab7e73b578a1f6 (patch) | |
tree | f2e765d51bcaa34a5d1d4e7ce93f1e0805a324d1 | |
parent | start work on 0.10.6 (diff) | |
download | snakeoil-266d2c7b8b975ccc6361eb47bcab7e73b578a1f6.tar.gz snakeoil-266d2c7b8b975ccc6361eb47bcab7e73b578a1f6.tar.bz2 snakeoil-266d2c7b8b975ccc6361eb47bcab7e73b578a1f6.zip |
Reformat with black 23.1.0
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
30 files changed, 2 insertions, 70 deletions
diff --git a/src/snakeoil/chksum/__init__.py b/src/snakeoil/chksum/__init__.py index 5bd6a7c..bc6bef2 100644 --- a/src/snakeoil/chksum/__init__.py +++ b/src/snakeoil/chksum/__init__.py @@ -18,7 +18,6 @@ class MissingChksumHandler(Exception): def get_handler(requested): - """ get a chksum handler @@ -34,7 +33,6 @@ def get_handler(requested): def get_handlers(requested=None): - """ get multiple chksum handlers @@ -55,7 +53,6 @@ def get_handlers(requested=None): def init(additional_handlers=None): - """ init the chksum subsystem. diff --git a/src/snakeoil/cli/arghparse.py b/src/snakeoil/cli/arghparse.py index a1d1c0b..ab458c8 100644 --- a/src/snakeoil/cli/arghparse.py +++ b/src/snakeoil/cli/arghparse.py @@ -726,7 +726,6 @@ class OptionalsParser(argparse.ArgumentParser): 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("-") @@ -773,7 +772,6 @@ class OptionalsParser(argparse.ArgumentParser): # 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 @@ -783,7 +781,6 @@ class OptionalsParser(argparse.ArgumentParser): 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]) @@ -882,7 +879,6 @@ class OptionalsParser(argparse.ArgumentParser): 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] diff --git a/src/snakeoil/compatibility.py b/src/snakeoil/compatibility.py index 4fee417..a602efe 100644 --- a/src/snakeoil/compatibility.py +++ b/src/snakeoil/compatibility.py @@ -7,7 +7,6 @@ __all__ = ("cmp", "sorted_cmp", "sort_cmp") def sorted_key_from_cmp(cmp_func, key_func=None): class _key_proxy: - __slots__ = ("_obj",) if key_func: # done this way for speed reasons. diff --git a/src/snakeoil/compression/__init__.py b/src/snakeoil/compression/__init__.py index 9eee103..96dd75f 100644 --- a/src/snakeoil/compression/__init__.py +++ b/src/snakeoil/compression/__init__.py @@ -148,7 +148,6 @@ class _CompressedStdin: class _Tar(_Archive, ArComp): - exts = frozenset([".tar"]) binary = ( "gtar", @@ -179,87 +178,74 @@ class _Tar(_Archive, ArComp): 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}"' diff --git a/src/snakeoil/compression/_bzip2.py b/src/snakeoil/compression/_bzip2.py index 122debd..77c121b 100644 --- a/src/snakeoil/compression/_bzip2.py +++ b/src/snakeoil/compression/_bzip2.py @@ -28,7 +28,6 @@ try: 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 diff --git a/src/snakeoil/compression/_xz.py b/src/snakeoil/compression/_xz.py index 9a91a4c..0f13046 100644 --- a/src/snakeoil/compression/_xz.py +++ b/src/snakeoil/compression/_xz.py @@ -32,7 +32,6 @@ try: 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 diff --git a/src/snakeoil/fileutils.py b/src/snakeoil/fileutils.py index 743ef2d..02355a8 100644 --- a/src/snakeoil/fileutils.py +++ b/src/snakeoil/fileutils.py @@ -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, ) @@ -135,7 +135,6 @@ class AtomicWriteFile_mixin: class AtomicWriteFile(AtomicWriteFile_mixin): - __doc__ = AtomicWriteFile_mixin.__doc__ def _actual_init(self): diff --git a/src/snakeoil/formatters.py b/src/snakeoil/formatters.py index 151778c..0f65209 100644 --- a/src/snakeoil/formatters.py +++ b/src/snakeoil/formatters.py @@ -407,7 +407,6 @@ else: raise AttributeError(f"{self.__class__.__name__} instances are immutable") class TerminfoMode(TerminfoCode): - __doc__ = TerminfoCode.__doc__ __slots__ = () @@ -416,7 +415,6 @@ else: formatter.stream.write(self.value) class TerminfoReset(TerminfoCode): - __doc__ = TerminfoCode.__doc__ __slots__ = () diff --git a/src/snakeoil/process/spawn.py b/src/snakeoil/process/spawn.py index 2709598..9908c8d 100644 --- a/src/snakeoil/process/spawn.py +++ b/src/snakeoil/process/spawn.py @@ -176,7 +176,6 @@ def spawn( cwd: Optional[str] = None, pgid: Optional[int] = None, ): - """wrapper around execve :type mycommand: list or string @@ -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. @@ -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` diff --git a/src/snakeoil/tar.py b/src/snakeoil/tar.py index 74061a5..6f74ef2 100644 --- a/src/snakeoil/tar.py +++ b/src/snakeoil/tar.py @@ -110,7 +110,6 @@ class TarInfo(tarfile.TarInfo): # add in a tweaked ExFileObject that is usable by snakeoil.data_source class ExFileObject(tarfile.ExFileObject): - exceptions = (EnvironmentError,) diff --git a/src/snakeoil/test/eq_hash_inheritance.py b/src/snakeoil/test/eq_hash_inheritance.py index eaa42a3..98c6468 100644 --- a/src/snakeoil/test/eq_hash_inheritance.py +++ b/src/snakeoil/test/eq_hash_inheritance.py @@ -2,7 +2,6 @@ from . import mixins class Test(mixins.TargetedNamespaceWalker, mixins.KlassWalker): - target_namespace = "snakeoil" singleton = object() diff --git a/src/snakeoil/test/mixins.py b/src/snakeoil/test/mixins.py index 0648de1..eb8dae1 100644 --- a/src/snakeoil/test/mixins.py +++ b/src/snakeoil/test/mixins.py @@ -8,7 +8,6 @@ from ..compatibility import IGNORED_EXCEPTIONS class PythonNamespaceWalker: - ignore_all_import_failures = False valid_inits = frozenset(f"__init__.{x}" for x in ("py", "pyc", "pyo", "so")) @@ -144,7 +143,6 @@ class TargetedNamespaceWalker(PythonNamespaceWalker): class _classWalker: - cls_blacklist = frozenset() def is_blacklisted(self, cls): diff --git a/src/snakeoil/test/modules.py b/src/snakeoil/test/modules.py index 0ae116b..3758960 100644 --- a/src/snakeoil/test/modules.py +++ b/src/snakeoil/test/modules.py @@ -2,7 +2,6 @@ from . import mixins class ExportedModules(mixins.PythonNamespaceWalker): - target_namespace = "snakeoil" def test__all__accuracy(self): diff --git a/src/snakeoil/test/slot_shadowing.py b/src/snakeoil/test/slot_shadowing.py index fac6619..abb8e09 100644 --- a/src/snakeoil/test/slot_shadowing.py +++ b/src/snakeoil/test/slot_shadowing.py @@ -4,7 +4,6 @@ from . import mixins class SlotShadowing(mixins.TargetedNamespaceWalker, mixins.SubclassWalker): - target_namespace = "snakeoil" err_if_slots_is_str = True err_if_slots_is_mutable = True diff --git a/tests/cli/test_arghparse.py b/tests/cli/test_arghparse.py index 4741d86..d0db449 100644 --- a/tests/cli/test_arghparse.py +++ b/tests/cli/test_arghparse.py @@ -68,7 +68,6 @@ class TestArgparseDocs: class TestOptionalsParser: - # TODO: move this to a generic argparse fixture @pytest.fixture(autouse=True) def __setup_optionals_parser(self): @@ -132,7 +131,6 @@ class TestOptionalsParser: class TestCsvActionsParser: - # TODO: move this to a generic argparse fixture @pytest.fixture(autouse=True) def __setup_csv_actions_parser(self): diff --git a/tests/compression/__init__.py b/tests/compression/__init__.py index 0bf26d0..61ab9cc 100644 --- a/tests/compression/__init__.py +++ b/tests/compression/__init__.py @@ -15,7 +15,6 @@ def hide_binary(*binaries: str): class Base: - module: str = "" decompressed_test_data: bytes = b"" compressed_test_data: bytes = b"" diff --git a/tests/compression/test_bzip2.py b/tests/compression/test_bzip2.py index 9fdffd9..8af917a 100644 --- a/tests/compression/test_bzip2.py +++ b/tests/compression/test_bzip2.py @@ -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 = ( diff --git a/tests/compression/test_xz.py b/tests/compression/test_xz.py index 0af7c64..a666bbe 100644 --- a/tests/compression/test_xz.py +++ b/tests/compression/test_xz.py @@ -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 = ( diff --git a/tests/test_chksum_defaults.py b/tests/test_chksum_defaults.py index a22d339..1b847da 100644 --- a/tests/test_chksum_defaults.py +++ b/tests/test_chksum_defaults.py @@ -114,7 +114,6 @@ del chf_type, expected class TestGetChksums(base): - chfs = [k for k in sorted(checksums) if k in ("md5", "sha1")] expected_long = [checksums[k][0] for k in chfs] diff --git a/tests/test_containers.py b/tests/test_containers.py index 9df3258..03709c2 100644 --- a/tests/test_containers.py +++ b/tests/test_containers.py @@ -244,7 +244,6 @@ class TestProtectedSet: class TestRefCountingSet: - kls = containers.RefCountingSet def test_it(self): diff --git a/tests/test_currying.py b/tests/test_currying.py index 7f8618f..eff2146 100644 --- a/tests/test_currying.py +++ b/tests/test_currying.py @@ -14,7 +14,6 @@ def documented(): class TestPreCurry: - pre_curry = staticmethod(currying.pre_curry) def test_pre_curry(self): @@ -54,7 +53,6 @@ class TestPreCurry: class Test_pretty_docs: - currying_targets = (currying.pre_curry, currying.post_curry) def test_module_magic(self): diff --git a/tests/test_data_source.py b/tests/test_data_source.py index 1ede9aa..b528e42 100644 --- a/tests/test_data_source.py +++ b/tests/test_data_source.py @@ -5,7 +5,6 @@ from snakeoil import compression, data_source class TestDataSource: - supports_mutable = True @pytest.fixture(autouse=True) @@ -144,7 +143,6 @@ class TestBz2Source(TestDataSource): class Test_invokable_data_source(TestDataSource): - supports_mutable = False def get_obj(self, data="foonani", mutable=False): @@ -161,7 +159,6 @@ class Test_invokable_data_source(TestDataSource): class Test_invokable_data_source_wrapper_text(Test_invokable_data_source): - supports_mutable = False text_mode = True @@ -180,5 +177,4 @@ class Test_invokable_data_source_wrapper_text(Test_invokable_data_source): class Test_invokable_data_source_wrapper_bytes(Test_invokable_data_source_wrapper_text): - text_mode = False diff --git a/tests/test_demandload_usage.py b/tests/test_demandload_usage.py index ddde056..437094c 100644 --- a/tests/test_demandload_usage.py +++ b/tests/test_demandload_usage.py @@ -3,7 +3,6 @@ from snakeoil.test import mixins class TestDemandLoadTargets(mixins.PythonNamespaceWalker): - target_namespace = "snakeoil" ignore_all_import_failures = False diff --git a/tests/test_fileutils.py b/tests/test_fileutils.py index de8a1f7..f339b9b 100644 --- a/tests/test_fileutils.py +++ b/tests/test_fileutils.py @@ -65,7 +65,6 @@ class TestTouch: class TestAtomicWriteFile: - kls = AtomicWriteFile def test_normal_ops(self, tmp_path): @@ -273,7 +272,6 @@ for case in ("ascii", "bytes", "utf8"): class TestBrokenStats: - test_cases = ["/proc/crypto", "/sys/devices/system/cpu/present"] def test_readfile(self): @@ -303,7 +301,6 @@ class TestBrokenStats: class Test_mmap_or_open_for_read: - func = staticmethod(fileutils.mmap_or_open_for_read) def test_zero_length(self, tmp_path): diff --git a/tests/test_formatters.py b/tests/test_formatters.py index 549f2ad..515511c 100644 --- a/tests/test_formatters.py +++ b/tests/test_formatters.py @@ -13,7 +13,6 @@ issue7567 = protect_process class TestPlainTextFormatter: - kls = staticmethod(formatters.PlainTextFormatter) def test_basics(self): diff --git a/tests/test_klass.py b/tests/test_klass.py index 25728fa..5c30a2a 100644 --- a/tests/test_klass.py +++ b/tests/test_klass.py @@ -137,7 +137,6 @@ class Test_get: class Test_chained_getter: - kls = klass.chained_getter def test_hash(self): @@ -178,7 +177,6 @@ class Test_chained_getter: class Test_jit_attr: - kls = staticmethod(klass._internal_jit_attr) @property @@ -201,7 +199,6 @@ class Test_jit_attr: func=None, singleton=klass._uncached_singleton, ): - f = func if not func: @@ -435,7 +432,6 @@ class Test_jit_attr: class Test_aliased_attr: - func = staticmethod(klass.alias_attr) def test_it(self): @@ -561,7 +557,6 @@ class TestImmutableInstance: class TestAliasMethod: - func = staticmethod(klass.alias_method) def test_alias_method(self): diff --git a/tests/test_mappings.py b/tests/test_mappings.py index 1ffe780..1e1b865 100644 --- a/tests/test_mappings.py +++ b/tests/test_mappings.py @@ -112,6 +112,7 @@ class LazyValDictTestMixin: def test_getkey(self): assert self.dict[3] == -3 + # missing key def get(): return self.dict[42] @@ -402,7 +403,6 @@ class TestOrderedSet(TestOrderedFrozenSet): class TestStackedDict: - orig_dict = dict.fromkeys(range(100)) new_dict = dict.fromkeys(range(100, 200)) @@ -564,7 +564,6 @@ class TestFoldingDict: class Testdefaultdictkey: - kls = mappings.defaultdictkey def test_it(self): @@ -577,7 +576,6 @@ class Testdefaultdictkey: class Test_attr_to_item_mapping: - kls = mappings.AttrAccessible inject = staticmethod(mappings.inject_getitem_as_getattr) @@ -612,7 +610,6 @@ class Test_attr_to_item_mapping: class Test_ProxiedAttrs: - kls = mappings.ProxiedAttrs def test_it(self): @@ -648,7 +645,6 @@ class Test_ProxiedAttrs: class TestSlottedDict: - kls = staticmethod(mappings.make_SlottedDict_kls) def test_exceptions(self): diff --git a/tests/test_osutils.py b/tests/test_osutils.py index a60bb15..82959fe 100644 --- a/tests/test_osutils.py +++ b/tests/test_osutils.py @@ -207,7 +207,6 @@ class TestAbsSymlink: class Test_Native_NormPath: - func = staticmethod(osutils.normpath) def test_normpath(self): @@ -245,7 +244,6 @@ class Test_Native_NormPath: @pytest.mark.skipif(os.getuid() != 0, reason="these tests must be ran as root") class TestAccess: - func = staticmethod(osutils.fallback_access) def test_fallback(self, tmp_path): @@ -261,7 +259,6 @@ class TestAccess: class Test_unlink_if_exists: - func = staticmethod(osutils.unlink_if_exists) def test_it(self, tmp_path): diff --git a/tests/test_process.py b/tests/test_process.py index 488b7b0..0447b54 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -7,7 +7,6 @@ from snakeoil import process class TestFindBinary: - script = "findpath-test.sh" @pytest.fixture(autouse=True) diff --git a/tests/test_stringio.py b/tests/test_stringio.py index 1e6d1e5..30c9c8d 100644 --- a/tests/test_stringio.py +++ b/tests/test_stringio.py @@ -6,7 +6,6 @@ from snakeoil import stringio class readonly_mixin: - encoding = None kls = None |