text stringlengths 81 112k |
|---|
The number of the strip that has changed state,
with 0 being the first strip.
On tablets with only one strip, this method always returns 0.
For events not of type
:attr:`~libinput.constant.EventType.TABLET_PAD_STRIP`, this property
raises :exc:`AttributeError`.
Returns:
int: The index of the strip tha... |
The source of the interaction with the strip.
If the source is
:attr:`~libinput.constant.TabletPadStripAxisSource.FINGER`, libinput
sends a strip position value of -1 to terminate the current interaction.
For events not of type
:attr:`~libinput.constant.EventType.TABLET_PAD_STRIP`, this property
raises :e... |
The button number that triggered this event, starting at 0.
For events that are not of type
:attr:`~libinput.constant.Event.TABLET_PAD_BUTTON`,
this property raises :exc:`AttributeError`.
Note that the number returned is a generic sequential button number
and not a semantic button code as defined in ``linux... |
The button state of the event.
For events not of type
:attr:`~libinput.constant.EventType.TABLET_PAD_BUTTON`, this property
raises :exc:`AttributeError`.
Returns:
~libinput.constant.ButtonState: The button state triggering
this event.
Raises:
AttributeError
def button_state(self):
"""The button ... |
The mode group that the button, ring, or strip that
triggered this event is considered in.
The mode is a virtual grouping of functionality, usually based on some
visual feedback like LEDs on the pad. See `Tablet pad modes`_
for details.
Returns:
~libinput.define.TabletPadModeGroup: The mode group of the ... |
Parses arguments, returns (options, args).
def parse_args(args=None):
"""Parses arguments, returns (options, args)."""
from argparse import ArgumentParser
if args is None:
args = sys.argv
parser = ArgumentParser(description='''
Attempt to automatically find "adjacent" shapes in a SVG layer, a... |
Returns the Package long description.
:return: Package long description.
:rtype: unicode
def get_long_description():
"""
Returns the Package long description.
:return: Package long description.
:rtype: unicode
"""
description = []
with open("README.rst") as file:
for line... |
Generate the full file paths from a root path.
def ftp_listing_paths(ftpconn: FTP, root: str) -> Iterable[str]:
"""Generate the full file paths from a root path."""
for current_path, dirs, files in ftp_walk(ftpconn, root):
yield from (os.path.join(current_path, file) for file in files) |
Recursively traverse an ftp directory to discovery directory listing.
def ftp_walk(ftpconn: FTP, rootpath=''):
"""Recursively traverse an ftp directory to discovery directory listing."""
current_directory = rootpath
try:
directories, files = directory_listing(ftpconn, current_directory)
excep... |
Return the directories and files for single FTP listing.
def directory_listing(conn: FTP, path: str) -> Tuple[List, List]:
"""Return the directories and files for single FTP listing."""
entries = deque()
conn.dir(path, entries.append)
entries = map(parse_line, entries)
grouped_entries = defaultdic... |
Parse FTP directory listing into (type, filename).
def parse_line(line: str, char_index=0) -> Tuple[ListingType, str]:
"""Parse FTP directory listing into (type, filename)."""
entry_name = str.rpartition(line, ' ')[-1]
entry_type = LISTING_FLAG_MAP.get(line[char_index], ListingType.other)
return entry... |
Uses urllib. thread safe?
def download_ftp_url(source_url, target_uri, buffer_size=8192):
"""Uses urllib. thread safe?"""
ensure_file_directory(target_uri)
with urllib.request.urlopen(source_url) as source_file:
with open(target_uri, 'wb') as target_file:
shutil.copyfileobj(source_fil... |
List of devices to test
def devices(self):
"""List of devices to test
"""
eax = self.attributes.get('devices')
if eax is None:
eax = self._all_devices
if not isinstance(eax, list):
eax = [eax]
return [str(dev) for dev in eax] |
Handle SQLAlchemy exceptions in a sane way.
Args:
func: An arbitrary function to wrap.
error_is_fatal: Should we exit the program on exception?
reraise: Should we reraise the exception, after logging? Only makes sense
if error_is_fatal is False.
error_messages: A diction... |
Retreive migration information.
def get_version_data():
"""Retreive migration information."""
connect_str = str(settings.CFG["db"]["connect_string"])
repo_url = path.template_path("../db/")
return (connect_str, repo_url) |
Install versioning on the db.
def enforce_versioning(force=False):
"""Install versioning on the db."""
connect_str, repo_url = get_version_data()
LOG.warning("Your database uses an unversioned benchbuild schema.")
if not force and not ui.ask(
"Should I enforce version control on your schema... |
Initialize all SQL functions in the database.
def init_functions(connection):
"""Initialize all SQL functions in the database."""
if settings.CFG["db"]["create_functions"]:
print("Refreshing SQL functions...")
for file in path.template_files("../sql/", exts=[".sql"]):
func = sa.DDL(... |
Establish a connection to the database.
Provides simple error handling for fatal errors.
Returns:
True, if we could establish a connection, else False.
def connect_engine(self):
"""
Establish a connection to the database.
Provides simple error handling for fatal e... |
Configure the databse connection.
Sets appropriate transaction isolation levels and handle errors.
Returns:
True, if we did not encounter any unrecoverable errors, else False.
def configure_engine(self):
"""
Configure the databse connection.
Sets appropriate trans... |
Parse datetime.date from YYYY-MM-DD format.
def parse_date(date_str: str, pattern=_RE_DATE) -> dt.date:
"""Parse datetime.date from YYYY-MM-DD format."""
groups = re.match(pattern, date_str)
return dt.date(*_date_to_tuple(groups.groupdict())) |
datetime.datetime components from dictionary to tuple.
Example
-------
dt_dict = {'year': '2014','month': '07','day': '23',
'hour': '13','minute': '12','second': '45','microsecond': '321'}
_datetime_to_tuple(dt_dict) -> (2014, 7, 23, 13, 12, 45, 321)
def _datetime_to_tuple(dt_dict):
"... |
convert to datetime to UTC offset.
def convert_2_utc(self, datetime_, timezone):
"""convert to datetime to UTC offset."""
datetime_ = self.tz_mapper[timezone].localize(datetime_)
return datetime_.astimezone(pytz.UTC) |
Search for a query using the Entrez ESearch API.
Parameters
----------
database : str
Entez database to search.
query : str
Query string
userhistory : bool
Tells API to return a WebEnV and query_key.
webenv : str
An Entrez WebEnv to use saved history.
query_k... |
Post IDs using the Entrez ESearch API.
Parameters
----------
database : str
Entez database to search.
ids : list
List of IDs to submit to the server.
webenv : str
An Entrez WebEnv to post ids to.
api_key : str
A users API key which allows more requests per second... |
Get document summaries using the Entrez ESearch API.
Parameters
----------
db : str
Entez database to get ids from.
dbfrom : str
Entez database the provided ids are from.
ids : list or str
List of IDs to submit to the server.
webenv : str
An Entrez WebEnv to use ... |
Get document summaries using the Entrez ESearch API.
Parameters
----------
database : str
Entez database to search.
ids : list or str
List of IDs to submit to the server.
webenv : str
An Entrez WebEnv to use saved history.
query_key : str
An Entrez query_key to u... |
Get documents using the Entrez ESearch API.gg
Parameters
----------
database : str
Entez database to search.
ids : list or str
List of IDs to submit to the server.
webenv : str
An Entrez WebEnv to use saved history.
query_key : str
An Entrez query_key to use save... |
Gets sets of results back from Entrez.
Entrez can only return 500 results at a time. This creates a generator that gets results by incrementing
retstart and retmax.
Parameters
----------
url : str
The Entrez API url to use.
retstart : int
Return values starting at this index.
... |
Print all rows in this result query.
def print_runs(query):
""" Print all rows in this result query. """
if query is None:
return
for tup in query:
print(("{0} @ {1} - {2} id: {3} group: {4}".format(
tup.end, tup.experiment_name, tup.project_name,
tup.experiment_gr... |
Print status logs.
def print_logs(query, types=None):
""" Print status logs. """
if query is None:
return
for run, log in query:
print(("{0} @ {1} - {2} id: {3} group: {4} status: {5}".format(
run.end, run.experiment_name, run.project_name,
run.experiment_group, run... |
Collect layers from input svg sources.
Args:
svg_sources (list) : A list of file-like objects, each containing
one or more XML layers.
Returns
-------
(width, height), layers : (int, int), list
The first item in the tuple is the shape of the largest layer, and the
... |
Merge layers from input svg sources into a single XML document.
Args:
svg_sources (list) : A list of file-like objects, each containing
one or more XML layers.
share_transform (bool) : If exactly one layer has a transform, apply it
to *all* other layers as well.
Return... |
ben-sh entry point
def main(argv=None):
"""ben-sh entry point"""
arguments = cli_common(__doc__, argv=argv)
campaign_file = arguments['CAMPAIGN_FILE']
if arguments['-g']:
if osp.exists(campaign_file):
raise Exception('Campaign file already exists')
with open(campaign_file, '... |
ben-umb entry point
def main(argv=None):
"""ben-umb entry point"""
arguments = cli_common(__doc__, argv=argv)
driver = CampaignDriver(arguments['CAMPAIGN-DIR'], expandcampvars=False)
driver(no_exec=True)
if argv is not None:
return driver |
Frequency each value occurs in a record sequence for a given field name.
def count_by(records: Sequence[Dict], field_name: str) -> defaultdict:
"""
Frequency each value occurs in a record sequence for a given field name.
"""
counter = defaultdict(int)
for record in records:
name = record[... |
Fetch all rows associated with this experiment.
This will generate a huge .csv.
def generate(self):
"""
Fetch all rows associated with this experiment.
This will generate a huge .csv.
"""
exp_name = self.exp_name()
fname = os.path.basename(self.out_path)
... |
Return the metatab document for the URL
def doc(self):
"""Return the metatab document for the URL"""
from metatab import MetatabDoc
t = self.get_resource().get_target()
return MetatabDoc(t.inner) |
ben-doc entry point
def main(argv=None):
"""ben-doc entry point"""
arguments = cli_common(__doc__, argv=argv)
campaign_path = arguments['CAMPAIGN-DIR']
driver = CampaignDriver(campaign_path, expandcampvars=False)
with pushd(campaign_path):
render(
template=arguments['--template'... |
get class string from object
Examples
--------
>>> class_to_str(list).split('.')[1]
'list'
def class_to_str(obj):
""" get class string from object
Examples
--------
>>> class_to_str(list).split('.')[1]
'list'
"""
mod_str = obj.__module__
name_str = obj.__name__
... |
return a directory path to a module
def get_module_path(module):
"""return a directory path to a module"""
return pathlib.Path(
os.path.dirname(os.path.abspath(inspect.getfile(module)))) |
return a directory path to data within a module
Parameters
----------
data : str or list[str]
file name or list of sub-directories
and file name (e.g. ['lammps','data.txt'])
def get_data_path(data, module, check_exists=True):
"""return a directory path to data within a module
Para... |
return memory usage of python process in MB
from
http://fa.bianp.net/blog/2013/different-ways-to-get-memory-consumption-or-lessons-learned-from-memory_profiler/
psutil is quicker
>>> isinstance(memory_usage(),float)
True
def memory_usage():
"""return memory usage of python process in MB
... |
return memory usage of python process in MB
>>> isinstance(_memory_usage_ps(),float)
True
def _memory_usage_ps():
"""return memory usage of python process in MB
>>> isinstance(_memory_usage_ps(),float)
True
"""
out = subprocess.Popen(
['ps', 'v', '-p', str(os.getpid())],
... |
load memory usage ipython magic,
require memory_profiler package to be installed
to get usage: %memit?
Author: Vlad Niculae <vlad@vene.ro>
Makes use of memory_profiler from Fabian Pedregosa
available at https://github.com/fabianp/memory_profiler
def load_memit():
"""load memory usage ipython ... |
Processes key locations.
Parameters
----------
node: xml.etree.ElementTree.ElementTree.element
Current node.
locs: dict
A dictionary mapping key to a tuple. The tuple can either be 2 or 3
elements long. The first element maps to the location in the
current node. The seco... |
Parse XML into an ElemeTree object.
Parameters
----------
xml : str or file-like object
A filename, file object or string version of xml can be passed.
Returns
-------
Elementree.Element
def xml_to_root(xml: Union[str, IO]) -> ElementTree.Element:
"""Parse XML into an ElemeTree ob... |
Creates a new :py:class:`Layer` and set that as the active.
:param effect: A string with the blend mode for that layer that will be used when during the rendering process. The accepted values are: :code:`'soft_light','lighten','screen','dodge','addition','darken','multiply','hard_light','difference','subtract','gr... |
Duplicates the current active :py:class:`Layer`.
:rtype: Nothing.
def duplicateActiveLayer(self):
"""
Duplicates the current active :py:class:`Layer`.
:rtype: Nothing.
"""
activeLayer = self.layers[self.activeLayer]
newLayer = Layer(data=activeLayer.data, effect=activeLayer.effect)
self.layers.ap... |
Merge all the layers together.
:rtype: The result :py:class:`Layer` object.
def mergeAllLayers(self):
"""
Merge all the layers together.
:rtype: The result :py:class:`Layer` object.
"""
start = time.time()
while(len(self.layers)>1):
self.mergeBottomLayers()
print('merge time:'+str(time.time()-sta... |
Return a dict of term synonyms
def synonyms(self):
"""Return a dict of term synonyms"""
syns = {}
for k, v in self._declared_terms.items():
k = k.strip()
if v.get('synonym'):
syns[k.lower()] = v['synonym']
if not '.' in k:
... |
Return a dictionary mapping term names to their super terms
def super_terms(self):
"""Return a dictionary mapping term names to their super terms"""
# If the doc already has super terms, we've already parsed something, so
# assume we parsed the declaration, and can use re-use the old decls.
... |
Return declared sections, terms and synonyms as a dict
def declare_dict(self):
"""Return declared sections, terms and synonyms as a dict"""
# Run the parser, if it has not been run yet.
if not self.root:
for _ in self: pass
return {
'sections': self._declared_se... |
Replace the record_term and parent_term with a synonym
:param nt:
:return:
def substitute_synonym(self, nt):
"""
Replace the record_term and parent_term with a synonym
:param nt:
:return:
"""
if nt.join_lc in self.synonyms:
nt.parent_term, nt... |
Return parse errors as a dict
def errors_as_dict(self):
"""Return parse errors as a dict"""
errors = []
for e in self.errors:
errors.append({
'file': e.term.file_name,
'row': e.term.row if e.term else '<unknown>',
'col': e.term.col i... |
Given a name, try to resolve the name to a path or URL to
a declaration document. It will try:
* The name as a filesystem path
* The name as a file name in the directory d
* The name + '.csv' as a name in the directory d
* The name as a URL
* The name as a key in th... |
Resolve a name or path for an include doc to a an absolute path or url
:param name:
def find_include_doc(self, d, name):
"""Resolve a name or path for an include doc to a an absolute path or url
:param name:
"""
from metatab import parse_app_url
include_ref = name.strip... |
An generator that yields term objects, handling includes and argument
children.
:param file_type:
:param doc:
:param root:
:param ref:
def generate_terms(self, ref, root, file_type=None):
"""An generator that yields term objects, handling includes and argument
ch... |
Generate inherited children based on a terms InhertsFrom property.
The input term must have both an InheritsFrom property and a defined Section
:param t: A subclassed terms -- has an InheritsFrom value
def inherited_children(self, t):
"""Generate inherited children based on a terms InhertsFrom... |
listPeer 返回列表
{
"rtn":0,
"peerList": [{
"category": "",
"status": 0,
"name": "GUNNER_HOME",
"vodPort": 43566,
"company": "XUNLEI_MIPS_BE_MIPS32",
"pid": "8498352EB4F5208X0001",
... |
list 返回列表
{
"recycleNum": 0,
"serverFailNum": 0,
"rtn": 0,
"completeNum": 34,
"sync": 0,
"tasks": [{
"failCode": 15414,
"vipChannel": {
"available": 0,
"failCode": 0,
... |
urlCheck 返回数据
{
"rtn": 0,
"taskInfo": {
"failCode": 0,
"name": ".HDTVrip.1024X576.mkv",
"url": "ed2k://|file|%E6%B0%",
"type": 1,
"id": "0",
"size": 505005442
}
}
def chec... |
post data:
{
"path":"C:/TDDOWNLOAD/",
"tasks":[{
"url":"ed2k://|file|%E6%B0%B8%E6%81%92.Forever...",
"name":"永恒.Forever.S01E02.中英字幕.WEB-HR.mkv",
"gcid":"",
"cid":"",
"filesize":512807020
}]
... |
Read text and get there reffs
:param text: Collection (Readable)
:return:
def read_levels(text):
""" Read text and get there reffs
:param text: Collection (Readable)
:return:
"""
x = []
for i in range(0, len(NAUTILUSRESOLVER.getMetadata(text).citation)):
x.append(NAUTILUSRESOL... |
Provides a manager for flask scripts to perform specific maintenance operations
:param resolver: Nautilus Extension Instance
:type resolver: NautilusCtsResolver
:param flask_nautilus: Flask Application
:type flask_nautilus: FlaskNautilus
:return: CLI
:rtype: click.group
Import with
..... |
test if object is a list or tuple
def is_iter_non_string(obj):
"""test if object is a list or tuple"""
if isinstance(obj, list) or isinstance(obj, tuple):
return True
return False |
test if object is dict like
def is_dict_like(obj, attr=('keys', 'items')):
"""test if object is dict like"""
for a in attr:
if not hasattr(obj, a):
return False
return True |
test if object is a list only containing dict like items
def is_list_of_dict_like(obj, attr=('keys', 'items')):
"""test if object is a list only containing dict like items """
try:
if len(obj) == 0:
return False
return all([is_dict_like(i, attr) for i in obj])
except Exception:
... |
test if object is pathlib.Path like
def is_path_like(obj, attr=('name', 'is_file', 'is_dir', 'iterdir')):
"""test if object is pathlib.Path like"""
for a in attr:
if not hasattr(obj, a):
return False
return True |
convert all values of one type to another
Parameters
----------
d : dict
intype : type_class
outtype : type_class
convert_list : bool
whether to convert instances inside lists and tuples
in_place : bool
if True, applies conversions to original dict, else returns copy
Ex... |
print a nested dict in readable format
(- denotes an element in a list of dictionaries)
Parameters
----------
d : object
lvlindent : int
additional indentation spaces for each level
initindent : int
initial indentation spaces
delim : str
delimiter between key and... |
extract section of dictionary
Parameters
----------
d : dict
path : list[str]
keys to section
Returns
-------
new_dict : dict
original, without extracted section
extract_dict : dict
extracted section
Examples
--------
>>> from pprint import pprint
... |
index dictionary by multiple keys
Parameters
----------
dic : dict
keys : list
Examples
--------
>>> d = {1:{"a":"A"},2:{"b":"B"}}
>>> indexes(d,[1,'a'])
'A'
def indexes(dic, keys=None):
""" index dictionary by multiple keys
Parameters
----------
dic : dict
k... |
get nested dict as flat {key:val,...},
where key is tuple/string of all nested keys
Parameters
----------
d : object
key_as_tuple : bool
whether keys are list of nested keys or delimited string of nested keys
sep : str
if key_as_tuple=False, delimiter for keys
list_of_dicts:... |
r""" unflatten dictionary with keys as tuples or delimited strings
Parameters
----------
d : dict
key_as_tuple : bool
if true, keys are tuples, else, keys are delimited strings
delim : str
if keys are strings, then split by delim
list_of_dicts: str or None
if key starts ... |
merges b into a
def _single_merge(a, b, error_path=None, overwrite=False,
append=False, list_of_dicts=False):
"""merges b into a
"""
if error_path is None:
error_path = []
if list_of_dicts and is_list_of_dict_like(a) and is_list_of_dict_like(b):
if len(a) != len(b):
... |
merge dicts,
starting with dicts[1] into dicts[0]
Parameters
----------
dicts : list[dict]
list of dictionaries
overwrite : bool
if true allow overwriting of current data
append : bool
if true and items are both lists, then add them
list_of_dicts: bool
treat ... |
get nested dict as {key:dict,...},
where key is tuple/string of all-n levels of nested keys
Parameters
----------
d : dict
levels : int
the number of levels to leave unflattened
key_as_tuple : bool
whether keys are list of nested keys or delimited string of nested keys
delim... |
get nested dict as {key:dict,...},
where key is tuple/string of all-1 nested keys
NB: is same as flattennd(d,1,key_as_tuple,delim)
Parameters
----------
d : dict
key_as_tuple : bool
whether keys are list of nested keys or delimited string of nested keys
delim : str
if key_a... |
remove certain keys from nested dict, retaining preceeding paths
Parameters
----------
keys: list
use_wildcards : bool
if true, can use * (matches everything)
and ? (matches any single character)
list_of_dicts: bool
treat list of dicts as additional branches
deepcopy: bo... |
remove paths with at least one branch leading
to certain (key,value) pairs from dict
Parameters
----------
d : dict
keyvals : dict or list[tuple]
(key,value) pairs to remove
list_of_dicts: bool
treat list of dicts as additional branches
Examples
--------
>>> from p... |
remove paths containing certain keys from dict
Parameters
----------
d: dict
keys : list
list of keys to find and remove path
list_of_dicts: bool
treat list of dicts as additional branches
deepcopy: bool
deepcopy values
Examples
--------
>>> from pprint imp... |
filters leaf nodes of nested dictionary
Parameters
----------
d : dict
vals : list
values to filter by
list_of_dicts: bool
treat list of dicts as additional branches
deepcopy: bool
deepcopy values
Examples
--------
>>> d = {1:{"a":"A"},2:{"b":"B"},4:{5:{6:'... |
filters leaf nodes key:value pairs of nested dictionary
Parameters
----------
d : dict
keyvals : dict or list[tuple]
(key,value) pairs to filter by
logic : str
"OR" or "AND" for matching pairs
keep_siblings : bool
keep all sibling paths
list_of_dicts : bool
t... |
filter dict by certain keys
Parameters
----------
d : dict
keys: list
use_wildcards : bool
if true, can use * (matches everything)
and ? (matches any single character)
list_of_dicts: bool
treat list of dicts as additional branches
deepcopy: bool
deepcopy valu... |
filter dict by certain paths containing key sets
Parameters
----------
d : dict
paths : list[str] or list[tuple]
list_of_dicts: bool
treat list of dicts as additional branches
deepcopy: bool
deepcopy values
Examples
--------
>>> from pprint import pprint
>>> d ... |
rename keys in dict
Parameters
----------
d : dict
keymap : dict
dictionary of key name mappings
list_of_dicts: bool
treat list of dicts as additional branches
deepcopy: bool
deepcopy values
Examples
--------
>>> from pprint import pprint
>>> d = {'a':{... |
split an existing key(s) into multiple levels
Parameters
----------
d : dict
or dict like
key: str
existing key value
new_keys: list[str]
new levels to add
before: bool
add level before existing key (else after)
list_of_dicts: bool
treat list of dicts... |
apply a function to all values with a certain leaf (terminal) key
Parameters
----------
d : dict
leaf_key : str
name of leaf key
func : callable
function to apply
new_name : str
if not None, rename leaf_key
remove_lkey: bool
whether to remove original leaf_ke... |
combine values with certain leaf (terminal) keys by a function
Parameters
----------
d : dict
leaf_keys : list
names of leaf keys
func : callable
function to apply,
must take at least len(leaf_keys) arguments
new_name : str
new key name
unflatten_level : int ... |
split_lists key:list pairs into dicts for each item in the lists
NB: will only split if all split_keys are present
Parameters
----------
d : dict
split_keys : list
keys to split
new_name : str
top level key for split items
check_length : bool
if true, raise error if ... |
combine lists of dicts
Parameters
----------
d : dict or list[dict]
keys : list
keys to combine (all if None)
deepcopy: bool
deepcopy values
Example
-------
>>> from pprint import pprint
>>> d = {'path_key': {'a': 1, 'split': [{'x': 1, 'y': 3}, {'x': 2, 'y': 4}]}}
... |
convert a list of dicts to a dict with root keys
Parameters
----------
lst : list[dict]
key : str or None
a key contained by all of the dicts
if None use index number string
remove_key : bool
remove key from dicts in list
Examples
--------
>>> from pprint import... |
return the difference between two dict_like objects
Parameters
----------
new_dict: dict
old_dict: dict
iter_prefix: str
prefix to use for list and tuple indexes
np_allclose: bool
if True, try using numpy.allclose to assess differences
**kwargs:
keyword arguments to ... |
output dict to json
Parameters
----------
dct : dict
jfile : str or file_like
if file_like, must have write method
overwrite : bool
whether to overwrite existing files
dirlevel : int
if jfile is path to folder,
defines how many key levels to set as sub-folders
... |
output dict to json
Parameters
----------
dct : dict
jfile : str or file_like
if file_like, must have write method
overwrite : bool
whether to overwrite existing files
dirlevel : int
if jfile is path to folder,
defines how many key levels to set as sub-folders
... |
Parameters
d: dict
dict in which a key will be inserted/expanded
key: hashable
key in d
new_items: iterable
d[key] will be extended with items in new_items
no_duplicates: bool
avoid inserting duplicates in d[key] (default: True)
def expand_collection_in_dict(d, key, new_... |
Augmented shutil.copy with extra options and slightly
modified behaviour
Parameters
==========
src: string
path to source file
dst: string
path to destingation
only_update: bool
only copy if source is newer than destination
(returns None if it was newer), default... |
Computes the md5 hash of a file.
Parameters
==========
path: string
path to file to compute hash of
Returns
=======
hashlib md5 hash object. Use .digest() or .hexdigest()
on returned object to get binary or hex encoded string.
def md5_of_file(path, nblocks=128):
"""
Comput... |
Investigate if path is non-existant or older than provided reference
path.
Parameters
==========
path: string
path to path which might be missing or too old
other_path: string
reference path
cwd: string
working directory (root of relative paths)
Returns
=======
... |
Imports (cython generated) shared object file (.so)
Provide a list of paths in `only_if_newer_than` to check
timestamps of dependencies. import_ raises an ImportError
if any is newer.
Word of warning: Python's caching or the OS caching (unclear to author)
is horrible for reimporting same path of a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.