code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def union(self, i):
'''If intervals intersect, returns their union, otherwise returns None'''
if self.intersects(i) or self.end + 1 == i.start or i.end + 1 == self.start:
return Interval(min(self.start, i.start), max(self.end, i.end))
else:
return None | def function[union, parameter[self, i]]:
constant[If intervals intersect, returns their union, otherwise returns None]
if <ast.BoolOp object at 0x7da1aff1f520> begin[:]
return[call[name[Interval], parameter[call[name[min], parameter[name[self].start, name[i].start]], call[name[max], parameter[na... | keyword[def] identifier[union] ( identifier[self] , identifier[i] ):
literal[string]
keyword[if] identifier[self] . identifier[intersects] ( identifier[i] ) keyword[or] identifier[self] . identifier[end] + literal[int] == identifier[i] . identifier[start] keyword[or] identifier[i] . identifier[... | def union(self, i):
"""If intervals intersect, returns their union, otherwise returns None"""
if self.intersects(i) or self.end + 1 == i.start or i.end + 1 == self.start:
return Interval(min(self.start, i.start), max(self.end, i.end)) # depends on [control=['if'], data=[]]
else:
return None |
def asset_create_asset(self, *args, **kwargs):
"""Create a new asset
:returns: None
:rtype: None
:raises: None
"""
if not self.cur_asset:
return
asset = self.create_asset(project=self.cur_asset.project, asset=self.cur_asset)
if not asset:
... | def function[asset_create_asset, parameter[self]]:
constant[Create a new asset
:returns: None
:rtype: None
:raises: None
]
if <ast.UnaryOp object at 0x7da1b1434940> begin[:]
return[None]
variable[asset] assign[=] call[name[self].create_asset, parameter[]]... | keyword[def] identifier[asset_create_asset] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[cur_asset] :
keyword[return]
identifier[asset] = identifier[self] . identifier[create_asset] (... | def asset_create_asset(self, *args, **kwargs):
"""Create a new asset
:returns: None
:rtype: None
:raises: None
"""
if not self.cur_asset:
return # depends on [control=['if'], data=[]]
asset = self.create_asset(project=self.cur_asset.project, asset=self.cur_asset)
... |
def unionIntoArray(self, inputVector, outputVector, forceOutput=False):
"""
Create a union of the inputVector and copy the result into the outputVector
Parameters:
----------------------------
@param inputVector: The inputVector can be either a full numpy array
containing 0's... | def function[unionIntoArray, parameter[self, inputVector, outputVector, forceOutput]]:
constant[
Create a union of the inputVector and copy the result into the outputVector
Parameters:
----------------------------
@param inputVector: The inputVector can be either a full numpy array
... | keyword[def] identifier[unionIntoArray] ( identifier[self] , identifier[inputVector] , identifier[outputVector] , identifier[forceOutput] = keyword[False] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[inputVector] , identifier[numpy] . identifier[ndarray] ):
keyword[if] identi... | def unionIntoArray(self, inputVector, outputVector, forceOutput=False):
"""
Create a union of the inputVector and copy the result into the outputVector
Parameters:
----------------------------
@param inputVector: The inputVector can be either a full numpy array
containing 0's... |
def F_oneway(*lists):
"""
Performs a 1-way ANOVA, returning an F-value and probability given
any number of groups. From Heiman, pp.394-7.
Usage: F_oneway(*lists) where *lists is any number of lists, one per
treatment group
Returns: F value, one-tailed p-value
"""
a = len... | def function[F_oneway, parameter[]]:
constant[
Performs a 1-way ANOVA, returning an F-value and probability given
any number of groups. From Heiman, pp.394-7.
Usage: F_oneway(*lists) where *lists is any number of lists, one per
treatment group
Returns: F value, one-taile... | keyword[def] identifier[F_oneway] (* identifier[lists] ):
literal[string]
identifier[a] = identifier[len] ( identifier[lists] )
identifier[means] =[ literal[int] ]* identifier[a]
identifier[vars] =[ literal[int] ]* identifier[a]
identifier[ns] =[ literal[int] ]* identifier[a]
identif... | def F_oneway(*lists):
"""
Performs a 1-way ANOVA, returning an F-value and probability given
any number of groups. From Heiman, pp.394-7.
Usage: F_oneway(*lists) where *lists is any number of lists, one per
treatment group
Returns: F value, one-tailed p-value
"""
a = len... |
def shortInterestDF(symbol, date=None, token='', version=''):
'''The consolidated market short interest positions in all IEX-listed securities are included in the IEX Short Interest Report.
The report data will be published daily at 4:00pm ET.
https://iexcloud.io/docs/api/#listed-short-interest-list-in-de... | def function[shortInterestDF, parameter[symbol, date, token, version]]:
constant[The consolidated market short interest positions in all IEX-listed securities are included in the IEX Short Interest Report.
The report data will be published daily at 4:00pm ET.
https://iexcloud.io/docs/api/#listed-short... | keyword[def] identifier[shortInterestDF] ( identifier[symbol] , identifier[date] = keyword[None] , identifier[token] = literal[string] , identifier[version] = literal[string] ):
literal[string]
identifier[df] = identifier[pd] . identifier[DataFrame] ( identifier[shortInterest] ( identifier[symbol] , identi... | def shortInterestDF(symbol, date=None, token='', version=''):
"""The consolidated market short interest positions in all IEX-listed securities are included in the IEX Short Interest Report.
The report data will be published daily at 4:00pm ET.
https://iexcloud.io/docs/api/#listed-short-interest-list-in-de... |
def _get_shade_hdrgos(**kws):
"""If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F."""
# KWS: shade_hdrgos hdrgo_prt section_sortby top_n
if 'shade_hdrgos' in kws:
return kws['shade_hdrgos']
# Return user-sepcified hdrgo_prt, if provided
if 'h... | def function[_get_shade_hdrgos, parameter[]]:
constant[If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F.]
if compare[constant[shade_hdrgos] in name[kws]] begin[:]
return[call[name[kws]][constant[shade_hdrgos]]]
if compare[constant[hdrgo_prt] in name[kws]] begin[... | keyword[def] identifier[_get_shade_hdrgos] (** identifier[kws] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[kws] :
keyword[return] identifier[kws] [ literal[string] ]
keyword[if] literal[string] keyword[in] identifier[kws] ... | def _get_shade_hdrgos(**kws):
"""If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F."""
# KWS: shade_hdrgos hdrgo_prt section_sortby top_n
if 'shade_hdrgos' in kws:
return kws['shade_hdrgos'] # depends on [control=['if'], data=['kws']]
# Return user-sepcified hdrgo_prt, ... |
def disordered_formula(disordered_struct, symbols=('x', 'y', 'z'), fmt='plain'):
"""
Returns a formula of a form like AxB1-x (x=0.5)
for disordered structures. Will only return a
formula for disordered structures with one
kind of disordered site at present.
Args:
disordered_struct: a di... | def function[disordered_formula, parameter[disordered_struct, symbols, fmt]]:
constant[
Returns a formula of a form like AxB1-x (x=0.5)
for disordered structures. Will only return a
formula for disordered structures with one
kind of disordered site at present.
Args:
disordered_struc... | keyword[def] identifier[disordered_formula] ( identifier[disordered_struct] , identifier[symbols] =( literal[string] , literal[string] , literal[string] ), identifier[fmt] = literal[string] ):
literal[string]
keyword[from] identifier[pymatgen] . identifier[core] . identifier... | def disordered_formula(disordered_struct, symbols=('x', 'y', 'z'), fmt='plain'):
"""
Returns a formula of a form like AxB1-x (x=0.5)
for disordered structures. Will only return a
formula for disordered structures with one
kind of disordered site at present.
Args:
disordered_struct: a di... |
def splash(self):
"""
Draw splash screen
"""
dirname = os.path.split(os.path.abspath(__file__))[0]
try:
splash = open(os.path.join(dirname, "splash"), "r").readlines()
except IOError:
return
width = len(max(splash, key=len))
y = in... | def function[splash, parameter[self]]:
constant[
Draw splash screen
]
variable[dirname] assign[=] call[call[name[os].path.split, parameter[call[name[os].path.abspath, parameter[name[__file__]]]]]][constant[0]]
<ast.Try object at 0x7da207f00700>
variable[width] assign[=] call[... | keyword[def] identifier[splash] ( identifier[self] ):
literal[string]
identifier[dirname] = identifier[os] . identifier[path] . identifier[split] ( identifier[os] . identifier[path] . identifier[abspath] ( identifier[__file__] ))[ literal[int] ]
keyword[try] :
identifier[splas... | def splash(self):
"""
Draw splash screen
"""
dirname = os.path.split(os.path.abspath(__file__))[0]
try:
splash = open(os.path.join(dirname, 'splash'), 'r').readlines() # depends on [control=['try'], data=[]]
except IOError:
return # depends on [control=['except'], data=... |
async def _relay(self,
channel: aioamqp.channel.Channel,
body: str,
envelope: aioamqp.envelope.Envelope,
properties: aioamqp.properties.Properties):
"""Relays incoming messages between the queue and the user callback"""
... | <ast.AsyncFunctionDef object at 0x7da204963ee0> | keyword[async] keyword[def] identifier[_relay] ( identifier[self] ,
identifier[channel] : identifier[aioamqp] . identifier[channel] . identifier[Channel] ,
identifier[body] : identifier[str] ,
identifier[envelope] : identifier[aioamqp] . identifier[envelope] . identifier[Envelope] ,
identifier[properties] : iden... | async def _relay(self, channel: aioamqp.channel.Channel, body: str, envelope: aioamqp.envelope.Envelope, properties: aioamqp.properties.Properties):
"""Relays incoming messages between the queue and the user callback"""
try:
await channel.basic_client_ack(envelope.delivery_tag)
await self.on_mes... |
def change_email(self, email, as_username=False):
"""
Change account email
:param email:
:param as_username
:return: the email provided
"""
email = email.lower()
data = {"email": email}
if self.email != email:
if self.get_by_email(email... | def function[change_email, parameter[self, email, as_username]]:
constant[
Change account email
:param email:
:param as_username
:return: the email provided
]
variable[email] assign[=] call[name[email].lower, parameter[]]
variable[data] assign[=] dictionar... | keyword[def] identifier[change_email] ( identifier[self] , identifier[email] , identifier[as_username] = keyword[False] ):
literal[string]
identifier[email] = identifier[email] . identifier[lower] ()
identifier[data] ={ literal[string] : identifier[email] }
keyword[if] identifier... | def change_email(self, email, as_username=False):
"""
Change account email
:param email:
:param as_username
:return: the email provided
"""
email = email.lower()
data = {'email': email}
if self.email != email:
if self.get_by_email(email):
raise... |
def merge_dicts(*args):
r"""
add / concatenate / union / join / merge / combine dictionaries
Copies the first dictionary given and then repeatedly calls update using
the rest of the dicts given in args. Duplicate keys will receive the last
value specified the list of dictionaries.
Returns:
... | def function[merge_dicts, parameter[]]:
constant[
add / concatenate / union / join / merge / combine dictionaries
Copies the first dictionary given and then repeatedly calls update using
the rest of the dicts given in args. Duplicate keys will receive the last
value specified the list of dictio... | keyword[def] identifier[merge_dicts] (* identifier[args] ):
literal[string]
identifier[iter_] = identifier[iter] ( identifier[args] )
identifier[mergedict_] = identifier[six] . identifier[next] ( identifier[iter_] ). identifier[copy] ()
keyword[for] identifier[dict_] keyword[in] identifier[ite... | def merge_dicts(*args):
"""
add / concatenate / union / join / merge / combine dictionaries
Copies the first dictionary given and then repeatedly calls update using
the rest of the dicts given in args. Duplicate keys will receive the last
value specified the list of dictionaries.
Returns:
... |
def read_passwd_file(pass_file):
"""Read password from external file and retrun as string. The file should
contain just single line. Prevents hard-coding password anywhere in this
script. IMPORTANT! Password is stored as plain text! Do NOT use with your
personal account!"
Args:
pass_file (s... | def function[read_passwd_file, parameter[pass_file]]:
constant[Read password from external file and retrun as string. The file should
contain just single line. Prevents hard-coding password anywhere in this
script. IMPORTANT! Password is stored as plain text! Do NOT use with your
personal account!"
... | keyword[def] identifier[read_passwd_file] ( identifier[pass_file] ):
literal[string]
keyword[with] identifier[open] ( identifier[pass_file] ) keyword[as] identifier[fin] :
identifier[passwd] = identifier[fin] . identifier[read] (). identifier[strip] ()
keyword[return] identifier[passwd] | def read_passwd_file(pass_file):
"""Read password from external file and retrun as string. The file should
contain just single line. Prevents hard-coding password anywhere in this
script. IMPORTANT! Password is stored as plain text! Do NOT use with your
personal account!"
Args:
pass_file (s... |
def delete(path, regex=None, recurse=False, test=False):
"""Deletes the file or directory at `path`. If `path` is a directory and
`regex` is provided, matching files will be deleted; `recurse` controls
whether subdirectories are recursed. A list of deleted items is returned.
If `test` is true, nothing w... | def function[delete, parameter[path, regex, recurse, test]]:
constant[Deletes the file or directory at `path`. If `path` is a directory and
`regex` is provided, matching files will be deleted; `recurse` controls
whether subdirectories are recursed. A list of deleted items is returned.
If `test` is t... | keyword[def] identifier[delete] ( identifier[path] , identifier[regex] = keyword[None] , identifier[recurse] = keyword[False] , identifier[test] = keyword[False] ):
literal[string]
identifier[deleted] =[]
keyword[if] identifier[op] . identifier[isfile] ( identifier[path] ):
keyword[if] keyw... | def delete(path, regex=None, recurse=False, test=False):
"""Deletes the file or directory at `path`. If `path` is a directory and
`regex` is provided, matching files will be deleted; `recurse` controls
whether subdirectories are recursed. A list of deleted items is returned.
If `test` is true, nothing w... |
def is_streamable(self):
"""Returns True if the artist is streamable."""
return bool(
_number(
_extract(self._request(self.ws_prefix + ".getInfo", True), "streamable")
)
) | def function[is_streamable, parameter[self]]:
constant[Returns True if the artist is streamable.]
return[call[name[bool], parameter[call[name[_number], parameter[call[name[_extract], parameter[call[name[self]._request, parameter[binary_operation[name[self].ws_prefix + constant[.getInfo]], constant[True]]], ... | keyword[def] identifier[is_streamable] ( identifier[self] ):
literal[string]
keyword[return] identifier[bool] (
identifier[_number] (
identifier[_extract] ( identifier[self] . identifier[_request] ( identifier[self] . identifier[ws_prefix] + literal[string] , keyword[True] ), li... | def is_streamable(self):
"""Returns True if the artist is streamable."""
return bool(_number(_extract(self._request(self.ws_prefix + '.getInfo', True), 'streamable'))) |
def create_from_file(cls, filename):
"""Return an Estimator object given the path of the file, relative to the MEDIA_ROOT"""
obj = cls()
obj.object_file = filename
obj.load()
return obj | def function[create_from_file, parameter[cls, filename]]:
constant[Return an Estimator object given the path of the file, relative to the MEDIA_ROOT]
variable[obj] assign[=] call[name[cls], parameter[]]
name[obj].object_file assign[=] name[filename]
call[name[obj].load, parameter[]]
... | keyword[def] identifier[create_from_file] ( identifier[cls] , identifier[filename] ):
literal[string]
identifier[obj] = identifier[cls] ()
identifier[obj] . identifier[object_file] = identifier[filename]
identifier[obj] . identifier[load] ()
keyword[return] identifier[o... | def create_from_file(cls, filename):
"""Return an Estimator object given the path of the file, relative to the MEDIA_ROOT"""
obj = cls()
obj.object_file = filename
obj.load()
return obj |
def xgetattr(obj: object, name: str, default=_sentinel, getitem=False):
"""Get attribute value from object.
:param obj: object
:param name: attribute or key name
:param default: when attribute or key missing, return default; if obj is a
dict and use getitem, default will not be used.
:param... | def function[xgetattr, parameter[obj, name, default, getitem]]:
constant[Get attribute value from object.
:param obj: object
:param name: attribute or key name
:param default: when attribute or key missing, return default; if obj is a
dict and use getitem, default will not be used.
:par... | keyword[def] identifier[xgetattr] ( identifier[obj] : identifier[object] , identifier[name] : identifier[str] , identifier[default] = identifier[_sentinel] , identifier[getitem] = keyword[False] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[obj] , identifier[dict] ):
keyword... | def xgetattr(obj: object, name: str, default=_sentinel, getitem=False):
"""Get attribute value from object.
:param obj: object
:param name: attribute or key name
:param default: when attribute or key missing, return default; if obj is a
dict and use getitem, default will not be used.
:param... |
def _wait_for_operation_to_complete(self, operation_name):
"""
Waits for the named operation to complete - checks status of the
asynchronous call.
:param operation_name: The name of the operation.
:type operation_name: str
:return: The response returned by the operation.... | def function[_wait_for_operation_to_complete, parameter[self, operation_name]]:
constant[
Waits for the named operation to complete - checks status of the
asynchronous call.
:param operation_name: The name of the operation.
:type operation_name: str
:return: The response... | keyword[def] identifier[_wait_for_operation_to_complete] ( identifier[self] , identifier[operation_name] ):
literal[string]
identifier[service] = identifier[self] . identifier[get_conn] ()
keyword[while] keyword[True] :
identifier[operation_response] = identifier[service] . i... | def _wait_for_operation_to_complete(self, operation_name):
"""
Waits for the named operation to complete - checks status of the
asynchronous call.
:param operation_name: The name of the operation.
:type operation_name: str
:return: The response returned by the operation.
... |
def __merge(cls, *multicolors):
""" Produces a new :class:`Multicolor` object resulting from gathering information from all supplied :class:`Multicolor` instances.
New :class:`Multicolor` is created and its :attr:`Multicolor.multicolors` attribute is updated with similar attributes of supplied :class:`... | def function[__merge, parameter[cls]]:
constant[ Produces a new :class:`Multicolor` object resulting from gathering information from all supplied :class:`Multicolor` instances.
New :class:`Multicolor` is created and its :attr:`Multicolor.multicolors` attribute is updated with similar attributes of supp... | keyword[def] identifier[__merge] ( identifier[cls] ,* identifier[multicolors] ):
literal[string]
identifier[result] = identifier[cls] ()
keyword[for] identifier[multicolor] keyword[in] identifier[multicolors] :
identifier[result] . identifier[multicolors] = identifier[resul... | def __merge(cls, *multicolors):
""" Produces a new :class:`Multicolor` object resulting from gathering information from all supplied :class:`Multicolor` instances.
New :class:`Multicolor` is created and its :attr:`Multicolor.multicolors` attribute is updated with similar attributes of supplied :class:`Mult... |
async def detach(self, discard=True):
'''Remove the underlying :attr:`connection` from the connection
:attr:`pool`.
'''
if discard:
return self.close(True)
else:
self.connection._exit_ = False
return self | <ast.AsyncFunctionDef object at 0x7da20c6a84f0> | keyword[async] keyword[def] identifier[detach] ( identifier[self] , identifier[discard] = keyword[True] ):
literal[string]
keyword[if] identifier[discard] :
keyword[return] identifier[self] . identifier[close] ( keyword[True] )
keyword[else] :
identifier[self] ... | async def detach(self, discard=True):
"""Remove the underlying :attr:`connection` from the connection
:attr:`pool`.
"""
if discard:
return self.close(True) # depends on [control=['if'], data=[]]
else:
self.connection._exit_ = False
return self |
def name_filter(keywords, names):
'''
Returns the first keyword from the list, unless
that keyword is one of the names in names, in which case
it continues to the next keyword.
Since keywords consists of tuples, it just returns the first
element of the tuple, the keyword. It also adds double
... | def function[name_filter, parameter[keywords, names]]:
constant[
Returns the first keyword from the list, unless
that keyword is one of the names in names, in which case
it continues to the next keyword.
Since keywords consists of tuples, it just returns the first
element of the tuple, the ... | keyword[def] identifier[name_filter] ( identifier[keywords] , identifier[names] ):
literal[string]
identifier[name_set] = identifier[set] ( identifier[name] . identifier[lower] () keyword[for] identifier[name] keyword[in] identifier[names] )
keyword[for] identifier[key_tuple] keyword[in] identi... | def name_filter(keywords, names):
"""
Returns the first keyword from the list, unless
that keyword is one of the names in names, in which case
it continues to the next keyword.
Since keywords consists of tuples, it just returns the first
element of the tuple, the keyword. It also adds double
... |
def _handle_response(response, **kwargs) -> XMLResponse:
"""Requests HTTP Response handler. Attaches .html property to
class:`requests.Response <requests.Response>` objects.
"""
if not response.encoding:
response.encoding = DEFAULT_ENCODING
return response | def function[_handle_response, parameter[response]]:
constant[Requests HTTP Response handler. Attaches .html property to
class:`requests.Response <requests.Response>` objects.
]
if <ast.UnaryOp object at 0x7da1b26ae290> begin[:]
name[response].encoding assign[=] name[DEFA... | keyword[def] identifier[_handle_response] ( identifier[response] ,** identifier[kwargs] )-> identifier[XMLResponse] :
literal[string]
keyword[if] keyword[not] identifier[response] . identifier[encoding] :
identifier[response] . identifier[encoding] = identifier[DEFAULT_ENCODING]
... | def _handle_response(response, **kwargs) -> XMLResponse:
"""Requests HTTP Response handler. Attaches .html property to
class:`requests.Response <requests.Response>` objects.
"""
if not response.encoding:
response.encoding = DEFAULT_ENCODING # depends on [control=['if'], data=[]]
ret... |
def allpaths(args):
"""
%prog allpaths folder1 folder2 ...
Run automated ALLPATHS on list of dirs.
"""
p = OptionParser(allpaths.__doc__)
p.add_option("--ploidy", default="1", choices=("1", "2"),
help="Ploidy [default: %default]")
opts, args = p.parse_args(args)
if len... | def function[allpaths, parameter[args]]:
constant[
%prog allpaths folder1 folder2 ...
Run automated ALLPATHS on list of dirs.
]
variable[p] assign[=] call[name[OptionParser], parameter[name[allpaths].__doc__]]
call[name[p].add_option, parameter[constant[--ploidy]]]
<ast.Tupl... | keyword[def] identifier[allpaths] ( identifier[args] ):
literal[string]
identifier[p] = identifier[OptionParser] ( identifier[allpaths] . identifier[__doc__] )
identifier[p] . identifier[add_option] ( literal[string] , identifier[default] = literal[string] , identifier[choices] =( literal[string] , li... | def allpaths(args):
"""
%prog allpaths folder1 folder2 ...
Run automated ALLPATHS on list of dirs.
"""
p = OptionParser(allpaths.__doc__)
p.add_option('--ploidy', default='1', choices=('1', '2'), help='Ploidy [default: %default]')
(opts, args) = p.parse_args(args)
if len(args) == 0:
... |
def parent_after_fork_release():
"""
Call all parent after fork callables, release the lock and print
all prepare and parent callback exceptions.
"""
prepare_exceptions = list(_prepare_call_exceptions)
del _prepare_call_exceptions[:]
exceptions = _call_atfork_list(_parent_call_list)
_for... | def function[parent_after_fork_release, parameter[]]:
constant[
Call all parent after fork callables, release the lock and print
all prepare and parent callback exceptions.
]
variable[prepare_exceptions] assign[=] call[name[list], parameter[name[_prepare_call_exceptions]]]
<ast.Delete ob... | keyword[def] identifier[parent_after_fork_release] ():
literal[string]
identifier[prepare_exceptions] = identifier[list] ( identifier[_prepare_call_exceptions] )
keyword[del] identifier[_prepare_call_exceptions] [:]
identifier[exceptions] = identifier[_call_atfork_list] ( identifier[_parent_call... | def parent_after_fork_release():
"""
Call all parent after fork callables, release the lock and print
all prepare and parent callback exceptions.
"""
prepare_exceptions = list(_prepare_call_exceptions)
del _prepare_call_exceptions[:]
exceptions = _call_atfork_list(_parent_call_list)
_for... |
def segment(self, webvtt, output='', seconds=SECONDS, mpegts=MPEGTS):
"""Segments the captions based on a number of seconds."""
if isinstance(webvtt, str):
# if a string is supplied we parse the file
captions = WebVTT().read(webvtt).captions
elif not self._validate_webvtt... | def function[segment, parameter[self, webvtt, output, seconds, mpegts]]:
constant[Segments the captions based on a number of seconds.]
if call[name[isinstance], parameter[name[webvtt], name[str]]] begin[:]
variable[captions] assign[=] call[call[name[WebVTT], parameter[]].read, parameter[... | keyword[def] identifier[segment] ( identifier[self] , identifier[webvtt] , identifier[output] = literal[string] , identifier[seconds] = identifier[SECONDS] , identifier[mpegts] = identifier[MPEGTS] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[webvtt] , identifier[str] ):
... | def segment(self, webvtt, output='', seconds=SECONDS, mpegts=MPEGTS):
"""Segments the captions based on a number of seconds."""
if isinstance(webvtt, str):
# if a string is supplied we parse the file
captions = WebVTT().read(webvtt).captions # depends on [control=['if'], data=[]]
elif not s... |
def set_action(self,action):
"""Set the action of the item.
:Parameters:
- `action`: the new action or `None`.
:Types:
- `action`: `unicode`
"""
if action is None:
if self.xmlnode.hasProp("action"):
self.xmlnode.unsetProp("acti... | def function[set_action, parameter[self, action]]:
constant[Set the action of the item.
:Parameters:
- `action`: the new action or `None`.
:Types:
- `action`: `unicode`
]
if compare[name[action] is constant[None]] begin[:]
if call[name[sel... | keyword[def] identifier[set_action] ( identifier[self] , identifier[action] ):
literal[string]
keyword[if] identifier[action] keyword[is] keyword[None] :
keyword[if] identifier[self] . identifier[xmlnode] . identifier[hasProp] ( literal[string] ):
identifier[self] ... | def set_action(self, action):
"""Set the action of the item.
:Parameters:
- `action`: the new action or `None`.
:Types:
- `action`: `unicode`
"""
if action is None:
if self.xmlnode.hasProp('action'):
self.xmlnode.unsetProp('action') # depends... |
def note_to_int(note):
"""Convert notes in the form of C, C#, Cb, C##, etc. to an integer in the
range of 0-11.
Throw a NoteFormatError exception if the note format is not recognised.
"""
if is_valid_note(note):
val = _note_dict[note[0]]
else:
raise NoteFormatError("Unknown note... | def function[note_to_int, parameter[note]]:
constant[Convert notes in the form of C, C#, Cb, C##, etc. to an integer in the
range of 0-11.
Throw a NoteFormatError exception if the note format is not recognised.
]
if call[name[is_valid_note], parameter[name[note]]] begin[:]
v... | keyword[def] identifier[note_to_int] ( identifier[note] ):
literal[string]
keyword[if] identifier[is_valid_note] ( identifier[note] ):
identifier[val] = identifier[_note_dict] [ identifier[note] [ literal[int] ]]
keyword[else] :
keyword[raise] identifier[NoteFormatError] ( literal[... | def note_to_int(note):
"""Convert notes in the form of C, C#, Cb, C##, etc. to an integer in the
range of 0-11.
Throw a NoteFormatError exception if the note format is not recognised.
"""
if is_valid_note(note):
val = _note_dict[note[0]] # depends on [control=['if'], data=[]]
else:
... |
def DeregisterBlockchain():
"""
Remove the default blockchain instance.
"""
Blockchain.SECONDS_PER_BLOCK = 15
Blockchain.DECREMENT_INTERVAL = 2000000
Blockchain.GENERATION_AMOUNT = [8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
Blockchain._bloc... | def function[DeregisterBlockchain, parameter[]]:
constant[
Remove the default blockchain instance.
]
name[Blockchain].SECONDS_PER_BLOCK assign[=] constant[15]
name[Blockchain].DECREMENT_INTERVAL assign[=] constant[2000000]
name[Blockchain].GENERATION_AMOUNT assign[=] list... | keyword[def] identifier[DeregisterBlockchain] ():
literal[string]
identifier[Blockchain] . identifier[SECONDS_PER_BLOCK] = literal[int]
identifier[Blockchain] . identifier[DECREMENT_INTERVAL] = literal[int]
identifier[Blockchain] . identifier[GENERATION_AMOUNT] =[ literal[int] ,... | def DeregisterBlockchain():
"""
Remove the default blockchain instance.
"""
Blockchain.SECONDS_PER_BLOCK = 15
Blockchain.DECREMENT_INTERVAL = 2000000
Blockchain.GENERATION_AMOUNT = [8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
Blockchain._blockchain = None
Bl... |
def build():
"""
builds the cloud_init script
"""
try:
cloud_config = CloudConfig()
config_data = cloud_config.config_data('cluster')
cloud_init = CloudInit()
print(cloud_init.build(config_data))
except CloudComposeException as ex:
print(ex) | def function[build, parameter[]]:
constant[
builds the cloud_init script
]
<ast.Try object at 0x7da20c6c4340> | keyword[def] identifier[build] ():
literal[string]
keyword[try] :
identifier[cloud_config] = identifier[CloudConfig] ()
identifier[config_data] = identifier[cloud_config] . identifier[config_data] ( literal[string] )
identifier[cloud_init] = identifier[CloudInit] ()
iden... | def build():
"""
builds the cloud_init script
"""
try:
cloud_config = CloudConfig()
config_data = cloud_config.config_data('cluster')
cloud_init = CloudInit()
print(cloud_init.build(config_data)) # depends on [control=['try'], data=[]]
except CloudComposeException as... |
def track_metric(self, name, value, type=None, count=None, min=None, max=None, std_dev=None, properties=None):
"""Send information about a single metric data point that was captured for the application.
Args:
name (str). the name of the metric that was captured.\n
value (float).... | def function[track_metric, parameter[self, name, value, type, count, min, max, std_dev, properties]]:
constant[Send information about a single metric data point that was captured for the application.
Args:
name (str). the name of the metric that was captured.
value (float). the... | keyword[def] identifier[track_metric] ( identifier[self] , identifier[name] , identifier[value] , identifier[type] = keyword[None] , identifier[count] = keyword[None] , identifier[min] = keyword[None] , identifier[max] = keyword[None] , identifier[std_dev] = keyword[None] , identifier[properties] = keyword[None] ):
... | def track_metric(self, name, value, type=None, count=None, min=None, max=None, std_dev=None, properties=None):
"""Send information about a single metric data point that was captured for the application.
Args:
name (str). the name of the metric that was captured.
value (float). the ... |
def bump(component='patch', exact=None):
# type: (str, str) -> Tuple[str, str]
""" Bump the given version component.
Args:
component (str):
What part of the version should be bumped. Can be one of:
- major
- minor
- patch
exact (str):
... | def function[bump, parameter[component, exact]]:
constant[ Bump the given version component.
Args:
component (str):
What part of the version should be bumped. Can be one of:
- major
- minor
- patch
exact (str):
The exact version ... | keyword[def] identifier[bump] ( identifier[component] = literal[string] , identifier[exact] = keyword[None] ):
literal[string]
identifier[old_ver] = identifier[current] ()
keyword[if] identifier[exact] keyword[is] keyword[None] :
identifier[new_ver] = identifier[_bump_version] ( identifi... | def bump(component='patch', exact=None):
# type: (str, str) -> Tuple[str, str]
' Bump the given version component.\n\n Args:\n component (str):\n What part of the version should be bumped. Can be one of:\n\n - major\n - minor\n - patch\n\n exact (str)... |
def global_step(device=''):
"""Returns the global step variable.
Args:
device: Optional device to place the variable. It can be an string or a
function that is called to get the device for the variable.
Returns:
the tensor representing the global step variable.
"""
global_step_ref = tf.get_col... | def function[global_step, parameter[device]]:
constant[Returns the global step variable.
Args:
device: Optional device to place the variable. It can be an string or a
function that is called to get the device for the variable.
Returns:
the tensor representing the global step variable.
]
... | keyword[def] identifier[global_step] ( identifier[device] = literal[string] ):
literal[string]
identifier[global_step_ref] = identifier[tf] . identifier[get_collection] ( identifier[tf] . identifier[GraphKeys] . identifier[GLOBAL_STEP] )
keyword[if] identifier[global_step_ref] :
keyword[return] ident... | def global_step(device=''):
"""Returns the global step variable.
Args:
device: Optional device to place the variable. It can be an string or a
function that is called to get the device for the variable.
Returns:
the tensor representing the global step variable.
"""
global_step_ref = tf.get... |
def is_manifestation_model(instance, attribute, value):
"""Must include a ``manifestationOfWork`` key."""
instance_name = instance.__class__.__name__
is_creation_model(instance, attribute, value)
manifestation_of = value.get('manifestationOfWork')
if not isinstance(manifestation_of, str):
... | def function[is_manifestation_model, parameter[instance, attribute, value]]:
constant[Must include a ``manifestationOfWork`` key.]
variable[instance_name] assign[=] name[instance].__class__.__name__
call[name[is_creation_model], parameter[name[instance], name[attribute], name[value]]]
va... | keyword[def] identifier[is_manifestation_model] ( identifier[instance] , identifier[attribute] , identifier[value] ):
literal[string]
identifier[instance_name] = identifier[instance] . identifier[__class__] . identifier[__name__]
identifier[is_creation_model] ( identifier[instance] , identifier[attr... | def is_manifestation_model(instance, attribute, value):
"""Must include a ``manifestationOfWork`` key."""
instance_name = instance.__class__.__name__
is_creation_model(instance, attribute, value)
manifestation_of = value.get('manifestationOfWork')
if not isinstance(manifestation_of, str):
er... |
def _sync_children(self, task_specs, state=MAYBE):
"""
This method syncs up the task's children with the given list of task
specs. In other words::
- Add one child for each given TaskSpec, unless that child already
exists.
- Remove all children for which th... | def function[_sync_children, parameter[self, task_specs, state]]:
constant[
This method syncs up the task's children with the given list of task
specs. In other words::
- Add one child for each given TaskSpec, unless that child already
exists.
- Remove all ... | keyword[def] identifier[_sync_children] ( identifier[self] , identifier[task_specs] , identifier[state] = identifier[MAYBE] ):
literal[string]
identifier[LOG] . identifier[debug] ( literal[string] % identifier[self] . identifier[get_name] ())
keyword[if] identifier[task_specs] keyword[is... | def _sync_children(self, task_specs, state=MAYBE):
"""
This method syncs up the task's children with the given list of task
specs. In other words::
- Add one child for each given TaskSpec, unless that child already
exists.
- Remove all children for which there ... |
def handleMatch(self, m):
username = self.unescape(m.group(2))
"""Makesure `username` is registered and actived."""
if MARTOR_ENABLE_CONFIGS['mention'] == 'true':
if username in [u.username for u in User.objects.exclude(is_active=False)]:
url = '{0}{1}/'.format(MARTO... | def function[handleMatch, parameter[self, m]]:
variable[username] assign[=] call[name[self].unescape, parameter[call[name[m].group, parameter[constant[2]]]]]
constant[Makesure `username` is registered and actived.]
if compare[call[name[MARTOR_ENABLE_CONFIGS]][constant[mention]] equal[==] constan... | keyword[def] identifier[handleMatch] ( identifier[self] , identifier[m] ):
identifier[username] = identifier[self] . identifier[unescape] ( identifier[m] . identifier[group] ( literal[int] ))
literal[string]
keyword[if] identifier[MARTOR_ENABLE_CONFIGS] [ literal[string] ]== literal[stri... | def handleMatch(self, m):
username = self.unescape(m.group(2))
'Makesure `username` is registered and actived.'
if MARTOR_ENABLE_CONFIGS['mention'] == 'true':
if username in [u.username for u in User.objects.exclude(is_active=False)]:
url = '{0}{1}/'.format(MARTOR_MARKDOWN_BASE_MENTION_U... |
def adjustSize(self):
"""
Adjusts the size of this popup to best fit the new widget size.
"""
widget = self.centralWidget()
if widget is None:
super(XPopupWidget, self).adjustSize()
return
widget.adjustSize()
hint = widge... | def function[adjustSize, parameter[self]]:
constant[
Adjusts the size of this popup to best fit the new widget size.
]
variable[widget] assign[=] call[name[self].centralWidget, parameter[]]
if compare[name[widget] is constant[None]] begin[:]
call[call[name[super],... | keyword[def] identifier[adjustSize] ( identifier[self] ):
literal[string]
identifier[widget] = identifier[self] . identifier[centralWidget] ()
keyword[if] identifier[widget] keyword[is] keyword[None] :
identifier[super] ( identifier[XPopupWidget] , identifier[self] ). i... | def adjustSize(self):
"""
Adjusts the size of this popup to best fit the new widget size.
"""
widget = self.centralWidget()
if widget is None:
super(XPopupWidget, self).adjustSize()
return # depends on [control=['if'], data=[]]
widget.adjustSize()
hint = widget.minim... |
def DeregisterPlugin(cls, plugin_class):
"""Deregisters an preprocess plugin class.
Args:
plugin_class (type): preprocess plugin class.
Raises:
KeyError: if plugin class is not set for the corresponding name.
TypeError: if the source type of the plugin class is not supported.
"""
... | def function[DeregisterPlugin, parameter[cls, plugin_class]]:
constant[Deregisters an preprocess plugin class.
Args:
plugin_class (type): preprocess plugin class.
Raises:
KeyError: if plugin class is not set for the corresponding name.
TypeError: if the source type of the plugin clas... | keyword[def] identifier[DeregisterPlugin] ( identifier[cls] , identifier[plugin_class] ):
literal[string]
identifier[name] = identifier[getattr] (
identifier[plugin_class] , literal[string] , identifier[plugin_class] . identifier[__name__] )
identifier[name] = identifier[name] . identifier[lower]... | def DeregisterPlugin(cls, plugin_class):
"""Deregisters an preprocess plugin class.
Args:
plugin_class (type): preprocess plugin class.
Raises:
KeyError: if plugin class is not set for the corresponding name.
TypeError: if the source type of the plugin class is not supported.
"""
... |
def indices(self):
"""Returns dict {group name -> group indices}."""
self._prep_pandas_groupby()
def extract_group_indices(frame):
return (frame[0], frame[1].index)
return self._mergedRDD.map(extract_group_indices).collectAsMap() | def function[indices, parameter[self]]:
constant[Returns dict {group name -> group indices}.]
call[name[self]._prep_pandas_groupby, parameter[]]
def function[extract_group_indices, parameter[frame]]:
return[tuple[[<ast.Subscript object at 0x7da2047eaa40>, <ast.Attribute object at 0x7da20... | keyword[def] identifier[indices] ( identifier[self] ):
literal[string]
identifier[self] . identifier[_prep_pandas_groupby] ()
keyword[def] identifier[extract_group_indices] ( identifier[frame] ):
keyword[return] ( identifier[frame] [ literal[int] ], identifier[frame] [ liter... | def indices(self):
"""Returns dict {group name -> group indices}."""
self._prep_pandas_groupby()
def extract_group_indices(frame):
return (frame[0], frame[1].index)
return self._mergedRDD.map(extract_group_indices).collectAsMap() |
def create_big_url(name):
""" If name looks like a url, with an http, add an entry for it in BIG_URLS """
# BIG side effect
global BIG_URLS
filemeta = get_url_filemeta(name)
if not filemeta:
return None
filename = filemeta['filename']
remote_size = filemeta['remote_size']
url = f... | def function[create_big_url, parameter[name]]:
constant[ If name looks like a url, with an http, add an entry for it in BIG_URLS ]
<ast.Global object at 0x7da2047ea3e0>
variable[filemeta] assign[=] call[name[get_url_filemeta], parameter[name[name]]]
if <ast.UnaryOp object at 0x7da2047e84f0> ... | keyword[def] identifier[create_big_url] ( identifier[name] ):
literal[string]
keyword[global] identifier[BIG_URLS]
identifier[filemeta] = identifier[get_url_filemeta] ( identifier[name] )
keyword[if] keyword[not] identifier[filemeta] :
keyword[return] keyword[None]
identi... | def create_big_url(name):
""" If name looks like a url, with an http, add an entry for it in BIG_URLS """
# BIG side effect
global BIG_URLS
filemeta = get_url_filemeta(name)
if not filemeta:
return None # depends on [control=['if'], data=[]]
filename = filemeta['filename']
remote_si... |
def extract_metatile(io, fmt, offset=None):
"""
Extract the tile at the given offset (defaults to 0/0/0) and format from
the metatile in the file-like object io.
"""
ext = fmt.extension
if offset is None:
tile_name = '0/0/0.%s' % ext
else:
tile_name = '%d/%d/%d.%s' % (offset... | def function[extract_metatile, parameter[io, fmt, offset]]:
constant[
Extract the tile at the given offset (defaults to 0/0/0) and format from
the metatile in the file-like object io.
]
variable[ext] assign[=] name[fmt].extension
if compare[name[offset] is constant[None]] begin[:]
... | keyword[def] identifier[extract_metatile] ( identifier[io] , identifier[fmt] , identifier[offset] = keyword[None] ):
literal[string]
identifier[ext] = identifier[fmt] . identifier[extension]
keyword[if] identifier[offset] keyword[is] keyword[None] :
identifier[tile_name] = literal[string... | def extract_metatile(io, fmt, offset=None):
"""
Extract the tile at the given offset (defaults to 0/0/0) and format from
the metatile in the file-like object io.
"""
ext = fmt.extension
if offset is None:
tile_name = '0/0/0.%s' % ext # depends on [control=['if'], data=[]]
else:
... |
def handle_update(self, action, params):
"""Handle the specified action on this component."""
_LOGGER.debug('Keypad: "%s" %s Action: %s Params: %s"' % (
self._keypad.name, self, action, params))
ev_map = {
Button._ACTION_PRESS: Button.Event.PRESSED,
Button._ACTION_RELEASE: ... | def function[handle_update, parameter[self, action, params]]:
constant[Handle the specified action on this component.]
call[name[_LOGGER].debug, parameter[binary_operation[constant[Keypad: "%s" %s Action: %s Params: %s"] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Attribute object at 0x7da1b054a980>,... | keyword[def] identifier[handle_update] ( identifier[self] , identifier[action] , identifier[params] ):
literal[string]
identifier[_LOGGER] . identifier[debug] ( literal[string] %(
identifier[self] . identifier[_keypad] . identifier[name] , identifier[self] , identifier[action] , identifier[params] ))
... | def handle_update(self, action, params):
"""Handle the specified action on this component."""
_LOGGER.debug('Keypad: "%s" %s Action: %s Params: %s"' % (self._keypad.name, self, action, params))
ev_map = {Button._ACTION_PRESS: Button.Event.PRESSED, Button._ACTION_RELEASE: Button.Event.RELEASED}
if action... |
def get_resource_group(access_token, subscription_id, rgname):
'''Get details about the named resource group.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
rgname (str): Azure resource group name.
Returns:
HTTP r... | def function[get_resource_group, parameter[access_token, subscription_id, rgname]]:
constant[Get details about the named resource group.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
rgname (str): Azure resource group nam... | keyword[def] identifier[get_resource_group] ( identifier[access_token] , identifier[subscription_id] , identifier[rgname] ):
literal[string]
identifier[endpoint] = literal[string] . identifier[join] ([ identifier[get_rm_endpoint] (),
literal[string] , identifier[subscription_id] ,
literal[string]... | def get_resource_group(access_token, subscription_id, rgname):
"""Get details about the named resource group.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
rgname (str): Azure resource group name.
Returns:
HTTP r... |
def create(cls, extension_name=None, extension_tag=None,
extension_type=None):
"""
Construct an ExtensionInformation object from provided extension
values.
Args:
extension_name (str): The name of the extension. Optional,
defaults to None.
... | def function[create, parameter[cls, extension_name, extension_tag, extension_type]]:
constant[
Construct an ExtensionInformation object from provided extension
values.
Args:
extension_name (str): The name of the extension. Optional,
defaults to None.
... | keyword[def] identifier[create] ( identifier[cls] , identifier[extension_name] = keyword[None] , identifier[extension_tag] = keyword[None] ,
identifier[extension_type] = keyword[None] ):
literal[string]
identifier[extension_name] = identifier[ExtensionName] ( identifier[extension_name] )
... | def create(cls, extension_name=None, extension_tag=None, extension_type=None):
"""
Construct an ExtensionInformation object from provided extension
values.
Args:
extension_name (str): The name of the extension. Optional,
defaults to None.
extension_ta... |
def get_template(self):
"""
读取一个Excel模板,将此Excel的所有行读出来,并且识别特殊的标记进行记录
:return: 返回读取后的模板,结果类似:
[
{'cols': #各列,与subs不会同时生效
'subs':[ #子模板
{'cols':#各列,
'subs': #子模板
'field': #对应数据中字段名称
... | def function[get_template, parameter[self]]:
constant[
读取一个Excel模板,将此Excel的所有行读出来,并且识别特殊的标记进行记录
:return: 返回读取后的模板,结果类似:
[
{'cols': #各列,与subs不会同时生效
'subs':[ #子模板
{'cols':#各列,
'subs': #子模板
'field': #对应... | keyword[def] identifier[get_template] ( identifier[self] ):
literal[string]
identifier[rows] =[]
identifier[stack] =[]
identifier[stack] . identifier[append] ( identifier[rows] )
identifier[top] = identifier[rows]
keyword[for] identifier[i] keyword[in... | def get_template(self):
"""
读取一个Excel模板,将此Excel的所有行读出来,并且识别特殊的标记进行记录
:return: 返回读取后的模板,结果类似:
[
{'cols': #各列,与subs不会同时生效
'subs':[ #子模板
{'cols':#各列,
'subs': #子模板
'field': #对应数据中字段名称
},
... |
def eventReminder(self, thread_id, time, title, location="", location_id=""):
"""
Deprecated. Use :func:`fbchat.Client.createPlan` instead
"""
plan = Plan(time=time, title=title, location=location, location_id=location_id)
self.createPlan(plan=plan, thread_id=thread_id) | def function[eventReminder, parameter[self, thread_id, time, title, location, location_id]]:
constant[
Deprecated. Use :func:`fbchat.Client.createPlan` instead
]
variable[plan] assign[=] call[name[Plan], parameter[]]
call[name[self].createPlan, parameter[]] | keyword[def] identifier[eventReminder] ( identifier[self] , identifier[thread_id] , identifier[time] , identifier[title] , identifier[location] = literal[string] , identifier[location_id] = literal[string] ):
literal[string]
identifier[plan] = identifier[Plan] ( identifier[time] = identifier[time] ... | def eventReminder(self, thread_id, time, title, location='', location_id=''):
"""
Deprecated. Use :func:`fbchat.Client.createPlan` instead
"""
plan = Plan(time=time, title=title, location=location, location_id=location_id)
self.createPlan(plan=plan, thread_id=thread_id) |
def moment_magnitude_scalar(moment):
'''
Uses Hanks & Kanamori formula for calculating moment magnitude from
a scalar moment (Nm)
'''
if isinstance(moment, np.ndarray):
return (2. / 3.) * (np.log10(moment) - 9.05)
else:
return (2. / 3.) * (log10(moment) - 9.05) | def function[moment_magnitude_scalar, parameter[moment]]:
constant[
Uses Hanks & Kanamori formula for calculating moment magnitude from
a scalar moment (Nm)
]
if call[name[isinstance], parameter[name[moment], name[np].ndarray]] begin[:]
return[binary_operation[binary_operation[consta... | keyword[def] identifier[moment_magnitude_scalar] ( identifier[moment] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[moment] , identifier[np] . identifier[ndarray] ):
keyword[return] ( literal[int] / literal[int] )*( identifier[np] . identifier[log10] ( identifier[moment] )- l... | def moment_magnitude_scalar(moment):
"""
Uses Hanks & Kanamori formula for calculating moment magnitude from
a scalar moment (Nm)
"""
if isinstance(moment, np.ndarray):
return 2.0 / 3.0 * (np.log10(moment) - 9.05) # depends on [control=['if'], data=[]]
else:
return 2.0 / 3.0 * (... |
def summary_pb(self):
"""Create a top-level experiment summary describing this experiment.
The resulting summary should be written to a log directory that
encloses all the individual sessions' log directories.
Analogous to the low-level `experiment_pb` function in the
`hparams.summary` module.
... | def function[summary_pb, parameter[self]]:
constant[Create a top-level experiment summary describing this experiment.
The resulting summary should be written to a log directory that
encloses all the individual sessions' log directories.
Analogous to the low-level `experiment_pb` function in the
... | keyword[def] identifier[summary_pb] ( identifier[self] ):
literal[string]
identifier[hparam_infos] =[]
keyword[for] identifier[hparam] keyword[in] identifier[self] . identifier[_hparams] :
identifier[info] = identifier[api_pb2] . identifier[HParamInfo] (
identifier[name] = identifier[... | def summary_pb(self):
"""Create a top-level experiment summary describing this experiment.
The resulting summary should be written to a log directory that
encloses all the individual sessions' log directories.
Analogous to the low-level `experiment_pb` function in the
`hparams.summary` module.
... |
def describe_vpcs(vpc_id=None, name=None, cidr=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Describe all VPCs, matching the filter criteria if provided.
Returns a list of dictionaries with interesting properties.
.. versionadded:: 2015.8.0
CLI Example:
... | def function[describe_vpcs, parameter[vpc_id, name, cidr, tags, region, key, keyid, profile]]:
constant[
Describe all VPCs, matching the filter criteria if provided.
Returns a list of dictionaries with interesting properties.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
... | keyword[def] identifier[describe_vpcs] ( identifier[vpc_id] = keyword[None] , identifier[name] = keyword[None] , identifier[cidr] = keyword[None] , identifier[tags] = keyword[None] ,
identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keywo... | def describe_vpcs(vpc_id=None, name=None, cidr=None, tags=None, region=None, key=None, keyid=None, profile=None):
"""
Describe all VPCs, matching the filter criteria if provided.
Returns a list of dictionaries with interesting properties.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block... |
def delete(self, endpoint, headers):
"""
Method to delete an item or all items
headers['If-Match'] must contain the _etag identifier of the element to delete
:param endpoint: endpoint (API URL)
:type endpoint: str
:param headers: headers (example: Content-Type)
... | def function[delete, parameter[self, endpoint, headers]]:
constant[
Method to delete an item or all items
headers['If-Match'] must contain the _etag identifier of the element to delete
:param endpoint: endpoint (API URL)
:type endpoint: str
:param headers: headers (exam... | keyword[def] identifier[delete] ( identifier[self] , identifier[endpoint] , identifier[headers] ):
literal[string]
identifier[response] = identifier[self] . identifier[get_response] ( identifier[method] = literal[string] , identifier[endpoint] = identifier[endpoint] , identifier[headers] = identifi... | def delete(self, endpoint, headers):
"""
Method to delete an item or all items
headers['If-Match'] must contain the _etag identifier of the element to delete
:param endpoint: endpoint (API URL)
:type endpoint: str
:param headers: headers (example: Content-Type)
:typ... |
def import_service_version(self, repository_json, mode='production', service_version='default', service_id=None, **kwargs):
'''
import_service_version(self, repository_json, mode='production', service_version='default', service_id=None, **kwargs)
Imports a service version into Opereto from a re... | def function[import_service_version, parameter[self, repository_json, mode, service_version, service_id]]:
constant[
import_service_version(self, repository_json, mode='production', service_version='default', service_id=None, **kwargs)
Imports a service version into Opereto from a remote reposi... | keyword[def] identifier[import_service_version] ( identifier[self] , identifier[repository_json] , identifier[mode] = literal[string] , identifier[service_version] = literal[string] , identifier[service_id] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[request_data] ={ litera... | def import_service_version(self, repository_json, mode='production', service_version='default', service_id=None, **kwargs):
"""
import_service_version(self, repository_json, mode='production', service_version='default', service_id=None, **kwargs)
Imports a service version into Opereto from a remote... |
def LoadElement(href, only_etag=False):
"""
Return an instance of a element as a ElementCache dict
used as a cache.
:rtype ElementCache
"""
request = SMCRequest(href=href)
request.exception = FetchElementFailed
result = request.read()
if only_etag:
return result.etag
... | def function[LoadElement, parameter[href, only_etag]]:
constant[
Return an instance of a element as a ElementCache dict
used as a cache.
:rtype ElementCache
]
variable[request] assign[=] call[name[SMCRequest], parameter[]]
name[request].exception assign[=] name[FetchElementF... | keyword[def] identifier[LoadElement] ( identifier[href] , identifier[only_etag] = keyword[False] ):
literal[string]
identifier[request] = identifier[SMCRequest] ( identifier[href] = identifier[href] )
identifier[request] . identifier[exception] = identifier[FetchElementFailed]
identifier[result]... | def LoadElement(href, only_etag=False):
"""
Return an instance of a element as a ElementCache dict
used as a cache.
:rtype ElementCache
"""
request = SMCRequest(href=href)
request.exception = FetchElementFailed
result = request.read()
if only_etag:
return result.etag # ... |
def _deprecated(func):
"""A decorator that warns about deprecation when the passed-in function is
invoked."""
@wraps(func)
def with_warning(*args, **kwargs):
warnings.warn(
('The %s method is deprecated and will be removed in v2.*.*' %
func.__name__),
Depreca... | def function[_deprecated, parameter[func]]:
constant[A decorator that warns about deprecation when the passed-in function is
invoked.]
def function[with_warning, parameter[]]:
call[name[warnings].warn, parameter[binary_operation[constant[The %s method is deprecated and will be remove... | keyword[def] identifier[_deprecated] ( identifier[func] ):
literal[string]
@ identifier[wraps] ( identifier[func] )
keyword[def] identifier[with_warning] (* identifier[args] ,** identifier[kwargs] ):
identifier[warnings] . identifier[warn] (
( literal[string] %
identifier[fun... | def _deprecated(func):
"""A decorator that warns about deprecation when the passed-in function is
invoked."""
@wraps(func)
def with_warning(*args, **kwargs):
warnings.warn('The %s method is deprecated and will be removed in v2.*.*' % func.__name__, DeprecationWarning)
return func(*args,... |
def connection_with_anon(credentials, anon=True):
"""
Connect to S3 with automatic handling for anonymous access.
Parameters
----------
credentials : dict
AWS access key ('access') and secret access key ('secret')
anon : boolean, optional, default = True
Whether to make an anon... | def function[connection_with_anon, parameter[credentials, anon]]:
constant[
Connect to S3 with automatic handling for anonymous access.
Parameters
----------
credentials : dict
AWS access key ('access') and secret access key ('secret')
anon : boolean, optional, default = True
... | keyword[def] identifier[connection_with_anon] ( identifier[credentials] , identifier[anon] = keyword[True] ):
literal[string]
keyword[from] identifier[boto] . identifier[s3] . identifier[connection] keyword[import] identifier[S3Connection]
keyword[from] identifier[boto] . identifier[exception] k... | def connection_with_anon(credentials, anon=True):
"""
Connect to S3 with automatic handling for anonymous access.
Parameters
----------
credentials : dict
AWS access key ('access') and secret access key ('secret')
anon : boolean, optional, default = True
Whether to make an anon... |
def unindent(self):
"""
Unindents the document text under cursor.
:return: Method success.
:rtype: bool
"""
cursor = self.textCursor()
if not cursor.hasSelection():
cursor.movePosition(QTextCursor.StartOfBlock)
line = foundations.strings.... | def function[unindent, parameter[self]]:
constant[
Unindents the document text under cursor.
:return: Method success.
:rtype: bool
]
variable[cursor] assign[=] call[name[self].textCursor, parameter[]]
if <ast.UnaryOp object at 0x7da1b09e8640> begin[:]
... | keyword[def] identifier[unindent] ( identifier[self] ):
literal[string]
identifier[cursor] = identifier[self] . identifier[textCursor] ()
keyword[if] keyword[not] identifier[cursor] . identifier[hasSelection] ():
identifier[cursor] . identifier[movePosition] ( identifier[QT... | def unindent(self):
"""
Unindents the document text under cursor.
:return: Method success.
:rtype: bool
"""
cursor = self.textCursor()
if not cursor.hasSelection():
cursor.movePosition(QTextCursor.StartOfBlock)
line = foundations.strings.to_string(self.docume... |
def create_directory(self, path, mode=777):
"""
Creates a directory on the remote system.
:param path: full path to the remote directory to create
:type path: str
:param mode: int representation of octal mode for directory
"""
conn = self.get_conn()
conn.m... | def function[create_directory, parameter[self, path, mode]]:
constant[
Creates a directory on the remote system.
:param path: full path to the remote directory to create
:type path: str
:param mode: int representation of octal mode for directory
]
variable[conn] a... | keyword[def] identifier[create_directory] ( identifier[self] , identifier[path] , identifier[mode] = literal[int] ):
literal[string]
identifier[conn] = identifier[self] . identifier[get_conn] ()
identifier[conn] . identifier[mkdir] ( identifier[path] , identifier[mode] ) | def create_directory(self, path, mode=777):
"""
Creates a directory on the remote system.
:param path: full path to the remote directory to create
:type path: str
:param mode: int representation of octal mode for directory
"""
conn = self.get_conn()
conn.mkdir(path, m... |
def initLogger(obj):
"""
Helper function to create a logger object for the current object with
the standard Numenta prefix.
:param obj: (object) to add a logger to
"""
if inspect.isclass(obj):
myClass = obj
else:
myClass = obj.__class__
logger = logging.getLogger(".".join(
['com.numenta', m... | def function[initLogger, parameter[obj]]:
constant[
Helper function to create a logger object for the current object with
the standard Numenta prefix.
:param obj: (object) to add a logger to
]
if call[name[inspect].isclass, parameter[name[obj]]] begin[:]
variable[myClass] assign... | keyword[def] identifier[initLogger] ( identifier[obj] ):
literal[string]
keyword[if] identifier[inspect] . identifier[isclass] ( identifier[obj] ):
identifier[myClass] = identifier[obj]
keyword[else] :
identifier[myClass] = identifier[obj] . identifier[__class__]
identifier[logger] = identif... | def initLogger(obj):
"""
Helper function to create a logger object for the current object with
the standard Numenta prefix.
:param obj: (object) to add a logger to
"""
if inspect.isclass(obj):
myClass = obj # depends on [control=['if'], data=[]]
else:
myClass = obj.__class__
lo... |
def observe_reward_value(self, state_arr, action_arr):
'''
Compute the reward value.
Args:
state_arr: `np.ndarray` of state.
action_arr: `np.ndarray` of action.
Returns:
Reward value.
'''
if se... | def function[observe_reward_value, parameter[self, state_arr, action_arr]]:
constant[
Compute the reward value.
Args:
state_arr: `np.ndarray` of state.
action_arr: `np.ndarray` of action.
Returns:
Reward value... | keyword[def] identifier[observe_reward_value] ( identifier[self] , identifier[state_arr] , identifier[action_arr] ):
literal[string]
keyword[if] identifier[self] . identifier[__check_goal_flag] ( identifier[action_arr] ) keyword[is] keyword[True] :
keyword[return] literal[int]
... | def observe_reward_value(self, state_arr, action_arr):
"""
Compute the reward value.
Args:
state_arr: `np.ndarray` of state.
action_arr: `np.ndarray` of action.
Returns:
Reward value.
"""
if self.__che... |
def wrap_cell(entity, json_obj, mapping, table_view=False):
'''
Cell wrappers
for customizing the GUI data table
TODO : must coincide with hierarchy!
TODO : simplify this!
'''
html_class = '' # for GUI javascript
out = ''
#if 'cell_wrapper' in entity: # TODO : this bound type was d... | def function[wrap_cell, parameter[entity, json_obj, mapping, table_view]]:
constant[
Cell wrappers
for customizing the GUI data table
TODO : must coincide with hierarchy!
TODO : simplify this!
]
variable[html_class] assign[=] constant[]
variable[out] assign[=] constant[]
... | keyword[def] identifier[wrap_cell] ( identifier[entity] , identifier[json_obj] , identifier[mapping] , identifier[table_view] = keyword[False] ):
literal[string]
identifier[html_class] = literal[string]
identifier[out] = literal[string]
keyword[if] identifier[entity] [ literal... | def wrap_cell(entity, json_obj, mapping, table_view=False):
"""
Cell wrappers
for customizing the GUI data table
TODO : must coincide with hierarchy!
TODO : simplify this!
"""
html_class = '' # for GUI javascript
out = ''
#if 'cell_wrapper' in entity: # TODO : this bound type was d... |
def startswith(self, event_property, value):
"""A starts-with filter chain.
>>> request_time = EventExpression('request', 'elapsed_ms')
>>> filtered = request_time.startswith('path', '/cube')
>>> print(filtered)
request(elapsed_ms).re(path, "^/cube")
"""
c = self... | def function[startswith, parameter[self, event_property, value]]:
constant[A starts-with filter chain.
>>> request_time = EventExpression('request', 'elapsed_ms')
>>> filtered = request_time.startswith('path', '/cube')
>>> print(filtered)
request(elapsed_ms).re(path, "^/cube")
... | keyword[def] identifier[startswith] ( identifier[self] , identifier[event_property] , identifier[value] ):
literal[string]
identifier[c] = identifier[self] . identifier[copy] ()
identifier[c] . identifier[filters] . identifier[append] ( identifier[filters] . identifier[RE] ( identifier[eve... | def startswith(self, event_property, value):
"""A starts-with filter chain.
>>> request_time = EventExpression('request', 'elapsed_ms')
>>> filtered = request_time.startswith('path', '/cube')
>>> print(filtered)
request(elapsed_ms).re(path, "^/cube")
"""
c = self.copy()
... |
def add_pin_at_xy(self, x, y, text, location='above right',
relative_position=.9, use_arrow=True, style=None):
"""Add pin at x, y location.
:param x: array, list or float, specifying the location of the
pin.
:param y: array, list or float, specifying the locati... | def function[add_pin_at_xy, parameter[self, x, y, text, location, relative_position, use_arrow, style]]:
constant[Add pin at x, y location.
:param x: array, list or float, specifying the location of the
pin.
:param y: array, list or float, specifying the location of the
... | keyword[def] identifier[add_pin_at_xy] ( identifier[self] , identifier[x] , identifier[y] , identifier[text] , identifier[location] = literal[string] ,
identifier[relative_position] = literal[int] , identifier[use_arrow] = keyword[True] , identifier[style] = keyword[None] ):
literal[string]
keywor... | def add_pin_at_xy(self, x, y, text, location='above right', relative_position=0.9, use_arrow=True, style=None):
"""Add pin at x, y location.
:param x: array, list or float, specifying the location of the
pin.
:param y: array, list or float, specifying the location of the
pin... |
def from_size(cls, data, width, height):
# type: (bytearray, int, int) -> ScreenShot
""" Instantiate a new class given only screen shot's data and size. """
monitor = {"left": 0, "top": 0, "width": width, "height": height}
return cls(data, monitor) | def function[from_size, parameter[cls, data, width, height]]:
constant[ Instantiate a new class given only screen shot's data and size. ]
variable[monitor] assign[=] dictionary[[<ast.Constant object at 0x7da1b08330a0>, <ast.Constant object at 0x7da1b0830220>, <ast.Constant object at 0x7da1b0832020>, <as... | keyword[def] identifier[from_size] ( identifier[cls] , identifier[data] , identifier[width] , identifier[height] ):
literal[string]
identifier[monitor] ={ literal[string] : literal[int] , literal[string] : literal[int] , literal[string] : identifier[width] , literal[string] : identifier[height] }... | def from_size(cls, data, width, height):
# type: (bytearray, int, int) -> ScreenShot
" Instantiate a new class given only screen shot's data and size. "
monitor = {'left': 0, 'top': 0, 'width': width, 'height': height}
return cls(data, monitor) |
def plotFuncsDer(functions,bottom,top,N=1000,legend_kwds = None):
'''
Plots the first derivative of 1D function(s) over a given range.
Parameters
----------
function : function
A function or list of functions, the derivatives of which are to be plotted.
bottom : float
The lower ... | def function[plotFuncsDer, parameter[functions, bottom, top, N, legend_kwds]]:
constant[
Plots the first derivative of 1D function(s) over a given range.
Parameters
----------
function : function
A function or list of functions, the derivatives of which are to be plotted.
bottom : f... | keyword[def] identifier[plotFuncsDer] ( identifier[functions] , identifier[bottom] , identifier[top] , identifier[N] = literal[int] , identifier[legend_kwds] = keyword[None] ):
literal[string]
keyword[if] identifier[type] ( identifier[functions] )== identifier[list] :
identifier[function_list] = ... | def plotFuncsDer(functions, bottom, top, N=1000, legend_kwds=None):
"""
Plots the first derivative of 1D function(s) over a given range.
Parameters
----------
function : function
A function or list of functions, the derivatives of which are to be plotted.
bottom : float
The lowe... |
def configure_flair(self, subreddit, flair_enabled=False,
flair_position='right',
flair_self_assign=False,
link_flair_enabled=False,
link_flair_position='left',
link_flair_self_assign=False):
... | def function[configure_flair, parameter[self, subreddit, flair_enabled, flair_position, flair_self_assign, link_flair_enabled, link_flair_position, link_flair_self_assign]]:
constant[Configure the flair setting for the given subreddit.
:returns: The json response from the server.
]
var... | keyword[def] identifier[configure_flair] ( identifier[self] , identifier[subreddit] , identifier[flair_enabled] = keyword[False] ,
identifier[flair_position] = literal[string] ,
identifier[flair_self_assign] = keyword[False] ,
identifier[link_flair_enabled] = keyword[False] ,
identifier[link_flair_position] = lit... | def configure_flair(self, subreddit, flair_enabled=False, flair_position='right', flair_self_assign=False, link_flair_enabled=False, link_flair_position='left', link_flair_self_assign=False):
"""Configure the flair setting for the given subreddit.
:returns: The json response from the server.
"""
... |
def fill_parameters(self, path, blocks, exclude_free_params=False, check_parameters=False):
"""
Load parameters from file to fill all blocks sequentially.
:type blocks: list of deepy.layers.Block
"""
if not os.path.exists(path):
raise Exception("model {} does not exis... | def function[fill_parameters, parameter[self, path, blocks, exclude_free_params, check_parameters]]:
constant[
Load parameters from file to fill all blocks sequentially.
:type blocks: list of deepy.layers.Block
]
if <ast.UnaryOp object at 0x7da1b26ae3e0> begin[:]
<ast.Rai... | keyword[def] identifier[fill_parameters] ( identifier[self] , identifier[path] , identifier[blocks] , identifier[exclude_free_params] = keyword[False] , identifier[check_parameters] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[exists]... | def fill_parameters(self, path, blocks, exclude_free_params=False, check_parameters=False):
"""
Load parameters from file to fill all blocks sequentially.
:type blocks: list of deepy.layers.Block
"""
if not os.path.exists(path):
raise Exception('model {} does not exist'.format(pa... |
def total_seconds(td):
"""convert a timedelta to seconds.
This is patterned after timedelta.total_seconds, which is only
available in python 27.
Args:
td: a timedelta object.
Returns:
total seconds within a timedelta. Rounded up to seconds.
"""
secs = td.seconds + td.days * 24 * 3600
if td.mi... | def function[total_seconds, parameter[td]]:
constant[convert a timedelta to seconds.
This is patterned after timedelta.total_seconds, which is only
available in python 27.
Args:
td: a timedelta object.
Returns:
total seconds within a timedelta. Rounded up to seconds.
]
variable[secs... | keyword[def] identifier[total_seconds] ( identifier[td] ):
literal[string]
identifier[secs] = identifier[td] . identifier[seconds] + identifier[td] . identifier[days] * literal[int] * literal[int]
keyword[if] identifier[td] . identifier[microseconds] :
identifier[secs] += literal[int]
keyword[ret... | def total_seconds(td):
"""convert a timedelta to seconds.
This is patterned after timedelta.total_seconds, which is only
available in python 27.
Args:
td: a timedelta object.
Returns:
total seconds within a timedelta. Rounded up to seconds.
"""
secs = td.seconds + td.days * 24 * 3600
if... |
def isometric_transfer(script, sourceMesh=0, targetMesh=1):
"""Isometric parameterization: transfer between meshes
Provide the layer numbers of the source and target meshes.
"""
filter_xml = ''.join([
' <filter name="Iso Parametrization transfer between meshes">\n',
' <Param name="... | def function[isometric_transfer, parameter[script, sourceMesh, targetMesh]]:
constant[Isometric parameterization: transfer between meshes
Provide the layer numbers of the source and target meshes.
]
variable[filter_xml] assign[=] call[constant[].join, parameter[list[[<ast.Constant object at 0x... | keyword[def] identifier[isometric_transfer] ( identifier[script] , identifier[sourceMesh] = literal[int] , identifier[targetMesh] = literal[int] ):
literal[string]
identifier[filter_xml] = literal[string] . identifier[join] ([
literal[string] ,
literal[string] ,
literal[string] % identifier[... | def isometric_transfer(script, sourceMesh=0, targetMesh=1):
"""Isometric parameterization: transfer between meshes
Provide the layer numbers of the source and target meshes.
"""
filter_xml = ''.join([' <filter name="Iso Parametrization transfer between meshes">\n', ' <Param name="sourceMesh"', 'va... |
def stop_sync(self):
""" Stops all the synchonization loop (sensor/effector controllers). """
if not self._syncing:
return
if self._primitive_manager.running:
self._primitive_manager.stop()
[c.stop() for c in self._controllers]
[s.close() for s in self.s... | def function[stop_sync, parameter[self]]:
constant[ Stops all the synchonization loop (sensor/effector controllers). ]
if <ast.UnaryOp object at 0x7da1b15d2c50> begin[:]
return[None]
if name[self]._primitive_manager.running begin[:]
call[name[self]._primitive_manager.stop... | keyword[def] identifier[stop_sync] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_syncing] :
keyword[return]
keyword[if] identifier[self] . identifier[_primitive_manager] . identifier[running] :
identifier[self] ... | def stop_sync(self):
""" Stops all the synchonization loop (sensor/effector controllers). """
if not self._syncing:
return # depends on [control=['if'], data=[]]
if self._primitive_manager.running:
self._primitive_manager.stop() # depends on [control=['if'], data=[]]
[c.stop() for c in... |
def sext(self, num):
"""Sign-extend this farray by *num* bits.
Returns a new farray.
"""
sign = self._items[-1]
return self.__class__(self._items + [sign] * num, ftype=self.ftype) | def function[sext, parameter[self, num]]:
constant[Sign-extend this farray by *num* bits.
Returns a new farray.
]
variable[sign] assign[=] call[name[self]._items][<ast.UnaryOp object at 0x7da1b0e16ef0>]
return[call[name[self].__class__, parameter[binary_operation[name[self]._items +... | keyword[def] identifier[sext] ( identifier[self] , identifier[num] ):
literal[string]
identifier[sign] = identifier[self] . identifier[_items] [- literal[int] ]
keyword[return] identifier[self] . identifier[__class__] ( identifier[self] . identifier[_items] +[ identifier[sign] ]* identifi... | def sext(self, num):
"""Sign-extend this farray by *num* bits.
Returns a new farray.
"""
sign = self._items[-1]
return self.__class__(self._items + [sign] * num, ftype=self.ftype) |
def is_path(value):
"""
Checks whether the given value represents a path, i.e. a string which starts with an indicator for absolute or
relative paths.
:param value: Value to check.
:return: ``True``, if the value appears to be representing a path.
:rtype: bool
"""
return value and isins... | def function[is_path, parameter[value]]:
constant[
Checks whether the given value represents a path, i.e. a string which starts with an indicator for absolute or
relative paths.
:param value: Value to check.
:return: ``True``, if the value appears to be representing a path.
:rtype: bool
... | keyword[def] identifier[is_path] ( identifier[value] ):
literal[string]
keyword[return] identifier[value] keyword[and] identifier[isinstance] ( identifier[value] , identifier[six] . identifier[string_types] ) keyword[and] ( identifier[value] [ literal[int] ]== identifier[posixpath] . identifier[sep] ke... | def is_path(value):
"""
Checks whether the given value represents a path, i.e. a string which starts with an indicator for absolute or
relative paths.
:param value: Value to check.
:return: ``True``, if the value appears to be representing a path.
:rtype: bool
"""
return value and isins... |
def _load_aux_image(self, image, auxfile):
"""
Load a fits file (bkg/rms/curve) and make sure that
it is the same shape as the main image.
Parameters
----------
image : :class:`AegeanTools.fits_image.FitsImage`
The main image that has already been loaded.
... | def function[_load_aux_image, parameter[self, image, auxfile]]:
constant[
Load a fits file (bkg/rms/curve) and make sure that
it is the same shape as the main image.
Parameters
----------
image : :class:`AegeanTools.fits_image.FitsImage`
The main image that h... | keyword[def] identifier[_load_aux_image] ( identifier[self] , identifier[image] , identifier[auxfile] ):
literal[string]
identifier[auximg] = identifier[FitsImage] ( identifier[auxfile] , identifier[beam] = identifier[self] . identifier[global_data] . identifier[beam] ). identifier[get_pixels] ()
... | def _load_aux_image(self, image, auxfile):
"""
Load a fits file (bkg/rms/curve) and make sure that
it is the same shape as the main image.
Parameters
----------
image : :class:`AegeanTools.fits_image.FitsImage`
The main image that has already been loaded.
... |
def _iterContours(self, **kwargs):
"""
This must return an iterator that returns wrapped contours.
Subclasses may override this method.
"""
count = len(self)
index = 0
while count:
yield self[index]
count -= 1
index += 1 | def function[_iterContours, parameter[self]]:
constant[
This must return an iterator that returns wrapped contours.
Subclasses may override this method.
]
variable[count] assign[=] call[name[len], parameter[name[self]]]
variable[index] assign[=] constant[0]
while... | keyword[def] identifier[_iterContours] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[count] = identifier[len] ( identifier[self] )
identifier[index] = literal[int]
keyword[while] identifier[count] :
keyword[yield] identifier[self] [ identi... | def _iterContours(self, **kwargs):
"""
This must return an iterator that returns wrapped contours.
Subclasses may override this method.
"""
count = len(self)
index = 0
while count:
yield self[index]
count -= 1
index += 1 # depends on [control=['while'], ... |
def _set_instance(self, v, load=False):
"""
Setter method for instance, mapped from YANG variable /interface/port_channel/spanning_tree/instance (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_instance is considered as a private
method. Backends looking to pop... | def function[_set_instance, parameter[self, v, load]]:
constant[
Setter method for instance, mapped from YANG variable /interface/port_channel/spanning_tree/instance (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_instance is considered as a private
method... | keyword[def] identifier[_set_instance] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
ident... | def _set_instance(self, v, load=False):
"""
Setter method for instance, mapped from YANG variable /interface/port_channel/spanning_tree/instance (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_instance is considered as a private
method. Backends looking to pop... |
def getitem_row_array(self, key):
"""Get row data for target labels.
Args:
key: Target numeric indices by which to retrieve data.
Returns:
A new QueryCompiler.
"""
# Convert to list for type checking
key = list(key)
def getitem(df, inter... | def function[getitem_row_array, parameter[self, key]]:
constant[Get row data for target labels.
Args:
key: Target numeric indices by which to retrieve data.
Returns:
A new QueryCompiler.
]
variable[key] assign[=] call[name[list], parameter[name[key]]]
... | keyword[def] identifier[getitem_row_array] ( identifier[self] , identifier[key] ):
literal[string]
identifier[key] = identifier[list] ( identifier[key] )
keyword[def] identifier[getitem] ( identifier[df] , identifier[internal_indices] =[]):
keyword[return] identifi... | def getitem_row_array(self, key):
"""Get row data for target labels.
Args:
key: Target numeric indices by which to retrieve data.
Returns:
A new QueryCompiler.
"""
# Convert to list for type checking
key = list(key)
def getitem(df, internal_indices=[]):... |
def add(self, *args):
"""
Add one or more files or URLs to the manifest.
If files contains a glob, it is expanded.
All files are uploaded to SolveBio. The Upload
object is used to fill the manifest.
"""
def _is_url(path):
p = urlparse(path)
... | def function[add, parameter[self]]:
constant[
Add one or more files or URLs to the manifest.
If files contains a glob, it is expanded.
All files are uploaded to SolveBio. The Upload
object is used to fill the manifest.
]
def function[_is_url, parameter[path]]:
... | keyword[def] identifier[add] ( identifier[self] ,* identifier[args] ):
literal[string]
keyword[def] identifier[_is_url] ( identifier[path] ):
identifier[p] = identifier[urlparse] ( identifier[path] )
keyword[return] identifier[bool] ( identifier[p] . identifier[scheme] )... | def add(self, *args):
"""
Add one or more files or URLs to the manifest.
If files contains a glob, it is expanded.
All files are uploaded to SolveBio. The Upload
object is used to fill the manifest.
"""
def _is_url(path):
p = urlparse(path)
return bool(p... |
def open_output_file(self, test_record):
"""Open file based on pattern."""
# Ignore keys for the log filename to not convert larger data structures.
record_dict = data.convert_to_base_types(
test_record, ignore_keys=('code_info', 'phases', 'log_records'))
pattern = self.filename_pattern
if i... | def function[open_output_file, parameter[self, test_record]]:
constant[Open file based on pattern.]
variable[record_dict] assign[=] call[name[data].convert_to_base_types, parameter[name[test_record]]]
variable[pattern] assign[=] name[self].filename_pattern
if <ast.BoolOp object at 0x7da1... | keyword[def] identifier[open_output_file] ( identifier[self] , identifier[test_record] ):
literal[string]
identifier[record_dict] = identifier[data] . identifier[convert_to_base_types] (
identifier[test_record] , identifier[ignore_keys] =( literal[string] , literal[string] , literal[string] ))
... | def open_output_file(self, test_record):
"""Open file based on pattern."""
# Ignore keys for the log filename to not convert larger data structures.
record_dict = data.convert_to_base_types(test_record, ignore_keys=('code_info', 'phases', 'log_records'))
pattern = self.filename_pattern
if isinstance... |
def run(self):
"""
Process all outgoing packets, until `stop()` is called. Intended to run
in its own thread.
"""
while True:
to_send = self._queue.get()
if to_send is _SHUTDOWN:
break
# If we get a gateway object, connect to i... | def function[run, parameter[self]]:
constant[
Process all outgoing packets, until `stop()` is called. Intended to run
in its own thread.
]
while constant[True] begin[:]
variable[to_send] assign[=] call[name[self]._queue.get, parameter[]]
if compare... | keyword[def] identifier[run] ( identifier[self] ):
literal[string]
keyword[while] keyword[True] :
identifier[to_send] = identifier[self] . identifier[_queue] . identifier[get] ()
keyword[if] identifier[to_send] keyword[is] identifier[_SHUTDOWN] :
keywo... | def run(self):
"""
Process all outgoing packets, until `stop()` is called. Intended to run
in its own thread.
"""
while True:
to_send = self._queue.get()
if to_send is _SHUTDOWN:
break # depends on [control=['if'], data=[]]
# If we get a gateway objec... |
def x12(self, data: ['SASdata', str] = None,
adjust: str = None,
arima: str = None,
automdl: str = None,
by: [str, list] = None,
check: str = None,
estimate: [str, bool] = True,
event: str = None,
forecast: str = None,
... | def function[x12, parameter[self, data, adjust, arima, automdl, by, check, estimate, event, forecast, id, identify, input, outlier, output, pickmdl, regression, seatsdecomp, tables, transform, userdefined, var, x11, procopts, stmtpassthrough]]:
constant[
Python method to call the X12 procedure
... | keyword[def] identifier[x12] ( identifier[self] , identifier[data] :[ literal[string] , identifier[str] ]= keyword[None] ,
identifier[adjust] : identifier[str] = keyword[None] ,
identifier[arima] : identifier[str] = keyword[None] ,
identifier[automdl] : identifier[str] = keyword[None] ,
identifier[by] :[ identifi... | def x12(self, data: ['SASdata', str]=None, adjust: str=None, arima: str=None, automdl: str=None, by: [str, list]=None, check: str=None, estimate: [str, bool]=True, event: str=None, forecast: str=None, id: [str, list]=None, identify: str=None, input: [str, list, dict]=None, outlier: str=None, output: [str, bool, 'SASdat... |
def _expand_wildcard_action(action):
"""
:param action: 'autoscaling:*'
:return: A list of all autoscaling permissions matching the wildcard
"""
if isinstance(action, list):
expanded_actions = []
for item in action:
expanded_actions.extend(_expand_wildcard_action(item))
... | def function[_expand_wildcard_action, parameter[action]]:
constant[
:param action: 'autoscaling:*'
:return: A list of all autoscaling permissions matching the wildcard
]
if call[name[isinstance], parameter[name[action], name[list]]] begin[:]
variable[expanded_actions] assign[... | keyword[def] identifier[_expand_wildcard_action] ( identifier[action] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[action] , identifier[list] ):
identifier[expanded_actions] =[]
keyword[for] identifier[item] keyword[in] identifier[action] :
identifie... | def _expand_wildcard_action(action):
"""
:param action: 'autoscaling:*'
:return: A list of all autoscaling permissions matching the wildcard
"""
if isinstance(action, list):
expanded_actions = []
for item in action:
expanded_actions.extend(_expand_wildcard_action(item)) ... |
def get_courses_metadata(self):
"""Gets the metadata for the courses.
return: (osid.Metadata) - metadata for the courses
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.ActivityForm.get_assets_metadata_template
... | def function[get_courses_metadata, parameter[self]]:
constant[Gets the metadata for the courses.
return: (osid.Metadata) - metadata for the courses
*compliance: mandatory -- This method must be implemented.*
]
variable[metadata] assign[=] call[name[dict], parameter[call[name[se... | keyword[def] identifier[get_courses_metadata] ( identifier[self] ):
literal[string]
identifier[metadata] = identifier[dict] ( identifier[self] . identifier[_mdata] [ literal[string] ])
identifier[metadata] . identifier[update] ({ literal[string] : identifier[self] . identifier[_my... | def get_courses_metadata(self):
"""Gets the metadata for the courses.
return: (osid.Metadata) - metadata for the courses
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for osid.learning.ActivityForm.get_assets_metadata_template
metadata ... |
def follow(self, delay=1.0):
"""\
Iterator generator that returns lines as data is added to the file.
Based on: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/157035
"""
trailing = True
while 1:
where = self.file.tell()
line = self.file.... | def function[follow, parameter[self, delay]]:
constant[ Iterator generator that returns lines as data is added to the file.
Based on: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/157035
]
variable[trailing] assign[=] constant[True]
while constant[1] begin[:]
... | keyword[def] identifier[follow] ( identifier[self] , identifier[delay] = literal[int] ):
literal[string]
identifier[trailing] = keyword[True]
keyword[while] literal[int] :
identifier[where] = identifier[self] . identifier[file] . identifier[tell] ()
identifier[... | def follow(self, delay=1.0):
""" Iterator generator that returns lines as data is added to the file.
Based on: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/157035
"""
trailing = True
while 1:
where = self.file.tell()
line = self.file.readline()
if l... |
def _coerce_fields_parameters(self, fields):
"""
Used by values and values_list to get the list of fields to use in the
redis sort command to retrieve fields.
The result is a dict with two lists:
- 'names', with wanted field names
- 'keys', with keys to use in the sor... | def function[_coerce_fields_parameters, parameter[self, fields]]:
constant[
Used by values and values_list to get the list of fields to use in the
redis sort command to retrieve fields.
The result is a dict with two lists:
- 'names', with wanted field names
- 'keys', ... | keyword[def] identifier[_coerce_fields_parameters] ( identifier[self] , identifier[fields] ):
literal[string]
keyword[try] :
identifier[sorted_score_pos] = identifier[fields] . identifier[index] ( identifier[SORTED_SCORE] )
keyword[except] :
identifier[sorted_scor... | def _coerce_fields_parameters(self, fields):
"""
Used by values and values_list to get the list of fields to use in the
redis sort command to retrieve fields.
The result is a dict with two lists:
- 'names', with wanted field names
- 'keys', with keys to use in the sort co... |
def calc_qar_v1(self):
"""Calculate the discharge responses of the different AR processes.
Required derived parameters:
|Nmb|
|AR_Order|
|AR_Coefs|
Required log sequence:
|LogOut|
Calculated flux sequence:
|QAR|
Examples:
Assume there are four response func... | def function[calc_qar_v1, parameter[self]]:
constant[Calculate the discharge responses of the different AR processes.
Required derived parameters:
|Nmb|
|AR_Order|
|AR_Coefs|
Required log sequence:
|LogOut|
Calculated flux sequence:
|QAR|
Examples:
Assu... | keyword[def] identifier[calc_qar_v1] ( identifier[self] ):
literal[string]
identifier[der] = identifier[self] . identifier[parameters] . identifier[derived] . identifier[fastaccess]
identifier[flu] = identifier[self] . identifier[sequences] . identifier[fluxes] . identifier[fastaccess]
identifi... | def calc_qar_v1(self):
"""Calculate the discharge responses of the different AR processes.
Required derived parameters:
|Nmb|
|AR_Order|
|AR_Coefs|
Required log sequence:
|LogOut|
Calculated flux sequence:
|QAR|
Examples:
Assume there are four response func... |
def schedule_forced_svc_check(self, service, check_time):
"""Schedule a forced check on a service
Format of the line that triggers function call::
SCHEDULE_FORCED_SVC_CHECK;<host_name>;<service_description>;<check_time>
:param service: service to check
:type service: alignak.ob... | def function[schedule_forced_svc_check, parameter[self, service, check_time]]:
constant[Schedule a forced check on a service
Format of the line that triggers function call::
SCHEDULE_FORCED_SVC_CHECK;<host_name>;<service_description>;<check_time>
:param service: service to check
... | keyword[def] identifier[schedule_forced_svc_check] ( identifier[self] , identifier[service] , identifier[check_time] ):
literal[string]
identifier[service] . identifier[schedule] ( identifier[self] . identifier[daemon] . identifier[hosts] , identifier[self] . identifier[daemon] . identifier[service... | def schedule_forced_svc_check(self, service, check_time):
"""Schedule a forced check on a service
Format of the line that triggers function call::
SCHEDULE_FORCED_SVC_CHECK;<host_name>;<service_description>;<check_time>
:param service: service to check
:type service: alignak.object... |
def get_hull_energy(self, comp):
"""
Args:
comp (Composition): Input composition
Returns:
Energy of lowest energy equilibrium at desired composition. Not
normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)
"""
e = 0
for k, v in self.get_d... | def function[get_hull_energy, parameter[self, comp]]:
constant[
Args:
comp (Composition): Input composition
Returns:
Energy of lowest energy equilibrium at desired composition. Not
normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)
]
variable[e]... | keyword[def] identifier[get_hull_energy] ( identifier[self] , identifier[comp] ):
literal[string]
identifier[e] = literal[int]
keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . identifier[get_decomposition] ( identifier[comp] ). identifier[items] ():
... | def get_hull_energy(self, comp):
"""
Args:
comp (Composition): Input composition
Returns:
Energy of lowest energy equilibrium at desired composition. Not
normalized by atoms, i.e. E(Li4O2) = 2 * E(Li2O)
"""
e = 0
for (k, v) in self.get_decompositi... |
def create(self, name, serviceId, timezone, description, enabled):
"""
Create a connector for the organization in the Watson IoT Platform.
The connector must reference the target service that the Watson IoT Platform will store the IoT data in.
Parameters:
- name (string) - N... | def function[create, parameter[self, name, serviceId, timezone, description, enabled]]:
constant[
Create a connector for the organization in the Watson IoT Platform.
The connector must reference the target service that the Watson IoT Platform will store the IoT data in.
Parameters:
... | keyword[def] identifier[create] ( identifier[self] , identifier[name] , identifier[serviceId] , identifier[timezone] , identifier[description] , identifier[enabled] ):
literal[string]
identifier[connector] ={
literal[string] : identifier[name] ,
literal[string] : identifier[descr... | def create(self, name, serviceId, timezone, description, enabled):
"""
Create a connector for the organization in the Watson IoT Platform.
The connector must reference the target service that the Watson IoT Platform will store the IoT data in.
Parameters:
- name (string) - Name ... |
def parse(self, extent, length, fp, log_block_size):
# type: (int, int, BinaryIO, int) -> None
'''
Parse an existing Inode. This just saves off the extent for later use.
Parameters:
extent - The original extent that the data lives at.
Returns:
Nothing.
... | def function[parse, parameter[self, extent, length, fp, log_block_size]]:
constant[
Parse an existing Inode. This just saves off the extent for later use.
Parameters:
extent - The original extent that the data lives at.
Returns:
Nothing.
]
if name[self... | keyword[def] identifier[parse] ( identifier[self] , identifier[extent] , identifier[length] , identifier[fp] , identifier[log_block_size] ):
literal[string]
keyword[if] identifier[self] . identifier[_initialized] :
keyword[raise] identifier[pycdlibexception] . identifier[PyCdlibInte... | def parse(self, extent, length, fp, log_block_size):
# type: (int, int, BinaryIO, int) -> None
'\n Parse an existing Inode. This just saves off the extent for later use.\n\n Parameters:\n extent - The original extent that the data lives at.\n Returns:\n Nothing.\n '
... |
def _process_replacements(self, html):
""" Do raw string replacements on :param:`html`. """
if self.config.find_string:
for find_pattern, replace_pattern in self.config.replace_patterns:
html = html.replace(find_pattern, replace_pattern)
LOGGER.info(u'Done repla... | def function[_process_replacements, parameter[self, html]]:
constant[ Do raw string replacements on :param:`html`. ]
if name[self].config.find_string begin[:]
for taget[tuple[[<ast.Name object at 0x7da1b0aa6ec0>, <ast.Name object at 0x7da1b0aa6470>]]] in starred[name[self].config.replace... | keyword[def] identifier[_process_replacements] ( identifier[self] , identifier[html] ):
literal[string]
keyword[if] identifier[self] . identifier[config] . identifier[find_string] :
keyword[for] identifier[find_pattern] , identifier[replace_pattern] keyword[in] identifier[self] . ... | def _process_replacements(self, html):
""" Do raw string replacements on :param:`html`. """
if self.config.find_string:
for (find_pattern, replace_pattern) in self.config.replace_patterns:
html = html.replace(find_pattern, replace_pattern) # depends on [control=['for'], data=[]]
LOG... |
def MWAPIWrapper(func):
"""
MWAPIWrapper 控制API请求异常的装饰器
根据requests库定义的异常来控制请求返回的意外情况
"""
@wraps(func)
def wrapper(*args, **kwargs):
self = args[0]
try:
result = func(*args, **kwargs)
return result
except ConnectionError:
err_title = '连接错... | def function[MWAPIWrapper, parameter[func]]:
constant[
MWAPIWrapper 控制API请求异常的装饰器
根据requests库定义的异常来控制请求返回的意外情况
]
def function[wrapper, parameter[]]:
variable[self] assign[=] call[name[args]][constant[0]]
<ast.Try object at 0x7da2047e9390>
call[name[sel... | keyword[def] identifier[MWAPIWrapper] ( identifier[func] ):
literal[string]
@ identifier[wraps] ( identifier[func] )
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
identifier[self] = identifier[args] [ literal[int] ]
keyword[try] :
identif... | def MWAPIWrapper(func):
"""
MWAPIWrapper 控制API请求异常的装饰器
根据requests库定义的异常来控制请求返回的意外情况
"""
@wraps(func)
def wrapper(*args, **kwargs):
self = args[0]
try:
result = func(*args, **kwargs)
return result # depends on [control=['try'], data=[]]
except Con... |
def pipeline(self, source=None, phase='build', ps=None):
"""
Construct the ETL pipeline for all phases. Segments that are not used for the current phase
are filtered out later.
:param source: A source object, or a source string name
:return: an etl Pipeline
"""
f... | def function[pipeline, parameter[self, source, phase, ps]]:
constant[
Construct the ETL pipeline for all phases. Segments that are not used for the current phase
are filtered out later.
:param source: A source object, or a source string name
:return: an etl Pipeline
]
... | keyword[def] identifier[pipeline] ( identifier[self] , identifier[source] = keyword[None] , identifier[phase] = literal[string] , identifier[ps] = keyword[None] ):
literal[string]
keyword[from] identifier[ambry] . identifier[etl] . identifier[pipeline] keyword[import] identifier[Pipeline] , iden... | def pipeline(self, source=None, phase='build', ps=None):
"""
Construct the ETL pipeline for all phases. Segments that are not used for the current phase
are filtered out later.
:param source: A source object, or a source string name
:return: an etl Pipeline
"""
from ambr... |
def select_inputs(self, address, nfees, ntokens, min_confirmations=6):
"""
Selects the inputs for the spool transaction.
Args:
address (str): bitcoin address to select inputs for
nfees (int): number of fees
ntokens (int): number of tokens
min_conf... | def function[select_inputs, parameter[self, address, nfees, ntokens, min_confirmations]]:
constant[
Selects the inputs for the spool transaction.
Args:
address (str): bitcoin address to select inputs for
nfees (int): number of fees
ntokens (int): number of to... | keyword[def] identifier[select_inputs] ( identifier[self] , identifier[address] , identifier[nfees] , identifier[ntokens] , identifier[min_confirmations] = literal[int] ):
literal[string]
identifier[unspents] = identifier[self] . identifier[_t] . identifier[get] ( identifier[address] , identifier[m... | def select_inputs(self, address, nfees, ntokens, min_confirmations=6):
"""
Selects the inputs for the spool transaction.
Args:
address (str): bitcoin address to select inputs for
nfees (int): number of fees
ntokens (int): number of tokens
min_confirma... |
def append_faces(vertices_seq, faces_seq):
"""
Given a sequence of zero- indexed faces and vertices
combine them into a single array of faces and
a single array of vertices.
Parameters
-----------
vertices_seq : (n, ) sequence of (m, d) float
Multiple arrays of verticesvertex arrays
... | def function[append_faces, parameter[vertices_seq, faces_seq]]:
constant[
Given a sequence of zero- indexed faces and vertices
combine them into a single array of faces and
a single array of vertices.
Parameters
-----------
vertices_seq : (n, ) sequence of (m, d) float
Multiple ar... | keyword[def] identifier[append_faces] ( identifier[vertices_seq] , identifier[faces_seq] ):
literal[string]
identifier[vertices_len] = identifier[np] . identifier[array] ([ identifier[len] ( identifier[i] ) keyword[for] identifier[i] keyword[in] identifier[vertices_seq] ])
identifier[face... | def append_faces(vertices_seq, faces_seq):
"""
Given a sequence of zero- indexed faces and vertices
combine them into a single array of faces and
a single array of vertices.
Parameters
-----------
vertices_seq : (n, ) sequence of (m, d) float
Multiple arrays of verticesvertex arrays
... |
def from_json(json_data):
"""
Returns a pyalveo.Client given a json string built from the client.to_json() method.
"""
# If we have a string, then decode it, otherwise assume it's already decoded
if isinstance(json_data, str):
data = json.loads(json_data)
... | def function[from_json, parameter[json_data]]:
constant[
Returns a pyalveo.Client given a json string built from the client.to_json() method.
]
if call[name[isinstance], parameter[name[json_data], name[str]]] begin[:]
variable[data] assign[=] call[name[json].loads, pa... | keyword[def] identifier[from_json] ( identifier[json_data] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[json_data] , identifier[str] ):
identifier[data] = identifier[json] . identifier[loads] ( identifier[json_data] )
keyword[else] :
... | def from_json(json_data):
"""
Returns a pyalveo.Client given a json string built from the client.to_json() method.
"""
# If we have a string, then decode it, otherwise assume it's already decoded
if isinstance(json_data, str):
data = json.loads(json_data) # depends on [control=[... |
def mousePressEvent( self, event ):
"""
Handles the mouse press event.
:param event | <QMouseEvent>
"""
scene_point = self.mapToScene(event.pos())
date = self.scene().dateAt(scene_point)
date_time = self.scene().dateTimeAt(scene_poin... | def function[mousePressEvent, parameter[self, event]]:
constant[
Handles the mouse press event.
:param event | <QMouseEvent>
]
variable[scene_point] assign[=] call[name[self].mapToScene, parameter[call[name[event].pos, parameter[]]]]
variable[date] assign[=]... | keyword[def] identifier[mousePressEvent] ( identifier[self] , identifier[event] ):
literal[string]
identifier[scene_point] = identifier[self] . identifier[mapToScene] ( identifier[event] . identifier[pos] ())
identifier[date] = identifier[self] . identifier[scene] (). identifier[dateAt]... | def mousePressEvent(self, event):
"""
Handles the mouse press event.
:param event | <QMouseEvent>
"""
scene_point = self.mapToScene(event.pos())
date = self.scene().dateAt(scene_point)
date_time = self.scene().dateTimeAt(scene_point)
item = self.scene().itemAt(s... |
def get_loggable_url(url):
"""Strip out secrets from taskcluster urls.
Args:
url (str): the url to strip
Returns:
str: the loggable url
"""
loggable_url = url or ""
for secret_string in ("bewit=", "AWSAccessKeyId=", "access_token="):
parts = loggable_url.split(secret_s... | def function[get_loggable_url, parameter[url]]:
constant[Strip out secrets from taskcluster urls.
Args:
url (str): the url to strip
Returns:
str: the loggable url
]
variable[loggable_url] assign[=] <ast.BoolOp object at 0x7da18bcca140>
for taget[name[secret_string]... | keyword[def] identifier[get_loggable_url] ( identifier[url] ):
literal[string]
identifier[loggable_url] = identifier[url] keyword[or] literal[string]
keyword[for] identifier[secret_string] keyword[in] ( literal[string] , literal[string] , literal[string] ):
identifier[parts] = identifier... | def get_loggable_url(url):
"""Strip out secrets from taskcluster urls.
Args:
url (str): the url to strip
Returns:
str: the loggable url
"""
loggable_url = url or ''
for secret_string in ('bewit=', 'AWSAccessKeyId=', 'access_token='):
parts = loggable_url.split(secret_s... |
def null_beta(self):
"""
Optimal 𝜷 according to the marginal likelihood.
It is compute by solving the equation ::
(XᵀBX)𝜷 = XᵀB𝐲.
Returns
-------
beta : ndarray
Optimal 𝜷.
"""
ETBE = self._ETBE
yTBX = self._yTBX
... | def function[null_beta, parameter[self]]:
constant[
Optimal 𝜷 according to the marginal likelihood.
It is compute by solving the equation ::
(XᵀBX)𝜷 = XᵀB𝐲.
Returns
-------
beta : ndarray
Optimal 𝜷.
]
variable[ETBE] assign[=]... | keyword[def] identifier[null_beta] ( identifier[self] ):
literal[string]
identifier[ETBE] = identifier[self] . identifier[_ETBE]
identifier[yTBX] = identifier[self] . identifier[_yTBX]
identifier[A] = identifier[sum] ( identifier[i] . identifier[XTBX] keyword[for] identifier[... | def null_beta(self):
"""
Optimal 𝜷 according to the marginal likelihood.
It is compute by solving the equation ::
(XᵀBX)𝜷 = XᵀB𝐲.
Returns
-------
beta : ndarray
Optimal 𝜷.
"""
ETBE = self._ETBE
yTBX = self._yTBX
A = sum((i.XT... |
def insert_before(self, value: Union[RawValue, Value],
raw: bool = False) -> "ArrayEntry":
"""Insert a new entry before the receiver.
Args:
value: The value of the new entry.
raw: Flag to be set if `value` is raw.
Returns:
An instance n... | def function[insert_before, parameter[self, value, raw]]:
constant[Insert a new entry before the receiver.
Args:
value: The value of the new entry.
raw: Flag to be set if `value` is raw.
Returns:
An instance node of the new inserted entry.
]
retu... | keyword[def] identifier[insert_before] ( identifier[self] , identifier[value] : identifier[Union] [ identifier[RawValue] , identifier[Value] ],
identifier[raw] : identifier[bool] = keyword[False] )-> literal[string] :
literal[string]
keyword[return] identifier[ArrayEntry] ( identifier[self] . ide... | def insert_before(self, value: Union[RawValue, Value], raw: bool=False) -> 'ArrayEntry':
"""Insert a new entry before the receiver.
Args:
value: The value of the new entry.
raw: Flag to be set if `value` is raw.
Returns:
An instance node of the new inserted entr... |
def create_component(self,
name,
project,
description=None,
leadUserName=None,
assigneeType=None,
isAssigneeTypeValid=False,
):
"""Create... | def function[create_component, parameter[self, name, project, description, leadUserName, assigneeType, isAssigneeTypeValid]]:
constant[Create a component inside a project and return a Resource for it.
:param name: name of the component
:type name: str
:param project: key of the project ... | keyword[def] identifier[create_component] ( identifier[self] ,
identifier[name] ,
identifier[project] ,
identifier[description] = keyword[None] ,
identifier[leadUserName] = keyword[None] ,
identifier[assigneeType] = keyword[None] ,
identifier[isAssigneeTypeValid] = keyword[False] ,
):
literal[string]
... | def create_component(self, name, project, description=None, leadUserName=None, assigneeType=None, isAssigneeTypeValid=False):
"""Create a component inside a project and return a Resource for it.
:param name: name of the component
:type name: str
:param project: key of the project to create ... |
def shlex_process_stdin(process_command, helptext):
"""
Use shlex to process stdin line-by-line.
Also prints help text.
Requires that @process_command be a Click command object, used for
processing single lines of input. helptext is prepended to the standard
message printed to interactive sessi... | def function[shlex_process_stdin, parameter[process_command, helptext]]:
constant[
Use shlex to process stdin line-by-line.
Also prints help text.
Requires that @process_command be a Click command object, used for
processing single lines of input. helptext is prepended to the standard
messa... | keyword[def] identifier[shlex_process_stdin] ( identifier[process_command] , identifier[helptext] ):
literal[string]
keyword[if] identifier[sys] . identifier[stdin] . identifier[isatty] ():
identifier[safeprint] (
(
literal[string] . identifier[format] ( identifier[helptext]... | def shlex_process_stdin(process_command, helptext):
"""
Use shlex to process stdin line-by-line.
Also prints help text.
Requires that @process_command be a Click command object, used for
processing single lines of input. helptext is prepended to the standard
message printed to interactive sessi... |
def sortDictList(dictList,**kwargs):
'''
students = [
{'name':'john','class':'A', 'year':15},
{'name':'jane','class':'B', 'year':12},
{'name':'dave','class':'B', 'year':10}
]
rslt = sortDictList(students,cond_keys=['name','class','year'])
... | def function[sortDictList, parameter[dictList]]:
constant[
students = [
{'name':'john','class':'A', 'year':15},
{'name':'jane','class':'B', 'year':12},
{'name':'dave','class':'B', 'year':10}
]
rslt = sortDictList(students,cond_keys=['name','cl... | keyword[def] identifier[sortDictList] ( identifier[dictList] ,** identifier[kwargs] ):
literal[string]
keyword[def] identifier[default_eq_func] ( identifier[value1] , identifier[value2] ):
identifier[cond] =( identifier[value1] == identifier[value2] )
keyword[return] ( identifier[cond] )... | def sortDictList(dictList, **kwargs):
"""
students = [
{'name':'john','class':'A', 'year':15},
{'name':'jane','class':'B', 'year':12},
{'name':'dave','class':'B', 'year':10}
]
rslt = sortDictList(students,cond_keys=['name','class','year'])
... |
def _purge_jobs(timestamp):
'''
Purge records from the returner tables.
:param job_age_in_seconds: Purge jobs older than this
:return:
'''
with _get_serv() as cursor:
try:
sql = 'delete from jids where jid in (select distinct jid from salt_returns where alter_time < %s)'
... | def function[_purge_jobs, parameter[timestamp]]:
constant[
Purge records from the returner tables.
:param job_age_in_seconds: Purge jobs older than this
:return:
]
with call[name[_get_serv], parameter[]] begin[:]
<ast.Try object at 0x7da20c795540>
<ast.Try object at 0x7d... | keyword[def] identifier[_purge_jobs] ( identifier[timestamp] ):
literal[string]
keyword[with] identifier[_get_serv] () keyword[as] identifier[cursor] :
keyword[try] :
identifier[sql] = literal[string]
identifier[cursor] . identifier[execute] ( identifier[sql] ,( identi... | def _purge_jobs(timestamp):
"""
Purge records from the returner tables.
:param job_age_in_seconds: Purge jobs older than this
:return:
"""
with _get_serv() as cursor:
try:
sql = 'delete from jids where jid in (select distinct jid from salt_returns where alter_time < %s)'
... |
def get_component_attribute_name(component):
"""
Gets given Component attribute name.
Usage::
>>> Manager.get_component_attribute_name("factory.components_manager_ui")
u'factoryComponentsManagerUi'
:param component: Component to get the attribute name.
... | def function[get_component_attribute_name, parameter[component]]:
constant[
Gets given Component attribute name.
Usage::
>>> Manager.get_component_attribute_name("factory.components_manager_ui")
u'factoryComponentsManagerUi'
:param component: Component to get t... | keyword[def] identifier[get_component_attribute_name] ( identifier[component] ):
literal[string]
identifier[search] = identifier[re] . identifier[search] ( literal[string] , identifier[component] )
keyword[if] identifier[search] :
identifier[name] = literal[string] . identif... | def get_component_attribute_name(component):
"""
Gets given Component attribute name.
Usage::
>>> Manager.get_component_attribute_name("factory.components_manager_ui")
u'factoryComponentsManagerUi'
:param component: Component to get the attribute name.
:typ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.