in azure/datalake/store/core.py [0:0]
def info(self, path, invalidate_cache=True, expected_error_code=None):
"""
File information for path
Parameters
----------
path: str or AzureDLPath
Path to query
invalidate_cache: bool
Whether to invalidate cache or not
expected_error_code: int
Optionally indicates a specific, expected error code, if any.
Returns
-------
File information
"""
path = AzureDLPath(path).trim()
path_as_posix = path.as_posix()
root = path.parent
root_as_posix = root.as_posix()
# in the case of getting info about the root itself or if the cache won't be hit
# simply return the result of a GETFILESTATUS from the service
if invalidate_cache or path_as_posix in {'/', '.'}:
to_return = self.azure.call('GETFILESTATUS', path_as_posix, expected_error_code=expected_error_code)[
'FileStatus']
to_return['name'] = path_as_posix
# add the key/value pair back to the cache so long as it isn't the root
if path_as_posix not in {'/', '.'}:
if root_as_posix not in self.dirs:
self.dirs[root_as_posix] = [to_return]
else:
found = False
for f in self.dirs[root_as_posix]:
if f['name'] == path_as_posix:
found = True
break
if not found:
self.dirs[root_as_posix].append(to_return)
return to_return
for f in self._ls(root, invalidate_cache):
if f['name'] == path_as_posix:
return f
raise FileNotFoundError(path)