Skip to content

Commit 979d843

Browse files
style: autoformat with pre-commit
1 parent 71e25bb commit 979d843

9 files changed

Lines changed: 34 additions & 35 deletions

File tree

copier/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def __getattr__(name: str) -> Any:
3131

3232

3333
__all__ = [
34+
"Phase",
35+
"Settings",
36+
"VcsRef",
3437
"load_settings",
3538
"run_copy", # noqa: F405
3639
"run_recopy", # noqa: F405
3740
"run_update", # noqa: F405,
38-
"Phase",
39-
"Settings",
40-
"VcsRef",
4141
]

copier/_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ def run_copy(self) -> None:
12731273
self._render_template()
12741274
if not self.quiet:
12751275
# TODO Unify printing tools
1276-
print("") # padding space
1276+
print() # padding space
12771277
if not self.skip_tasks:
12781278
with Phase.use(Phase.TASKS):
12791279
self._execute_tasks(self.template.tasks)
@@ -1284,7 +1284,7 @@ def run_copy(self) -> None:
12841284
self._print_message(self.template.message_after_copy)
12851285
if not self.quiet:
12861286
# TODO Unify printing tools
1287-
print("") # padding space
1287+
print() # padding space
12881288

12891289
@as_operation("copy")
12901290
def run_recopy(self) -> None:

copier/_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def _raw_config(self) -> AnyByStrDict:
258258
conf_paths = [
259259
p
260260
for p in self.local_abspath.glob("copier.*")
261-
if p.is_file() and re.match(r"\.ya?ml", p.suffix, re.I)
261+
if p.is_file() and re.match(r"\.ya?ml", p.suffix, re.IGNORECASE)
262262
]
263263
if len(conf_paths) > 1:
264264
raise MultipleConfigFilesError(conf_paths)

copier/_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def printf_exception(
8888
) -> None:
8989
"""Print exception with common format."""
9090
if not quiet:
91-
print("", file=sys.stderr)
91+
print(file=sys.stderr)
9292
printf(action, msg=msg, style=Style.DANGER, indent=indent, file_=sys.stderr)
9393
print(HLINE, file=sys.stderr)
9494
print(e, file=sys.stderr)

copier/errors.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,31 @@
2323

2424

2525
__all__ = [
26-
"CopierError",
27-
"UserMessageError",
28-
"UnsupportedVersionError",
2926
"ConfigFileError",
27+
"CopierAnswersInterrupt",
28+
"CopierError",
29+
"CopierWarning",
30+
"DirtyLocalWarning",
31+
"ExtensionNotFoundError",
32+
"ForbiddenPathError",
33+
"InteractiveSessionError",
3034
"InvalidConfigFileError",
31-
"MultipleConfigFilesError",
3235
"InvalidTypeError",
36+
"MissingFileWarning",
37+
"MissingSettingsWarning",
38+
"MultipleConfigFilesError",
39+
"MultipleYieldTagsError",
40+
"OldTemplateWarning",
3341
"PathError",
3442
"PathNotAbsoluteError",
3543
"PathNotRelativeError",
36-
"ForbiddenPathError",
37-
"ExtensionNotFoundError",
38-
"CopierAnswersInterrupt",
39-
"UnsafeTemplateError",
40-
"YieldTagInFileError",
41-
"MultipleYieldTagsError",
44+
"ShallowCloneWarning",
4245
"TaskError",
43-
"CopierWarning",
4446
"UnknownCopierVersionWarning",
45-
"OldTemplateWarning",
46-
"DirtyLocalWarning",
47-
"ShallowCloneWarning",
48-
"MissingSettingsWarning",
49-
"MissingFileWarning",
50-
"InteractiveSessionError",
47+
"UnsafeTemplateError",
48+
"UnsupportedVersionError",
49+
"UserMessageError",
50+
"YieldTagInFileError",
5151
]
5252

5353

tests/test_copy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ def test_value_with_forward_slash(tmp_path_factory: pytest.TempPathFactory) -> N
590590
{"type": "int", "choices": {"one": 1, "two": 2}},
591591
"3",
592592
pytest.raises(
593-
ValueError, match="Invalid choice for 'q': 3 is not in \[1, 2\]"
593+
ValueError, match=r"Invalid choice for 'q': 3 is not in \[1, 2\]"
594594
),
595595
),
596596
(

tests/test_migrations.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@ def test_requires_unsafe(tmp_path_factory: pytest.TempPathFactory) -> None:
129129

130130
with local.cwd(src):
131131
git("tag", "v2")
132-
with local.cwd(dst):
133-
with pytest.raises(UnsafeTemplateError):
134-
run_update(defaults=True, overwrite=True, unsafe=False)
132+
with local.cwd(dst), pytest.raises(UnsafeTemplateError):
133+
run_update(defaults=True, overwrite=True, unsafe=False)
135134

136135
assert not (dst / "foo").exists()
137136

tests/test_output.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_messages_with_inline_text(
158158
Project\ myproj\ successfully\ created\s*$
159159
""",
160160
err,
161-
flags=re.S | re.X,
161+
flags=re.DOTALL | re.VERBOSE,
162162
)
163163

164164
# recopy
@@ -178,7 +178,7 @@ def test_messages_with_inline_text(
178178
Project\ myproj_new\ successfully\ created\s*$
179179
""",
180180
err,
181-
flags=re.S | re.X,
181+
flags=re.DOTALL | re.VERBOSE,
182182
)
183183

184184
with local.cwd(dst):
@@ -206,7 +206,7 @@ def test_messages_with_inline_text(
206206
Project\ myproj_new_update\ successfully\ updated\s*$
207207
""",
208208
err,
209-
flags=re.S | re.X,
209+
flags=re.DOTALL | re.VERBOSE,
210210
)
211211

212212

@@ -298,7 +298,7 @@ def test_messages_with_included_text(
298298
Project\ myproj\ successfully\ created\s*$
299299
""",
300300
err,
301-
flags=re.S | re.X,
301+
flags=re.DOTALL | re.VERBOSE,
302302
)
303303

304304
# recopy
@@ -318,7 +318,7 @@ def test_messages_with_included_text(
318318
Project\ myproj_new\ successfully\ created\s*$
319319
""",
320320
err,
321-
flags=re.S | re.X,
321+
flags=re.DOTALL | re.VERBOSE,
322322
)
323323

324324
with local.cwd(dst):
@@ -346,7 +346,7 @@ def test_messages_with_included_text(
346346
Project\ myproj_new_update\ successfully\ updated\s*$
347347
""",
348348
err,
349-
flags=re.S | re.X,
349+
flags=re.DOTALL | re.VERBOSE,
350350
)
351351

352352

tests/test_prompt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def test_update_with_new_field_in_new_version_skip_answered(
403403
def test_when(
404404
tmp_path_factory: pytest.TempPathFactory,
405405
spawn: Spawn,
406-
question_1: str | int | float | bool,
406+
question_1: str | float | bool,
407407
question_2_when: bool | str,
408408
asks: bool,
409409
) -> None:

0 commit comments

Comments
 (0)