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

Sign up
Appearance settings

Commit 1e1becb

Browse files
committed
style: Apply ruff formatting to entire codebase
1 parent bd0d83f commit 1e1becb

File tree

6 files changed

+41
-32
lines changed

6 files changed

+41
-32
lines changed

‎src/vcspull/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def create_parser(
102102
def cli(_args: list[str] | None = None) -> None:
103103
"""CLI entry point for vcspull."""
104104
parser, subparsers = create_parser(return_subparsers=True)
105-
sync_parser, add_parser, add_from_fs_parser = subparsers
105+
sync_parser, _add_parser, _add_from_fs_parser = subparsers
106106
args = parser.parse_args(_args)
107107

108108
setup_logger(log=log, level=args.log_level.upper())

‎src/vcspull/cli/add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def add_repo(
172172
f"{Fore.CYAN}'{name}'{Style.RESET_ALL} "
173173
f"({Fore.YELLOW}{url}{Style.RESET_ALL}) to "
174174
f"{Fore.BLUE}{config_file_path}{Style.RESET_ALL} under "
175-
f"'{Fore.MAGENTA}{base_dir_key}{Style.RESET_ALL}'."
175+
f"'{Fore.MAGENTA}{base_dir_key}{Style.RESET_ALL}'.",
176176
)
177177
except Exception:
178178
log.exception(f"Error saving config to {config_file_path}")

‎src/vcspull/cli/add_from_fs.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def add_from_filesystem(
116116
log.info(
117117
f"{Fore.CYAN}i{Style.RESET_ALL} No config specified and no default "
118118
f"home config, will use/create "
119-
f"{Fore.BLUE}{config_file_path}{Style.RESET_ALL}"
119+
f"{Fore.BLUE}{config_file_path}{Style.RESET_ALL}",
120120
)
121121
elif len(home_configs) > 1:
122122
log.error(
@@ -148,7 +148,7 @@ def add_from_filesystem(
148148
log.info(
149149
f"{Fore.CYAN}i{Style.RESET_ALL} Config file "
150150
f"{Fore.BLUE}{config_file_path}{Style.RESET_ALL} "
151-
f"not found. A new one will be created."
151+
f"not found. A new one will be created.",
152152
)
153153

154154
found_repos: list[
@@ -224,7 +224,7 @@ def add_from_filesystem(
224224
if not found_repos:
225225
log.info(
226226
f"{Fore.YELLOW}!{Style.RESET_ALL} No git repositories found in "
227-
f"{Fore.BLUE}{scan_dir}{Style.RESET_ALL}. Nothing to add."
227+
f"{Fore.BLUE}{scan_dir}{Style.RESET_ALL}. Nothing to add.",
228228
)
229229
return
230230

@@ -244,47 +244,47 @@ def add_from_filesystem(
244244
log.info(
245245
f"{Fore.YELLOW}!{Style.RESET_ALL} Found "
246246
f"{Fore.CYAN}{len(existing_repos)}{Style.RESET_ALL} "
247-
f"existing repositories already in configuration."
247+
f"existing repositories already in configuration.",
248248
)
249249
else:
250250
# Show details only for small numbers
251251
log.info(
252252
f"{Fore.YELLOW}!{Style.RESET_ALL} Found "
253253
f"{Fore.CYAN}{len(existing_repos)}{Style.RESET_ALL} "
254-
f"existing repositories in configuration:"
254+
f"existing repositories in configuration:",
255255
)
256256
for name, url, key in existing_repos:
257257
log.info(
258258
f" {Fore.BLUE}{Style.RESET_ALL} "
259259
f"{Fore.CYAN}{name}{Style.RESET_ALL} "
260260
f"({Fore.YELLOW}{url}{Style.RESET_ALL}) at "
261261
f"{Fore.MAGENTA}{key}{name}{Style.RESET_ALL} "
262-
f"in {Fore.BLUE}{config_file_path}{Style.RESET_ALL}"
262+
f"in {Fore.BLUE}{config_file_path}{Style.RESET_ALL}",
263263
)
264264

265265
if not repos_to_add:
266266
if existing_repos:
267267
log.info(
268268
f"{Fore.GREEN}{Style.RESET_ALL} All found repositories already exist "
269-
f"in the configuration. {Fore.GREEN}Nothing to do.{Style.RESET_ALL}"
269+
f"in the configuration. {Fore.GREEN}Nothing to do.{Style.RESET_ALL}",
270270
)
271271
return
272272

273273
# Show what will be added
274274
log.info(
275275
f"\n{Fore.GREEN}Found {len(repos_to_add)} new "
276276
f"{'repository' if len(repos_to_add) == 1 else 'repositories'} "
277-
f"to add:{Style.RESET_ALL}"
277+
f"to add:{Style.RESET_ALL}",
278278
)
279279
for repo_name, repo_url, _determined_base_key in repos_to_add:
280280
log.info(
281281
f" {Fore.GREEN}+{Style.RESET_ALL} {Fore.CYAN}{repo_name}{Style.RESET_ALL} "
282-
f"({Fore.YELLOW}{repo_url}{Style.RESET_ALL})"
282+
f"({Fore.YELLOW}{repo_url}{Style.RESET_ALL})",
283283
)
284284

285285
if not yes:
286286
confirm = input(
287-
f"\n{Fore.CYAN}Add these repositories? [y/N]: {Style.RESET_ALL}"
287+
f"\n{Fore.CYAN}Add these repositories? [y/N]: {Style.RESET_ALL}",
288288
).lower()
289289
if confirm not in {"y", "yes"}:
290290
log.info(f"{Fore.RED}{Style.RESET_ALL} Aborted by user.")
@@ -307,7 +307,7 @@ def add_from_filesystem(
307307
f"{Fore.GREEN}+{Style.RESET_ALL} Adding "
308308
f"{Fore.CYAN}'{repo_name}'{Style.RESET_ALL} "
309309
f"({Fore.YELLOW}{repo_url}{Style.RESET_ALL}) under "
310-
f"'{Fore.MAGENTA}{determined_base_key}{Style.RESET_ALL}'."
310+
f"'{Fore.MAGENTA}{determined_base_key}{Style.RESET_ALL}'.",
311311
)
312312
changes_made = True
313313

@@ -316,7 +316,7 @@ def add_from_filesystem(
316316
save_config_yaml(config_file_path, raw_config)
317317
log.info(
318318
f"{Fore.GREEN}{Style.RESET_ALL} Successfully updated "
319-
f"{Fore.BLUE}{config_file_path}{Style.RESET_ALL}."
319+
f"{Fore.BLUE}{config_file_path}{Style.RESET_ALL}.",
320320
)
321321
except Exception:
322322
log.exception(f"Error saving config to {config_file_path}")
@@ -327,5 +327,5 @@ def add_from_filesystem(
327327
raise
328328
else:
329329
log.info(
330-
f"{Fore.GREEN}{Style.RESET_ALL} No changes made to the configuration."
330+
f"{Fore.GREEN}{Style.RESET_ALL} No changes made to the configuration.",
331331
)

‎tests/cli/test_add.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
from __future__ import annotations
44

5-
import pathlib
65
import typing as t
76

87
import yaml
98

109
from vcspull.cli.add import add_repo
1110

1211
if t.TYPE_CHECKING:
12+
import pathlib
13+
1314
from _pytest.logging import LogCaptureFixture
1415

1516

@@ -44,7 +45,7 @@ def test_add_simple_repo(
4445
assert "./" in config_data
4546
assert "myproject" in config_data["./"]
4647
assert config_data["./"]["myproject"] == {
47-
"repo": "git@github.com:user/myproject.git"
48+
"repo": "git@github.com:user/myproject.git",
4849
}
4950

5051
# Check success message
@@ -75,7 +76,7 @@ def test_add_with_custom_base_dir(
7576

7677
assert "~/projects/libs/" in config_data
7778
assert config_data["~/projects/libs/"]["mylib"] == {
78-
"repo": "https://github.com/org/mylib"
79+
"repo": "https://github.com/org/mylib",
7980
}
8081

8182
def test_add_duplicate_repo(
@@ -90,7 +91,7 @@ def test_add_duplicate_repo(
9091

9192
# Pre-create config with existing repo
9293
existing_config = {
93-
"~/code/": {"existing": {"repo": "git@github.com:user/existing.git"}}
94+
"~/code/": {"existing": {"repo": "git@github.com:user/existing.git"}},
9495
}
9596
with config_file.open("w") as f:
9697
yaml.dump(existing_config, f)
@@ -128,7 +129,7 @@ def test_add_to_existing_config(
128129

129130
# Pre-create config with some repos
130131
existing_config = {
131-
"~/work/": {"project1": {"repo": "git@github.com:user/project1.git"}}
132+
"~/work/": {"project1": {"repo": "git@github.com:user/project1.git"}},
132133
}
133134
with config_file.open("w") as f:
134135
yaml.dump(existing_config, f)
@@ -149,5 +150,5 @@ def test_add_to_existing_config(
149150
assert "project1" in config_data["~/work/"]
150151
assert "project2" in config_data["~/work/"]
151152
assert config_data["~/work/"]["project2"] == {
152-
"repo": "git@github.com:user/project2.git"
153+
"repo": "git@github.com:user/project2.git",
153154
}

‎tests/cli/test_add_from_fs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
from __future__ import annotations
44

5-
import pathlib
65
import subprocess
76
import typing as t
87

9-
import pytest
108
import yaml
11-
from libvcs.pytest_plugin import CreateRepoPytestFixtureFn
129

1310
from vcspull.cli.add_from_fs import add_from_filesystem, get_git_origin_url
1411
from vcspull.config import save_config_yaml
1512

1613
if t.TYPE_CHECKING:
14+
import pathlib
15+
16+
import pytest
1717
from _pytest.logging import LogCaptureFixture
18+
from libvcs.pytest_plugin import CreateRepoPytestFixtureFn
1819

1920

2021
class TestGetGitOriginUrl:
@@ -165,7 +166,7 @@ def test_multiple_repos_recursive(
165166
(scan_dir, "repo1"),
166167
(scan_dir, "repo2"),
167168
(subdir, "nested_repo"),
168-
]
169+
],
169170
):
170171
remote_path = create_git_remote_repo()
171172
remote_url = f"file://{remote_path}"

‎tests/test_log.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ def test_setup_logger_custom_level(self, caplog: LogCaptureFixture) -> None:
467467
assert vcspull_logger.level == logging.DEBUG
468468

469469
def test_setup_logger_creates_vcspull_logger(
470-
self, caplog: LogCaptureFixture
470+
self,
471+
caplog: LogCaptureFixture,
471472
) -> None:
472473
"""Test that setup_logger creates vcspull logger with debug formatter."""
473474
# Clear handlers first to avoid interference
@@ -494,7 +495,8 @@ def test_setup_logger_creates_vcspull_logger(
494495
assert isinstance(handler.formatter, DebugLogFormatter)
495496

496497
def test_setup_logger_creates_cli_add_logger(
497-
self, caplog: LogCaptureFixture
498+
self,
499+
caplog: LogCaptureFixture,
498500
) -> None:
499501
"""Test that setup_logger creates CLI add logger with simple formatter."""
500502
# Clear handlers first to avoid interference
@@ -521,7 +523,8 @@ def test_setup_logger_creates_cli_add_logger(
521523
assert isinstance(handler.formatter, SimpleLogFormatter)
522524

523525
def test_setup_logger_creates_cli_add_fs_logger(
524-
self, caplog: LogCaptureFixture
526+
self,
527+
caplog: LogCaptureFixture,
525528
) -> None:
526529
"""Test that setup_logger creates CLI add-from-fs logger."""
527530
# Clear handlers first to avoid interference
@@ -548,7 +551,8 @@ def test_setup_logger_creates_cli_add_fs_logger(
548551
assert isinstance(handler.formatter, SimpleLogFormatter)
549552

550553
def test_setup_logger_creates_cli_sync_logger(
551-
self, caplog: LogCaptureFixture
554+
self,
555+
caplog: LogCaptureFixture,
552556
) -> None:
553557
"""Test that setup_logger creates CLI sync logger."""
554558
# Clear handlers first to avoid interference
@@ -575,7 +579,8 @@ def test_setup_logger_creates_cli_sync_logger(
575579
assert isinstance(handler.formatter, SimpleLogFormatter)
576580

577581
def test_setup_logger_creates_libvcs_logger(
578-
self, caplog: LogCaptureFixture
582+
self,
583+
caplog: LogCaptureFixture,
579584
) -> None:
580585
"""Test that setup_logger creates libvcs logger with repo formatter."""
581586
# Clear handlers first to avoid interference
@@ -602,7 +607,8 @@ def test_setup_logger_creates_libvcs_logger(
602607
assert isinstance(handler.formatter, RepoLogFormatter)
603608

604609
def test_setup_logger_prevents_duplicate_handlers(
605-
self, caplog: LogCaptureFixture
610+
self,
611+
caplog: LogCaptureFixture,
606612
) -> None:
607613
"""Test that setup_logger doesn't create duplicate handlers."""
608614
test_logger = logging.getLogger("test_logger")
@@ -619,7 +625,8 @@ def test_setup_logger_prevents_duplicate_handlers(
619625
assert initial_handler_count == final_handler_count
620626

621627
def test_setup_logger_with_none_creates_root_logger(
622-
self, caplog: LogCaptureFixture
628+
self,
629+
caplog: LogCaptureFixture,
623630
) -> None:
624631
"""Test that setup_logger with None creates root logger configuration."""
625632
# Clear handlers first to avoid interference

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /