code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def print_collection(self, c, h, n):
"""Print collection using the specified indent (n) and newline (nl)."""
if c in h:
return "[]..."
h.append(c)
s = []
for item in c:
s.append("\n")
s.append(self.indent(n))
s.append(self.process(i... | def function[print_collection, parameter[self, c, h, n]]:
constant[Print collection using the specified indent (n) and newline (nl).]
if compare[name[c] in name[h]] begin[:]
return[constant[[]...]]
call[name[h].append, parameter[name[c]]]
variable[s] assign[=] list[[]]
fo... | keyword[def] identifier[print_collection] ( identifier[self] , identifier[c] , identifier[h] , identifier[n] ):
literal[string]
keyword[if] identifier[c] keyword[in] identifier[h] :
keyword[return] literal[string]
identifier[h] . identifier[append] ( identifier[c] )
... | def print_collection(self, c, h, n):
"""Print collection using the specified indent (n) and newline (nl)."""
if c in h:
return '[]...' # depends on [control=['if'], data=[]]
h.append(c)
s = []
for item in c:
s.append('\n')
s.append(self.indent(n))
s.append(self.proce... |
def coerce_author(value):
"""
Coerce strings to :class:`Author` objects.
:param value: A string or :class:`Author` object.
:returns: An :class:`Author` object.
:raises: :exc:`~exceptions.ValueError` when `value`
isn't a string or :class:`Author` object.
"""
# Author objects pas... | def function[coerce_author, parameter[value]]:
constant[
Coerce strings to :class:`Author` objects.
:param value: A string or :class:`Author` object.
:returns: An :class:`Author` object.
:raises: :exc:`~exceptions.ValueError` when `value`
isn't a string or :class:`Author` object.
... | keyword[def] identifier[coerce_author] ( identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[Author] ):
keyword[return] identifier[value]
keyword[if] keyword[not] identifier[isinstance] ( identifier[value] , identifier[st... | def coerce_author(value):
"""
Coerce strings to :class:`Author` objects.
:param value: A string or :class:`Author` object.
:returns: An :class:`Author` object.
:raises: :exc:`~exceptions.ValueError` when `value`
isn't a string or :class:`Author` object.
"""
# Author objects pas... |
def setDefaultOptions(config):
"""
Set default options for builtin batch systems. This is required if a Config
object is not constructed from an Options object.
"""
config.batchSystem = "singleMachine"
config.disableAutoDeployment = False
config.environment = {}
config.statePollingWait =... | def function[setDefaultOptions, parameter[config]]:
constant[
Set default options for builtin batch systems. This is required if a Config
object is not constructed from an Options object.
]
name[config].batchSystem assign[=] constant[singleMachine]
name[config].disableAutoDeployment ... | keyword[def] identifier[setDefaultOptions] ( identifier[config] ):
literal[string]
identifier[config] . identifier[batchSystem] = literal[string]
identifier[config] . identifier[disableAutoDeployment] = keyword[False]
identifier[config] . identifier[environment] ={}
identifier[config] . id... | def setDefaultOptions(config):
"""
Set default options for builtin batch systems. This is required if a Config
object is not constructed from an Options object.
"""
config.batchSystem = 'singleMachine'
config.disableAutoDeployment = False
config.environment = {}
config.statePollingWait =... |
def _GenerateNames(name, fromlist, globals):
"""Generates the names of modules that might be loaded via this import.
Args:
name: Argument as passed to the importer.
fromlist: Argument as passed to the importer.
globals: Argument as passed to the importer.
Returns:
A set that contains the names o... | def function[_GenerateNames, parameter[name, fromlist, globals]]:
constant[Generates the names of modules that might be loaded via this import.
Args:
name: Argument as passed to the importer.
fromlist: Argument as passed to the importer.
globals: Argument as passed to the importer.
Returns:
... | keyword[def] identifier[_GenerateNames] ( identifier[name] , identifier[fromlist] , identifier[globals] ):
literal[string]
keyword[def] identifier[GetCurrentPackage] ( identifier[globals] ):
literal[string]
keyword[if] keyword[not] identifier[globals] :
keyword[return] keyword[None]
... | def _GenerateNames(name, fromlist, globals):
"""Generates the names of modules that might be loaded via this import.
Args:
name: Argument as passed to the importer.
fromlist: Argument as passed to the importer.
globals: Argument as passed to the importer.
Returns:
A set that contains the names... |
def enable_step_on_branch_mode(cls):
"""
When tracing, call this on every single step event
for step on branch mode.
@raise WindowsError:
Raises C{ERROR_DEBUGGER_INACTIVE} if the debugger is not attached
to least one process.
@raise NotImplementedError:
... | def function[enable_step_on_branch_mode, parameter[cls]]:
constant[
When tracing, call this on every single step event
for step on branch mode.
@raise WindowsError:
Raises C{ERROR_DEBUGGER_INACTIVE} if the debugger is not attached
to least one process.
@... | keyword[def] identifier[enable_step_on_branch_mode] ( identifier[cls] ):
literal[string]
identifier[cls] . identifier[write_msr] ( identifier[DebugRegister] . identifier[DebugCtlMSR] ,
identifier[DebugRegister] . identifier[BranchTrapFlag] | identifier[DebugRegister] . identifier[LastBranc... | def enable_step_on_branch_mode(cls):
"""
When tracing, call this on every single step event
for step on branch mode.
@raise WindowsError:
Raises C{ERROR_DEBUGGER_INACTIVE} if the debugger is not attached
to least one process.
@raise NotImplementedError:
... |
def subreporter(self, subpath, entry):
"""
create a reporter for a sub-report, with updated breadcrumbs and
the same output formats
"""
newbase = join(self.basedir, subpath)
r = Reporter(newbase, entry, self.options)
crumbs = list(self.breadcrumbs)
crumb... | def function[subreporter, parameter[self, subpath, entry]]:
constant[
create a reporter for a sub-report, with updated breadcrumbs and
the same output formats
]
variable[newbase] assign[=] call[name[join], parameter[name[self].basedir, name[subpath]]]
variable[r] assign[=... | keyword[def] identifier[subreporter] ( identifier[self] , identifier[subpath] , identifier[entry] ):
literal[string]
identifier[newbase] = identifier[join] ( identifier[self] . identifier[basedir] , identifier[subpath] )
identifier[r] = identifier[Reporter] ( identifier[newbase] , identif... | def subreporter(self, subpath, entry):
"""
create a reporter for a sub-report, with updated breadcrumbs and
the same output formats
"""
newbase = join(self.basedir, subpath)
r = Reporter(newbase, entry, self.options)
crumbs = list(self.breadcrumbs)
crumbs.append((self.basedir... |
def update_subscription(self, subscription_id, url=None, events=None):
"""
Create subscription
:param subscription_id: Subscription to update
:param events: Events to subscribe
:param url: Url to send events
"""
params = {}
if url is not None:
... | def function[update_subscription, parameter[self, subscription_id, url, events]]:
constant[
Create subscription
:param subscription_id: Subscription to update
:param events: Events to subscribe
:param url: Url to send events
]
variable[params] assign[=] dictionary... | keyword[def] identifier[update_subscription] ( identifier[self] , identifier[subscription_id] , identifier[url] = keyword[None] , identifier[events] = keyword[None] ):
literal[string]
identifier[params] ={}
keyword[if] identifier[url] keyword[is] keyword[not] keyword[None] :
... | def update_subscription(self, subscription_id, url=None, events=None):
"""
Create subscription
:param subscription_id: Subscription to update
:param events: Events to subscribe
:param url: Url to send events
"""
params = {}
if url is not None:
params['url'] = ... |
def ssn(self):
"""
Returns a 13 digits Swiss SSN named AHV (German) or
AVS (French and Italian)
See: http://www.bsv.admin.ch/themen/ahv/00011/02185/
"""
def _checksum(digits):
evensum = sum(digits[:-1:2])
oddsum ... | def function[ssn, parameter[self]]:
constant[
Returns a 13 digits Swiss SSN named AHV (German) or
AVS (French and Italian)
See: http://www.bsv.admin.ch/themen/ahv/00011/02185/
]
def function[_checksum, parameter[digits]]:
... | keyword[def] identifier[ssn] ( identifier[self] ):
literal[string]
keyword[def] identifier[_checksum] ( identifier[digits] ):
identifier[evensum] = identifier[sum] ( identifier[digits] [:- literal[int] : literal[int] ])
identifier[oddsum] = identifier[sum] ( identifier[di... | def ssn(self):
"""
Returns a 13 digits Swiss SSN named AHV (German) or
AVS (French and Italian)
See: http://www.bsv.admin.ch/themen/ahv/00011/02185/
"""
def _checksum(digits):
evensum = sum(digits[:-1:2])
oddsum = sum(digits[1:... |
def _perspective_warp(c, magnitude:partial(uniform,size=8)=0, invert=False):
"Apply warp of `magnitude` to `c`."
magnitude = magnitude.view(4,2)
targ_pts = [[x+m for x,m in zip(xs, ms)] for xs, ms in zip(_orig_pts, magnitude)]
return _do_perspective_warp(c, targ_pts, invert) | def function[_perspective_warp, parameter[c, magnitude, invert]]:
constant[Apply warp of `magnitude` to `c`.]
variable[magnitude] assign[=] call[name[magnitude].view, parameter[constant[4], constant[2]]]
variable[targ_pts] assign[=] <ast.ListComp object at 0x7da1b1dfa380>
return[call[name[_d... | keyword[def] identifier[_perspective_warp] ( identifier[c] , identifier[magnitude] : identifier[partial] ( identifier[uniform] , identifier[size] = literal[int] )= literal[int] , identifier[invert] = keyword[False] ):
literal[string]
identifier[magnitude] = identifier[magnitude] . identifier[view] ( litera... | def _perspective_warp(c, magnitude: partial(uniform, size=8)=0, invert=False):
"""Apply warp of `magnitude` to `c`."""
magnitude = magnitude.view(4, 2)
targ_pts = [[x + m for (x, m) in zip(xs, ms)] for (xs, ms) in zip(_orig_pts, magnitude)]
return _do_perspective_warp(c, targ_pts, invert) |
def make_fil_file(filename,out_dir='./', new_filename=None, max_load = None):
''' Converts file to Sigproc filterbank (.fil) format. Default saves output in current dir.
'''
fil_file = Waterfall(filename, max_load = max_load)
if not new_filename:
new_filename = out_dir+filename.replace('.h5','... | def function[make_fil_file, parameter[filename, out_dir, new_filename, max_load]]:
constant[ Converts file to Sigproc filterbank (.fil) format. Default saves output in current dir.
]
variable[fil_file] assign[=] call[name[Waterfall], parameter[name[filename]]]
if <ast.UnaryOp object at 0x7d... | keyword[def] identifier[make_fil_file] ( identifier[filename] , identifier[out_dir] = literal[string] , identifier[new_filename] = keyword[None] , identifier[max_load] = keyword[None] ):
literal[string]
identifier[fil_file] = identifier[Waterfall] ( identifier[filename] , identifier[max_load] = identifier... | def make_fil_file(filename, out_dir='./', new_filename=None, max_load=None):
""" Converts file to Sigproc filterbank (.fil) format. Default saves output in current dir.
"""
fil_file = Waterfall(filename, max_load=max_load)
if not new_filename:
new_filename = out_dir + filename.replace('.h5', '.... |
def to_unit(C, val, unit=None):
"""convert a string measurement to a Unum"""
md = re.match(r'^(?P<num>[\d\.]+)(?P<unit>.*)$', val)
if md is not None:
un = float(md.group('num')) * CSS.units[md.group('unit')]
if unit is not None:
return un.asUnit(unit... | def function[to_unit, parameter[C, val, unit]]:
constant[convert a string measurement to a Unum]
variable[md] assign[=] call[name[re].match, parameter[constant[^(?P<num>[\d\.]+)(?P<unit>.*)$], name[val]]]
if compare[name[md] is_not constant[None]] begin[:]
variable[un] assign[=] ... | keyword[def] identifier[to_unit] ( identifier[C] , identifier[val] , identifier[unit] = keyword[None] ):
literal[string]
identifier[md] = identifier[re] . identifier[match] ( literal[string] , identifier[val] )
keyword[if] identifier[md] keyword[is] keyword[not] keyword[None] :
... | def to_unit(C, val, unit=None):
"""convert a string measurement to a Unum"""
md = re.match('^(?P<num>[\\d\\.]+)(?P<unit>.*)$', val)
if md is not None:
un = float(md.group('num')) * CSS.units[md.group('unit')]
if unit is not None:
return un.asUnit(unit) # depends on [control=['if... |
def categories_ref(self):
"""
The Excel worksheet reference to the categories for this chart (not
including the column heading).
"""
categories = self._chart_data.categories
if categories.depth == 0:
raise ValueError('chart data contains no categories')
... | def function[categories_ref, parameter[self]]:
constant[
The Excel worksheet reference to the categories for this chart (not
including the column heading).
]
variable[categories] assign[=] name[self]._chart_data.categories
if compare[name[categories].depth equal[==] const... | keyword[def] identifier[categories_ref] ( identifier[self] ):
literal[string]
identifier[categories] = identifier[self] . identifier[_chart_data] . identifier[categories]
keyword[if] identifier[categories] . identifier[depth] == literal[int] :
keyword[raise] identifier[Valu... | def categories_ref(self):
"""
The Excel worksheet reference to the categories for this chart (not
including the column heading).
"""
categories = self._chart_data.categories
if categories.depth == 0:
raise ValueError('chart data contains no categories') # depends on [control... |
def dump_ifd(self, ifd, ifd_name, tag_dict=EXIF_TAGS, relative=0, stop_tag=DEFAULT_STOP_TAG):
"""
Return a list of entries in the given IFD.
"""
# make sure we can process the entries
try:
entries = self.s2n(ifd, 2)
except TypeError:
logger.warning... | def function[dump_ifd, parameter[self, ifd, ifd_name, tag_dict, relative, stop_tag]]:
constant[
Return a list of entries in the given IFD.
]
<ast.Try object at 0x7da18f00c040>
for taget[name[i]] in starred[call[name[range], parameter[name[entries]]]] begin[:]
variable... | keyword[def] identifier[dump_ifd] ( identifier[self] , identifier[ifd] , identifier[ifd_name] , identifier[tag_dict] = identifier[EXIF_TAGS] , identifier[relative] = literal[int] , identifier[stop_tag] = identifier[DEFAULT_STOP_TAG] ):
literal[string]
keyword[try] :
identifier... | def dump_ifd(self, ifd, ifd_name, tag_dict=EXIF_TAGS, relative=0, stop_tag=DEFAULT_STOP_TAG):
"""
Return a list of entries in the given IFD.
"""
# make sure we can process the entries
try:
entries = self.s2n(ifd, 2) # depends on [control=['try'], data=[]]
except TypeError:
... |
def delete(self, ids):
"""
Method to delete ipv4's by their ids
:param ids: Identifiers of ipv4's
:return: None
"""
url = build_uri_with_ids('api/v3/ipv4/%s/', ids)
return super(ApiIPv4, self).delete(url) | def function[delete, parameter[self, ids]]:
constant[
Method to delete ipv4's by their ids
:param ids: Identifiers of ipv4's
:return: None
]
variable[url] assign[=] call[name[build_uri_with_ids], parameter[constant[api/v3/ipv4/%s/], name[ids]]]
return[call[call[name[... | keyword[def] identifier[delete] ( identifier[self] , identifier[ids] ):
literal[string]
identifier[url] = identifier[build_uri_with_ids] ( literal[string] , identifier[ids] )
keyword[return] identifier[super] ( identifier[ApiIPv4] , identifier[self] ). identifier[delete] ( identifier[url... | def delete(self, ids):
"""
Method to delete ipv4's by their ids
:param ids: Identifiers of ipv4's
:return: None
"""
url = build_uri_with_ids('api/v3/ipv4/%s/', ids)
return super(ApiIPv4, self).delete(url) |
def wait(self, timeout=None):
"""pause the current coroutine until this event is set
.. note::
this method will block the current coroutine if :meth:`set` has not
been called.
:param timeout:
the maximum amount of time to block in seconds. the default of
... | def function[wait, parameter[self, timeout]]:
constant[pause the current coroutine until this event is set
.. note::
this method will block the current coroutine if :meth:`set` has not
been called.
:param timeout:
the maximum amount of time to block in seco... | keyword[def] identifier[wait] ( identifier[self] , identifier[timeout] = keyword[None] ):
literal[string]
keyword[if] identifier[self] . identifier[_is_set] :
keyword[return] keyword[False]
identifier[current] = identifier[compat] . identifier[getcurrent] ()
iden... | def wait(self, timeout=None):
"""pause the current coroutine until this event is set
.. note::
this method will block the current coroutine if :meth:`set` has not
been called.
:param timeout:
the maximum amount of time to block in seconds. the default of
... |
def setLegendData(self, *args, **kwargs):
""" Set or genernate the legend data from this canteen.
Uses :py:func:`.buildLegend` for genernating """
self.legendData = buildLegend(*args, key=self.legendKeyFunc, **kwargs) | def function[setLegendData, parameter[self]]:
constant[ Set or genernate the legend data from this canteen.
Uses :py:func:`.buildLegend` for genernating ]
name[self].legendData assign[=] call[name[buildLegend], parameter[<ast.Starred object at 0x7da1b1ec3070>]] | keyword[def] identifier[setLegendData] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[legendData] = identifier[buildLegend] (* identifier[args] , identifier[key] = identifier[self] . identifier[legendKeyFunc] ,** identifier[kwargs] ) | def setLegendData(self, *args, **kwargs):
""" Set or genernate the legend data from this canteen.
Uses :py:func:`.buildLegend` for genernating """
self.legendData = buildLegend(*args, key=self.legendKeyFunc, **kwargs) |
def transform(self, X):
r"""Maps the input data through the transformer to correspondingly
shaped output data array/list.
Parameters
----------
X : ndarray(T, n) or list of ndarray(T_i, n)
The input data, where T is the number of time steps and n is the
n... | def function[transform, parameter[self, X]]:
constant[Maps the input data through the transformer to correspondingly
shaped output data array/list.
Parameters
----------
X : ndarray(T, n) or list of ndarray(T_i, n)
The input data, where T is the number of time steps ... | keyword[def] identifier[transform] ( identifier[self] , identifier[X] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[X] , identifier[np] . identifier[ndarray] ):
keyword[if] identifier[X] . identifier[ndim] == literal[int] :
identifier[mapped] = i... | def transform(self, X):
"""Maps the input data through the transformer to correspondingly
shaped output data array/list.
Parameters
----------
X : ndarray(T, n) or list of ndarray(T_i, n)
The input data, where T is the number of time steps and n is the
number... |
def id_pools(self):
"""
Gets the IdPools API client.
Returns:
IdPools:
"""
if not self.__id_pools:
self.__id_pools = IdPools(self.__connection)
return self.__id_pools | def function[id_pools, parameter[self]]:
constant[
Gets the IdPools API client.
Returns:
IdPools:
]
if <ast.UnaryOp object at 0x7da20c76cf10> begin[:]
name[self].__id_pools assign[=] call[name[IdPools], parameter[name[self].__connection]]
return[n... | keyword[def] identifier[id_pools] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[__id_pools] :
identifier[self] . identifier[__id_pools] = identifier[IdPools] ( identifier[self] . identifier[__connection] )
keyword[return] ident... | def id_pools(self):
"""
Gets the IdPools API client.
Returns:
IdPools:
"""
if not self.__id_pools:
self.__id_pools = IdPools(self.__connection) # depends on [control=['if'], data=[]]
return self.__id_pools |
def expand_effect_repertoire(self, new_purview=None):
"""See |Subsystem.expand_repertoire()|."""
return self.subsystem.expand_effect_repertoire(
self.effect.repertoire, new_purview) | def function[expand_effect_repertoire, parameter[self, new_purview]]:
constant[See |Subsystem.expand_repertoire()|.]
return[call[name[self].subsystem.expand_effect_repertoire, parameter[name[self].effect.repertoire, name[new_purview]]]] | keyword[def] identifier[expand_effect_repertoire] ( identifier[self] , identifier[new_purview] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[subsystem] . identifier[expand_effect_repertoire] (
identifier[self] . identifier[effect] . identifier[repertoire... | def expand_effect_repertoire(self, new_purview=None):
"""See |Subsystem.expand_repertoire()|."""
return self.subsystem.expand_effect_repertoire(self.effect.repertoire, new_purview) |
def partial_dependence(self, term, X=None, width=None, quantiles=None,
meshgrid=False):
"""
Computes the term functions for the GAM
and possibly their confidence intervals.
if both width=None and quantiles=None,
then no confidence intervals are compute... | def function[partial_dependence, parameter[self, term, X, width, quantiles, meshgrid]]:
constant[
Computes the term functions for the GAM
and possibly their confidence intervals.
if both width=None and quantiles=None,
then no confidence intervals are computed
Parameters... | keyword[def] identifier[partial_dependence] ( identifier[self] , identifier[term] , identifier[X] = keyword[None] , identifier[width] = keyword[None] , identifier[quantiles] = keyword[None] ,
identifier[meshgrid] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[self] . ide... | def partial_dependence(self, term, X=None, width=None, quantiles=None, meshgrid=False):
"""
Computes the term functions for the GAM
and possibly their confidence intervals.
if both width=None and quantiles=None,
then no confidence intervals are computed
Parameters
-... |
def get_descriptor_defaults(self, api_info, hostname=None):
"""Gets a default configuration for a service.
Args:
api_info: _ApiInfo object for this service.
hostname: string, Hostname of the API, to override the value set on the
current service. Defaults to None.
Returns:
A dicti... | def function[get_descriptor_defaults, parameter[self, api_info, hostname]]:
constant[Gets a default configuration for a service.
Args:
api_info: _ApiInfo object for this service.
hostname: string, Hostname of the API, to override the value set on the
current service. Defaults to None.
... | keyword[def] identifier[get_descriptor_defaults] ( identifier[self] , identifier[api_info] , identifier[hostname] = keyword[None] ):
literal[string]
keyword[if] identifier[self] . identifier[__request] :
identifier[hostname] = identifier[self] . identifier[__request] . identifier[reconstruct_hostna... | def get_descriptor_defaults(self, api_info, hostname=None):
"""Gets a default configuration for a service.
Args:
api_info: _ApiInfo object for this service.
hostname: string, Hostname of the API, to override the value set on the
current service. Defaults to None.
Returns:
A dicti... |
def point_in_poly(p, poly):
"""Determine whether a point is within a polygon area
Uses the ray casting algorithm.
Parameters
----------
p: float
Coordinates of the point
poly: array_like of shape (N, 2)
Polygon (`PolygonFilter.points`)
R... | def function[point_in_poly, parameter[p, poly]]:
constant[Determine whether a point is within a polygon area
Uses the ray casting algorithm.
Parameters
----------
p: float
Coordinates of the point
poly: array_like of shape (N, 2)
Polygon (`Polygo... | keyword[def] identifier[point_in_poly] ( identifier[p] , identifier[poly] ):
literal[string]
identifier[poly] = identifier[np] . identifier[array] ( identifier[poly] )
identifier[n] = identifier[poly] . identifier[shape] [ literal[int] ]
identifier[inside] = keyword[False]
... | def point_in_poly(p, poly):
"""Determine whether a point is within a polygon area
Uses the ray casting algorithm.
Parameters
----------
p: float
Coordinates of the point
poly: array_like of shape (N, 2)
Polygon (`PolygonFilter.points`)
Retur... |
def _do_update_packet(self, packet, ip, port):
"""
React to update packet - people/person on a device have changed
:param packet: Packet from client with changes
:type packet: paps.si.app.message.APPUpdateMessage
:param ip: Client ip address
:type ip: unicode
:pa... | def function[_do_update_packet, parameter[self, packet, ip, port]]:
constant[
React to update packet - people/person on a device have changed
:param packet: Packet from client with changes
:type packet: paps.si.app.message.APPUpdateMessage
:param ip: Client ip address
:t... | keyword[def] identifier[_do_update_packet] ( identifier[self] , identifier[packet] , identifier[ip] , identifier[port] ):
literal[string]
identifier[self] . identifier[debug] ( literal[string] )
identifier[device_id] = identifier[packet] . identifier[header] . identifier[device_id]
... | def _do_update_packet(self, packet, ip, port):
"""
React to update packet - people/person on a device have changed
:param packet: Packet from client with changes
:type packet: paps.si.app.message.APPUpdateMessage
:param ip: Client ip address
:type ip: unicode
:param ... |
def rank_alternation(edm_missing, rank, niter=50, print_out=False, edm_true=None):
"""Complete and denoise EDM using rank alternation.
Iteratively impose rank and strucutre to complete marix entries
:param edm_missing: EDM with 0 where no measurement was taken.
:param rank: expected rank of complete E... | def function[rank_alternation, parameter[edm_missing, rank, niter, print_out, edm_true]]:
constant[Complete and denoise EDM using rank alternation.
Iteratively impose rank and strucutre to complete marix entries
:param edm_missing: EDM with 0 where no measurement was taken.
:param rank: expected r... | keyword[def] identifier[rank_alternation] ( identifier[edm_missing] , identifier[rank] , identifier[niter] = literal[int] , identifier[print_out] = keyword[False] , identifier[edm_true] = keyword[None] ):
literal[string]
keyword[from] identifier[pylocus] . identifier[basics] keyword[import] identifier[l... | def rank_alternation(edm_missing, rank, niter=50, print_out=False, edm_true=None):
"""Complete and denoise EDM using rank alternation.
Iteratively impose rank and strucutre to complete marix entries
:param edm_missing: EDM with 0 where no measurement was taken.
:param rank: expected rank of complete E... |
def truncate(self, distance):
"""
Return a truncated version of the path.
Only one vertex (at the endpoint) will be added.
"""
position = np.searchsorted(self._cum_norm, distance)
offset = distance - self._cum_norm[position - 1]
if offset < constants.tol_path.mer... | def function[truncate, parameter[self, distance]]:
constant[
Return a truncated version of the path.
Only one vertex (at the endpoint) will be added.
]
variable[position] assign[=] call[name[np].searchsorted, parameter[name[self]._cum_norm, name[distance]]]
variable[offse... | keyword[def] identifier[truncate] ( identifier[self] , identifier[distance] ):
literal[string]
identifier[position] = identifier[np] . identifier[searchsorted] ( identifier[self] . identifier[_cum_norm] , identifier[distance] )
identifier[offset] = identifier[distance] - identifier[self] .... | def truncate(self, distance):
"""
Return a truncated version of the path.
Only one vertex (at the endpoint) will be added.
"""
position = np.searchsorted(self._cum_norm, distance)
offset = distance - self._cum_norm[position - 1]
if offset < constants.tol_path.merge:
trunc... |
def GetEntries(self, cut=None, weighted_cut=None, weighted=False):
"""
Get the number of (weighted) entries in the Tree
Parameters
----------
cut : str or rootpy.tree.cut.Cut, optional (default=None)
Only entries passing this cut will be included in the count
... | def function[GetEntries, parameter[self, cut, weighted_cut, weighted]]:
constant[
Get the number of (weighted) entries in the Tree
Parameters
----------
cut : str or rootpy.tree.cut.Cut, optional (default=None)
Only entries passing this cut will be included in the co... | keyword[def] identifier[GetEntries] ( identifier[self] , identifier[cut] = keyword[None] , identifier[weighted_cut] = keyword[None] , identifier[weighted] = keyword[False] ):
literal[string]
keyword[if] identifier[weighted_cut] :
identifier[hist] = identifier[Hist] ( literal[int] ,- l... | def GetEntries(self, cut=None, weighted_cut=None, weighted=False):
"""
Get the number of (weighted) entries in the Tree
Parameters
----------
cut : str or rootpy.tree.cut.Cut, optional (default=None)
Only entries passing this cut will be included in the count
we... |
def _id_map(minion_id, dns_name):
'''
Maintain a relationship between a minion and a dns name
'''
bank = 'digicert/minions'
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
dns_names = cache.fetch(bank, minion_id)
if not isinstance(dns_names, list):
dns_names = []
if dns_na... | def function[_id_map, parameter[minion_id, dns_name]]:
constant[
Maintain a relationship between a minion and a dns name
]
variable[bank] assign[=] constant[digicert/minions]
variable[cache] assign[=] call[name[salt].cache.Cache, parameter[name[__opts__], name[syspaths].CACHE_DIR]]
... | keyword[def] identifier[_id_map] ( identifier[minion_id] , identifier[dns_name] ):
literal[string]
identifier[bank] = literal[string]
identifier[cache] = identifier[salt] . identifier[cache] . identifier[Cache] ( identifier[__opts__] , identifier[syspaths] . identifier[CACHE_DIR] )
identifier[dn... | def _id_map(minion_id, dns_name):
"""
Maintain a relationship between a minion and a dns name
"""
bank = 'digicert/minions'
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
dns_names = cache.fetch(bank, minion_id)
if not isinstance(dns_names, list):
dns_names = [] # depends on... |
def _heat_deploy(self, stack, stack_name, template_path, parameters,
environments, timeout):
"""Verify the Baremetal nodes are available and do a stack update"""
self.log.debug("Processing environment files")
env_files, env = (
template_utils.process_multiple_en... | def function[_heat_deploy, parameter[self, stack, stack_name, template_path, parameters, environments, timeout]]:
constant[Verify the Baremetal nodes are available and do a stack update]
call[name[self].log.debug, parameter[constant[Processing environment files]]]
<ast.Tuple object at 0x7da18bcc... | keyword[def] identifier[_heat_deploy] ( identifier[self] , identifier[stack] , identifier[stack_name] , identifier[template_path] , identifier[parameters] ,
identifier[environments] , identifier[timeout] ):
literal[string]
identifier[self] . identifier[log] . identifier[debug] ( literal[string] )... | def _heat_deploy(self, stack, stack_name, template_path, parameters, environments, timeout):
"""Verify the Baremetal nodes are available and do a stack update"""
self.log.debug('Processing environment files')
(env_files, env) = template_utils.process_multiple_environments_and_files(environments)
self.lo... |
def update(self, search=None, **kwargs):
"""Updates the server with any changes you've made to the current saved
search along with any additional arguments you specify.
:param `search`: The search query (optional).
:type search: ``string``
:param `kwargs`: Additional arguments (... | def function[update, parameter[self, search]]:
constant[Updates the server with any changes you've made to the current saved
search along with any additional arguments you specify.
:param `search`: The search query (optional).
:type search: ``string``
:param `kwargs`: Additional... | keyword[def] identifier[update] ( identifier[self] , identifier[search] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[search] keyword[is] keyword[None] : identifier[search] = identifier[self] . identifier[content] . identifier[search]... | def update(self, search=None, **kwargs):
"""Updates the server with any changes you've made to the current saved
search along with any additional arguments you specify.
:param `search`: The search query (optional).
:type search: ``string``
:param `kwargs`: Additional arguments (opti... |
def matches(self, txt: str) -> bool:
"""Determine whether txt matches pattern
:param txt: text to check
:return: True if match
"""
# rval = ref.getText()[1:-1].encode('utf-8').decode('unicode-escape')
if r'\\u' in self.pattern_re.pattern:
txt = txt.encode('ut... | def function[matches, parameter[self, txt]]:
constant[Determine whether txt matches pattern
:param txt: text to check
:return: True if match
]
if compare[constant[\\u] in name[self].pattern_re.pattern] begin[:]
variable[txt] assign[=] call[call[name[txt].encode, ... | keyword[def] identifier[matches] ( identifier[self] , identifier[txt] : identifier[str] )-> identifier[bool] :
literal[string]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[pattern_re] . identifier[pattern] :
identifier[txt] = identifier[txt] . ident... | def matches(self, txt: str) -> bool:
"""Determine whether txt matches pattern
:param txt: text to check
:return: True if match
"""
# rval = ref.getText()[1:-1].encode('utf-8').decode('unicode-escape')
if '\\\\u' in self.pattern_re.pattern:
txt = txt.encode('utf-8').decode('u... |
def untlpy2highwirepy(untl_elements, **kwargs):
"""Convert a UNTL Python object to a highwire Python object."""
highwire_list = []
title = None
publisher = None
creation = None
escape = kwargs.get('escape', False)
for element in untl_elements.children:
# If the UNTL element should be... | def function[untlpy2highwirepy, parameter[untl_elements]]:
constant[Convert a UNTL Python object to a highwire Python object.]
variable[highwire_list] assign[=] list[[]]
variable[title] assign[=] constant[None]
variable[publisher] assign[=] constant[None]
variable[creation] assig... | keyword[def] identifier[untlpy2highwirepy] ( identifier[untl_elements] ,** identifier[kwargs] ):
literal[string]
identifier[highwire_list] =[]
identifier[title] = keyword[None]
identifier[publisher] = keyword[None]
identifier[creation] = keyword[None]
identifier[escape] = identifier[... | def untlpy2highwirepy(untl_elements, **kwargs):
"""Convert a UNTL Python object to a highwire Python object."""
highwire_list = []
title = None
publisher = None
creation = None
escape = kwargs.get('escape', False)
for element in untl_elements.children:
# If the UNTL element should be... |
def render(self, template, **data):
"""Renders the template using Jinja2 with given data arguments.
"""
if(type(template) != str):
raise TypeError("String expected")
env = Environment(
loader=FileSystemLoader(os.getcwd() + '/View'),
autoescap... | def function[render, parameter[self, template]]:
constant[Renders the template using Jinja2 with given data arguments.
]
if compare[call[name[type], parameter[name[template]]] not_equal[!=] name[str]] begin[:]
<ast.Raise object at 0x7da2054a4670>
variable[env] assign[=] call[nam... | keyword[def] identifier[render] ( identifier[self] , identifier[template] ,** identifier[data] ):
literal[string]
keyword[if] ( identifier[type] ( identifier[template] )!= identifier[str] ):
keyword[raise] identifier[TypeError] ( literal[string] )
identifier[env] = identifie... | def render(self, template, **data):
"""Renders the template using Jinja2 with given data arguments.
"""
if type(template) != str:
raise TypeError('String expected') # depends on [control=['if'], data=[]]
env = Environment(loader=FileSystemLoader(os.getcwd() + '/View'), autoescape=select_au... |
async def unsubscribe(self, topic):
"""
Unsubscribe the socket from the specified topic.
:param topic: The topic to unsubscribe from.
"""
if self.socket_type not in {SUB, XSUB}:
raise AssertionError(
"A %s socket cannot unsubscribe." % self.socket_typ... | <ast.AsyncFunctionDef object at 0x7da1b0aec0d0> | keyword[async] keyword[def] identifier[unsubscribe] ( identifier[self] , identifier[topic] ):
literal[string]
keyword[if] identifier[self] . identifier[socket_type] keyword[not] keyword[in] { identifier[SUB] , identifier[XSUB] }:
keyword[raise] identifier[AssertionError] (
... | async def unsubscribe(self, topic):
"""
Unsubscribe the socket from the specified topic.
:param topic: The topic to unsubscribe from.
"""
if self.socket_type not in {SUB, XSUB}:
raise AssertionError('A %s socket cannot unsubscribe.' % self.socket_type.decode()) # depends on [co... |
def mount(self, source, target, options=[]):
"""
Mount partion on target
:param source: Full partition path like /dev/sda1
:param target: Mount point
:param options: Optional mount options
"""
if len(options) == 0:
options = ['']
args = {
... | def function[mount, parameter[self, source, target, options]]:
constant[
Mount partion on target
:param source: Full partition path like /dev/sda1
:param target: Mount point
:param options: Optional mount options
]
if compare[call[name[len], parameter[name[options... | keyword[def] identifier[mount] ( identifier[self] , identifier[source] , identifier[target] , identifier[options] =[]):
literal[string]
keyword[if] identifier[len] ( identifier[options] )== literal[int] :
identifier[options] =[ literal[string] ]
identifier[args] ={
... | def mount(self, source, target, options=[]):
"""
Mount partion on target
:param source: Full partition path like /dev/sda1
:param target: Mount point
:param options: Optional mount options
"""
if len(options) == 0:
options = [''] # depends on [control=['if'], dat... |
def auth(self, user, pwd):
"""
Obtain connection parameters from the Microsoft account login page, and perform a login with the given email
address or Skype username, and its password. This emulates a login to Skype for Web on ``login.live.com``.
.. note::
Microsoft account... | def function[auth, parameter[self, user, pwd]]:
constant[
Obtain connection parameters from the Microsoft account login page, and perform a login with the given email
address or Skype username, and its password. This emulates a login to Skype for Web on ``login.live.com``.
.. note::
... | keyword[def] identifier[auth] ( identifier[self] , identifier[user] , identifier[pwd] ):
literal[string]
identifier[params] = identifier[self] . identifier[getParams] ()
identifier[t] = identifier[self] . identifier[sendCreds] ( identifier[user] , identifier[pwd] , identifier[para... | def auth(self, user, pwd):
"""
Obtain connection parameters from the Microsoft account login page, and perform a login with the given email
address or Skype username, and its password. This emulates a login to Skype for Web on ``login.live.com``.
.. note::
Microsoft accounts wi... |
def set_default_headers(self, *args, **kwargs):
"""Set the default headers for all requests."""
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept')
self.set_header('A... | def function[set_default_headers, parameter[self]]:
constant[Set the default headers for all requests.]
call[name[self].set_header, parameter[constant[Access-Control-Allow-Origin], constant[*]]]
call[name[self].set_header, parameter[constant[Access-Control-Allow-Headers], constant[Origin, X-Requ... | keyword[def] identifier[set_default_headers] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[self] . identifier[set_header] ( literal[string] , literal[string] )
identifier[self] . identifier[set_header] ( literal[string] ,
literal[strin... | def set_default_headers(self, *args, **kwargs):
"""Set the default headers for all requests."""
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
self.set_header('Access-Control-Allow-Methods', 'GET, HEAD... |
def launch(self, monitor=False, wait=False, timeout=None, **kwargs):
"""Launch a new ad-hoc command.
Runs a user-defined command from Ansible Tower, immediately starts it,
and returns back an ID in order for its status to be monitored.
=====API DOCS=====
Launch a new ad-hoc com... | def function[launch, parameter[self, monitor, wait, timeout]]:
constant[Launch a new ad-hoc command.
Runs a user-defined command from Ansible Tower, immediately starts it,
and returns back an ID in order for its status to be monitored.
=====API DOCS=====
Launch a new ad-hoc com... | keyword[def] identifier[launch] ( identifier[self] , identifier[monitor] = keyword[False] , identifier[wait] = keyword[False] , identifier[timeout] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[r] = identifier[client] . identifier[get] ( literal[string] )
ke... | def launch(self, monitor=False, wait=False, timeout=None, **kwargs):
"""Launch a new ad-hoc command.
Runs a user-defined command from Ansible Tower, immediately starts it,
and returns back an ID in order for its status to be monitored.
=====API DOCS=====
Launch a new ad-hoc command... |
def _parse_line_vars(self, line):
"""
Parse a line in a [XXXXX:vars] section.
"""
key_values = {}
# Undocumented feature allows json in vars sections like so:
# [prod:vars]
# json_like_vars=[{'name': 'htpasswd_auth'}]
# We'll try this first. If it fai... | def function[_parse_line_vars, parameter[self, line]]:
constant[
Parse a line in a [XXXXX:vars] section.
]
variable[key_values] assign[=] dictionary[[], []]
<ast.Tuple object at 0x7da1b1d17f70> assign[=] call[call[name[line].strip, parameter[]].split, parameter[constant[=], const... | keyword[def] identifier[_parse_line_vars] ( identifier[self] , identifier[line] ):
literal[string]
identifier[key_values] ={}
identifier[k] , identifier[v] = identifier[line] . identifier[strip] (). identifier[split] ( literal[string] , literal... | def _parse_line_vars(self, line):
"""
Parse a line in a [XXXXX:vars] section.
"""
key_values = {}
# Undocumented feature allows json in vars sections like so:
# [prod:vars]
# json_like_vars=[{'name': 'htpasswd_auth'}]
# We'll try this first. If it fails, we'll fall back to no... |
def chunked(sentence):
""" Returns a list of Chunk and Chink objects from the given sentence.
Chink is a subclass of Chunk used for words that have Word.chunk == None
(e.g., punctuation marks, conjunctions).
"""
# For example, to construct a training vector with the head of previous chunks a... | def function[chunked, parameter[sentence]]:
constant[ Returns a list of Chunk and Chink objects from the given sentence.
Chink is a subclass of Chunk used for words that have Word.chunk == None
(e.g., punctuation marks, conjunctions).
]
variable[chunks] assign[=] list[[]]
for... | keyword[def] identifier[chunked] ( identifier[sentence] ):
literal[string]
identifier[chunks] =[]
keyword[for] identifier[word] keyword[in] identifier[sentence] :
keyword[if] identifier[word] . identifier[chunk] keyword[is] keyword[not] keyword[None] :
keywo... | def chunked(sentence):
""" Returns a list of Chunk and Chink objects from the given sentence.
Chink is a subclass of Chunk used for words that have Word.chunk == None
(e.g., punctuation marks, conjunctions).
"""
# For example, to construct a training vector with the head of previous chunks a... |
def init(base_url, username=None, password=None, verify=True):
"""Initialize ubersmith API module with HTTP request handler."""
handler = RequestHandler(base_url, username, password, verify)
set_default_request_handler(handler)
return handler | def function[init, parameter[base_url, username, password, verify]]:
constant[Initialize ubersmith API module with HTTP request handler.]
variable[handler] assign[=] call[name[RequestHandler], parameter[name[base_url], name[username], name[password], name[verify]]]
call[name[set_default_request_... | keyword[def] identifier[init] ( identifier[base_url] , identifier[username] = keyword[None] , identifier[password] = keyword[None] , identifier[verify] = keyword[True] ):
literal[string]
identifier[handler] = identifier[RequestHandler] ( identifier[base_url] , identifier[username] , identifier[password] , ... | def init(base_url, username=None, password=None, verify=True):
"""Initialize ubersmith API module with HTTP request handler."""
handler = RequestHandler(base_url, username, password, verify)
set_default_request_handler(handler)
return handler |
def unpack_ip(fourbytes):
"""Converts an ip address given in a four byte string in network
byte order to a string in dotted notation.
>>> unpack_ip(b"dead")
'100.101.97.100'
>>> unpack_ip(b"alive")
Traceback (most recent call last):
...
ValueError: given buffer is not exactly four bytes long
@type fourbytes:... | def function[unpack_ip, parameter[fourbytes]]:
constant[Converts an ip address given in a four byte string in network
byte order to a string in dotted notation.
>>> unpack_ip(b"dead")
'100.101.97.100'
>>> unpack_ip(b"alive")
Traceback (most recent call last):
...
ValueError: given buffer is not exactly ... | keyword[def] identifier[unpack_ip] ( identifier[fourbytes] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[fourbytes] , identifier[bytes] ):
keyword[raise] identifier[ValueError] ( literal[string] )
keyword[if] identifier[len] ( identifier[fourbytes] )!= literal[int] :
... | def unpack_ip(fourbytes):
"""Converts an ip address given in a four byte string in network
byte order to a string in dotted notation.
>>> unpack_ip(b"dead")
'100.101.97.100'
>>> unpack_ip(b"alive")
Traceback (most recent call last):
...
ValueError: given buffer is not exactly four bytes long
@type fourbyt... |
def restore_organization_to_ckan(catalog, owner_org, portal_url, apikey,
dataset_list=None, download_strategy=None,
generate_new_access_url=None):
"""Restaura los datasets de la organización de un catálogo al portal pasado
por parámetro. Si ha... | def function[restore_organization_to_ckan, parameter[catalog, owner_org, portal_url, apikey, dataset_list, download_strategy, generate_new_access_url]]:
constant[Restaura los datasets de la organización de un catálogo al portal pasado
por parámetro. Si hay temas presentes en el DataJson que no están en e... | keyword[def] identifier[restore_organization_to_ckan] ( identifier[catalog] , identifier[owner_org] , identifier[portal_url] , identifier[apikey] ,
identifier[dataset_list] = keyword[None] , identifier[download_strategy] = keyword[None] ,
identifier[generate_new_access_url] = keyword[None] ):
literal[string]
... | def restore_organization_to_ckan(catalog, owner_org, portal_url, apikey, dataset_list=None, download_strategy=None, generate_new_access_url=None):
"""Restaura los datasets de la organización de un catálogo al portal pasado
por parámetro. Si hay temas presentes en el DataJson que no están en el
portal ... |
def add_or_replace_annotation(self, # pylint: disable=R0201
obj,
annotation,
agent,
add_agent_only=False):
"""Takes an `annotation` dictionary which is
expected to hav... | def function[add_or_replace_annotation, parameter[self, obj, annotation, agent, add_agent_only]]:
constant[Takes an `annotation` dictionary which is
expected to have a string as the value of annotation['author']['name']
This function will remove all annotations from obj that:
1. have... | keyword[def] identifier[add_or_replace_annotation] ( identifier[self] ,
identifier[obj] ,
identifier[annotation] ,
identifier[agent] ,
identifier[add_agent_only] = keyword[False] ):
literal[string]
identifier[nex] = identifier[get_nexml_el] ( identifier[obj] )
identifier[nvers] = ident... | def add_or_replace_annotation(self, obj, annotation, agent, add_agent_only=False): # pylint: disable=R0201
"Takes an `annotation` dictionary which is\n expected to have a string as the value of annotation['author']['name']\n This function will remove all annotations from obj that:\n 1. hav... |
def scalarsToStr(self, scalarValues, scalarNames=None):
"""
Return a pretty print string representing the return values from
:meth:`.getScalars` and :meth:`.getScalarNames`.
:param scalarValues: input values to encode to string
:param scalarNames: optional input of scalar names to convert. If None,... | def function[scalarsToStr, parameter[self, scalarValues, scalarNames]]:
constant[
Return a pretty print string representing the return values from
:meth:`.getScalars` and :meth:`.getScalarNames`.
:param scalarValues: input values to encode to string
:param scalarNames: optional input of scalar ... | keyword[def] identifier[scalarsToStr] ( identifier[self] , identifier[scalarValues] , identifier[scalarNames] = keyword[None] ):
literal[string]
keyword[if] identifier[scalarNames] keyword[is] keyword[None] :
identifier[scalarNames] = identifier[self] . identifier[getScalarNames] ()
identi... | def scalarsToStr(self, scalarValues, scalarNames=None):
"""
Return a pretty print string representing the return values from
:meth:`.getScalars` and :meth:`.getScalarNames`.
:param scalarValues: input values to encode to string
:param scalarNames: optional input of scalar names to convert. If None,... |
def authorize_password(self, client_id, username, password):
"""Authorize to platform as regular user
You must provide a valid client_id (same as web application),
your password and your username. Username and password is not stored in
client but refresh token is stored. The only valid ... | def function[authorize_password, parameter[self, client_id, username, password]]:
constant[Authorize to platform as regular user
You must provide a valid client_id (same as web application),
your password and your username. Username and password is not stored in
client but refresh token... | keyword[def] identifier[authorize_password] ( identifier[self] , identifier[client_id] , identifier[username] , identifier[password] ):
literal[string]
identifier[self] . identifier[auth_data] ={
literal[string] : literal[string] ,
literal[string] : identifier[username] ,
... | def authorize_password(self, client_id, username, password):
"""Authorize to platform as regular user
You must provide a valid client_id (same as web application),
your password and your username. Username and password is not stored in
client but refresh token is stored. The only valid scop... |
def create(self, properties):
"""
Create and configure a Partition in this CPC.
Authorization requirements:
* Object-access permission to this CPC.
* Task permission to the "New Partition" task.
Parameters:
properties (dict): Initial property values.
... | def function[create, parameter[self, properties]]:
constant[
Create and configure a Partition in this CPC.
Authorization requirements:
* Object-access permission to this CPC.
* Task permission to the "New Partition" task.
Parameters:
properties (dict): Initi... | keyword[def] identifier[create] ( identifier[self] , identifier[properties] ):
literal[string]
identifier[result] = identifier[self] . identifier[session] . identifier[post] ( identifier[self] . identifier[cpc] . identifier[uri] + literal[string] ,
identifier[body] = identifier[properties]... | def create(self, properties):
"""
Create and configure a Partition in this CPC.
Authorization requirements:
* Object-access permission to this CPC.
* Task permission to the "New Partition" task.
Parameters:
properties (dict): Initial property values.
... |
def file(self, path, status=200, set_content_length=True):
"""
Return a file as a response
"""
ct, encoding = mimetypes.guess_type(path)
if not ct:
ct = 'application/octet-stream'
if encoding:
self.headers[aiohttp.hdrs.CONTENT_ENCODING] = encoding
... | def function[file, parameter[self, path, status, set_content_length]]:
constant[
Return a file as a response
]
<ast.Tuple object at 0x7da2049624d0> assign[=] call[name[mimetypes].guess_type, parameter[name[path]]]
if <ast.UnaryOp object at 0x7da2049607c0> begin[:]
... | keyword[def] identifier[file] ( identifier[self] , identifier[path] , identifier[status] = literal[int] , identifier[set_content_length] = keyword[True] ):
literal[string]
identifier[ct] , identifier[encoding] = identifier[mimetypes] . identifier[guess_type] ( identifier[path] )
keyword[if... | def file(self, path, status=200, set_content_length=True):
"""
Return a file as a response
"""
(ct, encoding) = mimetypes.guess_type(path)
if not ct:
ct = 'application/octet-stream' # depends on [control=['if'], data=[]]
if encoding:
self.headers[aiohttp.hdrs.CONTENT_ENC... |
def normalizeInternalObjectType(value, cls, name):
"""
Normalizes an internal object type.
* **value** must be a instance of **cls**.
* Returned value is the same type as the input value.
"""
if not isinstance(value, cls):
raise TypeError("%s must be a %s instance, not %s."
... | def function[normalizeInternalObjectType, parameter[value, cls, name]]:
constant[
Normalizes an internal object type.
* **value** must be a instance of **cls**.
* Returned value is the same type as the input value.
]
if <ast.UnaryOp object at 0x7da20c993370> begin[:]
<ast.Raise ... | keyword[def] identifier[normalizeInternalObjectType] ( identifier[value] , identifier[cls] , identifier[name] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[value] , identifier[cls] ):
keyword[raise] identifier[TypeError] ( literal[string]
%( identifier... | def normalizeInternalObjectType(value, cls, name):
"""
Normalizes an internal object type.
* **value** must be a instance of **cls**.
* Returned value is the same type as the input value.
"""
if not isinstance(value, cls):
raise TypeError('%s must be a %s instance, not %s.' % (name, nam... |
def _node_to_model(tree_or_item, package, parent=None,
lucent_id=TRANSLUCENT_BINDER_ID):
"""Given a tree, parse to a set of models"""
if 'contents' in tree_or_item:
# It is a binder.
tree = tree_or_item
# Grab the package metadata, so we have required license info
... | def function[_node_to_model, parameter[tree_or_item, package, parent, lucent_id]]:
constant[Given a tree, parse to a set of models]
if compare[constant[contents] in name[tree_or_item]] begin[:]
variable[tree] assign[=] name[tree_or_item]
variable[metadata] assign[=] call[... | keyword[def] identifier[_node_to_model] ( identifier[tree_or_item] , identifier[package] , identifier[parent] = keyword[None] ,
identifier[lucent_id] = identifier[TRANSLUCENT_BINDER_ID] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[tree_or_item] :
identifier[tree] ... | def _node_to_model(tree_or_item, package, parent=None, lucent_id=TRANSLUCENT_BINDER_ID):
"""Given a tree, parse to a set of models"""
if 'contents' in tree_or_item:
# It is a binder.
tree = tree_or_item
# Grab the package metadata, so we have required license info
metadata = pack... |
def loadUiType(uifile, from_imports=False, resource_suffix='_rc', import_from='.'):
"""loadUiType(uifile, from_imports=False, resource_suffix='_rc', import_from='.') -> (form class, base class)
Load a Qt Designer .ui file and return the generated form class and the Qt
base class.
uifile is a file name... | def function[loadUiType, parameter[uifile, from_imports, resource_suffix, import_from]]:
constant[loadUiType(uifile, from_imports=False, resource_suffix='_rc', import_from='.') -> (form class, base class)
Load a Qt Designer .ui file and return the generated form class and the Qt
base class.
uifile... | keyword[def] identifier[loadUiType] ( identifier[uifile] , identifier[from_imports] = keyword[False] , identifier[resource_suffix] = literal[string] , identifier[import_from] = literal[string] ):
literal[string]
keyword[import] identifier[sys]
keyword[from] identifier[PyQt5] keyword[import] ide... | def loadUiType(uifile, from_imports=False, resource_suffix='_rc', import_from='.'):
"""loadUiType(uifile, from_imports=False, resource_suffix='_rc', import_from='.') -> (form class, base class)
Load a Qt Designer .ui file and return the generated form class and the Qt
base class.
uifile is a file name... |
def get(path_or_file, default=SENTINAL, mime=None, name=None, backend=None,
encoding=None, encoding_errors=None, kwargs=None,
_wtitle=False):
"""
Get document full text.
Accepts a path or file-like object.
* If given, `default` is returned instead of an error.
* `backend` is eithe... | def function[get, parameter[path_or_file, default, mime, name, backend, encoding, encoding_errors, kwargs, _wtitle]]:
constant[
Get document full text.
Accepts a path or file-like object.
* If given, `default` is returned instead of an error.
* `backend` is either a module object or a string ... | keyword[def] identifier[get] ( identifier[path_or_file] , identifier[default] = identifier[SENTINAL] , identifier[mime] = keyword[None] , identifier[name] = keyword[None] , identifier[backend] = keyword[None] ,
identifier[encoding] = keyword[None] , identifier[encoding_errors] = keyword[None] , identifier[kwargs] = ... | def get(path_or_file, default=SENTINAL, mime=None, name=None, backend=None, encoding=None, encoding_errors=None, kwargs=None, _wtitle=False):
"""
Get document full text.
Accepts a path or file-like object.
* If given, `default` is returned instead of an error.
* `backend` is either a module objec... |
def set_group_whole_ban(self, *, group_id, enable=True):
"""
群组全员禁言
------------
:param int group_id: 群号
:param bool enable: 是否禁言
:return: None
:rtype: None
"""
return super().__getattr__('set_group_whole_ban') \
(group_id=group_id, e... | def function[set_group_whole_ban, parameter[self]]:
constant[
群组全员禁言
------------
:param int group_id: 群号
:param bool enable: 是否禁言
:return: None
:rtype: None
]
return[call[call[call[name[super], parameter[]].__getattr__, parameter[constant[set_group_... | keyword[def] identifier[set_group_whole_ban] ( identifier[self] ,*, identifier[group_id] , identifier[enable] = keyword[True] ):
literal[string]
keyword[return] identifier[super] (). identifier[__getattr__] ( literal[string] )( identifier[group_id] = identifier[group_id] , identifier[enable] = ide... | def set_group_whole_ban(self, *, group_id, enable=True):
"""
群组全员禁言
------------
:param int group_id: 群号
:param bool enable: 是否禁言
:return: None
:rtype: None
"""
return super().__getattr__('set_group_whole_ban')(group_id=group_id, enable=enable) |
def distok(self):
"""
Boolean array showing which stars pass all distribution constraints.
A "distribution constraint" is a constraint that affects the
distribution of stars, rather than just the number.
"""
ok = np.ones(len(self.stars)).astype(bool)
for name in ... | def function[distok, parameter[self]]:
constant[
Boolean array showing which stars pass all distribution constraints.
A "distribution constraint" is a constraint that affects the
distribution of stars, rather than just the number.
]
variable[ok] assign[=] call[call[name[... | keyword[def] identifier[distok] ( identifier[self] ):
literal[string]
identifier[ok] = identifier[np] . identifier[ones] ( identifier[len] ( identifier[self] . identifier[stars] )). identifier[astype] ( identifier[bool] )
keyword[for] identifier[name] keyword[in] identifier[self] . iden... | def distok(self):
"""
Boolean array showing which stars pass all distribution constraints.
A "distribution constraint" is a constraint that affects the
distribution of stars, rather than just the number.
"""
ok = np.ones(len(self.stars)).astype(bool)
for name in self.constra... |
def safe_listget(list_, index, default='?'):
""" depricate """
if index >= len(list_):
return default
ret = list_[index]
if ret is None:
return default
return ret | def function[safe_listget, parameter[list_, index, default]]:
constant[ depricate ]
if compare[name[index] greater_or_equal[>=] call[name[len], parameter[name[list_]]]] begin[:]
return[name[default]]
variable[ret] assign[=] call[name[list_]][name[index]]
if compare[name[ret] is c... | keyword[def] identifier[safe_listget] ( identifier[list_] , identifier[index] , identifier[default] = literal[string] ):
literal[string]
keyword[if] identifier[index] >= identifier[len] ( identifier[list_] ):
keyword[return] identifier[default]
identifier[ret] = identifier[list_] [ identif... | def safe_listget(list_, index, default='?'):
""" depricate """
if index >= len(list_):
return default # depends on [control=['if'], data=[]]
ret = list_[index]
if ret is None:
return default # depends on [control=['if'], data=[]]
return ret |
def _get_cmap_data(data, kwargs) -> Tuple[colors.Normalize, np.ndarray]:
"""Get normalized values to be used with a colormap.
Parameters
----------
data : array_like
cmap_min : Optional[float] or "min"
By default 0. If "min", minimum value of the data.
cmap_max : Optional[float]
... | def function[_get_cmap_data, parameter[data, kwargs]]:
constant[Get normalized values to be used with a colormap.
Parameters
----------
data : array_like
cmap_min : Optional[float] or "min"
By default 0. If "min", minimum value of the data.
cmap_max : Optional[float]
By defa... | keyword[def] identifier[_get_cmap_data] ( identifier[data] , identifier[kwargs] )-> identifier[Tuple] [ identifier[colors] . identifier[Normalize] , identifier[np] . identifier[ndarray] ]:
literal[string]
identifier[norm] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[None] )
keywo... | def _get_cmap_data(data, kwargs) -> Tuple[colors.Normalize, np.ndarray]:
"""Get normalized values to be used with a colormap.
Parameters
----------
data : array_like
cmap_min : Optional[float] or "min"
By default 0. If "min", minimum value of the data.
cmap_max : Optional[float]
... |
def import_journey_data_for_target_stop(self, target_stop_I, origin_stop_I_to_journey_labels, enforce_synchronous_writes=False):
"""
Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
target_stop_I: int
... | def function[import_journey_data_for_target_stop, parameter[self, target_stop_I, origin_stop_I_to_journey_labels, enforce_synchronous_writes]]:
constant[
Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
... | keyword[def] identifier[import_journey_data_for_target_stop] ( identifier[self] , identifier[target_stop_I] , identifier[origin_stop_I_to_journey_labels] , identifier[enforce_synchronous_writes] = keyword[False] ):
literal[string]
identifier[cur] = identifier[self] . identifier[conn] . identifier[c... | def import_journey_data_for_target_stop(self, target_stop_I, origin_stop_I_to_journey_labels, enforce_synchronous_writes=False):
"""
Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
target_stop_I: int
... |
def clear(self):
"""
Removes all pending Jobs from the queue and return them in a list. This
method does **no**t call #Job.cancel() on any of the jobs. If you want
that, use #cancel_all() or call it manually.
"""
with synchronized(self.__queue):
jobs = self.__queue.snapshot()
self._... | def function[clear, parameter[self]]:
constant[
Removes all pending Jobs from the queue and return them in a list. This
method does **no**t call #Job.cancel() on any of the jobs. If you want
that, use #cancel_all() or call it manually.
]
with call[name[synchronized], parameter[name[self]... | keyword[def] identifier[clear] ( identifier[self] ):
literal[string]
keyword[with] identifier[synchronized] ( identifier[self] . identifier[__queue] ):
identifier[jobs] = identifier[self] . identifier[__queue] . identifier[snapshot] ()
identifier[self] . identifier[__queue] . identifier[cle... | def clear(self):
"""
Removes all pending Jobs from the queue and return them in a list. This
method does **no**t call #Job.cancel() on any of the jobs. If you want
that, use #cancel_all() or call it manually.
"""
with synchronized(self.__queue):
jobs = self.__queue.snapshot()
sel... |
def _createLocalRouter(siteStore):
"""
Create an L{IMessageRouter} provider for the default case, where no
L{IMessageRouter} powerup is installed on the top-level store.
It wraps a L{LocalMessageRouter} around the L{LoginSystem} installed on the
given site store.
If no L{LoginSystem} is presen... | def function[_createLocalRouter, parameter[siteStore]]:
constant[
Create an L{IMessageRouter} provider for the default case, where no
L{IMessageRouter} powerup is installed on the top-level store.
It wraps a L{LocalMessageRouter} around the L{LoginSystem} installed on the
given site store.
... | keyword[def] identifier[_createLocalRouter] ( identifier[siteStore] ):
literal[string]
identifier[ls] = identifier[siteStore] . identifier[findUnique] ( identifier[LoginSystem] , identifier[default] = keyword[None] )
keyword[if] identifier[ls] keyword[is] keyword[None] :
keyword[try] :
... | def _createLocalRouter(siteStore):
"""
Create an L{IMessageRouter} provider for the default case, where no
L{IMessageRouter} powerup is installed on the top-level store.
It wraps a L{LocalMessageRouter} around the L{LoginSystem} installed on the
given site store.
If no L{LoginSystem} is presen... |
def bfs(self):
'''
Breadth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
'''
yield (self.root, None)
todo = deque([(self.root[char], self.root) for char in self.root])
while todo:
curre... | def function[bfs, parameter[self]]:
constant[
Breadth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
]
<ast.Yield object at 0x7da1b2428400>
variable[todo] assign[=] call[name[deque], parameter[<ast.ListComp... | keyword[def] identifier[bfs] ( identifier[self] ):
literal[string]
keyword[yield] ( identifier[self] . identifier[root] , keyword[None] )
identifier[todo] = identifier[deque] ([( identifier[self] . identifier[root] [ identifier[char] ], identifier[self] . identifier[root] ) keyword[for] i... | def bfs(self):
"""
Breadth-first search generator. Yields `(node, parent)` for every
node in the tree, beginning with `(self.root, None)`.
"""
yield (self.root, None)
todo = deque([(self.root[char], self.root) for char in self.root])
while todo:
(current, parent) = todo.... |
def confd_state_cli_listen_ssh_port(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring")
cli = ET.SubElement(confd_state, "cli")
listen = ET.SubElement... | def function[confd_state_cli_listen_ssh_port, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[confd_state] assign[=] call[name[ET].SubElement, parameter[name[config], constant[confd-state]]]
... | keyword[def] identifier[confd_state_cli_listen_ssh_port] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[confd_state] = identifier[ET] . identifier[SubElement] ( identifier[config] , liter... | def confd_state_cli_listen_ssh_port(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
confd_state = ET.SubElement(config, 'confd-state', xmlns='http://tail-f.com/yang/confd-monitoring')
cli = ET.SubElement(confd_state, 'cli')
listen = ET.SubElement(cli, 'listen')
... |
def union(rasters):
"""
Union of rasters
Usage:
union(rasters)
where:
rasters is a list of GeoRaster objects
"""
if sum([rasters[0].x_cell_size == i.x_cell_size for i in rasters]) == len(rasters) \
and sum([rasters[0].y_cell_size == i.y_cell_size for i in rasters]) == len... | def function[union, parameter[rasters]]:
constant[
Union of rasters
Usage:
union(rasters)
where:
rasters is a list of GeoRaster objects
]
if <ast.BoolOp object at 0x7da1b28649a0> begin[:]
if compare[call[name[sum], parameter[<ast.ListComp object at 0x7da1... | keyword[def] identifier[union] ( identifier[rasters] ):
literal[string]
keyword[if] identifier[sum] ([ identifier[rasters] [ literal[int] ]. identifier[x_cell_size] == identifier[i] . identifier[x_cell_size] keyword[for] identifier[i] keyword[in] identifier[rasters] ])== identifier[len] ( identifier[r... | def union(rasters):
"""
Union of rasters
Usage:
union(rasters)
where:
rasters is a list of GeoRaster objects
"""
if sum([rasters[0].x_cell_size == i.x_cell_size for i in rasters]) == len(rasters) and sum([rasters[0].y_cell_size == i.y_cell_size for i in rasters]) == len(rasters)... |
def ping(self):
"""Attempts to ping the server using current credentials, and responds with the path of the currently
authenticated device"""
return self.handleresult(self.r.get(self.url,
params={"q": "this"})).text | def function[ping, parameter[self]]:
constant[Attempts to ping the server using current credentials, and responds with the path of the currently
authenticated device]
return[call[name[self].handleresult, parameter[call[name[self].r.get, parameter[name[self].url]]]].text] | keyword[def] identifier[ping] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[handleresult] ( identifier[self] . identifier[r] . identifier[get] ( identifier[self] . identifier[url] ,
identifier[params] ={ literal[string] : literal[string] })). identifi... | def ping(self):
"""Attempts to ping the server using current credentials, and responds with the path of the currently
authenticated device"""
return self.handleresult(self.r.get(self.url, params={'q': 'this'})).text |
def backward_transfer_pair(
backward_channel: NettingChannelState,
payer_transfer: LockedTransferSignedState,
pseudo_random_generator: random.Random,
block_number: BlockNumber,
) -> Tuple[Optional[MediationPairState], List[Event]]:
""" Sends a transfer backwards, allowing the previou... | def function[backward_transfer_pair, parameter[backward_channel, payer_transfer, pseudo_random_generator, block_number]]:
constant[ Sends a transfer backwards, allowing the previous hop to try a new
route.
When all the routes available for this node failed, send a transfer
backwards with the same a... | keyword[def] identifier[backward_transfer_pair] (
identifier[backward_channel] : identifier[NettingChannelState] ,
identifier[payer_transfer] : identifier[LockedTransferSignedState] ,
identifier[pseudo_random_generator] : identifier[random] . identifier[Random] ,
identifier[block_number] : identifier[BlockNumber]... | def backward_transfer_pair(backward_channel: NettingChannelState, payer_transfer: LockedTransferSignedState, pseudo_random_generator: random.Random, block_number: BlockNumber) -> Tuple[Optional[MediationPairState], List[Event]]:
""" Sends a transfer backwards, allowing the previous hop to try a new
route.
... |
def show_explorer(self):
"""Show the explorer"""
if self.dockwidget is not None:
if self.dockwidget.isHidden():
self.dockwidget.show()
self.dockwidget.raise_()
self.dockwidget.update() | def function[show_explorer, parameter[self]]:
constant[Show the explorer]
if compare[name[self].dockwidget is_not constant[None]] begin[:]
if call[name[self].dockwidget.isHidden, parameter[]] begin[:]
call[name[self].dockwidget.show, parameter[]]
c... | keyword[def] identifier[show_explorer] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[dockwidget] keyword[is] keyword[not] keyword[None] :
keyword[if] identifier[self] . identifier[dockwidget] . identifier[isHidden] ():
identif... | def show_explorer(self):
"""Show the explorer"""
if self.dockwidget is not None:
if self.dockwidget.isHidden():
self.dockwidget.show() # depends on [control=['if'], data=[]]
self.dockwidget.raise_()
self.dockwidget.update() # depends on [control=['if'], data=[]] |
def luhn_check(card_number):
""" checks to make sure that the card passes a luhn mod-10 checksum """
sum = 0
num_digits = len(card_number)
oddeven = num_digits & 1
for count in range(0, num_digits):
digit = int(card_number[count])
if not ((count & 1) ^ oddeven):
digit *... | def function[luhn_check, parameter[card_number]]:
constant[ checks to make sure that the card passes a luhn mod-10 checksum ]
variable[sum] assign[=] constant[0]
variable[num_digits] assign[=] call[name[len], parameter[name[card_number]]]
variable[oddeven] assign[=] binary_operation[name... | keyword[def] identifier[luhn_check] ( identifier[card_number] ):
literal[string]
identifier[sum] = literal[int]
identifier[num_digits] = identifier[len] ( identifier[card_number] )
identifier[oddeven] = identifier[num_digits] & literal[int]
keyword[for] identifier[count] keyword[in] id... | def luhn_check(card_number):
""" checks to make sure that the card passes a luhn mod-10 checksum """
sum = 0
num_digits = len(card_number)
oddeven = num_digits & 1
for count in range(0, num_digits):
digit = int(card_number[count])
if not count & 1 ^ oddeven:
digit *= 2 #... |
def set_droppable_order(self, droppable_ids):
""" reorder droppables per the passed in list
:param droppable_ids:
:return:
"""
reordered_droppables = []
current_droppable_ids = [d['id'] for d in self.my_osid_object_form._my_map['droppables']]
if set(droppable_ids)... | def function[set_droppable_order, parameter[self, droppable_ids]]:
constant[ reorder droppables per the passed in list
:param droppable_ids:
:return:
]
variable[reordered_droppables] assign[=] list[[]]
variable[current_droppable_ids] assign[=] <ast.ListComp object at 0x7d... | keyword[def] identifier[set_droppable_order] ( identifier[self] , identifier[droppable_ids] ):
literal[string]
identifier[reordered_droppables] =[]
identifier[current_droppable_ids] =[ identifier[d] [ literal[string] ] keyword[for] identifier[d] keyword[in] identifier[self] . identifier... | def set_droppable_order(self, droppable_ids):
""" reorder droppables per the passed in list
:param droppable_ids:
:return:
"""
reordered_droppables = []
current_droppable_ids = [d['id'] for d in self.my_osid_object_form._my_map['droppables']]
if set(droppable_ids) != set(current_... |
def get_community_badge_progress(self, steamID, badgeID, format=None):
"""Gets all the quests needed to get the specified badge, and which are completed.
steamID: The users ID
badgeID: The badge we're asking about
format: Return format. None defaults to json. (json, xml, vdf)
"... | def function[get_community_badge_progress, parameter[self, steamID, badgeID, format]]:
constant[Gets all the quests needed to get the specified badge, and which are completed.
steamID: The users ID
badgeID: The badge we're asking about
format: Return format. None defaults to json. (json... | keyword[def] identifier[get_community_badge_progress] ( identifier[self] , identifier[steamID] , identifier[badgeID] , identifier[format] = keyword[None] ):
literal[string]
identifier[parameters] ={ literal[string] : identifier[steamID] , literal[string] : identifier[badgeID] }
keyword[if]... | def get_community_badge_progress(self, steamID, badgeID, format=None):
"""Gets all the quests needed to get the specified badge, and which are completed.
steamID: The users ID
badgeID: The badge we're asking about
format: Return format. None defaults to json. (json, xml, vdf)
"""
... |
def best_prediction(self):
"""The highest value from among the predictions made by the action
sets in this match set."""
if self._best_prediction is None and self._action_sets:
self._best_prediction = max(
action_set.prediction
for action_set in self._... | def function[best_prediction, parameter[self]]:
constant[The highest value from among the predictions made by the action
sets in this match set.]
if <ast.BoolOp object at 0x7da1b0feb760> begin[:]
name[self]._best_prediction assign[=] call[name[max], parameter[<ast.GeneratorExp ob... | keyword[def] identifier[best_prediction] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_best_prediction] keyword[is] keyword[None] keyword[and] identifier[self] . identifier[_action_sets] :
identifier[self] . identifier[_best_prediction] = identif... | def best_prediction(self):
"""The highest value from among the predictions made by the action
sets in this match set."""
if self._best_prediction is None and self._action_sets:
self._best_prediction = max((action_set.prediction for action_set in self._action_sets.values())) # depends on [contro... |
def to_gnuplot_datafile(self, datafilepath):
"""Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be writt... | def function[to_gnuplot_datafile, parameter[self, datafilepath]]:
constant[Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True`... | keyword[def] identifier[to_gnuplot_datafile] ( identifier[self] , identifier[datafilepath] ):
literal[string]
keyword[try] :
identifier[datafile] = identifier[file] ( identifier[datafilepath] , literal[string] )
keyword[except] identifier[Exception] :
keyword[ret... | def to_gnuplot_datafile(self, datafilepath):
"""Dumps the TimeSeries into a gnuplot compatible data file.
:param string datafilepath: Path used to create the file. If that file already exists,
it will be overwritten!
:return: Returns :py:const:`True` if the data could be written, ... |
async def list(self, *args, **kwargs):
'''
Corresponds to GET request without a resource identifier, fetching documents from the database
'''
limit = int(kwargs.pop('limit', self.limit))
limit = 1000 if limit == 0 else limit # lets not go crazy here
offset = int(kwargs.p... | <ast.AsyncFunctionDef object at 0x7da18bc70700> | keyword[async] keyword[def] identifier[list] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[limit] = identifier[int] ( identifier[kwargs] . identifier[pop] ( literal[string] , identifier[self] . identifier[limit] ))
identifier[limit] = literal[... | async def list(self, *args, **kwargs):
"""
Corresponds to GET request without a resource identifier, fetching documents from the database
"""
limit = int(kwargs.pop('limit', self.limit))
limit = 1000 if limit == 0 else limit # lets not go crazy here
offset = int(kwargs.pop('offset', sel... |
def edit(self, edits, data_reg):
"""
Edit data in :class:`Data_Source`. Sets :attr:`issaved` to ``False``.
"""
data_reg.update(edits)
self._is_saved = False | def function[edit, parameter[self, edits, data_reg]]:
constant[
Edit data in :class:`Data_Source`. Sets :attr:`issaved` to ``False``.
]
call[name[data_reg].update, parameter[name[edits]]]
name[self]._is_saved assign[=] constant[False] | keyword[def] identifier[edit] ( identifier[self] , identifier[edits] , identifier[data_reg] ):
literal[string]
identifier[data_reg] . identifier[update] ( identifier[edits] )
identifier[self] . identifier[_is_saved] = keyword[False] | def edit(self, edits, data_reg):
"""
Edit data in :class:`Data_Source`. Sets :attr:`issaved` to ``False``.
"""
data_reg.update(edits)
self._is_saved = False |
def get_pending_bios_settings(self, only_allowed_settings=True):
"""Get current BIOS settings.
:param: only_allowed_settings: True when only allowed BIOS settings
are to be returned. If False, All the BIOS settings supported
by iLO are returned.
:return: a dictio... | def function[get_pending_bios_settings, parameter[self, only_allowed_settings]]:
constant[Get current BIOS settings.
:param: only_allowed_settings: True when only allowed BIOS settings
are to be returned. If False, All the BIOS settings supported
by iLO are returned.
... | keyword[def] identifier[get_pending_bios_settings] ( identifier[self] , identifier[only_allowed_settings] = keyword[True] ):
literal[string]
identifier[headers] , identifier[bios_uri] , identifier[bios_settings] = identifier[self] . identifier[_check_bios_resource] ()
keyword[try] :
... | def get_pending_bios_settings(self, only_allowed_settings=True):
"""Get current BIOS settings.
:param: only_allowed_settings: True when only allowed BIOS settings
are to be returned. If False, All the BIOS settings supported
by iLO are returned.
:return: a dictionary... |
def set_toplevel_object(self, instance, class_=None):
"""
Set the toplevel object to return from :meth:`get_toplevel_object` when
asked for `class_` to `instance`.
If `class_` is :data:`None`, the :func:`type` of the `instance` is
used.
"""
if class_ is None:
... | def function[set_toplevel_object, parameter[self, instance, class_]]:
constant[
Set the toplevel object to return from :meth:`get_toplevel_object` when
asked for `class_` to `instance`.
If `class_` is :data:`None`, the :func:`type` of the `instance` is
used.
]
if... | keyword[def] identifier[set_toplevel_object] ( identifier[self] , identifier[instance] , identifier[class_] = keyword[None] ):
literal[string]
keyword[if] identifier[class_] keyword[is] keyword[None] :
identifier[class_] = identifier[type] ( identifier[instance] )
identifie... | def set_toplevel_object(self, instance, class_=None):
"""
Set the toplevel object to return from :meth:`get_toplevel_object` when
asked for `class_` to `instance`.
If `class_` is :data:`None`, the :func:`type` of the `instance` is
used.
"""
if class_ is None:
cla... |
def add(self, key, value):
"""Add an entry to a list preference
Add `value` to the list of entries for the `key` preference.
"""
if not key in self.prefs:
self.prefs[key] = []
self.prefs[key].append(value) | def function[add, parameter[self, key, value]]:
constant[Add an entry to a list preference
Add `value` to the list of entries for the `key` preference.
]
if <ast.UnaryOp object at 0x7da204622aa0> begin[:]
call[name[self].prefs][name[key]] assign[=] list[[]]
call... | keyword[def] identifier[add] ( identifier[self] , identifier[key] , identifier[value] ):
literal[string]
keyword[if] keyword[not] identifier[key] keyword[in] identifier[self] . identifier[prefs] :
identifier[self] . identifier[prefs] [ identifier[key] ]=[]
identifier[self]... | def add(self, key, value):
"""Add an entry to a list preference
Add `value` to the list of entries for the `key` preference.
"""
if not key in self.prefs:
self.prefs[key] = [] # depends on [control=['if'], data=[]]
self.prefs[key].append(value) |
def from_dict(data, ctx):
"""
Instantiate a new Instrument from a dict (generally from loading a JSON
response). The data used to instantiate the Instrument is a shallow
copy of the dict passed in, with any complex child types instantiated
appropriately.
"""
data... | def function[from_dict, parameter[data, ctx]]:
constant[
Instantiate a new Instrument from a dict (generally from loading a JSON
response). The data used to instantiate the Instrument is a shallow
copy of the dict passed in, with any complex child types instantiated
appropriately... | keyword[def] identifier[from_dict] ( identifier[data] , identifier[ctx] ):
literal[string]
identifier[data] = identifier[data] . identifier[copy] ()
keyword[if] identifier[data] . identifier[get] ( literal[string] ) keyword[is] keyword[not] keyword[None] :
identifier[data... | def from_dict(data, ctx):
"""
Instantiate a new Instrument from a dict (generally from loading a JSON
response). The data used to instantiate the Instrument is a shallow
copy of the dict passed in, with any complex child types instantiated
appropriately.
"""
data = data.c... |
def srfscc(srfstr, bodyid):
"""
Translate a surface string, together with a body ID code, to the
corresponding surface ID code. The input surface string may
contain a name or an integer ID code.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/srfscc_c.html
:param srfstr: Su... | def function[srfscc, parameter[srfstr, bodyid]]:
constant[
Translate a surface string, together with a body ID code, to the
corresponding surface ID code. The input surface string may
contain a name or an integer ID code.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/srfscc_c.... | keyword[def] identifier[srfscc] ( identifier[srfstr] , identifier[bodyid] ):
literal[string]
identifier[srfstr] = identifier[stypes] . identifier[stringToCharP] ( identifier[srfstr] )
identifier[bodyid] = identifier[ctypes] . identifier[c_int] ( identifier[bodyid] )
identifier[code] = identifier[... | def srfscc(srfstr, bodyid):
"""
Translate a surface string, together with a body ID code, to the
corresponding surface ID code. The input surface string may
contain a name or an integer ID code.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/srfscc_c.html
:param srfstr: Su... |
def is_func_decorator(node: astroid.node_classes.NodeNG) -> bool:
"""return true if the name is used in function decorator"""
parent = node.parent
while parent is not None:
if isinstance(parent, astroid.Decorators):
return True
if parent.is_statement or isinstance(
pa... | def function[is_func_decorator, parameter[node]]:
constant[return true if the name is used in function decorator]
variable[parent] assign[=] name[node].parent
while compare[name[parent] is_not constant[None]] begin[:]
if call[name[isinstance], parameter[name[parent], name[astroid... | keyword[def] identifier[is_func_decorator] ( identifier[node] : identifier[astroid] . identifier[node_classes] . identifier[NodeNG] )-> identifier[bool] :
literal[string]
identifier[parent] = identifier[node] . identifier[parent]
keyword[while] identifier[parent] keyword[is] keyword[not] keyword[... | def is_func_decorator(node: astroid.node_classes.NodeNG) -> bool:
"""return true if the name is used in function decorator"""
parent = node.parent
while parent is not None:
if isinstance(parent, astroid.Decorators):
return True # depends on [control=['if'], data=[]]
if parent.is... |
def to_template(template_name=None):
"""
Decorator for simple call TemplateResponse
Examples:
@to_template("test.html")
def test(request):
return {'test': 100}
@to_template
def test2(request):
return {'test': 100, 'TEMPLATE': 'test.html'}
@to_template
def test2(requ... | def function[to_template, parameter[template_name]]:
constant[
Decorator for simple call TemplateResponse
Examples:
@to_template("test.html")
def test(request):
return {'test': 100}
@to_template
def test2(request):
return {'test': 100, 'TEMPLATE': 'test.html'}
@to_t... | keyword[def] identifier[to_template] ( identifier[template_name] = keyword[None] ):
literal[string]
keyword[def] identifier[decorator] ( identifier[view_func] ):
keyword[def] identifier[_wrapped_view] ( identifier[request] ,* identifier[args] ,** identifier[kwargs] ):
identifier[re... | def to_template(template_name=None):
"""
Decorator for simple call TemplateResponse
Examples:
@to_template("test.html")
def test(request):
return {'test': 100}
@to_template
def test2(request):
return {'test': 100, 'TEMPLATE': 'test.html'}
@to_template
def test2(requ... |
def sort(self, order="asc"):
"""Getting the sorted result of the given list
:@param order: "asc"
:@type order: string
:@return self
"""
self.__prepare()
if isinstance(self._json_data, list):
if order == "asc":
self._json_data = sorted... | def function[sort, parameter[self, order]]:
constant[Getting the sorted result of the given list
:@param order: "asc"
:@type order: string
:@return self
]
call[name[self].__prepare, parameter[]]
if call[name[isinstance], parameter[name[self]._json_data, name[lis... | keyword[def] identifier[sort] ( identifier[self] , identifier[order] = literal[string] ):
literal[string]
identifier[self] . identifier[__prepare] ()
keyword[if] identifier[isinstance] ( identifier[self] . identifier[_json_data] , identifier[list] ):
keyword[if] identifier[o... | def sort(self, order='asc'):
"""Getting the sorted result of the given list
:@param order: "asc"
:@type order: string
:@return self
"""
self.__prepare()
if isinstance(self._json_data, list):
if order == 'asc':
self._json_data = sorted(self._json_data) #... |
def get(self):
"""Get the contents of a GValue.
The contents of the GValue are read out as a Python type.
"""
# logger.debug('GValue.get: self = %s', self)
gtype = self.gvalue.g_type
fundamental = gobject_lib.g_type_fundamental(gtype)
result = None
if... | def function[get, parameter[self]]:
constant[Get the contents of a GValue.
The contents of the GValue are read out as a Python type.
]
variable[gtype] assign[=] name[self].gvalue.g_type
variable[fundamental] assign[=] call[name[gobject_lib].g_type_fundamental, parameter[name[gty... | keyword[def] identifier[get] ( identifier[self] ):
literal[string]
identifier[gtype] = identifier[self] . identifier[gvalue] . identifier[g_type]
identifier[fundamental] = identifier[gobject_lib] . identifier[g_type_fundamental] ( identifier[gtype] )
identifier[result... | def get(self):
"""Get the contents of a GValue.
The contents of the GValue are read out as a Python type.
"""
# logger.debug('GValue.get: self = %s', self)
gtype = self.gvalue.g_type
fundamental = gobject_lib.g_type_fundamental(gtype)
result = None
if gtype == GValue.gbool_type:... |
def _find_new_ancestors(cls, db: BaseDB, header: BlockHeader) -> Iterable[BlockHeader]:
"""
Returns the chain leading up from the given header until (but not including)
the first ancestor it has in common with our canonical chain.
If D is the canonical head in the following chain, and F... | def function[_find_new_ancestors, parameter[cls, db, header]]:
constant[
Returns the chain leading up from the given header until (but not including)
the first ancestor it has in common with our canonical chain.
If D is the canonical head in the following chain, and F is the new header,... | keyword[def] identifier[_find_new_ancestors] ( identifier[cls] , identifier[db] : identifier[BaseDB] , identifier[header] : identifier[BlockHeader] )-> identifier[Iterable] [ identifier[BlockHeader] ]:
literal[string]
identifier[h] = identifier[header]
keyword[while] keyword[True] :
... | def _find_new_ancestors(cls, db: BaseDB, header: BlockHeader) -> Iterable[BlockHeader]:
"""
Returns the chain leading up from the given header until (but not including)
the first ancestor it has in common with our canonical chain.
If D is the canonical head in the following chain, and F is ... |
def get_widget_template(self, field_name, field):
"""
Returns the optional widget template to use when rendering the widget
for a form field.
Preference of template selection:
1. Template from `widget_template_overrides` selected by field name
2. Template from `w... | def function[get_widget_template, parameter[self, field_name, field]]:
constant[
Returns the optional widget template to use when rendering the widget
for a form field.
Preference of template selection:
1. Template from `widget_template_overrides` selected by field name
... | keyword[def] identifier[get_widget_template] ( identifier[self] , identifier[field_name] , identifier[field] ):
literal[string]
identifier[templates] = identifier[self] . identifier[widget_template_overrides] keyword[or] {}
identifier[template_name] = identifier[templates] . identifier[g... | def get_widget_template(self, field_name, field):
"""
Returns the optional widget template to use when rendering the widget
for a form field.
Preference of template selection:
1. Template from `widget_template_overrides` selected by field name
2. Template from `widge... |
def grab_hotkey(self, item):
"""
Grab a hotkey.
If the hotkey has no filter regex, it is global and is grabbed recursively from the root window
If it has a filter regex, iterate over all children of the root and grab from matching windows
"""
if item.get_applicable_regex... | def function[grab_hotkey, parameter[self, item]]:
constant[
Grab a hotkey.
If the hotkey has no filter regex, it is global and is grabbed recursively from the root window
If it has a filter regex, iterate over all children of the root and grab from matching windows
]
if ... | keyword[def] identifier[grab_hotkey] ( identifier[self] , identifier[item] ):
literal[string]
keyword[if] identifier[item] . identifier[get_applicable_regex] () keyword[is] keyword[None] :
identifier[self] . identifier[__enqueue] ( identifier[self] . identifier[__grabHotkey] , identi... | def grab_hotkey(self, item):
"""
Grab a hotkey.
If the hotkey has no filter regex, it is global and is grabbed recursively from the root window
If it has a filter regex, iterate over all children of the root and grab from matching windows
"""
if item.get_applicable_regex() is No... |
def _prepare_io_handler(self, handler):
"""Call the `interfaces.IOHandler.prepare` method and
remove the handler from unprepared handler list when done.
"""
logger.debug(" preparing handler: {0!r}".format(handler))
ret = handler.prepare()
logger.debug(" prepare result: ... | def function[_prepare_io_handler, parameter[self, handler]]:
constant[Call the `interfaces.IOHandler.prepare` method and
remove the handler from unprepared handler list when done.
]
call[name[logger].debug, parameter[call[constant[ preparing handler: {0!r}].format, parameter[name[handler... | keyword[def] identifier[_prepare_io_handler] ( identifier[self] , identifier[handler] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] . identifier[format] ( identifier[handler] ))
identifier[ret] = identifier[handler] . identifier[prepare] ()
identifier... | def _prepare_io_handler(self, handler):
"""Call the `interfaces.IOHandler.prepare` method and
remove the handler from unprepared handler list when done.
"""
logger.debug(' preparing handler: {0!r}'.format(handler))
ret = handler.prepare()
logger.debug(' prepare result: {0!r}'.format(re... |
def _es_content(settings):
"""
Extract content formating related subset of widget settings.
"""
return {k: settings[k] for k in (ConsoleWidget.SETTING_WIDTH,
ConsoleWidget.SETTING_ALIGN,
ConsoleWidget.SETTI... | def function[_es_content, parameter[settings]]:
constant[
Extract content formating related subset of widget settings.
]
return[<ast.DictComp object at 0x7da2045679a0>] | keyword[def] identifier[_es_content] ( identifier[settings] ):
literal[string]
keyword[return] { identifier[k] : identifier[settings] [ identifier[k] ] keyword[for] identifier[k] keyword[in] ( identifier[ConsoleWidget] . identifier[SETTING_WIDTH] ,
identifier[ConsoleWidget] . identifier[... | def _es_content(settings):
"""
Extract content formating related subset of widget settings.
"""
return {k: settings[k] for k in (ConsoleWidget.SETTING_WIDTH, ConsoleWidget.SETTING_ALIGN, ConsoleWidget.SETTING_PADDING, ConsoleWidget.SETTING_PADDING_LEFT, ConsoleWidget.SETTING_PADDING_RIGHT, Conso... |
def p_functioncall(self, tree):
# Where all the real interpreter action is
# Note that things that should only be done at the top level
# are performed in the interpret function defined below.
''' V ::= function_call ( V LPAREN V RPAREN )'''
if type(tree[2].value) != type([]... | def function[p_functioncall, parameter[self, tree]]:
constant[ V ::= function_call ( V LPAREN V RPAREN )]
if compare[call[name[type], parameter[call[name[tree]][constant[2]].value]] not_equal[!=] call[name[type], parameter[list[[]]]]] begin[:]
variable[args] assign[=] list[[<ast.Attribut... | keyword[def] identifier[p_functioncall] ( identifier[self] , identifier[tree] ):
literal[string]
keyword[if] identifier[type] ( identifier[tree] [ literal[int] ]. identifier[value] )!= identifier[type] ([]):
identifier[args] =[ identifier[tree] [ literal[int] ]. identifier[va... | def p_functioncall(self, tree): # Where all the real interpreter action is
# Note that things that should only be done at the top level
# are performed in the interpret function defined below.
' V ::= function_call ( V LPAREN V RPAREN )'
if type(tree[2].value) != type([]):
args = [tree[2].value... |
def get_ftype_counts(self):
"""Get the counts of ftypes in this object.
Returns:
The counts of ftypes in this object.
"""
if hasattr(self, "ftype"):
return pandas.Series({self.ftype: 1})
return self.ftypes.value_counts().sort_index() | def function[get_ftype_counts, parameter[self]]:
constant[Get the counts of ftypes in this object.
Returns:
The counts of ftypes in this object.
]
if call[name[hasattr], parameter[name[self], constant[ftype]]] begin[:]
return[call[name[pandas].Series, parameter[dicti... | keyword[def] identifier[get_ftype_counts] ( identifier[self] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[self] , literal[string] ):
keyword[return] identifier[pandas] . identifier[Series] ({ identifier[self] . identifier[ftype] : literal[int] })
keywo... | def get_ftype_counts(self):
"""Get the counts of ftypes in this object.
Returns:
The counts of ftypes in this object.
"""
if hasattr(self, 'ftype'):
return pandas.Series({self.ftype: 1}) # depends on [control=['if'], data=[]]
return self.ftypes.value_counts().sort_index... |
def _encode_fields(self, xfield, yfield, time_unit=None,
scale=Scale(zero=False)):
"""
Encode the fields in Altair format
"""
if scale is None:
scale = Scale()
xfieldtype = xfield[1]
yfieldtype = yfield[1]
x_options = None
... | def function[_encode_fields, parameter[self, xfield, yfield, time_unit, scale]]:
constant[
Encode the fields in Altair format
]
if compare[name[scale] is constant[None]] begin[:]
variable[scale] assign[=] call[name[Scale], parameter[]]
variable[xfieldtype] assign[... | keyword[def] identifier[_encode_fields] ( identifier[self] , identifier[xfield] , identifier[yfield] , identifier[time_unit] = keyword[None] ,
identifier[scale] = identifier[Scale] ( identifier[zero] = keyword[False] )):
literal[string]
keyword[if] identifier[scale] keyword[is] keyword[None] :
... | def _encode_fields(self, xfield, yfield, time_unit=None, scale=Scale(zero=False)):
"""
Encode the fields in Altair format
"""
if scale is None:
scale = Scale() # depends on [control=['if'], data=['scale']]
xfieldtype = xfield[1]
yfieldtype = yfield[1]
x_options = None
if... |
def notify_done(self, error=False, run_done_callbacks=True):
''' if error clear all sessions otherwise check to see if all other sessions are complete
then run the done callbacks
'''
if error:
for _session in self._sessions.values():
_session.set_done()
... | def function[notify_done, parameter[self, error, run_done_callbacks]]:
constant[ if error clear all sessions otherwise check to see if all other sessions are complete
then run the done callbacks
]
if name[error] begin[:]
for taget[name[_session]] in starred[call[name[... | keyword[def] identifier[notify_done] ( identifier[self] , identifier[error] = keyword[False] , identifier[run_done_callbacks] = keyword[True] ):
literal[string]
keyword[if] identifier[error] :
keyword[for] identifier[_session] keyword[in] identifier[self] . identifier[_sessions] . ... | def notify_done(self, error=False, run_done_callbacks=True):
""" if error clear all sessions otherwise check to see if all other sessions are complete
then run the done callbacks
"""
if error:
for _session in self._sessions.values():
_session.set_done() # depends on [con... |
def dashboard(request):
"Counts, aggregations and more!"
end_time = now()
start_time = end_time - timedelta(days=7)
defaults = {'start': start_time, 'end': end_time}
form = DashboardForm(data=request.GET or defaults)
if form.is_valid():
start_time = form.cleaned_data['start']
en... | def function[dashboard, parameter[request]]:
constant[Counts, aggregations and more!]
variable[end_time] assign[=] call[name[now], parameter[]]
variable[start_time] assign[=] binary_operation[name[end_time] - call[name[timedelta], parameter[]]]
variable[defaults] assign[=] dictionary[[<a... | keyword[def] identifier[dashboard] ( identifier[request] ):
literal[string]
identifier[end_time] = identifier[now] ()
identifier[start_time] = identifier[end_time] - identifier[timedelta] ( identifier[days] = literal[int] )
identifier[defaults] ={ literal[string] : identifier[start_time] , litera... | def dashboard(request):
"""Counts, aggregations and more!"""
end_time = now()
start_time = end_time - timedelta(days=7)
defaults = {'start': start_time, 'end': end_time}
form = DashboardForm(data=request.GET or defaults)
if form.is_valid():
start_time = form.cleaned_data['start']
... |
def rotvec(v1, angle, iaxis):
"""
Transform a vector to a new coordinate system rotated by angle
radians about axis iaxis. This transformation rotates v1 by
angle radians about the specified axis.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rotvec_c.html
:param v1: Vector whose co... | def function[rotvec, parameter[v1, angle, iaxis]]:
constant[
Transform a vector to a new coordinate system rotated by angle
radians about axis iaxis. This transformation rotates v1 by
angle radians about the specified axis.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rotvec_c.html
... | keyword[def] identifier[rotvec] ( identifier[v1] , identifier[angle] , identifier[iaxis] ):
literal[string]
identifier[v1] = identifier[stypes] . identifier[toDoubleVector] ( identifier[v1] )
identifier[angle] = identifier[ctypes] . identifier[c_double] ( identifier[angle] )
identifier[iaxis] = i... | def rotvec(v1, angle, iaxis):
"""
Transform a vector to a new coordinate system rotated by angle
radians about axis iaxis. This transformation rotates v1 by
angle radians about the specified axis.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/rotvec_c.html
:param v1: Vector whose co... |
def gen_text(env: TextIOBase, package: str, tmpl: str):
"""Create output from Jinja template."""
if env:
env_args = json_datetime.load(env)
else:
env_args = {}
jinja_env = template.setup(package)
echo(jinja_env.get_template(tmpl).render(**env_args)) | def function[gen_text, parameter[env, package, tmpl]]:
constant[Create output from Jinja template.]
if name[env] begin[:]
variable[env_args] assign[=] call[name[json_datetime].load, parameter[name[env]]]
variable[jinja_env] assign[=] call[name[template].setup, parameter[name[pack... | keyword[def] identifier[gen_text] ( identifier[env] : identifier[TextIOBase] , identifier[package] : identifier[str] , identifier[tmpl] : identifier[str] ):
literal[string]
keyword[if] identifier[env] :
identifier[env_args] = identifier[json_datetime] . identifier[load] ( identifier[env] )
k... | def gen_text(env: TextIOBase, package: str, tmpl: str):
"""Create output from Jinja template."""
if env:
env_args = json_datetime.load(env) # depends on [control=['if'], data=[]]
else:
env_args = {}
jinja_env = template.setup(package)
echo(jinja_env.get_template(tmpl).render(**env_a... |
def check_redirect_uris(uris, client_type=None):
"""
This function checks all return uris provided and tries to deduce
as what type of client we should register.
:param uris: The redirect URIs to check.
:type uris: list
:param client_type: An indicator of which client type you are expecting
... | def function[check_redirect_uris, parameter[uris, client_type]]:
constant[
This function checks all return uris provided and tries to deduce
as what type of client we should register.
:param uris: The redirect URIs to check.
:type uris: list
:param client_type: An indicator of which client ... | keyword[def] identifier[check_redirect_uris] ( identifier[uris] , identifier[client_type] = keyword[None] ):
literal[string]
keyword[if] identifier[client_type] keyword[not] keyword[in] [ keyword[None] , literal[string] , literal[string] ]:
keyword[raise] identifier[ValueError] ( literal[strin... | def check_redirect_uris(uris, client_type=None):
"""
This function checks all return uris provided and tries to deduce
as what type of client we should register.
:param uris: The redirect URIs to check.
:type uris: list
:param client_type: An indicator of which client type you are expecting
... |
def get_source_files(target, build_context) -> list:
"""Return list of source files for `target`."""
all_sources = list(target.props.sources)
for proto_dep_name in target.props.protos:
proto_dep = build_context.targets[proto_dep_name]
all_sources.extend(proto_dep.artifacts.get(AT.gen_cc).key... | def function[get_source_files, parameter[target, build_context]]:
constant[Return list of source files for `target`.]
variable[all_sources] assign[=] call[name[list], parameter[name[target].props.sources]]
for taget[name[proto_dep_name]] in starred[name[target].props.protos] begin[:]
... | keyword[def] identifier[get_source_files] ( identifier[target] , identifier[build_context] )-> identifier[list] :
literal[string]
identifier[all_sources] = identifier[list] ( identifier[target] . identifier[props] . identifier[sources] )
keyword[for] identifier[proto_dep_name] keyword[in] identifie... | def get_source_files(target, build_context) -> list:
"""Return list of source files for `target`."""
all_sources = list(target.props.sources)
for proto_dep_name in target.props.protos:
proto_dep = build_context.targets[proto_dep_name]
all_sources.extend(proto_dep.artifacts.get(AT.gen_cc).key... |
def blacklist(ctx, blacklist_account, account):
""" Add an account to a blacklist
"""
account = Account(account, blockchain_instance=ctx.blockchain)
print_tx(account.blacklist(blacklist_account)) | def function[blacklist, parameter[ctx, blacklist_account, account]]:
constant[ Add an account to a blacklist
]
variable[account] assign[=] call[name[Account], parameter[name[account]]]
call[name[print_tx], parameter[call[name[account].blacklist, parameter[name[blacklist_account]]]]] | keyword[def] identifier[blacklist] ( identifier[ctx] , identifier[blacklist_account] , identifier[account] ):
literal[string]
identifier[account] = identifier[Account] ( identifier[account] , identifier[blockchain_instance] = identifier[ctx] . identifier[blockchain] )
identifier[print_tx] ( identifier... | def blacklist(ctx, blacklist_account, account):
""" Add an account to a blacklist
"""
account = Account(account, blockchain_instance=ctx.blockchain)
print_tx(account.blacklist(blacklist_account)) |
def next_interval(self, interval):
"""
Given a value of an interval, this function returns the
next interval value
"""
index = np.where(self.intervals == interval)
if index[0][0] + 1 < len(self.intervals):
return self.intervals[index[0][0] + 1]
else:
... | def function[next_interval, parameter[self, interval]]:
constant[
Given a value of an interval, this function returns the
next interval value
]
variable[index] assign[=] call[name[np].where, parameter[compare[name[self].intervals equal[==] name[interval]]]]
if compare[bi... | keyword[def] identifier[next_interval] ( identifier[self] , identifier[interval] ):
literal[string]
identifier[index] = identifier[np] . identifier[where] ( identifier[self] . identifier[intervals] == identifier[interval] )
keyword[if] identifier[index] [ literal[int] ][ literal[int] ]+ l... | def next_interval(self, interval):
"""
Given a value of an interval, this function returns the
next interval value
"""
index = np.where(self.intervals == interval)
if index[0][0] + 1 < len(self.intervals):
return self.intervals[index[0][0] + 1] # depends on [control=['if'],... |
def get(msg_or_dict, key, default=_SENTINEL):
"""Retrieve a key's value from a protobuf Message or dictionary.
Args:
mdg_or_dict (Union[~google.protobuf.message.Message, Mapping]): the
object.
key (str): The key to retrieve from the object.
default (Any): If the key is not p... | def function[get, parameter[msg_or_dict, key, default]]:
constant[Retrieve a key's value from a protobuf Message or dictionary.
Args:
mdg_or_dict (Union[~google.protobuf.message.Message, Mapping]): the
object.
key (str): The key to retrieve from the object.
default (Any)... | keyword[def] identifier[get] ( identifier[msg_or_dict] , identifier[key] , identifier[default] = identifier[_SENTINEL] ):
literal[string]
identifier[key] , identifier[subkey] = identifier[_resolve_subkeys] ( identifier[key] )
keyword[if] identifier[isinstance] ( identifier[msg_or_dict... | def get(msg_or_dict, key, default=_SENTINEL):
"""Retrieve a key's value from a protobuf Message or dictionary.
Args:
mdg_or_dict (Union[~google.protobuf.message.Message, Mapping]): the
object.
key (str): The key to retrieve from the object.
default (Any): If the key is not p... |
def get_irmc_firmware_version(snmp_client):
"""Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
"""
try:
bmc_name = snmp_client.get(BMC_NAME_OID)
... | def function[get_irmc_firmware_version, parameter[snmp_client]]:
constant[Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
]
<ast.Try object at 0x7da1b19... | keyword[def] identifier[get_irmc_firmware_version] ( identifier[snmp_client] ):
literal[string]
keyword[try] :
identifier[bmc_name] = identifier[snmp_client] . identifier[get] ( identifier[BMC_NAME_OID] )
identifier[irmc_firm_ver] = identifier[snmp_client] . identifier[get] ( identifier[... | def get_irmc_firmware_version(snmp_client):
"""Get irmc firmware version of the node.
:param snmp_client: an SNMP client object.
:raises: SNMPFailure if SNMP operation failed.
:returns: a string of bmc name and irmc firmware version.
"""
try:
bmc_name = snmp_client.get(BMC_NAME_OID)
... |
def consequence_level(self):
"""
One of ``NONE``, ``WATCH``, ``WARNING``, ``DISTRESS``, ``CRITICAL``
or ``SEVERE``.
"""
if self._proto.HasField('consequenceLevel'):
return mdb_pb2.SignificanceInfo.SignificanceLevelType.Name(self._proto.consequenceLevel)
return... | def function[consequence_level, parameter[self]]:
constant[
One of ``NONE``, ``WATCH``, ``WARNING``, ``DISTRESS``, ``CRITICAL``
or ``SEVERE``.
]
if call[name[self]._proto.HasField, parameter[constant[consequenceLevel]]] begin[:]
return[call[name[mdb_pb2].SignificanceInfo.... | keyword[def] identifier[consequence_level] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_proto] . identifier[HasField] ( literal[string] ):
keyword[return] identifier[mdb_pb2] . identifier[SignificanceInfo] . identifier[SignificanceLevelType] . iden... | def consequence_level(self):
"""
One of ``NONE``, ``WATCH``, ``WARNING``, ``DISTRESS``, ``CRITICAL``
or ``SEVERE``.
"""
if self._proto.HasField('consequenceLevel'):
return mdb_pb2.SignificanceInfo.SignificanceLevelType.Name(self._proto.consequenceLevel) # depends on [control=['i... |
def find_by_reference_ids(reference_ids, _connection=None, page_size=100,
page_number=0, sort_by=enums.DEFAULT_SORT_BY,
sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of reference ids
"""
if not isinstance(reference_ids, (list, tuple)):
... | def function[find_by_reference_ids, parameter[reference_ids, _connection, page_size, page_number, sort_by, sort_order]]:
constant[
List all videos identified by a list of reference ids
]
if <ast.UnaryOp object at 0x7da204566590> begin[:]
variable[err] assign[=] constant[V... | keyword[def] identifier[find_by_reference_ids] ( identifier[reference_ids] , identifier[_connection] = keyword[None] , identifier[page_size] = literal[int] ,
identifier[page_number] = literal[int] , identifier[sort_by] = identifier[enums] . identifier[DEFAULT_SORT_BY] ,
identifier[sort_order] = identifier[enums] . ... | def find_by_reference_ids(reference_ids, _connection=None, page_size=100, page_number=0, sort_by=enums.DEFAULT_SORT_BY, sort_order=enums.DEFAULT_SORT_ORDER):
"""
List all videos identified by a list of reference ids
"""
if not isinstance(reference_ids, (list, tuple)):
err = 'Video.find_b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.