Bump hacking

hacking 4.0.x is too old.

Change-Id: Ic4d2e9731ddcaae4a63283805fd9425573a80050
This commit is contained in:
Takashi Kajinami 2024-01-17 01:37:07 +09:00
parent 436cc14867
commit 4df56c6586
3 changed files with 5 additions and 5 deletions

View File

@ -89,7 +89,7 @@ def _extract_key(config_path, key, fallback_metadata=None):
raise TypeError()
except (KeyError, TypeError):
try:
if type(config) == list:
if isinstance(config, list):
config = config[int(key)]
continue
except (IndexError, ValueError):
@ -150,7 +150,7 @@ def write_file(path, obj):
d = os.path.dirname(path)
os.path.exists(d) or os.makedirs(d)
with tempfile.NamedTemporaryFile(dir=d, delete=False) as newfile:
if type(obj.body) == str:
if isinstance(obj.body, str):
obj.body = obj.body.encode('utf-8')
newfile.write(obj.body)
os.chmod(newfile.name, mode)

View File

@ -26,7 +26,7 @@ def read_configs(config_files):
if os.path.exists(input_path):
try:
with open(input_path) as input_file:
yield((input_file.read(), input_path))
yield (input_file.read(), input_path)
except IOError as e:
raise exc.ConfigException('Could not open %s for reading. %s' %
(input_path, e))
@ -36,7 +36,7 @@ def parse_configs(config_data):
'''Generator yields parsed json for each item passed in config_data.'''
for input_data, input_path in config_data:
try:
yield(json.loads(input_data))
yield json.loads(input_data)
except ValueError:
raise exc.ConfigException('Could not parse metadata file: %s' %
input_path)

View File

@ -1,4 +1,4 @@
hacking>=4.0.0,<4.1.0 # Apache-2.0
hacking>=6.1.0,<6.2.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD