diff options
author | Brian Harring <ferringb@gmail.com> | 2022-12-24 13:14:53 -0800 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-12-25 19:49:11 +0200 |
commit | d6a7c2e44b4f497357f8569d423104232a58f384 (patch) | |
tree | 625ac52169356714a9f5e69e11f2b6cc2d72355a /src/snakeoil/strings.py | |
parent | compression: prefer gtar over tar if available (diff) | |
download | snakeoil-d6a7c2e44b4f497357f8569d423104232a58f384.tar.gz snakeoil-d6a7c2e44b4f497357f8569d423104232a58f384.tar.bz2 snakeoil-d6a7c2e44b4f497357f8569d423104232a58f384.zip |
Reformat w/ black 22.12.0 for consistency.
Signed-off-by: Brian Harring <ferringb@gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src/snakeoil/strings.py')
-rw-r--r-- | src/snakeoil/strings.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/snakeoil/strings.py b/src/snakeoil/strings.py index 7d7b2a8..d0dc58a 100644 --- a/src/snakeoil/strings.py +++ b/src/snakeoil/strings.py @@ -2,10 +2,10 @@ from .demandload import demand_compile_regexp -demand_compile_regexp('_whitespace_regex', r'^(?P<indent>\s+)') +demand_compile_regexp("_whitespace_regex", r"^(?P<indent>\s+)") -def pluralism(obj, none=None, singular='', plural='s'): +def pluralism(obj, none=None, singular="", plural="s"): """Return singular or plural suffix depending on object's length or value.""" # default to plural for empty objects, e.g. there are 0 repos if none is None: @@ -27,16 +27,16 @@ def pluralism(obj, none=None, singular='', plural='s'): def doc_dedent(s): """Support dedenting docstrings with initial line having no indentation.""" try: - lines = s.split('\n') + lines = s.split("\n") except AttributeError: - raise TypeError(f'{s!r} is not a string') + raise TypeError(f"{s!r} is not a string") if lines: # find first line with an indent if one exists for line in lines: if mo := _whitespace_regex.match(line): - indent = mo.group('indent') + indent = mo.group("indent") break else: - indent = '' + indent = "" len_i = len(indent) - return '\n'.join(x[len_i:] if x.startswith(indent) else x for x in lines) + return "\n".join(x[len_i:] if x.startswith(indent) else x for x in lines) |