code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def _on_dirty_changed(self, dirty): """ Adds a star in front of a dirtt tab and emits dirty_changed. """ try: title = self._current._tab_name index = self.indexOf(self._current) if dirty: self.setTabText(index, "* " + title) ...
def function[_on_dirty_changed, parameter[self, dirty]]: constant[ Adds a star in front of a dirtt tab and emits dirty_changed. ] <ast.Try object at 0x7da18f7222c0> call[name[self].dirty_changed.emit, parameter[name[dirty]]]
keyword[def] identifier[_on_dirty_changed] ( identifier[self] , identifier[dirty] ): literal[string] keyword[try] : identifier[title] = identifier[self] . identifier[_current] . identifier[_tab_name] identifier[index] = identifier[self] . identifier[indexOf] ( identifier[...
def _on_dirty_changed(self, dirty): """ Adds a star in front of a dirtt tab and emits dirty_changed. """ try: title = self._current._tab_name index = self.indexOf(self._current) if dirty: self.setTabText(index, '* ' + title) # depends on [control=['if'], data...
def getmap(self, path, query=None): """ Performs a GET request where the response content type is required to be "application/json" and the content is a JSON-encoded data structure. The decoded structure is returned. """ code, data, ctype = self.get(path, query) if ct...
def function[getmap, parameter[self, path, query]]: constant[ Performs a GET request where the response content type is required to be "application/json" and the content is a JSON-encoded data structure. The decoded structure is returned. ] <ast.Tuple object at 0x7da18bc73520...
keyword[def] identifier[getmap] ( identifier[self] , identifier[path] , identifier[query] = keyword[None] ): literal[string] identifier[code] , identifier[data] , identifier[ctype] = identifier[self] . identifier[get] ( identifier[path] , identifier[query] ) keyword[if] identifier[ctype] ...
def getmap(self, path, query=None): """ Performs a GET request where the response content type is required to be "application/json" and the content is a JSON-encoded data structure. The decoded structure is returned. """ (code, data, ctype) = self.get(path, query) if ctype != 'ap...
def update(self, name, **kwargs): """ Update existing role. http://www.keycloak.org/docs-api/3.4/rest-api/index.html#_roles_resource :param str name: Name for the role :param str description: (optional) :param str id: (optional) :param bool client_role: (optiona...
def function[update, parameter[self, name]]: constant[ Update existing role. http://www.keycloak.org/docs-api/3.4/rest-api/index.html#_roles_resource :param str name: Name for the role :param str description: (optional) :param str id: (optional) :param bool clie...
keyword[def] identifier[update] ( identifier[self] , identifier[name] ,** identifier[kwargs] ): literal[string] identifier[payload] = identifier[OrderedDict] ( identifier[name] = identifier[name] ) keyword[for] identifier[key] keyword[in] identifier[ROLE_KWARGS] : keyword[...
def update(self, name, **kwargs): """ Update existing role. http://www.keycloak.org/docs-api/3.4/rest-api/index.html#_roles_resource :param str name: Name for the role :param str description: (optional) :param str id: (optional) :param bool client_role: (optional) ...
def parse_environment_file(filename, world_size=(60, 60)): """ Extract information about spatial resources from an environment file. Arguments: filename - a string representing the path to the environment file. world_size - a tuple representing the x and y coordinates of the world. ...
def function[parse_environment_file, parameter[filename, world_size]]: constant[ Extract information about spatial resources from an environment file. Arguments: filename - a string representing the path to the environment file. world_size - a tuple representing the x and y coordinates of the w...
keyword[def] identifier[parse_environment_file] ( identifier[filename] , identifier[world_size] =( literal[int] , literal[int] )): literal[string] identifier[infile] = identifier[open] ( identifier[filename] ) identifier[lines] = identifier[infile] . identifier[readlines] () identifier[infile] ....
def parse_environment_file(filename, world_size=(60, 60)): """ Extract information about spatial resources from an environment file. Arguments: filename - a string representing the path to the environment file. world_size - a tuple representing the x and y coordinates of the world. ...
def search_groups(self, args): """ Executes a search flickr:(credsfile),search,(arg1)=(val1),(arg2)=(val2)... """ kwargs = {'text': args[0]} return self._paged_api_call(self.flickr.groups_search, kwargs, 'group')
def function[search_groups, parameter[self, args]]: constant[ Executes a search flickr:(credsfile),search,(arg1)=(val1),(arg2)=(val2)... ] variable[kwargs] assign[=] dictionary[[<ast.Constant object at 0x7da1b1622e60>], [<ast.Subscript object at 0x7da1b16206d0>]] return[call...
keyword[def] identifier[search_groups] ( identifier[self] , identifier[args] ): literal[string] identifier[kwargs] ={ literal[string] : identifier[args] [ literal[int] ]} keyword[return] identifier[self] . identifier[_paged_api_call] ( identifier[self] . identifier[flickr] . identifier[gr...
def search_groups(self, args): """ Executes a search flickr:(credsfile),search,(arg1)=(val1),(arg2)=(val2)... """ kwargs = {'text': args[0]} return self._paged_api_call(self.flickr.groups_search, kwargs, 'group')
async def async_get_forecast(self) -> List[SmhiForecast]: """ Returns a list of forecasts. The first in list are the current one """ json_data = await self._api.async_get_forecast_api(self._longitude, self._latitude) ...
<ast.AsyncFunctionDef object at 0x7da2046226b0>
keyword[async] keyword[def] identifier[async_get_forecast] ( identifier[self] )-> identifier[List] [ identifier[SmhiForecast] ]: literal[string] identifier[json_data] = keyword[await] identifier[self] . identifier[_api] . identifier[async_get_forecast_api] ( identifier[self] . identifier[_longi...
async def async_get_forecast(self) -> List[SmhiForecast]: """ Returns a list of forecasts. The first in list are the current one """ json_data = await self._api.async_get_forecast_api(self._longitude, self._latitude) return _get_forecast(json_data)
def sum(self, projection=None): """ Takes sum of elements in sequence. >>> seq([1, 2, 3, 4]).sum() 10 >>> seq([(1, 2), (1, 3), (1, 4)]).sum(lambda x: x[0]) 3 :param projection: function to project on the sequence before taking the sum :return: sum of el...
def function[sum, parameter[self, projection]]: constant[ Takes sum of elements in sequence. >>> seq([1, 2, 3, 4]).sum() 10 >>> seq([(1, 2), (1, 3), (1, 4)]).sum(lambda x: x[0]) 3 :param projection: function to project on the sequence before taking the sum ...
keyword[def] identifier[sum] ( identifier[self] , identifier[projection] = keyword[None] ): literal[string] keyword[if] identifier[projection] : keyword[return] identifier[sum] ( identifier[self] . identifier[map] ( identifier[projection] )) keyword[else] : keyw...
def sum(self, projection=None): """ Takes sum of elements in sequence. >>> seq([1, 2, 3, 4]).sum() 10 >>> seq([(1, 2), (1, 3), (1, 4)]).sum(lambda x: x[0]) 3 :param projection: function to project on the sequence before taking the sum :return: sum of elemen...
def rsdl_rn(self, AX, Y): """Compute primal residual normalisation term.""" # The primal residual normalisation term is # max( ||A x^(k)||_2, ||B y^(k)||_2 ) and B = -(I I I ...)^T. # The scaling by sqrt(Nb) of the l2 norm of Y accounts for the # block replication introduced by ...
def function[rsdl_rn, parameter[self, AX, Y]]: constant[Compute primal residual normalisation term.] return[call[name[max], parameter[tuple[[<ast.Call object at 0x7da20c6c5db0>, <ast.BinOp object at 0x7da20c6c70d0>]]]]]
keyword[def] identifier[rsdl_rn] ( identifier[self] , identifier[AX] , identifier[Y] ): literal[string] keyword[return] identifier[max] (( identifier[np] . identifier[linalg] . identifier[norm] ( identifier[AX] ), identifier[np] . identifier[sqrt] ( identifier[...
def rsdl_rn(self, AX, Y): """Compute primal residual normalisation term.""" # The primal residual normalisation term is # max( ||A x^(k)||_2, ||B y^(k)||_2 ) and B = -(I I I ...)^T. # The scaling by sqrt(Nb) of the l2 norm of Y accounts for the # block replication introduced by multiplication by B ...
def unirange(a, b): """Returns a regular expression string to match the given non-BMP range.""" if b < a: raise ValueError("Bad character range") if a < 0x10000 or b < 0x10000: raise ValueError("unirange is only defined for non-BMP ranges") if sys.maxunicode > 0xffff: # wide bui...
def function[unirange, parameter[a, b]]: constant[Returns a regular expression string to match the given non-BMP range.] if compare[name[b] less[<] name[a]] begin[:] <ast.Raise object at 0x7da20c6aa0b0> if <ast.BoolOp object at 0x7da20c6aa440> begin[:] <ast.Raise object at 0x7da2...
keyword[def] identifier[unirange] ( identifier[a] , identifier[b] ): literal[string] keyword[if] identifier[b] < identifier[a] : keyword[raise] identifier[ValueError] ( literal[string] ) keyword[if] identifier[a] < literal[int] keyword[or] identifier[b] < literal[int] : keyword[...
def unirange(a, b): """Returns a regular expression string to match the given non-BMP range.""" if b < a: raise ValueError('Bad character range') # depends on [control=['if'], data=[]] if a < 65536 or b < 65536: raise ValueError('unirange is only defined for non-BMP ranges') # depends on [...
def _bitResponseToValue(bytestring): """Convert a response string to a numerical value. Args: bytestring (str): A string of length 1. Can be for example ``\\x01``. Returns: The converted value (int). Raises: TypeError, ValueError """ _checkString(bytestring, descripti...
def function[_bitResponseToValue, parameter[bytestring]]: constant[Convert a response string to a numerical value. Args: bytestring (str): A string of length 1. Can be for example ``\x01``. Returns: The converted value (int). Raises: TypeError, ValueError ] ca...
keyword[def] identifier[_bitResponseToValue] ( identifier[bytestring] ): literal[string] identifier[_checkString] ( identifier[bytestring] , identifier[description] = literal[string] , identifier[minlength] = literal[int] , identifier[maxlength] = literal[int] ) identifier[RESPONSE_ON] = literal[stri...
def _bitResponseToValue(bytestring): """Convert a response string to a numerical value. Args: bytestring (str): A string of length 1. Can be for example ``\\x01``. Returns: The converted value (int). Raises: TypeError, ValueError """ _checkString(bytestring, descripti...
def generate(env): """Add Builders and construction variables for javac to an Environment.""" java_file = SCons.Tool.CreateJavaFileBuilder(env) java_class = SCons.Tool.CreateJavaClassFileBuilder(env) java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) java_class.add_emitter(None, emit_java_cl...
def function[generate, parameter[env]]: constant[Add Builders and construction variables for javac to an Environment.] variable[java_file] assign[=] call[name[SCons].Tool.CreateJavaFileBuilder, parameter[name[env]]] variable[java_class] assign[=] call[name[SCons].Tool.CreateJavaClassFileBuilder,...
keyword[def] identifier[generate] ( identifier[env] ): literal[string] identifier[java_file] = identifier[SCons] . identifier[Tool] . identifier[CreateJavaFileBuilder] ( identifier[env] ) identifier[java_class] = identifier[SCons] . identifier[Tool] . identifier[CreateJavaClassFileBuilder] ( identifie...
def generate(env): """Add Builders and construction variables for javac to an Environment.""" java_file = SCons.Tool.CreateJavaFileBuilder(env) java_class = SCons.Tool.CreateJavaClassFileBuilder(env) java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) java_class.add_emitter(None, emit_java_cl...
def cardinality(self): """A tuple containing the cardinality for this Slot. The Python equivalent of the CLIPS deftemplate-slot-cardinality function. """ data = clips.data.DataObject(self._env) lib.EnvDeftemplateSlotCardinality( self._env, self._tpl, self._...
def function[cardinality, parameter[self]]: constant[A tuple containing the cardinality for this Slot. The Python equivalent of the CLIPS deftemplate-slot-cardinality function. ] variable[data] assign[=] call[name[clips].data.DataObject, parameter[name[self]._env]] call...
keyword[def] identifier[cardinality] ( identifier[self] ): literal[string] identifier[data] = identifier[clips] . identifier[data] . identifier[DataObject] ( identifier[self] . identifier[_env] ) identifier[lib] . identifier[EnvDeftemplateSlotCardinality] ( identifier[self] . ide...
def cardinality(self): """A tuple containing the cardinality for this Slot. The Python equivalent of the CLIPS deftemplate-slot-cardinality function. """ data = clips.data.DataObject(self._env) lib.EnvDeftemplateSlotCardinality(self._env, self._tpl, self._name, data.byref) retu...
async def connect(self, client_id, conn_string): """Connect to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.connect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to ...
<ast.AsyncFunctionDef object at 0x7da18f58f640>
keyword[async] keyword[def] identifier[connect] ( identifier[self] , identifier[client_id] , identifier[conn_string] ): literal[string] identifier[conn_id] = identifier[self] . identifier[adapter] . identifier[unique_conn_id] () identifier[self] . identifier[_client_info] ( identifier[cl...
async def connect(self, client_id, conn_string): """Connect to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.connect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the ...
def slice(self, rng, num_of_slices=None, slice_pos=None, slice_start=None, slice_end=None, cache_dir=None): ''' Slices the data iterator so that newly generated data iterator has access to limited portion of the original data. Args: rng (numpy.random.Rand...
def function[slice, parameter[self, rng, num_of_slices, slice_pos, slice_start, slice_end, cache_dir]]: constant[ Slices the data iterator so that newly generated data iterator has access to limited portion of the original data. Args: rng (numpy.random.RandomState): Random generator...
keyword[def] identifier[slice] ( identifier[self] , identifier[rng] , identifier[num_of_slices] = keyword[None] , identifier[slice_pos] = keyword[None] , identifier[slice_start] = keyword[None] , identifier[slice_end] = keyword[None] , identifier[cache_dir] = keyword[None] ): literal[string] key...
def slice(self, rng, num_of_slices=None, slice_pos=None, slice_start=None, slice_end=None, cache_dir=None): """ Slices the data iterator so that newly generated data iterator has access to limited portion of the original data. Args: rng (numpy.random.RandomState): Random generator for I...
def slabs(request, server_name): """ Show server slabs. """ data = _context_data({ 'title': _('Memcache Slabs for %s') % server_name, 'cache_slabs': _get_cache_slabs(server_name), }, request) return render_to_response('memcache_admin/slabs.html', data, RequestContext(requ...
def function[slabs, parameter[request, server_name]]: constant[ Show server slabs. ] variable[data] assign[=] call[name[_context_data], parameter[dictionary[[<ast.Constant object at 0x7da1b013e8f0>, <ast.Constant object at 0x7da1b013c790>], [<ast.BinOp object at 0x7da1b013f8b0>, <ast.Call object...
keyword[def] identifier[slabs] ( identifier[request] , identifier[server_name] ): literal[string] identifier[data] = identifier[_context_data] ({ literal[string] : identifier[_] ( literal[string] )% identifier[server_name] , literal[string] : identifier[_get_cache_slabs] ( identifier[server_name]...
def slabs(request, server_name): """ Show server slabs. """ data = _context_data({'title': _('Memcache Slabs for %s') % server_name, 'cache_slabs': _get_cache_slabs(server_name)}, request) return render_to_response('memcache_admin/slabs.html', data, RequestContext(request))
def disconnect_node(node, src=True, dst=True): """Disconnect all connections from node :param node: the node to disconnect :type node: str :returns: None :rtype: None :raises: None """ if dst: destconns = cmds.listConnections(node, connections=True, plugs=True, source=False) or ...
def function[disconnect_node, parameter[node, src, dst]]: constant[Disconnect all connections from node :param node: the node to disconnect :type node: str :returns: None :rtype: None :raises: None ] if name[dst] begin[:] variable[destconns] assign[=] <ast.BoolOp...
keyword[def] identifier[disconnect_node] ( identifier[node] , identifier[src] = keyword[True] , identifier[dst] = keyword[True] ): literal[string] keyword[if] identifier[dst] : identifier[destconns] = identifier[cmds] . identifier[listConnections] ( identifier[node] , identifier[connections] = ke...
def disconnect_node(node, src=True, dst=True): """Disconnect all connections from node :param node: the node to disconnect :type node: str :returns: None :rtype: None :raises: None """ if dst: destconns = cmds.listConnections(node, connections=True, plugs=True, source=False) or ...
def other(wxcodes: typing.List[str]) -> str: """ Format wx codes into a spoken word string """ ret = [] for code in wxcodes: item = translate.wxcode(code) if item.startswith('Vicinity'): item = item.lstrip('Vicinity ') + ' in the Vicinity' ret.append(item) ret...
def function[other, parameter[wxcodes]]: constant[ Format wx codes into a spoken word string ] variable[ret] assign[=] list[[]] for taget[name[code]] in starred[name[wxcodes]] begin[:] variable[item] assign[=] call[name[translate].wxcode, parameter[name[code]]] ...
keyword[def] identifier[other] ( identifier[wxcodes] : identifier[typing] . identifier[List] [ identifier[str] ])-> identifier[str] : literal[string] identifier[ret] =[] keyword[for] identifier[code] keyword[in] identifier[wxcodes] : identifier[item] = identifier[translate] . identifier[wx...
def other(wxcodes: typing.List[str]) -> str: """ Format wx codes into a spoken word string """ ret = [] for code in wxcodes: item = translate.wxcode(code) if item.startswith('Vicinity'): item = item.lstrip('Vicinity ') + ' in the Vicinity' # depends on [control=['if'], d...
def gridnet(np, pfile, plenfile, tlenfile, gordfile, outlet=None, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None): """Run gridnet""" fname = TauDEM.func_name('gridnet') return TauDEM.run(FileClass.get_executable_fullpath(fname, exedi...
def function[gridnet, parameter[np, pfile, plenfile, tlenfile, gordfile, outlet, workingdir, mpiexedir, exedir, log_file, runtime_file, hostfile]]: constant[Run gridnet] variable[fname] assign[=] call[name[TauDEM].func_name, parameter[constant[gridnet]]] return[call[name[TauDEM].run, parameter[call[...
keyword[def] identifier[gridnet] ( identifier[np] , identifier[pfile] , identifier[plenfile] , identifier[tlenfile] , identifier[gordfile] , identifier[outlet] = keyword[None] , identifier[workingdir] = keyword[None] , identifier[mpiexedir] = keyword[None] , identifier[exedir] = keyword[None] , identifier[log_file] ...
def gridnet(np, pfile, plenfile, tlenfile, gordfile, outlet=None, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None): """Run gridnet""" fname = TauDEM.func_name('gridnet') return TauDEM.run(FileClass.get_executable_fullpath(fname, exedir), {'-p': pfile, '-o': outl...
def dt2ts(dt, drop_micro=False): ''' convert datetime objects to timestamp seconds (float) ''' is_true(HAS_DATEUTIL, "`pip install python_dateutil` required") if is_empty(dt, except_=False): ts = None elif isinstance(dt, (int, long, float)): # its a ts already ts = float(dt) elif is...
def function[dt2ts, parameter[dt, drop_micro]]: constant[ convert datetime objects to timestamp seconds (float) ] call[name[is_true], parameter[name[HAS_DATEUTIL], constant[`pip install python_dateutil` required]]] if call[name[is_empty], parameter[name[dt]]] begin[:] variable[ts...
keyword[def] identifier[dt2ts] ( identifier[dt] , identifier[drop_micro] = keyword[False] ): literal[string] identifier[is_true] ( identifier[HAS_DATEUTIL] , literal[string] ) keyword[if] identifier[is_empty] ( identifier[dt] , identifier[except_] = keyword[False] ): identifier[ts] = keyword...
def dt2ts(dt, drop_micro=False): """ convert datetime objects to timestamp seconds (float) """ is_true(HAS_DATEUTIL, '`pip install python_dateutil` required') if is_empty(dt, except_=False): ts = None # depends on [control=['if'], data=[]] elif isinstance(dt, (int, long, float)): # its a ts al...
def updateCategory(self,name,nmin=None,n=None,nmax=None): """ Smartly updates the given category. Only values that are given will be updated, others will be left unchanged. If the category does not exist, a :py:exc:`KeyError` will be thrown. Use :py:meth:`addCat...
def function[updateCategory, parameter[self, name, nmin, n, nmax]]: constant[ Smartly updates the given category. Only values that are given will be updated, others will be left unchanged. If the category does not exist, a :py:exc:`KeyError` will be thrown. Use ...
keyword[def] identifier[updateCategory] ( identifier[self] , identifier[name] , identifier[nmin] = keyword[None] , identifier[n] = keyword[None] , identifier[nmax] = keyword[None] ): literal[string] keyword[if] identifier[name] keyword[not] keyword[in] identifier[self] . identifier[cat...
def updateCategory(self, name, nmin=None, n=None, nmax=None): """ Smartly updates the given category. Only values that are given will be updated, others will be left unchanged. If the category does not exist, a :py:exc:`KeyError` will be thrown. Use :py:meth:`addCat...
def get_formatter(self, handler): """ Return formatters according to handler. All handlers are the same format, except syslog. We omit time when syslogging. """ if isinstance(handler, logging.handlers.SysLogHandler): formatter = '[%(levelname)-9s]' el...
def function[get_formatter, parameter[self, handler]]: constant[ Return formatters according to handler. All handlers are the same format, except syslog. We omit time when syslogging. ] if call[name[isinstance], parameter[name[handler], name[logging].handlers.SysLogHandl...
keyword[def] identifier[get_formatter] ( identifier[self] , identifier[handler] ): literal[string] keyword[if] identifier[isinstance] ( identifier[handler] , identifier[logging] . identifier[handlers] . identifier[SysLogHandler] ): identifier[formatter] = literal[string] key...
def get_formatter(self, handler): """ Return formatters according to handler. All handlers are the same format, except syslog. We omit time when syslogging. """ if isinstance(handler, logging.handlers.SysLogHandler): formatter = '[%(levelname)-9s]' # depends on [control...
def add_pending_greenlet(self, greenlet: Greenlet): """ Ensures an error on the passed greenlet crashes self/main greenlet. """ def remove(_): self.greenlets.remove(greenlet) self.greenlets.append(greenlet) greenlet.link_exception(self.on_error) greenlet.link_value(...
def function[add_pending_greenlet, parameter[self, greenlet]]: constant[ Ensures an error on the passed greenlet crashes self/main greenlet. ] def function[remove, parameter[_]]: call[name[self].greenlets.remove, parameter[name[greenlet]]] call[name[self].greenlets.append, parame...
keyword[def] identifier[add_pending_greenlet] ( identifier[self] , identifier[greenlet] : identifier[Greenlet] ): literal[string] keyword[def] identifier[remove] ( identifier[_] ): identifier[self] . identifier[greenlets] . identifier[remove] ( identifier[greenlet] ) identi...
def add_pending_greenlet(self, greenlet: Greenlet): """ Ensures an error on the passed greenlet crashes self/main greenlet. """ def remove(_): self.greenlets.remove(greenlet) self.greenlets.append(greenlet) greenlet.link_exception(self.on_error) greenlet.link_value(remove)
def advance_robots(self): '''Produces a new game state in which the robots have advanced towards the player by one step. Handles the robots crashing into one another too.''' # move the robots towards the player self = lens.robots.Each().call_step_towards(self.player)(self) ...
def function[advance_robots, parameter[self]]: constant[Produces a new game state in which the robots have advanced towards the player by one step. Handles the robots crashing into one another too.] variable[self] assign[=] call[call[call[name[lens].robots.Each, parameter[]].call_step_to...
keyword[def] identifier[advance_robots] ( identifier[self] ): literal[string] identifier[self] = identifier[lens] . identifier[robots] . identifier[Each] (). identifier[call_step_towards] ( identifier[self] . identifier[player] )( identifier[self] ) identifier[self] = id...
def advance_robots(self): """Produces a new game state in which the robots have advanced towards the player by one step. Handles the robots crashing into one another too.""" # move the robots towards the player self = lens.robots.Each().call_step_towards(self.player)(self) # robots in th...
def save(variable, filename): """Save variable on given path using Pickle Args: variable: what to save path (str): path of the output """ fileObj = open(filename, 'wb') pickle.dump(variable, fileObj) fileObj.close()
def function[save, parameter[variable, filename]]: constant[Save variable on given path using Pickle Args: variable: what to save path (str): path of the output ] variable[fileObj] assign[=] call[name[open], parameter[name[filename], constant[wb]]] call[name[pickle]....
keyword[def] identifier[save] ( identifier[variable] , identifier[filename] ): literal[string] identifier[fileObj] = identifier[open] ( identifier[filename] , literal[string] ) identifier[pickle] . identifier[dump] ( identifier[variable] , identifier[fileObj] ) identifier[fileObj] . identifier[cl...
def save(variable, filename): """Save variable on given path using Pickle Args: variable: what to save path (str): path of the output """ fileObj = open(filename, 'wb') pickle.dump(variable, fileObj) fileObj.close()
def _adjust_regs(self): """ Adjust bp and sp w.r.t. stack difference between GDB session and angr. This matches sp and bp registers, but there is a high risk of pointers inconsistencies. """ if not self.adjust_stack: return bp = self.state.arch.register_names...
def function[_adjust_regs, parameter[self]]: constant[ Adjust bp and sp w.r.t. stack difference between GDB session and angr. This matches sp and bp registers, but there is a high risk of pointers inconsistencies. ] if <ast.UnaryOp object at 0x7da1b26afc40> begin[:] retur...
keyword[def] identifier[_adjust_regs] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[adjust_stack] : keyword[return] identifier[bp] = identifier[self] . identifier[state] . identifier[arch] . identifier[register_names] [ identi...
def _adjust_regs(self): """ Adjust bp and sp w.r.t. stack difference between GDB session and angr. This matches sp and bp registers, but there is a high risk of pointers inconsistencies. """ if not self.adjust_stack: return # depends on [control=['if'], data=[]] bp = self.st...
def _getVirtualScreenRect(self): """ Returns the rect of all attached screens as (x, y, w, h) """ monitors = self.getScreenDetails() x1 = min([s["rect"][0] for s in monitors]) y1 = min([s["rect"][1] for s in monitors]) x2 = max([s["rect"][0]+s["rect"][2] for s in monitors]) ...
def function[_getVirtualScreenRect, parameter[self]]: constant[ Returns the rect of all attached screens as (x, y, w, h) ] variable[monitors] assign[=] call[name[self].getScreenDetails, parameter[]] variable[x1] assign[=] call[name[min], parameter[<ast.ListComp object at 0x7da18dc98790>]] ...
keyword[def] identifier[_getVirtualScreenRect] ( identifier[self] ): literal[string] identifier[monitors] = identifier[self] . identifier[getScreenDetails] () identifier[x1] = identifier[min] ([ identifier[s] [ literal[string] ][ literal[int] ] keyword[for] identifier[s] keyword[in] ide...
def _getVirtualScreenRect(self): """ Returns the rect of all attached screens as (x, y, w, h) """ monitors = self.getScreenDetails() x1 = min([s['rect'][0] for s in monitors]) y1 = min([s['rect'][1] for s in monitors]) x2 = max([s['rect'][0] + s['rect'][2] for s in monitors]) y2 = max([s['rect']...
def registerResponse(self, node, vendorSpecific=None): """CNRegister.register(session, node) → NodeReference https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNRegister.register. Args: node: vendorSpecific: Returns: ""...
def function[registerResponse, parameter[self, node, vendorSpecific]]: constant[CNRegister.register(session, node) → NodeReference https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNRegister.register. Args: node: vendorSpecific: ...
keyword[def] identifier[registerResponse] ( identifier[self] , identifier[node] , identifier[vendorSpecific] = keyword[None] ): literal[string] identifier[mmp_dict] ={ literal[string] :( literal[string] , identifier[node] . identifier[toxml] ( literal[string] ))} keyword[return] identifie...
def registerResponse(self, node, vendorSpecific=None): """CNRegister.register(session, node) → NodeReference https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNRegister.register. Args: node: vendorSpecific: Returns: """ ...
def list_of_lists_to_dict(l): """ Convert list of key,value lists to dict [['id', 1], ['id', 2], ['id', 3], ['foo': 4]] {'id': [1, 2, 3], 'foo': [4]} """ d = {} for key, val in l: d.setdefault(key, []).append(val) return d
def function[list_of_lists_to_dict, parameter[l]]: constant[ Convert list of key,value lists to dict [['id', 1], ['id', 2], ['id', 3], ['foo': 4]] {'id': [1, 2, 3], 'foo': [4]} ] variable[d] assign[=] dictionary[[], []] for taget[tuple[[<ast.Name object at 0x7da207f00df0>, <ast.Name...
keyword[def] identifier[list_of_lists_to_dict] ( identifier[l] ): literal[string] identifier[d] ={} keyword[for] identifier[key] , identifier[val] keyword[in] identifier[l] : identifier[d] . identifier[setdefault] ( identifier[key] ,[]). identifier[append] ( identifier[val] ) keyword[...
def list_of_lists_to_dict(l): """ Convert list of key,value lists to dict [['id', 1], ['id', 2], ['id', 3], ['foo': 4]] {'id': [1, 2, 3], 'foo': [4]} """ d = {} for (key, val) in l: d.setdefault(key, []).append(val) # depends on [control=['for'], data=[]] return d
def get_profile(self, profile_count=50): """ Get profile of query execution time. :param int profile_count: Number of profiles to retrieve, counted from the top query in descending order by the cumulative execution time. :return: Profile information f...
def function[get_profile, parameter[self, profile_count]]: constant[ Get profile of query execution time. :param int profile_count: Number of profiles to retrieve, counted from the top query in descending order by the cumulative execution time. :retur...
keyword[def] identifier[get_profile] ( identifier[self] , identifier[profile_count] = literal[int] ): literal[string] keyword[from] identifier[collections] keyword[import] identifier[namedtuple] identifier[profile_table_name] = literal[string] identifier[value_matrix] =[ ...
def get_profile(self, profile_count=50): """ Get profile of query execution time. :param int profile_count: Number of profiles to retrieve, counted from the top query in descending order by the cumulative execution time. :return: Profile information for e...
def get_upcoming_events(self): """ Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * PythonKCMeetupsBadR...
def function[get_upcoming_events, parameter[self]]: constant[ Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson ...
keyword[def] identifier[get_upcoming_events] ( identifier[self] ): literal[string] identifier[query] = identifier[urllib] . identifier[urlencode] ({ literal[string] : identifier[self] . identifier[_api_key] , literal[string] : identifier[GROUP_URLNAME] }) identifier[url] = litera...
def get_upcoming_events(self): """ Get upcoming PythonKC meetup events. Returns ------- List of ``pythonkc_meetups.types.MeetupEvent``, ordered by event time, ascending. Exceptions ---------- * PythonKCMeetupsBadJson * PythonKCMeetupsBadRespo...
def set_motor_position(self, motor_name, position): """ Sets the motor target position. """ self.call_remote_api('simxSetJointTargetPosition', self.get_object_handle(motor_name), position, sending=True)
def function[set_motor_position, parameter[self, motor_name, position]]: constant[ Sets the motor target position. ] call[name[self].call_remote_api, parameter[constant[simxSetJointTargetPosition], call[name[self].get_object_handle, parameter[name[motor_name]]], name[position]]]
keyword[def] identifier[set_motor_position] ( identifier[self] , identifier[motor_name] , identifier[position] ): literal[string] identifier[self] . identifier[call_remote_api] ( literal[string] , identifier[self] . identifier[get_object_handle] ( identifier[motor_name] ), identif...
def set_motor_position(self, motor_name, position): """ Sets the motor target position. """ self.call_remote_api('simxSetJointTargetPosition', self.get_object_handle(motor_name), position, sending=True)
def on(self, message, namespace=None): """Decorator to register a SocketIO event handler. This decorator must be applied to SocketIO event handlers. Example:: @socketio.on('my event', namespace='/chat') def handle_my_custom_event(json): print('received json: ' +...
def function[on, parameter[self, message, namespace]]: constant[Decorator to register a SocketIO event handler. This decorator must be applied to SocketIO event handlers. Example:: @socketio.on('my event', namespace='/chat') def handle_my_custom_event(json): pri...
keyword[def] identifier[on] ( identifier[self] , identifier[message] , identifier[namespace] = keyword[None] ): literal[string] identifier[namespace] = identifier[namespace] keyword[or] literal[string] keyword[def] identifier[decorator] ( identifier[handler] ): keyword[de...
def on(self, message, namespace=None): """Decorator to register a SocketIO event handler. This decorator must be applied to SocketIO event handlers. Example:: @socketio.on('my event', namespace='/chat') def handle_my_custom_event(json): print('received json: ' + str...
def when_all_players_ready(self): """Initializes decisions based on ``player.initial_decision()``. If :attr:`num_subperiods` is set, starts a timed task to run the sub-periods. """ self.group_decisions = {} self.subperiod_group_decisions = {} for player in self.ge...
def function[when_all_players_ready, parameter[self]]: constant[Initializes decisions based on ``player.initial_decision()``. If :attr:`num_subperiods` is set, starts a timed task to run the sub-periods. ] name[self].group_decisions assign[=] dictionary[[], []] name[self]...
keyword[def] identifier[when_all_players_ready] ( identifier[self] ): literal[string] identifier[self] . identifier[group_decisions] ={} identifier[self] . identifier[subperiod_group_decisions] ={} keyword[for] identifier[player] keyword[in] identifier[self] . identifier[get_pl...
def when_all_players_ready(self): """Initializes decisions based on ``player.initial_decision()``. If :attr:`num_subperiods` is set, starts a timed task to run the sub-periods. """ self.group_decisions = {} self.subperiod_group_decisions = {} for player in self.get_players(): ...
def get_draft_secret_key(): """ Return the secret key used to generate draft mode HMACs. It will be randomly generated on first access. Existing draft URLs can be invalidated by deleting or updating the ``DRAFT_SECRET_KEY`` setting. """ # TODO: Per URL secret keys, so we can invalidate draft URL...
def function[get_draft_secret_key, parameter[]]: constant[ Return the secret key used to generate draft mode HMACs. It will be randomly generated on first access. Existing draft URLs can be invalidated by deleting or updating the ``DRAFT_SECRET_KEY`` setting. ] <ast.Tuple object at 0x7da...
keyword[def] identifier[get_draft_secret_key] (): literal[string] identifier[draft_secret_key] , identifier[created] = identifier[Text] . identifier[objects] . identifier[get_or_create] ( identifier[name] = literal[string] , identifier[defaults] = identifier[dict] ( identifier[valu...
def get_draft_secret_key(): """ Return the secret key used to generate draft mode HMACs. It will be randomly generated on first access. Existing draft URLs can be invalidated by deleting or updating the ``DRAFT_SECRET_KEY`` setting. """ # TODO: Per URL secret keys, so we can invalidate draft URL...
def get_ref_annotation_data_for_tier(self, id_tier): """"Give a list of all reference annotations of the form: ``[(start, end, value, refvalue)]`` :param str id_tier: Name of the tier. :raises KeyError: If the tier is non existent. :returns: Reference annotations within that tie...
def function[get_ref_annotation_data_for_tier, parameter[self, id_tier]]: constant["Give a list of all reference annotations of the form: ``[(start, end, value, refvalue)]`` :param str id_tier: Name of the tier. :raises KeyError: If the tier is non existent. :returns: Reference ...
keyword[def] identifier[get_ref_annotation_data_for_tier] ( identifier[self] , identifier[id_tier] ): literal[string] identifier[bucket] =[] keyword[for] identifier[aid] ,( identifier[ref] , identifier[value] , identifier[prev] , identifier[_] ) keyword[in] identifier[self] . identifier[...
def get_ref_annotation_data_for_tier(self, id_tier): """"Give a list of all reference annotations of the form: ``[(start, end, value, refvalue)]`` :param str id_tier: Name of the tier. :raises KeyError: If the tier is non existent. :returns: Reference annotations within that tier. ...
def now_millis(absolute=False) -> int: """Return current millis since epoch as integer.""" millis = int(time.time() * 1e3) if absolute: return millis return millis - EPOCH_MICROS // 1000
def function[now_millis, parameter[absolute]]: constant[Return current millis since epoch as integer.] variable[millis] assign[=] call[name[int], parameter[binary_operation[call[name[time].time, parameter[]] * constant[1000.0]]]] if name[absolute] begin[:] return[name[millis]] return...
keyword[def] identifier[now_millis] ( identifier[absolute] = keyword[False] )-> identifier[int] : literal[string] identifier[millis] = identifier[int] ( identifier[time] . identifier[time] ()* literal[int] ) keyword[if] identifier[absolute] : keyword[return] identifier[millis] keyword[return] id...
def now_millis(absolute=False) -> int: """Return current millis since epoch as integer.""" millis = int(time.time() * 1000.0) if absolute: return millis # depends on [control=['if'], data=[]] return millis - EPOCH_MICROS // 1000
def paintEvent(self, event): """Paint the widget :param event: :type event: :returns: None :rtype: None :raises: None """ if not self.toPlainText() and not self.hasFocus() and self._placeholder: p = QtGui.QPainter(self.viewport()) ...
def function[paintEvent, parameter[self, event]]: constant[Paint the widget :param event: :type event: :returns: None :rtype: None :raises: None ] if <ast.BoolOp object at 0x7da18fe917e0> begin[:] variable[p] assign[=] call[name[QtGui].QPa...
keyword[def] identifier[paintEvent] ( identifier[self] , identifier[event] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[toPlainText] () keyword[and] keyword[not] identifier[self] . identifier[hasFocus] () keyword[and] identifier[self] . identifier[_placeholder] : ...
def paintEvent(self, event): """Paint the widget :param event: :type event: :returns: None :rtype: None :raises: None """ if not self.toPlainText() and (not self.hasFocus()) and self._placeholder: p = QtGui.QPainter(self.viewport()) p.setClipping(...
def last_year(date_): ''' Returns the same date 1 year ago. Args: date (datetime or datetime.date) Returns: (datetime or datetime.date) Raises: - ''' day = 28 if date_.day == 29 and date_.month == 2 else date_.day return datetime.date(date_.year-1, date_.month, d...
def function[last_year, parameter[date_]]: constant[ Returns the same date 1 year ago. Args: date (datetime or datetime.date) Returns: (datetime or datetime.date) Raises: - ] variable[day] assign[=] <ast.IfExp object at 0x7da1b135ea40> return[call[name[da...
keyword[def] identifier[last_year] ( identifier[date_] ): literal[string] identifier[day] = literal[int] keyword[if] identifier[date_] . identifier[day] == literal[int] keyword[and] identifier[date_] . identifier[month] == literal[int] keyword[else] identifier[date_] . identifier[day] keyword[r...
def last_year(date_): """ Returns the same date 1 year ago. Args: date (datetime or datetime.date) Returns: (datetime or datetime.date) Raises: - """ day = 28 if date_.day == 29 and date_.month == 2 else date_.day return datetime.date(date_.year - 1, date_.month,...
def load_crmod_volt(self, filename): """Load a CRMod measurement file (commonly called volt.dat) Parameters ---------- filename: string path to filename Returns ------- list list of measurement ids """ with open(filename, ...
def function[load_crmod_volt, parameter[self, filename]]: constant[Load a CRMod measurement file (commonly called volt.dat) Parameters ---------- filename: string path to filename Returns ------- list list of measurement ids ] ...
keyword[def] identifier[load_crmod_volt] ( identifier[self] , identifier[filename] ): literal[string] keyword[with] identifier[open] ( identifier[filename] , literal[string] ) keyword[as] identifier[fid] : identifier[nr_of_configs] = identifier[int] ( identifier[fid] . identifier[rea...
def load_crmod_volt(self, filename): """Load a CRMod measurement file (commonly called volt.dat) Parameters ---------- filename: string path to filename Returns ------- list list of measurement ids """ with open(filename, 'r') as ...
def get_subgraph(self, starting_node, block_addresses): """ Get a sub-graph out of a bunch of basic block addresses. :param CFGNode starting_node: The beginning of the subgraph :param iterable block_addresses: A collection of block addresses that should be included in the subgraph if ...
def function[get_subgraph, parameter[self, starting_node, block_addresses]]: constant[ Get a sub-graph out of a bunch of basic block addresses. :param CFGNode starting_node: The beginning of the subgraph :param iterable block_addresses: A collection of block addresses that should be inc...
keyword[def] identifier[get_subgraph] ( identifier[self] , identifier[starting_node] , identifier[block_addresses] ): literal[string] identifier[graph] = identifier[networkx] . identifier[DiGraph] () keyword[if] identifier[starting_node] keyword[not] keyword[in] identifier[self] . id...
def get_subgraph(self, starting_node, block_addresses): """ Get a sub-graph out of a bunch of basic block addresses. :param CFGNode starting_node: The beginning of the subgraph :param iterable block_addresses: A collection of block addresses that should be included in the subgraph if ...
def get_tournaments(self, only_active=True): """Get all tournaments Args: only_active (bool): Flag to indicate of only active tournaments should be returned or all of them. Defaults to True. Returns: list o...
def function[get_tournaments, parameter[self, only_active]]: constant[Get all tournaments Args: only_active (bool): Flag to indicate of only active tournaments should be returned or all of them. Defaults to True. Retur...
keyword[def] identifier[get_tournaments] ( identifier[self] , identifier[only_active] = keyword[True] ): literal[string] identifier[query] = literal[string] identifier[data] = identifier[self] . identifier[raw_query] ( identifier[query] )[ literal[string] ][ literal[string] ] key...
def get_tournaments(self, only_active=True): """Get all tournaments Args: only_active (bool): Flag to indicate of only active tournaments should be returned or all of them. Defaults to True. Returns: list of di...
def __choices2tkvalues(self, choices): """choices: iterable of key, value pairs""" values = [] for k, v in choices: values.append(v) return values
def function[__choices2tkvalues, parameter[self, choices]]: constant[choices: iterable of key, value pairs] variable[values] assign[=] list[[]] for taget[tuple[[<ast.Name object at 0x7da1b17cded0>, <ast.Name object at 0x7da1b17cf100>]]] in starred[name[choices]] begin[:] call[nam...
keyword[def] identifier[__choices2tkvalues] ( identifier[self] , identifier[choices] ): literal[string] identifier[values] =[] keyword[for] identifier[k] , identifier[v] keyword[in] identifier[choices] : identifier[values] . identifier[append] ( identifier[v] ) key...
def __choices2tkvalues(self, choices): """choices: iterable of key, value pairs""" values = [] for (k, v) in choices: values.append(v) # depends on [control=['for'], data=[]] return values
def get_conn(self): """ Establishes a connection depending on the security mode set via config or environment variable. :return: a hdfscli InsecureClient or KerberosClient object. :rtype: hdfs.InsecureClient or hdfs.ext.kerberos.KerberosClient """ connections = self.get_...
def function[get_conn, parameter[self]]: constant[ Establishes a connection depending on the security mode set via config or environment variable. :return: a hdfscli InsecureClient or KerberosClient object. :rtype: hdfs.InsecureClient or hdfs.ext.kerberos.KerberosClient ] ...
keyword[def] identifier[get_conn] ( identifier[self] ): literal[string] identifier[connections] = identifier[self] . identifier[get_connections] ( identifier[self] . identifier[webhdfs_conn_id] ) keyword[for] identifier[connection] keyword[in] identifier[connections] : key...
def get_conn(self): """ Establishes a connection depending on the security mode set via config or environment variable. :return: a hdfscli InsecureClient or KerberosClient object. :rtype: hdfs.InsecureClient or hdfs.ext.kerberos.KerberosClient """ connections = self.get_connecti...
def _create_arc(self, inst, destination, placeable=None): """ Returns a list of coordinates to arrive to the destination coordinate """ this_container = None if isinstance(placeable, containers.Well): this_container = placeable.get_parent() elif isinstance(pla...
def function[_create_arc, parameter[self, inst, destination, placeable]]: constant[ Returns a list of coordinates to arrive to the destination coordinate ] variable[this_container] assign[=] constant[None] if call[name[isinstance], parameter[name[placeable], name[containers].Well...
keyword[def] identifier[_create_arc] ( identifier[self] , identifier[inst] , identifier[destination] , identifier[placeable] = keyword[None] ): literal[string] identifier[this_container] = keyword[None] keyword[if] identifier[isinstance] ( identifier[placeable] , identifier[containers] ....
def _create_arc(self, inst, destination, placeable=None): """ Returns a list of coordinates to arrive to the destination coordinate """ this_container = None if isinstance(placeable, containers.Well): this_container = placeable.get_parent() # depends on [control=['if'], data=[]] ...
def set_bg(self, bg, key="data", attrs={}): """Set the background data Parameters ---------- bg: numbers.Real, 2d ndarray, ImageData, or h5py.Dataset The background data. If `bg` is an `h5py.Dataset` object, it must exist in the same hdf5 file (a hard link is cre...
def function[set_bg, parameter[self, bg, key, attrs]]: constant[Set the background data Parameters ---------- bg: numbers.Real, 2d ndarray, ImageData, or h5py.Dataset The background data. If `bg` is an `h5py.Dataset` object, it must exist in the same hdf5 file (a...
keyword[def] identifier[set_bg] ( identifier[self] , identifier[bg] , identifier[key] = literal[string] , identifier[attrs] ={}): literal[string] keyword[if] identifier[key] keyword[not] keyword[in] identifier[VALID_BG_KEYS] : keyword[raise] identifier[ValueError] ( literal[string...
def set_bg(self, bg, key='data', attrs={}): """Set the background data Parameters ---------- bg: numbers.Real, 2d ndarray, ImageData, or h5py.Dataset The background data. If `bg` is an `h5py.Dataset` object, it must exist in the same hdf5 file (a hard link is created...
def grid_destroy_from_ids(oargrid_jobids): """Destroy all the jobs with corresponding ids Args: oargrid_jobids (list): the ``(site, oar_job_id)`` list of tuple identifying the jobs for each site. """ jobs = grid_reload_from_ids(oargrid_jobids) for job in jobs: job.delete() ...
def function[grid_destroy_from_ids, parameter[oargrid_jobids]]: constant[Destroy all the jobs with corresponding ids Args: oargrid_jobids (list): the ``(site, oar_job_id)`` list of tuple identifying the jobs for each site. ] variable[jobs] assign[=] call[name[grid_reload_from_id...
keyword[def] identifier[grid_destroy_from_ids] ( identifier[oargrid_jobids] ): literal[string] identifier[jobs] = identifier[grid_reload_from_ids] ( identifier[oargrid_jobids] ) keyword[for] identifier[job] keyword[in] identifier[jobs] : identifier[job] . identifier[delete] () ide...
def grid_destroy_from_ids(oargrid_jobids): """Destroy all the jobs with corresponding ids Args: oargrid_jobids (list): the ``(site, oar_job_id)`` list of tuple identifying the jobs for each site. """ jobs = grid_reload_from_ids(oargrid_jobids) for job in jobs: job.delete() ...
def INIT_TLS_SESSION(self): """ XXX We should offer the right key according to the client's suites. For now server_rsa_key is only used for RSAkx, but we should try to replace every server_key with both server_rsa_key and server_ecdsa_key. """ self.cur_session = tlsSessio...
def function[INIT_TLS_SESSION, parameter[self]]: constant[ XXX We should offer the right key according to the client's suites. For now server_rsa_key is only used for RSAkx, but we should try to replace every server_key with both server_rsa_key and server_ecdsa_key. ] nam...
keyword[def] identifier[INIT_TLS_SESSION] ( identifier[self] ): literal[string] identifier[self] . identifier[cur_session] = identifier[tlsSession] ( identifier[connection_end] = literal[string] ) identifier[self] . identifier[cur_session] . identifier[server_certs] =[ identifier[self] . i...
def INIT_TLS_SESSION(self): """ XXX We should offer the right key according to the client's suites. For now server_rsa_key is only used for RSAkx, but we should try to replace every server_key with both server_rsa_key and server_ecdsa_key. """ self.cur_session = tlsSession(connec...
def complex2wav(filename,rate,x): """ Save a complex signal vector to a wav file for compact binary storage of 16-bit signal samples. The wav left and right channels are used to save real (I) and imaginary (Q) values. The rate is just a convent way of documenting the original signal sample rate...
def function[complex2wav, parameter[filename, rate, x]]: constant[ Save a complex signal vector to a wav file for compact binary storage of 16-bit signal samples. The wav left and right channels are used to save real (I) and imaginary (Q) values. The rate is just a convent way of documenting the...
keyword[def] identifier[complex2wav] ( identifier[filename] , identifier[rate] , identifier[x] ): literal[string] identifier[x_wav] = identifier[np] . identifier[hstack] (( identifier[np] . identifier[array] ([ identifier[x] . identifier[real] ]). identifier[T] , identifier[np] . identifier[array] ([ ide...
def complex2wav(filename, rate, x): """ Save a complex signal vector to a wav file for compact binary storage of 16-bit signal samples. The wav left and right channels are used to save real (I) and imaginary (Q) values. The rate is just a convent way of documenting the original signal sample rate. ...
def sequencenames(contigsfile): """ Takes a multifasta file and returns a list of sequence names :param contigsfile: multifasta of all sequences :return: list of all sequence names """ sequences = list() for record in SeqIO.parse(open(contigsfile, "rU", encoding="...
def function[sequencenames, parameter[contigsfile]]: constant[ Takes a multifasta file and returns a list of sequence names :param contigsfile: multifasta of all sequences :return: list of all sequence names ] variable[sequences] assign[=] call[name[list], parameter[]] ...
keyword[def] identifier[sequencenames] ( identifier[contigsfile] ): literal[string] identifier[sequences] = identifier[list] () keyword[for] identifier[record] keyword[in] identifier[SeqIO] . identifier[parse] ( identifier[open] ( identifier[contigsfile] , literal[string] , identifier[e...
def sequencenames(contigsfile): """ Takes a multifasta file and returns a list of sequence names :param contigsfile: multifasta of all sequences :return: list of all sequence names """ sequences = list() for record in SeqIO.parse(open(contigsfile, 'rU', encoding='iso-8859-15'...
def _PrintStorageInformationAsJSON(self, storage_reader): """Writes a summary of sessions as machine-readable JSON. Args: storage_reader (StorageReader): storage reader. """ serializer = json_serializer.JSONAttributeContainerSerializer storage_counters = self._CalculateStorageCounters(storage...
def function[_PrintStorageInformationAsJSON, parameter[self, storage_reader]]: constant[Writes a summary of sessions as machine-readable JSON. Args: storage_reader (StorageReader): storage reader. ] variable[serializer] assign[=] name[json_serializer].JSONAttributeContainerSerializer ...
keyword[def] identifier[_PrintStorageInformationAsJSON] ( identifier[self] , identifier[storage_reader] ): literal[string] identifier[serializer] = identifier[json_serializer] . identifier[JSONAttributeContainerSerializer] identifier[storage_counters] = identifier[self] . identifier[_CalculateStorage...
def _PrintStorageInformationAsJSON(self, storage_reader): """Writes a summary of sessions as machine-readable JSON. Args: storage_reader (StorageReader): storage reader. """ serializer = json_serializer.JSONAttributeContainerSerializer storage_counters = self._CalculateStorageCounters(storage...
def ad_unif_inf(statistic): """ Approximates the limiting distribution to about 5 decimal digits. """ z = statistic if z < 2: return (exp(-1.2337141 / z) / sqrt(z) * (2.00012 + (.247105 - (.0649821 - (.0347962 - (.011672 - .0016...
def function[ad_unif_inf, parameter[statistic]]: constant[ Approximates the limiting distribution to about 5 decimal digits. ] variable[z] assign[=] name[statistic] if compare[name[z] less[<] constant[2]] begin[:] return[binary_operation[binary_operation[call[name[exp], parameter...
keyword[def] identifier[ad_unif_inf] ( identifier[statistic] ): literal[string] identifier[z] = identifier[statistic] keyword[if] identifier[z] < literal[int] : keyword[return] ( identifier[exp] (- literal[int] / identifier[z] )/ identifier[sqrt] ( identifier[z] )* ( literal[int] +(...
def ad_unif_inf(statistic): """ Approximates the limiting distribution to about 5 decimal digits. """ z = statistic if z < 2: return exp(-1.2337141 / z) / sqrt(z) * (2.00012 + (0.247105 - (0.0649821 - (0.0347962 - (0.011672 - 0.00168691 * z) * z) * z) * z) * z) # depends on [control=['if'],...
def print_hex(self, value, justify_right=True): """Print a numeric value in hexadecimal. Value should be from 0 to FFFF. """ if value < 0 or value > 0xFFFF: # Ignore out of range values. return self.print_number_str('{0:X}'.format(value), justify_right)
def function[print_hex, parameter[self, value, justify_right]]: constant[Print a numeric value in hexadecimal. Value should be from 0 to FFFF. ] if <ast.BoolOp object at 0x7da1b10433a0> begin[:] return[None] call[name[self].print_number_str, parameter[call[constant[{0:X}].format...
keyword[def] identifier[print_hex] ( identifier[self] , identifier[value] , identifier[justify_right] = keyword[True] ): literal[string] keyword[if] identifier[value] < literal[int] keyword[or] identifier[value] > literal[int] : keyword[return] identifier[self] . ...
def print_hex(self, value, justify_right=True): """Print a numeric value in hexadecimal. Value should be from 0 to FFFF. """ if value < 0 or value > 65535: # Ignore out of range values. return # depends on [control=['if'], data=[]] self.print_number_str('{0:X}'.format(value), justi...
def select_tmpltbank_class(curr_exe): """ This function returns a class that is appropriate for setting up template bank jobs within workflow. Parameters ---------- curr_exe : string The name of the executable to be used for generating template banks. Returns -------- exe_class...
def function[select_tmpltbank_class, parameter[curr_exe]]: constant[ This function returns a class that is appropriate for setting up template bank jobs within workflow. Parameters ---------- curr_exe : string The name of the executable to be used for generating template banks. Ret...
keyword[def] identifier[select_tmpltbank_class] ( identifier[curr_exe] ): literal[string] identifier[exe_to_class_map] ={ literal[string] : identifier[PyCBCTmpltbankExecutable] , literal[string] : identifier[PyCBCTmpltbankExecutable] } keyword[try] : keyword[return] identifier...
def select_tmpltbank_class(curr_exe): """ This function returns a class that is appropriate for setting up template bank jobs within workflow. Parameters ---------- curr_exe : string The name of the executable to be used for generating template banks. Returns -------- exe_class...
def CleanName(name): """Perform generic name cleaning.""" name = re.sub('[^_A-Za-z0-9]', '_', name) if name[0].isdigit(): name = '_%s' % name while keyword.iskeyword(name): name = '%s_' % name # If we end up with __ as a prefix, we'll run afoul of python ...
def function[CleanName, parameter[name]]: constant[Perform generic name cleaning.] variable[name] assign[=] call[name[re].sub, parameter[constant[[^_A-Za-z0-9]], constant[_], name[name]]] if call[call[name[name]][constant[0]].isdigit, parameter[]] begin[:] variable[name] assign[=...
keyword[def] identifier[CleanName] ( identifier[name] ): literal[string] identifier[name] = identifier[re] . identifier[sub] ( literal[string] , literal[string] , identifier[name] ) keyword[if] identifier[name] [ literal[int] ]. identifier[isdigit] (): identifier[name] = lite...
def CleanName(name): """Perform generic name cleaning.""" name = re.sub('[^_A-Za-z0-9]', '_', name) if name[0].isdigit(): name = '_%s' % name # depends on [control=['if'], data=[]] while keyword.iskeyword(name): name = '%s_' % name # depends on [control=['while'], data=[]] # If we ...
def get_compositions_by_search(self, composition_query, composition_search): """Gets the search results matching the given search query using the given search. arg: composition_query (osid.repository.CompositionQuery): the composition query arg: composition_search (osid.re...
def function[get_compositions_by_search, parameter[self, composition_query, composition_search]]: constant[Gets the search results matching the given search query using the given search. arg: composition_query (osid.repository.CompositionQuery): the composition query arg: ...
keyword[def] identifier[get_compositions_by_search] ( identifier[self] , identifier[composition_query] , identifier[composition_search] ): literal[string] identifier[and_list] = identifier[list] () identifier[or_list] = identifier[list] () keyword[for] ...
def get_compositions_by_search(self, composition_query, composition_search): """Gets the search results matching the given search query using the given search. arg: composition_query (osid.repository.CompositionQuery): the composition query arg: composition_search (osid.reposi...
def is_ratio_different(min_ratio, study_go, study_n, pop_go, pop_n): """ check if the ratio go /n is different between the study group and the population """ if min_ratio is None: return True stu_ratio = float(study_go) / study_n pop_ratio = float(pop_go) / pop_n if stu_ratio == ...
def function[is_ratio_different, parameter[min_ratio, study_go, study_n, pop_go, pop_n]]: constant[ check if the ratio go /n is different between the study group and the population ] if compare[name[min_ratio] is constant[None]] begin[:] return[constant[True]] variable[stu_ra...
keyword[def] identifier[is_ratio_different] ( identifier[min_ratio] , identifier[study_go] , identifier[study_n] , identifier[pop_go] , identifier[pop_n] ): literal[string] keyword[if] identifier[min_ratio] keyword[is] keyword[None] : keyword[return] keyword[True] identifier[stu_ratio] =...
def is_ratio_different(min_ratio, study_go, study_n, pop_go, pop_n): """ check if the ratio go /n is different between the study group and the population """ if min_ratio is None: return True # depends on [control=['if'], data=[]] stu_ratio = float(study_go) / study_n pop_ratio = fl...
def ctx() -> moderngl.Context: """ModernGL context""" win = window() if not win.ctx: raise RuntimeError("Attempting to get context before creation") return win.ctx
def function[ctx, parameter[]]: constant[ModernGL context] variable[win] assign[=] call[name[window], parameter[]] if <ast.UnaryOp object at 0x7da18f58e350> begin[:] <ast.Raise object at 0x7da18f58ec50> return[name[win].ctx]
keyword[def] identifier[ctx] ()-> identifier[moderngl] . identifier[Context] : literal[string] identifier[win] = identifier[window] () keyword[if] keyword[not] identifier[win] . identifier[ctx] : keyword[raise] identifier[RuntimeError] ( literal[string] ) keyword[return] identifier[...
def ctx() -> moderngl.Context: """ModernGL context""" win = window() if not win.ctx: raise RuntimeError('Attempting to get context before creation') # depends on [control=['if'], data=[]] return win.ctx
def abort_running(self) -> bool: """ Executes a hard abort by shutting down the event loop in this thread in which the running command was operating. This is carried out using the asyncio library to prevent the stopped execution from destabilizing the Python environment. ...
def function[abort_running, parameter[self]]: constant[ Executes a hard abort by shutting down the event loop in this thread in which the running command was operating. This is carried out using the asyncio library to prevent the stopped execution from destabilizing the Python en...
keyword[def] identifier[abort_running] ( identifier[self] )-> identifier[bool] : literal[string] keyword[if] keyword[not] identifier[self] . identifier[_loop] : keyword[return] keyword[False] keyword[try] : identifier[self] . identifier[_loop] . identifier[s...
def abort_running(self) -> bool: """ Executes a hard abort by shutting down the event loop in this thread in which the running command was operating. This is carried out using the asyncio library to prevent the stopped execution from destabilizing the Python environment. """ ...
def read_credentials(fname): """ read a simple text file from a private location to get username and password """ with open(fname, 'r') as f: username = f.readline().strip('\n') password = f.readline().strip('\n') return username, password
def function[read_credentials, parameter[fname]]: constant[ read a simple text file from a private location to get username and password ] with call[name[open], parameter[name[fname], constant[r]]] begin[:] variable[username] assign[=] call[call[name[f].readline, parameter[]]...
keyword[def] identifier[read_credentials] ( identifier[fname] ): literal[string] keyword[with] identifier[open] ( identifier[fname] , literal[string] ) keyword[as] identifier[f] : identifier[username] = identifier[f] . identifier[readline] (). identifier[strip] ( literal[string] ) ident...
def read_credentials(fname): """ read a simple text file from a private location to get username and password """ with open(fname, 'r') as f: username = f.readline().strip('\n') password = f.readline().strip('\n') # depends on [control=['with'], data=['f']] return (username, pas...
def read_creds(profile_name, csv_file = None, mfa_serial_arg = None, mfa_code = None, force_init = False, role_session_name = 'opinel'): """ Read credentials from anywhere (CSV, Environment, Instance metadata, config/credentials) :param profile_name: :param csv_file: :param mfa_seria...
def function[read_creds, parameter[profile_name, csv_file, mfa_serial_arg, mfa_code, force_init, role_session_name]]: constant[ Read credentials from anywhere (CSV, Environment, Instance metadata, config/credentials) :param profile_name: :param csv_file: :param mfa_serial_arg: :param mfa_co...
keyword[def] identifier[read_creds] ( identifier[profile_name] , identifier[csv_file] = keyword[None] , identifier[mfa_serial_arg] = keyword[None] , identifier[mfa_code] = keyword[None] , identifier[force_init] = keyword[False] , identifier[role_session_name] = literal[string] ): literal[string] identifie...
def read_creds(profile_name, csv_file=None, mfa_serial_arg=None, mfa_code=None, force_init=False, role_session_name='opinel'): """ Read credentials from anywhere (CSV, Environment, Instance metadata, config/credentials) :param profile_name: :param csv_file: :param mfa_serial_arg: :param mfa_cod...
def update_famplex(): """Update all the CSV files that form the FamPlex resource.""" famplex_url_pattern = \ 'https://raw.githubusercontent.com/sorgerlab/famplex/master/%s.csv' csv_names = ['entities', 'equivalences', 'gene_prefixes', 'grounding_map', 'relations'] for csv_name i...
def function[update_famplex, parameter[]]: constant[Update all the CSV files that form the FamPlex resource.] variable[famplex_url_pattern] assign[=] constant[https://raw.githubusercontent.com/sorgerlab/famplex/master/%s.csv] variable[csv_names] assign[=] list[[<ast.Constant object at 0x7da20c99...
keyword[def] identifier[update_famplex] (): literal[string] identifier[famplex_url_pattern] = literal[string] identifier[csv_names] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ] keyword[for] identifier[csv_name] keyword[in] identifier[csv_na...
def update_famplex(): """Update all the CSV files that form the FamPlex resource.""" famplex_url_pattern = 'https://raw.githubusercontent.com/sorgerlab/famplex/master/%s.csv' csv_names = ['entities', 'equivalences', 'gene_prefixes', 'grounding_map', 'relations'] for csv_name in csv_names: url = ...
def check_block(block_id): """ Verify that a block ID is valid >>> check_block(FIRST_BLOCK_MAINNET) True >>> check_block(FIRST_BLOCK_MAINNET-1) False >>> check_block(-1) False >>> check_block("abc") False >>> check_block(int(1e7) + 1) False >>> check_block(int(1e7) -...
def function[check_block, parameter[block_id]]: constant[ Verify that a block ID is valid >>> check_block(FIRST_BLOCK_MAINNET) True >>> check_block(FIRST_BLOCK_MAINNET-1) False >>> check_block(-1) False >>> check_block("abc") False >>> check_block(int(1e7) + 1) False...
keyword[def] identifier[check_block] ( identifier[block_id] ): literal[string] keyword[if] identifier[type] ( identifier[block_id] ) keyword[not] keyword[in] [ identifier[int] , identifier[long] ]: keyword[return] keyword[False] keyword[if] identifier[BLOCKSTACK_TEST] : keyword...
def check_block(block_id): """ Verify that a block ID is valid >>> check_block(FIRST_BLOCK_MAINNET) True >>> check_block(FIRST_BLOCK_MAINNET-1) False >>> check_block(-1) False >>> check_block("abc") False >>> check_block(int(1e7) + 1) False >>> check_block(int(1e7) -...
def preprocess_cell(self, cell, resources, cell_index): """Also extracts attachments""" from nbformat.notebooknode import NotebookNode attach_names = [] # Just move the attachment into an output for k, attach in cell.get('attachments', {}).items(): for mime_type in...
def function[preprocess_cell, parameter[self, cell, resources, cell_index]]: constant[Also extracts attachments] from relative_module[nbformat.notebooknode] import module[NotebookNode] variable[attach_names] assign[=] list[[]] for taget[tuple[[<ast.Name object at 0x7da1b196bbe0>, <ast.Name o...
keyword[def] identifier[preprocess_cell] ( identifier[self] , identifier[cell] , identifier[resources] , identifier[cell_index] ): literal[string] keyword[from] identifier[nbformat] . identifier[notebooknode] keyword[import] identifier[NotebookNode] identifier[attach_names] =[] ...
def preprocess_cell(self, cell, resources, cell_index): """Also extracts attachments""" from nbformat.notebooknode import NotebookNode attach_names = [] # Just move the attachment into an output for (k, attach) in cell.get('attachments', {}).items(): for mime_type in self.extract_output_type...
def user_relation_name(self): """ Returns the string name of the related name to the user. This provides a consistent interface across different organization model classes. """ return "{0}_{1}".format( self._meta.app_label.lower(), self.__class__.__name__.low...
def function[user_relation_name, parameter[self]]: constant[ Returns the string name of the related name to the user. This provides a consistent interface across different organization model classes. ] return[call[constant[{0}_{1}].format, parameter[call[name[self]._meta.app...
keyword[def] identifier[user_relation_name] ( identifier[self] ): literal[string] keyword[return] literal[string] . identifier[format] ( identifier[self] . identifier[_meta] . identifier[app_label] . identifier[lower] (), identifier[self] . identifier[__class__] . identifier[__name__] . i...
def user_relation_name(self): """ Returns the string name of the related name to the user. This provides a consistent interface across different organization model classes. """ return '{0}_{1}'.format(self._meta.app_label.lower(), self.__class__.__name__.lower())
def truncate(text, max_len=350, end='...'): """Truncate the supplied text for display. Arguments: text (:py:class:`str`): The text to truncate. max_len (:py:class:`int`, optional): The maximum length of the text before truncation (defaults to 350 characters). end (:py:class:`str`, opt...
def function[truncate, parameter[text, max_len, end]]: constant[Truncate the supplied text for display. Arguments: text (:py:class:`str`): The text to truncate. max_len (:py:class:`int`, optional): The maximum length of the text before truncation (defaults to 350 characters). end ...
keyword[def] identifier[truncate] ( identifier[text] , identifier[max_len] = literal[int] , identifier[end] = literal[string] ): literal[string] keyword[if] identifier[len] ( identifier[text] )<= identifier[max_len] : keyword[return] identifier[text] keyword[return] identifier[text] [: id...
def truncate(text, max_len=350, end='...'): """Truncate the supplied text for display. Arguments: text (:py:class:`str`): The text to truncate. max_len (:py:class:`int`, optional): The maximum length of the text before truncation (defaults to 350 characters). end (:py:class:`str`, opt...
def alpha_mod(self): """int: The additional alpha value used in render copy operations.""" a = ffi.new('Uint8 *') check_int_err(lib.SDL_GetTextureAlphaMod(self._ptr, a)) return a[0]
def function[alpha_mod, parameter[self]]: constant[int: The additional alpha value used in render copy operations.] variable[a] assign[=] call[name[ffi].new, parameter[constant[Uint8 *]]] call[name[check_int_err], parameter[call[name[lib].SDL_GetTextureAlphaMod, parameter[name[self]._ptr, name[a...
keyword[def] identifier[alpha_mod] ( identifier[self] ): literal[string] identifier[a] = identifier[ffi] . identifier[new] ( literal[string] ) identifier[check_int_err] ( identifier[lib] . identifier[SDL_GetTextureAlphaMod] ( identifier[self] . identifier[_ptr] , identifier[a] )) ...
def alpha_mod(self): """int: The additional alpha value used in render copy operations.""" a = ffi.new('Uint8 *') check_int_err(lib.SDL_GetTextureAlphaMod(self._ptr, a)) return a[0]
def report(self, account_id, status_ids = None, comment = None, forward = False): """ Report statuses to the instances administrators. Accepts a list of toot IDs associated with the report, and a comment. Set forward to True to forward a report of a remote user to that users ...
def function[report, parameter[self, account_id, status_ids, comment, forward]]: constant[ Report statuses to the instances administrators. Accepts a list of toot IDs associated with the report, and a comment. Set forward to True to forward a report of a remote user to that use...
keyword[def] identifier[report] ( identifier[self] , identifier[account_id] , identifier[status_ids] = keyword[None] , identifier[comment] = keyword[None] , identifier[forward] = keyword[False] ): literal[string] identifier[account_id] = identifier[self] . identifier[__unpack_id] ( identifier[accou...
def report(self, account_id, status_ids=None, comment=None, forward=False): """ Report statuses to the instances administrators. Accepts a list of toot IDs associated with the report, and a comment. Set forward to True to forward a report of a remote user to that users inst...
def returner(ret): ''' Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post ''' _options = _get_options(ret) webhook = _options.get('webhook', None) show_tasks = _options.get('show_tasks') author_icon = _options.get('autho...
def function[returner, parameter[ret]]: constant[ Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post ] variable[_options] assign[=] call[name[_get_options], parameter[name[ret]]] variable[webhook] assign[=] call[name[_...
keyword[def] identifier[returner] ( identifier[ret] ): literal[string] identifier[_options] = identifier[_get_options] ( identifier[ret] ) identifier[webhook] = identifier[_options] . identifier[get] ( literal[string] , keyword[None] ) identifier[show_tasks] = identifier[_options] . identifier[...
def returner(ret): """ Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post """ _options = _get_options(ret) webhook = _options.get('webhook', None) show_tasks = _options.get('show_tasks') author_icon = _options.get('author_...
def get_subgraph_by_node_search(graph: BELGraph, query: Strings) -> BELGraph: """Get a sub-graph induced over all nodes matching the query string. :param graph: A BEL Graph :param query: A query string or iterable of query strings for node names Thinly wraps :func:`search_node_names` and :func:`get_su...
def function[get_subgraph_by_node_search, parameter[graph, query]]: constant[Get a sub-graph induced over all nodes matching the query string. :param graph: A BEL Graph :param query: A query string or iterable of query strings for node names Thinly wraps :func:`search_node_names` and :func:`get_su...
keyword[def] identifier[get_subgraph_by_node_search] ( identifier[graph] : identifier[BELGraph] , identifier[query] : identifier[Strings] )-> identifier[BELGraph] : literal[string] identifier[nodes] = identifier[search_node_names] ( identifier[graph] , identifier[query] ) keyword[return] identifier[g...
def get_subgraph_by_node_search(graph: BELGraph, query: Strings) -> BELGraph: """Get a sub-graph induced over all nodes matching the query string. :param graph: A BEL Graph :param query: A query string or iterable of query strings for node names Thinly wraps :func:`search_node_names` and :func:`get_su...
def t_recipe_RECIPE_LINE(self, t): r'.*\n' t.type = 'RECIPE_LINE' t.lexer.lineno += t.value.count("\n") return t
def function[t_recipe_RECIPE_LINE, parameter[self, t]]: constant[.*\n] name[t].type assign[=] constant[RECIPE_LINE] <ast.AugAssign object at 0x7da20c795fc0> return[name[t]]
keyword[def] identifier[t_recipe_RECIPE_LINE] ( identifier[self] , identifier[t] ): literal[string] identifier[t] . identifier[type] = literal[string] identifier[t] . identifier[lexer] . identifier[lineno] += identifier[t] . identifier[value] . identifier[count] ( literal[string] ) ...
def t_recipe_RECIPE_LINE(self, t): """.*\\n""" t.type = 'RECIPE_LINE' t.lexer.lineno += t.value.count('\n') return t
def status_color(status): """Return the appropriate status color.""" status_color = c.Fore.GREEN if not status: status_color = c.Fore.RED return status_color
def function[status_color, parameter[status]]: constant[Return the appropriate status color.] variable[status_color] assign[=] name[c].Fore.GREEN if <ast.UnaryOp object at 0x7da1b0ce2fe0> begin[:] variable[status_color] assign[=] name[c].Fore.RED return[name[status_color]]
keyword[def] identifier[status_color] ( identifier[status] ): literal[string] identifier[status_color] = identifier[c] . identifier[Fore] . identifier[GREEN] keyword[if] keyword[not] identifier[status] : identifier[status_color] = identifier[c] . identifier[Fore] . identifi...
def status_color(status): """Return the appropriate status color.""" status_color = c.Fore.GREEN if not status: status_color = c.Fore.RED # depends on [control=['if'], data=[]] return status_color
def insert_one(self, doc, *args, **kwargs): """ Inserts one document into the collection If contains '_id' key it is used, else it is generated. :param doc: the document :return: InsertOneResult """ if self.table is None: self.build_table() if...
def function[insert_one, parameter[self, doc]]: constant[ Inserts one document into the collection If contains '_id' key it is used, else it is generated. :param doc: the document :return: InsertOneResult ] if compare[name[self].table is constant[None]] begin[:] ...
keyword[def] identifier[insert_one] ( identifier[self] , identifier[doc] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[self] . identifier[table] keyword[is] keyword[None] : identifier[self] . identifier[build_table] () keyword[if] ke...
def insert_one(self, doc, *args, **kwargs): """ Inserts one document into the collection If contains '_id' key it is used, else it is generated. :param doc: the document :return: InsertOneResult """ if self.table is None: self.build_table() # depends on [control=...
def info_signal(self, args): """Print information about a signal""" if len(args) == 0: return None signame = args[0] if signame in ['handle', 'signal']: # This has come from dbgr's info command if len(args) == 1: # Show all signal handlers ...
def function[info_signal, parameter[self, args]]: constant[Print information about a signal] if compare[call[name[len], parameter[name[args]]] equal[==] constant[0]] begin[:] return[constant[None]] variable[signame] assign[=] call[name[args]][constant[0]] if compare[name[signame]...
keyword[def] identifier[info_signal] ( identifier[self] , identifier[args] ): literal[string] keyword[if] identifier[len] ( identifier[args] )== literal[int] : keyword[return] keyword[None] identifier[signame] = identifier[args] [ literal[int] ] keyword[if] identifier[signame]...
def info_signal(self, args): """Print information about a signal""" if len(args) == 0: return None # depends on [control=['if'], data=[]] signame = args[0] if signame in ['handle', 'signal']: # This has come from dbgr's info command if len(args) == 1: # Show all sign...
def patch_mock_desc(self, patch, *args, **kwarg): """ Context manager or decorator in order to patch a mock definition of service endpoint in a test. :param patch: Dictionary in order to update endpoint's mock definition :type patch: dict :param service_name: Name of ser...
def function[patch_mock_desc, parameter[self, patch]]: constant[ Context manager or decorator in order to patch a mock definition of service endpoint in a test. :param patch: Dictionary in order to update endpoint's mock definition :type patch: dict :param service_name: ...
keyword[def] identifier[patch_mock_desc] ( identifier[self] , identifier[patch] ,* identifier[args] ,** identifier[kwarg] ): literal[string] keyword[return] identifier[PatchMockDescDefinition] ( identifier[patch] , identifier[self] ,* identifier[args] ,** identifier[kwarg] )
def patch_mock_desc(self, patch, *args, **kwarg): """ Context manager or decorator in order to patch a mock definition of service endpoint in a test. :param patch: Dictionary in order to update endpoint's mock definition :type patch: dict :param service_name: Name of service...
def match(self, p_todo): """ Performs a match on a priority in the todo. It gets priority from p_todo and compares it with user-entered expression based on the given operator (default ==). It does that however in reversed order to obtain more intuitive result. Example: (>B) will...
def function[match, parameter[self, p_todo]]: constant[ Performs a match on a priority in the todo. It gets priority from p_todo and compares it with user-entered expression based on the given operator (default ==). It does that however in reversed order to obtain more intuitive...
keyword[def] identifier[match] ( identifier[self] , identifier[p_todo] ): literal[string] identifier[operand1] = identifier[self] . identifier[value] identifier[operand2] = identifier[p_todo] . identifier[priority] () keyword[or] literal[string] keyword[return] identifier[sel...
def match(self, p_todo): """ Performs a match on a priority in the todo. It gets priority from p_todo and compares it with user-entered expression based on the given operator (default ==). It does that however in reversed order to obtain more intuitive result. Example: (>B) will ...
def _LayoutShapeFactory(shape_elm, parent): """ Return an instance of the appropriate shape proxy class for *shape_elm* on a slide layout. """ tag_name = shape_elm.tag if tag_name == qn('p:sp') and shape_elm.has_ph_elm: return LayoutPlaceholder(shape_elm, parent) return BaseShapeFact...
def function[_LayoutShapeFactory, parameter[shape_elm, parent]]: constant[ Return an instance of the appropriate shape proxy class for *shape_elm* on a slide layout. ] variable[tag_name] assign[=] name[shape_elm].tag if <ast.BoolOp object at 0x7da204961ba0> begin[:] return[ca...
keyword[def] identifier[_LayoutShapeFactory] ( identifier[shape_elm] , identifier[parent] ): literal[string] identifier[tag_name] = identifier[shape_elm] . identifier[tag] keyword[if] identifier[tag_name] == identifier[qn] ( literal[string] ) keyword[and] identifier[shape_elm] . identifier[has_ph_e...
def _LayoutShapeFactory(shape_elm, parent): """ Return an instance of the appropriate shape proxy class for *shape_elm* on a slide layout. """ tag_name = shape_elm.tag if tag_name == qn('p:sp') and shape_elm.has_ph_elm: return LayoutPlaceholder(shape_elm, parent) # depends on [control=[...
def delete_expired_requests(): """Delete expired inclusion requests.""" InclusionRequest.query.filter_by( InclusionRequest.expiry_date > datetime.utcnow()).delete() db.session.commit()
def function[delete_expired_requests, parameter[]]: constant[Delete expired inclusion requests.] call[call[name[InclusionRequest].query.filter_by, parameter[compare[name[InclusionRequest].expiry_date greater[>] call[name[datetime].utcnow, parameter[]]]]].delete, parameter[]] call[name[db].sessio...
keyword[def] identifier[delete_expired_requests] (): literal[string] identifier[InclusionRequest] . identifier[query] . identifier[filter_by] ( identifier[InclusionRequest] . identifier[expiry_date] > identifier[datetime] . identifier[utcnow] ()). identifier[delete] () identifier[db] . identifier...
def delete_expired_requests(): """Delete expired inclusion requests.""" InclusionRequest.query.filter_by(InclusionRequest.expiry_date > datetime.utcnow()).delete() db.session.commit()
def p_property_decl(self, p): """ property_decl : prop_open style_list t_semicolon | prop_open style_list css_important t_semicolon | prop_open empty t_semicolon """ l = len(p) p[0] = Property(list(p)[1:-1]...
def function[p_property_decl, parameter[self, p]]: constant[ property_decl : prop_open style_list t_semicolon | prop_open style_list css_important t_semicolon | prop_open empty t_semicolon ] variable[l] assign[=] c...
keyword[def] identifier[p_property_decl] ( identifier[self] , identifier[p] ): literal[string] identifier[l] = identifier[len] ( identifier[p] ) identifier[p] [ literal[int] ]= identifier[Property] ( identifier[list] ( identifier[p] )[ literal[int] :- literal[int] ], identifier[p] . identi...
def p_property_decl(self, p): """ property_decl : prop_open style_list t_semicolon | prop_open style_list css_important t_semicolon | prop_open empty t_semicolon """ l = len(p) p[0] = Property(list(p)[1:-1], p.lineno(l...
def fast_pop(self, key=NOT_SET, index=NOT_SET): """Pop a specific item quickly by swapping it to the end. Remove value with given key or index (last item by default) fast by swapping it to the last place first. Changes order of the remaining items (item that used to be last goes to the popped location). R...
def function[fast_pop, parameter[self, key, index]]: constant[Pop a specific item quickly by swapping it to the end. Remove value with given key or index (last item by default) fast by swapping it to the last place first. Changes order of the remaining items (item that used to be last goes to the popp...
keyword[def] identifier[fast_pop] ( identifier[self] , identifier[key] = identifier[NOT_SET] , identifier[index] = identifier[NOT_SET] ): literal[string] keyword[if] identifier[index] keyword[is] identifier[NOT_SET] keyword[and] identifier[key] keyword[is] keyword[not] identifier[NOT_SET] : identif...
def fast_pop(self, key=NOT_SET, index=NOT_SET): """Pop a specific item quickly by swapping it to the end. Remove value with given key or index (last item by default) fast by swapping it to the last place first. Changes order of the remaining items (item that used to be last goes to the popped location). ...
def command_list(prog_name, prof_mgr, prof_name, prog_args): """ Print the list of components. """ # Retrieve arguments parser = argparse.ArgumentParser( prog=prog_name ) args = parser.parse_args(prog_args) # Profile load prof_stub = prof_mgr.load(prof_name) # Print component list out = io.StringIO(...
def function[command_list, parameter[prog_name, prof_mgr, prof_name, prog_args]]: constant[ Print the list of components. ] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] variable[args] assign[=] call[name[parser].parse_args, parameter[name[prog_args]]] var...
keyword[def] identifier[command_list] ( identifier[prog_name] , identifier[prof_mgr] , identifier[prof_name] , identifier[prog_args] ): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[prog] = identifier[prog_name] ) identifier[args] = identifier[parse...
def command_list(prog_name, prof_mgr, prof_name, prog_args): """ Print the list of components. """ # Retrieve arguments parser = argparse.ArgumentParser(prog=prog_name) args = parser.parse_args(prog_args) # Profile load prof_stub = prof_mgr.load(prof_name) # Print component list out = io.String...
def _add_games_to_schedule(self, schedule): """ Add game information to list of games. Create a Game instance for the given game in the schedule and add it to the list of games the team has or will play during the season. Parameters ---------- schedule : PyQuery...
def function[_add_games_to_schedule, parameter[self, schedule]]: constant[ Add game information to list of games. Create a Game instance for the given game in the schedule and add it to the list of games the team has or will play during the season. Parameters ----------...
keyword[def] identifier[_add_games_to_schedule] ( identifier[self] , identifier[schedule] ): literal[string] keyword[for] identifier[item] keyword[in] identifier[schedule] : keyword[if] literal[string] keyword[in] identifier[str] ( identifier[item] ) keyword[or] literal[string] ...
def _add_games_to_schedule(self, schedule): """ Add game information to list of games. Create a Game instance for the given game in the schedule and add it to the list of games the team has or will play during the season. Parameters ---------- schedule : PyQuery obj...
def render_head(self, ctx, data): """ Put liveglue content into the header of this page to activate it, but otherwise delegate to my parent's renderer for <head>. """ ctx.tag[tags.invisible(render=tags.directive('liveglue'))] return _PublicPageMixin.render_head(self, ctx,...
def function[render_head, parameter[self, ctx, data]]: constant[ Put liveglue content into the header of this page to activate it, but otherwise delegate to my parent's renderer for <head>. ] call[name[ctx].tag][call[name[tags].invisible, parameter[]]] return[call[name[_Publi...
keyword[def] identifier[render_head] ( identifier[self] , identifier[ctx] , identifier[data] ): literal[string] identifier[ctx] . identifier[tag] [ identifier[tags] . identifier[invisible] ( identifier[render] = identifier[tags] . identifier[directive] ( literal[string] ))] keyword[return]...
def render_head(self, ctx, data): """ Put liveglue content into the header of this page to activate it, but otherwise delegate to my parent's renderer for <head>. """ ctx.tag[tags.invisible(render=tags.directive('liveglue'))] return _PublicPageMixin.render_head(self, ctx, data)
def refresh(self, url=CONST.PANEL_URL): """Refresh the alarm device.""" response_object = AbodeDevice.refresh(self, url) # pylint: disable=W0212 self._abode._panel.update(response_object[0]) return response_object
def function[refresh, parameter[self, url]]: constant[Refresh the alarm device.] variable[response_object] assign[=] call[name[AbodeDevice].refresh, parameter[name[self], name[url]]] call[name[self]._abode._panel.update, parameter[call[name[response_object]][constant[0]]]] return[name[respon...
keyword[def] identifier[refresh] ( identifier[self] , identifier[url] = identifier[CONST] . identifier[PANEL_URL] ): literal[string] identifier[response_object] = identifier[AbodeDevice] . identifier[refresh] ( identifier[self] , identifier[url] ) identifier[self] . identifier[_ab...
def refresh(self, url=CONST.PANEL_URL): """Refresh the alarm device.""" response_object = AbodeDevice.refresh(self, url) # pylint: disable=W0212 self._abode._panel.update(response_object[0]) return response_object
def downsample(self, df=None, ds_type='kmeans', axis='row', num_samples=100, random_state=1000): ''' Downsample the matrix rows or columns (currently supporting kmeans only). Users can optionally pass in a DataFrame to be downsampled (and this will be incorporated into the network object). ''' return d...
def function[downsample, parameter[self, df, ds_type, axis, num_samples, random_state]]: constant[ Downsample the matrix rows or columns (currently supporting kmeans only). Users can optionally pass in a DataFrame to be downsampled (and this will be incorporated into the network object). ] return[ca...
keyword[def] identifier[downsample] ( identifier[self] , identifier[df] = keyword[None] , identifier[ds_type] = literal[string] , identifier[axis] = literal[string] , identifier[num_samples] = literal[int] , identifier[random_state] = literal[int] ): literal[string] keyword[return] identifier[downsample_...
def downsample(self, df=None, ds_type='kmeans', axis='row', num_samples=100, random_state=1000): """ Downsample the matrix rows or columns (currently supporting kmeans only). Users can optionally pass in a DataFrame to be downsampled (and this will be incorporated into the network object). """ return do...
def _mirror_penalized(self, f_values, idx): """obsolete and subject to removal (TODO), return modified f-values such that for each mirror one becomes worst. This function is useless when selective mirroring is applied with no more than (lambda-mu)/2 solutions. Mirrors are leadi...
def function[_mirror_penalized, parameter[self, f_values, idx]]: constant[obsolete and subject to removal (TODO), return modified f-values such that for each mirror one becomes worst. This function is useless when selective mirroring is applied with no more than (lambda-mu)/2 solutions....
keyword[def] identifier[_mirror_penalized] ( identifier[self] , identifier[f_values] , identifier[idx] ): literal[string] keyword[assert] identifier[len] ( identifier[f_values] )>= literal[int] * identifier[len] ( identifier[idx] ) identifier[m] = identifier[np] . identifier[max] ( identi...
def _mirror_penalized(self, f_values, idx): """obsolete and subject to removal (TODO), return modified f-values such that for each mirror one becomes worst. This function is useless when selective mirroring is applied with no more than (lambda-mu)/2 solutions. Mirrors are leading a...
def prepare_mac_header(token, uri, key, http_method, nonce=None, headers=None, body=None, ext='', hash_algorithm='hmac-sha-1', issue_time=None, draft=0): "...
def function[prepare_mac_header, parameter[token, uri, key, http_method, nonce, headers, body, ext, hash_algorithm, issue_time, draft]]: constant[Add an `MAC Access Authentication`_ signature to headers. Unlike OAuth 1, this HMAC signature does not require inclusion of the request payload/body, neither...
keyword[def] identifier[prepare_mac_header] ( identifier[token] , identifier[uri] , identifier[key] , identifier[http_method] , identifier[nonce] = keyword[None] , identifier[headers] = keyword[None] , identifier[body] = keyword[None] , identifier[ext] = literal[string] , identifier[hash_algorithm] = literal[str...
def prepare_mac_header(token, uri, key, http_method, nonce=None, headers=None, body=None, ext='', hash_algorithm='hmac-sha-1', issue_time=None, draft=0): """Add an `MAC Access Authentication`_ signature to headers. Unlike OAuth 1, this HMAC signature does not require inclusion of the request payload/body, ...
def get_segments(self): """Get segments for analysis. Creates instance of trans.Segments.""" # Chunking chunk = {k: v.isChecked() for k, v in self.chunk.items()} lock_to_staging = self.lock_to_staging.get_value() epoch_dur = self.epoch_param['dur'].get_value() epoch_overl...
def function[get_segments, parameter[self]]: constant[Get segments for analysis. Creates instance of trans.Segments.] variable[chunk] assign[=] <ast.DictComp object at 0x7da1b0ec0eb0> variable[lock_to_staging] assign[=] call[name[self].lock_to_staging.get_value, parameter[]] variable[epo...
keyword[def] identifier[get_segments] ( identifier[self] ): literal[string] identifier[chunk] ={ identifier[k] : identifier[v] . identifier[isChecked] () keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . identifier[chunk] . identifier[items] ()} identifi...
def get_segments(self): """Get segments for analysis. Creates instance of trans.Segments.""" # Chunking chunk = {k: v.isChecked() for (k, v) in self.chunk.items()} lock_to_staging = self.lock_to_staging.get_value() epoch_dur = self.epoch_param['dur'].get_value() epoch_overlap = self.epoch_param[...
def _strip_extra(elements): """Remove the "extra == ..." operands from the list. This is not a comprehensive implementation, but relies on an important characteristic of metadata generation: The "extra == ..." operand is always associated with an "and" operator. This means that we can simply remove the...
def function[_strip_extra, parameter[elements]]: constant[Remove the "extra == ..." operands from the list. This is not a comprehensive implementation, but relies on an important characteristic of metadata generation: The "extra == ..." operand is always associated with an "and" operator. This mean...
keyword[def] identifier[_strip_extra] ( identifier[elements] ): literal[string] identifier[extra_indexes] =[] keyword[for] identifier[i] , identifier[element] keyword[in] identifier[enumerate] ( identifier[elements] ): keyword[if] identifier[isinstance] ( identifier[element] , identifier[...
def _strip_extra(elements): """Remove the "extra == ..." operands from the list. This is not a comprehensive implementation, but relies on an important characteristic of metadata generation: The "extra == ..." operand is always associated with an "and" operator. This means that we can simply remove the...
def create_bot(self, name, avatar_url=None, callback_url=None, dm_notification=None, **kwargs): """Create a new bot in a particular group. :param str name: bot name :param str avatar_url: the URL of an image to use as an avatar :param str callback_url: a POST-back URL...
def function[create_bot, parameter[self, name, avatar_url, callback_url, dm_notification]]: constant[Create a new bot in a particular group. :param str name: bot name :param str avatar_url: the URL of an image to use as an avatar :param str callback_url: a POST-back URL for each new mes...
keyword[def] identifier[create_bot] ( identifier[self] , identifier[name] , identifier[avatar_url] = keyword[None] , identifier[callback_url] = keyword[None] , identifier[dm_notification] = keyword[None] , ** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[_bots...
def create_bot(self, name, avatar_url=None, callback_url=None, dm_notification=None, **kwargs): """Create a new bot in a particular group. :param str name: bot name :param str avatar_url: the URL of an image to use as an avatar :param str callback_url: a POST-back URL for each new message ...
def open_only(func): """ Decorator for `.Channel` methods which performs an openness check. :raises: `.SSHException` -- If the wrapped method is called on an unopened `.Channel`. """ @wraps(func) def _check(self, *args, **kwds): if ( self.closed ...
def function[open_only, parameter[func]]: constant[ Decorator for `.Channel` methods which performs an openness check. :raises: `.SSHException` -- If the wrapped method is called on an unopened `.Channel`. ] def function[_check, parameter[self]]: if <ast.Bool...
keyword[def] identifier[open_only] ( identifier[func] ): literal[string] @ identifier[wraps] ( identifier[func] ) keyword[def] identifier[_check] ( identifier[self] ,* identifier[args] ,** identifier[kwds] ): keyword[if] ( identifier[self] . identifier[closed] keyword[or] ...
def open_only(func): """ Decorator for `.Channel` methods which performs an openness check. :raises: `.SSHException` -- If the wrapped method is called on an unopened `.Channel`. """ @wraps(func) def _check(self, *args, **kwds): if self.closed or self.eof_received or se...
def calculate_item_depth(self, tree_alias, item_id, depth=0): """Calculates depth of the item in the tree. :param str|unicode tree_alias: :param int item_id: :param int depth: :rtype: int """ item = self.get_item_by_id(tree_alias, item_id) if hasattr(ite...
def function[calculate_item_depth, parameter[self, tree_alias, item_id, depth]]: constant[Calculates depth of the item in the tree. :param str|unicode tree_alias: :param int item_id: :param int depth: :rtype: int ] variable[item] assign[=] call[name[self].get_ite...
keyword[def] identifier[calculate_item_depth] ( identifier[self] , identifier[tree_alias] , identifier[item_id] , identifier[depth] = literal[int] ): literal[string] identifier[item] = identifier[self] . identifier[get_item_by_id] ( identifier[tree_alias] , identifier[item_id] ) keyword[i...
def calculate_item_depth(self, tree_alias, item_id, depth=0): """Calculates depth of the item in the tree. :param str|unicode tree_alias: :param int item_id: :param int depth: :rtype: int """ item = self.get_item_by_id(tree_alias, item_id) if hasattr(item, 'depth'): ...
def float_with_multiplier(string): """Convert string with optional k, M, G, T multiplier to float""" match = re_float_with_multiplier.search(string) if not match or not match.group('num'): raise ValueError('String "{}" is not numeric!'.format(string)) num = float(match.group('num')) multi =...
def function[float_with_multiplier, parameter[string]]: constant[Convert string with optional k, M, G, T multiplier to float] variable[match] assign[=] call[name[re_float_with_multiplier].search, parameter[name[string]]] if <ast.BoolOp object at 0x7da1b023c610> begin[:] <ast.Raise object...
keyword[def] identifier[float_with_multiplier] ( identifier[string] ): literal[string] identifier[match] = identifier[re_float_with_multiplier] . identifier[search] ( identifier[string] ) keyword[if] keyword[not] identifier[match] keyword[or] keyword[not] identifier[match] . identifier[group] ( l...
def float_with_multiplier(string): """Convert string with optional k, M, G, T multiplier to float""" match = re_float_with_multiplier.search(string) if not match or not match.group('num'): raise ValueError('String "{}" is not numeric!'.format(string)) # depends on [control=['if'], data=[]] num ...
def get_dev_mac_learn(devid, auth, url): ''' function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on the target device. :param devid: int value of the target device :param auth: requests auth object #usually auth.creds from auth pyhpeimc.a...
def function[get_dev_mac_learn, parameter[devid, auth, url]]: constant[ function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on the target device. :param devid: int value of the target device :param auth: requests auth object #usually ...
keyword[def] identifier[get_dev_mac_learn] ( identifier[devid] , identifier[auth] , identifier[url] ): literal[string] identifier[get_dev_mac_learn_url] = literal[string] + identifier[str] ( identifier[devid] ) identifier[f_url] = identifier[url] + identifier[get_dev_mac_learn_url] keyword[try] ...
def get_dev_mac_learn(devid, auth, url): """ function takes devid of specific device and issues a RESTFUL call to gather the current IP-MAC learning entries on the target device. :param devid: int value of the target device :param auth: requests auth object #usually auth.creds from auth pyhpeimc.a...
def from_json(buffer, auto_flatten=True, raise_for_index=True): """Parses a JSON string into either a view or an index. If auto flatten is enabled a sourcemap index that does not contain external references is automatically flattened into a view. By default if an index would be returned an `IndexedSou...
def function[from_json, parameter[buffer, auto_flatten, raise_for_index]]: constant[Parses a JSON string into either a view or an index. If auto flatten is enabled a sourcemap index that does not contain external references is automatically flattened into a view. By default if an index would be re...
keyword[def] identifier[from_json] ( identifier[buffer] , identifier[auto_flatten] = keyword[True] , identifier[raise_for_index] = keyword[True] ): literal[string] identifier[buffer] = identifier[to_bytes] ( identifier[buffer] ) identifier[view_out] = identifier[_ffi] . identifier[new] ( literal[stri...
def from_json(buffer, auto_flatten=True, raise_for_index=True): """Parses a JSON string into either a view or an index. If auto flatten is enabled a sourcemap index that does not contain external references is automatically flattened into a view. By default if an index would be returned an `IndexedSou...
def validate_create_package(package_format, owner, repo, **kwargs): """Validate parameters for creating a package.""" client = get_packages_api() with catch_raise_api_exception(): check = getattr( client, "packages_validate_upload_%s_with_http_info" % package_format ) _...
def function[validate_create_package, parameter[package_format, owner, repo]]: constant[Validate parameters for creating a package.] variable[client] assign[=] call[name[get_packages_api], parameter[]] with call[name[catch_raise_api_exception], parameter[]] begin[:] variable[chec...
keyword[def] identifier[validate_create_package] ( identifier[package_format] , identifier[owner] , identifier[repo] ,** identifier[kwargs] ): literal[string] identifier[client] = identifier[get_packages_api] () keyword[with] identifier[catch_raise_api_exception] (): identifier[check] = ide...
def validate_create_package(package_format, owner, repo, **kwargs): """Validate parameters for creating a package.""" client = get_packages_api() with catch_raise_api_exception(): check = getattr(client, 'packages_validate_upload_%s_with_http_info' % package_format) (_, _, headers) = check(o...
def convert(value): """Converts to a C language appropriate identifier format. """ s0 = "Sbp" + value if value in COLLISIONS else value s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', s0) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() + "_t"
def function[convert, parameter[value]]: constant[Converts to a C language appropriate identifier format. ] variable[s0] assign[=] <ast.IfExp object at 0x7da1b0510e80> variable[s1] assign[=] call[name[re].sub, parameter[constant[(.)([A-Z][a-z]+)], constant[\1_\2], name[s0]]] return[binary...
keyword[def] identifier[convert] ( identifier[value] ): literal[string] identifier[s0] = literal[string] + identifier[value] keyword[if] identifier[value] keyword[in] identifier[COLLISIONS] keyword[else] identifier[value] identifier[s1] = identifier[re] . identifier[sub] ( literal[string] , literal[s...
def convert(value): """Converts to a C language appropriate identifier format. """ s0 = 'Sbp' + value if value in COLLISIONS else value s1 = re.sub('(.)([A-Z][a-z]+)', '\\1_\\2', s0) return re.sub('([a-z0-9])([A-Z])', '\\1_\\2', s1).lower() + '_t'
def parse(self): """Parse the table data string into records.""" self.parse_fields() records = [] for line in self.t['data'].split('\n'): if EMPTY_ROW.match(line): continue row = [self.autoconvert(line[start_field:end_field+1]) ...
def function[parse, parameter[self]]: constant[Parse the table data string into records.] call[name[self].parse_fields, parameter[]] variable[records] assign[=] list[[]] for taget[name[line]] in starred[call[call[name[self].t][constant[data]].split, parameter[constant[ ]]]] begin[:] ...
keyword[def] identifier[parse] ( identifier[self] ): literal[string] identifier[self] . identifier[parse_fields] () identifier[records] =[] keyword[for] identifier[line] keyword[in] identifier[self] . identifier[t] [ literal[string] ]. identifier[split] ( literal[string] ): ...
def parse(self): """Parse the table data string into records.""" self.parse_fields() records = [] for line in self.t['data'].split('\n'): if EMPTY_ROW.match(line): continue # depends on [control=['if'], data=[]] row = [self.autoconvert(line[start_field:end_field + 1]) for (s...
def solve(self, print_solution=False): """Solves the current integer program and returns the computed layout. Args: print_solution: An optional boolean indicating whether to print the full solution in human-readable format. Returns: The computed layout (as a string). Raises: ...
def function[solve, parameter[self, print_solution]]: constant[Solves the current integer program and returns the computed layout. Args: print_solution: An optional boolean indicating whether to print the full solution in human-readable format. Returns: The computed layout (as a st...
keyword[def] identifier[solve] ( identifier[self] , identifier[print_solution] = keyword[False] ): literal[string] identifier[self] . identifier[_cp_solver] = identifier[cp_model] . identifier[CpSolver] () identifier[status] = identifier[self] . identifier[_cp_solver] . identifier[Solve] ( identi...
def solve(self, print_solution=False): """Solves the current integer program and returns the computed layout. Args: print_solution: An optional boolean indicating whether to print the full solution in human-readable format. Returns: The computed layout (as a string). Raises: ...
def sub(cls, *mixins_and_dicts, **values): """Create and instantiate a sub-injector. Mixins and local value dicts can be passed in as arguments. Local values can also be passed in as keyword arguments. """ class SubInjector(cls): pass mixins = [ x for x in...
def function[sub, parameter[cls]]: constant[Create and instantiate a sub-injector. Mixins and local value dicts can be passed in as arguments. Local values can also be passed in as keyword arguments. ] class class[SubInjector, parameter[]] begin[:] pass variable...
keyword[def] identifier[sub] ( identifier[cls] ,* identifier[mixins_and_dicts] ,** identifier[values] ): literal[string] keyword[class] identifier[SubInjector] ( identifier[cls] ): keyword[pass] identifier[mixins] =[ identifier[x] keyword[for] identifier[x] keyword[in] ...
def sub(cls, *mixins_and_dicts, **values): """Create and instantiate a sub-injector. Mixins and local value dicts can be passed in as arguments. Local values can also be passed in as keyword arguments. """ class SubInjector(cls): pass mixins = [x for x in mixins_and_dicts ...
def scale_0to1(image_in, exclude_outliers_below=False, exclude_outliers_above=False): """Scale the two images to [0, 1] based on min/max from both. Parameters ----------- image_in : ndarray Input image exclude_outliers_{below,above} : float Lower/upper...
def function[scale_0to1, parameter[image_in, exclude_outliers_below, exclude_outliers_above]]: constant[Scale the two images to [0, 1] based on min/max from both. Parameters ----------- image_in : ndarray Input image exclude_outliers_{below,above} : float Lower/upper limit, a v...
keyword[def] identifier[scale_0to1] ( identifier[image_in] , identifier[exclude_outliers_below] = keyword[False] , identifier[exclude_outliers_above] = keyword[False] ): literal[string] identifier[min_value] = identifier[image_in] . identifier[min] () identifier[max_value] = identifier[image_in] . ...
def scale_0to1(image_in, exclude_outliers_below=False, exclude_outliers_above=False): """Scale the two images to [0, 1] based on min/max from both. Parameters ----------- image_in : ndarray Input image exclude_outliers_{below,above} : float Lower/upper limit, a value between 0 and ...