code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def get_reviews(self, listing_id, offset=0, limit=20): """ Get reviews for a given listing """ params = { '_order': 'language_country', 'listing_id': str(listing_id), '_offset': str(offset), 'role': 'all', '_limit': str(limit), ...
def function[get_reviews, parameter[self, listing_id, offset, limit]]: constant[ Get reviews for a given listing ] variable[params] assign[=] dictionary[[<ast.Constant object at 0x7da20c6c5540>, <ast.Constant object at 0x7da20c6c66e0>, <ast.Constant object at 0x7da20c6c4160>, <ast.Consta...
keyword[def] identifier[get_reviews] ( identifier[self] , identifier[listing_id] , identifier[offset] = literal[int] , identifier[limit] = literal[int] ): literal[string] identifier[params] ={ literal[string] : literal[string] , literal[string] : identifier[str] ( identifier[listi...
def get_reviews(self, listing_id, offset=0, limit=20): """ Get reviews for a given listing """ params = {'_order': 'language_country', 'listing_id': str(listing_id), '_offset': str(offset), 'role': 'all', '_limit': str(limit), '_format': 'for_mobile_client'} print(self._session.headers) ...
def p_pkg_desc_1(self, p): """pkg_desc : PKG_DESC TEXT""" try: if six.PY2: value = p[2].decode(encoding='utf-8') else: value = p[2] self.builder.set_pkg_desc(self.document, value) except CardinalityError: self.more_t...
def function[p_pkg_desc_1, parameter[self, p]]: constant[pkg_desc : PKG_DESC TEXT] <ast.Try object at 0x7da1b0159120>
keyword[def] identifier[p_pkg_desc_1] ( identifier[self] , identifier[p] ): literal[string] keyword[try] : keyword[if] identifier[six] . identifier[PY2] : identifier[value] = identifier[p] [ literal[int] ]. identifier[decode] ( identifier[encoding] = literal[string] )...
def p_pkg_desc_1(self, p): """pkg_desc : PKG_DESC TEXT""" try: if six.PY2: value = p[2].decode(encoding='utf-8') # depends on [control=['if'], data=[]] else: value = p[2] self.builder.set_pkg_desc(self.document, value) # depends on [control=['try'], data=[]] ...
def define_new(cls, name, members, is_abstract=False): """ Define a new struct type derived from the current type. Parameters ---------- name: str Name of the struct type members: {member_name : type} Dictionary of struct member types. is_...
def function[define_new, parameter[cls, name, members, is_abstract]]: constant[ Define a new struct type derived from the current type. Parameters ---------- name: str Name of the struct type members: {member_name : type} Dictionary of struct memb...
keyword[def] identifier[define_new] ( identifier[cls] , identifier[name] , identifier[members] , identifier[is_abstract] = keyword[False] ): literal[string] identifier[m] = identifier[OrderedDict] ( identifier[cls] . identifier[_members] ) keyword[if] identifier[set] ( identifie...
def define_new(cls, name, members, is_abstract=False): """ Define a new struct type derived from the current type. Parameters ---------- name: str Name of the struct type members: {member_name : type} Dictionary of struct member types. is_abst...
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None): ''' Build and return a pkginfo namedtuple ''' pkginfo_tuple = collections.namedtuple( 'PkgInfo', ('name', 'version', 'arch', 'repoid', 'install_date', 'install_date_time_t') ) return p...
def function[pkginfo, parameter[name, version, arch, repoid, install_date, install_date_time_t]]: constant[ Build and return a pkginfo namedtuple ] variable[pkginfo_tuple] assign[=] call[name[collections].namedtuple, parameter[constant[PkgInfo], tuple[[<ast.Constant object at 0x7da1b2121f30>, <a...
keyword[def] identifier[pkginfo] ( identifier[name] , identifier[version] , identifier[arch] , identifier[repoid] , identifier[install_date] = keyword[None] , identifier[install_date_time_t] = keyword[None] ): literal[string] identifier[pkginfo_tuple] = identifier[collections] . identifier[namedtuple] ( ...
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None): """ Build and return a pkginfo namedtuple """ pkginfo_tuple = collections.namedtuple('PkgInfo', ('name', 'version', 'arch', 'repoid', 'install_date', 'install_date_time_t')) return pkginfo_tuple(name, version, arc...
def t2T(self, seg, t): """returns the path parameter T which corresponds to the segment parameter t. In other words, for any Path object, path, and any segment in path, seg, T(t) = path.t2T(seg, t) is the unique reparameterization such that path.point(T(t)) == seg.point(t) for all ...
def function[t2T, parameter[self, seg, t]]: constant[returns the path parameter T which corresponds to the segment parameter t. In other words, for any Path object, path, and any segment in path, seg, T(t) = path.t2T(seg, t) is the unique reparameterization such that path.point(T(t)) =...
keyword[def] identifier[t2T] ( identifier[self] , identifier[seg] , identifier[t] ): literal[string] identifier[self] . identifier[_calc_lengths] () keyword[if] identifier[isinstance] ( identifier[seg] , identifier[int] ): identifier[seg_idx] = identifier[seg] ...
def t2T(self, seg, t): """returns the path parameter T which corresponds to the segment parameter t. In other words, for any Path object, path, and any segment in path, seg, T(t) = path.t2T(seg, t) is the unique reparameterization such that path.point(T(t)) == seg.point(t) for all ...
def register(self, *actions): """Register `actions` in the current application. All `actions` must be an instance of :class:`.Action` or one of its subclasses. If `overwrite` is `True`, then it is allowed to overwrite an existing action with same name and category; else `ValueError` ...
def function[register, parameter[self]]: constant[Register `actions` in the current application. All `actions` must be an instance of :class:`.Action` or one of its subclasses. If `overwrite` is `True`, then it is allowed to overwrite an existing action with same name and category; else...
keyword[def] identifier[register] ( identifier[self] ,* identifier[actions] ): literal[string] keyword[assert] identifier[self] . identifier[installed] (), literal[string] keyword[assert] identifier[all] ( identifier[isinstance] ( identifier[a] , identifier[Action] ) keyword[for] ident...
def register(self, *actions): """Register `actions` in the current application. All `actions` must be an instance of :class:`.Action` or one of its subclasses. If `overwrite` is `True`, then it is allowed to overwrite an existing action with same name and category; else `ValueError` ...
def as_requirement(self): """Return a ``Requirement`` that matches this distribution exactly""" if isinstance(self.parsed_version, packaging.version.Version): spec = "%s==%s" % (self.project_name, self.parsed_version) else: spec = "%s===%s" % (self.project_name, self.pars...
def function[as_requirement, parameter[self]]: constant[Return a ``Requirement`` that matches this distribution exactly] if call[name[isinstance], parameter[name[self].parsed_version, name[packaging].version.Version]] begin[:] variable[spec] assign[=] binary_operation[constant[%s==%s] <a...
keyword[def] identifier[as_requirement] ( identifier[self] ): literal[string] keyword[if] identifier[isinstance] ( identifier[self] . identifier[parsed_version] , identifier[packaging] . identifier[version] . identifier[Version] ): identifier[spec] = literal[string] %( identifier[self...
def as_requirement(self): """Return a ``Requirement`` that matches this distribution exactly""" if isinstance(self.parsed_version, packaging.version.Version): spec = '%s==%s' % (self.project_name, self.parsed_version) # depends on [control=['if'], data=[]] else: spec = '%s===%s' % (self.pro...
def mehring_values(self): """ Returns: the Chemical shielding tensor in Mehring Notation """ pas=self.principal_axis_system sigma_iso=pas.trace() / 3 sigma_11, sigma_22, sigma_33=np.diag(pas) return self.MehringNotation(sigma_iso, sigma_11, sigma_22, sigma_33)
def function[mehring_values, parameter[self]]: constant[ Returns: the Chemical shielding tensor in Mehring Notation ] variable[pas] assign[=] name[self].principal_axis_system variable[sigma_iso] assign[=] binary_operation[call[name[pas].trace, parameter[]] / constant[3]] ...
keyword[def] identifier[mehring_values] ( identifier[self] ): literal[string] identifier[pas] = identifier[self] . identifier[principal_axis_system] identifier[sigma_iso] = identifier[pas] . identifier[trace] ()/ literal[int] identifier[sigma_11] , identifier[sigma_22] , identif...
def mehring_values(self): """ Returns: the Chemical shielding tensor in Mehring Notation """ pas = self.principal_axis_system sigma_iso = pas.trace() / 3 (sigma_11, sigma_22, sigma_33) = np.diag(pas) return self.MehringNotation(sigma_iso, sigma_11, sigma_22, sigma_33)
def get_task(self, name): """Get task by name or create it if it does not exists.""" if name in self.tasks.keys(): task = self.tasks[name] else: task = Task(name) self.tasks[name] = task return task
def function[get_task, parameter[self, name]]: constant[Get task by name or create it if it does not exists.] if compare[name[name] in call[name[self].tasks.keys, parameter[]]] begin[:] variable[task] assign[=] call[name[self].tasks][name[name]] return[name[task]]
keyword[def] identifier[get_task] ( identifier[self] , identifier[name] ): literal[string] keyword[if] identifier[name] keyword[in] identifier[self] . identifier[tasks] . identifier[keys] (): identifier[task] = identifier[self] . identifier[tasks] [ identifier[name] ] keywo...
def get_task(self, name): """Get task by name or create it if it does not exists.""" if name in self.tasks.keys(): task = self.tasks[name] # depends on [control=['if'], data=['name']] else: task = Task(name) self.tasks[name] = task return task
def duplicate(self): ''' Returns a copy of the current contact element. @returns: Contact ''' return self.__class__(name=self.name, identifier=self.identifier, phone=self.phone, require_id=self.__require_id, address=self...
def function[duplicate, parameter[self]]: constant[ Returns a copy of the current contact element. @returns: Contact ] return[call[name[self].__class__, parameter[]]]
keyword[def] identifier[duplicate] ( identifier[self] ): literal[string] keyword[return] identifier[self] . identifier[__class__] ( identifier[name] = identifier[self] . identifier[name] , identifier[identifier] = identifier[self] . identifier[identifier] , identifier[phone] = identifier[...
def duplicate(self): """ Returns a copy of the current contact element. @returns: Contact """ return self.__class__(name=self.name, identifier=self.identifier, phone=self.phone, require_id=self.__require_id, address=self.address.duplicate())
def get_ADC_value(bus, addr, channel): """ This method selects a channel and initiates conversion The ADC operates at 240 SPS (12 bits) with 1x gain One shot conversions are used, meaning a wait period is needed in order to acquire new data. This is done via a constant poll of ...
def function[get_ADC_value, parameter[bus, addr, channel]]: constant[ This method selects a channel and initiates conversion The ADC operates at 240 SPS (12 bits) with 1x gain One shot conversions are used, meaning a wait period is needed in order to acquire new data. This is done via a ...
keyword[def] identifier[get_ADC_value] ( identifier[bus] , identifier[addr] , identifier[channel] ): literal[string] keyword[if] identifier[channel] == literal[int] : identifier[INIT] = literal[int] keyword[elif] identifier[channel] == literal[int] : identifier[INIT] = litera...
def get_ADC_value(bus, addr, channel): """ This method selects a channel and initiates conversion The ADC operates at 240 SPS (12 bits) with 1x gain One shot conversions are used, meaning a wait period is needed in order to acquire new data. This is done via a constant poll of the re...
def cycle(arrays, descs=None, cadence=0.6, toworlds=None, drawoverlay=None, yflip=False, tostatuses=None, run_main=True, save_after_viewing=None): """Interactively display a series of 2D data arrays. arrays An iterable of 2D arrays (a 3D array works). descs An iterable of te...
def function[cycle, parameter[arrays, descs, cadence, toworlds, drawoverlay, yflip, tostatuses, run_main, save_after_viewing]]: constant[Interactively display a series of 2D data arrays. arrays An iterable of 2D arrays (a 3D array works). descs An iterable of text descriptions, one for each...
keyword[def] identifier[cycle] ( identifier[arrays] , identifier[descs] = keyword[None] , identifier[cadence] = literal[int] , identifier[toworlds] = keyword[None] , identifier[drawoverlay] = keyword[None] , identifier[yflip] = keyword[False] , identifier[tostatuses] = keyword[None] , identifier[run_main] = keyword[...
def cycle(arrays, descs=None, cadence=0.6, toworlds=None, drawoverlay=None, yflip=False, tostatuses=None, run_main=True, save_after_viewing=None): """Interactively display a series of 2D data arrays. arrays An iterable of 2D arrays (a 3D array works). descs An iterable of text descriptions, one...
def parse_auth_token(self, auth_token): """ Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** dict with Auth Token constituents """ # remove the random security key value from the front of the a...
def function[parse_auth_token, parameter[self, auth_token]]: constant[ Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** dict with Auth Token constituents ] variable[auth_token_cleaned] assign[=...
keyword[def] identifier[parse_auth_token] ( identifier[self] , identifier[auth_token] ): literal[string] identifier[auth_token_cleaned] = identifier[auth_token] . identifier[split] ( literal[string] , literal[int] )[ literal[int] ] identifier[auth_token_decoded] = identif...
def parse_auth_token(self, auth_token): """ Break auth_token up into it's constituent values. **Parameters:** - **auth_token:** Auth_token string **Returns:** dict with Auth Token constituents """ # remove the random security key value from the front of the auth_toke...
def _get_user(self) -> Dict: """ Same thing as for `_get_chat()` but for the user related to the message. """ if 'callback_query' in self._update: return self._update['callback_query']['from'] elif 'inline_query' in self._update: return self._upda...
def function[_get_user, parameter[self]]: constant[ Same thing as for `_get_chat()` but for the user related to the message. ] if compare[constant[callback_query] in name[self]._update] begin[:] return[call[call[name[self]._update][constant[callback_query]]][constant[from...
keyword[def] identifier[_get_user] ( identifier[self] )-> identifier[Dict] : literal[string] keyword[if] literal[string] keyword[in] identifier[self] . identifier[_update] : keyword[return] identifier[self] . identifier[_update] [ literal[string] ][ literal[string] ] keyw...
def _get_user(self) -> Dict: """ Same thing as for `_get_chat()` but for the user related to the message. """ if 'callback_query' in self._update: return self._update['callback_query']['from'] # depends on [control=['if'], data=[]] elif 'inline_query' in self._update: ...
def is_struct(declaration): """ Returns True if declaration represents a C++ struct Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ struct """ if not is_class(declaration): return False decl = cla...
def function[is_struct, parameter[declaration]]: constant[ Returns True if declaration represents a C++ struct Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ struct ] if <ast.UnaryOp object at 0x7da1...
keyword[def] identifier[is_struct] ( identifier[declaration] ): literal[string] keyword[if] keyword[not] identifier[is_class] ( identifier[declaration] ): keyword[return] keyword[False] identifier[decl] = identifier[class_traits] . identifier[get_declaration] ( identifier[declaration] ) ...
def is_struct(declaration): """ Returns True if declaration represents a C++ struct Args: declaration (declaration_t): the declaration to be checked. Returns: bool: True if declaration represents a C++ struct """ if not is_class(declaration): return False # depends on ...
def getLogger(name='generalLoggerName',dr='',lvl=20,addFH=True,addSH=True,): """This will either return the logging object already instantiated, or instantiate a new one and return it. **Use this function to both create and return any logger** to avoid accidentally adding additional handlers by using...
def function[getLogger, parameter[name, dr, lvl, addFH, addSH]]: constant[This will either return the logging object already instantiated, or instantiate a new one and return it. **Use this function to both create and return any logger** to avoid accidentally adding additional handlers by using t...
keyword[def] identifier[getLogger] ( identifier[name] = literal[string] , identifier[dr] = literal[string] , identifier[lvl] = literal[int] , identifier[addFH] = keyword[True] , identifier[addSH] = keyword[True] ,): literal[string] identifier[log] = keyword[False] keyword[try] : identifier[l...
def getLogger(name='generalLoggerName', dr='', lvl=20, addFH=True, addSH=True): """This will either return the logging object already instantiated, or instantiate a new one and return it. **Use this function to both create and return any logger** to avoid accidentally adding additional handlers by us...
def contains_list(longer, shorter): """Check if longer list starts with shorter list""" if len(longer) <= len(shorter): return False for a, b in zip(shorter, longer): if a != b: return False return True
def function[contains_list, parameter[longer, shorter]]: constant[Check if longer list starts with shorter list] if compare[call[name[len], parameter[name[longer]]] less_or_equal[<=] call[name[len], parameter[name[shorter]]]] begin[:] return[constant[False]] for taget[tuple[[<ast.Name ob...
keyword[def] identifier[contains_list] ( identifier[longer] , identifier[shorter] ): literal[string] keyword[if] identifier[len] ( identifier[longer] )<= identifier[len] ( identifier[shorter] ): keyword[return] keyword[False] keyword[for] identifier[a] , identifier[b] keyword[in] identi...
def contains_list(longer, shorter): """Check if longer list starts with shorter list""" if len(longer) <= len(shorter): return False # depends on [control=['if'], data=[]] for (a, b) in zip(shorter, longer): if a != b: return False # depends on [control=['if'], data=[]] # depe...
def _gccalc(lon, lat, azimuth, maxdist=None): """ Original javascript on http://williams.best.vwh.net/gccalc.htm Translated into python by Thomas Lecocq This function is a black box, because trigonometry is difficult """ glat1 = lat * np.pi / 180. glon1 = lon * np.pi / 180. s = maxd...
def function[_gccalc, parameter[lon, lat, azimuth, maxdist]]: constant[ Original javascript on http://williams.best.vwh.net/gccalc.htm Translated into python by Thomas Lecocq This function is a black box, because trigonometry is difficult ] variable[glat1] assign[=] binary_operation...
keyword[def] identifier[_gccalc] ( identifier[lon] , identifier[lat] , identifier[azimuth] , identifier[maxdist] = keyword[None] ): literal[string] identifier[glat1] = identifier[lat] * identifier[np] . identifier[pi] / literal[int] identifier[glon1] = identifier[lon] * identifier[np] . identifier[pi...
def _gccalc(lon, lat, azimuth, maxdist=None): """ Original javascript on http://williams.best.vwh.net/gccalc.htm Translated into python by Thomas Lecocq This function is a black box, because trigonometry is difficult """ glat1 = lat * np.pi / 180.0 glon1 = lon * np.pi / 180.0 s = ma...
def run_forever(self): """Run the bot, blocking forever.""" res = self.slack.rtm.start() self.log.info("current channels: %s", ','.join(c['name'] for c in res.body['channels'] if c['is_member'])) self.id = res.body['self']['id'] ...
def function[run_forever, parameter[self]]: constant[Run the bot, blocking forever.] variable[res] assign[=] call[name[self].slack.rtm.start, parameter[]] call[name[self].log.info, parameter[constant[current channels: %s], call[constant[,].join, parameter[<ast.GeneratorExp object at 0x7da1b191c3...
keyword[def] identifier[run_forever] ( identifier[self] ): literal[string] identifier[res] = identifier[self] . identifier[slack] . identifier[rtm] . identifier[start] () identifier[self] . identifier[log] . identifier[info] ( literal[string] , literal[string] . identifier[join] (...
def run_forever(self): """Run the bot, blocking forever.""" res = self.slack.rtm.start() self.log.info('current channels: %s', ','.join((c['name'] for c in res.body['channels'] if c['is_member']))) self.id = res.body['self']['id'] self.name = res.body['self']['name'] self.my_mention = '<@%s>' % ...
def unseen_videos_reset(self): """Reset the unseen videos counter.""" url = RESET_CAM_ENDPOINT.format(self.unique_id) ret = self._session.query(url).get('success') return ret
def function[unseen_videos_reset, parameter[self]]: constant[Reset the unseen videos counter.] variable[url] assign[=] call[name[RESET_CAM_ENDPOINT].format, parameter[name[self].unique_id]] variable[ret] assign[=] call[call[name[self]._session.query, parameter[name[url]]].get, parameter[constant...
keyword[def] identifier[unseen_videos_reset] ( identifier[self] ): literal[string] identifier[url] = identifier[RESET_CAM_ENDPOINT] . identifier[format] ( identifier[self] . identifier[unique_id] ) identifier[ret] = identifier[self] . identifier[_session] . identifier[query] ( identifier[u...
def unseen_videos_reset(self): """Reset the unseen videos counter.""" url = RESET_CAM_ENDPOINT.format(self.unique_id) ret = self._session.query(url).get('success') return ret
def left_release(self, event): """ Callback for the release of the left button. :param event: Tkinter event """ self.config(cursor="") if len(self.canvas.find_withtag("current")) != 0 and self.current is not None: self.canvas.itemconfigure(tk.CURRENT, fill=se...
def function[left_release, parameter[self, event]]: constant[ Callback for the release of the left button. :param event: Tkinter event ] call[name[self].config, parameter[]] if <ast.BoolOp object at 0x7da1b2362e00> begin[:] call[name[self].canvas.itemconf...
keyword[def] identifier[left_release] ( identifier[self] , identifier[event] ): literal[string] identifier[self] . identifier[config] ( identifier[cursor] = literal[string] ) keyword[if] identifier[len] ( identifier[self] . identifier[canvas] . identifier[find_withtag] ( literal[string] )...
def left_release(self, event): """ Callback for the release of the left button. :param event: Tkinter event """ self.config(cursor='') if len(self.canvas.find_withtag('current')) != 0 and self.current is not None: self.canvas.itemconfigure(tk.CURRENT, fill=self.item_colors[s...
def get_all(jail=None): ''' Return a list of all available services .. versionchanged:: 2016.3.4 jail: optional jid or jail name CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = [] service = _cmd(jail) for srv in __salt__['cmd.run']('{0} -l'.forma...
def function[get_all, parameter[jail]]: constant[ Return a list of all available services .. versionchanged:: 2016.3.4 jail: optional jid or jail name CLI Example: .. code-block:: bash salt '*' service.get_all ] variable[ret] assign[=] list[[]] variable[servi...
keyword[def] identifier[get_all] ( identifier[jail] = keyword[None] ): literal[string] identifier[ret] =[] identifier[service] = identifier[_cmd] ( identifier[jail] ) keyword[for] identifier[srv] keyword[in] identifier[__salt__] [ literal[string] ]( literal[string] . identifier[format] ( ident...
def get_all(jail=None): """ Return a list of all available services .. versionchanged:: 2016.3.4 jail: optional jid or jail name CLI Example: .. code-block:: bash salt '*' service.get_all """ ret = [] service = _cmd(jail) for srv in __salt__['cmd.run']('{0} -l'.forma...
def require_attribute(self, attribute: str, typ: Type = _Any) -> None: """Require an attribute on the node to exist. If `typ` is given, the attribute must have this type. Args: attribute: The name of the attribute / mapping key. typ: The type the attribute must have. ...
def function[require_attribute, parameter[self, attribute, typ]]: constant[Require an attribute on the node to exist. If `typ` is given, the attribute must have this type. Args: attribute: The name of the attribute / mapping key. typ: The type the attribute must have. ...
keyword[def] identifier[require_attribute] ( identifier[self] , identifier[attribute] : identifier[str] , identifier[typ] : identifier[Type] = identifier[_Any] )-> keyword[None] : literal[string] identifier[attr_nodes] =[ identifier[value_node] keyword[for] identifier[key_node] , identif...
def require_attribute(self, attribute: str, typ: Type=_Any) -> None: """Require an attribute on the node to exist. If `typ` is given, the attribute must have this type. Args: attribute: The name of the attribute / mapping key. typ: The type the attribute must have. ...
def cudnnSetTensor4dDescriptor(tensorDesc, format, dataType, n, c, h, w): """ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that...
def function[cudnnSetTensor4dDescriptor, parameter[tensorDesc, format, dataType, n, c, h, w]]: constant[ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format param...
keyword[def] identifier[cudnnSetTensor4dDescriptor] ( identifier[tensorDesc] , identifier[format] , identifier[dataType] , identifier[n] , identifier[c] , identifier[h] , identifier[w] ): literal[string] identifier[status] = identifier[_libcudnn] . identifier[cudnnSetTensor4dDescriptor] ( identifier[tenso...
def cudnnSetTensor4dDescriptor(tensorDesc, format, dataType, n, c, h, w): """ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that...
def fuzzy_subset(str_): """ converts a string into an argument to list_take """ if str_ is None: return str_ if ':' in str_: return smart_cast(str_, slice) if str_.startswith('['): return smart_cast(str_[1:-1], list) else: return smart_cast(str_, list)
def function[fuzzy_subset, parameter[str_]]: constant[ converts a string into an argument to list_take ] if compare[name[str_] is constant[None]] begin[:] return[name[str_]] if compare[constant[:] in name[str_]] begin[:] return[call[name[smart_cast], parameter[name[str_],...
keyword[def] identifier[fuzzy_subset] ( identifier[str_] ): literal[string] keyword[if] identifier[str_] keyword[is] keyword[None] : keyword[return] identifier[str_] keyword[if] literal[string] keyword[in] identifier[str_] : keyword[return] identifier[smart_cast] ( identifie...
def fuzzy_subset(str_): """ converts a string into an argument to list_take """ if str_ is None: return str_ # depends on [control=['if'], data=['str_']] if ':' in str_: return smart_cast(str_, slice) # depends on [control=['if'], data=['str_']] if str_.startswith('['): ...
def besttype(x, encoding="utf-8", percentify=True): """Convert string x to the most useful type, i.e. int, float or unicode string. If x is a quoted string (single or double quotes) then the quotes are stripped and the enclosed string returned. The string can contain any number of quotes, it is only im...
def function[besttype, parameter[x, encoding, percentify]]: constant[Convert string x to the most useful type, i.e. int, float or unicode string. If x is a quoted string (single or double quotes) then the quotes are stripped and the enclosed string returned. The string can contain any number of quo...
keyword[def] identifier[besttype] ( identifier[x] , identifier[encoding] = literal[string] , identifier[percentify] = keyword[True] ): literal[string] keyword[def] identifier[unicodify] ( identifier[x] ): keyword[return] identifier[to_unicode] ( identifier[x] , identifier[encoding] ) keywor...
def besttype(x, encoding='utf-8', percentify=True): """Convert string x to the most useful type, i.e. int, float or unicode string. If x is a quoted string (single or double quotes) then the quotes are stripped and the enclosed string returned. The string can contain any number of quotes, it is only im...
def get(self, queue_get): """ get to given consumer states. This function is used for merging of results of parallelized MC. The first state is used for merging in place. The states must be disjoint. :param object queue_get: second consumer state """ for (c, cs) ...
def function[get, parameter[self, queue_get]]: constant[ get to given consumer states. This function is used for merging of results of parallelized MC. The first state is used for merging in place. The states must be disjoint. :param object queue_get: second consumer state ...
keyword[def] identifier[get] ( identifier[self] , identifier[queue_get] ): literal[string] keyword[for] ( identifier[c] , identifier[cs] ) keyword[in] identifier[izip] ( identifier[self] . identifier[consumers] , identifier[queue_get] ): identifier[c] . identifier[get] ( identifier[cs...
def get(self, queue_get): """ get to given consumer states. This function is used for merging of results of parallelized MC. The first state is used for merging in place. The states must be disjoint. :param object queue_get: second consumer state """ for (c, cs) in izip(...
def bindmount(self, mountpoint): """Bind mounts the volume to another mountpoint. Only works if the volume is already mounted. :raises NotMountedError: when the volume is not yet mounted :raises SubsystemError: when the underlying command failed """ if not self.mountpoint: ...
def function[bindmount, parameter[self, mountpoint]]: constant[Bind mounts the volume to another mountpoint. Only works if the volume is already mounted. :raises NotMountedError: when the volume is not yet mounted :raises SubsystemError: when the underlying command failed ] if <...
keyword[def] identifier[bindmount] ( identifier[self] , identifier[mountpoint] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[mountpoint] : keyword[raise] identifier[NotMountedError] ( identifier[self] ) keyword[try] : identifier[_ut...
def bindmount(self, mountpoint): """Bind mounts the volume to another mountpoint. Only works if the volume is already mounted. :raises NotMountedError: when the volume is not yet mounted :raises SubsystemError: when the underlying command failed """ if not self.mountpoint: raise...
def execute(self): """ Execute the http request to the export service :return ads-classic formatted export string """ url = os.path.join(self.HTTP_ENDPOINT, self.format) self.response = ExportResponse.load_http_response( self.session.post(url, data=self.json_p...
def function[execute, parameter[self]]: constant[ Execute the http request to the export service :return ads-classic formatted export string ] variable[url] assign[=] call[name[os].path.join, parameter[name[self].HTTP_ENDPOINT, name[self].format]] name[self].response assi...
keyword[def] identifier[execute] ( identifier[self] ): literal[string] identifier[url] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[HTTP_ENDPOINT] , identifier[self] . identifier[format] ) identifier[self] . identifier[response] = identifier[Export...
def execute(self): """ Execute the http request to the export service :return ads-classic formatted export string """ url = os.path.join(self.HTTP_ENDPOINT, self.format) self.response = ExportResponse.load_http_response(self.session.post(url, data=self.json_payload)) return self....
def get_an(n, mc, dl, F, e): """ Compute a_n from Eq. 22 of Taylor et al. (2015). :param n: Harmonic number :param mc: Chirp mass of binary [Solar Mass] :param dl: Luminosity distance [Mpc] :param F: Orbital frequency of binary [Hz] :param e: Orbital Eccentricity :returns: a_n ...
def function[get_an, parameter[n, mc, dl, F, e]]: constant[ Compute a_n from Eq. 22 of Taylor et al. (2015). :param n: Harmonic number :param mc: Chirp mass of binary [Solar Mass] :param dl: Luminosity distance [Mpc] :param F: Orbital frequency of binary [Hz] :param e: Orbital Eccen...
keyword[def] identifier[get_an] ( identifier[n] , identifier[mc] , identifier[dl] , identifier[F] , identifier[e] ): literal[string] identifier[mc] *= identifier[SOLAR2S] identifier[dl] *= identifier[MPC2S] identifier[omega] = literal[int] * identifier[np] . identifier[pi] * identifier[F...
def get_an(n, mc, dl, F, e): """ Compute a_n from Eq. 22 of Taylor et al. (2015). :param n: Harmonic number :param mc: Chirp mass of binary [Solar Mass] :param dl: Luminosity distance [Mpc] :param F: Orbital frequency of binary [Hz] :param e: Orbital Eccentricity :returns: a_n ...
def _covar_mstep_full(gmm, X, responsibilities, weighted_X_sum, norm, min_covar): """Performing the covariance M step for full cases""" # Eq. 12 from K. Murphy, "Fitting a Conditional Linear Gaussian # Distribution" n_features = X.shape[1] cv = np.empty((gmm.n_components, n_fea...
def function[_covar_mstep_full, parameter[gmm, X, responsibilities, weighted_X_sum, norm, min_covar]]: constant[Performing the covariance M step for full cases] variable[n_features] assign[=] call[name[X].shape][constant[1]] variable[cv] assign[=] call[name[np].empty, parameter[tuple[[<ast.Attri...
keyword[def] identifier[_covar_mstep_full] ( identifier[gmm] , identifier[X] , identifier[responsibilities] , identifier[weighted_X_sum] , identifier[norm] , identifier[min_covar] ): literal[string] identifier[n_features] = identifier[X] . identifier[shape] [ literal[int] ] identifier[cv] =...
def _covar_mstep_full(gmm, X, responsibilities, weighted_X_sum, norm, min_covar): """Performing the covariance M step for full cases""" # Eq. 12 from K. Murphy, "Fitting a Conditional Linear Gaussian # Distribution" n_features = X.shape[1] cv = np.empty((gmm.n_components, n_features, n_features)) ...
def Approval(self, username, approval_id): """Returns a reference to an approval.""" return ClientApprovalRef( client_id=self.client_id, username=username, approval_id=approval_id, context=self._context)
def function[Approval, parameter[self, username, approval_id]]: constant[Returns a reference to an approval.] return[call[name[ClientApprovalRef], parameter[]]]
keyword[def] identifier[Approval] ( identifier[self] , identifier[username] , identifier[approval_id] ): literal[string] keyword[return] identifier[ClientApprovalRef] ( identifier[client_id] = identifier[self] . identifier[client_id] , identifier[username] = identifier[username] , identifi...
def Approval(self, username, approval_id): """Returns a reference to an approval.""" return ClientApprovalRef(client_id=self.client_id, username=username, approval_id=approval_id, context=self._context)
def uniform_crossover(parents): """Perform uniform crossover on two parent chromosomes. Randomly take genes from one parent or the other. Ex. p1 = xxxxx, p2 = yyyyy, child = xyxxy """ chromosome_length = len(parents[0]) children = [[], []] for i in range(chromosome_length): select...
def function[uniform_crossover, parameter[parents]]: constant[Perform uniform crossover on two parent chromosomes. Randomly take genes from one parent or the other. Ex. p1 = xxxxx, p2 = yyyyy, child = xyxxy ] variable[chromosome_length] assign[=] call[name[len], parameter[call[name[parents]...
keyword[def] identifier[uniform_crossover] ( identifier[parents] ): literal[string] identifier[chromosome_length] = identifier[len] ( identifier[parents] [ literal[int] ]) identifier[children] =[[],[]] keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[chromosome_length] )...
def uniform_crossover(parents): """Perform uniform crossover on two parent chromosomes. Randomly take genes from one parent or the other. Ex. p1 = xxxxx, p2 = yyyyy, child = xyxxy """ chromosome_length = len(parents[0]) children = [[], []] for i in range(chromosome_length): selected...
def _wc_hard_wrap(line, length): """ Wrap text to length characters, breaking when target length is reached, taking into account character width. Used to wrap lines which cannot be wrapped on whitespace. """ chars = [] chars_len = 0 for char in line: char_len = wcwidth(char) ...
def function[_wc_hard_wrap, parameter[line, length]]: constant[ Wrap text to length characters, breaking when target length is reached, taking into account character width. Used to wrap lines which cannot be wrapped on whitespace. ] variable[chars] assign[=] list[[]] variable[ch...
keyword[def] identifier[_wc_hard_wrap] ( identifier[line] , identifier[length] ): literal[string] identifier[chars] =[] identifier[chars_len] = literal[int] keyword[for] identifier[char] keyword[in] identifier[line] : identifier[char_len] = identifier[wcwidth] ( identifier[char] ) ...
def _wc_hard_wrap(line, length): """ Wrap text to length characters, breaking when target length is reached, taking into account character width. Used to wrap lines which cannot be wrapped on whitespace. """ chars = [] chars_len = 0 for char in line: char_len = wcwidth(char) ...
def generate_vars(project_name, project_dir): """ Generates the variables to replace in files """ out = vary_name(project_name) out['random_key'] = make_random_key() out['settings_file'] = make_file_path( project_dir, project_name, path.join('src', project_name), ...
def function[generate_vars, parameter[project_name, project_dir]]: constant[ Generates the variables to replace in files ] variable[out] assign[=] call[name[vary_name], parameter[name[project_name]]] call[name[out]][constant[random_key]] assign[=] call[name[make_random_key], parameter[]]...
keyword[def] identifier[generate_vars] ( identifier[project_name] , identifier[project_dir] ): literal[string] identifier[out] = identifier[vary_name] ( identifier[project_name] ) identifier[out] [ literal[string] ]= identifier[make_random_key] () identifier[out] [ literal[string] ]= identifier[...
def generate_vars(project_name, project_dir): """ Generates the variables to replace in files """ out = vary_name(project_name) out['random_key'] = make_random_key() out['settings_file'] = make_file_path(project_dir, project_name, path.join('src', project_name), 'settings.py') return out
def save_new_channel(self): """ It saves new channel according to specified channel features. """ form_info = self.input['form'] channel = Channel(typ=15, name=form_info['name'], description=form_info['description'], owner_id=f...
def function[save_new_channel, parameter[self]]: constant[ It saves new channel according to specified channel features. ] variable[form_info] assign[=] call[name[self].input][constant[form]] variable[channel] assign[=] call[name[Channel], parameter[]] call[name[channel]...
keyword[def] identifier[save_new_channel] ( identifier[self] ): literal[string] identifier[form_info] = identifier[self] . identifier[input] [ literal[string] ] identifier[channel] = identifier[Channel] ( identifier[typ] = literal[int] , identifier[name] = identifier[form_info] [ literal[s...
def save_new_channel(self): """ It saves new channel according to specified channel features. """ form_info = self.input['form'] channel = Channel(typ=15, name=form_info['name'], description=form_info['description'], owner_id=form_info['owner_id']) channel.blocking_save() self.curre...
def generate_data_key(self, name, key_type, context="", nonce="", bits=256, mount_point=DEFAULT_MOUNT_POINT): """Generates a new high-entropy key and the value encrypted with the named key. Optionally return the plaintext of the key as well. Whether plaintext is returned depends on the path; as a ...
def function[generate_data_key, parameter[self, name, key_type, context, nonce, bits, mount_point]]: constant[Generates a new high-entropy key and the value encrypted with the named key. Optionally return the plaintext of the key as well. Whether plaintext is returned depends on the path; as a ...
keyword[def] identifier[generate_data_key] ( identifier[self] , identifier[name] , identifier[key_type] , identifier[context] = literal[string] , identifier[nonce] = literal[string] , identifier[bits] = literal[int] , identifier[mount_point] = identifier[DEFAULT_MOUNT_POINT] ): literal[string] keyw...
def generate_data_key(self, name, key_type, context='', nonce='', bits=256, mount_point=DEFAULT_MOUNT_POINT): """Generates a new high-entropy key and the value encrypted with the named key. Optionally return the plaintext of the key as well. Whether plaintext is returned depends on the path; as a r...
def _dict_to_report_line(cls, report_dict): '''Takes a report_dict as input and returns a report line''' return '\t'.join([str(report_dict[x]) for x in report.columns])
def function[_dict_to_report_line, parameter[cls, report_dict]]: constant[Takes a report_dict as input and returns a report line] return[call[constant[ ].join, parameter[<ast.ListComp object at 0x7da18fe92c80>]]]
keyword[def] identifier[_dict_to_report_line] ( identifier[cls] , identifier[report_dict] ): literal[string] keyword[return] literal[string] . identifier[join] ([ identifier[str] ( identifier[report_dict] [ identifier[x] ]) keyword[for] identifier[x] keyword[in] identifier[report] . identifier[...
def _dict_to_report_line(cls, report_dict): """Takes a report_dict as input and returns a report line""" return '\t'.join([str(report_dict[x]) for x in report.columns])
def run_xenon_simple(workflow, machine, worker_config): """Run a workflow using a single Xenon remote worker. :param workflow: |Workflow| or |PromisedObject| to evaluate. :param machine: |Machine| instance. :param worker_config: Configuration for the pilot job.""" scheduler = Scheduler() retur...
def function[run_xenon_simple, parameter[workflow, machine, worker_config]]: constant[Run a workflow using a single Xenon remote worker. :param workflow: |Workflow| or |PromisedObject| to evaluate. :param machine: |Machine| instance. :param worker_config: Configuration for the pilot job.] v...
keyword[def] identifier[run_xenon_simple] ( identifier[workflow] , identifier[machine] , identifier[worker_config] ): literal[string] identifier[scheduler] = identifier[Scheduler] () keyword[return] identifier[scheduler] . identifier[run] ( identifier[xenon_interactive_worker] ( identifier[mach...
def run_xenon_simple(workflow, machine, worker_config): """Run a workflow using a single Xenon remote worker. :param workflow: |Workflow| or |PromisedObject| to evaluate. :param machine: |Machine| instance. :param worker_config: Configuration for the pilot job.""" scheduler = Scheduler() return...
def _initialize_initial_state_fluents(self): '''Returns the initial state-fluents instantiated.''' state_fluents = self.rddl.domain.state_fluents initializer = self.rddl.instance.init_state self.initial_state_fluents = self._initialize_pvariables( state_fluents, s...
def function[_initialize_initial_state_fluents, parameter[self]]: constant[Returns the initial state-fluents instantiated.] variable[state_fluents] assign[=] name[self].rddl.domain.state_fluents variable[initializer] assign[=] name[self].rddl.instance.init_state name[self].initial_state_...
keyword[def] identifier[_initialize_initial_state_fluents] ( identifier[self] ): literal[string] identifier[state_fluents] = identifier[self] . identifier[rddl] . identifier[domain] . identifier[state_fluents] identifier[initializer] = identifier[self] . identifier[rddl] . identifier[inst...
def _initialize_initial_state_fluents(self): """Returns the initial state-fluents instantiated.""" state_fluents = self.rddl.domain.state_fluents initializer = self.rddl.instance.init_state self.initial_state_fluents = self._initialize_pvariables(state_fluents, self.rddl.domain.state_fluent_ordering, in...
def universe(self): """ Data universe available at the current time. Universe contains the data passed in when creating a Backtest. Use this data to determine strategy logic. """ # avoid windowing every time # if calling and on same date return # cached va...
def function[universe, parameter[self]]: constant[ Data universe available at the current time. Universe contains the data passed in when creating a Backtest. Use this data to determine strategy logic. ] if compare[name[self].now equal[==] name[self]._last_chk] begin[:] ...
keyword[def] identifier[universe] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[now] == identifier[self] . identifier[_last_chk] : keyword[return] identifier[self] . identifier[_funiverse] keyword[else] : ...
def universe(self): """ Data universe available at the current time. Universe contains the data passed in when creating a Backtest. Use this data to determine strategy logic. """ # avoid windowing every time # if calling and on same date return # cached value if self....
def save(self, *args, **kwargs): """ Custom save method """ # change status to scheduled if necessary if self.is_scheduled and self.status is not OUTWARD_STATUS.get('scheduled'): self.status = OUTWARD_STATUS.get('scheduled') # call super.save() super(...
def function[save, parameter[self]]: constant[ Custom save method ] if <ast.BoolOp object at 0x7da18c4cf2b0> begin[:] name[self].status assign[=] call[name[OUTWARD_STATUS].get, parameter[constant[scheduled]]] call[call[name[super], parameter[name[Outward], name[se...
keyword[def] identifier[save] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[self] . identifier[is_scheduled] keyword[and] identifier[self] . identifier[status] keyword[is] keyword[not] identifier[OUTWARD_STATUS] . identifier[g...
def save(self, *args, **kwargs): """ Custom save method """ # change status to scheduled if necessary if self.is_scheduled and self.status is not OUTWARD_STATUS.get('scheduled'): self.status = OUTWARD_STATUS.get('scheduled') # depends on [control=['if'], data=[]] # call super.sa...
def export_wif(self) -> str: """ This interface is used to get export ECDSA private key in the form of WIF which is a way to encoding an ECDSA private key and make it easier to copy. :return: a WIF encode private key. """ data = b''.join([b'\x80', self.__private_key, b'\...
def function[export_wif, parameter[self]]: constant[ This interface is used to get export ECDSA private key in the form of WIF which is a way to encoding an ECDSA private key and make it easier to copy. :return: a WIF encode private key. ] variable[data] assign[=] call[c...
keyword[def] identifier[export_wif] ( identifier[self] )-> identifier[str] : literal[string] identifier[data] = literal[string] . identifier[join] ([ literal[string] , identifier[self] . identifier[__private_key] , literal[string] ]) identifier[checksum] = identifier[Digest] . identifier[h...
def export_wif(self) -> str: """ This interface is used to get export ECDSA private key in the form of WIF which is a way to encoding an ECDSA private key and make it easier to copy. :return: a WIF encode private key. """ data = b''.join([b'\x80', self.__private_key, b'\x01']) ...
def from_list(commands): """ Given a list of tuples of form (depth, text) that represents a DFS traversal of a command tree, returns a dictionary representing command tree. """ def subtrees(commands, level): if not commands: return acc = [] parent, *commands ...
def function[from_list, parameter[commands]]: constant[ Given a list of tuples of form (depth, text) that represents a DFS traversal of a command tree, returns a dictionary representing command tree. ] def function[subtrees, parameter[commands, level]]: if <ast.UnaryOp ob...
keyword[def] identifier[from_list] ( identifier[commands] ): literal[string] keyword[def] identifier[subtrees] ( identifier[commands] , identifier[level] ): keyword[if] keyword[not] identifier[commands] : keyword[return] identifier[acc] =[] identifier[parent] ,*...
def from_list(commands): """ Given a list of tuples of form (depth, text) that represents a DFS traversal of a command tree, returns a dictionary representing command tree. """ def subtrees(commands, level): if not commands: return # depends on [control=['if'], data=[]] ...
def makePFcFunc(self): ''' Makes the (linear) consumption function for this period. Parameters ---------- none Returns ------- none ''' # Calculate human wealth this period (and lower bound of m) self.hNrmNow = (self.PermGroFac/se...
def function[makePFcFunc, parameter[self]]: constant[ Makes the (linear) consumption function for this period. Parameters ---------- none Returns ------- none ] name[self].hNrmNow assign[=] binary_operation[binary_operation[name[self].Per...
keyword[def] identifier[makePFcFunc] ( identifier[self] ): literal[string] identifier[self] . identifier[hNrmNow] =( identifier[self] . identifier[PermGroFac] / identifier[self] . identifier[Rfree] )*( identifier[self] . identifier[solution_next] . identifier[hNrm] + literal[int] ) ...
def makePFcFunc(self): """ Makes the (linear) consumption function for this period. Parameters ---------- none Returns ------- none """ # Calculate human wealth this period (and lower bound of m) self.hNrmNow = self.PermGroFac / self.Rfree * ...
def _handle_event(self, event, *args, **kw): """Broadcast an event to the database connections registered.""" for engine in self.engines.values(): if hasattr(engine, event): getattr(engine, event)(*args, **kw)
def function[_handle_event, parameter[self, event]]: constant[Broadcast an event to the database connections registered.] for taget[name[engine]] in starred[call[name[self].engines.values, parameter[]]] begin[:] if call[name[hasattr], parameter[name[engine], name[event]]] begin[:] ...
keyword[def] identifier[_handle_event] ( identifier[self] , identifier[event] ,* identifier[args] ,** identifier[kw] ): literal[string] keyword[for] identifier[engine] keyword[in] identifier[self] . identifier[engines] . identifier[values] (): keyword[if] identifier[hasattr] ( identifier[engine] , ide...
def _handle_event(self, event, *args, **kw): """Broadcast an event to the database connections registered.""" for engine in self.engines.values(): if hasattr(engine, event): getattr(engine, event)(*args, **kw) # depends on [control=['if'], data=[]] # depends on [control=['for'], data=['eng...
def __is_exported(self, name, module): """ Returns `True` if and only if `pydoc` considers `name` to be a public identifier for this module where `name` was defined in the Python module `module`. If this module has an `__all__` attribute, then `name` is considered to be ...
def function[__is_exported, parameter[self, name, module]]: constant[ Returns `True` if and only if `pydoc` considers `name` to be a public identifier for this module where `name` was defined in the Python module `module`. If this module has an `__all__` attribute, then `name` i...
keyword[def] identifier[__is_exported] ( identifier[self] , identifier[name] , identifier[module] ): literal[string] keyword[if] identifier[hasattr] ( identifier[self] . identifier[module] , literal[string] ): keyword[return] identifier[name] keyword[in] identifier[self] . identifi...
def __is_exported(self, name, module): """ Returns `True` if and only if `pydoc` considers `name` to be a public identifier for this module where `name` was defined in the Python module `module`. If this module has an `__all__` attribute, then `name` is considered to be expo...
def _save_results(options, module, core_results, fit_results): """ Save results of analysis as tables and figures Parameters ---------- options : dict Option names and values for analysis module : str Module that contained function used to generate core_results core_results ...
def function[_save_results, parameter[options, module, core_results, fit_results]]: constant[ Save results of analysis as tables and figures Parameters ---------- options : dict Option names and values for analysis module : str Module that contained function used to generate...
keyword[def] identifier[_save_results] ( identifier[options] , identifier[module] , identifier[core_results] , identifier[fit_results] ): literal[string] identifier[logging] . identifier[info] ( literal[string] ) identifier[mpl] . identifier[rcParams] . identifier[update] ( identifier[misc] . i...
def _save_results(options, module, core_results, fit_results): """ Save results of analysis as tables and figures Parameters ---------- options : dict Option names and values for analysis module : str Module that contained function used to generate core_results core_results ...
def __read_stored_routine_metadata(self): """ Reads the metadata of stored routines from the metadata file. """ if os.path.isfile(self._pystratum_metadata_filename): with open(self._pystratum_metadata_filename, 'r') as file: self._pystratum_metadata = json.loa...
def function[__read_stored_routine_metadata, parameter[self]]: constant[ Reads the metadata of stored routines from the metadata file. ] if call[name[os].path.isfile, parameter[name[self]._pystratum_metadata_filename]] begin[:] with call[name[open], parameter[name[self]._...
keyword[def] identifier[__read_stored_routine_metadata] ( identifier[self] ): literal[string] keyword[if] identifier[os] . identifier[path] . identifier[isfile] ( identifier[self] . identifier[_pystratum_metadata_filename] ): keyword[with] identifier[open] ( identifier[self] . identi...
def __read_stored_routine_metadata(self): """ Reads the metadata of stored routines from the metadata file. """ if os.path.isfile(self._pystratum_metadata_filename): with open(self._pystratum_metadata_filename, 'r') as file: self._pystratum_metadata = json.load(file) # depen...
async def logout(self, request): """ Simple handler for logout """ if "Authorization" not in request.headers: msg = "Auth header is not present, can not destroy token" raise JsonValidaitonError(msg) response = json_response() await forget(request,...
<ast.AsyncFunctionDef object at 0x7da1b12947c0>
keyword[async] keyword[def] identifier[logout] ( identifier[self] , identifier[request] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[request] . identifier[headers] : identifier[msg] = literal[string] keyword[raise] identifier[Js...
async def logout(self, request): """ Simple handler for logout """ if 'Authorization' not in request.headers: msg = 'Auth header is not present, can not destroy token' raise JsonValidaitonError(msg) # depends on [control=['if'], data=[]] response = json_response() await ...
def parse_field(setting, field_name, default): """ Extract result from single-value or dict-type setting like fallback_values. """ if isinstance(setting, dict): return setting.get(field_name, default) else: return setting
def function[parse_field, parameter[setting, field_name, default]]: constant[ Extract result from single-value or dict-type setting like fallback_values. ] if call[name[isinstance], parameter[name[setting], name[dict]]] begin[:] return[call[name[setting].get, parameter[name[field_name], ...
keyword[def] identifier[parse_field] ( identifier[setting] , identifier[field_name] , identifier[default] ): literal[string] keyword[if] identifier[isinstance] ( identifier[setting] , identifier[dict] ): keyword[return] identifier[setting] . identifier[get] ( identifier[field_name] , identifier[...
def parse_field(setting, field_name, default): """ Extract result from single-value or dict-type setting like fallback_values. """ if isinstance(setting, dict): return setting.get(field_name, default) # depends on [control=['if'], data=[]] else: return setting
def _find_hstreaming(): """Finds the whole path to the hadoop streaming jar. If the environmental var HADOOP_HOME is specified, then start the search from there. Returns: Full path to the hadoop streaming jar if found, else return an empty string. """ global WARNED_HADOOP_HOME,...
def function[_find_hstreaming, parameter[]]: constant[Finds the whole path to the hadoop streaming jar. If the environmental var HADOOP_HOME is specified, then start the search from there. Returns: Full path to the hadoop streaming jar if found, else return an empty string. ] ...
keyword[def] identifier[_find_hstreaming] (): literal[string] keyword[global] identifier[WARNED_HADOOP_HOME] , identifier[HADOOP_STREAMING_PATH_CACHE] keyword[if] identifier[HADOOP_STREAMING_PATH_CACHE] : keyword[return] identifier[HADOOP_STREAMING_PATH_CACHE] keyword[try] : ...
def _find_hstreaming(): """Finds the whole path to the hadoop streaming jar. If the environmental var HADOOP_HOME is specified, then start the search from there. Returns: Full path to the hadoop streaming jar if found, else return an empty string. """ global WARNED_HADOOP_HOME,...
def returns(ts, **kwargs): ''' Compute returns on the given period @param ts : time serie to process @param kwargs.type: gross or simple returns @param delta : period betweend two computed returns @param start : with end, will return the return betweend this elapsed time @param period : del...
def function[returns, parameter[ts]]: constant[ Compute returns on the given period @param ts : time serie to process @param kwargs.type: gross or simple returns @param delta : period betweend two computed returns @param start : with end, will return the return betweend this elapsed time ...
keyword[def] identifier[returns] ( identifier[ts] ,** identifier[kwargs] ): literal[string] identifier[returns_type] = identifier[kwargs] . identifier[get] ( literal[string] , literal[string] ) identifier[cumulative] = identifier[kwargs] . identifier[get] ( literal[string] , keyword[False] ) keyw...
def returns(ts, **kwargs): """ Compute returns on the given period @param ts : time serie to process @param kwargs.type: gross or simple returns @param delta : period betweend two computed returns @param start : with end, will return the return betweend this elapsed time @param period : del...
def make_eventlogitem_log(log, condition='is', negate=False, preserve_case=False): """ Create a node for EventLogItem/log :return: A IndicatorItem represented as an Element node """ document = 'EventLogItem' search = 'EventLogItem/log' content_type = 'string' content = log ii_no...
def function[make_eventlogitem_log, parameter[log, condition, negate, preserve_case]]: constant[ Create a node for EventLogItem/log :return: A IndicatorItem represented as an Element node ] variable[document] assign[=] constant[EventLogItem] variable[search] assign[=] constant[E...
keyword[def] identifier[make_eventlogitem_log] ( identifier[log] , identifier[condition] = literal[string] , identifier[negate] = keyword[False] , identifier[preserve_case] = keyword[False] ): literal[string] identifier[document] = literal[string] identifier[search] = literal[string] identifier...
def make_eventlogitem_log(log, condition='is', negate=False, preserve_case=False): """ Create a node for EventLogItem/log :return: A IndicatorItem represented as an Element node """ document = 'EventLogItem' search = 'EventLogItem/log' content_type = 'string' content = log ii_no...
def connect_combo_data(instance, prop, widget): """ Connect a callback property with a QComboBox widget based on the userData. Parameters ---------- instance : object The class instance that the callback property is attached to prop : str The name of the callback property wi...
def function[connect_combo_data, parameter[instance, prop, widget]]: constant[ Connect a callback property with a QComboBox widget based on the userData. Parameters ---------- instance : object The class instance that the callback property is attached to prop : str The name ...
keyword[def] identifier[connect_combo_data] ( identifier[instance] , identifier[prop] , identifier[widget] ): literal[string] keyword[def] identifier[update_widget] ( identifier[value] ): keyword[try] : identifier[idx] = identifier[_find_combo_data] ( identifier[widget] , identifier...
def connect_combo_data(instance, prop, widget): """ Connect a callback property with a QComboBox widget based on the userData. Parameters ---------- instance : object The class instance that the callback property is attached to prop : str The name of the callback property wi...
def load_stream(self, stream): """ Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series. """ batches = super(ArrowStreamPandasSerializer, self).load_stream(stream) import pyarrow as pa for batch in batches: yield [self.arrow_t...
def function[load_stream, parameter[self, stream]]: constant[ Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series. ] variable[batches] assign[=] call[call[name[super], parameter[name[ArrowStreamPandasSerializer], name[self]]].load_stream, parameter[name...
keyword[def] identifier[load_stream] ( identifier[self] , identifier[stream] ): literal[string] identifier[batches] = identifier[super] ( identifier[ArrowStreamPandasSerializer] , identifier[self] ). identifier[load_stream] ( identifier[stream] ) keyword[import] identifier[pyarrow] keywo...
def load_stream(self, stream): """ Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series. """ batches = super(ArrowStreamPandasSerializer, self).load_stream(stream) import pyarrow as pa for batch in batches: yield [self.arrow_to_pandas(c) for c in...
def initialize_schema(connection): """Initializes the TensorBoard sqlite schema using the given connection. Args: connection: A sqlite DB connection. """ cursor = connection.cursor() cursor.execute("PRAGMA application_id={}".format(_TENSORBOARD_APPLICATION_ID)) cursor.execute("PRAGMA user_version={}".f...
def function[initialize_schema, parameter[connection]]: constant[Initializes the TensorBoard sqlite schema using the given connection. Args: connection: A sqlite DB connection. ] variable[cursor] assign[=] call[name[connection].cursor, parameter[]] call[name[cursor].execute, parameter[c...
keyword[def] identifier[initialize_schema] ( identifier[connection] ): literal[string] identifier[cursor] = identifier[connection] . identifier[cursor] () identifier[cursor] . identifier[execute] ( literal[string] . identifier[format] ( identifier[_TENSORBOARD_APPLICATION_ID] )) identifier[cursor] . iden...
def initialize_schema(connection): """Initializes the TensorBoard sqlite schema using the given connection. Args: connection: A sqlite DB connection. """ cursor = connection.cursor() cursor.execute('PRAGMA application_id={}'.format(_TENSORBOARD_APPLICATION_ID)) cursor.execute('PRAGMA user_versi...
def predict_noiseless(self, Xnew, full_cov=False, Y_metadata=None, kern=None): """ Convenience function to predict the underlying function of the GP (often referred to as f) without adding the likelihood variance on the prediction function. This is most likely what you want to ...
def function[predict_noiseless, parameter[self, Xnew, full_cov, Y_metadata, kern]]: constant[ Convenience function to predict the underlying function of the GP (often referred to as f) without adding the likelihood variance on the prediction function. This is most likely what yo...
keyword[def] identifier[predict_noiseless] ( identifier[self] , identifier[Xnew] , identifier[full_cov] = keyword[False] , identifier[Y_metadata] = keyword[None] , identifier[kern] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[predict] ( identifier[Xnew] , identi...
def predict_noiseless(self, Xnew, full_cov=False, Y_metadata=None, kern=None): """ Convenience function to predict the underlying function of the GP (often referred to as f) without adding the likelihood variance on the prediction function. This is most likely what you want to use f...
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
def function[_raise_error_if_column_exists, parameter[dataset, column_name, dataset_variable_name, column_name_error_message_name]]: constant[ Check if a column exists in an SFrame with error message. ] variable[err_msg] assign[=] call[constant[The SFrame {0} must contain the column {1}.].format...
keyword[def] identifier[_raise_error_if_column_exists] ( identifier[dataset] , identifier[column_name] = literal[string] , identifier[dataset_variable_name] = literal[string] , identifier[column_name_error_message_name] = literal[string] ): literal[string] identifier[err_msg] = literal[string] . identifi...
def _raise_error_if_column_exists(dataset, column_name='dataset', dataset_variable_name='dataset', column_name_error_message_name='column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must contain the column {1}.'.format(dataset_variable_name, column...
def pbkdf2_bin( data, salt, iterations=DEFAULT_PBKDF2_ITERATIONS, keylen=None, hashfunc=None ): """Returns a binary digest for the PBKDF2 hash algorithm of `data` with the given `salt`. It iterates `iterations` times and produces a key of `keylen` bytes. By default, SHA-256 is used as hash function; ...
def function[pbkdf2_bin, parameter[data, salt, iterations, keylen, hashfunc]]: constant[Returns a binary digest for the PBKDF2 hash algorithm of `data` with the given `salt`. It iterates `iterations` times and produces a key of `keylen` bytes. By default, SHA-256 is used as hash function; a differen...
keyword[def] identifier[pbkdf2_bin] ( identifier[data] , identifier[salt] , identifier[iterations] = identifier[DEFAULT_PBKDF2_ITERATIONS] , identifier[keylen] = keyword[None] , identifier[hashfunc] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[hashfunc] : identifier[h...
def pbkdf2_bin(data, salt, iterations=DEFAULT_PBKDF2_ITERATIONS, keylen=None, hashfunc=None): """Returns a binary digest for the PBKDF2 hash algorithm of `data` with the given `salt`. It iterates `iterations` times and produces a key of `keylen` bytes. By default, SHA-256 is used as hash function; a dif...
def create_migration(self, app, fixture_path): """ Create a data migration for app that uses fixture_path. """ self.monkey_patch_migration_template(app, fixture_path) out = StringIO() management.call_command('makemigrations', app.label, empty=True, stdout=out) s...
def function[create_migration, parameter[self, app, fixture_path]]: constant[ Create a data migration for app that uses fixture_path. ] call[name[self].monkey_patch_migration_template, parameter[name[app], name[fixture_path]]] variable[out] assign[=] call[name[StringIO], paramete...
keyword[def] identifier[create_migration] ( identifier[self] , identifier[app] , identifier[fixture_path] ): literal[string] identifier[self] . identifier[monkey_patch_migration_template] ( identifier[app] , identifier[fixture_path] ) identifier[out] = identifier[StringIO] () ide...
def create_migration(self, app, fixture_path): """ Create a data migration for app that uses fixture_path. """ self.monkey_patch_migration_template(app, fixture_path) out = StringIO() management.call_command('makemigrations', app.label, empty=True, stdout=out) self.restore_migration_...
def _extract_ld_data(data, data_format=None, **kwargs): """Extract the given :attr:`data` into a :class:`~.ExtractedLinkedDataResult` with the resulting data stripped of any Linked Data specifics. Any missing Linked Data properties are returned as ``None`` in the resulting :class:`~.ExtractLinkedDat...
def function[_extract_ld_data, parameter[data, data_format]]: constant[Extract the given :attr:`data` into a :class:`~.ExtractedLinkedDataResult` with the resulting data stripped of any Linked Data specifics. Any missing Linked Data properties are returned as ``None`` in the resulting :class:`~....
keyword[def] identifier[_extract_ld_data] ( identifier[data] , identifier[data_format] = keyword[None] ,** identifier[kwargs] ): literal[string] keyword[if] keyword[not] identifier[data_format] : identifier[data_format] = identifier[_get_format_from_data] ( identifier[data] ) identifier[ex...
def _extract_ld_data(data, data_format=None, **kwargs): """Extract the given :attr:`data` into a :class:`~.ExtractedLinkedDataResult` with the resulting data stripped of any Linked Data specifics. Any missing Linked Data properties are returned as ``None`` in the resulting :class:`~.ExtractLinkedDat...
def get_declared_items(self): """ Override to do it manually """ for k, v in super(AndroidListView, self).get_declared_items(): if k == 'layout': yield k, v break
def function[get_declared_items, parameter[self]]: constant[ Override to do it manually ] for taget[tuple[[<ast.Name object at 0x7da1b1b9dff0>, <ast.Name object at 0x7da1b1b9ee90>]]] in starred[call[call[name[super], parameter[name[AndroidListView], name[self]]].get_declared_items, para...
keyword[def] identifier[get_declared_items] ( identifier[self] ): literal[string] keyword[for] identifier[k] , identifier[v] keyword[in] identifier[super] ( identifier[AndroidListView] , identifier[self] ). identifier[get_declared_items] (): keyword[if] identifier[k] == literal[str...
def get_declared_items(self): """ Override to do it manually """ for (k, v) in super(AndroidListView, self).get_declared_items(): if k == 'layout': yield (k, v) break # depends on [control=['if'], data=['k']] # depends on [control=['for'], data=[]]
def _2ndderiv_xyz(self,x,y,z,i,j): """General 2nd derivative of the potential as a function of (x,y,z) in the aligned coordinate frame""" return 4.*numpy.pi*self._b*self._c\ *_2ndDerivInt(x,y,z, lambda m: self._mdens(m), lambda m: s...
def function[_2ndderiv_xyz, parameter[self, x, y, z, i, j]]: constant[General 2nd derivative of the potential as a function of (x,y,z) in the aligned coordinate frame] return[binary_operation[binary_operation[binary_operation[binary_operation[constant[4.0] * name[numpy].pi] * name[self]._b] * name[s...
keyword[def] identifier[_2ndderiv_xyz] ( identifier[self] , identifier[x] , identifier[y] , identifier[z] , identifier[i] , identifier[j] ): literal[string] keyword[return] literal[int] * identifier[numpy] . identifier[pi] * identifier[self] . identifier[_b] * identifier[self] . identifier[_c] * i...
def _2ndderiv_xyz(self, x, y, z, i, j): """General 2nd derivative of the potential as a function of (x,y,z) in the aligned coordinate frame""" return 4.0 * numpy.pi * self._b * self._c * _2ndDerivInt(x, y, z, lambda m: self._mdens(m), lambda m: self._mdens_deriv(m), self._b2, self._c2, i, j, glx=self._g...
def find_elements_by_partial_link_text(self, link_text): """ Finds elements by a partial match of their link text. :Args: - link_text: The text of the element to partial match on. :Returns: - list of webelement - a list with elements if any was found. an e...
def function[find_elements_by_partial_link_text, parameter[self, link_text]]: constant[ Finds elements by a partial match of their link text. :Args: - link_text: The text of the element to partial match on. :Returns: - list of webelement - a list with elements if any ...
keyword[def] identifier[find_elements_by_partial_link_text] ( identifier[self] , identifier[link_text] ): literal[string] keyword[return] identifier[self] . identifier[find_elements] ( identifier[by] = identifier[By] . identifier[PARTIAL_LINK_TEXT] , identifier[value] = identifier[link_text] )
def find_elements_by_partial_link_text(self, link_text): """ Finds elements by a partial match of their link text. :Args: - link_text: The text of the element to partial match on. :Returns: - list of webelement - a list with elements if any was found. an empty...
def containerIsRunning(name_or_id): '''Check if container with the given name or ID (str) is running. No side effects. Idempotent. Returns True if running, False if not.''' require_str("name_or_id", name_or_id) try: container = getContainer(name_or_id) # Refer to the latest status list ...
def function[containerIsRunning, parameter[name_or_id]]: constant[Check if container with the given name or ID (str) is running. No side effects. Idempotent. Returns True if running, False if not.] call[name[require_str], parameter[constant[name_or_id], name[name_or_id]]] <ast.Try object at 0x7d...
keyword[def] identifier[containerIsRunning] ( identifier[name_or_id] ): literal[string] identifier[require_str] ( literal[string] , identifier[name_or_id] ) keyword[try] : identifier[container] = identifier[getContainer] ( identifier[name_or_id] ) keyword[if] iden...
def containerIsRunning(name_or_id): """Check if container with the given name or ID (str) is running. No side effects. Idempotent. Returns True if running, False if not.""" require_str('name_or_id', name_or_id) try: container = getContainer(name_or_id) # Refer to the latest status list h...
def next(self): """Return the next available message Blocks indefinitely unless consumer_timeout_ms > 0 Returns: a single KafkaMessage from the message iterator Raises: ConsumerTimeout after consumer_timeout_ms and no message Note: This is ...
def function[next, parameter[self]]: constant[Return the next available message Blocks indefinitely unless consumer_timeout_ms > 0 Returns: a single KafkaMessage from the message iterator Raises: ConsumerTimeout after consumer_timeout_ms and no message ...
keyword[def] identifier[next] ( identifier[self] ): literal[string] identifier[self] . identifier[_set_consumer_timeout_start] () keyword[while] keyword[True] : keyword[try] : keyword[return] identifier[six] . identifier[next] ( identifier[self] . identifie...
def next(self): """Return the next available message Blocks indefinitely unless consumer_timeout_ms > 0 Returns: a single KafkaMessage from the message iterator Raises: ConsumerTimeout after consumer_timeout_ms and no message Note: This is also...
def load_field_config(self, file_id): """ Loads the configuration fields file for the id. :param file_id: the id for the field :return: the fields configuration """ if file_id not in self._field_configs: self._field_configs[file_id] = self._reader.read_yaml_f...
def function[load_field_config, parameter[self, file_id]]: constant[ Loads the configuration fields file for the id. :param file_id: the id for the field :return: the fields configuration ] if compare[name[file_id] <ast.NotIn object at 0x7da2590d7190> name[self]._field_c...
keyword[def] identifier[load_field_config] ( identifier[self] , identifier[file_id] ): literal[string] keyword[if] identifier[file_id] keyword[not] keyword[in] identifier[self] . identifier[_field_configs] : identifier[self] . identifier[_field_configs] [ identifier[file_id] ]= ide...
def load_field_config(self, file_id): """ Loads the configuration fields file for the id. :param file_id: the id for the field :return: the fields configuration """ if file_id not in self._field_configs: self._field_configs[file_id] = self._reader.read_yaml_file('field_c...
def write(self, buf): """Writes data to the pyboard over the serial port.""" self.check_pyb() try: return self.pyb.serial.write(buf) except (serial.serialutil.SerialException, BrokenPipeError, TypeError): # Write failed - assume that we got disconnected ...
def function[write, parameter[self, buf]]: constant[Writes data to the pyboard over the serial port.] call[name[self].check_pyb, parameter[]] <ast.Try object at 0x7da1b17351e0>
keyword[def] identifier[write] ( identifier[self] , identifier[buf] ): literal[string] identifier[self] . identifier[check_pyb] () keyword[try] : keyword[return] identifier[self] . identifier[pyb] . identifier[serial] . identifier[write] ( identifier[buf] ) keyword[e...
def write(self, buf): """Writes data to the pyboard over the serial port.""" self.check_pyb() try: return self.pyb.serial.write(buf) # depends on [control=['try'], data=[]] except (serial.serialutil.SerialException, BrokenPipeError, TypeError): # Write failed - assume that we got discon...
def convert_activation(node, **kwargs): """Map MXNet's Activation operator attributes to onnx's Tanh/Relu operator and return the created node. """ name, input_nodes, attrs = get_inputs(node, kwargs) act_type = attrs["act_type"] # Creating a dictionary here, but if this titlecase pattern #...
def function[convert_activation, parameter[node]]: constant[Map MXNet's Activation operator attributes to onnx's Tanh/Relu operator and return the created node. ] <ast.Tuple object at 0x7da1b1e401f0> assign[=] call[name[get_inputs], parameter[name[node], name[kwargs]]] variable[act_type]...
keyword[def] identifier[convert_activation] ( identifier[node] ,** identifier[kwargs] ): literal[string] identifier[name] , identifier[input_nodes] , identifier[attrs] = identifier[get_inputs] ( identifier[node] , identifier[kwargs] ) identifier[act_type] = identifier[attrs] [ literal[string] ] ...
def convert_activation(node, **kwargs): """Map MXNet's Activation operator attributes to onnx's Tanh/Relu operator and return the created node. """ (name, input_nodes, attrs) = get_inputs(node, kwargs) act_type = attrs['act_type'] # Creating a dictionary here, but if this titlecase pattern #...
def add_bundle(self, prov_bundle, identifier): """ Verbose method of adding a bundle. Can also be done as: >>> api = Api() >>> document = api.document.get(148) >>> document.bundles['identifier'] = prov_bundle :param prov_bundle: The bundle to be added ...
def function[add_bundle, parameter[self, prov_bundle, identifier]]: constant[ Verbose method of adding a bundle. Can also be done as: >>> api = Api() >>> document = api.document.get(148) >>> document.bundles['identifier'] = prov_bundle :param prov_bundle: ...
keyword[def] identifier[add_bundle] ( identifier[self] , identifier[prov_bundle] , identifier[identifier] ): literal[string] keyword[if] identifier[self] . identifier[abstract] : keyword[raise] identifier[AbstractDocumentException] () identifier[self] . identifier[_api] . i...
def add_bundle(self, prov_bundle, identifier): """ Verbose method of adding a bundle. Can also be done as: >>> api = Api() >>> document = api.document.get(148) >>> document.bundles['identifier'] = prov_bundle :param prov_bundle: The bundle to be added ...
def _store_variable(self, j, key, m, value): """Store a copy of the variable in the history """ if hasattr(value, 'copy'): v = value.copy() else: v = value self.history[j][key][m].append(v)
def function[_store_variable, parameter[self, j, key, m, value]]: constant[Store a copy of the variable in the history ] if call[name[hasattr], parameter[name[value], constant[copy]]] begin[:] variable[v] assign[=] call[name[value].copy, parameter[]] call[call[call[call[n...
keyword[def] identifier[_store_variable] ( identifier[self] , identifier[j] , identifier[key] , identifier[m] , identifier[value] ): literal[string] keyword[if] identifier[hasattr] ( identifier[value] , literal[string] ): identifier[v] = identifier[value] . identifier[copy] () ...
def _store_variable(self, j, key, m, value): """Store a copy of the variable in the history """ if hasattr(value, 'copy'): v = value.copy() # depends on [control=['if'], data=[]] else: v = value self.history[j][key][m].append(v)
def updateSocialTone(user, socialTone, maintainHistory): """ updateSocialTone updates the user with the social tones interpreted based on the specified thresholds @param user a json object representing user information (tone) to be used in conversing with the Conversation Service @param socialTo...
def function[updateSocialTone, parameter[user, socialTone, maintainHistory]]: constant[ updateSocialTone updates the user with the social tones interpreted based on the specified thresholds @param user a json object representing user information (tone) to be used in conversing with the Conversat...
keyword[def] identifier[updateSocialTone] ( identifier[user] , identifier[socialTone] , identifier[maintainHistory] ): literal[string] identifier[currentSocial] =[] identifier[currentSocialObject] =[] keyword[for] identifier[tone] keyword[in] identifier[socialTone] [ literal[string] ]: ...
def updateSocialTone(user, socialTone, maintainHistory): """ updateSocialTone updates the user with the social tones interpreted based on the specified thresholds @param user a json object representing user information (tone) to be used in conversing with the Conversation Service @param socialTo...
def _set_remap(self, v, load=False): """ Setter method for remap, mapped from YANG variable /cee_map/remap (container) If this variable is read-only (config: false) in the source YANG file, then _set_remap is considered as a private method. Backends looking to populate this variable should do so...
def function[_set_remap, parameter[self, v, load]]: constant[ Setter method for remap, mapped from YANG variable /cee_map/remap (container) If this variable is read-only (config: false) in the source YANG file, then _set_remap is considered as a private method. Backends looking to populate this ...
keyword[def] identifier[_set_remap] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ): literal[string] keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ): identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] ) keyword[try] : identifi...
def _set_remap(self, v, load=False): """ Setter method for remap, mapped from YANG variable /cee_map/remap (container) If this variable is read-only (config: false) in the source YANG file, then _set_remap is considered as a private method. Backends looking to populate this variable should do so...
def url_for(self, operation, _external=True, **kwargs): """ Construct a URL for an operation against a resource. :param kwargs: additional arguments for URL path expansion, which are passed to flask.url_for. In particular, _external=True produces absolute url. "...
def function[url_for, parameter[self, operation, _external]]: constant[ Construct a URL for an operation against a resource. :param kwargs: additional arguments for URL path expansion, which are passed to flask.url_for. In particular, _external=True produces absolute url...
keyword[def] identifier[url_for] ( identifier[self] , identifier[operation] , identifier[_external] = keyword[True] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[url_for] ( identifier[self] . identifier[endpoint_for] ( identifier[operation] ), identifier[_external] = identif...
def url_for(self, operation, _external=True, **kwargs): """ Construct a URL for an operation against a resource. :param kwargs: additional arguments for URL path expansion, which are passed to flask.url_for. In particular, _external=True produces absolute url. """ ...
def convert_ini(config_dict): """Convert _config_dict_ into a list of INI formatted strings. Args: config_dict (dict): Configuration dictionary to be flattened. Returns: (list) Lines to be written to a file in the format of KEY1_KEY2=value. """ config_lines = [] for env, confi...
def function[convert_ini, parameter[config_dict]]: constant[Convert _config_dict_ into a list of INI formatted strings. Args: config_dict (dict): Configuration dictionary to be flattened. Returns: (list) Lines to be written to a file in the format of KEY1_KEY2=value. ] vari...
keyword[def] identifier[convert_ini] ( identifier[config_dict] ): literal[string] identifier[config_lines] =[] keyword[for] identifier[env] , identifier[configs] keyword[in] identifier[sorted] ( identifier[config_dict] . identifier[items] ()): keyword[for] identifier[resource] , identifi...
def convert_ini(config_dict): """Convert _config_dict_ into a list of INI formatted strings. Args: config_dict (dict): Configuration dictionary to be flattened. Returns: (list) Lines to be written to a file in the format of KEY1_KEY2=value. """ config_lines = [] for (env, confi...
def has_child_catalogs(self, catalog_id): """Tests if a catalog has any children. arg: catalog_id (osid.id.Id): a ``catalog_id`` return: (boolean) - ``true`` if the ``catalog_id`` has children, ``false`` otherwise raise: NotFound - ``catalog_id`` is not found ...
def function[has_child_catalogs, parameter[self, catalog_id]]: constant[Tests if a catalog has any children. arg: catalog_id (osid.id.Id): a ``catalog_id`` return: (boolean) - ``true`` if the ``catalog_id`` has children, ``false`` otherwise raise: NotFound - ``catalo...
keyword[def] identifier[has_child_catalogs] ( identifier[self] , identifier[catalog_id] ): literal[string] keyword[if] identifier[self] . identifier[_catalog_session] keyword[is] keyword[not] keyword[None] : keyword[return] identifier[self] . identifier[_catalog_...
def has_child_catalogs(self, catalog_id): """Tests if a catalog has any children. arg: catalog_id (osid.id.Id): a ``catalog_id`` return: (boolean) - ``true`` if the ``catalog_id`` has children, ``false`` otherwise raise: NotFound - ``catalog_id`` is not found rai...
def i2repr(self, pkt, x): """Convert internal value to a nice representation""" if len(hex(self.i2m(pkt, x))) < 7: # short address return hex(self.i2m(pkt, x)) else: # long address x = "%016x" % self.i2m(pkt, x) return ":".join(["%s%s" % (x[i], x[i + 1]) for...
def function[i2repr, parameter[self, pkt, x]]: constant[Convert internal value to a nice representation] if compare[call[name[len], parameter[call[name[hex], parameter[call[name[self].i2m, parameter[name[pkt], name[x]]]]]]] less[<] constant[7]] begin[:] return[call[name[hex], parameter[call[name...
keyword[def] identifier[i2repr] ( identifier[self] , identifier[pkt] , identifier[x] ): literal[string] keyword[if] identifier[len] ( identifier[hex] ( identifier[self] . identifier[i2m] ( identifier[pkt] , identifier[x] )))< literal[int] : keyword[return] identifier[hex] ( identifie...
def i2repr(self, pkt, x): """Convert internal value to a nice representation""" if len(hex(self.i2m(pkt, x))) < 7: # short address return hex(self.i2m(pkt, x)) # depends on [control=['if'], data=[]] else: # long address x = '%016x' % self.i2m(pkt, x) return ':'.join(['%s%s' % (x[i...
def sunrise_sunset(moment, latitude, longitude): r'''Calculates the times at which the sun is at sunset; sunrise; and halfway between sunrise and sunset (transit). Uses the Reda and Andreas (2004) model described in [1]_, originally incorporated into the excellent `pvlib library <https://git...
def function[sunrise_sunset, parameter[moment, latitude, longitude]]: constant[Calculates the times at which the sun is at sunset; sunrise; and halfway between sunrise and sunset (transit). Uses the Reda and Andreas (2004) model described in [1]_, originally incorporated into the excellent ...
keyword[def] identifier[sunrise_sunset] ( identifier[moment] , identifier[latitude] , identifier[longitude] ): literal[string] keyword[from] identifier[fluids] . identifier[optional] keyword[import] identifier[spa] identifier[delta_t] = identifier[spa] . identifier[calculate_deltat] ( identifier[m...
def sunrise_sunset(moment, latitude, longitude): """Calculates the times at which the sun is at sunset; sunrise; and halfway between sunrise and sunset (transit). Uses the Reda and Andreas (2004) model described in [1]_, originally incorporated into the excellent `pvlib library <https://gith...
def findDuplicates(tfam): """Finds the duplicates in a TFAM. :param tfam: representation of a ``tfam`` file. :type tfam: list :returns: two :py:class:`dict`, containing unique and duplicated samples position. """ uSamples = {} dSamples = defaultdict(list) for i, row in e...
def function[findDuplicates, parameter[tfam]]: constant[Finds the duplicates in a TFAM. :param tfam: representation of a ``tfam`` file. :type tfam: list :returns: two :py:class:`dict`, containing unique and duplicated samples position. ] variable[uSamples] assign[=] dict...
keyword[def] identifier[findDuplicates] ( identifier[tfam] ): literal[string] identifier[uSamples] ={} identifier[dSamples] = identifier[defaultdict] ( identifier[list] ) keyword[for] identifier[i] , identifier[row] keyword[in] identifier[enumerate] ( identifier[tfam] ): identifier[sa...
def findDuplicates(tfam): """Finds the duplicates in a TFAM. :param tfam: representation of a ``tfam`` file. :type tfam: list :returns: two :py:class:`dict`, containing unique and duplicated samples position. """ uSamples = {} dSamples = defaultdict(list) for (i, row) in...
def getElementById(self, _id, root='root', useIndex=True): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search sta...
def function[getElementById, parameter[self, _id, root, useIndex]]: constant[ getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root...
keyword[def] identifier[getElementById] ( identifier[self] , identifier[_id] , identifier[root] = literal[string] , identifier[useIndex] = keyword[True] ): literal[string] ( identifier[root] , identifier[isFromRoot] )= identifier[self] . identifier[_handleRootArg] ( identifier[root] ) keyw...
def getElementById(self, _id, root='root', useIndex=True): """ getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search startin...
def get_bios_firmware_version(snmp_client): """Get bios firmware version of the node. :param snmp_client: an SNMP client object. :raises: SNMPFailure if SNMP operation failed. :returns: a string of bios firmware version. """ try: bios_firmware_version = snmp_client.get(BIOS_FW_VERSION_...
def function[get_bios_firmware_version, parameter[snmp_client]]: constant[Get bios firmware version of the node. :param snmp_client: an SNMP client object. :raises: SNMPFailure if SNMP operation failed. :returns: a string of bios firmware version. ] <ast.Try object at 0x7da1b1a76f80>
keyword[def] identifier[get_bios_firmware_version] ( identifier[snmp_client] ): literal[string] keyword[try] : identifier[bios_firmware_version] = identifier[snmp_client] . identifier[get] ( identifier[BIOS_FW_VERSION_OID] ) keyword[return] identifier[six] . identifier[text_type] ( iden...
def get_bios_firmware_version(snmp_client): """Get bios firmware version of the node. :param snmp_client: an SNMP client object. :raises: SNMPFailure if SNMP operation failed. :returns: a string of bios firmware version. """ try: bios_firmware_version = snmp_client.get(BIOS_FW_VERSION_O...
def get_rel_sciobj_file_path(pid): """Get the relative local path to the file holding an object's bytes. - The path is relative to settings.OBJECT_STORE_PATH - There is a one-to-one mapping between pid and path - The path is based on a SHA1 hash. It's now possible to craft SHA1 collisions, but it...
def function[get_rel_sciobj_file_path, parameter[pid]]: constant[Get the relative local path to the file holding an object's bytes. - The path is relative to settings.OBJECT_STORE_PATH - There is a one-to-one mapping between pid and path - The path is based on a SHA1 hash. It's now possible to craf...
keyword[def] identifier[get_rel_sciobj_file_path] ( identifier[pid] ): literal[string] identifier[hash_str] = identifier[hashlib] . identifier[sha1] ( identifier[pid] . identifier[encode] ( literal[string] )). identifier[hexdigest] () keyword[return] identifier[os] . identifier[path] . identifier[joi...
def get_rel_sciobj_file_path(pid): """Get the relative local path to the file holding an object's bytes. - The path is relative to settings.OBJECT_STORE_PATH - There is a one-to-one mapping between pid and path - The path is based on a SHA1 hash. It's now possible to craft SHA1 collisions, but it...
def _enforce_ttl_key(self, key): ''' Enforce the TTL to a specific key, delete if its past TTL ''' if key not in self._key_cache_time or self._ttl == 0: return if time.time() - self._key_cache_time[key] > self._ttl: del self._key_cache_time[key] ...
def function[_enforce_ttl_key, parameter[self, key]]: constant[ Enforce the TTL to a specific key, delete if its past TTL ] if <ast.BoolOp object at 0x7da18c4cf130> begin[:] return[None] if compare[binary_operation[call[name[time].time, parameter[]] - call[name[self]._key...
keyword[def] identifier[_enforce_ttl_key] ( identifier[self] , identifier[key] ): literal[string] keyword[if] identifier[key] keyword[not] keyword[in] identifier[self] . identifier[_key_cache_time] keyword[or] identifier[self] . identifier[_ttl] == literal[int] : keyword[return] ...
def _enforce_ttl_key(self, key): """ Enforce the TTL to a specific key, delete if its past TTL """ if key not in self._key_cache_time or self._ttl == 0: return # depends on [control=['if'], data=[]] if time.time() - self._key_cache_time[key] > self._ttl: del self._key_cache_...
def itermerged(self): """Iterate over all headers, merging duplicate ones together.""" for key in self: val = _dict_getitem(self, key) yield val[0], ', '.join(val[1:])
def function[itermerged, parameter[self]]: constant[Iterate over all headers, merging duplicate ones together.] for taget[name[key]] in starred[name[self]] begin[:] variable[val] assign[=] call[name[_dict_getitem], parameter[name[self], name[key]]] <ast.Yield object at 0x...
keyword[def] identifier[itermerged] ( identifier[self] ): literal[string] keyword[for] identifier[key] keyword[in] identifier[self] : identifier[val] = identifier[_dict_getitem] ( identifier[self] , identifier[key] ) keyword[yield] identifier[val] [ literal[int] ], lit...
def itermerged(self): """Iterate over all headers, merging duplicate ones together.""" for key in self: val = _dict_getitem(self, key) yield (val[0], ', '.join(val[1:])) # depends on [control=['for'], data=['key']]
def get_Cpt_params(A, Cnodes, AggOp, T): """Return C and F pts. Helper function that returns a dictionary of sparse matrices and arrays which allow us to easily operate on Cpts and Fpts separately. Parameters ---------- A : {csr_matrix, bsr_matrix} Operator Cnodes : {array} ...
def function[get_Cpt_params, parameter[A, Cnodes, AggOp, T]]: constant[Return C and F pts. Helper function that returns a dictionary of sparse matrices and arrays which allow us to easily operate on Cpts and Fpts separately. Parameters ---------- A : {csr_matrix, bsr_matrix} Operat...
keyword[def] identifier[get_Cpt_params] ( identifier[A] , identifier[Cnodes] , identifier[AggOp] , identifier[T] ): literal[string] keyword[if] keyword[not] identifier[isspmatrix_bsr] ( identifier[A] ) keyword[and] keyword[not] identifier[isspmatrix_csr] ( identifier[A] ): keyword[raise] iden...
def get_Cpt_params(A, Cnodes, AggOp, T): """Return C and F pts. Helper function that returns a dictionary of sparse matrices and arrays which allow us to easily operate on Cpts and Fpts separately. Parameters ---------- A : {csr_matrix, bsr_matrix} Operator Cnodes : {array} ...
def gfortran_search_path(library_dirs): """Get the library directory paths for ``gfortran``. Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs`` and then parses the paths. If this fails for any reason, this method will print an error and return ``library_dirs``. Args: ...
def function[gfortran_search_path, parameter[library_dirs]]: constant[Get the library directory paths for ``gfortran``. Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs`` and then parses the paths. If this fails for any reason, this method will print an error and return ``l...
keyword[def] identifier[gfortran_search_path] ( identifier[library_dirs] ): literal[string] identifier[cmd] =( literal[string] , literal[string] ) identifier[process] = identifier[subprocess] . identifier[Popen] ( identifier[cmd] , identifier[stdout] = identifier[subprocess] . identifier[PIPE] ) ...
def gfortran_search_path(library_dirs): """Get the library directory paths for ``gfortran``. Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs`` and then parses the paths. If this fails for any reason, this method will print an error and return ``library_dirs``. Args: ...
def cli(obj, origin, tags, timeout, customer, delete): """Send or delete a heartbeat.""" client = obj['client'] if delete: client.delete_heartbeat(delete) else: try: heartbeat = client.heartbeat(origin=origin, tags=tags, timeout=timeout, customer=customer) except Exce...
def function[cli, parameter[obj, origin, tags, timeout, customer, delete]]: constant[Send or delete a heartbeat.] variable[client] assign[=] call[name[obj]][constant[client]] if name[delete] begin[:] call[name[client].delete_heartbeat, parameter[name[delete]]]
keyword[def] identifier[cli] ( identifier[obj] , identifier[origin] , identifier[tags] , identifier[timeout] , identifier[customer] , identifier[delete] ): literal[string] identifier[client] = identifier[obj] [ literal[string] ] keyword[if] identifier[delete] : identifier[client] . identifie...
def cli(obj, origin, tags, timeout, customer, delete): """Send or delete a heartbeat.""" client = obj['client'] if delete: client.delete_heartbeat(delete) # depends on [control=['if'], data=[]] else: try: heartbeat = client.heartbeat(origin=origin, tags=tags, timeout=timeout...
def withdraw(self, currency, quantity, address, paymentid=None): """ Used to withdraw funds from your account Endpoint: 1.1 /account/withdraw 2.0 /key/balance/withdrawcurrency :param currency: String literal for the currency (ie. BTC) :type currency: str ...
def function[withdraw, parameter[self, currency, quantity, address, paymentid]]: constant[ Used to withdraw funds from your account Endpoint: 1.1 /account/withdraw 2.0 /key/balance/withdrawcurrency :param currency: String literal for the currency (ie. BTC) :type...
keyword[def] identifier[withdraw] ( identifier[self] , identifier[currency] , identifier[quantity] , identifier[address] , identifier[paymentid] = keyword[None] ): literal[string] identifier[options] ={ literal[string] : identifier[currency] , literal[string] : identifier[quantity...
def withdraw(self, currency, quantity, address, paymentid=None): """ Used to withdraw funds from your account Endpoint: 1.1 /account/withdraw 2.0 /key/balance/withdrawcurrency :param currency: String literal for the currency (ie. BTC) :type currency: str :pa...
def restrict_chat_member(self, *args, **kwargs): """See :func:`restrict_chat_member`""" return restrict_chat_member(*args, **self._merge_overrides(**kwargs)).run()
def function[restrict_chat_member, parameter[self]]: constant[See :func:`restrict_chat_member`] return[call[call[name[restrict_chat_member], parameter[<ast.Starred object at 0x7da1b0e9c040>]].run, parameter[]]]
keyword[def] identifier[restrict_chat_member] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[restrict_chat_member] (* identifier[args] ,** identifier[self] . identifier[_merge_overrides] (** identifier[kwargs] )). identifier[run] ()
def restrict_chat_member(self, *args, **kwargs): """See :func:`restrict_chat_member`""" return restrict_chat_member(*args, **self._merge_overrides(**kwargs)).run()
def matchingFilePaths(targetfilename, directory, targetFileExtension=None, selector=None): """Search for files in all subfolders of specified directory, return filepaths of all matching instances. :param targetfilename: filename to search for, only the string before the last "...
def function[matchingFilePaths, parameter[targetfilename, directory, targetFileExtension, selector]]: constant[Search for files in all subfolders of specified directory, return filepaths of all matching instances. :param targetfilename: filename to search for, only the string before the last "....
keyword[def] identifier[matchingFilePaths] ( identifier[targetfilename] , identifier[directory] , identifier[targetFileExtension] = keyword[None] , identifier[selector] = keyword[None] ): literal[string] identifier[targetFilePaths] = identifier[list] () identifier[targetfilename] = identifier[os] . ...
def matchingFilePaths(targetfilename, directory, targetFileExtension=None, selector=None): """Search for files in all subfolders of specified directory, return filepaths of all matching instances. :param targetfilename: filename to search for, only the string before the last "." is used for filenam...
def parse_data_line(self, sline): """ Parse the data line. If an AS was selected it can distinguish between data rows and information rows. :param sline: a split data line to parse :returns: the number of rows to jump and parse the next data line or return the code error -1 """ ...
def function[parse_data_line, parameter[self, sline]]: constant[ Parse the data line. If an AS was selected it can distinguish between data rows and information rows. :param sline: a split data line to parse :returns: the number of rows to jump and parse the next data line or return the ...
keyword[def] identifier[parse_data_line] ( identifier[self] , identifier[sline] ): literal[string] keyword[if] identifier[len] ( identifier[sline] )!= identifier[len] ( identifier[self] . identifier[_columns] ): identifier[self] . identifier[err] ( literal[string] ) ...
def parse_data_line(self, sline): """ Parse the data line. If an AS was selected it can distinguish between data rows and information rows. :param sline: a split data line to parse :returns: the number of rows to jump and parse the next data line or return the code error -1 """ #...
def sar(self, count): """Performs an arithmetic right-shift of a BinWord by the given number of bits. Bits shifted out of the word are lost. The word is filled on the left with copies of the top bit. The shift count can be an arbitrary non-negative number, including counts lar...
def function[sar, parameter[self, count]]: constant[Performs an arithmetic right-shift of a BinWord by the given number of bits. Bits shifted out of the word are lost. The word is filled on the left with copies of the top bit. The shift count can be an arbitrary non-negative number, i...
keyword[def] identifier[sar] ( identifier[self] , identifier[count] ): literal[string] identifier[count] = identifier[operator] . identifier[index] ( identifier[count] ) keyword[if] identifier[count] < literal[int] : keyword[raise] identifier[ValueError] ( literal[string] ) ...
def sar(self, count): """Performs an arithmetic right-shift of a BinWord by the given number of bits. Bits shifted out of the word are lost. The word is filled on the left with copies of the top bit. The shift count can be an arbitrary non-negative number, including counts larger ...
def error_response(self, e): """Make response for an IIIFError e. Also add compliance header. """ self.add_compliance_header() return self.make_response(*e.image_server_response(self.api_version))
def function[error_response, parameter[self, e]]: constant[Make response for an IIIFError e. Also add compliance header. ] call[name[self].add_compliance_header, parameter[]] return[call[name[self].make_response, parameter[<ast.Starred object at 0x7da1b04752a0>]]]
keyword[def] identifier[error_response] ( identifier[self] , identifier[e] ): literal[string] identifier[self] . identifier[add_compliance_header] () keyword[return] identifier[self] . identifier[make_response] (* identifier[e] . identifier[image_server_response] ( identifier[self] . iden...
def error_response(self, e): """Make response for an IIIFError e. Also add compliance header. """ self.add_compliance_header() return self.make_response(*e.image_server_response(self.api_version))
def update(self, other): """ Update the collection with items from *other*. Accepts other :class:`GeoDB` instances, dictionaries mapping places to ``{'latitude': latitude, 'longitude': longitude}`` dicts, or sequences of ``(place, latitude, longitude)`` tuples. """ ...
def function[update, parameter[self, other]]: constant[ Update the collection with items from *other*. Accepts other :class:`GeoDB` instances, dictionaries mapping places to ``{'latitude': latitude, 'longitude': longitude}`` dicts, or sequences of ``(place, latitude, longitude)``...
keyword[def] identifier[update] ( identifier[self] , identifier[other] ): literal[string] keyword[def] identifier[update_sortedset_trans] ( identifier[pipe] ): identifier[items] = identifier[other] . identifier[_data] ( identifier[pipe] = identifier[pipe] ) keyword[if] ident...
def update(self, other): """ Update the collection with items from *other*. Accepts other :class:`GeoDB` instances, dictionaries mapping places to ``{'latitude': latitude, 'longitude': longitude}`` dicts, or sequences of ``(place, latitude, longitude)`` tuples. """ # othe...
def _int_to_key(keys, index): 'Convert int ``index`` to the corresponding key in ``keys``' if isinstance(index, int): try: return keys[index] except IndexError: # use KeyError rather than IndexError for compatibility raise KeyError('Index out of range of keys:...
def function[_int_to_key, parameter[keys, index]]: constant[Convert int ``index`` to the corresponding key in ``keys``] if call[name[isinstance], parameter[name[index], name[int]]] begin[:] <ast.Try object at 0x7da18fe91840> return[name[index]]
keyword[def] identifier[_int_to_key] ( identifier[keys] , identifier[index] ): literal[string] keyword[if] identifier[isinstance] ( identifier[index] , identifier[int] ): keyword[try] : keyword[return] identifier[keys] [ identifier[index] ] keyword[except] identifier[Index...
def _int_to_key(keys, index): """Convert int ``index`` to the corresponding key in ``keys``""" if isinstance(index, int): try: return keys[index] # depends on [control=['try'], data=[]] except IndexError: # use KeyError rather than IndexError for compatibility ...
async def _process_message(self, message): """ Adds the given message to the list of messages that must be acknowledged and dispatches control to different ``_handle_*`` method based on its type. """ self._pending_ack.add(message.msg_id) handler = self._handlers.g...
<ast.AsyncFunctionDef object at 0x7da1b21dbac0>
keyword[async] keyword[def] identifier[_process_message] ( identifier[self] , identifier[message] ): literal[string] identifier[self] . identifier[_pending_ack] . identifier[add] ( identifier[message] . identifier[msg_id] ) identifier[handler] = identifier[self] . identifier[_handlers] . ...
async def _process_message(self, message): """ Adds the given message to the list of messages that must be acknowledged and dispatches control to different ``_handle_*`` method based on its type. """ self._pending_ack.add(message.msg_id) handler = self._handlers.get(message.o...
def update(self, request, *args, **kwargs): """Update an entity. Original queryset produces a temporary database table whose rows cannot be selected for an update. As a workaround, we patch get_queryset function to return only Entity objects without additional data that is not n...
def function[update, parameter[self, request]]: constant[Update an entity. Original queryset produces a temporary database table whose rows cannot be selected for an update. As a workaround, we patch get_queryset function to return only Entity objects without additional data tha...
keyword[def] identifier[update] ( identifier[self] , identifier[request] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[orig_get_queryset] = identifier[self] . identifier[get_queryset] keyword[def] identifier[patched_get_queryset] (): literal[strin...
def update(self, request, *args, **kwargs): """Update an entity. Original queryset produces a temporary database table whose rows cannot be selected for an update. As a workaround, we patch get_queryset function to return only Entity objects without additional data that is not neede...
def makefile(self, mode="r", buffering=None, **_3to2kwargs): """makefile(...) -> an I/O stream connected to the socket The arguments are as for io.open() after the filename, except the only mode characters supported are 'r', 'w' and 'b'. The semantics are similar too. (XXX refactor to ...
def function[makefile, parameter[self, mode, buffering]]: constant[makefile(...) -> an I/O stream connected to the socket The arguments are as for io.open() after the filename, except the only mode characters supported are 'r', 'w' and 'b'. The semantics are similar too. (XXX refactor ...
keyword[def] identifier[makefile] ( identifier[self] , identifier[mode] = literal[string] , identifier[buffering] = keyword[None] ,** identifier[_3to2kwargs] ): literal[string] keyword[if] literal[string] keyword[in] identifier[_3to2kwargs] : identifier[newline] = identifier[_3to2kwargs] [ liter...
def makefile(self, mode='r', buffering=None, **_3to2kwargs): """makefile(...) -> an I/O stream connected to the socket The arguments are as for io.open() after the filename, except the only mode characters supported are 'r', 'w' and 'b'. The semantics are similar too. (XXX refactor to shar...
def text_alignment(x, y): """ Align text labels based on the x- and y-axis coordinate values. This function is used for computing the appropriate alignment of the text label. For example, if the text is on the "right" side of the plot, we want it to be left-aligned. If the text is on the "top"...
def function[text_alignment, parameter[x, y]]: constant[ Align text labels based on the x- and y-axis coordinate values. This function is used for computing the appropriate alignment of the text label. For example, if the text is on the "right" side of the plot, we want it to be left-align...
keyword[def] identifier[text_alignment] ( identifier[x] , identifier[y] ): literal[string] keyword[if] identifier[x] == literal[int] : identifier[ha] = literal[string] keyword[elif] identifier[x] > literal[int] : identifier[ha] = literal[string] keyword[else] : iden...
def text_alignment(x, y): """ Align text labels based on the x- and y-axis coordinate values. This function is used for computing the appropriate alignment of the text label. For example, if the text is on the "right" side of the plot, we want it to be left-aligned. If the text is on the "top"...