Skip to content

Upload#

lit.sdk.data.upload #

This module provides classes and functions for managing and retrieving information about uploaded files.

__doc__ = '\nThis module provides classes and functions for managing and retrieving information about uploaded files.\n' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__file__ = '/opt/lit-platform/lit-lib/src/lit/sdk/data/upload.cpython-312-x86_64-linux-gnu.so' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__name__ = 'lit.sdk.data.upload' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__package__ = 'lit.sdk.data' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__test__ = {'get_uploads (line 38)': '\n Gets all of the uploads for a given team.\n\n Args:\n team (str): The name of the team.\n\n Returns:\n (list[Upload]): A list of paths.\n\n Examples:\n >>> uploads = get_uploads("contoso")\n >>> uploads[0].full_path, uploads[0].permissions\n (Path(\'/data/contoso/raw/qqq/2011_QQQ.csv.gz\'), \'-rwxr-xr-x\')\n\n '} module #

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

LitDataError #

Bases: lit.sdk.errors.LitError

A custom exception class for Lit data errors.

__annotations__ = {} class #

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ = 'A custom exception class for Lit data errors.' class #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ = 'lit.sdk.errors' class #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__init__(*args, code=None) method descriptor #

Initializes a new instance of LitDataError.

Parameters:

Name Type Description Default
*args object

Variable number of arguments to pass to the base class constructor.

required
code int | None

The error code. Defaults to None.

None

Upload #

Represents an uploaded file.

__annotations__ = {'full_path': 'Path', 'file_name': 'str', 'folder': 'str', 'file_time': 'str', 'permissions': 'str', 'owner': 'str', 'group': 'str', 'host': 'str', 'file_size': 'int', 'has_cache_file': 'bool', 'has_cache_error': 'bool'} class #

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__dataclass_fields__ = {'full_path': Field(name='full_path',type='Path',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'file_name': Field(name='file_name',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'folder': Field(name='folder',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'file_time': Field(name='file_time',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'permissions': Field(name='permissions',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'owner': Field(name='owner',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'group': Field(name='group',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'host': Field(name='host',type='str',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'file_size': Field(name='file_size',type='int',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'has_cache_file': Field(name='has_cache_file',type='bool',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'has_cache_error': Field(name='has_cache_error',type='bool',default=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,default_factory=<dataclasses._MISSING_TYPE object at 0x7fef887f4b30>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)} class #

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ = 'Represents an uploaded file.' class #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__match_args__ = ('full_path', 'file_name', 'folder', 'file_time', 'permissions', 'owner', 'group', 'host', 'file_size', 'has_cache_file', 'has_cache_error') class #

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

__module__ = 'lit.sdk.data.upload' class #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__weakref__ property #

list of weak references to the object

get_uploads(team) method descriptor #

Gets all of the uploads for a given team.

Parameters:

Name Type Description Default
team str

The name of the team.

required

Returns:

Type Description
list[Upload]

A list of paths.

Examples:

>>> uploads = get_uploads("contoso")
>>> uploads[0].full_path, uploads[0].permissions
(Path('/data/contoso/raw/qqq/2011_QQQ.csv.gz'), '-rwxr-xr-x')

lit_error_handler(error_type=LitError) method descriptor #

A decorator function that catches and re-raises exceptions with a custom error type.

Parameters:

Name Type Description Default
error_type Type[LitError]

The type of exception to raise. Defaults to LitError.

LitError

Returns:

Type Description
Callable

A wrapper function that catches exceptions and raises the specified error type.

Examples:

>>> @lit_error_handler()
... def raises_error():
...     assert False
...
>>> raises_error()
Traceback (most recent call last):
File "/opt/lit/src/lit/sdk/errors.py", line 130, in wrapper
File "<stdin>", line 3, in raises_error
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/lit/src/lit/sdk/errors.py", line 132, in wrapper
lit.sdk.errors.LitError: An error occurred in function 'raises_error'