Skip to content

Commit abd3bc8

Browse files
committed
ruff . --select COM --fix
1 parent f7f61ed commit abd3bc8

24 files changed

+84
-84
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"sidebar/navigation.html",
9898
"sidebar/projects.html",
9999
"sidebar/scroll-end.html",
100-
]
100+
],
101101
}
102102

103103
# linkify_issues

src/libvcs/_internal/module_loading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ def import_string(import_name: str, silent: bool = False) -> t.Any:
108108
except ImportError as e:
109109
if not silent:
110110
raise ImportStringError(import_name, e).with_traceback(
111-
sys.exc_info()[2]
111+
sys.exc_info()[2],
112112
) from None
113113
return None

src/libvcs/_internal/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, bin_name: str, keyword: str, *args: Any, **kwargs: Any) -> No
6565
logging.LoggerAdapter.__init__(self, *args, **kwargs)
6666

6767
def process(
68-
self, msg: str, kwargs: MutableMapping[str, Any]
68+
self, msg: str, kwargs: MutableMapping[str, Any],
6969
) -> tuple[Any, MutableMapping[str, Any]]:
7070
"""Add additional context information for loggers."""
7171
prefixed_dict = {}
@@ -89,7 +89,7 @@ def __call__(self, output: AnyStr, timestamp: datetime.datetime) -> None:
8989
_ENV: "TypeAlias" = Mapping[str, str]
9090
else:
9191
_ENV: "TypeAlias" = Union[
92-
Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]
92+
Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath],
9393
]
9494

9595
_CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]]

src/libvcs/_internal/subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, output: str, *args: object):
7373
_ENV: "TypeAlias" = Mapping[str, str]
7474
else:
7575
_ENV: "TypeAlias" = Union[
76-
Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]
76+
Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath],
7777
]
7878
_FILE: "TypeAlias" = Union[None, int, IO[Any]]
7979
_TXT: "TypeAlias" = Union[bytes, str]

src/libvcs/_internal/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
""":class:`os.PathLike` or :class:`str`"""
1717

1818
StrOrBytesPath: "TypeAlias" = Union[
19-
str, bytes, PathLike[str], PathLike[bytes] # stable
19+
str, bytes, PathLike[str], PathLike[bytes], # stable
2020
]
2121
""":class:`os.PathLike`, :class:`str` or :term:`bytes-like object`"""
2222

src/libvcs/cmd/git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ def rebase(
733733
local_flags.append("--quit")
734734

735735
return self.run(
736-
["rebase", *local_flags, *required_flags], check_returncode=check_returncode
736+
["rebase", *local_flags, *required_flags], check_returncode=check_returncode,
737737
)
738738

739739
def pull(

src/libvcs/pytest_plugin.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,26 @@ class MaxUniqueRepoAttemptsExceeded(exc.LibVCSException):
2525
def __init__(self, attempts: int, *args: object):
2626
"""Raise LibVCSException exception with message including attempts tried."""
2727
return super().__init__(
28-
f"Could not find unused repo destination (attempts: {attempts})"
28+
f"Could not find unused repo destination (attempts: {attempts})",
2929
)
3030

3131

3232
skip_if_git_missing = pytest.mark.skipif(
33-
not shutil.which("git"), reason="git is not available"
33+
not shutil.which("git"), reason="git is not available",
3434
)
3535
skip_if_svn_missing = pytest.mark.skipif(
36-
not shutil.which("svn"), reason="svn is not available"
36+
not shutil.which("svn"), reason="svn is not available",
3737
)
3838
skip_if_hg_missing = pytest.mark.skipif(
39-
not shutil.which("hg"), reason="hg is not available"
39+
not shutil.which("hg"), reason="hg is not available",
4040
)
4141

4242

4343
class RandomStrSequence:
4444
"""Create a random string sequence."""
4545

4646
def __init__(
47-
self, characters: str = "abcdefghijklmnopqrstuvwxyz0123456789_"
47+
self, characters: str = "abcdefghijklmnopqrstuvwxyz0123456789_",
4848
) -> None:
4949
self.characters: str = characters
5050

@@ -119,7 +119,7 @@ def gitconfig(user_path: pathlib.Path, set_home: pathlib.Path) -> pathlib.Path:
119119
name = {getpass.getuser()}
120120
[color]
121121
diff = auto
122-
"""
122+
""",
123123
),
124124
encoding="utf-8",
125125
)
@@ -132,7 +132,7 @@ def gitconfig(user_path: pathlib.Path, set_home: pathlib.Path) -> pathlib.Path:
132132
"--show-origin",
133133
"--get",
134134
"user.email",
135-
]
135+
],
136136
)
137137
assert str(gitconfig) in used_config_file_output
138138
assert user_email in output, "Should use our fixture config and home directory"
@@ -154,7 +154,7 @@ def hgconfig(user_path: pathlib.Path, set_home: pathlib.Path) -> pathlib.Path:
154154
155155
[trusted]
156156
users = {getpass.getuser()}
157-
"""
157+
""",
158158
),
159159
encoding="utf-8",
160160
)
@@ -163,7 +163,7 @@ def hgconfig(user_path: pathlib.Path, set_home: pathlib.Path) -> pathlib.Path:
163163

164164
@pytest.fixture(scope="function")
165165
def projects_path(
166-
user_path: pathlib.Path, request: pytest.FixtureRequest
166+
user_path: pathlib.Path, request: pytest.FixtureRequest,
167167
) -> pathlib.Path:
168168
"""User's local checkouts and clones. Emphemeral directory."""
169169
dir = user_path / "projects"
@@ -178,7 +178,7 @@ def clean() -> None:
178178

179179
@pytest.fixture(scope="function")
180180
def remote_repos_path(
181-
user_path: pathlib.Path, request: pytest.FixtureRequest
181+
user_path: pathlib.Path, request: pytest.FixtureRequest,
182182
) -> pathlib.Path:
183183
"""System's remote (file-based) repos to clone andpush to. Emphemeral directory."""
184184
dir = user_path / "remote_repos"
@@ -330,7 +330,7 @@ def svn_remote_repo_single_commit_post_init(remote_repo_path: pathlib.Path) -> N
330330
str(remote_repo_path),
331331
"<",
332332
str(repo_dumpfile),
333-
]
333+
],
334334
),
335335
shell=True,
336336
)
@@ -431,7 +431,7 @@ def fn(
431431
@pytest.fixture
432432
@skip_if_hg_missing
433433
def hg_remote_repo(
434-
remote_repos_path: pathlib.Path, hgconfig: pathlib.Path
434+
remote_repos_path: pathlib.Path, hgconfig: pathlib.Path,
435435
) -> pathlib.Path:
436436
"""Pre-made, file-based repo for push and pull."""
437437
return _create_hg_remote_repo(
@@ -452,7 +452,7 @@ def git_repo(projects_path: pathlib.Path, git_remote_repo: pathlib.Path) -> GitS
452452
name="origin",
453453
push_url=f"file://{git_remote_repo}",
454454
fetch_url=f"file://{git_remote_repo}",
455-
)
455+
),
456456
},
457457
)
458458
git_repo.obtain()

src/libvcs/sync/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(
118118

119119
#: Logging attribute
120120
self.log: CmdLoggingAdapter = CmdLoggingAdapter(
121-
bin_name=self.bin_name, keyword=self.repo_name, logger=logger, extra={}
121+
bin_name=self.bin_name, keyword=self.repo_name, logger=logger, extra={},
122122
)
123123

124124
@property
@@ -190,7 +190,7 @@ def ensure_dir(self, *args: Any, **kwargs: Any) -> bool:
190190

191191
if not self.dir.exists():
192192
self.log.debug(
193-
f"Project directory for {self.repo_name} does not exist @ {self.dir}"
193+
f"Project directory for {self.repo_name} does not exist @ {self.dir}",
194194
)
195195
self.dir.mkdir(parents=True)
196196

src/libvcs/sync/git.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class GitStatusParsingException(exc.LibVCSException):
3939

4040
def __init__(self, git_status_output: str, *args: object):
4141
return super().__init__(
42-
"Could not find match for git-status(1)" + f"Output: {git_status_output}"
42+
"Could not find match for git-status(1)" + f"Output: {git_status_output}",
4343
)
4444

4545

@@ -70,7 +70,7 @@ class GitRemoteRefNotFound(exc.CommandError):
7070
def __init__(self, git_tag: str, ref_output: str, *args: object):
7171
return super().__init__(
7272
f"Could not fetch remote in refs/remotes/{git_tag}:"
73-
+ f"Output: {ref_output}"
73+
+ f"Output: {ref_output}",
7474
)
7575

7676

@@ -174,8 +174,8 @@ def convert_pip_url(pip_url: str) -> VCSLocation:
174174
raise exc.LibVCSException(
175175
"Repo {} is malformatted, please use the convention {} for "
176176
"ssh / private GitHub repositories.".format(
177-
pip_url, "git+https://github.com/username/repo.git"
178-
)
177+
pip_url, "git+https://github.com/username/repo.git",
178+
),
179179
)
180180
else:
181181
url, rev = base_convert_pip_url(pip_url)
@@ -192,7 +192,7 @@ class GitSync(BaseSync):
192192
_remotes: GitSyncRemoteDict
193193

194194
def __init__(
195-
self, *, url: str, dir: StrPath, remotes: GitRemotesArgs = None, **kwargs: Any
195+
self, *, url: str, dir: StrPath, remotes: GitRemotesArgs = None, **kwargs: Any,
196196
) -> None:
197197
"""Local git repository.
198198
@@ -248,7 +248,7 @@ def __init__(
248248

249249
if remotes is None:
250250
self._remotes: GitSyncRemoteDict = {
251-
"origin": GitRemote(name="origin", fetch_url=url, push_url=url)
251+
"origin": GitRemote(name="origin", fetch_url=url, push_url=url),
252252
}
253253
elif isinstance(remotes, dict):
254254
self._remotes = {}
@@ -265,7 +265,7 @@ def __init__(
265265
"fetch_url": remote_url["fetch_url"],
266266
"push_url": remote_url["push_url"],
267267
"name": remote_name,
268-
}
268+
},
269269
)
270270
elif isinstance(remote_url, GitRemote):
271271
self._remotes[remote_name] = remote_url
@@ -396,7 +396,7 @@ def update_repo(self, set_remotes: bool = False, *args: Any, **kwargs: Any) -> N
396396
# Get head sha
397397
try:
398398
head_sha = self.cmd.rev_list(
399-
commit="HEAD", max_count=1, check_returncode=True
399+
commit="HEAD", max_count=1, check_returncode=True,
400400
)
401401
except exc.CommandError:
402402
self.log.exception("Failed to get the hash for HEAD")
@@ -496,7 +496,7 @@ def update_repo(self, set_remotes: bool = False, *args: Any, **kwargs: Any) -> N
496496

497497
self.log.exception(
498498
"\nFailed to rebase in: '%s'.\n"
499-
"You will have to resolve the conflicts manually" % self.dir
499+
"You will have to resolve the conflicts manually" % self.dir,
500500
)
501501
return
502502

@@ -515,7 +515,7 @@ def update_repo(self, set_remotes: bool = False, *args: Any, **kwargs: Any) -> N
515515
self.log.exception(
516516
f"\nFailed to rebase in: '{self.dir}'.\n"
517517
+ "You will have to resolve the "
518-
+ "conflicts manually"
518+
+ "conflicts manually",
519519
)
520520
return
521521

@@ -565,22 +565,22 @@ def remote(self, name: str, **kwargs: Any) -> Optional[GitRemote]:
565565
"""
566566
try:
567567
ret = self.cmd.remote.show(
568-
name=name, no_query_remotes=True, log_in_real_time=True
568+
name=name, no_query_remotes=True, log_in_real_time=True,
569569
)
570570
lines = ret.split("\n")
571571
remote_fetch_url = lines[1].replace("Fetch URL: ", "").strip()
572572
remote_push_url = lines[2].replace("Push URL: ", "").strip()
573573
if remote_fetch_url != name and remote_push_url != name:
574574
return GitRemote(
575-
name=name, fetch_url=remote_fetch_url, push_url=remote_push_url
575+
name=name, fetch_url=remote_fetch_url, push_url=remote_push_url,
576576
)
577577
else:
578578
return None
579579
except exc.LibVCSException:
580580
return None
581581

582582
def set_remote(
583-
self, name: str, url: str, push: bool = False, overwrite: bool = False
583+
self, name: str, url: str, push: bool = False, overwrite: bool = False,
584584
) -> GitRemote:
585585
"""Set remote with name and URL like git remote add.
586586
@@ -670,7 +670,7 @@ def status(self) -> GitStatus:
670670
)
671671
"""
672672
return GitStatus.from_stdout(
673-
self.cmd.status(short=True, branch=True, porcelain="2")
673+
self.cmd.status(short=True, branch=True, porcelain="2"),
674674
)
675675

676676
def get_current_remote_name(self) -> str:

src/libvcs/sync/svn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def get_revision(self, location: Optional[str] = None) -> int:
141141
return revision
142142

143143
def update_repo(
144-
self, dest: Optional[str] = None, *args: Any, **kwargs: Any
144+
self, dest: Optional[str] = None, *args: Any, **kwargs: Any,
145145
) -> None:
146146
"""Fetch changes from SVN repository to local working copy."""
147147
self.ensure_dir()
@@ -193,7 +193,7 @@ def _get_svn_url_rev(cls, location: str) -> tuple[Optional[str], int]:
193193
# is being used to prompt for passwords, because passwords
194194
# are only potentially needed for remote server requests.
195195
xml = Svn(dir=pathlib.Path(location).parent).info(
196-
target=pathlib.Path(location), xml=True
196+
target=pathlib.Path(location), xml=True,
197197
)
198198
match = _svn_info_xml_url_re.search(xml)
199199
assert match is not None

0 commit comments

Comments
 (0)