code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get_section2usrnts(self):
"""Get dict section2usrnts."""
sec_nts = []
for section_name, _ in self.get_sections_2d():
usrgos = self.get_usrgos_g_section(section_name)
sec_nts.append((section_name, [self.go2nt.get(u) for u in usrgos]))
return cx.OrderedDict(sec_... | def function[get_section2usrnts, parameter[self]]:
constant[Get dict section2usrnts.]
variable[sec_nts] assign[=] list[[]]
for taget[tuple[[<ast.Name object at 0x7da2054a41c0>, <ast.Name object at 0x7da2054a5030>]]] in starred[call[name[self].get_sections_2d, parameter[]]] begin[:]
... | keyword[def] identifier[get_section2usrnts] ( identifier[self] ):
literal[string]
identifier[sec_nts] =[]
keyword[for] identifier[section_name] , identifier[_] keyword[in] identifier[self] . identifier[get_sections_2d] ():
identifier[usrgos] = identifier[self] . identifier[... | def get_section2usrnts(self):
"""Get dict section2usrnts."""
sec_nts = []
for (section_name, _) in self.get_sections_2d():
usrgos = self.get_usrgos_g_section(section_name)
sec_nts.append((section_name, [self.go2nt.get(u) for u in usrgos])) # depends on [control=['for'], data=[]]
return ... |
def enable_i2c_slave(self, slave_address):
"""Enable I2C slave mode.
The device will respond to the specified slave_address if it is
addressed.
You can wait for the data with :func:`poll` and get it with
`i2c_slave_read`.
"""
ret = api.py_aa_i2c_slave_enable(sel... | def function[enable_i2c_slave, parameter[self, slave_address]]:
constant[Enable I2C slave mode.
The device will respond to the specified slave_address if it is
addressed.
You can wait for the data with :func:`poll` and get it with
`i2c_slave_read`.
]
variable[re... | keyword[def] identifier[enable_i2c_slave] ( identifier[self] , identifier[slave_address] ):
literal[string]
identifier[ret] = identifier[api] . identifier[py_aa_i2c_slave_enable] ( identifier[self] . identifier[handle] , identifier[slave_address] ,
identifier[self] . identifier[BUFFER_SIZE... | def enable_i2c_slave(self, slave_address):
"""Enable I2C slave mode.
The device will respond to the specified slave_address if it is
addressed.
You can wait for the data with :func:`poll` and get it with
`i2c_slave_read`.
"""
ret = api.py_aa_i2c_slave_enable(self.handle... |
def add(self, hostname, keytype, key):
"""
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
:param .P... | def function[add, parameter[self, hostname, keytype, key]]:
constant[
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ss... | keyword[def] identifier[add] ( identifier[self] , identifier[hostname] , identifier[keytype] , identifier[key] ):
literal[string]
keyword[for] identifier[e] keyword[in] identifier[self] . identifier[_entries] :
keyword[if] ( identifier[hostname] keyword[in] identifier[e] . identif... | def add(self, hostname, keytype, key):
"""
Add a host key entry to the table. Any existing entry for a
``(hostname, keytype)`` pair will be replaced.
:param str hostname: the hostname (or IP) to add
:param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
:param .PKey ... |
def apply_patch(self, patch_path):
"""Applies the patch located at *patch_path*. Returns the return code of
the patch command.
"""
# Do not create .orig backup files, and merge files in place.
return self._execute('patch -p1 --no-backup-if-mismatch --merge', stdout=open(os.devnul... | def function[apply_patch, parameter[self, patch_path]]:
constant[Applies the patch located at *patch_path*. Returns the return code of
the patch command.
]
return[call[call[name[self]._execute, parameter[constant[patch -p1 --no-backup-if-mismatch --merge]]]][constant[0]]] | keyword[def] identifier[apply_patch] ( identifier[self] , identifier[patch_path] ):
literal[string]
keyword[return] identifier[self] . identifier[_execute] ( literal[string] , identifier[stdout] = identifier[open] ( identifier[os] . identifier[devnull] , literal[string] ), identifier[stdi... | def apply_patch(self, patch_path):
"""Applies the patch located at *patch_path*. Returns the return code of
the patch command.
"""
# Do not create .orig backup files, and merge files in place.
return self._execute('patch -p1 --no-backup-if-mismatch --merge', stdout=open(os.devnull, 'w'), std... |
def _readline_insert(self, char, echo, insptr, line):
"""Deal properly with inserted chars in a line."""
if not self._readline_do_echo(echo):
return
# Write out the remainder of the line
self.write(char + ''.join(line[insptr:]))
# Cursor Left to the current insert poi... | def function[_readline_insert, parameter[self, char, echo, insptr, line]]:
constant[Deal properly with inserted chars in a line.]
if <ast.UnaryOp object at 0x7da18dc9a050> begin[:]
return[None]
call[name[self].write, parameter[binary_operation[name[char] + call[constant[].join, parameter... | keyword[def] identifier[_readline_insert] ( identifier[self] , identifier[char] , identifier[echo] , identifier[insptr] , identifier[line] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_readline_do_echo] ( identifier[echo] ):
keyword[return]
... | def _readline_insert(self, char, echo, insptr, line):
"""Deal properly with inserted chars in a line."""
if not self._readline_do_echo(echo):
return # depends on [control=['if'], data=[]]
# Write out the remainder of the line
self.write(char + ''.join(line[insptr:]))
# Cursor Left to the cu... |
def morsel_to_cookie(morsel):
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
expires = None
if morsel['max-age']:
expires = time.time() + morsel['max-age']
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT'
expires = time.mktime(
... | def function[morsel_to_cookie, parameter[morsel]]:
constant[Convert a Morsel object into a Cookie containing the one k/v pair.]
variable[expires] assign[=] constant[None]
if call[name[morsel]][constant[max-age]] begin[:]
variable[expires] assign[=] binary_operation[call[name[time... | keyword[def] identifier[morsel_to_cookie] ( identifier[morsel] ):
literal[string]
identifier[expires] = keyword[None]
keyword[if] identifier[morsel] [ literal[string] ]:
identifier[expires] = identifier[time] . identifier[time] ()+ identifier[morsel] [ literal[string] ]
keyword[elif] ... | def morsel_to_cookie(morsel):
"""Convert a Morsel object into a Cookie containing the one k/v pair."""
expires = None
if morsel['max-age']:
expires = time.time() + morsel['max-age'] # depends on [control=['if'], data=[]]
elif morsel['expires']:
time_template = '%a, %d-%b-%Y %H:%M:%S GMT... |
def post(self, query):
"""
Wrapper around ``_do_post()`` to handle accounts that require
sending back session cookies (``self.set_cookies`` True).
"""
res, response = self._do_post(query)
cookies = res.getheader('Set-Cookie', None)
if len(response) == 0 and cookie... | def function[post, parameter[self, query]]:
constant[
Wrapper around ``_do_post()`` to handle accounts that require
sending back session cookies (``self.set_cookies`` True).
]
<ast.Tuple object at 0x7da18f00c4f0> assign[=] call[name[self]._do_post, parameter[name[query]]]
... | keyword[def] identifier[post] ( identifier[self] , identifier[query] ):
literal[string]
identifier[res] , identifier[response] = identifier[self] . identifier[_do_post] ( identifier[query] )
identifier[cookies] = identifier[res] . identifier[getheader] ( literal[string] , keyword[None] )
... | def post(self, query):
"""
Wrapper around ``_do_post()`` to handle accounts that require
sending back session cookies (``self.set_cookies`` True).
"""
(res, response) = self._do_post(query)
cookies = res.getheader('Set-Cookie', None)
if len(response) == 0 and cookies is not None ... |
def sign(wheelfile, replace=False, get_keyring=get_keyring):
"""Sign a wheel"""
warn_signatures()
WheelKeys, keyring = get_keyring()
ed25519ll = signatures.get_ed25519ll()
wf = WheelFile(wheelfile, append=True)
wk = WheelKeys().load()
name = wf.parsed_filename.group('name')
sign_with ... | def function[sign, parameter[wheelfile, replace, get_keyring]]:
constant[Sign a wheel]
call[name[warn_signatures], parameter[]]
<ast.Tuple object at 0x7da20e954f10> assign[=] call[name[get_keyring], parameter[]]
variable[ed25519ll] assign[=] call[name[signatures].get_ed25519ll, parameter... | keyword[def] identifier[sign] ( identifier[wheelfile] , identifier[replace] = keyword[False] , identifier[get_keyring] = identifier[get_keyring] ):
literal[string]
identifier[warn_signatures] ()
identifier[WheelKeys] , identifier[keyring] = identifier[get_keyring] ()
identifier[ed25519ll] = iden... | def sign(wheelfile, replace=False, get_keyring=get_keyring):
"""Sign a wheel"""
warn_signatures()
(WheelKeys, keyring) = get_keyring()
ed25519ll = signatures.get_ed25519ll()
wf = WheelFile(wheelfile, append=True)
wk = WheelKeys().load()
name = wf.parsed_filename.group('name')
sign_with =... |
def _create_path(self, *args):
"""Create the URL path with the Fred endpoint and given arguments."""
args = filter(None, args)
path = self.endpoint + '/'.join(args)
return path | def function[_create_path, parameter[self]]:
constant[Create the URL path with the Fred endpoint and given arguments.]
variable[args] assign[=] call[name[filter], parameter[constant[None], name[args]]]
variable[path] assign[=] binary_operation[name[self].endpoint + call[constant[/].join, paramet... | keyword[def] identifier[_create_path] ( identifier[self] ,* identifier[args] ):
literal[string]
identifier[args] = identifier[filter] ( keyword[None] , identifier[args] )
identifier[path] = identifier[self] . identifier[endpoint] + literal[string] . identifier[join] ( identifier[args] )
... | def _create_path(self, *args):
"""Create the URL path with the Fred endpoint and given arguments."""
args = filter(None, args)
path = self.endpoint + '/'.join(args)
return path |
def _merge_sorted_items(self, index):
""" load a partition from disk, then sort and group by key """
def load_partition(j):
path = self._get_spill_dir(j)
p = os.path.join(path, str(index))
with open(p, 'rb', 65536) as f:
for v in self.serializer.load_s... | def function[_merge_sorted_items, parameter[self, index]]:
constant[ load a partition from disk, then sort and group by key ]
def function[load_partition, parameter[j]]:
variable[path] assign[=] call[name[self]._get_spill_dir, parameter[name[j]]]
variable[p] assign[=] cal... | keyword[def] identifier[_merge_sorted_items] ( identifier[self] , identifier[index] ):
literal[string]
keyword[def] identifier[load_partition] ( identifier[j] ):
identifier[path] = identifier[self] . identifier[_get_spill_dir] ( identifier[j] )
identifier[p] = identifier[... | def _merge_sorted_items(self, index):
""" load a partition from disk, then sort and group by key """
def load_partition(j):
path = self._get_spill_dir(j)
p = os.path.join(path, str(index))
with open(p, 'rb', 65536) as f:
for v in self.serializer.load_stream(f):
... |
def main():
"""Just print out some event infomation when the gamepad is used."""
while 1:
events = get_gamepad()
for event in events:
print(event.ev_type, event.code, event.state) | def function[main, parameter[]]:
constant[Just print out some event infomation when the gamepad is used.]
while constant[1] begin[:]
variable[events] assign[=] call[name[get_gamepad], parameter[]]
for taget[name[event]] in starred[name[events]] begin[:]
... | keyword[def] identifier[main] ():
literal[string]
keyword[while] literal[int] :
identifier[events] = identifier[get_gamepad] ()
keyword[for] identifier[event] keyword[in] identifier[events] :
identifier[print] ( identifier[event] . identifier[ev_type] , identifier[event] ... | def main():
"""Just print out some event infomation when the gamepad is used."""
while 1:
events = get_gamepad()
for event in events:
print(event.ev_type, event.code, event.state) # depends on [control=['for'], data=['event']] # depends on [control=['while'], data=[]] |
def wrap_worker__run(*args, **kwargs):
"""
While the strategy is active, rewrite connection_loader.get() calls for
some transports into requests for a compatible Mitogen transport.
"""
# Ignore parent's attempts to murder us when we still need to write
# profiling output.
if mitogen.core._pr... | def function[wrap_worker__run, parameter[]]:
constant[
While the strategy is active, rewrite connection_loader.get() calls for
some transports into requests for a compatible Mitogen transport.
]
if compare[name[mitogen].core._profile_hook.__name__ not_equal[!=] constant[_profile_hook]] begin... | keyword[def] identifier[wrap_worker__run] (* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[mitogen] . identifier[core] . identifier[_profile_hook] . identifier[__name__] != literal[string] :
identifier[signal] . identifier[signal] ( identifier[signal]... | def wrap_worker__run(*args, **kwargs):
"""
While the strategy is active, rewrite connection_loader.get() calls for
some transports into requests for a compatible Mitogen transport.
"""
# Ignore parent's attempts to murder us when we still need to write
# profiling output.
if mitogen.core._pr... |
def access_for(self, roles=None, actor=None, anchors=[]):
"""
Return a proxy object that limits read and write access to attributes
based on the actor's roles. If the ``roles`` parameter isn't
provided, :meth:`roles_for` is called with the other parameters::
# This typical c... | def function[access_for, parameter[self, roles, actor, anchors]]:
constant[
Return a proxy object that limits read and write access to attributes
based on the actor's roles. If the ``roles`` parameter isn't
provided, :meth:`roles_for` is called with the other parameters::
# ... | keyword[def] identifier[access_for] ( identifier[self] , identifier[roles] = keyword[None] , identifier[actor] = keyword[None] , identifier[anchors] =[]):
literal[string]
keyword[if] identifier[roles] keyword[is] keyword[None] :
identifier[roles] = identifier[self] . identifier[role... | def access_for(self, roles=None, actor=None, anchors=[]):
"""
Return a proxy object that limits read and write access to attributes
based on the actor's roles. If the ``roles`` parameter isn't
provided, :meth:`roles_for` is called with the other parameters::
# This typical call:... |
def get_stored_metadata(self, temp_ver):
"""
Retrieves the metadata for the given template version from the store
Args:
temp_ver (TemplateVersion): template version to retrieve the
metadata for
Returns:
dict: the metadata of the given template ve... | def function[get_stored_metadata, parameter[self, temp_ver]]:
constant[
Retrieves the metadata for the given template version from the store
Args:
temp_ver (TemplateVersion): template version to retrieve the
metadata for
Returns:
dict: the metada... | keyword[def] identifier[get_stored_metadata] ( identifier[self] , identifier[temp_ver] ):
literal[string]
keyword[with] identifier[open] ( identifier[self] . identifier[_prefixed] ( literal[string] % identifier[temp_ver] . identifier[name] )) keyword[as] identifier[f] :
keyword[retur... | def get_stored_metadata(self, temp_ver):
"""
Retrieves the metadata for the given template version from the store
Args:
temp_ver (TemplateVersion): template version to retrieve the
metadata for
Returns:
dict: the metadata of the given template versio... |
def validation_schema(name):
"""Return json schema for json validation."""
schemas = {
'processor': 'processSchema.json',
'descriptor': 'descriptorSchema.json',
'field': 'fieldSchema.json',
'type': 'typeSchema.json',
}
if name not in schemas:
raise ValueError()
... | def function[validation_schema, parameter[name]]:
constant[Return json schema for json validation.]
variable[schemas] assign[=] dictionary[[<ast.Constant object at 0x7da1b19b7400>, <ast.Constant object at 0x7da1b19b6e60>, <ast.Constant object at 0x7da1b19b6b90>, <ast.Constant object at 0x7da1b19b7160>],... | keyword[def] identifier[validation_schema] ( identifier[name] ):
literal[string]
identifier[schemas] ={
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[string] ,
literal[string] : literal[string] ,
}
keyword[if] identifier[nam... | def validation_schema(name):
"""Return json schema for json validation."""
schemas = {'processor': 'processSchema.json', 'descriptor': 'descriptorSchema.json', 'field': 'fieldSchema.json', 'type': 'typeSchema.json'}
if name not in schemas:
raise ValueError() # depends on [control=['if'], data=[]]
... |
def inverse_distance_to_grid(xp, yp, variable, grid_x, grid_y, r, gamma=None, kappa=None,
min_neighbors=3, kind='cressman'):
r"""Generate an inverse distance interpolation of the given points to a regular grid.
Values are assigned to the given grid using inverse distance weighting ... | def function[inverse_distance_to_grid, parameter[xp, yp, variable, grid_x, grid_y, r, gamma, kappa, min_neighbors, kind]]:
constant[Generate an inverse distance interpolation of the given points to a regular grid.
Values are assigned to the given grid using inverse distance weighting based on either
[C... | keyword[def] identifier[inverse_distance_to_grid] ( identifier[xp] , identifier[yp] , identifier[variable] , identifier[grid_x] , identifier[grid_y] , identifier[r] , identifier[gamma] = keyword[None] , identifier[kappa] = keyword[None] ,
identifier[min_neighbors] = literal[int] , identifier[kind] = literal[string] ... | def inverse_distance_to_grid(xp, yp, variable, grid_x, grid_y, r, gamma=None, kappa=None, min_neighbors=3, kind='cressman'):
"""Generate an inverse distance interpolation of the given points to a regular grid.
Values are assigned to the given grid using inverse distance weighting based on either
[Cressman1... |
def load(self):
"""Load table
Keeps only rows with annual average defined (full year data available).
Returns:
pandas.DataFrame: loaded data
"""
df = pd.read_excel(self.input_file, skiprows=11)
df = df.dropna(subset=['Annual'])
return df | def function[load, parameter[self]]:
constant[Load table
Keeps only rows with annual average defined (full year data available).
Returns:
pandas.DataFrame: loaded data
]
variable[df] assign[=] call[name[pd].read_excel, parameter[name[self].input_file]]
varia... | keyword[def] identifier[load] ( identifier[self] ):
literal[string]
identifier[df] = identifier[pd] . identifier[read_excel] ( identifier[self] . identifier[input_file] , identifier[skiprows] = literal[int] )
identifier[df] = identifier[df] . identifier[dropna] ( identifier[subset] =[ lite... | def load(self):
"""Load table
Keeps only rows with annual average defined (full year data available).
Returns:
pandas.DataFrame: loaded data
"""
df = pd.read_excel(self.input_file, skiprows=11)
df = df.dropna(subset=['Annual'])
return df |
def fit_model(ts, sc=None):
"""
Fits an AR(1) + GARCH(1, 1) model to the given time series.
Parameters
----------
ts:
the time series to which we want to fit a AR+GARCH model as a Numpy array
Returns an ARGARCH model
"""
assert sc != None, "Missing SparkContext"
... | def function[fit_model, parameter[ts, sc]]:
constant[
Fits an AR(1) + GARCH(1, 1) model to the given time series.
Parameters
----------
ts:
the time series to which we want to fit a AR+GARCH model as a Numpy array
Returns an ARGARCH model
]
assert[compare[name[s... | keyword[def] identifier[fit_model] ( identifier[ts] , identifier[sc] = keyword[None] ):
literal[string]
keyword[assert] identifier[sc] != keyword[None] , literal[string]
identifier[jvm] = identifier[sc] . identifier[_jvm]
identifier[jmodel] = identifier[jvm] . identifier[com] . identifier[clo... | def fit_model(ts, sc=None):
"""
Fits an AR(1) + GARCH(1, 1) model to the given time series.
Parameters
----------
ts:
the time series to which we want to fit a AR+GARCH model as a Numpy array
Returns an ARGARCH model
"""
assert sc != None, 'Missing SparkContext'
... |
def combine_last_two_dimensions(x):
"""Reshape x so that the last two dimension become one.
Args:
x: a Tensor with shape [..., a, b]
Returns:
a Tensor with shape [..., ab]
"""
x_shape = common_layers.shape_list(x)
a, b = x_shape[-2:]
return tf.reshape(x, x_shape[:-2] + [a * b]) | def function[combine_last_two_dimensions, parameter[x]]:
constant[Reshape x so that the last two dimension become one.
Args:
x: a Tensor with shape [..., a, b]
Returns:
a Tensor with shape [..., ab]
]
variable[x_shape] assign[=] call[name[common_layers].shape_list, parameter[name[x]]]
... | keyword[def] identifier[combine_last_two_dimensions] ( identifier[x] ):
literal[string]
identifier[x_shape] = identifier[common_layers] . identifier[shape_list] ( identifier[x] )
identifier[a] , identifier[b] = identifier[x_shape] [- literal[int] :]
keyword[return] identifier[tf] . identifier[reshape] (... | def combine_last_two_dimensions(x):
"""Reshape x so that the last two dimension become one.
Args:
x: a Tensor with shape [..., a, b]
Returns:
a Tensor with shape [..., ab]
"""
x_shape = common_layers.shape_list(x)
(a, b) = x_shape[-2:]
return tf.reshape(x, x_shape[:-2] + [a * b]) |
def set_logger(self, logger_name, level=logging.INFO):
"""
Convenience function to quickly configure full debug output
to go to the console.
"""
log = logging.getLogger(logger_name)
log.setLevel(level)
ch = logging.StreamHandler(None)
ch.setLevel(level)
... | def function[set_logger, parameter[self, logger_name, level]]:
constant[
Convenience function to quickly configure full debug output
to go to the console.
]
variable[log] assign[=] call[name[logging].getLogger, parameter[name[logger_name]]]
call[name[log].setLevel, parame... | keyword[def] identifier[set_logger] ( identifier[self] , identifier[logger_name] , identifier[level] = identifier[logging] . identifier[INFO] ):
literal[string]
identifier[log] = identifier[logging] . identifier[getLogger] ( identifier[logger_name] )
identifier[log] . identifier[setLevel] ... | def set_logger(self, logger_name, level=logging.INFO):
"""
Convenience function to quickly configure full debug output
to go to the console.
"""
log = logging.getLogger(logger_name)
log.setLevel(level)
ch = logging.StreamHandler(None)
ch.setLevel(level)
# create formatter... |
def subscribe_topic(self, topics=[], pattern=None):
"""Subscribe to a list of topics, or a topic regex pattern.
- ``topics`` (list): List of topics for subscription.
- ``pattern`` (str): Pattern to match available topics. You must provide either topics or pattern,
but not both... | def function[subscribe_topic, parameter[self, topics, pattern]]:
constant[Subscribe to a list of topics, or a topic regex pattern.
- ``topics`` (list): List of topics for subscription.
- ``pattern`` (str): Pattern to match available topics. You must provide either topics or pattern,
... | keyword[def] identifier[subscribe_topic] ( identifier[self] , identifier[topics] =[], identifier[pattern] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[topics] , identifier[list] ):
identifier[topics] =[ identifier[topics] ]
... | def subscribe_topic(self, topics=[], pattern=None):
"""Subscribe to a list of topics, or a topic regex pattern.
- ``topics`` (list): List of topics for subscription.
- ``pattern`` (str): Pattern to match available topics. You must provide either topics or pattern,
but not both.
... |
def get_uri_list(self, **kwargs):
"""
Returns a list of Uris to index
"""
index_status_filter = """
optional {{ ?s dcterm:modified ?modTime }} .
optional {{ ?s kds:esIndexTime ?time }} .
optional {{ ?s kds:esIndexError ?error }}
... | def function[get_uri_list, parameter[self]]:
constant[
Returns a list of Uris to index
]
variable[index_status_filter] assign[=] call[constant[
optional {{ ?s dcterm:modified ?modTime }} .
optional {{ ?s kds:esIndexTime ?time }} .
optional ... | keyword[def] identifier[get_uri_list] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[index_status_filter] = literal[string] . identifier[format] ( identifier[idx_start_time] = identifier[self] . identifier[idx_start_time] . identifier[sparql] )
identifier[items_que... | def get_uri_list(self, **kwargs):
"""
Returns a list of Uris to index
"""
index_status_filter = '\n optional {{ ?s dcterm:modified ?modTime }} .\n optional {{ ?s kds:esIndexTime ?time }} .\n optional {{ ?s kds:esIndexError ?error }}\n f... |
def _finalize_merge(out_file, bam_files, config):
"""Handle indexes and cleanups of merged BAM and input files.
"""
# Ensure timestamps are up to date on output file and index
# Works around issues on systems with inconsistent times
for ext in ["", ".bai"]:
if os.path.exists(out_file + ext):... | def function[_finalize_merge, parameter[out_file, bam_files, config]]:
constant[Handle indexes and cleanups of merged BAM and input files.
]
for taget[name[ext]] in starred[list[[<ast.Constant object at 0x7da1b18bc250>, <ast.Constant object at 0x7da1b18bdae0>]]] begin[:]
if call[name... | keyword[def] identifier[_finalize_merge] ( identifier[out_file] , identifier[bam_files] , identifier[config] ):
literal[string]
keyword[for] identifier[ext] keyword[in] [ literal[string] , literal[string] ]:
keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifi... | def _finalize_merge(out_file, bam_files, config):
"""Handle indexes and cleanups of merged BAM and input files.
"""
# Ensure timestamps are up to date on output file and index
# Works around issues on systems with inconsistent times
for ext in ['', '.bai']:
if os.path.exists(out_file + ext):... |
def cnst_A(self, X, Xf=None):
r"""Compute :math:`A \mathbf{x}` component of ADMM problem
constraint. In this case :math:`A \mathbf{x} = (G_r^T \;\;
G_c^T \;\; H)^T \mathbf{x}`.
"""
if Xf is None:
Xf = sl.rfftn(X, axes=self.axes)
return sl.irfftn(self.GAf*Xf[... | def function[cnst_A, parameter[self, X, Xf]]:
constant[Compute :math:`A \mathbf{x}` component of ADMM problem
constraint. In this case :math:`A \mathbf{x} = (G_r^T \;\;
G_c^T \;\; H)^T \mathbf{x}`.
]
if compare[name[Xf] is constant[None]] begin[:]
variable[Xf] as... | keyword[def] identifier[cnst_A] ( identifier[self] , identifier[X] , identifier[Xf] = keyword[None] ):
literal[string]
keyword[if] identifier[Xf] keyword[is] keyword[None] :
identifier[Xf] = identifier[sl] . identifier[rfftn] ( identifier[X] , identifier[axes] = identifier[self] . ... | def cnst_A(self, X, Xf=None):
"""Compute :math:`A \\mathbf{x}` component of ADMM problem
constraint. In this case :math:`A \\mathbf{x} = (G_r^T \\;\\;
G_c^T \\;\\; H)^T \\mathbf{x}`.
"""
if Xf is None:
Xf = sl.rfftn(X, axes=self.axes) # depends on [control=['if'], data=['Xf']]
... |
def _construct_update(self, outgoing_route):
"""Construct update message with Outgoing-routes path attribute
appropriately cloned/copied/updated.
"""
update = None
path = outgoing_route.path
# Get copy of path's path attributes.
pathattr_map = path.pathattr_map
... | def function[_construct_update, parameter[self, outgoing_route]]:
constant[Construct update message with Outgoing-routes path attribute
appropriately cloned/copied/updated.
]
variable[update] assign[=] constant[None]
variable[path] assign[=] name[outgoing_route].path
vari... | keyword[def] identifier[_construct_update] ( identifier[self] , identifier[outgoing_route] ):
literal[string]
identifier[update] = keyword[None]
identifier[path] = identifier[outgoing_route] . identifier[path]
identifier[pathattr_map] = identifier[path] . identifier[pat... | def _construct_update(self, outgoing_route):
"""Construct update message with Outgoing-routes path attribute
appropriately cloned/copied/updated.
"""
update = None
path = outgoing_route.path
# Get copy of path's path attributes.
pathattr_map = path.pathattr_map
new_pathattr = []
... |
def format_currency_field(__, prec, number, locale):
"""Formats a currency field."""
locale = Locale.parse(locale)
currency = get_territory_currencies(locale.territory)[0]
if prec is None:
pattern, currency_digits = None, True
else:
prec = int(prec)
pattern = locale.currency_... | def function[format_currency_field, parameter[__, prec, number, locale]]:
constant[Formats a currency field.]
variable[locale] assign[=] call[name[Locale].parse, parameter[name[locale]]]
variable[currency] assign[=] call[call[name[get_territory_currencies], parameter[name[locale].territory]]][co... | keyword[def] identifier[format_currency_field] ( identifier[__] , identifier[prec] , identifier[number] , identifier[locale] ):
literal[string]
identifier[locale] = identifier[Locale] . identifier[parse] ( identifier[locale] )
identifier[currency] = identifier[get_territory_currencies] ( identifier[lo... | def format_currency_field(__, prec, number, locale):
"""Formats a currency field."""
locale = Locale.parse(locale)
currency = get_territory_currencies(locale.territory)[0]
if prec is None:
(pattern, currency_digits) = (None, True) # depends on [control=['if'], data=[]]
else:
prec = ... |
def get_parameter(self):
"""Obtain list parameter object from the current widget state.
:returns: A DefaultValueParameter from the current state of widget
:rtype: DefaultValueParameter
"""
radio_button_checked_id = self.input_button_group.checkedId()
# No radio button ch... | def function[get_parameter, parameter[self]]:
constant[Obtain list parameter object from the current widget state.
:returns: A DefaultValueParameter from the current state of widget
:rtype: DefaultValueParameter
]
variable[radio_button_checked_id] assign[=] call[name[self].input... | keyword[def] identifier[get_parameter] ( identifier[self] ):
literal[string]
identifier[radio_button_checked_id] = identifier[self] . identifier[input_button_group] . identifier[checkedId] ()
keyword[if] identifier[radio_button_checked_id] ==- literal[int] :
identifi... | def get_parameter(self):
"""Obtain list parameter object from the current widget state.
:returns: A DefaultValueParameter from the current state of widget
:rtype: DefaultValueParameter
"""
radio_button_checked_id = self.input_button_group.checkedId()
# No radio button checked, then ... |
def long_press(self, on_element):
"""
Long press on an element.
:Args:
- on_element: The element to long press.
"""
self._actions.append(lambda: self._driver.execute(
Command.LONG_PRESS, {'element': on_element.id}))
return self | def function[long_press, parameter[self, on_element]]:
constant[
Long press on an element.
:Args:
- on_element: The element to long press.
]
call[name[self]._actions.append, parameter[<ast.Lambda object at 0x7da1b2029a50>]]
return[name[self]] | keyword[def] identifier[long_press] ( identifier[self] , identifier[on_element] ):
literal[string]
identifier[self] . identifier[_actions] . identifier[append] ( keyword[lambda] : identifier[self] . identifier[_driver] . identifier[execute] (
identifier[Command] . identifier[LONG_PRESS] ,{... | def long_press(self, on_element):
"""
Long press on an element.
:Args:
- on_element: The element to long press.
"""
self._actions.append(lambda : self._driver.execute(Command.LONG_PRESS, {'element': on_element.id}))
return self |
def _make_leading_paths(self, src, mode=0o700):
"""Create leading path components
The standard python `os.makedirs` is insufficient for our
needs: it will only create directories, and ignores the fact
that some path components may be symbolic links.
:param src: ... | def function[_make_leading_paths, parameter[self, src, mode]]:
constant[Create leading path components
The standard python `os.makedirs` is insufficient for our
needs: it will only create directories, and ignores the fact
that some path components may be symbolic links.
... | keyword[def] identifier[_make_leading_paths] ( identifier[self] , identifier[src] , identifier[mode] = literal[int] ):
literal[string]
identifier[self] . identifier[log_debug] ( literal[string] % identifier[src] )
identifier[root] = identifier[self] . identifier[_archive_root]
id... | def _make_leading_paths(self, src, mode=448):
"""Create leading path components
The standard python `os.makedirs` is insufficient for our
needs: it will only create directories, and ignores the fact
that some path components may be symbolic links.
:param src: The so... |
def progress_stats(self, id): # pylint: disable=invalid-name,redefined-builtin
"""Compute progress stats for a result.
:param id: Result ID as an int.
:return: :class:`results.Progress <results.Progress>` object
:rtype: results.Progress
"""
schema = ProgressSchema()
... | def function[progress_stats, parameter[self, id]]:
constant[Compute progress stats for a result.
:param id: Result ID as an int.
:return: :class:`results.Progress <results.Progress>` object
:rtype: results.Progress
]
variable[schema] assign[=] call[name[ProgressSchema], ... | keyword[def] identifier[progress_stats] ( identifier[self] , identifier[id] ):
literal[string]
identifier[schema] = identifier[ProgressSchema] ()
identifier[resp] = identifier[self] . identifier[service] . identifier[get] ( identifier[self] . identifier[base] + identifier[str] ( identifier... | def progress_stats(self, id): # pylint: disable=invalid-name,redefined-builtin
'Compute progress stats for a result.\n\n :param id: Result ID as an int.\n :return: :class:`results.Progress <results.Progress>` object\n :rtype: results.Progress\n '
schema = ProgressSchema()
resp =... |
def create_action(self):
"""Create actions associated with this widget."""
actions = {}
act = QAction(QIcon(ICON['step_prev']), 'Previous Step', self)
act.setShortcut('[')
act.triggered.connect(self.step_prev)
actions['step_prev'] = act
act = QAction(QIcon(ICON[... | def function[create_action, parameter[self]]:
constant[Create actions associated with this widget.]
variable[actions] assign[=] dictionary[[], []]
variable[act] assign[=] call[name[QAction], parameter[call[name[QIcon], parameter[call[name[ICON]][constant[step_prev]]]], constant[Previous Step], n... | keyword[def] identifier[create_action] ( identifier[self] ):
literal[string]
identifier[actions] ={}
identifier[act] = identifier[QAction] ( identifier[QIcon] ( identifier[ICON] [ literal[string] ]), literal[string] , identifier[self] )
identifier[act] . identifier[setShortcut] (... | def create_action(self):
"""Create actions associated with this widget."""
actions = {}
act = QAction(QIcon(ICON['step_prev']), 'Previous Step', self)
act.setShortcut('[')
act.triggered.connect(self.step_prev)
actions['step_prev'] = act
act = QAction(QIcon(ICON['step_next']), 'Next Step', se... |
def displayValue(self, vocab, value, widget):
"""Overwrite the Script (Python) `displayValue.py` located at
`Products.Archetypes.skins.archetypes` to handle the references
of our Picklist Widget (Methods) gracefully.
This method gets called by the `picklist.pt` template like thi... | def function[displayValue, parameter[self, vocab, value, widget]]:
constant[Overwrite the Script (Python) `displayValue.py` located at
`Products.Archetypes.skins.archetypes` to handle the references
of our Picklist Widget (Methods) gracefully.
This method gets called by the `pic... | keyword[def] identifier[displayValue] ( identifier[self] , identifier[vocab] , identifier[value] , identifier[widget] ):
literal[string]
identifier[t] = identifier[self] . identifier[restrictedTraverse] ( literal[string] ). identifier[translate]
keyword[def] i... | def displayValue(self, vocab, value, widget):
"""Overwrite the Script (Python) `displayValue.py` located at
`Products.Archetypes.skins.archetypes` to handle the references
of our Picklist Widget (Methods) gracefully.
This method gets called by the `picklist.pt` template like this:
... |
def last_post_on(self):
""" Returns the latest post date associated with the node or one of its descendants. """
dates = [n.last_post_on for n in self.children if n.last_post_on is not None]
children_last_post_on = max(dates) if dates else None
if children_last_post_on and self.obj.last_... | def function[last_post_on, parameter[self]]:
constant[ Returns the latest post date associated with the node or one of its descendants. ]
variable[dates] assign[=] <ast.ListComp object at 0x7da18f810cd0>
variable[children_last_post_on] assign[=] <ast.IfExp object at 0x7da18f810940>
if <a... | keyword[def] identifier[last_post_on] ( identifier[self] ):
literal[string]
identifier[dates] =[ identifier[n] . identifier[last_post_on] keyword[for] identifier[n] keyword[in] identifier[self] . identifier[children] keyword[if] identifier[n] . identifier[last_post_on] keyword[is] keyword[n... | def last_post_on(self):
""" Returns the latest post date associated with the node or one of its descendants. """
dates = [n.last_post_on for n in self.children if n.last_post_on is not None]
children_last_post_on = max(dates) if dates else None
if children_last_post_on and self.obj.last_post_on:
... |
def to_json(value, pretty=False):
"""
Serializes the given value to JSON.
:param value: the value to serialize
:param pretty:
whether or not to format the output in a more human-readable way; if
not specified, defaults to ``False``
:type pretty: bool
:rtype: str
"""
opt... | def function[to_json, parameter[value, pretty]]:
constant[
Serializes the given value to JSON.
:param value: the value to serialize
:param pretty:
whether or not to format the output in a more human-readable way; if
not specified, defaults to ``False``
:type pretty: bool
:rt... | keyword[def] identifier[to_json] ( identifier[value] , identifier[pretty] = keyword[False] ):
literal[string]
identifier[options] ={
literal[string] : keyword[False] ,
literal[string] : identifier[BasicJSONEncoder] ,
}
keyword[if] identifier[pretty] :
identifier[options] [ lit... | def to_json(value, pretty=False):
"""
Serializes the given value to JSON.
:param value: the value to serialize
:param pretty:
whether or not to format the output in a more human-readable way; if
not specified, defaults to ``False``
:type pretty: bool
:rtype: str
"""
opti... |
def IOR(type, nr, size):
"""
An ioctl with read parameters.
size (ctype type or instance)
Type/structure of the argument passed to ioctl's "arg" argument.
"""
return IOC(IOC_READ, type, nr, IOC_TYPECHECK(size)) | def function[IOR, parameter[type, nr, size]]:
constant[
An ioctl with read parameters.
size (ctype type or instance)
Type/structure of the argument passed to ioctl's "arg" argument.
]
return[call[name[IOC], parameter[name[IOC_READ], name[type], name[nr], call[name[IOC_TYPECHECK], parame... | keyword[def] identifier[IOR] ( identifier[type] , identifier[nr] , identifier[size] ):
literal[string]
keyword[return] identifier[IOC] ( identifier[IOC_READ] , identifier[type] , identifier[nr] , identifier[IOC_TYPECHECK] ( identifier[size] )) | def IOR(type, nr, size):
"""
An ioctl with read parameters.
size (ctype type or instance)
Type/structure of the argument passed to ioctl's "arg" argument.
"""
return IOC(IOC_READ, type, nr, IOC_TYPECHECK(size)) |
def get_app_state():
"""Get current status of application in context
Returns:
:obj:`dict` of application status
"""
if not hasattr(g, 'app_state'):
model = get_model()
g.app_state = {
'app_title': APP_TITLE,
'model_name': type(model).__name__,
... | def function[get_app_state, parameter[]]:
constant[Get current status of application in context
Returns:
:obj:`dict` of application status
]
if <ast.UnaryOp object at 0x7da20c7cb190> begin[:]
variable[model] assign[=] call[name[get_model], parameter[]]
n... | keyword[def] identifier[get_app_state] ():
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[g] , literal[string] ):
identifier[model] = identifier[get_model] ()
identifier[g] . identifier[app_state] ={
literal[string] : identifier[APP_TITLE] ,
... | def get_app_state():
"""Get current status of application in context
Returns:
:obj:`dict` of application status
"""
if not hasattr(g, 'app_state'):
model = get_model()
g.app_state = {'app_title': APP_TITLE, 'model_name': type(model).__name__, 'latest_ckpt_name': model.latest_ck... |
def collect_all_bucket_keys(self):
"""
Just collects all buckets keys from subtree
"""
if len(self.childs) == 0:
# This is a leaf so just return the bucket key (we reached the bucket leaf)
#print 'Returning (collect) leaf bucket key %s with %d vectors' % (self.buc... | def function[collect_all_bucket_keys, parameter[self]]:
constant[
Just collects all buckets keys from subtree
]
if compare[call[name[len], parameter[name[self].childs]] equal[==] constant[0]] begin[:]
return[list[[<ast.Attribute object at 0x7da1b08bf2e0>]]]
variable[resul... | keyword[def] identifier[collect_all_bucket_keys] ( identifier[self] ):
literal[string]
keyword[if] identifier[len] ( identifier[self] . identifier[childs] )== literal[int] :
keyword[return] [ identifier[self] . identifier[bucket_key] ]
identifi... | def collect_all_bucket_keys(self):
"""
Just collects all buckets keys from subtree
"""
if len(self.childs) == 0:
# This is a leaf so just return the bucket key (we reached the bucket leaf)
#print 'Returning (collect) leaf bucket key %s with %d vectors' % (self.bucket_key, self.ve... |
def _get_arrays(self, wavelengths, **kwargs):
"""Get sampled spectrum or bandpass in user units."""
x = self._validate_wavelengths(wavelengths)
y = self(x, **kwargs)
if isinstance(wavelengths, u.Quantity):
w = x.to(wavelengths.unit, u.spectral())
else:
w ... | def function[_get_arrays, parameter[self, wavelengths]]:
constant[Get sampled spectrum or bandpass in user units.]
variable[x] assign[=] call[name[self]._validate_wavelengths, parameter[name[wavelengths]]]
variable[y] assign[=] call[name[self], parameter[name[x]]]
if call[name[isinstance... | keyword[def] identifier[_get_arrays] ( identifier[self] , identifier[wavelengths] ,** identifier[kwargs] ):
literal[string]
identifier[x] = identifier[self] . identifier[_validate_wavelengths] ( identifier[wavelengths] )
identifier[y] = identifier[self] ( identifier[x] ,** identifier[kwarg... | def _get_arrays(self, wavelengths, **kwargs):
"""Get sampled spectrum or bandpass in user units."""
x = self._validate_wavelengths(wavelengths)
y = self(x, **kwargs)
if isinstance(wavelengths, u.Quantity):
w = x.to(wavelengths.unit, u.spectral()) # depends on [control=['if'], data=[]]
else:... |
def enrich_internal_unqualified_edges(graph, subgraph):
"""Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.
:param pybel.BELGraph graph: The full BEL graph
:param pybel.BELGraph subgraph: The query BEL subgraph
"""
for u, v in itt.combinat... | def function[enrich_internal_unqualified_edges, parameter[graph, subgraph]]:
constant[Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.
:param pybel.BELGraph graph: The full BEL graph
:param pybel.BELGraph subgraph: The query BEL subgraph
]... | keyword[def] identifier[enrich_internal_unqualified_edges] ( identifier[graph] , identifier[subgraph] ):
literal[string]
keyword[for] identifier[u] , identifier[v] keyword[in] identifier[itt] . identifier[combinations] ( identifier[subgraph] , literal[int] ):
keyword[if] keyword[not] identifi... | def enrich_internal_unqualified_edges(graph, subgraph):
"""Add the missing unqualified edges between entities in the subgraph that are contained within the full graph.
:param pybel.BELGraph graph: The full BEL graph
:param pybel.BELGraph subgraph: The query BEL subgraph
"""
for (u, v) in itt.combin... |
def g_coil(FlowPlant, IDTube, RadiusCoil, Temp):
"""We need a reference for this.
Karen's thesis likely has this equation and the reference.
"""
return (g_straight(FlowPlant, IDTube).magnitude
* (1 + 0.033 *
np.log10(dean_number(FlowPlant, IDTube, RadiusCoil, Temp)
... | def function[g_coil, parameter[FlowPlant, IDTube, RadiusCoil, Temp]]:
constant[We need a reference for this.
Karen's thesis likely has this equation and the reference.
]
return[binary_operation[call[name[g_straight], parameter[name[FlowPlant], name[IDTube]]].magnitude * binary_operation[binary_oper... | keyword[def] identifier[g_coil] ( identifier[FlowPlant] , identifier[IDTube] , identifier[RadiusCoil] , identifier[Temp] ):
literal[string]
keyword[return] ( identifier[g_straight] ( identifier[FlowPlant] , identifier[IDTube] ). identifier[magnitude]
*( literal[int] + literal[int] *
identifier[np... | def g_coil(FlowPlant, IDTube, RadiusCoil, Temp):
"""We need a reference for this.
Karen's thesis likely has this equation and the reference.
"""
return g_straight(FlowPlant, IDTube).magnitude * (1 + 0.033 * np.log10(dean_number(FlowPlant, IDTube, RadiusCoil, Temp)) ** 4) ** (1 / 2) |
def addmag(self, magval):
"""Add a scalar magnitude to existing flux values.
.. math::
\\textnormal{flux}_{\\textnormal{new}} = 10^{-0.4 \\; \\textnormal{magval}} \\; \\textnormal{flux}
Parameters
----------
magval : number
Magnitude value.
Ret... | def function[addmag, parameter[self, magval]]:
constant[Add a scalar magnitude to existing flux values.
.. math::
\textnormal{flux}_{\textnormal{new}} = 10^{-0.4 \; \textnormal{magval}} \; \textnormal{flux}
Parameters
----------
magval : number
Magnitud... | keyword[def] identifier[addmag] ( identifier[self] , identifier[magval] ):
literal[string]
keyword[if] identifier[N] . identifier[isscalar] ( identifier[magval] ):
identifier[factor] = literal[int] **(- literal[int] * identifier[magval] )
keyword[return] identifier[self]... | def addmag(self, magval):
"""Add a scalar magnitude to existing flux values.
.. math::
\\textnormal{flux}_{\\textnormal{new}} = 10^{-0.4 \\; \\textnormal{magval}} \\; \\textnormal{flux}
Parameters
----------
magval : number
Magnitude value.
Returns... |
def find_permission_view_menu(self, permission_name, view_menu_name):
"""
Finds and returns a PermissionView by names
"""
permission = self.find_permission(permission_name)
view_menu = self.find_view_menu(view_menu_name)
if permission and view_menu:
return... | def function[find_permission_view_menu, parameter[self, permission_name, view_menu_name]]:
constant[
Finds and returns a PermissionView by names
]
variable[permission] assign[=] call[name[self].find_permission, parameter[name[permission_name]]]
variable[view_menu] assign[=] c... | keyword[def] identifier[find_permission_view_menu] ( identifier[self] , identifier[permission_name] , identifier[view_menu_name] ):
literal[string]
identifier[permission] = identifier[self] . identifier[find_permission] ( identifier[permission_name] )
identifier[view_menu] = identifier[sel... | def find_permission_view_menu(self, permission_name, view_menu_name):
"""
Finds and returns a PermissionView by names
"""
permission = self.find_permission(permission_name)
view_menu = self.find_view_menu(view_menu_name)
if permission and view_menu:
return self.get_session.qu... |
def _clean_query_string(q):
"""Clean up a query string for searching.
Removes unmatched parentheses and joining operators.
Arguments:
q (str): Query string to be cleaned
Returns:
str: The clean query string.
"""
q = q.replace("()", "").strip()
if q.endswith("("):
q... | def function[_clean_query_string, parameter[q]]:
constant[Clean up a query string for searching.
Removes unmatched parentheses and joining operators.
Arguments:
q (str): Query string to be cleaned
Returns:
str: The clean query string.
]
variable[q] assign[=] call[call[... | keyword[def] identifier[_clean_query_string] ( identifier[q] ):
literal[string]
identifier[q] = identifier[q] . identifier[replace] ( literal[string] , literal[string] ). identifier[strip] ()
keyword[if] identifier[q] . identifier[endswith] ( literal[string] ):
identifier[q] = identifier[q] ... | def _clean_query_string(q):
"""Clean up a query string for searching.
Removes unmatched parentheses and joining operators.
Arguments:
q (str): Query string to be cleaned
Returns:
str: The clean query string.
"""
q = q.replace('()', '').strip()
if q.endswith('('):
q... |
def _parse_scalars(scalars):
"""Parse the scalars from the YAML file content to a dictionary of ScalarType(s).
:return: A dictionary { 'full.scalar.label': ScalarType }
"""
scalar_dict = {}
# Scalars are defined in a fixed two-level hierarchy within the definition file.
... | def function[_parse_scalars, parameter[scalars]]:
constant[Parse the scalars from the YAML file content to a dictionary of ScalarType(s).
:return: A dictionary { 'full.scalar.label': ScalarType }
]
variable[scalar_dict] assign[=] dictionary[[], []]
for taget[name[category_name]] ... | keyword[def] identifier[_parse_scalars] ( identifier[scalars] ):
literal[string]
identifier[scalar_dict] ={}
keyword[for] identifier[category_name] keyword[in] identifier[scalars] :
identifier[category] = identifier[scalars] [ identifier[category... | def _parse_scalars(scalars):
"""Parse the scalars from the YAML file content to a dictionary of ScalarType(s).
:return: A dictionary { 'full.scalar.label': ScalarType }
"""
scalar_dict = {}
# Scalars are defined in a fixed two-level hierarchy within the definition file.
# The first level... |
def main():
"""
NAME
plot_map_pts.py
DESCRIPTION
plots points on map
SYNTAX
plot_map_pts.py [command line options]
OPTIONS
-h prints help and quits
-sym [ro, bs, g^, r., b-, etc.] [1,5,10] symbol and size for points
colors are r=red,b=blue,g=g... | def function[main, parameter[]]:
constant[
NAME
plot_map_pts.py
DESCRIPTION
plots points on map
SYNTAX
plot_map_pts.py [command line options]
OPTIONS
-h prints help and quits
-sym [ro, bs, g^, r., b-, etc.] [1,5,10] symbol and size for points
... | keyword[def] identifier[main] ():
literal[string]
identifier[dir_path] = literal[string]
identifier[plot] = literal[int]
identifier[ocean] = literal[int]
identifier[res] = literal[string]
identifier[proj] = literal[string]
identifier[Lats] , identifier[Lons] =[],[]
identi... | def main():
"""
NAME
plot_map_pts.py
DESCRIPTION
plots points on map
SYNTAX
plot_map_pts.py [command line options]
OPTIONS
-h prints help and quits
-sym [ro, bs, g^, r., b-, etc.] [1,5,10] symbol and size for points
colors are r=red,b=blue,g=g... |
def transform_login(config):
"""
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent ... | def function[transform_login, parameter[config]]:
constant[
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dic... | keyword[def] identifier[transform_login] ( identifier[config] ):
literal[string]
identifier[verify] = keyword[True]
keyword[if] identifier[config] . identifier[pop] ( literal[string] , keyword[None] ):
identifier[scheme] = literal[string]
identifier[verify] = identifier[config] .... | def transform_login(config):
"""
Parse login data as dict. Called from load_from_file and
also can be used when collecting information from other
sources as well.
:param dict data: data representing the valid key/value pairs
from smcrc
:return: dict dict of settings that can be sent ... |
def follower_num(self):
"""获取关注此收藏夹的人数.
:return: 关注此收藏夹的人数
:rtype: int
"""
href = re_collection_url_split.match(self.url).group(1)
return int(self.soup.find('a', href=href + 'followers').text) | def function[follower_num, parameter[self]]:
constant[获取关注此收藏夹的人数.
:return: 关注此收藏夹的人数
:rtype: int
]
variable[href] assign[=] call[call[name[re_collection_url_split].match, parameter[name[self].url]].group, parameter[constant[1]]]
return[call[name[int], parameter[call[name[se... | keyword[def] identifier[follower_num] ( identifier[self] ):
literal[string]
identifier[href] = identifier[re_collection_url_split] . identifier[match] ( identifier[self] . identifier[url] ). identifier[group] ( literal[int] )
keyword[return] identifier[int] ( identifier[self] . identifier... | def follower_num(self):
"""获取关注此收藏夹的人数.
:return: 关注此收藏夹的人数
:rtype: int
"""
href = re_collection_url_split.match(self.url).group(1)
return int(self.soup.find('a', href=href + 'followers').text) |
def parsehours (hrstr):
"""Parse a string formatted as sexagesimal hours into an angle.
This function converts a textual representation of an angle, measured in
hours, into a floating point value measured in radians. The format of
*hrstr* is very limited: it may not have leading or trailing whitespace,... | def function[parsehours, parameter[hrstr]]:
constant[Parse a string formatted as sexagesimal hours into an angle.
This function converts a textual representation of an angle, measured in
hours, into a floating point value measured in radians. The format of
*hrstr* is very limited: it may not have l... | keyword[def] identifier[parsehours] ( identifier[hrstr] ):
literal[string]
identifier[hr] = identifier[_parsesexagesimal] ( identifier[hrstr] , literal[string] , keyword[False] )
keyword[if] identifier[hr] >= literal[int] :
keyword[raise] identifier[ValueError] ( literal[string] + identifie... | def parsehours(hrstr):
"""Parse a string formatted as sexagesimal hours into an angle.
This function converts a textual representation of an angle, measured in
hours, into a floating point value measured in radians. The format of
*hrstr* is very limited: it may not have leading or trailing whitespace,
... |
def info(self):
"""
tuple of the start_pc, end_pc, handler_pc and catch_type_ref
"""
return (self.start_pc, self.end_pc,
self.handler_pc, self.get_catch_type()) | def function[info, parameter[self]]:
constant[
tuple of the start_pc, end_pc, handler_pc and catch_type_ref
]
return[tuple[[<ast.Attribute object at 0x7da1b0b1bdf0>, <ast.Attribute object at 0x7da1b0b1a890>, <ast.Attribute object at 0x7da1b0b190f0>, <ast.Call object at 0x7da1b0b19840>]]] | keyword[def] identifier[info] ( identifier[self] ):
literal[string]
keyword[return] ( identifier[self] . identifier[start_pc] , identifier[self] . identifier[end_pc] ,
identifier[self] . identifier[handler_pc] , identifier[self] . identifier[get_catch_type] ()) | def info(self):
"""
tuple of the start_pc, end_pc, handler_pc and catch_type_ref
"""
return (self.start_pc, self.end_pc, self.handler_pc, self.get_catch_type()) |
def connect(self):
""" Todo connect """
self.transport = Transport(self.token, on_connect=self.on_connect, on_message=self.on_message) | def function[connect, parameter[self]]:
constant[ Todo connect ]
name[self].transport assign[=] call[name[Transport], parameter[name[self].token]] | keyword[def] identifier[connect] ( identifier[self] ):
literal[string]
identifier[self] . identifier[transport] = identifier[Transport] ( identifier[self] . identifier[token] , identifier[on_connect] = identifier[self] . identifier[on_connect] , identifier[on_message] = identifier[self] . identifier[on_mes... | def connect(self):
""" Todo connect """
self.transport = Transport(self.token, on_connect=self.on_connect, on_message=self.on_message) |
def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analysis_per... | def function[filter_by_analysis_period, parameter[self, analysis_period]]:
constant[Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
]
call[name[self]... | keyword[def] identifier[filter_by_analysis_period] ( identifier[self] , identifier[analysis_period] ):
literal[string]
identifier[self] . identifier[_check_analysis_period] ( identifier[analysis_period] )
identifier[analysis_period] = identifier[self] . identifier[_get_analysis_period_subs... | def filter_by_analysis_period(self, analysis_period):
"""Filter the Data Collection based on an analysis period.
Args:
analysis period: A Ladybug analysis period
Return:
A new Data Collection with filtered data
"""
self._check_analysis_period(analysis_period)
... |
def visit_assert(self, node):
"""check the use of an assert statement on a tuple."""
if (
node.fail is None
and isinstance(node.test, astroid.Tuple)
and len(node.test.elts) == 2
):
self.add_message("assert-on-tuple", node=node) | def function[visit_assert, parameter[self, node]]:
constant[check the use of an assert statement on a tuple.]
if <ast.BoolOp object at 0x7da1b0317b80> begin[:]
call[name[self].add_message, parameter[constant[assert-on-tuple]]] | keyword[def] identifier[visit_assert] ( identifier[self] , identifier[node] ):
literal[string]
keyword[if] (
identifier[node] . identifier[fail] keyword[is] keyword[None]
keyword[and] identifier[isinstance] ( identifier[node] . identifier[test] , identifier[astroid] . identifi... | def visit_assert(self, node):
"""check the use of an assert statement on a tuple."""
if node.fail is None and isinstance(node.test, astroid.Tuple) and (len(node.test.elts) == 2):
self.add_message('assert-on-tuple', node=node) # depends on [control=['if'], data=[]] |
def is_present(cls):
"""
Check if the currently tested element is into the database.
"""
if PyFunceble.CONFIGURATION["inactive_database"]:
# The database subsystem is activated.
if PyFunceble.INTERN["to_test"] in PyFunceble.INTERN[
"flatten_inact... | def function[is_present, parameter[cls]]:
constant[
Check if the currently tested element is into the database.
]
if call[name[PyFunceble].CONFIGURATION][constant[inactive_database]] begin[:]
if <ast.BoolOp object at 0x7da1b02958d0> begin[:]
return[constant[Tr... | keyword[def] identifier[is_present] ( identifier[cls] ):
literal[string]
keyword[if] identifier[PyFunceble] . identifier[CONFIGURATION] [ literal[string] ]:
keyword[if] identifier[PyFunceble] . identifier[INTERN] [ literal[string] ] keyword[in] identifier[PyFunceble] . id... | def is_present(cls):
"""
Check if the currently tested element is into the database.
"""
if PyFunceble.CONFIGURATION['inactive_database']:
# The database subsystem is activated.
if PyFunceble.INTERN['to_test'] in PyFunceble.INTERN['flatten_inactive_db'] or (PyFunceble.INTERN['fil... |
def _wrap_measure(individual_state_measure_process, state_measure, loaded_processes):
"""
Creates a function on a state_collection, which creates analysis_collections for each state in the collection.
Optionally sorts the collection if the state_measure has a sort_by parameter (see funtool.lib.general... | def function[_wrap_measure, parameter[individual_state_measure_process, state_measure, loaded_processes]]:
constant[
Creates a function on a state_collection, which creates analysis_collections for each state in the collection.
Optionally sorts the collection if the state_measure has a sort_by para... | keyword[def] identifier[_wrap_measure] ( identifier[individual_state_measure_process] , identifier[state_measure] , identifier[loaded_processes] ):
literal[string]
keyword[def] identifier[wrapped_measure] ( identifier[state_collection] , identifier[overriding_parameters] = keyword[None] , identifier[logge... | def _wrap_measure(individual_state_measure_process, state_measure, loaded_processes):
"""
Creates a function on a state_collection, which creates analysis_collections for each state in the collection.
Optionally sorts the collection if the state_measure has a sort_by parameter (see funtool.lib.general.... |
def dispatch(self, *args, **kwargs):
'''Find and evaluate/return the first method this input dispatches to.
'''
for result in self.gen_dispatch(*args, **kwargs):
return result | def function[dispatch, parameter[self]]:
constant[Find and evaluate/return the first method this input dispatches to.
]
for taget[name[result]] in starred[call[name[self].gen_dispatch, parameter[<ast.Starred object at 0x7da1b008d810>]]] begin[:]
return[name[result]] | keyword[def] identifier[dispatch] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[for] identifier[result] keyword[in] identifier[self] . identifier[gen_dispatch] (* identifier[args] ,** identifier[kwargs] ):
keyword[return] identifier[result... | def dispatch(self, *args, **kwargs):
"""Find and evaluate/return the first method this input dispatches to.
"""
for result in self.gen_dispatch(*args, **kwargs):
return result # depends on [control=['for'], data=['result']] |
def program_pixel_reg(self, enable_receiver=True):
"""
Send the pixel register to the chip and store the output.
Loads the values of self['PIXEL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
if(enable_receiver)... | def function[program_pixel_reg, parameter[self, enable_receiver]]:
constant[
Send the pixel register to the chip and store the output.
Loads the values of self['PIXEL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
... | keyword[def] identifier[program_pixel_reg] ( identifier[self] , identifier[enable_receiver] = keyword[True] ):
literal[string]
identifier[self] . identifier[_clear_strobes] ()
identifier[self] [ literal[string] ]. identifier[set_en] ( identifier[enable_receiver] )
iden... | def program_pixel_reg(self, enable_receiver=True):
"""
Send the pixel register to the chip and store the output.
Loads the values of self['PIXEL_REG'] onto the chip.
Includes enabling the clock, and loading the Control (CTR)
and DAC shadow registers.
if(enable_receiver), st... |
def externals(trgt, **kwargs):
"""Return a list of direct external dependencies of ``pkgname``.
Called for the ``pydeps --externals`` command.
"""
kw = dict(
T='svg', config=None, debug=False, display=None, exclude=[], externals=True,
format='svg', max_bacon=2**65, no_config=True, nod... | def function[externals, parameter[trgt]]:
constant[Return a list of direct external dependencies of ``pkgname``.
Called for the ``pydeps --externals`` command.
]
variable[kw] assign[=] call[name[dict], parameter[]]
call[name[kw].update, parameter[name[kwargs]]]
variable[depgra... | keyword[def] identifier[externals] ( identifier[trgt] ,** identifier[kwargs] ):
literal[string]
identifier[kw] = identifier[dict] (
identifier[T] = literal[string] , identifier[config] = keyword[None] , identifier[debug] = keyword[False] , identifier[display] = keyword[None] , identifier[exclude] =[],... | def externals(trgt, **kwargs):
"""Return a list of direct external dependencies of ``pkgname``.
Called for the ``pydeps --externals`` command.
"""
kw = dict(T='svg', config=None, debug=False, display=None, exclude=[], externals=True, format='svg', max_bacon=2 ** 65, no_config=True, nodot=False, noise... |
def parse_option(self, option, block_name, *values):
""" Parse duration option for timer.
"""
try:
if len(values) != 1:
raise TypeError
self.total_duration = int(values[0])
if self.total_duration <= 0:
raise ValueError
... | def function[parse_option, parameter[self, option, block_name]]:
constant[ Parse duration option for timer.
]
<ast.Try object at 0x7da1b13b8d00> | keyword[def] identifier[parse_option] ( identifier[self] , identifier[option] , identifier[block_name] ,* identifier[values] ):
literal[string]
keyword[try] :
keyword[if] identifier[len] ( identifier[values] )!= literal[int] :
keyword[raise] identifier[TypeError]
... | def parse_option(self, option, block_name, *values):
""" Parse duration option for timer.
"""
try:
if len(values) != 1:
raise TypeError # depends on [control=['if'], data=[]]
self.total_duration = int(values[0])
if self.total_duration <= 0:
raise Valu... |
def parse_psql_array(inp):
"""
:param inp: a string encoding an array
:return: the array of elements as represented by the input
"""
inp = unescape_sql(inp)
# Strip '{' and '}'
if inp.startswith("{") and inp.endswith("}"):
inp = inp[1:-1]
lst = []
elem = ""
in_quotes, es... | def function[parse_psql_array, parameter[inp]]:
constant[
:param inp: a string encoding an array
:return: the array of elements as represented by the input
]
variable[inp] assign[=] call[name[unescape_sql], parameter[name[inp]]]
if <ast.BoolOp object at 0x7da1b10802b0> begin[:]
... | keyword[def] identifier[parse_psql_array] ( identifier[inp] ):
literal[string]
identifier[inp] = identifier[unescape_sql] ( identifier[inp] )
keyword[if] identifier[inp] . identifier[startswith] ( literal[string] ) keyword[and] identifier[inp] . identifier[endswith] ( literal[string] ):
... | def parse_psql_array(inp):
"""
:param inp: a string encoding an array
:return: the array of elements as represented by the input
"""
inp = unescape_sql(inp)
# Strip '{' and '}'
if inp.startswith('{') and inp.endswith('}'):
inp = inp[1:-1] # depends on [control=['if'], data=[]]
l... |
def update_from_shiftfile(shiftfile,wcsname=None,force=False):
"""
Update headers of all images specified in shiftfile with shifts
from shiftfile.
Parameters
----------
shiftfile : str
Filename of shiftfile.
wcsname : str
Label to give to new WCS solution being created by t... | def function[update_from_shiftfile, parameter[shiftfile, wcsname, force]]:
constant[
Update headers of all images specified in shiftfile with shifts
from shiftfile.
Parameters
----------
shiftfile : str
Filename of shiftfile.
wcsname : str
Label to give to new WCS solut... | keyword[def] identifier[update_from_shiftfile] ( identifier[shiftfile] , identifier[wcsname] = keyword[None] , identifier[force] = keyword[False] ):
literal[string]
identifier[f] = identifier[open] ( identifier[fileutil] . identifier[osfn] ( identifier[shiftfile] ))
identifier[shift_lines] =[ identifi... | def update_from_shiftfile(shiftfile, wcsname=None, force=False):
"""
Update headers of all images specified in shiftfile with shifts
from shiftfile.
Parameters
----------
shiftfile : str
Filename of shiftfile.
wcsname : str
Label to give to new WCS solution being created by... |
def fuzzy_index_match(possiblities, label, **kwargs):
"""Find the closest matching column label, key, or integer indexed value
Returns:
type(label): sequence of immutable objects corresponding to best matches to each object in label
if label is an int returns the object (value) in the list ... | def function[fuzzy_index_match, parameter[possiblities, label]]:
constant[Find the closest matching column label, key, or integer indexed value
Returns:
type(label): sequence of immutable objects corresponding to best matches to each object in label
if label is an int returns the object... | keyword[def] identifier[fuzzy_index_match] ( identifier[possiblities] , identifier[label] ,** identifier[kwargs] ):
literal[string]
identifier[possibilities] = identifier[list] ( identifier[possiblities] )
keyword[if] identifier[isinstance] ( identifier[label] , identifier[basestring] ):
key... | def fuzzy_index_match(possiblities, label, **kwargs):
"""Find the closest matching column label, key, or integer indexed value
Returns:
type(label): sequence of immutable objects corresponding to best matches to each object in label
if label is an int returns the object (value) in the list ... |
def is_readable(fp, size=1):
"""
Check if the file-like object is readable.
:param fp: file-like object
:param size: byte size
:return: bool
"""
read_size = len(fp.read(size))
fp.seek(-read_size, 1)
return read_size == size | def function[is_readable, parameter[fp, size]]:
constant[
Check if the file-like object is readable.
:param fp: file-like object
:param size: byte size
:return: bool
]
variable[read_size] assign[=] call[name[len], parameter[call[name[fp].read, parameter[name[size]]]]]
call[n... | keyword[def] identifier[is_readable] ( identifier[fp] , identifier[size] = literal[int] ):
literal[string]
identifier[read_size] = identifier[len] ( identifier[fp] . identifier[read] ( identifier[size] ))
identifier[fp] . identifier[seek] (- identifier[read_size] , literal[int] )
keyword[return] ... | def is_readable(fp, size=1):
"""
Check if the file-like object is readable.
:param fp: file-like object
:param size: byte size
:return: bool
"""
read_size = len(fp.read(size))
fp.seek(-read_size, 1)
return read_size == size |
def build_statusbar(self):
"""construct and return statusbar widget"""
info = {}
cb = self.current_buffer
btype = None
if cb is not None:
info = cb.get_info()
btype = cb.modename
info['buffer_no'] = self.buffers.index(cb)
info['buf... | def function[build_statusbar, parameter[self]]:
constant[construct and return statusbar widget]
variable[info] assign[=] dictionary[[], []]
variable[cb] assign[=] name[self].current_buffer
variable[btype] assign[=] constant[None]
if compare[name[cb] is_not constant[None]] begin[:... | keyword[def] identifier[build_statusbar] ( identifier[self] ):
literal[string]
identifier[info] ={}
identifier[cb] = identifier[self] . identifier[current_buffer]
identifier[btype] = keyword[None]
keyword[if] identifier[cb] keyword[is] keyword[not] keyword[None] :
... | def build_statusbar(self):
"""construct and return statusbar widget"""
info = {}
cb = self.current_buffer
btype = None
if cb is not None:
info = cb.get_info()
btype = cb.modename
info['buffer_no'] = self.buffers.index(cb)
info['buffer_type'] = btype # depends on [con... |
def is_current(self, paths=None):
"""Return true if dependency is present and up-to-date on 'paths'"""
version = self.get_version(paths)
if version is None:
return False
return self.version_ok(version) | def function[is_current, parameter[self, paths]]:
constant[Return true if dependency is present and up-to-date on 'paths']
variable[version] assign[=] call[name[self].get_version, parameter[name[paths]]]
if compare[name[version] is constant[None]] begin[:]
return[constant[False]]
ret... | keyword[def] identifier[is_current] ( identifier[self] , identifier[paths] = keyword[None] ):
literal[string]
identifier[version] = identifier[self] . identifier[get_version] ( identifier[paths] )
keyword[if] identifier[version] keyword[is] keyword[None] :
keyword[return] ... | def is_current(self, paths=None):
"""Return true if dependency is present and up-to-date on 'paths'"""
version = self.get_version(paths)
if version is None:
return False # depends on [control=['if'], data=[]]
return self.version_ok(version) |
def parallel(view, dist='b', block=None, ordered=True, **flags):
"""Turn a function into a parallel remote function.
This method can be used for map:
In [1]: @parallel(view, block=True)
...: def func(a):
...: pass
"""
def parallel_function(f):
return ParallelFunction(view... | def function[parallel, parameter[view, dist, block, ordered]]:
constant[Turn a function into a parallel remote function.
This method can be used for map:
In [1]: @parallel(view, block=True)
...: def func(a):
...: pass
]
def function[parallel_function, parameter[f]]:
... | keyword[def] identifier[parallel] ( identifier[view] , identifier[dist] = literal[string] , identifier[block] = keyword[None] , identifier[ordered] = keyword[True] ,** identifier[flags] ):
literal[string]
keyword[def] identifier[parallel_function] ( identifier[f] ):
keyword[return] identifier[P... | def parallel(view, dist='b', block=None, ordered=True, **flags):
"""Turn a function into a parallel remote function.
This method can be used for map:
In [1]: @parallel(view, block=True)
...: def func(a):
...: pass
"""
def parallel_function(f):
return ParallelFunction(view... |
def getShocks(self):
'''
Finds permanent and transitory income "shocks" for each agent this period. As this is a
perfect foresight model, there are no stochastic shocks: PermShkNow = PermGroFac for each
agent (according to their t_cycle) and TranShkNow = 1.0 for all agents.
Par... | def function[getShocks, parameter[self]]:
constant[
Finds permanent and transitory income "shocks" for each agent this period. As this is a
perfect foresight model, there are no stochastic shocks: PermShkNow = PermGroFac for each
agent (according to their t_cycle) and TranShkNow = 1.0 f... | keyword[def] identifier[getShocks] ( identifier[self] ):
literal[string]
identifier[PermGroFac] = identifier[np] . identifier[array] ( identifier[self] . identifier[PermGroFac] )
identifier[self] . identifier[PermShkNow] = identifier[PermGroFac] [ identifier[self] . identifier[t_cycle] - l... | def getShocks(self):
"""
Finds permanent and transitory income "shocks" for each agent this period. As this is a
perfect foresight model, there are no stochastic shocks: PermShkNow = PermGroFac for each
agent (according to their t_cycle) and TranShkNow = 1.0 for all agents.
Paramet... |
def stack(self, slug, chart_obj=None, title=None):
"""
Get the html for a chart and store it
"""
if chart_obj is None:
if self.chart_obj is None:
self.err(
self.stack,
"No chart object set: please provide one in paramete... | def function[stack, parameter[self, slug, chart_obj, title]]:
constant[
Get the html for a chart and store it
]
if compare[name[chart_obj] is constant[None]] begin[:]
if compare[name[self].chart_obj is constant[None]] begin[:]
call[name[self].err, ... | keyword[def] identifier[stack] ( identifier[self] , identifier[slug] , identifier[chart_obj] = keyword[None] , identifier[title] = keyword[None] ):
literal[string]
keyword[if] identifier[chart_obj] keyword[is] keyword[None] :
keyword[if] identifier[self] . identifier[chart_obj] ke... | def stack(self, slug, chart_obj=None, title=None):
"""
Get the html for a chart and store it
"""
if chart_obj is None:
if self.chart_obj is None:
self.err(self.stack, 'No chart object set: please provide one in parameters')
return # depends on [control=['if'], da... |
def _button_autosave_clicked(self, checked):
"""
Called whenever the button is clicked.
"""
if checked:
# get the path from the user
path = _spinmob.dialogs.save(filters=self.file_type)
# abort if necessary
if not path:
sel... | def function[_button_autosave_clicked, parameter[self, checked]]:
constant[
Called whenever the button is clicked.
]
if name[checked] begin[:]
variable[path] assign[=] call[name[_spinmob].dialogs.save, parameter[]]
if <ast.UnaryOp object at 0x7da18ede5030>... | keyword[def] identifier[_button_autosave_clicked] ( identifier[self] , identifier[checked] ):
literal[string]
keyword[if] identifier[checked] :
identifier[path] = identifier[_spinmob] . identifier[dialogs] . identifier[save] ( identifier[filters] = identifier[self] . identifi... | def _button_autosave_clicked(self, checked):
"""
Called whenever the button is clicked.
"""
if checked:
# get the path from the user
path = _spinmob.dialogs.save(filters=self.file_type)
# abort if necessary
if not path:
self.button_autosave.set_checked... |
def consume_socket_output(frames, demux=False):
"""
Iterate through frames read from the socket and return the result.
Args:
demux (bool):
If False, stdout and stderr are multiplexed, and the result is the
concatenation of all the frames. If True, the streams are
... | def function[consume_socket_output, parameter[frames, demux]]:
constant[
Iterate through frames read from the socket and return the result.
Args:
demux (bool):
If False, stdout and stderr are multiplexed, and the result is the
concatenation of all the frames. If True, t... | keyword[def] identifier[consume_socket_output] ( identifier[frames] , identifier[demux] = keyword[False] ):
literal[string]
keyword[if] identifier[demux] keyword[is] keyword[False] :
keyword[return] identifier[six] . identifier[binary_type] (). identifier[join] ( identifier[frames] )... | def consume_socket_output(frames, demux=False):
"""
Iterate through frames read from the socket and return the result.
Args:
demux (bool):
If False, stdout and stderr are multiplexed, and the result is the
concatenation of all the frames. If True, the streams are
... |
def is_oct(ip):
"""Return true if the IP address is in octal notation."""
try:
dec = int(str(ip), 8)
except (TypeError, ValueError):
return False
if dec > 0o37777777777 or dec < 0:
return False
return True | def function[is_oct, parameter[ip]]:
constant[Return true if the IP address is in octal notation.]
<ast.Try object at 0x7da1afe73490>
if <ast.BoolOp object at 0x7da20c6a8f70> begin[:]
return[constant[False]]
return[constant[True]] | keyword[def] identifier[is_oct] ( identifier[ip] ):
literal[string]
keyword[try] :
identifier[dec] = identifier[int] ( identifier[str] ( identifier[ip] ), literal[int] )
keyword[except] ( identifier[TypeError] , identifier[ValueError] ):
keyword[return] keyword[False]
keyword[... | def is_oct(ip):
"""Return true if the IP address is in octal notation."""
try:
dec = int(str(ip), 8) # depends on [control=['try'], data=[]]
except (TypeError, ValueError):
return False # depends on [control=['except'], data=[]]
if dec > 4294967295 or dec < 0:
return False # d... |
def generate_type_docs(types):
"""Parse an object of types and generate RAML documentation for them.
Expects each type to be either a regular type or a list/array. If a type is a list,
it must specify what type to use for each item.
"""
output = StringIO()
indent = " " # 2
# loop through... | def function[generate_type_docs, parameter[types]]:
constant[Parse an object of types and generate RAML documentation for them.
Expects each type to be either a regular type or a list/array. If a type is a list,
it must specify what type to use for each item.
]
variable[output] assign[=] cal... | keyword[def] identifier[generate_type_docs] ( identifier[types] ):
literal[string]
identifier[output] = identifier[StringIO] ()
identifier[indent] = literal[string]
keyword[for] identifier[type_name] keyword[in] identifier[types] :
keyword[if] identifier[types] [ identifier[... | def generate_type_docs(types):
"""Parse an object of types and generate RAML documentation for them.
Expects each type to be either a regular type or a list/array. If a type is a list,
it must specify what type to use for each item.
"""
output = StringIO()
indent = ' ' # 2
# loop through t... |
def get_edu_text(text_subtree):
"""return the text of the given EDU subtree, with '_!'-delimiters removed."""
assert text_subtree.label() == 'text', "text_subtree: {}".format(text_subtree)
edu_str = u' '.join(word for word in text_subtree.leaves())
return re.sub('_!(.*?)_!', '\g<1>', edu_str) | def function[get_edu_text, parameter[text_subtree]]:
constant[return the text of the given EDU subtree, with '_!'-delimiters removed.]
assert[compare[call[name[text_subtree].label, parameter[]] equal[==] constant[text]]]
variable[edu_str] assign[=] call[constant[ ].join, parameter[<ast.GeneratorExp ... | keyword[def] identifier[get_edu_text] ( identifier[text_subtree] ):
literal[string]
keyword[assert] identifier[text_subtree] . identifier[label] ()== literal[string] , literal[string] . identifier[format] ( identifier[text_subtree] )
identifier[edu_str] = literal[string] . identifier[join] ( identifi... | def get_edu_text(text_subtree):
"""return the text of the given EDU subtree, with '_!'-delimiters removed."""
assert text_subtree.label() == 'text', 'text_subtree: {}'.format(text_subtree)
edu_str = u' '.join((word for word in text_subtree.leaves()))
return re.sub('_!(.*?)_!', '\\g<1>', edu_str) |
def is_adjacent(self, other: ops.Qid) -> bool:
"""Determines if two qubits are adjacent qubits."""
return (isinstance(other, GridQubit) and
abs(self.row - other.row) + abs(self.col - other.col) == 1) | def function[is_adjacent, parameter[self, other]]:
constant[Determines if two qubits are adjacent qubits.]
return[<ast.BoolOp object at 0x7da204621600>] | keyword[def] identifier[is_adjacent] ( identifier[self] , identifier[other] : identifier[ops] . identifier[Qid] )-> identifier[bool] :
literal[string]
keyword[return] ( identifier[isinstance] ( identifier[other] , identifier[GridQubit] ) keyword[and]
identifier[abs] ( identifier[self] . i... | def is_adjacent(self, other: ops.Qid) -> bool:
"""Determines if two qubits are adjacent qubits."""
return isinstance(other, GridQubit) and abs(self.row - other.row) + abs(self.col - other.col) == 1 |
def add_partition(self, spec, location=None):
"""
Add a new table partition, creating any new directories in HDFS if
necessary.
Partition parameters can be set in a single DDL statement, or you can
use alter_partition to set them after the fact.
Returns
-------
... | def function[add_partition, parameter[self, spec, location]]:
constant[
Add a new table partition, creating any new directories in HDFS if
necessary.
Partition parameters can be set in a single DDL statement, or you can
use alter_partition to set them after the fact.
Re... | keyword[def] identifier[add_partition] ( identifier[self] , identifier[spec] , identifier[location] = keyword[None] ):
literal[string]
identifier[part_schema] = identifier[self] . identifier[partition_schema] ()
identifier[stmt] = identifier[ddl] . identifier[AddPartition] (
ident... | def add_partition(self, spec, location=None):
"""
Add a new table partition, creating any new directories in HDFS if
necessary.
Partition parameters can be set in a single DDL statement, or you can
use alter_partition to set them after the fact.
Returns
-------
... |
def libvlc_media_new_as_node(p_instance, psz_name):
'''Create a media as an empty node with a given name.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param psz_name: the name of the node.
@return: the new empty media or NULL on error.
'''
f = _Cfunctions.get('libvlc_media_... | def function[libvlc_media_new_as_node, parameter[p_instance, psz_name]]:
constant[Create a media as an empty node with a given name.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param psz_name: the name of the node.
@return: the new empty media or NULL on error.
]
v... | keyword[def] identifier[libvlc_media_new_as_node] ( identifier[p_instance] , identifier[psz_name] ):
literal[string]
identifier[f] = identifier[_Cfunctions] . identifier[get] ( literal[string] , keyword[None] ) keyword[or] identifier[_Cfunction] ( literal[string] ,(( literal[int] ,),( literal[int] ,),), i... | def libvlc_media_new_as_node(p_instance, psz_name):
"""Create a media as an empty node with a given name.
See L{libvlc_media_release}.
@param p_instance: the instance.
@param psz_name: the name of the node.
@return: the new empty media or NULL on error.
"""
f = _Cfunctions.get('libvlc_media_... |
def calculate_taper_function(obs_threshold_moment, sel_threshold_moment,
corner_moment, beta):
'''
Calculates the tapering function of the tapered Gutenberg & Richter model:
as described in Bird & Liu (2007)::
taper_function = (M_0(M_T) / M_0(M_T^{CMT}))^-beta x exp((M_0(m... | def function[calculate_taper_function, parameter[obs_threshold_moment, sel_threshold_moment, corner_moment, beta]]:
constant[
Calculates the tapering function of the tapered Gutenberg & Richter model:
as described in Bird & Liu (2007)::
taper_function = (M_0(M_T) / M_0(M_T^{CMT}))^-beta x exp((M_0... | keyword[def] identifier[calculate_taper_function] ( identifier[obs_threshold_moment] , identifier[sel_threshold_moment] ,
identifier[corner_moment] , identifier[beta] ):
literal[string]
identifier[argument] =( identifier[obs_threshold_moment] - identifier[sel_threshold_moment] )/ identifier[corner_moment]... | def calculate_taper_function(obs_threshold_moment, sel_threshold_moment, corner_moment, beta):
"""
Calculates the tapering function of the tapered Gutenberg & Richter model:
as described in Bird & Liu (2007)::
taper_function = (M_0(M_T) / M_0(M_T^{CMT}))^-beta x exp((M_0(m_T^CMT) -
M_0(m_T)) ... |
def call(operation_name, *args, **kwargs):
"""Call a libvips operation.
Use this method to call any libvips operation. For example::
black_image = pyvips.Operation.call('black', 10, 10)
See the Introduction for notes on how this works.
"""
logger.debug('VipsOpera... | def function[call, parameter[operation_name]]:
constant[Call a libvips operation.
Use this method to call any libvips operation. For example::
black_image = pyvips.Operation.call('black', 10, 10)
See the Introduction for notes on how this works.
]
call[name[logger... | keyword[def] identifier[call] ( identifier[operation_name] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] , identifier[operation_name] )
identifier[string_options] = identifier[kwargs] . id... | def call(operation_name, *args, **kwargs):
"""Call a libvips operation.
Use this method to call any libvips operation. For example::
black_image = pyvips.Operation.call('black', 10, 10)
See the Introduction for notes on how this works.
"""
logger.debug('VipsOperation.call... |
def inspect_work_unit(self, work_spec_name, work_unit_key):
'''Get the data for some work unit.
Returns the data for that work unit, or `None` if it really
can't be found.
:param str work_spec_name: name of the work spec
:param str work_unit_key: name of the work unit
:... | def function[inspect_work_unit, parameter[self, work_spec_name, work_unit_key]]:
constant[Get the data for some work unit.
Returns the data for that work unit, or `None` if it really
can't be found.
:param str work_spec_name: name of the work spec
:param str work_unit_key: name... | keyword[def] identifier[inspect_work_unit] ( identifier[self] , identifier[work_spec_name] , identifier[work_unit_key] ):
literal[string]
keyword[with] identifier[self] . identifier[registry] . identifier[lock] ( identifier[identifier] = identifier[self] . identifier[worker_id] ) keyword[as] iden... | def inspect_work_unit(self, work_spec_name, work_unit_key):
"""Get the data for some work unit.
Returns the data for that work unit, or `None` if it really
can't be found.
:param str work_spec_name: name of the work spec
:param str work_unit_key: name of the work unit
:retu... |
def feature_extraction(self, algorithms):
"""Get a list of features.
Every algorithm has to return the features as a list."""
assert type(algorithms) is list
features = []
for algorithm in algorithms:
new_features = algorithm(self)
assert len(new_features... | def function[feature_extraction, parameter[self, algorithms]]:
constant[Get a list of features.
Every algorithm has to return the features as a list.]
assert[compare[call[name[type], parameter[name[algorithms]]] is name[list]]]
variable[features] assign[=] list[[]]
for taget[name[al... | keyword[def] identifier[feature_extraction] ( identifier[self] , identifier[algorithms] ):
literal[string]
keyword[assert] identifier[type] ( identifier[algorithms] ) keyword[is] identifier[list]
identifier[features] =[]
keyword[for] identifier[algorithm] keyword[in] identif... | def feature_extraction(self, algorithms):
"""Get a list of features.
Every algorithm has to return the features as a list."""
assert type(algorithms) is list
features = []
for algorithm in algorithms:
new_features = algorithm(self)
assert len(new_features) == algorithm.get_dimen... |
def extend_left_to(self, window, max_size):
"""Adjust the offset to start where the given window on our left ends if possible,
but don't make yourself larger than max_size.
The resize will assure that the new window still contains the old window area"""
rofs = self.ofs - window.ofs_end()... | def function[extend_left_to, parameter[self, window, max_size]]:
constant[Adjust the offset to start where the given window on our left ends if possible,
but don't make yourself larger than max_size.
The resize will assure that the new window still contains the old window area]
variable[... | keyword[def] identifier[extend_left_to] ( identifier[self] , identifier[window] , identifier[max_size] ):
literal[string]
identifier[rofs] = identifier[self] . identifier[ofs] - identifier[window] . identifier[ofs_end] ()
identifier[nsize] = identifier[rofs] + identifier[self] . identifier... | def extend_left_to(self, window, max_size):
"""Adjust the offset to start where the given window on our left ends if possible,
but don't make yourself larger than max_size.
The resize will assure that the new window still contains the old window area"""
rofs = self.ofs - window.ofs_end()
nsi... |
def render(self, request):
"""
Render a request by forwarding it to the proxied server.
"""
# set up and evaluate a connection to the target server
if self.port == 80:
host = self.host
else:
host = "%s:%d" % (self.host, self.port)
request.r... | def function[render, parameter[self, request]]:
constant[
Render a request by forwarding it to the proxied server.
]
if compare[name[self].port equal[==] constant[80]] begin[:]
variable[host] assign[=] name[self].host
call[name[request].requestHeaders.addRawHeader... | keyword[def] identifier[render] ( identifier[self] , identifier[request] ):
literal[string]
keyword[if] identifier[self] . identifier[port] == literal[int] :
identifier[host] = identifier[self] . identifier[host]
keyword[else] :
identifier[host] = liter... | def render(self, request):
"""
Render a request by forwarding it to the proxied server.
"""
# set up and evaluate a connection to the target server
if self.port == 80:
host = self.host # depends on [control=['if'], data=[]]
else:
host = '%s:%d' % (self.host, self.port)
... |
def create(self):
"""Create this database within its instance
Inclues any configured schema assigned to :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase
:rt... | def function[create, parameter[self]]:
constant[Create this database within its instance
Inclues any configured schema assigned to :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.... | keyword[def] identifier[create] ( identifier[self] ):
literal[string]
identifier[api] = identifier[self] . identifier[_instance] . identifier[_client] . identifier[database_admin_api]
identifier[metadata] = identifier[_metadata_with_prefix] ( identifier[self] . identifier[name] )
... | def create(self):
"""Create this database within its instance
Inclues any configured schema assigned to :attr:`ddl_statements`.
See
https://cloud.google.com/spanner/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase
:rtype:... |
def _get_total_read_size(self):
"""How much event data to process at once."""
if self.read_size:
read_size = EVENT_SIZE * self.read_size
else:
read_size = EVENT_SIZE
return read_size | def function[_get_total_read_size, parameter[self]]:
constant[How much event data to process at once.]
if name[self].read_size begin[:]
variable[read_size] assign[=] binary_operation[name[EVENT_SIZE] * name[self].read_size]
return[name[read_size]] | keyword[def] identifier[_get_total_read_size] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[read_size] :
identifier[read_size] = identifier[EVENT_SIZE] * identifier[self] . identifier[read_size]
keyword[else] :
identifier[read_s... | def _get_total_read_size(self):
"""How much event data to process at once."""
if self.read_size:
read_size = EVENT_SIZE * self.read_size # depends on [control=['if'], data=[]]
else:
read_size = EVENT_SIZE
return read_size |
def should_checkpoint(self):
"""Whether this trial is due for checkpointing."""
result = self.last_result or {}
if result.get(DONE) and self.checkpoint_at_end:
return True
if self.checkpoint_freq:
return result.get(TRAINING_ITERATION,
... | def function[should_checkpoint, parameter[self]]:
constant[Whether this trial is due for checkpointing.]
variable[result] assign[=] <ast.BoolOp object at 0x7da1b2345b70>
if <ast.BoolOp object at 0x7da1b23473d0> begin[:]
return[constant[True]]
if name[self].checkpoint_freq begin[:... | keyword[def] identifier[should_checkpoint] ( identifier[self] ):
literal[string]
identifier[result] = identifier[self] . identifier[last_result] keyword[or] {}
keyword[if] identifier[result] . identifier[get] ( identifier[DONE] ) keyword[and] identifier[self] . identifier[checkpoint_at... | def should_checkpoint(self):
"""Whether this trial is due for checkpointing."""
result = self.last_result or {}
if result.get(DONE) and self.checkpoint_at_end:
return True # depends on [control=['if'], data=[]]
if self.checkpoint_freq:
return result.get(TRAINING_ITERATION, 0) % self.che... |
def get_data(path):
"""
Returns data from a package directory.
'path' should be an absolute path.
"""
# Run the imported setup to get the metadata.
with FakeContext(path):
with SetupMonkey() as sm:
try:
distro = run_setup('setup.py', stop_after='config')
... | def function[get_data, parameter[path]]:
constant[
Returns data from a package directory.
'path' should be an absolute path.
]
with call[name[FakeContext], parameter[name[path]]] begin[:]
with call[name[SetupMonkey], parameter[]] begin[:]
<ast.Try object at 0x7da1... | keyword[def] identifier[get_data] ( identifier[path] ):
literal[string]
keyword[with] identifier[FakeContext] ( identifier[path] ):
keyword[with] identifier[SetupMonkey] () keyword[as] identifier[sm] :
keyword[try] :
identifier[distro] = identifier[run_setup] ... | def get_data(path):
"""
Returns data from a package directory.
'path' should be an absolute path.
"""
# Run the imported setup to get the metadata.
with FakeContext(path):
with SetupMonkey() as sm:
try:
distro = run_setup('setup.py', stop_after='config')
... |
def primary_suffix(name,
suffix=None,
updates=False):
'''
.. versionadded:: 2014.7.0
Configure the global primary DNS suffix of a DHCP client.
suffix : None
The suffix which is advertised for this client when acquiring a DHCP lease
When none is set, the explicitly confi... | def function[primary_suffix, parameter[name, suffix, updates]]:
constant[
.. versionadded:: 2014.7.0
Configure the global primary DNS suffix of a DHCP client.
suffix : None
The suffix which is advertised for this client when acquiring a DHCP lease
When none is set, the explicitly c... | keyword[def] identifier[primary_suffix] ( identifier[name] ,
identifier[suffix] = keyword[None] ,
identifier[updates] = keyword[False] ):
literal[string]
identifier[ret] ={
literal[string] : identifier[name] ,
literal[string] :{},
literal[string] : keyword[True] ,
literal[string] : l... | def primary_suffix(name, suffix=None, updates=False):
"""
.. versionadded:: 2014.7.0
Configure the global primary DNS suffix of a DHCP client.
suffix : None
The suffix which is advertised for this client when acquiring a DHCP lease
When none is set, the explicitly configured DNS suffix... |
def users(self, institute=None):
"""Return all users from the database
Args:
institute(str): A institute_id
Returns:
res(pymongo.Cursor): A cursor with users
"""
query = {}
if institute:
LOG.info("Fetch... | def function[users, parameter[self, institute]]:
constant[Return all users from the database
Args:
institute(str): A institute_id
Returns:
res(pymongo.Cursor): A cursor with users
]
variable[query] assign[=] dictionary[[],... | keyword[def] identifier[users] ( identifier[self] , identifier[institute] = keyword[None] ):
literal[string]
identifier[query] ={}
keyword[if] identifier[institute] :
identifier[LOG] . identifier[info] ( literal[string] , identifier[institute] )
identifier[query]... | def users(self, institute=None):
"""Return all users from the database
Args:
institute(str): A institute_id
Returns:
res(pymongo.Cursor): A cursor with users
"""
query = {}
if institute:
LOG.info('Fetching all users fr... |
def set_maxrad(self,newrad):
"""
Sets max allowed radius in populations.
Doesn't operate via the :class:`stars.Constraint`
protocol; rather just rescales the sky positions
for the background objects and recalculates
sky area, etc.
"""
if not isinstance(n... | def function[set_maxrad, parameter[self, newrad]]:
constant[
Sets max allowed radius in populations.
Doesn't operate via the :class:`stars.Constraint`
protocol; rather just rescales the sky positions
for the background objects and recalculates
sky area, etc.
]
... | keyword[def] identifier[set_maxrad] ( identifier[self] , identifier[newrad] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[newrad] , identifier[Quantity] ):
identifier[newrad] = identifier[newrad] * identifier[u] . identifier[arcsec]
... | def set_maxrad(self, newrad):
"""
Sets max allowed radius in populations.
Doesn't operate via the :class:`stars.Constraint`
protocol; rather just rescales the sky positions
for the background objects and recalculates
sky area, etc.
"""
if not isinstance(newrad, ... |
def connect_default_driver_wrapper(cls, config_files=None):
"""Get default driver wrapper, configure it and connect driver
:param config_files: driver wrapper specific config files
:returns: default driver wrapper
:rtype: toolium.driver_wrapper.DriverWrapper
"""
driver_w... | def function[connect_default_driver_wrapper, parameter[cls, config_files]]:
constant[Get default driver wrapper, configure it and connect driver
:param config_files: driver wrapper specific config files
:returns: default driver wrapper
:rtype: toolium.driver_wrapper.DriverWrapper
... | keyword[def] identifier[connect_default_driver_wrapper] ( identifier[cls] , identifier[config_files] = keyword[None] ):
literal[string]
identifier[driver_wrapper] = identifier[cls] . identifier[get_default_wrapper] ()
keyword[if] keyword[not] identifier[driver_wrapper] . identifier[drive... | def connect_default_driver_wrapper(cls, config_files=None):
"""Get default driver wrapper, configure it and connect driver
:param config_files: driver wrapper specific config files
:returns: default driver wrapper
:rtype: toolium.driver_wrapper.DriverWrapper
"""
driver_wrapper =... |
def _format_native_types(self, na_rep='NaT', date_format=None, **kwargs):
"""
actually format my specific types
"""
values = self.astype(object)
if date_format:
formatter = lambda dt: dt.strftime(date_format)
else:
formatter = lambda dt: '%s' % dt... | def function[_format_native_types, parameter[self, na_rep, date_format]]:
constant[
actually format my specific types
]
variable[values] assign[=] call[name[self].astype, parameter[name[object]]]
if name[date_format] begin[:]
variable[formatter] assign[=] <ast.Lam... | keyword[def] identifier[_format_native_types] ( identifier[self] , identifier[na_rep] = literal[string] , identifier[date_format] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[values] = identifier[self] . identifier[astype] ( identifier[object] )
keyword[if] identi... | def _format_native_types(self, na_rep='NaT', date_format=None, **kwargs):
"""
actually format my specific types
"""
values = self.astype(object)
if date_format:
formatter = lambda dt: dt.strftime(date_format) # depends on [control=['if'], data=[]]
else:
formatter = lambd... |
def LegacyKextload(self, cf_bundle_url, dependency_kext):
"""Load a kext by forking into kextload."""
_ = dependency_kext
error_code = OS_SUCCESS
cf_path = self.dll.CFURLCopyFileSystemPath(cf_bundle_url, POSIX_PATH_STYLE)
path = self.CFStringToPystring(cf_path)
self.dll.CFRelease(cf_path)
tr... | def function[LegacyKextload, parameter[self, cf_bundle_url, dependency_kext]]:
constant[Load a kext by forking into kextload.]
variable[_] assign[=] name[dependency_kext]
variable[error_code] assign[=] name[OS_SUCCESS]
variable[cf_path] assign[=] call[name[self].dll.CFURLCopyFileSystemPa... | keyword[def] identifier[LegacyKextload] ( identifier[self] , identifier[cf_bundle_url] , identifier[dependency_kext] ):
literal[string]
identifier[_] = identifier[dependency_kext]
identifier[error_code] = identifier[OS_SUCCESS]
identifier[cf_path] = identifier[self] . identifier[dll] . identifi... | def LegacyKextload(self, cf_bundle_url, dependency_kext):
"""Load a kext by forking into kextload."""
_ = dependency_kext
error_code = OS_SUCCESS
cf_path = self.dll.CFURLCopyFileSystemPath(cf_bundle_url, POSIX_PATH_STYLE)
path = self.CFStringToPystring(cf_path)
self.dll.CFRelease(cf_path)
tr... |
def term_echo(command, nindent=0, env=None, fpointer=None, cols=60):
"""
Print STDOUT resulting from a Bash shell command formatted in reStructuredText.
:param command: Bash shell command
:type command: string
:param nindent: Indentation level
:type nindent: integer
:param env: Environm... | def function[term_echo, parameter[command, nindent, env, fpointer, cols]]:
constant[
Print STDOUT resulting from a Bash shell command formatted in reStructuredText.
:param command: Bash shell command
:type command: string
:param nindent: Indentation level
:type nindent: integer
:par... | keyword[def] identifier[term_echo] ( identifier[command] , identifier[nindent] = literal[int] , identifier[env] = keyword[None] , identifier[fpointer] = keyword[None] , identifier[cols] = literal[int] ):
literal[string]
identifier[os] . identifier[environ] [ literal[string] ]= identifier[str... | def term_echo(command, nindent=0, env=None, fpointer=None, cols=60):
"""
Print STDOUT resulting from a Bash shell command formatted in reStructuredText.
:param command: Bash shell command
:type command: string
:param nindent: Indentation level
:type nindent: integer
:param env: Environm... |
def loadRecord(self, domain, type, zone=None, callback=None,
errback=None, **kwargs):
"""
Load an existing record into a high level Record object.
:param str domain: domain name of the record in the zone, for example \
'myrecord'. You may leave off the zone, since... | def function[loadRecord, parameter[self, domain, type, zone, callback, errback]]:
constant[
Load an existing record into a high level Record object.
:param str domain: domain name of the record in the zone, for example 'myrecord'. You may leave off the zone, since it must be ... | keyword[def] identifier[loadRecord] ( identifier[self] , identifier[domain] , identifier[type] , identifier[zone] = keyword[None] , identifier[callback] = keyword[None] ,
identifier[errback] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[import] identifier[ns1] . identifier[zon... | def loadRecord(self, domain, type, zone=None, callback=None, errback=None, **kwargs):
"""
Load an existing record into a high level Record object.
:param str domain: domain name of the record in the zone, for example 'myrecord'. You may leave off the zone, since it must be s... |
def group_batches(xs):
"""Group samples into batches for simultaneous variant calling.
Identify all samples to call together: those in the same batch
and variant caller.
Pull together all BAM files from this batch and process together,
Provide details to pull these finalized files back into individ... | def function[group_batches, parameter[xs]]:
constant[Group samples into batches for simultaneous variant calling.
Identify all samples to call together: those in the same batch
and variant caller.
Pull together all BAM files from this batch and process together,
Provide details to pull these fi... | keyword[def] identifier[group_batches] ( identifier[xs] ):
literal[string]
keyword[def] identifier[_caller_batches] ( identifier[data] ):
identifier[caller] = identifier[tz] . identifier[get_in] (( literal[string] , literal[string] , literal[string] ), identifier[data] )
identifier[joint... | def group_batches(xs):
"""Group samples into batches for simultaneous variant calling.
Identify all samples to call together: those in the same batch
and variant caller.
Pull together all BAM files from this batch and process together,
Provide details to pull these finalized files back into individ... |
def predict_fixation_duration(
durations, angles, length_diffs, dataset=None, params=None):
"""
Fits a non-linear piecewise regression to fixtaion durations for a fixmat.
Returns corrected fixation durations.
"""
if dataset is None:
dataset = np.ones(durations.shape)
corrected_d... | def function[predict_fixation_duration, parameter[durations, angles, length_diffs, dataset, params]]:
constant[
Fits a non-linear piecewise regression to fixtaion durations for a fixmat.
Returns corrected fixation durations.
]
if compare[name[dataset] is constant[None]] begin[:]
... | keyword[def] identifier[predict_fixation_duration] (
identifier[durations] , identifier[angles] , identifier[length_diffs] , identifier[dataset] = keyword[None] , identifier[params] = keyword[None] ):
literal[string]
keyword[if] identifier[dataset] keyword[is] keyword[None] :
identifier[datase... | def predict_fixation_duration(durations, angles, length_diffs, dataset=None, params=None):
"""
Fits a non-linear piecewise regression to fixtaion durations for a fixmat.
Returns corrected fixation durations.
"""
if dataset is None:
dataset = np.ones(durations.shape) # depends on [control=[... |
def get_site(self, plot_voronoi_sites=False):
"""Return primaty (top, bridge, hollow, 4fold) and
secondary (chemical elements in close environment) site designation"""
if self.dissociated:
return 'dissociated', ''
if self.is_desorbed():
return 'desorbed', ''
... | def function[get_site, parameter[self, plot_voronoi_sites]]:
constant[Return primaty (top, bridge, hollow, 4fold) and
secondary (chemical elements in close environment) site designation]
if name[self].dissociated begin[:]
return[tuple[[<ast.Constant object at 0x7da204566920>, <ast.Consta... | keyword[def] identifier[get_site] ( identifier[self] , identifier[plot_voronoi_sites] = keyword[False] ):
literal[string]
keyword[if] identifier[self] . identifier[dissociated] :
keyword[return] literal[string] , literal[string]
keyword[if] identifier[self] . identifier[... | def get_site(self, plot_voronoi_sites=False):
"""Return primaty (top, bridge, hollow, 4fold) and
secondary (chemical elements in close environment) site designation"""
if self.dissociated:
return ('dissociated', '') # depends on [control=['if'], data=[]]
if self.is_desorbed():
retur... |
def list(self):
"""List collection items."""
if self.is_fake:
return
for item in self.collection.list():
yield item.uid + self.content_suffix | def function[list, parameter[self]]:
constant[List collection items.]
if name[self].is_fake begin[:]
return[None]
for taget[name[item]] in starred[call[name[self].collection.list, parameter[]]] begin[:]
<ast.Yield object at 0x7da18c4cfc40> | keyword[def] identifier[list] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[is_fake] :
keyword[return]
keyword[for] identifier[item] keyword[in] identifier[self] . identifier[collection] . identifier[list] ():
keyword[yield]... | def list(self):
"""List collection items."""
if self.is_fake:
return # depends on [control=['if'], data=[]]
for item in self.collection.list():
yield (item.uid + self.content_suffix) # depends on [control=['for'], data=['item']] |
def _decode(self, s):
'''This converts from the external coding system (as passed to
the constructor) to the internal one (unicode). '''
if self.decoder is not None:
return self.decoder.decode(s)
else:
raise TypeError("This screen was constructed with encoding=Non... | def function[_decode, parameter[self, s]]:
constant[This converts from the external coding system (as passed to
the constructor) to the internal one (unicode). ]
if compare[name[self].decoder is_not constant[None]] begin[:]
return[call[name[self].decoder.decode, parameter[name[s]]]] | keyword[def] identifier[_decode] ( identifier[self] , identifier[s] ):
literal[string]
keyword[if] identifier[self] . identifier[decoder] keyword[is] keyword[not] keyword[None] :
keyword[return] identifier[self] . identifier[decoder] . identifier[decode] ( identifier[s] )
... | def _decode(self, s):
"""This converts from the external coding system (as passed to
the constructor) to the internal one (unicode). """
if self.decoder is not None:
return self.decoder.decode(s) # depends on [control=['if'], data=[]]
else:
raise TypeError('This screen was construct... |
def _set_ospf(self, v, load=False):
"""
Setter method for ospf, mapped from YANG variable /rbridge_id/router/ospf (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_ospf is considered as a private
method. Backends looking to populate this variable should
do s... | def function[_set_ospf, parameter[self, v, load]]:
constant[
Setter method for ospf, mapped from YANG variable /rbridge_id/router/ospf (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_ospf is considered as a private
method. Backends looking to populate this... | keyword[def] identifier[_set_ospf] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
identifie... | def _set_ospf(self, v, load=False):
"""
Setter method for ospf, mapped from YANG variable /rbridge_id/router/ospf (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_ospf is considered as a private
method. Backends looking to populate this variable should
do s... |
async def start_client(self,
sock: anyio.abc.SocketStream,
addr,
path: str,
headers: Optional[List] = None,
subprotocols: Optional[List[str]] = None):
"""Start a client WS conne... | <ast.AsyncFunctionDef object at 0x7da18ede4310> | keyword[async] keyword[def] identifier[start_client] ( identifier[self] ,
identifier[sock] : identifier[anyio] . identifier[abc] . identifier[SocketStream] ,
identifier[addr] ,
identifier[path] : identifier[str] ,
identifier[headers] : identifier[Optional] [ identifier[List] ]= keyword[None] ,
identifier[subpro... | async def start_client(self, sock: anyio.abc.SocketStream, addr, path: str, headers: Optional[List]=None, subprotocols: Optional[List[str]]=None):
"""Start a client WS connection on this socket.
Returns: the AcceptConnection message.
"""
self._sock = sock
self._connection = WSConnection(Con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.