code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def get_primitive_name(schema): """ Get a human-friendly name for the given primitive. :param schema: Schema :type schema: * :rtype: unicode """ try: return { const.COMPILED_TYPE.LITERAL: six.text_type, const.COMPILED_TYPE.TYPE: get_type_name, const.C...
def function[get_primitive_name, parameter[schema]]: constant[ Get a human-friendly name for the given primitive. :param schema: Schema :type schema: * :rtype: unicode ] <ast.Try object at 0x7da1b26c9c00>
keyword[def] identifier[get_primitive_name] ( identifier[schema] ): literal[string] keyword[try] : keyword[return] { identifier[const] . identifier[COMPILED_TYPE] . identifier[LITERAL] : identifier[six] . identifier[text_type] , identifier[const] . identifier[COMPILED_TYPE] . ide...
def get_primitive_name(schema): """ Get a human-friendly name for the given primitive. :param schema: Schema :type schema: * :rtype: unicode """ try: return {const.COMPILED_TYPE.LITERAL: six.text_type, const.COMPILED_TYPE.TYPE: get_type_name, const.COMPILED_TYPE.ENUM: get_type_name, con...
def format_frame_info(frame): """ Formats the given stack frame to show its position in the code and part of its context :param frame: A stack frame """ # Same as in traceback.extract_stack line_no = frame.f_lineno code = frame.f_code filename = code.co_filename method_name = co...
def function[format_frame_info, parameter[frame]]: constant[ Formats the given stack frame to show its position in the code and part of its context :param frame: A stack frame ] variable[line_no] assign[=] name[frame].f_lineno variable[code] assign[=] name[frame].f_code ...
keyword[def] identifier[format_frame_info] ( identifier[frame] ): literal[string] identifier[line_no] = identifier[frame] . identifier[f_lineno] identifier[code] = identifier[frame] . identifier[f_code] identifier[filename] = identifier[code] . identifier[co_filename] identifier[meth...
def format_frame_info(frame): """ Formats the given stack frame to show its position in the code and part of its context :param frame: A stack frame """ # Same as in traceback.extract_stack line_no = frame.f_lineno code = frame.f_code filename = code.co_filename method_name = co...
def execute(self, sql, *args, **kwargs): """Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: number of affec...
def function[execute, parameter[self, sql]]: constant[Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: numbe...
keyword[def] identifier[execute] ( identifier[self] , identifier[sql] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[ensure_connected] () keyword[return] identifier[Statement] ( identifier[self] ). identifier[execute] ( identifier[sql] ,* ident...
def execute(self, sql, *args, **kwargs): """Executes an SQL INSERT/UPDATE/DELETE query with the given parameters and returns the number of affected rows. :param sql: statement to execute :param args: parameters iterable :param kwargs: parameters iterable :return: number of affected ...
def isSameTypeWith(self, other, matchTags=True, matchConstraints=True): """Examine |ASN.1| type for equality with other ASN.1 type. ASN.1 tags (:py:mod:`~pyasn1.type.tag`) and constraints (:py:mod:`~pyasn1.type.constraint`) are examined when carrying out ASN.1 types comparison. ...
def function[isSameTypeWith, parameter[self, other, matchTags, matchConstraints]]: constant[Examine |ASN.1| type for equality with other ASN.1 type. ASN.1 tags (:py:mod:`~pyasn1.type.tag`) and constraints (:py:mod:`~pyasn1.type.constraint`) are examined when carrying out ASN.1 types com...
keyword[def] identifier[isSameTypeWith] ( identifier[self] , identifier[other] , identifier[matchTags] = keyword[True] , identifier[matchConstraints] = keyword[True] ): literal[string] keyword[return] ( identifier[self] keyword[is] identifier[other] keyword[or] ( keyword[not] identifie...
def isSameTypeWith(self, other, matchTags=True, matchConstraints=True): """Examine |ASN.1| type for equality with other ASN.1 type. ASN.1 tags (:py:mod:`~pyasn1.type.tag`) and constraints (:py:mod:`~pyasn1.type.constraint`) are examined when carrying out ASN.1 types comparison. Pyt...
def iter(self, match="*", count=1000): """ Iterates the set of keys in :prop:key_prefix in :prop:_client @match: #str pattern to match after the :prop:key_prefix @count: the user specified the amount of work that should be done at every call in order to retrieve elements ...
def function[iter, parameter[self, match, count]]: constant[ Iterates the set of keys in :prop:key_prefix in :prop:_client @match: #str pattern to match after the :prop:key_prefix @count: the user specified the amount of work that should be done at every call in order to ...
keyword[def] identifier[iter] ( identifier[self] , identifier[match] = literal[string] , identifier[count] = literal[int] ): literal[string] identifier[replace_this] = identifier[self] . identifier[key_prefix] + literal[string] keyword[for] identifier[key] keyword[in] identifier[self] ...
def iter(self, match='*', count=1000): """ Iterates the set of keys in :prop:key_prefix in :prop:_client @match: #str pattern to match after the :prop:key_prefix @count: the user specified the amount of work that should be done at every call in order to retrieve elements from...
def ones(shape, ctx=None, dtype=None, **kwargs): """Returns a new array filled with all ones, with the given shape and type. Parameters ---------- shape : int or tuple of int or list of int The shape of the empty array. ctx : Context, optional An optional device context. Def...
def function[ones, parameter[shape, ctx, dtype]]: constant[Returns a new array filled with all ones, with the given shape and type. Parameters ---------- shape : int or tuple of int or list of int The shape of the empty array. ctx : Context, optional An optional device context. ...
keyword[def] identifier[ones] ( identifier[shape] , identifier[ctx] = keyword[None] , identifier[dtype] = keyword[None] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[ctx] keyword[is] keyword[None] : identifier[ctx] = identifier[current_context] () identifier[dtype] ...
def ones(shape, ctx=None, dtype=None, **kwargs): """Returns a new array filled with all ones, with the given shape and type. Parameters ---------- shape : int or tuple of int or list of int The shape of the empty array. ctx : Context, optional An optional device context. Def...
def edit_preferences(self, resource): """Edit preferences in /usr/cdrouter-data/etc/config.yml. :param resource: :class:`system.Preferences <system.Preferences>` object :return: :class:`system.Preferences <system.Preferences>` object :rtype: system.Preferences """ schema...
def function[edit_preferences, parameter[self, resource]]: constant[Edit preferences in /usr/cdrouter-data/etc/config.yml. :param resource: :class:`system.Preferences <system.Preferences>` object :return: :class:`system.Preferences <system.Preferences>` object :rtype: system.Preferences...
keyword[def] identifier[edit_preferences] ( identifier[self] , identifier[resource] ): literal[string] identifier[schema] = identifier[PreferencesSchema] () identifier[json] = identifier[self] . identifier[service] . identifier[encode] ( identifier[schema] , identifier[resource] ) ...
def edit_preferences(self, resource): """Edit preferences in /usr/cdrouter-data/etc/config.yml. :param resource: :class:`system.Preferences <system.Preferences>` object :return: :class:`system.Preferences <system.Preferences>` object :rtype: system.Preferences """ schema = Prefe...
def get_repo(self, auth, username, repo_name): """ Returns a the repository with name ``repo_name`` owned by the user with username ``username``. :param auth.Authentication auth: authentication object :param str username: username of owner of repository :param str repo_n...
def function[get_repo, parameter[self, auth, username, repo_name]]: constant[ Returns a the repository with name ``repo_name`` owned by the user with username ``username``. :param auth.Authentication auth: authentication object :param str username: username of owner of repositor...
keyword[def] identifier[get_repo] ( identifier[self] , identifier[auth] , identifier[username] , identifier[repo_name] ): literal[string] identifier[path] = literal[string] . identifier[format] ( identifier[u] = identifier[username] , identifier[r] = identifier[repo_name] ) identifier[resp...
def get_repo(self, auth, username, repo_name): """ Returns a the repository with name ``repo_name`` owned by the user with username ``username``. :param auth.Authentication auth: authentication object :param str username: username of owner of repository :param str repo_name:...
def list_tasks(collector): """List the available_tasks""" print("Usage: dashmat <task>") print("") print("Available tasks to choose from are:") print("-----------------------------------") print("") keygetter = lambda item: item[1].label tasks = sorted(available_actions.items(), key=keyg...
def function[list_tasks, parameter[collector]]: constant[List the available_tasks] call[name[print], parameter[constant[Usage: dashmat <task>]]] call[name[print], parameter[constant[]]] call[name[print], parameter[constant[Available tasks to choose from are:]]] call[name[print], ...
keyword[def] identifier[list_tasks] ( identifier[collector] ): literal[string] identifier[print] ( literal[string] ) identifier[print] ( literal[string] ) identifier[print] ( literal[string] ) identifier[print] ( literal[string] ) identifier[print] ( literal[string] ) identifier[ke...
def list_tasks(collector): """List the available_tasks""" print('Usage: dashmat <task>') print('') print('Available tasks to choose from are:') print('-----------------------------------') print('') keygetter = lambda item: item[1].label tasks = sorted(available_actions.items(), key=keyg...
def remove(self, path, recursive=True): """ Remove a file or directory from S3. :param path: File or directory to remove :param recursive: Boolean indicator to remove object and children :return: Boolean indicator denoting success of the removal of 1 or more files """ ...
def function[remove, parameter[self, path, recursive]]: constant[ Remove a file or directory from S3. :param path: File or directory to remove :param recursive: Boolean indicator to remove object and children :return: Boolean indicator denoting success of the removal of 1 or more...
keyword[def] identifier[remove] ( identifier[self] , identifier[path] , identifier[recursive] = keyword[True] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[exists] ( identifier[path] ): identifier[logger] . identifier[debug] ( literal[string] , identifier[...
def remove(self, path, recursive=True): """ Remove a file or directory from S3. :param path: File or directory to remove :param recursive: Boolean indicator to remove object and children :return: Boolean indicator denoting success of the removal of 1 or more files """ if ...
def generate_bug_changes(self, startday, endday, alt_startday, alt_endday): """Returns a list of dicts containing a bug id, a bug comment (only for bugs whose total number of daily or weekly occurrences meet the appropriate threshold) and potentially an updated whiteboard or pri...
def function[generate_bug_changes, parameter[self, startday, endday, alt_startday, alt_endday]]: constant[Returns a list of dicts containing a bug id, a bug comment (only for bugs whose total number of daily or weekly occurrences meet the appropriate threshold) and potentially an updated w...
keyword[def] identifier[generate_bug_changes] ( identifier[self] , identifier[startday] , identifier[endday] , identifier[alt_startday] , identifier[alt_endday] ): literal[string] identifier[bug_stats] , identifier[bug_ids] = identifier[self] . identifier[get_bug_stats] ( identifier[startday] , id...
def generate_bug_changes(self, startday, endday, alt_startday, alt_endday): """Returns a list of dicts containing a bug id, a bug comment (only for bugs whose total number of daily or weekly occurrences meet the appropriate threshold) and potentially an updated whiteboard or priorit...
def get_repos(config, force=False): """Return a :py:obj:`list` list of repos from config file. :param config: the repos config in :py:class:`dict` format. :param bool force: Force aggregate dirty repos or not. :type config: dict :rtype: list """ repo_list = [] for directory, repo_data in...
def function[get_repos, parameter[config, force]]: constant[Return a :py:obj:`list` list of repos from config file. :param config: the repos config in :py:class:`dict` format. :param bool force: Force aggregate dirty repos or not. :type config: dict :rtype: list ] variable[repo_list]...
keyword[def] identifier[get_repos] ( identifier[config] , identifier[force] = keyword[False] ): literal[string] identifier[repo_list] =[] keyword[for] identifier[directory] , identifier[repo_data] keyword[in] identifier[config] . identifier[items] (): keyword[if] keyword[not] identifier[...
def get_repos(config, force=False): """Return a :py:obj:`list` list of repos from config file. :param config: the repos config in :py:class:`dict` format. :param bool force: Force aggregate dirty repos or not. :type config: dict :rtype: list """ repo_list = [] for (directory, repo_data) ...
def ReleaseProcessedFlow(self, flow_obj, cursor=None): """Releases a flow that the worker was processing to the database.""" update_query = """ UPDATE flows LEFT OUTER JOIN ( SELECT client_id, flow_id, needs_processing FROM flow_requests WHERE client_id = %(client_id)s AND ...
def function[ReleaseProcessedFlow, parameter[self, flow_obj, cursor]]: constant[Releases a flow that the worker was processing to the database.] variable[update_query] assign[=] constant[ UPDATE flows LEFT OUTER JOIN ( SELECT client_id, flow_id, needs_processing FROM flow_requests ...
keyword[def] identifier[ReleaseProcessedFlow] ( identifier[self] , identifier[flow_obj] , identifier[cursor] = keyword[None] ): literal[string] identifier[update_query] = literal[string] identifier[clone] = identifier[flow_obj] . identifier[Copy] () identifier[clone] . identifier[processing_on...
def ReleaseProcessedFlow(self, flow_obj, cursor=None): """Releases a flow that the worker was processing to the database.""" update_query = '\n UPDATE flows\n LEFT OUTER JOIN (\n SELECT client_id, flow_id, needs_processing\n FROM flow_requests\n WHERE\n client_id = %(client_id)s AND\...
def _make_handler(state_token, done_function): ''' Makes a a handler class to use inside the basic python HTTP server. state_token is the expected state token. done_function is a function that is called, with the code passed to it. ''' class LocalServerHandler(BaseHTTPServer.BaseHTTPRequestHan...
def function[_make_handler, parameter[state_token, done_function]]: constant[ Makes a a handler class to use inside the basic python HTTP server. state_token is the expected state token. done_function is a function that is called, with the code passed to it. ] class class[LocalServerHan...
keyword[def] identifier[_make_handler] ( identifier[state_token] , identifier[done_function] ): literal[string] keyword[class] identifier[LocalServerHandler] ( identifier[BaseHTTPServer] . identifier[BaseHTTPRequestHandler] ): keyword[def] identifier[error_response] ( identifier[self] , identi...
def _make_handler(state_token, done_function): """ Makes a a handler class to use inside the basic python HTTP server. state_token is the expected state token. done_function is a function that is called, with the code passed to it. """ class LocalServerHandler(BaseHTTPServer.BaseHTTPRequestHan...
def feed(self, new_bytes): """Feed a new set of bytes into the protocol handler These bytes will be immediately fed into the parsing state machine and if new packets are found, the ``packet_callback`` will be executed with the fully-formed message. :param new_bytes: The new byt...
def function[feed, parameter[self, new_bytes]]: constant[Feed a new set of bytes into the protocol handler These bytes will be immediately fed into the parsing state machine and if new packets are found, the ``packet_callback`` will be executed with the fully-formed message. :p...
keyword[def] identifier[feed] ( identifier[self] , identifier[new_bytes] ): literal[string] identifier[self] . identifier[_available_bytes] += identifier[new_bytes] identifier[callbacks] =[] keyword[try] : keyword[while] keyword[True] : identifier[p...
def feed(self, new_bytes): """Feed a new set of bytes into the protocol handler These bytes will be immediately fed into the parsing state machine and if new packets are found, the ``packet_callback`` will be executed with the fully-formed message. :param new_bytes: The new bytes t...
def estimate_tuning(input_file): '''Load an audio file and estimate tuning (in cents)''' print('Loading ', input_file) y, sr = librosa.load(input_file) print('Separating harmonic component ... ') y_harm = librosa.effects.harmonic(y) print('Estimating tuning ... ') # Just track the pitches...
def function[estimate_tuning, parameter[input_file]]: constant[Load an audio file and estimate tuning (in cents)] call[name[print], parameter[constant[Loading ], name[input_file]]] <ast.Tuple object at 0x7da20c991420> assign[=] call[name[librosa].load, parameter[name[input_file]]] call[n...
keyword[def] identifier[estimate_tuning] ( identifier[input_file] ): literal[string] identifier[print] ( literal[string] , identifier[input_file] ) identifier[y] , identifier[sr] = identifier[librosa] . identifier[load] ( identifier[input_file] ) identifier[print] ( literal[string] ) ident...
def estimate_tuning(input_file): """Load an audio file and estimate tuning (in cents)""" print('Loading ', input_file) (y, sr) = librosa.load(input_file) print('Separating harmonic component ... ') y_harm = librosa.effects.harmonic(y) print('Estimating tuning ... ') # Just track the pitches ...
def subtree_leaf_positions(subtree): """Return tree positions of all leaves of a subtree.""" relative_leaf_positions = subtree.treepositions('leaves') subtree_root_pos = subtree.treeposition() absolute_leaf_positions = [] for rel_leaf_pos in relative_leaf_positions: absolute_leaf_positions.a...
def function[subtree_leaf_positions, parameter[subtree]]: constant[Return tree positions of all leaves of a subtree.] variable[relative_leaf_positions] assign[=] call[name[subtree].treepositions, parameter[constant[leaves]]] variable[subtree_root_pos] assign[=] call[name[subtree].treeposition, p...
keyword[def] identifier[subtree_leaf_positions] ( identifier[subtree] ): literal[string] identifier[relative_leaf_positions] = identifier[subtree] . identifier[treepositions] ( literal[string] ) identifier[subtree_root_pos] = identifier[subtree] . identifier[treeposition] () identifier[absolute_l...
def subtree_leaf_positions(subtree): """Return tree positions of all leaves of a subtree.""" relative_leaf_positions = subtree.treepositions('leaves') subtree_root_pos = subtree.treeposition() absolute_leaf_positions = [] for rel_leaf_pos in relative_leaf_positions: absolute_leaf_positions.a...
def reset_secret(self): """ Resets the client secret for this client. """ result = self._client.post("{}/reset_secret".format(OAuthClient.api_endpoint), model=self) if not 'id' in result: raise UnexpectedResponseError('Unexpected response when resetting secret!', jso...
def function[reset_secret, parameter[self]]: constant[ Resets the client secret for this client. ] variable[result] assign[=] call[name[self]._client.post, parameter[call[constant[{}/reset_secret].format, parameter[name[OAuthClient].api_endpoint]]]] if <ast.UnaryOp object at 0x7d...
keyword[def] identifier[reset_secret] ( identifier[self] ): literal[string] identifier[result] = identifier[self] . identifier[_client] . identifier[post] ( literal[string] . identifier[format] ( identifier[OAuthClient] . identifier[api_endpoint] ), identifier[model] = identifier[self] ) ...
def reset_secret(self): """ Resets the client secret for this client. """ result = self._client.post('{}/reset_secret'.format(OAuthClient.api_endpoint), model=self) if not 'id' in result: raise UnexpectedResponseError('Unexpected response when resetting secret!', json=result) # depe...
def setup_pixelmap(hashcode): """Creates and combines all required layers to build a pixelmap for creating the virtual pixels.""" # Color distribution. # colors = hashgrinder.grindIpForColors(ip) colors = hashgrinder.grind_hash_for_colors(hashcode) color_body = colors[0] color_subfield ...
def function[setup_pixelmap, parameter[hashcode]]: constant[Creates and combines all required layers to build a pixelmap for creating the virtual pixels.] variable[colors] assign[=] call[name[hashgrinder].grind_hash_for_colors, parameter[name[hashcode]]] variable[color_body] assign[=] ca...
keyword[def] identifier[setup_pixelmap] ( identifier[hashcode] ): literal[string] identifier[colors] = identifier[hashgrinder] . identifier[grind_hash_for_colors] ( identifier[hashcode] ) identifier[color_body] = identifier[colors] [ literal[int] ] identifier[color_subfield] = identifi...
def setup_pixelmap(hashcode): """Creates and combines all required layers to build a pixelmap for creating the virtual pixels.""" # Color distribution. # colors = hashgrinder.grindIpForColors(ip) colors = hashgrinder.grind_hash_for_colors(hashcode) color_body = colors[0] color_subfield =...
def bbknn(adata, batch_key='batch', save_knn=False, copy=False, **kwargs): """\ Batch balanced kNN [Park18]_. Batch balanced kNN alters the kNN procedure to identify each cell's top neighbours in each batch separately instead of the entire cell pool with no accounting for batch. Aligns batches in a...
def function[bbknn, parameter[adata, batch_key, save_knn, copy]]: constant[ Batch balanced kNN [Park18]_. Batch balanced kNN alters the kNN procedure to identify each cell's top neighbours in each batch separately instead of the entire cell pool with no accounting for batch. Aligns batches in a ...
keyword[def] identifier[bbknn] ( identifier[adata] , identifier[batch_key] = literal[string] , identifier[save_knn] = keyword[False] , identifier[copy] = keyword[False] ,** identifier[kwargs] ): literal[string] identifier[params] = identifier[locals] () identifier[kwargs] = identifier[params] . identi...
def bbknn(adata, batch_key='batch', save_knn=False, copy=False, **kwargs): """ Batch balanced kNN [Park18]_. Batch balanced kNN alters the kNN procedure to identify each cell's top neighbours in each batch separately instead of the entire cell pool with no accounting for batch. Aligns batches in a ...
def plt_goea_results(fout_img, goea_results, **kws): """Plot a single page.""" go_sources = [rec.GO for rec in goea_results] go2obj = {rec.GO:rec.goterm for rec in goea_results} gosubdag = GoSubDag(go_sources, go2obj, rcntobj=True) godagplot = GoSubDagPlot(gosubdag, goea_results=goea_results, **kws)...
def function[plt_goea_results, parameter[fout_img, goea_results]]: constant[Plot a single page.] variable[go_sources] assign[=] <ast.ListComp object at 0x7da20e955420> variable[go2obj] assign[=] <ast.DictComp object at 0x7da1b26af370> variable[gosubdag] assign[=] call[name[GoSubDag], par...
keyword[def] identifier[plt_goea_results] ( identifier[fout_img] , identifier[goea_results] ,** identifier[kws] ): literal[string] identifier[go_sources] =[ identifier[rec] . identifier[GO] keyword[for] identifier[rec] keyword[in] identifier[goea_results] ] identifier[go2obj] ={ identifier[rec] . ...
def plt_goea_results(fout_img, goea_results, **kws): """Plot a single page.""" go_sources = [rec.GO for rec in goea_results] go2obj = {rec.GO: rec.goterm for rec in goea_results} gosubdag = GoSubDag(go_sources, go2obj, rcntobj=True) godagplot = GoSubDagPlot(gosubdag, goea_results=goea_results, **kws...
def reload_module(self, module_path=None): """ Reloads a module into the framework. If module_path is not specified, then the current_module variable is used. Returns True on success, False on error. @type module_path: String @param module_path: The name of the module to reload """ if module_path is ...
def function[reload_module, parameter[self, module_path]]: constant[ Reloads a module into the framework. If module_path is not specified, then the current_module variable is used. Returns True on success, False on error. @type module_path: String @param module_path: The name of the module to reloa...
keyword[def] identifier[reload_module] ( identifier[self] , identifier[module_path] = keyword[None] ): literal[string] keyword[if] identifier[module_path] keyword[is] keyword[None] : keyword[if] identifier[self] . identifier[current_module] keyword[is] keyword[not] keyword[None] : identifier[mo...
def reload_module(self, module_path=None): """ Reloads a module into the framework. If module_path is not specified, then the current_module variable is used. Returns True on success, False on error. @type module_path: String @param module_path: The name of the module to reload """ if module_path...
def emd_eq(self, other): """Return whether this concept is equal to another in the context of an EMD calculation. """ return (self.phi == other.phi and self.mechanism == other.mechanism and self.eq_repertoires(other))
def function[emd_eq, parameter[self, other]]: constant[Return whether this concept is equal to another in the context of an EMD calculation. ] return[<ast.BoolOp object at 0x7da18ede4f40>]
keyword[def] identifier[emd_eq] ( identifier[self] , identifier[other] ): literal[string] keyword[return] ( identifier[self] . identifier[phi] == identifier[other] . identifier[phi] keyword[and] identifier[self] . identifier[mechanism] == identifier[other] . identifier[mechanism] keywor...
def emd_eq(self, other): """Return whether this concept is equal to another in the context of an EMD calculation. """ return self.phi == other.phi and self.mechanism == other.mechanism and self.eq_repertoires(other)
def json_loads(cls, s, **kwargs): """ A rewrap of json.loads done for one reason - to inject a custom `cls` kwarg :param s: :param kwargs: :return: :rtype: dict """ if 'cls' not in kwargs: kwargs['cls'] = cls.json_decoder return json.l...
def function[json_loads, parameter[cls, s]]: constant[ A rewrap of json.loads done for one reason - to inject a custom `cls` kwarg :param s: :param kwargs: :return: :rtype: dict ] if compare[constant[cls] <ast.NotIn object at 0x7da2590d7190> name[kwargs]]...
keyword[def] identifier[json_loads] ( identifier[cls] , identifier[s] ,** identifier[kwargs] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[kwargs] : identifier[kwargs] [ literal[string] ]= identifier[cls] . identifier[json_decoder] key...
def json_loads(cls, s, **kwargs): """ A rewrap of json.loads done for one reason - to inject a custom `cls` kwarg :param s: :param kwargs: :return: :rtype: dict """ if 'cls' not in kwargs: kwargs['cls'] = cls.json_decoder # depends on [control=['if'], da...
def _create_filter(self, server_id, source_namespace, query, query_language, owned, filter_id, name): """ Create a :term:`dynamic indication filter` instance in the Interop namespace of a WBEM server and return that instance. In order to catch any changes the serv...
def function[_create_filter, parameter[self, server_id, source_namespace, query, query_language, owned, filter_id, name]]: constant[ Create a :term:`dynamic indication filter` instance in the Interop namespace of a WBEM server and return that instance. In order to catch any changes the ...
keyword[def] identifier[_create_filter] ( identifier[self] , identifier[server_id] , identifier[source_namespace] , identifier[query] , identifier[query_language] , identifier[owned] , identifier[filter_id] , identifier[name] ): literal[string] identifier[server] = identifier[self] . ide...
def _create_filter(self, server_id, source_namespace, query, query_language, owned, filter_id, name): """ Create a :term:`dynamic indication filter` instance in the Interop namespace of a WBEM server and return that instance. In order to catch any changes the server applies, the instance is...
def methods(self) -> 'PrettyDir': """Returns all methods of the inspected object. Note that "methods" can mean "functions" when inspecting a module. """ return PrettyDir( self.obj, [ pattr for pattr in self.pattrs i...
def function[methods, parameter[self]]: constant[Returns all methods of the inspected object. Note that "methods" can mean "functions" when inspecting a module. ] return[call[name[PrettyDir], parameter[name[self].obj, <ast.ListComp object at 0x7da2054a77c0>]]]
keyword[def] identifier[methods] ( identifier[self] )-> literal[string] : literal[string] keyword[return] identifier[PrettyDir] ( identifier[self] . identifier[obj] , [ identifier[pattr] keyword[for] identifier[pattr] keyword[in] identifier[self] . identifier...
def methods(self) -> 'PrettyDir': """Returns all methods of the inspected object. Note that "methods" can mean "functions" when inspecting a module. """ return PrettyDir(self.obj, [pattr for pattr in self.pattrs if category_match(pattr.category, AttrCategory.FUNCTION)])
def result(self, timeout=None): """Gets the result of the task. Arguments: timeout: Maximum seconds to wait for a result before raising a TimeoutError. If set to None, this will wait forever. If the queue doesn't store results and timeout is None, this call w...
def function[result, parameter[self, timeout]]: constant[Gets the result of the task. Arguments: timeout: Maximum seconds to wait for a result before raising a TimeoutError. If set to None, this will wait forever. If the queue doesn't store results and timeou...
keyword[def] identifier[result] ( identifier[self] , identifier[timeout] = keyword[None] ): literal[string] identifier[start] = identifier[time] . identifier[time] () keyword[while] keyword[True] : identifier[task] = identifier[self] . identifier[get_task] () key...
def result(self, timeout=None): """Gets the result of the task. Arguments: timeout: Maximum seconds to wait for a result before raising a TimeoutError. If set to None, this will wait forever. If the queue doesn't store results and timeout is None, this call will ...
def open_for_group_write(fp, mode, encoding='utf-8'): """Open with mode=mode and permissions '-rw-rw-r--' group writable is the default on some systems/accounts, but it is important that it be present on our deployment machine """ d = os.path.split(fp)[0] if not os.path.exists(d): os.makedir...
def function[open_for_group_write, parameter[fp, mode, encoding]]: constant[Open with mode=mode and permissions '-rw-rw-r--' group writable is the default on some systems/accounts, but it is important that it be present on our deployment machine ] variable[d] assign[=] call[call[name[os].path.sp...
keyword[def] identifier[open_for_group_write] ( identifier[fp] , identifier[mode] , identifier[encoding] = literal[string] ): literal[string] identifier[d] = identifier[os] . identifier[path] . identifier[split] ( identifier[fp] )[ literal[int] ] keyword[if] keyword[not] identifier[os] . identifier[...
def open_for_group_write(fp, mode, encoding='utf-8'): """Open with mode=mode and permissions '-rw-rw-r--' group writable is the default on some systems/accounts, but it is important that it be present on our deployment machine """ d = os.path.split(fp)[0] if not os.path.exists(d): os.makedir...
def _loop_topo(self, topologyType, topologicalEntity=None, topologyTypeToAvoid=None): ''' this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face) ''' topoTypes = {TopAbs_VERTEX: Top...
def function[_loop_topo, parameter[self, topologyType, topologicalEntity, topologyTypeToAvoid]]: constant[ this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face) ] variable[topoTypes] ass...
keyword[def] identifier[_loop_topo] ( identifier[self] , identifier[topologyType] , identifier[topologicalEntity] = keyword[None] , identifier[topologyTypeToAvoid] = keyword[None] ): literal[string] identifier[topoTypes] ={ identifier[TopAbs_VERTEX] : identifier[TopoDS_Vertex] , identif...
def _loop_topo(self, topologyType, topologicalEntity=None, topologyTypeToAvoid=None): """ this could be a faces generator for a python TopoShape class that way you can just do: for face in srf.faces: processFace(face) """ topoTypes = {TopAbs_VERTEX: TopoDS_Vertex, Top...
def __collect_interfaces_return(interfaces): """Collect new style (44.1+) return values to old-style kv-list""" acc = [] for (interfaceName, interfaceData) in interfaces.items(): signalValues = interfaceData.get("signals", {}) for (signalName, signalValue) in signalValues...
def function[__collect_interfaces_return, parameter[interfaces]]: constant[Collect new style (44.1+) return values to old-style kv-list] variable[acc] assign[=] list[[]] for taget[tuple[[<ast.Name object at 0x7da1b100f910>, <ast.Name object at 0x7da1b100f0d0>]]] in starred[call[name[interfaces]....
keyword[def] identifier[__collect_interfaces_return] ( identifier[interfaces] ): literal[string] identifier[acc] =[] keyword[for] ( identifier[interfaceName] , identifier[interfaceData] ) keyword[in] identifier[interfaces] . identifier[items] (): identifier[signalValues] = id...
def __collect_interfaces_return(interfaces): """Collect new style (44.1+) return values to old-style kv-list""" acc = [] for (interfaceName, interfaceData) in interfaces.items(): signalValues = interfaceData.get('signals', {}) for (signalName, signalValue) in signalValues.items(): ...
def hacking_assert_is_none(logical_line, noqa): """Use assertIs(Not)None to check for None in assertions. Okay: self.assertEqual('foo', 'bar') Okay: self.assertNotEqual('foo', {}.get('bar', None)) Okay: self.assertIs('foo', 'bar') Okay: self.assertIsNot('foo', 'bar', None) Okay: foo(self.assert...
def function[hacking_assert_is_none, parameter[logical_line, noqa]]: constant[Use assertIs(Not)None to check for None in assertions. Okay: self.assertEqual('foo', 'bar') Okay: self.assertNotEqual('foo', {}.get('bar', None)) Okay: self.assertIs('foo', 'bar') Okay: self.assertIsNot('foo', 'bar', ...
keyword[def] identifier[hacking_assert_is_none] ( identifier[logical_line] , identifier[noqa] ): literal[string] keyword[if] identifier[noqa] : keyword[return] keyword[for] identifier[func_name] keyword[in] ( literal[string] , literal[string] , literal[string] , literal[string] ): ...
def hacking_assert_is_none(logical_line, noqa): """Use assertIs(Not)None to check for None in assertions. Okay: self.assertEqual('foo', 'bar') Okay: self.assertNotEqual('foo', {}.get('bar', None)) Okay: self.assertIs('foo', 'bar') Okay: self.assertIsNot('foo', 'bar', None) Okay: foo(self.assert...
def make_exporter_resources(nb_name, out_folder, images_folder=None): """ Creates resources dict for the exporter """ resources = defaultdict(str) resources['metadata'] = defaultdict(str) resources['metadata']['name'] = nb_name resources['metadata']['path'] = out_folder # This results i...
def function[make_exporter_resources, parameter[nb_name, out_folder, images_folder]]: constant[ Creates resources dict for the exporter ] variable[resources] assign[=] call[name[defaultdict], parameter[name[str]]] call[name[resources]][constant[metadata]] assign[=] call[name[defaultdict]...
keyword[def] identifier[make_exporter_resources] ( identifier[nb_name] , identifier[out_folder] , identifier[images_folder] = keyword[None] ): literal[string] identifier[resources] = identifier[defaultdict] ( identifier[str] ) identifier[resources] [ literal[string] ]= identifier[defaultdict] ( identi...
def make_exporter_resources(nb_name, out_folder, images_folder=None): """ Creates resources dict for the exporter """ resources = defaultdict(str) resources['metadata'] = defaultdict(str) resources['metadata']['name'] = nb_name resources['metadata']['path'] = out_folder # This results in...
def _make_sections(self, **section_hdr_params): """Flatten the sections into a single story list.""" sect_story = [] if not self.section_headings and len(self.sections): self.section_headings = self.sections.keys() for section_name in self.section_headings: secti...
def function[_make_sections, parameter[self]]: constant[Flatten the sections into a single story list.] variable[sect_story] assign[=] list[[]] if <ast.BoolOp object at 0x7da18bcca8f0> begin[:] name[self].section_headings assign[=] call[name[self].sections.keys, parameter[]] ...
keyword[def] identifier[_make_sections] ( identifier[self] ,** identifier[section_hdr_params] ): literal[string] identifier[sect_story] =[] keyword[if] keyword[not] identifier[self] . identifier[section_headings] keyword[and] identifier[len] ( identifier[self] . identifier[sections] ):...
def _make_sections(self, **section_hdr_params): """Flatten the sections into a single story list.""" sect_story = [] if not self.section_headings and len(self.sections): self.section_headings = self.sections.keys() # depends on [control=['if'], data=[]] for section_name in self.section_headings...
def colfieldnames(self, columnname, keyword=''): """Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields ...
def function[colfieldnames, parameter[self, columnname, keyword]]: constant[Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in ...
keyword[def] identifier[colfieldnames] ( identifier[self] , identifier[columnname] , identifier[keyword] = literal[string] ): literal[string] keyword[if] identifier[isinstance] ( identifier[keyword] , identifier[str] ): keyword[return] identifier[self] . identifier[_getfieldnames] ( ...
def colfieldnames(self, columnname, keyword=''): """Get the names of the fields in a column keyword value. The value of a keyword can be a struct (python dict). This method returns the names of the fields in that struct. Each field in a struct can be a struct in itself. Names of fields in a...
def _additional_rows_date2int(self, keys, rows): """ Replaces start and end dates of the additional date intervals in the row set with their integer representation :param list[tuple[str,str]] keys: The other keys with start and end date. :param list[dict[str,T]] rows: The list of rows. ...
def function[_additional_rows_date2int, parameter[self, keys, rows]]: constant[ Replaces start and end dates of the additional date intervals in the row set with their integer representation :param list[tuple[str,str]] keys: The other keys with start and end date. :param list[dict[str,T...
keyword[def] identifier[_additional_rows_date2int] ( identifier[self] , identifier[keys] , identifier[rows] ): literal[string] keyword[for] identifier[row] keyword[in] identifier[rows] : keyword[for] identifier[key_start_date] , identifier[key_end_date] keyword[in] identifier[key...
def _additional_rows_date2int(self, keys, rows): """ Replaces start and end dates of the additional date intervals in the row set with their integer representation :param list[tuple[str,str]] keys: The other keys with start and end date. :param list[dict[str,T]] rows: The list of rows. ...
def save(self, mark): """Save a position in this collection. :param mark: The position to save :type mark: Mark :raises: DBError, NoTrackingCollection """ self._check_exists() obj = mark.as_dict() try: # Make a 'filter' to find/update existing...
def function[save, parameter[self, mark]]: constant[Save a position in this collection. :param mark: The position to save :type mark: Mark :raises: DBError, NoTrackingCollection ] call[name[self]._check_exists, parameter[]] variable[obj] assign[=] call[name[mark]...
keyword[def] identifier[save] ( identifier[self] , identifier[mark] ): literal[string] identifier[self] . identifier[_check_exists] () identifier[obj] = identifier[mark] . identifier[as_dict] () keyword[try] : identifier[filt] ={ identifier[k] : iden...
def save(self, mark): """Save a position in this collection. :param mark: The position to save :type mark: Mark :raises: DBError, NoTrackingCollection """ self._check_exists() obj = mark.as_dict() try: # Make a 'filter' to find/update existing record, which uses ...
def tolocal(self): """ Convert to local mode. """ from thunder.images.readers import fromarray if self.mode == 'local': logging.getLogger('thunder').warn('images already in local mode') pass return fromarray(self.toarray())
def function[tolocal, parameter[self]]: constant[ Convert to local mode. ] from relative_module[thunder.images.readers] import module[fromarray] if compare[name[self].mode equal[==] constant[local]] begin[:] call[call[name[logging].getLogger, parameter[constant[thunde...
keyword[def] identifier[tolocal] ( identifier[self] ): literal[string] keyword[from] identifier[thunder] . identifier[images] . identifier[readers] keyword[import] identifier[fromarray] keyword[if] identifier[self] . identifier[mode] == literal[string] : identifier[loggi...
def tolocal(self): """ Convert to local mode. """ from thunder.images.readers import fromarray if self.mode == 'local': logging.getLogger('thunder').warn('images already in local mode') pass # depends on [control=['if'], data=[]] return fromarray(self.toarray())
def require_server(fn): """ Checks if the user has called the task with a server name. Fabric tasks decorated with this decorator must be called like so:: fab <server name> <task name> If no server name is given, the task will not be executed. """ @wraps(fn) def wrapper(*args, **...
def function[require_server, parameter[fn]]: constant[ Checks if the user has called the task with a server name. Fabric tasks decorated with this decorator must be called like so:: fab <server name> <task name> If no server name is given, the task will not be executed. ] def...
keyword[def] identifier[require_server] ( identifier[fn] ): literal[string] @ identifier[wraps] ( identifier[fn] ) keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ): keyword[if] identifier[env] . identifier[machine] keyword[is] keyword[None] : ident...
def require_server(fn): """ Checks if the user has called the task with a server name. Fabric tasks decorated with this decorator must be called like so:: fab <server name> <task name> If no server name is given, the task will not be executed. """ @wraps(fn) def wrapper(*args, *...
def __fetch_issue_messages(self, issue_id): """Get messages of an issue""" for messages_raw in self.client.issue_collection(issue_id, "messages"): messages = json.loads(messages_raw) for msg in messages['entries']: msg['owner_data'] = self.__fetch_user_data('{OW...
def function[__fetch_issue_messages, parameter[self, issue_id]]: constant[Get messages of an issue] for taget[name[messages_raw]] in starred[call[name[self].client.issue_collection, parameter[name[issue_id], constant[messages]]]] begin[:] variable[messages] assign[=] call[name[json].load...
keyword[def] identifier[__fetch_issue_messages] ( identifier[self] , identifier[issue_id] ): literal[string] keyword[for] identifier[messages_raw] keyword[in] identifier[self] . identifier[client] . identifier[issue_collection] ( identifier[issue_id] , literal[string] ): identifier...
def __fetch_issue_messages(self, issue_id): """Get messages of an issue""" for messages_raw in self.client.issue_collection(issue_id, 'messages'): messages = json.loads(messages_raw) for msg in messages['entries']: msg['owner_data'] = self.__fetch_user_data('{OWNER}', msg['owner_link...
def on_btn_demag_gui(self, event): """ Open Demag GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "demag_gui.py -WD %s"%self.WD print("-I- running python script:\n %s"%(outstri...
def function[on_btn_demag_gui, parameter[self, event]]: constant[ Open Demag GUI ] if <ast.UnaryOp object at 0x7da2041da680> begin[:] return[None] if <ast.UnaryOp object at 0x7da2041db4c0> begin[:] return[None] variable[outstring] assign[=] binary_operatio...
keyword[def] identifier[on_btn_demag_gui] ( identifier[self] , identifier[event] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[check_for_meas_file] (): keyword[return] keyword[if] keyword[not] identifier[self] . identifier[check_for_uncombined_...
def on_btn_demag_gui(self, event): """ Open Demag GUI """ if not self.check_for_meas_file(): return # depends on [control=['if'], data=[]] if not self.check_for_uncombined_files(): return # depends on [control=['if'], data=[]] outstring = 'demag_gui.py -WD %s' % self.WD...
def list(self, obj, filter=False, only_id=False, limit=20): """ Function list Get the list of an object @param obj: object name ('hosts', 'puppetclasses'...) @param filter: filter for objects @param only_id: boolean to only return dict with name/id @return RETURN: the li...
def function[list, parameter[self, obj, filter, only_id, limit]]: constant[ Function list Get the list of an object @param obj: object name ('hosts', 'puppetclasses'...) @param filter: filter for objects @param only_id: boolean to only return dict with name/id @return RE...
keyword[def] identifier[list] ( identifier[self] , identifier[obj] , identifier[filter] = keyword[False] , identifier[only_id] = keyword[False] , identifier[limit] = literal[int] ): literal[string] identifier[self] . identifier[url] = literal[string] . identifier[format] ( identifier[self] . identi...
def list(self, obj, filter=False, only_id=False, limit=20): """ Function list Get the list of an object @param obj: object name ('hosts', 'puppetclasses'...) @param filter: filter for objects @param only_id: boolean to only return dict with name/id @return RETURN: the list o...
def get_units(**kwargs): """ Returns all the units """ units_list = db.DBSession.query(Unit).all() units = [] for unit in units_list: new_unit = JSONObject(unit) units.append(new_unit) return units
def function[get_units, parameter[]]: constant[ Returns all the units ] variable[units_list] assign[=] call[call[name[db].DBSession.query, parameter[name[Unit]]].all, parameter[]] variable[units] assign[=] list[[]] for taget[name[unit]] in starred[name[units_list]] begin[:] ...
keyword[def] identifier[get_units] (** identifier[kwargs] ): literal[string] identifier[units_list] = identifier[db] . identifier[DBSession] . identifier[query] ( identifier[Unit] ). identifier[all] () identifier[units] =[] keyword[for] identifier[unit] keyword[in] identifier[units_list] : ...
def get_units(**kwargs): """ Returns all the units """ units_list = db.DBSession.query(Unit).all() units = [] for unit in units_list: new_unit = JSONObject(unit) units.append(new_unit) # depends on [control=['for'], data=['unit']] return units
def _validate_parse_dates_arg(parse_dates): """ Check whether or not the 'parse_dates' parameter is a non-boolean scalar. Raises a ValueError if that is the case. """ msg = ("Only booleans, lists, and " "dictionaries are accepted " "for the 'parse_dates' parameter") if...
def function[_validate_parse_dates_arg, parameter[parse_dates]]: constant[ Check whether or not the 'parse_dates' parameter is a non-boolean scalar. Raises a ValueError if that is the case. ] variable[msg] assign[=] constant[Only booleans, lists, and dictionaries are accepted for the 'pa...
keyword[def] identifier[_validate_parse_dates_arg] ( identifier[parse_dates] ): literal[string] identifier[msg] =( literal[string] literal[string] literal[string] ) keyword[if] identifier[parse_dates] keyword[is] keyword[not] keyword[None] : keyword[if] identifier[is_scalar]...
def _validate_parse_dates_arg(parse_dates): """ Check whether or not the 'parse_dates' parameter is a non-boolean scalar. Raises a ValueError if that is the case. """ msg = "Only booleans, lists, and dictionaries are accepted for the 'parse_dates' parameter" if parse_dates is not None: ...
def connect_checkable_button(instance, prop, widget): """ Connect a boolean callback property with a Qt button widget. Parameters ---------- instance : object The class instance that the callback property is attached to prop : str The name of the callback property widget : Q...
def function[connect_checkable_button, parameter[instance, prop, widget]]: constant[ Connect a boolean callback property with a Qt button widget. Parameters ---------- instance : object The class instance that the callback property is attached to prop : str The name of the c...
keyword[def] identifier[connect_checkable_button] ( identifier[instance] , identifier[prop] , identifier[widget] ): literal[string] identifier[add_callback] ( identifier[instance] , identifier[prop] , identifier[widget] . identifier[setChecked] ) identifier[widget] . identifier[toggled] . identifier[c...
def connect_checkable_button(instance, prop, widget): """ Connect a boolean callback property with a Qt button widget. Parameters ---------- instance : object The class instance that the callback property is attached to prop : str The name of the callback property widget : Q...
def encode(df, encoding='utf8', verbosity=1): """If you try to encode each element individually with python, this would take days!""" if verbosity > 0: # pbar_i = 0 pbar = progressbar.ProgressBar(maxval=df.shape[1]) pbar.start() # encode strings as UTF-8 so they'll work in python2 an...
def function[encode, parameter[df, encoding, verbosity]]: constant[If you try to encode each element individually with python, this would take days!] if compare[name[verbosity] greater[>] constant[0]] begin[:] variable[pbar] assign[=] call[name[progressbar].ProgressBar, parameter[]] ...
keyword[def] identifier[encode] ( identifier[df] , identifier[encoding] = literal[string] , identifier[verbosity] = literal[int] ): literal[string] keyword[if] identifier[verbosity] > literal[int] : identifier[pbar] = identifier[progressbar] . identifier[ProgressBar] ( identifier[maxval] = i...
def encode(df, encoding='utf8', verbosity=1): """If you try to encode each element individually with python, this would take days!""" if verbosity > 0: # pbar_i = 0 pbar = progressbar.ProgressBar(maxval=df.shape[1]) pbar.start() # depends on [control=['if'], data=[]] # encode string...
def render_as_xml(func): """ Decorator to render as XML :param func: :return: """ if inspect.isclass(func): setattr(func, "_renderer", xml_renderer) return func else: @functools.wraps(func) def decorated_view(*args, **kwargs): data = func(*args, **...
def function[render_as_xml, parameter[func]]: constant[ Decorator to render as XML :param func: :return: ] if call[name[inspect].isclass, parameter[name[func]]] begin[:] call[name[setattr], parameter[name[func], constant[_renderer], name[xml_renderer]]] return[nam...
keyword[def] identifier[render_as_xml] ( identifier[func] ): literal[string] keyword[if] identifier[inspect] . identifier[isclass] ( identifier[func] ): identifier[setattr] ( identifier[func] , literal[string] , identifier[xml_renderer] ) keyword[return] identifier[func] keyword[e...
def render_as_xml(func): """ Decorator to render as XML :param func: :return: """ if inspect.isclass(func): setattr(func, '_renderer', xml_renderer) return func # depends on [control=['if'], data=[]] else: @functools.wraps(func) def decorated_view(*args, **k...
def node_sub(self, node_self, node_other): '''node_sub High-level api: Compute the delta of two config nodes. This method is recursive. Assume two config nodes are different. Parameters ---------- node_self : `Element` A config node in the destination confi...
def function[node_sub, parameter[self, node_self, node_other]]: constant[node_sub High-level api: Compute the delta of two config nodes. This method is recursive. Assume two config nodes are different. Parameters ---------- node_self : `Element` A config no...
keyword[def] identifier[node_sub] ( identifier[self] , identifier[node_self] , identifier[node_other] ): literal[string] identifier[deletes] =[] identifier[puts] =[] identifier[patches] =[] keyword[def] identifier[generate_delete] ( identifie...
def node_sub(self, node_self, node_other): """node_sub High-level api: Compute the delta of two config nodes. This method is recursive. Assume two config nodes are different. Parameters ---------- node_self : `Element` A config node in the destination config th...
def write_jsonl_file(fname, data): """Writes a jsonl file. Args: data: list of json encoded data """ if not isinstance(data, list): print('warning: malformed json data for file', fname) return with open(fname, 'w') as of: for row in data: # TODO: other ma...
def function[write_jsonl_file, parameter[fname, data]]: constant[Writes a jsonl file. Args: data: list of json encoded data ] if <ast.UnaryOp object at 0x7da18bcc8d30> begin[:] call[name[print], parameter[constant[warning: malformed json data for file], name[fname]]] ...
keyword[def] identifier[write_jsonl_file] ( identifier[fname] , identifier[data] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[data] , identifier[list] ): identifier[print] ( literal[string] , identifier[fname] ) keyword[return] keyword[with] ide...
def write_jsonl_file(fname, data): """Writes a jsonl file. Args: data: list of json encoded data """ if not isinstance(data, list): print('warning: malformed json data for file', fname) return # depends on [control=['if'], data=[]] with open(fname, 'w') as of: for r...
def shorten(text): """ Reduce text length for displaying / logging purposes. """ if len(text) >= MAX_DISPLAY_LEN: text = text[:MAX_DISPLAY_LEN//2]+"..."+text[-MAX_DISPLAY_LEN//2:] return text
def function[shorten, parameter[text]]: constant[ Reduce text length for displaying / logging purposes. ] if compare[call[name[len], parameter[name[text]]] greater_or_equal[>=] name[MAX_DISPLAY_LEN]] begin[:] variable[text] assign[=] binary_operation[binary_operation[call[name[text]]...
keyword[def] identifier[shorten] ( identifier[text] ): literal[string] keyword[if] identifier[len] ( identifier[text] )>= identifier[MAX_DISPLAY_LEN] : identifier[text] = identifier[text] [: identifier[MAX_DISPLAY_LEN] // literal[int] ]+ literal[string] + identifier[text] [- identifier[MAX_DISPLA...
def shorten(text): """ Reduce text length for displaying / logging purposes. """ if len(text) >= MAX_DISPLAY_LEN: text = text[:MAX_DISPLAY_LEN // 2] + '...' + text[-MAX_DISPLAY_LEN // 2:] # depends on [control=['if'], data=['MAX_DISPLAY_LEN']] return text
def confusion_matrix(rater_a, rater_b, min_rating=None, max_rating=None): """ Generates a confusion matrix between rater_a and rater_b A confusion matrix shows how often 2 values agree and disagree See quadratic_weighted_kappa for argument descriptions """ assert(len(rater_a) == len(rater_b)) ...
def function[confusion_matrix, parameter[rater_a, rater_b, min_rating, max_rating]]: constant[ Generates a confusion matrix between rater_a and rater_b A confusion matrix shows how often 2 values agree and disagree See quadratic_weighted_kappa for argument descriptions ] assert[compare[call[...
keyword[def] identifier[confusion_matrix] ( identifier[rater_a] , identifier[rater_b] , identifier[min_rating] = keyword[None] , identifier[max_rating] = keyword[None] ): literal[string] keyword[assert] ( identifier[len] ( identifier[rater_a] )== identifier[len] ( identifier[rater_b] )) identifier[rat...
def confusion_matrix(rater_a, rater_b, min_rating=None, max_rating=None): """ Generates a confusion matrix between rater_a and rater_b A confusion matrix shows how often 2 values agree and disagree See quadratic_weighted_kappa for argument descriptions """ assert len(rater_a) == len(rater_b) ...
def get_position_searchable(self): """Return dict of the position and corrasponding searchable str """ ids = gkr.list_item_ids_sync(self.keyring) position_searchable = {} for i in ids: item_attrs = gkr.item_get_attributes_sync(self.keyring, i) position_sea...
def function[get_position_searchable, parameter[self]]: constant[Return dict of the position and corrasponding searchable str ] variable[ids] assign[=] call[name[gkr].list_item_ids_sync, parameter[name[self].keyring]] variable[position_searchable] assign[=] dictionary[[], []] for...
keyword[def] identifier[get_position_searchable] ( identifier[self] ): literal[string] identifier[ids] = identifier[gkr] . identifier[list_item_ids_sync] ( identifier[self] . identifier[keyring] ) identifier[position_searchable] ={} keyword[for] identifier[i] keyword[in] identi...
def get_position_searchable(self): """Return dict of the position and corrasponding searchable str """ ids = gkr.list_item_ids_sync(self.keyring) position_searchable = {} for i in ids: item_attrs = gkr.item_get_attributes_sync(self.keyring, i) position_searchable[i] = item_attrs[...
def _downloadfile(self, url, fname): ''' Download the image ''' print("The file %s need to be download - Wait\n " % (fname.split('/')[-1])) urllib.urlretrieve(url, fname, self._report) print("\n The download of the file %s has succeded \n " % (fname.split('/'...
def function[_downloadfile, parameter[self, url, fname]]: constant[ Download the image ] call[name[print], parameter[binary_operation[constant[The file %s need to be download - Wait ] <ast.Mod object at 0x7da2590d6920> call[call[name[fname].split, parameter[constant[/]]]][<ast.UnaryOp object at 0x7da18...
keyword[def] identifier[_downloadfile] ( identifier[self] , identifier[url] , identifier[fname] ): literal[string] identifier[print] ( literal[string] % ( identifier[fname] . identifier[split] ( literal[string] )[- literal[int] ])) identifier[urllib] . identifier[urlretrieve] ( id...
def _downloadfile(self, url, fname): """ Download the image """ print('The file %s need to be download - Wait\n ' % fname.split('/')[-1]) urllib.urlretrieve(url, fname, self._report) print('\n The download of the file %s has succeded \n ' % fname.split('/')[-1])
def load_configuration(self): """Loading configuration.""" filename = os.path.join(os.path.dirname(__file__), 'templates/spline-loc.yml.j2') with open(filename) as handle: return Adapter(safe_load(handle)).configuration
def function[load_configuration, parameter[self]]: constant[Loading configuration.] variable[filename] assign[=] call[name[os].path.join, parameter[call[name[os].path.dirname, parameter[name[__file__]]], constant[templates/spline-loc.yml.j2]]] with call[name[open], parameter[name[filename]]] beg...
keyword[def] identifier[load_configuration] ( identifier[self] ): literal[string] identifier[filename] = identifier[os] . identifier[path] . identifier[join] ( identifier[os] . identifier[path] . identifier[dirname] ( identifier[__file__] ), literal[string] ) keyword[with] identifier[open...
def load_configuration(self): """Loading configuration.""" filename = os.path.join(os.path.dirname(__file__), 'templates/spline-loc.yml.j2') with open(filename) as handle: return Adapter(safe_load(handle)).configuration # depends on [control=['with'], data=['handle']]
def map_channels(mapping, cdim): """Create a :class:`CPermuation` based on a dict of channel mappings For a given mapping in form of a dictionary, generate the channel permutating circuit that achieves the specified mapping while leaving the relative order of all non-specified channels intact. Arg...
def function[map_channels, parameter[mapping, cdim]]: constant[Create a :class:`CPermuation` based on a dict of channel mappings For a given mapping in form of a dictionary, generate the channel permutating circuit that achieves the specified mapping while leaving the relative order of all non-spec...
keyword[def] identifier[map_channels] ( identifier[mapping] , identifier[cdim] ): literal[string] identifier[n] = identifier[cdim] identifier[free_values] = identifier[list] ( identifier[range] ( identifier[n] )) keyword[for] identifier[v] keyword[in] identifier[mapping] . identifier[values]...
def map_channels(mapping, cdim): """Create a :class:`CPermuation` based on a dict of channel mappings For a given mapping in form of a dictionary, generate the channel permutating circuit that achieves the specified mapping while leaving the relative order of all non-specified channels intact. Arg...
def RegisterFreeformKey(cls, key, name, mean="com.apple.iTunes"): """Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 freeform atom (----) and name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterFreeformKey...
def function[RegisterFreeformKey, parameter[cls, key, name, mean]]: constant[Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 freeform atom (----) and name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterFre...
keyword[def] identifier[RegisterFreeformKey] ( identifier[cls] , identifier[key] , identifier[name] , identifier[mean] = literal[string] ): literal[string] identifier[atomid] = literal[string] + identifier[mean] + literal[string] + identifier[name] keyword[def] identifier[getter] ( iden...
def RegisterFreeformKey(cls, key, name, mean='com.apple.iTunes'): """Register a text key. If the key you need to register is a simple one-to-one mapping of MP4 freeform atom (----) and name to EasyMP4Tags key, then you can use this function:: EasyMP4Tags.RegisterFreeformKey( ...
def get_libraries(self, database=''): """return active enrichr library name.Offical API """ lib_url='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%database libs_json = json.loads(requests.get(lib_url).text) libs = [lib['libraryName'] for lib in libs_json['statistics']] ...
def function[get_libraries, parameter[self, database]]: constant[return active enrichr library name.Offical API ] variable[lib_url] assign[=] binary_operation[constant[http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics] <ast.Mod object at 0x7da2590d6920> name[database]] variable[libs_json] as...
keyword[def] identifier[get_libraries] ( identifier[self] , identifier[database] = literal[string] ): literal[string] identifier[lib_url] = literal[string] % identifier[database] identifier[libs_json] = identifier[json] . identifier[loads] ( identifier[requests] . identifier[get] ( ident...
def get_libraries(self, database=''): """return active enrichr library name.Offical API """ lib_url = 'http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics' % database libs_json = json.loads(requests.get(lib_url).text) libs = [lib['libraryName'] for lib in libs_json['statistics']] return sorted(lib...
def add_col_features(self, col=None, degree=None): """ Exponentiate columns of dataframe. Basically this function squares/cubes a column. e.g. df[col^2] = pow(df[col], degree) where degree=2. Parameters ---------- col : list(str) Column to exponentiate....
def function[add_col_features, parameter[self, col, degree]]: constant[ Exponentiate columns of dataframe. Basically this function squares/cubes a column. e.g. df[col^2] = pow(df[col], degree) where degree=2. Parameters ---------- col : list(str) Column...
keyword[def] identifier[add_col_features] ( identifier[self] , identifier[col] = keyword[None] , identifier[degree] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[col] keyword[and] keyword[not] identifier[degree] : keyword[return] keyword[else] ...
def add_col_features(self, col=None, degree=None): """ Exponentiate columns of dataframe. Basically this function squares/cubes a column. e.g. df[col^2] = pow(df[col], degree) where degree=2. Parameters ---------- col : list(str) Column to exponentiate. ...
def info(ctx): """ Display status of PIV application. """ controller = ctx.obj['controller'] click.echo('PIV version: %d.%d.%d' % controller.version) # Largest possible number of PIN tries to get back is 15 tries = controller.get_pin_tries() tries = '15 or more.' if tries == 15 else tri...
def function[info, parameter[ctx]]: constant[ Display status of PIV application. ] variable[controller] assign[=] call[name[ctx].obj][constant[controller]] call[name[click].echo, parameter[binary_operation[constant[PIV version: %d.%d.%d] <ast.Mod object at 0x7da2590d6920> name[controller...
keyword[def] identifier[info] ( identifier[ctx] ): literal[string] identifier[controller] = identifier[ctx] . identifier[obj] [ literal[string] ] identifier[click] . identifier[echo] ( literal[string] % identifier[controller] . identifier[version] ) identifier[tries] = identifier[controller...
def info(ctx): """ Display status of PIV application. """ controller = ctx.obj['controller'] click.echo('PIV version: %d.%d.%d' % controller.version) # Largest possible number of PIN tries to get back is 15 tries = controller.get_pin_tries() tries = '15 or more.' if tries == 15 else trie...
def get_path(self, path=''): """ Validate incoming path, if path is empty, build it from resource attributes, If path is invalid - raise exception :param path: path to remote file storage :return: valid path or :raise Exception: """ if not path: host...
def function[get_path, parameter[self, path]]: constant[ Validate incoming path, if path is empty, build it from resource attributes, If path is invalid - raise exception :param path: path to remote file storage :return: valid path or :raise Exception: ] if <ast....
keyword[def] identifier[get_path] ( identifier[self] , identifier[path] = literal[string] ): literal[string] keyword[if] keyword[not] identifier[path] : identifier[host] = identifier[self] . identifier[resource_config] . identifier[backup_location] keyword[if] literal...
def get_path(self, path=''): """ Validate incoming path, if path is empty, build it from resource attributes, If path is invalid - raise exception :param path: path to remote file storage :return: valid path or :raise Exception: """ if not path: host = self.resou...
def set_figure(self, figure, handle=None): """Call this with the Bokeh figure object.""" self.figure = figure self.bkimage = None self._push_handle = handle wd = figure.plot_width ht = figure.plot_height self.configure_window(wd, ht) doc = curdoc() ...
def function[set_figure, parameter[self, figure, handle]]: constant[Call this with the Bokeh figure object.] name[self].figure assign[=] name[figure] name[self].bkimage assign[=] constant[None] name[self]._push_handle assign[=] name[handle] variable[wd] assign[=] name[figure].plo...
keyword[def] identifier[set_figure] ( identifier[self] , identifier[figure] , identifier[handle] = keyword[None] ): literal[string] identifier[self] . identifier[figure] = identifier[figure] identifier[self] . identifier[bkimage] = keyword[None] identifier[self] . identifier[_pu...
def set_figure(self, figure, handle=None): """Call this with the Bokeh figure object.""" self.figure = figure self.bkimage = None self._push_handle = handle wd = figure.plot_width ht = figure.plot_height self.configure_window(wd, ht) doc = curdoc() #self.logger.info(str(dir(doc))) ...
def add_index(self, mode, blob_id, path): """ Add new entry to the current index :param tree: :return: """ self.command_exec(['update-index', '--add', '--cacheinfo', mode, blob_id, path])
def function[add_index, parameter[self, mode, blob_id, path]]: constant[ Add new entry to the current index :param tree: :return: ] call[name[self].command_exec, parameter[list[[<ast.Constant object at 0x7da20e960ac0>, <ast.Constant object at 0x7da20e961630>, <ast.Const...
keyword[def] identifier[add_index] ( identifier[self] , identifier[mode] , identifier[blob_id] , identifier[path] ): literal[string] identifier[self] . identifier[command_exec] ([ literal[string] , literal[string] , literal[string] , identifier[mode] , identifier[blob_id] , identifier[path] ])
def add_index(self, mode, blob_id, path): """ Add new entry to the current index :param tree: :return: """ self.command_exec(['update-index', '--add', '--cacheinfo', mode, blob_id, path])
def evaluate_call_args(self, calculator): """Interpreting this literal as a function call, return a 2-tuple of ``(args, kwargs)``. """ args = [] kwargs = OrderedDict() # Sass kwargs preserve order for var_node, value_node in self.argpairs: value = value_node....
def function[evaluate_call_args, parameter[self, calculator]]: constant[Interpreting this literal as a function call, return a 2-tuple of ``(args, kwargs)``. ] variable[args] assign[=] list[[]] variable[kwargs] assign[=] call[name[OrderedDict], parameter[]] for taget[tupl...
keyword[def] identifier[evaluate_call_args] ( identifier[self] , identifier[calculator] ): literal[string] identifier[args] =[] identifier[kwargs] = identifier[OrderedDict] () keyword[for] identifier[var_node] , identifier[value_node] keyword[in] identifier[self] . identifier[a...
def evaluate_call_args(self, calculator): """Interpreting this literal as a function call, return a 2-tuple of ``(args, kwargs)``. """ args = [] kwargs = OrderedDict() # Sass kwargs preserve order for (var_node, value_node) in self.argpairs: value = value_node.evaluate(calculato...
def get_websensors(self): """ Get sensors with defined tag as a dictionary of format ``{name: status}`` """ return {i.name: i.status for i in self.system.sensors if self.tag & i.tags}
def function[get_websensors, parameter[self]]: constant[ Get sensors with defined tag as a dictionary of format ``{name: status}`` ] return[<ast.DictComp object at 0x7da1b255ecb0>]
keyword[def] identifier[get_websensors] ( identifier[self] ): literal[string] keyword[return] { identifier[i] . identifier[name] : identifier[i] . identifier[status] keyword[for] identifier[i] keyword[in] identifier[self] . identifier[system] . identifier[sensors] keyword[if] identifier[self]...
def get_websensors(self): """ Get sensors with defined tag as a dictionary of format ``{name: status}`` """ return {i.name: i.status for i in self.system.sensors if self.tag & i.tags}
def purge(vm_, dirs=False, removables=None, **kwargs): ''' Recursively destroy and delete a persistent virtual machine, pass True for dir's to also delete the directories containing the virtual machine disk images - USE WITH EXTREME CAUTION! Pass removables=False to avoid deleting cdrom and floppy ...
def function[purge, parameter[vm_, dirs, removables]]: constant[ Recursively destroy and delete a persistent virtual machine, pass True for dir's to also delete the directories containing the virtual machine disk images - USE WITH EXTREME CAUTION! Pass removables=False to avoid deleting cdrom a...
keyword[def] identifier[purge] ( identifier[vm_] , identifier[dirs] = keyword[False] , identifier[removables] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[conn] = identifier[__get_conn] (** identifier[kwargs] ) identifier[dom] = identifier[_get_domain] ( identifier[conn] , iden...
def purge(vm_, dirs=False, removables=None, **kwargs): """ Recursively destroy and delete a persistent virtual machine, pass True for dir's to also delete the directories containing the virtual machine disk images - USE WITH EXTREME CAUTION! Pass removables=False to avoid deleting cdrom and floppy ...
def add_line_wrappers(data_passed_from_pelican): """A function to read through each page and post as it comes through from Pelican, find all instances of triple-backtick (```...```) code blocks, and add an HTML wrapper to each line of each of those code blocks""" if data_passed_from_pelican._content: # If the ...
def function[add_line_wrappers, parameter[data_passed_from_pelican]]: constant[A function to read through each page and post as it comes through from Pelican, find all instances of triple-backtick (```...```) code blocks, and add an HTML wrapper to each line of each of those code blocks] if name[data_pa...
keyword[def] identifier[add_line_wrappers] ( identifier[data_passed_from_pelican] ): literal[string] keyword[if] identifier[data_passed_from_pelican] . identifier[_content] : identifier[full_content_of_page_or_post] = identifier[data_passed_from_pelican] . identifier[_content] keyword[else...
def add_line_wrappers(data_passed_from_pelican): """A function to read through each page and post as it comes through from Pelican, find all instances of triple-backtick (```...```) code blocks, and add an HTML wrapper to each line of each of those code blocks""" if data_passed_from_pelican._content: # If the ...
async def update_data_status(self, **kwargs): """Update (PATCH) Data object. :param kwargs: The dictionary of :class:`~resolwe.flow.models.Data` attributes to be changed. """ await self._send_manager_command(ExecutorProtocol.UPDATE, extra_fields={ ExecutorProtoco...
<ast.AsyncFunctionDef object at 0x7da1b19b7580>
keyword[async] keyword[def] identifier[update_data_status] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[await] identifier[self] . identifier[_send_manager_command] ( identifier[ExecutorProtocol] . identifier[UPDATE] , identifier[extra_fields] ={ identifier[Executo...
async def update_data_status(self, **kwargs): """Update (PATCH) Data object. :param kwargs: The dictionary of :class:`~resolwe.flow.models.Data` attributes to be changed. """ await self._send_manager_command(ExecutorProtocol.UPDATE, extra_fields={ExecutorProtocol.UPDATE_CHANGESET: k...
def phonex(word, language="english"): """ Short for phone index, maps a word onto a sequence of phone clusters Strips non supported characters (for english, non alpha characters) """ phone_variants = phoneticize(word) mappings = cluster_phones(language) results = [] for phone_variant in ...
def function[phonex, parameter[word, language]]: constant[ Short for phone index, maps a word onto a sequence of phone clusters Strips non supported characters (for english, non alpha characters) ] variable[phone_variants] assign[=] call[name[phoneticize], parameter[name[word]]] vari...
keyword[def] identifier[phonex] ( identifier[word] , identifier[language] = literal[string] ): literal[string] identifier[phone_variants] = identifier[phoneticize] ( identifier[word] ) identifier[mappings] = identifier[cluster_phones] ( identifier[language] ) identifier[results] =[] keyword[...
def phonex(word, language='english'): """ Short for phone index, maps a word onto a sequence of phone clusters Strips non supported characters (for english, non alpha characters) """ phone_variants = phoneticize(word) mappings = cluster_phones(language) results = [] for phone_variant in ...
def _address_family(address): """ Attempt to determine the family of an address (or hostname) :return: either socket.AF_INET or socket.AF_INET6 or socket.AF_UNSPEC if the address family could not be determined """ if address.startswith('[') and address.endswith(']'): ...
def function[_address_family, parameter[address]]: constant[ Attempt to determine the family of an address (or hostname) :return: either socket.AF_INET or socket.AF_INET6 or socket.AF_UNSPEC if the address family could not be determined ] if <ast.BoolOp object at 0x...
keyword[def] identifier[_address_family] ( identifier[address] ): literal[string] keyword[if] identifier[address] . identifier[startswith] ( literal[string] ) keyword[and] identifier[address] . identifier[endswith] ( literal[string] ): keyword[return] identifier[socket] . identifier[AF_INET6] ...
def _address_family(address): """ Attempt to determine the family of an address (or hostname) :return: either socket.AF_INET or socket.AF_INET6 or socket.AF_UNSPEC if the address family could not be determined """ if address.startswith('[') and address.endswith(']'): ...
def element_tree_collection_to_records(tree): """Take an ElementTree and converts the nodes into BibRecord records. This function is for a tree root of collection as such: <collection> <record> <!-- MARCXML --> </record> <record> ... </record> </collection> """ ...
def function[element_tree_collection_to_records, parameter[tree]]: constant[Take an ElementTree and converts the nodes into BibRecord records. This function is for a tree root of collection as such: <collection> <record> <!-- MARCXML --> </record> <record> ... </reco...
keyword[def] identifier[element_tree_collection_to_records] ( identifier[tree] ): literal[string] keyword[from] . identifier[bibrecord] keyword[import] identifier[create_record] identifier[records] =[] identifier[collection] = identifier[tree] . identifier[getroot] () keyword[for] ident...
def element_tree_collection_to_records(tree): """Take an ElementTree and converts the nodes into BibRecord records. This function is for a tree root of collection as such: <collection> <record> <!-- MARCXML --> </record> <record> ... </record> </collection> """ ...
def migrate_data(ignore: Sequence[str], new_data_path: str, old_data_path: str): """ Copy everything in the app data to the root of the main data part :param ignore: A list of files that should be ignored in the root of /data :param new_data_path: Where the new data partit...
def function[migrate_data, parameter[ignore, new_data_path, old_data_path]]: constant[ Copy everything in the app data to the root of the main data part :param ignore: A list of files that should be ignored in the root of /data :param new_data_path: Where the new data partition is mounted :param ol...
keyword[def] identifier[migrate_data] ( identifier[ignore] : identifier[Sequence] [ identifier[str] ], identifier[new_data_path] : identifier[str] , identifier[old_data_path] : identifier[str] ): literal[string] identifier[dest_data] = identifier[os] . identifier[path] . identifier[join] ( identifie...
def migrate_data(ignore: Sequence[str], new_data_path: str, old_data_path: str): """ Copy everything in the app data to the root of the main data part :param ignore: A list of files that should be ignored in the root of /data :param new_data_path: Where the new data partition is mounted :param old_data...
def count_leaves(x): """ Return the number of non-sequence items in a given recursive sequence. """ if hasattr(x, 'keys'): x = list(x.values()) if hasattr(x, '__getitem__'): return sum(map(count_leaves, x)) return 1
def function[count_leaves, parameter[x]]: constant[ Return the number of non-sequence items in a given recursive sequence. ] if call[name[hasattr], parameter[name[x], constant[keys]]] begin[:] variable[x] assign[=] call[name[list], parameter[call[name[x].values, parameter[]]]] ...
keyword[def] identifier[count_leaves] ( identifier[x] ): literal[string] keyword[if] identifier[hasattr] ( identifier[x] , literal[string] ): identifier[x] = identifier[list] ( identifier[x] . identifier[values] ()) keyword[if] identifier[hasattr] ( identifier[x] , literal[string] ): ...
def count_leaves(x): """ Return the number of non-sequence items in a given recursive sequence. """ if hasattr(x, 'keys'): x = list(x.values()) # depends on [control=['if'], data=[]] if hasattr(x, '__getitem__'): return sum(map(count_leaves, x)) # depends on [control=['if'], data=[...
def _deserialize_int(data, nbytes=32, padding=0): """ Read a `nbytes` bytes long big endian signed integer from `data` starting at `offset` :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data :param nbytes: number of bytes to read starting from least significant byte ...
def function[_deserialize_int, parameter[data, nbytes, padding]]: constant[ Read a `nbytes` bytes long big endian signed integer from `data` starting at `offset` :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data :param nbytes: number of bytes to read starting from l...
keyword[def] identifier[_deserialize_int] ( identifier[data] , identifier[nbytes] = literal[int] , identifier[padding] = literal[int] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[data] ,( identifier[bytearray] , identifier[Array] )) identifier[value] = identifier...
def _deserialize_int(data, nbytes=32, padding=0): """ Read a `nbytes` bytes long big endian signed integer from `data` starting at `offset` :param data: sliceable buffer; symbolic buffer of Eth ABI encoded data :param nbytes: number of bytes to read starting from least significant byte ...
def module_definition_from_mirteFile_dict(man, d): """ Creates a ModuleDefinition instance from the dictionary <d> from a mirte-file for the Manager instance <man>. """ m = ModuleDefinition() if 'inherits' not in d: d['inherits'] = list() if 'settings' not in d: d['settings'] = d...
def function[module_definition_from_mirteFile_dict, parameter[man, d]]: constant[ Creates a ModuleDefinition instance from the dictionary <d> from a mirte-file for the Manager instance <man>. ] variable[m] assign[=] call[name[ModuleDefinition], parameter[]] if compare[constant[inherits] ...
keyword[def] identifier[module_definition_from_mirteFile_dict] ( identifier[man] , identifier[d] ): literal[string] identifier[m] = identifier[ModuleDefinition] () keyword[if] literal[string] keyword[not] keyword[in] identifier[d] : identifier[d] [ literal[string] ]= identifier[list] () ...
def module_definition_from_mirteFile_dict(man, d): """ Creates a ModuleDefinition instance from the dictionary <d> from a mirte-file for the Manager instance <man>. """ m = ModuleDefinition() if 'inherits' not in d: d['inherits'] = list() # depends on [control=['if'], data=['d']] if 'se...
def _update_fields_with_objects(self): """ Convert dict fields into objects, where appropriate """ # Update the photo target with photo objects if self.target is not None: if self.target_type == "photo": self.target = Photo(self._client, self.target) else:...
def function[_update_fields_with_objects, parameter[self]]: constant[ Convert dict fields into objects, where appropriate ] if compare[name[self].target is_not constant[None]] begin[:] if compare[name[self].target_type equal[==] constant[photo]] begin[:] name[self...
keyword[def] identifier[_update_fields_with_objects] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[target] keyword[is] keyword[not] keyword[None] : keyword[if] identifier[self] . identifier[target_type] == literal[string] : ...
def _update_fields_with_objects(self): """ Convert dict fields into objects, where appropriate """ # Update the photo target with photo objects if self.target is not None: if self.target_type == 'photo': self.target = Photo(self._client, self.target) # depends on [control=['if'], data=[...
def get_id2children(objs): """Get all parent item IDs for each item in dict keys.""" id2children = {} for obj in objs: _get_id2children(id2children, obj.item_id, obj) return id2children
def function[get_id2children, parameter[objs]]: constant[Get all parent item IDs for each item in dict keys.] variable[id2children] assign[=] dictionary[[], []] for taget[name[obj]] in starred[name[objs]] begin[:] call[name[_get_id2children], parameter[name[id2children], name[obj...
keyword[def] identifier[get_id2children] ( identifier[objs] ): literal[string] identifier[id2children] ={} keyword[for] identifier[obj] keyword[in] identifier[objs] : identifier[_get_id2children] ( identifier[id2children] , identifier[obj] . identifier[item_id] , identifier[obj] ) key...
def get_id2children(objs): """Get all parent item IDs for each item in dict keys.""" id2children = {} for obj in objs: _get_id2children(id2children, obj.item_id, obj) # depends on [control=['for'], data=['obj']] return id2children
def url(self): """:class:`str`: The URL to the highscores page on Tibia.com containing the results.""" return self.get_url(self.world, self.category, self.vocation, self.page)
def function[url, parameter[self]]: constant[:class:`str`: The URL to the highscores page on Tibia.com containing the results.] return[call[name[self].get_url, parameter[name[self].world, name[self].category, name[self].vocation, name[self].page]]]
keyword[def] identifier[url] ( identifier[self] ): literal[string] keyword[return] identifier[self] . identifier[get_url] ( identifier[self] . identifier[world] , identifier[self] . identifier[category] , identifier[self] . identifier[vocation] , identifier[self] . identifier[page] )
def url(self): """:class:`str`: The URL to the highscores page on Tibia.com containing the results.""" return self.get_url(self.world, self.category, self.vocation, self.page)
def public(self): """ Is this document visible to anyone? """ if self._public: return self._public elif not self.abstract: return self.read_meta()._public raise EmptyDocumentException()
def function[public, parameter[self]]: constant[ Is this document visible to anyone? ] if name[self]._public begin[:] return[name[self]._public] <ast.Raise object at 0x7da204960b50>
keyword[def] identifier[public] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_public] : keyword[return] identifier[self] . identifier[_public] keyword[elif] keyword[not] identifier[self] . identifier[abstract] : keyword[retu...
def public(self): """ Is this document visible to anyone? """ if self._public: return self._public # depends on [control=['if'], data=[]] elif not self.abstract: return self.read_meta()._public # depends on [control=['if'], data=[]] raise EmptyDocumentException()
def _get_transformation_history(path): """ Checks for a transformations.json* file and returns the history. """ trans_json = glob.glob(os.path.join(path, "transformations.json*")) if trans_json: try: with zopen(trans_json[0]) as f: return json.load(f)["history"] ...
def function[_get_transformation_history, parameter[path]]: constant[ Checks for a transformations.json* file and returns the history. ] variable[trans_json] assign[=] call[name[glob].glob, parameter[call[name[os].path.join, parameter[name[path], constant[transformations.json*]]]]] if na...
keyword[def] identifier[_get_transformation_history] ( identifier[path] ): literal[string] identifier[trans_json] = identifier[glob] . identifier[glob] ( identifier[os] . identifier[path] . identifier[join] ( identifier[path] , literal[string] )) keyword[if] identifier[trans_json] : keyword[...
def _get_transformation_history(path): """ Checks for a transformations.json* file and returns the history. """ trans_json = glob.glob(os.path.join(path, 'transformations.json*')) if trans_json: try: with zopen(trans_json[0]) as f: return json.load(f)['history'] ...
def dimod_object_hook(obj): """JSON-decoding for dimod objects. See Also: :class:`json.JSONDecoder` for using custom decoders. """ if _is_sampleset_v2(obj): # in the future we could handle subtypes but right now we just have the # one return SampleSet.from_serializable(...
def function[dimod_object_hook, parameter[obj]]: constant[JSON-decoding for dimod objects. See Also: :class:`json.JSONDecoder` for using custom decoders. ] if call[name[_is_sampleset_v2], parameter[name[obj]]] begin[:] return[call[name[SampleSet].from_serializable, parameter[na...
keyword[def] identifier[dimod_object_hook] ( identifier[obj] ): literal[string] keyword[if] identifier[_is_sampleset_v2] ( identifier[obj] ): keyword[return] identifier[SampleSet] . identifier[from_serializable] ( identifier[obj] ) keyword[elif] identifier[_is_bqm_v2] ( identifie...
def dimod_object_hook(obj): """JSON-decoding for dimod objects. See Also: :class:`json.JSONDecoder` for using custom decoders. """ if _is_sampleset_v2(obj): # in the future we could handle subtypes but right now we just have the # one return SampleSet.from_serializable(...
def draw_separators(self): """Draw the lines separating the categories on the Canvas""" total = 1 self._timeline.create_line((0, 1, self.pixel_width, 1)) for index, (category, label) in enumerate(self._category_labels.items()): height = label.winfo_reqheight() sel...
def function[draw_separators, parameter[self]]: constant[Draw the lines separating the categories on the Canvas] variable[total] assign[=] constant[1] call[name[self]._timeline.create_line, parameter[tuple[[<ast.Constant object at 0x7da1b2359e10>, <ast.Constant object at 0x7da1b2358bb0>, <ast.At...
keyword[def] identifier[draw_separators] ( identifier[self] ): literal[string] identifier[total] = literal[int] identifier[self] . identifier[_timeline] . identifier[create_line] (( literal[int] , literal[int] , identifier[self] . identifier[pixel_width] , literal[int] )) keyword...
def draw_separators(self): """Draw the lines separating the categories on the Canvas""" total = 1 self._timeline.create_line((0, 1, self.pixel_width, 1)) for (index, (category, label)) in enumerate(self._category_labels.items()): height = label.winfo_reqheight() self._rows[category] = (t...
def values_for_enum(gtype): """Get all values for a enum (gtype).""" g_type_class = gobject_lib.g_type_class_ref(gtype) g_enum_class = ffi.cast('GEnumClass *', g_type_class) values = [] # -1 since we always have a "last" member. for i in range(0, g_enum_class.n_values - 1): value = _t...
def function[values_for_enum, parameter[gtype]]: constant[Get all values for a enum (gtype).] variable[g_type_class] assign[=] call[name[gobject_lib].g_type_class_ref, parameter[name[gtype]]] variable[g_enum_class] assign[=] call[name[ffi].cast, parameter[constant[GEnumClass *], name[g_type_clas...
keyword[def] identifier[values_for_enum] ( identifier[gtype] ): literal[string] identifier[g_type_class] = identifier[gobject_lib] . identifier[g_type_class_ref] ( identifier[gtype] ) identifier[g_enum_class] = identifier[ffi] . identifier[cast] ( literal[string] , identifier[g_type_class] ) id...
def values_for_enum(gtype): """Get all values for a enum (gtype).""" g_type_class = gobject_lib.g_type_class_ref(gtype) g_enum_class = ffi.cast('GEnumClass *', g_type_class) values = [] # -1 since we always have a "last" member. for i in range(0, g_enum_class.n_values - 1): value = _to_s...
def _get_basin_response_term(self, C, z2pt5): """ Returns the basin response term defined in equation 20 """ f_sed = np.zeros(len(z2pt5)) idx = z2pt5 < 1.0 f_sed[idx] = (C["c14"] + C["c15"] * float(self.CONSTS["SJ"])) *\ (z2pt5[idx] - 1.0) idx = z2pt5 ...
def function[_get_basin_response_term, parameter[self, C, z2pt5]]: constant[ Returns the basin response term defined in equation 20 ] variable[f_sed] assign[=] call[name[np].zeros, parameter[call[name[len], parameter[name[z2pt5]]]]] variable[idx] assign[=] compare[name[z2pt5] les...
keyword[def] identifier[_get_basin_response_term] ( identifier[self] , identifier[C] , identifier[z2pt5] ): literal[string] identifier[f_sed] = identifier[np] . identifier[zeros] ( identifier[len] ( identifier[z2pt5] )) identifier[idx] = identifier[z2pt5] < literal[int] identifie...
def _get_basin_response_term(self, C, z2pt5): """ Returns the basin response term defined in equation 20 """ f_sed = np.zeros(len(z2pt5)) idx = z2pt5 < 1.0 f_sed[idx] = (C['c14'] + C['c15'] * float(self.CONSTS['SJ'])) * (z2pt5[idx] - 1.0) idx = z2pt5 > 3.0 f_sed[idx] = C['c16'] *...
def writexlsx(self, path, sheetname="default"): """ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acry...
def function[writexlsx, parameter[self, path, sheetname]]: constant[ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` f...
keyword[def] identifier[writexlsx] ( identifier[self] , identifier[path] , identifier[sheetname] = literal[string] ): literal[string] identifier[writer] = identifier[ExcelRW] . identifier[UnicodeWriter] ( identifier[path] ) identifier[writer] . identifier[set_active_sheet] ( identifier[she...
def writexlsx(self, path, sheetname='default'): """ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acrylic....
def bind(self, alloy): ''' Shallow copies this MethodParameter, and binds it to an alloy. This is required before calling. ''' param = MethodParameter(self.name, self.method, self.dependencies, self.units, self.aliases, self._references) pa...
def function[bind, parameter[self, alloy]]: constant[ Shallow copies this MethodParameter, and binds it to an alloy. This is required before calling. ] variable[param] assign[=] call[name[MethodParameter], parameter[name[self].name, name[self].method, name[self].dependencies, nam...
keyword[def] identifier[bind] ( identifier[self] , identifier[alloy] ): literal[string] identifier[param] = identifier[MethodParameter] ( identifier[self] . identifier[name] , identifier[self] . identifier[method] , identifier[self] . identifier[dependencies] , identifier[self] . identifie...
def bind(self, alloy): """ Shallow copies this MethodParameter, and binds it to an alloy. This is required before calling. """ param = MethodParameter(self.name, self.method, self.dependencies, self.units, self.aliases, self._references) param.alloy = alloy return param
def encrypt_var(source, keys): """Attempts to encrypt a variable""" cmd = flatten([gnupg_bin(), "--armor", "--encrypt", gnupg_verbose(), recipients_args(keys)]) output = stderr_with_input(cmd, source) return output
def function[encrypt_var, parameter[source, keys]]: constant[Attempts to encrypt a variable] variable[cmd] assign[=] call[name[flatten], parameter[list[[<ast.Call object at 0x7da1b19b08b0>, <ast.Constant object at 0x7da1b19b1150>, <ast.Constant object at 0x7da1b19b0070>, <ast.Call object at 0x7da1b19b35...
keyword[def] identifier[encrypt_var] ( identifier[source] , identifier[keys] ): literal[string] identifier[cmd] = identifier[flatten] ([ identifier[gnupg_bin] (), literal[string] , literal[string] , identifier[gnupg_verbose] (), identifier[recipients_args] ( identifier[keys] )]) identifier[output...
def encrypt_var(source, keys): """Attempts to encrypt a variable""" cmd = flatten([gnupg_bin(), '--armor', '--encrypt', gnupg_verbose(), recipients_args(keys)]) output = stderr_with_input(cmd, source) return output
def _get_free_gpu(max_gpu_utilization=40, min_free_memory=0.5, num_gpu=1): """Get available GPUs according to utilization thresholds. Args: :max_gpu_utilization: percent utilization threshold to consider a GPU "free" :min_free_memory: percent free memory to consider a GPU "free" :num_gpu: number of req...
def function[_get_free_gpu, parameter[max_gpu_utilization, min_free_memory, num_gpu]]: constant[Get available GPUs according to utilization thresholds. Args: :max_gpu_utilization: percent utilization threshold to consider a GPU "free" :min_free_memory: percent free memory to consider a GPU "free" ...
keyword[def] identifier[_get_free_gpu] ( identifier[max_gpu_utilization] = literal[int] , identifier[min_free_memory] = literal[int] , identifier[num_gpu] = literal[int] ): literal[string] keyword[def] identifier[get_gpu_info] (): identifier[gpu_info] = identifier[subprocess] . identifier[check_output...
def _get_free_gpu(max_gpu_utilization=40, min_free_memory=0.5, num_gpu=1): """Get available GPUs according to utilization thresholds. Args: :max_gpu_utilization: percent utilization threshold to consider a GPU "free" :min_free_memory: percent free memory to consider a GPU "free" :num_gpu: number of r...
def CheckCondition(condition, check_object): """Check if a condition matches an object. Args: condition: A string condition e.g. "os == 'Windows'" check_object: Object to validate, e.g. an rdf_client.KnowledgeBase() Returns: True or False depending on whether the condition matches. Raises: Co...
def function[CheckCondition, parameter[condition, check_object]]: constant[Check if a condition matches an object. Args: condition: A string condition e.g. "os == 'Windows'" check_object: Object to validate, e.g. an rdf_client.KnowledgeBase() Returns: True or False depending on whether the con...
keyword[def] identifier[CheckCondition] ( identifier[condition] , identifier[check_object] ): literal[string] keyword[try] : identifier[of] = identifier[objectfilter] . identifier[Parser] ( identifier[condition] ). identifier[Parse] () identifier[compiled_filter] = identifier[of] . identifier[Compile...
def CheckCondition(condition, check_object): """Check if a condition matches an object. Args: condition: A string condition e.g. "os == 'Windows'" check_object: Object to validate, e.g. an rdf_client.KnowledgeBase() Returns: True or False depending on whether the condition matches. Raises: ...
def acgtn_only(infile, outfile): '''Replace every non-acgtn (case insensitve) character with an N''' f = utils.open_file_write(outfile) for seq in sequences.file_reader(infile): seq.replace_non_acgt() print(seq, file=f) utils.close(f)
def function[acgtn_only, parameter[infile, outfile]]: constant[Replace every non-acgtn (case insensitve) character with an N] variable[f] assign[=] call[name[utils].open_file_write, parameter[name[outfile]]] for taget[name[seq]] in starred[call[name[sequences].file_reader, parameter[name[infile]...
keyword[def] identifier[acgtn_only] ( identifier[infile] , identifier[outfile] ): literal[string] identifier[f] = identifier[utils] . identifier[open_file_write] ( identifier[outfile] ) keyword[for] identifier[seq] keyword[in] identifier[sequences] . identifier[file_reader] ( identifier[infile] ): ...
def acgtn_only(infile, outfile): """Replace every non-acgtn (case insensitve) character with an N""" f = utils.open_file_write(outfile) for seq in sequences.file_reader(infile): seq.replace_non_acgt() print(seq, file=f) # depends on [control=['for'], data=['seq']] utils.close(f)
def data_filler_user_agent(self, number_of_rows, pipe): '''creates keys with user agent data ''' try: for i in range(number_of_rows): pipe.hmset('user_agent:%s' % i, { 'id': rnd_id_generator(self), 'ip': self.faker.ipv4(), ...
def function[data_filler_user_agent, parameter[self, number_of_rows, pipe]]: constant[creates keys with user agent data ] <ast.Try object at 0x7da1b08d9090>
keyword[def] identifier[data_filler_user_agent] ( identifier[self] , identifier[number_of_rows] , identifier[pipe] ): literal[string] keyword[try] : keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[number_of_rows] ): identifier[pipe] . identifi...
def data_filler_user_agent(self, number_of_rows, pipe): """creates keys with user agent data """ try: for i in range(number_of_rows): pipe.hmset('user_agent:%s' % i, {'id': rnd_id_generator(self), 'ip': self.faker.ipv4(), 'countrycode': self.faker.country_code(), 'useragent': self.fa...
def setSpeciesFromJson(self, speciesJson): """ Sets the species, an OntologyTerm, to the specified value, given as a JSON string. See the documentation for details of this field. """ try: parsed = protocol.fromJson(speciesJson, protocol.OntologyTerm) ...
def function[setSpeciesFromJson, parameter[self, speciesJson]]: constant[ Sets the species, an OntologyTerm, to the specified value, given as a JSON string. See the documentation for details of this field. ] <ast.Try object at 0x7da1b26acb80> name[self]._species assi...
keyword[def] identifier[setSpeciesFromJson] ( identifier[self] , identifier[speciesJson] ): literal[string] keyword[try] : identifier[parsed] = identifier[protocol] . identifier[fromJson] ( identifier[speciesJson] , identifier[protocol] . identifier[OntologyTerm] ) keyword[exc...
def setSpeciesFromJson(self, speciesJson): """ Sets the species, an OntologyTerm, to the specified value, given as a JSON string. See the documentation for details of this field. """ try: parsed = protocol.fromJson(speciesJson, protocol.OntologyTerm) # depends on [contr...
def rand_pad(padding:int, size:int, mode:str='reflection'): "Fixed `mode` `padding` and random crop of `size`" return [pad(padding=padding,mode=mode), crop(size=size, **rand_pos)]
def function[rand_pad, parameter[padding, size, mode]]: constant[Fixed `mode` `padding` and random crop of `size`] return[list[[<ast.Call object at 0x7da20e9b2560>, <ast.Call object at 0x7da20e9b0ee0>]]]
keyword[def] identifier[rand_pad] ( identifier[padding] : identifier[int] , identifier[size] : identifier[int] , identifier[mode] : identifier[str] = literal[string] ): literal[string] keyword[return] [ identifier[pad] ( identifier[padding] = identifier[padding] , identifier[mode] = identifier[mode] ), ...
def rand_pad(padding: int, size: int, mode: str='reflection'): """Fixed `mode` `padding` and random crop of `size`""" return [pad(padding=padding, mode=mode), crop(size=size, **rand_pos)]
def process_remove_action(processors, action, argument): """Process action removals.""" for processor in processors: processor(action, argument) db.session.commit()
def function[process_remove_action, parameter[processors, action, argument]]: constant[Process action removals.] for taget[name[processor]] in starred[name[processors]] begin[:] call[name[processor], parameter[name[action], name[argument]]] call[name[db].session.commit, parameter...
keyword[def] identifier[process_remove_action] ( identifier[processors] , identifier[action] , identifier[argument] ): literal[string] keyword[for] identifier[processor] keyword[in] identifier[processors] : identifier[processor] ( identifier[action] , identifier[argument] ) identifier[db] ...
def process_remove_action(processors, action, argument): """Process action removals.""" for processor in processors: processor(action, argument) # depends on [control=['for'], data=['processor']] db.session.commit()
def treePopupWidget(self): """ Returns the popup widget for this record box when it is supposed to be an ORB tree widget. :return <XTreeWidget> """ edit = self.lineEdit() if not self._treePopupWidget: # create the treewidget ...
def function[treePopupWidget, parameter[self]]: constant[ Returns the popup widget for this record box when it is supposed to be an ORB tree widget. :return <XTreeWidget> ] variable[edit] assign[=] call[name[self].lineEdit, parameter[]] if <ast.UnaryO...
keyword[def] identifier[treePopupWidget] ( identifier[self] ): literal[string] identifier[edit] = identifier[self] . identifier[lineEdit] () keyword[if] keyword[not] identifier[self] . identifier[_treePopupWidget] : identifier[tree] = identifier[XTreeWidget] ( ...
def treePopupWidget(self): """ Returns the popup widget for this record box when it is supposed to be an ORB tree widget. :return <XTreeWidget> """ edit = self.lineEdit() if not self._treePopupWidget: # create the treewidget tree = XTreeWidget(self) ...
def setup_db(self, wait_for_ready=True): ''' Create and configure index If `wait_for_ready` is True, this function will block until status for `self.index_name` will be `yellow` ''' if self.es.indices.exists(self.index_name): try: self.update...
def function[setup_db, parameter[self, wait_for_ready]]: constant[ Create and configure index If `wait_for_ready` is True, this function will block until status for `self.index_name` will be `yellow` ] if call[name[self].es.indices.exists, parameter[name[self].index_name...
keyword[def] identifier[setup_db] ( identifier[self] , identifier[wait_for_ready] = keyword[True] ): literal[string] keyword[if] identifier[self] . identifier[es] . identifier[indices] . identifier[exists] ( identifier[self] . identifier[index_name] ): keyword[try] : ...
def setup_db(self, wait_for_ready=True): """ Create and configure index If `wait_for_ready` is True, this function will block until status for `self.index_name` will be `yellow` """ if self.es.indices.exists(self.index_name): try: self.update_mappings() # de...
def update_lan(self, datacenter_id, lan_id, name=None, public=None, ip_failover=None): """ Updates a LAN :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :typ...
def function[update_lan, parameter[self, datacenter_id, lan_id, name, public, ip_failover]]: constant[ Updates a LAN :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :type ...
keyword[def] identifier[update_lan] ( identifier[self] , identifier[datacenter_id] , identifier[lan_id] , identifier[name] = keyword[None] , identifier[public] = keyword[None] , identifier[ip_failover] = keyword[None] ): literal[string] identifier[data] ={} keyword[if] identifier[name] ...
def update_lan(self, datacenter_id, lan_id, name=None, public=None, ip_failover=None): """ Updates a LAN :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param lan_id: The unique ID of the LAN. :type lan_id: ``str``...
def _get_operation_rpc(self): """Polls the status of the current operation. Uses gRPC request to check. :rtype: :class:`~google.longrunning.operations_pb2.Operation` :returns: The latest status of the current operation. """ request_pb = operations_pb2.GetOperationReques...
def function[_get_operation_rpc, parameter[self]]: constant[Polls the status of the current operation. Uses gRPC request to check. :rtype: :class:`~google.longrunning.operations_pb2.Operation` :returns: The latest status of the current operation. ] variable[request_pb] ...
keyword[def] identifier[_get_operation_rpc] ( identifier[self] ): literal[string] identifier[request_pb] = identifier[operations_pb2] . identifier[GetOperationRequest] ( identifier[name] = identifier[self] . identifier[name] ) keyword[return] identifier[self] . identifier[client] . identi...
def _get_operation_rpc(self): """Polls the status of the current operation. Uses gRPC request to check. :rtype: :class:`~google.longrunning.operations_pb2.Operation` :returns: The latest status of the current operation. """ request_pb = operations_pb2.GetOperationRequest(name=s...
def do_ignore(self, arg): """ignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakp...
def function[do_ignore, parameter[self, arg]]: constant[ignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decre...
keyword[def] identifier[do_ignore] ( identifier[self] , identifier[arg] ): literal[string] identifier[args] = identifier[arg] . identifier[split] ( literal[string] , literal[int] ) keyword[try] : identifier[count] = identifier[int] ( identifier[args] [ literal[int] ]. identifi...
def do_ignore(self, arg): """ignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakpoint...
def class_box(self, cn: ClassDefinitionName) -> str: """ Generate a box for the class. Populate its interior only if (a) it hasn't previously been generated and (b) it appears in the gen_classes list @param cn: @param inherited: @return: """ slot_defs: List[str]...
def function[class_box, parameter[self, cn]]: constant[ Generate a box for the class. Populate its interior only if (a) it hasn't previously been generated and (b) it appears in the gen_classes list @param cn: @param inherited: @return: ] <ast.AnnAssign object at 0x...
keyword[def] identifier[class_box] ( identifier[self] , identifier[cn] : identifier[ClassDefinitionName] )-> identifier[str] : literal[string] identifier[slot_defs] : identifier[List] [ identifier[str] ]=[] keyword[if] identifier[cn] keyword[not] keyword[in] identifier[self] . identifi...
def class_box(self, cn: ClassDefinitionName) -> str: """ Generate a box for the class. Populate its interior only if (a) it hasn't previously been generated and (b) it appears in the gen_classes list @param cn: @param inherited: @return: """ slot_defs: List[str] = [] ...
def log_run_info(self, model_name): """Collect most of the TF runtime information for the local env. The schema of the run info follows official/benchmark/datastore/schema. Args: model_name: string, the name of the model. """ run_info = { "model_name": model_name, "machine_co...
def function[log_run_info, parameter[self, model_name]]: constant[Collect most of the TF runtime information for the local env. The schema of the run info follows official/benchmark/datastore/schema. Args: model_name: string, the name of the model. ] variable[run_info] assign[=] dict...
keyword[def] identifier[log_run_info] ( identifier[self] , identifier[model_name] ): literal[string] identifier[run_info] ={ literal[string] : identifier[model_name] , literal[string] :{}, literal[string] : identifier[datetime] . identifier[datetime] . identifier[now] (). identifier[strftime...
def log_run_info(self, model_name): """Collect most of the TF runtime information for the local env. The schema of the run info follows official/benchmark/datastore/schema. Args: model_name: string, the name of the model. """ run_info = {'model_name': model_name, 'machine_config': {}, 'run_d...
def do_GET(self): """ Handle the retrieval of the code """ parsed_url = urlparse(self.path) if parsed_url[2] == "/" + SERVER_REDIRECT_PATH: # 2 = Path parsed_query = parse_qs(parsed_url[4]) # 4 = Query if "code" not in parsed_query: self.send_response(200) self.send_header("Content-Type", "t...
def function[do_GET, parameter[self]]: constant[ Handle the retrieval of the code ] variable[parsed_url] assign[=] call[name[urlparse], parameter[name[self].path]] if compare[call[name[parsed_url]][constant[2]] equal[==] binary_operation[constant[/] + name[SERVER_REDIRECT_PATH]]] begin[:] ...
keyword[def] identifier[do_GET] ( identifier[self] ): literal[string] identifier[parsed_url] = identifier[urlparse] ( identifier[self] . identifier[path] ) keyword[if] identifier[parsed_url] [ literal[int] ]== literal[string] + identifier[SERVER_REDIRECT_PATH] : identifier[parsed_query] = identifier[p...
def do_GET(self): """ Handle the retrieval of the code """ parsed_url = urlparse(self.path) if parsed_url[2] == '/' + SERVER_REDIRECT_PATH: # 2 = Path parsed_query = parse_qs(parsed_url[4]) # 4 = Query if 'code' not in parsed_query: self.send_response(200) self....