Skip to content

Commit f217a96

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a4b6acd commit f217a96

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

pre_commit_macadmin_hooks/format_autopkg_yaml_recipes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import ruamel.yaml
1010
from ruamel.yaml.constructor import DuplicateKeyError
1111

12-
1312
# YAML 1.1 boolean tokens that AutoPkg uses as strings (e.g. 'YES'/'NO').
1413
# Force single quotes so a later load doesn't coerce them to booleans.
1514
_YAML_11_BOOL_RE = re.compile(
@@ -98,7 +97,7 @@ def _insert_section_blank_lines(output: str) -> str:
9897

9998
def tidy_recipe(path: str, yaml: ruamel.yaml.YAML) -> None:
10099
"""Tidy a single AutoPkg YAML recipe in place."""
101-
with open(path, "r") as in_file:
100+
with open(path) as in_file:
102101
original = in_file.read()
103102

104103
recipe = yaml.load(original)

tests/test_format_autopkg_yaml_recipes.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _write(self, content: str) -> str:
2828
return tmp.name
2929

3030
def _read(self, path: str) -> str:
31-
with open(path, "r") as f:
31+
with open(path) as f:
3232
return f.read()
3333

3434
def test_idempotent(self):
@@ -152,9 +152,7 @@ def test_multiple_files(self):
152152

153153
def test_already_formatted_does_not_rewrite(self):
154154
path = self._write(
155-
"Identifier: com.example.test\n"
156-
"Input:\n"
157-
" NAME: TestApp\n"
155+
"Identifier: com.example.test\n" "Input:\n" " NAME: TestApp\n"
158156
)
159157
self.assertEqual(format_autopkg_yaml_recipes.main([path]), 0)
160158
mtime_after_first = Path(path).stat().st_mtime_ns

0 commit comments

Comments
 (0)