def open_json(file_name): """ returns json contents as string """ with open_file(file_name) as json_file: data = json.load(json_file) return data
def __init__(self): self.cache_file = constants.DEFAULT_MOBAN_CACHE_FILE if (file_system.exists(self.cache_file) and self.IGNORE_CACHE_FILE is False): with file_system.open_file(self.cache_file) as f: self.hashes = json.load(f) else: self.hashes = {}
def test_open_file(): for url in TEST_SPECS: with file_system.open_file(url): pass
def loads(file_name): _, extension = path_splitext(file_name) with open_file(file_name) as any_format_file: content = anyconfig.loads(any_format_file.read(), ac_parser=extension[1:]) return content