Skip to content

Commit cd755c1

Browse files
committed
fix!: Fix shadowing of python builtins
docs/conf.py:56:1: A001 Variable `copyright` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:333:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:346:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:359:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:372:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:385:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:397:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:449:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:463:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:477:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:492:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:506:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/_internal/subprocess.py:519:9: A002 Argument `input` is shadowing a Python builtin src/libvcs/cmd/git.py:86:9: A002 Argument `help` is shadowing a Python builtin src/libvcs/cmd/git.py:262:9: A002 Argument `all` is shadowing a Python builtin src/libvcs/cmd/git.py:316:13: A001 Variable `filter` is shadowing a Python builtin src/libvcs/cmd/git.py:401:9: A002 Argument `all` is shadowing a Python builtin src/libvcs/cmd/git.py:459:13: A001 Variable `filter` is shadowing a Python builtin src/libvcs/cmd/git.py:579:9: A002 Argument `exec` is shadowing a Python builtin src/libvcs/cmd/git.py:594:9: A002 Argument `quit` is shadowing a Python builtin src/libvcs/cmd/git.py:803:9: A002 Argument `all` is shadowing a Python builtin src/libvcs/cmd/git.py:942:13: A001 Variable `filter` is shadowing a Python builtin src/libvcs/cmd/git.py:1110:9: A002 Argument `all` is shadowing a Python builtin src/libvcs/cmd/git.py:1868:9: A002 Argument `all` is shadowing a Python builtin src/libvcs/cmd/git.py:2089:9: A002 Argument `hash` is shadowing a Python builtin src/libvcs/cmd/git.py:2326:13: A001 Variable `filter` is shadowing a Python builtin src/libvcs/cmd/git.py:2599:9: A002 Argument `all` is shadowing a Python builtin src/libvcs/cmd/git.py:2905:9: A002 Argument `all` is shadowing a Python builtin Found 28 errors.
1 parent 6b9eacb commit cd755c1

File tree

3 files changed

+36
-35
lines changed

3 files changed

+36
-35
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
master_doc = "index"
5454

5555
project = about["__title__"]
56-
copyright = about["__copyright__"]
56+
project_copyright = about["__copyright__"]
5757

5858
version = "%s" % (".".join(about["__version__"].split("."))[:2])
5959
release = "%s" % (about["__version__"])

src/libvcs/_internal/subprocess.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: NOQA: A002
12
r"""Invocable :mod:`subprocess` wrapper.
23
34
Defer running a subprocess, such as by handing to an executor.

src/libvcs/cmd/git.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def run(
8383
*,
8484
# Print-and-exit flags
8585
version: Optional[bool] = None,
86-
help: Optional[bool] = None,
86+
_help: Optional[bool] = None,
8787
html_path: Optional[bool] = None,
8888
man_path: Optional[bool] = None,
8989
info_path: Optional[bool] = None,
@@ -155,7 +155,7 @@ def run(
155155
``--man-path``
156156
info_path : bool
157157
``--info-path``
158-
help : bool
158+
_help : bool
159159
``-h / --help``
160160
pager : bool
161161
``-p --pager``
@@ -182,7 +182,7 @@ def run(
182182
#
183183
if version is True:
184184
cli_args.append("--version")
185-
if help is True:
185+
if _help is True:
186186
cli_args.append("--help")
187187
if html_path is True:
188188
cli_args.append("--html-path")
@@ -259,7 +259,7 @@ def clone(
259259
jobs: Optional[str] = None,
260260
force: Optional[bool] = None,
261261
local: Optional[bool] = None,
262-
all: Optional[bool] = None,
262+
_all: Optional[bool] = None,
263263
no_hardlinks: Optional[bool] = None,
264264
hardlinks: Optional[bool] = None,
265265
shared: Optional[bool] = None,
@@ -313,8 +313,8 @@ def clone(
313313
local_flags.append(f"--template={template}")
314314
if separate_git_dir is not None:
315315
local_flags.append(f"--separate-git-dir={separate_git_dir!r}")
316-
if (filter := kwargs.pop("filter", None)) is not None:
317-
local_flags.append(f"--filter={filter}")
316+
if (_filter := kwargs.pop("_filter", None)) is not None:
317+
local_flags.append(f"--filter={_filter}")
318318
if depth is not None:
319319
local_flags.extend(["--depth", str(depth)])
320320
if branch is not None:
@@ -398,7 +398,7 @@ def fetch(
398398
] = None,
399399
submodule_prefix: Optional[StrOrBytesPath] = None,
400400
#
401-
all: Optional[bool] = None,
401+
_all: Optional[bool] = None,
402402
force: Optional[bool] = None,
403403
keep: Optional[bool] = None,
404404
multiple: Optional[bool] = None,
@@ -456,8 +456,8 @@ def fetch(
456456

457457
if submodule_prefix is not None:
458458
local_flags.append(f"--submodule-prefix={submodule_prefix!r}")
459-
if (filter := kwargs.pop("filter", None)) is not None:
460-
local_flags.append(f"--filter={filter}")
459+
if (_filter := kwargs.pop("_filter", None)) is not None:
460+
local_flags.append(f"--filter={_filter}")
461461
if depth is not None:
462462
local_flags.extend(["--depth", depth])
463463
if branch is not None:
@@ -486,7 +486,7 @@ def fetch(
486486
local_flags.append("--progress")
487487
if verbose:
488488
local_flags.append("--verbose")
489-
if all:
489+
if _all:
490490
local_flags.append("--all")
491491
if atomic:
492492
local_flags.append("--atomic")
@@ -576,7 +576,7 @@ def rebase(
576576
keep_base: Optional[bool] = None,
577577
strategy: Optional[Union[str, bool]] = None,
578578
strategy_option: Optional[str] = None,
579-
exec: Optional[str] = None,
579+
_exec: Optional[str] = None,
580580
gpg_sign: Optional[Union[str, bool]] = None,
581581
no_gpg_sign: Optional[bool] = None,
582582
empty: Optional[Union[str, Literal["drop", "keep", "ask"]]] = None,
@@ -591,7 +591,7 @@ def rebase(
591591
skip: Optional[bool] = None,
592592
show_current_patch: Optional[bool] = None,
593593
abort: Optional[bool] = None,
594-
quit: Optional[bool] = None,
594+
_quit: Optional[bool] = None,
595595
# libvcs special behavior
596596
check_returncode: Optional[bool] = None,
597597
**kwargs: Any,
@@ -633,8 +633,8 @@ def rebase(
633633
if context:
634634
local_flags.extend(["--C", str(context)])
635635

636-
if exec:
637-
local_flags.extend(["--exec", shlex.quote(exec)])
636+
if _exec:
637+
local_flags.extend(["--exec", shlex.quote(_exec)])
638638
if reschedule_failed_exec:
639639
local_flags.append("--reschedule-failed-exec")
640640
if no_reschedule_failed_exec:
@@ -729,7 +729,7 @@ def rebase(
729729
local_flags.append("--edit-todo")
730730
if show_current_patch:
731731
local_flags.append("--show-current-patch")
732-
if quit:
732+
if _quit:
733733
local_flags.append("--quit")
734734

735735
return self.run(
@@ -800,7 +800,7 @@ def pull(
800800
#
801801
fetch: Optional[bool] = None,
802802
no_fetch: Optional[bool] = None,
803-
all: Optional[bool] = None,
803+
_all: Optional[bool] = None,
804804
force: Optional[bool] = None,
805805
keep: Optional[bool] = None,
806806
multiple: Optional[bool] = None,
@@ -939,8 +939,8 @@ def pull(
939939
#
940940
if submodule_prefix is not None:
941941
local_flags.append(f"--submodule-prefix={submodule_prefix!r}")
942-
if (filter := kwargs.pop("filter", None)) is not None:
943-
local_flags.append(f"--filter={filter}")
942+
if (_filter := kwargs.pop("_filter", None)) is not None:
943+
local_flags.append(f"--filter={_filter}")
944944
if depth is not None:
945945
local_flags.extend(["--depth", depth])
946946
if branch is not None:
@@ -969,7 +969,7 @@ def pull(
969969
local_flags.append("--progress")
970970
if verbose:
971971
local_flags.append("--verbose")
972-
if all:
972+
if _all:
973973
local_flags.append("--all")
974974
if atomic:
975975
local_flags.append("--atomic")
@@ -1107,7 +1107,7 @@ def init(
11071107
def help(
11081108
self,
11091109
*,
1110-
all: Optional[bool] = None,
1110+
_all: Optional[bool] = None,
11111111
verbose: Optional[bool] = None,
11121112
no_external_commands: Optional[bool] = None,
11131113
no_aliases: Optional[bool] = None,
@@ -1124,7 +1124,7 @@ def help(
11241124
11251125
Parameters
11261126
----------
1127-
all : bool
1127+
_all : bool
11281128
Prints everything.
11291129
11301130
no_external_commands : bool
@@ -1158,7 +1158,7 @@ def help(
11581158
>>> git.help()
11591159
"usage: git [...--version] [...--help] [-C <path>]..."
11601160
1161-
>>> git.help(all=True)
1161+
>>> git.help(_all=True)
11621162
"See 'git help <command>' to read about a specific subcommand..."
11631163
11641164
>>> git.help(info=True)
@@ -1171,7 +1171,7 @@ def help(
11711171

11721172
if verbose is True:
11731173
local_flags.append("--verbose")
1174-
if all is True:
1174+
if _all is True:
11751175
local_flags.append("--all")
11761176
if no_external_commands is True:
11771177
local_flags.append("--no-external-commands")
@@ -1865,7 +1865,7 @@ def rev_list(
18651865
first_parent: Optional[bool] = None,
18661866
exclude_first_parent_only: Optional[bool] = None,
18671867
_not: Optional[bool] = None,
1868-
all: Optional[bool] = None,
1868+
_all: Optional[bool] = None,
18691869
branches: Optional[Union[str, bool]] = None,
18701870
tags: Optional[Union[str, bool]] = None,
18711871
remotes: Optional[Union[str, bool]] = None,
@@ -1923,7 +1923,7 @@ def rev_list(
19231923
>>> git.rev_list(commit="HEAD", path=".", max_count=1, header=True)
19241924
''
19251925
1926-
>>> git.rev_list(commit="origin..HEAD", max_count=1, all=True, header=True)
1926+
>>> git.rev_list(commit="origin..HEAD", max_count=1, _all=True, header=True)
19271927
''
19281928
19291929
>>> git.rev_list(commit="origin..HEAD", max_count=1, header=True)
@@ -2086,7 +2086,7 @@ def show_ref(
20862086
head: Optional[bool] = None,
20872087
dereference: Optional[bool] = None,
20882088
tags: Optional[bool] = None,
2089-
hash: Optional[Union[str, bool]] = None,
2089+
_hash: Optional[Union[str, bool]] = None,
20902090
abbrev: Optional[Union[str, bool]] = None,
20912091
# libvcs special behavior
20922092
check_returncode: Optional[bool] = None,
@@ -2126,7 +2126,7 @@ def show_ref(
21262126
pattern_flags.extend(pattern)
21272127

21282128
for kwarg, kwarg_shell_flag in [
2129-
(hash, "--hash"),
2129+
(_hash, "--hash"),
21302130
(abbrev, "--abbrev"),
21312131
]:
21322132
if kwarg is not None:
@@ -2323,8 +2323,8 @@ def update(
23232323
local_flags.append("--rebase")
23242324
elif merge is True:
23252325
local_flags.append("--merge")
2326-
if (filter := kwargs.pop("filter", None)) is not None:
2327-
local_flags.append(f"--filter={filter}")
2326+
if (_filter := kwargs.pop("_filter", None)) is not None:
2327+
local_flags.append(f"--filter={_filter}")
23282328

23292329
return self.run(
23302330
"update",
@@ -2596,7 +2596,7 @@ def get_url(
25962596
*,
25972597
name: str,
25982598
push: Optional[bool] = None,
2599-
all: Optional[bool] = None,
2599+
_all: Optional[bool] = None,
26002600
# Pass-through to run()
26012601
log_in_real_time: bool = False,
26022602
check_returncode: Optional[bool] = None,
@@ -2612,15 +2612,15 @@ def get_url(
26122612
>>> GitRemoteCmd(path=git_local_clone.path).get_url(name='origin', push=True)
26132613
'file:///...'
26142614
2615-
>>> GitRemoteCmd(path=git_local_clone.path).get_url(name='origin', all=True)
2615+
>>> GitRemoteCmd(path=git_local_clone.path).get_url(name='origin', _all=True)
26162616
'file:///...'
26172617
"""
26182618
local_flags: list[str] = []
26192619
required_flags: list[str] = [name]
26202620

26212621
if push:
26222622
local_flags.append("--push")
2623-
if all:
2623+
if _all:
26242624
local_flags.append("--all")
26252625

26262626
return self.run(
@@ -2902,7 +2902,7 @@ def save(
29022902
keep_index: Optional[int] = None,
29032903
patch: Optional[bool] = None,
29042904
include_untracked: Optional[bool] = None,
2905-
all: Optional[bool] = None,
2905+
_all: Optional[bool] = None,
29062906
quiet: Optional[bool] = None,
29072907
# Pass-through to run()
29082908
log_in_real_time: bool = False,
@@ -2922,7 +2922,7 @@ def save(
29222922
local_flags: list[str] = []
29232923
stash_flags: list[str] = []
29242924

2925-
if all is True:
2925+
if _all is True:
29262926
local_flags.append("--all")
29272927
if staged is True:
29282928
local_flags.append("--staged")

0 commit comments

Comments
 (0)