code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def get_lr(self): """Calculates the learning rate at batch index: ``self.last_batch_idx``. """ cycle = np.floor(1 + self.last_batch_idx / self.total_size) x = 1 + self.last_batch_idx / self.total_size - cycle if x <= self.step_ratio: scale_factor = x / self.st...
def function[get_lr, parameter[self]]: constant[Calculates the learning rate at batch index: ``self.last_batch_idx``. ] variable[cycle] assign[=] call[name[np].floor, parameter[binary_operation[constant[1] + binary_operation[name[self].last_batch_idx / name[self].total_size]]]] v...
keyword[def] identifier[get_lr] ( identifier[self] ): literal[string] identifier[cycle] = identifier[np] . identifier[floor] ( literal[int] + identifier[self] . identifier[last_batch_idx] / identifier[self] . identifier[total_size] ) identifier[x] = literal[int] + identifier[self] . identi...
def get_lr(self): """Calculates the learning rate at batch index: ``self.last_batch_idx``. """ cycle = np.floor(1 + self.last_batch_idx / self.total_size) x = 1 + self.last_batch_idx / self.total_size - cycle if x <= self.step_ratio: scale_factor = x / self.step_ratio # depends ...
def _UpdateRequestsAndScheduleFPRs(self, responses, cursor=None): """Updates requests and writes FlowProcessingRequests if needed.""" request_keys = set( (r.client_id, r.flow_id, r.request_id) for r in responses) flow_keys = set((r.client_id, r.flow_id) for r in responses) response_counts = se...
def function[_UpdateRequestsAndScheduleFPRs, parameter[self, responses, cursor]]: constant[Updates requests and writes FlowProcessingRequests if needed.] variable[request_keys] assign[=] call[name[set], parameter[<ast.GeneratorExp object at 0x7da1b1b46f20>]] variable[flow_keys] assign[=] call[na...
keyword[def] identifier[_UpdateRequestsAndScheduleFPRs] ( identifier[self] , identifier[responses] , identifier[cursor] = keyword[None] ): literal[string] identifier[request_keys] = identifier[set] ( ( identifier[r] . identifier[client_id] , identifier[r] . identifier[flow_id] , identifier[r] . identi...
def _UpdateRequestsAndScheduleFPRs(self, responses, cursor=None): """Updates requests and writes FlowProcessingRequests if needed.""" request_keys = set(((r.client_id, r.flow_id, r.request_id) for r in responses)) flow_keys = set(((r.client_id, r.flow_id) for r in responses)) response_counts = self._Rea...
def make_tokens(parse_buffer): """ Takes a list of pairs (token_type, read_result) and applies token_type(read_result). Footnotes are already parsed before this point, and span-level parsing is started here. """ tokens = [] for token_type, result in parse_buffer: token = token_t...
def function[make_tokens, parameter[parse_buffer]]: constant[ Takes a list of pairs (token_type, read_result) and applies token_type(read_result). Footnotes are already parsed before this point, and span-level parsing is started here. ] variable[tokens] assign[=] list[[]] fo...
keyword[def] identifier[make_tokens] ( identifier[parse_buffer] ): literal[string] identifier[tokens] =[] keyword[for] identifier[token_type] , identifier[result] keyword[in] identifier[parse_buffer] : identifier[token] = identifier[token_type] ( identifier[result] ) keyword[if] ...
def make_tokens(parse_buffer): """ Takes a list of pairs (token_type, read_result) and applies token_type(read_result). Footnotes are already parsed before this point, and span-level parsing is started here. """ tokens = [] for (token_type, result) in parse_buffer: token = token...
def main(self): """ Run the necessary methods in the correct order """ if not os.path.isfile(self.gdcs_report): logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Run the analyses ShortKSippingMethods(self, self.cutoff) ...
def function[main, parameter[self]]: constant[ Run the necessary methods in the correct order ] if <ast.UnaryOp object at 0x7da1b1eeccd0> begin[:] call[name[logging].info, parameter[call[constant[Starting {} analysis pipeline].format, parameter[name[self].analysistype]]]]...
keyword[def] identifier[main] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[isfile] ( identifier[self] . identifier[gdcs_report] ): identifier[logging] . identifier[info] ( literal[string] . identifier[format] ( identifi...
def main(self): """ Run the necessary methods in the correct order """ if not os.path.isfile(self.gdcs_report): logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Run the analyses ShortKSippingMethods(self, self.cutoff) # Create the reports ...
def cmd_reboot(self, args): '''reboot autopilot''' if len(args) > 0 and args[0] == 'bootloader': self.master.reboot_autopilot(True) else: self.master.reboot_autopilot()
def function[cmd_reboot, parameter[self, args]]: constant[reboot autopilot] if <ast.BoolOp object at 0x7da1b2344940> begin[:] call[name[self].master.reboot_autopilot, parameter[constant[True]]]
keyword[def] identifier[cmd_reboot] ( identifier[self] , identifier[args] ): literal[string] keyword[if] identifier[len] ( identifier[args] )> literal[int] keyword[and] identifier[args] [ literal[int] ]== literal[string] : identifier[self] . identifier[master] . identifier[reboot_au...
def cmd_reboot(self, args): """reboot autopilot""" if len(args) > 0 and args[0] == 'bootloader': self.master.reboot_autopilot(True) # depends on [control=['if'], data=[]] else: self.master.reboot_autopilot()
def title(self): """ The title of the course. If no entry in the namemap of the configuration is found a new entry is created with name=$STUD.IP_NAME + $SEMESTER_NAME """ name = c.namemap_lookup(self.id) if name is None: name = self._title + " " + client.get_semester_...
def function[title, parameter[self]]: constant[ The title of the course. If no entry in the namemap of the configuration is found a new entry is created with name=$STUD.IP_NAME + $SEMESTER_NAME ] variable[name] assign[=] call[name[c].namemap_lookup, parameter[name[self].id]] if c...
keyword[def] identifier[title] ( identifier[self] ): literal[string] identifier[name] = identifier[c] . identifier[namemap_lookup] ( identifier[self] . identifier[id] ) keyword[if] identifier[name] keyword[is] keyword[None] : identifier[name] = identifier[self] . identifier...
def title(self): """ The title of the course. If no entry in the namemap of the configuration is found a new entry is created with name=$STUD.IP_NAME + $SEMESTER_NAME """ name = c.namemap_lookup(self.id) if name is None: name = self._title + ' ' + client.get_semester_title(self) ...
def fetch_build_egg(self, req): """Fetch an egg needed for building""" from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args': ['easy_install']}) opts = dist.get_option_dict('easy_install') opts.clear() opts.update( (k, v...
def function[fetch_build_egg, parameter[self, req]]: constant[Fetch an egg needed for building] from relative_module[setuptools.command.easy_install] import module[easy_install] variable[dist] assign[=] call[name[self].__class__, parameter[dictionary[[<ast.Constant object at 0x7da1b1b17340>], [<ast....
keyword[def] identifier[fetch_build_egg] ( identifier[self] , identifier[req] ): literal[string] keyword[from] identifier[setuptools] . identifier[command] . identifier[easy_install] keyword[import] identifier[easy_install] identifier[dist] = identifier[self] . identifier[__class__] ({...
def fetch_build_egg(self, req): """Fetch an egg needed for building""" from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args': ['easy_install']}) opts = dist.get_option_dict('easy_install') opts.clear() # don't use any other settings opts.update(((k, v)...
def edit(self, resource): """Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'options', 'package_name', 'config_name', 'device_name', 'result_id...
def function[edit, parameter[self, resource]]: constant[Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job ] variable[schema] assign[=] call[name[JobSchema], parameter[]] variable[json] a...
keyword[def] identifier[edit] ( identifier[self] , identifier[resource] ): literal[string] identifier[schema] = identifier[JobSchema] ( identifier[exclude] =( literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string...
def edit(self, resource): """Edit a job. :param resource: :class:`jobs.Job <jobs.Job>` object :return: :class:`jobs.Job <jobs.Job>` object :rtype: jobs.Job """ schema = JobSchema(exclude=('id', 'status', 'options', 'package_name', 'config_name', 'device_name', 'result_id', 'user...
def close(self): """Flush the buffer and finalize the file. When this returns the new file is available for reading. """ if not self.closed: self.closed = True self._flush(finish=True) self._buffer = None
def function[close, parameter[self]]: constant[Flush the buffer and finalize the file. When this returns the new file is available for reading. ] if <ast.UnaryOp object at 0x7da1b050b310> begin[:] name[self].closed assign[=] constant[True] call[name[self]._flush,...
keyword[def] identifier[close] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[closed] : identifier[self] . identifier[closed] = keyword[True] identifier[self] . identifier[_flush] ( identifier[finish] = keyword[True] ) identifier[self] ....
def close(self): """Flush the buffer and finalize the file. When this returns the new file is available for reading. """ if not self.closed: self.closed = True self._flush(finish=True) self._buffer = None # depends on [control=['if'], data=[]]
def apply_compact(graph_path): """Run the pruned and frozen inference graph. """ with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess: # Note, we just load the graph and do *not* need to initialize anything. with tf.gfile.GFile(graph_path, "rb") as f: graph_def =...
def function[apply_compact, parameter[graph_path]]: constant[Run the pruned and frozen inference graph. ] with call[name[tf].Session, parameter[]] begin[:] with call[name[tf].gfile.GFile, parameter[name[graph_path], constant[rb]]] begin[:] variable[graph_def] assi...
keyword[def] identifier[apply_compact] ( identifier[graph_path] ): literal[string] keyword[with] identifier[tf] . identifier[Session] ( identifier[config] = identifier[tf] . identifier[ConfigProto] ( identifier[allow_soft_placement] = keyword[True] )) keyword[as] identifier[sess] : keyword[...
def apply_compact(graph_path): """Run the pruned and frozen inference graph. """ with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess: # Note, we just load the graph and do *not* need to initialize anything. with tf.gfile.GFile(graph_path, 'rb') as f: graph_def =...
def attrs_sqlalchemy(maybe_cls=None): """ A class decorator that adds ``__repr__``, ``__eq__``, ``__cmp__``, and ``__hash__`` methods according to the fields defined on the SQLAlchemy model class. """ def wrap(cls): warnings.warn(UserWarning('attrs_sqlalchemy is deprecated')) th...
def function[attrs_sqlalchemy, parameter[maybe_cls]]: constant[ A class decorator that adds ``__repr__``, ``__eq__``, ``__cmp__``, and ``__hash__`` methods according to the fields defined on the SQLAlchemy model class. ] def function[wrap, parameter[cls]]: call[name[warni...
keyword[def] identifier[attrs_sqlalchemy] ( identifier[maybe_cls] = keyword[None] ): literal[string] keyword[def] identifier[wrap] ( identifier[cls] ): identifier[warnings] . identifier[warn] ( identifier[UserWarning] ( literal[string] )) identifier[these] ={ identifier[name] :...
def attrs_sqlalchemy(maybe_cls=None): """ A class decorator that adds ``__repr__``, ``__eq__``, ``__cmp__``, and ``__hash__`` methods according to the fields defined on the SQLAlchemy model class. """ def wrap(cls): warnings.warn(UserWarning('attrs_sqlalchemy is deprecated')) # ...
def update_isbn(self): """Remove dashes from ISBN.""" isbns = record_get_field_instances(self.record, '020') for field in isbns: for idx, (key, value) in enumerate(field[0]): if key == 'a': field[0][idx] = ('a', value.replace("-", "").strip())
def function[update_isbn, parameter[self]]: constant[Remove dashes from ISBN.] variable[isbns] assign[=] call[name[record_get_field_instances], parameter[name[self].record, constant[020]]] for taget[name[field]] in starred[name[isbns]] begin[:] for taget[tuple[[<ast.Name object a...
keyword[def] identifier[update_isbn] ( identifier[self] ): literal[string] identifier[isbns] = identifier[record_get_field_instances] ( identifier[self] . identifier[record] , literal[string] ) keyword[for] identifier[field] keyword[in] identifier[isbns] : keyword[for] ide...
def update_isbn(self): """Remove dashes from ISBN.""" isbns = record_get_field_instances(self.record, '020') for field in isbns: for (idx, (key, value)) in enumerate(field[0]): if key == 'a': field[0][idx] = ('a', value.replace('-', '').strip()) # depends on [control=['i...
def add(self, pathogenName, sampleName): """ Add a (pathogen name, sample name) combination and get its FASTA/FASTQ file name and unique read count. Write the FASTA/FASTQ file if it does not already exist. Save the unique read count into C{self._proteinGrouper}. @param p...
def function[add, parameter[self, pathogenName, sampleName]]: constant[ Add a (pathogen name, sample name) combination and get its FASTA/FASTQ file name and unique read count. Write the FASTA/FASTQ file if it does not already exist. Save the unique read count into C{self._protein...
keyword[def] identifier[add] ( identifier[self] , identifier[pathogenName] , identifier[sampleName] ): literal[string] identifier[pathogenIndex] = identifier[self] . identifier[_pathogens] . identifier[setdefault] ( identifier[pathogenName] , identifier[len] ( identifier[self] . identifier...
def add(self, pathogenName, sampleName): """ Add a (pathogen name, sample name) combination and get its FASTA/FASTQ file name and unique read count. Write the FASTA/FASTQ file if it does not already exist. Save the unique read count into C{self._proteinGrouper}. @param patho...
def load_word_file(filename): """Loads a words file as a list of lines""" words_file = resource_filename(__name__, "words/%s" % filename) handle = open(words_file, 'r') words = handle.readlines() handle.close() return words
def function[load_word_file, parameter[filename]]: constant[Loads a words file as a list of lines] variable[words_file] assign[=] call[name[resource_filename], parameter[name[__name__], binary_operation[constant[words/%s] <ast.Mod object at 0x7da2590d6920> name[filename]]]] variable[handle] assi...
keyword[def] identifier[load_word_file] ( identifier[filename] ): literal[string] identifier[words_file] = identifier[resource_filename] ( identifier[__name__] , literal[string] % identifier[filename] ) identifier[handle] = identifier[open] ( identifier[words_file] , literal[string] ) identifier[...
def load_word_file(filename): """Loads a words file as a list of lines""" words_file = resource_filename(__name__, 'words/%s' % filename) handle = open(words_file, 'r') words = handle.readlines() handle.close() return words
def unbind(self): """ Unbinds this connection from queue and topic managers (freeing up resources) and resets state. """ self.connected = False self.queue_manager.disconnect(self.connection) self.topic_manager.disconnect(self.connection)
def function[unbind, parameter[self]]: constant[ Unbinds this connection from queue and topic managers (freeing up resources) and resets state. ] name[self].connected assign[=] constant[False] call[name[self].queue_manager.disconnect, parameter[name[self].connection]] ...
keyword[def] identifier[unbind] ( identifier[self] ): literal[string] identifier[self] . identifier[connected] = keyword[False] identifier[self] . identifier[queue_manager] . identifier[disconnect] ( identifier[self] . identifier[connection] ) identifier[self] . identifier[topic_...
def unbind(self): """ Unbinds this connection from queue and topic managers (freeing up resources) and resets state. """ self.connected = False self.queue_manager.disconnect(self.connection) self.topic_manager.disconnect(self.connection)
def get_file_relative_path_by_id(self, id): """ Given an id, get the corresponding file info relative path joined with file name. Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relative path joined with file n...
def function[get_file_relative_path_by_id, parameter[self, id]]: constant[ Given an id, get the corresponding file info relative path joined with file name. Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relat...
keyword[def] identifier[get_file_relative_path_by_id] ( identifier[self] , identifier[id] ): literal[string] keyword[for] identifier[path] , identifier[info] keyword[in] identifier[self] . identifier[walk_files_info] (): keyword[if] identifier[info] [ literal[string] ]== identifier...
def get_file_relative_path_by_id(self, id): """ Given an id, get the corresponding file info relative path joined with file name. Parameters: #. id (string): The file unique id string. :Returns: #. relativePath (string): The file relative path joined with file name....
def find_subdirectories(package): """ Get the subdirectories within a package This will include resources (non-submodules) and submodules """ try: subdirectories = os.walk(package_to_path(package)).next()[1] except StopIteration: subdirectories = [] return subdirectories
def function[find_subdirectories, parameter[package]]: constant[ Get the subdirectories within a package This will include resources (non-submodules) and submodules ] <ast.Try object at 0x7da2054a5cf0> return[name[subdirectories]]
keyword[def] identifier[find_subdirectories] ( identifier[package] ): literal[string] keyword[try] : identifier[subdirectories] = identifier[os] . identifier[walk] ( identifier[package_to_path] ( identifier[package] )). identifier[next] ()[ literal[int] ] keyword[except] identifier[StopItera...
def find_subdirectories(package): """ Get the subdirectories within a package This will include resources (non-submodules) and submodules """ try: subdirectories = os.walk(package_to_path(package)).next()[1] # depends on [control=['try'], data=[]] except StopIteration: subdirect...
def _make_binary_stream(thing, encoding=None, armor=True): """Encode **thing**, then make it stream/file-like. :param thing: The thing to turn into a encoded stream. :rtype: ``io.BytesIO`` or ``io.StringIO``. :returns: The encoded **thing**, wrapped in an ``io.BytesIO`` (if available), otherwis...
def function[_make_binary_stream, parameter[thing, encoding, armor]]: constant[Encode **thing**, then make it stream/file-like. :param thing: The thing to turn into a encoded stream. :rtype: ``io.BytesIO`` or ``io.StringIO``. :returns: The encoded **thing**, wrapped in an ``io.BytesIO`` (if ...
keyword[def] identifier[_make_binary_stream] ( identifier[thing] , identifier[encoding] = keyword[None] , identifier[armor] = keyword[True] ): literal[string] keyword[if] identifier[_py3k] : keyword[if] identifier[isinstance] ( identifier[thing] , identifier[str] ): identifier[thing...
def _make_binary_stream(thing, encoding=None, armor=True): """Encode **thing**, then make it stream/file-like. :param thing: The thing to turn into a encoded stream. :rtype: ``io.BytesIO`` or ``io.StringIO``. :returns: The encoded **thing**, wrapped in an ``io.BytesIO`` (if available), otherwis...
def node_set_to_surface(self, tag): """ Converts a node set to surface. """ # Create a dummy node with label 0 nodes = self.nodes.copy() dummy = nodes.iloc[0].copy() dummy["coords"] *= np.nan dummy["sets"] = True nodes.loc[0] = dummy # Getting element surfaces element_surface...
def function[node_set_to_surface, parameter[self, tag]]: constant[ Converts a node set to surface. ] variable[nodes] assign[=] call[name[self].nodes.copy, parameter[]] variable[dummy] assign[=] call[call[name[nodes].iloc][constant[0]].copy, parameter[]] <ast.AugAssign object at 0x7da...
keyword[def] identifier[node_set_to_surface] ( identifier[self] , identifier[tag] ): literal[string] identifier[nodes] = identifier[self] . identifier[nodes] . identifier[copy] () identifier[dummy] = identifier[nodes] . identifier[iloc] [ literal[int] ]. identifier[copy] () identifier[dummy]...
def node_set_to_surface(self, tag): """ Converts a node set to surface. """ # Create a dummy node with label 0 nodes = self.nodes.copy() dummy = nodes.iloc[0].copy() dummy['coords'] *= np.nan dummy['sets'] = True nodes.loc[0] = dummy # Getting element surfaces element_surface...
def wait(self): """ Block until a matched message appears. """ if not self._patterns: raise RuntimeError('Listener has nothing to capture') while 1: msg = self._queue.get(block=True) if any(map(lambda p: filtering.match_all(msg, p), self._pat...
def function[wait, parameter[self]]: constant[ Block until a matched message appears. ] if <ast.UnaryOp object at 0x7da1b1b0fdf0> begin[:] <ast.Raise object at 0x7da1b1b0d0f0> while constant[1] begin[:] variable[msg] assign[=] call[name[self]._queue.get, p...
keyword[def] identifier[wait] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_patterns] : keyword[raise] identifier[RuntimeError] ( literal[string] ) keyword[while] literal[int] : identifier[msg] = identifier[self...
def wait(self): """ Block until a matched message appears. """ if not self._patterns: raise RuntimeError('Listener has nothing to capture') # depends on [control=['if'], data=[]] while 1: msg = self._queue.get(block=True) if any(map(lambda p: filtering.match_all(msg,...
def cee_map_priority_table_map_cos2_pgid(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") cee_map = ET.SubElement(config, "cee-map", xmlns="urn:brocade.com:mgmt:brocade-cee-map") name_key = ET.SubElement(cee_map, "name") name_key.text = kwargs.pop...
def function[cee_map_priority_table_map_cos2_pgid, parameter[self]]: constant[Auto Generated Code ] variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]] variable[cee_map] assign[=] call[name[ET].SubElement, parameter[name[config], constant[cee-map]]] var...
keyword[def] identifier[cee_map_priority_table_map_cos2_pgid] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[config] = identifier[ET] . identifier[Element] ( literal[string] ) identifier[cee_map] = identifier[ET] . identifier[SubElement] ( identifier[config] , lite...
def cee_map_priority_table_map_cos2_pgid(self, **kwargs): """Auto Generated Code """ config = ET.Element('config') cee_map = ET.SubElement(config, 'cee-map', xmlns='urn:brocade.com:mgmt:brocade-cee-map') name_key = ET.SubElement(cee_map, 'name') name_key.text = kwargs.pop('name') priorit...
async def _delay(self): """Check for a 'retry-after' header to set timeout, otherwise use configured timeout. """ if self._response is None: await asyncio.sleep(0) if self._response.headers.get('retry-after'): await asyncio.sleep(int(self._response.headers...
<ast.AsyncFunctionDef object at 0x7da18dc99ff0>
keyword[async] keyword[def] identifier[_delay] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_response] keyword[is] keyword[None] : keyword[await] identifier[asyncio] . identifier[sleep] ( literal[int] ) keyword[if] identifier[self] . id...
async def _delay(self): """Check for a 'retry-after' header to set timeout, otherwise use configured timeout. """ if self._response is None: await asyncio.sleep(0) # depends on [control=['if'], data=[]] if self._response.headers.get('retry-after'): await asyncio.sleep(int(se...
def mount(self, volume): """Mounts the given volume on the provided mountpoint. The default implementation simply calls mount. :param Volume volume: The volume to be mounted :param mountpoint: The file system path to mount the filesystem on. :raises UnsupportedFilesystemError: when the ...
def function[mount, parameter[self, volume]]: constant[Mounts the given volume on the provided mountpoint. The default implementation simply calls mount. :param Volume volume: The volume to be mounted :param mountpoint: The file system path to mount the filesystem on. :raises Unsupporte...
keyword[def] identifier[mount] ( identifier[self] , identifier[volume] ): literal[string] identifier[volume] . identifier[_make_mountpoint] () keyword[try] : identifier[self] . identifier[_call_mount] ( identifier[volume] , identifier[volume] . identifier[mountpoint] , identi...
def mount(self, volume): """Mounts the given volume on the provided mountpoint. The default implementation simply calls mount. :param Volume volume: The volume to be mounted :param mountpoint: The file system path to mount the filesystem on. :raises UnsupportedFilesystemError: when the volu...
def push_async_callback(self, callback, *args, **kwds): """Registers an arbitrary coroutine function and arguments. Cannot suppress exceptions. """ _exit_wrapper = self._create_async_cb_wrapper(callback, *args, **kwds) # We changed the signature, so using @wraps is not appropria...
def function[push_async_callback, parameter[self, callback]]: constant[Registers an arbitrary coroutine function and arguments. Cannot suppress exceptions. ] variable[_exit_wrapper] assign[=] call[name[self]._create_async_cb_wrapper, parameter[name[callback], <ast.Starred object at 0x7da...
keyword[def] identifier[push_async_callback] ( identifier[self] , identifier[callback] ,* identifier[args] ,** identifier[kwds] ): literal[string] identifier[_exit_wrapper] = identifier[self] . identifier[_create_async_cb_wrapper] ( identifier[callback] ,* identifier[args] ,** identifier[kwds] ) ...
def push_async_callback(self, callback, *args, **kwds): """Registers an arbitrary coroutine function and arguments. Cannot suppress exceptions. """ _exit_wrapper = self._create_async_cb_wrapper(callback, *args, **kwds) # We changed the signature, so using @wraps is not appropriate, but #...
def _verify_credentials(self): """ An internal method that verifies the credentials given at instantiation. :raises: :class:`Pymoe.errors.UserLoginFailed` """ r = requests.get(self.apiurl + "account/verify_credentials.xml", auth=HTTPBasicAuth(self._usern...
def function[_verify_credentials, parameter[self]]: constant[ An internal method that verifies the credentials given at instantiation. :raises: :class:`Pymoe.errors.UserLoginFailed` ] variable[r] assign[=] call[name[requests].get, parameter[binary_operation[name[self].apiurl + c...
keyword[def] identifier[_verify_credentials] ( identifier[self] ): literal[string] identifier[r] = identifier[requests] . identifier[get] ( identifier[self] . identifier[apiurl] + literal[string] , identifier[auth] = identifier[HTTPBasicAuth] ( identifier[self] . identifier[_username] , id...
def _verify_credentials(self): """ An internal method that verifies the credentials given at instantiation. :raises: :class:`Pymoe.errors.UserLoginFailed` """ r = requests.get(self.apiurl + 'account/verify_credentials.xml', auth=HTTPBasicAuth(self._username, self._password), headers=sel...
def add_key_filters(self, key_filters): """ Adds key filters to the inputs. :param key_filters: a list of filters :type key_filters: list :rtype: :class:`RiakMapReduce` """ if self._input_mode == 'query': raise ValueError('Key filters are not supporte...
def function[add_key_filters, parameter[self, key_filters]]: constant[ Adds key filters to the inputs. :param key_filters: a list of filters :type key_filters: list :rtype: :class:`RiakMapReduce` ] if compare[name[self]._input_mode equal[==] constant[query]] begi...
keyword[def] identifier[add_key_filters] ( identifier[self] , identifier[key_filters] ): literal[string] keyword[if] identifier[self] . identifier[_input_mode] == literal[string] : keyword[raise] identifier[ValueError] ( literal[string] ) identifier[self] . identifier[_key_...
def add_key_filters(self, key_filters): """ Adds key filters to the inputs. :param key_filters: a list of filters :type key_filters: list :rtype: :class:`RiakMapReduce` """ if self._input_mode == 'query': raise ValueError('Key filters are not supported in a query...
def _build_vertex_data(self): """Rebuild the vertex buffers used for rendering the image when using the subdivide method. """ grid = self._grid w = 1.0 / grid[1] h = 1.0 / grid[0] quad = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0], [0, 0, 0...
def function[_build_vertex_data, parameter[self]]: constant[Rebuild the vertex buffers used for rendering the image when using the subdivide method. ] variable[grid] assign[=] name[self]._grid variable[w] assign[=] binary_operation[constant[1.0] / call[name[grid]][constant[1]]] ...
keyword[def] identifier[_build_vertex_data] ( identifier[self] ): literal[string] identifier[grid] = identifier[self] . identifier[_grid] identifier[w] = literal[int] / identifier[grid] [ literal[int] ] identifier[h] = literal[int] / identifier[grid] [ literal[int] ] id...
def _build_vertex_data(self): """Rebuild the vertex buffers used for rendering the image when using the subdivide method. """ grid = self._grid w = 1.0 / grid[1] h = 1.0 / grid[0] quad = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0], [0, 0, 0], [w, h, 0], [0, h, 0]], dtype=np.float32) ...
def _docspec(func, module=None, qualname=None, of_class=None): """ For a callable, get the full spec by merging doc_parse() and argspec() :type func: Callable :rtype: data.FDocstring """ sp = _argspec(func) doc = _doc_parse(getdoc(func), module=module, qualname=qualname) # Merge args d...
def function[_docspec, parameter[func, module, qualname, of_class]]: constant[ For a callable, get the full spec by merging doc_parse() and argspec() :type func: Callable :rtype: data.FDocstring ] variable[sp] assign[=] call[name[_argspec], parameter[name[func]]] variable[doc] assig...
keyword[def] identifier[_docspec] ( identifier[func] , identifier[module] = keyword[None] , identifier[qualname] = keyword[None] , identifier[of_class] = keyword[None] ): literal[string] identifier[sp] = identifier[_argspec] ( identifier[func] ) identifier[doc] = identifier[_doc_parse] ( identifier[ge...
def _docspec(func, module=None, qualname=None, of_class=None): """ For a callable, get the full spec by merging doc_parse() and argspec() :type func: Callable :rtype: data.FDocstring """ sp = _argspec(func) doc = _doc_parse(getdoc(func), module=module, qualname=qualname) # Merge args do...
def _add_logical_operator(self, operator): """Adds a logical operator in query :param operator: logical operator (str) :raise: - QueryExpressionError: if a expression hasn't been set """ if not self.c_oper: raise QueryExpressionError("Logical operators m...
def function[_add_logical_operator, parameter[self, operator]]: constant[Adds a logical operator in query :param operator: logical operator (str) :raise: - QueryExpressionError: if a expression hasn't been set ] if <ast.UnaryOp object at 0x7da1b07a3280> begin[:] ...
keyword[def] identifier[_add_logical_operator] ( identifier[self] , identifier[operator] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[c_oper] : keyword[raise] identifier[QueryExpressionError] ( literal[string] ) identifier[self] . identifier[c...
def _add_logical_operator(self, operator): """Adds a logical operator in query :param operator: logical operator (str) :raise: - QueryExpressionError: if a expression hasn't been set """ if not self.c_oper: raise QueryExpressionError('Logical operators must be preced...
def _pool_one_shape(features_2d, area_width, area_height, batch_size, width, height, depth, fn=tf.reduce_max, name=None): """Pools for an area in features_2d. Args: features_2d: a Tensor in a shape of [batch_size, height, width, depth]. area_width: the max width allowed for an area. ...
def function[_pool_one_shape, parameter[features_2d, area_width, area_height, batch_size, width, height, depth, fn, name]]: constant[Pools for an area in features_2d. Args: features_2d: a Tensor in a shape of [batch_size, height, width, depth]. area_width: the max width allowed for an area. area_...
keyword[def] identifier[_pool_one_shape] ( identifier[features_2d] , identifier[area_width] , identifier[area_height] , identifier[batch_size] , identifier[width] , identifier[height] , identifier[depth] , identifier[fn] = identifier[tf] . identifier[reduce_max] , identifier[name] = keyword[None] ): literal[strin...
def _pool_one_shape(features_2d, area_width, area_height, batch_size, width, height, depth, fn=tf.reduce_max, name=None): """Pools for an area in features_2d. Args: features_2d: a Tensor in a shape of [batch_size, height, width, depth]. area_width: the max width allowed for an area. area_height: the ...
def allZero(buffer): """ Tries to determine if a buffer is empty. @type buffer: str @param buffer: Buffer to test if it is empty. @rtype: bool @return: C{True} if the given buffer is empty, i.e. full of zeros, C{False} if it doesn't. """ allZero = True for byte ...
def function[allZero, parameter[buffer]]: constant[ Tries to determine if a buffer is empty. @type buffer: str @param buffer: Buffer to test if it is empty. @rtype: bool @return: C{True} if the given buffer is empty, i.e. full of zeros, C{False} if it doesn't. ] ...
keyword[def] identifier[allZero] ( identifier[buffer] ): literal[string] identifier[allZero] = keyword[True] keyword[for] identifier[byte] keyword[in] identifier[buffer] : keyword[if] identifier[byte] != literal[string] : identifier[allZero] = keyword[False] ke...
def allZero(buffer): """ Tries to determine if a buffer is empty. @type buffer: str @param buffer: Buffer to test if it is empty. @rtype: bool @return: C{True} if the given buffer is empty, i.e. full of zeros, C{False} if it doesn't. """ allZero = True for byte ...
def remove_umis(adj_list, cluster, nodes): '''removes the specified nodes from the cluster and returns the remaining nodes ''' # list incomprehension: for x in nodes: for node in adj_list[x]: yield node nodes_to_remove = set([node for x in nodes for...
def function[remove_umis, parameter[adj_list, cluster, nodes]]: constant[removes the specified nodes from the cluster and returns the remaining nodes ] variable[nodes_to_remove] assign[=] call[name[set], parameter[binary_operation[<ast.ListComp object at 0x7da20c6a8ca0> + name[nodes]]]] return[b...
keyword[def] identifier[remove_umis] ( identifier[adj_list] , identifier[cluster] , identifier[nodes] ): literal[string] identifier[nodes_to_remove] = identifier[set] ([ identifier[node] keyword[for] identifier[x] keyword[in] identifier[nodes] keyword[for] identifier[node] keyword[in...
def remove_umis(adj_list, cluster, nodes): """removes the specified nodes from the cluster and returns the remaining nodes """ # list incomprehension: for x in nodes: for node in adj_list[x]: yield node nodes_to_remove = set([node for x in nodes for node in adj_list[x]] + nodes) return cluster - nod...
def round_edge_open_mesh(alpha, subtype='diamond pattern wire', angle=0): r'''Returns the loss coefficient for a round edged open net/screen made of one of the following patterns, according to [1]_: 'round bar screen': .. math:: K = 0.95(1-\alpha) + 0.2(1-\alpha)^2 'diamond pattern wire':...
def function[round_edge_open_mesh, parameter[alpha, subtype, angle]]: constant[Returns the loss coefficient for a round edged open net/screen made of one of the following patterns, according to [1]_: 'round bar screen': .. math:: K = 0.95(1-\alpha) + 0.2(1-\alpha)^2 'diamond pattern w...
keyword[def] identifier[round_edge_open_mesh] ( identifier[alpha] , identifier[subtype] = literal[string] , identifier[angle] = literal[int] ): literal[string] keyword[if] identifier[subtype] == literal[string] : identifier[K] = literal[int] *( literal[int] - identifier[alpha] )+ literal[int] *( ...
def round_edge_open_mesh(alpha, subtype='diamond pattern wire', angle=0): """Returns the loss coefficient for a round edged open net/screen made of one of the following patterns, according to [1]_: 'round bar screen': .. math:: K = 0.95(1-\\alpha) + 0.2(1-\\alpha)^2 'diamond pattern wire'...
def union(left, right, distinct=False): """ Union two collections. :param left: left collection :param right: right collection :param distinct: :return: collection :Example: >>> df['name', 'id'].union(df2['id', 'name']) """ left, right = _make_different_sources(left, right) ...
def function[union, parameter[left, right, distinct]]: constant[ Union two collections. :param left: left collection :param right: right collection :param distinct: :return: collection :Example: >>> df['name', 'id'].union(df2['id', 'name']) ] <ast.Tuple object at 0x7da1...
keyword[def] identifier[union] ( identifier[left] , identifier[right] , identifier[distinct] = keyword[False] ): literal[string] identifier[left] , identifier[right] = identifier[_make_different_sources] ( identifier[left] , identifier[right] ) keyword[return] identifier[UnionCollectionExpr] ( identi...
def union(left, right, distinct=False): """ Union two collections. :param left: left collection :param right: right collection :param distinct: :return: collection :Example: >>> df['name', 'id'].union(df2['id', 'name']) """ (left, right) = _make_different_sources(left, right) ...
def get_ugali_dir(): """Get the path to the ugali data directory from the environment""" dirname = os.getenv('UGALIDIR') # Get the HOME directory if not dirname: dirname=os.path.join(os.getenv('HOME'),'.ugali') if not os.path.exists(dirname): from ugali.utils.logger import logger ...
def function[get_ugali_dir, parameter[]]: constant[Get the path to the ugali data directory from the environment] variable[dirname] assign[=] call[name[os].getenv, parameter[constant[UGALIDIR]]] if <ast.UnaryOp object at 0x7da20cabc4f0> begin[:] variable[dirname] assign[=] call[n...
keyword[def] identifier[get_ugali_dir] (): literal[string] identifier[dirname] = identifier[os] . identifier[getenv] ( literal[string] ) keyword[if] keyword[not] identifier[dirname] : identifier[dirname] = identifier[os] . identifier[path] . identifier[join] ( identifier[os] . identi...
def get_ugali_dir(): """Get the path to the ugali data directory from the environment""" dirname = os.getenv('UGALIDIR') # Get the HOME directory if not dirname: dirname = os.path.join(os.getenv('HOME'), '.ugali') # depends on [control=['if'], data=[]] if not os.path.exists(dirname): ...
def batch_get(self, offset=0, count=50, status_list=None): """ 批量查询卡券信息 """ card_data = { 'offset': offset, 'count': count } if status_list: card_data['status_list'] = status_list return self._post( 'card/batchget', ...
def function[batch_get, parameter[self, offset, count, status_list]]: constant[ 批量查询卡券信息 ] variable[card_data] assign[=] dictionary[[<ast.Constant object at 0x7da1b21a2bf0>, <ast.Constant object at 0x7da1b21a1600>], [<ast.Name object at 0x7da1b21a2350>, <ast.Name object at 0x7da1b21a2dd0...
keyword[def] identifier[batch_get] ( identifier[self] , identifier[offset] = literal[int] , identifier[count] = literal[int] , identifier[status_list] = keyword[None] ): literal[string] identifier[card_data] ={ literal[string] : identifier[offset] , literal[string] : identifier[co...
def batch_get(self, offset=0, count=50, status_list=None): """ 批量查询卡券信息 """ card_data = {'offset': offset, 'count': count} if status_list: card_data['status_list'] = status_list # depends on [control=['if'], data=[]] return self._post('card/batchget', data=card_data)
def assistant_from_yaml(cls, source, y, superassistant, fully_loaded=True, role=settings.DEFAULT_ASSISTANT_ROLE): """Constructs instance of YamlAssistant loaded from given structure y, loaded from source file source. Args: source: path to assistant source...
def function[assistant_from_yaml, parameter[cls, source, y, superassistant, fully_loaded, role]]: constant[Constructs instance of YamlAssistant loaded from given structure y, loaded from source file source. Args: source: path to assistant source file y: loaded yaml struc...
keyword[def] identifier[assistant_from_yaml] ( identifier[cls] , identifier[source] , identifier[y] , identifier[superassistant] , identifier[fully_loaded] = keyword[True] , identifier[role] = identifier[settings] . identifier[DEFAULT_ASSISTANT_ROLE] ): literal[string] i...
def assistant_from_yaml(cls, source, y, superassistant, fully_loaded=True, role=settings.DEFAULT_ASSISTANT_ROLE): """Constructs instance of YamlAssistant loaded from given structure y, loaded from source file source. Args: source: path to assistant source file y: loaded yaml...
def values(self, *keys): """ Return the values of the record, optionally filtering to include only certain values by index or key. :param keys: indexes or keys of the items to include; if none are provided, all values will be included :return: list of values ...
def function[values, parameter[self]]: constant[ Return the values of the record, optionally filtering to include only certain values by index or key. :param keys: indexes or keys of the items to include; if none are provided, all values will be included :return: li...
keyword[def] identifier[values] ( identifier[self] ,* identifier[keys] ): literal[string] keyword[if] identifier[keys] : identifier[d] =[] keyword[for] identifier[key] keyword[in] identifier[keys] : keyword[try] : identifier[i] = i...
def values(self, *keys): """ Return the values of the record, optionally filtering to include only certain values by index or key. :param keys: indexes or keys of the items to include; if none are provided, all values will be included :return: list of values """...
def saltmem(human_readable=False): ''' .. versionadded:: 2015.8.0 Returns the amount of memory that salt is using human_readable : False return the value in a nicely formatted number CLI Example: .. code-block:: bash salt '*' status.saltmem salt '*' status.saltmem hu...
def function[saltmem, parameter[human_readable]]: constant[ .. versionadded:: 2015.8.0 Returns the amount of memory that salt is using human_readable : False return the value in a nicely formatted number CLI Example: .. code-block:: bash salt '*' status.saltmem s...
keyword[def] identifier[saltmem] ( identifier[human_readable] = keyword[False] ): literal[string] identifier[p] = identifier[psutil] . identifier[Process] () keyword[with] identifier[p] . identifier[oneshot] (): identifier[mem] = identifier[p] . identifier[memory_info] (). identif...
def saltmem(human_readable=False): """ .. versionadded:: 2015.8.0 Returns the amount of memory that salt is using human_readable : False return the value in a nicely formatted number CLI Example: .. code-block:: bash salt '*' status.saltmem salt '*' status.saltmem hu...
def compile(self): """ Recursively compile this widget as well as all of its children to HTML. :returns: HTML string representation of this widget. """ self.content = "".join(map(lambda x: x.compile(), self.children)) return self._generate_html()
def function[compile, parameter[self]]: constant[ Recursively compile this widget as well as all of its children to HTML. :returns: HTML string representation of this widget. ] name[self].content assign[=] call[constant[].join, parameter[call[name[map], parameter[<ast.Lambda obj...
keyword[def] identifier[compile] ( identifier[self] ): literal[string] identifier[self] . identifier[content] = literal[string] . identifier[join] ( identifier[map] ( keyword[lambda] identifier[x] : identifier[x] . identifier[compile] (), identifier[self] . identifier[children] )) keyword...
def compile(self): """ Recursively compile this widget as well as all of its children to HTML. :returns: HTML string representation of this widget. """ self.content = ''.join(map(lambda x: x.compile(), self.children)) return self._generate_html()
def resource_to_portal_type(resource): """Converts a resource to a portal type :param resource: Resource name as it is used in the content route :type name: string :returns: Portal type name :rtype: string """ if resource is None: return None resource_mapping = get_resource_map...
def function[resource_to_portal_type, parameter[resource]]: constant[Converts a resource to a portal type :param resource: Resource name as it is used in the content route :type name: string :returns: Portal type name :rtype: string ] if compare[name[resource] is constant[None]] beg...
keyword[def] identifier[resource_to_portal_type] ( identifier[resource] ): literal[string] keyword[if] identifier[resource] keyword[is] keyword[None] : keyword[return] keyword[None] identifier[resource_mapping] = identifier[get_resource_mapping] () identifier[portal_type] = identif...
def resource_to_portal_type(resource): """Converts a resource to a portal type :param resource: Resource name as it is used in the content route :type name: string :returns: Portal type name :rtype: string """ if resource is None: return None # depends on [control=['if'], data=[]] ...
def _execShowCountCmd(self, showcmd): """Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. """ result = None lines = self._execCmd("show", showcmd + " count") for line in line...
def function[_execShowCountCmd, parameter[self, showcmd]]: constant[Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. ] variable[result] assign[=] constant[None] variable[lines] assig...
keyword[def] identifier[_execShowCountCmd] ( identifier[self] , identifier[showcmd] ): literal[string] identifier[result] = keyword[None] identifier[lines] = identifier[self] . identifier[_execCmd] ( literal[string] , identifier[showcmd] + literal[string] ) keyword[for] identifi...
def _execShowCountCmd(self, showcmd): """Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. """ result = None lines = self._execCmd('show', showcmd + ' count') for line in lines: mobj ...
def wrap(self, alias=None): """ Wraps the query by selecting all fields from itself :rtype: :class:`Query <querybuilder.query.Query>` :return: The wrapped query """ field_names = self.get_field_names() query = Query(self.connection).from_table(deepcopy(self), ali...
def function[wrap, parameter[self, alias]]: constant[ Wraps the query by selecting all fields from itself :rtype: :class:`Query <querybuilder.query.Query>` :return: The wrapped query ] variable[field_names] assign[=] call[name[self].get_field_names, parameter[]] ...
keyword[def] identifier[wrap] ( identifier[self] , identifier[alias] = keyword[None] ): literal[string] identifier[field_names] = identifier[self] . identifier[get_field_names] () identifier[query] = identifier[Query] ( identifier[self] . identifier[connection] ). identifier[from_table] ( ...
def wrap(self, alias=None): """ Wraps the query by selecting all fields from itself :rtype: :class:`Query <querybuilder.query.Query>` :return: The wrapped query """ field_names = self.get_field_names() query = Query(self.connection).from_table(deepcopy(self), alias=alias) ...
def preview_box(endpoint=None, filename=None): """Create a preview box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. """ preview_size = current_app.config['AVATARS_CROP_PREVIEW_SIZE'...
def function[preview_box, parameter[endpoint, filename]]: constant[Create a preview box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. ] variable[preview_size] assign[=] <ast.BoolOp o...
keyword[def] identifier[preview_box] ( identifier[endpoint] = keyword[None] , identifier[filename] = keyword[None] ): literal[string] identifier[preview_size] = identifier[current_app] . identifier[config] [ literal[string] ] keyword[or] identifier[current_app] . identifier[config] [ literal[strin...
def preview_box(endpoint=None, filename=None): """Create a preview box. :param endpoint: The endpoint of view function that serve avatar image file. :param filename: The filename of the image that need to be crop. """ preview_size = current_app.config['AVATARS_CROP_PREVIEW_SIZE'] or cur...
def change_nick(self,new_nick): """ Send a nick change request to the room. :Parameters: - `new_nick`: the new nickname requested. :Types: - `new_nick`: `unicode` """ new_room_jid=JID(self.room_jid.node,self.room_jid.domain,new_nick) p=Pre...
def function[change_nick, parameter[self, new_nick]]: constant[ Send a nick change request to the room. :Parameters: - `new_nick`: the new nickname requested. :Types: - `new_nick`: `unicode` ] variable[new_room_jid] assign[=] call[name[JID], param...
keyword[def] identifier[change_nick] ( identifier[self] , identifier[new_nick] ): literal[string] identifier[new_room_jid] = identifier[JID] ( identifier[self] . identifier[room_jid] . identifier[node] , identifier[self] . identifier[room_jid] . identifier[domain] , identifier[new_nick] ) ...
def change_nick(self, new_nick): """ Send a nick change request to the room. :Parameters: - `new_nick`: the new nickname requested. :Types: - `new_nick`: `unicode` """ new_room_jid = JID(self.room_jid.node, self.room_jid.domain, new_nick) p = Presence...
def save_metadata_json(self, filename: str, structure: JsonExportable) -> None: """Saves metadata JSON file of a structure.""" if self.compress_json: filename += '.json.xz' else: filename += '.json' save_structure_to_file(structure, filename) if isinstance...
def function[save_metadata_json, parameter[self, filename, structure]]: constant[Saves metadata JSON file of a structure.] if name[self].compress_json begin[:] <ast.AugAssign object at 0x7da20c6e62f0> call[name[save_structure_to_file], parameter[name[structure], name[filename]]] ...
keyword[def] identifier[save_metadata_json] ( identifier[self] , identifier[filename] : identifier[str] , identifier[structure] : identifier[JsonExportable] )-> keyword[None] : literal[string] keyword[if] identifier[self] . identifier[compress_json] : identifier[filename] += literal[s...
def save_metadata_json(self, filename: str, structure: JsonExportable) -> None: """Saves metadata JSON file of a structure.""" if self.compress_json: filename += '.json.xz' # depends on [control=['if'], data=[]] else: filename += '.json' save_structure_to_file(structure, filename) i...
def json_2_injector_component(json_obj): """ transform the JSON return by Ariane server to local object :param json_obj: the JSON returned by Ariane server :return: a new InjectorCachedComponent """ LOGGER.debug("InjectorCachedComponent.json_2_injector_component") ...
def function[json_2_injector_component, parameter[json_obj]]: constant[ transform the JSON return by Ariane server to local object :param json_obj: the JSON returned by Ariane server :return: a new InjectorCachedComponent ] call[name[LOGGER].debug, parameter[constant[Inje...
keyword[def] identifier[json_2_injector_component] ( identifier[json_obj] ): literal[string] identifier[LOGGER] . identifier[debug] ( literal[string] ) keyword[return] identifier[InjectorCachedComponent] ( identifier[component_id] = identifier[json_obj] [ literal[string] ], ...
def json_2_injector_component(json_obj): """ transform the JSON return by Ariane server to local object :param json_obj: the JSON returned by Ariane server :return: a new InjectorCachedComponent """ LOGGER.debug('InjectorCachedComponent.json_2_injector_component') return Inje...
def clear_cache(self, items=None, topic=EVENT_TOPIC): """ expects event object to be in the format of a session-stop or session-expire event, whose results attribute is a namedtuple(identifiers, session_key) """ try: for realm in self.realms: i...
def function[clear_cache, parameter[self, items, topic]]: constant[ expects event object to be in the format of a session-stop or session-expire event, whose results attribute is a namedtuple(identifiers, session_key) ] <ast.Try object at 0x7da20c6c7a00>
keyword[def] identifier[clear_cache] ( identifier[self] , identifier[items] = keyword[None] , identifier[topic] = identifier[EVENT_TOPIC] ): literal[string] keyword[try] : keyword[for] identifier[realm] keyword[in] identifier[self] . identifier[realms] : identifier[...
def clear_cache(self, items=None, topic=EVENT_TOPIC): """ expects event object to be in the format of a session-stop or session-expire event, whose results attribute is a namedtuple(identifiers, session_key) """ try: for realm in self.realms: identifier = item...
def on_execute__set_surface_alphas(self, request): ''' .. versionchanged:: 0.12 Queue redraw after setting surface alphas. ''' data = decode_content_data(request) logger.debug('[on_execute__set_surface_alphas] %s', data['surface_alphas']) ...
def function[on_execute__set_surface_alphas, parameter[self, request]]: constant[ .. versionchanged:: 0.12 Queue redraw after setting surface alphas. ] variable[data] assign[=] call[name[decode_content_data], parameter[name[request]]] call[name[logger].debug, paramete...
keyword[def] identifier[on_execute__set_surface_alphas] ( identifier[self] , identifier[request] ): literal[string] identifier[data] = identifier[decode_content_data] ( identifier[request] ) identifier[logger] . identifier[debug] ( literal[string] , identifier[data] [ literal[stri...
def on_execute__set_surface_alphas(self, request): """ .. versionchanged:: 0.12 Queue redraw after setting surface alphas. """ data = decode_content_data(request) logger.debug('[on_execute__set_surface_alphas] %s', data['surface_alphas']) for (name, alpha) in data['surface_al...
def do_use(self, line): "use {tablename}" self.table = boto.dynamodb2.table.Table(line, connection=self.conn) self.pprint(self.table.describe()) self.prompt = "%s> " % self.table.table_name
def function[do_use, parameter[self, line]]: constant[use {tablename}] name[self].table assign[=] call[name[boto].dynamodb2.table.Table, parameter[name[line]]] call[name[self].pprint, parameter[call[name[self].table.describe, parameter[]]]] name[self].prompt assign[=] binary_operation[co...
keyword[def] identifier[do_use] ( identifier[self] , identifier[line] ): literal[string] identifier[self] . identifier[table] = identifier[boto] . identifier[dynamodb2] . identifier[table] . identifier[Table] ( identifier[line] , identifier[connection] = identifier[self] . identifier[conn] ) ...
def do_use(self, line): """use {tablename}""" self.table = boto.dynamodb2.table.Table(line, connection=self.conn) self.pprint(self.table.describe()) self.prompt = '%s> ' % self.table.table_name
def replace(self, to_replace, value, inplace=False, filter=None, regex=False, convert=True): """replace the to_replace value with value, possible to create new blocks here this is just a call to putmask. regex is not used here. It is used in ObjectBlocks. It is here for API comp...
def function[replace, parameter[self, to_replace, value, inplace, filter, regex, convert]]: constant[replace the to_replace value with value, possible to create new blocks here this is just a call to putmask. regex is not used here. It is used in ObjectBlocks. It is here for API compatibility. ...
keyword[def] identifier[replace] ( identifier[self] , identifier[to_replace] , identifier[value] , identifier[inplace] = keyword[False] , identifier[filter] = keyword[None] , identifier[regex] = keyword[False] , identifier[convert] = keyword[True] ): literal[string] identifier[inplace] = identifi...
def replace(self, to_replace, value, inplace=False, filter=None, regex=False, convert=True): """replace the to_replace value with value, possible to create new blocks here this is just a call to putmask. regex is not used here. It is used in ObjectBlocks. It is here for API compatibility. "...
def _process_change(self, server_description): """Process a new ServerDescription on an opened topology. Hold the lock when calling this. """ td_old = self._description if self._publish_server: old_server_description = td_old._server_descriptions[ ser...
def function[_process_change, parameter[self, server_description]]: constant[Process a new ServerDescription on an opened topology. Hold the lock when calling this. ] variable[td_old] assign[=] name[self]._description if name[self]._publish_server begin[:] variab...
keyword[def] identifier[_process_change] ( identifier[self] , identifier[server_description] ): literal[string] identifier[td_old] = identifier[self] . identifier[_description] keyword[if] identifier[self] . identifier[_publish_server] : identifier[old_server_description] = ...
def _process_change(self, server_description): """Process a new ServerDescription on an opened topology. Hold the lock when calling this. """ td_old = self._description if self._publish_server: old_server_description = td_old._server_descriptions[server_description.address] ...
def _parse_path(self, path): """Return (hosts, path) tuple""" # Support specifying another host via hdfs://host:port/path syntax # We ignore the scheme and piece together the query and fragment # Note that HDFS URIs are not URL encoded, so a '?' or a '#' in the URI is part of the ...
def function[_parse_path, parameter[self, path]]: constant[Return (hosts, path) tuple] variable[parts] assign[=] call[name[urlsplit], parameter[name[path]]] if <ast.UnaryOp object at 0x7da18fe91d20> begin[:] <ast.Raise object at 0x7da18fe92980> if compare[name[parts].scheme <ast....
keyword[def] identifier[_parse_path] ( identifier[self] , identifier[path] ): literal[string] identifier[parts] = identifier[urlsplit] ( identifier[path] , identifier[allow_fragments] = keyword[False] ) keyword[if] keyword[not] identifier[parts] . iden...
def _parse_path(self, path): """Return (hosts, path) tuple""" # Support specifying another host via hdfs://host:port/path syntax # We ignore the scheme and piece together the query and fragment # Note that HDFS URIs are not URL encoded, so a '?' or a '#' in the URI is part of the # path parts = ...
def batch_rename_file(path, f, t): """根据replaces中定义的规则,批量重命名""" files = os.listdir(path) for file in files: if f in file: new_fn = file.replace(f, t) old = os.path.join(path, file) new = os.path.join(path, new_fn) os.rename(old, new)
def function[batch_rename_file, parameter[path, f, t]]: constant[根据replaces中定义的规则,批量重命名] variable[files] assign[=] call[name[os].listdir, parameter[name[path]]] for taget[name[file]] in starred[name[files]] begin[:] if compare[name[f] in name[file]] begin[:] ...
keyword[def] identifier[batch_rename_file] ( identifier[path] , identifier[f] , identifier[t] ): literal[string] identifier[files] = identifier[os] . identifier[listdir] ( identifier[path] ) keyword[for] identifier[file] keyword[in] identifier[files] : keyword[if] identifier[f] keyword[i...
def batch_rename_file(path, f, t): """根据replaces中定义的规则,批量重命名""" files = os.listdir(path) for file in files: if f in file: new_fn = file.replace(f, t) old = os.path.join(path, file) new = os.path.join(path, new_fn) os.rename(old, new) # depends on [con...
def not_completed(f): """Decorator function to check if user is loged in. :raises: :class:`FMBaseError` if not logged in """ @wraps(f) def check_if_complete(cls, *args, **kwargs): if cls.is_complete: raise FMBaseError('Transfer already completed.') return f(cls, *args,...
def function[not_completed, parameter[f]]: constant[Decorator function to check if user is loged in. :raises: :class:`FMBaseError` if not logged in ] def function[check_if_complete, parameter[cls]]: if name[cls].is_complete begin[:] <ast.Raise object at 0x7da18f09e1d...
keyword[def] identifier[not_completed] ( identifier[f] ): literal[string] @ identifier[wraps] ( identifier[f] ) keyword[def] identifier[check_if_complete] ( identifier[cls] ,* identifier[args] ,** identifier[kwargs] ): keyword[if] identifier[cls] . identifier[is_complete] : key...
def not_completed(f): """Decorator function to check if user is loged in. :raises: :class:`FMBaseError` if not logged in """ @wraps(f) def check_if_complete(cls, *args, **kwargs): if cls.is_complete: raise FMBaseError('Transfer already completed.') # depends on [control=['if']...
def map_exceptions(self, mapping, *args, **kwargs): """ Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs. """ @self.__call__(*args, **kwargs) def helper(e,...
def function[map_exceptions, parameter[self, mapping]]: constant[ Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs. ] def function[helper, parameter[e, status]]: ...
keyword[def] identifier[map_exceptions] ( identifier[self] , identifier[mapping] ,* identifier[args] ,** identifier[kwargs] ): literal[string] @ identifier[self] . identifier[__call__] (* identifier[args] ,** identifier[kwargs] ) keyword[def] identifier[helper] ( identifier[e] , identifier...
def map_exceptions(self, mapping, *args, **kwargs): """ Exception mapping helper decorator. Takes the same arguments as the main decorator, plus `mapping`, which is a list of `(exception_class, status_line)` pairs. """ @self.__call__(*args, **kwargs) def helper(e, status): ...
def keygen(sk_file=None, pk_file=None, **kwargs): ''' Use libnacl to generate a keypair. If no `sk_file` is defined return a keypair. If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`. When the `sk_file` is already existing, but `pk_file` is not. The `pk_file...
def function[keygen, parameter[sk_file, pk_file]]: constant[ Use libnacl to generate a keypair. If no `sk_file` is defined return a keypair. If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`. When the `sk_file` is already existing, but `pk_file` is not. T...
keyword[def] identifier[keygen] ( identifier[sk_file] = keyword[None] , identifier[pk_file] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[kwargs] [ literal[string] ]= identifier[__opts__] keyword[return] identifier[salt] . identifier[utils] . identifier[nacl] . identifier[keyg...
def keygen(sk_file=None, pk_file=None, **kwargs): """ Use libnacl to generate a keypair. If no `sk_file` is defined return a keypair. If only the `sk_file` is defined `pk_file` will use the same name with a postfix `.pub`. When the `sk_file` is already existing, but `pk_file` is not. The `pk_file...
def _mplain_word_separator(self): """ Get the word separator to split words in mplain format. :rtype: string """ word_separator = gf.safe_get(self.parameters, gc.PPN_TASK_IS_TEXT_MPLAIN_WORD_SEPARATOR, u" ") if (word_separator is None) or (word_separator == "space"): ...
def function[_mplain_word_separator, parameter[self]]: constant[ Get the word separator to split words in mplain format. :rtype: string ] variable[word_separator] assign[=] call[name[gf].safe_get, parameter[name[self].parameters, name[gc].PPN_TASK_IS_TEXT_MPLAIN_WORD_SEPARATOR, ...
keyword[def] identifier[_mplain_word_separator] ( identifier[self] ): literal[string] identifier[word_separator] = identifier[gf] . identifier[safe_get] ( identifier[self] . identifier[parameters] , identifier[gc] . identifier[PPN_TASK_IS_TEXT_MPLAIN_WORD_SEPARATOR] , literal[string] ) key...
def _mplain_word_separator(self): """ Get the word separator to split words in mplain format. :rtype: string """ word_separator = gf.safe_get(self.parameters, gc.PPN_TASK_IS_TEXT_MPLAIN_WORD_SEPARATOR, u' ') if word_separator is None or word_separator == 'space': return u' '...
def playlist_songs(self, playlist): """Get a listing of songs from a playlist. Paramters: playlist (dict): A playlist dict. Returns: list: Playlist song dicts. """ playlist_type = playlist.get('type') playlist_song_list = [] if playlist_type in ('USER_GENERATED', None): start_token = None ...
def function[playlist_songs, parameter[self, playlist]]: constant[Get a listing of songs from a playlist. Paramters: playlist (dict): A playlist dict. Returns: list: Playlist song dicts. ] variable[playlist_type] assign[=] call[name[playlist].get, parameter[constant[type]]] variabl...
keyword[def] identifier[playlist_songs] ( identifier[self] , identifier[playlist] ): literal[string] identifier[playlist_type] = identifier[playlist] . identifier[get] ( literal[string] ) identifier[playlist_song_list] =[] keyword[if] identifier[playlist_type] keyword[in] ( literal[string] , keyword[...
def playlist_songs(self, playlist): """Get a listing of songs from a playlist. Paramters: playlist (dict): A playlist dict. Returns: list: Playlist song dicts. """ playlist_type = playlist.get('type') playlist_song_list = [] if playlist_type in ('USER_GENERATED', None): start_token...
def is_int_like(value): """Returns whether the value can be used as a standard integer. >>> is_int_like(4) True >>> is_int_like(4.0) False >>> is_int_like("4") False >>> is_int_like("abc") False """ try: if isinstance(value, int): ret...
def function[is_int_like, parameter[value]]: constant[Returns whether the value can be used as a standard integer. >>> is_int_like(4) True >>> is_int_like(4.0) False >>> is_int_like("4") False >>> is_int_like("abc") False ] <ast.Try objec...
keyword[def] identifier[is_int_like] ( identifier[value] ): literal[string] keyword[try] : keyword[if] identifier[isinstance] ( identifier[value] , identifier[int] ): keyword[return] keyword[True] keyword[return] identifier[int] ( identifier[value] )== identifier[value] keyword[and] ...
def is_int_like(value): """Returns whether the value can be used as a standard integer. >>> is_int_like(4) True >>> is_int_like(4.0) False >>> is_int_like("4") False >>> is_int_like("abc") False """ try: if isinstance(value, int): ...
def qx(mt, x): """ qx: Returns the probability that a life aged x dies before 1 year With the convention: the true probability is qx/1000 Args: mt: the mortality table x: the age as integer number. """ if x < len(mt.qx): return mt.qx[x] else: return 0
def function[qx, parameter[mt, x]]: constant[ qx: Returns the probability that a life aged x dies before 1 year With the convention: the true probability is qx/1000 Args: mt: the mortality table x: the age as integer number. ] if compare[name[x] less[<] call[name[len]...
keyword[def] identifier[qx] ( identifier[mt] , identifier[x] ): literal[string] keyword[if] identifier[x] < identifier[len] ( identifier[mt] . identifier[qx] ): keyword[return] identifier[mt] . identifier[qx] [ identifier[x] ] keyword[else] : keyword[return] literal[int]
def qx(mt, x): """ qx: Returns the probability that a life aged x dies before 1 year With the convention: the true probability is qx/1000 Args: mt: the mortality table x: the age as integer number. """ if x < len(mt.qx): return mt.qx[x] # depends on [control=['if'], ...
def running(name, **kwargs): r''' Defines and starts a new VM with specified arguments, or restart a VM (or group of VMs). (Runs ``vagrant up``.) :param name: the Salt_id node name you wish your VM to have. If ``name`` contains a "?" or "*" then it will re-start a group of VMs which have been...
def function[running, parameter[name]]: constant[ Defines and starts a new VM with specified arguments, or restart a VM (or group of VMs). (Runs ``vagrant up``.) :param name: the Salt_id node name you wish your VM to have. If ``name`` contains a "?" or "*" then it will re-start a group of VMs...
keyword[def] identifier[running] ( identifier[name] ,** identifier[kwargs] ): literal[string] keyword[if] literal[string] keyword[in] identifier[name] keyword[or] literal[string] keyword[in] identifier[name] : keyword[return] identifier[_vagrant_call] ( identifier[name] , literal[string] ...
def running(name, **kwargs): """ Defines and starts a new VM with specified arguments, or restart a VM (or group of VMs). (Runs ``vagrant up``.) :param name: the Salt_id node name you wish your VM to have. If ``name`` contains a "?" or "*" then it will re-start a group of VMs which have been ...
def call(self, fn, *args, **kwargs): """ Like :meth:`call_async`, but block until the return value is available. Equivalent to:: call_async(fn, *args, **kwargs).get().unpickle() :returns: The function's return value. :raises mitogen.core.CallError: ...
def function[call, parameter[self, fn]]: constant[ Like :meth:`call_async`, but block until the return value is available. Equivalent to:: call_async(fn, *args, **kwargs).get().unpickle() :returns: The function's return value. :raises mitogen.core.CallEr...
keyword[def] identifier[call] ( identifier[self] , identifier[fn] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[receiver] = identifier[self] . identifier[call_async] ( identifier[fn] ,* identifier[args] ,** identifier[kwargs] ) keyword[return] identifier[receive...
def call(self, fn, *args, **kwargs): """ Like :meth:`call_async`, but block until the return value is available. Equivalent to:: call_async(fn, *args, **kwargs).get().unpickle() :returns: The function's return value. :raises mitogen.core.CallError: ...
def _dy_shapelets(self, shapelets, beta): """ computes the derivative d/dx of the shapelet coeffs :param shapelets: :param beta: :return: """ num_n = len(shapelets) dy = np.zeros((num_n+1, num_n+1)) for n1 in range(num_n): for n2 in ran...
def function[_dy_shapelets, parameter[self, shapelets, beta]]: constant[ computes the derivative d/dx of the shapelet coeffs :param shapelets: :param beta: :return: ] variable[num_n] assign[=] call[name[len], parameter[name[shapelets]]] variable[dy] assign...
keyword[def] identifier[_dy_shapelets] ( identifier[self] , identifier[shapelets] , identifier[beta] ): literal[string] identifier[num_n] = identifier[len] ( identifier[shapelets] ) identifier[dy] = identifier[np] . identifier[zeros] (( identifier[num_n] + literal[int] , identifier[num_n] ...
def _dy_shapelets(self, shapelets, beta): """ computes the derivative d/dx of the shapelet coeffs :param shapelets: :param beta: :return: """ num_n = len(shapelets) dy = np.zeros((num_n + 1, num_n + 1)) for n1 in range(num_n): for n2 in range(num_n): ...
def attr(self, kw=None, _attributes=None, **attrs): """Add a general or graph/node/edge attribute statement. Args: kw: Attributes target (``None`` or ``'graph'``, ``'node'``, ``'edge'``). attrs: Attributes to be set (must be strings, may be empty). See the :ref:`usage e...
def function[attr, parameter[self, kw, _attributes]]: constant[Add a general or graph/node/edge attribute statement. Args: kw: Attributes target (``None`` or ``'graph'``, ``'node'``, ``'edge'``). attrs: Attributes to be set (must be strings, may be empty). See the :ref:...
keyword[def] identifier[attr] ( identifier[self] , identifier[kw] = keyword[None] , identifier[_attributes] = keyword[None] ,** identifier[attrs] ): literal[string] keyword[if] identifier[kw] keyword[is] keyword[not] keyword[None] keyword[and] identifier[kw] . identifier[lower] () keyword[not...
def attr(self, kw=None, _attributes=None, **attrs): """Add a general or graph/node/edge attribute statement. Args: kw: Attributes target (``None`` or ``'graph'``, ``'node'``, ``'edge'``). attrs: Attributes to be set (must be strings, may be empty). See the :ref:`usage examp...
def start_watching(self): """ Begins watching etcd for changes. """ # Don't create a new watcher thread if we already have one running if self.watcher and self.watcher.is_alive(): return # Create a new watcher thread and start it self.watcher = Watcher() self...
def function[start_watching, parameter[self]]: constant[ Begins watching etcd for changes. ] if <ast.BoolOp object at 0x7da204960d90> begin[:] return[None] name[self].watcher assign[=] call[name[Watcher], parameter[]] call[name[self].watcher.start, parameter[]]
keyword[def] identifier[start_watching] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[watcher] keyword[and] identifier[self] . identifier[watcher] . identifier[is_alive] (): keyword[return] identifier[self] . identif...
def start_watching(self): """ Begins watching etcd for changes. """ # Don't create a new watcher thread if we already have one running if self.watcher and self.watcher.is_alive(): return # depends on [control=['if'], data=[]] # Create a new watcher thread and start it self.watcher = Watcher...
def analyse_text(text): """ Check if code contains REBOL header and so it probably not R code """ if re.match(r'^\s*REBOL\s*\[', text, re.IGNORECASE): # The code starts with REBOL header return 1.0 elif re.search(r'\s*REBOL\s*[', text, re.IGNORECASE): ...
def function[analyse_text, parameter[text]]: constant[ Check if code contains REBOL header and so it probably not R code ] if call[name[re].match, parameter[constant[^\s*REBOL\s*\[], name[text], name[re].IGNORECASE]] begin[:] return[constant[1.0]]
keyword[def] identifier[analyse_text] ( identifier[text] ): literal[string] keyword[if] identifier[re] . identifier[match] ( literal[string] , identifier[text] , identifier[re] . identifier[IGNORECASE] ): keyword[return] literal[int] keyword[elif] identifier[re] ....
def analyse_text(text): """ Check if code contains REBOL header and so it probably not R code """ if re.match('^\\s*REBOL\\s*\\[', text, re.IGNORECASE): # The code starts with REBOL header return 1.0 # depends on [control=['if'], data=[]] elif re.search('\\s*REBOL\\s*[', tex...
def get_header(fn, file_format, header_bytes=20000, verbose=False, *args, **kwargs): """Apply rules for detecting the boundary of the header :param str fn: file name :param str file_format: either ``AmiraMesh`` or ``HyperSurface`` :param int header_bytes: number of bytes in which to search for the ...
def function[get_header, parameter[fn, file_format, header_bytes, verbose]]: constant[Apply rules for detecting the boundary of the header :param str fn: file name :param str file_format: either ``AmiraMesh`` or ``HyperSurface`` :param int header_bytes: number of bytes in which to search for th...
keyword[def] identifier[get_header] ( identifier[fn] , identifier[file_format] , identifier[header_bytes] = literal[int] , identifier[verbose] = keyword[False] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[assert] identifier[header_bytes] > literal[int] keyword[assert] ident...
def get_header(fn, file_format, header_bytes=20000, verbose=False, *args, **kwargs): """Apply rules for detecting the boundary of the header :param str fn: file name :param str file_format: either ``AmiraMesh`` or ``HyperSurface`` :param int header_bytes: number of bytes in which to search for the ...
def info(self, id): """Return the ``Package`` or ``Collection`` record for the given item.""" #self._update_index() # This is commented because it leads to # excessive network load if id in self._packages: return self._packages[id] if id in self._collections: return self...
def function[info, parameter[self, id]]: constant[Return the ``Package`` or ``Collection`` record for the given item.] if compare[name[id] in name[self]._packages] begin[:] return[call[name[self]._packages][name[id]]] if compare[name[id] in name[self]._collections] begin[:] ...
keyword[def] identifier[info] ( identifier[self] , identifier[id] ): literal[string] keyword[if] identifier[id] keyword[in] identifier[self] . identifier[_packages] : keyword[return] identifier[self] . identifier[_packages] [ identifier[id] ] keyword[if] identifier[id] keyword[in] ide...
def info(self, id): """Return the ``Package`` or ``Collection`` record for the given item.""" #self._update_index() # This is commented because it leads to # excessive network load if id in self._packages: return self._packages[id] # depends on [control=['if'], data=['id']] if id in ...
def x_pos(self, xval): "Return the x position (on the canvas) corresponding to XVAL." off = self.x_coord.get_canvas_pos(self.size[0], xval, self.x_range[0], self.x_range[1]) return self.loc[0] + off
def function[x_pos, parameter[self, xval]]: constant[Return the x position (on the canvas) corresponding to XVAL.] variable[off] assign[=] call[name[self].x_coord.get_canvas_pos, parameter[call[name[self].size][constant[0]], name[xval], call[name[self].x_range][constant[0]], call[name[self].x_range][con...
keyword[def] identifier[x_pos] ( identifier[self] , identifier[xval] ): literal[string] identifier[off] = identifier[self] . identifier[x_coord] . identifier[get_canvas_pos] ( identifier[self] . identifier[size] [ literal[int] ], identifier[xval] , identifier[self] . identifier[x_range] [ ...
def x_pos(self, xval): """Return the x position (on the canvas) corresponding to XVAL.""" off = self.x_coord.get_canvas_pos(self.size[0], xval, self.x_range[0], self.x_range[1]) return self.loc[0] + off
async def create_websocket_client(sock: anyio.abc.SocketStream, addr, path: str, headers: Optional[List] = None, subprotocols: Optional[List[str]] = None): """ A more low-level...
<ast.AsyncFunctionDef object at 0x7da2046204f0>
keyword[async] keyword[def] identifier[create_websocket_client] ( identifier[sock] : identifier[anyio] . identifier[abc] . identifier[SocketStream] , identifier[addr] , identifier[path] : identifier[str] , identifier[headers] : identifier[Optional] [ identifier[List] ]= keyword[None] , identifier[subprotocols] :...
async def create_websocket_client(sock: anyio.abc.SocketStream, addr, path: str, headers: Optional[List]=None, subprotocols: Optional[List[str]]=None): """ A more low-level form of create_websocket_client. You are responsible for closing this websocket. """ ws = Websocket() await ws.start_client...
def video_search(self, entitiy_type, query, **kwargs): """ Search the TV schedule database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movie ``tvseries`` TV series ``episode`` Episode titles ``onetimeonly...
def function[video_search, parameter[self, entitiy_type, query]]: constant[ Search the TV schedule database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movie ``tvseries`` TV series ``episode`` Episode titles ...
keyword[def] identifier[video_search] ( identifier[self] , identifier[entitiy_type] , identifier[query] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[make_request] ( literal[string] , identifier[entitiy_type] , identifier[query] , identifier[kwargs] )
def video_search(self, entitiy_type, query, **kwargs): """ Search the TV schedule database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movie ``tvseries`` TV series ``episode`` Episode titles ``onetimeonly`` ...
def replace_all(text, dic): """Takes a string and dictionary. replaces all occurrences of i with j""" for i, j in dic.iteritems(): text = text.replace(i, j) return text
def function[replace_all, parameter[text, dic]]: constant[Takes a string and dictionary. replaces all occurrences of i with j] for taget[tuple[[<ast.Name object at 0x7da1b1f39de0>, <ast.Name object at 0x7da1b1f3bd60>]]] in starred[call[name[dic].iteritems, parameter[]]] begin[:] variable...
keyword[def] identifier[replace_all] ( identifier[text] , identifier[dic] ): literal[string] keyword[for] identifier[i] , identifier[j] keyword[in] identifier[dic] . identifier[iteritems] (): identifier[text] = identifier[text] . identifier[replace] ( identifier[i] , identifier[j] ) keywo...
def replace_all(text, dic): """Takes a string and dictionary. replaces all occurrences of i with j""" for (i, j) in dic.iteritems(): text = text.replace(i, j) # depends on [control=['for'], data=[]] return text
def host(environ): # pragma: no cover """ Reconstruct host from environment. A modified version of http://www.python.org/dev/peps/pep-0333/#url-reconstruction """ url = environ['wsgi.url_scheme'] + '://' if environ.get('HTTP_HOST'): url += environ['HTTP_HOST'] else: url +=...
def function[host, parameter[environ]]: constant[ Reconstruct host from environment. A modified version of http://www.python.org/dev/peps/pep-0333/#url-reconstruction ] variable[url] assign[=] binary_operation[call[name[environ]][constant[wsgi.url_scheme]] + constant[://]] if call[na...
keyword[def] identifier[host] ( identifier[environ] ): literal[string] identifier[url] = identifier[environ] [ literal[string] ]+ literal[string] keyword[if] identifier[environ] . identifier[get] ( literal[string] ): identifier[url] += identifier[environ] [ literal[string] ] keyword[...
def host(environ): # pragma: no cover '\n Reconstruct host from environment. A modified version\n of http://www.python.org/dev/peps/pep-0333/#url-reconstruction\n ' url = environ['wsgi.url_scheme'] + '://' if environ.get('HTTP_HOST'): url += environ['HTTP_HOST'] # depends on [control=['if...
def update(self): """Actual update process goes here using auxialary ``get_currencies`` and ``get_exchangerates`` methods. This method creates or updates corresponding ``Currency`` and ``ExchangeRate`` models """ currencies = self.get_currencies() currency_objects = {} ...
def function[update, parameter[self]]: constant[Actual update process goes here using auxialary ``get_currencies`` and ``get_exchangerates`` methods. This method creates or updates corresponding ``Currency`` and ``ExchangeRate`` models ] variable[currencies] assign[=] call[name[...
keyword[def] identifier[update] ( identifier[self] ): literal[string] identifier[currencies] = identifier[self] . identifier[get_currencies] () identifier[currency_objects] ={} keyword[for] identifier[code] , identifier[name] keyword[in] identifier[currencies] : id...
def update(self): """Actual update process goes here using auxialary ``get_currencies`` and ``get_exchangerates`` methods. This method creates or updates corresponding ``Currency`` and ``ExchangeRate`` models """ currencies = self.get_currencies() currency_objects = {} for (code...
def export_vms( self, vms_names=None, standalone=False, export_dir='.', compress=False, init_file_name='LagoInitFile', out_format=YAMLOutFormatPlugin(), collect_only=False, with_threads=True, ): """ Export vm images disks and in...
def function[export_vms, parameter[self, vms_names, standalone, export_dir, compress, init_file_name, out_format, collect_only, with_threads]]: constant[ Export vm images disks and init file. The exported images and init file can be used to recreate the environment. Args: ...
keyword[def] identifier[export_vms] ( identifier[self] , identifier[vms_names] = keyword[None] , identifier[standalone] = keyword[False] , identifier[export_dir] = literal[string] , identifier[compress] = keyword[False] , identifier[init_file_name] = literal[string] , identifier[out_format] = identifier[YAMLOu...
def export_vms(self, vms_names=None, standalone=False, export_dir='.', compress=False, init_file_name='LagoInitFile', out_format=YAMLOutFormatPlugin(), collect_only=False, with_threads=True): """ Export vm images disks and init file. The exported images and init file can be used to recreate ...
def to_binary(decimal, length): """ Given a decimal, generate the binary equivalent string of given length. e.g. binary(2, 5) = 00010 """ b = bitstring.Bits(int=decimal, length=length) return b.bin
def function[to_binary, parameter[decimal, length]]: constant[ Given a decimal, generate the binary equivalent string of given length. e.g. binary(2, 5) = 00010 ] variable[b] assign[=] call[name[bitstring].Bits, parameter[]] return[name[b].bin]
keyword[def] identifier[to_binary] ( identifier[decimal] , identifier[length] ): literal[string] identifier[b] = identifier[bitstring] . identifier[Bits] ( identifier[int] = identifier[decimal] , identifier[length] = identifier[length] ) keyword[return] identifier[b] . identifier[bin]
def to_binary(decimal, length): """ Given a decimal, generate the binary equivalent string of given length. e.g. binary(2, 5) = 00010 """ b = bitstring.Bits(int=decimal, length=length) return b.bin
def format(self, show_enabled=True): '''format display item''' what = '' if show_enabled: if self.enabled: what += ' y ' else: what += ' n ' pass pass if self.fmt: what += self.fmt + ' ' ...
def function[format, parameter[self, show_enabled]]: constant[format display item] variable[what] assign[=] constant[] if name[show_enabled] begin[:] if name[self].enabled begin[:] <ast.AugAssign object at 0x7da18c4cd390> pass if name[self].fmt begin[:...
keyword[def] identifier[format] ( identifier[self] , identifier[show_enabled] = keyword[True] ): literal[string] identifier[what] = literal[string] keyword[if] identifier[show_enabled] : keyword[if] identifier[self] . identifier[enabled] : identifier[what] ...
def format(self, show_enabled=True): """format display item""" what = '' if show_enabled: if self.enabled: what += ' y ' # depends on [control=['if'], data=[]] else: what += ' n ' pass pass # depends on [control=['if'], data=[]] if self.fmt: ...
async def login(self, token, *, bot=True): """|coro| Logs in the client with the specified credentials. This function can be used in two different ways. .. warning:: Logging on with a user token is against the Discord `Terms of Service <https://support.discord...
<ast.AsyncFunctionDef object at 0x7da1b1f8b580>
keyword[async] keyword[def] identifier[login] ( identifier[self] , identifier[token] ,*, identifier[bot] = keyword[True] ): literal[string] identifier[log] . identifier[info] ( literal[string] ) keyword[await] identifier[self] . identifier[http] . identifier[static_login] ( identifier[t...
async def login(self, token, *, bot=True): """|coro| Logs in the client with the specified credentials. This function can be used in two different ways. .. warning:: Logging on with a user token is against the Discord `Terms of Service <https://support.discordapp....
def check_ipv4(ip_str): """ Return True if is a valid IP v4 """ try: socket.inet_pton(socket.AF_INET, ip_str) except AttributeError: try: socket.inet_aton(ip_str) except socket.error: return False return ip_str.count('.') == 3 except socket...
def function[check_ipv4, parameter[ip_str]]: constant[ Return True if is a valid IP v4 ] <ast.Try object at 0x7da1b15f4340> return[constant[True]]
keyword[def] identifier[check_ipv4] ( identifier[ip_str] ): literal[string] keyword[try] : identifier[socket] . identifier[inet_pton] ( identifier[socket] . identifier[AF_INET] , identifier[ip_str] ) keyword[except] identifier[AttributeError] : keyword[try] : identifier...
def check_ipv4(ip_str): """ Return True if is a valid IP v4 """ try: socket.inet_pton(socket.AF_INET, ip_str) # depends on [control=['try'], data=[]] except AttributeError: try: socket.inet_aton(ip_str) # depends on [control=['try'], data=[]] except socket.error...
def arp_access_list_permit_permit_list_host_mac(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") arp = ET.SubElement(config, "arp", xmlns="urn:brocade.com:mgmt:brocade-dai") access_list = ET.SubElement(arp, "access-list") acl_name_key = ET.SubElem...
def function[arp_access_list_permit_permit_list_host_mac, parameter[self]]: constant[Auto Generated Code ] variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]] variable[arp] assign[=] call[name[ET].SubElement, parameter[name[config], constant[arp]]] vari...
keyword[def] identifier[arp_access_list_permit_permit_list_host_mac] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[config] = identifier[ET] . identifier[Element] ( literal[string] ) identifier[arp] = identifier[ET] . identifier[SubElement] ( identifier[config] , l...
def arp_access_list_permit_permit_list_host_mac(self, **kwargs): """Auto Generated Code """ config = ET.Element('config') arp = ET.SubElement(config, 'arp', xmlns='urn:brocade.com:mgmt:brocade-dai') access_list = ET.SubElement(arp, 'access-list') acl_name_key = ET.SubElement(access_list, 'ac...
def label_store(self): '''Return a thread local :class:`dossier.label.LabelStore` client.''' if self._label_store is None: config = global_config('dossier.label') if 'kvlayer' in config: kvl = kvlayer.client(config=config['kvlayer']) self._label_st...
def function[label_store, parameter[self]]: constant[Return a thread local :class:`dossier.label.LabelStore` client.] if compare[name[self]._label_store is constant[None]] begin[:] variable[config] assign[=] call[name[global_config], parameter[constant[dossier.label]]] if...
keyword[def] identifier[label_store] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_label_store] keyword[is] keyword[None] : identifier[config] = identifier[global_config] ( literal[string] ) keyword[if] literal[string] keyword[in] i...
def label_store(self): """Return a thread local :class:`dossier.label.LabelStore` client.""" if self._label_store is None: config = global_config('dossier.label') if 'kvlayer' in config: kvl = kvlayer.client(config=config['kvlayer']) self._label_store = LabelStore(kvl) #...
def purge(self, obj, email_addresses=None): """ Removes a CDN-enabled object from public access before the TTL expires. Please note that there is a limit (at this time) of 25 such requests; if you need to purge more than that, you must contact support. If one or more email_addre...
def function[purge, parameter[self, obj, email_addresses]]: constant[ Removes a CDN-enabled object from public access before the TTL expires. Please note that there is a limit (at this time) of 25 such requests; if you need to purge more than that, you must contact support. If o...
keyword[def] identifier[purge] ( identifier[self] , identifier[obj] , identifier[email_addresses] = keyword[None] ): literal[string] identifier[cname] = identifier[utils] . identifier[get_name] ( identifier[self] . identifier[container] ) identifier[oname] = identifier[utils] . identifier[...
def purge(self, obj, email_addresses=None): """ Removes a CDN-enabled object from public access before the TTL expires. Please note that there is a limit (at this time) of 25 such requests; if you need to purge more than that, you must contact support. If one or more email_addresses...
def listThirdPartyLibs(self, configuration = 'Development'): """ Lists the supported Unreal-bundled third-party libraries """ interrogator = self._getUE4BuildInterrogator() return interrogator.list(self.getPlatformIdentifier(), configuration, self._getLibraryOverrides())
def function[listThirdPartyLibs, parameter[self, configuration]]: constant[ Lists the supported Unreal-bundled third-party libraries ] variable[interrogator] assign[=] call[name[self]._getUE4BuildInterrogator, parameter[]] return[call[name[interrogator].list, parameter[call[name[self].getPlatfor...
keyword[def] identifier[listThirdPartyLibs] ( identifier[self] , identifier[configuration] = literal[string] ): literal[string] identifier[interrogator] = identifier[self] . identifier[_getUE4BuildInterrogator] () keyword[return] identifier[interrogator] . identifier[list] ( identifier[self] . identifier[g...
def listThirdPartyLibs(self, configuration='Development'): """ Lists the supported Unreal-bundled third-party libraries """ interrogator = self._getUE4BuildInterrogator() return interrogator.list(self.getPlatformIdentifier(), configuration, self._getLibraryOverrides())
def WriteFlowLogEntries(self, entries): """Writes flow output plugin log entries for a given flow.""" flow_ids = [(e.client_id, e.flow_id) for e in entries] for f in flow_ids: if f not in self.flows: raise db.AtLeastOneUnknownFlowError(flow_ids) for e in entries: dest = self.flow_lo...
def function[WriteFlowLogEntries, parameter[self, entries]]: constant[Writes flow output plugin log entries for a given flow.] variable[flow_ids] assign[=] <ast.ListComp object at 0x7da1b1b47f40> for taget[name[f]] in starred[name[flow_ids]] begin[:] if compare[name[f] <ast.NotIn...
keyword[def] identifier[WriteFlowLogEntries] ( identifier[self] , identifier[entries] ): literal[string] identifier[flow_ids] =[( identifier[e] . identifier[client_id] , identifier[e] . identifier[flow_id] ) keyword[for] identifier[e] keyword[in] identifier[entries] ] keyword[for] identifier[f] k...
def WriteFlowLogEntries(self, entries): """Writes flow output plugin log entries for a given flow.""" flow_ids = [(e.client_id, e.flow_id) for e in entries] for f in flow_ids: if f not in self.flows: raise db.AtLeastOneUnknownFlowError(flow_ids) # depends on [control=['if'], data=[]] #...
def ensure_newline(self, n): """Make sure there are 'n' line breaks at the end.""" assert n >= 0 text = self._output.getvalue().rstrip('\n') if not text: return self._output = StringIO() self._output.write(text) self._output.write('\n' * n) tex...
def function[ensure_newline, parameter[self, n]]: constant[Make sure there are 'n' line breaks at the end.] assert[compare[name[n] greater_or_equal[>=] constant[0]]] variable[text] assign[=] call[call[name[self]._output.getvalue, parameter[]].rstrip, parameter[constant[ ]]] if <ast.UnaryOp o...
keyword[def] identifier[ensure_newline] ( identifier[self] , identifier[n] ): literal[string] keyword[assert] identifier[n] >= literal[int] identifier[text] = identifier[self] . identifier[_output] . identifier[getvalue] (). identifier[rstrip] ( literal[string] ) keyword[if] ke...
def ensure_newline(self, n): """Make sure there are 'n' line breaks at the end.""" assert n >= 0 text = self._output.getvalue().rstrip('\n') if not text: return # depends on [control=['if'], data=[]] self._output = StringIO() self._output.write(text) self._output.write('\n' * n) ...
def list_members(self, retrieve_all=True, **_params): """Fetches a list of all load balancer members for a project.""" # Pass filters in "params" argument to do_request return self.list('members', self.members_path, retrieve_all, **_params)
def function[list_members, parameter[self, retrieve_all]]: constant[Fetches a list of all load balancer members for a project.] return[call[name[self].list, parameter[constant[members], name[self].members_path, name[retrieve_all]]]]
keyword[def] identifier[list_members] ( identifier[self] , identifier[retrieve_all] = keyword[True] ,** identifier[_params] ): literal[string] keyword[return] identifier[self] . identifier[list] ( literal[string] , identifier[self] . identifier[members_path] , identifier[retrieve_all] , ...
def list_members(self, retrieve_all=True, **_params): """Fetches a list of all load balancer members for a project.""" # Pass filters in "params" argument to do_request return self.list('members', self.members_path, retrieve_all, **_params)
def _TryPrintAsAnyMessage(self, message): """Serializes if message is a google.protobuf.Any field.""" packed_message = _BuildMessageFromTypeName(message.TypeName(), self.descriptor_pool) if packed_message: packed_message.MergeFromString(message.value) ...
def function[_TryPrintAsAnyMessage, parameter[self, message]]: constant[Serializes if message is a google.protobuf.Any field.] variable[packed_message] assign[=] call[name[_BuildMessageFromTypeName], parameter[call[name[message].TypeName, parameter[]], name[self].descriptor_pool]] if name[packed...
keyword[def] identifier[_TryPrintAsAnyMessage] ( identifier[self] , identifier[message] ): literal[string] identifier[packed_message] = identifier[_BuildMessageFromTypeName] ( identifier[message] . identifier[TypeName] (), identifier[self] . identifier[descriptor_pool] ) keyword[if] identifier[p...
def _TryPrintAsAnyMessage(self, message): """Serializes if message is a google.protobuf.Any field.""" packed_message = _BuildMessageFromTypeName(message.TypeName(), self.descriptor_pool) if packed_message: packed_message.MergeFromString(message.value) self.out.write('%s[%s]' % (self.indent *...
def get_binaries(): """Download and return paths of all platform-specific binaries""" paths = [] for arp in [False, True]: paths.append(get_binary(arp=arp)) return paths
def function[get_binaries, parameter[]]: constant[Download and return paths of all platform-specific binaries] variable[paths] assign[=] list[[]] for taget[name[arp]] in starred[list[[<ast.Constant object at 0x7da18fe922c0>, <ast.Constant object at 0x7da18fe929b0>]]] begin[:] cal...
keyword[def] identifier[get_binaries] (): literal[string] identifier[paths] =[] keyword[for] identifier[arp] keyword[in] [ keyword[False] , keyword[True] ]: identifier[paths] . identifier[append] ( identifier[get_binary] ( identifier[arp] = identifier[arp] )) keyword[return] identifie...
def get_binaries(): """Download and return paths of all platform-specific binaries""" paths = [] for arp in [False, True]: paths.append(get_binary(arp=arp)) # depends on [control=['for'], data=['arp']] return paths
def set_current_context(self, name): """Set the current context in kubeconfig.""" if self.context_exists(name): self.data['current-context'] = name else: raise KubeConfError("Context does not exist.")
def function[set_current_context, parameter[self, name]]: constant[Set the current context in kubeconfig.] if call[name[self].context_exists, parameter[name[name]]] begin[:] call[name[self].data][constant[current-context]] assign[=] name[name]
keyword[def] identifier[set_current_context] ( identifier[self] , identifier[name] ): literal[string] keyword[if] identifier[self] . identifier[context_exists] ( identifier[name] ): identifier[self] . identifier[data] [ literal[string] ]= identifier[name] keyword[else] : ...
def set_current_context(self, name): """Set the current context in kubeconfig.""" if self.context_exists(name): self.data['current-context'] = name # depends on [control=['if'], data=[]] else: raise KubeConfError('Context does not exist.')
def delete_collection_namespaced_lease(self, namespace, **kwargs): """ delete collection of Lease This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_lease(namespac...
def function[delete_collection_namespaced_lease, parameter[self, namespace]]: constant[ delete collection of Lease This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespac...
keyword[def] identifier[delete_collection_namespaced_lease] ( identifier[self] , identifier[namespace] ,** identifier[kwargs] ): literal[string] identifier[kwargs] [ literal[string] ]= keyword[True] keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ): keywor...
def delete_collection_namespaced_lease(self, namespace, **kwargs): """ delete collection of Lease This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_collection_namespaced_lease(namespace, a...
def play(self): """Change state to playing.""" if self.state == STATE_PAUSED: self._player.set_state(Gst.State.PLAYING) self.state = STATE_PLAYING
def function[play, parameter[self]]: constant[Change state to playing.] if compare[name[self].state equal[==] name[STATE_PAUSED]] begin[:] call[name[self]._player.set_state, parameter[name[Gst].State.PLAYING]] name[self].state assign[=] name[STATE_PLAYING]
keyword[def] identifier[play] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[state] == identifier[STATE_PAUSED] : identifier[self] . identifier[_player] . identifier[set_state] ( identifier[Gst] . identifier[State] . identifier[PLAYING] ) ...
def play(self): """Change state to playing.""" if self.state == STATE_PAUSED: self._player.set_state(Gst.State.PLAYING) self.state = STATE_PLAYING # depends on [control=['if'], data=[]]
def make_niche_grid(res_dict, world_size=(60, 60)): """ Converts dictionary specifying where resources are to nested lists specifying what sets of resources are where. res_dict - a dictionary in which keys are resources in the environment and values are list of tuples representing the cells they're...
def function[make_niche_grid, parameter[res_dict, world_size]]: constant[ Converts dictionary specifying where resources are to nested lists specifying what sets of resources are where. res_dict - a dictionary in which keys are resources in the environment and values are list of tuples represen...
keyword[def] identifier[make_niche_grid] ( identifier[res_dict] , identifier[world_size] =( literal[int] , literal[int] )): literal[string] identifier[world] = identifier[initialize_grid] ( identifier[world_size] , identifier[set] ()) keyword[for] identifier[res] keyword[in] identifier[...
def make_niche_grid(res_dict, world_size=(60, 60)): """ Converts dictionary specifying where resources are to nested lists specifying what sets of resources are where. res_dict - a dictionary in which keys are resources in the environment and values are list of tuples representing the cells they're...
def getrawfile(self, project_id, sha1, filepath): """ Get the raw file contents for a file by commit SHA and path. :param project_id: The ID of a project :param sha1: The commit or branch name :param filepath: The path the file :return: raw file contents """ ...
def function[getrawfile, parameter[self, project_id, sha1, filepath]]: constant[ Get the raw file contents for a file by commit SHA and path. :param project_id: The ID of a project :param sha1: The commit or branch name :param filepath: The path the file :return: raw fil...
keyword[def] identifier[getrawfile] ( identifier[self] , identifier[project_id] , identifier[sha1] , identifier[filepath] ): literal[string] identifier[data] ={ literal[string] : identifier[filepath] } identifier[request] = identifier[requests] . identifier[get] ( literal[string]...
def getrawfile(self, project_id, sha1, filepath): """ Get the raw file contents for a file by commit SHA and path. :param project_id: The ID of a project :param sha1: The commit or branch name :param filepath: The path the file :return: raw file contents """ data...
def human_xor_01(X, y, model_generator, method_name): """ XOR (false/true) This tests how well a feature attribution method agrees with human intuition for an eXclusive OR operation combined with linear effects. This metric deals specifically with the question of credit allocation for the following fun...
def function[human_xor_01, parameter[X, y, model_generator, method_name]]: constant[ XOR (false/true) This tests how well a feature attribution method agrees with human intuition for an eXclusive OR operation combined with linear effects. This metric deals specifically with the question of credit a...
keyword[def] identifier[human_xor_01] ( identifier[X] , identifier[y] , identifier[model_generator] , identifier[method_name] ): literal[string] keyword[return] identifier[_human_xor] ( identifier[X] , identifier[model_generator] , identifier[method_name] , keyword[False] , keyword[True] )
def human_xor_01(X, y, model_generator, method_name): """ XOR (false/true) This tests how well a feature attribution method agrees with human intuition for an eXclusive OR operation combined with linear effects. This metric deals specifically with the question of credit allocation for the following fun...
def upper(string): # pragma: no cover """Lower.""" new_string = [] for c in string: o = ord(c) new_string.append(chr(o - 32) if LC_A <= o <= LC_Z else c) return ''.join(new_string)
def function[upper, parameter[string]]: constant[Lower.] variable[new_string] assign[=] list[[]] for taget[name[c]] in starred[name[string]] begin[:] variable[o] assign[=] call[name[ord], parameter[name[c]]] call[name[new_string].append, parameter[<ast.IfExp objec...
keyword[def] identifier[upper] ( identifier[string] ): literal[string] identifier[new_string] =[] keyword[for] identifier[c] keyword[in] identifier[string] : identifier[o] = identifier[ord] ( identifier[c] ) identifier[new_string] . identifier[append] ( identifier[chr] ( identifi...
def upper(string): # pragma: no cover 'Lower.' new_string = [] for c in string: o = ord(c) new_string.append(chr(o - 32) if LC_A <= o <= LC_Z else c) # depends on [control=['for'], data=['c']] return ''.join(new_string)
def ignore_cxx(self) -> bool: """Consume comments and whitespace characters.""" self._stream.save_context() while not self.read_eof(): idxref = self._stream.index if self._stream.peek_char in " \t\v\f\r\n": while (not self.read_eof() and self._stream.peek_char...
def function[ignore_cxx, parameter[self]]: constant[Consume comments and whitespace characters.] call[name[self]._stream.save_context, parameter[]] while <ast.UnaryOp object at 0x7da1b01197b0> begin[:] variable[idxref] assign[=] name[self]._stream.index if compare...
keyword[def] identifier[ignore_cxx] ( identifier[self] )-> identifier[bool] : literal[string] identifier[self] . identifier[_stream] . identifier[save_context] () keyword[while] keyword[not] identifier[self] . identifier[read_eof] (): identifier[idxref] = identifier[self] . identifier[_stre...
def ignore_cxx(self) -> bool: """Consume comments and whitespace characters.""" self._stream.save_context() while not self.read_eof(): idxref = self._stream.index if self._stream.peek_char in ' \t\x0b\x0c\r\n': while not self.read_eof() and self._stream.peek_char in ' \t\x0b\x0c\...
def fulfill_access_secret_store_condition(event, agreement_id, did, service_agreement, consumer_address, publisher_account): """ Fulfill the access condition. :param event: AttributeDict with the event data. :param agreement_id: id of the agreement, hex str ...
def function[fulfill_access_secret_store_condition, parameter[event, agreement_id, did, service_agreement, consumer_address, publisher_account]]: constant[ Fulfill the access condition. :param event: AttributeDict with the event data. :param agreement_id: id of the agreement, hex str :param did...
keyword[def] identifier[fulfill_access_secret_store_condition] ( identifier[event] , identifier[agreement_id] , identifier[did] , identifier[service_agreement] , identifier[consumer_address] , identifier[publisher_account] ): literal[string] identifier[logger] . identifier[debug] ( literal[string] ) ...
def fulfill_access_secret_store_condition(event, agreement_id, did, service_agreement, consumer_address, publisher_account): """ Fulfill the access condition. :param event: AttributeDict with the event data. :param agreement_id: id of the agreement, hex str :param did: DID, str :param service_a...
def _read_json(self, schema=None, maxlen=JSONRPC_MAX_SIZE): """ Read a JSON payload from the requester Return the parsed payload on success Return None on error """ # JSON post? request_type = self.headers.get('content-type', None) client_address_str = "{}...
def function[_read_json, parameter[self, schema, maxlen]]: constant[ Read a JSON payload from the requester Return the parsed payload on success Return None on error ] variable[request_type] assign[=] call[name[self].headers.get, parameter[constant[content-type], constant...
keyword[def] identifier[_read_json] ( identifier[self] , identifier[schema] = keyword[None] , identifier[maxlen] = identifier[JSONRPC_MAX_SIZE] ): literal[string] identifier[request_type] = identifier[self] . identifier[headers] . identifier[get] ( literal[string] , keyword[None] ) ...
def _read_json(self, schema=None, maxlen=JSONRPC_MAX_SIZE): """ Read a JSON payload from the requester Return the parsed payload on success Return None on error """ # JSON post? request_type = self.headers.get('content-type', None) client_address_str = '{}:{}'.format(self...
def subscribe_to_data( self, subscriber: Callable[[bytes], bool], ) -> None: """ Not thread-safe. """ self._data_subscribers.append(subscriber)
def function[subscribe_to_data, parameter[self, subscriber]]: constant[ Not thread-safe. ] call[name[self]._data_subscribers.append, parameter[name[subscriber]]]
keyword[def] identifier[subscribe_to_data] ( identifier[self] , identifier[subscriber] : identifier[Callable] [[ identifier[bytes] ], identifier[bool] ], )-> keyword[None] : literal[string] identifier[self] . identifier[_data_subscribers] . identifier[append] ( identifier[subscriber] )
def subscribe_to_data(self, subscriber: Callable[[bytes], bool]) -> None: """ Not thread-safe. """ self._data_subscribers.append(subscriber)