code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def mock_session_with_class(session, cls, url):
"""
Context Manager
Mock the responses with a particular session
to any private methods for the URLs
:param session: The requests session object
:type session: :class:`requests.Session`
:param cls: The class instance with private methods fo... | def function[mock_session_with_class, parameter[session, cls, url]]:
constant[
Context Manager
Mock the responses with a particular session
to any private methods for the URLs
:param session: The requests session object
:type session: :class:`requests.Session`
:param cls: The class i... | keyword[def] identifier[mock_session_with_class] ( identifier[session] , identifier[cls] , identifier[url] ):
literal[string]
identifier[_orig_adapters] = identifier[session] . identifier[adapters]
identifier[mock_adapter] = identifier[adapter] . identifier[ClassAdapter] ( identifier[cls] )
iden... | def mock_session_with_class(session, cls, url):
"""
Context Manager
Mock the responses with a particular session
to any private methods for the URLs
:param session: The requests session object
:type session: :class:`requests.Session`
:param cls: The class instance with private methods fo... |
def load(self, commit=None):
"""Load a result from the storage directory."""
git_info = self.record_git_info(commit)
LOGGER.debug("Loading the result for commit '%s'.", git_info.hexsha)
filename = self.get_filename(git_info)
LOGGER.debug("Loading the result '%s'.", filename)
... | def function[load, parameter[self, commit]]:
constant[Load a result from the storage directory.]
variable[git_info] assign[=] call[name[self].record_git_info, parameter[name[commit]]]
call[name[LOGGER].debug, parameter[constant[Loading the result for commit '%s'.], name[git_info].hexsha]]
... | keyword[def] identifier[load] ( identifier[self] , identifier[commit] = keyword[None] ):
literal[string]
identifier[git_info] = identifier[self] . identifier[record_git_info] ( identifier[commit] )
identifier[LOGGER] . identifier[debug] ( literal[string] , identifier[git_info] . identifier... | def load(self, commit=None):
"""Load a result from the storage directory."""
git_info = self.record_git_info(commit)
LOGGER.debug("Loading the result for commit '%s'.", git_info.hexsha)
filename = self.get_filename(git_info)
LOGGER.debug("Loading the result '%s'.", filename)
result = super(RepoR... |
def tokenize_block(iterable, token_types):
"""
Returns a list of pairs (token_type, read_result).
Footnotes are parsed here, but span-level parsing has not
started yet.
"""
lines = FileWrapper(iterable)
parse_buffer = ParseBuffer()
line = lines.peek()
while line is not None:
... | def function[tokenize_block, parameter[iterable, token_types]]:
constant[
Returns a list of pairs (token_type, read_result).
Footnotes are parsed here, but span-level parsing has not
started yet.
]
variable[lines] assign[=] call[name[FileWrapper], parameter[name[iterable]]]
vari... | keyword[def] identifier[tokenize_block] ( identifier[iterable] , identifier[token_types] ):
literal[string]
identifier[lines] = identifier[FileWrapper] ( identifier[iterable] )
identifier[parse_buffer] = identifier[ParseBuffer] ()
identifier[line] = identifier[lines] . identifier[peek] ()
ke... | def tokenize_block(iterable, token_types):
"""
Returns a list of pairs (token_type, read_result).
Footnotes are parsed here, but span-level parsing has not
started yet.
"""
lines = FileWrapper(iterable)
parse_buffer = ParseBuffer()
line = lines.peek()
while line is not None:
... |
def move_dot(self):
"""Returns the DottedRule that results from moving the dot."""
return self.__class__(self.production, self.pos + 1, self.lookahead) | def function[move_dot, parameter[self]]:
constant[Returns the DottedRule that results from moving the dot.]
return[call[name[self].__class__, parameter[name[self].production, binary_operation[name[self].pos + constant[1]], name[self].lookahead]]] | keyword[def] identifier[move_dot] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[__class__] ( identifier[self] . identifier[production] , identifier[self] . identifier[pos] + literal[int] , identifier[self] . identifier[lookahead] ) | def move_dot(self):
"""Returns the DottedRule that results from moving the dot."""
return self.__class__(self.production, self.pos + 1, self.lookahead) |
def config_lines_w_child(parent_regex, child_regex, source='running'):
r'''
.. versionadded:: 2019.2.0
Return the configuration lines that match the regular expressions from the
``parent_regex`` argument, having child lines matching ``child_regex``.
The configuration is read from the network devic... | def function[config_lines_w_child, parameter[parent_regex, child_regex, source]]:
constant[
.. versionadded:: 2019.2.0
Return the configuration lines that match the regular expressions from the
``parent_regex`` argument, having child lines matching ``child_regex``.
The configuration is read fr... | keyword[def] identifier[config_lines_w_child] ( identifier[parent_regex] , identifier[child_regex] , identifier[source] = literal[string] ):
literal[string]
identifier[config_txt] = identifier[__salt__] [ literal[string] ]( identifier[source] = identifier[source] )[ literal[string] ][ identifier[source] ]
... | def config_lines_w_child(parent_regex, child_regex, source='running'):
"""
.. versionadded:: 2019.2.0
Return the configuration lines that match the regular expressions from the
``parent_regex`` argument, having child lines matching ``child_regex``.
The configuration is read from the network device... |
def _eig_complex_symmetric(M: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
"""Diagonalize a complex symmetric matrix. The eigenvalues are
complex, and the eigenvectors form an orthogonal matrix.
Returns:
eigenvalues, eigenvectors
"""
if not np.allclose(M, M.transpose()):
raise np.... | def function[_eig_complex_symmetric, parameter[M]]:
constant[Diagonalize a complex symmetric matrix. The eigenvalues are
complex, and the eigenvectors form an orthogonal matrix.
Returns:
eigenvalues, eigenvectors
]
if <ast.UnaryOp object at 0x7da18f722f20> begin[:]
<ast.Rai... | keyword[def] identifier[_eig_complex_symmetric] ( identifier[M] : identifier[np] . identifier[ndarray] )-> identifier[Tuple] [ identifier[np] . identifier[ndarray] , identifier[np] . identifier[ndarray] ]:
literal[string]
keyword[if] keyword[not] identifier[np] . identifier[allclose] ( identifier[M] , id... | def _eig_complex_symmetric(M: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
"""Diagonalize a complex symmetric matrix. The eigenvalues are
complex, and the eigenvectors form an orthogonal matrix.
Returns:
eigenvalues, eigenvectors
"""
if not np.allclose(M, M.transpose()):
raise np.... |
def _set_port_profile_port(self, v, load=False):
"""
Setter method for port_profile_port, mapped from YANG variable /interface/port_channel/port_profile_port (empty)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_profile_port is considered as a private
method. ... | def function[_set_port_profile_port, parameter[self, v, load]]:
constant[
Setter method for port_profile_port, mapped from YANG variable /interface/port_channel/port_profile_port (empty)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_profile_port is considered ... | keyword[def] identifier[_set_port_profile_port] ( 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] :
... | def _set_port_profile_port(self, v, load=False):
"""
Setter method for port_profile_port, mapped from YANG variable /interface/port_channel/port_profile_port (empty)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_profile_port is considered as a private
method. ... |
def count_items(self, unique=True):
"""Count items in the cart.
Parameters
----------
unique : bool-convertible, optional
Returns
-------
int
If `unique` is truthy, then the result is the number of
items in the cart. Otherwise, it's the s... | def function[count_items, parameter[self, unique]]:
constant[Count items in the cart.
Parameters
----------
unique : bool-convertible, optional
Returns
-------
int
If `unique` is truthy, then the result is the number of
items in the cart.... | keyword[def] identifier[count_items] ( identifier[self] , identifier[unique] = keyword[True] ):
literal[string]
keyword[if] identifier[unique] :
keyword[return] identifier[len] ( identifier[self] . identifier[items] )
keyword[return] identifier[sum] ([ identifier[item] . id... | def count_items(self, unique=True):
"""Count items in the cart.
Parameters
----------
unique : bool-convertible, optional
Returns
-------
int
If `unique` is truthy, then the result is the number of
items in the cart. Otherwise, it's the sum o... |
def add_deviation_element(keyword, element):
"""Add an element to the <keyword>'s list of deviations.
Can be used by plugins that add support for specific extension
statements."""
if keyword in _valid_deviations:
_valid_deviations[keyword].append(element)
else:
_valid_deviations[keyword] = [eleme... | def function[add_deviation_element, parameter[keyword, element]]:
constant[Add an element to the <keyword>'s list of deviations.
Can be used by plugins that add support for specific extension
statements.]
if compare[name[keyword] in name[_valid_deviations]] begin[:]
call[call[name[_... | keyword[def] identifier[add_deviation_element] ( identifier[keyword] , identifier[element] ):
literal[string]
keyword[if] identifier[keyword] keyword[in] identifier[_valid_deviations] :
identifier[_valid_deviations] [ identifier[keyword] ]. identifier[append] ( identifier[element] )
keyword[else] ... | def add_deviation_element(keyword, element):
"""Add an element to the <keyword>'s list of deviations.
Can be used by plugins that add support for specific extension
statements."""
if keyword in _valid_deviations:
_valid_deviations[keyword].append(element) # depends on [control=['if'], data=['keywo... |
def _get_host_details(self):
"""Get the system details."""
# Assuming only one system present as part of collection,
# as we are dealing with iLO's here.
status, headers, system = self._rest_get('/rest/v1/Systems/1')
if status < 300:
stype = self._get_type(system)
... | def function[_get_host_details, parameter[self]]:
constant[Get the system details.]
<ast.Tuple object at 0x7da1b19905e0> assign[=] call[name[self]._rest_get, parameter[constant[/rest/v1/Systems/1]]]
if compare[name[status] less[<] constant[300]] begin[:]
variable[stype] assign[=]... | keyword[def] identifier[_get_host_details] ( identifier[self] ):
literal[string]
identifier[status] , identifier[headers] , identifier[system] = identifier[self] . identifier[_rest_get] ( literal[string] )
keyword[if] identifier[status] < literal[int] :
iden... | def _get_host_details(self):
"""Get the system details."""
# Assuming only one system present as part of collection,
# as we are dealing with iLO's here.
(status, headers, system) = self._rest_get('/rest/v1/Systems/1')
if status < 300:
stype = self._get_type(system)
if stype not in [... |
def _setup():
"""
Sets up the global import environment variables by registering the
sub-folders for projex as import locations. When defining your
custom manager, you will want to overload this method to do any
sort of global initialization that you wish before continuing.
... | def function[_setup, parameter[]]:
constant[
Sets up the global import environment variables by registering the
sub-folders for projex as import locations. When defining your
custom manager, you will want to overload this method to do any
sort of global initialization that you ... | keyword[def] identifier[_setup] ():
literal[string]
identifier[projex_path] = identifier[os] . identifier[getenv] ( literal[string] )
keyword[if] keyword[not] identifier[projex_path] :
keyword[return]
identifier[base_path] = identifier[os] . identifier[path] . ide... | def _setup():
"""
Sets up the global import environment variables by registering the
sub-folders for projex as import locations. When defining your
custom manager, you will want to overload this method to do any
sort of global initialization that you wish before continuing.
... |
def state_engine_replay_block(existing_state_engine, new_state_engine, block_height, expected_snapshots={}):
"""
Extract the existing chain state transactions from the existing state engine at a particular block height,
parse them using the new state engine, and process them using the new state engine.
... | def function[state_engine_replay_block, parameter[existing_state_engine, new_state_engine, block_height, expected_snapshots]]:
constant[
Extract the existing chain state transactions from the existing state engine at a particular block height,
parse them using the new state engine, and process them usin... | keyword[def] identifier[state_engine_replay_block] ( identifier[existing_state_engine] , identifier[new_state_engine] , identifier[block_height] , identifier[expected_snapshots] ={}):
literal[string]
keyword[assert] identifier[new_state_engine] . identifier[lastblock] + literal[int] == identifier[block_h... | def state_engine_replay_block(existing_state_engine, new_state_engine, block_height, expected_snapshots={}):
"""
Extract the existing chain state transactions from the existing state engine at a particular block height,
parse them using the new state engine, and process them using the new state engine.
... |
def coerce(self, value):
"""Convert text values into integer values.
Args:
value (str or int): The value to coerce.
Raises:
TypeError: If the value is not an int or string.
ValueError: If the value is not int or an acceptable value.
Return... | def function[coerce, parameter[self, value]]:
constant[Convert text values into integer values.
Args:
value (str or int): The value to coerce.
Raises:
TypeError: If the value is not an int or string.
ValueError: If the value is not int or an acceptable value... | keyword[def] identifier[coerce] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[int] ) keyword[or] identifier[isinstance] ( identifier[value] , identifier[compat] . identifier[long] ):
keyword[return] ... | def coerce(self, value):
"""Convert text values into integer values.
Args:
value (str or int): The value to coerce.
Raises:
TypeError: If the value is not an int or string.
ValueError: If the value is not int or an acceptable value.
Returns:
... |
def Laliberte_heat_capacity(T, ws, CASRNs):
r'''Calculate the heat capacity of an aqueous electrolyte mixture using the
form proposed by [1]_.
Parameters are loaded by the function as needed.
.. math::
TODO
Parameters
----------
T : float
Temperature of fluid [K]
ws : a... | def function[Laliberte_heat_capacity, parameter[T, ws, CASRNs]]:
constant[Calculate the heat capacity of an aqueous electrolyte mixture using the
form proposed by [1]_.
Parameters are loaded by the function as needed.
.. math::
TODO
Parameters
----------
T : float
Tempe... | keyword[def] identifier[Laliberte_heat_capacity] ( identifier[T] , identifier[ws] , identifier[CASRNs] ):
literal[string]
identifier[Cp_w] = identifier[Laliberte_heat_capacity_w] ( identifier[T] )
identifier[w_w] = literal[int] - identifier[sum] ( identifier[ws] )
identifier[Cp] = identifier[w_w]... | def Laliberte_heat_capacity(T, ws, CASRNs):
"""Calculate the heat capacity of an aqueous electrolyte mixture using the
form proposed by [1]_.
Parameters are loaded by the function as needed.
.. math::
TODO
Parameters
----------
T : float
Temperature of fluid [K]
ws : ar... |
def get(self, pid, stream=False, vendorSpecific=None):
"""Initiate a MNRead.get(). Return a Requests Response object from which the
object bytes can be retrieved.
When ``stream`` is False, Requests buffers the entire object in memory before
returning the Response. This can exhaust avail... | def function[get, parameter[self, pid, stream, vendorSpecific]]:
constant[Initiate a MNRead.get(). Return a Requests Response object from which the
object bytes can be retrieved.
When ``stream`` is False, Requests buffers the entire object in memory before
returning the Response. This c... | keyword[def] identifier[get] ( identifier[self] , identifier[pid] , identifier[stream] = keyword[False] , identifier[vendorSpecific] = keyword[None] ):
literal[string]
identifier[response] = identifier[self] . identifier[getResponse] ( identifier[pid] , identifier[stream] , identifier[vendorSpecifi... | def get(self, pid, stream=False, vendorSpecific=None):
"""Initiate a MNRead.get(). Return a Requests Response object from which the
object bytes can be retrieved.
When ``stream`` is False, Requests buffers the entire object in memory before
returning the Response. This can exhaust available... |
def align_bam(in_bam, ref_file, names, align_dir, data):
"""Perform direct alignment of an input BAM file with BWA using pipes.
This avoids disk IO by piping between processes:
- samtools sort of input BAM to queryname
- bedtools conversion to interleaved FASTQ
- bwa-mem alignment
- samtool... | def function[align_bam, parameter[in_bam, ref_file, names, align_dir, data]]:
constant[Perform direct alignment of an input BAM file with BWA using pipes.
This avoids disk IO by piping between processes:
- samtools sort of input BAM to queryname
- bedtools conversion to interleaved FASTQ
- b... | keyword[def] identifier[align_bam] ( identifier[in_bam] , identifier[ref_file] , identifier[names] , identifier[align_dir] , identifier[data] ):
literal[string]
identifier[config] = identifier[data] [ literal[string] ]
identifier[out_file] = identifier[os] . identifier[path] . identifier[join] ( ident... | def align_bam(in_bam, ref_file, names, align_dir, data):
"""Perform direct alignment of an input BAM file with BWA using pipes.
This avoids disk IO by piping between processes:
- samtools sort of input BAM to queryname
- bedtools conversion to interleaved FASTQ
- bwa-mem alignment
- samtool... |
def mutate(self):
"""Mutates code."""
# Choose a random position
if len(self.code) == 0:
return
index = random.randint(0, len(self.code)-1)
mutation_type = random.random()
if mutation_type < 0.5:
# Change
self.code[index] = self.new()... | def function[mutate, parameter[self]]:
constant[Mutates code.]
if compare[call[name[len], parameter[name[self].code]] equal[==] constant[0]] begin[:]
return[None]
variable[index] assign[=] call[name[random].randint, parameter[constant[0], binary_operation[call[name[len], parameter[name[s... | keyword[def] identifier[mutate] ( identifier[self] ):
literal[string]
keyword[if] identifier[len] ( identifier[self] . identifier[code] )== literal[int] :
keyword[return]
identifier[index] = identifier[random] . identifier[randint] ( literal[int] , identifier[len] ... | def mutate(self):
"""Mutates code."""
# Choose a random position
if len(self.code) == 0:
return # depends on [control=['if'], data=[]]
index = random.randint(0, len(self.code) - 1)
mutation_type = random.random()
if mutation_type < 0.5:
# Change
self.code[index] = self.n... |
def and_inverter_synth(net):
"""
Transforms a decomposed block into one consisting of ands and inverters in place
:param block: The block to synthesize
"""
if net.op in '~&rwcsm@':
return True
def arg(num):
return net.args[num]
dest = net.dests[0]
if net.op == '|':
... | def function[and_inverter_synth, parameter[net]]:
constant[
Transforms a decomposed block into one consisting of ands and inverters in place
:param block: The block to synthesize
]
if compare[name[net].op in constant[~&rwcsm@]] begin[:]
return[constant[True]]
def function[arg... | keyword[def] identifier[and_inverter_synth] ( identifier[net] ):
literal[string]
keyword[if] identifier[net] . identifier[op] keyword[in] literal[string] :
keyword[return] keyword[True]
keyword[def] identifier[arg] ( identifier[num] ):
keyword[return] identifier[net] . identi... | def and_inverter_synth(net):
"""
Transforms a decomposed block into one consisting of ands and inverters in place
:param block: The block to synthesize
"""
if net.op in '~&rwcsm@':
return True # depends on [control=['if'], data=[]]
def arg(num):
return net.args[num]
dest = ... |
def purge_bad_timestamp_files(file_list):
"Given a list of image files, find bad frames, remove them and modify file_list"
MAX_INITIAL_BAD_FRAMES = 15
bad_ts = Kinect.detect_bad_timestamps(Kinect.timestamps_from_file_list(file_list))
# Trivial case
if not bad_ts:
... | def function[purge_bad_timestamp_files, parameter[file_list]]:
constant[Given a list of image files, find bad frames, remove them and modify file_list]
variable[MAX_INITIAL_BAD_FRAMES] assign[=] constant[15]
variable[bad_ts] assign[=] call[name[Kinect].detect_bad_timestamps, parameter[call[name[... | keyword[def] identifier[purge_bad_timestamp_files] ( identifier[file_list] ):
literal[string]
identifier[MAX_INITIAL_BAD_FRAMES] = literal[int]
identifier[bad_ts] = identifier[Kinect] . identifier[detect_bad_timestamps] ( identifier[Kinect] . identifier[timestamps_from_file_list] ( identi... | def purge_bad_timestamp_files(file_list):
"""Given a list of image files, find bad frames, remove them and modify file_list"""
MAX_INITIAL_BAD_FRAMES = 15
bad_ts = Kinect.detect_bad_timestamps(Kinect.timestamps_from_file_list(file_list))
# Trivial case
if not bad_ts:
return file_list # depe... |
def addCategory(self,name):
"""
Adds a new texture category with the given name.
If the category already exists, it will be overridden.
"""
self.categories[name]={}
self.categoriesTexCache[name]={}
self.categoriesTexBin[name]=pyglet.image.atlas.TextureBin... | def function[addCategory, parameter[self, name]]:
constant[
Adds a new texture category with the given name.
If the category already exists, it will be overridden.
]
call[name[self].categories][name[name]] assign[=] dictionary[[], []]
call[name[self].categoriesTe... | keyword[def] identifier[addCategory] ( identifier[self] , identifier[name] ):
literal[string]
identifier[self] . identifier[categories] [ identifier[name] ]={}
identifier[self] . identifier[categoriesTexCache] [ identifier[name] ]={}
identifier[self] . identifier[categoriesTexBin]... | def addCategory(self, name):
"""
Adds a new texture category with the given name.
If the category already exists, it will be overridden.
"""
self.categories[name] = {}
self.categoriesTexCache[name] = {}
self.categoriesTexBin[name] = pyglet.image.atlas.TextureBin(self.tex... |
def fatal(self, correlation_id, error, message, *args, **kwargs):
"""
Logs fatal (unrecoverable) message that caused the process to crash.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param error: an error object associated with this message.... | def function[fatal, parameter[self, correlation_id, error, message]]:
constant[
Logs fatal (unrecoverable) message that caused the process to crash.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param error: an error object associated with thi... | keyword[def] identifier[fatal] ( identifier[self] , identifier[correlation_id] , identifier[error] , identifier[message] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[_format_and_write] ( identifier[LogLevel] . identifier[Fatal] , identifier[correlation... | def fatal(self, correlation_id, error, message, *args, **kwargs):
"""
Logs fatal (unrecoverable) message that caused the process to crash.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param error: an error object associated with this message.
... |
def set_form_field_order(form, field_order):
"""
This function is a verbatim copy of django.forms.Form.order_fields() to
support field ordering below Django 1.9.
field_order is a list of field names specifying the order. Append fields
not included in the list in the default order for backward compa... | def function[set_form_field_order, parameter[form, field_order]]:
constant[
This function is a verbatim copy of django.forms.Form.order_fields() to
support field ordering below Django 1.9.
field_order is a list of field names specifying the order. Append fields
not included in the list in the d... | keyword[def] identifier[set_form_field_order] ( identifier[form] , identifier[field_order] ):
literal[string]
keyword[if] identifier[field_order] keyword[is] keyword[None] :
keyword[return]
identifier[fields] = identifier[OrderedDict] ()
keyword[for] identifier[key] keyword[in] id... | def set_form_field_order(form, field_order):
"""
This function is a verbatim copy of django.forms.Form.order_fields() to
support field ordering below Django 1.9.
field_order is a list of field names specifying the order. Append fields
not included in the list in the default order for backward compa... |
def doRollover(self):
"""
do a rollover; in this case, a date/time stamp is appended to the filename
when the rollover happens. However, you want the file to be named for the
start of the interval, not the current time. If there is a backup count,
then we have to get a list of ... | def function[doRollover, parameter[self]]:
constant[
do a rollover; in this case, a date/time stamp is appended to the filename
when the rollover happens. However, you want the file to be named for the
start of the interval, not the current time. If there is a backup count,
the... | keyword[def] identifier[doRollover] ( identifier[self] ):
literal[string]
identifier[self] . identifier[stream] . identifier[close] ()
identifier[t] = identifier[self] . identifier[rolloverAt] - identifier[self] . identifier[interval]
identifier[timeTuple] = identifier[t... | def doRollover(self):
"""
do a rollover; in this case, a date/time stamp is appended to the filename
when the rollover happens. However, you want the file to be named for the
start of the interval, not the current time. If there is a backup count,
then we have to get a list of matc... |
def render_badge(user):
''' Renders a single user's badge. '''
data = {
"user": user,
}
t = loader.get_template('registrasion/badge.svg')
return t.render(data) | def function[render_badge, parameter[user]]:
constant[ Renders a single user's badge. ]
variable[data] assign[=] dictionary[[<ast.Constant object at 0x7da18eb56290>], [<ast.Name object at 0x7da18eb54550>]]
variable[t] assign[=] call[name[loader].get_template, parameter[constant[registrasion/badg... | keyword[def] identifier[render_badge] ( identifier[user] ):
literal[string]
identifier[data] ={
literal[string] : identifier[user] ,
}
identifier[t] = identifier[loader] . identifier[get_template] ( literal[string] )
keyword[return] identifier[t] . identifier[render] ( identifier[data... | def render_badge(user):
""" Renders a single user's badge. """
data = {'user': user}
t = loader.get_template('registrasion/badge.svg')
return t.render(data) |
def _intersected_edge(self, edges, cut_edge):
""" Given a list of *edges*, return the first that is intersected by
*cut_edge*.
"""
for edge in edges:
if self._edges_intersect(edge, cut_edge):
return edge | def function[_intersected_edge, parameter[self, edges, cut_edge]]:
constant[ Given a list of *edges*, return the first that is intersected by
*cut_edge*.
]
for taget[name[edge]] in starred[name[edges]] begin[:]
if call[name[self]._edges_intersect, parameter[name[edge], na... | keyword[def] identifier[_intersected_edge] ( identifier[self] , identifier[edges] , identifier[cut_edge] ):
literal[string]
keyword[for] identifier[edge] keyword[in] identifier[edges] :
keyword[if] identifier[self] . identifier[_edges_intersect] ( identifier[edge] , identifier[cut_... | def _intersected_edge(self, edges, cut_edge):
""" Given a list of *edges*, return the first that is intersected by
*cut_edge*.
"""
for edge in edges:
if self._edges_intersect(edge, cut_edge):
return edge # depends on [control=['if'], data=[]] # depends on [control=['for'], ... |
def open_telemetry_logs(logpath_telem, logpath_telem_raw):
'''open log files'''
if opts.append_log or opts.continue_mode:
mode = 'a'
else:
mode = 'w'
mpstate.logfile = open(logpath_telem, mode=mode)
mpstate.logfile_raw = open(logpath_telem_raw, mode=mode)
print("Log Directory: %s... | def function[open_telemetry_logs, parameter[logpath_telem, logpath_telem_raw]]:
constant[open log files]
if <ast.BoolOp object at 0x7da2041d9990> begin[:]
variable[mode] assign[=] constant[a]
name[mpstate].logfile assign[=] call[name[open], parameter[name[logpath_telem]]]
... | keyword[def] identifier[open_telemetry_logs] ( identifier[logpath_telem] , identifier[logpath_telem_raw] ):
literal[string]
keyword[if] identifier[opts] . identifier[append_log] keyword[or] identifier[opts] . identifier[continue_mode] :
identifier[mode] = literal[string]
keyword[else] :
... | def open_telemetry_logs(logpath_telem, logpath_telem_raw):
"""open log files"""
if opts.append_log or opts.continue_mode:
mode = 'a' # depends on [control=['if'], data=[]]
else:
mode = 'w'
mpstate.logfile = open(logpath_telem, mode=mode)
mpstate.logfile_raw = open(logpath_telem_raw,... |
def ensureModelData(self,obj):
"""
Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized.
"""
if not hasattr(obj,"_modeldata"):
self.create(obj,cache=True)
... | def function[ensureModelData, parameter[self, obj]]:
constant[
Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized.
]
if <ast.UnaryOp object at 0x7da1b012d270> begin[:]
... | keyword[def] identifier[ensureModelData] ( identifier[self] , identifier[obj] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[obj] , literal[string] ):
identifier[self] . identifier[create] ( identifier[obj] , identifier[cache] = keyword[True] )
... | def ensureModelData(self, obj):
"""
Ensures that the given ``obj`` has been initialized to be used with this model.
If the object is found to not be initialized, it will be initialized.
"""
if not hasattr(obj, '_modeldata'):
self.create(obj, cache=True) # depends on [co... |
def group_members_remove(self, device_group_id, body, **kwargs): # noqa: E501
"""Remove a device from a group # noqa: E501
Remove one device from a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchrono... | def function[group_members_remove, parameter[self, device_group_id, body]]:
constant[Remove a device from a group # noqa: E501
Remove one device from a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchr... | keyword[def] identifier[group_members_remove] ( identifier[self] , identifier[device_group_id] , identifier[body] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
... | def group_members_remove(self, device_group_id, body, **kwargs): # noqa: E501
'Remove a device from a group # noqa: E501\n\n Remove one device from a group # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass asynchronous... |
def _process_module_needs(self, modules):
"""Adds the module and its dependencies to the result list in dependency order."""
result = list(modules)
for i, module in enumerate(modules):
#It is possible that the parser couldn't find it, if so
#we can't create the executable... | def function[_process_module_needs, parameter[self, modules]]:
constant[Adds the module and its dependencies to the result list in dependency order.]
variable[result] assign[=] call[name[list], parameter[name[modules]]]
for taget[tuple[[<ast.Name object at 0x7da1b255f640>, <ast.Name object at 0x... | keyword[def] identifier[_process_module_needs] ( identifier[self] , identifier[modules] ):
literal[string]
identifier[result] = identifier[list] ( identifier[modules] )
keyword[for] identifier[i] , identifier[module] keyword[in] identifier[enumerate] ( identifier[modules] ):
... | def _process_module_needs(self, modules):
"""Adds the module and its dependencies to the result list in dependency order."""
result = list(modules)
for (i, module) in enumerate(modules):
#It is possible that the parser couldn't find it, if so
#we can't create the executable!
if modul... |
def get_analysis_config(self, group_name):
""" Gets any config data saved for the analysis.
:param group_name: The name of the analysis group.
:returns: A dictionary of dictionaries. Each key represents
an analysis step. Each value is a dictionary containing the
analysis... | def function[get_analysis_config, parameter[self, group_name]]:
constant[ Gets any config data saved for the analysis.
:param group_name: The name of the analysis group.
:returns: A dictionary of dictionaries. Each key represents
an analysis step. Each value is a dictionary containi... | keyword[def] identifier[get_analysis_config] ( identifier[self] , identifier[group_name] ):
literal[string]
identifier[self] . identifier[assert_open] ()
identifier[group] = literal[string] . identifier[format] ( identifier[group_name] )
identifier[config] = keyword[None]
... | def get_analysis_config(self, group_name):
""" Gets any config data saved for the analysis.
:param group_name: The name of the analysis group.
:returns: A dictionary of dictionaries. Each key represents
an analysis step. Each value is a dictionary containing the
analysis par... |
def __parse_child(self, node):
'''for rpc-style map each message part to a class in typesmodule
'''
try:
tc = self.gettypecode(self.typesmodule, node)
except:
self.logger.debug('didnt find typecode for "%s" in typesmodule: %s',
node.localName, sel... | def function[__parse_child, parameter[self, node]]:
constant[for rpc-style map each message part to a class in typesmodule
]
<ast.Try object at 0x7da1b1595150>
call[name[self].logger.debug, parameter[constant[parse child with typecode : %s], name[tc]]]
<ast.Try object at 0x7da1b13347c0>
... | keyword[def] identifier[__parse_child] ( identifier[self] , identifier[node] ):
literal[string]
keyword[try] :
identifier[tc] = identifier[self] . identifier[gettypecode] ( identifier[self] . identifier[typesmodule] , identifier[node] )
keyword[except] :
identifie... | def __parse_child(self, node):
"""for rpc-style map each message part to a class in typesmodule
"""
try:
tc = self.gettypecode(self.typesmodule, node) # depends on [control=['try'], data=[]]
except:
self.logger.debug('didnt find typecode for "%s" in typesmodule: %s', node.localName,... |
def stitch(images):
"""Stitch regular spaced images.
Parameters
----------
images : ImageCollection or list of tuple(path, row, column)
Each image-tuple should contain path, row and column. Row 0,
column 0 is top left image.
Example:
>>> images = [('1.png', 0, 0), ('2.p... | def function[stitch, parameter[images]]:
constant[Stitch regular spaced images.
Parameters
----------
images : ImageCollection or list of tuple(path, row, column)
Each image-tuple should contain path, row and column. Row 0,
column 0 is top left image.
Example:
>>> i... | keyword[def] identifier[stitch] ( identifier[images] ):
literal[string]
keyword[if] identifier[type] ( identifier[images] )!= identifier[ImageCollection] :
identifier[images] = identifier[ImageCollection] ( identifier[images] )
identifier[calc_translations_parallel] ( identifier[images] )
... | def stitch(images):
"""Stitch regular spaced images.
Parameters
----------
images : ImageCollection or list of tuple(path, row, column)
Each image-tuple should contain path, row and column. Row 0,
column 0 is top left image.
Example:
>>> images = [('1.png', 0, 0), ('2.p... |
def QA_util_dict_remove_key(dicts, key):
"""
输入一个dict 返回删除后的
"""
if isinstance(key, list):
for item in key:
try:
dicts.pop(item)
except:
pass
else:
try:
dicts.pop(key)
except:
pass
return dic... | def function[QA_util_dict_remove_key, parameter[dicts, key]]:
constant[
输入一个dict 返回删除后的
]
if call[name[isinstance], parameter[name[key], name[list]]] begin[:]
for taget[name[item]] in starred[name[key]] begin[:]
<ast.Try object at 0x7da1b1f45ae0>
return[name[dicts... | keyword[def] identifier[QA_util_dict_remove_key] ( identifier[dicts] , identifier[key] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[key] , identifier[list] ):
keyword[for] identifier[item] keyword[in] identifier[key] :
keyword[try] :
identif... | def QA_util_dict_remove_key(dicts, key):
"""
输入一个dict 返回删除后的
"""
if isinstance(key, list):
for item in key:
try:
dicts.pop(item) # depends on [control=['try'], data=[]]
except:
pass # depends on [control=['except'], data=[]] # depends on... |
def should_use(intersection):
"""Check if an intersection can be used as part of a curved polygon.
Will return :data:`True` if the intersection is classified as
:attr:`~.IntersectionClassification.FIRST`,
:attr:`~.IntersectionClassification.SECOND` or
:attr:`~.IntersectionClassification.COINCIDENT`... | def function[should_use, parameter[intersection]]:
constant[Check if an intersection can be used as part of a curved polygon.
Will return :data:`True` if the intersection is classified as
:attr:`~.IntersectionClassification.FIRST`,
:attr:`~.IntersectionClassification.SECOND` or
:attr:`~.Interse... | keyword[def] identifier[should_use] ( identifier[intersection] ):
literal[string]
keyword[if] identifier[intersection] . identifier[interior_curve] keyword[in] identifier[ACCEPTABLE_CLASSIFICATIONS] :
keyword[return] keyword[True]
keyword[if] identifier[intersection] . identifier[inter... | def should_use(intersection):
"""Check if an intersection can be used as part of a curved polygon.
Will return :data:`True` if the intersection is classified as
:attr:`~.IntersectionClassification.FIRST`,
:attr:`~.IntersectionClassification.SECOND` or
:attr:`~.IntersectionClassification.COINCIDENT`... |
def skip_http_error(statuses):
'''
A decorator to wrap with try..except to swallow
specific HTTP errors.
@skip_http_error((404, 503))
def fetch():
...
'''
assert isinstance(statuses, tuple)
def decorator(func):
def wrapper(*args, **kwargs):
try:
... | def function[skip_http_error, parameter[statuses]]:
constant[
A decorator to wrap with try..except to swallow
specific HTTP errors.
@skip_http_error((404, 503))
def fetch():
...
]
assert[call[name[isinstance], parameter[name[statuses], name[tuple]]]]
def function[decorat... | keyword[def] identifier[skip_http_error] ( identifier[statuses] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[statuses] , identifier[tuple] )
keyword[def] identifier[decorator] ( identifier[func] ):
keyword[def] identifier[wrapper] (* identifier[args] ,** identif... | def skip_http_error(statuses):
"""
A decorator to wrap with try..except to swallow
specific HTTP errors.
@skip_http_error((404, 503))
def fetch():
...
"""
assert isinstance(statuses, tuple)
def decorator(func):
def wrapper(*args, **kwargs):
try:
... |
def get_or_set_hash(uri,
length=8,
chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'):
'''
Perform a one-time generation of a hash and write it to sdb.
If that value has already been set return the value instead.
This is useful for generating passwords or keys that are specific... | def function[get_or_set_hash, parameter[uri, length, chars]]:
constant[
Perform a one-time generation of a hash and write it to sdb.
If that value has already been set return the value instead.
This is useful for generating passwords or keys that are specific to
multiple minions that need to be... | keyword[def] identifier[get_or_set_hash] ( identifier[uri] ,
identifier[length] = literal[int] ,
identifier[chars] = literal[string] ):
literal[string]
keyword[return] identifier[salt] . identifier[utils] . identifier[sdb] . identifier[sdb_get_or_set_hash] ( identifier[uri] , identifier[__opts__] , iden... | def get_or_set_hash(uri, length=8, chars='abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'):
"""
Perform a one-time generation of a hash and write it to sdb.
If that value has already been set return the value instead.
This is useful for generating passwords or keys that are specific to
multiple... |
def logpdf(self, mu):
"""
Log PDF for Exponential prior
Parameters
----------
mu : float
Latent variable for which the prior is being formed over
Returns
----------
- log(p(mu))
"""
if self.transform is not None:
m... | def function[logpdf, parameter[self, mu]]:
constant[
Log PDF for Exponential prior
Parameters
----------
mu : float
Latent variable for which the prior is being formed over
Returns
----------
- log(p(mu))
]
if compare[name[sel... | keyword[def] identifier[logpdf] ( identifier[self] , identifier[mu] ):
literal[string]
keyword[if] identifier[self] . identifier[transform] keyword[is] keyword[not] keyword[None] :
identifier[mu] = identifier[self] . identifier[transform] ( identifier[mu] )
keyword[return]... | def logpdf(self, mu):
"""
Log PDF for Exponential prior
Parameters
----------
mu : float
Latent variable for which the prior is being formed over
Returns
----------
- log(p(mu))
"""
if self.transform is not None:
mu = self.tra... |
def ParseOptions(self, options):
"""Parses the options.
Args:
options (argparse.Namespace): command line arguments.
Raises:
BadConfigOption: if the options are invalid.
"""
# The output modules options are dependent on the preferred language
# and preferred time zone options.
s... | def function[ParseOptions, parameter[self, options]]:
constant[Parses the options.
Args:
options (argparse.Namespace): command line arguments.
Raises:
BadConfigOption: if the options are invalid.
]
call[name[self]._ParseTimezoneOption, parameter[name[options]]]
variable... | keyword[def] identifier[ParseOptions] ( identifier[self] , identifier[options] ):
literal[string]
identifier[self] . identifier[_ParseTimezoneOption] ( identifier[options] )
identifier[names] =[ literal[string] , literal[string] , literal[string] ]
identifier[helpers_manager] . identif... | def ParseOptions(self, options):
"""Parses the options.
Args:
options (argparse.Namespace): command line arguments.
Raises:
BadConfigOption: if the options are invalid.
"""
# The output modules options are dependent on the preferred language
# and preferred time zone options.
s... |
def remove(self, id):
""" Remove pool.
"""
p = Pool.get(int(id))
p.remove()
redirect(url(controller = 'pool', action = 'list')) | def function[remove, parameter[self, id]]:
constant[ Remove pool.
]
variable[p] assign[=] call[name[Pool].get, parameter[call[name[int], parameter[name[id]]]]]
call[name[p].remove, parameter[]]
call[name[redirect], parameter[call[name[url], parameter[]]]] | keyword[def] identifier[remove] ( identifier[self] , identifier[id] ):
literal[string]
identifier[p] = identifier[Pool] . identifier[get] ( identifier[int] ( identifier[id] ))
identifier[p] . identifier[remove] ()
identifier[redirect] ( identifier[url] ( identifier[controller] = ... | def remove(self, id):
""" Remove pool.
"""
p = Pool.get(int(id))
p.remove()
redirect(url(controller='pool', action='list')) |
def kernel_gaussian(size=100, sigma=None, forwardOnly=False):
"""
return a 1d gassuan array of a given size and sigma.
If sigma isn't given, it will be 1/10 of the size, which is usually good.
"""
if sigma is None:sigma=size/10
points=np.exp(-np.power(np.arange(size)-size/2,2)/(2*np.power(sigma,... | def function[kernel_gaussian, parameter[size, sigma, forwardOnly]]:
constant[
return a 1d gassuan array of a given size and sigma.
If sigma isn't given, it will be 1/10 of the size, which is usually good.
]
if compare[name[sigma] is constant[None]] begin[:]
variable[sigma] as... | keyword[def] identifier[kernel_gaussian] ( identifier[size] = literal[int] , identifier[sigma] = keyword[None] , identifier[forwardOnly] = keyword[False] ):
literal[string]
keyword[if] identifier[sigma] keyword[is] keyword[None] : identifier[sigma] = identifier[size] / literal[int]
identifier[poin... | def kernel_gaussian(size=100, sigma=None, forwardOnly=False):
"""
return a 1d gassuan array of a given size and sigma.
If sigma isn't given, it will be 1/10 of the size, which is usually good.
"""
if sigma is None:
sigma = size / 10 # depends on [control=['if'], data=['sigma']]
points =... |
def main():
"""Main method."""
args = parse_cmd_arguments()
html_file = args.file
try:
json.loads(args.add_tags or '{}')
json.loads(args.exc_tags or '{}')
except ValueError:
print('\033[91m' + 'Invalid json string: please provide a valid json '
'string e.g {}'.... | def function[main, parameter[]]:
constant[Main method.]
variable[args] assign[=] call[name[parse_cmd_arguments], parameter[]]
variable[html_file] assign[=] name[args].file
<ast.Try object at 0x7da18dc04040>
variable[staticfied] assign[=] call[call[name[staticfy], parameter[name[html_... | keyword[def] identifier[main] ():
literal[string]
identifier[args] = identifier[parse_cmd_arguments] ()
identifier[html_file] = identifier[args] . identifier[file]
keyword[try] :
identifier[json] . identifier[loads] ( identifier[args] . identifier[add_tags] keyword[or] literal[string... | def main():
"""Main method."""
args = parse_cmd_arguments()
html_file = args.file
try:
json.loads(args.add_tags or '{}')
json.loads(args.exc_tags or '{}') # depends on [control=['try'], data=[]]
except ValueError:
print('\x1b[91m' + 'Invalid json string: please provide a val... |
def start(self) -> None:
"""
Start monitoring the base unit.
"""
self._shutdown = False
# Start listening (if server) / Open connection (if client)
if isinstance(self._protocol, Server):
self.create_task(self._async_listen)
elif isinstance(self._prot... | def function[start, parameter[self]]:
constant[
Start monitoring the base unit.
]
name[self]._shutdown assign[=] constant[False]
if call[name[isinstance], parameter[name[self]._protocol, name[Server]]] begin[:]
call[name[self].create_task, parameter[name[self]._as... | keyword[def] identifier[start] ( identifier[self] )-> keyword[None] :
literal[string]
identifier[self] . identifier[_shutdown] = keyword[False]
keyword[if] identifier[isinstance] ( identifier[self] . identifier[_protocol] , identifier[Server] ):
identifier[self] .... | def start(self) -> None:
"""
Start monitoring the base unit.
"""
self._shutdown = False
# Start listening (if server) / Open connection (if client)
if isinstance(self._protocol, Server):
self.create_task(self._async_listen) # depends on [control=['if'], data=[]]
elif isinsta... |
def _restore_auto_increment(self, table):
"""restore the auto increment value for the table to what it was previously"""
query, seq_table, seq_column, seq_name = self._get_auto_increment_info(table)
if query:
queries = [query, "select nextval('{}')".format(seq_name)]
retu... | def function[_restore_auto_increment, parameter[self, table]]:
constant[restore the auto increment value for the table to what it was previously]
<ast.Tuple object at 0x7da1b2839bd0> assign[=] call[name[self]._get_auto_increment_info, parameter[name[table]]]
if name[query] begin[:]
... | keyword[def] identifier[_restore_auto_increment] ( identifier[self] , identifier[table] ):
literal[string]
identifier[query] , identifier[seq_table] , identifier[seq_column] , identifier[seq_name] = identifier[self] . identifier[_get_auto_increment_info] ( identifier[table] )
keyword[if] ... | def _restore_auto_increment(self, table):
"""restore the auto increment value for the table to what it was previously"""
(query, seq_table, seq_column, seq_name) = self._get_auto_increment_info(table)
if query:
queries = [query, "select nextval('{}')".format(seq_name)]
return self._run_queri... |
def parse(self, text):
"""Parse the given text, return a list of Keywords."""
token_stream = self.lexer.tokenize(text)
return self.expr(token_stream, next(token_stream)) | def function[parse, parameter[self, text]]:
constant[Parse the given text, return a list of Keywords.]
variable[token_stream] assign[=] call[name[self].lexer.tokenize, parameter[name[text]]]
return[call[name[self].expr, parameter[name[token_stream], call[name[next], parameter[name[token_stream]]]]]] | keyword[def] identifier[parse] ( identifier[self] , identifier[text] ):
literal[string]
identifier[token_stream] = identifier[self] . identifier[lexer] . identifier[tokenize] ( identifier[text] )
keyword[return] identifier[self] . identifier[expr] ( identifier[token_stream] , identifier[n... | def parse(self, text):
"""Parse the given text, return a list of Keywords."""
token_stream = self.lexer.tokenize(text)
return self.expr(token_stream, next(token_stream)) |
def certificate(self):
"""
Retrieves the certificate used to sign the bounce message.
TODO: Cache the certificate based on the cert URL so we don't have to
retrieve it for each bounce message. *We would need to do it in a
secure way so that the cert couldn't be overwritten in th... | def function[certificate, parameter[self]]:
constant[
Retrieves the certificate used to sign the bounce message.
TODO: Cache the certificate based on the cert URL so we don't have to
retrieve it for each bounce message. *We would need to do it in a
secure way so that the cert co... | keyword[def] identifier[certificate] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , literal[string] ):
identifier[cert_url] = identifier[self] . identifier[_get_cert_url] ()
... | def certificate(self):
"""
Retrieves the certificate used to sign the bounce message.
TODO: Cache the certificate based on the cert URL so we don't have to
retrieve it for each bounce message. *We would need to do it in a
secure way so that the cert couldn't be overwritten in the ca... |
def from_string(key_pem, is_x509_cert):
"""Construct a Verified instance from a string.
Args:
key_pem: string, public key in PEM format.
is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it
is expected to be an RSA key in PEM format.
... | def function[from_string, parameter[key_pem, is_x509_cert]]:
constant[Construct a Verified instance from a string.
Args:
key_pem: string, public key in PEM format.
is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it
is expected to be an RS... | keyword[def] identifier[from_string] ( identifier[key_pem] , identifier[is_x509_cert] ):
literal[string]
identifier[key_pem] = identifier[_helpers] . identifier[_to_bytes] ( identifier[key_pem] )
keyword[if] identifier[is_x509_cert] :
identifier[pubkey] = identifier[crypto] .... | def from_string(key_pem, is_x509_cert):
"""Construct a Verified instance from a string.
Args:
key_pem: string, public key in PEM format.
is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it
is expected to be an RSA key in PEM format.
R... |
def before_run(self):
"""Initialize the scheduling process"""
# Actions and checks counters
self.nb_checks = 0
self.nb_internal_checks = 0
self.nb_checks_launched = 0
self.nb_actions_launched = 0
self.nb_checks_results = 0
self.nb_checks_results_timeout =... | def function[before_run, parameter[self]]:
constant[Initialize the scheduling process]
name[self].nb_checks assign[=] constant[0]
name[self].nb_internal_checks assign[=] constant[0]
name[self].nb_checks_launched assign[=] constant[0]
name[self].nb_actions_launched assign[=] const... | keyword[def] identifier[before_run] ( identifier[self] ):
literal[string]
identifier[self] . identifier[nb_checks] = literal[int]
identifier[self] . identifier[nb_internal_checks] = literal[int]
identifier[self] . identifier[nb_checks_launched] = literal[int]
... | def before_run(self):
"""Initialize the scheduling process"""
# Actions and checks counters
self.nb_checks = 0
self.nb_internal_checks = 0
self.nb_checks_launched = 0
self.nb_actions_launched = 0
self.nb_checks_results = 0
self.nb_checks_results_timeout = 0
self.nb_checks_results_pas... |
def _get_linear_lookup_table_and_weight(nbits, wp):
"""
Generate a linear lookup table.
:param nbits: int
Number of bits to represent a quantized weight value
:param wp: numpy.array
Weight blob to be quantized
Returns
-------
lookup_table: numpy.array
Lookup table ... | def function[_get_linear_lookup_table_and_weight, parameter[nbits, wp]]:
constant[
Generate a linear lookup table.
:param nbits: int
Number of bits to represent a quantized weight value
:param wp: numpy.array
Weight blob to be quantized
Returns
-------
lookup_table: nu... | keyword[def] identifier[_get_linear_lookup_table_and_weight] ( identifier[nbits] , identifier[wp] ):
literal[string]
identifier[w] = identifier[wp] . identifier[reshape] ( literal[int] ,- literal[int] )
identifier[qw] , identifier[scales] , identifier[biases] = identifier[_quantize_channelwise_linear]... | def _get_linear_lookup_table_and_weight(nbits, wp):
"""
Generate a linear lookup table.
:param nbits: int
Number of bits to represent a quantized weight value
:param wp: numpy.array
Weight blob to be quantized
Returns
-------
lookup_table: numpy.array
Lookup table ... |
def is_union(type_: Type[Any]) -> bool:
'''
Union[A, B]
Union
Optional[A]
'''
if HAS_UNIONSUBCLASS:
# Old python
return _issubclass(type_, Union)
else:
return getattr(type_, '__origin__', None) == Union | def function[is_union, parameter[type_]]:
constant[
Union[A, B]
Union
Optional[A]
]
if name[HAS_UNIONSUBCLASS] begin[:]
return[call[name[_issubclass], parameter[name[type_], name[Union]]]] | keyword[def] identifier[is_union] ( identifier[type_] : identifier[Type] [ identifier[Any] ])-> identifier[bool] :
literal[string]
keyword[if] identifier[HAS_UNIONSUBCLASS] :
keyword[return] identifier[_issubclass] ( identifier[type_] , identifier[Union] )
keyword[else] :
keyw... | def is_union(type_: Type[Any]) -> bool:
"""
Union[A, B]
Union
Optional[A]
"""
if HAS_UNIONSUBCLASS:
# Old python
return _issubclass(type_, Union) # depends on [control=['if'], data=[]]
else:
return getattr(type_, '__origin__', None) == Union |
def main(arguments=None):
"""Main command line entry point."""
if not arguments:
arguments = sys.argv[1:]
wordlist, sowpods, by_length, start, end = argument_parser(arguments)
for word in wordlist:
pretty_print(
word,
anagrams_in_word(word, sowpods, start, end),... | def function[main, parameter[arguments]]:
constant[Main command line entry point.]
if <ast.UnaryOp object at 0x7da1b01a6920> begin[:]
variable[arguments] assign[=] call[name[sys].argv][<ast.Slice object at 0x7da1b01a48e0>]
<ast.Tuple object at 0x7da18fe916f0> assign[=] call[name[... | keyword[def] identifier[main] ( identifier[arguments] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[arguments] :
identifier[arguments] = identifier[sys] . identifier[argv] [ literal[int] :]
identifier[wordlist] , identifier[sowpods] , identifier[by_length] , ident... | def main(arguments=None):
"""Main command line entry point."""
if not arguments:
arguments = sys.argv[1:] # depends on [control=['if'], data=[]]
(wordlist, sowpods, by_length, start, end) = argument_parser(arguments)
for word in wordlist:
pretty_print(word, anagrams_in_word(word, sowpod... |
def slots_class_sealer(fields, defaults):
"""
This sealer makes a container class that uses ``__slots__`` (it uses :func:`class_sealer` internally).
The resulting class has a metaclass that forcibly sets ``__slots__`` on subclasses.
"""
class __slots_meta__(type):
def __new__(mcs, name, bas... | def function[slots_class_sealer, parameter[fields, defaults]]:
constant[
This sealer makes a container class that uses ``__slots__`` (it uses :func:`class_sealer` internally).
The resulting class has a metaclass that forcibly sets ``__slots__`` on subclasses.
]
class class[__slots_meta__, p... | keyword[def] identifier[slots_class_sealer] ( identifier[fields] , identifier[defaults] ):
literal[string]
keyword[class] identifier[__slots_meta__] ( identifier[type] ):
keyword[def] identifier[__new__] ( identifier[mcs] , identifier[name] , identifier[bases] , identifier[namespace] ):
... | def slots_class_sealer(fields, defaults):
"""
This sealer makes a container class that uses ``__slots__`` (it uses :func:`class_sealer` internally).
The resulting class has a metaclass that forcibly sets ``__slots__`` on subclasses.
"""
class __slots_meta__(type):
def __new__(mcs, name, b... |
def get_vault_form_for_update(self, vault_id):
"""Gets the vault form for updating an existing vault.
A new vault form should be requested for each update
transaction.
arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault``
return: (osid.authorization.VaultForm) - the vault ... | def function[get_vault_form_for_update, parameter[self, vault_id]]:
constant[Gets the vault form for updating an existing vault.
A new vault form should be requested for each update
transaction.
arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault``
return: (osid.authorizat... | keyword[def] identifier[get_vault_form_for_update] ( identifier[self] , identifier[vault_id] ):
literal[string]
keyword[if] identifier[self] . identifier[_catalog_session] keyword[is] keyword[not] keyword[None] :
keyword[return] identifier[self] . identifier[_cat... | def get_vault_form_for_update(self, vault_id):
"""Gets the vault form for updating an existing vault.
A new vault form should be requested for each update
transaction.
arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault``
return: (osid.authorization.VaultForm) - the vault form... |
def main(args=None):
""" The main routine. """
cfg.configureLogger()
wireHandlers(cfg)
# get config from a flask standard place not our config yml
app.run(debug=cfg.runInDebug(), host='0.0.0.0', port=cfg.getPort()) | def function[main, parameter[args]]:
constant[ The main routine. ]
call[name[cfg].configureLogger, parameter[]]
call[name[wireHandlers], parameter[name[cfg]]]
call[name[app].run, parameter[]] | keyword[def] identifier[main] ( identifier[args] = keyword[None] ):
literal[string]
identifier[cfg] . identifier[configureLogger] ()
identifier[wireHandlers] ( identifier[cfg] )
identifier[app] . identifier[run] ( identifier[debug] = identifier[cfg] . identifier[runInDebug] (), identifier[ho... | def main(args=None):
""" The main routine. """
cfg.configureLogger()
wireHandlers(cfg)
# get config from a flask standard place not our config yml
app.run(debug=cfg.runInDebug(), host='0.0.0.0', port=cfg.getPort()) |
def expand_path_cfg(path_cfg, alias_dict={ }, overriding_kargs={ }):
"""expand a path config
Args:
path_cfg (str, tuple, dict): a config for path
alias_dict (dict): a dict for aliases
overriding_kargs (dict): to be used for recursive call
"""
if isinstance(path_cfg, str):
... | def function[expand_path_cfg, parameter[path_cfg, alias_dict, overriding_kargs]]:
constant[expand a path config
Args:
path_cfg (str, tuple, dict): a config for path
alias_dict (dict): a dict for aliases
overriding_kargs (dict): to be used for recursive call
]
if call[nam... | keyword[def] identifier[expand_path_cfg] ( identifier[path_cfg] , identifier[alias_dict] ={}, identifier[overriding_kargs] ={}):
literal[string]
keyword[if] identifier[isinstance] ( identifier[path_cfg] , identifier[str] ):
keyword[return] identifier[_expand_str] ( identifier[path_cfg] , identi... | def expand_path_cfg(path_cfg, alias_dict={}, overriding_kargs={}):
"""expand a path config
Args:
path_cfg (str, tuple, dict): a config for path
alias_dict (dict): a dict for aliases
overriding_kargs (dict): to be used for recursive call
"""
if isinstance(path_cfg, str):
... |
def per_file_type_data(self):
"""
Return download data by file type.
:return: dict of cache data; keys are datetime objects, values are
dict of file type (str) to count (int)
:rtype: dict
"""
ret = {}
for cache_date in self.cache_dates:
data... | def function[per_file_type_data, parameter[self]]:
constant[
Return download data by file type.
:return: dict of cache data; keys are datetime objects, values are
dict of file type (str) to count (int)
:rtype: dict
]
variable[ret] assign[=] dictionary[[], []]
... | keyword[def] identifier[per_file_type_data] ( identifier[self] ):
literal[string]
identifier[ret] ={}
keyword[for] identifier[cache_date] keyword[in] identifier[self] . identifier[cache_dates] :
identifier[data] = identifier[self] . identifier[_cache_get] ( identifier[cache... | def per_file_type_data(self):
"""
Return download data by file type.
:return: dict of cache data; keys are datetime objects, values are
dict of file type (str) to count (int)
:rtype: dict
"""
ret = {}
for cache_date in self.cache_dates:
data = self._cache_g... |
def process_task(self):
"""This function is called when the client has failed to send all of the
segments of a segmented request, the application has taken too long to
complete the request, or the client failed to ack the segments of a
segmented response."""
if _debug: ServerSSM.... | def function[process_task, parameter[self]]:
constant[This function is called when the client has failed to send all of the
segments of a segmented request, the application has taken too long to
complete the request, or the client failed to ack the segments of a
segmented response.]
... | keyword[def] identifier[process_task] ( identifier[self] ):
literal[string]
keyword[if] identifier[_debug] : identifier[ServerSSM] . identifier[_debug] ( literal[string] )
keyword[if] identifier[self] . identifier[state] == identifier[SEGMENTED_REQUEST] :
identifier[self] .... | def process_task(self):
"""This function is called when the client has failed to send all of the
segments of a segmented request, the application has taken too long to
complete the request, or the client failed to ack the segments of a
segmented response."""
if _debug:
ServerSSM.... |
def _fake_openenumerateinstancepaths(self, namespace, **params):
# pylint: disable=invalid-name
"""
Implements WBEM server responder for
:meth:`~pywbem.WBEMConnection.OpenEnumerationInstancePaths`
with data from the instance repository.
"""
self._validate_namespac... | def function[_fake_openenumerateinstancepaths, parameter[self, namespace]]:
constant[
Implements WBEM server responder for
:meth:`~pywbem.WBEMConnection.OpenEnumerationInstancePaths`
with data from the instance repository.
]
call[name[self]._validate_namespace, parameter[... | keyword[def] identifier[_fake_openenumerateinstancepaths] ( identifier[self] , identifier[namespace] ,** identifier[params] ):
literal[string]
identifier[self] . identifier[_validate_namespace] ( identifier[namespace] )
identifier[self] . identifier[_validate_open_params] (** identifier[p... | def _fake_openenumerateinstancepaths(self, namespace, **params):
# pylint: disable=invalid-name
'\n Implements WBEM server responder for\n :meth:`~pywbem.WBEMConnection.OpenEnumerationInstancePaths`\n with data from the instance repository.\n '
self._validate_namespace(namespace)... |
def set_fc_volume(self, port_id,
target_wwn, target_lun=0, boot_prio=1,
initiator_wwnn=None, initiator_wwpn=None):
"""Set FibreChannel volume information to configuration.
:param port_id: Physical port ID.
:param target_wwn: WWN of target.
:pa... | def function[set_fc_volume, parameter[self, port_id, target_wwn, target_lun, boot_prio, initiator_wwnn, initiator_wwpn]]:
constant[Set FibreChannel volume information to configuration.
:param port_id: Physical port ID.
:param target_wwn: WWN of target.
:param target_lun: LUN number of t... | keyword[def] identifier[set_fc_volume] ( identifier[self] , identifier[port_id] ,
identifier[target_wwn] , identifier[target_lun] = literal[int] , identifier[boot_prio] = literal[int] ,
identifier[initiator_wwnn] = keyword[None] , identifier[initiator_wwpn] = keyword[None] ):
literal[string]
iden... | def set_fc_volume(self, port_id, target_wwn, target_lun=0, boot_prio=1, initiator_wwnn=None, initiator_wwpn=None):
"""Set FibreChannel volume information to configuration.
:param port_id: Physical port ID.
:param target_wwn: WWN of target.
:param target_lun: LUN number of target.
:p... |
def apply_transformation(self, structure):
"""
:param structure (bulk structure to be scaled up - typically conventional unit cell)
:return:
defect_structure, with charge applied
"""
if structure != self.defect.bulk_structure:
raise ValueError("Defect bulk... | def function[apply_transformation, parameter[self, structure]]:
constant[
:param structure (bulk structure to be scaled up - typically conventional unit cell)
:return:
defect_structure, with charge applied
]
if compare[name[structure] not_equal[!=] name[self].defect.b... | keyword[def] identifier[apply_transformation] ( identifier[self] , identifier[structure] ):
literal[string]
keyword[if] identifier[structure] != identifier[self] . identifier[defect] . identifier[bulk_structure] :
keyword[raise] identifier[ValueError] ( literal[string] )
id... | def apply_transformation(self, structure):
"""
:param structure (bulk structure to be scaled up - typically conventional unit cell)
:return:
defect_structure, with charge applied
"""
if structure != self.defect.bulk_structure:
raise ValueError('Defect bulk_structure i... |
def run_cli(cli_parser, run_sample, known_args=None):
"""Run sampling with CLI arguments.
Parameters
----------
cli_parser : function
Function to add method specific arguments to parser
run_sample: function
Method specific function that runs the sampling
known_args: list [option... | def function[run_cli, parameter[cli_parser, run_sample, known_args]]:
constant[Run sampling with CLI arguments.
Parameters
----------
cli_parser : function
Function to add method specific arguments to parser
run_sample: function
Method specific function that runs the sampling
... | keyword[def] identifier[run_cli] ( identifier[cli_parser] , identifier[run_sample] , identifier[known_args] = keyword[None] ):
literal[string]
identifier[parser] = identifier[create] ( identifier[cli_parser] )
identifier[args] = identifier[parser] . identifier[parse_args] ( identifier[known_args] )
... | def run_cli(cli_parser, run_sample, known_args=None):
"""Run sampling with CLI arguments.
Parameters
----------
cli_parser : function
Function to add method specific arguments to parser
run_sample: function
Method specific function that runs the sampling
known_args: list [option... |
def pisaParser(src, context, default_css="", xhtml=False, encoding=None, xml_output=None):
"""
- Parse HTML and get miniDOM
- Extract CSS informations, add default CSS, parse CSS
- Handle the document DOM itself and build reportlab story
- Return Context object
"""
global CSSAttrCache
C... | def function[pisaParser, parameter[src, context, default_css, xhtml, encoding, xml_output]]:
constant[
- Parse HTML and get miniDOM
- Extract CSS informations, add default CSS, parse CSS
- Handle the document DOM itself and build reportlab story
- Return Context object
]
<ast.Global obje... | keyword[def] identifier[pisaParser] ( identifier[src] , identifier[context] , identifier[default_css] = literal[string] , identifier[xhtml] = keyword[False] , identifier[encoding] = keyword[None] , identifier[xml_output] = keyword[None] ):
literal[string]
keyword[global] identifier[CSSAttrCache]
id... | def pisaParser(src, context, default_css='', xhtml=False, encoding=None, xml_output=None):
"""
- Parse HTML and get miniDOM
- Extract CSS informations, add default CSS, parse CSS
- Handle the document DOM itself and build reportlab story
- Return Context object
"""
global CSSAttrCache
CS... |
def bulk_upsert(
queryset, model_objs, unique_fields, update_fields=None, return_upserts=False, return_upserts_distinct=False,
sync=False, native=False
):
"""
Performs a bulk update or insert on a list of model objects. Matches all objects in the queryset
with the objs provided using the field value... | def function[bulk_upsert, parameter[queryset, model_objs, unique_fields, update_fields, return_upserts, return_upserts_distinct, sync, native]]:
constant[
Performs a bulk update or insert on a list of model objects. Matches all objects in the queryset
with the objs provided using the field values in uni... | keyword[def] identifier[bulk_upsert] (
identifier[queryset] , identifier[model_objs] , identifier[unique_fields] , identifier[update_fields] = keyword[None] , identifier[return_upserts] = keyword[False] , identifier[return_upserts_distinct] = keyword[False] ,
identifier[sync] = keyword[False] , identifier[native] =... | def bulk_upsert(queryset, model_objs, unique_fields, update_fields=None, return_upserts=False, return_upserts_distinct=False, sync=False, native=False):
"""
Performs a bulk update or insert on a list of model objects. Matches all objects in the queryset
with the objs provided using the field values in uniqu... |
def get_update_tile(self, params, values):
""" Get the amount of support size required for a particular update."""
doglobal, particles = self._update_type(params)
if doglobal:
return self.shape.copy()
# 1) store the current parameters of interest
values0 = self.get_v... | def function[get_update_tile, parameter[self, params, values]]:
constant[ Get the amount of support size required for a particular update.]
<ast.Tuple object at 0x7da18ede60b0> assign[=] call[name[self]._update_type, parameter[name[params]]]
if name[doglobal] begin[:]
return[call[name[se... | keyword[def] identifier[get_update_tile] ( identifier[self] , identifier[params] , identifier[values] ):
literal[string]
identifier[doglobal] , identifier[particles] = identifier[self] . identifier[_update_type] ( identifier[params] )
keyword[if] identifier[doglobal] :
keywor... | def get_update_tile(self, params, values):
""" Get the amount of support size required for a particular update."""
(doglobal, particles) = self._update_type(params)
if doglobal:
return self.shape.copy() # depends on [control=['if'], data=[]]
# 1) store the current parameters of interest
val... |
def convert_all_videos(app_label, model_name, object_pk):
"""
Automatically converts all videos of a given instance.
"""
# get instance
Model = apps.get_model(app_label=app_label, model_name=model_name)
instance = Model.objects.get(pk=object_pk)
# search for `VideoFields`
fields = insta... | def function[convert_all_videos, parameter[app_label, model_name, object_pk]]:
constant[
Automatically converts all videos of a given instance.
]
variable[Model] assign[=] call[name[apps].get_model, parameter[]]
variable[instance] assign[=] call[name[Model].objects.get, parameter[]]
... | keyword[def] identifier[convert_all_videos] ( identifier[app_label] , identifier[model_name] , identifier[object_pk] ):
literal[string]
identifier[Model] = identifier[apps] . identifier[get_model] ( identifier[app_label] = identifier[app_label] , identifier[model_name] = identifier[model_name] )
... | def convert_all_videos(app_label, model_name, object_pk):
"""
Automatically converts all videos of a given instance.
"""
# get instance
Model = apps.get_model(app_label=app_label, model_name=model_name)
instance = Model.objects.get(pk=object_pk)
# search for `VideoFields`
fields = instan... |
def get_last_calc_id(datadir=None):
"""
Extract the latest calculation ID from the given directory.
If none is found, return 0.
"""
datadir = datadir or get_datadir()
calcs = get_calc_ids(datadir)
if not calcs:
return 0
return calcs[-1] | def function[get_last_calc_id, parameter[datadir]]:
constant[
Extract the latest calculation ID from the given directory.
If none is found, return 0.
]
variable[datadir] assign[=] <ast.BoolOp object at 0x7da18f00e050>
variable[calcs] assign[=] call[name[get_calc_ids], parameter[name[... | keyword[def] identifier[get_last_calc_id] ( identifier[datadir] = keyword[None] ):
literal[string]
identifier[datadir] = identifier[datadir] keyword[or] identifier[get_datadir] ()
identifier[calcs] = identifier[get_calc_ids] ( identifier[datadir] )
keyword[if] keyword[not] identifier[calcs] :... | def get_last_calc_id(datadir=None):
"""
Extract the latest calculation ID from the given directory.
If none is found, return 0.
"""
datadir = datadir or get_datadir()
calcs = get_calc_ids(datadir)
if not calcs:
return 0 # depends on [control=['if'], data=[]]
return calcs[-1] |
def new_consumer(self, config, consumer_name):
"""Return a consumer dict for the given name and configuration.
:param dict config: The consumer configuration
:param str consumer_name: The consumer name
:rtype: dict
"""
return Consumer(0,
dict(),
... | def function[new_consumer, parameter[self, config, consumer_name]]:
constant[Return a consumer dict for the given name and configuration.
:param dict config: The consumer configuration
:param str consumer_name: The consumer name
:rtype: dict
]
return[call[name[Consumer], pa... | keyword[def] identifier[new_consumer] ( identifier[self] , identifier[config] , identifier[consumer_name] ):
literal[string]
keyword[return] identifier[Consumer] ( literal[int] ,
identifier[dict] (),
identifier[config] . identifier[get] ( literal[string] , identifier[self] . iden... | def new_consumer(self, config, consumer_name):
"""Return a consumer dict for the given name and configuration.
:param dict config: The consumer configuration
:param str consumer_name: The consumer name
:rtype: dict
"""
return Consumer(0, dict(), config.get('qty', self.DEFAULT_C... |
def get_session(self, sid, namespace=None):
"""Return the user session for a client.
The only difference with the :func:`socketio.Server.get_session`
method is that when the ``namespace`` argument is not given the
namespace associated with the class is used.
"""
return s... | def function[get_session, parameter[self, sid, namespace]]:
constant[Return the user session for a client.
The only difference with the :func:`socketio.Server.get_session`
method is that when the ``namespace`` argument is not given the
namespace associated with the class is used.
... | keyword[def] identifier[get_session] ( identifier[self] , identifier[sid] , identifier[namespace] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[server] . identifier[get_session] (
identifier[sid] , identifier[namespace] = identifier[namespace] keyword[o... | def get_session(self, sid, namespace=None):
"""Return the user session for a client.
The only difference with the :func:`socketio.Server.get_session`
method is that when the ``namespace`` argument is not given the
namespace associated with the class is used.
"""
return self.serv... |
def _ScanNode(self, scan_context, scan_node, auto_recurse=True):
"""Scans a node for supported formats.
Args:
scan_context (SourceScannerContext): source scanner context.
scan_node (SourceScanNode): source scan node.
auto_recurse (Optional[bool]): True if the scan should automatically
... | def function[_ScanNode, parameter[self, scan_context, scan_node, auto_recurse]]:
constant[Scans a node for supported formats.
Args:
scan_context (SourceScannerContext): source scanner context.
scan_node (SourceScanNode): source scan node.
auto_recurse (Optional[bool]): True if the scan sh... | keyword[def] identifier[_ScanNode] ( identifier[self] , identifier[scan_context] , identifier[scan_node] , identifier[auto_recurse] = keyword[True] ):
literal[string]
keyword[if] keyword[not] identifier[scan_context] :
keyword[raise] identifier[ValueError] ( literal[string] )
keyword[if] k... | def _ScanNode(self, scan_context, scan_node, auto_recurse=True):
"""Scans a node for supported formats.
Args:
scan_context (SourceScannerContext): source scanner context.
scan_node (SourceScanNode): source scan node.
auto_recurse (Optional[bool]): True if the scan should automatically
... |
def rotate(self, log):
"""Move the current log to a new file with timestamp and create a new empty log file."""
self.write(log, rotate=True)
self.write({}) | def function[rotate, parameter[self, log]]:
constant[Move the current log to a new file with timestamp and create a new empty log file.]
call[name[self].write, parameter[name[log]]]
call[name[self].write, parameter[dictionary[[], []]]] | keyword[def] identifier[rotate] ( identifier[self] , identifier[log] ):
literal[string]
identifier[self] . identifier[write] ( identifier[log] , identifier[rotate] = keyword[True] )
identifier[self] . identifier[write] ({}) | def rotate(self, log):
"""Move the current log to a new file with timestamp and create a new empty log file."""
self.write(log, rotate=True)
self.write({}) |
def update(self, membershipId, isModerator=None, **request_parameters):
"""Update a team membership, by ID.
Args:
membershipId(basestring): The team membership ID.
isModerator(bool): Set to True to make the person a team moderator.
**request_parameters: Additional re... | def function[update, parameter[self, membershipId, isModerator]]:
constant[Update a team membership, by ID.
Args:
membershipId(basestring): The team membership ID.
isModerator(bool): Set to True to make the person a team moderator.
**request_parameters: Additional re... | keyword[def] identifier[update] ( identifier[self] , identifier[membershipId] , identifier[isModerator] = keyword[None] ,** identifier[request_parameters] ):
literal[string]
identifier[check_type] ( identifier[membershipId] , identifier[basestring] , identifier[may_be_none] = keyword[False] )
... | def update(self, membershipId, isModerator=None, **request_parameters):
"""Update a team membership, by ID.
Args:
membershipId(basestring): The team membership ID.
isModerator(bool): Set to True to make the person a team moderator.
**request_parameters: Additional reques... |
def msgurls(msg, urlidx=1):
"""Main entry function for urlscan.py
"""
# Written as a generator so I can easily choose only
# one subpart in the future (e.g., for
# multipart/alternative). Actually, I might even add
# a browser for the message structure?
enc = get_charset(msg)
if msg.is... | def function[msgurls, parameter[msg, urlidx]]:
constant[Main entry function for urlscan.py
]
variable[enc] assign[=] call[name[get_charset], parameter[name[msg]]]
if call[name[msg].is_multipart, parameter[]] begin[:]
for taget[name[part]] in starred[call[name[msg].get_payloa... | keyword[def] identifier[msgurls] ( identifier[msg] , identifier[urlidx] = literal[int] ):
literal[string]
identifier[enc] = identifier[get_charset] ( identifier[msg] )
keyword[if] identifier[msg] . identifier[is_multipart] ():
keyword[for] identifier[part] keyword[in] ... | def msgurls(msg, urlidx=1):
"""Main entry function for urlscan.py
"""
# Written as a generator so I can easily choose only
# one subpart in the future (e.g., for
# multipart/alternative). Actually, I might even add
# a browser for the message structure?
enc = get_charset(msg)
if msg.is... |
def update_vpnservice(self, vpnservice, desc):
'''
Updates a VPN service
'''
vpnservice_id = self._find_vpnservice_id(vpnservice)
body = {'description': desc}
return self.network_conn.update_vpnservice(vpnservice_id,
body... | def function[update_vpnservice, parameter[self, vpnservice, desc]]:
constant[
Updates a VPN service
]
variable[vpnservice_id] assign[=] call[name[self]._find_vpnservice_id, parameter[name[vpnservice]]]
variable[body] assign[=] dictionary[[<ast.Constant object at 0x7da18f720790>],... | keyword[def] identifier[update_vpnservice] ( identifier[self] , identifier[vpnservice] , identifier[desc] ):
literal[string]
identifier[vpnservice_id] = identifier[self] . identifier[_find_vpnservice_id] ( identifier[vpnservice] )
identifier[body] ={ literal[string] : identifier[desc] }
... | def update_vpnservice(self, vpnservice, desc):
"""
Updates a VPN service
"""
vpnservice_id = self._find_vpnservice_id(vpnservice)
body = {'description': desc}
return self.network_conn.update_vpnservice(vpnservice_id, body={'vpnservice': body}) |
def make_refresh_on_demand_service(injector_component):
"""
create a refresh on demand service listening to refresh order on the component admin queue
:param injector_component: the injector_component to bind with the new refresh on demande service
:return: the created service
""... | def function[make_refresh_on_demand_service, parameter[injector_component]]:
constant[
create a refresh on demand service listening to refresh order on the component admin queue
:param injector_component: the injector_component to bind with the new refresh on demande service
:return: the... | keyword[def] identifier[make_refresh_on_demand_service] ( identifier[injector_component] ):
literal[string]
identifier[LOGGER] . identifier[debug] ( literal[string] )
identifier[args] ={
literal[string] : identifier[injector_component] . identifier[id] ,
literal[string] :... | def make_refresh_on_demand_service(injector_component):
"""
create a refresh on demand service listening to refresh order on the component admin queue
:param injector_component: the injector_component to bind with the new refresh on demande service
:return: the created service
"""
... |
def _UpdateDatabaseFromResponse(self, response, mode):
"""
Update database table given a user input in the form
"TABLENAME COL1=VAL1 COL2=VAL2".
Either ADD or DELETE from table depending on mode argument.
If the change succeeds the updated table is printed to stdout.
Parameters
----------... | def function[_UpdateDatabaseFromResponse, parameter[self, response, mode]]:
constant[
Update database table given a user input in the form
"TABLENAME COL1=VAL1 COL2=VAL2".
Either ADD or DELETE from table depending on mode argument.
If the change succeeds the updated table is printed to stdout.... | keyword[def] identifier[_UpdateDatabaseFromResponse] ( identifier[self] , identifier[response] , identifier[mode] ):
literal[string]
keyword[try] :
identifier[tableName] , identifier[tableColumns] = identifier[response] . identifier[split] ( literal[string] , literal[int] )
keyword[except]... | def _UpdateDatabaseFromResponse(self, response, mode):
"""
Update database table given a user input in the form
"TABLENAME COL1=VAL1 COL2=VAL2".
Either ADD or DELETE from table depending on mode argument.
If the change succeeds the updated table is printed to stdout.
Parameters
----------... |
def interjoint_paths(self):
"""
Returns paths between the adjacent critical points
in the skeleton, where a critical point is the set of
terminal and branch points.
"""
paths = []
for tree in self.components():
subpaths = self._single_tree_interjoint_paths(tree)
paths.extend(subp... | def function[interjoint_paths, parameter[self]]:
constant[
Returns paths between the adjacent critical points
in the skeleton, where a critical point is the set of
terminal and branch points.
]
variable[paths] assign[=] list[[]]
for taget[name[tree]] in starred[call[name[self].co... | keyword[def] identifier[interjoint_paths] ( identifier[self] ):
literal[string]
identifier[paths] =[]
keyword[for] identifier[tree] keyword[in] identifier[self] . identifier[components] ():
identifier[subpaths] = identifier[self] . identifier[_single_tree_interjoint_paths] ( identifier[tree]... | def interjoint_paths(self):
"""
Returns paths between the adjacent critical points
in the skeleton, where a critical point is the set of
terminal and branch points.
"""
paths = []
for tree in self.components():
subpaths = self._single_tree_interjoint_paths(tree)
paths.extend(... |
def path(self):
"""
Serve gzip file if client accept it.
Generate or update the gzip file if needed.
"""
path = self._path()
statobj = os.stat(path)
ae = self.request.META.get('HTTP_ACCEPT_ENCODING', '')
if re_accepts_gzip.search(ae) and getattr(settings, ... | def function[path, parameter[self]]:
constant[
Serve gzip file if client accept it.
Generate or update the gzip file if needed.
]
variable[path] assign[=] call[name[self]._path, parameter[]]
variable[statobj] assign[=] call[name[os].stat, parameter[name[path]]]
va... | keyword[def] identifier[path] ( identifier[self] ):
literal[string]
identifier[path] = identifier[self] . identifier[_path] ()
identifier[statobj] = identifier[os] . identifier[stat] ( identifier[path] )
identifier[ae] = identifier[self] . identifier[request] . identifier[META] . ... | def path(self):
"""
Serve gzip file if client accept it.
Generate or update the gzip file if needed.
"""
path = self._path()
statobj = os.stat(path)
ae = self.request.META.get('HTTP_ACCEPT_ENCODING', '')
if re_accepts_gzip.search(ae) and getattr(settings, 'UMAP_GZIP', True):
... |
def END(self):
"""END state."""
logger.debug('In state: END')
self.current_state = STATE_END
if self.script is not None:
self.script.script_init(self.client.lease, self.current_state)
self.script.script_go()
else:
set_net(self.client.lease)
... | def function[END, parameter[self]]:
constant[END state.]
call[name[logger].debug, parameter[constant[In state: END]]]
name[self].current_state assign[=] name[STATE_END]
if compare[name[self].script is_not constant[None]] begin[:]
call[name[self].script.script_init, parame... | keyword[def] identifier[END] ( identifier[self] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] )
identifier[self] . identifier[current_state] = identifier[STATE_END]
keyword[if] identifier[self] . identifier[script] keyword[is] keyword[not] keywor... | def END(self):
"""END state."""
logger.debug('In state: END')
self.current_state = STATE_END
if self.script is not None:
self.script.script_init(self.client.lease, self.current_state)
self.script.script_go() # depends on [control=['if'], data=[]]
else:
set_net(self.client.le... |
def match_any_learning_objective(self, match):
"""Matches an item with any objective.
arg: match (boolean): ``true`` to match items with any
learning objective, ``false`` to match items with no
learning objectives
*compliance: mandatory -- This method must be ... | def function[match_any_learning_objective, parameter[self, match]]:
constant[Matches an item with any objective.
arg: match (boolean): ``true`` to match items with any
learning objective, ``false`` to match items with no
learning objectives
*compliance: mandat... | keyword[def] identifier[match_any_learning_objective] ( identifier[self] , identifier[match] ):
literal[string]
identifier[match_key] = literal[string]
identifier[param] = literal[string]
keyword[if] identifier[match] :
identifier[flag] = literal[string]
... | def match_any_learning_objective(self, match):
"""Matches an item with any objective.
arg: match (boolean): ``true`` to match items with any
learning objective, ``false`` to match items with no
learning objectives
*compliance: mandatory -- This method must be impl... |
def validate_units(self, value):
"""Validate units, assuming that it was called by _validate_type_*."""
self.validate_quantity(value)
self.units_type = inspect.stack()[1][3].split('_')[-1]
assert self.units_type, ("`validate_units` should not be called "
... | def function[validate_units, parameter[self, value]]:
constant[Validate units, assuming that it was called by _validate_type_*.]
call[name[self].validate_quantity, parameter[name[value]]]
name[self].units_type assign[=] call[call[call[call[call[name[inspect].stack, parameter[]]][constant[1]]][co... | keyword[def] identifier[validate_units] ( identifier[self] , identifier[value] ):
literal[string]
identifier[self] . identifier[validate_quantity] ( identifier[value] )
identifier[self] . identifier[units_type] = identifier[inspect] . identifier[stack] ()[ literal[int] ][ literal[int] ]. i... | def validate_units(self, value):
"""Validate units, assuming that it was called by _validate_type_*."""
self.validate_quantity(value)
self.units_type = inspect.stack()[1][3].split('_')[-1]
assert self.units_type, '`validate_units` should not be called directly. It should be called by a _validate_type_* ... |
def import_submodules(package, recursive=True):
""" Import all submodules of a module, recursively, including subpackages
:param package: package (name or actual module)
:type package: str | module
:rtype: dict[str, types.ModuleType]
"""
if isinstance(package, str):
package = importlib.... | def function[import_submodules, parameter[package, recursive]]:
constant[ Import all submodules of a module, recursively, including subpackages
:param package: package (name or actual module)
:type package: str | module
:rtype: dict[str, types.ModuleType]
]
if call[name[isinstance], par... | keyword[def] identifier[import_submodules] ( identifier[package] , identifier[recursive] = keyword[True] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[package] , identifier[str] ):
identifier[package] = identifier[importlib] . identifier[import_module] ( identifier[package] )... | def import_submodules(package, recursive=True):
""" Import all submodules of a module, recursively, including subpackages
:param package: package (name or actual module)
:type package: str | module
:rtype: dict[str, types.ModuleType]
"""
if isinstance(package, str):
package = importlib.... |
def _assemble_gap(self, stmt):
"""Example: act(p(HGNC:RASA1), ma(gap)) =| act(p(HGNC:KRAS), ma(gtp))"""
gap = deepcopy(stmt.gap)
gap.activity = ActivityCondition('gap', True)
ras = deepcopy(stmt.ras)
ras.activity = ActivityCondition('gtpbound', True)
self._add_nodes_edges... | def function[_assemble_gap, parameter[self, stmt]]:
constant[Example: act(p(HGNC:RASA1), ma(gap)) =| act(p(HGNC:KRAS), ma(gtp))]
variable[gap] assign[=] call[name[deepcopy], parameter[name[stmt].gap]]
name[gap].activity assign[=] call[name[ActivityCondition], parameter[constant[gap], constant[Tr... | keyword[def] identifier[_assemble_gap] ( identifier[self] , identifier[stmt] ):
literal[string]
identifier[gap] = identifier[deepcopy] ( identifier[stmt] . identifier[gap] )
identifier[gap] . identifier[activity] = identifier[ActivityCondition] ( literal[string] , keyword[True] )
... | def _assemble_gap(self, stmt):
"""Example: act(p(HGNC:RASA1), ma(gap)) =| act(p(HGNC:KRAS), ma(gtp))"""
gap = deepcopy(stmt.gap)
gap.activity = ActivityCondition('gap', True)
ras = deepcopy(stmt.ras)
ras.activity = ActivityCondition('gtpbound', True)
self._add_nodes_edges(gap, ras, pc.DIRECTLY_D... |
def map_version(self, requirement, local_version):
"""
Maps a local version name to one recognised by the Requirement class
Parameters
----------
requirement : str
Name of the requirement
version : str
version string
"""
if isinsta... | def function[map_version, parameter[self, requirement, local_version]]:
constant[
Maps a local version name to one recognised by the Requirement class
Parameters
----------
requirement : str
Name of the requirement
version : str
version string
... | keyword[def] identifier[map_version] ( identifier[self] , identifier[requirement] , identifier[local_version] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[self] . identifier[_versions_map] , identifier[dict] ):
identifier[version] = identifier[self] . identifier[... | def map_version(self, requirement, local_version):
"""
Maps a local version name to one recognised by the Requirement class
Parameters
----------
requirement : str
Name of the requirement
version : str
version string
"""
if isinstance(self... |
def rweibull(alpha, beta, size=None):
"""
Weibull random variates.
"""
tmp = -np.log(runiform(0, 1, size))
return beta * (tmp ** (1. / alpha)) | def function[rweibull, parameter[alpha, beta, size]]:
constant[
Weibull random variates.
]
variable[tmp] assign[=] <ast.UnaryOp object at 0x7da2041da2c0>
return[binary_operation[name[beta] * binary_operation[name[tmp] ** binary_operation[constant[1.0] / name[alpha]]]]] | keyword[def] identifier[rweibull] ( identifier[alpha] , identifier[beta] , identifier[size] = keyword[None] ):
literal[string]
identifier[tmp] =- identifier[np] . identifier[log] ( identifier[runiform] ( literal[int] , literal[int] , identifier[size] ))
keyword[return] identifier[beta] *( identifier[... | def rweibull(alpha, beta, size=None):
"""
Weibull random variates.
"""
tmp = -np.log(runiform(0, 1, size))
return beta * tmp ** (1.0 / alpha) |
def v_unique_name_children(ctx, stmt):
"""Make sure that each child of stmt has a unique name"""
def sort_pos(p1, p2):
if p1.line < p2.line:
return (p1,p2)
else:
return (p2,p1)
dict = {}
chs = stmt.i_children
def check(c):
key = (c.i_module.i_module... | def function[v_unique_name_children, parameter[ctx, stmt]]:
constant[Make sure that each child of stmt has a unique name]
def function[sort_pos, parameter[p1, p2]]:
if compare[name[p1].line less[<] name[p2].line] begin[:]
return[tuple[[<ast.Name object at 0x7da20e9b0bb0>, <as... | keyword[def] identifier[v_unique_name_children] ( identifier[ctx] , identifier[stmt] ):
literal[string]
keyword[def] identifier[sort_pos] ( identifier[p1] , identifier[p2] ):
keyword[if] identifier[p1] . identifier[line] < identifier[p2] . identifier[line] :
keyword[return] ( ident... | def v_unique_name_children(ctx, stmt):
"""Make sure that each child of stmt has a unique name"""
def sort_pos(p1, p2):
if p1.line < p2.line:
return (p1, p2) # depends on [control=['if'], data=[]]
else:
return (p2, p1)
dict = {}
chs = stmt.i_children
def che... |
def r_annotations(self):
""" Route to retrieve annotations by target
:param target_urn: The CTS URN for which to retrieve annotations
:type target_urn: str
:return: a JSON string containing count and list of resources
:rtype: {str: Any}
"""
target = request.ar... | def function[r_annotations, parameter[self]]:
constant[ Route to retrieve annotations by target
:param target_urn: The CTS URN for which to retrieve annotations
:type target_urn: str
:return: a JSON string containing count and list of resources
:rtype: {str: Any}
]
... | keyword[def] identifier[r_annotations] ( identifier[self] ):
literal[string]
identifier[target] = identifier[request] . identifier[args] . identifier[get] ( literal[string] , keyword[None] )
identifier[wildcard] = identifier[request] . identifier[args] . identifier[get] ( literal[string] ... | def r_annotations(self):
""" Route to retrieve annotations by target
:param target_urn: The CTS URN for which to retrieve annotations
:type target_urn: str
:return: a JSON string containing count and list of resources
:rtype: {str: Any}
"""
target = request.args.get('t... |
def credentials_required(method_func):
"""
Decorator for methods that checks that the client has credentials.
Throws a CredentialsMissingError when they are absent.
"""
def _checkcredentials(self, *args, **kwargs):
if self.username and self.password:
return method_func(self, *ar... | def function[credentials_required, parameter[method_func]]:
constant[
Decorator for methods that checks that the client has credentials.
Throws a CredentialsMissingError when they are absent.
]
def function[_checkcredentials, parameter[self]]:
if <ast.BoolOp object at 0x7da2... | keyword[def] identifier[credentials_required] ( identifier[method_func] ):
literal[string]
keyword[def] identifier[_checkcredentials] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
keyword[if] identifier[self] . identifier[username] keyword[and] identifier[self] . identifier[... | def credentials_required(method_func):
"""
Decorator for methods that checks that the client has credentials.
Throws a CredentialsMissingError when they are absent.
"""
def _checkcredentials(self, *args, **kwargs):
if self.username and self.password:
return method_func(self, *a... |
def check_number_available(self, id_environment, num_vlan, id_vlan):
"""Checking if environment has a number vlan available
:param id_environment: Identifier of environment
:param num_vlan: Vlan number
:param id_vlan: Vlan indentifier (False if inserting a vlan)
:return: True i... | def function[check_number_available, parameter[self, id_environment, num_vlan, id_vlan]]:
constant[Checking if environment has a number vlan available
:param id_environment: Identifier of environment
:param num_vlan: Vlan number
:param id_vlan: Vlan indentifier (False if inserting a vla... | keyword[def] identifier[check_number_available] ( identifier[self] , identifier[id_environment] , identifier[num_vlan] , identifier[id_vlan] ):
literal[string]
identifier[url] = literal[string] + identifier[str] ( identifier[id_environment] )+ literal[string] + identifier[str] ( identifier[num_vla... | def check_number_available(self, id_environment, num_vlan, id_vlan):
"""Checking if environment has a number vlan available
:param id_environment: Identifier of environment
:param num_vlan: Vlan number
:param id_vlan: Vlan indentifier (False if inserting a vlan)
:return: True is ha... |
def copy(self):
"""
Makes a safe copy of the model.
"""
copied_model = GPModel(kernel = self.model.kern.copy(),
noise_var=self.noise_var,
exact_feval=self.exact_feval,
optimizer=self.optimizer,
... | def function[copy, parameter[self]]:
constant[
Makes a safe copy of the model.
]
variable[copied_model] assign[=] call[name[GPModel], parameter[]]
call[name[copied_model]._create_model, parameter[name[self].model.X, name[self].model.Y]]
call[name[copied_model].updateModel... | keyword[def] identifier[copy] ( identifier[self] ):
literal[string]
identifier[copied_model] = identifier[GPModel] ( identifier[kernel] = identifier[self] . identifier[model] . identifier[kern] . identifier[copy] (),
identifier[noise_var] = identifier[self] . identifier[noise_var] ,
... | def copy(self):
"""
Makes a safe copy of the model.
"""
copied_model = GPModel(kernel=self.model.kern.copy(), noise_var=self.noise_var, exact_feval=self.exact_feval, optimizer=self.optimizer, max_iters=self.max_iters, optimize_restarts=self.optimize_restarts, verbose=self.verbose, ARD=self.ARD)
... |
def financials(symbol, token='', version=''):
'''Pulls income statement, balance sheet, and cash flow data from the four most recent reported quarters.
https://iexcloud.io/docs/api/#financials
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access... | def function[financials, parameter[symbol, token, version]]:
constant[Pulls income statement, balance sheet, and cash flow data from the four most recent reported quarters.
https://iexcloud.io/docs/api/#financials
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
... | keyword[def] identifier[financials] ( identifier[symbol] , identifier[token] = literal[string] , identifier[version] = literal[string] ):
literal[string]
identifier[_raiseIfNotStr] ( identifier[symbol] )
keyword[return] identifier[_getJson] ( literal[string] + identifier[symbol] + literal[string] , i... | def financials(symbol, token='', version=''):
"""Pulls income statement, balance sheet, and cash flow data from the four most recent reported quarters.
https://iexcloud.io/docs/api/#financials
Updates at 8am, 9am UTC daily
Args:
symbol (string); Ticker to request
token (string); Access... |
def get_last_modified_datetime(self):
"""Return datetime object of modified time of machine file. Return now if not a file."""
if self._path:
statbuf = os.stat(self._path)
return datetime.utcfromtimestamp(statbuf.st_mtime)
else:
return datetime.now() | def function[get_last_modified_datetime, parameter[self]]:
constant[Return datetime object of modified time of machine file. Return now if not a file.]
if name[self]._path begin[:]
variable[statbuf] assign[=] call[name[os].stat, parameter[name[self]._path]]
return[call[name[datet... | keyword[def] identifier[get_last_modified_datetime] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_path] :
identifier[statbuf] = identifier[os] . identifier[stat] ( identifier[self] . identifier[_path] )
keyword[return] identifier[dateti... | def get_last_modified_datetime(self):
"""Return datetime object of modified time of machine file. Return now if not a file."""
if self._path:
statbuf = os.stat(self._path)
return datetime.utcfromtimestamp(statbuf.st_mtime) # depends on [control=['if'], data=[]]
else:
return datetime... |
def clear(self):
"Remove all items and reset internal structures"
dict.clear(self)
self._key = 0
if hasattr(self._tree_view, "wx_obj"):
self._tree_view.wx_obj.DeleteAllItems() | def function[clear, parameter[self]]:
constant[Remove all items and reset internal structures]
call[name[dict].clear, parameter[name[self]]]
name[self]._key assign[=] constant[0]
if call[name[hasattr], parameter[name[self]._tree_view, constant[wx_obj]]] begin[:]
call[name... | keyword[def] identifier[clear] ( identifier[self] ):
literal[string]
identifier[dict] . identifier[clear] ( identifier[self] )
identifier[self] . identifier[_key] = literal[int]
keyword[if] identifier[hasattr] ( identifier[self] . identifier[_tree_view] , literal[string] ):
... | def clear(self):
"""Remove all items and reset internal structures"""
dict.clear(self)
self._key = 0
if hasattr(self._tree_view, 'wx_obj'):
self._tree_view.wx_obj.DeleteAllItems() # depends on [control=['if'], data=[]] |
def attach_data(self, node):
'''Generic method called for visit_XXXX() with XXXX in
GatherOMPData.statements list
'''
if self.current:
for curr in self.current:
md = OMPDirective(curr)
metadata.add(node, md)
self.current = list()
... | def function[attach_data, parameter[self, node]]:
constant[Generic method called for visit_XXXX() with XXXX in
GatherOMPData.statements list
]
if name[self].current begin[:]
for taget[name[curr]] in starred[name[self].current] begin[:]
variable[md... | keyword[def] identifier[attach_data] ( identifier[self] , identifier[node] ):
literal[string]
keyword[if] identifier[self] . identifier[current] :
keyword[for] identifier[curr] keyword[in] identifier[self] . identifier[current] :
identifier[md] = identifier[OMPDire... | def attach_data(self, node):
"""Generic method called for visit_XXXX() with XXXX in
GatherOMPData.statements list
"""
if self.current:
for curr in self.current:
md = OMPDirective(curr)
metadata.add(node, md) # depends on [control=['for'], data=['curr']]
... |
def evaluate(self, instance, step, extra):
"""Evaluate the current definition and fill its attributes.
Uses attributes definition in the following order:
- values defined when defining the ParameteredAttribute
- additional values defined when instantiating the containing factory
... | def function[evaluate, parameter[self, instance, step, extra]]:
constant[Evaluate the current definition and fill its attributes.
Uses attributes definition in the following order:
- values defined when defining the ParameteredAttribute
- additional values defined when instantiating the... | keyword[def] identifier[evaluate] ( identifier[self] , identifier[instance] , identifier[step] , identifier[extra] ):
literal[string]
identifier[defaults] = identifier[dict] ( identifier[self] . identifier[defaults] )
keyword[if] identifier[extra] :
identifier[defaults] . ide... | def evaluate(self, instance, step, extra):
"""Evaluate the current definition and fill its attributes.
Uses attributes definition in the following order:
- values defined when defining the ParameteredAttribute
- additional values defined when instantiating the containing factory
Ar... |
def a2enconf(conf):
'''
.. versionadded:: 2016.3.0
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enconf security
'''
ret = {}
command = ['a2en... | def function[a2enconf, parameter[conf]]:
constant[
.. versionadded:: 2016.3.0
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enconf security
]
... | keyword[def] identifier[a2enconf] ( identifier[conf] ):
literal[string]
identifier[ret] ={}
identifier[command] =[ literal[string] , identifier[conf] ]
keyword[try] :
identifier[status] = identifier[__salt__] [ literal[string] ]( identifier[command] , identifier[python_shell] = keyword[... | def a2enconf(conf):
"""
.. versionadded:: 2016.3.0
Runs a2enconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu,
Mint, etc).
CLI Examples:
.. code-block:: bash
salt '*' apache.a2enconf security
"""
ret = {}
command = ['a2en... |
def reset(self):
""" Resets the readonly variables.
"""
self.p_lmbda = 0.0
self.q_lmbda = 0.0
self.mu_vmin = 0.0
self.mu_vmax = 0.0 | def function[reset, parameter[self]]:
constant[ Resets the readonly variables.
]
name[self].p_lmbda assign[=] constant[0.0]
name[self].q_lmbda assign[=] constant[0.0]
name[self].mu_vmin assign[=] constant[0.0]
name[self].mu_vmax assign[=] constant[0.0] | keyword[def] identifier[reset] ( identifier[self] ):
literal[string]
identifier[self] . identifier[p_lmbda] = literal[int]
identifier[self] . identifier[q_lmbda] = literal[int]
identifier[self] . identifier[mu_vmin] = literal[int]
identifier[self] . identifier[mu_vmax]... | def reset(self):
""" Resets the readonly variables.
"""
self.p_lmbda = 0.0
self.q_lmbda = 0.0
self.mu_vmin = 0.0
self.mu_vmax = 0.0 |
def add_color_stop_rgba(self, offset, red, green, blue, alpha=1):
"""Adds a translucent color stop to a gradient pattern.
The offset specifies the location along the gradient's control vector.
For example,
a linear gradient's control vector is from (x0,y0) to (x1,y1)
while a rad... | def function[add_color_stop_rgba, parameter[self, offset, red, green, blue, alpha]]:
constant[Adds a translucent color stop to a gradient pattern.
The offset specifies the location along the gradient's control vector.
For example,
a linear gradient's control vector is from (x0,y0) to (x... | keyword[def] identifier[add_color_stop_rgba] ( identifier[self] , identifier[offset] , identifier[red] , identifier[green] , identifier[blue] , identifier[alpha] = literal[int] ):
literal[string]
identifier[cairo] . identifier[cairo_pattern_add_color_stop_rgba] (
identifier[self] . identif... | def add_color_stop_rgba(self, offset, red, green, blue, alpha=1):
"""Adds a translucent color stop to a gradient pattern.
The offset specifies the location along the gradient's control vector.
For example,
a linear gradient's control vector is from (x0,y0) to (x1,y1)
while a radial ... |
def TEST(fname):
"""
Test function to step through all functions in
order to try and identify all features on a map
This test function should be placed in a main
section later
"""
#fname = os.path.join(os.getcwd(), '..','..', # os.path.join(os.path.getcwd(), '
m = MapObject(fname, os.p... | def function[TEST, parameter[fname]]:
constant[
Test function to step through all functions in
order to try and identify all features on a map
This test function should be placed in a main
section later
]
variable[m] assign[=] call[name[MapObject], parameter[name[fname], call[name[o... | keyword[def] identifier[TEST] ( identifier[fname] ):
literal[string]
identifier[m] = identifier[MapObject] ( identifier[fname] , identifier[os] . identifier[path] . identifier[join] ( identifier[os] . identifier[getcwd] (), literal[string] ))
identifier[m] . identifier[add_layer] ( identifier[Ima... | def TEST(fname):
"""
Test function to step through all functions in
order to try and identify all features on a map
This test function should be placed in a main
section later
"""
#fname = os.path.join(os.getcwd(), '..','..', # os.path.join(os.path.getcwd(), '
m = MapObject(fname, os.p... |
def update_webhook(self, webhook_url, webhook_id, events=None):
"""Register webhook (if it doesn't exit)."""
hooks = self._request(MINUT_WEBHOOKS_URL, request_type='GET')['hooks']
try:
self._webhook = next(
hook for hook in hooks if hook['url'] == webhook_url)
... | def function[update_webhook, parameter[self, webhook_url, webhook_id, events]]:
constant[Register webhook (if it doesn't exit).]
variable[hooks] assign[=] call[call[name[self]._request, parameter[name[MINUT_WEBHOOKS_URL]]]][constant[hooks]]
<ast.Try object at 0x7da1b1121a50> | keyword[def] identifier[update_webhook] ( identifier[self] , identifier[webhook_url] , identifier[webhook_id] , identifier[events] = keyword[None] ):
literal[string]
identifier[hooks] = identifier[self] . identifier[_request] ( identifier[MINUT_WEBHOOKS_URL] , identifier[request_type] = literal[str... | def update_webhook(self, webhook_url, webhook_id, events=None):
"""Register webhook (if it doesn't exit)."""
hooks = self._request(MINUT_WEBHOOKS_URL, request_type='GET')['hooks']
try:
self._webhook = next((hook for hook in hooks if hook['url'] == webhook_url))
_LOGGER.debug('Webhook: %s', s... |
def call(self, method_path, **kwargs):
"""
Make an API call for specific method
:param method_path: format ``Interface.Method`` (e.g. ``ISteamWebAPIUtil.GetServerInfo``)
:type method_path: :class:`str`
:param kwargs: keyword arguments for the specific method
:return: res... | def function[call, parameter[self, method_path]]:
constant[
Make an API call for specific method
:param method_path: format ``Interface.Method`` (e.g. ``ISteamWebAPIUtil.GetServerInfo``)
:type method_path: :class:`str`
:param kwargs: keyword arguments for the specific method
... | keyword[def] identifier[call] ( identifier[self] , identifier[method_path] ,** identifier[kwargs] ):
literal[string]
identifier[interface] , identifier[method] = identifier[method_path] . identifier[split] ( literal[string] , literal[int] )
keyword[return] identifier[getattr] ( identifie... | def call(self, method_path, **kwargs):
"""
Make an API call for specific method
:param method_path: format ``Interface.Method`` (e.g. ``ISteamWebAPIUtil.GetServerInfo``)
:type method_path: :class:`str`
:param kwargs: keyword arguments for the specific method
:return: respons... |
def add_fast_step(self, fastsim):
""" Add the fastsim context to the trace. """
for wire_name in self.trace:
self.trace[wire_name].append(fastsim.context[wire_name]) | def function[add_fast_step, parameter[self, fastsim]]:
constant[ Add the fastsim context to the trace. ]
for taget[name[wire_name]] in starred[name[self].trace] begin[:]
call[call[name[self].trace][name[wire_name]].append, parameter[call[name[fastsim].context][name[wire_name]]]] | keyword[def] identifier[add_fast_step] ( identifier[self] , identifier[fastsim] ):
literal[string]
keyword[for] identifier[wire_name] keyword[in] identifier[self] . identifier[trace] :
identifier[self] . identifier[trace] [ identifier[wire_name] ]. identifier[append] ( identifier[fa... | def add_fast_step(self, fastsim):
""" Add the fastsim context to the trace. """
for wire_name in self.trace:
self.trace[wire_name].append(fastsim.context[wire_name]) # depends on [control=['for'], data=['wire_name']] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.