mirror of
https://github.com/yaml/pyyaml.git
synced 2025-11-01 17:20:56 +00:00
Use with statements to eliminate ResourceWarnings
This commit is contained in:
parent
779bdb129e
commit
575d2f46db
16 changed files with 145 additions and 91 deletions
|
|
@ -29,8 +29,10 @@ class Multi2(yaml.FullLoader):
|
|||
pass
|
||||
|
||||
def test_multi_constructor(input_filename, code_filename, verbose=False):
|
||||
input = open(input_filename, 'rb').read().decode('utf-8')
|
||||
native = _load_code(open(code_filename, 'rb').read())
|
||||
with open(input_filename, 'rb') as file:
|
||||
input = file.read().decode('utf-8')
|
||||
with open(code_filename, 'rb') as file:
|
||||
native = _load_code(file.read())
|
||||
|
||||
# default multi constructor for ! and !! tags
|
||||
Multi1.add_multi_constructor('!', myconstructor1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue