Bump hacking
hacking 4.0.x is too old. Change-Id: Ic4d2e9731ddcaae4a63283805fd9425573a80050
This commit is contained in:
parent
436cc14867
commit
4df56c6586
@ -89,7 +89,7 @@ def _extract_key(config_path, key, fallback_metadata=None):
|
|||||||
raise TypeError()
|
raise TypeError()
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
try:
|
try:
|
||||||
if type(config) == list:
|
if isinstance(config, list):
|
||||||
config = config[int(key)]
|
config = config[int(key)]
|
||||||
continue
|
continue
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
@ -150,7 +150,7 @@ def write_file(path, obj):
|
|||||||
d = os.path.dirname(path)
|
d = os.path.dirname(path)
|
||||||
os.path.exists(d) or os.makedirs(d)
|
os.path.exists(d) or os.makedirs(d)
|
||||||
with tempfile.NamedTemporaryFile(dir=d, delete=False) as newfile:
|
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')
|
obj.body = obj.body.encode('utf-8')
|
||||||
newfile.write(obj.body)
|
newfile.write(obj.body)
|
||||||
os.chmod(newfile.name, mode)
|
os.chmod(newfile.name, mode)
|
||||||
|
@ -26,7 +26,7 @@ def read_configs(config_files):
|
|||||||
if os.path.exists(input_path):
|
if os.path.exists(input_path):
|
||||||
try:
|
try:
|
||||||
with open(input_path) as input_file:
|
with open(input_path) as input_file:
|
||||||
yield((input_file.read(), input_path))
|
yield (input_file.read(), input_path)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
raise exc.ConfigException('Could not open %s for reading. %s' %
|
raise exc.ConfigException('Could not open %s for reading. %s' %
|
||||||
(input_path, e))
|
(input_path, e))
|
||||||
@ -36,7 +36,7 @@ def parse_configs(config_data):
|
|||||||
'''Generator yields parsed json for each item passed in config_data.'''
|
'''Generator yields parsed json for each item passed in config_data.'''
|
||||||
for input_data, input_path in config_data:
|
for input_data, input_path in config_data:
|
||||||
try:
|
try:
|
||||||
yield(json.loads(input_data))
|
yield json.loads(input_data)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise exc.ConfigException('Could not parse metadata file: %s' %
|
raise exc.ConfigException('Could not parse metadata file: %s' %
|
||||||
input_path)
|
input_path)
|
||||||
|
@ -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
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||||
|
Loading…
Reference in New Issue
Block a user