code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def get_permissions_query(session, identifier_s):
"""
:type identifier_s: list
"""
thedomain = case([(Domain.name == None, '*')], else_=Domain.name)
theaction = case([(Action.name == None, '*')], else_=Action.name)
theresource = case([(Resource.name == None, '*')], else_=Resource.name)
acti... | def function[get_permissions_query, parameter[session, identifier_s]]:
constant[
:type identifier_s: list
]
variable[thedomain] assign[=] call[name[case], parameter[list[[<ast.Tuple object at 0x7da204960430>]]]]
variable[theaction] assign[=] call[name[case], parameter[list[[<ast.Tuple ob... | keyword[def] identifier[get_permissions_query] ( identifier[session] , identifier[identifier_s] ):
literal[string]
identifier[thedomain] = identifier[case] ([( identifier[Domain] . identifier[name] == keyword[None] , literal[string] )], identifier[else_] = identifier[Domain] . identifier[name] )
ident... | def get_permissions_query(session, identifier_s):
"""
:type identifier_s: list
"""
thedomain = case([(Domain.name == None, '*')], else_=Domain.name)
theaction = case([(Action.name == None, '*')], else_=Action.name)
theresource = case([(Resource.name == None, '*')], else_=Resource.name)
actio... |
def _handle_response(res, delimiter):
"""Get an iterator over the CSV data from the response."""
if res.status_code == 200:
# Python 2 -- csv.reader will need bytes
if sys.version_info[0] < 3:
csv_io = BytesIO(res.content)
# Python 3 -- csv.reader needs str
else:
... | def function[_handle_response, parameter[res, delimiter]]:
constant[Get an iterator over the CSV data from the response.]
if compare[name[res].status_code equal[==] constant[200]] begin[:]
if compare[call[name[sys].version_info][constant[0]] less[<] constant[3]] begin[:]
... | keyword[def] identifier[_handle_response] ( identifier[res] , identifier[delimiter] ):
literal[string]
keyword[if] identifier[res] . identifier[status_code] == literal[int] :
keyword[if] identifier[sys] . identifier[version_info] [ literal[int] ]< literal[int] :
identifier[csv_... | def _handle_response(res, delimiter):
"""Get an iterator over the CSV data from the response."""
if res.status_code == 200:
# Python 2 -- csv.reader will need bytes
if sys.version_info[0] < 3:
csv_io = BytesIO(res.content) # depends on [control=['if'], data=[]]
else:
... |
def split_phonemes(letter, onset=True, nucleus=True, coda=True):
"""Splits Korean phonemes as known as "자소" from a Hangul letter.
:returns: (onset, nucleus, coda)
:raises ValueError: `letter` is not a Hangul single letter.
"""
if len(letter) != 1 or not is_hangul(letter):
raise ValueError(... | def function[split_phonemes, parameter[letter, onset, nucleus, coda]]:
constant[Splits Korean phonemes as known as "자소" from a Hangul letter.
:returns: (onset, nucleus, coda)
:raises ValueError: `letter` is not a Hangul single letter.
]
if <ast.BoolOp object at 0x7da1aff1cfa0> begin[:]
... | keyword[def] identifier[split_phonemes] ( identifier[letter] , identifier[onset] = keyword[True] , identifier[nucleus] = keyword[True] , identifier[coda] = keyword[True] ):
literal[string]
keyword[if] identifier[len] ( identifier[letter] )!= literal[int] keyword[or] keyword[not] identifier[is_hangul] (... | def split_phonemes(letter, onset=True, nucleus=True, coda=True):
"""Splits Korean phonemes as known as "자소" from a Hangul letter.
:returns: (onset, nucleus, coda)
:raises ValueError: `letter` is not a Hangul single letter.
"""
if len(letter) != 1 or not is_hangul(letter):
raise ValueError(... |
def wsgi(self, environ, start_response):
""" The bottle WSGI-interface. """
try:
environ['bottle.app'] = self
request.bind(environ)
response.bind()
out = self._handle(environ)
out = self._cast(out, request, response)
# rfc2616 secti... | def function[wsgi, parameter[self, environ, start_response]]:
constant[ The bottle WSGI-interface. ]
<ast.Try object at 0x7da1b194d330> | keyword[def] identifier[wsgi] ( identifier[self] , identifier[environ] , identifier[start_response] ):
literal[string]
keyword[try] :
identifier[environ] [ literal[string] ]= identifier[self]
identifier[request] . identifier[bind] ( identifier[environ] )
iden... | def wsgi(self, environ, start_response):
""" The bottle WSGI-interface. """
try:
environ['bottle.app'] = self
request.bind(environ)
response.bind()
out = self._handle(environ)
out = self._cast(out, request, response)
# rfc2616 section 4.3
if response.statu... |
def write_gps_datum(self, code=None, gps_datum=None):
"""
Write the mandatory GPS datum header::
writer.write_gps_datum()
# -> HFDTM100GPSDATUM:WGS-1984
writer.write_gps_datum(33, 'Guam-1963')
# -> HFDTM033GPSDATUM:Guam-1963
Note that the defaul... | def function[write_gps_datum, parameter[self, code, gps_datum]]:
constant[
Write the mandatory GPS datum header::
writer.write_gps_datum()
# -> HFDTM100GPSDATUM:WGS-1984
writer.write_gps_datum(33, 'Guam-1963')
# -> HFDTM033GPSDATUM:Guam-1963
Not... | keyword[def] identifier[write_gps_datum] ( identifier[self] , identifier[code] = keyword[None] , identifier[gps_datum] = keyword[None] ):
literal[string]
keyword[if] identifier[code] keyword[is] keyword[None] :
identifier[code] = literal[int]
keyword[if] identifier[gps_... | def write_gps_datum(self, code=None, gps_datum=None):
"""
Write the mandatory GPS datum header::
writer.write_gps_datum()
# -> HFDTM100GPSDATUM:WGS-1984
writer.write_gps_datum(33, 'Guam-1963')
# -> HFDTM033GPSDATUM:Guam-1963
Note that the default GP... |
def generate(self, model_len=None, model_width=None):
"""Generates a CNN.
Args:
model_len: An integer. Number of convolutional layers.
model_width: An integer. Number of filters for the convolutional layers.
Returns:
An instance of the class Graph. Represents ... | def function[generate, parameter[self, model_len, model_width]]:
constant[Generates a CNN.
Args:
model_len: An integer. Number of convolutional layers.
model_width: An integer. Number of filters for the convolutional layers.
Returns:
An instance of the class G... | keyword[def] identifier[generate] ( identifier[self] , identifier[model_len] = keyword[None] , identifier[model_width] = keyword[None] ):
literal[string]
keyword[if] identifier[model_len] keyword[is] keyword[None] :
identifier[model_len] = identifier[Constant] . identifier[MODEL_LE... | def generate(self, model_len=None, model_width=None):
"""Generates a CNN.
Args:
model_len: An integer. Number of convolutional layers.
model_width: An integer. Number of filters for the convolutional layers.
Returns:
An instance of the class Graph. Represents the ... |
def cli(env):
"""Server order options for a given chassis."""
hardware_manager = hardware.HardwareManager(env.client)
options = hardware_manager.get_create_options()
tables = []
# Datacenters
dc_table = formatting.Table(['datacenter', 'value'])
dc_table.sortby = 'value'
for location i... | def function[cli, parameter[env]]:
constant[Server order options for a given chassis.]
variable[hardware_manager] assign[=] call[name[hardware].HardwareManager, parameter[name[env].client]]
variable[options] assign[=] call[name[hardware_manager].get_create_options, parameter[]]
variable[... | keyword[def] identifier[cli] ( identifier[env] ):
literal[string]
identifier[hardware_manager] = identifier[hardware] . identifier[HardwareManager] ( identifier[env] . identifier[client] )
identifier[options] = identifier[hardware_manager] . identifier[get_create_options] ()
identifier[tables] ... | def cli(env):
"""Server order options for a given chassis."""
hardware_manager = hardware.HardwareManager(env.client)
options = hardware_manager.get_create_options()
tables = []
# Datacenters
dc_table = formatting.Table(['datacenter', 'value'])
dc_table.sortby = 'value'
for location in o... |
def prune(self, filter_func=None, from_stash='active', to_stash='pruned'):
"""
Prune unsatisfiable states from a stash.
This function will move all unsatisfiable states in the given stash into a different stash.
:param filter_func: Only prune states that match this filter.
:par... | def function[prune, parameter[self, filter_func, from_stash, to_stash]]:
constant[
Prune unsatisfiable states from a stash.
This function will move all unsatisfiable states in the given stash into a different stash.
:param filter_func: Only prune states that match this filter.
... | keyword[def] identifier[prune] ( identifier[self] , identifier[filter_func] = keyword[None] , identifier[from_stash] = literal[string] , identifier[to_stash] = literal[string] ):
literal[string]
keyword[def] identifier[_prune_filter] ( identifier[state] ):
identifier[to_prune] = keywo... | def prune(self, filter_func=None, from_stash='active', to_stash='pruned'):
"""
Prune unsatisfiable states from a stash.
This function will move all unsatisfiable states in the given stash into a different stash.
:param filter_func: Only prune states that match this filter.
:param f... |
async def _download_photo(self, photo, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for photos"""
# Determine the photo and its largest size
if isinstance(photo, types.MessageMediaPhoto):
photo = photo.photo
if not isinstance(photo, types... | <ast.AsyncFunctionDef object at 0x7da1b1f48f40> | keyword[async] keyword[def] identifier[_download_photo] ( identifier[self] , identifier[photo] , identifier[file] , identifier[date] , identifier[thumb] , identifier[progress_callback] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[photo] , identifier[types] . identif... | async def _download_photo(self, photo, file, date, thumb, progress_callback):
"""Specialized version of .download_media() for photos"""
# Determine the photo and its largest size
if isinstance(photo, types.MessageMediaPhoto):
photo = photo.photo # depends on [control=['if'], data=[]]
if not isi... |
def sp_sum_values(self):
"""
return sp level values
input:
"values": {
"spa": {
"19": "385",
"18": "0",
"20": "0",
"17": "0",
"16": "0"
},
"spb": {
"19": "... | def function[sp_sum_values, parameter[self]]:
constant[
return sp level values
input:
"values": {
"spa": {
"19": "385",
"18": "0",
"20": "0",
"17": "0",
"16": "0"
},
"spb"... | keyword[def] identifier[sp_sum_values] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[values] keyword[is] keyword[None] :
identifier[ret] = identifier[IdValues] ()
keyword[else] :
identifier[ret] = identifier[IdValues] ({ identi... | def sp_sum_values(self):
"""
return sp level values
input:
"values": {
"spa": {
"19": "385",
"18": "0",
"20": "0",
"17": "0",
"16": "0"
},
"spb": {
"19": "101"... |
def decrypt_block(self, cipherText):
"""Decrypt a 16-byte block of data.
NOTE: This function was formerly called `decrypt`, but was changed when
support for decrypting arbitrary-length strings was added.
Args:
cipherText (str): 16-byte data.
Returns:
16-byte str.
Raises:
... | def function[decrypt_block, parameter[self, cipherText]]:
constant[Decrypt a 16-byte block of data.
NOTE: This function was formerly called `decrypt`, but was changed when
support for decrypting arbitrary-length strings was added.
Args:
cipherText (str): 16-byte data.
Returns:
... | keyword[def] identifier[decrypt_block] ( identifier[self] , identifier[cipherText] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[initialized] :
keyword[raise] identifier[TypeError] ( literal[string] )
keyword[if] identifier[len] ( identifier[cipherText] )!= ident... | def decrypt_block(self, cipherText):
"""Decrypt a 16-byte block of data.
NOTE: This function was formerly called `decrypt`, but was changed when
support for decrypting arbitrary-length strings was added.
Args:
cipherText (str): 16-byte data.
Returns:
16-byte str.
Raises:
... |
def id_to_object(self, line):
"""
Resolves the given id to a user object, if it doesn't exists it will be created.
"""
user = User.get(line, ignore=404)
if not user:
user = User(username=line)
user.save()
return user | def function[id_to_object, parameter[self, line]]:
constant[
Resolves the given id to a user object, if it doesn't exists it will be created.
]
variable[user] assign[=] call[name[User].get, parameter[name[line]]]
if <ast.UnaryOp object at 0x7da1affc6050> begin[:]
... | keyword[def] identifier[id_to_object] ( identifier[self] , identifier[line] ):
literal[string]
identifier[user] = identifier[User] . identifier[get] ( identifier[line] , identifier[ignore] = literal[int] )
keyword[if] keyword[not] identifier[user] :
identifier[user] = identi... | def id_to_object(self, line):
"""
Resolves the given id to a user object, if it doesn't exists it will be created.
"""
user = User.get(line, ignore=404)
if not user:
user = User(username=line)
user.save() # depends on [control=['if'], data=[]]
return user |
def as_dict(self):
"""
Additionally encodes headers.
:return:
"""
data = super(BaseEmail, self).as_dict()
data["Headers"] = [{"Name": name, "Value": value} for name, value in data["Headers"].items()]
for field in ("To", "Cc", "Bcc"):
if field in data:... | def function[as_dict, parameter[self]]:
constant[
Additionally encodes headers.
:return:
]
variable[data] assign[=] call[call[name[super], parameter[name[BaseEmail], name[self]]].as_dict, parameter[]]
call[name[data]][constant[Headers]] assign[=] <ast.ListComp object at ... | keyword[def] identifier[as_dict] ( identifier[self] ):
literal[string]
identifier[data] = identifier[super] ( identifier[BaseEmail] , identifier[self] ). identifier[as_dict] ()
identifier[data] [ literal[string] ]=[{ literal[string] : identifier[name] , literal[string] : identifier[value] ... | def as_dict(self):
"""
Additionally encodes headers.
:return:
"""
data = super(BaseEmail, self).as_dict()
data['Headers'] = [{'Name': name, 'Value': value} for (name, value) in data['Headers'].items()]
for field in ('To', 'Cc', 'Bcc'):
if field in data:
data[... |
def to_source(self, classname):
"""
Returns the model as Java source code if the classifier implements weka.classifiers.Sourcable.
:param classname: the classname for the generated Java code
:type classname: str
:return: the model as source code string
:rtype: str
... | def function[to_source, parameter[self, classname]]:
constant[
Returns the model as Java source code if the classifier implements weka.classifiers.Sourcable.
:param classname: the classname for the generated Java code
:type classname: str
:return: the model as source code string... | keyword[def] identifier[to_source] ( identifier[self] , identifier[classname] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[check_type] ( identifier[self] . identifier[jobject] , literal[string] ):
keyword[return] keyword[None]
keyword[return] ... | def to_source(self, classname):
"""
Returns the model as Java source code if the classifier implements weka.classifiers.Sourcable.
:param classname: the classname for the generated Java code
:type classname: str
:return: the model as source code string
:rtype: str
""... |
def to_ansi_8bit(self):
"""
Convert to ANSI 8-bit
:return:
"""
res = []
for i in self.parts:
res.append(i.to_ansi_8bit())
return ''.join(res).encode('utf8') | def function[to_ansi_8bit, parameter[self]]:
constant[
Convert to ANSI 8-bit
:return:
]
variable[res] assign[=] list[[]]
for taget[name[i]] in starred[name[self].parts] begin[:]
call[name[res].append, parameter[call[name[i].to_ansi_8bit, parameter[]]]]
... | keyword[def] identifier[to_ansi_8bit] ( identifier[self] ):
literal[string]
identifier[res] =[]
keyword[for] identifier[i] keyword[in] identifier[self] . identifier[parts] :
identifier[res] . identifier[append] ( identifier[i] . identifier[to_ansi_8bit] ())
keyword... | def to_ansi_8bit(self):
"""
Convert to ANSI 8-bit
:return:
"""
res = []
for i in self.parts:
res.append(i.to_ansi_8bit()) # depends on [control=['for'], data=['i']]
return ''.join(res).encode('utf8') |
def checksec_app(_parser, _, args): # pragma: no cover
"""
Check security features of an ELF file.
"""
import sys
import argparse
import csv
import os.path
def checksec(elf, path, fortifiable_funcs):
relro = 0
nx = False
pie = 0
rpath = False
ru... | def function[checksec_app, parameter[_parser, _, args]]:
constant[
Check security features of an ELF file.
]
import module[sys]
import module[argparse]
import module[csv]
import module[os.path]
def function[checksec, parameter[elf, path, fortifiable_funcs]]:
varia... | keyword[def] identifier[checksec_app] ( identifier[_parser] , identifier[_] , identifier[args] ):
literal[string]
keyword[import] identifier[sys]
keyword[import] identifier[argparse]
keyword[import] identifier[csv]
keyword[import] identifier[os] . identifier[path]
keyword[def]... | def checksec_app(_parser, _, args): # pragma: no cover
'\n Check security features of an ELF file.\n '
import sys
import argparse
import csv
import os.path
def checksec(elf, path, fortifiable_funcs):
relro = 0
nx = False
pie = 0
rpath = False
runpa... |
def to_xml(self):
"""Encodes the stored ``data`` to XML and returns
an ``lxml.etree`` value.
"""
if self.data:
self.document = self._update_document(self.document, self.data)
return self.document | def function[to_xml, parameter[self]]:
constant[Encodes the stored ``data`` to XML and returns
an ``lxml.etree`` value.
]
if name[self].data begin[:]
name[self].document assign[=] call[name[self]._update_document, parameter[name[self].document, name[self].data]]
retur... | keyword[def] identifier[to_xml] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[data] :
identifier[self] . identifier[document] = identifier[self] . identifier[_update_document] ( identifier[self] . identifier[document] , identifier[self] . identifier[d... | def to_xml(self):
"""Encodes the stored ``data`` to XML and returns
an ``lxml.etree`` value.
"""
if self.data:
self.document = self._update_document(self.document, self.data) # depends on [control=['if'], data=[]]
return self.document |
def __destroy(self):
"""Remove controller from parent controller and/or destroy it self."""
if self.parent:
self.parent.remove_controller(self)
else:
self.destroy() | def function[__destroy, parameter[self]]:
constant[Remove controller from parent controller and/or destroy it self.]
if name[self].parent begin[:]
call[name[self].parent.remove_controller, parameter[name[self]]] | keyword[def] identifier[__destroy] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[parent] :
identifier[self] . identifier[parent] . identifier[remove_controller] ( identifier[self] )
keyword[else] :
identifier[self] . identifier[d... | def __destroy(self):
"""Remove controller from parent controller and/or destroy it self."""
if self.parent:
self.parent.remove_controller(self) # depends on [control=['if'], data=[]]
else:
self.destroy() |
def setValidityErrorHandler(self, err_func, warn_func, arg=None):
"""
Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg)
"""
libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg) | def function[setValidityErrorHandler, parameter[self, err_func, warn_func, arg]]:
constant[
Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg)
]
call[name[libxml2mod].xmlSchemaSetValidErrors, parameter[name[self]._o, name[err_func],... | keyword[def] identifier[setValidityErrorHandler] ( identifier[self] , identifier[err_func] , identifier[warn_func] , identifier[arg] = keyword[None] ):
literal[string]
identifier[libxml2mod] . identifier[xmlSchemaSetValidErrors] ( identifier[self] . identifier[_o] , identifier[err_func] , identifie... | def setValidityErrorHandler(self, err_func, warn_func, arg=None):
"""
Register error and warning handlers for Schema validation.
These will be called back as f(msg,arg)
"""
libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg) |
def listrecords(**kwargs):
"""Create OAI-PMH response for verb ListRecords."""
record_dumper = serializer(kwargs['metadataPrefix'])
e_tree, e_listrecords = verb(**kwargs)
result = get_records(**kwargs)
for record in result.items:
pid = oaiid_fetcher(record['id'], record['json']['_source'])... | def function[listrecords, parameter[]]:
constant[Create OAI-PMH response for verb ListRecords.]
variable[record_dumper] assign[=] call[name[serializer], parameter[call[name[kwargs]][constant[metadataPrefix]]]]
<ast.Tuple object at 0x7da20e957190> assign[=] call[name[verb], parameter[]]
v... | keyword[def] identifier[listrecords] (** identifier[kwargs] ):
literal[string]
identifier[record_dumper] = identifier[serializer] ( identifier[kwargs] [ literal[string] ])
identifier[e_tree] , identifier[e_listrecords] = identifier[verb] (** identifier[kwargs] )
identifier[result] = identifier[g... | def listrecords(**kwargs):
"""Create OAI-PMH response for verb ListRecords."""
record_dumper = serializer(kwargs['metadataPrefix'])
(e_tree, e_listrecords) = verb(**kwargs)
result = get_records(**kwargs)
for record in result.items:
pid = oaiid_fetcher(record['id'], record['json']['_source'])... |
def run_in_terminal(self, func, render_cli_done=False, cooked_mode=True):
"""
Run function on the terminal above the prompt.
What this does is first hiding the prompt, then running this callable
(which can safely output to the terminal), and then again rendering the
prompt which... | def function[run_in_terminal, parameter[self, func, render_cli_done, cooked_mode]]:
constant[
Run function on the terminal above the prompt.
What this does is first hiding the prompt, then running this callable
(which can safely output to the terminal), and then again rendering the
... | keyword[def] identifier[run_in_terminal] ( identifier[self] , identifier[func] , identifier[render_cli_done] = keyword[False] , identifier[cooked_mode] = keyword[True] ):
literal[string]
keyword[if] identifier[render_cli_done] :
identifier[self] . identifier[_return_value] = ... | def run_in_terminal(self, func, render_cli_done=False, cooked_mode=True):
"""
Run function on the terminal above the prompt.
What this does is first hiding the prompt, then running this callable
(which can safely output to the terminal), and then again rendering the
prompt which cau... |
def calculate_sun_from_date_time(self, datetime, is_solar_time=False):
"""Get Sun for an hour of the year.
This code is originally written by Trygve Wastvedt \
(Trygve.Wastvedt@gmail.com)
based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari
Args:
date... | def function[calculate_sun_from_date_time, parameter[self, datetime, is_solar_time]]:
constant[Get Sun for an hour of the year.
This code is originally written by Trygve Wastvedt (Trygve.Wastvedt@gmail.com)
based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari
Arg... | keyword[def] identifier[calculate_sun_from_date_time] ( identifier[self] , identifier[datetime] , identifier[is_solar_time] = keyword[False] ):
literal[string]
keyword[if] identifier[datetime] . identifier[year] != literal[int] keyword[and] identifier[self] . identifier[is_leap_year] :
... | def calculate_sun_from_date_time(self, datetime, is_solar_time=False):
"""Get Sun for an hour of the year.
This code is originally written by Trygve Wastvedt (Trygve.Wastvedt@gmail.com)
based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari
Args:
datetime: ... |
def save_config(self):
""" Save config file
Creates config.restore (back up file)
Returns:
-1: Error saving config
0: Config saved successfully
1: Config not saved (not modified"""
if not self.opts['dirty_config'][1]:
... | def function[save_config, parameter[self]]:
constant[ Save config file
Creates config.restore (back up file)
Returns:
-1: Error saving config
0: Config saved successfully
1: Config not saved (not modified]
if <ast.UnaryOp object ... | keyword[def] identifier[save_config] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[opts] [ literal[string] ][ literal[int] ]:
keyword[if] identifier[logger] . identifier[isEnabledFor] ( identifier[logging] . identifier[INFO] ):
... | def save_config(self):
""" Save config file
Creates config.restore (back up file)
Returns:
-1: Error saving config
0: Config saved successfully
1: Config not saved (not modified"""
if not self.opts['dirty_config'][1]:
if logger.i... |
def all(cls, collection, skip=None, limit=None):
"""
Returns all documents of the collection
:param collection Collection instance
:param skip The number of documents to skip in the query
:param limit The maximal amount of documents to return. The skip is applie... | def function[all, parameter[cls, collection, skip, limit]]:
constant[
Returns all documents of the collection
:param collection Collection instance
:param skip The number of documents to skip in the query
:param limit The maximal amount of documents to return. T... | keyword[def] identifier[all] ( identifier[cls] , identifier[collection] , identifier[skip] = keyword[None] , identifier[limit] = keyword[None] ):
literal[string]
identifier[kwargs] ={
literal[string] : identifier[skip] ,
literal[string] : identifier[limit] ,
}
k... | def all(cls, collection, skip=None, limit=None):
"""
Returns all documents of the collection
:param collection Collection instance
:param skip The number of documents to skip in the query
:param limit The maximal amount of documents to return. The skip is applied be... |
def break_args_options(line):
# type: (Text) -> Tuple[str, Text]
"""Break up the line into an args and options string. We only want to shlex
(and then optparse) the options, not the args. args can contain markers
which are corrupted by shlex.
"""
tokens = line.split(' ')
args = []
opti... | def function[break_args_options, parameter[line]]:
constant[Break up the line into an args and options string. We only want to shlex
(and then optparse) the options, not the args. args can contain markers
which are corrupted by shlex.
]
variable[tokens] assign[=] call[name[line].split, par... | keyword[def] identifier[break_args_options] ( identifier[line] ):
literal[string]
identifier[tokens] = identifier[line] . identifier[split] ( literal[string] )
identifier[args] =[]
identifier[options] = identifier[tokens] [:]
keyword[for] identifier[token] keyword[in] identifier[tokens] ... | def break_args_options(line):
# type: (Text) -> Tuple[str, Text]
'Break up the line into an args and options string. We only want to shlex\n (and then optparse) the options, not the args. args can contain markers\n which are corrupted by shlex.\n '
tokens = line.split(' ')
args = []
optio... |
def _component_of(name):
"""Get the root package or module of the passed module.
"""
# Get the registered package this model belongs to.
segments = name.split('.')
while segments:
# Is this name a registered package?
test = '.'.join(segments)
if test in settings.get('COMPONE... | def function[_component_of, parameter[name]]:
constant[Get the root package or module of the passed module.
]
variable[segments] assign[=] call[name[name].split, parameter[constant[.]]]
while name[segments] begin[:]
variable[test] assign[=] call[constant[.].join, parameter[na... | keyword[def] identifier[_component_of] ( identifier[name] ):
literal[string]
identifier[segments] = identifier[name] . identifier[split] ( literal[string] )
keyword[while] identifier[segments] :
identifier[test] = literal[string] . identifier[join] ( identifier[segments] )
... | def _component_of(name):
"""Get the root package or module of the passed module.
"""
# Get the registered package this model belongs to.
segments = name.split('.')
while segments:
# Is this name a registered package?
test = '.'.join(segments)
if test in settings.get('COMPONEN... |
def get_directories_with_extensions(self, start, extensions=None):
"""
Look for directories with image extensions in given directory and
return a list with found dirs.
.. note:: In deep file structures this might get pretty slow.
"""
return set([p.parent for ext i... | def function[get_directories_with_extensions, parameter[self, start, extensions]]:
constant[
Look for directories with image extensions in given directory and
return a list with found dirs.
.. note:: In deep file structures this might get pretty slow.
]
return[call[name[set]... | keyword[def] identifier[get_directories_with_extensions] ( identifier[self] , identifier[start] , identifier[extensions] = keyword[None] ):
literal[string]
keyword[return] identifier[set] ([ identifier[p] . identifier[parent] keyword[for] identifier[ext] keyword[in] identifier[extensions] k... | def get_directories_with_extensions(self, start, extensions=None):
"""
Look for directories with image extensions in given directory and
return a list with found dirs.
.. note:: In deep file structures this might get pretty slow.
"""
return set([p.parent for ext in extensions fo... |
def _compile_control_flow_expression(self,
expr: Expression,
scope: Dict[str, TensorFluent],
batch_size: Optional[int] = None,
noise: Optional[List[tf.Tenso... | def function[_compile_control_flow_expression, parameter[self, expr, scope, batch_size, noise]]:
constant[Compile a control flow expression `expr` into a TensorFluent
in the given `scope` with optional batch size.
Args:
expr (:obj:`rddl2tf.expr.Expression`): A RDDL control flow expr... | keyword[def] identifier[_compile_control_flow_expression] ( identifier[self] ,
identifier[expr] : identifier[Expression] ,
identifier[scope] : identifier[Dict] [ identifier[str] , identifier[TensorFluent] ],
identifier[batch_size] : identifier[Optional] [ identifier[int] ]= keyword[None] ,
identifier[noise] : ide... | def _compile_control_flow_expression(self, expr: Expression, scope: Dict[str, TensorFluent], batch_size: Optional[int]=None, noise: Optional[List[tf.Tensor]]=None) -> TensorFluent:
"""Compile a control flow expression `expr` into a TensorFluent
in the given `scope` with optional batch size.
Args:
... |
def pretty(timings, label):
'''Print timing stats'''
results = [(sum(values), len(values), key)
for key, values in timings.items()]
print(label)
print('=' * 65)
print('%20s => %13s | %8s | %13s' % (
'Command', 'Average', '# Calls', 'Total time'))
p... | def function[pretty, parameter[timings, label]]:
constant[Print timing stats]
variable[results] assign[=] <ast.ListComp object at 0x7da1b1beec20>
call[name[print], parameter[name[label]]]
call[name[print], parameter[binary_operation[constant[=] * constant[65]]]]
call[name[print],... | keyword[def] identifier[pretty] ( identifier[timings] , identifier[label] ):
literal[string]
identifier[results] =[( identifier[sum] ( identifier[values] ), identifier[len] ( identifier[values] ), identifier[key] )
keyword[for] identifier[key] , identifier[values] keyword[in] identifier... | def pretty(timings, label):
"""Print timing stats"""
results = [(sum(values), len(values), key) for (key, values) in timings.items()]
print(label)
print('=' * 65)
print('%20s => %13s | %8s | %13s' % ('Command', 'Average', '# Calls', 'Total time'))
print('-' * 65)
for (total, length, key) in ... |
def get_unset_inputs(self):
""" Return a set of unset inputs """
return set([k for k, v in self._inputs.items() if v.is_empty(False)]) | def function[get_unset_inputs, parameter[self]]:
constant[ Return a set of unset inputs ]
return[call[name[set], parameter[<ast.ListComp object at 0x7da20c7cb940>]]] | keyword[def] identifier[get_unset_inputs] ( identifier[self] ):
literal[string]
keyword[return] identifier[set] ([ identifier[k] keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . identifier[_inputs] . identifier[items] () keyword[if] identifier[v] . identifier[is_empty... | def get_unset_inputs(self):
""" Return a set of unset inputs """
return set([k for (k, v) in self._inputs.items() if v.is_empty(False)]) |
async def fetch_guild(self, guild_id):
"""|coro|
Retrieves a :class:`.Guild` from an ID.
.. note::
Using this, you will not receive :attr:`.Guild.channels`, :class:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.
.. no... | <ast.AsyncFunctionDef object at 0x7da1b20ca770> | keyword[async] keyword[def] identifier[fetch_guild] ( identifier[self] , identifier[guild_id] ):
literal[string]
identifier[data] = keyword[await] identifier[self] . identifier[http] . identifier[get_guild] ( identifier[guild_id] )
keyword[return] identifier[Guild] ( identifier[data] = ... | async def fetch_guild(self, guild_id):
"""|coro|
Retrieves a :class:`.Guild` from an ID.
.. note::
Using this, you will not receive :attr:`.Guild.channels`, :class:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.
.. note::... |
def encrypt_password(self):
""" encrypt password if not already encrypted """
if self.password and not self.password.startswith('$pbkdf2'):
self.set_password(self.password) | def function[encrypt_password, parameter[self]]:
constant[ encrypt password if not already encrypted ]
if <ast.BoolOp object at 0x7da18f58c820> begin[:]
call[name[self].set_password, parameter[name[self].password]] | keyword[def] identifier[encrypt_password] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[password] keyword[and] keyword[not] identifier[self] . identifier[password] . identifier[startswith] ( literal[string] ):
identifier[self] . identifier[set_pass... | def encrypt_password(self):
""" encrypt password if not already encrypted """
if self.password and (not self.password.startswith('$pbkdf2')):
self.set_password(self.password) # depends on [control=['if'], data=[]] |
def upload_token(
self,
bucket,
key=None,
expires=3600,
policy=None,
strict_policy=True):
"""生成上传凭证
Args:
bucket: 上传的空间名
key: 上传的文件名,默认为空
expires: 上传凭证的过期时间,默认为3600s
policy: 上传策... | def function[upload_token, parameter[self, bucket, key, expires, policy, strict_policy]]:
constant[生成上传凭证
Args:
bucket: 上传的空间名
key: 上传的文件名,默认为空
expires: 上传凭证的过期时间,默认为3600s
policy: 上传策略,默认为空
Returns:
上传凭证
]
if <as... | keyword[def] identifier[upload_token] (
identifier[self] ,
identifier[bucket] ,
identifier[key] = keyword[None] ,
identifier[expires] = literal[int] ,
identifier[policy] = keyword[None] ,
identifier[strict_policy] = keyword[True] ):
literal[string]
keyword[if] identifier[bucket] keyword[is]... | def upload_token(self, bucket, key=None, expires=3600, policy=None, strict_policy=True):
"""生成上传凭证
Args:
bucket: 上传的空间名
key: 上传的文件名,默认为空
expires: 上传凭证的过期时间,默认为3600s
policy: 上传策略,默认为空
Returns:
上传凭证
"""
if bucket is None o... |
async def extended_analog(self, pin, data):
"""
This method will send an extended-data analog write command to the
selected pin.
:param pin: 0 - 127
:param data: 0 - 0xfffff
:returns: No return value
"""
analog_data = [pin, data & 0x7f, (data >> 7) & 0x... | <ast.AsyncFunctionDef object at 0x7da18dc9b9a0> | keyword[async] keyword[def] identifier[extended_analog] ( identifier[self] , identifier[pin] , identifier[data] ):
literal[string]
identifier[analog_data] =[ identifier[pin] , identifier[data] & literal[int] ,( identifier[data] >> literal[int] )& literal[int] ,( identifier[data] >> literal[int] )&... | async def extended_analog(self, pin, data):
"""
This method will send an extended-data analog write command to the
selected pin.
:param pin: 0 - 127
:param data: 0 - 0xfffff
:returns: No return value
"""
analog_data = [pin, data & 127, data >> 7 & 127, data >> ... |
def with_known_args(self, **kwargs):
"""Send only known keyword-arguments to the phase when called."""
argspec = inspect.getargspec(self.func)
stored = {}
for key, arg in six.iteritems(kwargs):
if key in argspec.args or argspec.keywords:
stored[key] = arg
if stored:
return self.w... | def function[with_known_args, parameter[self]]:
constant[Send only known keyword-arguments to the phase when called.]
variable[argspec] assign[=] call[name[inspect].getargspec, parameter[name[self].func]]
variable[stored] assign[=] dictionary[[], []]
for taget[tuple[[<ast.Name object at ... | keyword[def] identifier[with_known_args] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[argspec] = identifier[inspect] . identifier[getargspec] ( identifier[self] . identifier[func] )
identifier[stored] ={}
keyword[for] identifier[key] , identifier[arg] keyword[in] ide... | def with_known_args(self, **kwargs):
"""Send only known keyword-arguments to the phase when called."""
argspec = inspect.getargspec(self.func)
stored = {}
for (key, arg) in six.iteritems(kwargs):
if key in argspec.args or argspec.keywords:
stored[key] = arg # depends on [control=['i... |
def close_room(self, room, namespace):
"""Remove all participants from a room."""
try:
for sid in self.get_participants(namespace, room):
self.leave_room(sid, namespace, room)
except KeyError:
pass | def function[close_room, parameter[self, room, namespace]]:
constant[Remove all participants from a room.]
<ast.Try object at 0x7da1b21b91e0> | keyword[def] identifier[close_room] ( identifier[self] , identifier[room] , identifier[namespace] ):
literal[string]
keyword[try] :
keyword[for] identifier[sid] keyword[in] identifier[self] . identifier[get_participants] ( identifier[namespace] , identifier[room] ):
... | def close_room(self, room, namespace):
"""Remove all participants from a room."""
try:
for sid in self.get_participants(namespace, room):
self.leave_room(sid, namespace, room) # depends on [control=['for'], data=['sid']] # depends on [control=['try'], data=[]]
except KeyError:
... |
def speak(self, message):
""" Post a message.
Args:
message (:class:`Message` or string): Message
Returns:
bool. Success
"""
campfire = self.get_campfire()
if not isinstance(message, Message):
message = Message(campfire, message)
... | def function[speak, parameter[self, message]]:
constant[ Post a message.
Args:
message (:class:`Message` or string): Message
Returns:
bool. Success
]
variable[campfire] assign[=] call[name[self].get_campfire, parameter[]]
if <ast.UnaryOp object a... | keyword[def] identifier[speak] ( identifier[self] , identifier[message] ):
literal[string]
identifier[campfire] = identifier[self] . identifier[get_campfire] ()
keyword[if] keyword[not] identifier[isinstance] ( identifier[message] , identifier[Message] ):
identifier[message]... | def speak(self, message):
""" Post a message.
Args:
message (:class:`Message` or string): Message
Returns:
bool. Success
"""
campfire = self.get_campfire()
if not isinstance(message, Message):
message = Message(campfire, message) # depends on [contr... |
def _nac(self, q_direction):
"""nac_term = (A1 (x) A2) / B * coef.
"""
num_atom = self._pcell.get_number_of_atoms()
nac_q = np.zeros((num_atom, num_atom, 3, 3), dtype='double')
if (np.abs(q_direction) < 1e-5).all():
return nac_q
rec_lat = np.linalg.inv(self._... | def function[_nac, parameter[self, q_direction]]:
constant[nac_term = (A1 (x) A2) / B * coef.
]
variable[num_atom] assign[=] call[name[self]._pcell.get_number_of_atoms, parameter[]]
variable[nac_q] assign[=] call[name[np].zeros, parameter[tuple[[<ast.Name object at 0x7da207f00b80>, <ast.... | keyword[def] identifier[_nac] ( identifier[self] , identifier[q_direction] ):
literal[string]
identifier[num_atom] = identifier[self] . identifier[_pcell] . identifier[get_number_of_atoms] ()
identifier[nac_q] = identifier[np] . identifier[zeros] (( identifier[num_atom] , identifier[num_at... | def _nac(self, q_direction):
"""nac_term = (A1 (x) A2) / B * coef.
"""
num_atom = self._pcell.get_number_of_atoms()
nac_q = np.zeros((num_atom, num_atom, 3, 3), dtype='double')
if (np.abs(q_direction) < 1e-05).all():
return nac_q # depends on [control=['if'], data=[]]
rec_lat = np.l... |
def etag(self):
"""
Generates etag from file contents.
"""
CHUNKSIZE = 1024 * 64
from hashlib import md5
hash = md5()
with open(self.path) as fin:
chunk = fin.read(CHUNKSIZE)
while chunk:
hash_update(hash, chunk)
... | def function[etag, parameter[self]]:
constant[
Generates etag from file contents.
]
variable[CHUNKSIZE] assign[=] binary_operation[constant[1024] * constant[64]]
from relative_module[hashlib] import module[md5]
variable[hash] assign[=] call[name[md5], parameter[]]
wit... | keyword[def] identifier[etag] ( identifier[self] ):
literal[string]
identifier[CHUNKSIZE] = literal[int] * literal[int]
keyword[from] identifier[hashlib] keyword[import] identifier[md5]
identifier[hash] = identifier[md5] ()
keyword[with] identifier[open] ( identifie... | def etag(self):
"""
Generates etag from file contents.
"""
CHUNKSIZE = 1024 * 64
from hashlib import md5
hash = md5()
with open(self.path) as fin:
chunk = fin.read(CHUNKSIZE)
while chunk:
hash_update(hash, chunk)
chunk = fin.read(CHUNKSIZE) # ... |
def patch_f90_compiler(f90_compiler):
"""Patch up ``f90_compiler.library_dirs``.
Updates flags in ``gfortran`` and ignores other compilers. The only
modification is the removal of ``-fPIC`` since it is not used on Windows
and the build flags turn warnings into errors.
Args:
f90_compiler (n... | def function[patch_f90_compiler, parameter[f90_compiler]]:
constant[Patch up ``f90_compiler.library_dirs``.
Updates flags in ``gfortran`` and ignores other compilers. The only
modification is the removal of ``-fPIC`` since it is not used on Windows
and the build flags turn warnings into errors.
... | keyword[def] identifier[patch_f90_compiler] ( identifier[f90_compiler] ):
literal[string]
keyword[from] identifier[numpy] . identifier[distutils] . identifier[fcompiler] keyword[import] identifier[gnu]
keyword[if] identifier[os] . identifier[name] != literal[string] :
key... | def patch_f90_compiler(f90_compiler):
"""Patch up ``f90_compiler.library_dirs``.
Updates flags in ``gfortran`` and ignores other compilers. The only
modification is the removal of ``-fPIC`` since it is not used on Windows
and the build flags turn warnings into errors.
Args:
f90_compiler (n... |
def getObject(ID, date, pos):
""" Returns an ephemeris object. """
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
return Object.fromDict(obj) | def function[getObject, parameter[ID, date, pos]]:
constant[ Returns an ephemeris object. ]
variable[obj] assign[=] call[name[eph].getObject, parameter[name[ID], name[date].jd, name[pos].lat, name[pos].lon]]
return[call[name[Object].fromDict, parameter[name[obj]]]] | keyword[def] identifier[getObject] ( identifier[ID] , identifier[date] , identifier[pos] ):
literal[string]
identifier[obj] = identifier[eph] . identifier[getObject] ( identifier[ID] , identifier[date] . identifier[jd] , identifier[pos] . identifier[lat] , identifier[pos] . identifier[lon] )
keyword[r... | def getObject(ID, date, pos):
""" Returns an ephemeris object. """
obj = eph.getObject(ID, date.jd, pos.lat, pos.lon)
return Object.fromDict(obj) |
def entropy(args):
"""
%prog entropy kmc_dump.out
kmc_dump.out contains two columns:
AAAAAAAAAAAGAAGAAAGAAA 34
"""
p = OptionParser(entropy.__doc__)
p.add_option("--threshold", default=0, type="int",
help="Complexity needs to be above")
opts, args = p.parse_args(args)
... | def function[entropy, parameter[args]]:
constant[
%prog entropy kmc_dump.out
kmc_dump.out contains two columns:
AAAAAAAAAAAGAAGAAAGAAA 34
]
variable[p] assign[=] call[name[OptionParser], parameter[name[entropy].__doc__]]
call[name[p].add_option, parameter[constant[--threshold]]... | keyword[def] identifier[entropy] ( identifier[args] ):
literal[string]
identifier[p] = identifier[OptionParser] ( identifier[entropy] . identifier[__doc__] )
identifier[p] . identifier[add_option] ( literal[string] , identifier[default] = literal[int] , identifier[type] = literal[string] ,
identi... | def entropy(args):
"""
%prog entropy kmc_dump.out
kmc_dump.out contains two columns:
AAAAAAAAAAAGAAGAAAGAAA 34
"""
p = OptionParser(entropy.__doc__)
p.add_option('--threshold', default=0, type='int', help='Complexity needs to be above')
(opts, args) = p.parse_args(args)
if len(args... |
def _convert_input(self, *args, **kwargs):
""" Takes variable inputs
:param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts
:param kwargs: str, any number of kwargs that represent token:value pairs
:return: dict, combined dictionary of a... | def function[_convert_input, parameter[self]]:
constant[ Takes variable inputs
:param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts
:param kwargs: str, any number of kwargs that represent token:value pairs
:return: dict, combined dicti... | keyword[def] identifier[_convert_input] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[args] =[ identifier[arg] . identifier[state] keyword[if] identifier[isinstance] ( identifier[arg] , identifier[Nomenclate] ) keyword[else] identifier[arg] keyword[... | def _convert_input(self, *args, **kwargs):
""" Takes variable inputs
:param args: (dict, Nomenclate), any number of dictionary inputs or Nomenclates to be converted to dicts
:param kwargs: str, any number of kwargs that represent token:value pairs
:return: dict, combined dictionary of all i... |
def chooseReliableActiveFiringRate(cellsPerAxis, bumpSigma,
minimumActiveDiameter=None):
"""
When a cell is activated by sensory input, this implies that the phase is
within a particular small patch of the rhombus. This patch is roughly
equivalent to a circle of diam... | def function[chooseReliableActiveFiringRate, parameter[cellsPerAxis, bumpSigma, minimumActiveDiameter]]:
constant[
When a cell is activated by sensory input, this implies that the phase is
within a particular small patch of the rhombus. This patch is roughly
equivalent to a circle of diameter (1/cel... | keyword[def] identifier[chooseReliableActiveFiringRate] ( identifier[cellsPerAxis] , identifier[bumpSigma] ,
identifier[minimumActiveDiameter] = keyword[None] ):
literal[string]
identifier[firingFieldDiameter] = literal[int] *( literal[int] / identifier[cellsPerAxis] )*( literal[int] / identifier[math] . ... | def chooseReliableActiveFiringRate(cellsPerAxis, bumpSigma, minimumActiveDiameter=None):
"""
When a cell is activated by sensory input, this implies that the phase is
within a particular small patch of the rhombus. This patch is roughly
equivalent to a circle of diameter (1/cellsPerAxis)(2/sqrt(3)), cen... |
def set_title(self, title=None):
"""
Sets the title on the current axes.
Parameters
----------
title: string, default: None
Add title to figure or if None leave untitled.
"""
title = self.title or title
if title is not None:
self.a... | def function[set_title, parameter[self, title]]:
constant[
Sets the title on the current axes.
Parameters
----------
title: string, default: None
Add title to figure or if None leave untitled.
]
variable[title] assign[=] <ast.BoolOp object at 0x7da18b... | keyword[def] identifier[set_title] ( identifier[self] , identifier[title] = keyword[None] ):
literal[string]
identifier[title] = identifier[self] . identifier[title] keyword[or] identifier[title]
keyword[if] identifier[title] keyword[is] keyword[not] keyword[None] :
ide... | def set_title(self, title=None):
"""
Sets the title on the current axes.
Parameters
----------
title: string, default: None
Add title to figure or if None leave untitled.
"""
title = self.title or title
if title is not None:
self.ax.set_title(titl... |
def get_events(fd, timeout=None):
"""get_events(fd[, timeout])
Return a list of InotifyEvent instances representing events read from
inotify. If timeout is None, this will block forever until at least one
event can be read. Otherwise, timeout should be an integer or float
specifying a timeout in ... | def function[get_events, parameter[fd, timeout]]:
constant[get_events(fd[, timeout])
Return a list of InotifyEvent instances representing events read from
inotify. If timeout is None, this will block forever until at least one
event can be read. Otherwise, timeout should be an integer or float
... | keyword[def] identifier[get_events] ( identifier[fd] , identifier[timeout] = keyword[None] ):
literal[string]
( identifier[rlist] , identifier[_] , identifier[_] )= identifier[select] ([ identifier[fd] ],[],[], identifier[timeout] )
keyword[if] keyword[not] identifier[rlist] :
keyword[return... | def get_events(fd, timeout=None):
"""get_events(fd[, timeout])
Return a list of InotifyEvent instances representing events read from
inotify. If timeout is None, this will block forever until at least one
event can be read. Otherwise, timeout should be an integer or float
specifying a timeout in ... |
def path_for(path):
"""
Generate a path in the ~/.autolens directory by taking the provided path, base64 encoding it and extracting the
first and last five characters.
Parameters
----------
path: str
The path where multinest output is apparently saved
Returns
-------
actual... | def function[path_for, parameter[path]]:
constant[
Generate a path in the ~/.autolens directory by taking the provided path, base64 encoding it and extracting the
first and last five characters.
Parameters
----------
path: str
The path where multinest output is apparently saved
... | keyword[def] identifier[path_for] ( identifier[path] ):
literal[string]
identifier[start] = identifier[int] ( identifier[SUB_PATH_LENGTH] / literal[int] )
identifier[end] = identifier[SUB_PATH_LENGTH] - identifier[start]
identifier[encoded_string] = identifier[str] ( identifier[hashlib] . identi... | def path_for(path):
"""
Generate a path in the ~/.autolens directory by taking the provided path, base64 encoding it and extracting the
first and last five characters.
Parameters
----------
path: str
The path where multinest output is apparently saved
Returns
-------
actual... |
def purge(datasets, reuses, organizations):
'''
Permanently remove data flagged as deleted.
If no model flag is given, all models are purged.
'''
purge_all = not any((datasets, reuses, organizations))
if purge_all or datasets:
log.info('Purging datasets')
purge_datasets()
... | def function[purge, parameter[datasets, reuses, organizations]]:
constant[
Permanently remove data flagged as deleted.
If no model flag is given, all models are purged.
]
variable[purge_all] assign[=] <ast.UnaryOp object at 0x7da18f09d4e0>
if <ast.BoolOp object at 0x7da18f09d9c0> be... | keyword[def] identifier[purge] ( identifier[datasets] , identifier[reuses] , identifier[organizations] ):
literal[string]
identifier[purge_all] = keyword[not] identifier[any] (( identifier[datasets] , identifier[reuses] , identifier[organizations] ))
keyword[if] identifier[purge_all] keyword[or] ... | def purge(datasets, reuses, organizations):
"""
Permanently remove data flagged as deleted.
If no model flag is given, all models are purged.
"""
purge_all = not any((datasets, reuses, organizations))
if purge_all or datasets:
log.info('Purging datasets')
purge_datasets() # dep... |
def requirements(filename):
"""Reads requirements from a file."""
with open(filename) as f:
return [x.strip() for x in f.readlines() if x.strip()] | def function[requirements, parameter[filename]]:
constant[Reads requirements from a file.]
with call[name[open], parameter[name[filename]]] begin[:]
return[<ast.ListComp object at 0x7da1b11a8820>] | keyword[def] identifier[requirements] ( identifier[filename] ):
literal[string]
keyword[with] identifier[open] ( identifier[filename] ) keyword[as] identifier[f] :
keyword[return] [ identifier[x] . identifier[strip] () keyword[for] identifier[x] keyword[in] identifier[f] . identifier[readline... | def requirements(filename):
"""Reads requirements from a file."""
with open(filename) as f:
return [x.strip() for x in f.readlines() if x.strip()] # depends on [control=['with'], data=['f']] |
def position_windows(pos, size, start, stop, step):
"""Convenience function to construct windows for the
:func:`windowed_statistic` and :func:`windowed_count` functions.
"""
last = False
# determine start and stop positions
if start is None:
start = pos[0]
if stop is None:
... | def function[position_windows, parameter[pos, size, start, stop, step]]:
constant[Convenience function to construct windows for the
:func:`windowed_statistic` and :func:`windowed_count` functions.
]
variable[last] assign[=] constant[False]
if compare[name[start] is constant[None]] begin... | keyword[def] identifier[position_windows] ( identifier[pos] , identifier[size] , identifier[start] , identifier[stop] , identifier[step] ):
literal[string]
identifier[last] = keyword[False]
keyword[if] identifier[start] keyword[is] keyword[None] :
identifier[start] = identifier[pos]... | def position_windows(pos, size, start, stop, step):
"""Convenience function to construct windows for the
:func:`windowed_statistic` and :func:`windowed_count` functions.
"""
last = False
# determine start and stop positions
if start is None:
start = pos[0] # depends on [control=['if'],... |
def remove_nodes_by_function_namespace(graph: BELGraph, func: str, namespace: Strings) -> None:
"""Remove nodes with the given function and namespace.
This might be useful to exclude information learned about distant species, such as excluding all information
from MGI and RGD in diseases where mice and rat... | def function[remove_nodes_by_function_namespace, parameter[graph, func, namespace]]:
constant[Remove nodes with the given function and namespace.
This might be useful to exclude information learned about distant species, such as excluding all information
from MGI and RGD in diseases where mice and rats... | keyword[def] identifier[remove_nodes_by_function_namespace] ( identifier[graph] : identifier[BELGraph] , identifier[func] : identifier[str] , identifier[namespace] : identifier[Strings] )-> keyword[None] :
literal[string]
identifier[remove_filtered_nodes] ( identifier[graph] , identifier[function_namespace... | def remove_nodes_by_function_namespace(graph: BELGraph, func: str, namespace: Strings) -> None:
"""Remove nodes with the given function and namespace.
This might be useful to exclude information learned about distant species, such as excluding all information
from MGI and RGD in diseases where mice and rat... |
def encode(self, word):
"""Return the FONEM code of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The FONEM code
Examples
--------
>>> pe = FONEM()
>>> pe.encode('March... | def function[encode, parameter[self, word]]:
constant[Return the FONEM code of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The FONEM code
Examples
--------
>>> pe = FONEM()
... | keyword[def] identifier[encode] ( identifier[self] , identifier[word] ):
literal[string]
identifier[word] = identifier[unicode_normalize] ( literal[string] , identifier[text_type] ( identifier[word] . identifier[upper] ()))
identifier[word] = identifier[word] . identifier[translat... | def encode(self, word):
"""Return the FONEM code of a word.
Parameters
----------
word : str
The word to transform
Returns
-------
str
The FONEM code
Examples
--------
>>> pe = FONEM()
>>> pe.encode('Marchand'... |
def get_formatted_rule(rule=None):
"""Helper to format the rule into a user friendly format.
:param dict rule: A dict containing one rule of the firewall
:returns: a formatted string that get be pushed into the editor
"""
rule = rule or {}
return ('action: %s\n'
'protocol: %s\n'
... | def function[get_formatted_rule, parameter[rule]]:
constant[Helper to format the rule into a user friendly format.
:param dict rule: A dict containing one rule of the firewall
:returns: a formatted string that get be pushed into the editor
]
variable[rule] assign[=] <ast.BoolOp object at 0x... | keyword[def] identifier[get_formatted_rule] ( identifier[rule] = keyword[None] ):
literal[string]
identifier[rule] = identifier[rule] keyword[or] {}
keyword[return] ( literal[string]
literal[string]
literal[string]
literal[string]
literal[string]
literal[string]
li... | def get_formatted_rule(rule=None):
"""Helper to format the rule into a user friendly format.
:param dict rule: A dict containing one rule of the firewall
:returns: a formatted string that get be pushed into the editor
"""
rule = rule or {}
return 'action: %s\nprotocol: %s\nsource_ip_address: %s... |
def name(self):
"""Dict with locale codes as keys and localized name as value"""
# pylint:disable=E1101
return next((self.names.get(x) for x in self._locales if x in
self.names), None) | def function[name, parameter[self]]:
constant[Dict with locale codes as keys and localized name as value]
return[call[name[next], parameter[<ast.GeneratorExp object at 0x7da20c7c8250>, constant[None]]]] | keyword[def] identifier[name] ( identifier[self] ):
literal[string]
keyword[return] identifier[next] (( identifier[self] . identifier[names] . identifier[get] ( identifier[x] ) keyword[for] identifier[x] keyword[in] identifier[self] . identifier[_locales] keyword[if] identifier[x] k... | def name(self):
"""Dict with locale codes as keys and localized name as value"""
# pylint:disable=E1101
return next((self.names.get(x) for x in self._locales if x in self.names), None) |
def tx_extend(partial_tx_hex, new_inputs, new_outputs, blockchain='bitcoin', **blockchain_opts):
"""
Add a set of inputs and outputs to a tx.
Return the new tx on success
Raise on error
"""
if blockchain == 'bitcoin':
return btc_tx_extend(partial_tx_hex, new_inputs, new_outputs, **blockc... | def function[tx_extend, parameter[partial_tx_hex, new_inputs, new_outputs, blockchain]]:
constant[
Add a set of inputs and outputs to a tx.
Return the new tx on success
Raise on error
]
if compare[name[blockchain] equal[==] constant[bitcoin]] begin[:]
return[call[name[btc_tx_exte... | keyword[def] identifier[tx_extend] ( identifier[partial_tx_hex] , identifier[new_inputs] , identifier[new_outputs] , identifier[blockchain] = literal[string] ,** identifier[blockchain_opts] ):
literal[string]
keyword[if] identifier[blockchain] == literal[string] :
keyword[return] identifier[btc_... | def tx_extend(partial_tx_hex, new_inputs, new_outputs, blockchain='bitcoin', **blockchain_opts):
"""
Add a set of inputs and outputs to a tx.
Return the new tx on success
Raise on error
"""
if blockchain == 'bitcoin':
return btc_tx_extend(partial_tx_hex, new_inputs, new_outputs, **blockc... |
def from_str(cls, string):
"""
Creates a mapping from a string
Parameters
----------
string : str
String of the form `target<-clause` where `clause` is a valid string for :class:`caspo.core.clause.Clause`
Returns
-------
caspo.core.mapping.Ma... | def function[from_str, parameter[cls, string]]:
constant[
Creates a mapping from a string
Parameters
----------
string : str
String of the form `target<-clause` where `clause` is a valid string for :class:`caspo.core.clause.Clause`
Returns
-------
... | keyword[def] identifier[from_str] ( identifier[cls] , identifier[string] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[string] :
keyword[raise] identifier[ValueError] ( literal[string] )
identifier[target] , identifier[clause_str] = i... | def from_str(cls, string):
"""
Creates a mapping from a string
Parameters
----------
string : str
String of the form `target<-clause` where `clause` is a valid string for :class:`caspo.core.clause.Clause`
Returns
-------
caspo.core.mapping.Mappin... |
def einstein_radius_in_units(self, unit_length='arcsec', kpc_per_arcsec=None):
"""The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.
If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Radius \
may be inac... | def function[einstein_radius_in_units, parameter[self, unit_length, kpc_per_arcsec]]:
constant[The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.
If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Radius ... | keyword[def] identifier[einstein_radius_in_units] ( identifier[self] , identifier[unit_length] = literal[string] , identifier[kpc_per_arcsec] = keyword[None] ):
literal[string]
keyword[if] identifier[self] . identifier[has_mass_profile] :
keyword[return] identifier[sum] ( identifier... | def einstein_radius_in_units(self, unit_length='arcsec', kpc_per_arcsec=None):
"""The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.
If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Radius may be inaccurate... |
def tag_list(self, tags):
"""
Generates a list of tags identifying those previously selected.
Returns a list of tuples of the form (<tag name>, <CSS class name>).
Uses the string names rather than the tags themselves in order to work
with tag lists built from forms not fully su... | def function[tag_list, parameter[self, tags]]:
constant[
Generates a list of tags identifying those previously selected.
Returns a list of tuples of the form (<tag name>, <CSS class name>).
Uses the string names rather than the tags themselves in order to work
with tag lists bu... | keyword[def] identifier[tag_list] ( identifier[self] , identifier[tags] ):
literal[string]
keyword[return] [
( identifier[tag] . identifier[name] , literal[string] keyword[if] identifier[tag] . identifier[name] keyword[in] identifier[tags] keyword[else] literal[string] )
keyw... | def tag_list(self, tags):
"""
Generates a list of tags identifying those previously selected.
Returns a list of tuples of the form (<tag name>, <CSS class name>).
Uses the string names rather than the tags themselves in order to work
with tag lists built from forms not fully submit... |
def from_config(cls, config_file=None, profile=None, client=None,
endpoint=None, token=None, solver=None, proxy=None,
legacy_config_fallback=False, **kwargs):
"""Client factory method to instantiate a client instance from configuration.
Configuration values can b... | def function[from_config, parameter[cls, config_file, profile, client, endpoint, token, solver, proxy, legacy_config_fallback]]:
constant[Client factory method to instantiate a client instance from configuration.
Configuration values can be specified in multiple ways, ranked in the following
or... | keyword[def] identifier[from_config] ( identifier[cls] , identifier[config_file] = keyword[None] , identifier[profile] = keyword[None] , identifier[client] = keyword[None] ,
identifier[endpoint] = keyword[None] , identifier[token] = keyword[None] , identifier[solver] = keyword[None] , identifier[proxy] = keyword[Non... | def from_config(cls, config_file=None, profile=None, client=None, endpoint=None, token=None, solver=None, proxy=None, legacy_config_fallback=False, **kwargs):
"""Client factory method to instantiate a client instance from configuration.
Configuration values can be specified in multiple ways, ranked in the ... |
def determine_redirect(self, url, host_header, opts):
"""
Determines whether scanning a different request is suggested by the
remote host. This function should be called only if
opts['follow_redirects'] is true.
@param url: the base url as returned by self._process_host_line.
... | def function[determine_redirect, parameter[self, url, host_header, opts]]:
constant[
Determines whether scanning a different request is suggested by the
remote host. This function should be called only if
opts['follow_redirects'] is true.
@param url: the base url as returned by s... | keyword[def] identifier[determine_redirect] ( identifier[self] , identifier[url] , identifier[host_header] , identifier[opts] ):
literal[string]
identifier[orig_host_header] = identifier[host_header]
identifier[redir_url] = identifier[self] . identifier[_determine_redirect] ( identifier[u... | def determine_redirect(self, url, host_header, opts):
"""
Determines whether scanning a different request is suggested by the
remote host. This function should be called only if
opts['follow_redirects'] is true.
@param url: the base url as returned by self._process_host_line.
... |
def generate(self):
"""Yields pieces of ATOM XML."""
base = ''
if self.xml_base:
base = ' xml:base="%s"' % escape(self.xml_base, True)
yield u'<entry%s>\n' % base
yield u' ' + _make_text_block('title', self.title, self.title_type)
yield u' <id>%s</id>\n' % e... | def function[generate, parameter[self]]:
constant[Yields pieces of ATOM XML.]
variable[base] assign[=] constant[]
if name[self].xml_base begin[:]
variable[base] assign[=] binary_operation[constant[ xml:base="%s"] <ast.Mod object at 0x7da2590d6920> call[name[escape], parameter[nam... | keyword[def] identifier[generate] ( identifier[self] ):
literal[string]
identifier[base] = literal[string]
keyword[if] identifier[self] . identifier[xml_base] :
identifier[base] = literal[string] % identifier[escape] ( identifier[self] . identifier[xml_base] , keyword[True] ... | def generate(self):
"""Yields pieces of ATOM XML."""
base = ''
if self.xml_base:
base = ' xml:base="%s"' % escape(self.xml_base, True) # depends on [control=['if'], data=[]]
yield (u'<entry%s>\n' % base)
yield (u' ' + _make_text_block('title', self.title, self.title_type))
yield (u' <... |
def _read_last_geometry(self):
"""
Parses the last geometry from an optimization trajectory for use in a new input file.
"""
header_pattern = r"\s+Optimization\sCycle:\s+" + \
str(len(self.data.get("energy_trajectory"))) + \
r"\s+Coordinates \(Angstroms\)\s+ATOM\s... | def function[_read_last_geometry, parameter[self]]:
constant[
Parses the last geometry from an optimization trajectory for use in a new input file.
]
variable[header_pattern] assign[=] binary_operation[binary_operation[constant[\s+Optimization\sCycle:\s+] + call[name[str], parameter[call... | keyword[def] identifier[_read_last_geometry] ( identifier[self] ):
literal[string]
identifier[header_pattern] = literal[string] + identifier[str] ( identifier[len] ( identifier[self] . identifier[data] . identifier[get] ( literal[string] )))+ literal[string]
identifier[table_pattern] = li... | def _read_last_geometry(self):
"""
Parses the last geometry from an optimization trajectory for use in a new input file.
"""
header_pattern = '\\s+Optimization\\sCycle:\\s+' + str(len(self.data.get('energy_trajectory'))) + '\\s+Coordinates \\(Angstroms\\)\\s+ATOM\\s+X\\s+Y\\s+Z'
table_patter... |
def get_templates_from_publishable(name, publishable):
"""
Returns the same template list as `get_templates` but gets values from `Publishable` instance.
"""
slug = publishable.slug
category = publishable.category
app_label = publishable.content_type.app_label
model_label = publishable.conte... | def function[get_templates_from_publishable, parameter[name, publishable]]:
constant[
Returns the same template list as `get_templates` but gets values from `Publishable` instance.
]
variable[slug] assign[=] name[publishable].slug
variable[category] assign[=] name[publishable].category
... | keyword[def] identifier[get_templates_from_publishable] ( identifier[name] , identifier[publishable] ):
literal[string]
identifier[slug] = identifier[publishable] . identifier[slug]
identifier[category] = identifier[publishable] . identifier[category]
identifier[app_label] = identifier[publisha... | def get_templates_from_publishable(name, publishable):
"""
Returns the same template list as `get_templates` but gets values from `Publishable` instance.
"""
slug = publishable.slug
category = publishable.category
app_label = publishable.content_type.app_label
model_label = publishable.conte... |
def check_and_adjust_sighandler(self, signame, sigs):
"""
Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or N... | def function[check_and_adjust_sighandler, parameter[self, signame, sigs]]:
constant[
Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the s... | keyword[def] identifier[check_and_adjust_sighandler] ( identifier[self] , identifier[signame] , identifier[sigs] ):
literal[string]
identifier[signum] = identifier[lookup_signum] ( identifier[signame] )
keyword[try] :
identifier[old_handler] = identifier[signal] . identifier... | def check_and_adjust_sighandler(self, signame, sigs):
"""
Check to see if a single signal handler that we are interested
in has changed or has not been set initially. On return
self.sigs[signame] should have our signal handler. True is
returned if the same or adjusted, False or None ... |
def to_pdb(self, path, records=None, gz=False, append_newline=True):
"""Write record DataFrames to a PDB file or gzipped PDB file.
Parameters
----------
path : str
A valid output path for the pdb file
records : iterable, default: None
A list of PDB recor... | def function[to_pdb, parameter[self, path, records, gz, append_newline]]:
constant[Write record DataFrames to a PDB file or gzipped PDB file.
Parameters
----------
path : str
A valid output path for the pdb file
records : iterable, default: None
A list o... | keyword[def] identifier[to_pdb] ( identifier[self] , identifier[path] , identifier[records] = keyword[None] , identifier[gz] = keyword[False] , identifier[append_newline] = keyword[True] ):
literal[string]
keyword[if] identifier[gz] :
identifier[openf] = identifier[gzip] . identifier[... | def to_pdb(self, path, records=None, gz=False, append_newline=True):
"""Write record DataFrames to a PDB file or gzipped PDB file.
Parameters
----------
path : str
A valid output path for the pdb file
records : iterable, default: None
A list of PDB record se... |
def InitLocCheck(self):
"""
make an interactive grid in which users can edit locations
"""
# if there is a location without a name, name it 'unknown'
self.contribution.rename_item('locations', 'nan', 'unknown')
# propagate lat/lon values from sites table
self.cont... | def function[InitLocCheck, parameter[self]]:
constant[
make an interactive grid in which users can edit locations
]
call[name[self].contribution.rename_item, parameter[constant[locations], constant[nan], constant[unknown]]]
call[name[self].contribution.get_min_max_lat_lon, parame... | keyword[def] identifier[InitLocCheck] ( identifier[self] ):
literal[string]
identifier[self] . identifier[contribution] . identifier[rename_item] ( literal[string] , literal[string] , literal[string] )
identifier[self] . identifier[contribution] . identifier[get_min_max_l... | def InitLocCheck(self):
"""
make an interactive grid in which users can edit locations
"""
# if there is a location without a name, name it 'unknown'
self.contribution.rename_item('locations', 'nan', 'unknown')
# propagate lat/lon values from sites table
self.contribution.get_min_max... |
def addvlan(self, vlanid, vlan_name):
"""
Function operates on the IMCDev object. Takes input of vlanid (1-4094), str of vlan_name,
auth and url to execute the create_dev_vlan method on the IMCDev object. Device must be
supported in the HPE IMC Platform VLAN Manager module.
:para... | def function[addvlan, parameter[self, vlanid, vlan_name]]:
constant[
Function operates on the IMCDev object. Takes input of vlanid (1-4094), str of vlan_name,
auth and url to execute the create_dev_vlan method on the IMCDev object. Device must be
supported in the HPE IMC Platform VLAN Ma... | keyword[def] identifier[addvlan] ( identifier[self] , identifier[vlanid] , identifier[vlan_name] ):
literal[string]
identifier[create_dev_vlan] ( identifier[vlanid] , identifier[vlan_name] , identifier[self] . identifier[auth] , identifier[self] . identifier[url] , identifier[devid] = identifier[se... | def addvlan(self, vlanid, vlan_name):
"""
Function operates on the IMCDev object. Takes input of vlanid (1-4094), str of vlan_name,
auth and url to execute the create_dev_vlan method on the IMCDev object. Device must be
supported in the HPE IMC Platform VLAN Manager module.
:param vl... |
def download(self, filename=None):
"""Download an attachment. The files are currently not cached since they
can be overwritten on the server.
Parameters
----------
filename : string, optional
Optional name for the file on local disk.
Returns
-------
... | def function[download, parameter[self, filename]]:
constant[Download an attachment. The files are currently not cached since they
can be overwritten on the server.
Parameters
----------
filename : string, optional
Optional name for the file on local disk.
Re... | keyword[def] identifier[download] ( identifier[self] , identifier[filename] = keyword[None] ):
literal[string]
identifier[tmp_file] , identifier[f_suffix] = identifier[download_file] ( identifier[self] . identifier[url] )
keyword[if] keyword[not] identifier[filename] keyword[is] keywor... | def download(self, filename=None):
"""Download an attachment. The files are currently not cached since they
can be overwritten on the server.
Parameters
----------
filename : string, optional
Optional name for the file on local disk.
Returns
-------
... |
def construct_form(self, request):
"""
Constructs form from POST method using self.form_class.
"""
if not hasattr(self, 'form_class'):
return None
if request.method == 'POST':
form = self.form_class(self.model, request.POST, request.FILES)
else:
... | def function[construct_form, parameter[self, request]]:
constant[
Constructs form from POST method using self.form_class.
]
if <ast.UnaryOp object at 0x7da2047e8880> begin[:]
return[constant[None]]
if compare[name[request].method equal[==] constant[POST]] begin[:]
... | keyword[def] identifier[construct_form] ( identifier[self] , identifier[request] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , literal[string] ):
keyword[return] keyword[None]
keyword[if] identifier[request] . identifier[method] == ... | def construct_form(self, request):
"""
Constructs form from POST method using self.form_class.
"""
if not hasattr(self, 'form_class'):
return None # depends on [control=['if'], data=[]]
if request.method == 'POST':
form = self.form_class(self.model, request.POST, request.FIL... |
def profiler(self):
"""
Calculates the core profile for each strain
"""
printtime('Calculating core profiles', self.start)
# Only create the profile if it doesn't exist already
# if not os.path.isfile('{}/profile.txt'.format(self.profilelocation)):
for strain in s... | def function[profiler, parameter[self]]:
constant[
Calculates the core profile for each strain
]
call[name[printtime], parameter[constant[Calculating core profiles], name[self].start]]
for taget[name[strain]] in starred[name[self].corealleles] begin[:]
call[name[s... | keyword[def] identifier[profiler] ( identifier[self] ):
literal[string]
identifier[printtime] ( literal[string] , identifier[self] . identifier[start] )
keyword[for] identifier[strain] keyword[in] identifier[self] . identifier[corealleles] :
ident... | def profiler(self):
"""
Calculates the core profile for each strain
"""
printtime('Calculating core profiles', self.start)
# Only create the profile if it doesn't exist already
# if not os.path.isfile('{}/profile.txt'.format(self.profilelocation)):
for strain in self.corealleles:
... |
def helpAbout(self):
"""Brief description of the plugin.
"""
# Text to be displayed
about_text = translate('pyBarPlugin',
"""<qt>
<p>Data plotting plug-in for pyBAR.
</qt>""",
'About')
descr =... | def function[helpAbout, parameter[self]]:
constant[Brief description of the plugin.
]
variable[about_text] assign[=] call[name[translate], parameter[constant[pyBarPlugin], constant[<qt>
<p>Data plotting plug-in for pyBAR.
</qt>], constant[About]]]
variable[descr] ... | keyword[def] identifier[helpAbout] ( identifier[self] ):
literal[string]
identifier[about_text] = identifier[translate] ( literal[string] ,
literal[string] ,
literal[string] )
identifier[descr] = identifier[dict] ( identifier[module_name] = literal[string] ,
... | def helpAbout(self):
"""Brief description of the plugin.
"""
# Text to be displayed
about_text = translate('pyBarPlugin', '<qt>\n <p>Data plotting plug-in for pyBAR.\n </qt>', 'About')
descr = dict(module_name='pyBarPlugin', folder=PLUGINSDIR, version=__version__, plugin_na... |
def run(self):
"""
Run the database seeds.
"""
self.factory.register(User, self.users_factory)
self.factory(User, 50).create() | def function[run, parameter[self]]:
constant[
Run the database seeds.
]
call[name[self].factory.register, parameter[name[User], name[self].users_factory]]
call[call[name[self].factory, parameter[name[User], constant[50]]].create, parameter[]] | keyword[def] identifier[run] ( identifier[self] ):
literal[string]
identifier[self] . identifier[factory] . identifier[register] ( identifier[User] , identifier[self] . identifier[users_factory] )
identifier[self] . identifier[factory] ( identifier[User] , literal[int] ). identifier[creat... | def run(self):
"""
Run the database seeds.
"""
self.factory.register(User, self.users_factory)
self.factory(User, 50).create() |
def pubsub_peers(self, topic=None, **kwargs):
"""List the peers we are pubsubbing with.
Lists the id's of other IPFS users who we
are connected to via some topic. Without specifying
a topic, IPFS peers from all subscribed topics
will be returned in the data. If a topic is specif... | def function[pubsub_peers, parameter[self, topic]]:
constant[List the peers we are pubsubbing with.
Lists the id's of other IPFS users who we
are connected to via some topic. Without specifying
a topic, IPFS peers from all subscribed topics
will be returned in the data. If a top... | keyword[def] identifier[pubsub_peers] ( identifier[self] , identifier[topic] = keyword[None] ,** identifier[kwargs] ):
literal[string]
identifier[args] =( identifier[topic] ,) keyword[if] identifier[topic] keyword[is] keyword[not] keyword[None] keyword[else] ()
keyword[return] identi... | def pubsub_peers(self, topic=None, **kwargs):
"""List the peers we are pubsubbing with.
Lists the id's of other IPFS users who we
are connected to via some topic. Without specifying
a topic, IPFS peers from all subscribed topics
will be returned in the data. If a topic is specified
... |
def _get_num_tokens_from_first_line(line: str) -> Optional[int]:
""" This function takes in input a string and if it contains 1 or 2 integers, it assumes the
largest one it the number of tokens. Returns None if the line doesn't match that pattern. """
fields = line.split(' ')
if 1 <= len... | def function[_get_num_tokens_from_first_line, parameter[line]]:
constant[ This function takes in input a string and if it contains 1 or 2 integers, it assumes the
largest one it the number of tokens. Returns None if the line doesn't match that pattern. ]
variable[fields] assign[=] call[name[line... | keyword[def] identifier[_get_num_tokens_from_first_line] ( identifier[line] : identifier[str] )-> identifier[Optional] [ identifier[int] ]:
literal[string]
identifier[fields] = identifier[line] . identifier[split] ( literal[string] )
keyword[if] literal[int] <= identifier[len] ( identifie... | def _get_num_tokens_from_first_line(line: str) -> Optional[int]:
""" This function takes in input a string and if it contains 1 or 2 integers, it assumes the
largest one it the number of tokens. Returns None if the line doesn't match that pattern. """
fields = line.split(' ')
if 1 <= len(fields) <= ... |
def tuple_arg(fn):
"""
fun(1,2) -> fun((1,), (2,))로
f(1,2,3) => f((1,), (2,), (3,))
:param fn:
:return:
"""
@wraps(fn)
def wrapped(*args, **kwargs):
args = map(tuplefy, args)
return fn(*args, **kwargs)
return wrapped | def function[tuple_arg, parameter[fn]]:
constant[
fun(1,2) -> fun((1,), (2,))로
f(1,2,3) => f((1,), (2,), (3,))
:param fn:
:return:
]
def function[wrapped, parameter[]]:
variable[args] assign[=] call[name[map], parameter[name[tuplefy], name[args]]]
return[call... | keyword[def] identifier[tuple_arg] ( identifier[fn] ):
literal[string]
@ identifier[wraps] ( identifier[fn] )
keyword[def] identifier[wrapped] (* identifier[args] ,** identifier[kwargs] ):
identifier[args] = identifier[map] ( identifier[tuplefy] , identifier[args] )
keyword[return] ... | def tuple_arg(fn):
"""
fun(1,2) -> fun((1,), (2,))로
f(1,2,3) => f((1,), (2,), (3,))
:param fn:
:return:
"""
@wraps(fn)
def wrapped(*args, **kwargs):
args = map(tuplefy, args)
return fn(*args, **kwargs)
return wrapped |
def fetch(self, payment_id, data={}, **kwargs):
""""
Fetch Payment for given Id
Args:
payment_id : Id for which payment object has to be retrieved
Returns:
Payment dict for given payment Id
"""
return super(Payment, self).fetch(payment_id, data, ... | def function[fetch, parameter[self, payment_id, data]]:
constant["
Fetch Payment for given Id
Args:
payment_id : Id for which payment object has to be retrieved
Returns:
Payment dict for given payment Id
]
return[call[call[name[super], parameter[name... | keyword[def] identifier[fetch] ( identifier[self] , identifier[payment_id] , identifier[data] ={},** identifier[kwargs] ):
literal[string]
keyword[return] identifier[super] ( identifier[Payment] , identifier[self] ). identifier[fetch] ( identifier[payment_id] , identifier[data] ,** identifier[kwar... | def fetch(self, payment_id, data={}, **kwargs):
""""
Fetch Payment for given Id
Args:
payment_id : Id for which payment object has to be retrieved
Returns:
Payment dict for given payment Id
"""
return super(Payment, self).fetch(payment_id, data, **kwargs... |
def deserialize(stream_or_string, **options):
'''
Deserialize from TOML into Python data structure.
:param stream_or_string: toml stream or string to deserialize.
:param options: options given to lower pytoml module.
'''
try:
if not isinstance(stream_or_string, (bytes, six.string_types... | def function[deserialize, parameter[stream_or_string]]:
constant[
Deserialize from TOML into Python data structure.
:param stream_or_string: toml stream or string to deserialize.
:param options: options given to lower pytoml module.
]
<ast.Try object at 0x7da1b1f96e30> | keyword[def] identifier[deserialize] ( identifier[stream_or_string] ,** identifier[options] ):
literal[string]
keyword[try] :
keyword[if] keyword[not] identifier[isinstance] ( identifier[stream_or_string] ,( identifier[bytes] , identifier[six] . identifier[string_types] )):
keyword... | def deserialize(stream_or_string, **options):
"""
Deserialize from TOML into Python data structure.
:param stream_or_string: toml stream or string to deserialize.
:param options: options given to lower pytoml module.
"""
try:
if not isinstance(stream_or_string, (bytes, six.string_types)... |
def remove_link(self, rel, value=None, href=None):
"""
Removes link nodes based on the function arguments.
This can remove link nodes based on the following combinations of arguments:
link/@rel
link/@rel & link/text()
link/@rel & link/@href
link/@... | def function[remove_link, parameter[self, rel, value, href]]:
constant[
Removes link nodes based on the function arguments.
This can remove link nodes based on the following combinations of arguments:
link/@rel
link/@rel & link/text()
link/@rel & link/@href
... | keyword[def] identifier[remove_link] ( identifier[self] , identifier[rel] , identifier[value] = keyword[None] , identifier[href] = keyword[None] ):
literal[string]
identifier[links_node] = identifier[self] . identifier[metadata] . identifier[find] ( literal[string] )
keyword[if] identifie... | def remove_link(self, rel, value=None, href=None):
"""
Removes link nodes based on the function arguments.
This can remove link nodes based on the following combinations of arguments:
link/@rel
link/@rel & link/text()
link/@rel & link/@href
link/@rel ... |
def add_tag(self, task, params={}, **options):
"""Adds a tag to a task. Returns an empty data block.
Parameters
----------
task : {Id} The task to add a tag to.
[data] : {Object} Data for the request
- tag : {Id} The tag to add to the task.
"""
path = ... | def function[add_tag, parameter[self, task, params]]:
constant[Adds a tag to a task. Returns an empty data block.
Parameters
----------
task : {Id} The task to add a tag to.
[data] : {Object} Data for the request
- tag : {Id} The tag to add to the task.
]
... | keyword[def] identifier[add_tag] ( identifier[self] , identifier[task] , identifier[params] ={},** identifier[options] ):
literal[string]
identifier[path] = literal[string] %( identifier[task] )
keyword[return] identifier[self] . identifier[client] . identifier[post] ( identifier[path] , ... | def add_tag(self, task, params={}, **options):
"""Adds a tag to a task. Returns an empty data block.
Parameters
----------
task : {Id} The task to add a tag to.
[data] : {Object} Data for the request
- tag : {Id} The tag to add to the task.
"""
path = '/tasks/%... |
def make_data_packet(raw_data) -> 'DataPacket':
"""
Converts raw byte data to a sACN DataPacket. Note that the raw bytes have to come from a 2016 sACN Message.
This does not support Sync Addresses, Force_Sync option and DMX Start code!
:param raw_data: raw bytes as tuple or list
... | def function[make_data_packet, parameter[raw_data]]:
constant[
Converts raw byte data to a sACN DataPacket. Note that the raw bytes have to come from a 2016 sACN Message.
This does not support Sync Addresses, Force_Sync option and DMX Start code!
:param raw_data: raw bytes as tuple or li... | keyword[def] identifier[make_data_packet] ( identifier[raw_data] )-> literal[string] :
literal[string]
keyword[if] identifier[len] ( identifier[raw_data] )< literal[int] :
keyword[raise] identifier[TypeError] ( literal[string] )
keyword[if] identifier[... | def make_data_packet(raw_data) -> 'DataPacket':
"""
Converts raw byte data to a sACN DataPacket. Note that the raw bytes have to come from a 2016 sACN Message.
This does not support Sync Addresses, Force_Sync option and DMX Start code!
:param raw_data: raw bytes as tuple or list
:ret... |
def call(self, method, *args):
""" Make a call to a `Responder` and return the result """
payload = self.build_payload(method, args)
logging.debug('* Client will send payload: {}'.format(payload))
self.send(payload)
res = self.receive()
assert payload[2] == res['ref']
... | def function[call, parameter[self, method]]:
constant[ Make a call to a `Responder` and return the result ]
variable[payload] assign[=] call[name[self].build_payload, parameter[name[method], name[args]]]
call[name[logging].debug, parameter[call[constant[* Client will send payload: {}].format, pa... | keyword[def] identifier[call] ( identifier[self] , identifier[method] ,* identifier[args] ):
literal[string]
identifier[payload] = identifier[self] . identifier[build_payload] ( identifier[method] , identifier[args] )
identifier[logging] . identifier[debug] ( literal[string] . identifier[... | def call(self, method, *args):
""" Make a call to a `Responder` and return the result """
payload = self.build_payload(method, args)
logging.debug('* Client will send payload: {}'.format(payload))
self.send(payload)
res = self.receive()
assert payload[2] == res['ref']
return (res['result'], ... |
def resolve_parameter_refs(self, input_dict, parameters):
"""
Recursively resolves "Fn::FindInMap"references that are present in the mappings and returns the value.
If it is not in mappings, this method simply returns the input unchanged.
:param input_dict: Dictionary representing the F... | def function[resolve_parameter_refs, parameter[self, input_dict, parameters]]:
constant[
Recursively resolves "Fn::FindInMap"references that are present in the mappings and returns the value.
If it is not in mappings, this method simply returns the input unchanged.
:param input_dict: Di... | keyword[def] identifier[resolve_parameter_refs] ( identifier[self] , identifier[input_dict] , identifier[parameters] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[can_handle] ( identifier[input_dict] ):
keyword[return] identifier[input_dict]
id... | def resolve_parameter_refs(self, input_dict, parameters):
"""
Recursively resolves "Fn::FindInMap"references that are present in the mappings and returns the value.
If it is not in mappings, this method simply returns the input unchanged.
:param input_dict: Dictionary representing the FindI... |
def get_iam_account(l, args, user_name):
"""Return the local Account for a user name, by fetching User and looking up
the arn. """
iam = get_resource(args, 'iam')
user = iam.User(user_name)
user.load()
return l.find_or_new_account(user.arn) | def function[get_iam_account, parameter[l, args, user_name]]:
constant[Return the local Account for a user name, by fetching User and looking up
the arn. ]
variable[iam] assign[=] call[name[get_resource], parameter[name[args], constant[iam]]]
variable[user] assign[=] call[name[iam].User, par... | keyword[def] identifier[get_iam_account] ( identifier[l] , identifier[args] , identifier[user_name] ):
literal[string]
identifier[iam] = identifier[get_resource] ( identifier[args] , literal[string] )
identifier[user] = identifier[iam] . identifier[User] ( identifier[user_name] )
identifier[user... | def get_iam_account(l, args, user_name):
"""Return the local Account for a user name, by fetching User and looking up
the arn. """
iam = get_resource(args, 'iam')
user = iam.User(user_name)
user.load()
return l.find_or_new_account(user.arn) |
def get_latex_figure_str(fpath_list, caption_str=None, label_str=None,
width_str=r'\textwidth', height_str=None, nCols=None,
dpath=None, colpos_sep=' ', nlsep='',
use_sublbls=None, use_frame=False):
r"""
Args:
fpath_list (list):
... | def function[get_latex_figure_str, parameter[fpath_list, caption_str, label_str, width_str, height_str, nCols, dpath, colpos_sep, nlsep, use_sublbls, use_frame]]:
constant[
Args:
fpath_list (list):
dpath (str): directory relative to main tex file
Returns:
str: figure_str
Co... | keyword[def] identifier[get_latex_figure_str] ( identifier[fpath_list] , identifier[caption_str] = keyword[None] , identifier[label_str] = keyword[None] ,
identifier[width_str] = literal[string] , identifier[height_str] = keyword[None] , identifier[nCols] = keyword[None] ,
identifier[dpath] = keyword[None] , identi... | def get_latex_figure_str(fpath_list, caption_str=None, label_str=None, width_str='\\textwidth', height_str=None, nCols=None, dpath=None, colpos_sep=' ', nlsep='', use_sublbls=None, use_frame=False):
"""
Args:
fpath_list (list):
dpath (str): directory relative to main tex file
Returns:
... |
def updateObj(self,event):
"""Put this object in the search box"""
name=w.objList.get("active")
w.SearchVar.set(name)
w.ObjInfo.set(objInfoDict[name])
return | def function[updateObj, parameter[self, event]]:
constant[Put this object in the search box]
variable[name] assign[=] call[name[w].objList.get, parameter[constant[active]]]
call[name[w].SearchVar.set, parameter[name[name]]]
call[name[w].ObjInfo.set, parameter[call[name[objInfoDict]][name... | keyword[def] identifier[updateObj] ( identifier[self] , identifier[event] ):
literal[string]
identifier[name] = identifier[w] . identifier[objList] . identifier[get] ( literal[string] )
identifier[w] . identifier[SearchVar] . identifier[set] ( identifier[name] )
identifier[w] . i... | def updateObj(self, event):
"""Put this object in the search box"""
name = w.objList.get('active')
w.SearchVar.set(name)
w.ObjInfo.set(objInfoDict[name])
return |
def _get_vnet(self, adapter_number):
"""
Return the vnet will use in ubridge
"""
vnet = "ethernet{}.vnet".format(adapter_number)
if vnet not in self._vmx_pairs:
raise VMwareError("vnet {} not in VMX file".format(vnet))
return vnet | def function[_get_vnet, parameter[self, adapter_number]]:
constant[
Return the vnet will use in ubridge
]
variable[vnet] assign[=] call[constant[ethernet{}.vnet].format, parameter[name[adapter_number]]]
if compare[name[vnet] <ast.NotIn object at 0x7da2590d7190> name[self]._vmx_pa... | keyword[def] identifier[_get_vnet] ( identifier[self] , identifier[adapter_number] ):
literal[string]
identifier[vnet] = literal[string] . identifier[format] ( identifier[adapter_number] )
keyword[if] identifier[vnet] keyword[not] keyword[in] identifier[self] . identifier[_vmx_pairs] :... | def _get_vnet(self, adapter_number):
"""
Return the vnet will use in ubridge
"""
vnet = 'ethernet{}.vnet'.format(adapter_number)
if vnet not in self._vmx_pairs:
raise VMwareError('vnet {} not in VMX file'.format(vnet)) # depends on [control=['if'], data=['vnet']]
return vnet |
def fix_schema_node_ordering(parent):
"""
Fix the ordering of children under the criteria node to ensure that IndicatorItem/Indicator order
is preserved, as per XML Schema.
:return:
"""
children = parent.getchildren()
i_nodes = [node for node in children if node.... | def function[fix_schema_node_ordering, parameter[parent]]:
constant[
Fix the ordering of children under the criteria node to ensure that IndicatorItem/Indicator order
is preserved, as per XML Schema.
:return:
]
variable[children] assign[=] call[name[parent].getchildren, ... | keyword[def] identifier[fix_schema_node_ordering] ( identifier[parent] ):
literal[string]
identifier[children] = identifier[parent] . identifier[getchildren] ()
identifier[i_nodes] =[ identifier[node] keyword[for] identifier[node] keyword[in] identifier[children] keyword[if] identifi... | def fix_schema_node_ordering(parent):
"""
Fix the ordering of children under the criteria node to ensure that IndicatorItem/Indicator order
is preserved, as per XML Schema.
:return:
"""
children = parent.getchildren()
i_nodes = [node for node in children if node.tag == 'Indi... |
def remove(self, item):
"""Remove the given C{item} from the sequence.
@raises L{WSDLParseError}: If the operation would result in having
less child elements than the required min_occurs, or if no such
index is found.
"""
for index, child in enumerate(self._roo... | def function[remove, parameter[self, item]]:
constant[Remove the given C{item} from the sequence.
@raises L{WSDLParseError}: If the operation would result in having
less child elements than the required min_occurs, or if no such
index is found.
]
for taget[tupl... | keyword[def] identifier[remove] ( identifier[self] , identifier[item] ):
literal[string]
keyword[for] identifier[index] , identifier[child] keyword[in] identifier[enumerate] ( identifier[self] . identifier[_root] . identifier[getchildren] ()):
keyword[if] identifier[child] keyword... | def remove(self, item):
"""Remove the given C{item} from the sequence.
@raises L{WSDLParseError}: If the operation would result in having
less child elements than the required min_occurs, or if no such
index is found.
"""
for (index, child) in enumerate(self._root.getc... |
def warn_if_nans_exist(X):
"""Warn if nans exist in a numpy array."""
null_count = count_rows_with_nans(X)
total = len(X)
percent = 100 * null_count / total
if null_count > 0:
warning_message = \
'Warning! Found {} rows of {} ({:0.2f}%) with nan values. Only ' \
'com... | def function[warn_if_nans_exist, parameter[X]]:
constant[Warn if nans exist in a numpy array.]
variable[null_count] assign[=] call[name[count_rows_with_nans], parameter[name[X]]]
variable[total] assign[=] call[name[len], parameter[name[X]]]
variable[percent] assign[=] binary_operation[bi... | keyword[def] identifier[warn_if_nans_exist] ( identifier[X] ):
literal[string]
identifier[null_count] = identifier[count_rows_with_nans] ( identifier[X] )
identifier[total] = identifier[len] ( identifier[X] )
identifier[percent] = literal[int] * identifier[null_count] / identifier[total]
k... | def warn_if_nans_exist(X):
"""Warn if nans exist in a numpy array."""
null_count = count_rows_with_nans(X)
total = len(X)
percent = 100 * null_count / total
if null_count > 0:
warning_message = 'Warning! Found {} rows of {} ({:0.2f}%) with nan values. Only complete rows will be plotted.'.for... |
def openSourceFile(self, fileToOpen):
"""Finds and opens the source file for link target fileToOpen.
When links like [test](test) are clicked, the file test.md is opened.
It has to be located next to the current opened file.
Relative paths like [test](../test) or [test](folder/test) are also possible.
"""
... | def function[openSourceFile, parameter[self, fileToOpen]]:
constant[Finds and opens the source file for link target fileToOpen.
When links like [test](test) are clicked, the file test.md is opened.
It has to be located next to the current opened file.
Relative paths like [test](../test) or [test](folder/... | keyword[def] identifier[openSourceFile] ( identifier[self] , identifier[fileToOpen] ):
literal[string]
keyword[if] identifier[self] . identifier[fileName] :
identifier[currentExt] = identifier[splitext] ( identifier[self] . identifier[fileName] )[ literal[int] ]
identifier[basename] , identifier[ext] ... | def openSourceFile(self, fileToOpen):
"""Finds and opens the source file for link target fileToOpen.
When links like [test](test) are clicked, the file test.md is opened.
It has to be located next to the current opened file.
Relative paths like [test](../test) or [test](folder/test) are also possible.
"""
... |
def thumbnail(self, value):
"""
gets/sets the thumbnail
Enter the pathname to the thumbnail image to be used for the item.
The recommended image size is 200 pixels wide by 133 pixels high.
Acceptable image formats are PNG, GIF, and JPEG. The maximum file
size for an image... | def function[thumbnail, parameter[self, value]]:
constant[
gets/sets the thumbnail
Enter the pathname to the thumbnail image to be used for the item.
The recommended image size is 200 pixels wide by 133 pixels high.
Acceptable image formats are PNG, GIF, and JPEG. The maximum fil... | keyword[def] identifier[thumbnail] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[os] . identifier[path] . identifier[isfile] ( identifier[value] ) keyword[and] identifier[self] . identifier[_thumbnail] != identifier[value] :
identifier[self] . ident... | def thumbnail(self, value):
"""
gets/sets the thumbnail
Enter the pathname to the thumbnail image to be used for the item.
The recommended image size is 200 pixels wide by 133 pixels high.
Acceptable image formats are PNG, GIF, and JPEG. The maximum file
size for an image is ... |
def list_firmware_images(self, **kwargs):
"""List all firmware images.
:param int limit: number of firmware images to retrieve
:param str order: ordering of images when ordered by time. 'desc' or 'asc'
:param str after: get firmware images after given `image_id`
:param dict filt... | def function[list_firmware_images, parameter[self]]:
constant[List all firmware images.
:param int limit: number of firmware images to retrieve
:param str order: ordering of images when ordered by time. 'desc' or 'asc'
:param str after: get firmware images after given `image_id`
... | keyword[def] identifier[list_firmware_images] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] = identifier[self] . identifier[_verify_sort_options] ( identifier[kwargs] )
identifier[kwargs] = identifier[self] . identifier[_verify_filters] ( identifier[kwargs... | def list_firmware_images(self, **kwargs):
"""List all firmware images.
:param int limit: number of firmware images to retrieve
:param str order: ordering of images when ordered by time. 'desc' or 'asc'
:param str after: get firmware images after given `image_id`
:param dict filters:... |
def get(filename, target=None, serial=None):
"""
Gets a referenced file on the device's file system and copies it to the
target (or current working directory if unspecified).
If no serial object is supplied, microfs will attempt to detect the
connection itself.
Returns True for success or rais... | def function[get, parameter[filename, target, serial]]:
constant[
Gets a referenced file on the device's file system and copies it to the
target (or current working directory if unspecified).
If no serial object is supplied, microfs will attempt to detect the
connection itself.
Returns Tru... | keyword[def] identifier[get] ( identifier[filename] , identifier[target] = keyword[None] , identifier[serial] = keyword[None] ):
literal[string]
keyword[if] identifier[target] keyword[is] keyword[None] :
identifier[target] = identifier[filename]
identifier[commands] =[
literal[string... | def get(filename, target=None, serial=None):
"""
Gets a referenced file on the device's file system and copies it to the
target (or current working directory if unspecified).
If no serial object is supplied, microfs will attempt to detect the
connection itself.
Returns True for success or rais... |
def translate_to_american_phonetic_alphabet(self, hide_stress_mark=False):
'''
转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
'''
translations = self.stress.mark_ipa() if (not hide_stress_mark) and self.have_vowel else ""
for phoneme in self._phonem... | def function[translate_to_american_phonetic_alphabet, parameter[self, hide_stress_mark]]:
constant[
转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
]
variable[translations] assign[=] <ast.IfExp object at 0x7da1b10c3bb0>
for taget[name[phoneme]] in star... | keyword[def] identifier[translate_to_american_phonetic_alphabet] ( identifier[self] , identifier[hide_stress_mark] = keyword[False] ):
literal[string]
identifier[translations] = identifier[self] . identifier[stress] . identifier[mark_ipa] () keyword[if] ( keyword[not] identifier[hide_stress_mark]... | def translate_to_american_phonetic_alphabet(self, hide_stress_mark=False):
"""
转换成美音音。只要一个元音的时候需要隐藏重音标识
:param hide_stress_mark:
:return:
"""
translations = self.stress.mark_ipa() if not hide_stress_mark and self.have_vowel else ''
for phoneme in self._phoneme_list:
... |
def add_action(self, actor, action, date, type=None, committees=None,
legislators=None, **kwargs):
"""
Add an action that was performed on this bill.
:param actor: a string representing who performed the action.
If the action is associated with one of the chambers t... | def function[add_action, parameter[self, actor, action, date, type, committees, legislators]]:
constant[
Add an action that was performed on this bill.
:param actor: a string representing who performed the action.
If the action is associated with one of the chambers this
sho... | keyword[def] identifier[add_action] ( identifier[self] , identifier[actor] , identifier[action] , identifier[date] , identifier[type] = keyword[None] , identifier[committees] = keyword[None] ,
identifier[legislators] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[def] identifi... | def add_action(self, actor, action, date, type=None, committees=None, legislators=None, **kwargs):
"""
Add an action that was performed on this bill.
:param actor: a string representing who performed the action.
If the action is associated with one of the chambers this
should be... |
def second(self):
'''set unit to second'''
self.magnification = 1
self._update(self.baseNumber, self.magnification)
return self | def function[second, parameter[self]]:
constant[set unit to second]
name[self].magnification assign[=] constant[1]
call[name[self]._update, parameter[name[self].baseNumber, name[self].magnification]]
return[name[self]] | keyword[def] identifier[second] ( identifier[self] ):
literal[string]
identifier[self] . identifier[magnification] = literal[int]
identifier[self] . identifier[_update] ( identifier[self] . identifier[baseNumber] , identifier[self] . identifier[magnification] )
keyword[return] i... | def second(self):
"""set unit to second"""
self.magnification = 1
self._update(self.baseNumber, self.magnification)
return self |
def get_instance(self, payload):
"""
Build an instance of SigningKeyInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance
:rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance
""... | def function[get_instance, parameter[self, payload]]:
constant[
Build an instance of SigningKeyInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance
:rtype: twilio.rest.api.v2010.account.signing_key.Si... | keyword[def] identifier[get_instance] ( identifier[self] , identifier[payload] ):
literal[string]
keyword[return] identifier[SigningKeyInstance] ( identifier[self] . identifier[_version] , identifier[payload] , identifier[account_sid] = identifier[self] . identifier[_solution] [ literal[string] ],... | def get_instance(self, payload):
"""
Build an instance of SigningKeyInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance
:rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyInstance
"""
... |
def rest_get(url, timeout):
'''Call rest get method'''
try:
response = requests.get(url, timeout=timeout)
return response
except Exception as e:
print('Get exception {0} when sending http get to url {1}'.format(str(e), url))
return None | def function[rest_get, parameter[url, timeout]]:
constant[Call rest get method]
<ast.Try object at 0x7da1b1f39030> | keyword[def] identifier[rest_get] ( identifier[url] , identifier[timeout] ):
literal[string]
keyword[try] :
identifier[response] = identifier[requests] . identifier[get] ( identifier[url] , identifier[timeout] = identifier[timeout] )
keyword[return] identifier[response]
keyword[exc... | def rest_get(url, timeout):
"""Call rest get method"""
try:
response = requests.get(url, timeout=timeout)
return response # depends on [control=['try'], data=[]]
except Exception as e:
print('Get exception {0} when sending http get to url {1}'.format(str(e), url))
return Non... |
def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on guppi raw files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for creating spectra from GuppiRaw files.")
parser.add_argument('filename', type=str, help='Name of file to... | def function[cmd_tool, parameter[args]]:
constant[ Command line tool for plotting and viewing info on guppi raw files ]
from relative_module[argparse] import module[ArgumentParser]
variable[parser] assign[=] call[name[ArgumentParser], parameter[]]
call[name[parser].add_argument, parameter[co... | keyword[def] identifier[cmd_tool] ( identifier[args] = keyword[None] ):
literal[string]
keyword[from] identifier[argparse] keyword[import] identifier[ArgumentParser]
identifier[parser] = identifier[ArgumentParser] ( identifier[description] = literal[string] )
identifier[parser] . identifie... | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on guppi raw files """
from argparse import ArgumentParser
parser = ArgumentParser(description='Command line utility for creating spectra from GuppiRaw files.')
parser.add_argument('filename', type=str, help='Name of file to re... |
def get_route53_records(self):
''' Get and store the map of resource records to domain names that
point to them. '''
r53_conn = route53.Route53Connection()
all_zones = r53_conn.get_zones()
route53_zones = [ zone for zone in all_zones if zone.name[:-1]
... | def function[get_route53_records, parameter[self]]:
constant[ Get and store the map of resource records to domain names that
point to them. ]
variable[r53_conn] assign[=] call[name[route53].Route53Connection, parameter[]]
variable[all_zones] assign[=] call[name[r53_conn].get_zones, param... | keyword[def] identifier[get_route53_records] ( identifier[self] ):
literal[string]
identifier[r53_conn] = identifier[route53] . identifier[Route53Connection] ()
identifier[all_zones] = identifier[r53_conn] . identifier[get_zones] ()
identifier[route53_zones] =[ identifier[zone] ... | def get_route53_records(self):
""" Get and store the map of resource records to domain names that
point to them. """
r53_conn = route53.Route53Connection()
all_zones = r53_conn.get_zones()
route53_zones = [zone for zone in all_zones if zone.name[:-1] not in self.route53_excluded_zones]
self.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.