mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
[PR #11341/5b5f7e9e backport][stable-12] batch 1 - update Python idiom to 3.7 using pyupgrade (#11349)
batch 1 - update Python idiom to 3.7 using pyupgrade (#11341)
* batch 1 - update Python idiom to 3.7 using pyupgrade
* add changelog frag
* add changelog frag
(cherry picked from commit 5b5f7e9e64)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
@@ -210,9 +210,9 @@ class InventoryModule(BaseInventoryPlugin):
|
||||
Returns:
|
||||
dict(json_data): json data"""
|
||||
try:
|
||||
with open(path, "r") as json_file:
|
||||
with open(path) as json_file:
|
||||
return json.load(json_file)
|
||||
except (IOError, json.decoder.JSONDecodeError) as err:
|
||||
except (OSError, json.decoder.JSONDecodeError) as err:
|
||||
raise AnsibleParserError(f"Could not load the test data from {to_native(path)}: {err}") from err
|
||||
|
||||
def save_json_data(self, path, file_name=None):
|
||||
@@ -242,7 +242,7 @@ class InventoryModule(BaseInventoryPlugin):
|
||||
cwd = os.path.abspath(os.path.dirname(__file__))
|
||||
with open(os.path.abspath(os.path.join(cwd, *path)), "w") as json_file:
|
||||
json.dump(self.data, json_file)
|
||||
except IOError as err:
|
||||
except OSError as err:
|
||||
raise AnsibleParserError(f"Could not save data: {err}") from err
|
||||
|
||||
def verify_file(self, path):
|
||||
|
||||
Reference in New Issue
Block a user