Search is not available for this dataset
text stringlengths 75 104k |
|---|
def _create_snapshot(volume):
""" Create a new snapshot
:type volume: boto.ec2.volume.Volume
:param volume: Volume to snapshot
:returns: boto.ec2.snapshot.Snapshot -- The new snapshot
"""
logger.info('Creating new snapshot for {}'.format(volume.id))
snapshot = volume.create_snapshot(
... |
def _ensure_snapshot(connection, volume):
""" Ensure that a given volume has an appropriate snapshot
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume: boto.ec2.volume.Volume
:param volume: Volume to check
:returns: None
"""
if 'Au... |
def _remove_old_snapshots(connection, volume):
""" Remove old snapshots
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume: boto.ec2.volume.Volume
:param volume: Volume to check
:returns: None
"""
if 'AutomatedEBSSnapshotsRetention'... |
def list(connection):
""" List watched EBS volumes
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:returns: None
"""
volumes = get_watched_volumes(connection)
if not volumes:
logger.info('No watched volumes found')
return
l... |
def unwatch(connection, volume_id):
""" Remove watching of a volume
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume_id: str
:param volume_id: VolumeID to add to the watchlist
:returns: bool - True if the watch was successful
"""
... |
def watch(connection, volume_id, interval='daily', retention=0):
""" Start watching a new volume
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume_id: str
:param volume_id: VolumeID to add to the watchlist
:type interval: str
:param in... |
def get_volume_id(connection, volume):
"""
Get Volume ID from the given volume. Input can be volume id
or its Name tag.
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume: str
:param volume: Volume ID or Volume Name
:returns: Volume... |
def watch_from_file(connection, file_name):
""" Start watching a new volume
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type file_name: str
:param file_name: path to config file
:returns: None
"""
with open(file_name, 'r') as filehandle:... |
def unwatch_from_file(connection, file_name):
""" Start watching a new volume
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type file_name: str
:param file_name: path to config file
:returns: None
"""
with open(file_name, 'r') as filehandl... |
def list_snapshots(connection, volume):
""" List all snapshots for the volume
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type volume: str
:param volume: Volume ID or Volume Name
:returns: None
"""
logger.info(
'+---------------... |
def stem(self, words, parser, **kwargs):
"""
Get stems for the words using a given parser
Example:
from .parsing import ListParser
parser = ListParser()
stemmer = Morfologik()
stemmer.stem(['ja tańczę a ona śpi], parser)
[
... |
def _run_morfologik(self, words):
"""
Runs morfologik java jar and assumes that input and output is
UTF-8 encoded.
"""
p = subprocess.Popen(
['java', '-jar', self.jar_path, 'plstem',
'-ie', 'UTF-8',
'-oe', 'UTF-8'],
bufsize=-1,
... |
def read_from_hdx(identifier, configuration=None):
# type: (str, Optional[Configuration]) -> Optional['Showcase']
"""Reads the showcase given by identifier from HDX and returns Showcase object
Args:
identifier (str): Identifier of showcase
configuration (Optional[Configu... |
def get_datasets(self):
# type: () -> List[hdx.data.dataset.Dataset]
"""Get any datasets in the showcase
Returns:
List[Dataset]: List of datasets
"""
assoc_result, datasets_dicts = self._read_from_hdx('showcase', self.data['id'], fieldname='showcase_id',
... |
def _get_showcase_dataset_dict(self, dataset):
# type: (Union[hdx.data.dataset.Dataset,Dict,str]) -> Dict
"""Get showcase dataset dict
Args:
showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary
Returns:
... |
def add_dataset(self, dataset, datasets_to_check=None):
# type: (Union[hdx.data.dataset.Dataset,Dict,str], List[hdx.data.dataset.Dataset]) -> bool
"""Add a dataset
Args:
dataset (Union[Dataset,Dict,str]): Either a dataset id or dataset metadata either from a Dataset object or a dict... |
def add_datasets(self, datasets, datasets_to_check=None):
# type: (List[Union[hdx.data.dataset.Dataset,Dict,str]], List[hdx.data.dataset.Dataset]) -> bool
"""Add multiple datasets
Args:
datasets (List[Union[Dataset,Dict,str]]): A list of either dataset ids or dataset metadata from D... |
def possible_parameter(nb, jsonable_parameter=True, end_cell_index=None):
"""
Find the possible parameters from a jupyter notebook (python3 only).
The possible parameters are obtained by parsing the abstract syntax tree of
the python code generated from the jupyter notebook.
For a jupuyter noteboo... |
def run_jnb(input_path, output_path=r"///_run_jnb/*-output",
execution_path=r'///input',
return_mode='except',
overwrite=False,
timeout=ExecutePreprocessor.timeout.default_value,
kernel_name=ExecutePreprocessor.kernel_name.default_value,
ep_kwargs=... |
def join(self, joiner, formatter=lambda s, t: t.format(s),
template="{}"):
"""Join values and convert to string
Example:
>>> from ww import l
>>> lst = l('012')
>>> lst.join(',')
u'0,1,2'
>>> lst.join(',', template="{}#")
... |
def append(self, *values):
"""Append values at the end of the list
Allow chaining.
Args:
values: values to be appened at the end.
Example:
>>> from ww import l
>>> lst = l([])
>>> lst.append(1)
[1]
>>> lst
... |
def extend(self, *iterables):
"""Add all values of all iterables at the end of the list
Args:
iterables: iterable which content to add at the end
Example:
>>> from ww import l
>>> lst = l([])
>>> lst.extend([1, 2])
[1, 2]
... |
def normalize_cell_value(value):
"""Process value for writing into a cell.
Args:
value: any type of variable
Returns:
json serialized value if value is list or dict, else value
"""
if isinstance(value, dict) or isinstance(value, list):
return json.dumps(value)
return va... |
def get_addresses_from_input_file(input_file_name):
"""Read addresses from input file into list of tuples.
This only supports address and zipcode headers
"""
mode = 'r'
if sys.version_info[0] < 3:
mode = 'rb'
with io.open(input_file_name, mode) as input_file:
reader = csv.read... |
def get_identifiers_from_input_file(input_file_name):
"""Read identifiers from input file into list of dicts with the header row values
as keys, and the rest of the rows as values.
"""
valid_identifiers = ['address', 'zipcode', 'unit', 'city', 'state', 'slug', 'block_id', 'msa',
... |
def get_real_time_locate(ipAddress, auth, url):
"""
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the
target host is currently connected to. Note: Although intended to return a single location, Multiple locations may
be returned for a sing... |
def get_ip_mac_arp_list(devId, auth,url):
"""
function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device.
:param devId: int or str value of the target device.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
... |
def get_ip_scope_detail(scopeId, auth, url ):
"""
function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the
optional scopeId parameter is included, this will automatically return only the desired scope id.
:param scopeId: integer of the desired scop... |
def delete_ip_scope(network_address, auth, url):
'''Function to delete an entire IP segment from the IMC IP Address management under terminal access
:param network_address
:param auth
:param url
>>> from pyhpeimc.auth import *
>>> from pyhpeimc.plat.termaccess import *
>>> auth = IMCAuth(... |
def add_scope_ip(ipaddress, name, description, scopeid, auth, url):
"""
Function to add new host IP address allocation to existing scope ID
:param ipaddress:
:param name: name of the owner of this host
:param description: Description of the host
:param auth: requests auth object #usually aut... |
def remove_scope_ip(hostid, auth, url):
"""
Function to add remove IP address allocation
:param hostid: Host id of the host to be deleted
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au... |
def get_ip_scope_hosts( scopeId, auth, url):
"""
Function requires input of scope ID and returns list of allocated IP address for the specified scope
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS interface #usually auth.url from pyhp... |
def add_host_to_segment(ipaddress, name, description, network_address, auth, url):
''' Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human
to learn the scope_id
:param ipaddress:
:param name: name of the owner of this host
:param descrip... |
def delete_host_from_segment(ipaddress, networkaddress, auth, url):
'''Function to abstract
'''
host_id = get_host_id(ipaddress, networkaddress, auth, url)
remove_scope_ip(host_id, auth.creds, auth.url) |
def generate_signature(method, version, endpoint,
date, rel_url, content_type, content,
access_key, secret_key, hash_type):
'''
Generates the API request signature from the given parameters.
'''
hash_type = hash_type
hostname = endpoint._val.netloc # FI... |
async def list_with_limit(cls,
limit,
offset,
status: str = 'ALIVE',
fields: Iterable[str] = None) -> Sequence[dict]:
'''
Fetches the list of agents with the given status with limit an... |
def set_content(self, value: RequestContent, *,
content_type: str = None):
'''
Sets the content of the request.
'''
assert self._attached_files is None, \
'cannot set content because you already attached files.'
guessed_content_type = 'applicati... |
def set_json(self, value: object):
'''
A shortcut for set_content() with JSON objects.
'''
self.set_content(modjson.dumps(value, cls=ExtendedJSONEncoder),
content_type='application/json') |
def attach_files(self, files: Sequence[AttachedFile]):
'''
Attach a list of files represented as AttachedFile.
'''
assert not self._content, 'content must be empty to attach files.'
self.content_type = 'multipart/form-data'
self._attached_files = files |
def _sign(self, rel_url, access_key=None, secret_key=None, hash_type=None):
'''
Calculates the signature of the given request and adds the
Authorization HTTP header.
It should be called at the very end of request preparation and before
sending the request to the server.
'... |
def fetch(self, **kwargs) -> 'FetchContextManager':
'''
Sends the request to the server and reads the response.
You may use this method either with plain synchronous Session or
AsyncSession. Both the followings patterns are valid:
.. code-block:: python3
from ai.bac... |
def connect_websocket(self, **kwargs) -> 'WebSocketContextManager':
'''
Creates a WebSocket connection.
.. warning::
This method only works with
:class:`~ai.backend.client.session.AsyncSession`.
'''
assert isinstance(self.session, AsyncSession), \
... |
def main():
"""
Main function.
:return:
None.
"""
try:
# Get the `src` directory's absolute path
src_path = os.path.dirname(
# `aoiklivereload` directory's absolute path
os.path.dirname(
# `demo` directory's absolute path
... |
def add_perf_task(task, auth, url):
"""
function takes the a python dict containing all necessary fields for a performance tasks,
transforms the dict into JSON and issues a RESTFUL call to create the performance task. device.
:param task: dictionary containing all required fields for performance tasks
... |
def get_perf_task(task_name, auth, url):
"""
function takes the a str object containing the name of an existing performance tasks and
issues a RESTFUL call to the IMC REST service. It will return a list
:param task_name: str containing the name of the performance task
:param auth: ... |
def delete_perf_task(task_name, auth, url):
"""
Function takes a str of the target task_name to be deleted and retrieves task_id using
the get_perf_task function. Once the task_id has been successfully retrieved it is
populated into the task_id variable and an DELETE call is made against the HPE IMC RES... |
def process_json_response(self, response):
"""For a json response, check if there was any error and throw exception.
Otherwise, create a housecanary.response.Response."""
response_json = response.json()
# handle errors
code_key = "code"
if code_key in response_json and ... |
def start_watcher_thread(self):
"""
Start watcher thread.
:return:
Watcher thread object.
"""
# Create watcher thread
watcher_thread = threading.Thread(target=self.run_watcher)
# If the reload mode is `spawn_wait`
if self._reload_mode == self... |
def run_watcher(self):
"""
Watcher thread's function.
:return:
None.
"""
# Create observer
observer = Observer()
# Start observer
observer.start()
# Dict that maps file path to `watch object`
watche_obj_map = {}
# Ru... |
def _find_watch_paths(self):
"""
Find paths to watch.
:return:
Paths to watch.
"""
# Add directory paths in `sys.path` to watch paths
watch_path_s = set(os.path.abspath(x) for x in sys.path)
# For each extra path
for extra_path in self._extra... |
def _find_short_paths(self, paths):
"""
Find short paths of given paths.
E.g. if both `/home` and `/home/aoik` exist, only keep `/home`.
:param paths:
Paths.
:return:
Set of short paths.
"""
# Split each path to parts.
# E.g. '/h... |
def _collect_leaf_paths(self, node, path_parts, leaf_paths):
"""
Collect paths of leaf nodes.
:param node:
Starting node. Type is dict.
Key is child node's path part. Value is child node.
:param path_parts:
The starting node's path parts. Type is tu... |
def dispatch(self, event):
"""
Dispatch file system event.
Callback called when there is a file system event. Hooked at 2KGRW.
This function overrides `FileSystemEventHandler.dispatch`.
:param event:
File system event object.
:return:
None.
... |
def reload(self):
"""
Reload the program.
:return:
None.
"""
# Get reload mode
reload_mode = self._reload_mode
# If reload mode is `exec`
if self._reload_mode == self.RELOAD_MODE_V_EXEC:
# Call `reload_using_exec`
self... |
def reload_using_exec(self):
"""
Reload the program process.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Reload the program process
os.e... |
def reload_using_spawn_exit(self):
"""
Spawn a subprocess and exit the current process.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Spawn subpro... |
def reload_using_spawn_wait(self):
"""
Spawn a subprocess and wait until it finishes.
:return:
None.
"""
# Create command parts
cmd_parts = [sys.executable] + sys.argv
# Get env dict copy
env_copy = os.environ.copy()
# Send interrupt... |
def agent(agent_id):
'''
Show the information about the given agent.
'''
fields = [
('ID', 'id'),
('Status', 'status'),
('Region', 'region'),
('First Contact', 'first_contact'),
('CPU Usage (%)', 'cpu_cur_pct'),
('Used Memory (MiB)', 'mem_cur_bytes'),
... |
def agents(status, all):
'''
List and manage agents.
(admin privilege required)
'''
fields = [
('ID', 'id'),
('Status', 'status'),
('Region', 'region'),
('First Contact', 'first_contact'),
('CPU Usage (%)', 'cpu_cur_pct'),
('Used Memory (MiB)', 'mem_cu... |
def resource_policy(name):
"""
Show details about a keypair resource policy. When `name` option is omitted, the
resource policy for the current access_key will be returned.
"""
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Default for Unspecified', 'default_for... |
def resource_policies(ctx):
'''
List and manage resource policies.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('Name', 'name'),
('Created At', 'created_at'),
('Default for Unspecified', 'default_for_unspecified'),
... |
def add(name, default_for_unspecified, total_resource_slots, max_concurrent_sessions,
max_containers_per_session, max_vfolder_count, max_vfolder_size,
idle_timeout, allowed_vfolder_hosts):
'''
Add a new keypair resource policy.
NAME: NAME of a new keypair resource policy.
'''
with S... |
def delete(name):
"""
Delete a keypair resource policy.
NAME: NAME of a keypair resource policy to delete.
"""
with Session() as session:
if input('Are you sure? (y/n): ').lower().strip()[:1] != 'y':
print('Canceled.')
sys.exit(1)
try:
data = sess... |
def app(session_id, app, bind, port):
"""
Run a local proxy to a service provided by Backend.AI compute sessions.
The type of proxy depends on the app definition: plain TCP or HTTP.
\b
SESSID: The compute session ID.
APP: The name of service provided by the given session.
"""
api_sessi... |
def get_env(key: str,
default: Any = None,
clean: Callable[[str], Any] = lambda v: v):
'''
Retrieves a configuration value from the environment variables.
The given *key* is uppercased and prefixed by ``"BACKEND_"`` and then
``"SORNA_"`` if the former does not exist.
:param ... |
def logs(sess_id_or_alias):
'''
Shows the output logs of a running container.
\b
SESSID: Session ID or its alias given when creating the session.
'''
with Session() as session:
try:
print_wait('Retrieving container logs...')
kernel = session.Kernel(sess_id_or_ali... |
def _wrap_key(function, args, kws):
'''
get the key from the function input.
'''
return hashlib.md5(pickle.dumps((_from_file(function) + function.__name__, args, kws))).hexdigest() |
def get(key, adapter = MemoryAdapter):
'''
get the cache value
'''
try:
return pickle.loads(adapter().get(key))
except CacheExpiredException:
return None |
def set(key, value, timeout = -1, adapter = MemoryAdapter):
'''
set cache by code, must set timeout length
'''
if adapter(timeout = timeout).set(key, pickle.dumps(value)):
return value
else:
return None |
def wrapcache(timeout = -1, adapter = MemoryAdapter):
'''
the Decorator to cache Function.
'''
def _wrapcache(function):
@wraps(function)
def __wrapcache(*args, **kws):
hash_key = _wrap_key(function, args, kws)
try:
adapter_instance = adapter()
return pickle.loads(adapter_instance.get(hash_key))
... |
def export_analytics_data_to_excel(data, output_file_name, result_info_key, identifier_keys):
"""Creates an Excel file containing data returned by the Analytics API
Args:
data: Analytics API data as a list of dicts
output_file_name: File name for output Excel file (use .xlsx extension).
""... |
def export_analytics_data_to_csv(data, output_folder, result_info_key, identifier_keys):
"""Creates CSV files containing data returned by the Analytics API.
Creates one file per requested endpoint and saves it into the
specified output_folder
Args:
data: Analytics API data as a list of di... |
def concat_excel_reports(addresses, output_file_name, endpoint, report_type,
retry, api_key, api_secret, files_path):
"""Creates an Excel file made up of combining the Value Report or Rental Report Excel
output for the provided addresses.
Args:
addresses: A list of (addr... |
def create_excel_workbook(data, result_info_key, identifier_keys):
"""Calls the analytics_data_excel module to create the Workbook"""
workbook = analytics_data_excel.get_excel_workbook(data, result_info_key, identifier_keys)
adjust_column_width_workbook(workbook)
return workbook |
def adjust_column_width(worksheet):
"""Adjust column width in worksheet.
Args:
worksheet: worksheet to be adjusted
"""
dims = {}
padding = 1
for row in worksheet.rows:
for cell in row:
if not cell.value:
continue
dims[cell.column] = max(
... |
def get_ap_info(ipaddress, auth, url):
"""
function takes input of ipaddress to RESTFUL call to HP IMC
:param ipaddress: The current IP address of the Access Point at time of query.
:param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class
:param url: base url of IMC RS ... |
def sessions(status, access_key, id_only, all):
'''
List and manage compute sessions.
'''
fields = [
('Session ID', 'sess_id'),
]
with Session() as session:
if is_admin(session):
fields.append(('Owner', 'access_key'))
if not id_only:
fields.extend([
... |
def session(sess_id_or_alias):
'''
Show detailed information for a running compute session.
SESSID: Session id or its alias.
'''
fields = [
('Session ID', 'sess_id'),
('Role', 'role'),
('Image', 'image'),
('Tag', 'tag'),
('Created At', 'created_at'),
... |
def create(cls, endpoint_name, json_body, original_response):
"""Factory for creating the correct type of Response based on the data.
Args:
endpoint_name (str) - The endpoint of the request, such as "property/value"
json_body - The response body in json format.
origin... |
def get_object_errors(self):
"""Gets a list of business error message strings
for each of the requested objects that had a business error.
If there was no error, returns an empty list
Returns:
List of strings
"""
if self._object_errors is None:
se... |
def has_object_error(self):
"""Returns true if any requested object had a business logic error,
otherwise returns false
Returns:
boolean
"""
if self._has_object_error is None:
# scan the objects for any business error codes
self._has_object_er... |
def rate_limits(self):
"""Returns a list of rate limit details."""
if not self._rate_limits:
self._rate_limits = utilities.get_rate_limits(self.response)
return self._rate_limits |
def check_imc_creds(auth, url):
"""Function takes input of auth class object auth object and URL and returns a BOOL of TRUE
if the authentication was successful.
>>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin")
>>> check_imc_creds(auth.creds, auth.url)
True
"""
tes... |
def print_to_file(object_name):
"""
Function takes in object of type str, list, or dict and prints out to current working
directory as pyoutput.txt
:param: Object: object of type str, list, or dict
:return: No return. Just prints out to file handler and save to current working directory as
pyou... |
def get_auth(self):
"""
This method requests an authentication object from the HPE IMC NMS and returns an
HTTPDigest Auth Object
:return:
"""
url = self.h_url + self.server + ":" + self.port
auth = requests.auth.HTTPDigestAuth(self.username, self.password)
... |
def print_title(title, is_end=False):
"""
Print title like ``----- {title} -----`` or ``===== {title} =====``.
:param title: Title.
:param is_end: Whether is end title. End title use ``=`` instead of ``-``.
:return: None.
"""
# If is end title
if is_end:
# Use `=`
sep ... |
def get_full_python_version():
"""
Get full Python version.
E.g.
- `2.7.11.final.0.32bit`
- `3.5.1.final.0.64bit`
:return: Full Python version.
"""
# Get version part, e.g. `3.5.1.final.0`
version_part = '.'.join(str(x) for x in sys.version_info)
# Get integer width, e... |
def get_python_path(venv_path):
"""
Get given virtual environment's `python` program path.
:param venv_path: Virtual environment directory path.
:return: `python` program path.
"""
# Get `bin` directory path
bin_path = get_bin_path(venv_path)
# Get `python` program path
program_pa... |
def add_options(ctx):
"""
Add command line options.
:return: None.
"""
# Add option
ctx.add_option(
'--always',
action='store_true',
default=False,
dest='always',
help='whether always run tasks.',
)
# Add option
ctx.add_option(
'--che... |
def add_pythonpath(path):
"""
Prepend given path to environment variable PYTHONPATH.
:param path: Path to add to PYTHONPATH.
:return: New PYTHONPATH value.
"""
# Get PYTHONPATH value. Default is empty string.
pythonpath = os.environ.setdefault('PYTHONPATH', '')
# If given path is not ... |
def mark_path(path):
"""
Wrap given path as relative path relative to top directory.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param path: Relative path relative to top directory.
:return: Wrapper object.
"""
# If given path is not string,
#... |
def _mark_target(type, item):
"""
Wrap given item as input or output target that should be added to task.
Wrapper object will be handled specially in \
:paramref:`create_cmd_task.parts`.
:param type: Target type.
Allowed values:
- 'input'
- 'output'
:param ite... |
def create_node(ctx, path):
"""
Create node for given relative path.
:param ctx: BuildContext object.
:param path: Relative path relative to top directory.
:return: Created Node.
"""
# Ensure given context object is BuildContext object
_ensure_build_context(ctx)
# Get top directo... |
def _normalize_items(
ctx,
items,
str_to_node=False,
node_to_str=False,
allow_task=False,
):
"""
Normalize given items.
Do several things:
- Ignore None.
- Flatten list.
- Unwrap wrapped item in `_ItemWrapper`.
:param ctx: BuildContext object.
:param it... |
def update_touch_file(
ctx,
path,
check_import=False,
check_import_module=None,
check_import_python=None,
always=False,
):
"""
Update touch file at given path.
Do two things:
- Create touch file if it not exists.
- Update touch file if import checking fails.
The... |
def chain_tasks(tasks):
"""
Chain given tasks. Set each task to run after its previous task.
:param tasks: Tasks list.
:return: Given tasks list.
"""
# If given tasks list is not empty
if tasks:
# Previous task
previous_task = None
# For given tasks list's each tas... |
def create_cmd_task(
ctx,
parts,
inputs=None,
outputs=None,
env=None,
cwd=None,
task_name=None,
cache_key=None,
always=False,
add_to_group=True,
):
"""
Create task that runs given command.
:param ctx: BuildContext object.
:param parts: Command parts list.
... |
def build_ctx(pythonpath=None):
"""
Decorator that makes decorated function use BuildContext instead of \
Context instance. BuildContext instance has more methods.
:param pythonpath: Path or list of paths to add to environment variable
PYTHONPATH. Each path can be absolute path, or relative pat... |
def config_ctx(func):
"""
Decorator that makes decorated function use ConfigurationContext instead \
of Context instance.
:param func: Decorated function.
:return: Decorated function.
"""
# Create ConfigurationContext subclass
class _ConfigurationContext(ConfigurationContext):
... |
def print_ctx(ctx):
"""
Print given context's info.
:param ctx: Context object.
:return: None.
"""
# Print title
print_title('ctx attributes')
# Print context object's attributes
print_text(dir(ctx))
# Print end title
print_title('ctx attributes', is_end=True)
# Prin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.