code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def from_pickle(cls, filename): """Loads and Returns a Mesh from a pickle file, given a filename.""" with open(filename, 'rb') as f: mesh = pickle.load(f).copy() return mesh
def function[from_pickle, parameter[cls, filename]]: constant[Loads and Returns a Mesh from a pickle file, given a filename.] with call[name[open], parameter[name[filename], constant[rb]]] begin[:] variable[mesh] assign[=] call[call[name[pickle].load, parameter[name[f]]].copy, parameter[...
keyword[def] identifier[from_pickle] ( identifier[cls] , identifier[filename] ): literal[string] keyword[with] identifier[open] ( identifier[filename] , literal[string] ) keyword[as] identifier[f] : identifier[mesh] = identifier[pickle] . identifier[load] ( identifier[f] ). identifie...
def from_pickle(cls, filename): """Loads and Returns a Mesh from a pickle file, given a filename.""" with open(filename, 'rb') as f: mesh = pickle.load(f).copy() # depends on [control=['with'], data=['f']] return mesh
def status_count(self, project): ''' return a dict ''' result = dict() if project not in self.projects: self._list_project() if project not in self.projects: return result tablename = self._tablename(project) for status, count in se...
def function[status_count, parameter[self, project]]: constant[ return a dict ] variable[result] assign[=] call[name[dict], parameter[]] if compare[name[project] <ast.NotIn object at 0x7da2590d7190> name[self].projects] begin[:] call[name[self]._list_project, para...
keyword[def] identifier[status_count] ( identifier[self] , identifier[project] ): literal[string] identifier[result] = identifier[dict] () keyword[if] identifier[project] keyword[not] keyword[in] identifier[self] . identifier[projects] : identifier[self] . identifier[_list...
def status_count(self, project): """ return a dict """ result = dict() if project not in self.projects: self._list_project() # depends on [control=['if'], data=[]] if project not in self.projects: return result # depends on [control=['if'], data=[]] tablename = self...
def evaluate(self, dataset, metric='auto'): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same ...
def function[evaluate, parameter[self, dataset, metric]]: constant[ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with t...
keyword[def] identifier[evaluate] ( identifier[self] , identifier[dataset] , identifier[metric] = literal[string] ): literal[string] identifier[avail_metrics] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , l...
def evaluate(self, dataset, metric='auto'): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same name...
def list_permissions(vhost, runas=None): ''' Lists permissions for vhost via rabbitmqctl list_permissions CLI Example: .. code-block:: bash salt '*' rabbitmq.list_permissions /myvhost ''' if runas is None and not salt.utils.platform.is_windows(): runas = salt.utils.user.get_us...
def function[list_permissions, parameter[vhost, runas]]: constant[ Lists permissions for vhost via rabbitmqctl list_permissions CLI Example: .. code-block:: bash salt '*' rabbitmq.list_permissions /myvhost ] if <ast.BoolOp object at 0x7da2047eb820> begin[:] var...
keyword[def] identifier[list_permissions] ( identifier[vhost] , identifier[runas] = keyword[None] ): literal[string] keyword[if] identifier[runas] keyword[is] keyword[None] keyword[and] keyword[not] identifier[salt] . identifier[utils] . identifier[platform] . identifier[is_windows] (): iden...
def list_permissions(vhost, runas=None): """ Lists permissions for vhost via rabbitmqctl list_permissions CLI Example: .. code-block:: bash salt '*' rabbitmq.list_permissions /myvhost """ if runas is None and (not salt.utils.platform.is_windows()): runas = salt.utils.user.get_...
def token_perplexity_micro(eval_data, predictions, scores, learner='ignored'): ''' Return the micro-averaged per-token perplexity `exp(-score / num_tokens)` computed over the entire corpus, as a length-1 list of floats. The log scores in `scores` should be base e (`exp`, `log`). >>> refs = [Instanc...
def function[token_perplexity_micro, parameter[eval_data, predictions, scores, learner]]: constant[ Return the micro-averaged per-token perplexity `exp(-score / num_tokens)` computed over the entire corpus, as a length-1 list of floats. The log scores in `scores` should be base e (`exp`, `log`). ...
keyword[def] identifier[token_perplexity_micro] ( identifier[eval_data] , identifier[predictions] , identifier[scores] , identifier[learner] = literal[string] ): literal[string] identifier[lens] = identifier[np] . identifier[array] ([ identifier[len] ( identifier[_maybe_tokenize] ( identifier[inst] . ident...
def token_perplexity_micro(eval_data, predictions, scores, learner='ignored'): """ Return the micro-averaged per-token perplexity `exp(-score / num_tokens)` computed over the entire corpus, as a length-1 list of floats. The log scores in `scores` should be base e (`exp`, `log`). >>> refs = [Instanc...
def asDictionary(self): """ returns the object as a dictionary """ template = { "type" : "esriPMS", "url" : self._url, "imageData" : self._imageDate, "contentType" : self._contentType, "width" : self._width, "height" : self._height,...
def function[asDictionary, parameter[self]]: constant[ returns the object as a dictionary ] variable[template] assign[=] dictionary[[<ast.Constant object at 0x7da2041dbe50>, <ast.Constant object at 0x7da2041dafb0>, <ast.Constant object at 0x7da2041dae90>, <ast.Constant object at 0x7da2041da890>, <ast.Co...
keyword[def] identifier[asDictionary] ( identifier[self] ): literal[string] identifier[template] ={ literal[string] : literal[string] , literal[string] : identifier[self] . identifier[_url] , literal[string] : identifier[self] . identifier[_imageDate] , literal[s...
def asDictionary(self): """ returns the object as a dictionary """ template = {'type': 'esriPMS', 'url': self._url, 'imageData': self._imageDate, 'contentType': self._contentType, 'width': self._width, 'height': self._height, 'angle': self._angle, 'xoffset': self._xoffset, 'yoffset': self._yoffset, 'xscale': se...
def get_df(self, data_file): """ 读取历史财务数据文件,并返回pandas结果 , 类似gpcw20171231.zip格式,具体字段含义参考 https://github.com/rainx/pytdx/issues/133 :param data_file: 数据文件地址, 数据文件类型可以为 .zip 文件,也可以为解压后的 .dat :return: pandas DataFrame格式的历史财务数据 """ crawler = QAHistoryFinancialCrawle...
def function[get_df, parameter[self, data_file]]: constant[ 读取历史财务数据文件,并返回pandas结果 , 类似gpcw20171231.zip格式,具体字段含义参考 https://github.com/rainx/pytdx/issues/133 :param data_file: 数据文件地址, 数据文件类型可以为 .zip 文件,也可以为解压后的 .dat :return: pandas DataFrame格式的历史财务数据 ] variable[c...
keyword[def] identifier[get_df] ( identifier[self] , identifier[data_file] ): literal[string] identifier[crawler] = identifier[QAHistoryFinancialCrawler] () keyword[with] identifier[open] ( identifier[data_file] , literal[string] ) keyword[as] identifier[df] : identifier[d...
def get_df(self, data_file): """ 读取历史财务数据文件,并返回pandas结果 , 类似gpcw20171231.zip格式,具体字段含义参考 https://github.com/rainx/pytdx/issues/133 :param data_file: 数据文件地址, 数据文件类型可以为 .zip 文件,也可以为解压后的 .dat :return: pandas DataFrame格式的历史财务数据 """ crawler = QAHistoryFinancialCrawler() w...
def _set_dscp_mutation(self, v, load=False): """ Setter method for dscp_mutation, mapped from YANG variable /qos/map/dscp_mutation (list) If this variable is read-only (config: false) in the source YANG file, then _set_dscp_mutation is considered as a private method. Backends looking to populate thi...
def function[_set_dscp_mutation, parameter[self, v, load]]: constant[ Setter method for dscp_mutation, mapped from YANG variable /qos/map/dscp_mutation (list) If this variable is read-only (config: false) in the source YANG file, then _set_dscp_mutation is considered as a private method. Backend...
keyword[def] identifier[_set_dscp_mutation] ( 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] : ...
def _set_dscp_mutation(self, v, load=False): """ Setter method for dscp_mutation, mapped from YANG variable /qos/map/dscp_mutation (list) If this variable is read-only (config: false) in the source YANG file, then _set_dscp_mutation is considered as a private method. Backends looking to populate thi...
def pull_isotime(voevent, index=0): """ Deprecated alias of :func:`.get_event_time_as_utc` """ import warnings warnings.warn( """ The function `pull_isotime` has been renamed to `get_event_time_as_utc`. This alias is preserved for backwards compatibility, and may be r...
def function[pull_isotime, parameter[voevent, index]]: constant[ Deprecated alias of :func:`.get_event_time_as_utc` ] import module[warnings] call[name[warnings].warn, parameter[constant[ The function `pull_isotime` has been renamed to `get_event_time_as_utc`. This alias is p...
keyword[def] identifier[pull_isotime] ( identifier[voevent] , identifier[index] = literal[int] ): literal[string] keyword[import] identifier[warnings] identifier[warnings] . identifier[warn] ( literal[string] , identifier[FutureWarning] ) keyword[return] identifier[get_event_time_as_...
def pull_isotime(voevent, index=0): """ Deprecated alias of :func:`.get_event_time_as_utc` """ import warnings warnings.warn('\n The function `pull_isotime` has been renamed to\n `get_event_time_as_utc`. This alias is preserved for backwards\n compatibility, and may be removed i...
def prompt(question, choices=None): """echo a prompt to the user and wait for an answer question -- string -- the prompt for the user choices -- list -- if given, only exit when prompt matches one of the choices return -- string -- the answer that was given by the user """ if not re.match("\s$...
def function[prompt, parameter[question, choices]]: constant[echo a prompt to the user and wait for an answer question -- string -- the prompt for the user choices -- list -- if given, only exit when prompt matches one of the choices return -- string -- the answer that was given by the user ] ...
keyword[def] identifier[prompt] ( identifier[question] , identifier[choices] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[re] . identifier[match] ( literal[string] , identifier[question] ): identifier[question] = literal[string] . identifier[format] ( identifier[questi...
def prompt(question, choices=None): """echo a prompt to the user and wait for an answer question -- string -- the prompt for the user choices -- list -- if given, only exit when prompt matches one of the choices return -- string -- the answer that was given by the user """ if not re.match('\\s$...
def xVal_xml(self): """ Return the ``<c:xVal>`` element for this series as unicode text. This element contains the X values for this series. """ return self._xVal_tmpl.format(**{ 'nsdecls': '', 'numRef_xml': self.numRef_xml( self._series...
def function[xVal_xml, parameter[self]]: constant[ Return the ``<c:xVal>`` element for this series as unicode text. This element contains the X values for this series. ] return[call[name[self]._xVal_tmpl.format, parameter[]]]
keyword[def] identifier[xVal_xml] ( identifier[self] ): literal[string] keyword[return] identifier[self] . identifier[_xVal_tmpl] . identifier[format] (**{ literal[string] : literal[string] , literal[string] : identifier[self] . identifier[numRef_xml] ( identifier[self] ...
def xVal_xml(self): """ Return the ``<c:xVal>`` element for this series as unicode text. This element contains the X values for this series. """ return self._xVal_tmpl.format(**{'nsdecls': '', 'numRef_xml': self.numRef_xml(self._series.x_values_ref, self._series.number_format, self._seri...
def _categorize(self, category): """Remove torrents with unwanted category from self.torrents""" self.torrents = [result for result in self.torrents if result.category == category]
def function[_categorize, parameter[self, category]]: constant[Remove torrents with unwanted category from self.torrents] name[self].torrents assign[=] <ast.ListComp object at 0x7da1b1fbadd0>
keyword[def] identifier[_categorize] ( identifier[self] , identifier[category] ): literal[string] identifier[self] . identifier[torrents] =[ identifier[result] keyword[for] identifier[result] keyword[in] identifier[self] . identifier[torrents] keyword[if] identifier[result] . identifier[category] == i...
def _categorize(self, category): """Remove torrents with unwanted category from self.torrents""" self.torrents = [result for result in self.torrents if result.category == category]
def base_string_uri(uri, host=None): """**Base String URI** Per `section 3.4.1.2`_ of RFC 5849. For example, the HTTP request:: GET /r%20v/X?id=123 HTTP/1.1 Host: EXAMPLE.COM:80 is represented by the base string URI: "http://example.com/r%20v/X". In another example, the HTTPS req...
def function[base_string_uri, parameter[uri, host]]: constant[**Base String URI** Per `section 3.4.1.2`_ of RFC 5849. For example, the HTTP request:: GET /r%20v/X?id=123 HTTP/1.1 Host: EXAMPLE.COM:80 is represented by the base string URI: "http://example.com/r%20v/X". In anot...
keyword[def] identifier[base_string_uri] ( identifier[uri] , identifier[host] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[uri] , identifier[unicode_type] ): keyword[raise] identifier[ValueError] ( literal[string] ) identifier[sc...
def base_string_uri(uri, host=None): """**Base String URI** Per `section 3.4.1.2`_ of RFC 5849. For example, the HTTP request:: GET /r%20v/X?id=123 HTTP/1.1 Host: EXAMPLE.COM:80 is represented by the base string URI: "http://example.com/r%20v/X". In another example, the HTTPS req...
def Campbell_Thodos(T, Tb, Tc, Pc, M, dipole=None, hydroxyl=False): r'''Calculate saturation liquid density using the Campbell-Thodos [1]_ CSP method. An old and uncommon estimation method. .. math:: V_s = \frac{RT_c}{P_c}{Z_{RA}}^{[1+(1-T_r)^{2/7}]} Z_{RA} = \alpha + \beta(1-T_r) ...
def function[Campbell_Thodos, parameter[T, Tb, Tc, Pc, M, dipole, hydroxyl]]: constant[Calculate saturation liquid density using the Campbell-Thodos [1]_ CSP method. An old and uncommon estimation method. .. math:: V_s = \frac{RT_c}{P_c}{Z_{RA}}^{[1+(1-T_r)^{2/7}]} Z_{RA} = \alpha...
keyword[def] identifier[Campbell_Thodos] ( identifier[T] , identifier[Tb] , identifier[Tc] , identifier[Pc] , identifier[M] , identifier[dipole] = keyword[None] , identifier[hydroxyl] = keyword[False] ): literal[string] identifier[Tr] = identifier[T] / identifier[Tc] identifier[Tbr] = identifier[Tb] ...
def Campbell_Thodos(T, Tb, Tc, Pc, M, dipole=None, hydroxyl=False): """Calculate saturation liquid density using the Campbell-Thodos [1]_ CSP method. An old and uncommon estimation method. .. math:: V_s = \\frac{RT_c}{P_c}{Z_{RA}}^{[1+(1-T_r)^{2/7}]} Z_{RA} = \\alpha + \\beta(1-T_r) ...
def write_pgpass(self, name=None, site=None, use_sudo=0, root=0): """ Write the file used to store login credentials for PostgreSQL. """ r = self.database_renderer(name=name, site=site) root = int(root) use_sudo = int(use_sudo) r.run('touch {pgpass_path}') ...
def function[write_pgpass, parameter[self, name, site, use_sudo, root]]: constant[ Write the file used to store login credentials for PostgreSQL. ] variable[r] assign[=] call[name[self].database_renderer, parameter[]] variable[root] assign[=] call[name[int], parameter[name[root]]...
keyword[def] identifier[write_pgpass] ( identifier[self] , identifier[name] = keyword[None] , identifier[site] = keyword[None] , identifier[use_sudo] = literal[int] , identifier[root] = literal[int] ): literal[string] identifier[r] = identifier[self] . identifier[database_renderer] ( identifier[na...
def write_pgpass(self, name=None, site=None, use_sudo=0, root=0): """ Write the file used to store login credentials for PostgreSQL. """ r = self.database_renderer(name=name, site=site) root = int(root) use_sudo = int(use_sudo) r.run('touch {pgpass_path}') if '~' in r.env.pgpass_...
def map_coords(func, obj): """ Returns the mapped coordinates from a Geometry after applying the provided function to each dimension in tuples list (ie, linear scaling). :param func: Function to apply to individual coordinate values independently :type func: function :param obj: A geometry ...
def function[map_coords, parameter[func, obj]]: constant[ Returns the mapped coordinates from a Geometry after applying the provided function to each dimension in tuples list (ie, linear scaling). :param func: Function to apply to individual coordinate values independently :type func: funct...
keyword[def] identifier[map_coords] ( identifier[func] , identifier[obj] ): literal[string] keyword[def] identifier[tuple_func] ( identifier[coord] ): keyword[return] ( identifier[func] ( identifier[coord] [ literal[int] ]), identifier[func] ( identifier[coord] [ literal[int] ])) keyword[r...
def map_coords(func, obj): """ Returns the mapped coordinates from a Geometry after applying the provided function to each dimension in tuples list (ie, linear scaling). :param func: Function to apply to individual coordinate values independently :type func: function :param obj: A geometry ...
def _value_from_label(self, label): '''Convert a label into a kvl value. ''' unser_val = (label.rel_strength.value, label.meta) return cbor.dumps(unser_val)
def function[_value_from_label, parameter[self, label]]: constant[Convert a label into a kvl value. ] variable[unser_val] assign[=] tuple[[<ast.Attribute object at 0x7da1b14343d0>, <ast.Attribute object at 0x7da1b14351b0>]] return[call[name[cbor].dumps, parameter[name[unser_val]]]]
keyword[def] identifier[_value_from_label] ( identifier[self] , identifier[label] ): literal[string] identifier[unser_val] =( identifier[label] . identifier[rel_strength] . identifier[value] , identifier[label] . identifier[meta] ) keyword[return] identifier[cbor] . identifier[dumps] ( id...
def _value_from_label(self, label): """Convert a label into a kvl value. """ unser_val = (label.rel_strength.value, label.meta) return cbor.dumps(unser_val)
def get_sub_node(dsp, path, node_attr='auto', solution=NONE, _level=0, _dsp_name=NONE): """ Returns a sub node of a dispatcher. :param dsp: A dispatcher object or a sub dispatch function. :type dsp: schedula.Dispatcher | SubDispatch :param path: A sequence of node...
def function[get_sub_node, parameter[dsp, path, node_attr, solution, _level, _dsp_name]]: constant[ Returns a sub node of a dispatcher. :param dsp: A dispatcher object or a sub dispatch function. :type dsp: schedula.Dispatcher | SubDispatch :param path: A sequence of node ids ...
keyword[def] identifier[get_sub_node] ( identifier[dsp] , identifier[path] , identifier[node_attr] = literal[string] , identifier[solution] = identifier[NONE] , identifier[_level] = literal[int] , identifier[_dsp_name] = identifier[NONE] ): literal[string] identifier[path] = identifier[list] ( identifier...
def get_sub_node(dsp, path, node_attr='auto', solution=NONE, _level=0, _dsp_name=NONE): """ Returns a sub node of a dispatcher. :param dsp: A dispatcher object or a sub dispatch function. :type dsp: schedula.Dispatcher | SubDispatch :param path: A sequence of node ids or a single ...
def create_initializer_configuration(self, body, **kwargs): # noqa: E501 """create_initializer_configuration # noqa: E501 create an InitializerConfiguration # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_r...
def function[create_initializer_configuration, parameter[self, body]]: constant[create_initializer_configuration # noqa: E501 create an InitializerConfiguration # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asyn...
keyword[def] identifier[create_initializer_configuration] ( identifier[self] , identifier[body] ,** identifier[kwargs] ): literal[string] identifier[kwargs] [ literal[string] ]= keyword[True] keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ): keyword[retur...
def create_initializer_configuration(self, body, **kwargs): # noqa: E501 "create_initializer_configuration # noqa: E501\n\n create an InitializerConfiguration # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req...
def create_current_pb(self, ): """Create a push button and place it in the corner of the tabwidget :returns: the created button :rtype: :class:`QtGui.QPushButton` :raises: None """ pb = QtGui.QPushButton("Select current") self.selection_tabw.setCornerWidget(pb) ...
def function[create_current_pb, parameter[self]]: constant[Create a push button and place it in the corner of the tabwidget :returns: the created button :rtype: :class:`QtGui.QPushButton` :raises: None ] variable[pb] assign[=] call[name[QtGui].QPushButton, parameter[cons...
keyword[def] identifier[create_current_pb] ( identifier[self] ,): literal[string] identifier[pb] = identifier[QtGui] . identifier[QPushButton] ( literal[string] ) identifier[self] . identifier[selection_tabw] . identifier[setCornerWidget] ( identifier[pb] ) keyword[return] identi...
def create_current_pb(self): """Create a push button and place it in the corner of the tabwidget :returns: the created button :rtype: :class:`QtGui.QPushButton` :raises: None """ pb = QtGui.QPushButton('Select current') self.selection_tabw.setCornerWidget(pb) return pb
def on_created(self, event): """Function called everytime a new file is created. Args: event: Event to process. """ self._logger.debug('Detected create event on watched path: %s', event.src_path) self._process_event(event)
def function[on_created, parameter[self, event]]: constant[Function called everytime a new file is created. Args: event: Event to process. ] call[name[self]._logger.debug, parameter[constant[Detected create event on watched path: %s], name[event].src_path]] call[name...
keyword[def] identifier[on_created] ( identifier[self] , identifier[event] ): literal[string] identifier[self] . identifier[_logger] . identifier[debug] ( literal[string] , identifier[event] . identifier[src_path] ) identifier[self] . identifier[_process_event] ( identifier[event] )
def on_created(self, event): """Function called everytime a new file is created. Args: event: Event to process. """ self._logger.debug('Detected create event on watched path: %s', event.src_path) self._process_event(event)
def get_paginated_catalogs(self, querystring=None): """ Return a paginated list of course catalogs, including name and ID. Returns: dict: Paginated response containing catalogs available for the user. """ return self._load_data( self.CATALOGS_ENDPOINT, ...
def function[get_paginated_catalogs, parameter[self, querystring]]: constant[ Return a paginated list of course catalogs, including name and ID. Returns: dict: Paginated response containing catalogs available for the user. ] return[call[name[self]._load_data, parameter[...
keyword[def] identifier[get_paginated_catalogs] ( identifier[self] , identifier[querystring] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[_load_data] ( identifier[self] . identifier[CATALOGS_ENDPOINT] , identifier[default] =[], identif...
def get_paginated_catalogs(self, querystring=None): """ Return a paginated list of course catalogs, including name and ID. Returns: dict: Paginated response containing catalogs available for the user. """ return self._load_data(self.CATALOGS_ENDPOINT, default=[], querystrin...
def streamserver_handle(cls, socket, address): '''Translate this class for use in a StreamServer''' request = cls.dummy_request() request._sock = socket server = None cls(request, address, server)
def function[streamserver_handle, parameter[cls, socket, address]]: constant[Translate this class for use in a StreamServer] variable[request] assign[=] call[name[cls].dummy_request, parameter[]] name[request]._sock assign[=] name[socket] variable[server] assign[=] constant[None] ...
keyword[def] identifier[streamserver_handle] ( identifier[cls] , identifier[socket] , identifier[address] ): literal[string] identifier[request] = identifier[cls] . identifier[dummy_request] () identifier[request] . identifier[_sock] = identifier[socket] identifier[server] = keyw...
def streamserver_handle(cls, socket, address): """Translate this class for use in a StreamServer""" request = cls.dummy_request() request._sock = socket server = None cls(request, address, server)
def clr(args): """ %prog blastfile fastafiles Calculate the vector clear range file based BLAST to the vectors. """ p = OptionParser(clr.__doc__) opts, args = p.parse_args(args) if len(args) < 2: sys.exit(not p.print_help()) blastfile = args[0] fastafiles = args[1:] s...
def function[clr, parameter[args]]: constant[ %prog blastfile fastafiles Calculate the vector clear range file based BLAST to the vectors. ] variable[p] assign[=] call[name[OptionParser], parameter[name[clr].__doc__]] <ast.Tuple object at 0x7da18f723730> assign[=] call[name[p].parse...
keyword[def] identifier[clr] ( identifier[args] ): literal[string] identifier[p] = identifier[OptionParser] ( identifier[clr] . identifier[__doc__] ) identifier[opts] , identifier[args] = identifier[p] . identifier[parse_args] ( identifier[args] ) keyword[if] identifier[len] ( identifier[args] ...
def clr(args): """ %prog blastfile fastafiles Calculate the vector clear range file based BLAST to the vectors. """ p = OptionParser(clr.__doc__) (opts, args) = p.parse_args(args) if len(args) < 2: sys.exit(not p.print_help()) # depends on [control=['if'], data=[]] blastfile = ...
def last(self): """Gets item with lowest priority. Performance: O(1)""" with self.lock: try: return self.data[-1][0] except IndexError as ex: ex.args = ('DEPQ is empty',) raise
def function[last, parameter[self]]: constant[Gets item with lowest priority. Performance: O(1)] with name[self].lock begin[:] <ast.Try object at 0x7da207f02d70>
keyword[def] identifier[last] ( identifier[self] ): literal[string] keyword[with] identifier[self] . identifier[lock] : keyword[try] : keyword[return] identifier[self] . identifier[data] [- literal[int] ][ literal[int] ] keyword[except] identifier[Index...
def last(self): """Gets item with lowest priority. Performance: O(1)""" with self.lock: try: return self.data[-1][0] # depends on [control=['try'], data=[]] except IndexError as ex: ex.args = ('DEPQ is empty',) raise # depends on [control=['except'], data=['...
def copyPort(port, targetLNode, reverseDir, topPortName=None): """ Create identical port on targetNode """ newP = _copyPort(port, targetLNode, reverseDir) if topPortName is not None: newP.name = topPortName return newP
def function[copyPort, parameter[port, targetLNode, reverseDir, topPortName]]: constant[ Create identical port on targetNode ] variable[newP] assign[=] call[name[_copyPort], parameter[name[port], name[targetLNode], name[reverseDir]]] if compare[name[topPortName] is_not constant[None]] be...
keyword[def] identifier[copyPort] ( identifier[port] , identifier[targetLNode] , identifier[reverseDir] , identifier[topPortName] = keyword[None] ): literal[string] identifier[newP] = identifier[_copyPort] ( identifier[port] , identifier[targetLNode] , identifier[reverseDir] ) keyword[if] identifier...
def copyPort(port, targetLNode, reverseDir, topPortName=None): """ Create identical port on targetNode """ newP = _copyPort(port, targetLNode, reverseDir) if topPortName is not None: newP.name = topPortName # depends on [control=['if'], data=['topPortName']] return newP
def get_dict_of_all_args(self): """Generates a dictionary from a handler paths query string and returns it :returns: Dictionary of all key/values in arguments list :rtype: dict """ dictionary = {} for arg in [arg for arg in self.request.arguments if arg not in self.setti...
def function[get_dict_of_all_args, parameter[self]]: constant[Generates a dictionary from a handler paths query string and returns it :returns: Dictionary of all key/values in arguments list :rtype: dict ] variable[dictionary] assign[=] dictionary[[], []] for taget[name[...
keyword[def] identifier[get_dict_of_all_args] ( identifier[self] ): literal[string] identifier[dictionary] ={} keyword[for] identifier[arg] keyword[in] [ identifier[arg] keyword[for] identifier[arg] keyword[in] identifier[self] . identifier[request] . identifier[arguments] keyword[i...
def get_dict_of_all_args(self): """Generates a dictionary from a handler paths query string and returns it :returns: Dictionary of all key/values in arguments list :rtype: dict """ dictionary = {} for arg in [arg for arg in self.request.arguments if arg not in self.settings.get('res...
def clear_system_configuration(self): """Clear the BIOS/UEFI configuration """ biosinfo = self._do_web_request(self._biosurl) rb = biosinfo.get('Actions', {}).get('#Bios.ResetBios', {}) rb = rb.get('target', '') if not rb: raise Exception('BIOS reset not dete...
def function[clear_system_configuration, parameter[self]]: constant[Clear the BIOS/UEFI configuration ] variable[biosinfo] assign[=] call[name[self]._do_web_request, parameter[name[self]._biosurl]] variable[rb] assign[=] call[call[name[biosinfo].get, parameter[constant[Actions], diction...
keyword[def] identifier[clear_system_configuration] ( identifier[self] ): literal[string] identifier[biosinfo] = identifier[self] . identifier[_do_web_request] ( identifier[self] . identifier[_biosurl] ) identifier[rb] = identifier[biosinfo] . identifier[get] ( literal[string] ,{}). identi...
def clear_system_configuration(self): """Clear the BIOS/UEFI configuration """ biosinfo = self._do_web_request(self._biosurl) rb = biosinfo.get('Actions', {}).get('#Bios.ResetBios', {}) rb = rb.get('target', '') if not rb: raise Exception('BIOS reset not detected on this system') #...
def pseudo_partial_waves(self): """Dictionary with the pseudo partial waves indexed by state.""" pseudo_partial_waves = OrderedDict() for (mesh, values, attrib) in self._parse_all_radfuncs("pseudo_partial_wave"): state = attrib["state"] #val_state = self.valence_states[st...
def function[pseudo_partial_waves, parameter[self]]: constant[Dictionary with the pseudo partial waves indexed by state.] variable[pseudo_partial_waves] assign[=] call[name[OrderedDict], parameter[]] for taget[tuple[[<ast.Name object at 0x7da18eb54430>, <ast.Name object at 0x7da18eb54a90>, <ast....
keyword[def] identifier[pseudo_partial_waves] ( identifier[self] ): literal[string] identifier[pseudo_partial_waves] = identifier[OrderedDict] () keyword[for] ( identifier[mesh] , identifier[values] , identifier[attrib] ) keyword[in] identifier[self] . identifier[_parse_all_radfuncs] ( li...
def pseudo_partial_waves(self): """Dictionary with the pseudo partial waves indexed by state.""" pseudo_partial_waves = OrderedDict() for (mesh, values, attrib) in self._parse_all_radfuncs('pseudo_partial_wave'): state = attrib['state'] #val_state = self.valence_states[state] pseudo_...
def _get_sof_terms(self, C, rake): """ Returns the style-of-faulting scaling parameters """ if rake >= 45.0 and rake <= 135.0: # Reverse faulting return C["b0R"], C["b1R"] elif rake <= -45. and rake >= -135.0: # Normal faulting retu...
def function[_get_sof_terms, parameter[self, C, rake]]: constant[ Returns the style-of-faulting scaling parameters ] if <ast.BoolOp object at 0x7da18f00d4e0> begin[:] return[tuple[[<ast.Subscript object at 0x7da18f00ee60>, <ast.Subscript object at 0x7da18f00d660>]]]
keyword[def] identifier[_get_sof_terms] ( identifier[self] , identifier[C] , identifier[rake] ): literal[string] keyword[if] identifier[rake] >= literal[int] keyword[and] identifier[rake] <= literal[int] : keyword[return] identifier[C] [ literal[string] ], identifier[C] [ ...
def _get_sof_terms(self, C, rake): """ Returns the style-of-faulting scaling parameters """ if rake >= 45.0 and rake <= 135.0: # Reverse faulting return (C['b0R'], C['b1R']) # depends on [control=['if'], data=[]] elif rake <= -45.0 and rake >= -135.0: # Normal faulti...
def screen_text( self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config): """Detect profanity and match against custom and shared blacklists. Detects profanity in mor...
def function[screen_text, parameter[self, text_content_type, text_content, language, autocorrect, pii, list_id, classify, custom_headers, raw, callback]]: constant[Detect profanity and match against custom and shared blacklists. Detects profanity in more than 100 languages and match against custom ...
keyword[def] identifier[screen_text] ( identifier[self] , identifier[text_content_type] , identifier[text_content] , identifier[language] = keyword[None] , identifier[autocorrect] = keyword[False] , identifier[pii] = keyword[False] , identifier[list_id] = keyword[None] , identifier[classify] = keyword[False] , ident...
def screen_text(self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config): """Detect profanity and match against custom and shared blacklists. Detects profanity in more than 100 langua...
def trigger_event(self, event, *args): """Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are needed...
def function[trigger_event, parameter[self, event]]: constant[Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatch...
keyword[def] identifier[trigger_event] ( identifier[self] , identifier[event] ,* identifier[args] ): literal[string] identifier[handler_name] = literal[string] + identifier[event] keyword[if] identifier[hasattr] ( identifier[self] , identifier[handler_name] ): keyword[return...
def trigger_event(self, event, *args): """Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are needed, or...
def unescape_utf8(msg): ''' convert escaped unicode web entities to unicode ''' def sub(m): text = m.group(0) if text[:3] == "&#x": return unichr(int(text[3:-1], 16)) else: return unichr(int(text[2:-1])) return re.sub("&#?\w+;", sub, urllib.unquote(msg))
def function[unescape_utf8, parameter[msg]]: constant[ convert escaped unicode web entities to unicode ] def function[sub, parameter[m]]: variable[text] assign[=] call[name[m].group, parameter[constant[0]]] if compare[call[name[text]][<ast.Slice object at 0x7da1b2362170>]...
keyword[def] identifier[unescape_utf8] ( identifier[msg] ): literal[string] keyword[def] identifier[sub] ( identifier[m] ): identifier[text] = identifier[m] . identifier[group] ( literal[int] ) keyword[if] identifier[text] [: literal[int] ]== literal[string] : keyword[return] identifie...
def unescape_utf8(msg): """ convert escaped unicode web entities to unicode """ def sub(m): text = m.group(0) if text[:3] == '&#x': return unichr(int(text[3:-1], 16)) # depends on [control=['if'], data=[]] else: return unichr(int(text[2:-1])) return re.sub('...
def _handle_event(self, conv_event): """Handle updating and scrolling when a new event is added. Automatically scroll down to show the new text if the bottom is showing. This allows the user to scroll up to read previous messages while new messages are arriving. """ if n...
def function[_handle_event, parameter[self, conv_event]]: constant[Handle updating and scrolling when a new event is added. Automatically scroll down to show the new text if the bottom is showing. This allows the user to scroll up to read previous messages while new messages are arrivin...
keyword[def] identifier[_handle_event] ( identifier[self] , identifier[conv_event] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_is_scrolling] : identifier[self] . identifier[set_focus] ( identifier[conv_event] . identifier[id_] ) keyword[else] :...
def _handle_event(self, conv_event): """Handle updating and scrolling when a new event is added. Automatically scroll down to show the new text if the bottom is showing. This allows the user to scroll up to read previous messages while new messages are arriving. """ if not self....
def label_correcting_get_cycle(self, j, pred): ''' API: label_correcting_get_cycle(self, labelled, pred) Description: In label correcting check cycle it is decided pred has a cycle and nodes in the cycle are labelled. We will create a list of nodes ...
def function[label_correcting_get_cycle, parameter[self, j, pred]]: constant[ API: label_correcting_get_cycle(self, labelled, pred) Description: In label correcting check cycle it is decided pred has a cycle and nodes in the cycle are labelled. We will create ...
keyword[def] identifier[label_correcting_get_cycle] ( identifier[self] , identifier[j] , identifier[pred] ): literal[string] identifier[cycle] =[] identifier[cycle] . identifier[append] ( identifier[j] ) identifier[current] = identifier[pred] [ identifier[j] ] keyword[whi...
def label_correcting_get_cycle(self, j, pred): """ API: label_correcting_get_cycle(self, labelled, pred) Description: In label correcting check cycle it is decided pred has a cycle and nodes in the cycle are labelled. We will create a list of nodes in ...
def wiki_pages(self, extra_params=None): """ All Wiki Pages with access to this Space """ return self.api._get_json( WikiPage, space=self, rel_path=self._build_rel_path('wiki_pages'), extra_params=extra_params, )
def function[wiki_pages, parameter[self, extra_params]]: constant[ All Wiki Pages with access to this Space ] return[call[name[self].api._get_json, parameter[name[WikiPage]]]]
keyword[def] identifier[wiki_pages] ( identifier[self] , identifier[extra_params] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[api] . identifier[_get_json] ( identifier[WikiPage] , identifier[space] = identifier[self] , identifier[rel_...
def wiki_pages(self, extra_params=None): """ All Wiki Pages with access to this Space """ return self.api._get_json(WikiPage, space=self, rel_path=self._build_rel_path('wiki_pages'), extra_params=extra_params)
def osu_run1(data_set='osu_run1', sample_every=4): """Ohio State University's Run1 motion capture data set.""" path = os.path.join(data_path, data_set) if not data_available(data_set): import zipfile download_data(data_set) zip = zipfile.ZipFile(os.path.join(data_path, data_set, 'run...
def function[osu_run1, parameter[data_set, sample_every]]: constant[Ohio State University's Run1 motion capture data set.] variable[path] assign[=] call[name[os].path.join, parameter[name[data_path], name[data_set]]] if <ast.UnaryOp object at 0x7da1b0fb1090> begin[:] import module[zipfil...
keyword[def] identifier[osu_run1] ( identifier[data_set] = literal[string] , identifier[sample_every] = literal[int] ): literal[string] identifier[path] = identifier[os] . identifier[path] . identifier[join] ( identifier[data_path] , identifier[data_set] ) keyword[if] keyword[not] identifier[data_av...
def osu_run1(data_set='osu_run1', sample_every=4): """Ohio State University's Run1 motion capture data set.""" path = os.path.join(data_path, data_set) if not data_available(data_set): import zipfile download_data(data_set) zip = zipfile.ZipFile(os.path.join(data_path, data_set, 'run...
def p(name="", **kwargs): ''' really quick and dirty profiling you start a profile by passing in name, you stop the top profiling by not passing in a name. You can also call this method using a with statement This is for when you just want to get a really back of envelope view of how your fast...
def function[p, parameter[name]]: constant[ really quick and dirty profiling you start a profile by passing in name, you stop the top profiling by not passing in a name. You can also call this method using a with statement This is for when you just want to get a really back of envelope view of...
keyword[def] identifier[p] ( identifier[name] = literal[string] ,** identifier[kwargs] ): literal[string] keyword[with] identifier[Reflect] . identifier[context] (** identifier[kwargs] ) keyword[as] identifier[r] : keyword[if] identifier[name] : identifier[instance] = identifier[P_...
def p(name='', **kwargs): """ really quick and dirty profiling you start a profile by passing in name, you stop the top profiling by not passing in a name. You can also call this method using a with statement This is for when you just want to get a really back of envelope view of how your fast...
def from_timestamp( timestamp, tz=UTC # type: Union[int, float] # type: Union[str, _Timezone] ): # type: (...) -> DateTime """ Create a DateTime instance from a timestamp. """ dt = _datetime.datetime.utcfromtimestamp(timestamp) dt = datetime( dt.year, dt.month, dt.day, dt.hour, dt.mi...
def function[from_timestamp, parameter[timestamp, tz]]: constant[ Create a DateTime instance from a timestamp. ] variable[dt] assign[=] call[name[_datetime].datetime.utcfromtimestamp, parameter[name[timestamp]]] variable[dt] assign[=] call[name[datetime], parameter[name[dt].year, name[dt...
keyword[def] identifier[from_timestamp] ( identifier[timestamp] , identifier[tz] = identifier[UTC] ): literal[string] identifier[dt] = identifier[_datetime] . identifier[datetime] . identifier[utcfromtimestamp] ( identifier[timestamp] ) identifier[dt] = identifier[datetime] ( identifier[dt] . ...
def from_timestamp(timestamp, tz=UTC): # type: Union[int, float] # type: Union[str, _Timezone] # type: (...) -> DateTime '\n Create a DateTime instance from a timestamp.\n ' dt = _datetime.datetime.utcfromtimestamp(timestamp) dt = datetime(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second...
def complete_contexts(self): ''' Returns a list of context interfaces that yield a complete context. ''' interfaces = [] [interfaces.extend(i.complete_contexts()) for i in six.itervalues(self.templates)] return interfaces
def function[complete_contexts, parameter[self]]: constant[ Returns a list of context interfaces that yield a complete context. ] variable[interfaces] assign[=] list[[]] <ast.ListComp object at 0x7da18bc70f10> return[name[interfaces]]
keyword[def] identifier[complete_contexts] ( identifier[self] ): literal[string] identifier[interfaces] =[] [ identifier[interfaces] . identifier[extend] ( identifier[i] . identifier[complete_contexts] ()) keyword[for] identifier[i] keyword[in] identifier[six] . identifier[iterv...
def complete_contexts(self): """ Returns a list of context interfaces that yield a complete context. """ interfaces = [] [interfaces.extend(i.complete_contexts()) for i in six.itervalues(self.templates)] return interfaces
def third_property(CASRN=None, T=False, P=False, V=False): r'''Function for calculating a critical property of a substance from its other two critical properties, but retrieving the actual other critical values for convenient calculation. Calls functions Ihmels, Meissner, and Grigoras, each of which...
def function[third_property, parameter[CASRN, T, P, V]]: constant[Function for calculating a critical property of a substance from its other two critical properties, but retrieving the actual other critical values for convenient calculation. Calls functions Ihmels, Meissner, and Grigoras, each o...
keyword[def] identifier[third_property] ( identifier[CASRN] = keyword[None] , identifier[T] = keyword[False] , identifier[P] = keyword[False] , identifier[V] = keyword[False] ): literal[string] identifier[Third] = keyword[None] keyword[if] identifier[V] : identifier[Tc_methods] = identifier...
def third_property(CASRN=None, T=False, P=False, V=False): """Function for calculating a critical property of a substance from its other two critical properties, but retrieving the actual other critical values for convenient calculation. Calls functions Ihmels, Meissner, and Grigoras, each of which ...
def restore_descriptor(self, table_name, columns, constraints, autoincrement_column=None): """Restore descriptor from SQL """ # Fields fields = [] for column in columns: if column.name == autoincrement_column: continue field_type = self.re...
def function[restore_descriptor, parameter[self, table_name, columns, constraints, autoincrement_column]]: constant[Restore descriptor from SQL ] variable[fields] assign[=] list[[]] for taget[name[column]] in starred[name[columns]] begin[:] if compare[name[column].name eq...
keyword[def] identifier[restore_descriptor] ( identifier[self] , identifier[table_name] , identifier[columns] , identifier[constraints] , identifier[autoincrement_column] = keyword[None] ): literal[string] identifier[fields] =[] keyword[for] identifier[column] keyword[in] iden...
def restore_descriptor(self, table_name, columns, constraints, autoincrement_column=None): """Restore descriptor from SQL """ # Fields fields = [] for column in columns: if column.name == autoincrement_column: continue # depends on [control=['if'], data=[]] field_typ...
def _read_mac_addr(self): """Read MAC address.""" _byte = self._read_fileng(6) _addr = '-'.join(textwrap.wrap(_byte.hex(), 2)) return _addr
def function[_read_mac_addr, parameter[self]]: constant[Read MAC address.] variable[_byte] assign[=] call[name[self]._read_fileng, parameter[constant[6]]] variable[_addr] assign[=] call[constant[-].join, parameter[call[name[textwrap].wrap, parameter[call[name[_byte].hex, parameter[]], constant[2...
keyword[def] identifier[_read_mac_addr] ( identifier[self] ): literal[string] identifier[_byte] = identifier[self] . identifier[_read_fileng] ( literal[int] ) identifier[_addr] = literal[string] . identifier[join] ( identifier[textwrap] . identifier[wrap] ( identifier[_byte] . identifier[h...
def _read_mac_addr(self): """Read MAC address.""" _byte = self._read_fileng(6) _addr = '-'.join(textwrap.wrap(_byte.hex(), 2)) return _addr
def _spot_check_that_elements_produced_by_this_generator_have_attribute(self, name): """ Helper function to spot-check that the items produces by this generator have the attribute `name`. """ g_tmp = self.values_gen.spawn() sample_element = next(g_tmp)[0] try: ...
def function[_spot_check_that_elements_produced_by_this_generator_have_attribute, parameter[self, name]]: constant[ Helper function to spot-check that the items produces by this generator have the attribute `name`. ] variable[g_tmp] assign[=] call[name[self].values_gen.spawn, parameter[]...
keyword[def] identifier[_spot_check_that_elements_produced_by_this_generator_have_attribute] ( identifier[self] , identifier[name] ): literal[string] identifier[g_tmp] = identifier[self] . identifier[values_gen] . identifier[spawn] () identifier[sample_element] = identifier[next] ( identif...
def _spot_check_that_elements_produced_by_this_generator_have_attribute(self, name): """ Helper function to spot-check that the items produces by this generator have the attribute `name`. """ g_tmp = self.values_gen.spawn() sample_element = next(g_tmp)[0] try: getattr(sample_elem...
def attendee_data(request, form, user_id=None): ''' Lists attendees for a given product/category selection along with profile data.''' status_display = { commerce.Cart.STATUS_ACTIVE: "Unpaid", commerce.Cart.STATUS_PAID: "Paid", commerce.Cart.STATUS_RELEASED: "Refunded", } o...
def function[attendee_data, parameter[request, form, user_id]]: constant[ Lists attendees for a given product/category selection along with profile data.] variable[status_display] assign[=] dictionary[[<ast.Attribute object at 0x7da1b26afb20>, <ast.Attribute object at 0x7da1b26afbb0>, <ast.Attribute...
keyword[def] identifier[attendee_data] ( identifier[request] , identifier[form] , identifier[user_id] = keyword[None] ): literal[string] identifier[status_display] ={ identifier[commerce] . identifier[Cart] . identifier[STATUS_ACTIVE] : literal[string] , identifier[commerce] . identifier[Cart] ....
def attendee_data(request, form, user_id=None): """ Lists attendees for a given product/category selection along with profile data.""" status_display = {commerce.Cart.STATUS_ACTIVE: 'Unpaid', commerce.Cart.STATUS_PAID: 'Paid', commerce.Cart.STATUS_RELEASED: 'Refunded'} output = [] by_category = form...
def replace_widgets(self, widgets, team_context, dashboard_id, eTag=None): """ReplaceWidgets. [Preview API] Replace the widgets on specified dashboard with the supplied widgets. :param [Widget] widgets: Revised state of widgets to store for the dashboard. :param :class:`<TeamContext> <az...
def function[replace_widgets, parameter[self, widgets, team_context, dashboard_id, eTag]]: constant[ReplaceWidgets. [Preview API] Replace the widgets on specified dashboard with the supplied widgets. :param [Widget] widgets: Revised state of widgets to store for the dashboard. :param :cl...
keyword[def] identifier[replace_widgets] ( identifier[self] , identifier[widgets] , identifier[team_context] , identifier[dashboard_id] , identifier[eTag] = keyword[None] ): literal[string] identifier[project] = keyword[None] identifier[team] = keyword[None] keyword[if] identif...
def replace_widgets(self, widgets, team_context, dashboard_id, eTag=None): """ReplaceWidgets. [Preview API] Replace the widgets on specified dashboard with the supplied widgets. :param [Widget] widgets: Revised state of widgets to store for the dashboard. :param :class:`<TeamContext> <azure....
def _get_related_fields(self, model): "Returns the names of all related fields for model class." reverse_fk = self._get_all_related_objects(model) reverse_m2m = self._get_all_related_many_to_many_objects(model) fields = tuple(reverse_fk + reverse_m2m) names = tuple([x.get_access...
def function[_get_related_fields, parameter[self, model]]: constant[Returns the names of all related fields for model class.] variable[reverse_fk] assign[=] call[name[self]._get_all_related_objects, parameter[name[model]]] variable[reverse_m2m] assign[=] call[name[self]._get_all_related_many_to_...
keyword[def] identifier[_get_related_fields] ( identifier[self] , identifier[model] ): literal[string] identifier[reverse_fk] = identifier[self] . identifier[_get_all_related_objects] ( identifier[model] ) identifier[reverse_m2m] = identifier[self] . identifier[_get_all_related_many_to_man...
def _get_related_fields(self, model): """Returns the names of all related fields for model class.""" reverse_fk = self._get_all_related_objects(model) reverse_m2m = self._get_all_related_many_to_many_objects(model) fields = tuple(reverse_fk + reverse_m2m) names = tuple([x.get_accessor_name() for x i...
def remove_highdepth_regions(in_file, items): """Remove high depth regions from a BED file for analyzing a set of calls. Tries to avoid spurious errors and slow run times in collapsed repeat regions. Also adds ENCODE blacklist regions which capture additional collapsed repeats around centromeres. ...
def function[remove_highdepth_regions, parameter[in_file, items]]: constant[Remove high depth regions from a BED file for analyzing a set of calls. Tries to avoid spurious errors and slow run times in collapsed repeat regions. Also adds ENCODE blacklist regions which capture additional collapsed repea...
keyword[def] identifier[remove_highdepth_regions] ( identifier[in_file] , identifier[items] ): literal[string] identifier[encode_bed] = identifier[tz] . identifier[get_in] ([ literal[string] , literal[string] , literal[string] ], identifier[items] [ literal[int] ]) keyword[if] identifier[encode_bed] ...
def remove_highdepth_regions(in_file, items): """Remove high depth regions from a BED file for analyzing a set of calls. Tries to avoid spurious errors and slow run times in collapsed repeat regions. Also adds ENCODE blacklist regions which capture additional collapsed repeats around centromeres. ...
def grab_key(conn, wid, modifiers, key): """ Grabs a key for a particular window and a modifiers/key value. If the grab was successful, return True. Otherwise, return False. If your client is grabbing keys, it is useful to notify the user if a key wasn't grabbed. Keyboard shortcuts not responding is...
def function[grab_key, parameter[conn, wid, modifiers, key]]: constant[ Grabs a key for a particular window and a modifiers/key value. If the grab was successful, return True. Otherwise, return False. If your client is grabbing keys, it is useful to notify the user if a key wasn't grabbed. Keybo...
keyword[def] identifier[grab_key] ( identifier[conn] , identifier[wid] , identifier[modifiers] , identifier[key] ): literal[string] keyword[try] : keyword[for] identifier[mod] keyword[in] identifier[TRIVIAL_MODS] : identifier[conn] . identifier[core] . identifier[GrabKeyChecked] ( ...
def grab_key(conn, wid, modifiers, key): """ Grabs a key for a particular window and a modifiers/key value. If the grab was successful, return True. Otherwise, return False. If your client is grabbing keys, it is useful to notify the user if a key wasn't grabbed. Keyboard shortcuts not responding is...
def supported_languages(self, task=None): """Languages that are covered by a specific task. Args: task (string): Task name. """ if task: collection = self.get_collection(task=task) return [isoLangs[x.id.split('.')[1]]["name"] for x in collectio...
def function[supported_languages, parameter[self, task]]: constant[Languages that are covered by a specific task. Args: task (string): Task name. ] if name[task] begin[:] variable[collection] assign[=] call[name[self].get_collection, parameter[]] return[<ast.ListCo...
keyword[def] identifier[supported_languages] ( identifier[self] , identifier[task] = keyword[None] ): literal[string] keyword[if] identifier[task] : identifier[collection] = identifier[self] . identifier[get_collection] ( identifier[task] = identifier[task] ) keyword[return] [ identifier[iso...
def supported_languages(self, task=None): """Languages that are covered by a specific task. Args: task (string): Task name. """ if task: collection = self.get_collection(task=task) return [isoLangs[x.id.split('.')[1]]['name'] for x in collection.packages] # depends on [control=['...
def sql_solid(name, select_statement, materialization_strategy, table_name=None, inputs=None): '''Return a new solid that executes and materializes a SQL select statement. Args: name (str): The name of the new solid. select_statement (str): The select statement to execute. materializati...
def function[sql_solid, parameter[name, select_statement, materialization_strategy, table_name, inputs]]: constant[Return a new solid that executes and materializes a SQL select statement. Args: name (str): The name of the new solid. select_statement (str): The select statement to execute. ...
keyword[def] identifier[sql_solid] ( identifier[name] , identifier[select_statement] , identifier[materialization_strategy] , identifier[table_name] = keyword[None] , identifier[inputs] = keyword[None] ): literal[string] identifier[inputs] = identifier[check] . identifier[opt_list_param] ( identifier[input...
def sql_solid(name, select_statement, materialization_strategy, table_name=None, inputs=None): """Return a new solid that executes and materializes a SQL select statement. Args: name (str): The name of the new solid. select_statement (str): The select statement to execute. materializati...
def elasticsearch(delete, index_name): """Setup Elasticsearch namespace indexes This will by default only create the indexes and run the namespace index mapping if the indexes don't exist. The --delete option will force removal of the index if it exists. The index_name should be aliased to the in...
def function[elasticsearch, parameter[delete, index_name]]: constant[Setup Elasticsearch namespace indexes This will by default only create the indexes and run the namespace index mapping if the indexes don't exist. The --delete option will force removal of the index if it exists. The index_n...
keyword[def] identifier[elasticsearch] ( identifier[delete] , identifier[index_name] ): literal[string] keyword[if] identifier[delete] : identifier[bel] . identifier[db] . identifier[elasticsearch] . identifier[get_client] ( identifier[delete] = keyword[True] ) keyword[else] : iden...
def elasticsearch(delete, index_name): """Setup Elasticsearch namespace indexes This will by default only create the indexes and run the namespace index mapping if the indexes don't exist. The --delete option will force removal of the index if it exists. The index_name should be aliased to the in...
def rank_reference_paragraphs(wiki_title, references_content, normalize=True): """Rank and return reference paragraphs by tf-idf score on title tokens.""" normalized_title = _normalize_text(wiki_title) title_tokens = _tokens_to_score( set(tokenizer.encode(text_encoder.native_to_unicode(normalized_title)))) ...
def function[rank_reference_paragraphs, parameter[wiki_title, references_content, normalize]]: constant[Rank and return reference paragraphs by tf-idf score on title tokens.] variable[normalized_title] assign[=] call[name[_normalize_text], parameter[name[wiki_title]]] variable[title_tokens] assi...
keyword[def] identifier[rank_reference_paragraphs] ( identifier[wiki_title] , identifier[references_content] , identifier[normalize] = keyword[True] ): literal[string] identifier[normalized_title] = identifier[_normalize_text] ( identifier[wiki_title] ) identifier[title_tokens] = identifier[_tokens_to_score...
def rank_reference_paragraphs(wiki_title, references_content, normalize=True): """Rank and return reference paragraphs by tf-idf score on title tokens.""" normalized_title = _normalize_text(wiki_title) title_tokens = _tokens_to_score(set(tokenizer.encode(text_encoder.native_to_unicode(normalized_title)))) ...
def filter(self, value=None, model=None, context=None): """ Sequentially applies all the filters to provided value :param value: a value to filter :param model: parent entity :param context: filtering context, usually parent entity :return: filtered value """ ...
def function[filter, parameter[self, value, model, context]]: constant[ Sequentially applies all the filters to provided value :param value: a value to filter :param model: parent entity :param context: filtering context, usually parent entity :return: filtered value ...
keyword[def] identifier[filter] ( identifier[self] , identifier[value] = keyword[None] , identifier[model] = keyword[None] , identifier[context] = keyword[None] ): literal[string] keyword[if] identifier[value] keyword[is] keyword[None] : keyword[return] identifier[value] ...
def filter(self, value=None, model=None, context=None): """ Sequentially applies all the filters to provided value :param value: a value to filter :param model: parent entity :param context: filtering context, usually parent entity :return: filtered value """ if ...
def decode(self, hashid): """Restore a tuple of numbers from the passed `hashid`. :param hashid The hashid to decode >>> hashids = Hashids('arbitrary salt', 16, 'abcdefghijkl0123456') >>> hashids.decode('1d6216i30h53elk3') (1, 23, 456) """ if not hashid or not _...
def function[decode, parameter[self, hashid]]: constant[Restore a tuple of numbers from the passed `hashid`. :param hashid The hashid to decode >>> hashids = Hashids('arbitrary salt', 16, 'abcdefghijkl0123456') >>> hashids.decode('1d6216i30h53elk3') (1, 23, 456) ] ...
keyword[def] identifier[decode] ( identifier[self] , identifier[hashid] ): literal[string] keyword[if] keyword[not] identifier[hashid] keyword[or] keyword[not] identifier[_is_str] ( identifier[hashid] ): keyword[return] () keyword[try] : identifier[numbers] =...
def decode(self, hashid): """Restore a tuple of numbers from the passed `hashid`. :param hashid The hashid to decode >>> hashids = Hashids('arbitrary salt', 16, 'abcdefghijkl0123456') >>> hashids.decode('1d6216i30h53elk3') (1, 23, 456) """ if not hashid or not _is_str(h...
def getJsonFromApi(view, request): """Return json from querying Web Api Args: view: django view function. request: http request object got from django. Returns: json format dictionary """ jsonText = view(request) jsonText = json.loads(jsonText.content.decode('utf-8')) return jsonText
def function[getJsonFromApi, parameter[view, request]]: constant[Return json from querying Web Api Args: view: django view function. request: http request object got from django. Returns: json format dictionary ] variable[jsonText] assign[=] call[name[view], parameter[name[request]]] ...
keyword[def] identifier[getJsonFromApi] ( identifier[view] , identifier[request] ): literal[string] identifier[jsonText] = identifier[view] ( identifier[request] ) identifier[jsonText] = identifier[json] . identifier[loads] ( identifier[jsonText] . identifier[content] . identifier[decode] ( literal[string] )) ...
def getJsonFromApi(view, request): """Return json from querying Web Api Args: view: django view function. request: http request object got from django. Returns: json format dictionary """ jsonText = view(request) jsonText = json.loads(jsonText.content.decode('utf-8')) return jsonText
def list_all_available(self, id_vlan): """ List all environment vips availables :return: Following dictionary: :: {'environment_vip': [{'id': <id>, 'finalidade_txt': <finalidade_txt>, 'cliente_txt': <cliente_txt>, 'ambiente_p44_txt': <am...
def function[list_all_available, parameter[self, id_vlan]]: constant[ List all environment vips availables :return: Following dictionary: :: {'environment_vip': [{'id': <id>, 'finalidade_txt': <finalidade_txt>, 'cliente_txt': <cliente_txt>, ...
keyword[def] identifier[list_all_available] ( identifier[self] , identifier[id_vlan] ): literal[string] identifier[url] = literal[string] + identifier[str] ( identifier[id_vlan] ) identifier[code] , identifier[xml] = identifier[self] . identifier[submit] ( keyword[None] , literal[string]...
def list_all_available(self, id_vlan): """ List all environment vips availables :return: Following dictionary: :: {'environment_vip': [{'id': <id>, 'finalidade_txt': <finalidade_txt>, 'cliente_txt': <cliente_txt>, 'ambiente_p44_txt': <ambien...
def find_closed_date_by_commit(self, issue): """ Fill "actual_date" parameter of specified issue by closed date of the commit, if it was closed by commit. :param dict issue: issue to edit """ if not issue.get('events'): return # if it's PR -> then fi...
def function[find_closed_date_by_commit, parameter[self, issue]]: constant[ Fill "actual_date" parameter of specified issue by closed date of the commit, if it was closed by commit. :param dict issue: issue to edit ] if <ast.UnaryOp object at 0x7da18f00f5b0> begin[:] ...
keyword[def] identifier[find_closed_date_by_commit] ( identifier[self] , identifier[issue] ): literal[string] keyword[if] keyword[not] identifier[issue] . identifier[get] ( literal[string] ): keyword[return] identifier[compare_string] = literal[st...
def find_closed_date_by_commit(self, issue): """ Fill "actual_date" parameter of specified issue by closed date of the commit, if it was closed by commit. :param dict issue: issue to edit """ if not issue.get('events'): return # depends on [control=['if'], data=[]] ...
def deflections_from_grid(self, grid): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. For coordinates (0.0, 0.0) the analytic calculation of the deflection angle gives a NaN. Therefore, \ coordinates at (0.0, 0.0) are shifted slightly to (1.0e-8, 1...
def function[deflections_from_grid, parameter[self, grid]]: constant[ Calculate the deflection angles at a given set of arc-second gridded coordinates. For coordinates (0.0, 0.0) the analytic calculation of the deflection angle gives a NaN. Therefore, coordinates at (0.0, 0.0) are shift...
keyword[def] identifier[deflections_from_grid] ( identifier[self] , identifier[grid] ): literal[string] identifier[factor] = literal[int] * identifier[self] . identifier[einstein_radius_rescaled] * identifier[self] . identifier[axis_ratio] / identifier[np] . identifier[sqrt] ( literal[int] - identi...
def deflections_from_grid(self, grid): """ Calculate the deflection angles at a given set of arc-second gridded coordinates. For coordinates (0.0, 0.0) the analytic calculation of the deflection angle gives a NaN. Therefore, coordinates at (0.0, 0.0) are shifted slightly to (1.0e-8, 1.0e-8)...
def get_or_default(func=None, default=None): """ Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable it will be called wh...
def function[get_or_default, parameter[func, default]]: constant[ Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable...
keyword[def] identifier[get_or_default] ( identifier[func] = keyword[None] , identifier[default] = keyword[None] ): literal[string] keyword[def] identifier[decorator] ( identifier[func] ): @ identifier[wraps] ( identifier[func] ) keyword[def] identifier[wrapper] (* identifier[args] ,** i...
def get_or_default(func=None, default=None): """ Wrapper around Django's ORM `get` functionality. Wrap anything that raises ObjectDoesNotExist exception and provide the default value if necessary. `default` by default is None. `default` can be any callable, if it is callable it will be called wh...
async def logs( self, service_id: str, *, details: bool = False, follow: bool = False, stdout: bool = False, stderr: bool = False, since: int = 0, timestamps: bool = False, is_tty: bool = False, tail: str = "all" ) -> Union[str,...
<ast.AsyncFunctionDef object at 0x7da1b08b3250>
keyword[async] keyword[def] identifier[logs] ( identifier[self] , identifier[service_id] : identifier[str] , *, identifier[details] : identifier[bool] = keyword[False] , identifier[follow] : identifier[bool] = keyword[False] , identifier[stdout] : identifier[bool] = keyword[False] , identifier[stderr] : identi...
async def logs(self, service_id: str, *, details: bool=False, follow: bool=False, stdout: bool=False, stderr: bool=False, since: int=0, timestamps: bool=False, is_tty: bool=False, tail: str='all') -> Union[str, AsyncIterator[str]]: """ Retrieve logs of the given service Args: details: s...
def load_by_name(name): """ Load a spec from either a file path or a fully qualified name. """ if os.path.exists(name): load_from_path(name) else: __import__(name)
def function[load_by_name, parameter[name]]: constant[ Load a spec from either a file path or a fully qualified name. ] if call[name[os].path.exists, parameter[name[name]]] begin[:] call[name[load_from_path], parameter[name[name]]]
keyword[def] identifier[load_by_name] ( identifier[name] ): literal[string] keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[name] ): identifier[load_from_path] ( identifier[name] ) keyword[else] : identifier[__import__] ( identifier[name] )
def load_by_name(name): """ Load a spec from either a file path or a fully qualified name. """ if os.path.exists(name): load_from_path(name) # depends on [control=['if'], data=[]] else: __import__(name)
def _send(self, **req_kwargs): """Send an authenticated request to a Google API. Args: **req_kwargs: Arbitrary keyword arguments to pass to Requests. Return: requests.Response: The raw response. Raises: LoginException: If :py:meth:`login` has not be...
def function[_send, parameter[self]]: constant[Send an authenticated request to a Google API. Args: **req_kwargs: Arbitrary keyword arguments to pass to Requests. Return: requests.Response: The raw response. Raises: LoginException: If :py:meth:`logi...
keyword[def] identifier[_send] ( identifier[self] ,** identifier[req_kwargs] ): literal[string] identifier[auth_token] = identifier[self] . identifier[_auth] . identifier[getAuthToken] () keyword[if] identifier[auth_token] keyword[is] keyword[None] : keyword[raise] identif...
def _send(self, **req_kwargs): """Send an authenticated request to a Google API. Args: **req_kwargs: Arbitrary keyword arguments to pass to Requests. Return: requests.Response: The raw response. Raises: LoginException: If :py:meth:`login` has not been c...
def truncateGraph(graph, root_nodes): """Create a set of all nodes containg the root_nodes and all nodes reacheable from them """ subgraph = Graph() for node in root_nodes: subgraph = GraphUtils.joinGraphs(subgraph, GraphUtils.getReacheableSubgraph(graph, node)) return subgraph
def function[truncateGraph, parameter[graph, root_nodes]]: constant[Create a set of all nodes containg the root_nodes and all nodes reacheable from them ] variable[subgraph] assign[=] call[name[Graph], parameter[]] for taget[name[node]] in starred[name[root_nodes]] begin[:] ...
keyword[def] identifier[truncateGraph] ( identifier[graph] , identifier[root_nodes] ): literal[string] identifier[subgraph] = identifier[Graph] () keyword[for] identifier[node] keyword[in] identifier[root_nodes] : identifier[subgraph] = identifier[GraphUtils] . identifier[joinGraphs] ( identifier[sub...
def truncateGraph(graph, root_nodes): """Create a set of all nodes containg the root_nodes and all nodes reacheable from them """ subgraph = Graph() for node in root_nodes: subgraph = GraphUtils.joinGraphs(subgraph, GraphUtils.getReacheableSubgraph(graph, node)) # depends on [control=['for']...
def version(self): """ Return kernel and btrfs version. """ return dict( buttersink=theVersion, btrfs=self.butterStore.butter.btrfsVersion, linux=platform.platform(), )
def function[version, parameter[self]]: constant[ Return kernel and btrfs version. ] return[call[name[dict], parameter[]]]
keyword[def] identifier[version] ( identifier[self] ): literal[string] keyword[return] identifier[dict] ( identifier[buttersink] = identifier[theVersion] , identifier[btrfs] = identifier[self] . identifier[butterStore] . identifier[butter] . identifier[btrfsVersion] , id...
def version(self): """ Return kernel and btrfs version. """ return dict(buttersink=theVersion, btrfs=self.butterStore.butter.btrfsVersion, linux=platform.platform())
def get_next_valid_time_from_t(self, timestamp): """Get next valid time for time range :param timestamp: time we compute from :type timestamp: int :return: timestamp of the next valid time (LOCAL TIME) :rtype: int | None """ if self.is_time_valid(timestamp): ...
def function[get_next_valid_time_from_t, parameter[self, timestamp]]: constant[Get next valid time for time range :param timestamp: time we compute from :type timestamp: int :return: timestamp of the next valid time (LOCAL TIME) :rtype: int | None ] if call[name[...
keyword[def] identifier[get_next_valid_time_from_t] ( identifier[self] , identifier[timestamp] ): literal[string] keyword[if] identifier[self] . identifier[is_time_valid] ( identifier[timestamp] ): keyword[return] identifier[timestamp] identifier[t_day] = iden...
def get_next_valid_time_from_t(self, timestamp): """Get next valid time for time range :param timestamp: time we compute from :type timestamp: int :return: timestamp of the next valid time (LOCAL TIME) :rtype: int | None """ if self.is_time_valid(timestamp): retu...
def __float_window(window_spec): '''Decorator function for windows with fractional input. This function guarantees that for fractional `x`, the following hold: 1. `__float_window(window_function)(x)` has length `np.ceil(x)` 2. all values from `np.floor(x)` are set to 0. For integer-valued `x`, th...
def function[__float_window, parameter[window_spec]]: constant[Decorator function for windows with fractional input. This function guarantees that for fractional `x`, the following hold: 1. `__float_window(window_function)(x)` has length `np.ceil(x)` 2. all values from `np.floor(x)` are set to 0. ...
keyword[def] identifier[__float_window] ( identifier[window_spec] ): literal[string] keyword[def] identifier[_wrap] ( identifier[n] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[n_min] , identifier[n_max] = identifier[int] ( identifier[np] . identifier[floor]...
def __float_window(window_spec): """Decorator function for windows with fractional input. This function guarantees that for fractional `x`, the following hold: 1. `__float_window(window_function)(x)` has length `np.ceil(x)` 2. all values from `np.floor(x)` are set to 0. For integer-valued `x`, th...
def riak_http_search_query(self, solr_core, solr_params, count_deleted=False): """ This method is for advanced SOLR queries. Riak HTTP search query endpoint, sends solr_params and query string as a proxy and returns solr reponse. Args: solr_core (str): solr core on w...
def function[riak_http_search_query, parameter[self, solr_core, solr_params, count_deleted]]: constant[ This method is for advanced SOLR queries. Riak HTTP search query endpoint, sends solr_params and query string as a proxy and returns solr reponse. Args: solr_core ...
keyword[def] identifier[riak_http_search_query] ( identifier[self] , identifier[solr_core] , identifier[solr_params] , identifier[count_deleted] = keyword[False] ): literal[string] identifier[sq] =[ literal[string] %( identifier[q] [ literal[int] ], identifier[q] [ literal[int] ]) keyword...
def riak_http_search_query(self, solr_core, solr_params, count_deleted=False): """ This method is for advanced SOLR queries. Riak HTTP search query endpoint, sends solr_params and query string as a proxy and returns solr reponse. Args: solr_core (str): solr core on which...
def nonpresent_module_filename(): """Return module name that doesn't already exist""" while True: module_name = get_random_name() loader = pkgutil.find_loader(module_name) if loader is not None: continue importlib.invalidate_caches() return "{}.py".format(modu...
def function[nonpresent_module_filename, parameter[]]: constant[Return module name that doesn't already exist] while constant[True] begin[:] variable[module_name] assign[=] call[name[get_random_name], parameter[]] variable[loader] assign[=] call[name[pkgutil].find_loader,...
keyword[def] identifier[nonpresent_module_filename] (): literal[string] keyword[while] keyword[True] : identifier[module_name] = identifier[get_random_name] () identifier[loader] = identifier[pkgutil] . identifier[find_loader] ( identifier[module_name] ) keyword[if] identifier[...
def nonpresent_module_filename(): """Return module name that doesn't already exist""" while True: module_name = get_random_name() loader = pkgutil.find_loader(module_name) if loader is not None: continue # depends on [control=['if'], data=[]] importlib.invalidate_cac...
def _validate_cert_path(name): ''' Ensure that the certificate path, as determind from user input, is valid. ''' cmd = r"Test-Path -Path '{0}'".format(name) if not ast.literal_eval(_cmd_run(cmd=cmd)): raise SaltInvocationError(r"Invalid path specified: {0}".format(name))
def function[_validate_cert_path, parameter[name]]: constant[ Ensure that the certificate path, as determind from user input, is valid. ] variable[cmd] assign[=] call[constant[Test-Path -Path '{0}'].format, parameter[name[name]]] if <ast.UnaryOp object at 0x7da204622560> begin[:] ...
keyword[def] identifier[_validate_cert_path] ( identifier[name] ): literal[string] identifier[cmd] = literal[string] . identifier[format] ( identifier[name] ) keyword[if] keyword[not] identifier[ast] . identifier[literal_eval] ( identifier[_cmd_run] ( identifier[cmd] = identifier[cmd] )): ...
def _validate_cert_path(name): """ Ensure that the certificate path, as determind from user input, is valid. """ cmd = "Test-Path -Path '{0}'".format(name) if not ast.literal_eval(_cmd_run(cmd=cmd)): raise SaltInvocationError('Invalid path specified: {0}'.format(name)) # depends on [control...
def append(self, transitions, rows=None): """Append a batch of transitions to rows of the memory. Args: transitions: Tuple of transition quantities with batch dimension. rows: Episodes to append to, defaults to all. Returns: Operation. """ rows = tf.range(self._capacity) if rows ...
def function[append, parameter[self, transitions, rows]]: constant[Append a batch of transitions to rows of the memory. Args: transitions: Tuple of transition quantities with batch dimension. rows: Episodes to append to, defaults to all. Returns: Operation. ] variable[row...
keyword[def] identifier[append] ( identifier[self] , identifier[transitions] , identifier[rows] = keyword[None] ): literal[string] identifier[rows] = identifier[tf] . identifier[range] ( identifier[self] . identifier[_capacity] ) keyword[if] identifier[rows] keyword[is] keyword[None] keyword[else] ide...
def append(self, transitions, rows=None): """Append a batch of transitions to rows of the memory. Args: transitions: Tuple of transition quantities with batch dimension. rows: Episodes to append to, defaults to all. Returns: Operation. """ rows = tf.range(self._capacity) if rows ...
def add_chunk(self,start,end,trig_start=0,trig_end=0): """ Add an AnalysisChunk to the list associated with this ScienceSegment. @param start: GPS start time of chunk. @param end: GPS end time of chunk. @param trig_start: GPS start time for triggers from chunk """ self.__chunks.append(Analys...
def function[add_chunk, parameter[self, start, end, trig_start, trig_end]]: constant[ Add an AnalysisChunk to the list associated with this ScienceSegment. @param start: GPS start time of chunk. @param end: GPS end time of chunk. @param trig_start: GPS start time for triggers from chunk ] ...
keyword[def] identifier[add_chunk] ( identifier[self] , identifier[start] , identifier[end] , identifier[trig_start] = literal[int] , identifier[trig_end] = literal[int] ): literal[string] identifier[self] . identifier[__chunks] . identifier[append] ( identifier[AnalysisChunk] ( identifier[start] , identif...
def add_chunk(self, start, end, trig_start=0, trig_end=0): """ Add an AnalysisChunk to the list associated with this ScienceSegment. @param start: GPS start time of chunk. @param end: GPS end time of chunk. @param trig_start: GPS start time for triggers from chunk """ self.__chunks.append(An...
def scan(subtitles): """Remove advertising from subtitles.""" from importlib.util import find_spec try: import subnuker except ImportError: fatal('Unable to scan subtitles. Please install subnuker.') # check whether aeidon is available aeidon = find_spec('aeidon') is not None ...
def function[scan, parameter[subtitles]]: constant[Remove advertising from subtitles.] from relative_module[importlib.util] import module[find_spec] <ast.Try object at 0x7da1b13514b0> variable[aeidon] assign[=] compare[call[name[find_spec], parameter[constant[aeidon]]] is_not constant[None]] ...
keyword[def] identifier[scan] ( identifier[subtitles] ): literal[string] keyword[from] identifier[importlib] . identifier[util] keyword[import] identifier[find_spec] keyword[try] : keyword[import] identifier[subnuker] keyword[except] identifier[ImportError] : identifier...
def scan(subtitles): """Remove advertising from subtitles.""" from importlib.util import find_spec try: import subnuker # depends on [control=['try'], data=[]] except ImportError: fatal('Unable to scan subtitles. Please install subnuker.') # depends on [control=['except'], data=[]] ...
def _generate_overview_note(pass_count, only_warning_count, error_count, total_count): """ Generates and returns the HTML note that provides a summary of validation status. """ note_html = ['<div class="progress">'] pbars = [ [ float(error_count), 'danger', 'had errors' ], [ float(only_warn...
def function[_generate_overview_note, parameter[pass_count, only_warning_count, error_count, total_count]]: constant[ Generates and returns the HTML note that provides a summary of validation status. ] variable[note_html] assign[=] list[[<ast.Constant object at 0x7da18ede4520>]] variable[pbars] ...
keyword[def] identifier[_generate_overview_note] ( identifier[pass_count] , identifier[only_warning_count] , identifier[error_count] , identifier[total_count] ): literal[string] identifier[note_html] =[ literal[string] ] identifier[pbars] =[ [ identifier[float] ( identifier[error_count] ), litera...
def _generate_overview_note(pass_count, only_warning_count, error_count, total_count): """ Generates and returns the HTML note that provides a summary of validation status. """ note_html = ['<div class="progress">'] pbars = [[float(error_count), 'danger', 'had errors'], [float(only_warning_count), 'warning'...
def setup_cmd_parser(cls): """Returns the RSS argument parser.""" parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES, archive=True) # Required arguments parser.parser.add_argument('url', help="UR...
def function[setup_cmd_parser, parameter[cls]]: constant[Returns the RSS argument parser.] variable[parser] assign[=] call[name[BackendCommandArgumentParser], parameter[name[cls].BACKEND.CATEGORIES]] call[name[parser].parser.add_argument, parameter[constant[url]]] return[name[parser]]
keyword[def] identifier[setup_cmd_parser] ( identifier[cls] ): literal[string] identifier[parser] = identifier[BackendCommandArgumentParser] ( identifier[cls] . identifier[BACKEND] . identifier[CATEGORIES] , identifier[archive] = keyword[True] ) identifier[parser] . ide...
def setup_cmd_parser(cls): """Returns the RSS argument parser.""" parser = BackendCommandArgumentParser(cls.BACKEND.CATEGORIES, archive=True) # Required arguments parser.parser.add_argument('url', help='URL of the RSS feed') return parser
async def _deploy(self, charm_url, application, series, config, constraints, endpoint_bindings, resources, storage, channel=None, num_units=None, placement=None, devices=None): """Logic shared between `Model.deploy` and `BundleHandler.deploy`. ...
<ast.AsyncFunctionDef object at 0x7da20e954610>
keyword[async] keyword[def] identifier[_deploy] ( identifier[self] , identifier[charm_url] , identifier[application] , identifier[series] , identifier[config] , identifier[constraints] , identifier[endpoint_bindings] , identifier[resources] , identifier[storage] , identifier[channel] = keyword[None] , identifier[n...
async def _deploy(self, charm_url, application, series, config, constraints, endpoint_bindings, resources, storage, channel=None, num_units=None, placement=None, devices=None): """Logic shared between `Model.deploy` and `BundleHandler.deploy`. """ log.info('Deploying %s', charm_url) # stringify all ...
def yaml_dump_hook(cfg, text: bool=False): """ Dumps all the data into a YAML file. """ data = cfg.config.dump() if not text: yaml.dump(data, cfg.fd, Dumper=cfg.dumper, default_flow_style=False) else: return yaml.dump(data, Dumper=cfg.dumper, default_flow_style=False)
def function[yaml_dump_hook, parameter[cfg, text]]: constant[ Dumps all the data into a YAML file. ] variable[data] assign[=] call[name[cfg].config.dump, parameter[]] if <ast.UnaryOp object at 0x7da20e957fd0> begin[:] call[name[yaml].dump, parameter[name[data], name[cfg]....
keyword[def] identifier[yaml_dump_hook] ( identifier[cfg] , identifier[text] : identifier[bool] = keyword[False] ): literal[string] identifier[data] = identifier[cfg] . identifier[config] . identifier[dump] () keyword[if] keyword[not] identifier[text] : identifier[yaml] . identifier[dump] ...
def yaml_dump_hook(cfg, text: bool=False): """ Dumps all the data into a YAML file. """ data = cfg.config.dump() if not text: yaml.dump(data, cfg.fd, Dumper=cfg.dumper, default_flow_style=False) # depends on [control=['if'], data=[]] else: return yaml.dump(data, Dumper=cfg.dumpe...
def load_yaml(filename): """ Loads a YAML-formatted file. """ with open(filename) as f: ydoc = yaml.safe_load(f.read()) return (ydoc, serialize_tojson(ydoc))
def function[load_yaml, parameter[filename]]: constant[ Loads a YAML-formatted file. ] with call[name[open], parameter[name[filename]]] begin[:] variable[ydoc] assign[=] call[name[yaml].safe_load, parameter[call[name[f].read, parameter[]]]] return[tuple[[<ast.Name object at 0...
keyword[def] identifier[load_yaml] ( identifier[filename] ): literal[string] keyword[with] identifier[open] ( identifier[filename] ) keyword[as] identifier[f] : identifier[ydoc] = identifier[yaml] . identifier[safe_load] ( identifier[f] . identifier[read] ()) keyword[return] ( identifier[yd...
def load_yaml(filename): """ Loads a YAML-formatted file. """ with open(filename) as f: ydoc = yaml.safe_load(f.read()) # depends on [control=['with'], data=['f']] return (ydoc, serialize_tojson(ydoc))
def findalliter(string, sub, regex=False, case_sensitive=False, whole_word=False): """ Generator that finds all occurrences of ``sub`` in ``string`` :param string: string to parse :param sub: string to search :param regex: True to search using regex :param case_sensitive: True t...
def function[findalliter, parameter[string, sub, regex, case_sensitive, whole_word]]: constant[ Generator that finds all occurrences of ``sub`` in ``string`` :param string: string to parse :param sub: string to search :param regex: True to search using regex :param case_sensitive: True to m...
keyword[def] identifier[findalliter] ( identifier[string] , identifier[sub] , identifier[regex] = keyword[False] , identifier[case_sensitive] = keyword[False] , identifier[whole_word] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[sub] : keyword[return] keyword[if...
def findalliter(string, sub, regex=False, case_sensitive=False, whole_word=False): """ Generator that finds all occurrences of ``sub`` in ``string`` :param string: string to parse :param sub: string to search :param regex: True to search using regex :param case_sensitive: True to match case, Fa...
def qteConnectHook(self, hookName: str, slot: (types.FunctionType, types.MethodType)): """ Connect the method or function ``slot`` to ``hookName``. |Args| * ``hookName`` (**str**): name of the hook. * ``slot`` (**function**, **method**): the routine to ex...
def function[qteConnectHook, parameter[self, hookName, slot]]: constant[ Connect the method or function ``slot`` to ``hookName``. |Args| * ``hookName`` (**str**): name of the hook. * ``slot`` (**function**, **method**): the routine to execute when the hook triggers. ...
keyword[def] identifier[qteConnectHook] ( identifier[self] , identifier[hookName] : identifier[str] , identifier[slot] :( identifier[types] . identifier[FunctionType] , identifier[types] . identifier[MethodType] )): literal[string] identifier[reg] = identifier[self] . identifier[_qteRegis...
def qteConnectHook(self, hookName: str, slot: (types.FunctionType, types.MethodType)): """ Connect the method or function ``slot`` to ``hookName``. |Args| * ``hookName`` (**str**): name of the hook. * ``slot`` (**function**, **method**): the routine to execute when the ho...
def _onIncomingMessageReceived(self, conn, message): """ Callback for initial messages on incoming connections. Handles encryption, utility messages, and association of the connection with a Node. Once this initial setup is done, the relevant connected callback is executed, and further messages ...
def function[_onIncomingMessageReceived, parameter[self, conn, message]]: constant[ Callback for initial messages on incoming connections. Handles encryption, utility messages, and association of the connection with a Node. Once this initial setup is done, the relevant connected callback is exec...
keyword[def] identifier[_onIncomingMessageReceived] ( identifier[self] , identifier[conn] , identifier[message] ): literal[string] keyword[if] identifier[self] . identifier[_syncObj] . identifier[encryptor] keyword[and] keyword[not] identifier[conn] . identifier[sendRandKey] : ide...
def _onIncomingMessageReceived(self, conn, message): """ Callback for initial messages on incoming connections. Handles encryption, utility messages, and association of the connection with a Node. Once this initial setup is done, the relevant connected callback is executed, and further messages are ...
def scale_images_0to1(slice1, slice2): """Scale the two images to [0, 1] based on min/max from both.""" min_value = max(slice1.min(), slice2.min()) max_value = max(slice1.max(), slice2.max()) slice1 = (slice1 - min_value) / max_value slice2 = (slice2 - min_value) / max_value return slice1, sl...
def function[scale_images_0to1, parameter[slice1, slice2]]: constant[Scale the two images to [0, 1] based on min/max from both.] variable[min_value] assign[=] call[name[max], parameter[call[name[slice1].min, parameter[]], call[name[slice2].min, parameter[]]]] variable[max_value] assign[=] call[n...
keyword[def] identifier[scale_images_0to1] ( identifier[slice1] , identifier[slice2] ): literal[string] identifier[min_value] = identifier[max] ( identifier[slice1] . identifier[min] (), identifier[slice2] . identifier[min] ()) identifier[max_value] = identifier[max] ( identifier[slice1] . identifier...
def scale_images_0to1(slice1, slice2): """Scale the two images to [0, 1] based on min/max from both.""" min_value = max(slice1.min(), slice2.min()) max_value = max(slice1.max(), slice2.max()) slice1 = (slice1 - min_value) / max_value slice2 = (slice2 - min_value) / max_value return (slice1, slic...
def _get_data_from_list_of_lists(source, fields='*', first_row=0, count=-1, schema=None): """ Helper function for _get_data that handles lists of lists. """ if schema is None: schema = google.datalab.bigquery.Schema.from_data(source) fields = get_field_list(fields, schema) gen = source[first_row:first_row +...
def function[_get_data_from_list_of_lists, parameter[source, fields, first_row, count, schema]]: constant[ Helper function for _get_data that handles lists of lists. ] if compare[name[schema] is constant[None]] begin[:] variable[schema] assign[=] call[name[google].datalab.bigquery.Schema...
keyword[def] identifier[_get_data_from_list_of_lists] ( identifier[source] , identifier[fields] = literal[string] , identifier[first_row] = literal[int] , identifier[count] =- literal[int] , identifier[schema] = keyword[None] ): literal[string] keyword[if] identifier[schema] keyword[is] keyword[None] : ...
def _get_data_from_list_of_lists(source, fields='*', first_row=0, count=-1, schema=None): """ Helper function for _get_data that handles lists of lists. """ if schema is None: schema = google.datalab.bigquery.Schema.from_data(source) # depends on [control=['if'], data=['schema']] fields = get_field...
def cache_control(max_age=None, private=False, public=False, s_maxage=None, must_revalidate=False, proxy_revalidate=False, no_cache=False, no_store=False): """Generate the value for a Cache-Control header. Example: >>> from rhino.http import cache_control as cc >>> from datetim...
def function[cache_control, parameter[max_age, private, public, s_maxage, must_revalidate, proxy_revalidate, no_cache, no_store]]: constant[Generate the value for a Cache-Control header. Example: >>> from rhino.http import cache_control as cc >>> from datetime import timedelta >>> ...
keyword[def] identifier[cache_control] ( identifier[max_age] = keyword[None] , identifier[private] = keyword[False] , identifier[public] = keyword[False] , identifier[s_maxage] = keyword[None] , identifier[must_revalidate] = keyword[False] , identifier[proxy_revalidate] = keyword[False] , identifier[no_cache] = keyw...
def cache_control(max_age=None, private=False, public=False, s_maxage=None, must_revalidate=False, proxy_revalidate=False, no_cache=False, no_store=False): """Generate the value for a Cache-Control header. Example: >>> from rhino.http import cache_control as cc >>> from datetime import timedel...
def spawn(self, parameters=None, arguments=None, stderr=None, timeout=None, short_option_prefix="-", long_option_prefix="--"): """ Spawn the process defined in `cmd` parameters is converted to options the short and long option prefixes if a list is given as the value, the parameter is r...
def function[spawn, parameter[self, parameters, arguments, stderr, timeout, short_option_prefix, long_option_prefix]]: constant[ Spawn the process defined in `cmd` parameters is converted to options the short and long option prefixes if a list is given as the value, the parameter is rep...
keyword[def] identifier[spawn] ( identifier[self] , identifier[parameters] = keyword[None] , identifier[arguments] = keyword[None] , identifier[stderr] = keyword[None] , identifier[timeout] = keyword[None] , identifier[short_option_prefix] = literal[string] , identifier[long_option_prefix] = literal[string] ): ...
def spawn(self, parameters=None, arguments=None, stderr=None, timeout=None, short_option_prefix='-', long_option_prefix='--'): """ Spawn the process defined in `cmd` parameters is converted to options the short and long option prefixes if a list is given as the value, the parameter is repea...
def disconnect(self): """Disconnect from the card.""" # when __del__() is invoked in response to a module being deleted, # e.g., when execution of the program is done, other globals referenced # by the __del__() method may already have been deleted. # this causes CardConnection....
def function[disconnect, parameter[self]]: constant[Disconnect from the card.] <ast.Try object at 0x7da20c76fa30> if compare[constant[None] not_equal[!=] name[self].hcard] begin[:] variable[hresult] assign[=] call[name[SCardDisconnect], parameter[name[self].hcard, name[self].disposit...
keyword[def] identifier[disconnect] ( identifier[self] ): literal[string] keyword[try] : identifier[CardConnection] . identifier[disconnect] ( identifier[self] ) keyword[except] identifier[TypeError] : keyword[pass] ...
def disconnect(self): """Disconnect from the card.""" # when __del__() is invoked in response to a module being deleted, # e.g., when execution of the program is done, other globals referenced # by the __del__() method may already have been deleted. # this causes CardConnection.disconnect to except ...
def image_summary(predictions, targets, hparams): """Reshapes predictions and passes it to tensorboard. Args: predictions : The predicted image (logits). targets : The ground truth. hparams: model hparams. Returns: summary_proto: containing the summary images. weights: A Tensor of zeros of t...
def function[image_summary, parameter[predictions, targets, hparams]]: constant[Reshapes predictions and passes it to tensorboard. Args: predictions : The predicted image (logits). targets : The ground truth. hparams: model hparams. Returns: summary_proto: containing the summary images. ...
keyword[def] identifier[image_summary] ( identifier[predictions] , identifier[targets] , identifier[hparams] ): literal[string] keyword[del] identifier[hparams] identifier[results] = identifier[tf] . identifier[cast] ( identifier[tf] . identifier[argmax] ( identifier[predictions] , identifier[axis] =- lit...
def image_summary(predictions, targets, hparams): """Reshapes predictions and passes it to tensorboard. Args: predictions : The predicted image (logits). targets : The ground truth. hparams: model hparams. Returns: summary_proto: containing the summary images. weights: A Tensor of zeros of...
def bind_and_listen_on_posix_socket(socket_name, accept_callback): """ :param accept_callback: Called with `PosixSocketConnection` when a new connection is established. """ assert socket_name is None or isinstance(socket_name, six.text_type) assert callable(accept_callback) # Py2 uses 0...
def function[bind_and_listen_on_posix_socket, parameter[socket_name, accept_callback]]: constant[ :param accept_callback: Called with `PosixSocketConnection` when a new connection is established. ] assert[<ast.BoolOp object at 0x7da20e957d60>] assert[call[name[callable], parameter[name[a...
keyword[def] identifier[bind_and_listen_on_posix_socket] ( identifier[socket_name] , identifier[accept_callback] ): literal[string] keyword[assert] identifier[socket_name] keyword[is] keyword[None] keyword[or] identifier[isinstance] ( identifier[socket_name] , identifier[six] . identifier[text_type] )...
def bind_and_listen_on_posix_socket(socket_name, accept_callback): """ :param accept_callback: Called with `PosixSocketConnection` when a new connection is established. """ assert socket_name is None or isinstance(socket_name, six.text_type) assert callable(accept_callback) # Py2 uses 00...
def preview(self, when=timezone.now(), **kwargs): """Preview transactions, but don't actually save changes to list.""" return self.operate_on(when=when, apply=False, **kwargs)
def function[preview, parameter[self, when]]: constant[Preview transactions, but don't actually save changes to list.] return[call[name[self].operate_on, parameter[]]]
keyword[def] identifier[preview] ( identifier[self] , identifier[when] = identifier[timezone] . identifier[now] (),** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[operate_on] ( identifier[when] = identifier[when] , identifier[apply] = keyword[False] ,** iden...
def preview(self, when=timezone.now(), **kwargs): """Preview transactions, but don't actually save changes to list.""" return self.operate_on(when=when, apply=False, **kwargs)
def delete(self, request, customer_uuid): """ Handle DELETE request - handle unlinking learner. Arguments: request (django.http.request.HttpRequest): Request instance customer_uuid (str): Enterprise Customer UUID Returns: django.http.response.HttpRes...
def function[delete, parameter[self, request, customer_uuid]]: constant[ Handle DELETE request - handle unlinking learner. Arguments: request (django.http.request.HttpRequest): Request instance customer_uuid (str): Enterprise Customer UUID Returns: d...
keyword[def] identifier[delete] ( identifier[self] , identifier[request] , identifier[customer_uuid] ): literal[string] identifier[enterprise_customer] = identifier[EnterpriseCustomer] . identifier[objects] . identifier[get] ( identifier[uuid] = identifier[customer_uuid] ) identif...
def delete(self, request, customer_uuid): """ Handle DELETE request - handle unlinking learner. Arguments: request (django.http.request.HttpRequest): Request instance customer_uuid (str): Enterprise Customer UUID Returns: django.http.response.HttpRespons...
def get_sstable_data_files(self, ks, table): """ Read sstable data files by using sstableutil, so we ignore temporary files """ p = self.get_sstable_data_files_process(ks=ks, table=table) out, _, _ = handle_external_tool_process(p, ["sstableutil", '--type', 'final', ks, table]) ...
def function[get_sstable_data_files, parameter[self, ks, table]]: constant[ Read sstable data files by using sstableutil, so we ignore temporary files ] variable[p] assign[=] call[name[self].get_sstable_data_files_process, parameter[]] <ast.Tuple object at 0x7da1b12a8fd0> assign[...
keyword[def] identifier[get_sstable_data_files] ( identifier[self] , identifier[ks] , identifier[table] ): literal[string] identifier[p] = identifier[self] . identifier[get_sstable_data_files_process] ( identifier[ks] = identifier[ks] , identifier[table] = identifier[table] ) identifier[o...
def get_sstable_data_files(self, ks, table): """ Read sstable data files by using sstableutil, so we ignore temporary files """ p = self.get_sstable_data_files_process(ks=ks, table=table) (out, _, _) = handle_external_tool_process(p, ['sstableutil', '--type', 'final', ks, table]) return ...
def select_elements(source): ''' Yields all the elements from the source source - if an element, yields all child elements in order; if any other iterator yields the elements from that iterator ''' if isinstance(source, element): source = source.xml_children return filter(lambda x: isins...
def function[select_elements, parameter[source]]: constant[ Yields all the elements from the source source - if an element, yields all child elements in order; if any other iterator yields the elements from that iterator ] if call[name[isinstance], parameter[name[source], name[element]]] beg...
keyword[def] identifier[select_elements] ( identifier[source] ): literal[string] keyword[if] identifier[isinstance] ( identifier[source] , identifier[element] ): identifier[source] = identifier[source] . identifier[xml_children] keyword[return] identifier[filter] ( keyword[lambda] identif...
def select_elements(source): """ Yields all the elements from the source source - if an element, yields all child elements in order; if any other iterator yields the elements from that iterator """ if isinstance(source, element): source = source.xml_children # depends on [control=['if'], da...
def checkReference(self, reference): """ Check the reference for security. Tries to avoid any characters necessary for doing a script injection. """ pattern = re.compile(r'[\s,;"\'&\\]') if pattern.findall(reference.strip()): return False return True
def function[checkReference, parameter[self, reference]]: constant[ Check the reference for security. Tries to avoid any characters necessary for doing a script injection. ] variable[pattern] assign[=] call[name[re].compile, parameter[constant[[\s,;"\'&\\]]]] if call[name...
keyword[def] identifier[checkReference] ( identifier[self] , identifier[reference] ): literal[string] identifier[pattern] = identifier[re] . identifier[compile] ( literal[string] ) keyword[if] identifier[pattern] . identifier[findall] ( identifier[reference] . identifier[strip] ()): ...
def checkReference(self, reference): """ Check the reference for security. Tries to avoid any characters necessary for doing a script injection. """ pattern = re.compile('[\\s,;"\\\'&\\\\]') if pattern.findall(reference.strip()): return False # depends on [control=['if'], da...
def set_session(self, headers=None): """Init session with default or custom headers Args: headers: A dict of headers (default None, thus using the default header to init the session) """ if headers is None: headers = { 'User-A...
def function[set_session, parameter[self, headers]]: constant[Init session with default or custom headers Args: headers: A dict of headers (default None, thus using the default header to init the session) ] if compare[name[headers] is constant[None]] beg...
keyword[def] identifier[set_session] ( identifier[self] , identifier[headers] = keyword[None] ): literal[string] keyword[if] identifier[headers] keyword[is] keyword[None] : identifier[headers] ={ literal[string] : ( literal[string] literal[stri...
def set_session(self, headers=None): """Init session with default or custom headers Args: headers: A dict of headers (default None, thus using the default header to init the session) """ if headers is None: headers = {'User-Agent': 'Mozilla/5.0 (Macintos...
def create_diamond_db(self): '''Create a diamond database from the unaligned sequences in this package. Returns ------- path to the created diamond db e.g. 'my_sequences.dmnd' ''' base = self.unaligned_sequence_database_path() cmd = "diamond makedb --in '%s' -d '...
def function[create_diamond_db, parameter[self]]: constant[Create a diamond database from the unaligned sequences in this package. Returns ------- path to the created diamond db e.g. 'my_sequences.dmnd' ] variable[base] assign[=] call[name[self].unaligned_sequence_databa...
keyword[def] identifier[create_diamond_db] ( identifier[self] ): literal[string] identifier[base] = identifier[self] . identifier[unaligned_sequence_database_path] () identifier[cmd] = literal[string] %( identifier[self] . identifier[unaligned_sequence_database_path] (), identifier[base] )...
def create_diamond_db(self): """Create a diamond database from the unaligned sequences in this package. Returns ------- path to the created diamond db e.g. 'my_sequences.dmnd' """ base = self.unaligned_sequence_database_path() cmd = "diamond makedb --in '%s' -d '%s'" % (self...
def _local_times_from_hours_since_midnight(times, hours): """ converts hours since midnight from an array of floats to localized times """ tz_info = times.tz # pytz timezone info naive_times = times.tz_localize(None) # naive but still localized # normalize local, naive times to previous midnig...
def function[_local_times_from_hours_since_midnight, parameter[times, hours]]: constant[ converts hours since midnight from an array of floats to localized times ] variable[tz_info] assign[=] name[times].tz variable[naive_times] assign[=] call[name[times].tz_localize, parameter[constant[...
keyword[def] identifier[_local_times_from_hours_since_midnight] ( identifier[times] , identifier[hours] ): literal[string] identifier[tz_info] = identifier[times] . identifier[tz] identifier[naive_times] = identifier[times] . identifier[tz_localize] ( keyword[None] ) keyword[return] i...
def _local_times_from_hours_since_midnight(times, hours): """ converts hours since midnight from an array of floats to localized times """ tz_info = times.tz # pytz timezone info naive_times = times.tz_localize(None) # naive but still localized # normalize local, naive times to previous midnig...
def fetch(self, url, payload=None): """Return the textual content associated to the Response object""" response = super().fetch(url, payload=payload) return response.text
def function[fetch, parameter[self, url, payload]]: constant[Return the textual content associated to the Response object] variable[response] assign[=] call[call[name[super], parameter[]].fetch, parameter[name[url]]] return[name[response].text]
keyword[def] identifier[fetch] ( identifier[self] , identifier[url] , identifier[payload] = keyword[None] ): literal[string] identifier[response] = identifier[super] (). identifier[fetch] ( identifier[url] , identifier[payload] = identifier[payload] ) keyword[return] identifier[response...
def fetch(self, url, payload=None): """Return the textual content associated to the Response object""" response = super().fetch(url, payload=payload) return response.text
def find_in_tree(tree, key, perfect=False): """ Helper to perform find in dictionary tree. """ if len(key) == 0: if tree['item'] is not None: return tree['item'], () else: for i in range(len(tree['subtrees'])): if not perfect and tree['subtrees'][i...
def function[find_in_tree, parameter[tree, key, perfect]]: constant[ Helper to perform find in dictionary tree. ] if compare[call[name[len], parameter[name[key]]] equal[==] constant[0]] begin[:] if compare[call[name[tree]][constant[item]] is_not constant[None]] begin[:] ...
keyword[def] identifier[find_in_tree] ( identifier[tree] , identifier[key] , identifier[perfect] = keyword[False] ): literal[string] keyword[if] identifier[len] ( identifier[key] )== literal[int] : keyword[if] identifier[tree] [ literal[string] ] keyword[is] keyword[not] keyword[None] : ...
def find_in_tree(tree, key, perfect=False): """ Helper to perform find in dictionary tree. """ if len(key) == 0: if tree['item'] is not None: return (tree['item'], ()) # depends on [control=['if'], data=[]] else: for i in range(len(tree['subtrees'])): ...
def _state_delete(self): '''Try to delete the state.yml file and the folder .blockade''' try: os.remove(self._state_file) except OSError as err: if err.errno not in (errno.EPERM, errno.ENOENT): raise try: os.rmdir(self._state_dir) ...
def function[_state_delete, parameter[self]]: constant[Try to delete the state.yml file and the folder .blockade] <ast.Try object at 0x7da1b01c0430> <ast.Try object at 0x7da1b01c0520>
keyword[def] identifier[_state_delete] ( identifier[self] ): literal[string] keyword[try] : identifier[os] . identifier[remove] ( identifier[self] . identifier[_state_file] ) keyword[except] identifier[OSError] keyword[as] identifier[err] : keyword[if] identif...
def _state_delete(self): """Try to delete the state.yml file and the folder .blockade""" try: os.remove(self._state_file) # depends on [control=['try'], data=[]] except OSError as err: if err.errno not in (errno.EPERM, errno.ENOENT): raise # depends on [control=['if'], data=[]]...
def find_Note(data, freq, bits): """Get the frequencies, feed them to find_notes and the return the Note with the highest amplitude.""" data = find_frequencies(data, freq, bits) return sorted(find_notes(data), key=operator.itemgetter(1))[-1][0]
def function[find_Note, parameter[data, freq, bits]]: constant[Get the frequencies, feed them to find_notes and the return the Note with the highest amplitude.] variable[data] assign[=] call[name[find_frequencies], parameter[name[data], name[freq], name[bits]]] return[call[call[call[name[sorted]...
keyword[def] identifier[find_Note] ( identifier[data] , identifier[freq] , identifier[bits] ): literal[string] identifier[data] = identifier[find_frequencies] ( identifier[data] , identifier[freq] , identifier[bits] ) keyword[return] identifier[sorted] ( identifier[find_notes] ( identifier[data] ), i...
def find_Note(data, freq, bits): """Get the frequencies, feed them to find_notes and the return the Note with the highest amplitude.""" data = find_frequencies(data, freq, bits) return sorted(find_notes(data), key=operator.itemgetter(1))[-1][0]