code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def create_ical(request, slug):
""" Creates an ical .ics file for an event using python-card-me. """
event = get_object_or_404(Event, slug=slug)
# convert dates to datetimes.
# when we change code to datetimes, we won't have to do this.
start = event.start_date
start = datetime.datetime(start.ye... | def function[create_ical, parameter[request, slug]]:
constant[ Creates an ical .ics file for an event using python-card-me. ]
variable[event] assign[=] call[name[get_object_or_404], parameter[name[Event]]]
variable[start] assign[=] name[event].start_date
variable[start] assign[=] call[na... | keyword[def] identifier[create_ical] ( identifier[request] , identifier[slug] ):
literal[string]
identifier[event] = identifier[get_object_or_404] ( identifier[Event] , identifier[slug] = identifier[slug] )
identifier[start] = identifier[event] . identifier[start_date]
identifier[start... | def create_ical(request, slug):
""" Creates an ical .ics file for an event using python-card-me. """
event = get_object_or_404(Event, slug=slug)
# convert dates to datetimes.
# when we change code to datetimes, we won't have to do this.
start = event.start_date
start = datetime.datetime(start.ye... |
def editable(parsed, context, token):
"""
Add the required HTML to the parsed content for in-line editing,
such as the icon and edit form if the object is deemed to be
editable - either it has an ``editable`` method which returns
``True``, or the logged in user has change permissions for the
mod... | def function[editable, parameter[parsed, context, token]]:
constant[
Add the required HTML to the parsed content for in-line editing,
such as the icon and edit form if the object is deemed to be
editable - either it has an ``editable`` method which returns
``True``, or the logged in user has cha... | keyword[def] identifier[editable] ( identifier[parsed] , identifier[context] , identifier[token] ):
literal[string]
keyword[def] identifier[parse_field] ( identifier[field] ):
identifier[field] = identifier[field] . identifier[split] ( literal[string] )
identifier[obj] = identifier[conte... | def editable(parsed, context, token):
"""
Add the required HTML to the parsed content for in-line editing,
such as the icon and edit form if the object is deemed to be
editable - either it has an ``editable`` method which returns
``True``, or the logged in user has change permissions for the
mod... |
def chdir(self, directory, browsing_history=False,
refresh_explorer=True, refresh_console=True):
"""Set directory as working directory"""
if directory:
directory = osp.abspath(to_text_string(directory))
# Working directory history management
if browsing_... | def function[chdir, parameter[self, directory, browsing_history, refresh_explorer, refresh_console]]:
constant[Set directory as working directory]
if name[directory] begin[:]
variable[directory] assign[=] call[name[osp].abspath, parameter[call[name[to_text_string], parameter[name[directo... | keyword[def] identifier[chdir] ( identifier[self] , identifier[directory] , identifier[browsing_history] = keyword[False] ,
identifier[refresh_explorer] = keyword[True] , identifier[refresh_console] = keyword[True] ):
literal[string]
keyword[if] identifier[directory] :
identifier... | def chdir(self, directory, browsing_history=False, refresh_explorer=True, refresh_console=True):
"""Set directory as working directory"""
if directory:
directory = osp.abspath(to_text_string(directory)) # depends on [control=['if'], data=[]] # Working directory history management
if browsing_histo... |
def refresh_state(self, id_or_uri, configuration, timeout=-1):
"""
Refreshes a drive enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
configuration: Configuration
timeout: Timeout in seconds. Wait for task completion by default. ... | def function[refresh_state, parameter[self, id_or_uri, configuration, timeout]]:
constant[
Refreshes a drive enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
configuration: Configuration
timeout: Timeout in seconds. Wait for task... | keyword[def] identifier[refresh_state] ( identifier[self] , identifier[id_or_uri] , identifier[configuration] , identifier[timeout] =- literal[int] ):
literal[string]
identifier[uri] = identifier[self] . identifier[_client] . identifier[build_uri] ( identifier[id_or_uri] )+ identifier[self] . ident... | def refresh_state(self, id_or_uri, configuration, timeout=-1):
"""
Refreshes a drive enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
configuration: Configuration
timeout: Timeout in seconds. Wait for task completion by default. The ... |
def _parse_value(value):
'''Internal helper for parsing configuration values into python values'''
if isinstance(value, bool):
return 'true' if value else 'false'
elif isinstance(value, six.string_types):
# parse compacted notation to dict
listparser = re.compile(r'''((?:[^,"']|"[^"]... | def function[_parse_value, parameter[value]]:
constant[Internal helper for parsing configuration values into python values]
if call[name[isinstance], parameter[name[value], name[bool]]] begin[:]
return[<ast.IfExp object at 0x7da1b1f821d0>] | keyword[def] identifier[_parse_value] ( identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[bool] ):
keyword[return] literal[string] keyword[if] identifier[value] keyword[else] literal[string]
keyword[elif] identifier[isinstance] ( ... | def _parse_value(value):
"""Internal helper for parsing configuration values into python values"""
if isinstance(value, bool):
return 'true' if value else 'false' # depends on [control=['if'], data=[]]
elif isinstance(value, six.string_types):
# parse compacted notation to dict
list... |
def UnPlug(self, force=False):
"""Unplug controller from Virtual USB Bus and free up ID"""
if force:
_xinput.UnPlugForce(c_uint(self.id))
else:
_xinput.UnPlug(c_uint(self.id))
while self.id not in self.available_ids():
if self.id == 0:
... | def function[UnPlug, parameter[self, force]]:
constant[Unplug controller from Virtual USB Bus and free up ID]
if name[force] begin[:]
call[name[_xinput].UnPlugForce, parameter[call[name[c_uint], parameter[name[self].id]]]]
while compare[name[self].id <ast.NotIn object at 0x7da259... | keyword[def] identifier[UnPlug] ( identifier[self] , identifier[force] = keyword[False] ):
literal[string]
keyword[if] identifier[force] :
identifier[_xinput] . identifier[UnPlugForce] ( identifier[c_uint] ( identifier[self] . identifier[id] ))
keyword[else] :
id... | def UnPlug(self, force=False):
"""Unplug controller from Virtual USB Bus and free up ID"""
if force:
_xinput.UnPlugForce(c_uint(self.id)) # depends on [control=['if'], data=[]]
else:
_xinput.UnPlug(c_uint(self.id))
while self.id not in self.available_ids():
if self.id == 0:
... |
def vcf2cytosure(store, institute_id, case_name, individual_id):
"""vcf2cytosure CGH file for inidividual."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
for individual in case_obj['individuals']:
if individual['individual_id'] == individual_id:
individu... | def function[vcf2cytosure, parameter[store, institute_id, case_name, individual_id]]:
constant[vcf2cytosure CGH file for inidividual.]
<ast.Tuple object at 0x7da2046213f0> assign[=] call[name[institute_and_case], parameter[name[store], name[institute_id], name[case_name]]]
for taget[name[individ... | keyword[def] identifier[vcf2cytosure] ( identifier[store] , identifier[institute_id] , identifier[case_name] , identifier[individual_id] ):
literal[string]
identifier[institute_obj] , identifier[case_obj] = identifier[institute_and_case] ( identifier[store] , identifier[institute_id] , identifier[case_name... | def vcf2cytosure(store, institute_id, case_name, individual_id):
"""vcf2cytosure CGH file for inidividual."""
(institute_obj, case_obj) = institute_and_case(store, institute_id, case_name)
for individual in case_obj['individuals']:
if individual['individual_id'] == individual_id:
individ... |
def set_visible_func(self, visible_func):
"""Set the function to decide visibility of an item
:param visible_func: A callable that returns a boolean result to
decide if an item should be visible, for
example::
de... | def function[set_visible_func, parameter[self, visible_func]]:
constant[Set the function to decide visibility of an item
:param visible_func: A callable that returns a boolean result to
decide if an item should be visible, for
example::
... | keyword[def] identifier[set_visible_func] ( identifier[self] , identifier[visible_func] ):
literal[string]
identifier[self] . identifier[model_filter] . identifier[set_visible_func] (
identifier[self] . identifier[_internal_visible_func] ,
identifier[visible_func] ,
)
... | def set_visible_func(self, visible_func):
"""Set the function to decide visibility of an item
:param visible_func: A callable that returns a boolean result to
decide if an item should be visible, for
example::
def is... |
def create_entry(self, title='', image=1, url='', username='', password='',
comment='', y=2999, mon=12, d=28, h=23, min_=59, s=59):
"""This method creates an entry in this group.
Compare to StdEntry for information about the arguments.
One of the following arguments is ne... | def function[create_entry, parameter[self, title, image, url, username, password, comment, y, mon, d, h, min_, s]]:
constant[This method creates an entry in this group.
Compare to StdEntry for information about the arguments.
One of the following arguments is needed:
- title
-... | keyword[def] identifier[create_entry] ( identifier[self] , identifier[title] = literal[string] , identifier[image] = literal[int] , identifier[url] = literal[string] , identifier[username] = literal[string] , identifier[password] = literal[string] ,
identifier[comment] = literal[string] , identifier[y] = literal[int... | def create_entry(self, title='', image=1, url='', username='', password='', comment='', y=2999, mon=12, d=28, h=23, min_=59, s=59):
"""This method creates an entry in this group.
Compare to StdEntry for information about the arguments.
One of the following arguments is needed:
- title
... |
def infer(self, number_of_processes=1, *args, **kwargs):
"""
:param number_of_processes: If set to more than 1, the inference routines will be paralellised
using ``multiprocessing`` module
:param args: arguments to pass to :meth:`Inference.infer`
:para... | def function[infer, parameter[self, number_of_processes]]:
constant[
:param number_of_processes: If set to more than 1, the inference routines will be paralellised
using ``multiprocessing`` module
:param args: arguments to pass to :meth:`Inference.infer`
... | keyword[def] identifier[infer] ( identifier[self] , identifier[number_of_processes] = literal[int] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[number_of_processes] == literal[int] :
identifier[results] = identifier[map] ( keyword[lambda] ident... | def infer(self, number_of_processes=1, *args, **kwargs):
"""
:param number_of_processes: If set to more than 1, the inference routines will be paralellised
using ``multiprocessing`` module
:param args: arguments to pass to :meth:`Inference.infer`
:param kw... |
def setup(self, builder):
"""Performs this component's simulation setup.
Parameters
----------
builder : `engine.Builder`
Interface to several simulation tools.
"""
super().setup(builder)
self.clock = builder.time.clock()
self.excess_mortalit... | def function[setup, parameter[self, builder]]:
constant[Performs this component's simulation setup.
Parameters
----------
builder : `engine.Builder`
Interface to several simulation tools.
]
call[call[name[super], parameter[]].setup, parameter[name[builder]]]
... | keyword[def] identifier[setup] ( identifier[self] , identifier[builder] ):
literal[string]
identifier[super] (). identifier[setup] ( identifier[builder] )
identifier[self] . identifier[clock] = identifier[builder] . identifier[time] . identifier[clock] ()
identifier[self] . ident... | def setup(self, builder):
"""Performs this component's simulation setup.
Parameters
----------
builder : `engine.Builder`
Interface to several simulation tools.
"""
super().setup(builder)
self.clock = builder.time.clock()
self.excess_mortality_rate = builder.... |
def read(self):
"""Read a Response, do some validation, and return it."""
if FLAGS.sc2_verbose_protocol:
self._log(" Reading response ".center(60, "-"))
start = time.time()
response = self._read()
if FLAGS.sc2_verbose_protocol:
self._log(" %0.1f msec\n" % (1000 * (time.time() - start))... | def function[read, parameter[self]]:
constant[Read a Response, do some validation, and return it.]
if name[FLAGS].sc2_verbose_protocol begin[:]
call[name[self]._log, parameter[call[constant[ Reading response ].center, parameter[constant[60], constant[-]]]]]
variable[start... | keyword[def] identifier[read] ( identifier[self] ):
literal[string]
keyword[if] identifier[FLAGS] . identifier[sc2_verbose_protocol] :
identifier[self] . identifier[_log] ( literal[string] . identifier[center] ( literal[int] , literal[string] ))
identifier[start] = identifier[time] . identif... | def read(self):
"""Read a Response, do some validation, and return it."""
if FLAGS.sc2_verbose_protocol:
self._log(' Reading response '.center(60, '-'))
start = time.time() # depends on [control=['if'], data=[]]
response = self._read()
if FLAGS.sc2_verbose_protocol:
self._log(' ... |
def make_sloppy_codec(encoding):
"""
Take a codec name, and return a 'sloppy' version of that codec that can
encode and decode the unassigned bytes in that encoding.
Single-byte encodings in the standard library are defined using some
boilerplate classes surrounding the functions that do the actual... | def function[make_sloppy_codec, parameter[encoding]]:
constant[
Take a codec name, and return a 'sloppy' version of that codec that can
encode and decode the unassigned bytes in that encoding.
Single-byte encodings in the standard library are defined using some
boilerplate classes surrounding t... | keyword[def] identifier[make_sloppy_codec] ( identifier[encoding] ):
literal[string]
identifier[all_bytes] = identifier[bytes] ( identifier[range] ( literal[int] ))
identifier[sloppy_chars] = identifier[list] ( identifier[all_bytes] . identifier[decode] ( literal[string] ))
... | def make_sloppy_codec(encoding):
"""
Take a codec name, and return a 'sloppy' version of that codec that can
encode and decode the unassigned bytes in that encoding.
Single-byte encodings in the standard library are defined using some
boilerplate classes surrounding the functions that do the actual... |
def server_bind(self):
"""Override server_bind to store the server name."""
socketserver.TCPServer.server_bind(self)
host, port = self.socket.getsockname()[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port | def function[server_bind, parameter[self]]:
constant[Override server_bind to store the server name.]
call[name[socketserver].TCPServer.server_bind, parameter[name[self]]]
<ast.Tuple object at 0x7da18dc04c10> assign[=] call[call[name[self].socket.getsockname, parameter[]]][<ast.Slice object at 0x... | keyword[def] identifier[server_bind] ( identifier[self] ):
literal[string]
identifier[socketserver] . identifier[TCPServer] . identifier[server_bind] ( identifier[self] )
identifier[host] , identifier[port] = identifier[self] . identifier[socket] . identifier[getsockname] ()[: literal[int]... | def server_bind(self):
"""Override server_bind to store the server name."""
socketserver.TCPServer.server_bind(self)
(host, port) = self.socket.getsockname()[:2]
self.server_name = socket.getfqdn(host)
self.server_port = port |
async def oauth2_request(
self,
url: str,
access_token: str = None,
post_args: Dict[str, Any] = None,
**args: Any
) -> Any:
"""Fetches the given URL auth an OAuth2 access token.
If the request is a POST, ``post_args`` should be provided. Query
string ... | <ast.AsyncFunctionDef object at 0x7da1b1f2eec0> | keyword[async] keyword[def] identifier[oauth2_request] (
identifier[self] ,
identifier[url] : identifier[str] ,
identifier[access_token] : identifier[str] = keyword[None] ,
identifier[post_args] : identifier[Dict] [ identifier[str] , identifier[Any] ]= keyword[None] ,
** identifier[args] : identifier[Any]
)-> i... | async def oauth2_request(self, url: str, access_token: str=None, post_args: Dict[str, Any]=None, **args: Any) -> Any:
"""Fetches the given URL auth an OAuth2 access token.
If the request is a POST, ``post_args`` should be provided. Query
string arguments should be given as keyword arguments.
... |
def qAx(mt, x, q):
""" This function evaluates the APV of a geometrically increasing annual annuity-due """
q = float(q)
j = (mt.i - q) / (1 + q)
mtj = Actuarial(nt=mt.nt, i=j)
return Ax(mtj, x) | def function[qAx, parameter[mt, x, q]]:
constant[ This function evaluates the APV of a geometrically increasing annual annuity-due ]
variable[q] assign[=] call[name[float], parameter[name[q]]]
variable[j] assign[=] binary_operation[binary_operation[name[mt].i - name[q]] / binary_operation[consta... | keyword[def] identifier[qAx] ( identifier[mt] , identifier[x] , identifier[q] ):
literal[string]
identifier[q] = identifier[float] ( identifier[q] )
identifier[j] =( identifier[mt] . identifier[i] - identifier[q] )/( literal[int] + identifier[q] )
identifier[mtj] = identifier[Actuarial] ( identif... | def qAx(mt, x, q):
""" This function evaluates the APV of a geometrically increasing annual annuity-due """
q = float(q)
j = (mt.i - q) / (1 + q)
mtj = Actuarial(nt=mt.nt, i=j)
return Ax(mtj, x) |
def to_utf8(s):
"""Convert a string to utf8. If the argument is an iterable
(list/tuple/set), then each element of it would be converted instead.
>>> to_utf8('a')
'a'
>>> to_utf8(u'a')
'a'
>>> to_utf8([u'a', u'b', u'\u4f60'])
['a', 'b', '\\xe4\\xbd\\xa0']
"""
if six.PY2:
... | def function[to_utf8, parameter[s]]:
constant[Convert a string to utf8. If the argument is an iterable
(list/tuple/set), then each element of it would be converted instead.
>>> to_utf8('a')
'a'
>>> to_utf8(u'a')
'a'
>>> to_utf8([u'a', u'b', u'你'])
['a', 'b', '\xe4\xbd\xa0']
]
... | keyword[def] identifier[to_utf8] ( identifier[s] ):
literal[string]
keyword[if] identifier[six] . identifier[PY2] :
keyword[if] identifier[isinstance] ( identifier[s] , identifier[str] ):
keyword[return] identifier[s]
keyword[elif] identifier[isinstance] ( identifier[s] ... | def to_utf8(s):
"""Convert a string to utf8. If the argument is an iterable
(list/tuple/set), then each element of it would be converted instead.
>>> to_utf8('a')
'a'
>>> to_utf8(u'a')
'a'
>>> to_utf8([u'a', u'b', u'你'])
['a', 'b', '\\xe4\\xbd\\xa0']
"""
if six.PY2:
if i... |
def zone_present(domain, type, profile):
'''
Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str``
... | def function[zone_present, parameter[domain, type, profile]]:
constant[
Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
... | keyword[def] identifier[zone_present] ( identifier[domain] , identifier[type] , identifier[profile] ):
literal[string]
identifier[zones] = identifier[__salt__] [ literal[string] ]( identifier[profile] )
keyword[if] keyword[not] identifier[type] :
identifier[type] = literal[string]
ide... | def zone_present(domain, type, profile):
"""
Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str``
... |
def _insert_error(self, path, node):
""" Adds an error or sub-tree to :attr:tree.
:param path: Path to the error.
:type path: Tuple of strings and integers.
:param node: An error message or a sub-tree.
:type node: String or dictionary.
"""
field = path[0]
... | def function[_insert_error, parameter[self, path, node]]:
constant[ Adds an error or sub-tree to :attr:tree.
:param path: Path to the error.
:type path: Tuple of strings and integers.
:param node: An error message or a sub-tree.
:type node: String or dictionary.
]
... | keyword[def] identifier[_insert_error] ( identifier[self] , identifier[path] , identifier[node] ):
literal[string]
identifier[field] = identifier[path] [ literal[int] ]
keyword[if] identifier[len] ( identifier[path] )== literal[int] :
keyword[if] identifier[field] keyword[i... | def _insert_error(self, path, node):
""" Adds an error or sub-tree to :attr:tree.
:param path: Path to the error.
:type path: Tuple of strings and integers.
:param node: An error message or a sub-tree.
:type node: String or dictionary.
"""
field = path[0]
if len(path... |
def _process_settings(**kwargs):
"""
Apply user supplied settings.
"""
# If we are in this method due to a signal, only reload for our settings
setting_name = kwargs.get('setting', None)
if setting_name is not None and setting_name != 'QUERYCOUNT':
return
# Support the old-style s... | def function[_process_settings, parameter[]]:
constant[
Apply user supplied settings.
]
variable[setting_name] assign[=] call[name[kwargs].get, parameter[constant[setting], constant[None]]]
if <ast.BoolOp object at 0x7da20c992020> begin[:]
return[None]
if call[name[getatt... | keyword[def] identifier[_process_settings] (** identifier[kwargs] ):
literal[string]
identifier[setting_name] = identifier[kwargs] . identifier[get] ( literal[string] , keyword[None] )
keyword[if] identifier[setting_name] keyword[is] keyword[not] keyword[None] keyword[and] identifier[setti... | def _process_settings(**kwargs):
"""
Apply user supplied settings.
"""
# If we are in this method due to a signal, only reload for our settings
setting_name = kwargs.get('setting', None)
if setting_name is not None and setting_name != 'QUERYCOUNT':
return # depends on [control=['if'], d... |
def zip_source_model(ssmLT, archive_zip='', log=logging.info):
"""
Zip the source model files starting from the smmLT.xml file
"""
basedir = os.path.dirname(ssmLT)
if os.path.basename(ssmLT) != 'ssmLT.xml':
orig = ssmLT
ssmLT = os.path.join(basedir, 'ssmLT.xml')
with open(ssm... | def function[zip_source_model, parameter[ssmLT, archive_zip, log]]:
constant[
Zip the source model files starting from the smmLT.xml file
]
variable[basedir] assign[=] call[name[os].path.dirname, parameter[name[ssmLT]]]
if compare[call[name[os].path.basename, parameter[name[ssmLT]]] not_... | keyword[def] identifier[zip_source_model] ( identifier[ssmLT] , identifier[archive_zip] = literal[string] , identifier[log] = identifier[logging] . identifier[info] ):
literal[string]
identifier[basedir] = identifier[os] . identifier[path] . identifier[dirname] ( identifier[ssmLT] )
keyword[if] ident... | def zip_source_model(ssmLT, archive_zip='', log=logging.info):
"""
Zip the source model files starting from the smmLT.xml file
"""
basedir = os.path.dirname(ssmLT)
if os.path.basename(ssmLT) != 'ssmLT.xml':
orig = ssmLT
ssmLT = os.path.join(basedir, 'ssmLT.xml')
with open(ssm... |
def validate(self, fixerrors=True):
"""
Validates that the geometry is correctly formatted according to the geometry type.
Parameters:
- **fixerrors** (optional): Attempts to fix minor errors without raising exceptions (defaults to True)
Returns:
- True if th... | def function[validate, parameter[self, fixerrors]]:
constant[
Validates that the geometry is correctly formatted according to the geometry type.
Parameters:
- **fixerrors** (optional): Attempts to fix minor errors without raising exceptions (defaults to True)
Returns:
... | keyword[def] identifier[validate] ( identifier[self] , identifier[fixerrors] = keyword[True] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_data] :
keyword[return] keyword[True]
keyword[elif] literal[string] keyword[not] ke... | def validate(self, fixerrors=True):
"""
Validates that the geometry is correctly formatted according to the geometry type.
Parameters:
- **fixerrors** (optional): Attempts to fix minor errors without raising exceptions (defaults to True)
Returns:
- True if the ge... |
def evaluate(module_name: str, fname: str, verbose: bool):
"""
Load fname as a module. Will raise an exception if there is an error
:param module_name: resulting name of module
:param fname: name to load
"""
if verbose:
print("Testing {}".format(fname))
spec = importlib.util.spec_f... | def function[evaluate, parameter[module_name, fname, verbose]]:
constant[
Load fname as a module. Will raise an exception if there is an error
:param module_name: resulting name of module
:param fname: name to load
]
if name[verbose] begin[:]
call[name[print], parameter... | keyword[def] identifier[evaluate] ( identifier[module_name] : identifier[str] , identifier[fname] : identifier[str] , identifier[verbose] : identifier[bool] ):
literal[string]
keyword[if] identifier[verbose] :
identifier[print] ( literal[string] . identifier[format] ( identifier[fname] ))
id... | def evaluate(module_name: str, fname: str, verbose: bool):
"""
Load fname as a module. Will raise an exception if there is an error
:param module_name: resulting name of module
:param fname: name to load
"""
if verbose:
print('Testing {}'.format(fname)) # depends on [control=['if'], d... |
def create(self, friendly_name, event_callback_url=values.unset,
events_filter=values.unset, multi_task_enabled=values.unset,
template=values.unset, prioritize_queue_order=values.unset):
"""
Create a new WorkspaceInstance
:param unicode friendly_name: Human readabl... | def function[create, parameter[self, friendly_name, event_callback_url, events_filter, multi_task_enabled, template, prioritize_queue_order]]:
constant[
Create a new WorkspaceInstance
:param unicode friendly_name: Human readable description of this workspace
:param unicode event_callbac... | keyword[def] identifier[create] ( identifier[self] , identifier[friendly_name] , identifier[event_callback_url] = identifier[values] . identifier[unset] ,
identifier[events_filter] = identifier[values] . identifier[unset] , identifier[multi_task_enabled] = identifier[values] . identifier[unset] ,
identifier[templat... | def create(self, friendly_name, event_callback_url=values.unset, events_filter=values.unset, multi_task_enabled=values.unset, template=values.unset, prioritize_queue_order=values.unset):
"""
Create a new WorkspaceInstance
:param unicode friendly_name: Human readable description of this workspace
... |
def container_size(self):
""" Returns the accumulated bit size of all fields in the `Sequence` as
a tuple in the form of ``(number of bytes, remaining number of bits)``.
"""
length = 0
for name, item in enumerate(self):
# Container
if is_container(item):
... | def function[container_size, parameter[self]]:
constant[ Returns the accumulated bit size of all fields in the `Sequence` as
a tuple in the form of ``(number of bytes, remaining number of bits)``.
]
variable[length] assign[=] constant[0]
for taget[tuple[[<ast.Name object at 0x7da... | keyword[def] identifier[container_size] ( identifier[self] ):
literal[string]
identifier[length] = literal[int]
keyword[for] identifier[name] , identifier[item] keyword[in] identifier[enumerate] ( identifier[self] ):
keyword[if] identifier[is_container] ( identif... | def container_size(self):
""" Returns the accumulated bit size of all fields in the `Sequence` as
a tuple in the form of ``(number of bytes, remaining number of bits)``.
"""
length = 0
for (name, item) in enumerate(self):
# Container
if is_container(item):
(byte_l... |
def do_table(self, arg):
"""Prints the set of values for the independent vs. dependent variables in the
active unit test and analysis group as a table.
"""
usable, filename, append = self._redirect_split(arg)
a = self.tests[self.active]
args = self.curargs
self._m... | def function[do_table, parameter[self, arg]]:
constant[Prints the set of values for the independent vs. dependent variables in the
active unit test and analysis group as a table.
]
<ast.Tuple object at 0x7da20c7941f0> assign[=] call[name[self]._redirect_split, parameter[name[arg]]]
... | keyword[def] identifier[do_table] ( identifier[self] , identifier[arg] ):
literal[string]
identifier[usable] , identifier[filename] , identifier[append] = identifier[self] . identifier[_redirect_split] ( identifier[arg] )
identifier[a] = identifier[self] . identifier[tests] [ identifier[se... | def do_table(self, arg):
"""Prints the set of values for the independent vs. dependent variables in the
active unit test and analysis group as a table.
"""
(usable, filename, append) = self._redirect_split(arg)
a = self.tests[self.active]
args = self.curargs
self._make_fits()
res... |
def get_nodes(self, request):
"""
Return menu's node for entries
"""
nodes = []
archives = []
attributes = {'hidden': HIDE_ENTRY_MENU}
for entry in Entry.published.all():
year = entry.creation_date.strftime('%Y')
month = entry.creation_date... | def function[get_nodes, parameter[self, request]]:
constant[
Return menu's node for entries
]
variable[nodes] assign[=] list[[]]
variable[archives] assign[=] list[[]]
variable[attributes] assign[=] dictionary[[<ast.Constant object at 0x7da1b0c219f0>], [<ast.Name object at... | keyword[def] identifier[get_nodes] ( identifier[self] , identifier[request] ):
literal[string]
identifier[nodes] =[]
identifier[archives] =[]
identifier[attributes] ={ literal[string] : identifier[HIDE_ENTRY_MENU] }
keyword[for] identifier[entry] keyword[in] identifier... | def get_nodes(self, request):
"""
Return menu's node for entries
"""
nodes = []
archives = []
attributes = {'hidden': HIDE_ENTRY_MENU}
for entry in Entry.published.all():
year = entry.creation_date.strftime('%Y')
month = entry.creation_date.strftime('%m')
mont... |
def typelogged_func(func):
"""Works like typelogged, but is only applicable to functions,
methods and properties.
"""
if not pytypes.typelogging_enabled:
return func
if hasattr(func, 'do_logging'):
func.do_logging = True
return func
elif hasattr(func, 'do_typecheck'):
... | def function[typelogged_func, parameter[func]]:
constant[Works like typelogged, but is only applicable to functions,
methods and properties.
]
if <ast.UnaryOp object at 0x7da1b0d0d420> begin[:]
return[name[func]]
if call[name[hasattr], parameter[name[func], constant[do_logging]]]... | keyword[def] identifier[typelogged_func] ( identifier[func] ):
literal[string]
keyword[if] keyword[not] identifier[pytypes] . identifier[typelogging_enabled] :
keyword[return] identifier[func]
keyword[if] identifier[hasattr] ( identifier[func] , literal[string] ):
identifier[fun... | def typelogged_func(func):
"""Works like typelogged, but is only applicable to functions,
methods and properties.
"""
if not pytypes.typelogging_enabled:
return func # depends on [control=['if'], data=[]]
if hasattr(func, 'do_logging'):
func.do_logging = True
return func # ... |
def iterpink(depth=20):
"""Generate a sequence of samples of pink noise.
pink noise generator
from http://pydoc.net/Python/lmj.sound/0.1.1/lmj.sound.noise/
Based on the Voss-McCartney algorithm, discussion and code examples at
http://www.firstpr.com.au/dsp/pink-noise/
depth: Use this many sam... | def function[iterpink, parameter[depth]]:
constant[Generate a sequence of samples of pink noise.
pink noise generator
from http://pydoc.net/Python/lmj.sound/0.1.1/lmj.sound.noise/
Based on the Voss-McCartney algorithm, discussion and code examples at
http://www.firstpr.com.au/dsp/pink-noise/
... | keyword[def] identifier[iterpink] ( identifier[depth] = literal[int] ):
literal[string]
identifier[values] = identifier[numpy] . identifier[random] . identifier[randn] ( identifier[depth] )
identifier[smooth] = identifier[numpy] . identifier[random] . identifier[randn] ( identifier[depth] )
ident... | def iterpink(depth=20):
"""Generate a sequence of samples of pink noise.
pink noise generator
from http://pydoc.net/Python/lmj.sound/0.1.1/lmj.sound.noise/
Based on the Voss-McCartney algorithm, discussion and code examples at
http://www.firstpr.com.au/dsp/pink-noise/
depth: Use this many sam... |
def main():
"""
Runs a clusterer from the command-line. Calls JVM start/stop automatically.
Use -h to see all options.
"""
parser = argparse.ArgumentParser(
description='Performs clustering from the command-line. Calls JVM start/stop automatically.')
parser.add_argument("-j", metavar="cl... | def function[main, parameter[]]:
constant[
Runs a clusterer from the command-line. Calls JVM start/stop automatically.
Use -h to see all options.
]
variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]]
call[name[parser].add_argument, parameter[constant[-j]]]
... | keyword[def] identifier[main] ():
literal[string]
identifier[parser] = identifier[argparse] . identifier[ArgumentParser] (
identifier[description] = literal[string] )
identifier[parser] . identifier[add_argument] ( literal[string] , identifier[metavar] = literal[string] , identifier[dest] = liter... | def main():
"""
Runs a clusterer from the command-line. Calls JVM start/stop automatically.
Use -h to see all options.
"""
parser = argparse.ArgumentParser(description='Performs clustering from the command-line. Calls JVM start/stop automatically.')
parser.add_argument('-j', metavar='classpath',... |
def create_note(note_store, note, trigger_id, data):
"""
create a note
:param note_store Evernote instance
:param note
:param trigger_id id of the trigger
:param data to save or to put in cache
:type note_store: Evernote Instance
... | def function[create_note, parameter[note_store, note, trigger_id, data]]:
constant[
create a note
:param note_store Evernote instance
:param note
:param trigger_id id of the trigger
:param data to save or to put in cache
:type note_store: E... | keyword[def] identifier[create_note] ( identifier[note_store] , identifier[note] , identifier[trigger_id] , identifier[data] ):
literal[string]
keyword[try] :
identifier[created_note] = identifier[note_store] . identifier[createNote] ( identifier[note] )
identifie... | def create_note(note_store, note, trigger_id, data):
"""
create a note
:param note_store Evernote instance
:param note
:param trigger_id id of the trigger
:param data to save or to put in cache
:type note_store: Evernote Instance
:t... |
def _write_to_pipette(self, gcode, mount, data_string):
'''
Write to an attached pipette's internal memory. The gcode used
determines which portion of memory is written to.
NOTE: To enable write-access to the pipette, it's button must be held
gcode:
String (str) con... | def function[_write_to_pipette, parameter[self, gcode, mount, data_string]]:
constant[
Write to an attached pipette's internal memory. The gcode used
determines which portion of memory is written to.
NOTE: To enable write-access to the pipette, it's button must be held
gcode:
... | keyword[def] identifier[_write_to_pipette] ( identifier[self] , identifier[gcode] , identifier[mount] , identifier[data_string] ):
literal[string]
identifier[allowed_mounts] ={ literal[string] : literal[string] , literal[string] : literal[string] }
identifier[mount] = identifier[allowed_mo... | def _write_to_pipette(self, gcode, mount, data_string):
"""
Write to an attached pipette's internal memory. The gcode used
determines which portion of memory is written to.
NOTE: To enable write-access to the pipette, it's button must be held
gcode:
String (str) contain... |
def load_path(self, path):
"""
:param path:
:type path:
:return:
:rtype:
"""
logger.debug("load_path(path=%s)" % path)
if os.path.isfile(path):
configtype = self.guess_type(path)
logger.debug("Detected config type: %s" % self._type_... | def function[load_path, parameter[self, path]]:
constant[
:param path:
:type path:
:return:
:rtype:
]
call[name[logger].debug, parameter[binary_operation[constant[load_path(path=%s)] <ast.Mod object at 0x7da2590d6920> name[path]]]]
if call[name[os].path.is... | keyword[def] identifier[load_path] ( identifier[self] , identifier[path] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] % identifier[path] )
keyword[if] identifier[os] . identifier[path] . identifier[isfile] ( identifier[path] ):
identifier[config... | def load_path(self, path):
"""
:param path:
:type path:
:return:
:rtype:
"""
logger.debug('load_path(path=%s)' % path)
if os.path.isfile(path):
configtype = self.guess_type(path)
logger.debug('Detected config type: %s' % self._type_to_str(configtype))
... |
def sort(self):
"""
Return an iterable of nodes, toplogically sorted to correctly import
dependencies before leaf nodes.
"""
while self.nodes:
iterated = False
for node in self.leaf_nodes():
iterated = True
self.prune_node(n... | def function[sort, parameter[self]]:
constant[
Return an iterable of nodes, toplogically sorted to correctly import
dependencies before leaf nodes.
]
while name[self].nodes begin[:]
variable[iterated] assign[=] constant[False]
for taget[name[node]]... | keyword[def] identifier[sort] ( identifier[self] ):
literal[string]
keyword[while] identifier[self] . identifier[nodes] :
identifier[iterated] = keyword[False]
keyword[for] identifier[node] keyword[in] identifier[self] . identifier[leaf_nodes] ():
ide... | def sort(self):
"""
Return an iterable of nodes, toplogically sorted to correctly import
dependencies before leaf nodes.
"""
while self.nodes:
iterated = False
for node in self.leaf_nodes():
iterated = True
self.prune_node(node)
yield n... |
def by_player(self):
""":class:`bool`: Whether the kill involves other characters."""
return any([k.player and self.name != k.name for k in self.killers]) | def function[by_player, parameter[self]]:
constant[:class:`bool`: Whether the kill involves other characters.]
return[call[name[any], parameter[<ast.ListComp object at 0x7da1b0b6df30>]]] | keyword[def] identifier[by_player] ( identifier[self] ):
literal[string]
keyword[return] identifier[any] ([ identifier[k] . identifier[player] keyword[and] identifier[self] . identifier[name] != identifier[k] . identifier[name] keyword[for] identifier[k] keyword[in] identifier[self] . identi... | def by_player(self):
""":class:`bool`: Whether the kill involves other characters."""
return any([k.player and self.name != k.name for k in self.killers]) |
def parse(value):
"""Parse the string date.
This supports the subset of ISO8601 used by xsd:date, but is lenient
with what is accepted, handling most reasonable syntax.
Any timezone is parsed but ignored because a) it's meaningless without
a time and b) B{datetime}.I{date} doe... | def function[parse, parameter[value]]:
constant[Parse the string date.
This supports the subset of ISO8601 used by xsd:date, but is lenient
with what is accepted, handling most reasonable syntax.
Any timezone is parsed but ignored because a) it's meaningless without
a time and... | keyword[def] identifier[parse] ( identifier[value] ):
literal[string]
identifier[match_result] = identifier[RE_DATE] . identifier[match] ( identifier[value] )
keyword[if] identifier[match_result] keyword[is] keyword[None] :
keyword[raise] identifier[ValueError] ( literal[s... | def parse(value):
"""Parse the string date.
This supports the subset of ISO8601 used by xsd:date, but is lenient
with what is accepted, handling most reasonable syntax.
Any timezone is parsed but ignored because a) it's meaningless without
a time and b) B{datetime}.I{date} does no... |
def write(self, data):
"""Write data to serial port."""
for chunk in chunks(data, 512):
self.wait_to_write()
self.comport.write(chunk)
self.comport.flush() | def function[write, parameter[self, data]]:
constant[Write data to serial port.]
for taget[name[chunk]] in starred[call[name[chunks], parameter[name[data], constant[512]]]] begin[:]
call[name[self].wait_to_write, parameter[]]
call[name[self].comport.write, parameter[name[... | keyword[def] identifier[write] ( identifier[self] , identifier[data] ):
literal[string]
keyword[for] identifier[chunk] keyword[in] identifier[chunks] ( identifier[data] , literal[int] ):
identifier[self] . identifier[wait_to_write] ()
identifier[self] . identifier[compo... | def write(self, data):
"""Write data to serial port."""
for chunk in chunks(data, 512):
self.wait_to_write()
self.comport.write(chunk) # depends on [control=['for'], data=['chunk']]
self.comport.flush() |
def sort_by_tag(self, tag):
"""Sorts the `AmpalContainer` by a tag on the component objects.
Parameters
----------
tag : str
Key of tag used for sorting.
"""
return AmpalContainer(sorted(self, key=lambda x: x.tags[tag])) | def function[sort_by_tag, parameter[self, tag]]:
constant[Sorts the `AmpalContainer` by a tag on the component objects.
Parameters
----------
tag : str
Key of tag used for sorting.
]
return[call[name[AmpalContainer], parameter[call[name[sorted], parameter[name[se... | keyword[def] identifier[sort_by_tag] ( identifier[self] , identifier[tag] ):
literal[string]
keyword[return] identifier[AmpalContainer] ( identifier[sorted] ( identifier[self] , identifier[key] = keyword[lambda] identifier[x] : identifier[x] . identifier[tags] [ identifier[tag] ])) | def sort_by_tag(self, tag):
"""Sorts the `AmpalContainer` by a tag on the component objects.
Parameters
----------
tag : str
Key of tag used for sorting.
"""
return AmpalContainer(sorted(self, key=lambda x: x.tags[tag])) |
def word(self):
"""
Lazy-loads word value
:getter: Returns the plain string value of the word
:type: str
"""
if self._word is None:
words = self._element.xpath('word/text()')
if len(words) > 0:
self._word = words[0]
return... | def function[word, parameter[self]]:
constant[
Lazy-loads word value
:getter: Returns the plain string value of the word
:type: str
]
if compare[name[self]._word is constant[None]] begin[:]
variable[words] assign[=] call[name[self]._element.xpath, parame... | keyword[def] identifier[word] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[_word] keyword[is] keyword[None] :
identifier[words] = identifier[self] . identifier[_element] . identifier[xpath] ( literal[string] )
keyword[if] identifier[l... | def word(self):
"""
Lazy-loads word value
:getter: Returns the plain string value of the word
:type: str
"""
if self._word is None:
words = self._element.xpath('word/text()')
if len(words) > 0:
self._word = words[0] # depends on [control=['if'], dat... |
def js_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using pure JS. Does not use jQuery. """
selector, by = self.__recalculate_selector(selector, by)
if by == By.LINK_TEXT:
message = (
"Pure JavaScript doesn't support clicking by Link Text. "
... | def function[js_click, parameter[self, selector, by]]:
constant[ Clicks an element using pure JS. Does not use jQuery. ]
<ast.Tuple object at 0x7da1b1bc9c90> assign[=] call[name[self].__recalculate_selector, parameter[name[selector], name[by]]]
if compare[name[by] equal[==] name[By].LINK_TEXT] b... | keyword[def] identifier[js_click] ( identifier[self] , identifier[selector] , identifier[by] = identifier[By] . identifier[CSS_SELECTOR] ):
literal[string]
identifier[selector] , identifier[by] = identifier[self] . identifier[__recalculate_selector] ( identifier[selector] , identifier[by] )
... | def js_click(self, selector, by=By.CSS_SELECTOR):
""" Clicks an element using pure JS. Does not use jQuery. """
(selector, by) = self.__recalculate_selector(selector, by)
if by == By.LINK_TEXT:
message = "Pure JavaScript doesn't support clicking by Link Text. You may want to use self.jquery_click() ... |
def add_book_series(self, title, volume=None):
"""
:param volume: the volume of the book
:type volume: string
:param title: the title of the book
:type title: string
"""
book_series = {}
if title is not None:
book_series['title'] = title
... | def function[add_book_series, parameter[self, title, volume]]:
constant[
:param volume: the volume of the book
:type volume: string
:param title: the title of the book
:type title: string
]
variable[book_series] assign[=] dictionary[[], []]
if compare[nam... | keyword[def] identifier[add_book_series] ( identifier[self] , identifier[title] , identifier[volume] = keyword[None] ):
literal[string]
identifier[book_series] ={}
keyword[if] identifier[title] keyword[is] keyword[not] keyword[None] :
identifier[book_series] [ literal[stri... | def add_book_series(self, title, volume=None):
"""
:param volume: the volume of the book
:type volume: string
:param title: the title of the book
:type title: string
"""
book_series = {}
if title is not None:
book_series['title'] = title # depends on [contro... |
def get_token_obj(self, token, expire=_token_default):
"""Returns or creates the object associaten with the given token.
Parameters
----------
token : string
The token for the object as returned by `create_token`.
expire : number or None
The number of se... | def function[get_token_obj, parameter[self, token, expire]]:
constant[Returns or creates the object associaten with the given token.
Parameters
----------
token : string
The token for the object as returned by `create_token`.
expire : number or None
The ... | keyword[def] identifier[get_token_obj] ( identifier[self] , identifier[token] , identifier[expire] = identifier[_token_default] ):
literal[string]
keyword[if] identifier[expire] == identifier[_token_default] :
identifier[expire] = identifier[self] . identifier[get_default_token_expira... | def get_token_obj(self, token, expire=_token_default):
"""Returns or creates the object associaten with the given token.
Parameters
----------
token : string
The token for the object as returned by `create_token`.
expire : number or None
The number of second... |
def make_chunk(chunk_type, chunk_data):
"""Create a raw chunk by composing chunk type and data. It
calculates chunk length and CRC for you.
:arg str chunk_type: PNG chunk type.
:arg bytes chunk_data: PNG chunk data, **excluding chunk length, type, and CRC**.
:rtype: bytes
"""
out = struct.pack("!I", len(chunk_d... | def function[make_chunk, parameter[chunk_type, chunk_data]]:
constant[Create a raw chunk by composing chunk type and data. It
calculates chunk length and CRC for you.
:arg str chunk_type: PNG chunk type.
:arg bytes chunk_data: PNG chunk data, **excluding chunk length, type, and CRC**.
:rtype: bytes
]
... | keyword[def] identifier[make_chunk] ( identifier[chunk_type] , identifier[chunk_data] ):
literal[string]
identifier[out] = identifier[struct] . identifier[pack] ( literal[string] , identifier[len] ( identifier[chunk_data] ))
identifier[chunk_data] = identifier[chunk_type] . identifier[encode] ( literal[string]... | def make_chunk(chunk_type, chunk_data):
"""Create a raw chunk by composing chunk type and data. It
calculates chunk length and CRC for you.
:arg str chunk_type: PNG chunk type.
:arg bytes chunk_data: PNG chunk data, **excluding chunk length, type, and CRC**.
:rtype: bytes
"""
out = struct.pack('!I', len(c... |
def get_file(self, filename):
"""Get file source from cache"""
import linecache
# Hack for frozen importlib bootstrap
if filename == '<frozen importlib._bootstrap>':
filename = os.path.join(
os.path.dirname(linecache.__file__), 'importlib',
'_b... | def function[get_file, parameter[self, filename]]:
constant[Get file source from cache]
import module[linecache]
if compare[name[filename] equal[==] constant[<frozen importlib._bootstrap>]] begin[:]
variable[filename] assign[=] call[name[os].path.join, parameter[call[name[os].path.di... | keyword[def] identifier[get_file] ( identifier[self] , identifier[filename] ):
literal[string]
keyword[import] identifier[linecache]
keyword[if] identifier[filename] == literal[string] :
identifier[filename] = identifier[os] . identifier[path] . identifier[join] (
... | def get_file(self, filename):
"""Get file source from cache"""
import linecache
# Hack for frozen importlib bootstrap
if filename == '<frozen importlib._bootstrap>':
filename = os.path.join(os.path.dirname(linecache.__file__), 'importlib', '_bootstrap.py') # depends on [control=['if'], data=['f... |
def _get_cubic_root(self):
"""Get the cubic root."""
# We have the equation x^2 D^2 + (1-x)^4 * C / h_min^2
# where x = sqrt(mu).
# We substitute x, which is sqrt(mu), with x = y + 1.
# It gives y^3 + py = q
# where p = (D^2 h_min^2)/(2*C) and q = -p.
# We use the Vieta's substitution to com... | def function[_get_cubic_root, parameter[self]]:
constant[Get the cubic root.]
variable[assert_array] assign[=] list[[<ast.Call object at 0x7da1b2004fa0>, <ast.Call object at 0x7da1b20049a0>, <ast.Call object at 0x7da1b2004e80>, <ast.Call object at 0x7da1b2004be0>, <ast.Call object at 0x7da1b2004820>, <a... | keyword[def] identifier[_get_cubic_root] ( identifier[self] ):
literal[string]
identifier[assert_array] =[
identifier[tf] . identifier[Assert] (
identifier[tf] . identifier[logical_not] ( identifier[tf] . identifier[is_nan] ( identifier[self] . identifier[_... | def _get_cubic_root(self):
"""Get the cubic root."""
# We have the equation x^2 D^2 + (1-x)^4 * C / h_min^2
# where x = sqrt(mu).
# We substitute x, which is sqrt(mu), with x = y + 1.
# It gives y^3 + py = q
# where p = (D^2 h_min^2)/(2*C) and q = -p.
# We use the Vieta's substitution to com... |
def cases(self, owner=None, collaborator=None, query=None, skip_assigned=False,
has_causatives=False, reruns=False, finished=False,
research_requested=False, is_research=False, status=None,
phenotype_terms=False, pinned=False, cohort=False, name_query=None,
yield_... | def function[cases, parameter[self, owner, collaborator, query, skip_assigned, has_causatives, reruns, finished, research_requested, is_research, status, phenotype_terms, pinned, cohort, name_query, yield_query]]:
constant[Fetches all cases from the backend.
Args:
collaborator(str): If coll... | keyword[def] identifier[cases] ( identifier[self] , identifier[owner] = keyword[None] , identifier[collaborator] = keyword[None] , identifier[query] = keyword[None] , identifier[skip_assigned] = keyword[False] ,
identifier[has_causatives] = keyword[False] , identifier[reruns] = keyword[False] , identifier[finished] ... | def cases(self, owner=None, collaborator=None, query=None, skip_assigned=False, has_causatives=False, reruns=False, finished=False, research_requested=False, is_research=False, status=None, phenotype_terms=False, pinned=False, cohort=False, name_query=None, yield_query=False):
"""Fetches all cases from the backend.... |
def get_multi(
self, keys, missing=None, deferred=None, transaction=None, eventual=False
):
"""Retrieve entities, along with their attributes.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be retrieved from the datastore.
:type missing... | def function[get_multi, parameter[self, keys, missing, deferred, transaction, eventual]]:
constant[Retrieve entities, along with their attributes.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be retrieved from the datastore.
:type missing: list
... | keyword[def] identifier[get_multi] (
identifier[self] , identifier[keys] , identifier[missing] = keyword[None] , identifier[deferred] = keyword[None] , identifier[transaction] = keyword[None] , identifier[eventual] = keyword[False]
):
literal[string]
keyword[if] keyword[not] identifier[keys] :
... | def get_multi(self, keys, missing=None, deferred=None, transaction=None, eventual=False):
"""Retrieve entities, along with their attributes.
:type keys: list of :class:`google.cloud.datastore.key.Key`
:param keys: The keys to be retrieved from the datastore.
:type missing: list
:pa... |
def titles(self, key, value):
"""Populate the ``titles`` key."""
if not key.startswith('245'):
return {
'source': value.get('9'),
'subtitle': value.get('b'),
'title': value.get('a'),
}
self.setdefault('titles', []).insert(0, {
'source': value.get(... | def function[titles, parameter[self, key, value]]:
constant[Populate the ``titles`` key.]
if <ast.UnaryOp object at 0x7da18ede4ac0> begin[:]
return[dictionary[[<ast.Constant object at 0x7da18bcc8460>, <ast.Constant object at 0x7da18bcc8e80>, <ast.Constant object at 0x7da18bcc8280>], [<ast.Call o... | keyword[def] identifier[titles] ( identifier[self] , identifier[key] , identifier[value] ):
literal[string]
keyword[if] keyword[not] identifier[key] . identifier[startswith] ( literal[string] ):
keyword[return] {
literal[string] : identifier[value] . identifier[get] ( literal[string] ),... | def titles(self, key, value):
"""Populate the ``titles`` key."""
if not key.startswith('245'):
return {'source': value.get('9'), 'subtitle': value.get('b'), 'title': value.get('a')} # depends on [control=['if'], data=[]]
self.setdefault('titles', []).insert(0, {'source': value.get('9'), 'subtitle':... |
def match_sp_sep(first, second):
"""
Verify that all the values in 'first' appear in 'second'.
The values can either be in the form of lists or as space separated
items.
:param first:
:param second:
:return: True/False
"""
if isinstance(first, list):
one = [set(v.split(" "))... | def function[match_sp_sep, parameter[first, second]]:
constant[
Verify that all the values in 'first' appear in 'second'.
The values can either be in the form of lists or as space separated
items.
:param first:
:param second:
:return: True/False
]
if call[name[isinstance], p... | keyword[def] identifier[match_sp_sep] ( identifier[first] , identifier[second] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[first] , identifier[list] ):
identifier[one] =[ identifier[set] ( identifier[v] . identifier[split] ( literal[string] )) keyword[for] identifier[v] k... | def match_sp_sep(first, second):
"""
Verify that all the values in 'first' appear in 'second'.
The values can either be in the form of lists or as space separated
items.
:param first:
:param second:
:return: True/False
"""
if isinstance(first, list):
one = [set(v.split(' '))... |
def setHighlightColor( self, color ):
"""
Sets the primary color used for highlighting this item.
:param color | <QColor>
"""
self._highlightColor = QColor(color)
self.setAlternateHighlightColor(self._highlightColor.darker(110)) | def function[setHighlightColor, parameter[self, color]]:
constant[
Sets the primary color used for highlighting this item.
:param color | <QColor>
]
name[self]._highlightColor assign[=] call[name[QColor], parameter[name[color]]]
call[name[self].setAlternateH... | keyword[def] identifier[setHighlightColor] ( identifier[self] , identifier[color] ):
literal[string]
identifier[self] . identifier[_highlightColor] = identifier[QColor] ( identifier[color] )
identifier[self] . identifier[setAlternateHighlightColor] ( identifier[self] . identifier[_highl... | def setHighlightColor(self, color):
"""
Sets the primary color used for highlighting this item.
:param color | <QColor>
"""
self._highlightColor = QColor(color)
self.setAlternateHighlightColor(self._highlightColor.darker(110)) |
def resample(self, new_timepoints, extrapolate=False):
"""
Use linear interpolation to resample trajectory values.
The new values are interpolated for the provided time points.
This is generally before comparing or averaging trajectories.
:param new_timepoints: the new time poi... | def function[resample, parameter[self, new_timepoints, extrapolate]]:
constant[
Use linear interpolation to resample trajectory values.
The new values are interpolated for the provided time points.
This is generally before comparing or averaging trajectories.
:param new_timepoin... | keyword[def] identifier[resample] ( identifier[self] , identifier[new_timepoints] , identifier[extrapolate] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[extrapolate] :
keyword[if] identifier[min] ( identifier[self] . identifier[timepoints] )> identifier[m... | def resample(self, new_timepoints, extrapolate=False):
"""
Use linear interpolation to resample trajectory values.
The new values are interpolated for the provided time points.
This is generally before comparing or averaging trajectories.
:param new_timepoints: the new time points
... |
def sim_mlipns(src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS similarity of two strings.
This is a wrapper for :py:meth:`MLIPNS.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
... | def function[sim_mlipns, parameter[src, tar, threshold, max_mismatches]]:
constant[Return the MLIPNS similarity of two strings.
This is a wrapper for :py:meth:`MLIPNS.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
... | keyword[def] identifier[sim_mlipns] ( identifier[src] , identifier[tar] , identifier[threshold] = literal[int] , identifier[max_mismatches] = literal[int] ):
literal[string]
keyword[return] identifier[MLIPNS] (). identifier[sim] ( identifier[src] , identifier[tar] , identifier[threshold] , identifier[max_... | def sim_mlipns(src, tar, threshold=0.25, max_mismatches=2):
"""Return the MLIPNS similarity of two strings.
This is a wrapper for :py:meth:`MLIPNS.sim`.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
threshold : float
... |
def get_resource(self, device_id, resource_path):
"""Get a resource.
:param str device_id: ID of the device (Required)
:param str path: Path of the resource to get (Required)
:returns: Device resource
:rtype Resource
"""
resources = self.list_resources(device_id... | def function[get_resource, parameter[self, device_id, resource_path]]:
constant[Get a resource.
:param str device_id: ID of the device (Required)
:param str path: Path of the resource to get (Required)
:returns: Device resource
:rtype Resource
]
variable[resourc... | keyword[def] identifier[get_resource] ( identifier[self] , identifier[device_id] , identifier[resource_path] ):
literal[string]
identifier[resources] = identifier[self] . identifier[list_resources] ( identifier[device_id] )
keyword[for] identifier[r] keyword[in] identifier[resources] :
... | def get_resource(self, device_id, resource_path):
"""Get a resource.
:param str device_id: ID of the device (Required)
:param str path: Path of the resource to get (Required)
:returns: Device resource
:rtype Resource
"""
resources = self.list_resources(device_id)
fo... |
def ginga_to_matplotlib_cmap(cm, name=None):
"""Convert Ginga colormap to matplotlib's."""
if name is None:
name = cm.name
from matplotlib.colors import ListedColormap
carr = np.asarray(cm.clst)
mpl_cm = ListedColormap(carr, name=name, N=len(carr))
return mpl_cm | def function[ginga_to_matplotlib_cmap, parameter[cm, name]]:
constant[Convert Ginga colormap to matplotlib's.]
if compare[name[name] is constant[None]] begin[:]
variable[name] assign[=] name[cm].name
from relative_module[matplotlib.colors] import module[ListedColormap]
variab... | keyword[def] identifier[ginga_to_matplotlib_cmap] ( identifier[cm] , identifier[name] = keyword[None] ):
literal[string]
keyword[if] identifier[name] keyword[is] keyword[None] :
identifier[name] = identifier[cm] . identifier[name]
keyword[from] identifier[matplotlib] . identifier[colors]... | def ginga_to_matplotlib_cmap(cm, name=None):
"""Convert Ginga colormap to matplotlib's."""
if name is None:
name = cm.name # depends on [control=['if'], data=['name']]
from matplotlib.colors import ListedColormap
carr = np.asarray(cm.clst)
mpl_cm = ListedColormap(carr, name=name, N=len(carr... |
def transform_distance(self, dx, dy):
"""Transforms the distance vector ``(dx, dy)`` by this matrix.
This is similar to :meth:`transform_point`
except that the translation components of the transformation
are ignored.
The calculation of the returned vector is as follows::
... | def function[transform_distance, parameter[self, dx, dy]]:
constant[Transforms the distance vector ``(dx, dy)`` by this matrix.
This is similar to :meth:`transform_point`
except that the translation components of the transformation
are ignored.
The calculation of the returned vec... | keyword[def] identifier[transform_distance] ( identifier[self] , identifier[dx] , identifier[dy] ):
literal[string]
identifier[xy] = identifier[ffi] . identifier[new] ( literal[string] ,[ identifier[dx] , identifier[dy] ])
identifier[cairo] . identifier[cairo_matrix_transform_distance] ( i... | def transform_distance(self, dx, dy):
"""Transforms the distance vector ``(dx, dy)`` by this matrix.
This is similar to :meth:`transform_point`
except that the translation components of the transformation
are ignored.
The calculation of the returned vector is as follows::
... |
def menuconfig(kconf):
"""
Launches the configuration interface, returning after the user exits.
kconf:
Kconfig instance to be configured
"""
global _kconf
global _conf_filename
global _conf_changed
global _minconf_filename
global _show_all
_kconf = kconf
# Load exis... | def function[menuconfig, parameter[kconf]]:
constant[
Launches the configuration interface, returning after the user exits.
kconf:
Kconfig instance to be configured
]
<ast.Global object at 0x7da18f810ee0>
<ast.Global object at 0x7da18f811f90>
<ast.Global object at 0x7da18f8126e0>
... | keyword[def] identifier[menuconfig] ( identifier[kconf] ):
literal[string]
keyword[global] identifier[_kconf]
keyword[global] identifier[_conf_filename]
keyword[global] identifier[_conf_changed]
keyword[global] identifier[_minconf_filename]
keyword[global] identifier[_show_all]... | def menuconfig(kconf):
"""
Launches the configuration interface, returning after the user exits.
kconf:
Kconfig instance to be configured
"""
global _kconf
global _conf_filename
global _conf_changed
global _minconf_filename
global _show_all
_kconf = kconf
# Load existi... |
def longest_path_weighted_nodes(G, source, target, weights=None):
"""
The longest path problem is the problem of finding a simple path of maximum
length in a given graph. While for general graph, this problem is NP-hard,
but if G is a directed acyclic graph (DAG), longest paths in G can be found
in ... | def function[longest_path_weighted_nodes, parameter[G, source, target, weights]]:
constant[
The longest path problem is the problem of finding a simple path of maximum
length in a given graph. While for general graph, this problem is NP-hard,
but if G is a directed acyclic graph (DAG), longest paths... | keyword[def] identifier[longest_path_weighted_nodes] ( identifier[G] , identifier[source] , identifier[target] , identifier[weights] = keyword[None] ):
literal[string]
keyword[assert] identifier[nx] . identifier[is_directed_acyclic_graph] ( identifier[G] )
identifier[tree] = identifier[nx] . identif... | def longest_path_weighted_nodes(G, source, target, weights=None):
"""
The longest path problem is the problem of finding a simple path of maximum
length in a given graph. While for general graph, this problem is NP-hard,
but if G is a directed acyclic graph (DAG), longest paths in G can be found
in ... |
def get_as_boolean(self, key):
"""
Converts map element into a boolean or returns false if conversion is not possible.
:param key: an index of element to get.
:return: boolean value ot the element or false if conversion is not supported.
"""
value = self.get(key)
... | def function[get_as_boolean, parameter[self, key]]:
constant[
Converts map element into a boolean or returns false if conversion is not possible.
:param key: an index of element to get.
:return: boolean value ot the element or false if conversion is not supported.
]
var... | keyword[def] identifier[get_as_boolean] ( identifier[self] , identifier[key] ):
literal[string]
identifier[value] = identifier[self] . identifier[get] ( identifier[key] )
keyword[return] identifier[BooleanConverter] . identifier[to_boolean] ( identifier[value] ) | def get_as_boolean(self, key):
"""
Converts map element into a boolean or returns false if conversion is not possible.
:param key: an index of element to get.
:return: boolean value ot the element or false if conversion is not supported.
"""
value = self.get(key)
return Boo... |
def inkscape_export(input_file, output_file, export_flag="-A", dpi=90, inkscape_binpath=None):
""" Call Inkscape to export the input_file to output_file using the
specific export argument flag for the output file type.
Parameters
----------
input_file: str
Path to the input file
outpu... | def function[inkscape_export, parameter[input_file, output_file, export_flag, dpi, inkscape_binpath]]:
constant[ Call Inkscape to export the input_file to output_file using the
specific export argument flag for the output file type.
Parameters
----------
input_file: str
Path to the inp... | keyword[def] identifier[inkscape_export] ( identifier[input_file] , identifier[output_file] , identifier[export_flag] = literal[string] , identifier[dpi] = literal[int] , identifier[inkscape_binpath] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[os] . identifier[path] . identifie... | def inkscape_export(input_file, output_file, export_flag='-A', dpi=90, inkscape_binpath=None):
""" Call Inkscape to export the input_file to output_file using the
specific export argument flag for the output file type.
Parameters
----------
input_file: str
Path to the input file
outpu... |
def _add_to_tbz(tfile, filename, data_str):
'''
Adds string data to a tarfile
'''
# Create a bytesio object for adding to a tarfile
# https://stackoverflow.com/a/52724508
encoded_data = data_str.encode('utf-8')
ti = tarfile.TarInfo(name=filename)
ti.size = len(encoded_data)
tfile.ad... | def function[_add_to_tbz, parameter[tfile, filename, data_str]]:
constant[
Adds string data to a tarfile
]
variable[encoded_data] assign[=] call[name[data_str].encode, parameter[constant[utf-8]]]
variable[ti] assign[=] call[name[tarfile].TarInfo, parameter[]]
name[ti].size assign... | keyword[def] identifier[_add_to_tbz] ( identifier[tfile] , identifier[filename] , identifier[data_str] ):
literal[string]
identifier[encoded_data] = identifier[data_str] . identifier[encode] ( literal[string] )
identifier[ti] = identifier[tarfile] . identifier[TarInfo] ( identifier[name] = ... | def _add_to_tbz(tfile, filename, data_str):
"""
Adds string data to a tarfile
"""
# Create a bytesio object for adding to a tarfile
# https://stackoverflow.com/a/52724508
encoded_data = data_str.encode('utf-8')
ti = tarfile.TarInfo(name=filename)
ti.size = len(encoded_data)
tfile.add... |
def _ConvertParamType(self, paramType):
"""
Convert vmodl.reflect.DynamicTypeManager.ParamTypeInfo to pyVmomi param
definition
"""
if paramType:
name = paramType.name
version = paramType.version
aType = paramType.type
flags = self._ConvertAnnotations(par... | def function[_ConvertParamType, parameter[self, paramType]]:
constant[
Convert vmodl.reflect.DynamicTypeManager.ParamTypeInfo to pyVmomi param
definition
]
if name[paramType] begin[:]
variable[name] assign[=] name[paramType].name
variable[version] assign... | keyword[def] identifier[_ConvertParamType] ( identifier[self] , identifier[paramType] ):
literal[string]
keyword[if] identifier[paramType] :
identifier[name] = identifier[paramType] . identifier[name]
identifier[version] = identifier[paramType] . identifier[version]
ide... | def _ConvertParamType(self, paramType):
"""
Convert vmodl.reflect.DynamicTypeManager.ParamTypeInfo to pyVmomi param
definition
"""
if paramType:
name = paramType.name
version = paramType.version
aType = paramType.type
flags = self._ConvertAnnotations(paramType.a... |
def _augment_info(info):
"""Fill out the template information"""
info['description_header'] = "=" * len(info['description'])
info['component_name'] = info['plugin_name'].capitalize()
info['year'] = time.localtime().tm_year
info['license_longtext'] = ''
info['keyword_list'] = u""
for keywor... | def function[_augment_info, parameter[info]]:
constant[Fill out the template information]
call[name[info]][constant[description_header]] assign[=] binary_operation[constant[=] * call[name[len], parameter[call[name[info]][constant[description]]]]]
call[name[info]][constant[component_name]] assign... | keyword[def] identifier[_augment_info] ( identifier[info] ):
literal[string]
identifier[info] [ literal[string] ]= literal[string] * identifier[len] ( identifier[info] [ literal[string] ])
identifier[info] [ literal[string] ]= identifier[info] [ literal[string] ]. identifier[capitalize] ()
ident... | def _augment_info(info):
"""Fill out the template information"""
info['description_header'] = '=' * len(info['description'])
info['component_name'] = info['plugin_name'].capitalize()
info['year'] = time.localtime().tm_year
info['license_longtext'] = ''
info['keyword_list'] = u''
for keyword ... |
def get_filestore_instance(img_dir=None, data_dir=None):
"""Return an instance of FileStore."""
global _filestore_instances
key = "%s:%s" % (img_dir, data_dir)
try:
instance = _filestore_instances[key]
except KeyError:
instance = FileStore(
img_dir=img_dir, data_dir=dat... | def function[get_filestore_instance, parameter[img_dir, data_dir]]:
constant[Return an instance of FileStore.]
<ast.Global object at 0x7da20c991900>
variable[key] assign[=] binary_operation[constant[%s:%s] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Name object at 0x7da20c992110>, <ast.Name objec... | keyword[def] identifier[get_filestore_instance] ( identifier[img_dir] = keyword[None] , identifier[data_dir] = keyword[None] ):
literal[string]
keyword[global] identifier[_filestore_instances]
identifier[key] = literal[string] %( identifier[img_dir] , identifier[data_dir] )
keyword[try] :
... | def get_filestore_instance(img_dir=None, data_dir=None):
"""Return an instance of FileStore."""
global _filestore_instances
key = '%s:%s' % (img_dir, data_dir)
try:
instance = _filestore_instances[key] # depends on [control=['try'], data=[]]
except KeyError:
instance = FileStore(img... |
def extend(self, base, key, value=None):
"""
Adds a new definition to this enumerated type, extending the given
base type. This will create a new key for the type and register
it as a new viable option from the system, however, it will also
register its base information so you c... | def function[extend, parameter[self, base, key, value]]:
constant[
Adds a new definition to this enumerated type, extending the given
base type. This will create a new key for the type and register
it as a new viable option from the system, however, it will also
register its bas... | keyword[def] identifier[extend] ( identifier[self] , identifier[base] , identifier[key] , identifier[value] = keyword[None] ):
literal[string]
identifier[new_val] = identifier[self] . identifier[add] ( identifier[key] , identifier[value] )
identifier[self] . identifier[_bases] [ identifier... | def extend(self, base, key, value=None):
"""
Adds a new definition to this enumerated type, extending the given
base type. This will create a new key for the type and register
it as a new viable option from the system, however, it will also
register its base information so you can u... |
def wikidata_get(identifier):
"""
https://www.wikidata.org/wiki/Special:EntityData/P248.json
"""
url = 'https://www.wikidata.org/wiki/Special:EntityData/{}.json'.format(identifier)
#logging.info(url)
return json.loads(requests.get(url).content) | def function[wikidata_get, parameter[identifier]]:
constant[
https://www.wikidata.org/wiki/Special:EntityData/P248.json
]
variable[url] assign[=] call[constant[https://www.wikidata.org/wiki/Special:EntityData/{}.json].format, parameter[name[identifier]]]
return[call[name[json].loads, par... | keyword[def] identifier[wikidata_get] ( identifier[identifier] ):
literal[string]
identifier[url] = literal[string] . identifier[format] ( identifier[identifier] )
keyword[return] identifier[json] . identifier[loads] ( identifier[requests] . identifier[get] ( identifier[url] ). identifier[conten... | def wikidata_get(identifier):
"""
https://www.wikidata.org/wiki/Special:EntityData/P248.json
"""
url = 'https://www.wikidata.org/wiki/Special:EntityData/{}.json'.format(identifier)
#logging.info(url)
return json.loads(requests.get(url).content) |
def get_rank():
"""
Gets distributed rank or returns zero if distributed is not initialized.
"""
if torch.distributed.is_available() and torch.distributed.is_initialized():
rank = torch.distributed.get_rank()
else:
rank = 0
return rank | def function[get_rank, parameter[]]:
constant[
Gets distributed rank or returns zero if distributed is not initialized.
]
if <ast.BoolOp object at 0x7da2054a7010> begin[:]
variable[rank] assign[=] call[name[torch].distributed.get_rank, parameter[]]
return[name[rank]] | keyword[def] identifier[get_rank] ():
literal[string]
keyword[if] identifier[torch] . identifier[distributed] . identifier[is_available] () keyword[and] identifier[torch] . identifier[distributed] . identifier[is_initialized] ():
identifier[rank] = identifier[torch] . identifier[distributed] . i... | def get_rank():
"""
Gets distributed rank or returns zero if distributed is not initialized.
"""
if torch.distributed.is_available() and torch.distributed.is_initialized():
rank = torch.distributed.get_rank() # depends on [control=['if'], data=[]]
else:
rank = 0
return rank |
def create_multidim_plot(parameters, samples, labels=None,
mins=None, maxs=None, expected_parameters=None,
expected_parameters_color='r',
plot_marginal=True, plot_scatter=True,
marginal_percentiles=None, contour_percenti... | def function[create_multidim_plot, parameter[parameters, samples, labels, mins, maxs, expected_parameters, expected_parameters_color, plot_marginal, plot_scatter, marginal_percentiles, contour_percentiles, marginal_title, marginal_linestyle, zvals, show_colorbar, cbar_label, vmin, vmax, scatter_cmap, plot_density, plot... | keyword[def] identifier[create_multidim_plot] ( identifier[parameters] , identifier[samples] , identifier[labels] = keyword[None] ,
identifier[mins] = keyword[None] , identifier[maxs] = keyword[None] , identifier[expected_parameters] = keyword[None] ,
identifier[expected_parameters_color] = literal[string] ,
ident... | def create_multidim_plot(parameters, samples, labels=None, mins=None, maxs=None, expected_parameters=None, expected_parameters_color='r', plot_marginal=True, plot_scatter=True, marginal_percentiles=None, contour_percentiles=None, marginal_title=True, marginal_linestyle='-', zvals=None, show_colorbar=True, cbar_label=No... |
def get_total_degree_day_too_low_warning(
model_type,
balance_point,
degree_day_type,
avg_degree_days,
period_days,
minimum_total,
):
""" Return an empty list or a single warning wrapped in a list regarding
the total summed degree day values.
Parameters
----------
model_type... | def function[get_total_degree_day_too_low_warning, parameter[model_type, balance_point, degree_day_type, avg_degree_days, period_days, minimum_total]]:
constant[ Return an empty list or a single warning wrapped in a list regarding
the total summed degree day values.
Parameters
----------
model_... | keyword[def] identifier[get_total_degree_day_too_low_warning] (
identifier[model_type] ,
identifier[balance_point] ,
identifier[degree_day_type] ,
identifier[avg_degree_days] ,
identifier[period_days] ,
identifier[minimum_total] ,
):
literal[string]
identifier[warnings] =[]
identifier[total_deg... | def get_total_degree_day_too_low_warning(model_type, balance_point, degree_day_type, avg_degree_days, period_days, minimum_total):
""" Return an empty list or a single warning wrapped in a list regarding
the total summed degree day values.
Parameters
----------
model_type : :any:`str`
Model... |
def get_track_info(track_id):
"""
Fetches track info from Soundcloud, given a track_id
"""
logger.info('Retrieving more info on the track')
info_url = url["trackinfo"].format(track_id)
r = requests.get(info_url, params={'client_id': CLIENT_ID}, stream=True)
item = r.json()
logger.debug(i... | def function[get_track_info, parameter[track_id]]:
constant[
Fetches track info from Soundcloud, given a track_id
]
call[name[logger].info, parameter[constant[Retrieving more info on the track]]]
variable[info_url] assign[=] call[call[name[url]][constant[trackinfo]].format, parameter[nam... | keyword[def] identifier[get_track_info] ( identifier[track_id] ):
literal[string]
identifier[logger] . identifier[info] ( literal[string] )
identifier[info_url] = identifier[url] [ literal[string] ]. identifier[format] ( identifier[track_id] )
identifier[r] = identifier[requests] . identifier[get... | def get_track_info(track_id):
"""
Fetches track info from Soundcloud, given a track_id
"""
logger.info('Retrieving more info on the track')
info_url = url['trackinfo'].format(track_id)
r = requests.get(info_url, params={'client_id': CLIENT_ID}, stream=True)
item = r.json()
logger.debug(i... |
def _start_priority_containers(self, groups, group_orders, tool_d):
""" Select containers based on priorities to start """
vent_cfg = Template(self.path_dirs.cfg_file)
cfg_groups = vent_cfg.option('groups', 'start_order')
if cfg_groups[0]:
cfg_groups = cfg_groups[1].split(','... | def function[_start_priority_containers, parameter[self, groups, group_orders, tool_d]]:
constant[ Select containers based on priorities to start ]
variable[vent_cfg] assign[=] call[name[Template], parameter[name[self].path_dirs.cfg_file]]
variable[cfg_groups] assign[=] call[name[vent_cfg].optio... | keyword[def] identifier[_start_priority_containers] ( identifier[self] , identifier[groups] , identifier[group_orders] , identifier[tool_d] ):
literal[string]
identifier[vent_cfg] = identifier[Template] ( identifier[self] . identifier[path_dirs] . identifier[cfg_file] )
identifier[cfg_grou... | def _start_priority_containers(self, groups, group_orders, tool_d):
""" Select containers based on priorities to start """
vent_cfg = Template(self.path_dirs.cfg_file)
cfg_groups = vent_cfg.option('groups', 'start_order')
if cfg_groups[0]:
cfg_groups = cfg_groups[1].split(',') # depends on [con... |
def chromsizes(self, uid):
"""
Return the chromosome sizes from the given filename
"""
url = "http://{host}:{port}/api/v1/chrom-sizes/?id={uid}".format(
host=self.host, port=self.port, uid=uid
)
req = requests.get(url)
if req.status_code != 200:
... | def function[chromsizes, parameter[self, uid]]:
constant[
Return the chromosome sizes from the given filename
]
variable[url] assign[=] call[constant[http://{host}:{port}/api/v1/chrom-sizes/?id={uid}].format, parameter[]]
variable[req] assign[=] call[name[requests].get, parameter... | keyword[def] identifier[chromsizes] ( identifier[self] , identifier[uid] ):
literal[string]
identifier[url] = literal[string] . identifier[format] (
identifier[host] = identifier[self] . identifier[host] , identifier[port] = identifier[self] . identifier[port] , identifier[uid] = identifie... | def chromsizes(self, uid):
"""
Return the chromosome sizes from the given filename
"""
url = 'http://{host}:{port}/api/v1/chrom-sizes/?id={uid}'.format(host=self.host, port=self.port, uid=uid)
req = requests.get(url)
if req.status_code != 200:
raise ServerError('Error fetching ch... |
def build_application(conf):
"""Do some setup and return the wsgi app."""
if isinstance(conf.adapter_options, list):
conf['adapter_options'] = {key: val for _dict in conf.adapter_options
for key, val in _dict.items()}
elif conf.adapter_options is None:
conf... | def function[build_application, parameter[conf]]:
constant[Do some setup and return the wsgi app.]
if call[name[isinstance], parameter[name[conf].adapter_options, name[list]]] begin[:]
call[name[conf]][constant[adapter_options]] assign[=] <ast.DictComp object at 0x7da1b09e8fa0>
c... | keyword[def] identifier[build_application] ( identifier[conf] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[conf] . identifier[adapter_options] , identifier[list] ):
identifier[conf] [ literal[string] ]={ identifier[key] : identifier[val] keyword[for] identifier[_dict] key... | def build_application(conf):
"""Do some setup and return the wsgi app."""
if isinstance(conf.adapter_options, list):
conf['adapter_options'] = {key: val for _dict in conf.adapter_options for (key, val) in _dict.items()} # depends on [control=['if'], data=[]]
elif conf.adapter_options is None:
... |
def get_access_bits(self, c1, c2, c3):
"""
Calculates the access bits for a sector trailer based on their access conditions
c1, c2, c3, c4 are 4 items tuples containing the values for each block
returns the 3 bytes for the sector trailer
"""
byte_6 = ((~c2[3] & 1) << 7) +... | def function[get_access_bits, parameter[self, c1, c2, c3]]:
constant[
Calculates the access bits for a sector trailer based on their access conditions
c1, c2, c3, c4 are 4 items tuples containing the values for each block
returns the 3 bytes for the sector trailer
]
varia... | keyword[def] identifier[get_access_bits] ( identifier[self] , identifier[c1] , identifier[c2] , identifier[c3] ):
literal[string]
identifier[byte_6] =((~ identifier[c2] [ literal[int] ]& literal[int] )<< literal[int] )+((~ identifier[c2] [ literal[int] ]& literal[int] )<< literal[int] )+((~ identif... | def get_access_bits(self, c1, c2, c3):
"""
Calculates the access bits for a sector trailer based on their access conditions
c1, c2, c3, c4 are 4 items tuples containing the values for each block
returns the 3 bytes for the sector trailer
"""
byte_6 = ((~c2[3] & 1) << 7) + ((~c2[2... |
def match(self, s):
""" Matching the pattern to the input string, returns True/False and
saves the matched string in the internal list
"""
if self.re.match(s):
self.list.append(s)
return True
else: return False | def function[match, parameter[self, s]]:
constant[ Matching the pattern to the input string, returns True/False and
saves the matched string in the internal list
]
if call[name[self].re.match, parameter[name[s]]] begin[:]
call[name[self].list.append, parameter[name[s]]]
... | keyword[def] identifier[match] ( identifier[self] , identifier[s] ):
literal[string]
keyword[if] identifier[self] . identifier[re] . identifier[match] ( identifier[s] ):
identifier[self] . identifier[list] . identifier[append] ( identifier[s] )
keyword[return] keyword[True]
... | def match(self, s):
""" Matching the pattern to the input string, returns True/False and
saves the matched string in the internal list
"""
if self.re.match(s):
self.list.append(s)
return True # depends on [control=['if'], data=[]]
else:
return False |
def lat_lon_grid_spacing(longitude, latitude, **kwargs):
r"""Calculate the distance between grid points that are in a latitude/longitude format.
Calculate the distance between grid points when the grid spacing is defined by
delta lat/lon rather than delta x/y
Parameters
----------
longitude : ... | def function[lat_lon_grid_spacing, parameter[longitude, latitude]]:
constant[Calculate the distance between grid points that are in a latitude/longitude format.
Calculate the distance between grid points when the grid spacing is defined by
delta lat/lon rather than delta x/y
Parameters
-------... | keyword[def] identifier[lat_lon_grid_spacing] ( identifier[longitude] , identifier[latitude] ,** identifier[kwargs] ):
literal[string]
identifier[dx] , identifier[dy] = identifier[lat_lon_grid_deltas] ( identifier[longitude] , identifier[latitude] ,** identifier[kwargs] )
keyword[return] identi... | def lat_lon_grid_spacing(longitude, latitude, **kwargs):
"""Calculate the distance between grid points that are in a latitude/longitude format.
Calculate the distance between grid points when the grid spacing is defined by
delta lat/lon rather than delta x/y
Parameters
----------
longitude : a... |
def load_plugins(self, directory):
"""
Loads plugins from the specified directory.
`directory` is the full path to a directory containing python modules
which each contain a subclass of the Plugin class.
There is no criteria for a valid plugin at this level - any python
... | def function[load_plugins, parameter[self, directory]]:
constant[
Loads plugins from the specified directory.
`directory` is the full path to a directory containing python modules
which each contain a subclass of the Plugin class.
There is no criteria for a valid plugin at this... | keyword[def] identifier[load_plugins] ( identifier[self] , identifier[directory] ):
literal[string]
keyword[for] identifier[filename] keyword[in] identifier[os] . identifier[listdir] ( identifier[directory] ):
identifier[filepath] = identifier[os] . identifier[path... | def load_plugins(self, directory):
"""
Loads plugins from the specified directory.
`directory` is the full path to a directory containing python modules
which each contain a subclass of the Plugin class.
There is no criteria for a valid plugin at this level - any python
mod... |
def get_data(self):
"""Returns the x, y, w, h, data as a tuple."""
return self.x, self.y, self.w, self.h | def function[get_data, parameter[self]]:
constant[Returns the x, y, w, h, data as a tuple.]
return[tuple[[<ast.Attribute object at 0x7da1b2592a10>, <ast.Attribute object at 0x7da1b2590f10>, <ast.Attribute object at 0x7da1b2592cb0>, <ast.Attribute object at 0x7da1b2590340>]]] | keyword[def] identifier[get_data] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[x] , identifier[self] . identifier[y] , identifier[self] . identifier[w] , identifier[self] . identifier[h] | def get_data(self):
"""Returns the x, y, w, h, data as a tuple."""
return (self.x, self.y, self.w, self.h) |
def _change_soi(self, body):
"""Modify the inner parameters of the Kepler propagator in order to place
the spacecraft in the right Sphere of Influence
"""
if body == self.central:
self.bodies = [self.central]
self.step = self.central_step
self.active ... | def function[_change_soi, parameter[self, body]]:
constant[Modify the inner parameters of the Kepler propagator in order to place
the spacecraft in the right Sphere of Influence
]
if compare[name[body] equal[==] name[self].central] begin[:]
name[self].bodies assign[=] lis... | keyword[def] identifier[_change_soi] ( identifier[self] , identifier[body] ):
literal[string]
keyword[if] identifier[body] == identifier[self] . identifier[central] :
identifier[self] . identifier[bodies] =[ identifier[self] . identifier[central] ]
identifier[self] . ide... | def _change_soi(self, body):
"""Modify the inner parameters of the Kepler propagator in order to place
the spacecraft in the right Sphere of Influence
"""
if body == self.central:
self.bodies = [self.central]
self.step = self.central_step
self.active = self.central.name
... |
def outline(dataset, generate_faces=False):
"""Produces an outline of the full extent for the input dataset.
Parameters
----------
generate_faces : bool, optional
Generate solid faces for the box. This is off by default
"""
alg = vtk.vtkOutlineFilter()
... | def function[outline, parameter[dataset, generate_faces]]:
constant[Produces an outline of the full extent for the input dataset.
Parameters
----------
generate_faces : bool, optional
Generate solid faces for the box. This is off by default
]
variable[alg] a... | keyword[def] identifier[outline] ( identifier[dataset] , identifier[generate_faces] = keyword[False] ):
literal[string]
identifier[alg] = identifier[vtk] . identifier[vtkOutlineFilter] ()
identifier[alg] . identifier[SetInputDataObject] ( identifier[dataset] )
identifier[alg] . id... | def outline(dataset, generate_faces=False):
"""Produces an outline of the full extent for the input dataset.
Parameters
----------
generate_faces : bool, optional
Generate solid faces for the box. This is off by default
"""
alg = vtk.vtkOutlineFilter()
alg.SetIn... |
def save(self):
"""Convert to JSON.
Returns
-------
`dict`
JSON data.
"""
data = super().save()
data['end_chars'] = self.end_chars
data['default_end'] = self.default_end
return data | def function[save, parameter[self]]:
constant[Convert to JSON.
Returns
-------
`dict`
JSON data.
]
variable[data] assign[=] call[call[name[super], parameter[]].save, parameter[]]
call[name[data]][constant[end_chars]] assign[=] name[self].end_chars
... | keyword[def] identifier[save] ( identifier[self] ):
literal[string]
identifier[data] = identifier[super] (). identifier[save] ()
identifier[data] [ literal[string] ]= identifier[self] . identifier[end_chars]
identifier[data] [ literal[string] ]= identifier[self] . identifier[defa... | def save(self):
"""Convert to JSON.
Returns
-------
`dict`
JSON data.
"""
data = super().save()
data['end_chars'] = self.end_chars
data['default_end'] = self.default_end
return data |
def _check_pcre_minions(self, expr, greedy): # pylint: disable=unused-argument
'''
Return the minions found by looking via regular expressions
'''
reg = re.compile(expr)
return {'minions': [m for m in self._pki_minions() if reg.match(m)],
'missing': []} | def function[_check_pcre_minions, parameter[self, expr, greedy]]:
constant[
Return the minions found by looking via regular expressions
]
variable[reg] assign[=] call[name[re].compile, parameter[name[expr]]]
return[dictionary[[<ast.Constant object at 0x7da1b2197730>, <ast.Constant ob... | keyword[def] identifier[_check_pcre_minions] ( identifier[self] , identifier[expr] , identifier[greedy] ):
literal[string]
identifier[reg] = identifier[re] . identifier[compile] ( identifier[expr] )
keyword[return] { literal[string] :[ identifier[m] keyword[for] identifier[m] keyword[in... | def _check_pcre_minions(self, expr, greedy): # pylint: disable=unused-argument
'\n Return the minions found by looking via regular expressions\n '
reg = re.compile(expr)
return {'minions': [m for m in self._pki_minions() if reg.match(m)], 'missing': []} |
def wait_for_job(self, job, interval=5, timeout=60):
"""
Waits until the job indicated by job_resource is done or has failed
Parameters
----------
job : Union[dict, str]
``dict`` representing a BigQuery job resource, or a ``str``
representing the BigQuery... | def function[wait_for_job, parameter[self, job, interval, timeout]]:
constant[
Waits until the job indicated by job_resource is done or has failed
Parameters
----------
job : Union[dict, str]
``dict`` representing a BigQuery job resource, or a ``str``
rep... | keyword[def] identifier[wait_for_job] ( identifier[self] , identifier[job] , identifier[interval] = literal[int] , identifier[timeout] = literal[int] ):
literal[string]
identifier[complete] = keyword[False]
identifier[job_id] = identifier[str] ( identifier[job] keyword[if] identifier[is... | def wait_for_job(self, job, interval=5, timeout=60):
"""
Waits until the job indicated by job_resource is done or has failed
Parameters
----------
job : Union[dict, str]
``dict`` representing a BigQuery job resource, or a ``str``
representing the BigQuery job... |
def __create_proj_mat(self, size):
"""Create a random projection matrix
[1] D. Achlioptas. Database-friendly random projections: Johnson-Lindenstrauss with binary coins.
[2] P. Li, et al. Very sparse random projections.
http://scikit-learn.org/stable/modules/random_projection.html#spar... | def function[__create_proj_mat, parameter[self, size]]:
constant[Create a random projection matrix
[1] D. Achlioptas. Database-friendly random projections: Johnson-Lindenstrauss with binary coins.
[2] P. Li, et al. Very sparse random projections.
http://scikit-learn.org/stable/modules/... | keyword[def] identifier[__create_proj_mat] ( identifier[self] , identifier[size] ):
literal[string]
identifier[s] = literal[int] / identifier[self] . identifier[density]
keyword[return] identifier[np] . identifier[random] . identifier[choice] ([- identifier[n... | def __create_proj_mat(self, size):
"""Create a random projection matrix
[1] D. Achlioptas. Database-friendly random projections: Johnson-Lindenstrauss with binary coins.
[2] P. Li, et al. Very sparse random projections.
http://scikit-learn.org/stable/modules/random_projection.html#sparse-r... |
def _recv_flow_ok(self, method_frame):
'''
Receive a flow control ack from the broker.
'''
self.channel._active = method_frame.args.read_bit()
if self._flow_control_cb is not None:
self._flow_control_cb() | def function[_recv_flow_ok, parameter[self, method_frame]]:
constant[
Receive a flow control ack from the broker.
]
name[self].channel._active assign[=] call[name[method_frame].args.read_bit, parameter[]]
if compare[name[self]._flow_control_cb is_not constant[None]] begin[:]
... | keyword[def] identifier[_recv_flow_ok] ( identifier[self] , identifier[method_frame] ):
literal[string]
identifier[self] . identifier[channel] . identifier[_active] = identifier[method_frame] . identifier[args] . identifier[read_bit] ()
keyword[if] identifier[self] . identifier[_flow_cont... | def _recv_flow_ok(self, method_frame):
"""
Receive a flow control ack from the broker.
"""
self.channel._active = method_frame.args.read_bit()
if self._flow_control_cb is not None:
self._flow_control_cb() # depends on [control=['if'], data=[]] |
def process_blast(
blast_dir,
org_lengths,
fraglengths=None,
mode="ANIb",
identity=0.3,
coverage=0.7,
logger=None,
):
"""Returns a tuple of ANIb results for .blast_tab files in the output dir.
- blast_dir - path to the directory containing .blast_tab files
- org_lengths - the ba... | def function[process_blast, parameter[blast_dir, org_lengths, fraglengths, mode, identity, coverage, logger]]:
constant[Returns a tuple of ANIb results for .blast_tab files in the output dir.
- blast_dir - path to the directory containing .blast_tab files
- org_lengths - the base count for each input s... | keyword[def] identifier[process_blast] (
identifier[blast_dir] ,
identifier[org_lengths] ,
identifier[fraglengths] = keyword[None] ,
identifier[mode] = literal[string] ,
identifier[identity] = literal[int] ,
identifier[coverage] = literal[int] ,
identifier[logger] = keyword[None] ,
):
literal[string]
... | def process_blast(blast_dir, org_lengths, fraglengths=None, mode='ANIb', identity=0.3, coverage=0.7, logger=None):
"""Returns a tuple of ANIb results for .blast_tab files in the output dir.
- blast_dir - path to the directory containing .blast_tab files
- org_lengths - the base count for each input sequenc... |
async def replace_keys_start(wallet_handle: int,
did: str,
identity_json: str) -> str:
"""
Generated new keys (signing and encryption keys) for an existing
DID (owned by the caller of the library).
:param wallet_handle: wallet handler (created b... | <ast.AsyncFunctionDef object at 0x7da207f03280> | keyword[async] keyword[def] identifier[replace_keys_start] ( identifier[wallet_handle] : identifier[int] ,
identifier[did] : identifier[str] ,
identifier[identity_json] : identifier[str] )-> identifier[str] :
literal[string]
identifier[logger] = identifier[logging] . identifier[getLogger] ( identifier[... | async def replace_keys_start(wallet_handle: int, did: str, identity_json: str) -> str:
"""
Generated new keys (signing and encryption keys) for an existing
DID (owned by the caller of the library).
:param wallet_handle: wallet handler (created by open_wallet).
:param did: signing DID
:param ide... |
def _should_sign_response_header(header_name):
"""
:type header_name: str
:rtype: bool
"""
if header_name == _HEADER_SERVER_SIGNATURE:
return False
if re.match(_PATTERN_HEADER_PREFIX_BUNQ, header_name):
return True
return False | def function[_should_sign_response_header, parameter[header_name]]:
constant[
:type header_name: str
:rtype: bool
]
if compare[name[header_name] equal[==] name[_HEADER_SERVER_SIGNATURE]] begin[:]
return[constant[False]]
if call[name[re].match, parameter[name[_PATTERN_HEADER_... | keyword[def] identifier[_should_sign_response_header] ( identifier[header_name] ):
literal[string]
keyword[if] identifier[header_name] == identifier[_HEADER_SERVER_SIGNATURE] :
keyword[return] keyword[False]
keyword[if] identifier[re] . identifier[match] ( identifier[_PATTERN_HEADER_PRE... | def _should_sign_response_header(header_name):
"""
:type header_name: str
:rtype: bool
"""
if header_name == _HEADER_SERVER_SIGNATURE:
return False # depends on [control=['if'], data=[]]
if re.match(_PATTERN_HEADER_PREFIX_BUNQ, header_name):
return True # depends on [control=[... |
def check_pool(self, name):
'''
Check to see if a pool exists
'''
pools = self.bigIP.LocalLB.Pool
for pool in pools.get_list():
if pool.split('/')[-1] == name:
return True
return False | def function[check_pool, parameter[self, name]]:
constant[
Check to see if a pool exists
]
variable[pools] assign[=] name[self].bigIP.LocalLB.Pool
for taget[name[pool]] in starred[call[name[pools].get_list, parameter[]]] begin[:]
if compare[call[call[name[pool].sp... | keyword[def] identifier[check_pool] ( identifier[self] , identifier[name] ):
literal[string]
identifier[pools] = identifier[self] . identifier[bigIP] . identifier[LocalLB] . identifier[Pool]
keyword[for] identifier[pool] keyword[in] identifier[pools] . identifier[get_list] ():
... | def check_pool(self, name):
"""
Check to see if a pool exists
"""
pools = self.bigIP.LocalLB.Pool
for pool in pools.get_list():
if pool.split('/')[-1] == name:
return True # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['pool']]
return Fa... |
def indent (text, indent_string=" "):
"""Indent each line of text with the given indent string."""
lines = str(text).splitlines()
return os.linesep.join("%s%s" % (indent_string, x) for x in lines) | def function[indent, parameter[text, indent_string]]:
constant[Indent each line of text with the given indent string.]
variable[lines] assign[=] call[call[name[str], parameter[name[text]]].splitlines, parameter[]]
return[call[name[os].linesep.join, parameter[<ast.GeneratorExp object at 0x7da18f72223... | keyword[def] identifier[indent] ( identifier[text] , identifier[indent_string] = literal[string] ):
literal[string]
identifier[lines] = identifier[str] ( identifier[text] ). identifier[splitlines] ()
keyword[return] identifier[os] . identifier[linesep] . identifier[join] ( literal[string] %( identifi... | def indent(text, indent_string=' '):
"""Indent each line of text with the given indent string."""
lines = str(text).splitlines()
return os.linesep.join(('%s%s' % (indent_string, x) for x in lines)) |
def build(self):
"""Build single DNA strand along z-axis, starting with P on x-axis"""
ang_per_res = (2 * numpy.pi) / self.nucleotides_per_turn
atom_offset_coords = _backbone_properties[self.helix_type]['atoms']
if self.handedness == 'l':
handedness = -1
else:
... | def function[build, parameter[self]]:
constant[Build single DNA strand along z-axis, starting with P on x-axis]
variable[ang_per_res] assign[=] binary_operation[binary_operation[constant[2] * name[numpy].pi] / name[self].nucleotides_per_turn]
variable[atom_offset_coords] assign[=] call[call[name... | keyword[def] identifier[build] ( identifier[self] ):
literal[string]
identifier[ang_per_res] =( literal[int] * identifier[numpy] . identifier[pi] )/ identifier[self] . identifier[nucleotides_per_turn]
identifier[atom_offset_coords] = identifier[_backbone_properties] [ identifier[self] . i... | def build(self):
"""Build single DNA strand along z-axis, starting with P on x-axis"""
ang_per_res = 2 * numpy.pi / self.nucleotides_per_turn
atom_offset_coords = _backbone_properties[self.helix_type]['atoms']
if self.handedness == 'l':
handedness = -1 # depends on [control=['if'], data=[]]
... |
def _geom_series_uint32(r, n):
"""Unsigned integer calculation of sum of geometric series:
1 + r + r^2 + r^3 + ... r^(n-1)
summed to n terms.
Calculated modulo 2**32.
Use the formula (r**n - 1) / (r - 1)
"""
if n == 0:
return 0
if n == 1 or r == 0:
return 1
m = 2**32
... | def function[_geom_series_uint32, parameter[r, n]]:
constant[Unsigned integer calculation of sum of geometric series:
1 + r + r^2 + r^3 + ... r^(n-1)
summed to n terms.
Calculated modulo 2**32.
Use the formula (r**n - 1) / (r - 1)
]
if compare[name[n] equal[==] constant[0]] begin[:]
... | keyword[def] identifier[_geom_series_uint32] ( identifier[r] , identifier[n] ):
literal[string]
keyword[if] identifier[n] == literal[int] :
keyword[return] literal[int]
keyword[if] identifier[n] == literal[int] keyword[or] identifier[r] == literal[int] :
keyword[return] litera... | def _geom_series_uint32(r, n):
"""Unsigned integer calculation of sum of geometric series:
1 + r + r^2 + r^3 + ... r^(n-1)
summed to n terms.
Calculated modulo 2**32.
Use the formula (r**n - 1) / (r - 1)
"""
if n == 0:
return 0 # depends on [control=['if'], data=[]]
if n == 1 or... |
def contains_all(self, other, atol=0.0):
"""Return ``True`` if all points defined by ``other`` are contained.
Parameters
----------
other :
Collection of points to be tested. Can be given as a single
point, a ``(d, N)`` array-like where ``d`` is the
n... | def function[contains_all, parameter[self, other, atol]]:
constant[Return ``True`` if all points defined by ``other`` are contained.
Parameters
----------
other :
Collection of points to be tested. Can be given as a single
point, a ``(d, N)`` array-like where ``d... | keyword[def] identifier[contains_all] ( identifier[self] , identifier[other] , identifier[atol] = literal[int] ):
literal[string]
identifier[atol] = identifier[float] ( identifier[atol] )
keyword[if] identifier[other] keyword[in] identifier[self] :
keyword[return]... | def contains_all(self, other, atol=0.0):
"""Return ``True`` if all points defined by ``other`` are contained.
Parameters
----------
other :
Collection of points to be tested. Can be given as a single
point, a ``(d, N)`` array-like where ``d`` is the
numbe... |
def create_role(self, name, policies=None, ttl=None, max_ttl=None, period=None, bound_service_principal_ids=None,
bound_group_ids=None, bound_location=None, bound_subscription_ids=None,
bound_resource_group_names=None, bound_scale_sets=None, mount_point=DEFAULT_MOUNT_POINT):
... | def function[create_role, parameter[self, name, policies, ttl, max_ttl, period, bound_service_principal_ids, bound_group_ids, bound_location, bound_subscription_ids, bound_resource_group_names, bound_scale_sets, mount_point]]:
constant[Create a role in the method.
Role types have specific entities that... | keyword[def] identifier[create_role] ( identifier[self] , identifier[name] , identifier[policies] = keyword[None] , identifier[ttl] = keyword[None] , identifier[max_ttl] = keyword[None] , identifier[period] = keyword[None] , identifier[bound_service_principal_ids] = keyword[None] ,
identifier[bound_group_ids] = keyw... | def create_role(self, name, policies=None, ttl=None, max_ttl=None, period=None, bound_service_principal_ids=None, bound_group_ids=None, bound_location=None, bound_subscription_ids=None, bound_resource_group_names=None, bound_scale_sets=None, mount_point=DEFAULT_MOUNT_POINT):
"""Create a role in the method.
... |
def import_parms(self, args):
"""Import external dict to internal dict"""
for key, val in args.items():
self.set_parm(key, val) | def function[import_parms, parameter[self, args]]:
constant[Import external dict to internal dict]
for taget[tuple[[<ast.Name object at 0x7da1b0123a00>, <ast.Name object at 0x7da1b0122da0>]]] in starred[call[name[args].items, parameter[]]] begin[:]
call[name[self].set_parm, parameter[nam... | keyword[def] identifier[import_parms] ( identifier[self] , identifier[args] ):
literal[string]
keyword[for] identifier[key] , identifier[val] keyword[in] identifier[args] . identifier[items] ():
identifier[self] . identifier[set_parm] ( identifier[key] , identifier[val] ) | def import_parms(self, args):
"""Import external dict to internal dict"""
for (key, val) in args.items():
self.set_parm(key, val) # depends on [control=['for'], data=[]] |
def flush(self):
"""Flushes the collected information"""
self.__flushLevel(0)
if self.__lastImport is not None:
self.imports.append(self.__lastImport) | def function[flush, parameter[self]]:
constant[Flushes the collected information]
call[name[self].__flushLevel, parameter[constant[0]]]
if compare[name[self].__lastImport is_not constant[None]] begin[:]
call[name[self].imports.append, parameter[name[self].__lastImport]] | keyword[def] identifier[flush] ( identifier[self] ):
literal[string]
identifier[self] . identifier[__flushLevel] ( literal[int] )
keyword[if] identifier[self] . identifier[__lastImport] keyword[is] keyword[not] keyword[None] :
identifier[self] . identifier[imports] . ident... | def flush(self):
"""Flushes the collected information"""
self.__flushLevel(0)
if self.__lastImport is not None:
self.imports.append(self.__lastImport) # depends on [control=['if'], data=[]] |
def remove_child_vault(self, vault_id, child_id):
"""Removes a child from a vault.
arg: vault_id (osid.id.Id): the ``Id`` of a vault
arg: child_id (osid.id.Id): the ``Id`` of the child
raise: NotFound - ``vault_id`` not parent of ``child_id``
raise: NullArgument - ``vaul... | def function[remove_child_vault, parameter[self, vault_id, child_id]]:
constant[Removes a child from a vault.
arg: vault_id (osid.id.Id): the ``Id`` of a vault
arg: child_id (osid.id.Id): the ``Id`` of the child
raise: NotFound - ``vault_id`` not parent of ``child_id``
ra... | keyword[def] identifier[remove_child_vault] ( identifier[self] , identifier[vault_id] , identifier[child_id] ):
literal[string]
keyword[if] identifier[self] . identifier[_catalog_session] keyword[is] keyword[not] keyword[None] :
keyword[return] identifier[self] .... | def remove_child_vault(self, vault_id, child_id):
"""Removes a child from a vault.
arg: vault_id (osid.id.Id): the ``Id`` of a vault
arg: child_id (osid.id.Id): the ``Id`` of the child
raise: NotFound - ``vault_id`` not parent of ``child_id``
raise: NullArgument - ``vault_id... |
def validate_config(cls, config):
"""
Validates a config dictionary parsed from a cluster config file.
Checks that a discovery method is defined and that at least one of
the balancers in the config are installed and available.
"""
if "discovery" not in config:
... | def function[validate_config, parameter[cls, config]]:
constant[
Validates a config dictionary parsed from a cluster config file.
Checks that a discovery method is defined and that at least one of
the balancers in the config are installed and available.
]
if compare[cons... | keyword[def] identifier[validate_config] ( identifier[cls] , identifier[config] ):
literal[string]
keyword[if] literal[string] keyword[not] keyword[in] identifier[config] :
keyword[raise] identifier[ValueError] ( literal[string] )
identifier[installed_balancers] = identi... | def validate_config(cls, config):
"""
Validates a config dictionary parsed from a cluster config file.
Checks that a discovery method is defined and that at least one of
the balancers in the config are installed and available.
"""
if 'discovery' not in config:
raise Valu... |
def match_sr(self, svc_ref, cid=None):
# type: (ServiceReference, Optional[Tuple[str, str]] ) -> bool
"""
Checks if this export registration matches the given service reference
:param svc_ref: A service reference
:param cid: A container ID
:return: True if the service ma... | def function[match_sr, parameter[self, svc_ref, cid]]:
constant[
Checks if this export registration matches the given service reference
:param svc_ref: A service reference
:param cid: A container ID
:return: True if the service matches this export registration
]
... | keyword[def] identifier[match_sr] ( identifier[self] , identifier[svc_ref] , identifier[cid] = keyword[None] ):
literal[string]
keyword[with] identifier[self] . identifier[__lock] :
identifier[our_sr] = identifier[self] . identifier[get_reference] ()
keyword[if] identif... | def match_sr(self, svc_ref, cid=None):
# type: (ServiceReference, Optional[Tuple[str, str]] ) -> bool
'\n Checks if this export registration matches the given service reference\n\n :param svc_ref: A service reference\n :param cid: A container ID\n :return: True if the service matches... |
def profile(self):
"""Return raster metadata."""
with rasterio.open(self.path, "r") as src:
return deepcopy(src.meta) | def function[profile, parameter[self]]:
constant[Return raster metadata.]
with call[name[rasterio].open, parameter[name[self].path, constant[r]]] begin[:]
return[call[name[deepcopy], parameter[name[src].meta]]] | keyword[def] identifier[profile] ( identifier[self] ):
literal[string]
keyword[with] identifier[rasterio] . identifier[open] ( identifier[self] . identifier[path] , literal[string] ) keyword[as] identifier[src] :
keyword[return] identifier[deepcopy] ( identifier[src] . identifier[me... | def profile(self):
"""Return raster metadata."""
with rasterio.open(self.path, 'r') as src:
return deepcopy(src.meta) # depends on [control=['with'], data=['src']] |
def propagate(self, date):
"""Propagate the orbit to a new date
Args:
date (Date)
Return:
Orbit
"""
if self.propagator.orbit is not self:
self.propagator.orbit = self
return self.propagator.propagate(date) | def function[propagate, parameter[self, date]]:
constant[Propagate the orbit to a new date
Args:
date (Date)
Return:
Orbit
]
if compare[name[self].propagator.orbit is_not name[self]] begin[:]
name[self].propagator.orbit assign[=] name[self... | keyword[def] identifier[propagate] ( identifier[self] , identifier[date] ):
literal[string]
keyword[if] identifier[self] . identifier[propagator] . identifier[orbit] keyword[is] keyword[not] identifier[self] :
identifier[self] . identifier[propagator] . identifier[orbit] = identif... | def propagate(self, date):
"""Propagate the orbit to a new date
Args:
date (Date)
Return:
Orbit
"""
if self.propagator.orbit is not self:
self.propagator.orbit = self # depends on [control=['if'], data=['self']]
return self.propagator.propagate(date) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.