code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def get_content(pattern, string, tag='content'): """ Finds the 'content' tag from a 'pattern' in the provided 'string' """ output = [] for match in re.finditer(pattern, string): output.append(match.group(tag)) return output
def function[get_content, parameter[pattern, string, tag]]: constant[ Finds the 'content' tag from a 'pattern' in the provided 'string' ] variable[output] assign[=] list[[]] for taget[name[match]] in starred[call[name[re].finditer, parameter[name[pattern], name[string]]]] begin[:] ...
keyword[def] identifier[get_content] ( identifier[pattern] , identifier[string] , identifier[tag] = literal[string] ): literal[string] identifier[output] =[] keyword[for] identifier[match] keyword[in] identifier[re] . identifier[finditer] ( identifier[pattern] , identifier[string] ): ident...
def get_content(pattern, string, tag='content'): """ Finds the 'content' tag from a 'pattern' in the provided 'string' """ output = [] for match in re.finditer(pattern, string): output.append(match.group(tag)) # depends on [control=['for'], data=['match']] return output
def setPriority(self, queue, priority): ''' Set priority of a sub-queue ''' q = self.queueindex[queue] self.queues[q[0]].removeSubQueue(q[1]) newPriority = self.queues.setdefault(priority, CBQueue.MultiQueue(self, priority)) q[0] = priority newPriority.add...
def function[setPriority, parameter[self, queue, priority]]: constant[ Set priority of a sub-queue ] variable[q] assign[=] call[name[self].queueindex][name[queue]] call[call[name[self].queues][call[name[q]][constant[0]]].removeSubQueue, parameter[call[name[q]][constant[1]]]] ...
keyword[def] identifier[setPriority] ( identifier[self] , identifier[queue] , identifier[priority] ): literal[string] identifier[q] = identifier[self] . identifier[queueindex] [ identifier[queue] ] identifier[self] . identifier[queues] [ identifier[q] [ literal[int] ]]. identifier[removeSu...
def setPriority(self, queue, priority): """ Set priority of a sub-queue """ q = self.queueindex[queue] self.queues[q[0]].removeSubQueue(q[1]) newPriority = self.queues.setdefault(priority, CBQueue.MultiQueue(self, priority)) q[0] = priority newPriority.addSubQueue(q[1])
def register_entry_points(self, exclude=()): """Allow Gears plugins to inject themselves to the environment. For example, if your plugin's package contains such ``entry_points`` definition in ``setup.py``, ``gears_plugin.register`` function will be called with current environment during ...
def function[register_entry_points, parameter[self, exclude]]: constant[Allow Gears plugins to inject themselves to the environment. For example, if your plugin's package contains such ``entry_points`` definition in ``setup.py``, ``gears_plugin.register`` function will be called with cur...
keyword[def] identifier[register_entry_points] ( identifier[self] , identifier[exclude] =()): literal[string] keyword[for] identifier[entry_point] keyword[in] identifier[iter_entry_points] ( literal[string] , literal[string] ): keyword[if] identifier[entry_point] . identifier[modul...
def register_entry_points(self, exclude=()): """Allow Gears plugins to inject themselves to the environment. For example, if your plugin's package contains such ``entry_points`` definition in ``setup.py``, ``gears_plugin.register`` function will be called with current environment during ``re...
def run_sambamba_markdup(job, bam): """ Marks reads as PCR duplicates using Sambamba :param JobFunctionWrappingJob job: passed automatically by Toil :param str bam: FileStoreID for BAM file :return: FileStoreID for sorted BAM file :rtype: str """ work_dir = job.fileStore.getLocalTempDir...
def function[run_sambamba_markdup, parameter[job, bam]]: constant[ Marks reads as PCR duplicates using Sambamba :param JobFunctionWrappingJob job: passed automatically by Toil :param str bam: FileStoreID for BAM file :return: FileStoreID for sorted BAM file :rtype: str ] variabl...
keyword[def] identifier[run_sambamba_markdup] ( identifier[job] , identifier[bam] ): literal[string] identifier[work_dir] = identifier[job] . identifier[fileStore] . identifier[getLocalTempDir] () identifier[job] . identifier[fileStore] . identifier[readGlobalFile] ( identifier[bam] , identifier[os] ....
def run_sambamba_markdup(job, bam): """ Marks reads as PCR duplicates using Sambamba :param JobFunctionWrappingJob job: passed automatically by Toil :param str bam: FileStoreID for BAM file :return: FileStoreID for sorted BAM file :rtype: str """ work_dir = job.fileStore.getLocalTempDir...
def olindices(order, dim): """ Create an lexiographical sorted basis for a given order. Examples: >>> chaospy.bertran.olindices(2, 2) array([[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0]]) """ indices = [oli...
def function[olindices, parameter[order, dim]]: constant[ Create an lexiographical sorted basis for a given order. Examples: >>> chaospy.bertran.olindices(2, 2) array([[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, ...
keyword[def] identifier[olindices] ( identifier[order] , identifier[dim] ): literal[string] identifier[indices] =[ identifier[olindex] ( identifier[o] , identifier[dim] ) keyword[for] identifier[o] keyword[in] identifier[range] ( identifier[order] + literal[int] )] identifier[indices] = identifier[...
def olindices(order, dim): """ Create an lexiographical sorted basis for a given order. Examples: >>> chaospy.bertran.olindices(2, 2) array([[0, 0], [0, 1], [1, 0], [0, 2], [1, 1], [2, 0]]) """ indices = [oli...
def _selftoken_expired(): ''' Validate the current token exists and is still valid ''' try: verify = __opts__['vault'].get('verify', None) url = '{0}/v1/auth/token/lookup-self'.format(__opts__['vault']['url']) if 'token' not in __opts__['vault']['auth']: return True ...
def function[_selftoken_expired, parameter[]]: constant[ Validate the current token exists and is still valid ] <ast.Try object at 0x7da18ede58d0>
keyword[def] identifier[_selftoken_expired] (): literal[string] keyword[try] : identifier[verify] = identifier[__opts__] [ literal[string] ]. identifier[get] ( literal[string] , keyword[None] ) identifier[url] = literal[string] . identifier[format] ( identifier[__opts__] [ literal[string]...
def _selftoken_expired(): """ Validate the current token exists and is still valid """ try: verify = __opts__['vault'].get('verify', None) url = '{0}/v1/auth/token/lookup-self'.format(__opts__['vault']['url']) if 'token' not in __opts__['vault']['auth']: return True ...
def close(self): """gym api close""" try: # Purge last token from head node with <Close> message. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.server, self.port)) self._hello(sock) comms.send_message(sock, ("<Clo...
def function[close, parameter[self]]: constant[gym api close] <ast.Try object at 0x7da1b1a560e0> if name[self].client_socket begin[:] call[name[self].client_socket.close, parameter[]] name[self].client_socket assign[=] constant[None]
keyword[def] identifier[close] ( identifier[self] ): literal[string] keyword[try] : identifier[sock] = identifier[socket] . identifier[socket] ( identifier[socket] . identifier[AF_INET] , identifier[socket] . identifier[SOCK_STREAM] ) identifier[sock] . identifier...
def close(self): """gym api close""" try: # Purge last token from head node with <Close> message. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.server, self.port)) self._hello(sock) comms.send_message(sock, ('<Close>' + self._get_token() + '<...
def transform_array(rot_mtx,vec_array): '''transform_array( matrix, vector_array ) -> vector_array ''' return map( lambda x,m=rot_mtx:transform(m,x), vec_array )
def function[transform_array, parameter[rot_mtx, vec_array]]: constant[transform_array( matrix, vector_array ) -> vector_array ] return[call[name[map], parameter[<ast.Lambda object at 0x7da1b0e6cdf0>, name[vec_array]]]]
keyword[def] identifier[transform_array] ( identifier[rot_mtx] , identifier[vec_array] ): literal[string] keyword[return] identifier[map] ( keyword[lambda] identifier[x] , identifier[m] = identifier[rot_mtx] : identifier[transform] ( identifier[m] , identifier[x] ), identifier[vec_array] )
def transform_array(rot_mtx, vec_array): """transform_array( matrix, vector_array ) -> vector_array """ return map(lambda x, m=rot_mtx: transform(m, x), vec_array)
def match_anywhere(subject: Expression, pattern: Pattern) -> Iterator[Tuple[Substitution, Tuple[int, ...]]]: """Tries to match the given *pattern* to the any subexpression of the given *subject*. Yields each match in form of a substitution and a position tuple. The position is a tuple of indices, e.g. the ...
def function[match_anywhere, parameter[subject, pattern]]: constant[Tries to match the given *pattern* to the any subexpression of the given *subject*. Yields each match in form of a substitution and a position tuple. The position is a tuple of indices, e.g. the empty tuple refers to the *subject* itse...
keyword[def] identifier[match_anywhere] ( identifier[subject] : identifier[Expression] , identifier[pattern] : identifier[Pattern] )-> identifier[Iterator] [ identifier[Tuple] [ identifier[Substitution] , identifier[Tuple] [ identifier[int] ,...]]]: literal[string] keyword[if] keyword[not] identifier[is_...
def match_anywhere(subject: Expression, pattern: Pattern) -> Iterator[Tuple[Substitution, Tuple[int, ...]]]: """Tries to match the given *pattern* to the any subexpression of the given *subject*. Yields each match in form of a substitution and a position tuple. The position is a tuple of indices, e.g. the ...
def register(self, entry_point): """Register an extension :param str entry_point: extension to register (entry point syntax). :raise: ValueError if already registered. """ if entry_point in self.registered_extensions: raise ValueError('Extension already registered')...
def function[register, parameter[self, entry_point]]: constant[Register an extension :param str entry_point: extension to register (entry point syntax). :raise: ValueError if already registered. ] if compare[name[entry_point] in name[self].registered_extensions] begin[:] ...
keyword[def] identifier[register] ( identifier[self] , identifier[entry_point] ): literal[string] keyword[if] identifier[entry_point] keyword[in] identifier[self] . identifier[registered_extensions] : keyword[raise] identifier[ValueError] ( literal[string] ) identifier[ep...
def register(self, entry_point): """Register an extension :param str entry_point: extension to register (entry point syntax). :raise: ValueError if already registered. """ if entry_point in self.registered_extensions: raise ValueError('Extension already registered') # depends ...
def insert_or_replace_entity(self, entity): ''' Adds an insert or replace entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_replace_entity` for more information on insert or replace operations. The operation will not be executed...
def function[insert_or_replace_entity, parameter[self, entity]]: constant[ Adds an insert or replace entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_replace_entity` for more information on insert or replace operations. The ope...
keyword[def] identifier[insert_or_replace_entity] ( identifier[self] , identifier[entity] ): literal[string] identifier[request] = identifier[_insert_or_replace_entity] ( identifier[entity] , identifier[self] . identifier[_require_encryption] , identifier[self] . identifier[_key_encryption_key] , ...
def insert_or_replace_entity(self, entity): """ Adds an insert or replace entity operation to the batch. See :func:`~azure.storage.table.tableservice.TableService.insert_or_replace_entity` for more information on insert or replace operations. The operation will not be executed unt...
def _send_acceptance(self, enrollment, password, event): """Send an acceptance mail to an open enrolment""" self.log('Sending acceptance status mail to user') if password is not "": password_hint = '\n\nPS: Your new password is ' + password + ' - please change it after your first l...
def function[_send_acceptance, parameter[self, enrollment, password, event]]: constant[Send an acceptance mail to an open enrolment] call[name[self].log, parameter[constant[Sending acceptance status mail to user]]] if compare[name[password] is_not constant[]] begin[:] variable[pa...
keyword[def] identifier[_send_acceptance] ( identifier[self] , identifier[enrollment] , identifier[password] , identifier[event] ): literal[string] identifier[self] . identifier[log] ( literal[string] ) keyword[if] identifier[password] keyword[is] keyword[not] literal[string] : ...
def _send_acceptance(self, enrollment, password, event): """Send an acceptance mail to an open enrolment""" self.log('Sending acceptance status mail to user') if password is not '': password_hint = '\n\nPS: Your new password is ' + password + ' - please change it after your first login!' acc...
def atlasdb_get_zonefile_bits( zonefile_hash, con=None, path=None ): """ What bit(s) in a zonefile inventory does a zonefile hash correspond to? Return their indexes in the bit field. """ with AtlasDBOpen(con=con, path=path) as dbcon: sql = "SELECT inv_index FROM zonefiles WHERE zonefile_ha...
def function[atlasdb_get_zonefile_bits, parameter[zonefile_hash, con, path]]: constant[ What bit(s) in a zonefile inventory does a zonefile hash correspond to? Return their indexes in the bit field. ] with call[name[AtlasDBOpen], parameter[]] begin[:] variable[sql] assign[=] ...
keyword[def] identifier[atlasdb_get_zonefile_bits] ( identifier[zonefile_hash] , identifier[con] = keyword[None] , identifier[path] = keyword[None] ): literal[string] keyword[with] identifier[AtlasDBOpen] ( identifier[con] = identifier[con] , identifier[path] = identifier[path] ) keyword[as] identifier[d...
def atlasdb_get_zonefile_bits(zonefile_hash, con=None, path=None): """ What bit(s) in a zonefile inventory does a zonefile hash correspond to? Return their indexes in the bit field. """ with AtlasDBOpen(con=con, path=path) as dbcon: sql = 'SELECT inv_index FROM zonefiles WHERE zonefile_hash ...
def etree_to_dict(t, trim=True, **kw): u"""Converts an lxml.etree object to Python dict. >>> etree_to_dict(etree.Element('root')) {'root': None} :param etree.Element t: lxml tree to convert :returns d: a dict representing the lxml tree ``t`` :rtype: dict """ d = {t.tag: {} if t.attrib ...
def function[etree_to_dict, parameter[t, trim]]: constant[Converts an lxml.etree object to Python dict. >>> etree_to_dict(etree.Element('root')) {'root': None} :param etree.Element t: lxml tree to convert :returns d: a dict representing the lxml tree ``t`` :rtype: dict ] variab...
keyword[def] identifier[etree_to_dict] ( identifier[t] , identifier[trim] = keyword[True] ,** identifier[kw] ): literal[string] identifier[d] ={ identifier[t] . identifier[tag] :{} keyword[if] identifier[t] . identifier[attrib] keyword[else] keyword[None] } identifier[children] = identifier[list] (...
def etree_to_dict(t, trim=True, **kw): u"""Converts an lxml.etree object to Python dict. >>> etree_to_dict(etree.Element('root')) {'root': None} :param etree.Element t: lxml tree to convert :returns d: a dict representing the lxml tree ``t`` :rtype: dict """ d = {t.tag: {} if t.attrib ...
def wet_records_from_file_obj(f, take_ownership=False): """Iterate through records in WET file object.""" while True: record = WETRecord.read(f) if record is None: break if not record.url: continue yield record if take_ownership: f.close()
def function[wet_records_from_file_obj, parameter[f, take_ownership]]: constant[Iterate through records in WET file object.] while constant[True] begin[:] variable[record] assign[=] call[name[WETRecord].read, parameter[name[f]]] if compare[name[record] is constant[None]] ...
keyword[def] identifier[wet_records_from_file_obj] ( identifier[f] , identifier[take_ownership] = keyword[False] ): literal[string] keyword[while] keyword[True] : identifier[record] = identifier[WETRecord] . identifier[read] ( identifier[f] ) keyword[if] identifier[record] keyword[is] keyword[No...
def wet_records_from_file_obj(f, take_ownership=False): """Iterate through records in WET file object.""" while True: record = WETRecord.read(f) if record is None: break # depends on [control=['if'], data=[]] if not record.url: continue # depends on [control=['i...
def read(self, n): """Read n bytes. Returns exactly n bytes of data unless the underlying raw IO stream reaches EOF. """ buf = self._read_buf pos = self._read_pos end = pos + n if end <= len(buf): # Fast path: the data to read is fully buffere...
def function[read, parameter[self, n]]: constant[Read n bytes. Returns exactly n bytes of data unless the underlying raw IO stream reaches EOF. ] variable[buf] assign[=] name[self]._read_buf variable[pos] assign[=] name[self]._read_pos variable[end] assign[=] bina...
keyword[def] identifier[read] ( identifier[self] , identifier[n] ): literal[string] identifier[buf] = identifier[self] . identifier[_read_buf] identifier[pos] = identifier[self] . identifier[_read_pos] identifier[end] = identifier[pos] + identifier[n] keyword[if] ide...
def read(self, n): """Read n bytes. Returns exactly n bytes of data unless the underlying raw IO stream reaches EOF. """ buf = self._read_buf pos = self._read_pos end = pos + n if end <= len(buf): # Fast path: the data to read is fully buffered. self._read_pos...
def ipv4_lstrip_zeros(address): """ The function to strip leading zeros in each octet of an IPv4 address. Args: address (:obj:`str`): An IPv4 address. Returns: str: The modified IPv4 address. """ # Split the octets. obj = address.strip().split('.') for x, y in enumer...
def function[ipv4_lstrip_zeros, parameter[address]]: constant[ The function to strip leading zeros in each octet of an IPv4 address. Args: address (:obj:`str`): An IPv4 address. Returns: str: The modified IPv4 address. ] variable[obj] assign[=] call[call[name[address].s...
keyword[def] identifier[ipv4_lstrip_zeros] ( identifier[address] ): literal[string] identifier[obj] = identifier[address] . identifier[strip] (). identifier[split] ( literal[string] ) keyword[for] identifier[x] , identifier[y] keyword[in] identifier[enumerate] ( identifier[obj] ): ...
def ipv4_lstrip_zeros(address): """ The function to strip leading zeros in each octet of an IPv4 address. Args: address (:obj:`str`): An IPv4 address. Returns: str: The modified IPv4 address. """ # Split the octets. obj = address.strip().split('.') for (x, y) in enumer...
def get_options(argv): """Called to parse the given list as command-line arguments. :returns: an options object as returned by argparse. """ arg_parser = make_arg_parser() options, unknown = arg_parser.parse_known_args(argv) if unknown: arg_parser.print_help() raise exce...
def function[get_options, parameter[argv]]: constant[Called to parse the given list as command-line arguments. :returns: an options object as returned by argparse. ] variable[arg_parser] assign[=] call[name[make_arg_parser], parameter[]] <ast.Tuple object at 0x7da1b0f596f0> assi...
keyword[def] identifier[get_options] ( identifier[argv] ): literal[string] identifier[arg_parser] = identifier[make_arg_parser] () identifier[options] , identifier[unknown] = identifier[arg_parser] . identifier[parse_known_args] ( identifier[argv] ) keyword[if] identifier[unknown] : ide...
def get_options(argv): """Called to parse the given list as command-line arguments. :returns: an options object as returned by argparse. """ arg_parser = make_arg_parser() (options, unknown) = arg_parser.parse_known_args(argv) if unknown: arg_parser.print_help() raise ex...
def is_on(self): """ Get sensor state. Assume offline or open (worst case). """ return self.status not in (CONST.STATUS_OFF, CONST.STATUS_OFFLINE, CONST.STATUS_CLOSED, CONST.STATUS_OPEN)
def function[is_on, parameter[self]]: constant[ Get sensor state. Assume offline or open (worst case). ] return[compare[name[self].status <ast.NotIn object at 0x7da2590d7190> tuple[[<ast.Attribute object at 0x7da18f00fc10>, <ast.Attribute object at 0x7da18f00f520>, <ast.Attribute ob...
keyword[def] identifier[is_on] ( identifier[self] ): literal[string] keyword[return] identifier[self] . identifier[status] keyword[not] keyword[in] ( identifier[CONST] . identifier[STATUS_OFF] , identifier[CONST] . identifier[STATUS_OFFLINE] , identifier[CONST] . identifier[STATUS_CLOSE...
def is_on(self): """ Get sensor state. Assume offline or open (worst case). """ return self.status not in (CONST.STATUS_OFF, CONST.STATUS_OFFLINE, CONST.STATUS_CLOSED, CONST.STATUS_OPEN)
def _convert_parsed_show_output(parsed_data): ''' Convert matching string values to lists/dictionaries. :param dict parsed_data: The text of the command output that needs to be parsed. :return: A dictionary containing the modified configuration data. :rtype: dict ''' # Match lines like "ma...
def function[_convert_parsed_show_output, parameter[parsed_data]]: constant[ Convert matching string values to lists/dictionaries. :param dict parsed_data: The text of the command output that needs to be parsed. :return: A dictionary containing the modified configuration data. :rtype: dict ...
keyword[def] identifier[_convert_parsed_show_output] ( identifier[parsed_data] ): literal[string] identifier[source_pattern] = identifier[re] . identifier[compile] ( literal[string] ) identifier[sources] = identifier[list] () keyword[if] literal[string] keyword[in] identifier[parsed_data...
def _convert_parsed_show_output(parsed_data): """ Convert matching string values to lists/dictionaries. :param dict parsed_data: The text of the command output that needs to be parsed. :return: A dictionary containing the modified configuration data. :rtype: dict """ # Match lines like "ma...
def extend(self, step): """ Adds the data from another STObject to this object. Args: step: another STObject being added after the current one in time. """ self.timesteps.extend(step.timesteps) self.masks.extend(step.masks) self.x.extend(step....
def function[extend, parameter[self, step]]: constant[ Adds the data from another STObject to this object. Args: step: another STObject being added after the current one in time. ] call[name[self].timesteps.extend, parameter[name[step].timesteps]] cal...
keyword[def] identifier[extend] ( identifier[self] , identifier[step] ): literal[string] identifier[self] . identifier[timesteps] . identifier[extend] ( identifier[step] . identifier[timesteps] ) identifier[self] . identifier[masks] . identifier[extend] ( identifier[step] . identifier[mask...
def extend(self, step): """ Adds the data from another STObject to this object. Args: step: another STObject being added after the current one in time. """ self.timesteps.extend(step.timesteps) self.masks.extend(step.masks) self.x.extend(step.x) self.y.ex...
def GetHasherClasses(cls, hasher_names=None): """Retrieves the registered hashers. Args: hasher_names (list[str]): names of the hashers to retrieve. Yields: tuple: containing: str: parser name type: next hasher class. """ for hasher_name, hasher_class in iter(cls._...
def function[GetHasherClasses, parameter[cls, hasher_names]]: constant[Retrieves the registered hashers. Args: hasher_names (list[str]): names of the hashers to retrieve. Yields: tuple: containing: str: parser name type: next hasher class. ] for taget[tuple...
keyword[def] identifier[GetHasherClasses] ( identifier[cls] , identifier[hasher_names] = keyword[None] ): literal[string] keyword[for] identifier[hasher_name] , identifier[hasher_class] keyword[in] identifier[iter] ( identifier[cls] . identifier[_hasher_classes] . identifier[items] ()): keyword[i...
def GetHasherClasses(cls, hasher_names=None): """Retrieves the registered hashers. Args: hasher_names (list[str]): names of the hashers to retrieve. Yields: tuple: containing: str: parser name type: next hasher class. """ for (hasher_name, hasher_class) in iter(cls...
def _on_new_data_received(self, data: bytes): """ Gets called whenever we get a whole new XML element from kik's servers. :param data: The data received (bytes) """ if data == b' ': # Happens every half hour. Disconnect after 10th time. Some kind of keep-alive? Let's ...
def function[_on_new_data_received, parameter[self, data]]: constant[ Gets called whenever we get a whole new XML element from kik's servers. :param data: The data received (bytes) ] if compare[name[data] equal[==] constant[b' ']] begin[:] call[name[self].loop.cal...
keyword[def] identifier[_on_new_data_received] ( identifier[self] , identifier[data] : identifier[bytes] ): literal[string] keyword[if] identifier[data] == literal[string] : identifier[self] . identifier[loop] . identifier[call_soon_threadsafe] ( identifier[self] . identifier...
def _on_new_data_received(self, data: bytes): """ Gets called whenever we get a whole new XML element from kik's servers. :param data: The data received (bytes) """ if data == b' ': # Happens every half hour. Disconnect after 10th time. Some kind of keep-alive? Let's send it back...
def process(self, document): """Processing a group of tasks.""" self.logger.info("Processing group of tasks (parallel=%s)", self.get_parallel_mode()) self.pipeline.data.env_list[2] = {} output, shells = [], [] result = Adapter({'success': True, 'output': []}) for task_en...
def function[process, parameter[self, document]]: constant[Processing a group of tasks.] call[name[self].logger.info, parameter[constant[Processing group of tasks (parallel=%s)], call[name[self].get_parallel_mode, parameter[]]]] call[name[self].pipeline.data.env_list][constant[2]] assign[=] dict...
keyword[def] identifier[process] ( identifier[self] , identifier[document] ): literal[string] identifier[self] . identifier[logger] . identifier[info] ( literal[string] , identifier[self] . identifier[get_parallel_mode] ()) identifier[self] . identifier[pipeline] . identifier[data] . ident...
def process(self, document): """Processing a group of tasks.""" self.logger.info('Processing group of tasks (parallel=%s)', self.get_parallel_mode()) self.pipeline.data.env_list[2] = {} (output, shells) = ([], []) result = Adapter({'success': True, 'output': []}) for task_entry in document: ...
def gen_cert_request(filepath, keyfile, config, silent=False): """ generate certificate request :param filepath: file path to the certificate request :param keyfile: file path to the private key :param silent: whether to suppress output """ message = 'generate ssl certificate request' cm...
def function[gen_cert_request, parameter[filepath, keyfile, config, silent]]: constant[ generate certificate request :param filepath: file path to the certificate request :param keyfile: file path to the private key :param silent: whether to suppress output ] variable[message] assign...
keyword[def] identifier[gen_cert_request] ( identifier[filepath] , identifier[keyfile] , identifier[config] , identifier[silent] = keyword[False] ): literal[string] identifier[message] = literal[string] identifier[cmd] =( literal[string] literal[string] ). identifier[format] ( identif...
def gen_cert_request(filepath, keyfile, config, silent=False): """ generate certificate request :param filepath: file path to the certificate request :param keyfile: file path to the private key :param silent: whether to suppress output """ message = 'generate ssl certificate request' cm...
def mel(sr, n_dft, n_mels=128, fmin=0.0, fmax=None, htk=False, norm=1): """[np] create a filterbank matrix to combine stft bins into mel-frequency bins use Slaney (said Librosa) n_mels: numbre of mel bands fmin : lowest frequency [Hz] fmax : highest frequency [Hz] If `None`, use `sr / 2.0` ...
def function[mel, parameter[sr, n_dft, n_mels, fmin, fmax, htk, norm]]: constant[[np] create a filterbank matrix to combine stft bins into mel-frequency bins use Slaney (said Librosa) n_mels: numbre of mel bands fmin : lowest frequency [Hz] fmax : highest frequency [Hz] If `None`, use `...
keyword[def] identifier[mel] ( identifier[sr] , identifier[n_dft] , identifier[n_mels] = literal[int] , identifier[fmin] = literal[int] , identifier[fmax] = keyword[None] , identifier[htk] = keyword[False] , identifier[norm] = literal[int] ): literal[string] keyword[return] identifier[librosa] . identifie...
def mel(sr, n_dft, n_mels=128, fmin=0.0, fmax=None, htk=False, norm=1): """[np] create a filterbank matrix to combine stft bins into mel-frequency bins use Slaney (said Librosa) n_mels: numbre of mel bands fmin : lowest frequency [Hz] fmax : highest frequency [Hz] If `None`, use `sr / 2.0` ...
def import_admin_credentials(self, username, password): """ Imports the KDC Account Manager credentials needed by Cloudera Manager to create kerberos principals needed by CDH services. @param username Username of the Account Manager. Full name including the Kerberos realm must be specified. ...
def function[import_admin_credentials, parameter[self, username, password]]: constant[ Imports the KDC Account Manager credentials needed by Cloudera Manager to create kerberos principals needed by CDH services. @param username Username of the Account Manager. Full name including the Kerberos ...
keyword[def] identifier[import_admin_credentials] ( identifier[self] , identifier[username] , identifier[password] ): literal[string] keyword[return] identifier[self] . identifier[_cmd] ( literal[string] , identifier[params] = identifier[dict] ( identifier[username] = identifier[username] , identifier[pas...
def import_admin_credentials(self, username, password): """ Imports the KDC Account Manager credentials needed by Cloudera Manager to create kerberos principals needed by CDH services. @param username Username of the Account Manager. Full name including the Kerberos realm must be specified. ...
def estimate(s1, s2): """ Estimate the spacial relationship by examining the position of the bounding boxes. Parameters ---------- s1 : HandwrittenData s2 : HandwrittenData Returns ------- dict of probabilities {'bottom': 0.1, 'subscript': 0.2, 'right'...
def function[estimate, parameter[s1, s2]]: constant[ Estimate the spacial relationship by examining the position of the bounding boxes. Parameters ---------- s1 : HandwrittenData s2 : HandwrittenData Returns ------- dict of probabilities {'bottom': 0.1, 'su...
keyword[def] identifier[estimate] ( identifier[s1] , identifier[s2] ): literal[string] identifier[s1bb] = identifier[s1] . identifier[get_bounding_box] () identifier[s2bb] = identifier[s2] . identifier[get_bounding_box] () identifier[total_area] =(( identifier[s2bb] [ literal[string] ]- identifie...
def estimate(s1, s2): """ Estimate the spacial relationship by examining the position of the bounding boxes. Parameters ---------- s1 : HandwrittenData s2 : HandwrittenData Returns ------- dict of probabilities {'bottom': 0.1, 'subscript': 0.2, 'right'...
def name_parts(self): """Works with PartialNameMixin.clear_dict to set NONE and ANY values.""" default = PartialMixin.ANY return ([(k, default, True) for k, _, _ in PartitionName._name_parts] + [(k, default, True) for k, ...
def function[name_parts, parameter[self]]: constant[Works with PartialNameMixin.clear_dict to set NONE and ANY values.] variable[default] assign[=] name[PartialMixin].ANY return[binary_operation[<ast.ListComp object at 0x7da2041d9f60> + <ast.ListComp object at 0x7da2041d9ba0>]]
keyword[def] identifier[name_parts] ( identifier[self] ): literal[string] identifier[default] = identifier[PartialMixin] . identifier[ANY] keyword[return] ([( identifier[k] , identifier[default] , keyword[True] ) keyword[for] identifier[k] , identifier[_] , identifier[_] keyw...
def name_parts(self): """Works with PartialNameMixin.clear_dict to set NONE and ANY values.""" default = PartialMixin.ANY return [(k, default, True) for (k, _, _) in PartitionName._name_parts] + [(k, default, True) for (k, _, _) in Name._generated_names]
def _write_jpy_config(target_dir=None, install_dir=None): """ Write out a well-formed jpyconfig.properties file for easier Java integration in a given location. """ if not target_dir: target_dir = _build_dir() args = [sys.executable, os.path.join(target_dir, 'jpyutil.py'...
def function[_write_jpy_config, parameter[target_dir, install_dir]]: constant[ Write out a well-formed jpyconfig.properties file for easier Java integration in a given location. ] if <ast.UnaryOp object at 0x7da204623970> begin[:] variable[target_dir] assign[=] call[name[_bui...
keyword[def] identifier[_write_jpy_config] ( identifier[target_dir] = keyword[None] , identifier[install_dir] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[target_dir] : identifier[target_dir] = identifier[_build_dir] () identifier[args] =[ identifier[sys] . identi...
def _write_jpy_config(target_dir=None, install_dir=None): """ Write out a well-formed jpyconfig.properties file for easier Java integration in a given location. """ if not target_dir: target_dir = _build_dir() # depends on [control=['if'], data=[]] args = [sys.executable, os.path.join(t...
def cached(f): """ Cache decorator for functions taking one or more arguments. :param f: The function to be cached. :return: The cached value. """ cache = f.cache = {} @functools.wraps(f) def decorator(*args, **kwargs): key = str(args) + str(kwargs) if key not in cache:...
def function[cached, parameter[f]]: constant[ Cache decorator for functions taking one or more arguments. :param f: The function to be cached. :return: The cached value. ] variable[cache] assign[=] dictionary[[], []] def function[decorator, parameter[]]: variable[...
keyword[def] identifier[cached] ( identifier[f] ): literal[string] identifier[cache] = identifier[f] . identifier[cache] ={} @ identifier[functools] . identifier[wraps] ( identifier[f] ) keyword[def] identifier[decorator] (* identifier[args] ,** identifier[kwargs] ): identifier[key] = ...
def cached(f): """ Cache decorator for functions taking one or more arguments. :param f: The function to be cached. :return: The cached value. """ cache = f.cache = {} @functools.wraps(f) def decorator(*args, **kwargs): key = str(args) + str(kwargs) if key not in cache: ...
def write(self, message, flush=True): """ Function: write Summary: write method on the default stream Examples: >>> stream.write('message') 'message' Attributes: @param (message): str-like content to send on stream @param (flush) default=...
def function[write, parameter[self, message, flush]]: constant[ Function: write Summary: write method on the default stream Examples: >>> stream.write('message') 'message' Attributes: @param (message): str-like content to send on stream @...
keyword[def] identifier[write] ( identifier[self] , identifier[message] , identifier[flush] = keyword[True] ): literal[string] identifier[self] . identifier[stream] . identifier[write] ( identifier[message] ) keyword[if] identifier[flush] : identifier[self] . identifier[strea...
def write(self, message, flush=True): """ Function: write Summary: write method on the default stream Examples: >>> stream.write('message') 'message' Attributes: @param (message): str-like content to send on stream @param (flush) default=True...
def check_bucket_exists(self, bucket: str) -> bool: """ Checks if bucket with specified name exists. :param bucket: the bucket to be checked. :return: true if specified bucket exists. """ bucket_obj = self.gcp_client.bucket(bucket) # type: Bucket return bucket_ob...
def function[check_bucket_exists, parameter[self, bucket]]: constant[ Checks if bucket with specified name exists. :param bucket: the bucket to be checked. :return: true if specified bucket exists. ] variable[bucket_obj] assign[=] call[name[self].gcp_client.bucket, parame...
keyword[def] identifier[check_bucket_exists] ( identifier[self] , identifier[bucket] : identifier[str] )-> identifier[bool] : literal[string] identifier[bucket_obj] = identifier[self] . identifier[gcp_client] . identifier[bucket] ( identifier[bucket] ) keyword[return] identifier[bucket_ob...
def check_bucket_exists(self, bucket: str) -> bool: """ Checks if bucket with specified name exists. :param bucket: the bucket to be checked. :return: true if specified bucket exists. """ bucket_obj = self.gcp_client.bucket(bucket) # type: Bucket return bucket_obj.exists()
def collection_callback(result=None): """ :type result: opendnp3.CommandPointResult """ print("Header: {0} | Index: {1} | State: {2} | Status: {3}".format( result.headerIndex, result.index, opendnp3.CommandPointStateToString(result.state), opendnp3.CommandStatusToString...
def function[collection_callback, parameter[result]]: constant[ :type result: opendnp3.CommandPointResult ] call[name[print], parameter[call[constant[Header: {0} | Index: {1} | State: {2} | Status: {3}].format, parameter[name[result].headerIndex, name[result].index, call[name[opendnp3].Command...
keyword[def] identifier[collection_callback] ( identifier[result] = keyword[None] ): literal[string] identifier[print] ( literal[string] . identifier[format] ( identifier[result] . identifier[headerIndex] , identifier[result] . identifier[index] , identifier[opendnp3] . identifier[CommandPoi...
def collection_callback(result=None): """ :type result: opendnp3.CommandPointResult """ print('Header: {0} | Index: {1} | State: {2} | Status: {3}'.format(result.headerIndex, result.index, opendnp3.CommandPointStateToString(result.state), opendnp3.CommandStatusToString(result.status)))
def print_stmt(self, print_loc, stmt): """ (2.6-2.7) print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] ) """ stmt.keyword_loc = print_loc if stmt.loc is None: stmt.loc = print_loc else: ...
def function[print_stmt, parameter[self, print_loc, stmt]]: constant[ (2.6-2.7) print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] ) ] name[stmt].keyword_loc assign[=] name[print_loc] if compare[name[stmt].loc ...
keyword[def] identifier[print_stmt] ( identifier[self] , identifier[print_loc] , identifier[stmt] ): literal[string] identifier[stmt] . identifier[keyword_loc] = identifier[print_loc] keyword[if] identifier[stmt] . identifier[loc] keyword[is] keyword[None] : identifier[stm...
def print_stmt(self, print_loc, stmt): """ (2.6-2.7) print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] ) """ stmt.keyword_loc = print_loc if stmt.loc is None: stmt.loc = print_loc # depends on [control=['if'], da...
def _iter_ns_range(self): """Iterates over self._ns_range, delegating to self._iter_key_range().""" while True: if self._current_key_range is None: query = self._ns_range.make_datastore_query() namespace_result = query.Get(1) if not namespace_result: break namesp...
def function[_iter_ns_range, parameter[self]]: constant[Iterates over self._ns_range, delegating to self._iter_key_range().] while constant[True] begin[:] if compare[name[self]._current_key_range is constant[None]] begin[:] variable[query] assign[=] call[name[self...
keyword[def] identifier[_iter_ns_range] ( identifier[self] ): literal[string] keyword[while] keyword[True] : keyword[if] identifier[self] . identifier[_current_key_range] keyword[is] keyword[None] : identifier[query] = identifier[self] . identifier[_ns_range] . identifier[make_datastore...
def _iter_ns_range(self): """Iterates over self._ns_range, delegating to self._iter_key_range().""" while True: if self._current_key_range is None: query = self._ns_range.make_datastore_query() namespace_result = query.Get(1) if not namespace_result: b...
def _rolling_lstsq(x, y): """Finds solution for the rolling case. Matrix formulation.""" if x.ndim == 2: # Treat everything as 3d and avoid AxisError on .swapaxes(1, 2) below # This means an original input of: # array([0., 1., 2., 3., 4., 5., 6.]) # becomes: #...
def function[_rolling_lstsq, parameter[x, y]]: constant[Finds solution for the rolling case. Matrix formulation.] if compare[name[x].ndim equal[==] constant[2]] begin[:] variable[x] assign[=] call[name[x]][tuple[[<ast.Slice object at 0x7da1b078ffd0>, <ast.Slice object at 0x7da1b078e500>...
keyword[def] identifier[_rolling_lstsq] ( identifier[x] , identifier[y] ): literal[string] keyword[if] identifier[x] . identifier[ndim] == literal[int] : identifier[x] = identifier[x] [:,:, keyword[None] ] keyword[el...
def _rolling_lstsq(x, y): """Finds solution for the rolling case. Matrix formulation.""" if x.ndim == 2: # Treat everything as 3d and avoid AxisError on .swapaxes(1, 2) below # This means an original input of: # array([0., 1., 2., 3., 4., 5., 6.]) # becomes: # array([[[0.],...
def create_instance(self, plugin_type, plugin_name, **instance_kwargs): """Create and return an instance of the given plugin.""" plugin_type = self._get_plugin_type(plugin_type) return plugin_type.create_instance(plugin_name, **instance_kwargs)
def function[create_instance, parameter[self, plugin_type, plugin_name]]: constant[Create and return an instance of the given plugin.] variable[plugin_type] assign[=] call[name[self]._get_plugin_type, parameter[name[plugin_type]]] return[call[name[plugin_type].create_instance, parameter[name[plugin_...
keyword[def] identifier[create_instance] ( identifier[self] , identifier[plugin_type] , identifier[plugin_name] ,** identifier[instance_kwargs] ): literal[string] identifier[plugin_type] = identifier[self] . identifier[_get_plugin_type] ( identifier[plugin_type] ) keyword[return] identifi...
def create_instance(self, plugin_type, plugin_name, **instance_kwargs): """Create and return an instance of the given plugin.""" plugin_type = self._get_plugin_type(plugin_type) return plugin_type.create_instance(plugin_name, **instance_kwargs)
def cmd_tcpflags(ip, port, flags, rflags, verbose): """Send TCP packets with different flags and tell what responses receives. It can be used to analyze how the different TCP/IP stack implementations and configurations responds to packet with various flag combinations. Example: \b # habu.tcpf...
def function[cmd_tcpflags, parameter[ip, port, flags, rflags, verbose]]: constant[Send TCP packets with different flags and tell what responses receives. It can be used to analyze how the different TCP/IP stack implementations and configurations responds to packet with various flag combinations. E...
keyword[def] identifier[cmd_tcpflags] ( identifier[ip] , identifier[port] , identifier[flags] , identifier[rflags] , identifier[verbose] ): literal[string] identifier[conf] . identifier[verb] = keyword[False] identifier[pkts] = identifier[IP] ( identifier[dst] = identifier[ip] )/ identifier[TCP] ( ...
def cmd_tcpflags(ip, port, flags, rflags, verbose): """Send TCP packets with different flags and tell what responses receives. It can be used to analyze how the different TCP/IP stack implementations and configurations responds to packet with various flag combinations. Example: \x08 # habu.tc...
def svg_to_path(file_obj, file_type=None): """ Load an SVG file into a Path2D object. Parameters ----------- file_obj : open file object Contains SVG data file_type: None Not used Returns ----------- loaded : dict With kwargs for Path2D constructor """ de...
def function[svg_to_path, parameter[file_obj, file_type]]: constant[ Load an SVG file into a Path2D object. Parameters ----------- file_obj : open file object Contains SVG data file_type: None Not used Returns ----------- loaded : dict With kwargs for Path2D c...
keyword[def] identifier[svg_to_path] ( identifier[file_obj] , identifier[file_type] = keyword[None] ): literal[string] keyword[def] identifier[element_transform] ( identifier[e] , identifier[max_depth] = literal[int] ): literal[string] identifier[matrices] =[] identifier[curre...
def svg_to_path(file_obj, file_type=None): """ Load an SVG file into a Path2D object. Parameters ----------- file_obj : open file object Contains SVG data file_type: None Not used Returns ----------- loaded : dict With kwargs for Path2D constructor """ de...
def _parse_status(data, cast_type): """ Parses a STATUS message and returns a CastStatus object. :type data: dict :param cast_type: Type of Chromecast. :rtype: CastStatus """ data = data.get('status', {}) volume_data = data.get('volume', {}) try...
def function[_parse_status, parameter[data, cast_type]]: constant[ Parses a STATUS message and returns a CastStatus object. :type data: dict :param cast_type: Type of Chromecast. :rtype: CastStatus ] variable[data] assign[=] call[name[data].get, parameter[constan...
keyword[def] identifier[_parse_status] ( identifier[data] , identifier[cast_type] ): literal[string] identifier[data] = identifier[data] . identifier[get] ( literal[string] ,{}) identifier[volume_data] = identifier[data] . identifier[get] ( literal[string] ,{}) keyword[try] : ...
def _parse_status(data, cast_type): """ Parses a STATUS message and returns a CastStatus object. :type data: dict :param cast_type: Type of Chromecast. :rtype: CastStatus """ data = data.get('status', {}) volume_data = data.get('volume', {}) try: app_data...
def parse_rosters(self): """ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['home', 'away']: self.rosters[t] = ...
def function[parse_rosters, parameter[self]]: constant[ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise ] variable[lx_doc] assign[=] call[name[self].html_doc, parameter[]] if <ast.UnaryOp object at 0x7da1b0e0e800> begin[:] ...
keyword[def] identifier[parse_rosters] ( identifier[self] ): literal[string] identifier[lx_doc] = identifier[self] . identifier[html_doc] () keyword[if] keyword[not] identifier[self] . identifier[__blocks] : identifier[self] . identifier[__pl_blocks] ( identifier[lx_doc] ) ...
def parse_rosters(self): """ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) # depends on [control=['if'], data=[]] for t in ['home', 'away']: self...
def compile_latex_text(input_text, dpath=None, fname=None, verbose=True, move=True, nest_in_doc=None, title=None, preamb_extra=None): r""" CommandLine: python -m utool.util_latex --test-compile_latex_text --show Ignore: pdflatex -shell-escape --...
def function[compile_latex_text, parameter[input_text, dpath, fname, verbose, move, nest_in_doc, title, preamb_extra]]: constant[ CommandLine: python -m utool.util_latex --test-compile_latex_text --show Ignore: pdflatex -shell-escape --synctex=-1 -src-specials -interaction=nonstopmode\ ...
keyword[def] identifier[compile_latex_text] ( identifier[input_text] , identifier[dpath] = keyword[None] , identifier[fname] = keyword[None] , identifier[verbose] = keyword[True] , identifier[move] = keyword[True] , identifier[nest_in_doc] = keyword[None] , identifier[title] = keyword[None] , identifier[preamb_extr...
def compile_latex_text(input_text, dpath=None, fname=None, verbose=True, move=True, nest_in_doc=None, title=None, preamb_extra=None): """ CommandLine: python -m utool.util_latex --test-compile_latex_text --show Ignore: pdflatex -shell-escape --synctex=-1 -src-specials -interaction=nonstopmo...
def _eval_script(redis, script_id, *keys, **kwargs): """Tries to call ``EVALSHA`` with the `hash` and then, if it fails, calls regular ``EVAL`` with the `script`. """ args = kwargs.pop('args', ()) if kwargs: raise TypeError("Unexpected keyword arguments %s" % kwargs.keys()) try: ...
def function[_eval_script, parameter[redis, script_id]]: constant[Tries to call ``EVALSHA`` with the `hash` and then, if it fails, calls regular ``EVAL`` with the `script`. ] variable[args] assign[=] call[name[kwargs].pop, parameter[constant[args], tuple[[]]]] if name[kwargs] begin[:] ...
keyword[def] identifier[_eval_script] ( identifier[redis] , identifier[script_id] ,* identifier[keys] ,** identifier[kwargs] ): literal[string] identifier[args] = identifier[kwargs] . identifier[pop] ( literal[string] ,()) keyword[if] identifier[kwargs] : keyword[raise] identifier[TypeError...
def _eval_script(redis, script_id, *keys, **kwargs): """Tries to call ``EVALSHA`` with the `hash` and then, if it fails, calls regular ``EVAL`` with the `script`. """ args = kwargs.pop('args', ()) if kwargs: raise TypeError('Unexpected keyword arguments %s' % kwargs.keys()) # depends on [co...
def underline(self, text, indent=4): """Underline a given text""" length = len(text) indentation = (' ' * indent) return indentation + text + '\n' + indentation + ('-' * length)
def function[underline, parameter[self, text, indent]]: constant[Underline a given text] variable[length] assign[=] call[name[len], parameter[name[text]]] variable[indentation] assign[=] binary_operation[constant[ ] * name[indent]] return[binary_operation[binary_operation[binary_operation[bi...
keyword[def] identifier[underline] ( identifier[self] , identifier[text] , identifier[indent] = literal[int] ): literal[string] identifier[length] = identifier[len] ( identifier[text] ) identifier[indentation] =( literal[string] * identifier[indent] ) keyword[return] identifier[i...
def underline(self, text, indent=4): """Underline a given text""" length = len(text) indentation = ' ' * indent return indentation + text + '\n' + indentation + '-' * length
def threaded( name: typing.Callable[..., typing.Any], daemon: bool = False, started: bool = False ) -> typing.Callable[..., threading.Thread]: """Overload: Call decorator without arguments."""
def function[threaded, parameter[name, daemon, started]]: constant[Overload: Call decorator without arguments.]
keyword[def] identifier[threaded] ( identifier[name] : identifier[typing] . identifier[Callable] [..., identifier[typing] . identifier[Any] ], identifier[daemon] : identifier[bool] = keyword[False] , identifier[started] : identifier[bool] = keyword[False] )-> identifier[typing] . identifier[Callable] [..., identifi...
def threaded(name: typing.Callable[..., typing.Any], daemon: bool=False, started: bool=False) -> typing.Callable[..., threading.Thread]: """Overload: Call decorator without arguments."""
def gif(gif_id, api_key=GIPHY_PUBLIC_KEY, strict=False): """ Shorthand for creating a Giphy api wrapper with the given api key and then calling the gif method. """ return Giphy(api_key=api_key, strict=strict).gif(gif_id)
def function[gif, parameter[gif_id, api_key, strict]]: constant[ Shorthand for creating a Giphy api wrapper with the given api key and then calling the gif method. ] return[call[call[name[Giphy], parameter[]].gif, parameter[name[gif_id]]]]
keyword[def] identifier[gif] ( identifier[gif_id] , identifier[api_key] = identifier[GIPHY_PUBLIC_KEY] , identifier[strict] = keyword[False] ): literal[string] keyword[return] identifier[Giphy] ( identifier[api_key] = identifier[api_key] , identifier[strict] = identifier[strict] ). identifier[gif] ( ident...
def gif(gif_id, api_key=GIPHY_PUBLIC_KEY, strict=False): """ Shorthand for creating a Giphy api wrapper with the given api key and then calling the gif method. """ return Giphy(api_key=api_key, strict=strict).gif(gif_id)
def contextual_log_handler(context, path, log_obj=None, level=logging.DEBUG, formatter=None): """Add a short-lived log with a contextmanager for cleanup. Args: context (scriptworker.context.Context): the scriptworker context path (str): the path to the log file to cre...
def function[contextual_log_handler, parameter[context, path, log_obj, level, formatter]]: constant[Add a short-lived log with a contextmanager for cleanup. Args: context (scriptworker.context.Context): the scriptworker context path (str): the path to the log file to create log_obj ...
keyword[def] identifier[contextual_log_handler] ( identifier[context] , identifier[path] , identifier[log_obj] = keyword[None] , identifier[level] = identifier[logging] . identifier[DEBUG] , identifier[formatter] = keyword[None] ): literal[string] identifier[log_obj] = identifier[log_obj] keyword[or] id...
def contextual_log_handler(context, path, log_obj=None, level=logging.DEBUG, formatter=None): """Add a short-lived log with a contextmanager for cleanup. Args: context (scriptworker.context.Context): the scriptworker context path (str): the path to the log file to create log_obj (loggin...
def add_meta(self, **metadict): """Add meta information to a Symbol. Parameters ---------- metadict Attributes are passed as keywords, with their associated values as strings. For meta attributes with spaces, use an unpacked ...
def function[add_meta, parameter[self]]: constant[Add meta information to a Symbol. Parameters ---------- metadict Attributes are passed as keywords, with their associated values as strings. For meta attributes with spaces, use an un...
keyword[def] identifier[add_meta] ( identifier[self] ,** identifier[metadict] ): literal[string] identifier[objs] = identifier[object_session] ( identifier[self] ) keyword[for] identifier[attr] , identifier[val] keyword[in] identifier[metadict] . identifier[iteritems] (): ...
def add_meta(self, **metadict): """Add meta information to a Symbol. Parameters ---------- metadict Attributes are passed as keywords, with their associated values as strings. For meta attributes with spaces, use an unpacked dict. ...
def nxos_api_show(commands, raw_text=True, **kwargs): ''' .. versionadded:: 2019.2.0 Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. CLI Example: .. code-block:...
def function[nxos_api_show, parameter[commands, raw_text]]: constant[ .. versionadded:: 2019.2.0 Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. CLI Example: ...
keyword[def] identifier[nxos_api_show] ( identifier[commands] , identifier[raw_text] = keyword[True] ,** identifier[kwargs] ): literal[string] identifier[nxos_api_kwargs] = identifier[pyeapi_nxos_api_args] (** identifier[kwargs] ) keyword[return] identifier[__salt__] [ literal[string] ]( identifier[c...
def nxos_api_show(commands, raw_text=True, **kwargs): """ .. versionadded:: 2019.2.0 Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. CLI Example: .. code-block:...
def median(nums): """Return median. With numbers sorted by value, the median is the middle value (if there is an odd number of values) or the arithmetic mean of the two middle values (if there is an even number of values). Cf. https://en.wikipedia.org/wiki/Median Parameters ---------- ...
def function[median, parameter[nums]]: constant[Return median. With numbers sorted by value, the median is the middle value (if there is an odd number of values) or the arithmetic mean of the two middle values (if there is an even number of values). Cf. https://en.wikipedia.org/wiki/Median ...
keyword[def] identifier[median] ( identifier[nums] ): literal[string] identifier[nums] = identifier[sorted] ( identifier[nums] ) identifier[mag] = identifier[len] ( identifier[nums] ) keyword[if] identifier[mag] % literal[int] : identifier[mag] = identifier[int] (( identifier[mag] - lit...
def median(nums): """Return median. With numbers sorted by value, the median is the middle value (if there is an odd number of values) or the arithmetic mean of the two middle values (if there is an even number of values). Cf. https://en.wikipedia.org/wiki/Median Parameters ---------- ...
def get_repository(self, entity_cls): """Return a repository object configured with a live connection""" model_cls = self.get_model(entity_cls) return DictRepository(self, entity_cls, model_cls)
def function[get_repository, parameter[self, entity_cls]]: constant[Return a repository object configured with a live connection] variable[model_cls] assign[=] call[name[self].get_model, parameter[name[entity_cls]]] return[call[name[DictRepository], parameter[name[self], name[entity_cls], name[model...
keyword[def] identifier[get_repository] ( identifier[self] , identifier[entity_cls] ): literal[string] identifier[model_cls] = identifier[self] . identifier[get_model] ( identifier[entity_cls] ) keyword[return] identifier[DictRepository] ( identifier[self] , identifier[entity_cls] , ident...
def get_repository(self, entity_cls): """Return a repository object configured with a live connection""" model_cls = self.get_model(entity_cls) return DictRepository(self, entity_cls, model_cls)
def set_plot_theme(theme): """Set the plotting parameters to a predefined theme""" if theme.lower() in ['paraview', 'pv']: rcParams['background'] = PV_BACKGROUND rcParams['cmap'] = 'coolwarm' rcParams['font']['family'] = 'arial' rcParams['font']['label_size'] = 16 rcParam...
def function[set_plot_theme, parameter[theme]]: constant[Set the plotting parameters to a predefined theme] if compare[call[name[theme].lower, parameter[]] in list[[<ast.Constant object at 0x7da20e960df0>, <ast.Constant object at 0x7da20e9612d0>]]] begin[:] call[name[rcParams]][constant[...
keyword[def] identifier[set_plot_theme] ( identifier[theme] ): literal[string] keyword[if] identifier[theme] . identifier[lower] () keyword[in] [ literal[string] , literal[string] ]: identifier[rcParams] [ literal[string] ]= identifier[PV_BACKGROUND] identifier[rcParams] [ literal[strin...
def set_plot_theme(theme): """Set the plotting parameters to a predefined theme""" if theme.lower() in ['paraview', 'pv']: rcParams['background'] = PV_BACKGROUND rcParams['cmap'] = 'coolwarm' rcParams['font']['family'] = 'arial' rcParams['font']['label_size'] = 16 rcParam...
def add_user(self, attrs): """add a user""" ldap_client = self._bind() # encoding crap attrs_srt = self.attrs_pretreatment(attrs) attrs_srt[self._byte_p2('objectClass')] = self.objectclasses # construct is DN dn = \ self._byte_p2(self.dn_user_attr) + ...
def function[add_user, parameter[self, attrs]]: constant[add a user] variable[ldap_client] assign[=] call[name[self]._bind, parameter[]] variable[attrs_srt] assign[=] call[name[self].attrs_pretreatment, parameter[name[attrs]]] call[name[attrs_srt]][call[name[self]._byte_p2, parameter[con...
keyword[def] identifier[add_user] ( identifier[self] , identifier[attrs] ): literal[string] identifier[ldap_client] = identifier[self] . identifier[_bind] () identifier[attrs_srt] = identifier[self] . identifier[attrs_pretreatment] ( identifier[attrs] ) identifier[attrs_...
def add_user(self, attrs): """add a user""" ldap_client = self._bind() # encoding crap attrs_srt = self.attrs_pretreatment(attrs) attrs_srt[self._byte_p2('objectClass')] = self.objectclasses # construct is DN dn = self._byte_p2(self.dn_user_attr) + self._byte_p2('=') + self._byte_p2(ldap.dn....
def handle_machines(changeset): """Populate the change set with addMachines changes.""" machines = sorted(changeset.bundle.get('machines', {}).items()) for machine_name, machine in machines: if machine is None: # We allow the machine value to be unset in the YAML. machine = {...
def function[handle_machines, parameter[changeset]]: constant[Populate the change set with addMachines changes.] variable[machines] assign[=] call[name[sorted], parameter[call[call[name[changeset].bundle.get, parameter[constant[machines], dictionary[[], []]]].items, parameter[]]]] for taget[tupl...
keyword[def] identifier[handle_machines] ( identifier[changeset] ): literal[string] identifier[machines] = identifier[sorted] ( identifier[changeset] . identifier[bundle] . identifier[get] ( literal[string] ,{}). identifier[items] ()) keyword[for] identifier[machine_name] , identifier[machine] keywo...
def handle_machines(changeset): """Populate the change set with addMachines changes.""" machines = sorted(changeset.bundle.get('machines', {}).items()) for (machine_name, machine) in machines: if machine is None: # We allow the machine value to be unset in the YAML. machine =...
def register_intent_parser(self, intent_parser, domain=0): """ Register a intent parser with a domain. Args: intent_parser(intent): The intent parser you wish to register. domain(str): a string representing the domain you wish register the intent parser t...
def function[register_intent_parser, parameter[self, intent_parser, domain]]: constant[ Register a intent parser with a domain. Args: intent_parser(intent): The intent parser you wish to register. domain(str): a string representing the domain you wish register the intent...
keyword[def] identifier[register_intent_parser] ( identifier[self] , identifier[intent_parser] , identifier[domain] = literal[int] ): literal[string] keyword[if] identifier[domain] keyword[not] keyword[in] identifier[self] . identifier[domains] : identifier[self] . identifier[regis...
def register_intent_parser(self, intent_parser, domain=0): """ Register a intent parser with a domain. Args: intent_parser(intent): The intent parser you wish to register. domain(str): a string representing the domain you wish register the intent parser to. ...
def get_email_message(self, message_uid, message_type="text/plain"): """ Fetch contents of email. Args: message_uid (int): IMAP Message UID number. Kwargs: message_type: Can be 'text' or 'html' """ self._mail.select("inbox") result = sel...
def function[get_email_message, parameter[self, message_uid, message_type]]: constant[ Fetch contents of email. Args: message_uid (int): IMAP Message UID number. Kwargs: message_type: Can be 'text' or 'html' ] call[name[self]._mail.select, param...
keyword[def] identifier[get_email_message] ( identifier[self] , identifier[message_uid] , identifier[message_type] = literal[string] ): literal[string] identifier[self] . identifier[_mail] . identifier[select] ( literal[string] ) identifier[result] = identifier[self] . identifier[_mail] . ...
def get_email_message(self, message_uid, message_type='text/plain'): """ Fetch contents of email. Args: message_uid (int): IMAP Message UID number. Kwargs: message_type: Can be 'text' or 'html' """ self._mail.select('inbox') result = self._mail.uid(...
def get_command_arg_list(self, command_name: str, to_parse: Union[Statement, str], preserve_quotes: bool) -> Tuple[Statement, List[str]]: """ Called by the argument_list and argparse wrappers to retrieve just the arguments being passed to their do_* methods as a list...
def function[get_command_arg_list, parameter[self, command_name, to_parse, preserve_quotes]]: constant[ Called by the argument_list and argparse wrappers to retrieve just the arguments being passed to their do_* methods as a list. :param command_name: name of the command being run ...
keyword[def] identifier[get_command_arg_list] ( identifier[self] , identifier[command_name] : identifier[str] , identifier[to_parse] : identifier[Union] [ identifier[Statement] , identifier[str] ], identifier[preserve_quotes] : identifier[bool] )-> identifier[Tuple] [ identifier[Statement] , identifier[List] [ ident...
def get_command_arg_list(self, command_name: str, to_parse: Union[Statement, str], preserve_quotes: bool) -> Tuple[Statement, List[str]]: """ Called by the argument_list and argparse wrappers to retrieve just the arguments being passed to their do_* methods as a list. :param command_name: n...
def split_calls(func): """ Decorator to split up server calls for methods using url parameters, due to the lenght limitation of the URI in Apache. By default 8190 bytes """ def wrapper(*args, **kwargs): #The size limit is 8190 bytes minus url and api to call #For example (https://cms...
def function[split_calls, parameter[func]]: constant[ Decorator to split up server calls for methods using url parameters, due to the lenght limitation of the URI in Apache. By default 8190 bytes ] def function[wrapper, parameter[]]: variable[size_limit] assign[=] constant[80...
keyword[def] identifier[split_calls] ( identifier[func] ): literal[string] keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ): identifier[size_limit] = literal[int] identifier[encoded_url] = identifier[urllib] . identifier[urlencode] ( identifier[kwa...
def split_calls(func): """ Decorator to split up server calls for methods using url parameters, due to the lenght limitation of the URI in Apache. By default 8190 bytes """ def wrapper(*args, **kwargs): #The size limit is 8190 bytes minus url and api to call #For example (https://cm...
def get_config(cls, service, config=None): """Get get configuration of the specified rate limiter :param str service: rate limiter name :param config: optional global rate limiters configuration. If not specified, then use rate limiters configuration spe...
def function[get_config, parameter[cls, service, config]]: constant[Get get configuration of the specified rate limiter :param str service: rate limiter name :param config: optional global rate limiters configuration. If not specified, then use rate limiters confi...
keyword[def] identifier[get_config] ( identifier[cls] , identifier[service] , identifier[config] = keyword[None] ): literal[string] identifier[config] = identifier[config] keyword[or] identifier[cls] . identifier[get_configs] () keyword[return] identifier[config] [ identifier[service] ]
def get_config(cls, service, config=None): """Get get configuration of the specified rate limiter :param str service: rate limiter name :param config: optional global rate limiters configuration. If not specified, then use rate limiters configuration specifi...
def find_formatters(path, silent=True): """ Returns a list of formatter classes which would accept the file given by *path*. When no classes could be found and *silent* is *True*, an empty list is returned. Otherwise, an exception is raised. """ formatters = [f for f in six.itervalues(FormatterR...
def function[find_formatters, parameter[path, silent]]: constant[ Returns a list of formatter classes which would accept the file given by *path*. When no classes could be found and *silent* is *True*, an empty list is returned. Otherwise, an exception is raised. ] variable[formatters] a...
keyword[def] identifier[find_formatters] ( identifier[path] , identifier[silent] = keyword[True] ): literal[string] identifier[formatters] =[ identifier[f] keyword[for] identifier[f] keyword[in] identifier[six] . identifier[itervalues] ( identifier[FormatterRegister] . identifier[formatters] ) keyword[...
def find_formatters(path, silent=True): """ Returns a list of formatter classes which would accept the file given by *path*. When no classes could be found and *silent* is *True*, an empty list is returned. Otherwise, an exception is raised. """ formatters = [f for f in six.itervalues(FormatterR...
def current_user(self): """Retrieve the user ID of the current user talking to your bot. This is mostly useful inside of a Python object macro to get the user ID of the person who caused the object macro to be invoked (i.e. to set a variable for that user from within the object). ...
def function[current_user, parameter[self]]: constant[Retrieve the user ID of the current user talking to your bot. This is mostly useful inside of a Python object macro to get the user ID of the person who caused the object macro to be invoked (i.e. to set a variable for that user from...
keyword[def] identifier[current_user] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_brain] . identifier[_current_user] keyword[is] keyword[None] : identifier[self] . identifier[_warn] ( literal[string] ) keyword[return] identifie...
def current_user(self): """Retrieve the user ID of the current user talking to your bot. This is mostly useful inside of a Python object macro to get the user ID of the person who caused the object macro to be invoked (i.e. to set a variable for that user from within the object). T...
def tower_layout(graph, height='freeenergy', scale=None, center=None, dim=2): """ Position all nodes of graph stacked on top of each other. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None`, opt...
def function[tower_layout, parameter[graph, height, scale, center, dim]]: constant[ Position all nodes of graph stacked on top of each other. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None...
keyword[def] identifier[tower_layout] ( identifier[graph] , identifier[height] = literal[string] , identifier[scale] = keyword[None] , identifier[center] = keyword[None] , identifier[dim] = literal[int] ): literal[string] identifier[graph] , identifier[center] = identifier[_nx] . identifier[drawing] ....
def tower_layout(graph, height='freeenergy', scale=None, center=None, dim=2): """ Position all nodes of graph stacked on top of each other. Parameters ---------- graph : `networkx.Graph` or `list` of nodes A position will be assigned to every node in graph. height : `str` or `None`, opt...
def do_unalias(self, arg): """unalias name Delete the specified alias. """ args = arg.split() if len(args) == 0: return if args[0] in self.aliases: del self.aliases[args[0]]
def function[do_unalias, parameter[self, arg]]: constant[unalias name Delete the specified alias. ] variable[args] assign[=] call[name[arg].split, parameter[]] if compare[call[name[len], parameter[name[args]]] equal[==] constant[0]] begin[:] return[None] if compar...
keyword[def] identifier[do_unalias] ( identifier[self] , identifier[arg] ): literal[string] identifier[args] = identifier[arg] . identifier[split] () keyword[if] identifier[len] ( identifier[args] )== literal[int] : keyword[return] keyword[if] identifier[args] [ literal[int] ] ...
def do_unalias(self, arg): """unalias name Delete the specified alias. """ args = arg.split() if len(args) == 0: return # depends on [control=['if'], data=[]] if args[0] in self.aliases: del self.aliases[args[0]] # depends on [control=['if'], data=[]]
def add_sched_block_instance(self, config_dict): """Add Scheduling Block to the database. Args: config_dict (dict): SBI configuration """ # Get schema for validation schema = self._get_schema() LOG.debug('Adding SBI with config: %s', config_dict) # ...
def function[add_sched_block_instance, parameter[self, config_dict]]: constant[Add Scheduling Block to the database. Args: config_dict (dict): SBI configuration ] variable[schema] assign[=] call[name[self]._get_schema, parameter[]] call[name[LOG].debug, parameter[co...
keyword[def] identifier[add_sched_block_instance] ( identifier[self] , identifier[config_dict] ): literal[string] identifier[schema] = identifier[self] . identifier[_get_schema] () identifier[LOG] . identifier[debug] ( literal[string] , identifier[config_dict] ) ...
def add_sched_block_instance(self, config_dict): """Add Scheduling Block to the database. Args: config_dict (dict): SBI configuration """ # Get schema for validation schema = self._get_schema() LOG.debug('Adding SBI with config: %s', config_dict) # Validates the schema ...
def fetch(self, method, url, data=None, expected_status_code=None): """Prepare the headers, encode data, call API and provide data it returns """ kwargs = self.prepare_request(method, url, data) log.debug(json.dumps(kwargs)) response = getattr(requests, method.lower())(ur...
def function[fetch, parameter[self, method, url, data, expected_status_code]]: constant[Prepare the headers, encode data, call API and provide data it returns ] variable[kwargs] assign[=] call[name[self].prepare_request, parameter[name[method], name[url], name[data]]] call[name[l...
keyword[def] identifier[fetch] ( identifier[self] , identifier[method] , identifier[url] , identifier[data] = keyword[None] , identifier[expected_status_code] = keyword[None] ): literal[string] identifier[kwargs] = identifier[self] . identifier[prepare_request] ( identifier[method] , identifier[url...
def fetch(self, method, url, data=None, expected_status_code=None): """Prepare the headers, encode data, call API and provide data it returns """ kwargs = self.prepare_request(method, url, data) log.debug(json.dumps(kwargs)) response = getattr(requests, method.lower())(url, **kwargs) ...
def validate_empty_attributes(fully_qualified_name: str, spec: Dict[str, Any], *attributes: str) -> List[EmptyAttributeError]: """ Validates to ensure that a set of attributes do not contain empty values """ return [ EmptyAttributeError(fully_qualified_name, spec, attribute...
def function[validate_empty_attributes, parameter[fully_qualified_name, spec]]: constant[ Validates to ensure that a set of attributes do not contain empty values ] return[<ast.ListComp object at 0x7da20c992f50>]
keyword[def] identifier[validate_empty_attributes] ( identifier[fully_qualified_name] : identifier[str] , identifier[spec] : identifier[Dict] [ identifier[str] , identifier[Any] ], * identifier[attributes] : identifier[str] )-> identifier[List] [ identifier[EmptyAttributeError] ]: literal[string] keyword[r...
def validate_empty_attributes(fully_qualified_name: str, spec: Dict[str, Any], *attributes: str) -> List[EmptyAttributeError]: """ Validates to ensure that a set of attributes do not contain empty values """ return [EmptyAttributeError(fully_qualified_name, spec, attribute) for attribute in attributes if not sp...
def write(self, message): """ (coroutine) Write a single message into the pipe. """ if self.done_f.done(): raise BrokenPipeError try: yield From(write_message_to_pipe(self.pipe_instance.pipe_handle, message)) except BrokenPipeError: ...
def function[write, parameter[self, message]]: constant[ (coroutine) Write a single message into the pipe. ] if call[name[self].done_f.done, parameter[]] begin[:] <ast.Raise object at 0x7da1b206a530> <ast.Try object at 0x7da1b206b700>
keyword[def] identifier[write] ( identifier[self] , identifier[message] ): literal[string] keyword[if] identifier[self] . identifier[done_f] . identifier[done] (): keyword[raise] identifier[BrokenPipeError] keyword[try] : keyword[yield] identifier[From] ( ide...
def write(self, message): """ (coroutine) Write a single message into the pipe. """ if self.done_f.done(): raise BrokenPipeError # depends on [control=['if'], data=[]] try: yield From(write_message_to_pipe(self.pipe_instance.pipe_handle, message)) # depends on [cont...
def get_info(brain_or_object, endpoint=None, complete=False): """Extract the data from the catalog brain or object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL endpoint for the root...
def function[get_info, parameter[brain_or_object, endpoint, complete]]: constant[Extract the data from the catalog brain or object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL e...
keyword[def] identifier[get_info] ( identifier[brain_or_object] , identifier[endpoint] = keyword[None] , identifier[complete] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[is_brain] ( identifier[brain_or_object] ): identifier[brain_or_object] = identifier[get_brai...
def get_info(brain_or_object, endpoint=None, complete=False): """Extract the data from the catalog brain or object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL endpoint for the root...
def to_array(self): """ Serializes this ShippingAddress to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(ShippingAddress, self).to_array() array['country_code'] = u(self.country_code) # py2: type unicode, py3: ty...
def function[to_array, parameter[self]]: constant[ Serializes this ShippingAddress to a dictionary. :return: dictionary representation of this object. :rtype: dict ] variable[array] assign[=] call[call[name[super], parameter[name[ShippingAddress], name[self]]].to_array, ...
keyword[def] identifier[to_array] ( identifier[self] ): literal[string] identifier[array] = identifier[super] ( identifier[ShippingAddress] , identifier[self] ). identifier[to_array] () identifier[array] [ literal[string] ]= identifier[u] ( identifier[self] . identifier[country_code] ) ...
def to_array(self): """ Serializes this ShippingAddress to a dictionary. :return: dictionary representation of this object. :rtype: dict """ array = super(ShippingAddress, self).to_array() array['country_code'] = u(self.country_code) # py2: type unicode, py3: type str a...
def delete_os_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False): """Deletes the Openstack Out network and update the DB. """ ret = True tenant_name = fw_dict.get('tenant_name') try: ret = self._delete_os_nwk(tenant_id, tenant_name, "out", ...
def function[delete_os_out_nwk, parameter[self, tenant_id, fw_dict, is_fw_virt]]: constant[Deletes the Openstack Out network and update the DB. ] variable[ret] assign[=] constant[True] variable[tenant_name] assign[=] call[name[fw_dict].get, parameter[constant[tenant_name]]] <ast.Try object a...
keyword[def] identifier[delete_os_out_nwk] ( identifier[self] , identifier[tenant_id] , identifier[fw_dict] , identifier[is_fw_virt] = keyword[False] ): literal[string] identifier[ret] = keyword[True] identifier[tenant_name] = identifier[fw_dict] . identifier[get] ( literal[string] ) ...
def delete_os_out_nwk(self, tenant_id, fw_dict, is_fw_virt=False): """Deletes the Openstack Out network and update the DB. """ ret = True tenant_name = fw_dict.get('tenant_name') try: ret = self._delete_os_nwk(tenant_id, tenant_name, 'out', is_fw_virt=is_fw_virt) # depends on [control=['try'], ...
def transformed(self, t): """ Transforms an m-dimensional Rect using t, an nxn matrix that can transform vectors in the form: [x, y, z, …, 1]. The Rect is padded to n dimensions. """ assert t.shape[0] == t.shape[1] extra_dimensions = t.shape[0] - self.dimensions -...
def function[transformed, parameter[self, t]]: constant[ Transforms an m-dimensional Rect using t, an nxn matrix that can transform vectors in the form: [x, y, z, …, 1]. The Rect is padded to n dimensions. ] assert[compare[call[name[t].shape][constant[0]] equal[==] call[name[...
keyword[def] identifier[transformed] ( identifier[self] , identifier[t] ): literal[string] keyword[assert] identifier[t] . identifier[shape] [ literal[int] ]== identifier[t] . identifier[shape] [ literal[int] ] identifier[extra_dimensions] = identifier[t] . identifier[shape] [ literal[int...
def transformed(self, t): """ Transforms an m-dimensional Rect using t, an nxn matrix that can transform vectors in the form: [x, y, z, …, 1]. The Rect is padded to n dimensions. """ assert t.shape[0] == t.shape[1] extra_dimensions = t.shape[0] - self.dimensions - 1 def ...
def agg_wt_avg(mat, min_wt = 0.01, corr_metric='spearman'): ''' Aggregate a set of replicate profiles into a single signature using a weighted average. Args: mat (pandas df): a matrix of replicate profiles, where the columns are samples and the rows are features; columns correspond to the ...
def function[agg_wt_avg, parameter[mat, min_wt, corr_metric]]: constant[ Aggregate a set of replicate profiles into a single signature using a weighted average. Args: mat (pandas df): a matrix of replicate profiles, where the columns are samples and the rows are features; columns correspond...
keyword[def] identifier[agg_wt_avg] ( identifier[mat] , identifier[min_wt] = literal[int] , identifier[corr_metric] = literal[string] ): literal[string] keyword[assert] identifier[mat] . identifier[shape] [ literal[int] ]> literal[int] , literal[string] . identifier[format] ( identifier[mat] ) keywo...
def agg_wt_avg(mat, min_wt=0.01, corr_metric='spearman'): """ Aggregate a set of replicate profiles into a single signature using a weighted average. Args: mat (pandas df): a matrix of replicate profiles, where the columns are samples and the rows are features; columns correspond to the ...
def make_flat_df(frames, return_addresses): """ Takes a list of dictionaries, each representing what is returned from the model at a particular time, and creates a dataframe whose columns correspond to the keys of `return addresses` Parameters ---------- frames: list of dictionaries ...
def function[make_flat_df, parameter[frames, return_addresses]]: constant[ Takes a list of dictionaries, each representing what is returned from the model at a particular time, and creates a dataframe whose columns correspond to the keys of `return addresses` Parameters ---------- frame...
keyword[def] identifier[make_flat_df] ( identifier[frames] , identifier[return_addresses] ): literal[string] identifier[visited] = identifier[list] ( identifier[map] ( keyword[lambda] identifier[x] : identifier[visit_addresses] ( identifier[x] , identifier[return_addresses] ), identifier[frames] )) ...
def make_flat_df(frames, return_addresses): """ Takes a list of dictionaries, each representing what is returned from the model at a particular time, and creates a dataframe whose columns correspond to the keys of `return addresses` Parameters ---------- frames: list of dictionaries ...
def add_splash_ids(splash_mapping_file_pth, conn, db_type='sqlite'): """ Add splash ids to database (in case stored in a different file to the msp files like for MoNA) Example: >>> from msp2db.db import get_connection >>> from msp2db.parse import add_splash_ids >>> conn = get_connection...
def function[add_splash_ids, parameter[splash_mapping_file_pth, conn, db_type]]: constant[ Add splash ids to database (in case stored in a different file to the msp files like for MoNA) Example: >>> from msp2db.db import get_connection >>> from msp2db.parse import add_splash_ids >>>...
keyword[def] identifier[add_splash_ids] ( identifier[splash_mapping_file_pth] , identifier[conn] , identifier[db_type] = literal[string] ): literal[string] identifier[cursor] = identifier[conn] . identifier[cursor] () identifier[cursor] . identifier[execute] ( literal[string] ) identifier[a...
def add_splash_ids(splash_mapping_file_pth, conn, db_type='sqlite'): """ Add splash ids to database (in case stored in a different file to the msp files like for MoNA) Example: >>> from msp2db.db import get_connection >>> from msp2db.parse import add_splash_ids >>> conn = get_connection...
def timeout(seconds=None, use_signals=True, timeout_exception=TimeoutError, exception_message=None): """Add a timeout parameter to a function and return it. :param seconds: optional time limit in seconds or fractions of a second. If None is passed, no timeout is applied. This adds some flexibility to t...
def function[timeout, parameter[seconds, use_signals, timeout_exception, exception_message]]: constant[Add a timeout parameter to a function and return it. :param seconds: optional time limit in seconds or fractions of a second. If None is passed, no timeout is applied. This adds some flexibility t...
keyword[def] identifier[timeout] ( identifier[seconds] = keyword[None] , identifier[use_signals] = keyword[True] , identifier[timeout_exception] = identifier[TimeoutError] , identifier[exception_message] = keyword[None] ): literal[string] keyword[def] identifier[decorate] ( identifier[function] ): ...
def timeout(seconds=None, use_signals=True, timeout_exception=TimeoutError, exception_message=None): """Add a timeout parameter to a function and return it. :param seconds: optional time limit in seconds or fractions of a second. If None is passed, no timeout is applied. This adds some flexibility to t...
def _smooth_distribution(p, eps=0.0001): """Given a discrete distribution (may have not been normalized to 1), smooth it by replacing zeros with eps multiplied by a scaling factor and taking the corresponding amount off the non-zero values. Ref: http://web.engr.illinois.edu/~hanj/cs412/bk3/KL-divergence...
def function[_smooth_distribution, parameter[p, eps]]: constant[Given a discrete distribution (may have not been normalized to 1), smooth it by replacing zeros with eps multiplied by a scaling factor and taking the corresponding amount off the non-zero values. Ref: http://web.engr.illinois.edu/~hanj...
keyword[def] identifier[_smooth_distribution] ( identifier[p] , identifier[eps] = literal[int] ): literal[string] identifier[is_zeros] =( identifier[p] == literal[int] ). identifier[astype] ( identifier[np] . identifier[float32] ) identifier[is_nonzeros] =( identifier[p] != literal[int] ). identifier[...
def _smooth_distribution(p, eps=0.0001): """Given a discrete distribution (may have not been normalized to 1), smooth it by replacing zeros with eps multiplied by a scaling factor and taking the corresponding amount off the non-zero values. Ref: http://web.engr.illinois.edu/~hanj/cs412/bk3/KL-divergence...
def create_or_update(cls, video, language_code, metadata, file_data=None): """ Create or update Transcript object. Arguments: video (Video): Video for which transcript is going to be saved. language_code (str): language code for (to be created/updated) transcript ...
def function[create_or_update, parameter[cls, video, language_code, metadata, file_data]]: constant[ Create or update Transcript object. Arguments: video (Video): Video for which transcript is going to be saved. language_code (str): language code for (to be created/updat...
keyword[def] identifier[create_or_update] ( identifier[cls] , identifier[video] , identifier[language_code] , identifier[metadata] , identifier[file_data] = keyword[None] ): literal[string] keyword[try] : identifier[video_transcript] = identifier[cls] . identifier[objects] . identifier...
def create_or_update(cls, video, language_code, metadata, file_data=None): """ Create or update Transcript object. Arguments: video (Video): Video for which transcript is going to be saved. language_code (str): language code for (to be created/updated) transcript ...
def lookup_attribute_chain(attrname, namespace): """ >>> attrname = funcname >>> namespace = mod.__dict__ >>> import utool as ut >>> globals_ = ut.util_inspect.__dict__ >>> attrname = 'KWReg.print_defaultkw' """ #subdict = meta_util_six.get_funcglobals(root_func) ...
def function[lookup_attribute_chain, parameter[attrname, namespace]]: constant[ >>> attrname = funcname >>> namespace = mod.__dict__ >>> import utool as ut >>> globals_ = ut.util_inspect.__dict__ >>> attrname = 'KWReg.print_defaultkw' ] variable[subtup] assi...
keyword[def] identifier[lookup_attribute_chain] ( identifier[attrname] , identifier[namespace] ): literal[string] identifier[subtup] = identifier[attrname] . identifier[split] ( literal[string] ) identifier[subdict] = identifier[namespace] keyword[for] identifier[attr] keyword[in] identi...
def lookup_attribute_chain(attrname, namespace): """ >>> attrname = funcname >>> namespace = mod.__dict__ >>> import utool as ut >>> globals_ = ut.util_inspect.__dict__ >>> attrname = 'KWReg.print_defaultkw' """ #subdict = meta_util_six.get_funcglobals(root_func) ...
def reduceByWindow(self, reduceFunc, invReduceFunc, windowDuration, slideDuration): """ Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream. if `invReduceFunc` is not None, the reduction is done incremental...
def function[reduceByWindow, parameter[self, reduceFunc, invReduceFunc, windowDuration, slideDuration]]: constant[ Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream. if `invReduceFunc` is not None, the re...
keyword[def] identifier[reduceByWindow] ( identifier[self] , identifier[reduceFunc] , identifier[invReduceFunc] , identifier[windowDuration] , identifier[slideDuration] ): literal[string] identifier[keyed] = identifier[self] . identifier[map] ( keyword[lambda] identifier[x] :( literal[int] , ident...
def reduceByWindow(self, reduceFunc, invReduceFunc, windowDuration, slideDuration): """ Return a new DStream in which each RDD has a single element generated by reducing all elements in a sliding window over this DStream. if `invReduceFunc` is not None, the reduction is done incrementally ...
def bucketize(src, key=None, value_transform=None, key_filter=None): """Group values in the *src* iterable by the value returned by *key*, which defaults to :class:`bool`, grouping values by truthiness. >>> bucketize(range(5)) {False: [0], True: [1, 2, 3, 4]} >>> is_odd = lambda x: x % 2 == 1 >...
def function[bucketize, parameter[src, key, value_transform, key_filter]]: constant[Group values in the *src* iterable by the value returned by *key*, which defaults to :class:`bool`, grouping values by truthiness. >>> bucketize(range(5)) {False: [0], True: [1, 2, 3, 4]} >>> is_odd = lambda x: ...
keyword[def] identifier[bucketize] ( identifier[src] , identifier[key] = keyword[None] , identifier[value_transform] = keyword[None] , identifier[key_filter] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[is_iterable] ( identifier[src] ): keyword[raise] identifier[TypeEr...
def bucketize(src, key=None, value_transform=None, key_filter=None): """Group values in the *src* iterable by the value returned by *key*, which defaults to :class:`bool`, grouping values by truthiness. >>> bucketize(range(5)) {False: [0], True: [1, 2, 3, 4]} >>> is_odd = lambda x: x % 2 == 1 >...
def handlePortfolio(self, msg): """ handle portfolio updates """ # log handler msg self.log_msg("portfolio", msg) # contract identifier contract_tuple = self.contract_to_tuple(msg.contract) contractString = self.contractString(contract_tuple) # try creating the...
def function[handlePortfolio, parameter[self, msg]]: constant[ handle portfolio updates ] call[name[self].log_msg, parameter[constant[portfolio], name[msg]]] variable[contract_tuple] assign[=] call[name[self].contract_to_tuple, parameter[name[msg].contract]] variable[contractString] assi...
keyword[def] identifier[handlePortfolio] ( identifier[self] , identifier[msg] ): literal[string] identifier[self] . identifier[log_msg] ( literal[string] , identifier[msg] ) identifier[contract_tuple] = identifier[self] . identifier[contract_to_tuple] ( identifier[msg] ...
def handlePortfolio(self, msg): """ handle portfolio updates """ # log handler msg self.log_msg('portfolio', msg) # contract identifier contract_tuple = self.contract_to_tuple(msg.contract) contractString = self.contractString(contract_tuple) # try creating the contract self.registerCont...
def get_base_indentation(code, include_start=False): """Heuristically extracts the base indentation from the provided code. Finds the smallest indentation following a newline not at the end of the string. """ new_line_indentation = re_new_line_indentation[include_start].finditer(code) new_line_...
def function[get_base_indentation, parameter[code, include_start]]: constant[Heuristically extracts the base indentation from the provided code. Finds the smallest indentation following a newline not at the end of the string. ] variable[new_line_indentation] assign[=] call[call[name[re_new_...
keyword[def] identifier[get_base_indentation] ( identifier[code] , identifier[include_start] = keyword[False] ): literal[string] identifier[new_line_indentation] = identifier[re_new_line_indentation] [ identifier[include_start] ]. identifier[finditer] ( identifier[code] ) identifier[new_line_indentati...
def get_base_indentation(code, include_start=False): """Heuristically extracts the base indentation from the provided code. Finds the smallest indentation following a newline not at the end of the string. """ new_line_indentation = re_new_line_indentation[include_start].finditer(code) new_line_...
def CompleteHuntIfExpirationTimeReached(hunt_obj): """Marks the hunt as complete if it's past its expiry time.""" # TODO(hanuszczak): This should not set the hunt state to `COMPLETED` but we # should have a sparate `EXPIRED` state instead and set that. if (hunt_obj.hunt_state not in [ rdf_hunt_objects.Hun...
def function[CompleteHuntIfExpirationTimeReached, parameter[hunt_obj]]: constant[Marks the hunt as complete if it's past its expiry time.] if <ast.BoolOp object at 0x7da1b1b44940> begin[:] call[name[StopHunt], parameter[name[hunt_obj].hunt_id]] call[name[data_store].REL_D...
keyword[def] identifier[CompleteHuntIfExpirationTimeReached] ( identifier[hunt_obj] ): literal[string] keyword[if] ( identifier[hunt_obj] . identifier[hunt_state] keyword[not] keyword[in] [ identifier[rdf_hunt_objects] . identifier[Hunt] . identifier[HuntState] . identifier[STOPPED] , identifier[...
def CompleteHuntIfExpirationTimeReached(hunt_obj): """Marks the hunt as complete if it's past its expiry time.""" # TODO(hanuszczak): This should not set the hunt state to `COMPLETED` but we # should have a sparate `EXPIRED` state instead and set that. if hunt_obj.hunt_state not in [rdf_hunt_objects.Hun...
def create_comment(self, comment_form): """Creates a new ``Comment``. arg: comment_form (osid.commenting.CommentForm): the form for this ``Comment`` return: (osid.commenting.Comment) - the new ``Comment`` raise: IllegalState - ``comment_form`` already used in a creat...
def function[create_comment, parameter[self, comment_form]]: constant[Creates a new ``Comment``. arg: comment_form (osid.commenting.CommentForm): the form for this ``Comment`` return: (osid.commenting.Comment) - the new ``Comment`` raise: IllegalState - ``comment_for...
keyword[def] identifier[create_comment] ( identifier[self] , identifier[comment_form] ): literal[string] identifier[collection] = identifier[JSONClientValidated] ( literal[string] , identifier[collection] = literal[string] , identifier[runtime] = identifier[self]...
def create_comment(self, comment_form): """Creates a new ``Comment``. arg: comment_form (osid.commenting.CommentForm): the form for this ``Comment`` return: (osid.commenting.Comment) - the new ``Comment`` raise: IllegalState - ``comment_form`` already used in a create ...
def _get_library_metadata(self, date_range): """ Retrieve the libraries for the given date range, the assumption is that the date ranges do not overlap and they are CLOSED_CLOSED. At the moment the date range is mandatory """ if date_range is None: raise Exce...
def function[_get_library_metadata, parameter[self, date_range]]: constant[ Retrieve the libraries for the given date range, the assumption is that the date ranges do not overlap and they are CLOSED_CLOSED. At the moment the date range is mandatory ] if compare[name[date...
keyword[def] identifier[_get_library_metadata] ( identifier[self] , identifier[date_range] ): literal[string] keyword[if] identifier[date_range] keyword[is] keyword[None] : keyword[raise] identifier[Exception] ( literal[string] ) keyword[if] keyword[not] ( identifier[date...
def _get_library_metadata(self, date_range): """ Retrieve the libraries for the given date range, the assumption is that the date ranges do not overlap and they are CLOSED_CLOSED. At the moment the date range is mandatory """ if date_range is None: raise Exception('A dat...
def translate_array(array, lval, obj_count=1, arr_count=1): """array has to be any js array for example [1,2,3] lval has to be name of this array. Returns python code that adds lval to the PY scope it should be put before lval""" array = array[1:-1] array, obj_rep, obj_count = remove_objects(a...
def function[translate_array, parameter[array, lval, obj_count, arr_count]]: constant[array has to be any js array for example [1,2,3] lval has to be name of this array. Returns python code that adds lval to the PY scope it should be put before lval] variable[array] assign[=] call[name[arr...
keyword[def] identifier[translate_array] ( identifier[array] , identifier[lval] , identifier[obj_count] = literal[int] , identifier[arr_count] = literal[int] ): literal[string] identifier[array] = identifier[array] [ literal[int] :- literal[int] ] identifier[array] , identifier[obj_rep] , identifier[o...
def translate_array(array, lval, obj_count=1, arr_count=1): """array has to be any js array for example [1,2,3] lval has to be name of this array. Returns python code that adds lval to the PY scope it should be put before lval""" array = array[1:-1] (array, obj_rep, obj_count) = remove_objects...
def create_Dim(self, name,value): ''' Adds a dimension to class. :parameter name: dimension name :parameter value: dimension value ''' if not self._dimensions.has_key(name) : self.message(3, 'Create dimension {0}:{1}'.format(name,value)) ...
def function[create_Dim, parameter[self, name, value]]: constant[ Adds a dimension to class. :parameter name: dimension name :parameter value: dimension value ] if <ast.UnaryOp object at 0x7da1b0911270> begin[:] call[name[self].message, parameter[...
keyword[def] identifier[create_Dim] ( identifier[self] , identifier[name] , identifier[value] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_dimensions] . identifier[has_key] ( identifier[name] ): identifier[self] . identifier[message] ( literal[int] , ...
def create_Dim(self, name, value): """ Adds a dimension to class. :parameter name: dimension name :parameter value: dimension value """ if not self._dimensions.has_key(name): self.message(3, 'Create dimension {0}:{1}'.format(name, value)) self._dimensions...
def _patched_pep257(): """Monkey-patch pep257 after imports to avoid info logging.""" import pep257 if getattr(pep257, "log", None): def _dummy(*args, **kwargs): del args del kwargs old_log_info = pep257.log.info pep257.log.info = _dummy # suppress(unused-a...
def function[_patched_pep257, parameter[]]: constant[Monkey-patch pep257 after imports to avoid info logging.] import module[pep257] if call[name[getattr], parameter[name[pep257], constant[log], constant[None]]] begin[:] def function[_dummy, parameter[]]: <ast.Delete obje...
keyword[def] identifier[_patched_pep257] (): literal[string] keyword[import] identifier[pep257] keyword[if] identifier[getattr] ( identifier[pep257] , literal[string] , keyword[None] ): keyword[def] identifier[_dummy] (* identifier[args] ,** identifier[kwargs] ): keyword[del...
def _patched_pep257(): """Monkey-patch pep257 after imports to avoid info logging.""" import pep257 if getattr(pep257, 'log', None): def _dummy(*args, **kwargs): del args del kwargs old_log_info = pep257.log.info pep257.log.info = _dummy # suppress(unused-at...
def color(x, y): """triangles. Colors: - http://paletton.com/#uid=70l150klllletuehUpNoMgTsdcs shade 2 """ if (x-4) > (y-4) and -(y-4) <= (x-4): # right return "#CDB95B" elif (x-4) > (y-4) and -(y-4) > (x-4): # top return "#CD845B" elif (x-4) <= (y-4) and -(y...
def function[color, parameter[x, y]]: constant[triangles. Colors: - http://paletton.com/#uid=70l150klllletuehUpNoMgTsdcs shade 2 ] if <ast.BoolOp object at 0x7da18f812da0> begin[:] return[constant[#CDB95B]] return[constant[black]]
keyword[def] identifier[color] ( identifier[x] , identifier[y] ): literal[string] keyword[if] ( identifier[x] - literal[int] )>( identifier[y] - literal[int] ) keyword[and] -( identifier[y] - literal[int] )<=( identifier[x] - literal[int] ): keyword[return] literal[string] keyword[eli...
def color(x, y): """triangles. Colors: - http://paletton.com/#uid=70l150klllletuehUpNoMgTsdcs shade 2 """ if x - 4 > y - 4 and -(y - 4) <= x - 4: # right return '#CDB95B' # depends on [control=['if'], data=[]] elif x - 4 > y - 4 and -(y - 4) > x - 4: # top retur...
def ReadConflicts(self, collection_link, feed_options=None): """Reads conflicts. :param str collection_link: The link to the document collection. :param dict feed_options: :return: Query Iterable of Conflicts. :rtype: query_iterable.QueryIter...
def function[ReadConflicts, parameter[self, collection_link, feed_options]]: constant[Reads conflicts. :param str collection_link: The link to the document collection. :param dict feed_options: :return: Query Iterable of Conflicts. :rtype: qu...
keyword[def] identifier[ReadConflicts] ( identifier[self] , identifier[collection_link] , identifier[feed_options] = keyword[None] ): literal[string] keyword[if] identifier[feed_options] keyword[is] keyword[None] : identifier[feed_options] ={} keyword[return] identifier[s...
def ReadConflicts(self, collection_link, feed_options=None): """Reads conflicts. :param str collection_link: The link to the document collection. :param dict feed_options: :return: Query Iterable of Conflicts. :rtype: query_iterable.QueryIterable...
def dispatch(self, receiver): ''' Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_added`` if it exists. ''' super(SessionCallbackAdded, self).dispatch(receiver) if hasattr(receiver, '_session_callback_added'): ...
def function[dispatch, parameter[self, receiver]]: constant[ Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_added`` if it exists. ] call[call[name[super], parameter[name[SessionCallbackAdded], name[self]]].dispatch, parameter...
keyword[def] identifier[dispatch] ( identifier[self] , identifier[receiver] ): literal[string] identifier[super] ( identifier[SessionCallbackAdded] , identifier[self] ). identifier[dispatch] ( identifier[receiver] ) keyword[if] identifier[hasattr] ( identifier[receiver] , literal[string] ...
def dispatch(self, receiver): """ Dispatch handling of this event to a receiver. This method will invoke ``receiver._session_callback_added`` if it exists. """ super(SessionCallbackAdded, self).dispatch(receiver) if hasattr(receiver, '_session_callback_added'): receiver._se...
def __write_filter_tmpl(html_tpl): ''' doing for directory. ''' out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'list') if os.path.exists(out_dir): pass else: os.mkdir(out_dir) # for var_name in VAR_NAMES: for var_name, bl_val in SWITCH_DICS.items(): if var_name.st...
def function[__write_filter_tmpl, parameter[html_tpl]]: constant[ doing for directory. ] variable[out_dir] assign[=] call[name[os].path.join, parameter[call[name[os].getcwd, parameter[]], name[CRUD_PATH], constant[list]]] if call[name[os].path.exists, parameter[name[out_dir]]] begin[:] ...
keyword[def] identifier[__write_filter_tmpl] ( identifier[html_tpl] ): literal[string] identifier[out_dir] = identifier[os] . identifier[path] . identifier[join] ( identifier[os] . identifier[getcwd] (), identifier[CRUD_PATH] , literal[string] ) keyword[if] identifier[os] . identifier[path] . identif...
def __write_filter_tmpl(html_tpl): """ doing for directory. """ out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'list') if os.path.exists(out_dir): pass # depends on [control=['if'], data=[]] else: os.mkdir(out_dir) # for var_name in VAR_NAMES: for (var_name, bl_val) in S...
def save_admin_log(build, **kwargs): """Saves an action to the admin log.""" message = kwargs.pop('message', None) release = kwargs.pop('release', None) run = kwargs.pop('run', None) if not len(kwargs) == 1: raise TypeError('Must specify a LOG_TYPE argument') log_enum = kwargs.keys()[0...
def function[save_admin_log, parameter[build]]: constant[Saves an action to the admin log.] variable[message] assign[=] call[name[kwargs].pop, parameter[constant[message], constant[None]]] variable[release] assign[=] call[name[kwargs].pop, parameter[constant[release], constant[None]]] va...
keyword[def] identifier[save_admin_log] ( identifier[build] ,** identifier[kwargs] ): literal[string] identifier[message] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[None] ) identifier[release] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[None] ) ident...
def save_admin_log(build, **kwargs): """Saves an action to the admin log.""" message = kwargs.pop('message', None) release = kwargs.pop('release', None) run = kwargs.pop('run', None) if not len(kwargs) == 1: raise TypeError('Must specify a LOG_TYPE argument') # depends on [control=['if'], d...
def get_user_stats_for_game(self, steamID, appID, format=None): """Request the user stats for a given game. steamID: The users ID appID: The app id format: Return format. None defaults to json. (json, xml, vdf) """ parameters = {'steamid' : steamID, 'appid' : appID} ...
def function[get_user_stats_for_game, parameter[self, steamID, appID, format]]: constant[Request the user stats for a given game. steamID: The users ID appID: The app id format: Return format. None defaults to json. (json, xml, vdf) ] variable[parameters] assign[=] dict...
keyword[def] identifier[get_user_stats_for_game] ( identifier[self] , identifier[steamID] , identifier[appID] , identifier[format] = keyword[None] ): literal[string] identifier[parameters] ={ literal[string] : identifier[steamID] , literal[string] : identifier[appID] } keyword[if] identif...
def get_user_stats_for_game(self, steamID, appID, format=None): """Request the user stats for a given game. steamID: The users ID appID: The app id format: Return format. None defaults to json. (json, xml, vdf) """ parameters = {'steamid': steamID, 'appid': appID} if format...
def format_timedelta(td_object): """Format a timedelta object for display to users Returns ------- str """ def get_total_seconds(td): # timedelta.total_seconds not in py2.6 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6 seconds = i...
def function[format_timedelta, parameter[td_object]]: constant[Format a timedelta object for display to users Returns ------- str ] def function[get_total_seconds, parameter[td]]: return[binary_operation[binary_operation[name[td].microseconds + binary_operation[binary_operation[...
keyword[def] identifier[format_timedelta] ( identifier[td_object] ): literal[string] keyword[def] identifier[get_total_seconds] ( identifier[td] ): keyword[return] ( identifier[td] . identifier[microseconds] + ( identifier[td] . identifier[seconds] + identifier[td] . identifier[days]...
def format_timedelta(td_object): """Format a timedelta object for display to users Returns ------- str """ def get_total_seconds(td): # timedelta.total_seconds not in py2.6 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1000000.0) / 1000000.0 seconds = int(g...
def check_cluster( cluster_config, data_path, java_home, check_replicas, batch_size, minutes, start_time, end_time, ): """Check the integrity of the Kafka log files in a cluster. start_time and end_time should be in the format specified by TIME_FORMAT_REGEX. :param data...
def function[check_cluster, parameter[cluster_config, data_path, java_home, check_replicas, batch_size, minutes, start_time, end_time]]: constant[Check the integrity of the Kafka log files in a cluster. start_time and end_time should be in the format specified by TIME_FORMAT_REGEX. :param data_pat...
keyword[def] identifier[check_cluster] ( identifier[cluster_config] , identifier[data_path] , identifier[java_home] , identifier[check_replicas] , identifier[batch_size] , identifier[minutes] , identifier[start_time] , identifier[end_time] , ): literal[string] identifier[brokers] = identifier[get_b...
def check_cluster(cluster_config, data_path, java_home, check_replicas, batch_size, minutes, start_time, end_time): """Check the integrity of the Kafka log files in a cluster. start_time and end_time should be in the format specified by TIME_FORMAT_REGEX. :param data_path: the path to the log folder o...
def _validate_ports_low_level(ports): """ Internal helper. Validates the 'ports' argument to EphemeralOnionService or EphemeralAuthenticatedOnionService returning None on success or raising ValueError otherwise. This only accepts the "list of strings" variants; some higher-level APIs also ...
def function[_validate_ports_low_level, parameter[ports]]: constant[ Internal helper. Validates the 'ports' argument to EphemeralOnionService or EphemeralAuthenticatedOnionService returning None on success or raising ValueError otherwise. This only accepts the "list of strings" variants; s...
keyword[def] identifier[_validate_ports_low_level] ( identifier[ports] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[ports] ,( identifier[list] , identifier[tuple] )): keyword[raise] identifier[ValueError] ( literal[string] ) keyword[if] identifier[any] (...
def _validate_ports_low_level(ports): """ Internal helper. Validates the 'ports' argument to EphemeralOnionService or EphemeralAuthenticatedOnionService returning None on success or raising ValueError otherwise. This only accepts the "list of strings" variants; some higher-level APIs also ...
def send(self, cmd, **kwargs): """ send: string param=binary data ... -> None When send is called with the proper arguments, an API command will be written to the serial port for this XBee device containing the proper instructions and data. This method must be called wi...
def function[send, parameter[self, cmd]]: constant[ send: string param=binary data ... -> None When send is called with the proper arguments, an API command will be written to the serial port for this XBee device containing the proper instructions and data. This method ...
keyword[def] identifier[send] ( identifier[self] , identifier[cmd] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[_write] ( identifier[self] . identifier[_build_command] ( identifier[cmd] ,** identifier[kwargs] ))
def send(self, cmd, **kwargs): """ send: string param=binary data ... -> None When send is called with the proper arguments, an API command will be written to the serial port for this XBee device containing the proper instructions and data. This method must be called with n...
def movielens100k(data_set='movielens100k'): """Data set of movie ratings collected by the University of Minnesota and 'cleaned up' for use.""" if not data_available(data_set): import zipfile download_data(data_set) dir_path = os.path.join(data_path, data_set) zip = zipfile.ZipFi...
def function[movielens100k, parameter[data_set]]: constant[Data set of movie ratings collected by the University of Minnesota and 'cleaned up' for use.] if <ast.UnaryOp object at 0x7da1b0fef2b0> begin[:] import module[zipfile] call[name[download_data], parameter[name[data_set]]] ...
keyword[def] identifier[movielens100k] ( identifier[data_set] = literal[string] ): literal[string] keyword[if] keyword[not] identifier[data_available] ( identifier[data_set] ): keyword[import] identifier[zipfile] identifier[download_data] ( identifier[data_set] ) identifier[d...
def movielens100k(data_set='movielens100k'): """Data set of movie ratings collected by the University of Minnesota and 'cleaned up' for use.""" if not data_available(data_set): import zipfile download_data(data_set) dir_path = os.path.join(data_path, data_set) zip = zipfile.ZipFi...