uploads_management (version 1.0.0)
index
uploads_management.py

This tool runs CLI scripts and displays output in a Web Interface.
 
This file implement some functions to manage uploads on WebScripts.

 
Classes
       
builtins.object
FileMetadata
UploadedFile
builtins.tuple(builtins.object)
Upload

 
class FileMetadata(builtins.object)
    This class implements file metadata for
uploaded files.
 
  Methods defined here:
__init__(self)
Initialize self.  See help(type(self)) for accurate signature.
add(self, stat: os.stat_result, timestamp: float)
This function add a version to file metadata.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Upload(builtins.tuple)
    Upload(ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)
 
Upload(ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)
 
 
Method resolution order:
Upload
builtins.tuple
builtins.object

Methods defined here:
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__repr__(self)
Return a nicely formatted representation string
_asdict(self)
Return a new dict which maps field names to their values.
_replace(self, /, **kwds)
Return a new Upload object replacing specified fields with new values

Class methods defined here:
_make(iterable) from builtins.type
Make a new Upload object from a sequence or iterable

Static methods defined here:
__new__(_cls, ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)
Create new instance of Upload(ID, name, read_permission, write_permission, delete_permission, hidden, is_deleted, is_binary, no_compression, timestamp, user, version)

Data descriptors defined here:
ID
Alias for field number 0
name
Alias for field number 1
read_permission
Alias for field number 2
write_permission
Alias for field number 3
delete_permission
Alias for field number 4
hidden
Alias for field number 5
is_deleted
Alias for field number 6
is_binary
Alias for field number 7
no_compression
Alias for field number 8
timestamp
Alias for field number 9
user
Alias for field number 10
version
Alias for field number 11

Data and other attributes defined here:
__match_args__ = ('ID', 'name', 'read_permission', 'write_permission', 'delete_permission', 'hidden', 'is_deleted', 'is_binary', 'no_compression', 'timestamp', 'user', 'version')
_field_defaults = {}
_fields = ('ID', 'name', 'read_permission', 'write_permission', 'delete_permission', 'hidden', 'is_deleted', 'is_binary', 'no_compression', 'timestamp', 'user', 'version')

Methods inherited from builtins.tuple:
__add__(self, value, /)
Return self+value.
__contains__(self, key, /)
Return key in self.
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__getitem__(self, key, /)
Return self[key].
__gt__(self, value, /)
Return self>value.
__hash__(self, /)
Return hash(self).
__iter__(self, /)
Implement iter(self).
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__mul__(self, value, /)
Return self*value.
__ne__(self, value, /)
Return self!=value.
__rmul__(self, value, /)
Return value*self.
count(self, value, /)
Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
 
Raises ValueError if the value is not present.

Class methods inherited from builtins.tuple:
__class_getitem__(...) from builtins.type
See PEP 585

 
class UploadedFile(builtins.object)
    UploadedFile(name: str, read_access: int, write_access: int, delete_access: int, hidden: bool, binary: bool, no_compression: bool, with_access: bool = True)
 
This class implements the file type for
uploaded files.
 
  Methods defined here:
__del__(self, *args, **kwargs)
__enter__(self, *args, **kwargs)
__exit__(self, *args, **kwargs)
__getattr__(self, attr: str)
__init__(self, name: str, read_access: int, write_access: int, delete_access: int, hidden: bool, binary: bool, no_compression: bool, with_access: bool = True)
Initialize self.  See help(type(self)) for accurate signature.
__iter__(self, *args, **kwargs)
__next__(self, *args, **kwargs)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
delete_file(name: str) -> uploads_management.Upload
This function delete an uploaded file.
get_file(name: str, id_: str = None) -> Tuple[List[uploads_management.Upload], collections.Counter]
This function return the history of a file.
 
If name is None, this function get Upload by ID.
get_file_content(name: str = None, id_: str = None) -> Tuple[str, str]
This function return a base64 of the file
content and the filename (without check permissions).
 
If id_ and name arguments are None this function return (None, None).
 
Using a name this function return the last versions of the file content.
Using an ID this function return the version of this ID.
get_metadata() -> Dict[str, uploads_management.FileMetadata]
This function returns metadata of
each uploaded files and versions.
get_reader(file: uploads_management.Upload) -> _io._TextIOBase
This function returns a reader
of the uploaded file.
get_visible_files() -> collections.abc.Iterator[uploads_management.Upload]
This function return upload if not hidden.
read_file(name: str) -> str
This function check permission and
return a base64 of the file content.
write_file(data: str, name: str, read_access: int, write_access: int, delete_access: int, hidden: bool, binary: bool, no_compression: bool, is_b64: bool, with_access: bool = True) -> uploads_management.Upload
This function uploads a file.

 
Data
        __all__ = ['Upload', 'get_file', 'read_file', 'write_file', 'get_reader', 'delete_file', 'get_metadata', 'FileMetadata', 'UploadedFile', 'get_file_content', 'get_visible_files']
__author_email__ = 'mauricelambert434@gmail.com'
__copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n'
__description__ = '\nThis tool runs CLI scripts and displays output ...t some functions to manage uploads on WebScripts\n'
__license__ = 'GPL-3.0 License'
__maintainer__ = 'Maurice Lambert'
__maintainer_email__ = 'mauricelambert434@gmail.com'
__url__ = 'https://github.com/mauricelambert/WebScripts'
__warningregistry__ = {'version': 0}

 
Author
        Maurice Lambert