Remove unused read_cached_file method from utils
The read_cached_file() method in keystone.common.utils isn't being used anywhere in keystone and it isn't tested. Let's remove it. Change-Id: Iafba37114957c5270351aafd25538c6085c07805
This commit is contained in:
parent
0340cd0150
commit
294c5a11ca
|
@ -86,26 +86,6 @@ def flatten_dict(d, parent_key=''):
|
||||||
return dict(items)
|
return dict(items)
|
||||||
|
|
||||||
|
|
||||||
def read_cached_file(filename, cache_info, reload_func=None):
|
|
||||||
"""Read from a file if it has been modified.
|
|
||||||
|
|
||||||
:param cache_info: dictionary to hold opaque cache.
|
|
||||||
:param reload_func: optional function to be called with data when
|
|
||||||
file is reloaded due to a modification.
|
|
||||||
|
|
||||||
:returns: data from file.
|
|
||||||
|
|
||||||
"""
|
|
||||||
mtime = os.path.getmtime(filename)
|
|
||||||
if not cache_info or mtime != cache_info.get('mtime'):
|
|
||||||
with open(filename) as fap:
|
|
||||||
cache_info['data'] = fap.read()
|
|
||||||
cache_info['mtime'] = mtime
|
|
||||||
if reload_func:
|
|
||||||
reload_func(cache_info['data'])
|
|
||||||
return cache_info['data']
|
|
||||||
|
|
||||||
|
|
||||||
class SmarterEncoder(jsonutils.json.JSONEncoder):
|
class SmarterEncoder(jsonutils.json.JSONEncoder):
|
||||||
"""Help for JSON encoding dict-like objects."""
|
"""Help for JSON encoding dict-like objects."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue