Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise FileNotFoundError
elif status == 403:
raise IOError("Forbidden: %s\n%s" % (path, msg))
elif status == 502:
raise ProxyError()
elif "invalid" in str(msg):
raise ValueError("Bad Request: %s\n%s" % (path, msg))
elif error:
raise HttpError(error)
elif status:
raise HttpError({"code": status})
else:
raise RuntimeError(msg)
GCSFileSystem.load_tokens()
class GCSFile(fsspec.spec.AbstractBufferedFile):
def __init__(
self,
gcsfs,
path,
mode="rb",
block_size=DEFAULT_BLOCK_SIZE,
autocommit=True,
cache_type="readahead",
cache_options=None,
acl=None,
consistency="md5",
metadata=None,
content_type=None,
consistency: None or str
If None, use default for this instance
"""
if block_size is None:
block_size = self.default_block_size
const = consistency or self.consistency
return GCSFile(self, path, mode, block_size, consistency=const,
metadata=metadata, acl=acl, autocommit=autocommit)
def __setstate__(self, state):
self.__dict__.update(state)
self.dircache = {}
self.connect(self.token)
GCSFileSystem.load_tokens()
class GCSFile(fsspec.spec.AbstractBufferedFile):
def __init__(self, gcsfs, path, mode='rb', block_size=DEFAULT_BLOCK_SIZE,
acl=None, consistency='md5', metadata=None,
autocommit=True):
"""
Open a file.
Parameters
----------
gcsfs: instance of GCSFileSystem
path: str
location in GCS, like 'bucket/path/to/file'
mode: str