mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Fix several ResourceWarning: unclosed file
This commit is contained in:
parent
abee146199
commit
67d6fcb0f6
10 changed files with 78 additions and 34 deletions
|
|
@ -72,7 +72,8 @@ REV_LINE_FMT = '{}rev:{}{}{}'
|
|||
|
||||
|
||||
def _write_new_config_file(path, output):
|
||||
original_contents = open(path).read()
|
||||
with open(path) as f:
|
||||
original_contents = f.read()
|
||||
output = remove_defaults(output, CONFIG_SCHEMA)
|
||||
new_contents = ordered_dump(output, **C.YAML_DUMP_KWARGS)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue