Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6b51eda

Browse filesBrowse files
committed
refactor!(ruff): Run all automated fixes as of ruff 0.3.4
ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; ruff format . Fixed 206 errors: - conftest.py: 1 × PIE790 (unnecessary-placeholder) - docs/conf.py: 1 × RET505 (superfluous-else-return) - src/libvcs/__init__.py: 1 × RUF022 (unsorted-dunder-all) - src/libvcs/_internal/query_list.py: 3 × RSE102 (unnecessary-paren-on-raise-exception) 2 × ANN204 (missing-return-type-special-method) 1 × T201 (print) 1 × PLR5501 (collapsible-else-if) 1 × RET505 (superfluous-else-return) 1 × RET506 (superfluous-else-raise) 1 × F841 (unused-variable) - src/libvcs/_internal/run.py: 1 × TID252 (relative-imports) 1 × I001 (unsorted-imports) - src/libvcs/_internal/shortcuts.py: 3 × RET505 (superfluous-else-return) 3 × ANN204 (missing-return-type-special-method) 2 × COM812 (missing-trailing-comma) 1 × PLR6201 (literal-membership) - src/libvcs/_internal/subprocess.py: 1 × ANN204 (missing-return-type-special-method) - src/libvcs/cmd/git.py: 1 × PLR5501 (collapsible-else-if) 1 × PLR2044 (empty-comment) 1 × RET505 (superfluous-else-return) - src/libvcs/cmd/svn.py: 1 × RSE102 (unnecessary-paren-on-raise-exception) 1 × ANN204 (missing-return-type-special-method) - src/libvcs/pytest_plugin.py: 12 × PT001 (pytest-fixture-incorrect-parentheses-style) 3 × PT003 (pytest-extraneous-scope-function) 1 × ANN204 (missing-return-type-special-method) 1 × E303 (too-many-blank-lines) 1 × PT025 (pytest-erroneous-use-fixtures-on-fixture) 1 × RET504 (unnecessary-assign) 1 × SIM103 (needless-bool) - src/libvcs/sync/base.py: 1 × F841 (unused-variable) 1 × RET504 (unnecessary-assign) 1 × E303 (too-many-blank-lines) - src/libvcs/sync/git.py: 5 × ANN204 (missing-return-type-special-method) 1 × TID252 (relative-imports) 1 × RET505 (superfluous-else-return) 1 × I001 (unsorted-imports) 1 × PLR5501 (collapsible-else-if) 1 × E303 (too-many-blank-lines) 1 × PLR1714 (repeated-equality-comparison) 1 × RSE102 (unnecessary-paren-on-raise-exception) 1 × PIE804 (unnecessary-dict-kwargs) 1 × F841 (unused-variable) 1 × PLR6201 (literal-membership) 1 × RET504 (unnecessary-assign) - src/libvcs/sync/svn.py: 1 × FURB167 (regex-flag-alias) 1 × ANN204 (missing-return-type-special-method) 1 × PIE810 (multiple-starts-ends-with) - src/libvcs/url/base.py: 1 × ANN204 (missing-return-type-special-method) - src/libvcs/url/registry.py: 1 × ANN204 (missing-return-type-special-method) - src/libvcs/url/svn.py: 2 × PLR2044 (empty-comment) - tests/_internal/subprocess/test_SubprocessCommand.py: 9 × PT007 (pytest-parametrize-values-wrong-type) 6 × PT006 (pytest-parametrize-names-wrong-type) 1 × PLW1510 (subprocess-run-without-check) - tests/_internal/test_query_list.py: 38 × PT007 (pytest-parametrize-values-wrong-type) 1 × PT006 (pytest-parametrize-names-wrong-type) - tests/sync/test_git.py: 38 × PT007 (pytest-parametrize-values-wrong-type) 12 × PT006 (pytest-parametrize-names-wrong-type) 10 × PIE804 (unnecessary-dict-kwargs) 1 × COM812 (missing-trailing-comma) - tests/test_shortcuts.py: 1 × PT006 (pytest-parametrize-names-wrong-type) - tests/url/test_git.py: 4 × PT006 (pytest-parametrize-names-wrong-type) - tests/url/test_hg.py: 3 × PT006 (pytest-parametrize-names-wrong-type) 1 × PT014 (pytest-duplicate-parametrize-test-cases) - tests/url/test_registry.py: 1 × FURB148 (unnecessary-enumerate) - tests/url/test_svn.py: 3 × PT006 (pytest-parametrize-names-wrong-type) 1 × PT014 (pytest-duplicate-parametrize-test-cases)
1 parent 7720bbc commit 6b51eda
Copy full SHA for 6b51eda
Expand file treeCollapse file tree

24 files changed

+307
-354
lines changed

‎conftest.py

Copy file name to clipboardExpand all lines: conftest.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ def setup(
4242
set_home: pathlib.Path,
4343
) -> None:
4444
"""Configure test fixtures for pytest."""
45-
pass

‎docs/conf.py

Copy file name to clipboardExpand all lines: docs/conf.py
+8-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,14 @@ def linkcode_resolve(domain: str, info: dict[str, str]) -> t.Union[None, str]:
209209
fn,
210210
linespec,
211211
)
212-
else:
213-
return "{}/blob/v{}/{}/{}/{}{}".format(
214-
about["__github__"],
215-
about["__version__"],
216-
"src",
217-
about["__package_name__"],
218-
fn,
219-
linespec,
220-
)
212+
return "{}/blob/v{}/{}/{}/{}{}".format(
213+
about["__github__"],
214+
about["__version__"],
215+
"src",
216+
about["__package_name__"],
217+
fn,
218+
linespec,
219+
)
221220

222221

223222
def remove_tabs_js(app: "Sphinx", exc: Exception) -> None:

‎src/libvcs/__init__.py

Copy file name to clipboardExpand all lines: src/libvcs/__init__.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
from .sync.svn import SvnSync
1010

1111
__all__ = [
12+
"BaseSync",
13+
"CmdLoggingAdapter",
1214
"GitSync",
1315
"HgSync",
1416
"SvnSync",
15-
"BaseSync",
16-
"CmdLoggingAdapter",
1717
]
1818

1919
logger = logging.getLogger(__name__)

‎src/libvcs/_internal/query_list.py

Copy file name to clipboardExpand all lines: src/libvcs/_internal/query_list.py
+10-13Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ def keygetter(
8484
dct = dct[sub_field]
8585
elif hasattr(dct, sub_field):
8686
dct = getattr(dct, sub_field)
87-
except Exception as e:
87+
except Exception:
8888
traceback.print_stack()
89-
print(f"Above error was {e}")
9089
return None
9190
return dct
9291

@@ -304,12 +303,12 @@ def lookup_iregex(
304303

305304

306305
class PKRequiredException(Exception):
307-
def __init__(self, *args: object):
306+
def __init__(self, *args: object) -> None:
308307
return super().__init__("items() require a pk_key exists")
309308

310309

311310
class OpNotFound(ValueError):
312-
def __init__(self, op: str, *args: object):
311+
def __init__(self, op: str, *args: object) -> None:
313312
return super().__init__(f"{op} not in LOOKUP_NAME_MAP")
314313

315314

@@ -470,7 +469,7 @@ def __init__(self, items: t.Optional["Iterable[T]"] = None) -> None:
470469

471470
def items(self) -> list[tuple[str, T]]:
472471
if self.pk_key is None:
473-
raise PKRequiredException()
472+
raise PKRequiredException
474473
return [(getattr(item, self.pk_key), item) for item in self]
475474

476475
def __eq__(
@@ -490,9 +489,8 @@ def __eq__(
490489
for key in a_keys:
491490
if abs(a[key] - b[key]) > 1:
492491
return False
493-
else:
494-
if a != b:
495-
return False
492+
elif a != b:
493+
return False
496494

497495
return True
498496
return False
@@ -529,8 +527,7 @@ def filter_lookup(obj: t.Any) -> bool:
529527
def val_match(obj: t.Union[str, list[t.Any], T]) -> bool:
530528
if isinstance(matcher, list):
531529
return obj in matcher
532-
else:
533-
return bool(obj == matcher)
530+
return bool(obj == matcher)
534531

535532
_filter = val_match
536533
else:
@@ -546,9 +543,9 @@ def get(
546543
) -> t.Optional[T]:
547544
objs = self.filter(matcher=matcher, **kwargs)
548545
if len(objs) > 1:
549-
raise MultipleObjectsReturned()
550-
elif len(objs) == 0:
546+
raise MultipleObjectsReturned
547+
if len(objs) == 0:
551548
if default == no_arg:
552-
raise ObjectDoesNotExist()
549+
raise ObjectDoesNotExist
553550
return default
554551
return objs[0]

‎src/libvcs/_internal/run.py

Copy file name to clipboardExpand all lines: src/libvcs/_internal/run.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
from collections.abc import Iterable, Mapping, MutableMapping, Sequence
1616
from typing import IO, TYPE_CHECKING, Any, AnyStr, Callable, Optional, Protocol, Union
1717

18+
from libvcs import exc
1819
from libvcs._internal.types import StrOrBytesPath
1920

20-
from .. import exc
21-
2221
logger = logging.getLogger(__name__)
2322

2423
console_encoding = sys.__stdout__.encoding

‎src/libvcs/_internal/shortcuts.py

Copy file name to clipboardExpand all lines: src/libvcs/_internal/shortcuts.py
+15-10Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919

2020

2121
class VCSNoMatchFoundForUrl(exc.LibVCSException):
22-
def __init__(self, url: str, *args: object):
22+
def __init__(self, url: str, *args: object) -> None:
2323
return super().__init__(f"No VCS found for url: {url}")
2424

2525

2626
class VCSMultipleMatchFoundForUrl(exc.LibVCSException):
27-
def __init__(self, url: str, *args: object):
27+
def __init__(self, url: str, *args: object) -> None:
2828
return super().__init__(f"Multiple VCS found for url: {url}")
2929

3030

3131
class VCSNotSupported(exc.LibVCSException):
32-
def __init__(self, url: str, vcs: str, *args: object):
32+
def __init__(self, url: str, vcs: str, *args: object) -> None:
3333
return super().__init__(f"VCS '{vcs}' not supported, based on URL: {url}")
3434

3535

@@ -110,7 +110,7 @@ def create_project(
110110
assert vcs_matches[0].vcs is not None
111111

112112
def is_vcs(val: t.Any) -> "TypeGuard[VCSLiteral]":
113-
return isinstance(val, str) and val in ["git", "hg", "svn"]
113+
return isinstance(val, str) and val in {"git", "hg", "svn"}
114114

115115
if is_vcs(vcs_matches[0].vcs):
116116
vcs = vcs_matches[0].vcs
@@ -119,13 +119,18 @@ def is_vcs(val: t.Any) -> "TypeGuard[VCSLiteral]":
119119

120120
if vcs == "git":
121121
return GitSync(
122-
url=url, path=path, progress_callback=progress_callback, **kwargs
122+
url=url,
123+
path=path,
124+
progress_callback=progress_callback,
125+
**kwargs,
123126
)
124-
elif vcs == "hg":
127+
if vcs == "hg":
125128
return HgSync(url=url, path=path, progress_callback=progress_callback, **kwargs)
126-
elif vcs == "svn":
129+
if vcs == "svn":
127130
return SvnSync(
128-
url=url, path=path, progress_callback=progress_callback, **kwargs
131+
url=url,
132+
path=path,
133+
progress_callback=progress_callback,
134+
**kwargs,
129135
)
130-
else:
131-
raise InvalidVCS("VCS %s is not a valid VCS" % vcs)
136+
raise InvalidVCS("VCS %s is not a valid VCS" % vcs)

‎src/libvcs/_internal/subprocess.py

Copy file name to clipboardExpand all lines: src/libvcs/_internal/subprocess.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868

6969
class SubprocessCheckOutputError(Exception):
70-
def __init__(self, output: str, *args: object):
70+
def __init__(self, output: str, *args: object) -> None:
7171
return super().__init__(f"output is not str or bytes: {output}")
7272

7373

‎src/libvcs/cmd/git.py

Copy file name to clipboardExpand all lines: src/libvcs/cmd/git.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def run(
206206
def stringify(v: Any) -> str:
207207
if isinstance(v, bool):
208208
return "true" if True else "false"
209-
elif not isinstance(v, str):
209+
if not isinstance(v, str):
210210
return str(v)
211211
return v
212212

@@ -398,7 +398,6 @@ def fetch(
398398
Union[bool, Literal["yes", "on-demand"]]
399399
] = None,
400400
submodule_prefix: Optional[StrOrBytesPath] = None,
401-
#
402401
_all: Optional[bool] = None,
403402
force: Optional[bool] = None,
404403
keep: Optional[bool] = None,
@@ -1821,9 +1820,8 @@ def rev_parse(
18211820
if parseopt is True:
18221821
if args is not None:
18231822
local_flags.extend(["--", args])
1824-
else:
1825-
if args is not None:
1826-
local_flags.append(args)
1823+
elif args is not None:
1824+
local_flags.append(args)
18271825

18281826
return self.run(
18291827
["rev-parse", *local_flags],

‎src/libvcs/cmd/svn.py

Copy file name to clipboardExpand all lines: src/libvcs/cmd/svn.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class SvnPropsetValueOrValuePathRequired(exc.LibVCSException, TypeError):
2626
"""Raised when required parameters are not passed."""
2727

28-
def __init__(self, *args: object):
28+
def __init__(self, *args: object) -> None:
2929
return super().__init__("Must enter a value or value_path")
3030

3131

@@ -783,7 +783,7 @@ def propset(
783783
elif isinstance(value_path, pathlib.Path):
784784
local_flags.extend(["--file", str(pathlib.Path(value_path).absolute())])
785785
else:
786-
raise SvnPropsetValueOrValuePathRequired()
786+
raise SvnPropsetValueOrValuePathRequired
787787

788788
if path is not None:
789789
if isinstance(path, (str, pathlib.Path)):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.