code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def on_proposal(self, proposal, proto): "called to inform about synced peers" assert isinstance(proto, HDCProtocol) assert isinstance(proposal, Proposal) if proposal.height >= self.cm.height: assert proposal.lockset.is_valid self.last_active_protocol = proto
def function[on_proposal, parameter[self, proposal, proto]]: constant[called to inform about synced peers] assert[call[name[isinstance], parameter[name[proto], name[HDCProtocol]]]] assert[call[name[isinstance], parameter[name[proposal], name[Proposal]]]] if compare[name[proposal].height greater_...
keyword[def] identifier[on_proposal] ( identifier[self] , identifier[proposal] , identifier[proto] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[proto] , identifier[HDCProtocol] ) keyword[assert] identifier[isinstance] ( identifier[proposal] , identifier[Proposal...
def on_proposal(self, proposal, proto): """called to inform about synced peers""" assert isinstance(proto, HDCProtocol) assert isinstance(proposal, Proposal) if proposal.height >= self.cm.height: assert proposal.lockset.is_valid self.last_active_protocol = proto # depends on [control=['...
def get_memory_tar(image_path): '''get an in memory tar of an image. Use carefully, not as reliable as get_image_tar ''' byte_array = Client.image.export(image_path) file_object = io.BytesIO(byte_array) tar = tarfile.open(mode="r|*", fileobj=file_object) return (file_object,tar)
def function[get_memory_tar, parameter[image_path]]: constant[get an in memory tar of an image. Use carefully, not as reliable as get_image_tar ] variable[byte_array] assign[=] call[name[Client].image.export, parameter[name[image_path]]] variable[file_object] assign[=] call[name[io].B...
keyword[def] identifier[get_memory_tar] ( identifier[image_path] ): literal[string] identifier[byte_array] = identifier[Client] . identifier[image] . identifier[export] ( identifier[image_path] ) identifier[file_object] = identifier[io] . identifier[BytesIO] ( identifier[byte_array] ) identifier[...
def get_memory_tar(image_path): """get an in memory tar of an image. Use carefully, not as reliable as get_image_tar """ byte_array = Client.image.export(image_path) file_object = io.BytesIO(byte_array) tar = tarfile.open(mode='r|*', fileobj=file_object) return (file_object, tar)
def set_sample_type_default_stickers(portal): """ Fills the admitted stickers and their default stickers to every sample type. """ # Getting all sticker templates stickers = getStickerTemplates() sticker_ids = [] for sticker in stickers: sticker_ids.append(sticker.get('id')) ...
def function[set_sample_type_default_stickers, parameter[portal]]: constant[ Fills the admitted stickers and their default stickers to every sample type. ] variable[stickers] assign[=] call[name[getStickerTemplates], parameter[]] variable[sticker_ids] assign[=] list[[]] for t...
keyword[def] identifier[set_sample_type_default_stickers] ( identifier[portal] ): literal[string] identifier[stickers] = identifier[getStickerTemplates] () identifier[sticker_ids] =[] keyword[for] identifier[sticker] keyword[in] identifier[stickers] : identifier[sticker_ids] . id...
def set_sample_type_default_stickers(portal): """ Fills the admitted stickers and their default stickers to every sample type. """ # Getting all sticker templates stickers = getStickerTemplates() sticker_ids = [] for sticker in stickers: sticker_ids.append(sticker.get('id')) # d...
def _iter_groups(self, data): """ Iterate over the groups in `data` after grouping by `segmentation_col`. Skips any groups for which there is no model stored. Yields tuples of (name, df) where name is the group key and df is the group DataFrame. Parameters ...
def function[_iter_groups, parameter[self, data]]: constant[ Iterate over the groups in `data` after grouping by `segmentation_col`. Skips any groups for which there is no model stored. Yields tuples of (name, df) where name is the group key and df is the group DataFrame...
keyword[def] identifier[_iter_groups] ( identifier[self] , identifier[data] ): literal[string] identifier[groups] = identifier[data] . identifier[groupby] ( identifier[self] . identifier[segmentation_col] ) keyword[for] identifier[name] , identifier[group] keyword[in] identifier[groups...
def _iter_groups(self, data): """ Iterate over the groups in `data` after grouping by `segmentation_col`. Skips any groups for which there is no model stored. Yields tuples of (name, df) where name is the group key and df is the group DataFrame. Parameters -...
def from_plugin_classname(plugin_classname, exclude_lines_regex=None, **kwargs): """Initializes a plugin class, given a classname and kwargs. :type plugin_classname: str :param plugin_classname: subclass of BasePlugin. :type exclude_lines_regex: str|None :param exclude_lines_regex: optional regex ...
def function[from_plugin_classname, parameter[plugin_classname, exclude_lines_regex]]: constant[Initializes a plugin class, given a classname and kwargs. :type plugin_classname: str :param plugin_classname: subclass of BasePlugin. :type exclude_lines_regex: str|None :param exclude_lines_regex:...
keyword[def] identifier[from_plugin_classname] ( identifier[plugin_classname] , identifier[exclude_lines_regex] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[klass] = identifier[globals] ()[ identifier[plugin_classname] ] keyword[if] keyword[not] identifier[issubclass] (...
def from_plugin_classname(plugin_classname, exclude_lines_regex=None, **kwargs): """Initializes a plugin class, given a classname and kwargs. :type plugin_classname: str :param plugin_classname: subclass of BasePlugin. :type exclude_lines_regex: str|None :param exclude_lines_regex: optional regex ...
def fromtab(args): """ %prog fromtab tabfile fastafile Convert 2-column sequence file to FASTA format. One usage for this is to generatea `adapters.fasta` for TRIMMOMATIC. """ p = OptionParser(fromtab.__doc__) p.set_sep(sep=None) p.add_option("--noheader", default=False, action="store_t...
def function[fromtab, parameter[args]]: constant[ %prog fromtab tabfile fastafile Convert 2-column sequence file to FASTA format. One usage for this is to generatea `adapters.fasta` for TRIMMOMATIC. ] variable[p] assign[=] call[name[OptionParser], parameter[name[fromtab].__doc__]] ...
keyword[def] identifier[fromtab] ( identifier[args] ): literal[string] identifier[p] = identifier[OptionParser] ( identifier[fromtab] . identifier[__doc__] ) identifier[p] . identifier[set_sep] ( identifier[sep] = keyword[None] ) identifier[p] . identifier[add_option] ( literal[string] , identifi...
def fromtab(args): """ %prog fromtab tabfile fastafile Convert 2-column sequence file to FASTA format. One usage for this is to generatea `adapters.fasta` for TRIMMOMATIC. """ p = OptionParser(fromtab.__doc__) p.set_sep(sep=None) p.add_option('--noheader', default=False, action='store_t...
def to_ufo_glyph_background(self, glyph, layer): """Set glyph background.""" if not layer.hasBackground: return background = layer.background ufo_layer = self.to_ufo_background_layer(glyph) new_glyph = ufo_layer.newGlyph(glyph.name) width = background.userData[BACKGROUND_WIDTH_KEY] ...
def function[to_ufo_glyph_background, parameter[self, glyph, layer]]: constant[Set glyph background.] if <ast.UnaryOp object at 0x7da18ede7b80> begin[:] return[None] variable[background] assign[=] name[layer].background variable[ufo_layer] assign[=] call[name[self].to_ufo_backgro...
keyword[def] identifier[to_ufo_glyph_background] ( identifier[self] , identifier[glyph] , identifier[layer] ): literal[string] keyword[if] keyword[not] identifier[layer] . identifier[hasBackground] : keyword[return] identifier[background] = identifier[layer] . identifier[background] ...
def to_ufo_glyph_background(self, glyph, layer): """Set glyph background.""" if not layer.hasBackground: return # depends on [control=['if'], data=[]] background = layer.background ufo_layer = self.to_ufo_background_layer(glyph) new_glyph = ufo_layer.newGlyph(glyph.name) width = backgro...
def increment(self, subname=None, delta=1): '''Increment the gauge with `delta` :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword delta: The delta to add to the gauge :type delta: int >>> gauge = Ga...
def function[increment, parameter[self, subname, delta]]: constant[Increment the gauge with `delta` :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword delta: The delta to add to the gauge :type delta: int ...
keyword[def] identifier[increment] ( identifier[self] , identifier[subname] = keyword[None] , identifier[delta] = literal[int] ): literal[string] identifier[delta] = identifier[int] ( identifier[delta] ) identifier[sign] = literal[string] keyword[if] identifier[delta] >= literal[int] ke...
def increment(self, subname=None, delta=1): """Increment the gauge with `delta` :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword delta: The delta to add to the gauge :type delta: int >>> gauge = Gauge(...
def suffix(args): """ %prog suffix fastqfile CAG Filter reads based on suffix. """ p = OptionParser(suffix.__doc__) p.set_outfile() opts, args = p.parse_args(args) if len(args) != 2: sys.exit(not p.print_help()) fastqfile, sf = args fw = must_open(opts.outfile, "w") ...
def function[suffix, parameter[args]]: constant[ %prog suffix fastqfile CAG Filter reads based on suffix. ] variable[p] assign[=] call[name[OptionParser], parameter[name[suffix].__doc__]] call[name[p].set_outfile, parameter[]] <ast.Tuple object at 0x7da18fe91510> assign[=] c...
keyword[def] identifier[suffix] ( identifier[args] ): literal[string] identifier[p] = identifier[OptionParser] ( identifier[suffix] . identifier[__doc__] ) identifier[p] . identifier[set_outfile] () identifier[opts] , identifier[args] = identifier[p] . identifier[parse_args] ( identifier[args] ) ...
def suffix(args): """ %prog suffix fastqfile CAG Filter reads based on suffix. """ p = OptionParser(suffix.__doc__) p.set_outfile() (opts, args) = p.parse_args(args) if len(args) != 2: sys.exit(not p.print_help()) # depends on [control=['if'], data=[]] (fastqfile, sf) = arg...
def DeleteNodeTags(r, node, tags, dry_run=False): """ Delete tags from a node. @type node: str @param node: node to remove tags from @type tags: list of str @param tags: tags to remove from the node @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @r...
def function[DeleteNodeTags, parameter[r, node, tags, dry_run]]: constant[ Delete tags from a node. @type node: str @param node: node to remove tags from @type tags: list of str @param tags: tags to remove from the node @type dry_run: bool @param dry_run: whether to perform a dry ru...
keyword[def] identifier[DeleteNodeTags] ( identifier[r] , identifier[node] , identifier[tags] , identifier[dry_run] = keyword[False] ): literal[string] identifier[query] ={ literal[string] : identifier[tags] , literal[string] : identifier[dry_run] , } keyword[return] identifier[r] . i...
def DeleteNodeTags(r, node, tags, dry_run=False): """ Delete tags from a node. @type node: str @param node: node to remove tags from @type tags: list of str @param tags: tags to remove from the node @type dry_run: bool @param dry_run: whether to perform a dry run @rtype: int @r...
def Audits_getEncodedResponse(self, requestId, encoding, **kwargs): """ Function path: Audits.getEncodedResponse Domain: Audits Method name: getEncodedResponse Parameters: Required arguments: 'requestId' (type: Network.RequestId) -> Identifier of the network request to get content for. 'en...
def function[Audits_getEncodedResponse, parameter[self, requestId, encoding]]: constant[ Function path: Audits.getEncodedResponse Domain: Audits Method name: getEncodedResponse Parameters: Required arguments: 'requestId' (type: Network.RequestId) -> Identifier of the network request to ge...
keyword[def] identifier[Audits_getEncodedResponse] ( identifier[self] , identifier[requestId] , identifier[encoding] ,** identifier[kwargs] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[encoding] ,( identifier[str] ,) ), literal[string] % identifier[type] ( identifier[encoding] )...
def Audits_getEncodedResponse(self, requestId, encoding, **kwargs): """ Function path: Audits.getEncodedResponse Domain: Audits Method name: getEncodedResponse Parameters: Required arguments: 'requestId' (type: Network.RequestId) -> Identifier of the network request to get content for. '...
def ancestors(obj, refattrs=(ALIGNMENT, SEGMENTATION)): """ >>> for anc in query.ancestors(igt.get_item('g1'), refattrs=(ALIGNMENT, SEGMENTATION)): ... print(anc) (<Tier object (id: g type: glosses) at ...>, 'alignment', <Tier object (id: m type: morphemes) at ...>, [<Item object (id: m1) at ...>]) ...
def function[ancestors, parameter[obj, refattrs]]: constant[ >>> for anc in query.ancestors(igt.get_item('g1'), refattrs=(ALIGNMENT, SEGMENTATION)): ... print(anc) (<Tier object (id: g type: glosses) at ...>, 'alignment', <Tier object (id: m type: morphemes) at ...>, [<Item object (id: m1) at .....
keyword[def] identifier[ancestors] ( identifier[obj] , identifier[refattrs] =( identifier[ALIGNMENT] , identifier[SEGMENTATION] )): literal[string] keyword[if] identifier[hasattr] ( identifier[obj] , literal[string] ): identifier[tier] = identifier[obj] . identifier[tier] identifier[ite...
def ancestors(obj, refattrs=(ALIGNMENT, SEGMENTATION)): """ >>> for anc in query.ancestors(igt.get_item('g1'), refattrs=(ALIGNMENT, SEGMENTATION)): ... print(anc) (<Tier object (id: g type: glosses) at ...>, 'alignment', <Tier object (id: m type: morphemes) at ...>, [<Item object (id: m1) at ...>]) ...
def cublasZsymv(handle, uplo, n, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for complex symmetric matrix. """ status = _libcublas.cublasZsymv_v2(handle, _CUBLAS_FILL_MODE[uplo], n, ctypes.byref(cud...
def function[cublasZsymv, parameter[handle, uplo, n, alpha, A, lda, x, incx, beta, y, incy]]: constant[ Matrix-vector product for complex symmetric matrix. ] variable[status] assign[=] call[name[_libcublas].cublasZsymv_v2, parameter[name[handle], call[name[_CUBLAS_FILL_MODE]][name[uplo]], name[...
keyword[def] identifier[cublasZsymv] ( identifier[handle] , identifier[uplo] , identifier[n] , identifier[alpha] , identifier[A] , identifier[lda] , identifier[x] , identifier[incx] , identifier[beta] , identifier[y] , identifier[incy] ): literal[string] identifier[status] = identifier[_libcublas] . ident...
def cublasZsymv(handle, uplo, n, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for complex symmetric matrix. """ status = _libcublas.cublasZsymv_v2(handle, _CUBLAS_FILL_MODE[uplo], n, ctypes.byref(cuda.cuDoubleComplex(alpha.real, alpha.imag)), int(A), lda, int(x), incx, ctypes.byref...
def search(self, query=None, args=None): '''query a GitLab artifacts folder for a list of images. If query is None, collections are listed. ''' if query is None: bot.exit('You must include a collection query, <collection>/<repo>') # or default to listing (searching) all things. retur...
def function[search, parameter[self, query, args]]: constant[query a GitLab artifacts folder for a list of images. If query is None, collections are listed. ] if compare[name[query] is constant[None]] begin[:] call[name[bot].exit, parameter[constant[You must include a collecti...
keyword[def] identifier[search] ( identifier[self] , identifier[query] = keyword[None] , identifier[args] = keyword[None] ): literal[string] keyword[if] identifier[query] keyword[is] keyword[None] : identifier[bot] . identifier[exit] ( literal[string] ) keyword[return] identifie...
def search(self, query=None, args=None): """query a GitLab artifacts folder for a list of images. If query is None, collections are listed. """ if query is None: bot.exit('You must include a collection query, <collection>/<repo>') # depends on [control=['if'], data=[]] # or default to li...
def rule(rules, strict_slashes=False, api_func=None, *args, **kwargs): """ Add a API route to the 'api' blueprint. :param rules: rule string or string list :param strict_slashes: same to Blueprint.route, but default value is False :param api_func: a function that returns a JSON serializable object ...
def function[rule, parameter[rules, strict_slashes, api_func]]: constant[ Add a API route to the 'api' blueprint. :param rules: rule string or string list :param strict_slashes: same to Blueprint.route, but default value is False :param api_func: a function that returns a JSON serializable obje...
keyword[def] identifier[rule] ( identifier[rules] , identifier[strict_slashes] = keyword[False] , identifier[api_func] = keyword[None] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[url_rule] ( identifier[api_blueprint] , identifier[rules] , identifier[strict_slas...
def rule(rules, strict_slashes=False, api_func=None, *args, **kwargs): """ Add a API route to the 'api' blueprint. :param rules: rule string or string list :param strict_slashes: same to Blueprint.route, but default value is False :param api_func: a function that returns a JSON serializable object ...
def get_counter(self, transport, bucket, key, r=None, pr=None, basic_quorum=None, notfound_ok=None): """get_counter(bucket, key, r=None, pr=None, basic_quorum=None,\ notfound_ok=None) Gets the value of a counter. .. deprecated:: 2.1.0 (Riak 2.0) Riak ...
def function[get_counter, parameter[self, transport, bucket, key, r, pr, basic_quorum, notfound_ok]]: constant[get_counter(bucket, key, r=None, pr=None, basic_quorum=None, notfound_ok=None) Gets the value of a counter. .. deprecated:: 2.1.0 (Riak 2.0) Riak 1.4-style count...
keyword[def] identifier[get_counter] ( identifier[self] , identifier[transport] , identifier[bucket] , identifier[key] , identifier[r] = keyword[None] , identifier[pr] = keyword[None] , identifier[basic_quorum] = keyword[None] , identifier[notfound_ok] = keyword[None] ): literal[string] keyword[re...
def get_counter(self, transport, bucket, key, r=None, pr=None, basic_quorum=None, notfound_ok=None): """get_counter(bucket, key, r=None, pr=None, basic_quorum=None, notfound_ok=None) Gets the value of a counter. .. deprecated:: 2.1.0 (Riak 2.0) Riak 1.4-style counters are ...
def doubleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse positi...
def function[doubleClick, parameter[x, y, interval, button, duration, tween, pause, _pause]]: constant[Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse position is used....
keyword[def] identifier[doubleClick] ( identifier[x] = keyword[None] , identifier[y] = keyword[None] , identifier[interval] = literal[int] , identifier[button] = literal[string] , identifier[duration] = literal[int] , identifier[tween] = identifier[linear] , identifier[pause] = keyword[None] , identifier[_pause] = ke...
def doubleClick(x=None, y=None, interval=0.0, button='left', duration=0.0, tween=linear, pause=None, _pause=True): """Performs a double click. This is a wrapper function for click('left', x, y, 2, interval). The x and y parameters detail where the mouse event happens. If None, the current mouse positi...
def shutdown(self, signum, frame): # pylint: disable=unused-argument """Shut it down""" if not self.exit: self.exit = True self.log.debug(f"SIGTRAP!{signum};{frame}") self.api.shutdown() self.strat.shutdown()
def function[shutdown, parameter[self, signum, frame]]: constant[Shut it down] if <ast.UnaryOp object at 0x7da2054a47c0> begin[:] name[self].exit assign[=] constant[True] call[name[self].log.debug, parameter[<ast.JoinedStr object at 0x7da2054a44c0>]] call[...
keyword[def] identifier[shutdown] ( identifier[self] , identifier[signum] , identifier[frame] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[exit] : identifier[self] . identifier[exit] = keyword[True] identifier[self] . identifier[log] . ident...
def shutdown(self, signum, frame): # pylint: disable=unused-argument 'Shut it down' if not self.exit: self.exit = True self.log.debug(f'SIGTRAP!{signum};{frame}') self.api.shutdown() self.strat.shutdown() # depends on [control=['if'], data=[]]
def add_triple( self, subj: Union[URIRef, str], pred: Union[URIRef, str], obj: Union[URIRef, Literal, str] ) -> None: """ Adds triple to rdflib Graph Triple can be of any subject, predicate, and object of the entity without a need for order. ...
def function[add_triple, parameter[self, subj, pred, obj]]: constant[ Adds triple to rdflib Graph Triple can be of any subject, predicate, and object of the entity without a need for order. Args: subj: Entity subject pred: Entity predicate obj: Entity object...
keyword[def] identifier[add_triple] ( identifier[self] , identifier[subj] : identifier[Union] [ identifier[URIRef] , identifier[str] ], identifier[pred] : identifier[Union] [ identifier[URIRef] , identifier[str] ], identifier[obj] : identifier[Union] [ identifier[URIRef] , identifier[Literal] , identifier[str] ] ...
def add_triple(self, subj: Union[URIRef, str], pred: Union[URIRef, str], obj: Union[URIRef, Literal, str]) -> None: """ Adds triple to rdflib Graph Triple can be of any subject, predicate, and object of the entity without a need for order. Args: subj: Entity subject pred: E...
def emit_measured(self): """ The beam emittance :math:`\\langle x x' \\rangle`. """ return _np.sqrt(self.spotsq*self.divsq-self.xxp**2)
def function[emit_measured, parameter[self]]: constant[ The beam emittance :math:`\langle x x' \rangle`. ] return[call[name[_np].sqrt, parameter[binary_operation[binary_operation[name[self].spotsq * name[self].divsq] - binary_operation[name[self].xxp ** constant[2]]]]]]
keyword[def] identifier[emit_measured] ( identifier[self] ): literal[string] keyword[return] identifier[_np] . identifier[sqrt] ( identifier[self] . identifier[spotsq] * identifier[self] . identifier[divsq] - identifier[self] . identifier[xxp] ** literal[int] )
def emit_measured(self): """ The beam emittance :math:`\\langle x x' \\rangle`. """ return _np.sqrt(self.spotsq * self.divsq - self.xxp ** 2)
def _get_document_data(f, image_handler=None): ''' ``f`` is a ``ZipFile`` that is open Extract out the document data, numbering data and the relationship data. ''' if image_handler is None: def image_handler(image_id, relationship_dict): return relationship_dict.get(image_id) ...
def function[_get_document_data, parameter[f, image_handler]]: constant[ ``f`` is a ``ZipFile`` that is open Extract out the document data, numbering data and the relationship data. ] if compare[name[image_handler] is constant[None]] begin[:] def function[image_handler, param...
keyword[def] identifier[_get_document_data] ( identifier[f] , identifier[image_handler] = keyword[None] ): literal[string] keyword[if] identifier[image_handler] keyword[is] keyword[None] : keyword[def] identifier[image_handler] ( identifier[image_id] , identifier[relationship_dict] ): ...
def _get_document_data(f, image_handler=None): """ ``f`` is a ``ZipFile`` that is open Extract out the document data, numbering data and the relationship data. """ if image_handler is None: def image_handler(image_id, relationship_dict): return relationship_dict.get(image_id) #...
def transform(self, words, aggregate_method): """ Transform words (or sequences of words) to vectors using a word2vec model. :param str words: An H2OFrame made of a single column containing source words. :param str aggregate_method: Specifies how to aggregate sequences of words. If meth...
def function[transform, parameter[self, words, aggregate_method]]: constant[ Transform words (or sequences of words) to vectors using a word2vec model. :param str words: An H2OFrame made of a single column containing source words. :param str aggregate_method: Specifies how to aggregate ...
keyword[def] identifier[transform] ( identifier[self] , identifier[words] , identifier[aggregate_method] ): literal[string] identifier[j] = identifier[h2o] . identifier[api] ( literal[string] , identifier[data] ={ literal[string] : identifier[self] . identifier[model_id] , literal[string] : identif...
def transform(self, words, aggregate_method): """ Transform words (or sequences of words) to vectors using a word2vec model. :param str words: An H2OFrame made of a single column containing source words. :param str aggregate_method: Specifies how to aggregate sequences of words. If method i...
def resolve_elements(self): """Get element of this node recursively Compute rules with OR or AND rule then NOT rules. :return: set of element :rtype: set """ # If it's a leaf, we just need to dump a set with the content of the node if self.leaf: if no...
def function[resolve_elements, parameter[self]]: constant[Get element of this node recursively Compute rules with OR or AND rule then NOT rules. :return: set of element :rtype: set ] if name[self].leaf begin[:] if <ast.UnaryOp object at 0x7da20c7cb3a0> be...
keyword[def] identifier[resolve_elements] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[leaf] : keyword[if] keyword[not] identifier[self] . identifier[content] : keyword[return] identifier[set] () keyword[ret...
def resolve_elements(self): """Get element of this node recursively Compute rules with OR or AND rule then NOT rules. :return: set of element :rtype: set """ # If it's a leaf, we just need to dump a set with the content of the node if self.leaf: if not self.content: ...
def get_urls(self): """ Add a calendar URL. """ from django.conf.urls import patterns, url urls = super(EventAdmin, self).get_urls() my_urls = patterns( '', url( r'^calendar/$', self.admin_site.admin_view(self.calend...
def function[get_urls, parameter[self]]: constant[ Add a calendar URL. ] from relative_module[django.conf.urls] import module[patterns], module[url] variable[urls] assign[=] call[call[name[super], parameter[name[EventAdmin], name[self]]].get_urls, parameter[]] variable[my_url...
keyword[def] identifier[get_urls] ( identifier[self] ): literal[string] keyword[from] identifier[django] . identifier[conf] . identifier[urls] keyword[import] identifier[patterns] , identifier[url] identifier[urls] = identifier[super] ( identifier[EventAdmin] , identifier[self] ). iden...
def get_urls(self): """ Add a calendar URL. """ from django.conf.urls import patterns, url urls = super(EventAdmin, self).get_urls() my_urls = patterns('', url('^calendar/$', self.admin_site.admin_view(self.calendar), name='icekit_events_eventbase_calendar'), url('^calendar_data/$', self...
def time(self, intervals=1, *args, _show_progress=True, _print=True, _collect_garbage=True, _quiet=True, **kwargs): """ Measures the execution time of :prop:_callable for @intervals @intervals: #int number of intervals to measure the execution time of the function for ...
def function[time, parameter[self, intervals]]: constant[ Measures the execution time of :prop:_callable for @intervals @intervals: #int number of intervals to measure the execution time of the function for @*args: arguments to pass to the callable being timed ...
keyword[def] identifier[time] ( identifier[self] , identifier[intervals] = literal[int] ,* identifier[args] , identifier[_show_progress] = keyword[True] , identifier[_print] = keyword[True] , identifier[_collect_garbage] = keyword[True] , identifier[_quiet] = keyword[True] ,** identifier[kwargs] ): literal[...
def time(self, intervals=1, *args, _show_progress=True, _print=True, _collect_garbage=True, _quiet=True, **kwargs): """ Measures the execution time of :prop:_callable for @intervals @intervals: #int number of intervals to measure the execution time of the function for @*args...
def render_registered(url_id, remote_info): """ Render template file for the registered user, which has some of the values prefilled. Args: url_id (str): Seeder URL id. remote_info (dict): Informations read from Seeder. Returns: str: Template filled with data. """ r...
def function[render_registered, parameter[url_id, remote_info]]: constant[ Render template file for the registered user, which has some of the values prefilled. Args: url_id (str): Seeder URL id. remote_info (dict): Informations read from Seeder. Returns: str: Template ...
keyword[def] identifier[render_registered] ( identifier[url_id] , identifier[remote_info] ): literal[string] keyword[return] identifier[template] ( identifier[read_index_template] (), identifier[registered] = keyword[True] , identifier[url] = identifier[remote_info] [ literal[string] ], ...
def render_registered(url_id, remote_info): """ Render template file for the registered user, which has some of the values prefilled. Args: url_id (str): Seeder URL id. remote_info (dict): Informations read from Seeder. Returns: str: Template filled with data. """ r...
def _record(self, ext_loc, parent_dir_num): # type: (int, int) -> bytes ''' An internal method to generate a string representing this Path Table Record. Parameters: ext_loc - The extent location to place in this Path Table Record. parent_dir_num - The parent directory ...
def function[_record, parameter[self, ext_loc, parent_dir_num]]: constant[ An internal method to generate a string representing this Path Table Record. Parameters: ext_loc - The extent location to place in this Path Table Record. parent_dir_num - The parent directory number to...
keyword[def] identifier[_record] ( identifier[self] , identifier[ext_loc] , identifier[parent_dir_num] ): literal[string] keyword[return] identifier[struct] . identifier[pack] ( identifier[self] . identifier[FMT] , identifier[self] . identifier[len_di] , identifier[self] . identifier[xattr_length...
def _record(self, ext_loc, parent_dir_num): # type: (int, int) -> bytes '\n An internal method to generate a string representing this Path Table Record.\n\n Parameters:\n ext_loc - The extent location to place in this Path Table Record.\n parent_dir_num - The parent directory numbe...
def choose_init(module): """ Select a init system Returns the name of a init system (upstart, sysvinit ...). """ # Upstart checks first because when installing ceph, the # `/lib/systemd/system/ceph.target` file may be created, fooling this # detection mechanism. if is_upstart(module.con...
def function[choose_init, parameter[module]]: constant[ Select a init system Returns the name of a init system (upstart, sysvinit ...). ] if call[name[is_upstart], parameter[name[module].conn]] begin[:] return[constant[upstart]] if <ast.BoolOp object at 0x7da1b16a3d90> begin...
keyword[def] identifier[choose_init] ( identifier[module] ): literal[string] keyword[if] identifier[is_upstart] ( identifier[module] . identifier[conn] ): keyword[return] literal[string] keyword[if] identifier[is_systemd] ( identifier[module] . identifier[conn] ) keyword[o...
def choose_init(module): """ Select a init system Returns the name of a init system (upstart, sysvinit ...). """ # Upstart checks first because when installing ceph, the # `/lib/systemd/system/ceph.target` file may be created, fooling this # detection mechanism. if is_upstart(module.con...
def fit(self, range, function=None): """Fits a function to the active display's data trace within a specified range of the time window. E.g.:: # Fit's a gaussian to the first 30% of the time window. lockin.fit(range=(0, 30), function='gauss') :param start: The ...
def function[fit, parameter[self, range, function]]: constant[Fits a function to the active display's data trace within a specified range of the time window. E.g.:: # Fit's a gaussian to the first 30% of the time window. lockin.fit(range=(0, 30), function='gauss') ...
keyword[def] identifier[fit] ( identifier[self] , identifier[range] , identifier[function] = keyword[None] ): literal[string] keyword[if] identifier[function] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[fit_function] = identifier[function] ident...
def fit(self, range, function=None): """Fits a function to the active display's data trace within a specified range of the time window. E.g.:: # Fit's a gaussian to the first 30% of the time window. lockin.fit(range=(0, 30), function='gauss') :param start: The left...
def references(self, criteria, publications='publications', column_name='publication_shortname', fetch=False): """ Do a reverse lookup on the **publications** table. Will return every entry that matches that reference. Parameters ---------- criteria: int or str The i...
def function[references, parameter[self, criteria, publications, column_name, fetch]]: constant[ Do a reverse lookup on the **publications** table. Will return every entry that matches that reference. Parameters ---------- criteria: int or str The id from the PUBLICA...
keyword[def] identifier[references] ( identifier[self] , identifier[criteria] , identifier[publications] = literal[string] , identifier[column_name] = literal[string] , identifier[fetch] = keyword[False] ): literal[string] identifier[data_tables] = identifier[dict] () keyword[if...
def references(self, criteria, publications='publications', column_name='publication_shortname', fetch=False): """ Do a reverse lookup on the **publications** table. Will return every entry that matches that reference. Parameters ---------- criteria: int or str The id fr...
def paint(self, painter, rect, palette): """Draws a generic visual representation for this component Re-implement this to get a custom graphic in builder editor :param painter: Use this class to do the drawing :type painter: :qtdoc:`QPainter` :param rect: boundary of the delega...
def function[paint, parameter[self, painter, rect, palette]]: constant[Draws a generic visual representation for this component Re-implement this to get a custom graphic in builder editor :param painter: Use this class to do the drawing :type painter: :qtdoc:`QPainter` :param r...
keyword[def] identifier[paint] ( identifier[self] , identifier[painter] , identifier[rect] , identifier[palette] ): literal[string] identifier[painter] . identifier[save] () identifier[image] = identifier[img] . identifier[default] () identifier[painter] . identifier[drawImage] (...
def paint(self, painter, rect, palette): """Draws a generic visual representation for this component Re-implement this to get a custom graphic in builder editor :param painter: Use this class to do the drawing :type painter: :qtdoc:`QPainter` :param rect: boundary of the delegate f...
def find_modules_with_decorators(path,decorator_module,decorator_name): ''' Finds all the modules decorated with the specified decorator in the path, file or module specified. Args : path : All modules in the directory and its sub-directories will be scanned. decorato...
def function[find_modules_with_decorators, parameter[path, decorator_module, decorator_name]]: constant[ Finds all the modules decorated with the specified decorator in the path, file or module specified. Args : path : All modules in the directory and its sub-directories will...
keyword[def] identifier[find_modules_with_decorators] ( identifier[path] , identifier[decorator_module] , identifier[decorator_name] ): literal[string] identifier[modules_paths] =[] keyword[if] identifier[path] [- literal[int] :]== literal[string] : identifier[modules_paths] . identif...
def find_modules_with_decorators(path, decorator_module, decorator_name): """ Finds all the modules decorated with the specified decorator in the path, file or module specified. Args : path : All modules in the directory and its sub-directories will be scanned. decora...
def remove_cached_item(self, path): """ Remove cached resource item :param path: str :return: PIL.Image """ item_path = '%s/%s' % ( self.cache_folder, path.strip('/') ) self.blob_service.delete_blob(self.container_name,...
def function[remove_cached_item, parameter[self, path]]: constant[ Remove cached resource item :param path: str :return: PIL.Image ] variable[item_path] assign[=] binary_operation[constant[%s/%s] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Attribute object at 0x7da1b15...
keyword[def] identifier[remove_cached_item] ( identifier[self] , identifier[path] ): literal[string] identifier[item_path] = literal[string] %( identifier[self] . identifier[cache_folder] , identifier[path] . identifier[strip] ( literal[string] ) ) identifier[sel...
def remove_cached_item(self, path): """ Remove cached resource item :param path: str :return: PIL.Image """ item_path = '%s/%s' % (self.cache_folder, path.strip('/')) self.blob_service.delete_blob(self.container_name, item_path) while self.blob_service.exists(self.contain...
def __register(self, client_id, client_secret, email, scope, first_name, last_name, original_ip, original_device, **kwargs): """Call documentation: `/user/register <https://www.wepay.com/developer/reference/user#register>`_, plus extra keyword parameter: :keyw...
def function[__register, parameter[self, client_id, client_secret, email, scope, first_name, last_name, original_ip, original_device]]: constant[Call documentation: `/user/register <https://www.wepay.com/developer/reference/user#register>`_, plus extra keyword parameter: :keywor...
keyword[def] identifier[__register] ( identifier[self] , identifier[client_id] , identifier[client_secret] , identifier[email] , identifier[scope] , identifier[first_name] , identifier[last_name] , identifier[original_ip] , identifier[original_device] ,** identifier[kwargs] ): literal[string] iden...
def __register(self, client_id, client_secret, email, scope, first_name, last_name, original_ip, original_device, **kwargs): """Call documentation: `/user/register <https://www.wepay.com/developer/reference/user#register>`_, plus extra keyword parameter: :keyword bool batch_mode: tu...
def make_a_call(self, number: int or str = 18268237856) -> None: '''Make a call.''' self.app_start_action(Actions.CALL, '-d', 'tel:{}'.format(str(number)))
def function[make_a_call, parameter[self, number]]: constant[Make a call.] call[name[self].app_start_action, parameter[name[Actions].CALL, constant[-d], call[constant[tel:{}].format, parameter[call[name[str], parameter[name[number]]]]]]]
keyword[def] identifier[make_a_call] ( identifier[self] , identifier[number] : identifier[int] keyword[or] identifier[str] = literal[int] )-> keyword[None] : literal[string] identifier[self] . identifier[app_start_action] ( identifier[Actions] . identifier[CALL] , literal[string] , literal[string...
def make_a_call(self, number: int or str=18268237856) -> None: """Make a call.""" self.app_start_action(Actions.CALL, '-d', 'tel:{}'.format(str(number)))
def safe_getattr(brain_or_object, attr, default=_marker): """Return the attribute value :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param attr: Attribute name :type attr: str :returns: Attribute value ...
def function[safe_getattr, parameter[brain_or_object, attr, default]]: constant[Return the attribute value :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param attr: Attribute name :type attr: str :ret...
keyword[def] identifier[safe_getattr] ( identifier[brain_or_object] , identifier[attr] , identifier[default] = identifier[_marker] ): literal[string] keyword[try] : identifier[value] = identifier[getattr] ( identifier[brain_or_object] , identifier[attr] , identifier[_marker] ) keyword[if]...
def safe_getattr(brain_or_object, attr, default=_marker): """Return the attribute value :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param attr: Attribute name :type attr: str :returns: Attribute value ...
def install_middleware(middleware_name, lookup_names=None): """ Install specified middleware """ if lookup_names is None: lookup_names = (middleware_name,) # default settings.MIDDLEWARE is None middleware_attr = 'MIDDLEWARE' if getattr(settings, ...
def function[install_middleware, parameter[middleware_name, lookup_names]]: constant[ Install specified middleware ] if compare[name[lookup_names] is constant[None]] begin[:] variable[lookup_names] assign[=] tuple[[<ast.Name object at 0x7da1b1727880>]] variable[middleware...
keyword[def] identifier[install_middleware] ( identifier[middleware_name] , identifier[lookup_names] = keyword[None] ): literal[string] keyword[if] identifier[lookup_names] keyword[is] keyword[None] : identifier[lookup_names] =( identifier[middleware_name] ,) identifier[middleware...
def install_middleware(middleware_name, lookup_names=None): """ Install specified middleware """ if lookup_names is None: lookup_names = (middleware_name,) # depends on [control=['if'], data=['lookup_names']] # default settings.MIDDLEWARE is None middleware_attr = 'MIDDLEWARE' if getatt...
def nice_output(self): """Return a string for printing""" dates = [ str_format('Opening Day {0}: {1}.', [self.year, date_format(self.first_date_seas)]), str_format('Last day of the 1st half: {0}.', [date_format(self.last_date_1sth)]),...
def function[nice_output, parameter[self]]: constant[Return a string for printing] variable[dates] assign[=] list[[<ast.Call object at 0x7da20c7c8eb0>, <ast.Call object at 0x7da20c7c8cd0>, <ast.Call object at 0x7da20c7c83d0>, <ast.Call object at 0x7da20c7cb6a0>, <ast.Call object at 0x7da20c7c8940>, <ast...
keyword[def] identifier[nice_output] ( identifier[self] ): literal[string] identifier[dates] =[ identifier[str_format] ( literal[string] , [ identifier[self] . identifier[year] , identifier[date_format] ( identifier[self] . identifier[first_date_seas] )]), identifier[str_f...
def nice_output(self): """Return a string for printing""" dates = [str_format('Opening Day {0}: {1}.', [self.year, date_format(self.first_date_seas)]), str_format('Last day of the 1st half: {0}.', [date_format(self.last_date_1sth)]), str_format('{0} All Star Game: {1}.', [self.year, date_format(self.all_star_da...
def avg(self): """return the mean value""" # XXX rename this method if len(self.values) > 0: return sum(self.values) / float(len(self.values)) else: return None
def function[avg, parameter[self]]: constant[return the mean value] if compare[call[name[len], parameter[name[self].values]] greater[>] constant[0]] begin[:] return[binary_operation[call[name[sum], parameter[name[self].values]] / call[name[float], parameter[call[name[len], parameter[name[self].v...
keyword[def] identifier[avg] ( identifier[self] ): literal[string] keyword[if] identifier[len] ( identifier[self] . identifier[values] )> literal[int] : keyword[return] identifier[sum] ( identifier[self] . identifier[values] )/ identifier[float] ( identifier[len] ( identifie...
def avg(self): """return the mean value""" # XXX rename this method if len(self.values) > 0: return sum(self.values) / float(len(self.values)) # depends on [control=['if'], data=[]] else: return None
def lookup_users(self, user_ids=None, screen_names=None, include_entities=None, tweet_mode=None): """ Perform bulk look up of users from user ID or screen_name """ post_data = {} if include_entities is not None: include_entities = 'true' if include_entities else 'false' p...
def function[lookup_users, parameter[self, user_ids, screen_names, include_entities, tweet_mode]]: constant[ Perform bulk look up of users from user ID or screen_name ] variable[post_data] assign[=] dictionary[[], []] if compare[name[include_entities] is_not constant[None]] begin[:] ...
keyword[def] identifier[lookup_users] ( identifier[self] , identifier[user_ids] = keyword[None] , identifier[screen_names] = keyword[None] , identifier[include_entities] = keyword[None] , identifier[tweet_mode] = keyword[None] ): literal[string] identifier[post_data] ={} keyword[if] ident...
def lookup_users(self, user_ids=None, screen_names=None, include_entities=None, tweet_mode=None): """ Perform bulk look up of users from user ID or screen_name """ post_data = {} if include_entities is not None: include_entities = 'true' if include_entities else 'false' post_data['include_en...
def _modify_relationship(relationship, unlink=False, is_sub=False): """Return a function for relationship modification. Used to support friending (user-to-user), as well as moderating, contributor creating, and banning (user-to-subreddit). """ # The API uses friend and unfriend to manage all of th...
def function[_modify_relationship, parameter[relationship, unlink, is_sub]]: constant[Return a function for relationship modification. Used to support friending (user-to-user), as well as moderating, contributor creating, and banning (user-to-subreddit). ] variable[url_key] assign[=] <ast....
keyword[def] identifier[_modify_relationship] ( identifier[relationship] , identifier[unlink] = keyword[False] , identifier[is_sub] = keyword[False] ): literal[string] identifier[url_key] = literal[string] keyword[if] identifier[unlink] keyword[else] literal[string] keyword[if] identifier[...
def _modify_relationship(relationship, unlink=False, is_sub=False): """Return a function for relationship modification. Used to support friending (user-to-user), as well as moderating, contributor creating, and banning (user-to-subreddit). """ # The API uses friend and unfriend to manage all of th...
def handle_prep(self, req): """Handles the POST v2/.prep call for preparing the backing store Swift cluster for use with the auth subsystem. Can only be called by .super_admin. :param req: The swob.Request to process. :returns: swob.Response, 204 on success """ i...
def function[handle_prep, parameter[self, req]]: constant[Handles the POST v2/.prep call for preparing the backing store Swift cluster for use with the auth subsystem. Can only be called by .super_admin. :param req: The swob.Request to process. :returns: swob.Response, 204 on su...
keyword[def] identifier[handle_prep] ( identifier[self] , identifier[req] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[is_super_admin] ( identifier[req] ): keyword[return] identifier[self] . identifier[denied_response] ( identifier[req] ) identi...
def handle_prep(self, req): """Handles the POST v2/.prep call for preparing the backing store Swift cluster for use with the auth subsystem. Can only be called by .super_admin. :param req: The swob.Request to process. :returns: swob.Response, 204 on success """ if not se...
def _unregister_lookup(cls, lookup, lookup_name=None): """ Remove given lookup from cls lookups. For use in tests only as it's not thread-safe. """ if lookup_name is None: lookup_name = lookup.lookup_name del cls.class_lookups[lookup_name]
def function[_unregister_lookup, parameter[cls, lookup, lookup_name]]: constant[ Remove given lookup from cls lookups. For use in tests only as it's not thread-safe. ] if compare[name[lookup_name] is constant[None]] begin[:] variable[lookup_name] assign[=] name[lo...
keyword[def] identifier[_unregister_lookup] ( identifier[cls] , identifier[lookup] , identifier[lookup_name] = keyword[None] ): literal[string] keyword[if] identifier[lookup_name] keyword[is] keyword[None] : identifier[lookup_name] = identifier[lookup] . identifier[lookup_name] ...
def _unregister_lookup(cls, lookup, lookup_name=None): """ Remove given lookup from cls lookups. For use in tests only as it's not thread-safe. """ if lookup_name is None: lookup_name = lookup.lookup_name # depends on [control=['if'], data=['lookup_name']] del cls.class_look...
def send_location(self, loc, to, reply=None): """ Use this method to send point on the map. On success, the sent Message is returned. """ lat, lon = loc payload = dict(chat_id=to, reply_to_message_id=reply, latitude=lat, longitude=lon) return Me...
def function[send_location, parameter[self, loc, to, reply]]: constant[ Use this method to send point on the map. On success, the sent Message is returned. ] <ast.Tuple object at 0x7da18f00c7c0> assign[=] name[loc] variable[payload] assign[=] call[name[dict], parameter[]] ...
keyword[def] identifier[send_location] ( identifier[self] , identifier[loc] , identifier[to] , identifier[reply] = keyword[None] ): literal[string] identifier[lat] , identifier[lon] = identifier[loc] identifier[payload] = identifier[dict] ( identifier[chat_id] = identifier[to] , identifie...
def send_location(self, loc, to, reply=None): """ Use this method to send point on the map. On success, the sent Message is returned. """ (lat, lon) = loc payload = dict(chat_id=to, reply_to_message_id=reply, latitude=lat, longitude=lon) return Message.from_api(api, **self._get('send...
def __load(self): """ Loads dynamically the class that acts like a namespace for constants. """ parts = self.__class_name.split('.') module_name = ".".join(parts[:-1]) module = __import__(module_name) modules = [] for comp in parts[1:]: module ...
def function[__load, parameter[self]]: constant[ Loads dynamically the class that acts like a namespace for constants. ] variable[parts] assign[=] call[name[self].__class_name.split, parameter[constant[.]]] variable[module_name] assign[=] call[constant[.].join, parameter[call[nam...
keyword[def] identifier[__load] ( identifier[self] ): literal[string] identifier[parts] = identifier[self] . identifier[__class_name] . identifier[split] ( literal[string] ) identifier[module_name] = literal[string] . identifier[join] ( identifier[parts] [:- literal[int] ]) identi...
def __load(self): """ Loads dynamically the class that acts like a namespace for constants. """ parts = self.__class_name.split('.') module_name = '.'.join(parts[:-1]) module = __import__(module_name) modules = [] for comp in parts[1:]: module = getattr(module, comp) ...
def child(self, **kwargs): '''set childSelector.''' return AutomatorDeviceObject( self.device, self.selector.clone().child(**kwargs) )
def function[child, parameter[self]]: constant[set childSelector.] return[call[name[AutomatorDeviceObject], parameter[name[self].device, call[call[name[self].selector.clone, parameter[]].child, parameter[]]]]]
keyword[def] identifier[child] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[AutomatorDeviceObject] ( identifier[self] . identifier[device] , identifier[self] . identifier[selector] . identifier[clone] (). identifier[child] (** identifier...
def child(self, **kwargs): """set childSelector.""" return AutomatorDeviceObject(self.device, self.selector.clone().child(**kwargs))
def print_trip_table(document): """ Print trip table """ headers = [ 'Alt.', 'Name', 'Time', 'Track', 'Direction', 'Dest.', 'Track', 'Arrival'] table = [] altnr = 0 for alternative in document: altnr += 1 first_trip_in_a...
def function[print_trip_table, parameter[document]]: constant[ Print trip table ] variable[headers] assign[=] list[[<ast.Constant object at 0x7da18c4cfaf0>, <ast.Constant object at 0x7da18c4cf8e0>, <ast.Constant object at 0x7da18c4cfe80>, <ast.Constant object at 0x7da18c4ccf70>, <ast.Constant object at ...
keyword[def] identifier[print_trip_table] ( identifier[document] ): literal[string] identifier[headers] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ] identifier[...
def print_trip_table(document): """ Print trip table """ headers = ['Alt.', 'Name', 'Time', 'Track', 'Direction', 'Dest.', 'Track', 'Arrival'] table = [] altnr = 0 for alternative in document: altnr += 1 first_trip_in_alt = True if not isinstance(alternative['Leg'], list): ...
def pst_prior(pst,logger=None, filename=None, **kwargs): """ helper to plot prior parameter histograms implied by parameter bounds. Saves a multipage pdf named <case>.prior.pdf Parameters ---------- pst : pyemu.Pst logger : pyemu.Logger filename : str PDF filename to save plots to. ...
def function[pst_prior, parameter[pst, logger, filename]]: constant[ helper to plot prior parameter histograms implied by parameter bounds. Saves a multipage pdf named <case>.prior.pdf Parameters ---------- pst : pyemu.Pst logger : pyemu.Logger filename : str PDF filename to sav...
keyword[def] identifier[pst_prior] ( identifier[pst] , identifier[logger] = keyword[None] , identifier[filename] = keyword[None] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[logger] keyword[is] keyword[None] : identifier[logger] = identifier[Logger] ( literal[string] , ident...
def pst_prior(pst, logger=None, filename=None, **kwargs): """ helper to plot prior parameter histograms implied by parameter bounds. Saves a multipage pdf named <case>.prior.pdf Parameters ---------- pst : pyemu.Pst logger : pyemu.Logger filename : str PDF filename to save plots to....
def generate_menu(self, ass, text, path=None, level=0): """ Function generates menu from based on ass parameter """ menu = self.create_menu() for index, sub in enumerate(sorted(ass[1], key=lambda y: y[0].fullname.lower())): if index != 0: text += "|" ...
def function[generate_menu, parameter[self, ass, text, path, level]]: constant[ Function generates menu from based on ass parameter ] variable[menu] assign[=] call[name[self].create_menu, parameter[]] for taget[tuple[[<ast.Name object at 0x7da1b0f0d7b0>, <ast.Name object at 0x7da...
keyword[def] identifier[generate_menu] ( identifier[self] , identifier[ass] , identifier[text] , identifier[path] = keyword[None] , identifier[level] = literal[int] ): literal[string] identifier[menu] = identifier[self] . identifier[create_menu] () keyword[for] identifier[index] , identif...
def generate_menu(self, ass, text, path=None, level=0): """ Function generates menu from based on ass parameter """ menu = self.create_menu() for (index, sub) in enumerate(sorted(ass[1], key=lambda y: y[0].fullname.lower())): if index != 0: text += '|' # depends on [cont...
def GetServiceVersions(namespace): """ Get all the versions for the service with specified namespace (partially) ordered by compatibility (i.e. any version in the list that is compatible with some version v in the list will preceed v) """ def compare(a, b): if a == b: return 0 if ...
def function[GetServiceVersions, parameter[namespace]]: constant[ Get all the versions for the service with specified namespace (partially) ordered by compatibility (i.e. any version in the list that is compatible with some version v in the list will preceed v) ] def function[compare, parame...
keyword[def] identifier[GetServiceVersions] ( identifier[namespace] ): literal[string] keyword[def] identifier[compare] ( identifier[a] , identifier[b] ): keyword[if] identifier[a] == identifier[b] : keyword[return] literal[int] keyword[if] identifier[b] keyword[in] identifier[...
def GetServiceVersions(namespace): """ Get all the versions for the service with specified namespace (partially) ordered by compatibility (i.e. any version in the list that is compatible with some version v in the list will preceed v) """ def compare(a, b): if a == b: return 0 ...
def post_register_hook(self, verbosity=1): """Pull Docker images needed by processes after registering.""" if not getattr(settings, 'FLOW_DOCKER_DONT_PULL', False): call_command('list_docker_images', pull=True, verbosity=verbosity)
def function[post_register_hook, parameter[self, verbosity]]: constant[Pull Docker images needed by processes after registering.] if <ast.UnaryOp object at 0x7da18bccb8b0> begin[:] call[name[call_command], parameter[constant[list_docker_images]]]
keyword[def] identifier[post_register_hook] ( identifier[self] , identifier[verbosity] = literal[int] ): literal[string] keyword[if] keyword[not] identifier[getattr] ( identifier[settings] , literal[string] , keyword[False] ): identifier[call_command] ( literal[string] , identifier[p...
def post_register_hook(self, verbosity=1): """Pull Docker images needed by processes after registering.""" if not getattr(settings, 'FLOW_DOCKER_DONT_PULL', False): call_command('list_docker_images', pull=True, verbosity=verbosity) # depends on [control=['if'], data=[]]
def build(self) -> type: """ Build a subclass of `MappingJSONEncoder`. :return: the built subclass """ def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]: return _get_all_property_mappings(encoder, self.mappings, self.superclasses) ...
def function[build, parameter[self]]: constant[ Build a subclass of `MappingJSONEncoder`. :return: the built subclass ] def function[_get_property_mappings, parameter[encoder]]: return[call[name[_get_all_property_mappings], parameter[name[encoder], name[self].mappings, na...
keyword[def] identifier[build] ( identifier[self] )-> identifier[type] : literal[string] keyword[def] identifier[_get_property_mappings] ( identifier[encoder] : identifier[MappingJSONEncoder] )-> identifier[List] [ identifier[JsonPropertyMapping] ]: keyword[return] identifier[_get_al...
def build(self) -> type: """ Build a subclass of `MappingJSONEncoder`. :return: the built subclass """ def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]: return _get_all_property_mappings(encoder, self.mappings, self.superclasses) def get_...
def convertIndexToState(index): """Convert transition probability matrix index to state parameters. Parameters ---------- index : int The index into the transition probability matrix that corresponds to the state parameters. Returns ------- population, fire : tuple ...
def function[convertIndexToState, parameter[index]]: constant[Convert transition probability matrix index to state parameters. Parameters ---------- index : int The index into the transition probability matrix that corresponds to the state parameters. Returns ------...
keyword[def] identifier[convertIndexToState] ( identifier[index] ): literal[string] keyword[assert] identifier[index] < identifier[STATES] identifier[population] = identifier[index] // identifier[FIRE_CLASSES] identifier[fire] = identifier[index] % identifier[FIRE_CLASSES] keyword[return...
def convertIndexToState(index): """Convert transition probability matrix index to state parameters. Parameters ---------- index : int The index into the transition probability matrix that corresponds to the state parameters. Returns ------- population, fire : tuple ...
def __flip(self, sliceimg): """ Flip if asked in self.flipV or self.flipH :param sliceimg: one image slice :return: flipp """ if self.flipH: sliceimg = sliceimg[:, -1:0:-1] if self.flipV: sliceimg = sliceimg [-1:0:-1,:] ...
def function[__flip, parameter[self, sliceimg]]: constant[ Flip if asked in self.flipV or self.flipH :param sliceimg: one image slice :return: flipp ] if name[self].flipH begin[:] variable[sliceimg] assign[=] call[name[sliceimg]][tuple[[<ast.Slice object a...
keyword[def] identifier[__flip] ( identifier[self] , identifier[sliceimg] ): literal[string] keyword[if] identifier[self] . identifier[flipH] : identifier[sliceimg] = identifier[sliceimg] [:,- literal[int] : literal[int] :- literal[int] ] keyword[if] identifier[self] ....
def __flip(self, sliceimg): """ Flip if asked in self.flipV or self.flipH :param sliceimg: one image slice :return: flipp """ if self.flipH: sliceimg = sliceimg[:, -1:0:-1] # depends on [control=['if'], data=[]] if self.flipV: sliceimg = sliceimg[-1:0:-1, :] ...
def get_vertices_to_edges_matrix(self, want_xyz=True): """Returns a matrix M, which if multiplied by vertices, gives back edges (so "e = M.dot(v)"). Note that this generates one edge per edge, *not* two edges per triangle. Args: want_xyz: if true, takes and returns xyz coord...
def function[get_vertices_to_edges_matrix, parameter[self, want_xyz]]: constant[Returns a matrix M, which if multiplied by vertices, gives back edges (so "e = M.dot(v)"). Note that this generates one edge per edge, *not* two edges per triangle. Args: want_xyz: if true, takes...
keyword[def] identifier[get_vertices_to_edges_matrix] ( identifier[self] , identifier[want_xyz] = keyword[True] ): literal[string] keyword[import] identifier[numpy] keyword[as] identifier[np] keyword[import] identifier[scipy] . identifier[sparse] keyword[as] identifier[sp] ...
def get_vertices_to_edges_matrix(self, want_xyz=True): """Returns a matrix M, which if multiplied by vertices, gives back edges (so "e = M.dot(v)"). Note that this generates one edge per edge, *not* two edges per triangle. Args: want_xyz: if true, takes and returns xyz coordinat...
def generate_func_code_block(self, definition, variable, variable_name, clear_variables=False): """ Creates validation rules for current definition. """ backup = self._definition, self._variable, self._variable_name self._definition, self._variable, self._variable_name = definiti...
def function[generate_func_code_block, parameter[self, definition, variable, variable_name, clear_variables]]: constant[ Creates validation rules for current definition. ] variable[backup] assign[=] tuple[[<ast.Attribute object at 0x7da207f9b490>, <ast.Attribute object at 0x7da207f999c0>...
keyword[def] identifier[generate_func_code_block] ( identifier[self] , identifier[definition] , identifier[variable] , identifier[variable_name] , identifier[clear_variables] = keyword[False] ): literal[string] identifier[backup] = identifier[self] . identifier[_definition] , identifier[self] . ide...
def generate_func_code_block(self, definition, variable, variable_name, clear_variables=False): """ Creates validation rules for current definition. """ backup = (self._definition, self._variable, self._variable_name) (self._definition, self._variable, self._variable_name) = (definition, var...
def get_injuries_by_team(self, season, week, team_id): """ Injuries by week and team """ result = self._method_call("Injuries/{season}/{week}/{team_id}", "stats", season=season, week=week, team_id=team_id) return result
def function[get_injuries_by_team, parameter[self, season, week, team_id]]: constant[ Injuries by week and team ] variable[result] assign[=] call[name[self]._method_call, parameter[constant[Injuries/{season}/{week}/{team_id}], constant[stats]]] return[name[result]]
keyword[def] identifier[get_injuries_by_team] ( identifier[self] , identifier[season] , identifier[week] , identifier[team_id] ): literal[string] identifier[result] = identifier[self] . identifier[_method_call] ( literal[string] , literal[string] , identifier[season] = identifier[season] , identifi...
def get_injuries_by_team(self, season, week, team_id): """ Injuries by week and team """ result = self._method_call('Injuries/{season}/{week}/{team_id}', 'stats', season=season, week=week, team_id=team_id) return result
def get_argument_topology(self): """ Helper function to get topology argument. Raises exception if argument is missing. Returns the topology argument. """ try: topology = self.get_argument(constants.PARAM_TOPOLOGY) return topology except tornado.web.MissingArgumentError as e: ...
def function[get_argument_topology, parameter[self]]: constant[ Helper function to get topology argument. Raises exception if argument is missing. Returns the topology argument. ] <ast.Try object at 0x7da20c76dbd0>
keyword[def] identifier[get_argument_topology] ( identifier[self] ): literal[string] keyword[try] : identifier[topology] = identifier[self] . identifier[get_argument] ( identifier[constants] . identifier[PARAM_TOPOLOGY] ) keyword[return] identifier[topology] keyword[except] identifier...
def get_argument_topology(self): """ Helper function to get topology argument. Raises exception if argument is missing. Returns the topology argument. """ try: topology = self.get_argument(constants.PARAM_TOPOLOGY) return topology # depends on [control=['try'], data=[]] exce...
def build_policy(self, name, statements, roles, is_managed_policy=False): """ Generate policy for IAM cloudformation template :param name: Name of the policy :param statements: The "rules" the policy should have :param roles: The roles associated with this policy :param i...
def function[build_policy, parameter[self, name, statements, roles, is_managed_policy]]: constant[ Generate policy for IAM cloudformation template :param name: Name of the policy :param statements: The "rules" the policy should have :param roles: The roles associated with this po...
keyword[def] identifier[build_policy] ( identifier[self] , identifier[name] , identifier[statements] , identifier[roles] , identifier[is_managed_policy] = keyword[False] ): literal[string] keyword[if] identifier[is_managed_policy] : identifier[policy] = identifier[ManagedPolicy] ( ...
def build_policy(self, name, statements, roles, is_managed_policy=False): """ Generate policy for IAM cloudformation template :param name: Name of the policy :param statements: The "rules" the policy should have :param roles: The roles associated with this policy :param is_ma...
def get_summary(url, spk=True): ''' simple function to retrieve the header of a BSP file and return SPK object''' # connect to file at URL bspurl = urllib2.urlopen(url) # retrieve the "tip" of a file at URL bsptip = bspurl.read(10**5) # first 100kB # save data in fake file object (in-memory) ...
def function[get_summary, parameter[url, spk]]: constant[ simple function to retrieve the header of a BSP file and return SPK object] variable[bspurl] assign[=] call[name[urllib2].urlopen, parameter[name[url]]] variable[bsptip] assign[=] call[name[bspurl].read, parameter[binary_operation[constan...
keyword[def] identifier[get_summary] ( identifier[url] , identifier[spk] = keyword[True] ): literal[string] identifier[bspurl] = identifier[urllib2] . identifier[urlopen] ( identifier[url] ) identifier[bsptip] = identifier[bspurl] . identifier[read] ( literal[int] ** literal[int] ) ...
def get_summary(url, spk=True): """ simple function to retrieve the header of a BSP file and return SPK object""" # connect to file at URL bspurl = urllib2.urlopen(url) # retrieve the "tip" of a file at URL bsptip = bspurl.read(10 ** 5) # first 100kB # save data in fake file object (in-memory) ...
def validate_mandatory_str_fields(self, messages): """Fields marked as Mandatory and of type string in class docstring must be of a type that provides __str__ method. """ FIELDS = ['name', 'download_location', 'verif_code', 'cr_text'] messages = self.validate_str_fields(FIELDS, F...
def function[validate_mandatory_str_fields, parameter[self, messages]]: constant[Fields marked as Mandatory and of type string in class docstring must be of a type that provides __str__ method. ] variable[FIELDS] assign[=] list[[<ast.Constant object at 0x7da1b0137460>, <ast.Constant obje...
keyword[def] identifier[validate_mandatory_str_fields] ( identifier[self] , identifier[messages] ): literal[string] identifier[FIELDS] =[ literal[string] , literal[string] , literal[string] , literal[string] ] identifier[messages] = identifier[self] . identifier[validate_str_fields] ( iden...
def validate_mandatory_str_fields(self, messages): """Fields marked as Mandatory and of type string in class docstring must be of a type that provides __str__ method. """ FIELDS = ['name', 'download_location', 'verif_code', 'cr_text'] messages = self.validate_str_fields(FIELDS, False, messag...
def provision(self, conf): """Provision this metaconfig's config with what we gathered. Since Config has native support for ini files, we just need to let this metaconfig's config know about the ini file we found. In future scenarios, this is where we would implement logic spec...
def function[provision, parameter[self, conf]]: constant[Provision this metaconfig's config with what we gathered. Since Config has native support for ini files, we just need to let this metaconfig's config know about the ini file we found. In future scenarios, this is where we would i...
keyword[def] identifier[provision] ( identifier[self] , identifier[conf] ): literal[string] keyword[if] identifier[self] . identifier[ini] keyword[and] identifier[self] . identifier[ini] keyword[not] keyword[in] identifier[conf] . identifier[_ini_paths] : identifier[conf] . ident...
def provision(self, conf): """Provision this metaconfig's config with what we gathered. Since Config has native support for ini files, we just need to let this metaconfig's config know about the ini file we found. In future scenarios, this is where we would implement logic specific...
def average(a, b, distance_function): """ Given two collections ``a`` and ``b``, this will return the mean of all distances. ``distance_function`` is used to determine the distance between two elements. Example:: >>> single([1, 2], [3, 100], lambda x, y: abs(x-y)) 26 """ di...
def function[average, parameter[a, b, distance_function]]: constant[ Given two collections ``a`` and ``b``, this will return the mean of all distances. ``distance_function`` is used to determine the distance between two elements. Example:: >>> single([1, 2], [3, 100], lambda x, y: abs(...
keyword[def] identifier[average] ( identifier[a] , identifier[b] , identifier[distance_function] ): literal[string] identifier[distances] =[ identifier[distance_function] ( identifier[x] , identifier[y] ) keyword[for] identifier[x] keyword[in] identifier[a] keyword[for] identifier[y] keyword[in]...
def average(a, b, distance_function): """ Given two collections ``a`` and ``b``, this will return the mean of all distances. ``distance_function`` is used to determine the distance between two elements. Example:: >>> single([1, 2], [3, 100], lambda x, y: abs(x-y)) 26 """ di...
def entropy(self, logits): """ Categorical distribution entropy calculation - sum probs * log(probs) """ probs = torch.exp(logits) entropy = - torch.sum(probs * logits, dim=-1) return entropy
def function[entropy, parameter[self, logits]]: constant[ Categorical distribution entropy calculation - sum probs * log(probs) ] variable[probs] assign[=] call[name[torch].exp, parameter[name[logits]]] variable[entropy] assign[=] <ast.UnaryOp object at 0x7da2043456c0> return[name[entropy]]
keyword[def] identifier[entropy] ( identifier[self] , identifier[logits] ): literal[string] identifier[probs] = identifier[torch] . identifier[exp] ( identifier[logits] ) identifier[entropy] =- identifier[torch] . identifier[sum] ( identifier[probs] * identifier[logits] , identifier[dim] =...
def entropy(self, logits): """ Categorical distribution entropy calculation - sum probs * log(probs) """ probs = torch.exp(logits) entropy = -torch.sum(probs * logits, dim=-1) return entropy
def traverse(self, fn=None, specs=None, full_breadth=True): """Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args: ...
def function[traverse, parameter[self, fn, specs, full_breadth]]: constant[Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args...
keyword[def] identifier[traverse] ( identifier[self] , identifier[fn] = keyword[None] , identifier[specs] = keyword[None] , identifier[full_breadth] = keyword[True] ): literal[string] keyword[if] identifier[fn] keyword[is] keyword[None] : identifier[fn] = keyword[lambda] identifier...
def traverse(self, fn=None, specs=None, full_breadth=True): """Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args: fn...
def lx(mt, x): """ lx : Returns the number of survivors at begining of age x """ if x < len(mt.lx): return mt.lx[x] else: return 0
def function[lx, parameter[mt, x]]: constant[ lx : Returns the number of survivors at begining of age x ] if compare[name[x] less[<] call[name[len], parameter[name[mt].lx]]] begin[:] return[call[name[mt].lx][name[x]]]
keyword[def] identifier[lx] ( identifier[mt] , identifier[x] ): literal[string] keyword[if] identifier[x] < identifier[len] ( identifier[mt] . identifier[lx] ): keyword[return] identifier[mt] . identifier[lx] [ identifier[x] ] keyword[else] : keyword[return] literal[int]
def lx(mt, x): """ lx : Returns the number of survivors at begining of age x """ if x < len(mt.lx): return mt.lx[x] # depends on [control=['if'], data=['x']] else: return 0
def _print_count(log): r"""Print run-count information.""" log['cnt2'] += 1 # Current number cp = log['cnt2']/log['totnr']*100 # Percentage if log['cnt2'] == 0: # Not sure about this; brute seems to call the pass # function with the first arguments twice... ...
def function[_print_count, parameter[log]]: constant[Print run-count information.] <ast.AugAssign object at 0x7da18f811630> variable[cp] assign[=] binary_operation[binary_operation[call[name[log]][constant[cnt2]] / call[name[log]][constant[totnr]]] * constant[100]] if compare[call[name[log]]...
keyword[def] identifier[_print_count] ( identifier[log] ): literal[string] identifier[log] [ literal[string] ]+= literal[int] identifier[cp] = identifier[log] [ literal[string] ]/ identifier[log] [ literal[string] ]* literal[int] keyword[if] identifier[log] [ literal[string] ]== literal[int] ...
def _print_count(log): """Print run-count information.""" log['cnt2'] += 1 # Current number cp = log['cnt2'] / log['totnr'] * 100 # Percentage if log['cnt2'] == 0: # Not sure about this; brute seems to call the pass # function with the first arguments twice... # depends on [control=['if'], ...
def notify(title, message, icon=icon.ico, retcode=None): """ Optional parameters: * ``icon`` - path to an ICO file to display instead of the ntfy icon """ import win32api import win32con import win32gui class WindowsBalloonTip: def __init__(self, title, msg): me...
def function[notify, parameter[title, message, icon, retcode]]: constant[ Optional parameters: * ``icon`` - path to an ICO file to display instead of the ntfy icon ] import module[win32api] import module[win32con] import module[win32gui] class class[WindowsBalloonTip, paramet...
keyword[def] identifier[notify] ( identifier[title] , identifier[message] , identifier[icon] = identifier[icon] . identifier[ico] , identifier[retcode] = keyword[None] ): literal[string] keyword[import] identifier[win32api] keyword[import] identifier[win32con] keyword[import] identifier[win...
def notify(title, message, icon=icon.ico, retcode=None): """ Optional parameters: * ``icon`` - path to an ICO file to display instead of the ntfy icon """ import win32api import win32con import win32gui class WindowsBalloonTip: def __init__(self, title, msg): me...
def register_signals(self): """Register signals.""" from .models import Collection from .receivers import CollectionUpdater if self.app.config['COLLECTIONS_USE_PERCOLATOR']: from .percolator import collection_inserted_percolator, \ collection_removed_percolat...
def function[register_signals, parameter[self]]: constant[Register signals.] from relative_module[models] import module[Collection] from relative_module[receivers] import module[CollectionUpdater] if call[name[self].app.config][constant[COLLECTIONS_USE_PERCOLATOR]] begin[:] from relative...
keyword[def] identifier[register_signals] ( identifier[self] ): literal[string] keyword[from] . identifier[models] keyword[import] identifier[Collection] keyword[from] . identifier[receivers] keyword[import] identifier[CollectionUpdater] keyword[if] identifier[self] . iden...
def register_signals(self): """Register signals.""" from .models import Collection from .receivers import CollectionUpdater if self.app.config['COLLECTIONS_USE_PERCOLATOR']: from .percolator import collection_inserted_percolator, collection_removed_percolator, collection_updated_percolator ...
def send_notification(self, code, subcode): """Utility to send notification message. Closes the socket after sending the message. :Parameters: - `socket`: (socket) - socket over which to send notification message. - `code`: (int) - BGP Notification code ...
def function[send_notification, parameter[self, code, subcode]]: constant[Utility to send notification message. Closes the socket after sending the message. :Parameters: - `socket`: (socket) - socket over which to send notification message. - `code`: (int) -...
keyword[def] identifier[send_notification] ( identifier[self] , identifier[code] , identifier[subcode] ): literal[string] identifier[notification] = identifier[BGPNotification] ( identifier[code] , identifier[subcode] ) identifier[reason] = identifier[notification] . identifier[reason] ...
def send_notification(self, code, subcode): """Utility to send notification message. Closes the socket after sending the message. :Parameters: - `socket`: (socket) - socket over which to send notification message. - `code`: (int) - BGP Notification code ...
def full_domain_validator(hostname): """ Fully validates a domain name as compilant with the standard rules: - Composed of series of labels concatenated with dots, as are all domain names. - Each label must be between 1 and 63 characters long. - The entire hostname (including the delimit...
def function[full_domain_validator, parameter[hostname]]: constant[ Fully validates a domain name as compilant with the standard rules: - Composed of series of labels concatenated with dots, as are all domain names. - Each label must be between 1 and 63 characters long. - The entire ...
keyword[def] identifier[full_domain_validator] ( identifier[hostname] ): literal[string] identifier[HOSTNAME_LABEL_PATTERN] = identifier[re] . identifier[compile] ( literal[string] , identifier[re] . identifier[IGNORECASE] ) keyword[if] keyword[not] identifier[hostname] : keyword[return] ...
def full_domain_validator(hostname): """ Fully validates a domain name as compilant with the standard rules: - Composed of series of labels concatenated with dots, as are all domain names. - Each label must be between 1 and 63 characters long. - The entire hostname (including the delimit...
def _prepend_schema_name(self, message): """ If a custom schema name has been defined, prepends it to the error message that gets raised when a schema error occurs. """ if self._name: message = "{0!r} {1!s}".format(self._name, message) return message
def function[_prepend_schema_name, parameter[self, message]]: constant[ If a custom schema name has been defined, prepends it to the error message that gets raised when a schema error occurs. ] if name[self]._name begin[:] variable[message] assign[=] call[constant...
keyword[def] identifier[_prepend_schema_name] ( identifier[self] , identifier[message] ): literal[string] keyword[if] identifier[self] . identifier[_name] : identifier[message] = literal[string] . identifier[format] ( identifier[self] . identifier[_name] , identifier[message] ) ...
def _prepend_schema_name(self, message): """ If a custom schema name has been defined, prepends it to the error message that gets raised when a schema error occurs. """ if self._name: message = '{0!r} {1!s}'.format(self._name, message) # depends on [control=['if'], data=[]] ...
def _get_redis_server(opts=None): ''' Return the Redis server instance. Caching the object instance. ''' global REDIS_SERVER if REDIS_SERVER: return REDIS_SERVER if not opts: opts = _get_redis_cache_opts() if opts['cluster_mode']: REDIS_SERVER = StrictRedisCluste...
def function[_get_redis_server, parameter[opts]]: constant[ Return the Redis server instance. Caching the object instance. ] <ast.Global object at 0x7da1b2184580> if name[REDIS_SERVER] begin[:] return[name[REDIS_SERVER]] if <ast.UnaryOp object at 0x7da1b2185ea0> begin[:] ...
keyword[def] identifier[_get_redis_server] ( identifier[opts] = keyword[None] ): literal[string] keyword[global] identifier[REDIS_SERVER] keyword[if] identifier[REDIS_SERVER] : keyword[return] identifier[REDIS_SERVER] keyword[if] keyword[not] identifier[opts] : identifier...
def _get_redis_server(opts=None): """ Return the Redis server instance. Caching the object instance. """ global REDIS_SERVER if REDIS_SERVER: return REDIS_SERVER # depends on [control=['if'], data=[]] if not opts: opts = _get_redis_cache_opts() # depends on [control=['if'],...
def validate_key(self, activation_key): """ Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or raising ``ActivationError`` if not. """ try: username = signing.loads( acti...
def function[validate_key, parameter[self, activation_key]]: constant[ Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or raising ``ActivationError`` if not. ] <ast.Try object at 0x7da20cabce80>
keyword[def] identifier[validate_key] ( identifier[self] , identifier[activation_key] ): literal[string] keyword[try] : identifier[username] = identifier[signing] . identifier[loads] ( identifier[activation_key] , identifier[salt] = identifier[REGISTRATION_SAL...
def validate_key(self, activation_key): """ Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or raising ``ActivationError`` if not. """ try: username = signing.loads(activation_key, salt=REGISTRATION...
def get_current_tournaments(): """Get the next 200 tournaments from pokerstars.""" schedule_page = requests.get(TOURNAMENTS_XML_URL) root = etree.XML(schedule_page.content) for tour in root.iter('{*}tournament'): yield _Tournament( start_date=tour.findtext('{*}start_date'), ...
def function[get_current_tournaments, parameter[]]: constant[Get the next 200 tournaments from pokerstars.] variable[schedule_page] assign[=] call[name[requests].get, parameter[name[TOURNAMENTS_XML_URL]]] variable[root] assign[=] call[name[etree].XML, parameter[name[schedule_page].content]] ...
keyword[def] identifier[get_current_tournaments] (): literal[string] identifier[schedule_page] = identifier[requests] . identifier[get] ( identifier[TOURNAMENTS_XML_URL] ) identifier[root] = identifier[etree] . identifier[XML] ( identifier[schedule_page] . identifier[content] ) keyword[for] id...
def get_current_tournaments(): """Get the next 200 tournaments from pokerstars.""" schedule_page = requests.get(TOURNAMENTS_XML_URL) root = etree.XML(schedule_page.content) for tour in root.iter('{*}tournament'): yield _Tournament(start_date=tour.findtext('{*}start_date'), name=tour.findtext('{*...
def do_intersect(bb1, bb2): """ Helper function that returns True if two bounding boxes overlap. """ if bb1[0] + bb1[2] < bb2[0] or bb2[0] + bb2[2] < bb1[0]: return False if bb1[1] + bb1[3] < bb2[1] or bb2[1] + bb2[3] < bb1[1]: return False return True
def function[do_intersect, parameter[bb1, bb2]]: constant[ Helper function that returns True if two bounding boxes overlap. ] if <ast.BoolOp object at 0x7da1b13b6080> begin[:] return[constant[False]] if <ast.BoolOp object at 0x7da1b13442b0> begin[:] return[constant[False]...
keyword[def] identifier[do_intersect] ( identifier[bb1] , identifier[bb2] ): literal[string] keyword[if] identifier[bb1] [ literal[int] ]+ identifier[bb1] [ literal[int] ]< identifier[bb2] [ literal[int] ] keyword[or] identifier[bb2] [ literal[int] ]+ identifier[bb2] [ literal[int] ]< identifier[bb1] [ l...
def do_intersect(bb1, bb2): """ Helper function that returns True if two bounding boxes overlap. """ if bb1[0] + bb1[2] < bb2[0] or bb2[0] + bb2[2] < bb1[0]: return False # depends on [control=['if'], data=[]] if bb1[1] + bb1[3] < bb2[1] or bb2[1] + bb2[3] < bb1[1]: return False # ...
def mime_type(instance): """Ensure the 'mime_type' property of file objects comes from the Template column in the IANA media type registry. """ mime_pattern = re.compile(r'^(application|audio|font|image|message|model' '|multipart|text|video)/[a-zA-Z0-9.+_-]+') for key, ...
def function[mime_type, parameter[instance]]: constant[Ensure the 'mime_type' property of file objects comes from the Template column in the IANA media type registry. ] variable[mime_pattern] assign[=] call[name[re].compile, parameter[constant[^(application|audio|font|image|message|model|multipa...
keyword[def] identifier[mime_type] ( identifier[instance] ): literal[string] identifier[mime_pattern] = identifier[re] . identifier[compile] ( literal[string] literal[string] ) keyword[for] identifier[key] , identifier[obj] keyword[in] identifier[instance] [ literal[string] ]. identifier[item...
def mime_type(instance): """Ensure the 'mime_type' property of file objects comes from the Template column in the IANA media type registry. """ mime_pattern = re.compile('^(application|audio|font|image|message|model|multipart|text|video)/[a-zA-Z0-9.+_-]+') for (key, obj) in instance['objects'].items...
def _get_updated_rows(self, auth, function): """ Get rows updated by last update query * `function` [function] Function to use for searching (one of the search_* functions). Helper function used to fetch all rows which was updated by the latest UPDATE ... RE...
def function[_get_updated_rows, parameter[self, auth, function]]: constant[ Get rows updated by last update query * `function` [function] Function to use for searching (one of the search_* functions). Helper function used to fetch all rows which was updated by the ...
keyword[def] identifier[_get_updated_rows] ( identifier[self] , identifier[auth] , identifier[function] ): literal[string] identifier[qps] =[] keyword[for] identifier[row] keyword[in] identifier[self] . identifier[_curs_pg] : identifier[...
def _get_updated_rows(self, auth, function): """ Get rows updated by last update query * `function` [function] Function to use for searching (one of the search_* functions). Helper function used to fetch all rows which was updated by the latest UPDATE ... RETURN...
def t_binaryValue(t): r'[+-]?[0-9]+[bB]' # We must match [0-9], and then check the validity of the binary number. # If we match [0-1], the invalid binary number "2b" would match # 'decimalValue' 2 and 'IDENTIFIER 'b'. if re.search(r'[2-9]', t.value) is not None: msg = _format("Invalid binary...
def function[t_binaryValue, parameter[t]]: constant[[+-]?[0-9]+[bB]] if compare[call[name[re].search, parameter[constant[[2-9]], name[t].value]] is_not constant[None]] begin[:] variable[msg] assign[=] call[name[_format], parameter[constant[Invalid binary number {0!A}], name[t].value]] ...
keyword[def] identifier[t_binaryValue] ( identifier[t] ): literal[string] keyword[if] identifier[re] . identifier[search] ( literal[string] , identifier[t] . identifier[value] ) keyword[is] keyword[not] keyword[None] : identifier[msg] = identifier[_format] ( literal[string] , ide...
def t_binaryValue(t): """[+-]?[0-9]+[bB]""" # We must match [0-9], and then check the validity of the binary number. # If we match [0-1], the invalid binary number "2b" would match # 'decimalValue' 2 and 'IDENTIFIER 'b'. if re.search('[2-9]', t.value) is not None: msg = _format('Invalid bina...
def setAsApplication(myappid): """ Tells Windows this is an independent application with an unique icon on task bar. id is an unique string to identify this application, like: 'mycompany.myproduct.subproduct.version' """ if os.name == 'nt': import ctypes ctypes.windll.shell32.SetCu...
def function[setAsApplication, parameter[myappid]]: constant[ Tells Windows this is an independent application with an unique icon on task bar. id is an unique string to identify this application, like: 'mycompany.myproduct.subproduct.version' ] if compare[name[os].name equal[==] constant[n...
keyword[def] identifier[setAsApplication] ( identifier[myappid] ): literal[string] keyword[if] identifier[os] . identifier[name] == literal[string] : keyword[import] identifier[ctypes] identifier[ctypes] . identifier[windll] . identifier[shell32] . identifier[SetCurrentProcessExplicit...
def setAsApplication(myappid): """ Tells Windows this is an independent application with an unique icon on task bar. id is an unique string to identify this application, like: 'mycompany.myproduct.subproduct.version' """ if os.name == 'nt': import ctypes ctypes.windll.shell32.SetCur...
def _sel_to_text(self, cell_range): """Copy an array portion to a unicode string""" if not cell_range: return row_min, row_max, col_min, col_max = get_idx_rect(cell_range) if col_min == 0 and col_max == (self.model().cols_loaded-1): # we've selected a whole ...
def function[_sel_to_text, parameter[self, cell_range]]: constant[Copy an array portion to a unicode string] if <ast.UnaryOp object at 0x7da2043479a0> begin[:] return[None] <ast.Tuple object at 0x7da2043444f0> assign[=] call[name[get_idx_rect], parameter[name[cell_range]]] if <as...
keyword[def] identifier[_sel_to_text] ( identifier[self] , identifier[cell_range] ): literal[string] keyword[if] keyword[not] identifier[cell_range] : keyword[return] identifier[row_min] , identifier[row_max] , identifier[col_min] , identifier[col_max] = identifier[get_...
def _sel_to_text(self, cell_range): """Copy an array portion to a unicode string""" if not cell_range: return # depends on [control=['if'], data=[]] (row_min, row_max, col_min, col_max) = get_idx_rect(cell_range) if col_min == 0 and col_max == self.model().cols_loaded - 1: # we've selected a w...
def run(self, **kwargs): """ Run an IDF file with a given EnergyPlus weather file. This is a wrapper for the EnergyPlus command line interface. Parameters ---------- **kwargs See eppy.runner.functions.run() """ # write the IDF to the current ...
def function[run, parameter[self]]: constant[ Run an IDF file with a given EnergyPlus weather file. This is a wrapper for the EnergyPlus command line interface. Parameters ---------- **kwargs See eppy.runner.functions.run() ] call[name[self]....
keyword[def] identifier[run] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[saveas] ( literal[string] ) identifier[idd] = identifier[kwargs] . identifier[pop] ( literal[string] , identifier[self] . identifier[iddname] ) ...
def run(self, **kwargs): """ Run an IDF file with a given EnergyPlus weather file. This is a wrapper for the EnergyPlus command line interface. Parameters ---------- **kwargs See eppy.runner.functions.run() """ # write the IDF to the current director...
def as_sql(self, compiler, connection): # pylint: disable=arguments-differ """Compile SQL for this function.""" sql, params = super().as_sql(compiler, connection) params.append(self.path) return sql, params
def function[as_sql, parameter[self, compiler, connection]]: constant[Compile SQL for this function.] <ast.Tuple object at 0x7da1b19b4c40> assign[=] call[call[name[super], parameter[]].as_sql, parameter[name[compiler], name[connection]]] call[name[params].append, parameter[name[self].path]] ...
keyword[def] identifier[as_sql] ( identifier[self] , identifier[compiler] , identifier[connection] ): literal[string] identifier[sql] , identifier[params] = identifier[super] (). identifier[as_sql] ( identifier[compiler] , identifier[connection] ) identifier[params] . identifier[append] ( ...
def as_sql(self, compiler, connection): # pylint: disable=arguments-differ 'Compile SQL for this function.' (sql, params) = super().as_sql(compiler, connection) params.append(self.path) return (sql, params)
def tri_ttr(k, a): """ Custom TTR function. Triangle distribution does not have an analytical TTR function, but because of its non-smooth nature, a blind integration scheme will converge very slowly. However, by splitting the integration into two divided at the discontinuity in the derivative, ...
def function[tri_ttr, parameter[k, a]]: constant[ Custom TTR function. Triangle distribution does not have an analytical TTR function, but because of its non-smooth nature, a blind integration scheme will converge very slowly. However, by splitting the integration into two divided at the di...
keyword[def] identifier[tri_ttr] ( identifier[k] , identifier[a] ): literal[string] keyword[from] ... identifier[quad] keyword[import] identifier[quad_clenshaw_curtis] identifier[q1] , identifier[w1] = identifier[quad_clenshaw_curtis] ( identifier[int] ( literal[int] ** literal[int] * identifier[a]...
def tri_ttr(k, a): """ Custom TTR function. Triangle distribution does not have an analytical TTR function, but because of its non-smooth nature, a blind integration scheme will converge very slowly. However, by splitting the integration into two divided at the discontinuity in the derivative, ...
def clear_caches(): """Jinja2 keeps internal caches for environments and lexers. These are used so that Jinja2 doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches. """...
def function[clear_caches, parameter[]]: constant[Jinja2 keeps internal caches for environments and lexers. These are used so that Jinja2 doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may wa...
keyword[def] identifier[clear_caches] (): literal[string] keyword[from] identifier[jinja2] . identifier[environment] keyword[import] identifier[_spontaneous_environments] keyword[from] identifier[jinja2] . identifier[lexer] keyword[import] identifier[_lexer_cache] identifier[_spontaneous_...
def clear_caches(): """Jinja2 keeps internal caches for environments and lexers. These are used so that Jinja2 doesn't have to recreate environments and lexers all the time. Normally you don't have to care about that but if you are measuring memory consumption you may want to clean the caches. """...
def add_namespace(self, namespace, interface=None, check_extras=True, load_now=False): """ register given namespace in global database of plugins in case it's already registered, return the registration """ tempo = self._namespaces.get(namespace) i...
def function[add_namespace, parameter[self, namespace, interface, check_extras, load_now]]: constant[ register given namespace in global database of plugins in case it's already registered, return the registration ] variable[tempo] assign[=] call[name[self]._namespaces.get, para...
keyword[def] identifier[add_namespace] ( identifier[self] , identifier[namespace] , identifier[interface] = keyword[None] , identifier[check_extras] = keyword[True] , identifier[load_now] = keyword[False] ): literal[string] identifier[tempo] = identifier[self] . identifier[_namespaces] . identifie...
def add_namespace(self, namespace, interface=None, check_extras=True, load_now=False): """ register given namespace in global database of plugins in case it's already registered, return the registration """ tempo = self._namespaces.get(namespace) if tempo is None: tempo = _P...
def create_weights(nodes, dist): """Create weights for the Laja method.""" poly = chaospy.quad.generate_stieltjes(dist, len(nodes)-1, retall=True)[0] poly = chaospy.poly.flatten(chaospy.poly.Poly(poly)) weights_inverse = poly(nodes) weights = numpy.linalg.inv(weights_inverse) return weights[:, 0...
def function[create_weights, parameter[nodes, dist]]: constant[Create weights for the Laja method.] variable[poly] assign[=] call[call[name[chaospy].quad.generate_stieltjes, parameter[name[dist], binary_operation[call[name[len], parameter[name[nodes]]] - constant[1]]]]][constant[0]] variable[pol...
keyword[def] identifier[create_weights] ( identifier[nodes] , identifier[dist] ): literal[string] identifier[poly] = identifier[chaospy] . identifier[quad] . identifier[generate_stieltjes] ( identifier[dist] , identifier[len] ( identifier[nodes] )- literal[int] , identifier[retall] = keyword[True] )[ liter...
def create_weights(nodes, dist): """Create weights for the Laja method.""" poly = chaospy.quad.generate_stieltjes(dist, len(nodes) - 1, retall=True)[0] poly = chaospy.poly.flatten(chaospy.poly.Poly(poly)) weights_inverse = poly(nodes) weights = numpy.linalg.inv(weights_inverse) return weights[:,...
def update_index(model_items, model_name, action='index', bulk_size=100, num_docs=-1, start_date=None, end_date=None, refresh=True): ''' Updates the index for the provided model_items. :param model_items: a list of model_items (django Model instances, or proxy instances) which are to be indexed/updated or d...
def function[update_index, parameter[model_items, model_name, action, bulk_size, num_docs, start_date, end_date, refresh]]: constant[ Updates the index for the provided model_items. :param model_items: a list of model_items (django Model instances, or proxy instances) which are to be indexed/updated or ...
keyword[def] identifier[update_index] ( identifier[model_items] , identifier[model_name] , identifier[action] = literal[string] , identifier[bulk_size] = literal[int] , identifier[num_docs] =- literal[int] , identifier[start_date] = keyword[None] , identifier[end_date] = keyword[None] , identifier[refresh] = keyword[...
def update_index(model_items, model_name, action='index', bulk_size=100, num_docs=-1, start_date=None, end_date=None, refresh=True): """ Updates the index for the provided model_items. :param model_items: a list of model_items (django Model instances, or proxy instances) which are to be indexed/updated or d...
def domain_search(auth=None, **kwargs): ''' Search domains CLI Example: .. code-block:: bash salt '*' keystoneng.domain_search salt '*' keystoneng.domain_search name=domain1 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_domai...
def function[domain_search, parameter[auth]]: constant[ Search domains CLI Example: .. code-block:: bash salt '*' keystoneng.domain_search salt '*' keystoneng.domain_search name=domain1 ] variable[cloud] assign[=] call[name[get_operator_cloud], parameter[name[auth]]] ...
keyword[def] identifier[domain_search] ( identifier[auth] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[cloud] = identifier[get_operator_cloud] ( identifier[auth] ) identifier[kwargs] = identifier[_clean_kwargs] (** identifier[kwargs] ) keyword[return] identifier[cloud] . ...
def domain_search(auth=None, **kwargs): """ Search domains CLI Example: .. code-block:: bash salt '*' keystoneng.domain_search salt '*' keystoneng.domain_search name=domain1 """ cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_domai...
def rotate_and_traslate(cur, alpha, v0): r"""Rotate and translate a curve.""" if len(cur) > 2 or (type(cur[0][0]) in [list, tuple]): cur_list = cur[:] for i in range(len(cur_list)): curi = cur_list[i] curi = rotate_and_traslate(curi, alpha, v0) cur_list...
def function[rotate_and_traslate, parameter[cur, alpha, v0]]: constant[Rotate and translate a curve.] if <ast.BoolOp object at 0x7da1b19698a0> begin[:] variable[cur_list] assign[=] call[name[cur]][<ast.Slice object at 0x7da1b196bf40>] for taget[name[i]] in starred[call[na...
keyword[def] identifier[rotate_and_traslate] ( identifier[cur] , identifier[alpha] , identifier[v0] ): literal[string] keyword[if] identifier[len] ( identifier[cur] )> literal[int] keyword[or] ( identifier[type] ( identifier[cur] [ literal[int] ][ literal[int] ]) keyword[in] [ identifier[list] , identi...
def rotate_and_traslate(cur, alpha, v0): """Rotate and translate a curve.""" if len(cur) > 2 or type(cur[0][0]) in [list, tuple]: cur_list = cur[:] for i in range(len(cur_list)): curi = cur_list[i] curi = rotate_and_traslate(curi, alpha, v0) cur_list[i] = curi...
def list_market_profit_and_loss(self, market_ids, include_settled_bets=None, include_bsp_bets=None, net_of_commission=None, session=None, lightweight=None): """ Retrieve profit and loss for a given list of OPEN markets. :param list market_ids: List of markets...
def function[list_market_profit_and_loss, parameter[self, market_ids, include_settled_bets, include_bsp_bets, net_of_commission, session, lightweight]]: constant[ Retrieve profit and loss for a given list of OPEN markets. :param list market_ids: List of markets to calculate profit and loss ...
keyword[def] identifier[list_market_profit_and_loss] ( identifier[self] , identifier[market_ids] , identifier[include_settled_bets] = keyword[None] , identifier[include_bsp_bets] = keyword[None] , identifier[net_of_commission] = keyword[None] , identifier[session] = keyword[None] , identifier[lightweight] = keyword[...
def list_market_profit_and_loss(self, market_ids, include_settled_bets=None, include_bsp_bets=None, net_of_commission=None, session=None, lightweight=None): """ Retrieve profit and loss for a given list of OPEN markets. :param list market_ids: List of markets to calculate profit and loss :p...
def is_fornyrdhislag(text: str): """ Basic check, only the number of lines matters: 8 for fornyrðislag. >>> text1 = "Hljóðs bið ek allar\\nhelgar kindir,\\nmeiri ok minni\\nmögu Heimdallar;\\nviltu at ek, Valföðr,\\nvel fyr telja\\nforn spjöll fira,\\nþau er fremst of man." >>> text2 = ...
def function[is_fornyrdhislag, parameter[text]]: constant[ Basic check, only the number of lines matters: 8 for fornyrðislag. >>> text1 = "Hljóðs bið ek allar\nhelgar kindir,\nmeiri ok minni\nmögu Heimdallar;\nviltu at ek, Valföðr,\nvel fyr telja\nforn spjöll fira,\nþau er fremst of man." ...
keyword[def] identifier[is_fornyrdhislag] ( identifier[text] : identifier[str] ): literal[string] identifier[lines] =[ identifier[line] keyword[for] identifier[line] keyword[in] identifier[text] . identifier[split] ( literal[string] ) keyword[if] identifier[line] ] keyword[return] id...
def is_fornyrdhislag(text: str): """ Basic check, only the number of lines matters: 8 for fornyrðislag. >>> text1 = "Hljóðs bið ek allar\\nhelgar kindir,\\nmeiri ok minni\\nmögu Heimdallar;\\nviltu at ek, Valföðr,\\nvel fyr telja\\nforn spjöll fira,\\nþau er fremst of man." >>> text2 = "Dey...
def uptime(self, event, nickname=None): """ Shows the amount of time since the given nickname has been in the channel. If no nickname is given, I'll use my own. """ if nickname and nickname != self.nickname: try: uptime = self.timesince(self.joined[nic...
def function[uptime, parameter[self, event, nickname]]: constant[ Shows the amount of time since the given nickname has been in the channel. If no nickname is given, I'll use my own. ] if <ast.BoolOp object at 0x7da1b0ed9a80> begin[:] <ast.Try object at 0x7da1b0ed9b40> ...
keyword[def] identifier[uptime] ( identifier[self] , identifier[event] , identifier[nickname] = keyword[None] ): literal[string] keyword[if] identifier[nickname] keyword[and] identifier[nickname] != identifier[self] . identifier[nickname] : keyword[try] : identifier...
def uptime(self, event, nickname=None): """ Shows the amount of time since the given nickname has been in the channel. If no nickname is given, I'll use my own. """ if nickname and nickname != self.nickname: try: uptime = self.timesince(self.joined[nickname]) # depen...
def render(self): """Outputs a <ul> for this set of radio fields.""" t = template.loader.get_template('support/forms/profile_picture.html') return t.render(template.Context({'widget': self, 'MEDIA_URL': settings.MEDIA_URL }))
def function[render, parameter[self]]: constant[Outputs a <ul> for this set of radio fields.] variable[t] assign[=] call[name[template].loader.get_template, parameter[constant[support/forms/profile_picture.html]]] return[call[name[t].render, parameter[call[name[template].Context, parameter[dictionar...
keyword[def] identifier[render] ( identifier[self] ): literal[string] identifier[t] = identifier[template] . identifier[loader] . identifier[get_template] ( literal[string] ) keyword[return] identifier[t] . identifier[render] ( identifier[template] . identifier[Context] ({ literal[string]...
def render(self): """Outputs a <ul> for this set of radio fields.""" t = template.loader.get_template('support/forms/profile_picture.html') return t.render(template.Context({'widget': self, 'MEDIA_URL': settings.MEDIA_URL}))
def next(self): """ Return the next window """ next_index = (self.index + 1) % len(self._browser.driver.window_handles) next_handle = self._browser.driver.window_handles[next_index] return Window(self._browser, next_handle)
def function[next, parameter[self]]: constant[ Return the next window ] variable[next_index] assign[=] binary_operation[binary_operation[name[self].index + constant[1]] <ast.Mod object at 0x7da2590d6920> call[name[len], parameter[name[self]._browser.driver.window_handles]]] variable[next_handle]...
keyword[def] identifier[next] ( identifier[self] ): literal[string] identifier[next_index] =( identifier[self] . identifier[index] + literal[int] )% identifier[len] ( identifier[self] . identifier[_browser] . identifier[driver] . identifier[window_handles] ) identifier[next_handle] = ident...
def next(self): """ Return the next window """ next_index = (self.index + 1) % len(self._browser.driver.window_handles) next_handle = self._browser.driver.window_handles[next_index] return Window(self._browser, next_handle)
def clear(self): """ Remove all cache entries. """ db = sqlite3.connect(self.path) c = db.cursor() c.execute("DELETE FROM dirhashcache") db.commit() db.close()
def function[clear, parameter[self]]: constant[ Remove all cache entries. ] variable[db] assign[=] call[name[sqlite3].connect, parameter[name[self].path]] variable[c] assign[=] call[name[db].cursor, parameter[]] call[name[c].execute, parameter[constant[DELETE FROM dirhash...
keyword[def] identifier[clear] ( identifier[self] ): literal[string] identifier[db] = identifier[sqlite3] . identifier[connect] ( identifier[self] . identifier[path] ) identifier[c] = identifier[db] . identifier[cursor] () identifier[c] . identifier[execute] ( literal[string] ) ...
def clear(self): """ Remove all cache entries. """ db = sqlite3.connect(self.path) c = db.cursor() c.execute('DELETE FROM dirhashcache') db.commit() db.close()
def _format_batch_statuses(statuses, batch_ids, tracker): """Takes a statuses dict and formats it for transmission with Protobuf and ZMQ. Args: statuses (dict of int): Dict with batch ids as the key, status as value batch_ids (list of str): The batch ids in their original order trac...
def function[_format_batch_statuses, parameter[statuses, batch_ids, tracker]]: constant[Takes a statuses dict and formats it for transmission with Protobuf and ZMQ. Args: statuses (dict of int): Dict with batch ids as the key, status as value batch_ids (list of str): The batch ids in th...
keyword[def] identifier[_format_batch_statuses] ( identifier[statuses] , identifier[batch_ids] , identifier[tracker] ): literal[string] identifier[proto_statuses] =[] keyword[for] identifier[batch_id] keyword[in] identifier[batch_ids] : keyword[if] identifier[statuses] [ identifier[batch...
def _format_batch_statuses(statuses, batch_ids, tracker): """Takes a statuses dict and formats it for transmission with Protobuf and ZMQ. Args: statuses (dict of int): Dict with batch ids as the key, status as value batch_ids (list of str): The batch ids in their original order trac...
def to_unicode(text, charset=None): """Convert input to an `unicode` object. For a `str` object, we'll first try to decode the bytes using the given `charset` encoding (or UTF-8 if none is specified), then we fall back to the latin1 encoding which might be correct or not, but at least preserves the...
def function[to_unicode, parameter[text, charset]]: constant[Convert input to an `unicode` object. For a `str` object, we'll first try to decode the bytes using the given `charset` encoding (or UTF-8 if none is specified), then we fall back to the latin1 encoding which might be correct or not, but ...
keyword[def] identifier[to_unicode] ( identifier[text] , identifier[charset] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[text] , identifier[str] ): keyword[try] : keyword[return] identifier[unicode] ( identifier[text] , identifier[charset] key...
def to_unicode(text, charset=None): """Convert input to an `unicode` object. For a `str` object, we'll first try to decode the bytes using the given `charset` encoding (or UTF-8 if none is specified), then we fall back to the latin1 encoding which might be correct or not, but at least preserves the...
def _gatherDataFromLookups(gpos, scriptOrder): """ Gather kerning and classes from the applicable lookups and return them in script order. """ lookupIndexes = _gatherLookupIndexes(gpos) seenLookups = set() kerningDictionaries = [] leftClassDictionaries = [] rightClassDictionaries = [...
def function[_gatherDataFromLookups, parameter[gpos, scriptOrder]]: constant[ Gather kerning and classes from the applicable lookups and return them in script order. ] variable[lookupIndexes] assign[=] call[name[_gatherLookupIndexes], parameter[name[gpos]]] variable[seenLookups] assi...
keyword[def] identifier[_gatherDataFromLookups] ( identifier[gpos] , identifier[scriptOrder] ): literal[string] identifier[lookupIndexes] = identifier[_gatherLookupIndexes] ( identifier[gpos] ) identifier[seenLookups] = identifier[set] () identifier[kerningDictionaries] =[] identifier[leftCl...
def _gatherDataFromLookups(gpos, scriptOrder): """ Gather kerning and classes from the applicable lookups and return them in script order. """ lookupIndexes = _gatherLookupIndexes(gpos) seenLookups = set() kerningDictionaries = [] leftClassDictionaries = [] rightClassDictionaries = [...
def conclude_course(self, id, event): """ Conclude a course. Delete or conclude an existing course """ path = {} data = {} params = {} # REQUIRED - PATH - id """ID""" path["id"] = id # REQUIRED - event """T...
def function[conclude_course, parameter[self, id, event]]: constant[ Conclude a course. Delete or conclude an existing course ] variable[path] assign[=] dictionary[[], []] variable[data] assign[=] dictionary[[], []] variable[params] assign[=] dictionary[[], []] ...
keyword[def] identifier[conclude_course] ( identifier[self] , identifier[id] , identifier[event] ): literal[string] identifier[path] ={} identifier[data] ={} identifier[params] ={} literal[string] identifier[path] [ literal[string] ]= identifie...
def conclude_course(self, id, event): """ Conclude a course. Delete or conclude an existing course """ path = {} data = {} params = {} # REQUIRED - PATH - id 'ID' path['id'] = id # REQUIRED - event 'The action to take on the course.' self._validate_enum(event, ...