Search is not available for this dataset
text stringlengths 75 104k |
|---|
def keypair():
'''
Show the server-side information of the currently configured access key.
'''
fields = [
('User ID', 'user_id'),
('Access Key', 'access_key'),
('Secret Key', 'secret_key'),
('Active?', 'is_active'),
('Admin?', 'is_admin'),
('Created At', ... |
def keypairs(ctx, user_id, is_active):
'''
List and manage keypairs.
To show all keypairs or other user's, your access key must have the admin
privilege.
(admin privilege required)
'''
if ctx.invoked_subcommand is not None:
return
fields = [
('User ID', 'user_id'),
... |
def add(user_id, resource_policy, admin, inactive, rate_limit):
'''
Add a new keypair.
USER_ID: User ID of a new key pair.
RESOURCE_POLICY: resource policy for new key pair.
'''
try:
user_id = int(user_id)
except ValueError:
pass # string-based user ID for Backend.AI v1.4+... |
def update(access_key, resource_policy, is_admin, is_active, rate_limit):
'''
Update an existing keypair.
ACCESS_KEY: Access key of an existing key pair.
'''
with Session() as session:
try:
data = session.KeyPair.update(
access_key,
is_active=is_... |
def delete(access_key):
"""
Delete an existing keypair.
ACCESSKEY: ACCESSKEY for a keypair to delete.
"""
with Session() as session:
try:
data = session.KeyPair.delete(access_key)
except Exception as e:
print_error(e)
sys.exit(1)
if not da... |
def login(self):
""" perform API auth test returning user and team """
log.debug('performing auth test')
test = self._get(urls['test'])
user = User({ 'name': test['user'], 'id': test['user_id'] })
self._refresh()
return test['team'], user |
def user(self, match):
""" Return User object for a given Slack ID or name """
if len(match) == 9 and match[0] == 'U':
return self._lookup(User, 'id', match)
return self._lookup(User, 'name', match) |
def channel(self, match):
""" Return Channel object for a given Slack ID or name """
if len(match) == 9 and match[0] in ('C','G','D'):
return self._lookup(Channel, 'id', match)
return self._lookup(Channel, 'name', match) |
def _refresh(self):
""" refresh internal directory cache """
log.debug('refreshing directory cache')
self._users.update(list(self._user_gen()))
self._channels.update(list(self._channel_gen())) |
def match(self, attr, val):
""" lookup object in directory with attribute matching value """
self._lock.acquire()
try:
for x in self:
if getattr(x, attr) == val:
return x
finally:
self._lock.release() |
def _groups_of_size(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks."""
# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args) |
def slice_repr(slice_instance):
"""
Turn things like `slice(None, 2, -1)` into `:2:-1`.
"""
if not isinstance(slice_instance, slice):
raise TypeError('Unhandled type {}'.format(type(slice_instance)))
start = slice_instance.start or ''
stop = slice_instance.stop or ''
step = slice_in... |
def biggus_chunk(chunk_key, biggus_array, masked):
"""
A function that lazily evaluates a biggus.Chunk. This is useful for
passing through as a dask task so that we don't have to compute the
chunk in order to compute the graph.
"""
if masked:
array = biggus_a... |
def _make_stream_handler_nodes(self, dsk_graph, array, iteration_order,
masked):
"""
Produce task graph entries for an array that comes from a biggus
StreamsHandler.
This is essentially every type of array that isn't already a thing on
disk/in-... |
def lazy_chunk_creator(name):
"""
Create a lazy chunk creating function with a nice name that is suitable
for representation in a dask graph.
"""
# TODO: Could this become a LazyChunk class?
def biggus_chunk(chunk_key, biggus_array, masked):
"""
A... |
def _make_nodes(self, dsk_graph, array, iteration_order, masked,
top=False):
"""
Recursive function that returns the dask items for the given array.
NOTE: Currently assuming that all tasks are a tuple, with the second
item being the keys used to index the source of t... |
def group_keys(shape, *inputs_keys):
"""
Usecase: Two sets of chunks, one spans the whole of a dimension, the other
chunked it up. We need to know that we need to collect together the
chunked form, so that we can work with both sets at the same time.
Conceptually we have multiple source inputs, ea... |
def get_password(prompt='Password: ', confirm=False):
"""
<Purpose>
Return the password entered by the user. If 'confirm' is True, the user is
asked to enter the previously entered password once again. If they match,
the password is returned to the caller.
<Arguments>
prompt:
The text of ... |
def generate_and_write_rsa_keypair(filepath=None, bits=DEFAULT_RSA_KEY_BITS,
password=None):
"""
<Purpose>
Generate an RSA key pair. The public portion of the generated RSA key is
saved to <'filepath'>.pub, whereas the private key portion is saved to
<'filepath'>. If no password is given, the user... |
def import_rsa_privatekey_from_file(filepath, password=None,
scheme='rsassa-pss-sha256', prompt=False):
"""
<Purpose>
Import the PEM file in 'filepath' containing the private key.
If password is passed use passed password for decryption.
If prompt is True use entered password for decryption.
If... |
def import_rsa_publickey_from_file(filepath):
"""
<Purpose>
Import the RSA key stored in 'filepath'. The key object returned is in the
format 'securesystemslib.formats.RSAKEY_SCHEMA'. If the RSA PEM in
'filepath' contains a private key, it is discarded.
<Arguments>
filepath:
<filepath>.pu... |
def generate_and_write_ed25519_keypair(filepath=None, password=None):
"""
<Purpose>
Generate an Ed25519 keypair, where the encrypted key (using 'password' as
the passphrase) is saved to <'filepath'>. The public key portion of the
generated Ed25519 key is saved to <'filepath'>.pub. If the filepath is n... |
def import_ed25519_publickey_from_file(filepath):
"""
<Purpose>
Load the ED25519 public key object (conformant to
'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return
'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format.
If the key object in 'filepath' contains a private ... |
def import_ed25519_privatekey_from_file(filepath, password=None, prompt=False):
"""
<Purpose>
Import the encrypted ed25519 key file in 'filepath', decrypt it, and return
the key object in 'securesystemslib.formats.ED25519KEY_SCHEMA' format.
The private key (may also contain the public part) is encrypte... |
def generate_and_write_ecdsa_keypair(filepath=None, password=None):
"""
<Purpose>
Generate an ECDSA keypair, where the encrypted key (using 'password' as the
passphrase) is saved to <'filepath'>. The public key portion of the
generated ECDSA key is saved to <'filepath'>.pub. If the filepath is not
... |
def import_ecdsa_publickey_from_file(filepath):
"""
<Purpose>
Load the ECDSA public key object (conformant to
'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return
'filepath' in securesystemslib.formats.ECDSAKEY_SCHEMA format.
If the key object in 'filepath' contains a private key, i... |
def import_ecdsa_privatekey_from_file(filepath, password=None):
"""
<Purpose>
Import the encrypted ECDSA key file in 'filepath', decrypt it, and return
the key object in 'securesystemslib.formats.ECDSAKEY_SCHEMA' format.
The 'cryptography' library is currently supported and performs the actual
cryp... |
def wait_until_element_has_focus(self, locator, timeout=None):
"""Waits until the element identified by `locator` has focus.
You might rather want to use `Element Focus Should Be Set`
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| timeout | maximum time to wa... |
def wait_until_element_does_not_have_focus(self, locator, timeout=None):
"""Waits until the element identified by `locator` doesn't have focus.
You might rather want to use `Element Focus Should Not Be Set`
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| timeo... |
def wait_until_element_value_is(self, locator, expected, strip=False, timeout=None):
"""Waits until the element identified by `locator` value is exactly the
expected value. You might want to use `Element Value Should Be` instead.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator... |
def wait_until_element_value_contains(self, locator, expected, timeout=None):
"""Waits until the element identified by `locator` contains
the expected value. You might want to use `Element Value Should Contain` instead.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_i... |
def set_element_focus(self, locator):
"""Sets focus on the element identified by `locator`. Should
be used with elements meant to have focus only, such as
text fields. This keywords also waits for the focus to be
active by calling the `Wait Until Element Has Focus` keyword.
| *Argument* | *Description* | *Ex... |
def clear_input_field(self, locator, method=0):
"""Clears the text field identified by `locator`
The element.clear() method doesn't seem to work properly on
all browsers, so this keyword was created to offer alternatives.
The `method` argument defines the method it should use in order
to clear the target fi... |
def element_text_color_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
text color (it verifies the CSS attribute color). Color should be in
RGBA format.
Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA)
| *Argument* | *Description* | *Example* |
| l... |
def element_background_color_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
background color (it verifies the CSS attribute background-color). Color should
be in RGBA format.
Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA)
| *Argument* | *Descripti... |
def element_width_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
width. Expected width should be in pixels.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected width | 800 |"""
self._info... |
def element_height_should_be(self, locator, expected):
"""Verifies the element identified by `locator` has the expected
height. Expected height should be in pixels.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected height | 600 |"""
self._... |
def element_value_should_be(self, locator, expected, strip=False):
"""Verifies the element identified by `locator` has the expected value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected value | My Name Is Slim Shady |
| strip | Boolean, de... |
def element_value_should_not_be(self, locator, value, strip=False):
"""Verifies the element identified by `locator` is not the specified value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| value | value it should not be | My Name Is Slim Shady |
| strip | B... |
def element_value_should_contain(self, locator, expected):
"""Verifies the element identified by `locator` contains the expected value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| expected | expected value | Slim Shady |"""
self._info("Verifying element '... |
def element_value_should_not_contain(self, locator, value):
"""Verifies the element identified by `locator` does not contain the specified value.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| value | value it should not contain | Slim Shady |"""
self._info(... |
def element_focus_should_be_set(self, locator):
"""Verifies the element identified by `locator` has focus.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |"""
self._info("Verifying element '%s' focus is set" % locator)
self._check_element_focus(True, locator) |
def element_focus_should_not_be_set(self, locator):
"""Verifies the element identified by `locator` does not have focus.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |"""
self._info("Verifying element '%s' focus is not set" % locator)
self._check_element_focus... |
def element_css_attribute_should_be(self, locator, prop, expected):
"""Verifies the element identified by `locator` has the expected
value for the targeted `prop`.
| *Argument* | *Description* | *Example* |
| locator | Selenium 2 element locator | id=my_id |
| prop | targeted css attribute | background-color... |
def wait_until_page_contains_elements(self, timeout, *locators):
"""This is a copy of `Wait Until Page Contains Element` but it allows
multiple arguments in order to wait for more than one element.
| *Argument* | *Description* | *Example* |
| timeout | maximum time to wait, if set to ${None} it will use Sele... |
def wait_until_page_contains_one_of_these_elements(self, timeout, *locators):
"""Waits until at least one of the specified elements is found.
| *Argument* | *Description* | *Example* |
| timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s |
| *locators | Selenium 2 e... |
def wait_until_page_does_not_contain_these_elements(self, timeout, *locators):
"""Waits until all of the specified elements are not found on the page.
| *Argument* | *Description* | *Example* |
| timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s |
| *locators | Selen... |
def tap_key(self, key, complementKey=None) :
"""Presses the specified `key`. The `complementKey` defines the key to hold
when pressing the specified `key`. For example, you could use ${VK_TAB} as `key` and
use ${VK_SHIFT} as `complementKey' in order to press Shift + Tab (back tab)
| =Argument= | =Description= ... |
def wait_until_element_is_clickable(self, locator, timeout=None):
"""Clicks the element specified by `locator` until the operation succeeds. This should be
used with buttons that are generated in real-time and that don't have their click handling available
immediately. This keyword avoids unclickable element exce... |
def _visitor_impl(self, arg):
"""Actual visitor method implementation."""
if (_qualname(type(self)), type(arg)) in _methods:
method = _methods[(_qualname(type(self)), type(arg))]
return method(self, arg)
else:
# if no visitor method found for this arg type,
# search in parent... |
def visitor(arg_type):
"""Decorator that creates a visitor method."""
def decorator(fn):
declaring_class = _declaring_class(fn)
_methods[(declaring_class, arg_type)] = fn
# Replace all decorated methods with _visitor_impl
return _visitor_impl
return decorator |
def absolute(parser, token):
'''
Returns a full absolute URL based on the request host.
This template tag takes exactly the same paramters as url template tag.
'''
node = url(parser, token)
return AbsoluteUrlNode(
view_name=node.view_name,
args=node.args,
kwargs=node.kwa... |
def site(parser, token):
'''
Returns a full absolute URL based on the current site.
This template tag takes exactly the same paramters as url template tag.
'''
node = url(parser, token)
return SiteUrlNode(
view_name=node.view_name,
args=node.args,
kwargs=node.kwargs,
... |
def _wait_until_exp(self, timeout, error, function, *args):
"""This replaces the method from Selenium2Library to fix the major logic error in it"""
error = error.replace('<TIMEOUT>', self._format_timeout(timeout))
def wait_func():
return None if function(*args) else error
self._wait_until_no_error_ex... |
def _wait_until_no_error_exp(self, timeout, wait_func, *args):
"""This replaces the method from Selenium2Library to fix the major logic error in it"""
timeout = robot.utils.timestr_to_secs(timeout) if timeout is not None else self._timeout_in_secs
maxtime = time.time() + timeout
while True:
try:
... |
def rst(filename):
'''
Load rst file and sanitize it for PyPI.
Remove unsupported github tags:
- code-block directive
'''
content = open(filename).read()
return re.sub(r'\.\.\s? code-block::\s*(\w|\+)+', '::', content) |
def get_callable_method_dict(obj):
"""Returns a dictionary of callable methods of object `obj`.
@param obj: ZOS API Python COM object
@return: a dictionary of callable methods
Notes:
the function only returns the callable attributes that are listed by dir()
function. Properties are not r... |
def replicate_methods(srcObj, dstObj):
"""Replicate callable methods from a `srcObj` to `dstObj` (generally a wrapper object).
@param srcObj: source object
@param dstObj: destination object of the same type.
@return : none
Implementer notes:
1. Once the methods are mapped from the `s... |
def get_properties(zos_obj):
"""Returns a lists of properties bound to the object `zos_obj`
@param zos_obj: ZOS API Python COM object
@return prop_get: list of properties that are only getters
@return prop_set: list of properties that are both getters and setters
"""
prop_get = set(zos_obj._pro... |
def managed_wrapper_class_factory(zos_obj):
"""Creates and returns a wrapper class of a ZOS object, exposing the ZOS objects
methods and propertis, and patching custom specialized attributes
@param zos_obj: ZOS API Python COM object
"""
cls_name = repr(zos_obj).split()[0].split('.')[-1]
disp... |
def wrapped_zos_object(zos_obj):
"""Helper function to wrap ZOS API COM objects.
@param zos_obj : ZOS API Python COM object
@return: instance of the wrapped ZOS API class. If the input object is not a ZOS-API
COM object or if it is already wrapped, then the object is returned without
... |
def generate_public_and_private(scheme='ecdsa-sha2-nistp256'):
"""
<Purpose>
Generate a pair of ECDSA public and private keys with one of the supported,
external cryptography libraries. The public and private keys returned
conform to 'securesystemslib.formats.PEMECDSA_SCHEMA' and
'securesystemslib.... |
def create_signature(public_key, private_key, data, scheme='ecdsa-sha2-nistp256'):
"""
<Purpose>
Return a (signature, scheme) tuple.
>>> requested_scheme = 'ecdsa-sha2-nistp256'
>>> public, private = generate_public_and_private(requested_scheme)
>>> data = b'The quick brown fox jumps over the lazy ... |
def verify_signature(public_key, scheme, signature, data):
"""
<Purpose>
Verify that 'signature' was produced by the private key associated with
'public_key'.
>>> scheme = 'ecdsa-sha2-nistp256'
>>> public, private = generate_public_and_private(scheme)
>>> data = b'The quick brown fox jumps over... |
def create_ecdsa_public_and_private_from_pem(pem, password=None):
"""
<Purpose>
Create public and private ECDSA keys from a private 'pem'. The public and
private keys are strings in PEM format:
public: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----',
private: '-----BEGIN EC PRIVATE KEY--... |
def create_ecdsa_encrypted_pem(private_pem, passphrase):
"""
<Purpose>
Return a string in PEM format, where the private part of the ECDSA key is
encrypted. The private part of the ECDSA key is encrypted as done by
pyca/cryptography: "Encrypt using the best available encryption for a given
key's back... |
def reset(self):
"""Clean any processing data, and prepare object for reuse
"""
self.current_table = None
self.tables = []
self.data = [{}]
self.additional_data = {}
self.lines = []
self.set_state('document')
self.current_file = None
self.s... |
def _parse_line(self, file):
"""Parse single line (or more if particular keyword actually demands it)
:param file:
:type file: file
"""
line = self._strip_comments(file.readline())
# check if the file ended
if not line:
return False
# line w... |
def _set_table(self, data):
"""Set current parsing state to 'table',
create new table object and add it to tables collection
"""
self.set_state('table')
self.current_table = HEPTable(index=len(self.tables) + 1)
self.tables.append(self.current_table)
self.data.appe... |
def _parse_table_data(self, data):
"""Parse dataset data of the original HEPData format
:param data: header of the table to be parsed
:raise ValueError:
"""
header = data.split(':')
self.current_table.data_header = header
for i, h in enumerate(header):
... |
def _reformat_matrix(self):
"""Transform a square matrix into a format with two independent variables and one dependent variable.
"""
nxax = len(self.current_table.data['independent_variables'])
nyax = len(self.current_table.data['dependent_variables'])
npts = len(self.current_ta... |
def _parse_qual(self, data):
"""Parse qual attribute of the old HEPData format
example qual:
*qual: RE : P P --> Z0 Z0 X
:param data: data to be parsed
:type data: str
"""
list = []
headers = data.split(':')
name = headers[0].strip()
nam... |
def _parse_header(self, data):
"""Parse header (xheader or yheader)
:param data: data to be parsed
:type data: str
:return: list with header's data
:rtype: list
"""
return_list = []
headers = data.split(':')
for header in headers:
he... |
def _strip_comments(line):
"""Processes line stripping any comments from it
:param line: line to be processed
:type line: str
:return: line with removed comments
:rtype: str
"""
if line == '':
return line
r = re.search('(?P<line>[^#]*)(#(?P<co... |
def _read_multiline(self, init_data):
"""Reads multiline symbols (ususally comments)
:param init_data: initial data (parsed from the line containing keyword)
:return: parsed value of the multiline symbol
:rtype: str
"""
result = init_data
first = True
wh... |
def _bind_set_table_metadata(self, key, multiline=False):
"""Returns parsing function which will parse data as text, and add it to the table metatadata dictionary
with the provided key
:param key: dictionary key under which parsed data will be added to table.metadata
:type key: str
... |
def _bind_parse_additional_data(self, key, multiline=False):
"""Returns parsing function which will parse data as text, and add it to the table additional data dictionary
with the provided key
:param key: dictionary key under which parsed data will be added to table.metadata
:type key: ... |
def error_value_processor(value, error):
"""
If an error is a percentage, we convert to a float, then
calculate the percentage of the supplied value.
:param value: base value, e.g. 10
:param error: e.g. 20.0%
:return: the absolute error, e.g. 12 for the above case.
"""
if isinstance(err... |
def get_file_details(filepath, hash_algorithms=['sha256']):
"""
<Purpose>
To get file's length and hash information. The hash is computed using the
sha256 algorithm. This function is used in the signerlib.py and updater.py
modules.
<Arguments>
filepath:
Absolute file path of a file.
... |
def ensure_parent_dir(filename):
"""
<Purpose>
To ensure existence of the parent directory of 'filename'. If the parent
directory of 'name' does not exist, create it.
Example: If 'filename' is '/a/b/c/d.txt', and only the directory '/a/b/'
exists, then directory '/a/b/c/d/' will be created.
<Ar... |
def file_in_confined_directories(filepath, confined_directories):
"""
<Purpose>
Check if the directory containing 'filepath' is in the list/tuple of
'confined_directories'.
<Arguments>
filepath:
A string representing the path of a file. The following example path
strings are viewed as fi... |
def find_delegated_role(roles, delegated_role):
"""
<Purpose>
Find the index, if any, of a role with a given name in a list of roles.
<Arguments>
roles:
The list of roles, each of which must have a 'name' attribute.
delegated_role:
The name of the role to be found in the list of roles.
... |
def ensure_all_targets_allowed(rolename, list_of_targets, parent_delegations):
"""
<Purpose>
Ensure that the list of targets specified by 'rolename' are allowed; this
is determined by inspecting the 'delegations' field of the parent role of
'rolename'. If a target specified by 'rolename' is not found i... |
def paths_are_consistent_with_hash_prefixes(paths, path_hash_prefixes):
"""
<Purpose>
Determine whether a list of paths are consistent with their alleged path
hash prefixes. By default, the SHA256 hash function is used.
<Arguments>
paths:
A list of paths for which their hashes will be checked.
... |
def get_target_hash(target_filepath):
"""
<Purpose>
Compute the hash of 'target_filepath'. This is useful in conjunction with
the "path_hash_prefixes" attribute in a delegated targets role, which tells
us which paths it is implicitly responsible for.
The repository may optionally organize targets i... |
def import_json():
"""
<Purpose>
Tries to import json module. We used to fall back to the simplejson module,
but we have dropped support for that module. We are keeping this interface
intact for backwards compatibility.
<Arguments>
None.
<Exceptions>
ImportError: on failure to import the j... |
def load_json_string(data):
"""
<Purpose>
Deserialize 'data' (JSON string) to a Python object.
<Arguments>
data:
A JSON string.
<Exceptions>
securesystemslib.exceptions.Error, if 'data' cannot be deserialized to a
Python object.
<Side Effects>
None.
<Returns>
Deserialized o... |
def load_json_file(filepath):
"""
<Purpose>
Deserialize a JSON object from a file containing the object.
<Arguments>
filepath:
Absolute path of JSON file.
<Exceptions>
securesystemslib.exceptions.FormatError: If 'filepath' is improperly
formatted.
securesystemslib.exceptions.Error: ... |
def digests_are_equal(digest1, digest2):
"""
<Purpose>
While protecting against timing attacks, compare the hexadecimal arguments
and determine if they are equal.
<Arguments>
digest1:
The first hexadecimal string value to compare.
digest2:
The second hexadecimal string value to compa... |
def _default_temporary_directory(self, prefix):
"""__init__ helper."""
try:
self.temporary_file = tempfile.NamedTemporaryFile(prefix=prefix)
except OSError as err: # pragma: no cover
logger.critical('Cannot create a system temporary directory: '+repr(err))
raise securesystemslib.exception... |
def read(self, size=None):
"""
<Purpose>
Read specified number of bytes. If size is not specified then the whole
file is read and the file pointer is placed at the beginning of the file.
<Arguments>
size:
Number of bytes to be read.
<Exceptions>
securesystemslib.except... |
def write(self, data, auto_flush=True):
"""
<Purpose>
Writes a data string to the file.
<Arguments>
data:
A string containing some data.
auto_flush:
Boolean argument, if set to 'True', all data will be flushed from
internal buffer.
<Exceptions>
None.
... |
def move(self, destination_path):
"""
<Purpose>
Copies 'self.temporary_file' to a non-temp file at 'destination_path' and
closes 'self.temporary_file' so that it is removed.
<Arguments>
destination_path:
Path to store the file in.
<Exceptions>
None.
<Return>
... |
def decompress_temp_file_object(self, compression):
"""
<Purpose>
To decompress a compressed temp file object. Decompression is performed
on a temp file object that is compressed, this occurs after downloading
a compressed file. For instance if a compressed version of some meta
file in... |
def close_temp_file(self):
"""
<Purpose>
Closes the temporary file object. 'close_temp_file' mimics usual
file.close(), however temporary file destroys itself when
'close_temp_file' is called. Further if compression is set, second
temporary file instance 'self._orig_file' is also closed ... |
def matches(self, object):
"""
<Purpose>
Return True if 'object' matches this schema, False if it doesn't.
If the caller wishes to signal an error on a failed match, check_match()
should be called, which will raise a 'exceptions.FormatError' exception.
"""
try:
self.check_match(... |
def get_event(self, *etypes, timeout=None):
"""
Return a single event object or block until an event is
received and return it.
- etypes(str): If defined, Slack event type(s) not matching
the filter will be ignored. See https://api.slack.com/events for
a listing of... |
def events(self, *etypes, idle_timeout=None):
"""
returns a blocking generator yielding Slack event objects
params:
- etypes(str): If defined, Slack event type(s) not matching
the filter will be ignored. See https://api.slack.com/events for
a listing of valid event... |
def send_msg(self, text, channel, confirm=True):
"""
Send a message to a channel or group via Slack RTM socket, returning
the resulting message object
params:
- text(str): Message text to send
- channel(Channel): Target channel
- confirm(bool): If True, wait f... |
def _process_event(self, event):
""" Extend event object with User and Channel objects """
if event.get('user'):
event.user = self.lookup_user(event.get('user'))
if event.get('channel'):
event.channel = self.lookup_channel(event.get('channel'))
if self.user.id i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.