Skip to content

Commit

Permalink
pipx run black --line-length=100 .
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonrecursion committed Feb 8, 2022
1 parent b4d3385 commit 015cf83
Show file tree
Hide file tree
Showing 56 changed files with 654 additions and 1,975 deletions.
6 changes: 1 addition & 5 deletions conftest.py
Expand Up @@ -37,11 +37,7 @@ def clean_env(tmpdir_factory, monkeypatch):
monkeypatch.setenv("XDG_CONFIG_HOME", str(tmpdir_factory.mktemp("xdg-config-home")))
monkeypatch.setenv("XDG_CACHE_HOME", str(tmpdir_factory.mktemp("xdg-cache-home")))
# also avoid to use anything from the outside environment:
keys = [
key
for key in os.environ
if key.startswith("BORG_") and key not in ("BORG_FUSE_IMPL",)
]
keys = [key for key in os.environ if key.startswith("BORG_") and key not in ("BORG_FUSE_IMPL",)]
for key in keys:
monkeypatch.delenv(key, raising=False)

Expand Down
4 changes: 1 addition & 3 deletions docs/conf.py
Expand Up @@ -41,9 +41,7 @@

# General information about the project.
project = "Borg - Deduplicating Archiver"
copyright = (
"2010-2014 Jonas Borgström, 2015-2022 The Borg Collective (see AUTHORS file)"
)
copyright = "2010-2014 Jonas Borgström, 2015-2022 The Borg Collective (see AUTHORS file)"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
4 changes: 1 addition & 3 deletions scripts/glibc_check.py
Expand Up @@ -36,9 +36,7 @@ def main():
objdump % filename, shell=True, stderr=subprocess.STDOUT
)
output = output.decode()
versions = set(
parse_version(match.group(1)) for match in glibc_re.finditer(output)
)
versions = set(parse_version(match.group(1)) for match in glibc_re.finditer(output))
requires_glibc = max(versions)
overall_versions.add(requires_glibc)
if verbose:
Expand Down
4 changes: 1 addition & 3 deletions scripts/py36-blake2.py
Expand Up @@ -20,9 +20,7 @@ def test_b2(b2_input, b2_output):


test_b2(
bytes.fromhex(
"037fb9b75b20d623f1d5a568050fccde4a1b7c5f5047432925e941a17c7a2d0d7061796c6f6164"
),
bytes.fromhex("037fb9b75b20d623f1d5a568050fccde4a1b7c5f5047432925e941a17c7a2d0d7061796c6f6164"),
bytes.fromhex("a22d4fc81bb61c3846c334a09eaf28d22dd7df08c9a7a41e713ef28d80eebd45"),
)

Expand Down
15 changes: 4 additions & 11 deletions setup.py
Expand Up @@ -205,9 +205,7 @@ def members_appended(*ds):

checksums_ext_kwargs = members_appended(
dict(sources=[checksums_source]),
setup_checksums.xxhash_ext_kwargs(
pc, prefer_system_libxxhash, system_prefix_libxxhash
),
setup_checksums.xxhash_ext_kwargs(pc, prefer_system_libxxhash, system_prefix_libxxhash),
)

ext_modules += [
Expand All @@ -220,12 +218,8 @@ def members_appended(*ds):
]

posix_ext = Extension("borg.platform.posix", [platform_posix_source])
linux_ext = Extension(
"borg.platform.linux", [platform_linux_source], libraries=["acl"]
)
syncfilerange_ext = Extension(
"borg.platform.syncfilerange", [platform_syncfilerange_source]
)
linux_ext = Extension("borg.platform.linux", [platform_linux_source], libraries=["acl"])
syncfilerange_ext = Extension("borg.platform.syncfilerange", [platform_syncfilerange_source])
freebsd_ext = Extension("borg.platform.freebsd", [platform_freebsd_source])
darwin_ext = Extension("borg.platform.darwin", [platform_darwin_source])
windows_ext = Extension("borg.platform.windows", [platform_windows_source])
Expand All @@ -246,8 +240,7 @@ def members_appended(*ds):
# this breaks chained commands like 'clean sdist'
cythonizing = (
len(sys.argv) > 1
and sys.argv[1]
not in (("clean", "clean2", "egg_info", "--help-commands", "--version"))
and sys.argv[1] not in (("clean", "clean2", "egg_info", "--help-commands", "--version"))
and "--help" not in sys.argv[1:]
)

Expand Down
4 changes: 1 addition & 3 deletions setup_compress.py
Expand Up @@ -72,9 +72,7 @@ def multi_join(paths, *path_segments):
]


def zstd_ext_kwargs(
pc, prefer_system, system_prefix, multithreaded=False, legacy=False
):
def zstd_ext_kwargs(pc, prefer_system, system_prefix, multithreaded=False, legacy=False):
if prefer_system:
if system_prefix:
print("Detected and preferring libzstd [via BORG_LIBZSTD_PREFIX]")
Expand Down
4 changes: 1 addition & 3 deletions setup_crypto.py
Expand Up @@ -31,6 +31,4 @@ def crypto_ext_kwargs(pc, system_prefix):
print("Detected OpenSSL [via pkg-config]")
return pc.parse("libcrypto")

