code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def tile_coords_to_bbox(cls, x, y, zoom):
"""
Calculates the lon/lat estrema of the bounding box corresponding to specific tile coordinates. Output coodinates
are in degrees and in the Mercator Projection (http://en.wikipedia.org/wiki/Mercator_projection)
:param x: the x tile coordinate... | def function[tile_coords_to_bbox, parameter[cls, x, y, zoom]]:
constant[
Calculates the lon/lat estrema of the bounding box corresponding to specific tile coordinates. Output coodinates
are in degrees and in the Mercator Projection (http://en.wikipedia.org/wiki/Mercator_projection)
:par... | keyword[def] identifier[tile_coords_to_bbox] ( identifier[cls] , identifier[x] , identifier[y] , identifier[zoom] ):
literal[string]
keyword[def] identifier[tile_to_geocoords] ( identifier[x] , identifier[y] , identifier[zoom] ):
identifier[n] = literal[int] ** identifier[zoom]
... | def tile_coords_to_bbox(cls, x, y, zoom):
"""
Calculates the lon/lat estrema of the bounding box corresponding to specific tile coordinates. Output coodinates
are in degrees and in the Mercator Projection (http://en.wikipedia.org/wiki/Mercator_projection)
:param x: the x tile coordinates
... |
def _can_undo(comps, trans_list):
"""
Return whether a components can be undone with one of the transformation in
trans_list.
"""
comps = list(comps)
accent_list = list(map(accent.get_accent_char, comps[1]))
mark_list = list(map(mark.get_mark_char, utils.join(comps)))
action_list = list(... | def function[_can_undo, parameter[comps, trans_list]]:
constant[
Return whether a components can be undone with one of the transformation in
trans_list.
]
variable[comps] assign[=] call[name[list], parameter[name[comps]]]
variable[accent_list] assign[=] call[name[list], parameter[cal... | keyword[def] identifier[_can_undo] ( identifier[comps] , identifier[trans_list] ):
literal[string]
identifier[comps] = identifier[list] ( identifier[comps] )
identifier[accent_list] = identifier[list] ( identifier[map] ( identifier[accent] . identifier[get_accent_char] , identifier[comps] [ literal[in... | def _can_undo(comps, trans_list):
"""
Return whether a components can be undone with one of the transformation in
trans_list.
"""
comps = list(comps)
accent_list = list(map(accent.get_accent_char, comps[1]))
mark_list = list(map(mark.get_mark_char, utils.join(comps)))
action_list = list(... |
def _mark_context_complete(marker, context, has_errors):
"""Transactionally 'complete' the context."""
current = None
if marker:
current = marker.key.get()
if not current:
return False
if current and current.complete:
return False
current.complete = True
current.... | def function[_mark_context_complete, parameter[marker, context, has_errors]]:
constant[Transactionally 'complete' the context.]
variable[current] assign[=] constant[None]
if name[marker] begin[:]
variable[current] assign[=] call[name[marker].key.get, parameter[]]
if <ast.... | keyword[def] identifier[_mark_context_complete] ( identifier[marker] , identifier[context] , identifier[has_errors] ):
literal[string]
identifier[current] = keyword[None]
keyword[if] identifier[marker] :
identifier[current] = identifier[marker] . identifier[key] . identifier[get] ()
... | def _mark_context_complete(marker, context, has_errors):
"""Transactionally 'complete' the context."""
current = None
if marker:
current = marker.key.get() # depends on [control=['if'], data=[]]
if not current:
return False # depends on [control=['if'], data=[]]
if current and curr... |
def is_float_array(l):
r"""Checks if l is a numpy array of floats (any dimension
"""
if isinstance(l, np.ndarray):
if l.dtype.kind == 'f':
return True
return False | def function[is_float_array, parameter[l]]:
constant[Checks if l is a numpy array of floats (any dimension
]
if call[name[isinstance], parameter[name[l], name[np].ndarray]] begin[:]
if compare[name[l].dtype.kind equal[==] constant[f]] begin[:]
return[constant[True]]
... | keyword[def] identifier[is_float_array] ( identifier[l] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[l] , identifier[np] . identifier[ndarray] ):
keyword[if] identifier[l] . identifier[dtype] . identifier[kind] == literal[string] :
keyword[return] keyword[True... | def is_float_array(l):
"""Checks if l is a numpy array of floats (any dimension
"""
if isinstance(l, np.ndarray):
if l.dtype.kind == 'f':
return True # depends on [control=['if'], data=[]] # depends on [control=['if'], data=[]]
return False |
def connectdown(np, p, acc, outlet, wtsd=None, workingdir=None, mpiexedir=None,
exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Reads an ad8 contributing area file,
identifies the location of the largest ad8 value as the outlet of the largest watershed"""
# ... | def function[connectdown, parameter[np, p, acc, outlet, wtsd, workingdir, mpiexedir, exedir, log_file, runtime_file, hostfile]]:
constant[Reads an ad8 contributing area file,
identifies the location of the largest ad8 value as the outlet of the largest watershed]
if <ast.BoolOp object at 0x7da1b... | keyword[def] identifier[connectdown] ( identifier[np] , identifier[p] , identifier[acc] , identifier[outlet] , identifier[wtsd] = keyword[None] , identifier[workingdir] = keyword[None] , identifier[mpiexedir] = keyword[None] ,
identifier[exedir] = keyword[None] , identifier[log_file] = keyword[None] , identifier[run... | def connectdown(np, p, acc, outlet, wtsd=None, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Reads an ad8 contributing area file,
identifies the location of the largest ad8 value as the outlet of the largest watershed"""
# If watershed is not specifie... |
def mark_best_classifications(errors):
"""
Convenience wrapper around mark_best_classification.
Finds the best match for each TextLogError in errors, handling no match
meeting the cut off score and then mark_best_classification to save that
information.
"""
for text_log_error in errors:
... | def function[mark_best_classifications, parameter[errors]]:
constant[
Convenience wrapper around mark_best_classification.
Finds the best match for each TextLogError in errors, handling no match
meeting the cut off score and then mark_best_classification to save that
information.
]
... | keyword[def] identifier[mark_best_classifications] ( identifier[errors] ):
literal[string]
keyword[for] identifier[text_log_error] keyword[in] identifier[errors] :
identifier[best_match] = identifier[get_best_match] ( identifier[text_log_error] )
keyword[if] keyword[not] identifier[b... | def mark_best_classifications(errors):
"""
Convenience wrapper around mark_best_classification.
Finds the best match for each TextLogError in errors, handling no match
meeting the cut off score and then mark_best_classification to save that
information.
"""
for text_log_error in errors:
... |
def parse(self, data):
# type: (bytes) -> None
'''
Parse the passed in data into a UDF Partition Map.
Parameters:
data - The data to parse.
Returns:
Nothing.
'''
if self._initialized:
raise pycdlibexception.PyCdlibInternalError('UDF ... | def function[parse, parameter[self, data]]:
constant[
Parse the passed in data into a UDF Partition Map.
Parameters:
data - The data to parse.
Returns:
Nothing.
]
if name[self]._initialized begin[:]
<ast.Raise object at 0x7da20c6c77c0>
<... | keyword[def] identifier[parse] ( identifier[self] , identifier[data] ):
literal[string]
keyword[if] identifier[self] . identifier[_initialized] :
keyword[raise] identifier[pycdlibexception] . identifier[PyCdlibInternalError] ( literal[string] )
( identifier[map_type] , iden... | def parse(self, data):
# type: (bytes) -> None
'\n Parse the passed in data into a UDF Partition Map.\n\n Parameters:\n data - The data to parse.\n Returns:\n Nothing.\n '
if self._initialized:
raise pycdlibexception.PyCdlibInternalError('UDF Partition Map... |
def DbGetClassPropertyList(self, argin):
""" Get property list for a given Tango class with a specified filter
:param argin: The filter
:type: tango.DevString
:return: Property name list
:rtype: tango.DevVarStringArray """
self._log.debug("In DbGetClassPropertyList()")
... | def function[DbGetClassPropertyList, parameter[self, argin]]:
constant[ Get property list for a given Tango class with a specified filter
:param argin: The filter
:type: tango.DevString
:return: Property name list
:rtype: tango.DevVarStringArray ]
call[name[self]._log.de... | keyword[def] identifier[DbGetClassPropertyList] ( identifier[self] , identifier[argin] ):
literal[string]
identifier[self] . identifier[_log] . identifier[debug] ( literal[string] )
keyword[if] keyword[not] identifier[argin] :
identifier[argin] = literal[string]
ke... | def DbGetClassPropertyList(self, argin):
""" Get property list for a given Tango class with a specified filter
:param argin: The filter
:type: tango.DevString
:return: Property name list
:rtype: tango.DevVarStringArray """
self._log.debug('In DbGetClassPropertyList()')
if no... |
def from_sec(class_, sec):
"""
Create a key from an sec bytestream (which is an encoding of a public pair).
"""
public_pair = sec_to_public_pair(sec, class_._generator)
return class_(public_pair=public_pair, is_compressed=is_sec_compressed(sec)) | def function[from_sec, parameter[class_, sec]]:
constant[
Create a key from an sec bytestream (which is an encoding of a public pair).
]
variable[public_pair] assign[=] call[name[sec_to_public_pair], parameter[name[sec], name[class_]._generator]]
return[call[name[class_], parameter[]... | keyword[def] identifier[from_sec] ( identifier[class_] , identifier[sec] ):
literal[string]
identifier[public_pair] = identifier[sec_to_public_pair] ( identifier[sec] , identifier[class_] . identifier[_generator] )
keyword[return] identifier[class_] ( identifier[public_pair] = identifier[... | def from_sec(class_, sec):
"""
Create a key from an sec bytestream (which is an encoding of a public pair).
"""
public_pair = sec_to_public_pair(sec, class_._generator)
return class_(public_pair=public_pair, is_compressed=is_sec_compressed(sec)) |
def read_tuple_ticks(self, symbol, start, end):
''' read ticks as tuple '''
if end is None:
end=sys.maxint
session=self.getReadSession()()
try:
rows=session.query(Tick).filter(and_(Tick.symbol == symbol,
... | def function[read_tuple_ticks, parameter[self, symbol, start, end]]:
constant[ read ticks as tuple ]
if compare[name[end] is constant[None]] begin[:]
variable[end] assign[=] name[sys].maxint
variable[session] assign[=] call[call[name[self].getReadSession, parameter[]], parameter[... | keyword[def] identifier[read_tuple_ticks] ( identifier[self] , identifier[symbol] , identifier[start] , identifier[end] ):
literal[string]
keyword[if] identifier[end] keyword[is] keyword[None] :
identifier[end] = identifier[sys] . identifier[maxint]
identifier[sessio... | def read_tuple_ticks(self, symbol, start, end):
""" read ticks as tuple """
if end is None:
end = sys.maxint # depends on [control=['if'], data=['end']]
session = self.getReadSession()()
try:
rows = session.query(Tick).filter(and_(Tick.symbol == symbol, Tick.time >= int(start), Tick.tim... |
def pointwise_free_energies(self, therm_state=None):
r"""
Computes the pointwise free energies :math:`-\log(\mu^k(x))` for all points x.
:math:`\mu^k(x)` is the optimal estimate of the Boltzmann distribution
of the k'th ensemble defined on the set of all samples.
Parameters
... | def function[pointwise_free_energies, parameter[self, therm_state]]:
constant[
Computes the pointwise free energies :math:`-\log(\mu^k(x))` for all points x.
:math:`\mu^k(x)` is the optimal estimate of the Boltzmann distribution
of the k'th ensemble defined on the set of all samples.
... | keyword[def] identifier[pointwise_free_energies] ( identifier[self] , identifier[therm_state] = keyword[None] ):
literal[string]
keyword[assert] identifier[self] . identifier[therm_energies] keyword[is] keyword[not] keyword[None] , literal[string]
keyword[if] identifier[therm_state] ... | def pointwise_free_energies(self, therm_state=None):
"""
Computes the pointwise free energies :math:`-\\log(\\mu^k(x))` for all points x.
:math:`\\mu^k(x)` is the optimal estimate of the Boltzmann distribution
of the k'th ensemble defined on the set of all samples.
Parameters
... |
def pgen_lsp(
times,
mags,
errs,
magsarefluxes=False,
startp=None,
endp=None,
stepsize=1.0e-4,
autofreq=True,
nbestpeaks=5,
periodepsilon=0.1,
sigclip=10.0,
nworkers=None,
workchunksize=None,
glspfunc=_glsp_w... | def function[pgen_lsp, parameter[times, mags, errs, magsarefluxes, startp, endp, stepsize, autofreq, nbestpeaks, periodepsilon, sigclip, nworkers, workchunksize, glspfunc, verbose]]:
constant[This calculates the generalized Lomb-Scargle periodogram.
Uses the algorithm from Zechmeister and Kurster (2009).
... | keyword[def] identifier[pgen_lsp] (
identifier[times] ,
identifier[mags] ,
identifier[errs] ,
identifier[magsarefluxes] = keyword[False] ,
identifier[startp] = keyword[None] ,
identifier[endp] = keyword[None] ,
identifier[stepsize] = literal[int] ,
identifier[autofreq] = keyword[True] ,
identifier[nbestpeaks... | def pgen_lsp(times, mags, errs, magsarefluxes=False, startp=None, endp=None, stepsize=0.0001, autofreq=True, nbestpeaks=5, periodepsilon=0.1, sigclip=10.0, nworkers=None, workchunksize=None, glspfunc=_glsp_worker_withtau, verbose=True):
"""This calculates the generalized Lomb-Scargle periodogram.
Uses the algo... |
def from_soup(self, tag_prof_header, tag_prof_nav):
"""
Returns the scraped user data from a twitter user page.
:param tag_prof_header: captures the left hand part of user info
:param tag_prof_nav: captures the upper part of user info
:return: Returns a User object with captured... | def function[from_soup, parameter[self, tag_prof_header, tag_prof_nav]]:
constant[
Returns the scraped user data from a twitter user page.
:param tag_prof_header: captures the left hand part of user info
:param tag_prof_nav: captures the upper part of user info
:return: Returns ... | keyword[def] identifier[from_soup] ( identifier[self] , identifier[tag_prof_header] , identifier[tag_prof_nav] ):
literal[string]
identifier[self] . identifier[user] = identifier[tag_prof_header] . identifier[find] ( literal[string] ,{ literal[string] : literal[string] })[ literal[string] ]. ident... | def from_soup(self, tag_prof_header, tag_prof_nav):
"""
Returns the scraped user data from a twitter user page.
:param tag_prof_header: captures the left hand part of user info
:param tag_prof_nav: captures the upper part of user info
:return: Returns a User object with captured dat... |
def to_bytes(self):
'''
Create bytes from properties
'''
# Check properties
self.sanitize()
# Start with reserved bits
bitstream = self._to_rsvd1()
# Add zeroes for the flags
bitstream += self._to_flags()
# Add the type
bitstream... | def function[to_bytes, parameter[self]]:
constant[
Create bytes from properties
]
call[name[self].sanitize, parameter[]]
variable[bitstream] assign[=] call[name[self]._to_rsvd1, parameter[]]
<ast.AugAssign object at 0x7da1b0ae2e00>
<ast.AugAssign object at 0x7da1b0ae1690>... | keyword[def] identifier[to_bytes] ( identifier[self] ):
literal[string]
identifier[self] . identifier[sanitize] ()
identifier[bitstream] = identifier[self] . identifier[_to_rsvd1] ()
identifier[bitstream] += identifier[self] . identifier[_to_flags] ()
... | def to_bytes(self):
"""
Create bytes from properties
"""
# Check properties
self.sanitize()
# Start with reserved bits
bitstream = self._to_rsvd1()
# Add zeroes for the flags
bitstream += self._to_flags()
# Add the type
bitstream += BitArray('uint:8=%d' % self.lcaf_ty... |
def patch(self, url, data=None, **kwargs):
"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.
:param **kwargs: Optional arguments that `... | def function[patch, parameter[self, url, data]]:
constant[Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.
:param **kwargs: Optional argu... | keyword[def] identifier[patch] ( identifier[self] , identifier[url] , identifier[data] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[return] identifier[self] . identifier[request] ( literal[string] , identifier[url] , identifier[data] = identifier[data] ,** identifier[kwargs] ... | def patch(self, url, data=None, **kwargs):
"""Sends a PATCH request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param data: (optional) Dictionary or bytes to send in the body of the :class:`Request`.
:param **kwargs: Optional arguments that ``req... |
def parse_cond_and_hall(path_dir, doping_levels=None):
"""
Parses the conductivity and Hall tensors
Args:
path_dir: Path containing .condtens / .halltens files
doping_levels: ([float]) - doping lvls, parse outtrans to get this
Returns:
mu_steps, cond,... | def function[parse_cond_and_hall, parameter[path_dir, doping_levels]]:
constant[
Parses the conductivity and Hall tensors
Args:
path_dir: Path containing .condtens / .halltens files
doping_levels: ([float]) - doping lvls, parse outtrans to get this
Returns:
... | keyword[def] identifier[parse_cond_and_hall] ( identifier[path_dir] , identifier[doping_levels] = keyword[None] ):
literal[string]
identifier[t_steps] = identifier[set] ()
identifier[mu_steps] = identifier[set] ()
identifier[data_full] =[]
identifier[data_hall] ... | def parse_cond_and_hall(path_dir, doping_levels=None):
"""
Parses the conductivity and Hall tensors
Args:
path_dir: Path containing .condtens / .halltens files
doping_levels: ([float]) - doping lvls, parse outtrans to get this
Returns:
mu_steps, cond, see... |
def mobile_template(template):
"""
Mark a function as mobile-ready and pass a mobile template if MOBILE.
For example::
@mobile_template('a/{mobile/}b.html')
def view(template=None):
...
if ``request.MOBILE=True`` the template will be `a/mobile/b.html`.
if ``request.MO... | def function[mobile_template, parameter[template]]:
constant[
Mark a function as mobile-ready and pass a mobile template if MOBILE.
For example::
@mobile_template('a/{mobile/}b.html')
def view(template=None):
...
if ``request.MOBILE=True`` the template will be `a/mobi... | keyword[def] identifier[mobile_template] ( identifier[template] ):
literal[string]
keyword[def] identifier[decorator] ( identifier[f] ):
@ identifier[functools] . identifier[wraps] ( identifier[f] )
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
... | def mobile_template(template):
"""
Mark a function as mobile-ready and pass a mobile template if MOBILE.
For example::
@mobile_template('a/{mobile/}b.html')
def view(template=None):
...
if ``request.MOBILE=True`` the template will be `a/mobile/b.html`.
if ``request.MO... |
def load_known_hosts(self, filename=None):
"""Load host keys from an openssh :file:`known_hosts`-style file. Can
be called multiple times.
If *filename* is not specified, looks in the default locations i.e. :file:`~/.ssh/known_hosts` and :file:`~/ssh/known_hosts` for Windows.
"""
... | def function[load_known_hosts, parameter[self, filename]]:
constant[Load host keys from an openssh :file:`known_hosts`-style file. Can
be called multiple times.
If *filename* is not specified, looks in the default locations i.e. :file:`~/.ssh/known_hosts` and :file:`~/ssh/known_hosts` for Windo... | keyword[def] identifier[load_known_hosts] ( identifier[self] , identifier[filename] = keyword[None] ):
literal[string]
keyword[if] identifier[filename] keyword[is] keyword[None] :
identifier[filename] = identifier[os] . identifier[path] . identifier[expanduser] ( literal[string] )... | def load_known_hosts(self, filename=None):
"""Load host keys from an openssh :file:`known_hosts`-style file. Can
be called multiple times.
If *filename* is not specified, looks in the default locations i.e. :file:`~/.ssh/known_hosts` and :file:`~/ssh/known_hosts` for Windows.
"""
if fil... |
def remove_peer_from_bgp_speaker(self, speaker_id, body=None):
"""Removes a peer from BGP speaker."""
return self.put((self.bgp_speaker_path % speaker_id) +
"/remove_bgp_peer", body=body) | def function[remove_peer_from_bgp_speaker, parameter[self, speaker_id, body]]:
constant[Removes a peer from BGP speaker.]
return[call[name[self].put, parameter[binary_operation[binary_operation[name[self].bgp_speaker_path <ast.Mod object at 0x7da2590d6920> name[speaker_id]] + constant[/remove_bgp_peer]]]]] | keyword[def] identifier[remove_peer_from_bgp_speaker] ( identifier[self] , identifier[speaker_id] , identifier[body] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[put] (( identifier[self] . identifier[bgp_speaker_path] % identifier[speaker_id] )+
literal... | def remove_peer_from_bgp_speaker(self, speaker_id, body=None):
"""Removes a peer from BGP speaker."""
return self.put(self.bgp_speaker_path % speaker_id + '/remove_bgp_peer', body=body) |
def from_file(cls, f, fname=None, readers=None):
"""Create a Document from a file.
Usage::
with open('paper.html', 'rb') as f:
doc = Document.from_file(f)
.. note::
Always open files in binary mode by using the 'rb' parameter.
:param file|stri... | def function[from_file, parameter[cls, f, fname, readers]]:
constant[Create a Document from a file.
Usage::
with open('paper.html', 'rb') as f:
doc = Document.from_file(f)
.. note::
Always open files in binary mode by using the 'rb' parameter.
... | keyword[def] identifier[from_file] ( identifier[cls] , identifier[f] , identifier[fname] = keyword[None] , identifier[readers] = keyword[None] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[f] , identifier[six] . identifier[string_types] ):
identifier[f] = identifi... | def from_file(cls, f, fname=None, readers=None):
"""Create a Document from a file.
Usage::
with open('paper.html', 'rb') as f:
doc = Document.from_file(f)
.. note::
Always open files in binary mode by using the 'rb' parameter.
:param file|string f... |
def is_valid_email(email):
"""
RFC822 Email Address Regex
--------------------------
Originally written by Cal Henderson
c.f. http://iamcal.com/publish/articles/php/parsing_email/
Translated to Python by Tim Fletcher, with changes suggested by Dan Kubb.
Licensed under a Creative Commons A... | def function[is_valid_email, parameter[email]]:
constant[
RFC822 Email Address Regex
--------------------------
Originally written by Cal Henderson
c.f. http://iamcal.com/publish/articles/php/parsing_email/
Translated to Python by Tim Fletcher, with changes suggested by Dan Kubb.
Lice... | keyword[def] identifier[is_valid_email] ( identifier[email] ):
literal[string]
keyword[import] identifier[re]
identifier[qtext] = literal[string]
identifier[dtext] = literal[string]
identifier[atom] = literal[string]
identifier[quoted_pair] = literal[string]
identifier[domai... | def is_valid_email(email):
"""
RFC822 Email Address Regex
--------------------------
Originally written by Cal Henderson
c.f. http://iamcal.com/publish/articles/php/parsing_email/
Translated to Python by Tim Fletcher, with changes suggested by Dan Kubb.
Licensed under a Creative Commons A... |
def set_triggered_by_event(self, value):
"""
Setter for 'triggered_by_event' field.
:param value - a new value of 'triggered_by_event' field. Must be a boolean type. Does not accept None value.
"""
if value is None or not isinstance(value, bool):
raise TypeError("Trig... | def function[set_triggered_by_event, parameter[self, value]]:
constant[
Setter for 'triggered_by_event' field.
:param value - a new value of 'triggered_by_event' field. Must be a boolean type. Does not accept None value.
]
if <ast.BoolOp object at 0x7da18ede6590> begin[:]
... | keyword[def] identifier[set_triggered_by_event] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[None] keyword[or] keyword[not] identifier[isinstance] ( identifier[value] , identifier[bool] ):
keyword[raise] identifier[T... | def set_triggered_by_event(self, value):
"""
Setter for 'triggered_by_event' field.
:param value - a new value of 'triggered_by_event' field. Must be a boolean type. Does not accept None value.
"""
if value is None or not isinstance(value, bool):
raise TypeError('TriggeredByEvent... |
def any_ends_with(self, string_list, pattern):
"""Returns true iff one of the strings in string_list ends in
pattern."""
try:
s_base = basestring
except:
s_base = str
is_string = isinstance(pattern, s_base)
if not is_string:
return Fal... | def function[any_ends_with, parameter[self, string_list, pattern]]:
constant[Returns true iff one of the strings in string_list ends in
pattern.]
<ast.Try object at 0x7da18dc04c10>
variable[is_string] assign[=] call[name[isinstance], parameter[name[pattern], name[s_base]]]
if <ast.Un... | keyword[def] identifier[any_ends_with] ( identifier[self] , identifier[string_list] , identifier[pattern] ):
literal[string]
keyword[try] :
identifier[s_base] = identifier[basestring]
keyword[except] :
identifier[s_base] = identifier[str]
identifier[is_... | def any_ends_with(self, string_list, pattern):
"""Returns true iff one of the strings in string_list ends in
pattern."""
try:
s_base = basestring # depends on [control=['try'], data=[]]
except:
s_base = str # depends on [control=['except'], data=[]]
is_string = isinstance(patte... |
def data_from_cluster_id(self, cluster_id, graph, data):
"""Returns the original data of each cluster member for a given cluster ID
Parameters
----------
cluster_id : String
ID of the cluster.
graph : dict
The resulting dictionary after applying map()
... | def function[data_from_cluster_id, parameter[self, cluster_id, graph, data]]:
constant[Returns the original data of each cluster member for a given cluster ID
Parameters
----------
cluster_id : String
ID of the cluster.
graph : dict
The resulting dictiona... | keyword[def] identifier[data_from_cluster_id] ( identifier[self] , identifier[cluster_id] , identifier[graph] , identifier[data] ):
literal[string]
keyword[if] identifier[cluster_id] keyword[in] identifier[graph] [ literal[string] ]:
identifier[cluster_members] = identifier[graph] [... | def data_from_cluster_id(self, cluster_id, graph, data):
"""Returns the original data of each cluster member for a given cluster ID
Parameters
----------
cluster_id : String
ID of the cluster.
graph : dict
The resulting dictionary after applying map()
... |
def start_new_fact(self, clone_selected=True, fallback=True):
"""Start now a new fact.
clone_selected (bool): whether to start a clone of currently
selected fact or to create a new fact from scratch.
fallback (bool): if True, fall back to creating from scratch
... | def function[start_new_fact, parameter[self, clone_selected, fallback]]:
constant[Start now a new fact.
clone_selected (bool): whether to start a clone of currently
selected fact or to create a new fact from scratch.
fallback (bool): if True, fall back to creating from scratch
... | keyword[def] identifier[start_new_fact] ( identifier[self] , identifier[clone_selected] = keyword[True] , identifier[fallback] = keyword[True] ):
literal[string]
keyword[if] keyword[not] identifier[clone_selected] :
identifier[dialogs] . identifier[edit] . identifier[show] ( identifi... | def start_new_fact(self, clone_selected=True, fallback=True):
"""Start now a new fact.
clone_selected (bool): whether to start a clone of currently
selected fact or to create a new fact from scratch.
fallback (bool): if True, fall back to creating from scratch
in... |
def coef(self):
"""
Return the coefficients which can be applied to the non-standardized data.
Note: standardize = True by default, if set to False then coef() return the coefficients which are fit directly.
"""
tbl = self._model_json["output"]["coefficients_table"]
if t... | def function[coef, parameter[self]]:
constant[
Return the coefficients which can be applied to the non-standardized data.
Note: standardize = True by default, if set to False then coef() return the coefficients which are fit directly.
]
variable[tbl] assign[=] call[call[name[sel... | keyword[def] identifier[coef] ( identifier[self] ):
literal[string]
identifier[tbl] = identifier[self] . identifier[_model_json] [ literal[string] ][ literal[string] ]
keyword[if] identifier[tbl] keyword[is] keyword[None] :
keyword[return] keyword[None]
keyword[r... | def coef(self):
"""
Return the coefficients which can be applied to the non-standardized data.
Note: standardize = True by default, if set to False then coef() return the coefficients which are fit directly.
"""
tbl = self._model_json['output']['coefficients_table']
if tbl is None:
... |
def get_image_and_mask(self, label, positive_only=True, hide_rest=False,
num_features=5, min_weight=0.):
"""Init function.
Args:
label: label to explain
positive_only: if True, only take superpixels that contribute to
the prediction of ... | def function[get_image_and_mask, parameter[self, label, positive_only, hide_rest, num_features, min_weight]]:
constant[Init function.
Args:
label: label to explain
positive_only: if True, only take superpixels that contribute to
the prediction of the label. Other... | keyword[def] identifier[get_image_and_mask] ( identifier[self] , identifier[label] , identifier[positive_only] = keyword[True] , identifier[hide_rest] = keyword[False] ,
identifier[num_features] = literal[int] , identifier[min_weight] = literal[int] ):
literal[string]
keyword[if] identifier[label... | def get_image_and_mask(self, label, positive_only=True, hide_rest=False, num_features=5, min_weight=0.0):
"""Init function.
Args:
label: label to explain
positive_only: if True, only take superpixels that contribute to
the prediction of the label. Otherwise, use the ... |
def has_field(mc, field_name):
"""
detect if a model has a given field has
:param field_name:
:param mc:
:return:
"""
try:
mc._meta.get_field(field_name)
except FieldDoesNotExist:
return False
return True | def function[has_field, parameter[mc, field_name]]:
constant[
detect if a model has a given field has
:param field_name:
:param mc:
:return:
]
<ast.Try object at 0x7da204567a00>
return[constant[True]] | keyword[def] identifier[has_field] ( identifier[mc] , identifier[field_name] ):
literal[string]
keyword[try] :
identifier[mc] . identifier[_meta] . identifier[get_field] ( identifier[field_name] )
keyword[except] identifier[FieldDoesNotExist] :
keyword[return] keyword[False]
... | def has_field(mc, field_name):
"""
detect if a model has a given field has
:param field_name:
:param mc:
:return:
"""
try:
mc._meta.get_field(field_name) # depends on [control=['try'], data=[]]
except FieldDoesNotExist:
return False # depends on [control=['except'], da... |
def _parseKeyNames(lib):
"""
returns a dictionary mapping of human readable key names to their keycodes
this parses constants with the names of K_* and makes code=name pairs
this is for KeyEvent.key variable and that enables things like:
if (event.key == 'PAGEUP'):
"""
_keyNames = {}
for... | def function[_parseKeyNames, parameter[lib]]:
constant[
returns a dictionary mapping of human readable key names to their keycodes
this parses constants with the names of K_* and makes code=name pairs
this is for KeyEvent.key variable and that enables things like:
if (event.key == 'PAGEUP'):
... | keyword[def] identifier[_parseKeyNames] ( identifier[lib] ):
literal[string]
identifier[_keyNames] ={}
keyword[for] identifier[attr] keyword[in] identifier[dir] ( identifier[lib] ):
keyword[if] identifier[attr] [: literal[int] ]== literal[string] :
identifier[_keyNames] [ ide... | def _parseKeyNames(lib):
"""
returns a dictionary mapping of human readable key names to their keycodes
this parses constants with the names of K_* and makes code=name pairs
this is for KeyEvent.key variable and that enables things like:
if (event.key == 'PAGEUP'):
"""
_keyNames = {}
for... |
def scene_velocity(sequence_number, scene_id, velocity):
"""Create a scene.velocity message"""
return MessageWriter().string("scene.velocity").uint64(sequence_number).uint32(scene_id).uint32(int(velocity*1000)).get() | def function[scene_velocity, parameter[sequence_number, scene_id, velocity]]:
constant[Create a scene.velocity message]
return[call[call[call[call[call[call[name[MessageWriter], parameter[]].string, parameter[constant[scene.velocity]]].uint64, parameter[name[sequence_number]]].uint32, parameter[name[scene_i... | keyword[def] identifier[scene_velocity] ( identifier[sequence_number] , identifier[scene_id] , identifier[velocity] ):
literal[string]
keyword[return] identifier[MessageWriter] (). identifier[string] ( literal[string] ). identifier[uint64] ( identifier[sequence_number] ). identifier[uint32] ( iden... | def scene_velocity(sequence_number, scene_id, velocity):
"""Create a scene.velocity message"""
return MessageWriter().string('scene.velocity').uint64(sequence_number).uint32(scene_id).uint32(int(velocity * 1000)).get() |
def attach(self, **kwargs):
"""
Attach to this container.
:py:meth:`logs` is a wrapper around this method, which you can
use instead if you want to fetch/stream container output without first
retrieving the entire backlog.
Args:
stdout (bool): Include stdout... | def function[attach, parameter[self]]:
constant[
Attach to this container.
:py:meth:`logs` is a wrapper around this method, which you can
use instead if you want to fetch/stream container output without first
retrieving the entire backlog.
Args:
stdout (bool... | keyword[def] identifier[attach] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
keyword[return] identifier[self] . identifier[client] . identifier[api] . identifier[attach] ( identifier[self] . identifier[id] ,** identifier[kwargs] ) | def attach(self, **kwargs):
"""
Attach to this container.
:py:meth:`logs` is a wrapper around this method, which you can
use instead if you want to fetch/stream container output without first
retrieving the entire backlog.
Args:
stdout (bool): Include stdout.
... |
def check_config_xml(self, contents):
"""
Check whether the given XML config file contents
is well-formed and it has all the required parameters.
:param string contents: the XML config file contents or XML config string
:param bool is_config_string: if ``True``, contents is a co... | def function[check_config_xml, parameter[self, contents]]:
constant[
Check whether the given XML config file contents
is well-formed and it has all the required parameters.
:param string contents: the XML config file contents or XML config string
:param bool is_config_string: if... | keyword[def] identifier[check_config_xml] ( identifier[self] , identifier[contents] ):
literal[string]
identifier[self] . identifier[log] ( literal[string] )
identifier[self] . identifier[result] = identifier[ValidatorResult] ()
keyword[if] identifier[self] . identifier[_are_safe... | def check_config_xml(self, contents):
"""
Check whether the given XML config file contents
is well-formed and it has all the required parameters.
:param string contents: the XML config file contents or XML config string
:param bool is_config_string: if ``True``, contents is a config... |
def extract_shn (archive, compression, cmd, verbosity, interactive, outdir):
"""Decompress a SHN archive to a WAV file."""
cmdlist = [util.shell_quote(cmd)]
outfile = util.get_single_outfile(outdir, archive, extension=".wav")
cmdlist.extend(['-x', '-', util.shell_quote(outfile), '<',
util.shell_... | def function[extract_shn, parameter[archive, compression, cmd, verbosity, interactive, outdir]]:
constant[Decompress a SHN archive to a WAV file.]
variable[cmdlist] assign[=] list[[<ast.Call object at 0x7da1b07ae410>]]
variable[outfile] assign[=] call[name[util].get_single_outfile, parameter[nam... | keyword[def] identifier[extract_shn] ( identifier[archive] , identifier[compression] , identifier[cmd] , identifier[verbosity] , identifier[interactive] , identifier[outdir] ):
literal[string]
identifier[cmdlist] =[ identifier[util] . identifier[shell_quote] ( identifier[cmd] )]
identifier[outfile] = ... | def extract_shn(archive, compression, cmd, verbosity, interactive, outdir):
"""Decompress a SHN archive to a WAV file."""
cmdlist = [util.shell_quote(cmd)]
outfile = util.get_single_outfile(outdir, archive, extension='.wav')
cmdlist.extend(['-x', '-', util.shell_quote(outfile), '<', util.shell_quote(arc... |
def _get_standalone_app_url(self, app_id, spark_master_address, requests_config, tags):
"""
Return the application URL from the app info page on the Spark master.
Due to a bug, we need to parse the HTML manually because we cannot
fetch JSON data from HTTP interface.
"""
a... | def function[_get_standalone_app_url, parameter[self, app_id, spark_master_address, requests_config, tags]]:
constant[
Return the application URL from the app info page on the Spark master.
Due to a bug, we need to parse the HTML manually because we cannot
fetch JSON data from HTTP inter... | keyword[def] identifier[_get_standalone_app_url] ( identifier[self] , identifier[app_id] , identifier[spark_master_address] , identifier[requests_config] , identifier[tags] ):
literal[string]
identifier[app_page] = identifier[self] . identifier[_rest_request] (
identifier[spark_master_addr... | def _get_standalone_app_url(self, app_id, spark_master_address, requests_config, tags):
"""
Return the application URL from the app info page on the Spark master.
Due to a bug, we need to parse the HTML manually because we cannot
fetch JSON data from HTTP interface.
"""
app_page ... |
def _reset_suffix_links(self):
'''
Reset all suffix links in all nodes in this trie.
'''
self._suffix_links_set = False
for current, _parent in self.dfs():
current.suffix = None
current.dict_suffix = None
current.longest_prefix = None | def function[_reset_suffix_links, parameter[self]]:
constant[
Reset all suffix links in all nodes in this trie.
]
name[self]._suffix_links_set assign[=] constant[False]
for taget[tuple[[<ast.Name object at 0x7da1b2407a30>, <ast.Name object at 0x7da1b2405f00>]]] in starred[call[na... | keyword[def] identifier[_reset_suffix_links] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_suffix_links_set] = keyword[False]
keyword[for] identifier[current] , identifier[_parent] keyword[in] identifier[self] . identifier[dfs] ():
identifier[current... | def _reset_suffix_links(self):
"""
Reset all suffix links in all nodes in this trie.
"""
self._suffix_links_set = False
for (current, _parent) in self.dfs():
current.suffix = None
current.dict_suffix = None
current.longest_prefix = None # depends on [control=['for'],... |
def _configure_io_handler(self, handler):
"""Register an io-handler at the polling object."""
if self.check_events():
return
if handler in self._unprepared_handlers:
old_fileno = self._unprepared_handlers[handler]
prepared = self._prepare_io_handler(handler)
... | def function[_configure_io_handler, parameter[self, handler]]:
constant[Register an io-handler at the polling object.]
if call[name[self].check_events, parameter[]] begin[:]
return[None]
if compare[name[handler] in name[self]._unprepared_handlers] begin[:]
variable[old_fi... | keyword[def] identifier[_configure_io_handler] ( identifier[self] , identifier[handler] ):
literal[string]
keyword[if] identifier[self] . identifier[check_events] ():
keyword[return]
keyword[if] identifier[handler] keyword[in] identifier[self] . identifier[_unprepared_han... | def _configure_io_handler(self, handler):
"""Register an io-handler at the polling object."""
if self.check_events():
return # depends on [control=['if'], data=[]]
if handler in self._unprepared_handlers:
old_fileno = self._unprepared_handlers[handler]
prepared = self._prepare_io_ha... |
def multiplypub(pub,priv,outcompressed=True):
'''
Input pubkey must be hex string and valid pubkey.
Input privkey must be 64-char hex string.
Pubkey input can be compressed or uncompressed, as long as it's a
valid key and a hex string. Use the validatepubkey() function to
validate the public ke... | def function[multiplypub, parameter[pub, priv, outcompressed]]:
constant[
Input pubkey must be hex string and valid pubkey.
Input privkey must be 64-char hex string.
Pubkey input can be compressed or uncompressed, as long as it's a
valid key and a hex string. Use the validatepubkey() function t... | keyword[def] identifier[multiplypub] ( identifier[pub] , identifier[priv] , identifier[outcompressed] = keyword[True] ):
literal[string]
keyword[if] identifier[len] ( identifier[pub] )== literal[int] :
identifier[pub] = identifier[uncompress] ( identifier[pub] )
identifier[x] , identifier[y... | def multiplypub(pub, priv, outcompressed=True):
"""
Input pubkey must be hex string and valid pubkey.
Input privkey must be 64-char hex string.
Pubkey input can be compressed or uncompressed, as long as it's a
valid key and a hex string. Use the validatepubkey() function to
validate the public ... |
def count(self, axis='major'):
"""
Return number of observations over requested axis.
Parameters
----------
axis : {'items', 'major', 'minor'} or {0, 1, 2}
Returns
-------
count : DataFrame
"""
i = self._get_axis_number(axis)
val... | def function[count, parameter[self, axis]]:
constant[
Return number of observations over requested axis.
Parameters
----------
axis : {'items', 'major', 'minor'} or {0, 1, 2}
Returns
-------
count : DataFrame
]
variable[i] assign[=] call[... | keyword[def] identifier[count] ( identifier[self] , identifier[axis] = literal[string] ):
literal[string]
identifier[i] = identifier[self] . identifier[_get_axis_number] ( identifier[axis] )
identifier[values] = identifier[self] . identifier[values]
identifier[mask] = identifier... | def count(self, axis='major'):
"""
Return number of observations over requested axis.
Parameters
----------
axis : {'items', 'major', 'minor'} or {0, 1, 2}
Returns
-------
count : DataFrame
"""
i = self._get_axis_number(axis)
values = self.va... |
def export(self, file_type=None):
"""
Export a snapshot of the current scene.
Parameters
----------
file_type: what encoding to use for meshes
ie: dict, dict64, stl
Returns
----------
export: dict with keys:
meshes: lis... | def function[export, parameter[self, file_type]]:
constant[
Export a snapshot of the current scene.
Parameters
----------
file_type: what encoding to use for meshes
ie: dict, dict64, stl
Returns
----------
export: dict with keys:
... | keyword[def] identifier[export] ( identifier[self] , identifier[file_type] = keyword[None] ):
literal[string]
identifier[file_type] = identifier[str] ( identifier[file_type] ). identifier[strip] (). identifier[lower] ()
keyword[if] identifier[file_type] == literal[string] :
... | def export(self, file_type=None):
"""
Export a snapshot of the current scene.
Parameters
----------
file_type: what encoding to use for meshes
ie: dict, dict64, stl
Returns
----------
export: dict with keys:
meshes: list of... |
def search(search, **kwargs):
"""
Search for models whose names matches the given pattern. Print the
results to stdout.
.. deprecated :: 1.0.0
`search` will be moved to ``andeshelp`` in future versions.
Parameters
----------
search : str
Partial or full name of the model to... | def function[search, parameter[search]]:
constant[
Search for models whose names matches the given pattern. Print the
results to stdout.
.. deprecated :: 1.0.0
`search` will be moved to ``andeshelp`` in future versions.
Parameters
----------
search : str
Partial or full... | keyword[def] identifier[search] ( identifier[search] ,** identifier[kwargs] ):
literal[string]
keyword[from] . identifier[models] keyword[import] identifier[all_models]
identifier[out] =[]
keyword[if] keyword[not] identifier[search] :
keyword[return] identifier[out]
identi... | def search(search, **kwargs):
"""
Search for models whose names matches the given pattern. Print the
results to stdout.
.. deprecated :: 1.0.0
`search` will be moved to ``andeshelp`` in future versions.
Parameters
----------
search : str
Partial or full name of the model to... |
def _wait_for_read_ready_or_timeout(self, timeout):
"""Returns tuple of whether stdin is ready to read and an event.
If an event is returned, that event is more pressing than reading
bytes on stdin to create a keyboard input event.
If stdin is ready, either there are bytes to read or a ... | def function[_wait_for_read_ready_or_timeout, parameter[self, timeout]]:
constant[Returns tuple of whether stdin is ready to read and an event.
If an event is returned, that event is more pressing than reading
bytes on stdin to create a keyboard input event.
If stdin is ready, either th... | keyword[def] identifier[_wait_for_read_ready_or_timeout] ( identifier[self] , identifier[timeout] ):
literal[string]
identifier[remaining_timeout] = identifier[timeout]
identifier[t0] = identifier[time] . identifier[time] ()
keyword[while] keyword[True] :
keyword[tr... | def _wait_for_read_ready_or_timeout(self, timeout):
"""Returns tuple of whether stdin is ready to read and an event.
If an event is returned, that event is more pressing than reading
bytes on stdin to create a keyboard input event.
If stdin is ready, either there are bytes to read or a SIGT... |
def _run_smoove(full_bams, sr_bams, disc_bams, work_dir, items):
"""Run lumpy-sv using smoove.
"""
batch = sshared.get_cur_batch(items)
ext = "-%s-svs" % batch if batch else "-svs"
name = "%s%s" % (dd.get_sample_name(items[0]), ext)
out_file = os.path.join(work_dir, "%s-smoove.genotyped.vcf.gz" ... | def function[_run_smoove, parameter[full_bams, sr_bams, disc_bams, work_dir, items]]:
constant[Run lumpy-sv using smoove.
]
variable[batch] assign[=] call[name[sshared].get_cur_batch, parameter[name[items]]]
variable[ext] assign[=] <ast.IfExp object at 0x7da18f00fb20>
variable[name] ... | keyword[def] identifier[_run_smoove] ( identifier[full_bams] , identifier[sr_bams] , identifier[disc_bams] , identifier[work_dir] , identifier[items] ):
literal[string]
identifier[batch] = identifier[sshared] . identifier[get_cur_batch] ( identifier[items] )
identifier[ext] = literal[string] % identif... | def _run_smoove(full_bams, sr_bams, disc_bams, work_dir, items):
"""Run lumpy-sv using smoove.
"""
batch = sshared.get_cur_batch(items)
ext = '-%s-svs' % batch if batch else '-svs'
name = '%s%s' % (dd.get_sample_name(items[0]), ext)
out_file = os.path.join(work_dir, '%s-smoove.genotyped.vcf.gz' ... |
def _get_pos(self, key):
"""Get the index of the given key in the sorted key list.
We return the position with the nearest hash based on
the provided key unless we reach the end of the continuum/ring
in which case we return the 0 (beginning) index position.
:param key: the key ... | def function[_get_pos, parameter[self, key]]:
constant[Get the index of the given key in the sorted key list.
We return the position with the nearest hash based on
the provided key unless we reach the end of the continuum/ring
in which case we return the 0 (beginning) index position.
... | keyword[def] identifier[_get_pos] ( identifier[self] , identifier[key] ):
literal[string]
identifier[p] = identifier[bisect] ( identifier[self] . identifier[runtime] . identifier[_keys] , identifier[self] . identifier[hashi] ( identifier[key] ))
keyword[if] identifier[p] == identifier[len... | def _get_pos(self, key):
"""Get the index of the given key in the sorted key list.
We return the position with the nearest hash based on
the provided key unless we reach the end of the continuum/ring
in which case we return the 0 (beginning) index position.
:param key: the key to h... |
def get_trunk_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("http://", "10.101.0.203", "8080"... | def function[get_trunk_interfaces, parameter[devId, auth, url]]:
constant[Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("h... | keyword[def] identifier[get_trunk_interfaces] ( identifier[devId] , identifier[auth] , identifier[url] ):
literal[string]
identifier[get_trunk_interfaces_url] = literal[string] + identifier[str] ( identifier[devId] )+ literal[string]
identifier[f_url] = identifier[url] + identifier[get_trunk_in... | def get_trunk_interfaces(devId, auth, url):
"""Function takes devId as input to RESTFULL call to HP IMC platform
:param devId: output of get_dev_details
:return: list of dictionaries containing of interfaces configured as an 802.1q trunk
Example:
auth = IMCAuth("http://", "10.101.0.203", "8080"... |
def _outputLine(self, logevent, length=None, human=False):
"""
Print the final line.
Provides various options (length, human, datetime changes, ...).
"""
# adapt timezone output if necessary
if self.args['timestamp_format'] != 'none':
logevent._reformat_times... | def function[_outputLine, parameter[self, logevent, length, human]]:
constant[
Print the final line.
Provides various options (length, human, datetime changes, ...).
]
if compare[call[name[self].args][constant[timestamp_format]] not_equal[!=] constant[none]] begin[:]
... | keyword[def] identifier[_outputLine] ( identifier[self] , identifier[logevent] , identifier[length] = keyword[None] , identifier[human] = keyword[False] ):
literal[string]
keyword[if] identifier[self] . identifier[args] [ literal[string] ]!= literal[string] :
identifier[logev... | def _outputLine(self, logevent, length=None, human=False):
"""
Print the final line.
Provides various options (length, human, datetime changes, ...).
"""
# adapt timezone output if necessary
if self.args['timestamp_format'] != 'none':
logevent._reformat_timestamp(self.args['... |
def sync_proxy(self, mri, block):
"""Abstract method telling the ClientComms to sync this proxy Block
with its remote counterpart. Should wait until it is connected
Args:
mri (str): The mri for the remote block
block (BlockModel): The local proxy Block to keep in sync
... | def function[sync_proxy, parameter[self, mri, block]]:
constant[Abstract method telling the ClientComms to sync this proxy Block
with its remote counterpart. Should wait until it is connected
Args:
mri (str): The mri for the remote block
block (BlockModel): The local pro... | keyword[def] identifier[sync_proxy] ( identifier[self] , identifier[mri] , identifier[block] ):
literal[string]
identifier[done_queue] = identifier[Queue] ()
identifier[self] . identifier[_queues] [ identifier[mri] ]= identifier[done_queue]
identifier[update_fields] = identifier[... | def sync_proxy(self, mri, block):
"""Abstract method telling the ClientComms to sync this proxy Block
with its remote counterpart. Should wait until it is connected
Args:
mri (str): The mri for the remote block
block (BlockModel): The local proxy Block to keep in sync
... |
def get_version_from_tag(tag_name: str) -> Optional[str]:
"""Get git hash from tag
:param tag_name: Name of the git tag (i.e. 'v1.0.0')
:return: sha1 hash of the commit
"""
debug('get_version_from_tag({})'.format(tag_name))
check_repo()
for i in repo.tags:
if i.name == tag_name:
... | def function[get_version_from_tag, parameter[tag_name]]:
constant[Get git hash from tag
:param tag_name: Name of the git tag (i.e. 'v1.0.0')
:return: sha1 hash of the commit
]
call[name[debug], parameter[call[constant[get_version_from_tag({})].format, parameter[name[tag_name]]]]]
ca... | keyword[def] identifier[get_version_from_tag] ( identifier[tag_name] : identifier[str] )-> identifier[Optional] [ identifier[str] ]:
literal[string]
identifier[debug] ( literal[string] . identifier[format] ( identifier[tag_name] ))
identifier[check_repo] ()
keyword[for] identifier[i] keyword[i... | def get_version_from_tag(tag_name: str) -> Optional[str]:
"""Get git hash from tag
:param tag_name: Name of the git tag (i.e. 'v1.0.0')
:return: sha1 hash of the commit
"""
debug('get_version_from_tag({})'.format(tag_name))
check_repo()
for i in repo.tags:
if i.name == tag_name:
... |
def enable_extended_scan_code_mode(self):
"""
Extended scan code mode means the Yubikey will output the bytes in
the 'fixed string' as scan codes, without modhex encoding the data.
Because of the way this is stored in the config flags, it is not
possible to disable this option o... | def function[enable_extended_scan_code_mode, parameter[self]]:
constant[
Extended scan code mode means the Yubikey will output the bytes in
the 'fixed string' as scan codes, without modhex encoding the data.
Because of the way this is stored in the config flags, it is not
possib... | keyword[def] identifier[enable_extended_scan_code_mode] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[capabilities] . identifier[have_extended_scan_code_mode] ():
keyword[raise]
identifier[self] . identifier[_require_version] (... | def enable_extended_scan_code_mode(self):
"""
Extended scan code mode means the Yubikey will output the bytes in
the 'fixed string' as scan codes, without modhex encoding the data.
Because of the way this is stored in the config flags, it is not
possible to disable this option once ... |
def _transition_steps(self, brightness=None):
"""
Get the maximum number of steps needed for a transition.
:param brightness: The brightness to transition to (0.0-1.0).
:return: The maximum number of steps.
"""
if brightness is not None:
self._assert_is_brigh... | def function[_transition_steps, parameter[self, brightness]]:
constant[
Get the maximum number of steps needed for a transition.
:param brightness: The brightness to transition to (0.0-1.0).
:return: The maximum number of steps.
]
if compare[name[brightness] is_not const... | keyword[def] identifier[_transition_steps] ( identifier[self] , identifier[brightness] = keyword[None] ):
literal[string]
keyword[if] identifier[brightness] keyword[is] keyword[not] keyword[None] :
identifier[self] . identifier[_assert_is_brightness] ( identifier[brightness] )
... | def _transition_steps(self, brightness=None):
"""
Get the maximum number of steps needed for a transition.
:param brightness: The brightness to transition to (0.0-1.0).
:return: The maximum number of steps.
"""
if brightness is not None:
self._assert_is_brightness(bright... |
def list_locked(**kwargs):
'''
Query the package database those packages which are
locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
CLI Example:
.. code-block:: bash
salt '*' pkg.list_locked
jail
List l... | def function[list_locked, parameter[]]:
constant[
Query the package database those packages which are
locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
CLI Example:
.. code-block:: bash
salt '*' pkg.list_locked
... | keyword[def] identifier[list_locked] (** identifier[kwargs] ):
literal[string]
keyword[return] [ literal[string] . identifier[format] ( identifier[pkgname] , identifier[version] ( identifier[pkgname] ,** identifier[kwargs] ))
keyword[for] identifier[pkgname] keyword[in] identifier[_lockcmd] ( liter... | def list_locked(**kwargs):
"""
Query the package database those packages which are
locked against reinstallation, modification or deletion.
Returns returns a list of package names with version strings
CLI Example:
.. code-block:: bash
salt '*' pkg.list_locked
jail
List l... |
def _url_search_builder(term, country='US', media='all', entity=None, attribute=None, limit=50):
"""
Builds the URL to perform the search based on the provided data
:param term: String. The URL-encoded text string you want to search for. Example: Steven Wilson.
The method will take care of ... | def function[_url_search_builder, parameter[term, country, media, entity, attribute, limit]]:
constant[
Builds the URL to perform the search based on the provided data
:param term: String. The URL-encoded text string you want to search for. Example: Steven Wilson.
The method will take c... | keyword[def] identifier[_url_search_builder] ( identifier[term] , identifier[country] = literal[string] , identifier[media] = literal[string] , identifier[entity] = keyword[None] , identifier[attribute] = keyword[None] , identifier[limit] = literal[int] ):
literal[string]
identifier[built_url] = identifier... | def _url_search_builder(term, country='US', media='all', entity=None, attribute=None, limit=50):
"""
Builds the URL to perform the search based on the provided data
:param term: String. The URL-encoded text string you want to search for. Example: Steven Wilson.
The method will take care of ... |
def f_iter_nodes(self, recursive=True, with_links=True, max_depth=None, predicate=None):
"""Iterates recursively (default) over nodes hanging below this group.
:param recursive: Whether to iterate the whole sub tree or only immediate children.
:param with_links: If links should be considered
... | def function[f_iter_nodes, parameter[self, recursive, with_links, max_depth, predicate]]:
constant[Iterates recursively (default) over nodes hanging below this group.
:param recursive: Whether to iterate the whole sub tree or only immediate children.
:param with_links: If links should be consi... | keyword[def] identifier[f_iter_nodes] ( identifier[self] , identifier[recursive] = keyword[True] , identifier[with_links] = keyword[True] , identifier[max_depth] = keyword[None] , identifier[predicate] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[_nn_interface] ... | def f_iter_nodes(self, recursive=True, with_links=True, max_depth=None, predicate=None):
"""Iterates recursively (default) over nodes hanging below this group.
:param recursive: Whether to iterate the whole sub tree or only immediate children.
:param with_links: If links should be considered
... |
def plot_depth_descent_ascent(depths, dive_mask, des, asc):
'''Plot depth data for whole deployment, descents, and ascents
Args
----
depths: ndarray
Depth values at each sensor sampling
dive_mask: ndarray
Boolean mask slicing dives from the tag data
des: ndarray
boolean ... | def function[plot_depth_descent_ascent, parameter[depths, dive_mask, des, asc]]:
constant[Plot depth data for whole deployment, descents, and ascents
Args
----
depths: ndarray
Depth values at each sensor sampling
dive_mask: ndarray
Boolean mask slicing dives from the tag data
... | keyword[def] identifier[plot_depth_descent_ascent] ( identifier[depths] , identifier[dive_mask] , identifier[des] , identifier[asc] ):
literal[string]
keyword[import] identifier[numpy]
keyword[from] . keyword[import] identifier[plotutils]
identifier[des_ind] = identifier[numpy] . ident... | def plot_depth_descent_ascent(depths, dive_mask, des, asc):
"""Plot depth data for whole deployment, descents, and ascents
Args
----
depths: ndarray
Depth values at each sensor sampling
dive_mask: ndarray
Boolean mask slicing dives from the tag data
des: ndarray
boolean ... |
def compile_less(input_file, output_file):
"""
Compile a LESS source file. Minifies the output in release mode.
"""
from .modules import less
if not isinstance(input_file, str):
raise RuntimeError('LESS compiler takes only a single input file.')
return {
'dependencies_fn': less... | def function[compile_less, parameter[input_file, output_file]]:
constant[
Compile a LESS source file. Minifies the output in release mode.
]
from relative_module[modules] import module[less]
if <ast.UnaryOp object at 0x7da204344c70> begin[:]
<ast.Raise object at 0x7da204345b70>
r... | keyword[def] identifier[compile_less] ( identifier[input_file] , identifier[output_file] ):
literal[string]
keyword[from] . identifier[modules] keyword[import] identifier[less]
keyword[if] keyword[not] identifier[isinstance] ( identifier[input_file] , identifier[str] ):
keyword[raise] ... | def compile_less(input_file, output_file):
"""
Compile a LESS source file. Minifies the output in release mode.
"""
from .modules import less
if not isinstance(input_file, str):
raise RuntimeError('LESS compiler takes only a single input file.') # depends on [control=['if'], data=[]]
re... |
def attachments(self):
"""Returns an object with:
type = file content type
file_name = the name of the file
contents = base64 encoded file contents"""
attachments = None
if 'attachment-info' in self.payload:
attachments = self._get_attachments(self.request)
... | def function[attachments, parameter[self]]:
constant[Returns an object with:
type = file content type
file_name = the name of the file
contents = base64 encoded file contents]
variable[attachments] assign[=] constant[None]
if compare[constant[attachment-info] in name[self... | keyword[def] identifier[attachments] ( identifier[self] ):
literal[string]
identifier[attachments] = keyword[None]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[payload] :
identifier[attachments] = identifier[self] . identifier[_get_attachments] ( i... | def attachments(self):
"""Returns an object with:
type = file content type
file_name = the name of the file
contents = base64 encoded file contents"""
attachments = None
if 'attachment-info' in self.payload:
attachments = self._get_attachments(self.request) # depends on [con... |
async def service_observable(self, limit) -> int:
"""
Service the observable's inBox and outBox
:return: the number of messages successfully serviced
"""
if not self.isReady():
return 0
o = self._service_observable_out_box(limit)
i = await self._obser... | <ast.AsyncFunctionDef object at 0x7da2044c0b50> | keyword[async] keyword[def] identifier[service_observable] ( identifier[self] , identifier[limit] )-> identifier[int] :
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[isReady] ():
keyword[return] literal[int]
identifier[o] = identifier[self] . iden... | async def service_observable(self, limit) -> int:
"""
Service the observable's inBox and outBox
:return: the number of messages successfully serviced
"""
if not self.isReady():
return 0 # depends on [control=['if'], data=[]]
o = self._service_observable_out_box(limit)
i... |
def return_action(self, return_action):
"""Sets the return_action of this ReturnSettings.
:param return_action: The return_action of this ReturnSettings.
:type: str
"""
allowed_values = ["refund", "storeCredit"] # noqa: E501
if return_action is not None and return_acti... | def function[return_action, parameter[self, return_action]]:
constant[Sets the return_action of this ReturnSettings.
:param return_action: The return_action of this ReturnSettings.
:type: str
]
variable[allowed_values] assign[=] list[[<ast.Constant object at 0x7da20c993f40>, <a... | keyword[def] identifier[return_action] ( identifier[self] , identifier[return_action] ):
literal[string]
identifier[allowed_values] =[ literal[string] , literal[string] ]
keyword[if] identifier[return_action] keyword[is] keyword[not] keyword[None] keyword[and] identifier[return_actio... | def return_action(self, return_action):
"""Sets the return_action of this ReturnSettings.
:param return_action: The return_action of this ReturnSettings.
:type: str
"""
allowed_values = ['refund', 'storeCredit'] # noqa: E501
if return_action is not None and return_action not in al... |
def logout(self):
"""logout func (quit browser)"""
try:
self.browser.quit()
except Exception:
raise exceptions.BrowserException(self.brow_name, "not started")
return False
self.vbro.stop()
logger.info("logged out")
return True | def function[logout, parameter[self]]:
constant[logout func (quit browser)]
<ast.Try object at 0x7da1b0e439a0>
call[name[self].vbro.stop, parameter[]]
call[name[logger].info, parameter[constant[logged out]]]
return[constant[True]] | keyword[def] identifier[logout] ( identifier[self] ):
literal[string]
keyword[try] :
identifier[self] . identifier[browser] . identifier[quit] ()
keyword[except] identifier[Exception] :
keyword[raise] identifier[exceptions] . identifier[BrowserException] ( ident... | def logout(self):
"""logout func (quit browser)"""
try:
self.browser.quit() # depends on [control=['try'], data=[]]
except Exception:
raise exceptions.BrowserException(self.brow_name, 'not started')
return False # depends on [control=['except'], data=[]]
self.vbro.stop()
lo... |
def move(self, path, raise_if_exists=False):
"""
Alias for ``rename()``
"""
self.rename(path, raise_if_exists=raise_if_exists) | def function[move, parameter[self, path, raise_if_exists]]:
constant[
Alias for ``rename()``
]
call[name[self].rename, parameter[name[path]]] | keyword[def] identifier[move] ( identifier[self] , identifier[path] , identifier[raise_if_exists] = keyword[False] ):
literal[string]
identifier[self] . identifier[rename] ( identifier[path] , identifier[raise_if_exists] = identifier[raise_if_exists] ) | def move(self, path, raise_if_exists=False):
"""
Alias for ``rename()``
"""
self.rename(path, raise_if_exists=raise_if_exists) |
def update_courses(self, event, account_id, course_ids):
"""
Update courses.
Update multiple courses in an account. Operates asynchronously; use the {api:ProgressController#show progress endpoint}
to query the status of an operation.
The action to take on each c... | def function[update_courses, parameter[self, event, account_id, course_ids]]:
constant[
Update courses.
Update multiple courses in an account. Operates asynchronously; use the {api:ProgressController#show progress endpoint}
to query the status of an operation.
The acti... | keyword[def] identifier[update_courses] ( identifier[self] , identifier[event] , identifier[account_id] , identifier[course_ids] ):
literal[string]
identifier[path] ={}
identifier[data] ={}
identifier[params] ={}
literal[string]
identifier[path... | def update_courses(self, event, account_id, course_ids):
"""
Update courses.
Update multiple courses in an account. Operates asynchronously; use the {api:ProgressController#show progress endpoint}
to query the status of an operation.
The action to take on each course. Mus... |
def lib(ctx,
filepath=None,
extra=False,
bootstrap=False,
cache=False,
reveal=False,
show=False,
save=False,
directory=False):
"""
LIBRARY: work with a local library of RDF models.
"""
verbose = ctx.obj['VERBOSE']
sTime = ctx.obj['STIME... | def function[lib, parameter[ctx, filepath, extra, bootstrap, cache, reveal, show, save, directory]]:
constant[
LIBRARY: work with a local library of RDF models.
]
variable[verbose] assign[=] call[name[ctx].obj][constant[VERBOSE]]
variable[sTime] assign[=] call[name[ctx].obj][constant[STI... | keyword[def] identifier[lib] ( identifier[ctx] ,
identifier[filepath] = keyword[None] ,
identifier[extra] = keyword[False] ,
identifier[bootstrap] = keyword[False] ,
identifier[cache] = keyword[False] ,
identifier[reveal] = keyword[False] ,
identifier[show] = keyword[False] ,
identifier[save] = keyword[False] ... | def lib(ctx, filepath=None, extra=False, bootstrap=False, cache=False, reveal=False, show=False, save=False, directory=False):
"""
LIBRARY: work with a local library of RDF models.
"""
verbose = ctx.obj['VERBOSE']
sTime = ctx.obj['STIME']
print_opts = {'labels': verbose}
DONE_ACTION = False
... |
def unregister(self, collector):
"""Remove a collector from the registry."""
with self._lock:
for name in self._collector_to_names[collector]:
del self._names_to_collectors[name]
del self._collector_to_names[collector] | def function[unregister, parameter[self, collector]]:
constant[Remove a collector from the registry.]
with name[self]._lock begin[:]
for taget[name[name]] in starred[call[name[self]._collector_to_names][name[collector]]] begin[:]
<ast.Delete object at 0x7da1b2179120>
... | keyword[def] identifier[unregister] ( identifier[self] , identifier[collector] ):
literal[string]
keyword[with] identifier[self] . identifier[_lock] :
keyword[for] identifier[name] keyword[in] identifier[self] . identifier[_collector_to_names] [ identifier[collector] ]:
... | def unregister(self, collector):
"""Remove a collector from the registry."""
with self._lock:
for name in self._collector_to_names[collector]:
del self._names_to_collectors[name] # depends on [control=['for'], data=['name']]
del self._collector_to_names[collector] # depends on [con... |
def message_info(exchange, routing_key, properties):
"""Return info about a message using the same conditional constructs
:param str exchange: The exchange the message was published to
:param str routing_key: The routing key used
:param properties: The AMQP message properties
:type properties: pika... | def function[message_info, parameter[exchange, routing_key, properties]]:
constant[Return info about a message using the same conditional constructs
:param str exchange: The exchange the message was published to
:param str routing_key: The routing key used
:param properties: The AMQP message proper... | keyword[def] identifier[message_info] ( identifier[exchange] , identifier[routing_key] , identifier[properties] ):
literal[string]
identifier[output] =[]
keyword[if] identifier[properties] . identifier[message_id] :
identifier[output] . identifier[append] ( identifier[properties] . identifie... | def message_info(exchange, routing_key, properties):
"""Return info about a message using the same conditional constructs
:param str exchange: The exchange the message was published to
:param str routing_key: The routing key used
:param properties: The AMQP message properties
:type properties: pika... |
def convert_pint_to_fortran_safe_units(units, inverse=False):
"""
Convert Pint units to Fortran safe units
Parameters
----------
units : list_like, str
Units to convert
inverse : bool
If True, convert the other way i.e. convert Fortran safe units to Pint units
Returns
... | def function[convert_pint_to_fortran_safe_units, parameter[units, inverse]]:
constant[
Convert Pint units to Fortran safe units
Parameters
----------
units : list_like, str
Units to convert
inverse : bool
If True, convert the other way i.e. convert Fortran safe units to Pin... | keyword[def] identifier[convert_pint_to_fortran_safe_units] ( identifier[units] , identifier[inverse] = keyword[False] ):
literal[string]
keyword[if] identifier[inverse] :
keyword[return] identifier[apply_string_substitutions] ( identifier[units] , identifier[FORTRAN_SAFE_TO_PINT_UNITS_MAPPING] ... | def convert_pint_to_fortran_safe_units(units, inverse=False):
"""
Convert Pint units to Fortran safe units
Parameters
----------
units : list_like, str
Units to convert
inverse : bool
If True, convert the other way i.e. convert Fortran safe units to Pint units
Returns
... |
def scale_to_vol(self, vol):
"""Scale ball to encompass a target volume."""
f = (vol / self.vol_ball) ** (1.0 / self.n) # linear factor
self.expand *= f
self.radius *= f
self.vol_ball = vol | def function[scale_to_vol, parameter[self, vol]]:
constant[Scale ball to encompass a target volume.]
variable[f] assign[=] binary_operation[binary_operation[name[vol] / name[self].vol_ball] ** binary_operation[constant[1.0] / name[self].n]]
<ast.AugAssign object at 0x7da1b1ed5cf0>
<ast.AugAssign... | keyword[def] identifier[scale_to_vol] ( identifier[self] , identifier[vol] ):
literal[string]
identifier[f] =( identifier[vol] / identifier[self] . identifier[vol_ball] )**( literal[int] / identifier[self] . identifier[n] )
identifier[self] . identifier[expand] *= identifier[f]
... | def scale_to_vol(self, vol):
"""Scale ball to encompass a target volume."""
f = (vol / self.vol_ball) ** (1.0 / self.n) # linear factor
self.expand *= f
self.radius *= f
self.vol_ball = vol |
def clear_to_reset(self, config_vars):
"""Clear all volatile information across a reset."""
self._logger.info("Config vars in sensor log reset: %s", config_vars)
super(SensorLogSubsystem, self).clear_to_reset(config_vars)
self.storage.destroy_all_walkers()
self.dump_walker = No... | def function[clear_to_reset, parameter[self, config_vars]]:
constant[Clear all volatile information across a reset.]
call[name[self]._logger.info, parameter[constant[Config vars in sensor log reset: %s], name[config_vars]]]
call[call[name[super], parameter[name[SensorLogSubsystem], name[self]]].... | keyword[def] identifier[clear_to_reset] ( identifier[self] , identifier[config_vars] ):
literal[string]
identifier[self] . identifier[_logger] . identifier[info] ( literal[string] , identifier[config_vars] )
identifier[super] ( identifier[SensorLogSubsystem] , identifier[self] ). identifi... | def clear_to_reset(self, config_vars):
"""Clear all volatile information across a reset."""
self._logger.info('Config vars in sensor log reset: %s', config_vars)
super(SensorLogSubsystem, self).clear_to_reset(config_vars)
self.storage.destroy_all_walkers()
self.dump_walker = None
if config_vars.... |
def delay(self, amount, pid, method, *args):
"""Call a method on another process after a specified delay.
This is equivalent to ``dispatch`` except with an additional amount of
time to wait prior to invoking the call.
This function returns immediately.
:param amount: The amount of time to wait in... | def function[delay, parameter[self, amount, pid, method]]:
constant[Call a method on another process after a specified delay.
This is equivalent to ``dispatch`` except with an additional amount of
time to wait prior to invoking the call.
This function returns immediately.
:param amount: The a... | keyword[def] identifier[delay] ( identifier[self] , identifier[amount] , identifier[pid] , identifier[method] ,* identifier[args] ):
literal[string]
identifier[self] . identifier[_assert_started] ()
identifier[self] . identifier[_assert_local_pid] ( identifier[pid] )
identifier[function] = identi... | def delay(self, amount, pid, method, *args):
"""Call a method on another process after a specified delay.
This is equivalent to ``dispatch`` except with an additional amount of
time to wait prior to invoking the call.
This function returns immediately.
:param amount: The amount of time to wait in... |
def update_terminal_size():
"""Propagate the terminal size to the remote shells accounting for the
place taken by the longest name"""
w, h = terminal_size()
w = max(w - display_names.max_display_name_length - 2, min(w, 10))
# python bug http://python.org/sf/1112949 on amd64
# from ajaxterm.py
... | def function[update_terminal_size, parameter[]]:
constant[Propagate the terminal size to the remote shells accounting for the
place taken by the longest name]
<ast.Tuple object at 0x7da204344790> assign[=] call[name[terminal_size], parameter[]]
variable[w] assign[=] call[name[max], parameter... | keyword[def] identifier[update_terminal_size] ():
literal[string]
identifier[w] , identifier[h] = identifier[terminal_size] ()
identifier[w] = identifier[max] ( identifier[w] - identifier[display_names] . identifier[max_display_name_length] - literal[int] , identifier[min] ( identifier[w] , literal[in... | def update_terminal_size():
"""Propagate the terminal size to the remote shells accounting for the
place taken by the longest name"""
(w, h) = terminal_size()
w = max(w - display_names.max_display_name_length - 2, min(w, 10))
# python bug http://python.org/sf/1112949 on amd64
# from ajaxterm.py
... |
def tocimxml(self):
"""
Return the CIM-XML representation of this CIM property,
as an object of an appropriate subclass of :term:`Element`.
The returned CIM-XML representation is a `PROPERTY`,
`PROPERTY.REFERENCE`, or `PROPERTY.ARRAY` element dependent on the
property ty... | def function[tocimxml, parameter[self]]:
constant[
Return the CIM-XML representation of this CIM property,
as an object of an appropriate subclass of :term:`Element`.
The returned CIM-XML representation is a `PROPERTY`,
`PROPERTY.REFERENCE`, or `PROPERTY.ARRAY` element dependent... | keyword[def] identifier[tocimxml] ( identifier[self] ):
literal[string]
identifier[qualifiers] =[ identifier[q] . identifier[tocimxml] () keyword[for] identifier[q] keyword[in] identifier[self] . identifier[qualifiers] . identifier[values] ()]
keyword[if] identifier[self] . identifie... | def tocimxml(self):
"""
Return the CIM-XML representation of this CIM property,
as an object of an appropriate subclass of :term:`Element`.
The returned CIM-XML representation is a `PROPERTY`,
`PROPERTY.REFERENCE`, or `PROPERTY.ARRAY` element dependent on the
property type, ... |
def setup_failure(self, scenario=None, **args):
"""Add a given failure scenario
@param scenario: string 'delayrequests' or 'crash'
"""
assert scenario is not None and scenario in self.functiondict
self.functiondict[scenario](**args) | def function[setup_failure, parameter[self, scenario]]:
constant[Add a given failure scenario
@param scenario: string 'delayrequests' or 'crash'
]
assert[<ast.BoolOp object at 0x7da2047eb520>]
call[call[name[self].functiondict][name[scenario]], parameter[]] | keyword[def] identifier[setup_failure] ( identifier[self] , identifier[scenario] = keyword[None] ,** identifier[args] ):
literal[string]
keyword[assert] identifier[scenario] keyword[is] keyword[not] keyword[None] keyword[and] identifier[scenario] keyword[in] identifier[self] . identifier[fu... | def setup_failure(self, scenario=None, **args):
"""Add a given failure scenario
@param scenario: string 'delayrequests' or 'crash'
"""
assert scenario is not None and scenario in self.functiondict
self.functiondict[scenario](**args) |
def sawtooth(ATTITUDE, amplitude=2.0, period=5.0):
'''sawtooth pattern based on uptime'''
mins = (ATTITUDE.usec * 1.0e-6)/60
p = fmod(mins, period*2)
if p < period:
return amplitude * (p/period)
return amplitude * (period - (p-period))/period | def function[sawtooth, parameter[ATTITUDE, amplitude, period]]:
constant[sawtooth pattern based on uptime]
variable[mins] assign[=] binary_operation[binary_operation[name[ATTITUDE].usec * constant[1e-06]] / constant[60]]
variable[p] assign[=] call[name[fmod], parameter[name[mins], binary_operati... | keyword[def] identifier[sawtooth] ( identifier[ATTITUDE] , identifier[amplitude] = literal[int] , identifier[period] = literal[int] ):
literal[string]
identifier[mins] =( identifier[ATTITUDE] . identifier[usec] * literal[int] )/ literal[int]
identifier[p] = identifier[fmod] ( identifier[mins] , ident... | def sawtooth(ATTITUDE, amplitude=2.0, period=5.0):
"""sawtooth pattern based on uptime"""
mins = ATTITUDE.usec * 1e-06 / 60
p = fmod(mins, period * 2)
if p < period:
return amplitude * (p / period) # depends on [control=['if'], data=['p', 'period']]
return amplitude * (period - (p - period)... |
def alleles_to_retrieve(df):
"""Alleles to retrieve from genome fasta
Get a dict of the genome fasta contig title to a list of blastn results of the allele sequences that must be
retrieved from the genome contig.
Args:
df (pandas.DataFrame): blastn results dataframe
Returns:
{str:... | def function[alleles_to_retrieve, parameter[df]]:
constant[Alleles to retrieve from genome fasta
Get a dict of the genome fasta contig title to a list of blastn results of the allele sequences that must be
retrieved from the genome contig.
Args:
df (pandas.DataFrame): blastn results datafr... | keyword[def] identifier[alleles_to_retrieve] ( identifier[df] ):
literal[string]
identifier[contig_blastn_records] = identifier[defaultdict] ( identifier[list] )
identifier[markers] = identifier[df] . identifier[marker] . identifier[unique] ()
keyword[for] identifier[m] keyword[in] identifier[... | def alleles_to_retrieve(df):
"""Alleles to retrieve from genome fasta
Get a dict of the genome fasta contig title to a list of blastn results of the allele sequences that must be
retrieved from the genome contig.
Args:
df (pandas.DataFrame): blastn results dataframe
Returns:
{str:... |
def list_models(self, limit=-1, offset=-1):
"""List models in the database. Takes optional parameters limit and
offset for pagination.
Parameters
----------
limit : int
Limit number of models in the result set
offset : int
Set offset in list (orde... | def function[list_models, parameter[self, limit, offset]]:
constant[List models in the database. Takes optional parameters limit and
offset for pagination.
Parameters
----------
limit : int
Limit number of models in the result set
offset : int
Set... | keyword[def] identifier[list_models] ( identifier[self] , identifier[limit] =- literal[int] , identifier[offset] =- literal[int] ):
literal[string]
keyword[return] identifier[self] . identifier[list_objects] ( identifier[limit] = identifier[limit] , identifier[offset] = identifier[offset] ) | def list_models(self, limit=-1, offset=-1):
"""List models in the database. Takes optional parameters limit and
offset for pagination.
Parameters
----------
limit : int
Limit number of models in the result set
offset : int
Set offset in list (order as... |
def start(self):
"""Start processing streams."""
def cb():
time_ = time.time()
log.debug('Step {}'.format(time_))
# run a step on all streams
for d in self._dstreams:
d._step(time_)
self._pcb = PeriodicCallback(cb, self.batch_dur... | def function[start, parameter[self]]:
constant[Start processing streams.]
def function[cb, parameter[]]:
variable[time_] assign[=] call[name[time].time, parameter[]]
call[name[log].debug, parameter[call[constant[Step {}].format, parameter[name[time_]]]]]
f... | keyword[def] identifier[start] ( identifier[self] ):
literal[string]
keyword[def] identifier[cb] ():
identifier[time_] = identifier[time] . identifier[time] ()
identifier[log] . identifier[debug] ( literal[string] . identifier[format] ( identifier[time_] ))
... | def start(self):
"""Start processing streams."""
def cb():
time_ = time.time()
log.debug('Step {}'.format(time_))
# run a step on all streams
for d in self._dstreams:
d._step(time_) # depends on [control=['for'], data=['d']]
self._pcb = PeriodicCallback(cb, self... |
def install_dir(pkgpath, install_path, register_func, delete_after_install=False):
"""Install plugin from specified directory.
install_path and register_func are same as :func:`install_plugin`.
:param delete_after_install: Delete pkgpath after install (used in :func:`install_from_zip`).
"""
logger.... | def function[install_dir, parameter[pkgpath, install_path, register_func, delete_after_install]]:
constant[Install plugin from specified directory.
install_path and register_func are same as :func:`install_plugin`.
:param delete_after_install: Delete pkgpath after install (used in :func:`install_from_z... | keyword[def] identifier[install_dir] ( identifier[pkgpath] , identifier[install_path] , identifier[register_func] , identifier[delete_after_install] = keyword[False] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] , identifier[pkgpath] )
identifier[plugin] = identifier[regi... | def install_dir(pkgpath, install_path, register_func, delete_after_install=False):
"""Install plugin from specified directory.
install_path and register_func are same as :func:`install_plugin`.
:param delete_after_install: Delete pkgpath after install (used in :func:`install_from_zip`).
"""
logger.... |
def average_last_builds(connection, package, limit=5):
"""
Find the average duration time for the last couple of builds.
:param connection: txkoji.Connection
:param package: package name
:returns: deferred that when fired returns a datetime.timedelta object, or
None if there were no p... | def function[average_last_builds, parameter[connection, package, limit]]:
constant[
Find the average duration time for the last couple of builds.
:param connection: txkoji.Connection
:param package: package name
:returns: deferred that when fired returns a datetime.timedelta object, or
... | keyword[def] identifier[average_last_builds] ( identifier[connection] , identifier[package] , identifier[limit] = literal[int] ):
literal[string]
identifier[state] = identifier[build_states] . identifier[COMPLETE]
identifier[opts] ={ literal[string] : identifier[limit] , literal[string] : l... | def average_last_builds(connection, package, limit=5):
"""
Find the average duration time for the last couple of builds.
:param connection: txkoji.Connection
:param package: package name
:returns: deferred that when fired returns a datetime.timedelta object, or
None if there were no p... |
def _repack_pkgs(pkgs, normalize=True):
'''
Repack packages specified using "pkgs" argument to pkg states into a single
dictionary
'''
if normalize and 'pkg.normalize_name' in __salt__:
_normalize_name = __salt__['pkg.normalize_name']
else:
_normalize_name = lambda pkgname: pkgna... | def function[_repack_pkgs, parameter[pkgs, normalize]]:
constant[
Repack packages specified using "pkgs" argument to pkg states into a single
dictionary
]
if <ast.BoolOp object at 0x7da1b20467a0> begin[:]
variable[_normalize_name] assign[=] call[name[__salt__]][constant[pkg.n... | keyword[def] identifier[_repack_pkgs] ( identifier[pkgs] , identifier[normalize] = keyword[True] ):
literal[string]
keyword[if] identifier[normalize] keyword[and] literal[string] keyword[in] identifier[__salt__] :
identifier[_normalize_name] = identifier[__salt__] [ literal[string] ]
key... | def _repack_pkgs(pkgs, normalize=True):
"""
Repack packages specified using "pkgs" argument to pkg states into a single
dictionary
"""
if normalize and 'pkg.normalize_name' in __salt__:
_normalize_name = __salt__['pkg.normalize_name'] # depends on [control=['if'], data=[]]
else:
... |
def indication(self, pdu):
"""Direct this PDU to the appropriate server, create a
connection if one hasn't already been created."""
if _debug: TCPClientDirector._debug("indication %r", pdu)
# get the destination
addr = pdu.pduDestination
# get the client
client ... | def function[indication, parameter[self, pdu]]:
constant[Direct this PDU to the appropriate server, create a
connection if one hasn't already been created.]
if name[_debug] begin[:]
call[name[TCPClientDirector]._debug, parameter[constant[indication %r], name[pdu]]]
variab... | keyword[def] identifier[indication] ( identifier[self] , identifier[pdu] ):
literal[string]
keyword[if] identifier[_debug] : identifier[TCPClientDirector] . identifier[_debug] ( literal[string] , identifier[pdu] )
identifier[addr] = identifier[pdu] . identifier[pduDestination]
... | def indication(self, pdu):
"""Direct this PDU to the appropriate server, create a
connection if one hasn't already been created."""
if _debug:
TCPClientDirector._debug('indication %r', pdu) # depends on [control=['if'], data=[]]
# get the destination
addr = pdu.pduDestination
# get ... |
def conditionOnState(self,state_index):
'''
Temporarily assume that a particular Markov state will occur in the
succeeding period, and condition solver attributes on this assumption.
Allows the solver to construct the future-state-conditional marginal
value function (etc) for tha... | def function[conditionOnState, parameter[self, state_index]]:
constant[
Temporarily assume that a particular Markov state will occur in the
succeeding period, and condition solver attributes on this assumption.
Allows the solver to construct the future-state-conditional marginal
... | keyword[def] identifier[conditionOnState] ( identifier[self] , identifier[state_index] ):
literal[string]
identifier[self] . identifier[IncomeDstn] = identifier[self] . identifier[IncomeDstn_list] [ identifier[state_index] ]
identifier[self] . identifier[Rfree] = identifier[self] ... | def conditionOnState(self, state_index):
"""
Temporarily assume that a particular Markov state will occur in the
succeeding period, and condition solver attributes on this assumption.
Allows the solver to construct the future-state-conditional marginal
value function (etc) for that f... |
def full_width_svg(url, width, height, alt_text=None):
''' Helper to render an SVG that will size to fill
its element while keeping its dimentions.
'''
return {
'ratio': str((float(height)/float(width))*100)[:2],
'url': url,
'alt_text': alt_text
} | def function[full_width_svg, parameter[url, width, height, alt_text]]:
constant[ Helper to render an SVG that will size to fill
its element while keeping its dimentions.
]
return[dictionary[[<ast.Constant object at 0x7da18f8119c0>, <ast.Constant object at 0x7da18f811f90>, <ast.Constant obje... | keyword[def] identifier[full_width_svg] ( identifier[url] , identifier[width] , identifier[height] , identifier[alt_text] = keyword[None] ):
literal[string]
keyword[return] {
literal[string] : identifier[str] (( identifier[float] ( identifier[height] )/ identifier[float] ( identifier[width] ))* liter... | def full_width_svg(url, width, height, alt_text=None):
""" Helper to render an SVG that will size to fill
its element while keeping its dimentions.
"""
return {'ratio': str(float(height) / float(width) * 100)[:2], 'url': url, 'alt_text': alt_text} |
def run(*extractor_list, **kwargs):
"""Parse arguments provided on the commandline and execute extractors."""
args = _get_args(kwargs.get('args'))
n_extractors = len(extractor_list)
log.info('Going to run list of {} FeatureExtractors'.format(n_extractors))
collection = fex.Collection(cache_path=args... | def function[run, parameter[]]:
constant[Parse arguments provided on the commandline and execute extractors.]
variable[args] assign[=] call[name[_get_args], parameter[call[name[kwargs].get, parameter[constant[args]]]]]
variable[n_extractors] assign[=] call[name[len], parameter[name[extractor_lis... | keyword[def] identifier[run] (* identifier[extractor_list] ,** identifier[kwargs] ):
literal[string]
identifier[args] = identifier[_get_args] ( identifier[kwargs] . identifier[get] ( literal[string] ))
identifier[n_extractors] = identifier[len] ( identifier[extractor_list] )
identifier[log] . ide... | def run(*extractor_list, **kwargs):
"""Parse arguments provided on the commandline and execute extractors."""
args = _get_args(kwargs.get('args'))
n_extractors = len(extractor_list)
log.info('Going to run list of {} FeatureExtractors'.format(n_extractors))
collection = fex.Collection(cache_path=args... |
def createDataFromFile(self, filePath, inputEncoding = None, defaultFps = None):
"""Fetch a given filePath and parse its contents.
May raise the following exceptions:
* RuntimeError - generic exception telling that parsing was unsuccessfull
* IOError - failed to open a file at given fil... | def function[createDataFromFile, parameter[self, filePath, inputEncoding, defaultFps]]:
constant[Fetch a given filePath and parse its contents.
May raise the following exceptions:
* RuntimeError - generic exception telling that parsing was unsuccessfull
* IOError - failed to open a file... | keyword[def] identifier[createDataFromFile] ( identifier[self] , identifier[filePath] , identifier[inputEncoding] = keyword[None] , identifier[defaultFps] = keyword[None] ):
literal[string]
identifier[file_] = identifier[File] ( identifier[filePath] )
keyword[if] identifier[inputEncoding... | def createDataFromFile(self, filePath, inputEncoding=None, defaultFps=None):
"""Fetch a given filePath and parse its contents.
May raise the following exceptions:
* RuntimeError - generic exception telling that parsing was unsuccessfull
* IOError - failed to open a file at given filePath
... |
def get_bio(self, section, language=None):
"""
Returns a section of the bio.
section can be "content", "summary" or
"published" (for published date)
"""
if language:
params = self._get_params()
params["lang"] = language
else:
... | def function[get_bio, parameter[self, section, language]]:
constant[
Returns a section of the bio.
section can be "content", "summary" or
"published" (for published date)
]
if name[language] begin[:]
variable[params] assign[=] call[name[self]._get_para... | keyword[def] identifier[get_bio] ( identifier[self] , identifier[section] , identifier[language] = keyword[None] ):
literal[string]
keyword[if] identifier[language] :
identifier[params] = identifier[self] . identifier[_get_params] ()
identifier[params] [ literal[string] ]... | def get_bio(self, section, language=None):
"""
Returns a section of the bio.
section can be "content", "summary" or
"published" (for published date)
"""
if language:
params = self._get_params()
params['lang'] = language # depends on [control=['if'], data=[]]
... |
def serialise(self):
"""Creates standard market book json response,
will error if EX_MARKET_DEF not incl.
"""
return {
'marketId': self.market_id,
'totalAvailable': None,
'isMarketDataDelayed': None,
'lastMatchTime': None,
'betD... | def function[serialise, parameter[self]]:
constant[Creates standard market book json response,
will error if EX_MARKET_DEF not incl.
]
return[dictionary[[<ast.Constant object at 0x7da1b15f1390>, <ast.Constant object at 0x7da1b15f3280>, <ast.Constant object at 0x7da1b15f06d0>, <ast.Constant o... | keyword[def] identifier[serialise] ( identifier[self] ):
literal[string]
keyword[return] {
literal[string] : identifier[self] . identifier[market_id] ,
literal[string] : keyword[None] ,
literal[string] : keyword[None] ,
literal[string] : keyword[None] ,
... | def serialise(self):
"""Creates standard market book json response,
will error if EX_MARKET_DEF not incl.
""" # used in lightweight
return {'marketId': self.market_id, 'totalAvailable': None, 'isMarketDataDelayed': None, 'lastMatchTime': None, 'betDelay': self.market_definition.get('betDelay'),... |
def serialize(obj):
"""Takes a object and produces a dict-like representation
:param obj: the object to serialize
"""
if isinstance(obj, list):
return [serialize(o) for o in obj]
return GenericSerializer(ModelProviderImpl()).serialize(obj) | def function[serialize, parameter[obj]]:
constant[Takes a object and produces a dict-like representation
:param obj: the object to serialize
]
if call[name[isinstance], parameter[name[obj], name[list]]] begin[:]
return[<ast.ListComp object at 0x7da18f58e6b0>]
return[call[call[name[G... | keyword[def] identifier[serialize] ( identifier[obj] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[obj] , identifier[list] ):
keyword[return] [ identifier[serialize] ( identifier[o] ) keyword[for] identifier[o] keyword[in] identifier[obj] ]
keyword[return] identifier... | def serialize(obj):
"""Takes a object and produces a dict-like representation
:param obj: the object to serialize
"""
if isinstance(obj, list):
return [serialize(o) for o in obj] # depends on [control=['if'], data=[]]
return GenericSerializer(ModelProviderImpl()).serialize(obj) |
def unassign_asset_from_repository(self, asset_id, repository_id):
"""Removes an ``Asset`` from a ``Repository``.
arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset``
arg: repository_id (osid.id.Id): the ``Id`` of the
``Repository``
raise: NotFound - ``asset_id... | def function[unassign_asset_from_repository, parameter[self, asset_id, repository_id]]:
constant[Removes an ``Asset`` from a ``Repository``.
arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset``
arg: repository_id (osid.id.Id): the ``Id`` of the
``Repository``
ra... | keyword[def] identifier[unassign_asset_from_repository] ( identifier[self] , identifier[asset_id] , identifier[repository_id] ):
literal[string]
identifier[mgr] = identifier[self] . identifier[_get_provider_manager] ( literal[string] , identifier[local] = keyword[True] )
... | def unassign_asset_from_repository(self, asset_id, repository_id):
"""Removes an ``Asset`` from a ``Repository``.
arg: asset_id (osid.id.Id): the ``Id`` of the ``Asset``
arg: repository_id (osid.id.Id): the ``Id`` of the
``Repository``
raise: NotFound - ``asset_id`` o... |
def vectorized_sunday_to_monday(dtix):
"""A vectorized implementation of
:func:`pandas.tseries.holiday.sunday_to_monday`.
Parameters
----------
dtix : pd.DatetimeIndex
The index to shift sundays to mondays.
Returns
-------
sundays_as_mondays : pd.DatetimeIndex
``dtix`` ... | def function[vectorized_sunday_to_monday, parameter[dtix]]:
constant[A vectorized implementation of
:func:`pandas.tseries.holiday.sunday_to_monday`.
Parameters
----------
dtix : pd.DatetimeIndex
The index to shift sundays to mondays.
Returns
-------
sundays_as_mondays : pd.... | keyword[def] identifier[vectorized_sunday_to_monday] ( identifier[dtix] ):
literal[string]
identifier[values] = identifier[dtix] . identifier[values] . identifier[copy] ()
identifier[values] [ identifier[dtix] . identifier[weekday] == literal[int] ]+= identifier[np] . identifier[timedelta64] ( literal... | def vectorized_sunday_to_monday(dtix):
"""A vectorized implementation of
:func:`pandas.tseries.holiday.sunday_to_monday`.
Parameters
----------
dtix : pd.DatetimeIndex
The index to shift sundays to mondays.
Returns
-------
sundays_as_mondays : pd.DatetimeIndex
``dtix`` ... |
def addInput(self, key):
"""Add key to input : key, value or map
"""
if key not in self.inputs:
self.inputs.append(key)
root = self.etree
t_inputs = root.find('inputs')
if not t_inputs :
t_inputs = ctree.SubElement(root, 'inputs')
t_inpu... | def function[addInput, parameter[self, key]]:
constant[Add key to input : key, value or map
]
if compare[name[key] <ast.NotIn object at 0x7da2590d7190> name[self].inputs] begin[:]
call[name[self].inputs.append, parameter[name[key]]]
variable[root] assign[=] name[self].etr... | keyword[def] identifier[addInput] ( identifier[self] , identifier[key] ):
literal[string]
keyword[if] identifier[key] keyword[not] keyword[in] identifier[self] . identifier[inputs] :
identifier[self] . identifier[inputs] . identifier[append] ( identifier[key] )
identifier... | def addInput(self, key):
"""Add key to input : key, value or map
"""
if key not in self.inputs:
self.inputs.append(key) # depends on [control=['if'], data=['key']]
root = self.etree
t_inputs = root.find('inputs')
if not t_inputs:
t_inputs = ctree.SubElement(root, 'inputs') ... |
def create(cls, repo, path, ref='HEAD', message=None, force=False, **kwargs):
"""Create a new tag reference.
:param path:
The name of the tag, i.e. 1.0 or releases/1.0.
The prefix refs/tags is implied
:param ref:
A reference to the object you want to tag. It... | def function[create, parameter[cls, repo, path, ref, message, force]]:
constant[Create a new tag reference.
:param path:
The name of the tag, i.e. 1.0 or releases/1.0.
The prefix refs/tags is implied
:param ref:
A reference to the object you want to tag. It ... | keyword[def] identifier[create] ( identifier[cls] , identifier[repo] , identifier[path] , identifier[ref] = literal[string] , identifier[message] = keyword[None] , identifier[force] = keyword[False] ,** identifier[kwargs] ):
literal[string]
identifier[args] =( identifier[path] , identifier[ref] )
... | def create(cls, repo, path, ref='HEAD', message=None, force=False, **kwargs):
"""Create a new tag reference.
:param path:
The name of the tag, i.e. 1.0 or releases/1.0.
The prefix refs/tags is implied
:param ref:
A reference to the object you want to tag. It can... |
def is_valid(isbn_id):
"""
Check that a given string is a valid ISBN.
:param isbn_id: the isbn to be checked.
:returns: boolean indicating whether the isbn is valid or not.
>>> is_valid("978-3-16-148410-0")
True
>>> is_valid("9783161484100")
True
>>> is_valid("9783161484100aa")
... | def function[is_valid, parameter[isbn_id]]:
constant[
Check that a given string is a valid ISBN.
:param isbn_id: the isbn to be checked.
:returns: boolean indicating whether the isbn is valid or not.
>>> is_valid("978-3-16-148410-0")
True
>>> is_valid("9783161484100")
True
>>... | keyword[def] identifier[is_valid] ( identifier[isbn_id] ):
literal[string]
keyword[return] (
( keyword[not] identifier[isbnlib] . identifier[notisbn] ( identifier[isbn_id] )) keyword[and] (
identifier[isbnlib] . identifier[get_canonical_isbn] ( identifier[isbn_id] )== identifier[isbn_id] keyword... | def is_valid(isbn_id):
"""
Check that a given string is a valid ISBN.
:param isbn_id: the isbn to be checked.
:returns: boolean indicating whether the isbn is valid or not.
>>> is_valid("978-3-16-148410-0")
True
>>> is_valid("9783161484100")
True
>>> is_valid("9783161484100aa")
... |
def get_collection(self, **kwargs):
"""We need special get collection method to address issue in 11.5.4
In 11.5.4 collection 'items' were nested under 'policiesReference'
key. This has caused get_collection() calls to return empty list.
This fix will update the list if the policiesRefer... | def function[get_collection, parameter[self]]:
constant[We need special get collection method to address issue in 11.5.4
In 11.5.4 collection 'items' were nested under 'policiesReference'
key. This has caused get_collection() calls to return empty list.
This fix will update the list if ... | keyword[def] identifier[get_collection] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[list_of_contents] =[]
identifier[self] . identifier[refresh] (** identifier[kwargs] )
keyword[if] literal[string] keyword[in] identifier[self] . identifier[__dict__] ... | def get_collection(self, **kwargs):
"""We need special get collection method to address issue in 11.5.4
In 11.5.4 collection 'items' were nested under 'policiesReference'
key. This has caused get_collection() calls to return empty list.
This fix will update the list if the policiesReference... |
def will_print(level=1):
"""Returns True if the current global status of messaging would print a
message using any of the printing functions in this module.
"""
if level == 1:
#We only affect printability using the quiet setting.
return quiet is None or quiet == False
else:
r... | def function[will_print, parameter[level]]:
constant[Returns True if the current global status of messaging would print a
message using any of the printing functions in this module.
]
if compare[name[level] equal[==] constant[1]] begin[:]
return[<ast.BoolOp object at 0x7da20cabf280>] | keyword[def] identifier[will_print] ( identifier[level] = literal[int] ):
literal[string]
keyword[if] identifier[level] == literal[int] :
keyword[return] identifier[quiet] keyword[is] keyword[None] keyword[or] identifier[quiet] == keyword[False]
keyword[else] :
keyword[re... | def will_print(level=1):
"""Returns True if the current global status of messaging would print a
message using any of the printing functions in this module.
"""
if level == 1:
#We only affect printability using the quiet setting.
return quiet is None or quiet == False # depends on [cont... |
def augknt(knots, order):
"""Augment a knot vector.
Parameters:
knots:
Python list or rank-1 array, the original knot vector (without endpoint repeats)
order:
int, >= 0, order of spline
Returns:
list_of_knots:
rank-1 array that has (`order` + 1) copies of ``knots[0]``, then ``k... | def function[augknt, parameter[knots, order]]:
constant[Augment a knot vector.
Parameters:
knots:
Python list or rank-1 array, the original knot vector (without endpoint repeats)
order:
int, >= 0, order of spline
Returns:
list_of_knots:
rank-1 array that has (`order` + 1) c... | keyword[def] identifier[augknt] ( identifier[knots] , identifier[order] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[knots] , identifier[np] . identifier[ndarray] ) keyword[and] identifier[knots] . identifier[ndim] > literal[int] :
keyword[raise] identifier[ValueError] ( l... | def augknt(knots, order):
"""Augment a knot vector.
Parameters:
knots:
Python list or rank-1 array, the original knot vector (without endpoint repeats)
order:
int, >= 0, order of spline
Returns:
list_of_knots:
rank-1 array that has (`order` + 1) copies of ``knots[0]``, then ``k... |
def set_directory(robject):
"""
Context manager to temporarily set the directory of a ROOT object
(if possible)
"""
if (not hasattr(robject, 'GetDirectory') or
not hasattr(robject, 'SetDirectory')):
log.warning("Cannot set the directory of a `{0}`".format(
type(robject)))... | def function[set_directory, parameter[robject]]:
constant[
Context manager to temporarily set the directory of a ROOT object
(if possible)
]
if <ast.BoolOp object at 0x7da1b1128d60> begin[:]
call[name[log].warning, parameter[call[constant[Cannot set the directory of a `{0}`].... | keyword[def] identifier[set_directory] ( identifier[robject] ):
literal[string]
keyword[if] ( keyword[not] identifier[hasattr] ( identifier[robject] , literal[string] ) keyword[or]
keyword[not] identifier[hasattr] ( identifier[robject] , literal[string] )):
identifier[log] . identifier[war... | def set_directory(robject):
"""
Context manager to temporarily set the directory of a ROOT object
(if possible)
"""
if not hasattr(robject, 'GetDirectory') or not hasattr(robject, 'SetDirectory'):
log.warning('Cannot set the directory of a `{0}`'.format(type(robject)))
# Do nothing
... |
def y0(x, context=None):
"""
Return the value of the second kind Bessel function of order 0 at x.
"""
return _apply_function_in_current_context(
BigFloat,
mpfr.mpfr_y0,
(BigFloat._implicit_convert(x),),
context,
) | def function[y0, parameter[x, context]]:
constant[
Return the value of the second kind Bessel function of order 0 at x.
]
return[call[name[_apply_function_in_current_context], parameter[name[BigFloat], name[mpfr].mpfr_y0, tuple[[<ast.Call object at 0x7da20c76d990>]], name[context]]]] | keyword[def] identifier[y0] ( identifier[x] , identifier[context] = keyword[None] ):
literal[string]
keyword[return] identifier[_apply_function_in_current_context] (
identifier[BigFloat] ,
identifier[mpfr] . identifier[mpfr_y0] ,
( identifier[BigFloat] . identifier[_implicit_convert] ( ident... | def y0(x, context=None):
"""
Return the value of the second kind Bessel function of order 0 at x.
"""
return _apply_function_in_current_context(BigFloat, mpfr.mpfr_y0, (BigFloat._implicit_convert(x),), context) |
def get_description_metadata(self):
"""Gets the metadata for a description.
return: (osid.Metadata) - metadata for the description
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._mdata['description'])
metadata.update({'existing_stri... | def function[get_description_metadata, parameter[self]]:
constant[Gets the metadata for a description.
return: (osid.Metadata) - metadata for the description
*compliance: mandatory -- This method must be implemented.*
]
variable[metadata] assign[=] call[name[dict], parameter[ca... | keyword[def] identifier[get_description_metadata] ( identifier[self] ):
literal[string]
identifier[metadata] = identifier[dict] ( identifier[self] . identifier[_mdata] [ literal[string] ])
identifier[metadata] . identifier[update] ({ literal[string] : identifier[self] . identifier[_my_map]... | def get_description_metadata(self):
"""Gets the metadata for a description.
return: (osid.Metadata) - metadata for the description
*compliance: mandatory -- This method must be implemented.*
"""
metadata = dict(self._mdata['description'])
metadata.update({'existing_string_values': ... |
def _link(self, next_worker, next_is_first=False):
"""Link the worker to the given next worker object,
connecting the two workers with communication tubes."""
lock = multiprocessing.Lock()
next_worker._lock_prev_input = lock
self._lock_next_input = lock
lock.acquire()
... | def function[_link, parameter[self, next_worker, next_is_first]]:
constant[Link the worker to the given next worker object,
connecting the two workers with communication tubes.]
variable[lock] assign[=] call[name[multiprocessing].Lock, parameter[]]
name[next_worker]._lock_prev_input ass... | keyword[def] identifier[_link] ( identifier[self] , identifier[next_worker] , identifier[next_is_first] = keyword[False] ):
literal[string]
identifier[lock] = identifier[multiprocessing] . identifier[Lock] ()
identifier[next_worker] . identifier[_lock_prev_input] = identifier[lock]
... | def _link(self, next_worker, next_is_first=False):
"""Link the worker to the given next worker object,
connecting the two workers with communication tubes."""
lock = multiprocessing.Lock()
next_worker._lock_prev_input = lock
self._lock_next_input = lock
lock.acquire()
lock = multiproces... |
def _crop_data(self):
"""
Crop the ``data`` and ``mask`` to have an integer number of
background meshes of size ``box_size`` in both dimensions. The
data are cropped on the top and/or right edges (this is the best
option for the "zoom" interpolator).
Returns
---... | def function[_crop_data, parameter[self]]:
constant[
Crop the ``data`` and ``mask`` to have an integer number of
background meshes of size ``box_size`` in both dimensions. The
data are cropped on the top and/or right edges (this is the best
option for the "zoom" interpolator).
... | keyword[def] identifier[_crop_data] ( identifier[self] ):
literal[string]
identifier[ny_crop] = identifier[self] . identifier[nyboxes] * identifier[self] . identifier[box_size] [ literal[int] ]
identifier[nx_crop] = identifier[self] . identifier[nxboxes] * identifier[self] . identifier[bo... | def _crop_data(self):
"""
Crop the ``data`` and ``mask`` to have an integer number of
background meshes of size ``box_size`` in both dimensions. The
data are cropped on the top and/or right edges (this is the best
option for the "zoom" interpolator).
Returns
-------... |
def set_display_luminosity(self, luminosity):
"""
Change the intensity of light of the front panel of the box
:param luminosity: must be between 0 (light off) and 100
:type luminosity: int
"""
if (luminosity < 0) or (luminosity > 100):
raise ValueError("Lumino... | def function[set_display_luminosity, parameter[self, luminosity]]:
constant[
Change the intensity of light of the front panel of the box
:param luminosity: must be between 0 (light off) and 100
:type luminosity: int
]
if <ast.BoolOp object at 0x7da2044c3a60> begin[:]
... | keyword[def] identifier[set_display_luminosity] ( identifier[self] , identifier[luminosity] ):
literal[string]
keyword[if] ( identifier[luminosity] < literal[int] ) keyword[or] ( identifier[luminosity] > literal[int] ):
keyword[raise] identifier[ValueError] ( literal[string] )
... | def set_display_luminosity(self, luminosity):
"""
Change the intensity of light of the front panel of the box
:param luminosity: must be between 0 (light off) and 100
:type luminosity: int
"""
if luminosity < 0 or luminosity > 100:
raise ValueError('Luminosity must be bet... |
def _request_process_text(response):
"""Handle Signature download.
Return:
(string): The data from the download
(string): The status of the download
"""
status = 'Failure'
# Handle document download
data = response.content
if data:
... | def function[_request_process_text, parameter[response]]:
constant[Handle Signature download.
Return:
(string): The data from the download
(string): The status of the download
]
variable[status] assign[=] constant[Failure]
variable[data] assign[=] name[re... | keyword[def] identifier[_request_process_text] ( identifier[response] ):
literal[string]
identifier[status] = literal[string]
identifier[data] = identifier[response] . identifier[content]
keyword[if] identifier[data] :
identifier[status] = literal[string] ... | def _request_process_text(response):
"""Handle Signature download.
Return:
(string): The data from the download
(string): The status of the download
"""
status = 'Failure'
# Handle document download
data = response.content
if data:
status = 'Success' ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.