acdcli.cache package

Submodules

acdcli.cache.cursors module

Cursor context managers

class acdcli.cache.cursors.cursor(conn)[source]

Bases: object

__init__(conn)[source]
class acdcli.cache.cursors.mod_cursor(conn)[source]

Bases: object

__init__(conn)[source]

acdcli.cache.db module

exception acdcli.cache.db.IntegrityError(msg)[source]

Bases: Exception

__init__(msg)[source]
class acdcli.cache.db.NodeCache(cache_path: str='', settings_path='', check=0)[source]

Bases: acdcli.cache.schema.SchemaMixin, acdcli.cache.query.QueryMixin, acdcli.cache.sync.SyncMixin, acdcli.cache.format.FormatterMixin

IntegrityCheckType = {'none': 2, 'quick': 1, 'full': 0}

types of SQLite integrity checks

__init__(cache_path: str='', settings_path='', check=0)[source]
integrity_check(type_: {'none': 2, 'quick': 1, 'full': 0})[source]

Performs a self-integrity check on the database.

remove_db_file() → bool[source]

Removes database file.

acdcli.cache.format module

Formatters for query Bundle iterables. Capable of ANSI-type coloring using colors defined in LS_COLORS.

class acdcli.cache.format.FormatterMixin[source]

Bases: object

file_entry(file, long=False, size_bytes=False) → str[source]
static id_format(nodes) → 'Generator[str]'[source]
long_id_format(nodes) → 'Generator[str]'[source]
ls_format(folder_id, folder_path=None, recursive=False, trash_only=False, trashed_children=False, long=False, size_bytes=False) → 'Generator[str]'[source]
path_format(nodes)[source]

Creates a right-justified size/nlinks string.

tree_format(node, path, trash=False, dir_only=False, depth=0, max_depth=None) → 'Generator[str]'[source]

A simple tree formatter that indicates parentship by indentation (i.e. does not display graphical branches like tree).

acdcli.cache.format.color_file(name: str) → str[source]

Colorizes a file name according to its file ending.

acdcli.cache.format.color_path(path: str) → str[source]

Colorizes a path string.

acdcli.cache.format.color_status(status)[source]

Creates a colored one-character status abbreviation.

acdcli.cache.format.date_str(time_: datetime.datetime) → str[source]

Creates colored date string similar to the one in ls -l.

acdcli.cache.format.init(color=0)[source]

Disables pre-initialized coloring if never mode specified or stdout is a tty.

Parameters:color – the color mode to use, defaults to auto

acdcli.cache.query module

class acdcli.cache.query.Node(row)[source]

Bases: object

__init__(row)[source]
created
is_available
is_file
is_folder
is_trashed
modified
simple_name
class acdcli.cache.query.QueryMixin[source]

Bases: object

calculate_usage()[source]
childrens_names(folder_id) → 'List[str]'[source]
file_size_exists(size) → bool[source]
find_by_md5(md5) → 'List[Node]'[source]
find_by_name(name: str) → 'List[Node]'[source]
find_by_regex(regex) → 'List[Node]'[source]
first_path(node_id: str) → str[source]
get_child(folder_id, child_name) → 'Union[Node|None]'[source]
get_conflicting_node(name: str, parent_id: str)[source]

Finds conflicting node in folder specified by parent_id, if one exists.

get_file_count() → int[source]
get_folder_count() → int[source]
get_node(id) → 'Union[Node|None]'[source]
get_node_count() → int[source]
get_root_node()[source]
list_children(folder_id, trash=False) → 'Tuple[List[Node], List[Node]]'[source]
list_trashed_children(folder_id) → 'Tuple[List[Node], List[Node]]'[source]
num_children(folder_id) → int[source]
num_parents(node_id) → int[source]
resolve(path: str, trash=False) → 'Union[Node|None]'[source]
acdcli.cache.query.datetime_from_string(dt: str) → datetime.datetime[source]

acdcli.cache.schema module

class acdcli.cache.schema.SchemaMixin[source]

Bases: object

create_tables()[source]
drop_all()[source]
init()[source]

acdcli.cache.sync module

Syncs Amazon Node API objects with SQLite database.

class acdcli.cache.sync.SyncMixin[source]

Bases: object

Sync mixin to the NodeCache

insert_files(files: list)[source]
insert_folders(folders: list)[source]

Inserts list of folders into cache. Sets ‘update’ column to current date.

Parameters:folders – list of raw dict-type folders
insert_node(node: dict)[source]

Inserts single file or folder into cache.

insert_nodes(nodes: list, partial=True)[source]

Inserts mixed list of files and folders into cache.

insert_parentage(nodes: list, partial=True)[source]
remove_purged(purged: list)[source]

Removes purged nodes from database

Parameters:purged – list of purged node IDs
acdcli.cache.sync.gen_slice(list_, length=100)[source]
acdcli.cache.sync.placeholders(args)[source]

Module contents