raise Exception(
"Could not find OpenSSL lib/headers, please set BORG_OPENSSL_PREFIX"
)
raise Exception("Could not find OpenSSL lib/headers, please set BORG_OPENSSL_PREFIX")
51 changes: 14 additions & 37 deletions setup_docs.py
Expand Up @@ -19,13 +19,11 @@ def long_desc_from_readme():
assert start >= 0
long_description = "\n" + long_description[start:]
# remove badges
long_description = re.compile(
r"^\.\. start-badges.*^\.\. end-badges", re.M | re.S
).sub("", long_description)
# remove unknown directives
long_description = re.compile(r"^\.\. highlight:: \w+$", re.M).sub(
long_description = re.compile(r"^\.\. start-badges.*^\.\. end-badges", re.M | re.S).sub(
"", long_description
)
# remove unknown directives
long_description = re.compile(r"^\.\. highlight:: \w+$", re.M).sub("", long_description)
return long_description


Expand All @@ -38,8 +36,7 @@ def format_metavar(option):
return option.metavar
else:
raise ValueError(
"Can't format metavar %s, unknown nargs %s!"
% (option.metavar, option.nargs)
"Can't format metavar %s, unknown nargs %s!" % (option.metavar, option.nargs)
)


Expand Down Expand Up @@ -77,9 +74,7 @@ def generate_level(self, prefix, parser, Archiver, extra_choices=None):
is_subcommand = False
choices = {}
for action in parser._actions:
if action.choices is not None and "SubParsersAction" in str(
action.__class__
):
if action.choices is not None and "SubParsersAction" in str(action.__class__):
is_subcommand = True
for cmd, parser in action.choices.items():
choices[prefix + cmd] = parser
Expand Down Expand Up @@ -165,9 +160,7 @@ def html_write(s):
for group in parser._action_groups:
if group.title == "Common options":
# (no of columns used, columns, ...)
rows.append(
(1, ".. class:: borg-common-opt-ref\n\n:ref:`common_options`")
)
rows.append((1, ".. class:: borg-common-opt-ref\n\n:ref:`common_options`"))
else:
if not group._group_actions:
continue
Expand All @@ -177,21 +170,15 @@ def html_write(s):
rows.append((1, group_header))
if is_positional_group(group):
for option in group._group_actions:
rows.append(
(3, "", "``%s``" % option.metavar, option.help or "")
)
rows.append((3, "", "``%s``" % option.metavar, option.help or ""))
else:
for option in group._group_actions:
if option.metavar:
option_fmt = "``%s " + option.metavar + "``"
else:
option_fmt = "``%s``"
option_str = ", ".join(
option_fmt % s for s in option.option_strings
)
option_desc = textwrap.dedent(
(option.help or "") % option.__dict__
)
option_str = ", ".join(option_fmt % s for s in option.option_strings)
option_desc = textwrap.dedent((option.help or "") % option.__dict__)
rows.append((3, "", option_str, option_desc))

fp.write(".. only:: html\n\n")
Expand Down Expand Up @@ -393,9 +380,7 @@ def generate_level(self, prefix, parser, Archiver, extra_choices=None):
is_subcommand = False
choices = {}
for action in parser._actions:
if action.choices is not None and "SubParsersAction" in str(
action.__class__
):
if action.choices is not None and "SubParsersAction" in str(action.__class__):
is_subcommand = True
for cmd, parser in action.choices.items():
choices[prefix + cmd] = parser
Expand Down Expand Up @@ -428,9 +413,7 @@ def generate_level(self, prefix, parser, Archiver, extra_choices=None):
][0]
for subcommand in subparsers.choices:
write("| borg", "[common options]", command, subcommand, "...")
self.see_also.setdefault(command, []).append(
"%s-%s" % (command, subcommand)
)
self.see_also.setdefault(command, []).append("%s-%s" % (command, subcommand))
else:
if command == "borgfs":
write(command, end="")
Expand Down Expand Up @@ -499,9 +482,7 @@ def build_intro_page(self):
with open("docs/man_intro.rst") as fd:
man_intro = fd.read()

self.write_man_header(
write, man_title, "deduplicating and encrypting backup tool"
)
self.write_man_header(write, man_title, "deduplicating and encrypting backup tool")
self.gen_man_page(man_title, doc.getvalue() + man_intro)

def new_doc(self):
Expand Down Expand Up @@ -551,9 +532,7 @@ def write_examples(self, write, command):
examples = examples.replace(
"``docs/misc/prune-example.txt``:", "``docs/misc/prune-example.txt``."
)
examples = examples.replace(
".. highlight:: none\n", ""
) # we don't support highlight
examples = examples.replace(".. highlight:: none\n", "") # we don't support highlight
examples = re.sub(
"^(~+)$",
lambda matches: "+" * len(matches.group(0)),
Expand Down Expand Up @@ -602,9 +581,7 @@ def write_options(self, write, parser):
for group in parser._action_groups:
if group.title == "Common options" or not group._group_actions:
continue
title = (
"arguments" if group.title == "positional arguments" else group.title
)
title = "arguments" if group.title == "positional arguments" else group.title
self.write_heading(write, title, "+")
self.write_options_group(write, group)

Expand Down

0 comments on commit 015cf83

Please sign in to comment.