code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def _parse_control_fields(self, fields, tag_id="tag"): """ Parse control fields. Args: fields (list): list of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of ...
def function[_parse_control_fields, parameter[self, fields, tag_id]]: constant[ Parse control fields. Args: fields (list): list of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag",...
keyword[def] identifier[_parse_control_fields] ( identifier[self] , identifier[fields] , identifier[tag_id] = literal[string] ): literal[string] keyword[for] identifier[field] keyword[in] identifier[fields] : identifier[params] = identifier[field] . identifier[params] ...
def _parse_control_fields(self, fields, tag_id='tag'): """ Parse control fields. Args: fields (list): list of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of ...
def init(globalvars=None, show=False): """ Load profile INI """ global config profileini = getprofileini() if os.path.exists(profileini): config = configparser.ConfigParser() config.read(profileini) mgr = plugins_get_mgr() mgr.update_configs(config) if s...
def function[init, parameter[globalvars, show]]: constant[ Load profile INI ] <ast.Global object at 0x7da1b008cf40> variable[profileini] assign[=] call[name[getprofileini], parameter[]] if call[name[os].path.exists, parameter[name[profileini]]] begin[:] variable[confi...
keyword[def] identifier[init] ( identifier[globalvars] = keyword[None] , identifier[show] = keyword[False] ): literal[string] keyword[global] identifier[config] identifier[profileini] = identifier[getprofileini] () keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifie...
def init(globalvars=None, show=False): """ Load profile INI """ global config profileini = getprofileini() if os.path.exists(profileini): config = configparser.ConfigParser() config.read(profileini) mgr = plugins_get_mgr() mgr.update_configs(config) if sho...
def on_epoch_end(self, epoch, **kwargs:Any)->None: "Compare the value monitored to its best and maybe reduce lr." current = self.get_monitor_value() if current is None: return if self.operator(current - self.min_delta, self.best): self.best,self.wait = current,0 else: ...
def function[on_epoch_end, parameter[self, epoch]]: constant[Compare the value monitored to its best and maybe reduce lr.] variable[current] assign[=] call[name[self].get_monitor_value, parameter[]] if compare[name[current] is constant[None]] begin[:] return[None] if call[name[se...
keyword[def] identifier[on_epoch_end] ( identifier[self] , identifier[epoch] ,** identifier[kwargs] : identifier[Any] )-> keyword[None] : literal[string] identifier[current] = identifier[self] . identifier[get_monitor_value] () keyword[if] identifier[current] keyword[is] keyword[None] :...
def on_epoch_end(self, epoch, **kwargs: Any) -> None: """Compare the value monitored to its best and maybe reduce lr.""" current = self.get_monitor_value() if current is None: return # depends on [control=['if'], data=[]] if self.operator(current - self.min_delta, self.best): (self.best...
def circuit_to_quirk_url(circuit: circuits.Circuit, prefer_unknown_gate_to_failure: bool=False, escape_url=True) -> str: """Returns a Quirk URL for the given circuit. Args: circuit: The circuit to open in Quirk. prefer_unknown_gate_to_failure: I...
def function[circuit_to_quirk_url, parameter[circuit, prefer_unknown_gate_to_failure, escape_url]]: constant[Returns a Quirk URL for the given circuit. Args: circuit: The circuit to open in Quirk. prefer_unknown_gate_to_failure: If not set, gates that fail to convert will cause ...
keyword[def] identifier[circuit_to_quirk_url] ( identifier[circuit] : identifier[circuits] . identifier[Circuit] , identifier[prefer_unknown_gate_to_failure] : identifier[bool] = keyword[False] , identifier[escape_url] = keyword[True] )-> identifier[str] : literal[string] identifier[circuit] = identifier...
def circuit_to_quirk_url(circuit: circuits.Circuit, prefer_unknown_gate_to_failure: bool=False, escape_url=True) -> str: """Returns a Quirk URL for the given circuit. Args: circuit: The circuit to open in Quirk. prefer_unknown_gate_to_failure: If not set, gates that fail to convert ...
def get_resources_by_bins(self, bin_ids): """Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` is ``null`` raise: ...
def function[get_resources_by_bins, parameter[self, bin_ids]]: constant[Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` i...
keyword[def] identifier[get_resources_by_bins] ( identifier[self] , identifier[bin_ids] ): literal[string] identifier[resource_list] =[] keyword[for] identifier[bin_id] keyword[in] identifier[bin_ids] : identifier[resource_list] += identifier[list] ( ...
def get_resources_by_bins(self, bin_ids): """Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` is ``null`` raise: Oper...
def texture_array(self, size, components, data=None, *, alignment=1, dtype='f1') -> 'TextureArray': ''' Create a :py:class:`TextureArray` object. Args: size (tuple): The ``(width, height, layers)`` of the texture. components (int): The number of component...
def function[texture_array, parameter[self, size, components, data]]: constant[ Create a :py:class:`TextureArray` object. Args: size (tuple): The ``(width, height, layers)`` of the texture. components (int): The number of components 1, 2, 3 or 4. ...
keyword[def] identifier[texture_array] ( identifier[self] , identifier[size] , identifier[components] , identifier[data] = keyword[None] ,*, identifier[alignment] = literal[int] , identifier[dtype] = literal[string] )-> literal[string] : literal[string] identifier[res] = identifier[TextureArray] ....
def texture_array(self, size, components, data=None, *, alignment=1, dtype='f1') -> 'TextureArray': """ Create a :py:class:`TextureArray` object. Args: size (tuple): The ``(width, height, layers)`` of the texture. components (int): The number of components 1,...
def register_plugin_dir(path): """Find plugins in given directory""" import glob for f in glob.glob(path + '/*.py'): for k, v in load_plugins_from_module(f).items(): if k: global_registry[k] = v
def function[register_plugin_dir, parameter[path]]: constant[Find plugins in given directory] import module[glob] for taget[name[f]] in starred[call[name[glob].glob, parameter[binary_operation[name[path] + constant[/*.py]]]]] begin[:] for taget[tuple[[<ast.Name object at 0x7da1b18b76...
keyword[def] identifier[register_plugin_dir] ( identifier[path] ): literal[string] keyword[import] identifier[glob] keyword[for] identifier[f] keyword[in] identifier[glob] . identifier[glob] ( identifier[path] + literal[string] ): keyword[for] identifier[k] , identifier[v] keyword[in] ...
def register_plugin_dir(path): """Find plugins in given directory""" import glob for f in glob.glob(path + '/*.py'): for (k, v) in load_plugins_from_module(f).items(): if k: global_registry[k] = v # depends on [control=['if'], data=[]] # depends on [control=['for'], dat...
def load(schema, uri=None, spec=None, provider=None): """Scaffold a validator against a schema. :param schema: the schema to compile into a Validator :type schema: Mapping :param uri: the uri of the schema. it may be ignored in case of not cross referencing. :type ur...
def function[load, parameter[schema, uri, spec, provider]]: constant[Scaffold a validator against a schema. :param schema: the schema to compile into a Validator :type schema: Mapping :param uri: the uri of the schema. it may be ignored in case of not cross referenci...
keyword[def] identifier[load] ( identifier[schema] , identifier[uri] = keyword[None] , identifier[spec] = keyword[None] , identifier[provider] = keyword[None] ): literal[string] identifier[factory] = identifier[Factory] ( identifier[provider] , identifier[spec] ) keyword[return] identifier[factory] (...
def load(schema, uri=None, spec=None, provider=None): """Scaffold a validator against a schema. :param schema: the schema to compile into a Validator :type schema: Mapping :param uri: the uri of the schema. it may be ignored in case of not cross referencing. :type ur...
def _parse_canonical_minkey(doc): """Decode a JSON MinKey to bson.min_key.MinKey.""" if doc['$minKey'] is not 1: raise TypeError('$minKey value must be 1: %s' % (doc,)) if len(doc) != 1: raise TypeError('Bad $minKey, extra field(s): %s' % (doc,)) return MinKey()
def function[_parse_canonical_minkey, parameter[doc]]: constant[Decode a JSON MinKey to bson.min_key.MinKey.] if compare[call[name[doc]][constant[$minKey]] is_not constant[1]] begin[:] <ast.Raise object at 0x7da18f00c400> if compare[call[name[len], parameter[name[doc]]] not_equal[!=] con...
keyword[def] identifier[_parse_canonical_minkey] ( identifier[doc] ): literal[string] keyword[if] identifier[doc] [ literal[string] ] keyword[is] keyword[not] literal[int] : keyword[raise] identifier[TypeError] ( literal[string] %( identifier[doc] ,)) keyword[if] identifier[len] ( identi...
def _parse_canonical_minkey(doc): """Decode a JSON MinKey to bson.min_key.MinKey.""" if doc['$minKey'] is not 1: raise TypeError('$minKey value must be 1: %s' % (doc,)) # depends on [control=['if'], data=[]] if len(doc) != 1: raise TypeError('Bad $minKey, extra field(s): %s' % (doc,)) # de...
def calcHumWealthAndBoundingMPCs(self): ''' Calculates human wealth and the maximum and minimum MPC for each current period state, then stores them as attributes of self for use by other methods. Parameters ---------- none Returns ------- none ...
def function[calcHumWealthAndBoundingMPCs, parameter[self]]: constant[ Calculates human wealth and the maximum and minimum MPC for each current period state, then stores them as attributes of self for use by other methods. Parameters ---------- none Returns ...
keyword[def] identifier[calcHumWealthAndBoundingMPCs] ( identifier[self] ): literal[string] identifier[WorstIncPrb_array] = identifier[self] . identifier[BoroCnstDependency] * identifier[np] . identifier[tile] ( identifier[np] . identifier[reshape] ( identifier[self] . identifier[WorstIncP...
def calcHumWealthAndBoundingMPCs(self): """ Calculates human wealth and the maximum and minimum MPC for each current period state, then stores them as attributes of self for use by other methods. Parameters ---------- none Returns ------- none ...
def handle_check(self, command, **options): """Check your settings for common misconfigurations""" passed = True client = DjangoClient(metrics_interval="0ms") def is_set(x): return x and x != "None" # check if org/app is set: if is_set(client.config.service_...
def function[handle_check, parameter[self, command]]: constant[Check your settings for common misconfigurations] variable[passed] assign[=] constant[True] variable[client] assign[=] call[name[DjangoClient], parameter[]] def function[is_set, parameter[x]]: return[<ast.BoolOp objec...
keyword[def] identifier[handle_check] ( identifier[self] , identifier[command] ,** identifier[options] ): literal[string] identifier[passed] = keyword[True] identifier[client] = identifier[DjangoClient] ( identifier[metrics_interval] = literal[string] ) keyword[def] identifier[...
def handle_check(self, command, **options): """Check your settings for common misconfigurations""" passed = True client = DjangoClient(metrics_interval='0ms') def is_set(x): return x and x != 'None' # check if org/app is set: if is_set(client.config.service_name): self.write('Se...
def export_saved_model(self, sess, export_dir, tag_set, signatures): """Convenience function to access ``TFNode.export_saved_model`` directly from this object instance.""" TFNode.export_saved_model(sess, export_dir, tag_set, signatures)
def function[export_saved_model, parameter[self, sess, export_dir, tag_set, signatures]]: constant[Convenience function to access ``TFNode.export_saved_model`` directly from this object instance.] call[name[TFNode].export_saved_model, parameter[name[sess], name[export_dir], name[tag_set], name[signature...
keyword[def] identifier[export_saved_model] ( identifier[self] , identifier[sess] , identifier[export_dir] , identifier[tag_set] , identifier[signatures] ): literal[string] identifier[TFNode] . identifier[export_saved_model] ( identifier[sess] , identifier[export_dir] , identifier[tag_set] , identifier[sig...
def export_saved_model(self, sess, export_dir, tag_set, signatures): """Convenience function to access ``TFNode.export_saved_model`` directly from this object instance.""" TFNode.export_saved_model(sess, export_dir, tag_set, signatures)
def addStyle(w): """ Styles the GUI: global fonts and colours. Parameters ---------- w : tkinter.tk widget element to style """ # access global container in root widget root = get_root(w) g = root.globals fsize = g.cpars['font_size'] family = g.cpars['font_family'] ...
def function[addStyle, parameter[w]]: constant[ Styles the GUI: global fonts and colours. Parameters ---------- w : tkinter.tk widget element to style ] variable[root] assign[=] call[name[get_root], parameter[name[w]]] variable[g] assign[=] name[root].globals ...
keyword[def] identifier[addStyle] ( identifier[w] ): literal[string] identifier[root] = identifier[get_root] ( identifier[w] ) identifier[g] = identifier[root] . identifier[globals] identifier[fsize] = identifier[g] . identifier[cpars] [ literal[string] ] identifier[family] = identifie...
def addStyle(w): """ Styles the GUI: global fonts and colours. Parameters ---------- w : tkinter.tk widget element to style """ # access global container in root widget root = get_root(w) g = root.globals fsize = g.cpars['font_size'] family = g.cpars['font_family'] ...
def electric_field_amplitude_intensity(s0, Isat=16.6889462814, Omega=1e6, units="ad-hoc"): """Return the amplitude of the electric field for saturation parameter. This is at a given saturation parameter s0=I/Isat, where I0 is by default \ Isat=16.6889462814 m/m^2 is ...
def function[electric_field_amplitude_intensity, parameter[s0, Isat, Omega, units]]: constant[Return the amplitude of the electric field for saturation parameter. This is at a given saturation parameter s0=I/Isat, where I0 is by default Isat=16.6889462814 m/m^2 is the saturation intensity of the D2 line of...
keyword[def] identifier[electric_field_amplitude_intensity] ( identifier[s0] , identifier[Isat] = literal[int] , identifier[Omega] = literal[int] , identifier[units] = literal[string] ): literal[string] identifier[E0_sat] = identifier[sqrt] ( literal[int] * identifier[mu0] * identifier[c] * identifier[...
def electric_field_amplitude_intensity(s0, Isat=16.6889462814, Omega=1000000.0, units='ad-hoc'): """Return the amplitude of the electric field for saturation parameter. This is at a given saturation parameter s0=I/Isat, where I0 is by default Isat=16.6889462814 m/m^2 is the saturation intensity of the D2 line ...
def CopyToDatetime(cls, timestamp, timezone, raise_error=False): """Copies the timestamp to a datetime object. Args: timestamp: The timestamp which is an integer containing the number of micro seconds since January 1, 1970, 00:00:00 UTC. timezone: The timezone (pytz.timezone) objec...
def function[CopyToDatetime, parameter[cls, timestamp, timezone, raise_error]]: constant[Copies the timestamp to a datetime object. Args: timestamp: The timestamp which is an integer containing the number of micro seconds since January 1, 1970, 00:00:00 UTC. timezone: The timez...
keyword[def] identifier[CopyToDatetime] ( identifier[cls] , identifier[timestamp] , identifier[timezone] , identifier[raise_error] = keyword[False] ): literal[string] identifier[datetime_object] = identifier[datetime] . identifier[datetime] ( literal[int] , literal[int] , literal[int] , literal[int] , lite...
def CopyToDatetime(cls, timestamp, timezone, raise_error=False): """Copies the timestamp to a datetime object. Args: timestamp: The timestamp which is an integer containing the number of micro seconds since January 1, 1970, 00:00:00 UTC. timezone: The timezone (pytz.timezone) objec...
def _print_formatted_docstring(self, docstring, f): """Formats the given `docstring` as Markdown and prints it to `f`.""" lines = self._remove_docstring_indent(docstring) # Output the lines, identifying "Args" and other section blocks. i = 0 def _at_start_of_section(): """Returns the header ...
def function[_print_formatted_docstring, parameter[self, docstring, f]]: constant[Formats the given `docstring` as Markdown and prints it to `f`.] variable[lines] assign[=] call[name[self]._remove_docstring_indent, parameter[name[docstring]]] variable[i] assign[=] constant[0] def functio...
keyword[def] identifier[_print_formatted_docstring] ( identifier[self] , identifier[docstring] , identifier[f] ): literal[string] identifier[lines] = identifier[self] . identifier[_remove_docstring_indent] ( identifier[docstring] ) identifier[i] = literal[int] keyword[def] identifier[_at...
def _print_formatted_docstring(self, docstring, f): """Formats the given `docstring` as Markdown and prints it to `f`.""" lines = self._remove_docstring_indent(docstring) # Output the lines, identifying "Args" and other section blocks. i = 0 def _at_start_of_section(): """Returns the header...
def upload_files(self, source_paths, dir_name=None): '''批量创建上传任务, 会扫描子目录并依次上传. source_path - 本地文件的绝对路径 dir_name - 文件在服务器上的父目录, 如果为None的话, 会弹出一个 对话框让用户来选择一个目录. ''' def scan_folders(folder_path): file_list = os.listdir(folder_path) ...
def function[upload_files, parameter[self, source_paths, dir_name]]: constant[批量创建上传任务, 会扫描子目录并依次上传. source_path - 本地文件的绝对路径 dir_name - 文件在服务器上的父目录, 如果为None的话, 会弹出一个 对话框让用户来选择一个目录. ] def function[scan_folders, parameter[folder_path]]: var...
keyword[def] identifier[upload_files] ( identifier[self] , identifier[source_paths] , identifier[dir_name] = keyword[None] ): literal[string] keyword[def] identifier[scan_folders] ( identifier[folder_path] ): identifier[file_list] = identifier[os] . identifier[listdir] ( identifier[fo...
def upload_files(self, source_paths, dir_name=None): """批量创建上传任务, 会扫描子目录并依次上传. source_path - 本地文件的绝对路径 dir_name - 文件在服务器上的父目录, 如果为None的话, 会弹出一个 对话框让用户来选择一个目录. """ def scan_folders(folder_path): file_list = os.listdir(folder_path) source_paths = ...
def add_mag_drifts(inst): """Adds ion drifts in magnetic coordinates using ion drifts in S/C coordinates along with pre-calculated unit vectors for magnetic coordinates. Note ---- Requires ion drifts under labels 'iv_*' where * = (x,y,z) along with unit vectors labels 'unit_zonal_*'...
def function[add_mag_drifts, parameter[inst]]: constant[Adds ion drifts in magnetic coordinates using ion drifts in S/C coordinates along with pre-calculated unit vectors for magnetic coordinates. Note ---- Requires ion drifts under labels 'iv_*' where * = (x,y,z) along with uni...
keyword[def] identifier[add_mag_drifts] ( identifier[inst] ): literal[string] identifier[inst] [ literal[string] ]={ literal[string] : identifier[inst] [ literal[string] ]* identifier[inst] [ literal[string] ]+ identifier[inst] [ literal[string] ]* identifier[inst] [ literal[string] ]+ identifier[inst] [ ...
def add_mag_drifts(inst): """Adds ion drifts in magnetic coordinates using ion drifts in S/C coordinates along with pre-calculated unit vectors for magnetic coordinates. Note ---- Requires ion drifts under labels 'iv_*' where * = (x,y,z) along with unit vectors labels 'unit_zonal_*'...
def draw_annulus(self, center, inner_radius, outer_radius, array, value, mode="set"): """ Draws an annulus of specified radius on the input array and fills it with specified value :param center: a tuple for the center of the annulus :type center: tuple (x,y) :param inner_radius: ...
def function[draw_annulus, parameter[self, center, inner_radius, outer_radius, array, value, mode]]: constant[ Draws an annulus of specified radius on the input array and fills it with specified value :param center: a tuple for the center of the annulus :type center: tuple (x,y) ...
keyword[def] identifier[draw_annulus] ( identifier[self] , identifier[center] , identifier[inner_radius] , identifier[outer_radius] , identifier[array] , identifier[value] , identifier[mode] = literal[string] ): literal[string] keyword[if] identifier[mode] == literal[string] : identif...
def draw_annulus(self, center, inner_radius, outer_radius, array, value, mode='set'): """ Draws an annulus of specified radius on the input array and fills it with specified value :param center: a tuple for the center of the annulus :type center: tuple (x,y) :param inner_radius: how ...
def get_field_identifier(self): """ Return the lag/lead function with the offset and default value """ if self.default is None: return '{0}, {1}'.format(self.field.get_select_sql(), self.offset) return "{0}, {1}, '{2}'".format(self.field.get_select_sql(), self.offset,...
def function[get_field_identifier, parameter[self]]: constant[ Return the lag/lead function with the offset and default value ] if compare[name[self].default is constant[None]] begin[:] return[call[constant[{0}, {1}].format, parameter[call[name[self].field.get_select_sql, paramet...
keyword[def] identifier[get_field_identifier] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[default] keyword[is] keyword[None] : keyword[return] literal[string] . identifier[format] ( identifier[self] . identifier[field] . identifier[get_select_sql...
def get_field_identifier(self): """ Return the lag/lead function with the offset and default value """ if self.default is None: return '{0}, {1}'.format(self.field.get_select_sql(), self.offset) # depends on [control=['if'], data=[]] return "{0}, {1}, '{2}'".format(self.field.get_se...
def stop(self): """ Stop the worker. """ if self._http_server is not None: self._http_server.stop() tornado.ioloop.IOLoop.instance().add_callback( tornado.ioloop.IOLoop.instance().stop)
def function[stop, parameter[self]]: constant[ Stop the worker. ] if compare[name[self]._http_server is_not constant[None]] begin[:] call[name[self]._http_server.stop, parameter[]] call[call[name[tornado].ioloop.IOLoop.instance, parameter[]].add_callback, paramete...
keyword[def] identifier[stop] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_http_server] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[_http_server] . identifier[stop] () identifier[tornado] . identifier[ioloop] ....
def stop(self): """ Stop the worker. """ if self._http_server is not None: self._http_server.stop() # depends on [control=['if'], data=[]] tornado.ioloop.IOLoop.instance().add_callback(tornado.ioloop.IOLoop.instance().stop)
def _get_values(self, rdn): """ Returns a dict of prepped values contained in an RDN :param rdn: A RelativeDistinguishedName object :return: A dict object with unicode strings of NameTypeAndValue value field values that have been prepped for comparis...
def function[_get_values, parameter[self, rdn]]: constant[ Returns a dict of prepped values contained in an RDN :param rdn: A RelativeDistinguishedName object :return: A dict object with unicode strings of NameTypeAndValue value field values that hav...
keyword[def] identifier[_get_values] ( identifier[self] , identifier[rdn] ): literal[string] identifier[output] ={} [ identifier[output] . identifier[update] ([( identifier[ntv] [ literal[string] ]. identifier[native] , identifier[ntv] . identifier[prepped_value] )]) keyword[for] identifi...
def _get_values(self, rdn): """ Returns a dict of prepped values contained in an RDN :param rdn: A RelativeDistinguishedName object :return: A dict object with unicode strings of NameTypeAndValue value field values that have been prepped for comparison ...
def uses_placeholder_y(ds): """If ``ds`` is a ``skorch.dataset.Dataset`` or a ``skorch.dataset.Dataset`` nested inside a ``torch.utils.data.Subset`` and uses y as a placeholder, return ``True``.""" if isinstance(ds, torch.utils.data.Subset): return uses_placeholder_y(ds.dataset) return ...
def function[uses_placeholder_y, parameter[ds]]: constant[If ``ds`` is a ``skorch.dataset.Dataset`` or a ``skorch.dataset.Dataset`` nested inside a ``torch.utils.data.Subset`` and uses y as a placeholder, return ``True``.] if call[name[isinstance], parameter[name[ds], name[torch].utils.data....
keyword[def] identifier[uses_placeholder_y] ( identifier[ds] ): literal[string] keyword[if] identifier[isinstance] ( identifier[ds] , identifier[torch] . identifier[utils] . identifier[data] . identifier[Subset] ): keyword[return] identifier[uses_placeholder_y] ( identifier[ds] . identifier[dat...
def uses_placeholder_y(ds): """If ``ds`` is a ``skorch.dataset.Dataset`` or a ``skorch.dataset.Dataset`` nested inside a ``torch.utils.data.Subset`` and uses y as a placeholder, return ``True``.""" if isinstance(ds, torch.utils.data.Subset): return uses_placeholder_y(ds.dataset) # depends o...
def decorator(caller, func=None): """ decorator(caller) converts a caller function into a decorator; decorator(caller, func) decorates a function using a caller. """ if func is not None: # returns a decorated function evaldict = func.func_globals.copy() evaldict['_call_'] = caller ...
def function[decorator, parameter[caller, func]]: constant[ decorator(caller) converts a caller function into a decorator; decorator(caller, func) decorates a function using a caller. ] if compare[name[func] is_not constant[None]] begin[:] variable[evaldict] assign[=] call[na...
keyword[def] identifier[decorator] ( identifier[caller] , identifier[func] = keyword[None] ): literal[string] keyword[if] identifier[func] keyword[is] keyword[not] keyword[None] : identifier[evaldict] = identifier[func] . identifier[func_globals] . identifier[copy] () identifier[evald...
def decorator(caller, func=None): """ decorator(caller) converts a caller function into a decorator; decorator(caller, func) decorates a function using a caller. """ if func is not None: # returns a decorated function evaldict = func.func_globals.copy() evaldict['_call_'] = caller ...
def subdomain_try_insert(self, cursor, subdomain_rec, history_neighbors): """ Try to insert a subdomain record into its history neighbors. This is an optimization that handles the "usual" case. We can do this without having to rewrite this subdomain's past and future if (1) we c...
def function[subdomain_try_insert, parameter[self, cursor, subdomain_rec, history_neighbors]]: constant[ Try to insert a subdomain record into its history neighbors. This is an optimization that handles the "usual" case. We can do this without having to rewrite this subdomain's past and...
keyword[def] identifier[subdomain_try_insert] ( identifier[self] , identifier[cursor] , identifier[subdomain_rec] , identifier[history_neighbors] ): literal[string] identifier[blockchain_order] = identifier[history_neighbors] [ literal[string] ]+ identifier[history_neighbors] [ literal[string] ]+ i...
def subdomain_try_insert(self, cursor, subdomain_rec, history_neighbors): """ Try to insert a subdomain record into its history neighbors. This is an optimization that handles the "usual" case. We can do this without having to rewrite this subdomain's past and future if (1) we can f...
def decamelise(text): """Convert CamelCase to lower_and_underscore.""" s = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s).lower()
def function[decamelise, parameter[text]]: constant[Convert CamelCase to lower_and_underscore.] variable[s] assign[=] call[name[re].sub, parameter[constant[(.)([A-Z][a-z]+)], constant[\1_\2], name[text]]] return[call[call[name[re].sub, parameter[constant[([a-z0-9])([A-Z])], constant[\1_\2], name[s]]...
keyword[def] identifier[decamelise] ( identifier[text] ): literal[string] identifier[s] = identifier[re] . identifier[sub] ( literal[string] , literal[string] , identifier[text] ) keyword[return] identifier[re] . identifier[sub] ( literal[string] , literal[string] , identifier[s] ). identifier[lower]...
def decamelise(text): """Convert CamelCase to lower_and_underscore.""" s = re.sub('(.)([A-Z][a-z]+)', '\\1_\\2', text) return re.sub('([a-z0-9])([A-Z])', '\\1_\\2', s).lower()
def log_y_cb(self, w, val): """Toggle linear/log scale for Y-axis.""" self.tab_plot.logy = val self.plot_two_columns()
def function[log_y_cb, parameter[self, w, val]]: constant[Toggle linear/log scale for Y-axis.] name[self].tab_plot.logy assign[=] name[val] call[name[self].plot_two_columns, parameter[]]
keyword[def] identifier[log_y_cb] ( identifier[self] , identifier[w] , identifier[val] ): literal[string] identifier[self] . identifier[tab_plot] . identifier[logy] = identifier[val] identifier[self] . identifier[plot_two_columns] ()
def log_y_cb(self, w, val): """Toggle linear/log scale for Y-axis.""" self.tab_plot.logy = val self.plot_two_columns()
def remove_triple(self, p, o, auto_refresh=True): ''' remove triple by supplying p,o Args: p (rdflib.term.URIRef): predicate o (): object auto_refresh (bool): whether or not to update object-like self.rdf.triples Returns: None: removes triple from self.rdf.graph ''' self.rdf.graph.remove((se...
def function[remove_triple, parameter[self, p, o, auto_refresh]]: constant[ remove triple by supplying p,o Args: p (rdflib.term.URIRef): predicate o (): object auto_refresh (bool): whether or not to update object-like self.rdf.triples Returns: None: removes triple from self.rdf.graph ] ...
keyword[def] identifier[remove_triple] ( identifier[self] , identifier[p] , identifier[o] , identifier[auto_refresh] = keyword[True] ): literal[string] identifier[self] . identifier[rdf] . identifier[graph] . identifier[remove] (( identifier[self] . identifier[uri] , identifier[p] , identifier[self] . identi...
def remove_triple(self, p, o, auto_refresh=True): """ remove triple by supplying p,o Args: p (rdflib.term.URIRef): predicate o (): object auto_refresh (bool): whether or not to update object-like self.rdf.triples Returns: None: removes triple from self.rdf.graph """ self.rdf.graph.remove((...
def iterate_chunks(i, size=10): """ Iterate over an iterator ``i`` in ``size`` chunks, yield chunks. Similar to pagination. Example:: >>> list(iterate_chunks([1, 2, 3, 4], size=2)) [[1, 2], [3, 4]] """ accumulator = [] for n, i in enumerate(i): accumulator.append(i...
def function[iterate_chunks, parameter[i, size]]: constant[ Iterate over an iterator ``i`` in ``size`` chunks, yield chunks. Similar to pagination. Example:: >>> list(iterate_chunks([1, 2, 3, 4], size=2)) [[1, 2], [3, 4]] ] variable[accumulator] assign[=] list[[]] ...
keyword[def] identifier[iterate_chunks] ( identifier[i] , identifier[size] = literal[int] ): literal[string] identifier[accumulator] =[] keyword[for] identifier[n] , identifier[i] keyword[in] identifier[enumerate] ( identifier[i] ): identifier[accumulator] . identifier[append] ( identifie...
def iterate_chunks(i, size=10): """ Iterate over an iterator ``i`` in ``size`` chunks, yield chunks. Similar to pagination. Example:: >>> list(iterate_chunks([1, 2, 3, 4], size=2)) [[1, 2], [3, 4]] """ accumulator = [] for (n, i) in enumerate(i): accumulator.append(...
def set_quickchart_resource(self, resource): # type: (Union[hdx.data.resource.Resource,Dict,str,int]) -> bool """Set the resource that will be used for displaying QuickCharts in dataset preview Args: resource (Union[hdx.data.resource.Resource,Dict,str,int]): Either resource id or na...
def function[set_quickchart_resource, parameter[self, resource]]: constant[Set the resource that will be used for displaying QuickCharts in dataset preview Args: resource (Union[hdx.data.resource.Resource,Dict,str,int]): Either resource id or name, resource metadata from a Resource object o...
keyword[def] identifier[set_quickchart_resource] ( identifier[self] , identifier[resource] ): literal[string] keyword[if] identifier[isinstance] ( identifier[resource] , identifier[int] ) keyword[and] keyword[not] identifier[isinstance] ( identifier[resource] , identifier[bool] ): ...
def set_quickchart_resource(self, resource): # type: (Union[hdx.data.resource.Resource,Dict,str,int]) -> bool 'Set the resource that will be used for displaying QuickCharts in dataset preview\n\n Args:\n resource (Union[hdx.data.resource.Resource,Dict,str,int]): Either resource id or name, res...
def backend(): """ :return: A unicode string of the backend being used: "openssl", "osx", "win", "winlegacy" """ if _module_values['backend'] is not None: return _module_values['backend'] with _backend_lock: if _module_values['backend'] is not None: retu...
def function[backend, parameter[]]: constant[ :return: A unicode string of the backend being used: "openssl", "osx", "win", "winlegacy" ] if compare[call[name[_module_values]][constant[backend]] is_not constant[None]] begin[:] return[call[name[_module_values]][constant[ba...
keyword[def] identifier[backend] (): literal[string] keyword[if] identifier[_module_values] [ literal[string] ] keyword[is] keyword[not] keyword[None] : keyword[return] identifier[_module_values] [ literal[string] ] keyword[with] identifier[_backend_lock] : keyword[if] identi...
def backend(): """ :return: A unicode string of the backend being used: "openssl", "osx", "win", "winlegacy" """ if _module_values['backend'] is not None: return _module_values['backend'] # depends on [control=['if'], data=[]] with _backend_lock: if _module_values['b...
def write_data(self, buf): """Send data to the device. If the write fails for any reason, an :obj:`IOError` exception is raised. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool """ bmRequestType = usb....
def function[write_data, parameter[self, buf]]: constant[Send data to the device. If the write fails for any reason, an :obj:`IOError` exception is raised. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool ] ...
keyword[def] identifier[write_data] ( identifier[self] , identifier[buf] ): literal[string] identifier[bmRequestType] = identifier[usb] . identifier[util] . identifier[build_request_type] ( identifier[usb] . identifier[util] . identifier[ENDPOINT_OUT] , identifier[usb] . identifie...
def write_data(self, buf): """Send data to the device. If the write fails for any reason, an :obj:`IOError` exception is raised. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool """ bmRequestType = usb.util.bui...
def fill_from_simbad (self, ident, debug=False): """Fill in astrometric information using the Simbad web service. This uses the CDS Simbad web service to look up astrometric information for the source name *ident* and fills in attributes appropriately. Values from Simbad are not always ...
def function[fill_from_simbad, parameter[self, ident, debug]]: constant[Fill in astrometric information using the Simbad web service. This uses the CDS Simbad web service to look up astrometric information for the source name *ident* and fills in attributes appropriately. Values from Si...
keyword[def] identifier[fill_from_simbad] ( identifier[self] , identifier[ident] , identifier[debug] = keyword[False] ): literal[string] identifier[info] = identifier[get_simbad_astrometry_info] ( identifier[ident] , identifier[debug] = identifier[debug] ) identifier[posref] = literal[stri...
def fill_from_simbad(self, ident, debug=False): """Fill in astrometric information using the Simbad web service. This uses the CDS Simbad web service to look up astrometric information for the source name *ident* and fills in attributes appropriately. Values from Simbad are not always relia...
def disable_validation(self, field_name): """Disable the validation rules for a field""" field = self.field_dict.get(field_name) if not field: raise exceptions.FieldNotFound('Field not found: \'%s\' when trying to disable validation' % field_name) field.validators =...
def function[disable_validation, parameter[self, field_name]]: constant[Disable the validation rules for a field] variable[field] assign[=] call[name[self].field_dict.get, parameter[name[field_name]]] if <ast.UnaryOp object at 0x7da1b236ad70> begin[:] <ast.Raise object at 0x7da1b236bdf0>...
keyword[def] identifier[disable_validation] ( identifier[self] , identifier[field_name] ): literal[string] identifier[field] = identifier[self] . identifier[field_dict] . identifier[get] ( identifier[field_name] ) keyword[if] keyword[not] identifier[field] : keyword[raise] ...
def disable_validation(self, field_name): """Disable the validation rules for a field""" field = self.field_dict.get(field_name) if not field: raise exceptions.FieldNotFound("Field not found: '%s' when trying to disable validation" % field_name) # depends on [control=['if'], data=[]] field.vali...
def enable_pow_mining(chain_class: Type[BaseChain]) -> Type[BaseChain]: """ Inject on demand generation of the proof of work mining seal on newly mined blocks into each of the chain's vms. """ if not chain_class.vm_configuration: raise ValidationError("Chain class has no vm_configuration") ...
def function[enable_pow_mining, parameter[chain_class]]: constant[ Inject on demand generation of the proof of work mining seal on newly mined blocks into each of the chain's vms. ] if <ast.UnaryOp object at 0x7da1b1645000> begin[:] <ast.Raise object at 0x7da1b1646440> variab...
keyword[def] identifier[enable_pow_mining] ( identifier[chain_class] : identifier[Type] [ identifier[BaseChain] ])-> identifier[Type] [ identifier[BaseChain] ]: literal[string] keyword[if] keyword[not] identifier[chain_class] . identifier[vm_configuration] : keyword[raise] identifier[Validation...
def enable_pow_mining(chain_class: Type[BaseChain]) -> Type[BaseChain]: """ Inject on demand generation of the proof of work mining seal on newly mined blocks into each of the chain's vms. """ if not chain_class.vm_configuration: raise ValidationError('Chain class has no vm_configuration') ...
def release_role(name, rawtext, text, lineno, inliner, options={}, content=[]): """ Invoked as :release:`N.N.N <YYYY-MM-DD>`. Turns into useful release header + link to GH tree for the tag. """ # Make sure year has been specified match = year_arg_re.match(text) if not match: msg = i...
def function[release_role, parameter[name, rawtext, text, lineno, inliner, options, content]]: constant[ Invoked as :release:`N.N.N <YYYY-MM-DD>`. Turns into useful release header + link to GH tree for the tag. ] variable[match] assign[=] call[name[year_arg_re].match, parameter[name[text]]]...
keyword[def] identifier[release_role] ( identifier[name] , identifier[rawtext] , identifier[text] , identifier[lineno] , identifier[inliner] , identifier[options] ={}, identifier[content] =[]): literal[string] identifier[match] = identifier[year_arg_re] . identifier[match] ( identifier[text] ) ke...
def release_role(name, rawtext, text, lineno, inliner, options={}, content=[]): """ Invoked as :release:`N.N.N <YYYY-MM-DD>`. Turns into useful release header + link to GH tree for the tag. """ # Make sure year has been specified match = year_arg_re.match(text) if not match: msg = i...
def rollback(gandi, resource, background): """ Rollback a disk from a snapshot. """ result = gandi.disk.rollback(resource, background) if background: gandi.pretty_echo(result) return result
def function[rollback, parameter[gandi, resource, background]]: constant[ Rollback a disk from a snapshot. ] variable[result] assign[=] call[name[gandi].disk.rollback, parameter[name[resource], name[background]]] if name[background] begin[:] call[name[gandi].pretty_echo, paramete...
keyword[def] identifier[rollback] ( identifier[gandi] , identifier[resource] , identifier[background] ): literal[string] identifier[result] = identifier[gandi] . identifier[disk] . identifier[rollback] ( identifier[resource] , identifier[background] ) keyword[if] identifier[background] : id...
def rollback(gandi, resource, background): """ Rollback a disk from a snapshot. """ result = gandi.disk.rollback(resource, background) if background: gandi.pretty_echo(result) # depends on [control=['if'], data=[]] return result
def upload(self,project, inputtemplate, sourcefile, **kwargs): """Alias for ``addinputfile()``""" return self.addinputfile(project, inputtemplate,sourcefile, **kwargs)
def function[upload, parameter[self, project, inputtemplate, sourcefile]]: constant[Alias for ``addinputfile()``] return[call[name[self].addinputfile, parameter[name[project], name[inputtemplate], name[sourcefile]]]]
keyword[def] identifier[upload] ( identifier[self] , identifier[project] , identifier[inputtemplate] , identifier[sourcefile] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[addinputfile] ( identifier[project] , identifier[inputtemplate] , identifier[sourcef...
def upload(self, project, inputtemplate, sourcefile, **kwargs): """Alias for ``addinputfile()``""" return self.addinputfile(project, inputtemplate, sourcefile, **kwargs)
def jwt_verify_token(headers): """Verify the JWT token. :param dict headers: The request headers. :returns: The token data. :rtype: dict """ # Get the token from headers token = headers.get( current_app.config['OAUTH2SERVER_JWT_AUTH_HEADER'] ) if token is None: raise...
def function[jwt_verify_token, parameter[headers]]: constant[Verify the JWT token. :param dict headers: The request headers. :returns: The token data. :rtype: dict ] variable[token] assign[=] call[name[headers].get, parameter[call[name[current_app].config][constant[OAUTH2SERVER_JWT_AUTH...
keyword[def] identifier[jwt_verify_token] ( identifier[headers] ): literal[string] identifier[token] = identifier[headers] . identifier[get] ( identifier[current_app] . identifier[config] [ literal[string] ] ) keyword[if] identifier[token] keyword[is] keyword[None] : keyword[...
def jwt_verify_token(headers): """Verify the JWT token. :param dict headers: The request headers. :returns: The token data. :rtype: dict """ # Get the token from headers token = headers.get(current_app.config['OAUTH2SERVER_JWT_AUTH_HEADER']) if token is None: raise JWTInvalidHea...
def updateReferencedFile(self, pid, path, name, ref_url): """Deprecated, use updateReferenceURL. Update a Referenced Content File (.url) :param pid: The HydroShare ID of the resource for which the file should be updated :param path: Folder path for the file to be updated in ...
def function[updateReferencedFile, parameter[self, pid, path, name, ref_url]]: constant[Deprecated, use updateReferenceURL. Update a Referenced Content File (.url) :param pid: The HydroShare ID of the resource for which the file should be updated :param path: Folder path for the...
keyword[def] identifier[updateReferencedFile] ( identifier[self] , identifier[pid] , identifier[path] , identifier[name] , identifier[ref_url] ): literal[string] identifier[url] = literal[string] . identifier[format] ( identifier[url_base] = identifier[self] . identifier[url_base] ) iden...
def updateReferencedFile(self, pid, path, name, ref_url): """Deprecated, use updateReferenceURL. Update a Referenced Content File (.url) :param pid: The HydroShare ID of the resource for which the file should be updated :param path: Folder path for the file to be updated in ...
def delete_profile(hostname, username, password, profile_type, name): ''' A function to connect to a bigip device and delete an existing profile. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profile...
def function[delete_profile, parameter[hostname, username, password, profile_type, name]]: constant[ A function to connect to a bigip device and delete an existing profile. hostname The host/address of the bigip device username The iControl REST username password The iCo...
keyword[def] identifier[delete_profile] ( identifier[hostname] , identifier[username] , identifier[password] , identifier[profile_type] , identifier[name] ): literal[string] identifier[bigip_session] = identifier[_build_session] ( identifier[username] , identifier[password] ) keyword[try] ...
def delete_profile(hostname, username, password, profile_type, name): """ A function to connect to a bigip device and delete an existing profile. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password profile...
def get_references(basis_name, elements=None, version=None, fmt=None, data_dir=None): '''Get the references/citations for a basis set Parameters ---------- basis_name : str Name of the basis set. This is not case sensitive. elements : list List of element numbers that you want the b...
def function[get_references, parameter[basis_name, elements, version, fmt, data_dir]]: constant[Get the references/citations for a basis set Parameters ---------- basis_name : str Name of the basis set. This is not case sensitive. elements : list List of element numbers that you...
keyword[def] identifier[get_references] ( identifier[basis_name] , identifier[elements] = keyword[None] , identifier[version] = keyword[None] , identifier[fmt] = keyword[None] , identifier[data_dir] = keyword[None] ): literal[string] identifier[data_dir] = identifier[fix_data_dir] ( identifier[data_dir] )...
def get_references(basis_name, elements=None, version=None, fmt=None, data_dir=None): """Get the references/citations for a basis set Parameters ---------- basis_name : str Name of the basis set. This is not case sensitive. elements : list List of element numbers that you want the b...
def set_(key, value, service=None, profile=None): ''' Set a key/value pair in a keyring service ''' service = _get_service(service, profile) keyring.set_password(service, key, value)
def function[set_, parameter[key, value, service, profile]]: constant[ Set a key/value pair in a keyring service ] variable[service] assign[=] call[name[_get_service], parameter[name[service], name[profile]]] call[name[keyring].set_password, parameter[name[service], name[key], name[value...
keyword[def] identifier[set_] ( identifier[key] , identifier[value] , identifier[service] = keyword[None] , identifier[profile] = keyword[None] ): literal[string] identifier[service] = identifier[_get_service] ( identifier[service] , identifier[profile] ) identifier[keyring] . identifier[set_password]...
def set_(key, value, service=None, profile=None): """ Set a key/value pair in a keyring service """ service = _get_service(service, profile) keyring.set_password(service, key, value)
def load_single_dict(pinyin_dict, style='default'): """载入用户自定义的单字拼音库 :param pinyin_dict: 单字拼音库。比如: ``{0x963F: u"ā,ē"}`` :param style: pinyin_dict 参数值的拼音库风格. 支持 'default', 'tone2' :type pinyin_dict: dict """ if style == 'tone2': for k, v in pinyin_dict.items(): v = _replace_t...
def function[load_single_dict, parameter[pinyin_dict, style]]: constant[载入用户自定义的单字拼音库 :param pinyin_dict: 单字拼音库。比如: ``{0x963F: u"ā,ē"}`` :param style: pinyin_dict 参数值的拼音库风格. 支持 'default', 'tone2' :type pinyin_dict: dict ] if compare[name[style] equal[==] constant[tone2]] begin[:] ...
keyword[def] identifier[load_single_dict] ( identifier[pinyin_dict] , identifier[style] = literal[string] ): literal[string] keyword[if] identifier[style] == literal[string] : keyword[for] identifier[k] , identifier[v] keyword[in] identifier[pinyin_dict] . identifier[items] (): id...
def load_single_dict(pinyin_dict, style='default'): """载入用户自定义的单字拼音库 :param pinyin_dict: 单字拼音库。比如: ``{0x963F: u"ā,ē"}`` :param style: pinyin_dict 参数值的拼音库风格. 支持 'default', 'tone2' :type pinyin_dict: dict """ if style == 'tone2': for (k, v) in pinyin_dict.items(): v = _replace...
def main(device_type): """Run ssh-agent using given hardware client factory.""" args = create_agent_parser(device_type=device_type).parse_args() util.setup_logging(verbosity=args.verbose, filename=args.log_file) public_keys = None filename = None if args.identity.startswith('/'): filena...
def function[main, parameter[device_type]]: constant[Run ssh-agent using given hardware client factory.] variable[args] assign[=] call[call[name[create_agent_parser], parameter[]].parse_args, parameter[]] call[name[util].setup_logging, parameter[]] variable[public_keys] assign[=] constan...
keyword[def] identifier[main] ( identifier[device_type] ): literal[string] identifier[args] = identifier[create_agent_parser] ( identifier[device_type] = identifier[device_type] ). identifier[parse_args] () identifier[util] . identifier[setup_logging] ( identifier[verbosity] = identifier[args] . ident...
def main(device_type): """Run ssh-agent using given hardware client factory.""" args = create_agent_parser(device_type=device_type).parse_args() util.setup_logging(verbosity=args.verbose, filename=args.log_file) public_keys = None filename = None if args.identity.startswith('/'): filenam...
def unpack_types(types, args, argnames, major): """Parse arguments according to types list. Parameters ---------- types : list of kattypes The types of the arguments (in order). args : list of strings The arguments to parse. argnames : list of strings The names of the ar...
def function[unpack_types, parameter[types, args, argnames, major]]: constant[Parse arguments according to types list. Parameters ---------- types : list of kattypes The types of the arguments (in order). args : list of strings The arguments to parse. argnames : list of stri...
keyword[def] identifier[unpack_types] ( identifier[types] , identifier[args] , identifier[argnames] , identifier[major] ): literal[string] keyword[if] identifier[len] ( identifier[types] )> literal[int] : identifier[multiple] = identifier[types] [- literal[int] ]. identifier[_multiple] keyw...
def unpack_types(types, args, argnames, major): """Parse arguments according to types list. Parameters ---------- types : list of kattypes The types of the arguments (in order). args : list of strings The arguments to parse. argnames : list of strings The names of the ar...
def start(self, join=False): """ when calling with join=True, must call it in main thread, or else, the Keyboard Interrupt won't be caputured. :param join: default False, if hold on until the worker is stopped by Ctrl+C or other reasons. :return: """ Thread.start(self) ...
def function[start, parameter[self, join]]: constant[ when calling with join=True, must call it in main thread, or else, the Keyboard Interrupt won't be caputured. :param join: default False, if hold on until the worker is stopped by Ctrl+C or other reasons. :return: ] ca...
keyword[def] identifier[start] ( identifier[self] , identifier[join] = keyword[False] ): literal[string] identifier[Thread] . identifier[start] ( identifier[self] ) keyword[if] identifier[join] : keyword[try] : keyword[while] identifier[self] . identifier[i...
def start(self, join=False): """ when calling with join=True, must call it in main thread, or else, the Keyboard Interrupt won't be caputured. :param join: default False, if hold on until the worker is stopped by Ctrl+C or other reasons. :return: """ Thread.start(self) if joi...
def array_indented(level, l, quote_char='\'', comma_after=False): # type: (int, List[str], str, bool) -> str """ return an array indented according to indent level :param level: :param l: :param quote_char: :param comma_after: :return: """ out = "[\n" for x in l: out ...
def function[array_indented, parameter[level, l, quote_char, comma_after]]: constant[ return an array indented according to indent level :param level: :param l: :param quote_char: :param comma_after: :return: ] variable[out] assign[=] constant[[ ] for taget[name[x]] i...
keyword[def] identifier[array_indented] ( identifier[level] , identifier[l] , identifier[quote_char] = literal[string] , identifier[comma_after] = keyword[False] ): literal[string] identifier[out] = literal[string] keyword[for] identifier[x] keyword[in] identifier[l] : identifier[out] +=...
def array_indented(level, l, quote_char="'", comma_after=False): # type: (int, List[str], str, bool) -> str '\n return an array indented according to indent level\n :param level:\n :param l:\n :param quote_char:\n :param comma_after:\n :return:\n ' out = '[\n' for x in l: ou...
def _previous(self): """Get the previous summary and present it.""" self.summaries.rotate() current_summary = self.summaries[0] self._update_summary(current_summary)
def function[_previous, parameter[self]]: constant[Get the previous summary and present it.] call[name[self].summaries.rotate, parameter[]] variable[current_summary] assign[=] call[name[self].summaries][constant[0]] call[name[self]._update_summary, parameter[name[current_summary]]]
keyword[def] identifier[_previous] ( identifier[self] ): literal[string] identifier[self] . identifier[summaries] . identifier[rotate] () identifier[current_summary] = identifier[self] . identifier[summaries] [ literal[int] ] identifier[self] . identifier[_update_summary] ( identi...
def _previous(self): """Get the previous summary and present it.""" self.summaries.rotate() current_summary = self.summaries[0] self._update_summary(current_summary)
def clean(self, value): """Cleans and returns the given value, or raises a ParameterNotValidError exception""" if isinstance(value, six.string_types) and value.lower() == 'false': return False return bool(value)
def function[clean, parameter[self, value]]: constant[Cleans and returns the given value, or raises a ParameterNotValidError exception] if <ast.BoolOp object at 0x7da2054a60b0> begin[:] return[constant[False]] return[call[name[bool], parameter[name[value]]]]
keyword[def] identifier[clean] ( identifier[self] , identifier[value] ): literal[string] keyword[if] identifier[isinstance] ( identifier[value] , identifier[six] . identifier[string_types] ) keyword[and] identifier[value] . identifier[lower] ()== literal[string] : keyword[return] k...
def clean(self, value): """Cleans and returns the given value, or raises a ParameterNotValidError exception""" if isinstance(value, six.string_types) and value.lower() == 'false': return False # depends on [control=['if'], data=[]] return bool(value)
def read_file(file_path_name): """ Read the content of the specified file. @param file_path_name: path and name of the file to read. @return: content of the specified file. """ with io.open(os.path.join(os.path.dirname(__file__), file_path_name), mode='rt', encoding='utf-8') as fd: r...
def function[read_file, parameter[file_path_name]]: constant[ Read the content of the specified file. @param file_path_name: path and name of the file to read. @return: content of the specified file. ] with call[name[io].open, parameter[call[name[os].path.join, parameter[call[name[os...
keyword[def] identifier[read_file] ( identifier[file_path_name] ): literal[string] keyword[with] identifier[io] . identifier[open] ( identifier[os] . identifier[path] . identifier[join] ( identifier[os] . identifier[path] . identifier[dirname] ( identifier[__file__] ), identifier[file_path_name] ), identi...
def read_file(file_path_name): """ Read the content of the specified file. @param file_path_name: path and name of the file to read. @return: content of the specified file. """ with io.open(os.path.join(os.path.dirname(__file__), file_path_name), mode='rt', encoding='utf-8') as fd: r...
def get_nic(self, datacenter_id, server_id, nic_id, depth=1): """ Retrieves a NIC by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`...
def function[get_nic, parameter[self, datacenter_id, server_id, nic_id, depth]]: constant[ Retrieves a NIC by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :typ...
keyword[def] identifier[get_nic] ( identifier[self] , identifier[datacenter_id] , identifier[server_id] , identifier[nic_id] , identifier[depth] = literal[int] ): literal[string] identifier[response] = identifier[self] . identifier[_perform_request] ( literal[string] %( identifier...
def get_nic(self, datacenter_id, server_id, nic_id, depth=1): """ Retrieves a NIC by its ID. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param server_id: The unique ID of the server. :type server_id: ``str`` ...
def SetPassword(self,password): """Request change of password. The API request requires supplying the current password. For this we issue a call to retrieve the credentials so note there will be an activity log for retrieving the credentials associated with any SetPassword entry >>> s.SetPassword("newpassw...
def function[SetPassword, parameter[self, password]]: constant[Request change of password. The API request requires supplying the current password. For this we issue a call to retrieve the credentials so note there will be an activity log for retrieving the credentials associated with any SetPassword en...
keyword[def] identifier[SetPassword] ( identifier[self] , identifier[password] ): literal[string] keyword[if] identifier[self] . identifier[data] [ literal[string] ]!= literal[string] : keyword[raise] ( identifier[clc] . identifier[CLCException] ( literal[string] )) keyword[return] ( identifier[clc] ....
def SetPassword(self, password): """Request change of password. The API request requires supplying the current password. For this we issue a call to retrieve the credentials so note there will be an activity log for retrieving the credentials associated with any SetPassword entry >>> s.SetPassword("newpa...
def set_start_date(self, date): """Sets the start date. arg: date (osid.calendaring.DateTime): the new date raise: InvalidArgument - ``date`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``date`` is ``null`` *compliance: ...
def function[set_start_date, parameter[self, date]]: constant[Sets the start date. arg: date (osid.calendaring.DateTime): the new date raise: InvalidArgument - ``date`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``date`` is ``n...
keyword[def] identifier[set_start_date] ( identifier[self] , identifier[date] ): literal[string] keyword[if] identifier[self] . identifier[get_start_date_metadata] (). identifier[is_read_only] (): keyword[raise] identifier[errors] . identifier[NoAccess] () keyword[if] keywo...
def set_start_date(self, date): """Sets the start date. arg: date (osid.calendaring.DateTime): the new date raise: InvalidArgument - ``date`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``date`` is ``null`` *compliance: mand...
def get_instance(self, payload): """ Build an instance of RoleInstance :param dict payload: Payload response from the API :returns: twilio.rest.chat.v2.service.role.RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance """ return RoleInstance(self._...
def function[get_instance, parameter[self, payload]]: constant[ Build an instance of RoleInstance :param dict payload: Payload response from the API :returns: twilio.rest.chat.v2.service.role.RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance ] retur...
keyword[def] identifier[get_instance] ( identifier[self] , identifier[payload] ): literal[string] keyword[return] identifier[RoleInstance] ( identifier[self] . identifier[_version] , identifier[payload] , identifier[service_sid] = identifier[self] . identifier[_solution] [ literal[string] ],)
def get_instance(self, payload): """ Build an instance of RoleInstance :param dict payload: Payload response from the API :returns: twilio.rest.chat.v2.service.role.RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance """ return RoleInstance(self._version,...
def _union_lcs(evaluated_sentences, reference_sentence, prev_union=None): """ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example: if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w...
def function[_union_lcs, parameter[evaluated_sentences, reference_sentence, prev_union]]: constant[ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example: if r_i= w1 w2 w3 w4 w5, and C contains two ...
keyword[def] identifier[_union_lcs] ( identifier[evaluated_sentences] , identifier[reference_sentence] , identifier[prev_union] = keyword[None] ): literal[string] keyword[if] identifier[prev_union] keyword[is] keyword[None] : identifier[prev_union] = identifier[set] () keyword[if] identi...
def _union_lcs(evaluated_sentences, reference_sentence, prev_union=None): """ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example: if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w...
def pop(cls, anchors): """ Args: anchors (str | unicode | list): Optional paths to use as anchors for short() """ for anchor in flattened(anchors, split=SANITIZED | UNIQUE): if anchor in cls.paths: cls.paths.remove(anchor)
def function[pop, parameter[cls, anchors]]: constant[ Args: anchors (str | unicode | list): Optional paths to use as anchors for short() ] for taget[name[anchor]] in starred[call[name[flattened], parameter[name[anchors]]]] begin[:] if compare[name[anchor] in n...
keyword[def] identifier[pop] ( identifier[cls] , identifier[anchors] ): literal[string] keyword[for] identifier[anchor] keyword[in] identifier[flattened] ( identifier[anchors] , identifier[split] = identifier[SANITIZED] | identifier[UNIQUE] ): keyword[if] identifier[anchor] keywor...
def pop(cls, anchors): """ Args: anchors (str | unicode | list): Optional paths to use as anchors for short() """ for anchor in flattened(anchors, split=SANITIZED | UNIQUE): if anchor in cls.paths: cls.paths.remove(anchor) # depends on [control=['if'], data=['anc...
def export(self, private_keys=True): """Exports a RFC 7517 keyset using the standard JSON format :param private_key(bool): Whether to export private keys. Defaults to True. """ exp_dict = dict() for k, v in iteritems(self): if k == '...
def function[export, parameter[self, private_keys]]: constant[Exports a RFC 7517 keyset using the standard JSON format :param private_key(bool): Whether to export private keys. Defaults to True. ] variable[exp_dict] assign[=] call[name[dict], parameter[...
keyword[def] identifier[export] ( identifier[self] , identifier[private_keys] = keyword[True] ): literal[string] identifier[exp_dict] = identifier[dict] () keyword[for] identifier[k] , identifier[v] keyword[in] identifier[iteritems] ( identifier[self] ): keyword[if] identi...
def export(self, private_keys=True): """Exports a RFC 7517 keyset using the standard JSON format :param private_key(bool): Whether to export private keys. Defaults to True. """ exp_dict = dict() for (k, v) in iteritems(self): if k == 'keys': ...
def migrate(self) -> None: """ Migrate Perform a database migration, upgrading to the latest schema level. """ assert self.ormSessionCreator, "ormSessionCreator is not defined" connection = self._dbEngine.connect() isDbInitialised = self._dbEngine.dialect.has_table( ...
def function[migrate, parameter[self]]: constant[ Migrate Perform a database migration, upgrading to the latest schema level. ] assert[name[self].ormSessionCreator] variable[connection] assign[=] call[name[self]._dbEngine.connect, parameter[]] variable[isDbInitialised] assig...
keyword[def] identifier[migrate] ( identifier[self] )-> keyword[None] : literal[string] keyword[assert] identifier[self] . identifier[ormSessionCreator] , literal[string] identifier[connection] = identifier[self] . identifier[_dbEngine] . identifier[connect] () identifier[isDb...
def migrate(self) -> None: """ Migrate Perform a database migration, upgrading to the latest schema level. """ assert self.ormSessionCreator, 'ormSessionCreator is not defined' connection = self._dbEngine.connect() isDbInitialised = self._dbEngine.dialect.has_table(connection, 'alembic_...
def plane_intersection(self, plane, forward_only=False): '''return point where line intersects with a plane''' l_dot_n = self.vector * plane.normal if l_dot_n == 0.0: # line is parallel to the plane return None d = ((plane.point - self.point) * plane.normal) / l_d...
def function[plane_intersection, parameter[self, plane, forward_only]]: constant[return point where line intersects with a plane] variable[l_dot_n] assign[=] binary_operation[name[self].vector * name[plane].normal] if compare[name[l_dot_n] equal[==] constant[0.0]] begin[:] return[constan...
keyword[def] identifier[plane_intersection] ( identifier[self] , identifier[plane] , identifier[forward_only] = keyword[False] ): literal[string] identifier[l_dot_n] = identifier[self] . identifier[vector] * identifier[plane] . identifier[normal] keyword[if] identifier[l_dot_n] == litera...
def plane_intersection(self, plane, forward_only=False): """return point where line intersects with a plane""" l_dot_n = self.vector * plane.normal if l_dot_n == 0.0: # line is parallel to the plane return None # depends on [control=['if'], data=[]] d = (plane.point - self.point) * plan...
def raise_error(self, error): """Raises the exception in the client. Called by the client to convert the :py:class:`RPCErrorResponse` into an Exception and raise or return it depending on the :py:attr:`raises_errors` attribute. :param error: The error response received from the server....
def function[raise_error, parameter[self, error]]: constant[Raises the exception in the client. Called by the client to convert the :py:class:`RPCErrorResponse` into an Exception and raise or return it depending on the :py:attr:`raises_errors` attribute. :param error: The error respons...
keyword[def] identifier[raise_error] ( identifier[self] , identifier[error] ): literal[string] identifier[ex] = identifier[exc] . identifier[RPCError] ( literal[string] % identifier[error] . identifier[error] [ literal[string] ]) keyword[if] identifier[self] . identifier[raises_errors] : ...
def raise_error(self, error): """Raises the exception in the client. Called by the client to convert the :py:class:`RPCErrorResponse` into an Exception and raise or return it depending on the :py:attr:`raises_errors` attribute. :param error: The error response received from the server. ...
def compare(self, statement_a, statement_b): """ Compare the two input statements. :return: The percent of similarity between the text of the statements. :rtype: float """ # Return 0 if either statement has a falsy text value if not statement_a.text or not state...
def function[compare, parameter[self, statement_a, statement_b]]: constant[ Compare the two input statements. :return: The percent of similarity between the text of the statements. :rtype: float ] if <ast.BoolOp object at 0x7da1b1f76500> begin[:] return[constant[...
keyword[def] identifier[compare] ( identifier[self] , identifier[statement_a] , identifier[statement_b] ): literal[string] keyword[if] keyword[not] identifier[statement_a] . identifier[text] keyword[or] keyword[not] identifier[statement_b] . identifier[text] : keyword[re...
def compare(self, statement_a, statement_b): """ Compare the two input statements. :return: The percent of similarity between the text of the statements. :rtype: float """ # Return 0 if either statement has a falsy text value if not statement_a.text or not statement_b.text: ...
def to_json(self): """ Returns: str: """ data = dict() for key, value in self.__dict__.items(): if value: if hasattr(value, 'to_dict'): data[key] = value.to_dict() elif isinstance(value, datetime): ...
def function[to_json, parameter[self]]: constant[ Returns: str: ] variable[data] assign[=] call[name[dict], parameter[]] for taget[tuple[[<ast.Name object at 0x7da18bcc85e0>, <ast.Name object at 0x7da18bcc8580>]]] in starred[call[name[self].__dict__.items, parameter[]...
keyword[def] identifier[to_json] ( identifier[self] ): literal[string] identifier[data] = identifier[dict] () keyword[for] identifier[key] , identifier[value] keyword[in] identifier[self] . identifier[__dict__] . identifier[items] (): keyword[if] identifier[value] : ...
def to_json(self): """ Returns: str: """ data = dict() for (key, value) in self.__dict__.items(): if value: if hasattr(value, 'to_dict'): data[key] = value.to_dict() # depends on [control=['if'], data=[]] elif isinstance(value, dat...
def route53_public_hosted_zone_id(self, lookup, default=None): """ Args: lookup: The zone name to look up. Must end with "." default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the public hosted zone for the 'lookup' domain, or default/None if...
def function[route53_public_hosted_zone_id, parameter[self, lookup, default]]: constant[ Args: lookup: The zone name to look up. Must end with "." default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the public hosted zone for the 'lookup' ...
keyword[def] identifier[route53_public_hosted_zone_id] ( identifier[self] , identifier[lookup] , identifier[default] = keyword[None] ): literal[string] identifier[list_limit] = literal[string] keyword[if] identifier[lookup] [- literal[int] ]!= literal[string] : keyword[return] identifie...
def route53_public_hosted_zone_id(self, lookup, default=None): """ Args: lookup: The zone name to look up. Must end with "." default: the optional value to return if lookup failed; returns None if not set Returns: the ID of the public hosted zone for the 'lookup' domain, or default/None if...
def write_tar( src_fs, # type: FS file, # type: Union[Text, BinaryIO] compression=None, # type: Optional[Text] encoding="utf-8", # type: Text walker=None, # type: Optional[Walker] ): # type: (...) -> None """Write the contents of a filesystem to a tar file. Arguments: file ...
def function[write_tar, parameter[src_fs, file, compression, encoding, walker]]: constant[Write the contents of a filesystem to a tar file. Arguments: file (str or io.IOBase): Destination file, may be a file name or an open file object. compression (str, optional): Compression t...
keyword[def] identifier[write_tar] ( identifier[src_fs] , identifier[file] , identifier[compression] = keyword[None] , identifier[encoding] = literal[string] , identifier[walker] = keyword[None] , ): literal[string] identifier[type_map] ={ identifier[ResourceType] . identifier[block_special_file...
def write_tar(src_fs, file, compression=None, encoding='utf-8', walker=None): # type: FS # type: Union[Text, BinaryIO] # type: Optional[Text] # type: Text # type: Optional[Walker] # type: (...) -> None 'Write the contents of a filesystem to a tar file.\n\n Arguments:\n file (str or io...
def _correct(token, term_freq): """ Correct a single token according to the term_freq """ if token.lower() in term_freq: return token e1 = [t for t in _ed1(token) if t in term_freq] if len(e1) > 0: e1.sort(key=term_freq.get) return e1[0] e2 = [t for t in _ed2(token) i...
def function[_correct, parameter[token, term_freq]]: constant[ Correct a single token according to the term_freq ] if compare[call[name[token].lower, parameter[]] in name[term_freq]] begin[:] return[name[token]] variable[e1] assign[=] <ast.ListComp object at 0x7da18f00d990> ...
keyword[def] identifier[_correct] ( identifier[token] , identifier[term_freq] ): literal[string] keyword[if] identifier[token] . identifier[lower] () keyword[in] identifier[term_freq] : keyword[return] identifier[token] identifier[e1] =[ identifier[t] keyword[for] identifier[t] keyword...
def _correct(token, term_freq): """ Correct a single token according to the term_freq """ if token.lower() in term_freq: return token # depends on [control=['if'], data=[]] e1 = [t for t in _ed1(token) if t in term_freq] if len(e1) > 0: e1.sort(key=term_freq.get) return ...
def start_list(self): """Start a list.""" self._ordered = False self.start_container(List) self.set_next_paragraph_style('list-paragraph' if self._item_level <= 0 else 'sublist-paragraph')
def function[start_list, parameter[self]]: constant[Start a list.] name[self]._ordered assign[=] constant[False] call[name[self].start_container, parameter[name[List]]] call[name[self].set_next_paragraph_style, parameter[<ast.IfExp object at 0x7da1b0579a50>]]
keyword[def] identifier[start_list] ( identifier[self] ): literal[string] identifier[self] . identifier[_ordered] = keyword[False] identifier[self] . identifier[start_container] ( identifier[List] ) identifier[self] . identifier[set_next_paragraph_style] ( literal[string] ...
def start_list(self): """Start a list.""" self._ordered = False self.start_container(List) self.set_next_paragraph_style('list-paragraph' if self._item_level <= 0 else 'sublist-paragraph')
def SolveServiceArea(self, facilities=None, barriers=None, polylineBarriers=None, polygonBarriers=None, attributeParameterValues=None, defaultBreaks=None, excludeSourcesF...
def function[SolveServiceArea, parameter[self, facilities, barriers, polylineBarriers, polygonBarriers, attributeParameterValues, defaultBreaks, excludeSourcesFromPolygons, mergeSimilarPolygonRanges, outputLines, outputPolygons, overlapLines, overlapPolygons, splitLinesAtBreaks, splitPolygonsAtBreaks, travelDirection, ...
keyword[def] identifier[SolveServiceArea] ( identifier[self] , identifier[facilities] = keyword[None] , identifier[barriers] = keyword[None] , identifier[polylineBarriers] = keyword[None] , identifier[polygonBarriers] = keyword[None] , identifier[attributeParameterValues] = keyword[None] , identifier[defaultBrea...
def SolveServiceArea(self, facilities=None, barriers=None, polylineBarriers=None, polygonBarriers=None, attributeParameterValues=None, defaultBreaks=None, excludeSourcesFromPolygons=None, mergeSimilarPolygonRanges=None, outputLines=None, outputPolygons=None, overlapLines=None, overlapPolygons=None, splitLinesAtBreaks=N...
def profile_list(self, provider, lookup='all'): ''' Return a mapping of all configured profiles ''' data = {} lookups = self.lookup_profiles(provider, lookup) if not lookups: return data for alias, driver in lookups: if alias not in data:...
def function[profile_list, parameter[self, provider, lookup]]: constant[ Return a mapping of all configured profiles ] variable[data] assign[=] dictionary[[], []] variable[lookups] assign[=] call[name[self].lookup_profiles, parameter[name[provider], name[lookup]]] if <ast...
keyword[def] identifier[profile_list] ( identifier[self] , identifier[provider] , identifier[lookup] = literal[string] ): literal[string] identifier[data] ={} identifier[lookups] = identifier[self] . identifier[lookup_profiles] ( identifier[provider] , identifier[lookup] ) keywor...
def profile_list(self, provider, lookup='all'): """ Return a mapping of all configured profiles """ data = {} lookups = self.lookup_profiles(provider, lookup) if not lookups: return data # depends on [control=['if'], data=[]] for (alias, driver) in lookups: if alias ...
def send_reset_password_email(self, user, user_email): """Send the 'reset password' email.""" # Verify config settings if not self.user_manager.USER_ENABLE_EMAIL: return assert self.user_manager.USER_ENABLE_FORGOT_PASSWORD # The reset_password email is sent to a specific user_e...
def function[send_reset_password_email, parameter[self, user, user_email]]: constant[Send the 'reset password' email.] if <ast.UnaryOp object at 0x7da1b1e8cbe0> begin[:] return[None] assert[name[self].user_manager.USER_ENABLE_FORGOT_PASSWORD] variable[email] assign[=] <ast.IfExp obje...
keyword[def] identifier[send_reset_password_email] ( identifier[self] , identifier[user] , identifier[user_email] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[user_manager] . identifier[USER_ENABLE_EMAIL] : keyword[return] keyword[assert] identifi...
def send_reset_password_email(self, user, user_email): """Send the 'reset password' email.""" # Verify config settings if not self.user_manager.USER_ENABLE_EMAIL: return # depends on [control=['if'], data=[]] assert self.user_manager.USER_ENABLE_FORGOT_PASSWORD # The reset_password email is...
def moving_average(data, periods, type='simple'): """ compute a <periods> period moving average. type is 'simple' | 'exponential' """ data = np.asarray(data) if type == 'simple': weights = np.ones(periods) else: weights = np.exp(np.linspace(-1., 0., periods)) weights /= ...
def function[moving_average, parameter[data, periods, type]]: constant[ compute a <periods> period moving average. type is 'simple' | 'exponential' ] variable[data] assign[=] call[name[np].asarray, parameter[name[data]]] if compare[name[type] equal[==] constant[simple]] begin[:] ...
keyword[def] identifier[moving_average] ( identifier[data] , identifier[periods] , identifier[type] = literal[string] ): literal[string] identifier[data] = identifier[np] . identifier[asarray] ( identifier[data] ) keyword[if] identifier[type] == literal[string] : identifier[weights] = identi...
def moving_average(data, periods, type='simple'): """ compute a <periods> period moving average. type is 'simple' | 'exponential' """ data = np.asarray(data) if type == 'simple': weights = np.ones(periods) # depends on [control=['if'], data=[]] else: weights = np.exp(np.lins...
def getnames(): """ get mail names """ namestring = "" addmore = 1 while addmore: scientist = input("Enter name - <Return> when done ") if scientist != "": namestring = namestring + ":" + scientist else: namestring = namestring[1:] ad...
def function[getnames, parameter[]]: constant[ get mail names ] variable[namestring] assign[=] constant[] variable[addmore] assign[=] constant[1] while name[addmore] begin[:] variable[scientist] assign[=] call[name[input], parameter[constant[Enter name - <Return...
keyword[def] identifier[getnames] (): literal[string] identifier[namestring] = literal[string] identifier[addmore] = literal[int] keyword[while] identifier[addmore] : identifier[scientist] = identifier[input] ( literal[string] ) keyword[if] identifier[scientist] != literal[s...
def getnames(): """ get mail names """ namestring = '' addmore = 1 while addmore: scientist = input('Enter name - <Return> when done ') if scientist != '': namestring = namestring + ':' + scientist # depends on [control=['if'], data=['scientist']] else: ...
def configGet(self, vartype, category, name, optional=False, specialReturnMessage=None): """ Wraps a try / except and a check for self.filename around ConfigParser as it talks to the configuration file. Also, checks for existence of configuration file so this won't execute (and fail) when no config...
def function[configGet, parameter[self, vartype, category, name, optional, specialReturnMessage]]: constant[ Wraps a try / except and a check for self.filename around ConfigParser as it talks to the configuration file. Also, checks for existence of configuration file so this won't execute (and fail)...
keyword[def] identifier[configGet] ( identifier[self] , identifier[vartype] , identifier[category] , identifier[name] , identifier[optional] = keyword[False] , identifier[specialReturnMessage] = keyword[None] ): literal[string] keyword[try] : keyword[if] identifier[vartype] == literal[string] : ...
def configGet(self, vartype, category, name, optional=False, specialReturnMessage=None): """ Wraps a try / except and a check for self.filename around ConfigParser as it talks to the configuration file. Also, checks for existence of configuration file so this won't execute (and fail) when no config...
def distinct(l): """ Return a list where the duplicates have been removed. Args: l (list): the list to filter. Returns: list: the same list without duplicates. """ seen = set() seen_add = seen.add return (_ for _ in l if not (_ in seen or seen_add(_)))
def function[distinct, parameter[l]]: constant[ Return a list where the duplicates have been removed. Args: l (list): the list to filter. Returns: list: the same list without duplicates. ] variable[seen] assign[=] call[name[set], parameter[]] variable[seen_add] ...
keyword[def] identifier[distinct] ( identifier[l] ): literal[string] identifier[seen] = identifier[set] () identifier[seen_add] = identifier[seen] . identifier[add] keyword[return] ( identifier[_] keyword[for] identifier[_] keyword[in] identifier[l] keyword[if] keyword[not] ( identifier[_]...
def distinct(l): """ Return a list where the duplicates have been removed. Args: l (list): the list to filter. Returns: list: the same list without duplicates. """ seen = set() seen_add = seen.add return (_ for _ in l if not (_ in seen or seen_add(_)))
def get_elt_projected_plots(self, zero_to_efermi=True, ylim=None, vbm_cbm_marker=False): """ Method returning a plot composed of subplots along different elements Returns: a pylab object with different subfigures for each projection The bl...
def function[get_elt_projected_plots, parameter[self, zero_to_efermi, ylim, vbm_cbm_marker]]: constant[ Method returning a plot composed of subplots along different elements Returns: a pylab object with different subfigures for each projection The blue and red colors are...
keyword[def] identifier[get_elt_projected_plots] ( identifier[self] , identifier[zero_to_efermi] = keyword[True] , identifier[ylim] = keyword[None] , identifier[vbm_cbm_marker] = keyword[False] ): literal[string] identifier[band_linewidth] = literal[int] identifier[proj] = identifier[sel...
def get_elt_projected_plots(self, zero_to_efermi=True, ylim=None, vbm_cbm_marker=False): """ Method returning a plot composed of subplots along different elements Returns: a pylab object with different subfigures for each projection The blue and red colors are for spin up an...
def experiments_fmri_get(self, resource_url): """Get handle for functional fMRI resource at given Url. Parameters ---------- resource_url : string Url for fMRI resource at SCO-API Returns ------- scoserv.FunctionalDataHandle Handle for fu...
def function[experiments_fmri_get, parameter[self, resource_url]]: constant[Get handle for functional fMRI resource at given Url. Parameters ---------- resource_url : string Url for fMRI resource at SCO-API Returns ------- scoserv.FunctionalDataHandl...
keyword[def] identifier[experiments_fmri_get] ( identifier[self] , identifier[resource_url] ): literal[string] identifier[obj_dir] , identifier[obj_json] , identifier[is_active] , identifier[cache_id] = identifier[self] . identifier[get_object] ( identifier[resource_url] ) ...
def experiments_fmri_get(self, resource_url): """Get handle for functional fMRI resource at given Url. Parameters ---------- resource_url : string Url for fMRI resource at SCO-API Returns ------- scoserv.FunctionalDataHandle Handle for funcri...
def unflatten_list(flat_dict, separator='_'): """ Unflattens a dictionary, first assuming no lists exist and then tries to identify lists and replaces them This is probably not very efficient and has not been tested extensively Feel free to add test cases or rewrite the logic Issues that stand o...
def function[unflatten_list, parameter[flat_dict, separator]]: constant[ Unflattens a dictionary, first assuming no lists exist and then tries to identify lists and replaces them This is probably not very efficient and has not been tested extensively Feel free to add test cases or rewrite the lo...
keyword[def] identifier[unflatten_list] ( identifier[flat_dict] , identifier[separator] = literal[string] ): literal[string] identifier[_unflatten_asserts] ( identifier[flat_dict] , identifier[separator] ) identifier[unflattened_dict] = identifier[unflatten] ( identifier[flat_dict] , identifier[...
def unflatten_list(flat_dict, separator='_'): """ Unflattens a dictionary, first assuming no lists exist and then tries to identify lists and replaces them This is probably not very efficient and has not been tested extensively Feel free to add test cases or rewrite the logic Issues that stand o...
def location(self): """ The location for this engine. May be None if no specific location has been assigned. :param value: location to assign engine. Can be name, str href, or Location element. If name, it will be automatically created if a Location with the same...
def function[location, parameter[self]]: constant[ The location for this engine. May be None if no specific location has been assigned. :param value: location to assign engine. Can be name, str href, or Location element. If name, it will be automatically created ...
keyword[def] identifier[location] ( identifier[self] ): literal[string] identifier[location] = identifier[Element] . identifier[from_href] ( identifier[self] . identifier[location_ref] ) keyword[if] identifier[location] keyword[and] identifier[location] . identifier[name] == literal[str...
def location(self): """ The location for this engine. May be None if no specific location has been assigned. :param value: location to assign engine. Can be name, str href, or Location element. If name, it will be automatically created if a Location with the same nam...
def breathe_identifier(self): """ The unique identifier for breathe directives. .. note:: This method is currently assumed to only be called for nodes that are in :data:`exhale.utils.LEAF_LIKE_KINDS` (see also :func:`exhale.graph.ExhaleRoot.generateSingleNod...
def function[breathe_identifier, parameter[self]]: constant[ The unique identifier for breathe directives. .. note:: This method is currently assumed to only be called for nodes that are in :data:`exhale.utils.LEAF_LIKE_KINDS` (see also :func:`exhale.graph.E...
keyword[def] identifier[breathe_identifier] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[kind] == literal[string] : keyword[return] literal[string] . identifier[format] ( identifier[name] = identifier[self] . identifier[name] ,...
def breathe_identifier(self): """ The unique identifier for breathe directives. .. note:: This method is currently assumed to only be called for nodes that are in :data:`exhale.utils.LEAF_LIKE_KINDS` (see also :func:`exhale.graph.ExhaleRoot.generateSingleNodeRST...
def clean(self): """ Remove intermediate files created. """ #TODO: add cleaning of mask files, *if* created ... for f in self.catalog_names: if 'match' in f: if os.path.exists(self.catalog_names[f]): log.info('Deleting intermediate match fi...
def function[clean, parameter[self]]: constant[ Remove intermediate files created. ] for taget[name[f]] in starred[name[self].catalog_names] begin[:] if compare[constant[match] in name[f]] begin[:] if call[name[os].path.exists, parameter[call[name[self].ca...
keyword[def] identifier[clean] ( identifier[self] ): literal[string] keyword[for] identifier[f] keyword[in] identifier[self] . identifier[catalog_names] : keyword[if] literal[string] keyword[in] identifier[f] : keyword[if] identifier[os] . identifier[pa...
def clean(self): """ Remove intermediate files created. """ #TODO: add cleaning of mask files, *if* created ... for f in self.catalog_names: if 'match' in f: if os.path.exists(self.catalog_names[f]): log.info('Deleting intermediate match file: %s' % self.catalog_n...
def interpolate(requestContext, seriesList, limit=INF): """ Takes one metric or a wildcard seriesList, and optionally a limit to the number of 'None' values to skip over. Continues the line with the last received value when gaps ('None' values) appear in your data, rather than breaking your line. ...
def function[interpolate, parameter[requestContext, seriesList, limit]]: constant[ Takes one metric or a wildcard seriesList, and optionally a limit to the number of 'None' values to skip over. Continues the line with the last received value when gaps ('None' values) appear in your data, rather than...
keyword[def] identifier[interpolate] ( identifier[requestContext] , identifier[seriesList] , identifier[limit] = identifier[INF] ): literal[string] keyword[for] identifier[series] keyword[in] identifier[seriesList] : identifier[series] . identifier[name] = literal[string] %( identifier[series] ...
def interpolate(requestContext, seriesList, limit=INF): """ Takes one metric or a wildcard seriesList, and optionally a limit to the number of 'None' values to skip over. Continues the line with the last received value when gaps ('None' values) appear in your data, rather than breaking your line. ...
def handle_protein_results(permutation_result): """Takes in output from multiprocess_permutation function and converts to a better formatted dataframe. Parameters ---------- permutation_result : list output from multiprocess_permutation Returns ------- permutation_df : pd.DataF...
def function[handle_protein_results, parameter[permutation_result]]: constant[Takes in output from multiprocess_permutation function and converts to a better formatted dataframe. Parameters ---------- permutation_result : list output from multiprocess_permutation Returns ------...
keyword[def] identifier[handle_protein_results] ( identifier[permutation_result] ): literal[string] identifier[mycols] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ] identifier[permutation_df] = identifier[pd] . identifier[DataF...
def handle_protein_results(permutation_result): """Takes in output from multiprocess_permutation function and converts to a better formatted dataframe. Parameters ---------- permutation_result : list output from multiprocess_permutation Returns ------- permutation_df : pd.DataF...
def print_build_info(self): """Prints the include and library path being used for debugging purposes.""" if self.static_extension: build_type = "static extension" else: build_type = "dynamic extension" print("Build type: %s" % build_type) print("Include pa...
def function[print_build_info, parameter[self]]: constant[Prints the include and library path being used for debugging purposes.] if name[self].static_extension begin[:] variable[build_type] assign[=] constant[static extension] call[name[print], parameter[binary_operation[constan...
keyword[def] identifier[print_build_info] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[static_extension] : identifier[build_type] = literal[string] keyword[else] : identifier[build_type] = literal[string] identifier[p...
def print_build_info(self): """Prints the include and library path being used for debugging purposes.""" if self.static_extension: build_type = 'static extension' # depends on [control=['if'], data=[]] else: build_type = 'dynamic extension' print('Build type: %s' % build_type) print...
def new(localfile, jottapath, JFS): """Upload a new file from local disk (doesn't exist on JottaCloud). Returns JottaFile object""" with open(localfile) as lf: _new = JFS.up(jottapath, lf) return _new
def function[new, parameter[localfile, jottapath, JFS]]: constant[Upload a new file from local disk (doesn't exist on JottaCloud). Returns JottaFile object] with call[name[open], parameter[name[localfile]]] begin[:] variable[_new] assign[=] call[name[JFS].up, parameter[name[jottapat...
keyword[def] identifier[new] ( identifier[localfile] , identifier[jottapath] , identifier[JFS] ): literal[string] keyword[with] identifier[open] ( identifier[localfile] ) keyword[as] identifier[lf] : identifier[_new] = identifier[JFS] . identifier[up] ( identifier[jottapath] , identifier[lf] ) ...
def new(localfile, jottapath, JFS): """Upload a new file from local disk (doesn't exist on JottaCloud). Returns JottaFile object""" with open(localfile) as lf: _new = JFS.up(jottapath, lf) # depends on [control=['with'], data=['lf']] return _new
def draw(self,N=1.5): """compute every node coordinates after converging to optimal ordering by N rounds, and finally perform the edge routing. """ while N>0.5: for (l,mvmt) in self.ordering_step(): pass N = N-1 if N>0: for (...
def function[draw, parameter[self, N]]: constant[compute every node coordinates after converging to optimal ordering by N rounds, and finally perform the edge routing. ] while compare[name[N] greater[>] constant[0.5]] begin[:] for taget[tuple[[<ast.Name object at 0x7da...
keyword[def] identifier[draw] ( identifier[self] , identifier[N] = literal[int] ): literal[string] keyword[while] identifier[N] > literal[int] : keyword[for] ( identifier[l] , identifier[mvmt] ) keyword[in] identifier[self] . identifier[ordering_step] (): keyword[pas...
def draw(self, N=1.5): """compute every node coordinates after converging to optimal ordering by N rounds, and finally perform the edge routing. """ while N > 0.5: for (l, mvmt) in self.ordering_step(): pass # depends on [control=['for'], data=[]] N = N - 1 # dep...
def delete(self, ids): """ Method to delete vlan's by their ids :param ids: Identifiers of vlan's :return: None """ url = build_uri_with_ids('api/v3/vlan/%s/', ids) return super(ApiVlan, self).delete(url)
def function[delete, parameter[self, ids]]: constant[ Method to delete vlan's by their ids :param ids: Identifiers of vlan's :return: None ] variable[url] assign[=] call[name[build_uri_with_ids], parameter[constant[api/v3/vlan/%s/], name[ids]]] return[call[call[name[...
keyword[def] identifier[delete] ( identifier[self] , identifier[ids] ): literal[string] identifier[url] = identifier[build_uri_with_ids] ( literal[string] , identifier[ids] ) keyword[return] identifier[super] ( identifier[ApiVlan] , identifier[self] ). identifier[delete] ( identifier[url...
def delete(self, ids): """ Method to delete vlan's by their ids :param ids: Identifiers of vlan's :return: None """ url = build_uri_with_ids('api/v3/vlan/%s/', ids) return super(ApiVlan, self).delete(url)
def load_request_data(request_schema, partial=False): """ Load request data as JSON using the given schema. Forces JSON decoding even if the client not specify the `Content-Type` header properly. This is friendlier to client and test software, even at the cost of not distinguishing HTTP 400 and 41...
def function[load_request_data, parameter[request_schema, partial]]: constant[ Load request data as JSON using the given schema. Forces JSON decoding even if the client not specify the `Content-Type` header properly. This is friendlier to client and test software, even at the cost of not distingui...
keyword[def] identifier[load_request_data] ( identifier[request_schema] , identifier[partial] = keyword[False] ): literal[string] keyword[try] : identifier[json_data] = identifier[request] . identifier[get_json] ( identifier[force] = keyword[True] ) keyword[or] {} keyword[except] identifier[...
def load_request_data(request_schema, partial=False): """ Load request data as JSON using the given schema. Forces JSON decoding even if the client not specify the `Content-Type` header properly. This is friendlier to client and test software, even at the cost of not distinguishing HTTP 400 and 41...
def _process_assignments(self, anexec, contents, mode="insert"): """Extracts all variable assignments from the body of the executable. :arg mode: for real-time update; either 'insert', 'delete' or 'replace'. """ for assign in self.RE_ASSIGN.finditer(contents): assignee = ass...
def function[_process_assignments, parameter[self, anexec, contents, mode]]: constant[Extracts all variable assignments from the body of the executable. :arg mode: for real-time update; either 'insert', 'delete' or 'replace'. ] for taget[name[assign]] in starred[call[name[self].RE_ASSIG...
keyword[def] identifier[_process_assignments] ( identifier[self] , identifier[anexec] , identifier[contents] , identifier[mode] = literal[string] ): literal[string] keyword[for] identifier[assign] keyword[in] identifier[self] . identifier[RE_ASSIGN] . identifier[finditer] ( identifier[contents] ...
def _process_assignments(self, anexec, contents, mode='insert'): """Extracts all variable assignments from the body of the executable. :arg mode: for real-time update; either 'insert', 'delete' or 'replace'. """ for assign in self.RE_ASSIGN.finditer(contents): assignee = assign.group('a...
def _take_screenshot(self): """Take a screenshot, also called by Mixin Args: - filename(string): file name to save Returns: PIL Image object """ raw_png = self._wda.screenshot() img = Image.open(BytesIO(raw_png)) return img
def function[_take_screenshot, parameter[self]]: constant[Take a screenshot, also called by Mixin Args: - filename(string): file name to save Returns: PIL Image object ] variable[raw_png] assign[=] call[name[self]._wda.screenshot, parameter[]] var...
keyword[def] identifier[_take_screenshot] ( identifier[self] ): literal[string] identifier[raw_png] = identifier[self] . identifier[_wda] . identifier[screenshot] () identifier[img] = identifier[Image] . identifier[open] ( identifier[BytesIO] ( identifier[raw_png] )) keyword[retur...
def _take_screenshot(self): """Take a screenshot, also called by Mixin Args: - filename(string): file name to save Returns: PIL Image object """ raw_png = self._wda.screenshot() img = Image.open(BytesIO(raw_png)) return img
def _set_remote_mep(self, v, load=False): """ Setter method for remote_mep, mapped from YANG variable /protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/mep/cfm_mep_sub_commands/remote_mep (list) If this variable is read-only (config: false) in the source YANG file, then _set_remote_mep is considered...
def function[_set_remote_mep, parameter[self, v, load]]: constant[ Setter method for remote_mep, mapped from YANG variable /protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/mep/cfm_mep_sub_commands/remote_mep (list) If this variable is read-only (config: false) in the source YANG file, then _set...
keyword[def] identifier[_set_remote_mep] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ): literal[string] keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ): identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] ) keyword[try] : ide...
def _set_remote_mep(self, v, load=False): """ Setter method for remote_mep, mapped from YANG variable /protocol/cfm/domain_name/ma_name/cfm_ma_sub_commands/mep/cfm_mep_sub_commands/remote_mep (list) If this variable is read-only (config: false) in the source YANG file, then _set_remote_mep is considered...
def visit_html(self, node): """ Generate html elements and schematic json """ parentClsNode = node.parent.parent assert parentClsNode.attributes['objtype'] == 'class' assert parentClsNode.attributes['domain'] == 'py' sign = node.parent.parent.children[0] a...
def function[visit_html, parameter[self, node]]: constant[ Generate html elements and schematic json ] variable[parentClsNode] assign[=] name[node].parent.parent assert[compare[call[name[parentClsNode].attributes][constant[objtype]] equal[==] constant[class]]] assert[compare[call...
keyword[def] identifier[visit_html] ( identifier[self] , identifier[node] ): literal[string] identifier[parentClsNode] = identifier[node] . identifier[parent] . identifier[parent] keyword[assert] identifier[parentClsNode] . identifier[attributes] [ literal[string] ]== literal[string] ...
def visit_html(self, node): """ Generate html elements and schematic json """ parentClsNode = node.parent.parent assert parentClsNode.attributes['objtype'] == 'class' assert parentClsNode.attributes['domain'] == 'py' sign = node.parent.parent.children[0] assert isinstance(sign, d...
def register_service(self, **kwargs): """ register this service with consul kwargs passed to Consul.agent.service.register """ kwargs.setdefault('name', self.app.name) self.session.agent.service.register(**kwargs)
def function[register_service, parameter[self]]: constant[ register this service with consul kwargs passed to Consul.agent.service.register ] call[name[kwargs].setdefault, parameter[constant[name], name[self].app.name]] call[name[self].session.agent.service.register, para...
keyword[def] identifier[register_service] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[kwargs] . identifier[setdefault] ( literal[string] , identifier[self] . identifier[app] . identifier[name] ) identifier[self] . identifier[session] . identifier[agent] . identi...
def register_service(self, **kwargs): """ register this service with consul kwargs passed to Consul.agent.service.register """ kwargs.setdefault('name', self.app.name) self.session.agent.service.register(**kwargs)
def wc_lha2dict(lha): """Convert a dictionary returned by pylha from a DSixTools WC input file into a dictionary of Wilson coefficients.""" C = OrderedDict() # try to read all WCs with 0, 2, or 4 fermions; if not found, set to zero for k, (block, i) in WC_dict_0f.items(): try: C[...
def function[wc_lha2dict, parameter[lha]]: constant[Convert a dictionary returned by pylha from a DSixTools WC input file into a dictionary of Wilson coefficients.] variable[C] assign[=] call[name[OrderedDict], parameter[]] for taget[tuple[[<ast.Name object at 0x7da18ede4c70>, <ast.Tuple obj...
keyword[def] identifier[wc_lha2dict] ( identifier[lha] ): literal[string] identifier[C] = identifier[OrderedDict] () keyword[for] identifier[k] ,( identifier[block] , identifier[i] ) keyword[in] identifier[WC_dict_0f] . identifier[items] (): keyword[try] : identifier[C] [ ...
def wc_lha2dict(lha): """Convert a dictionary returned by pylha from a DSixTools WC input file into a dictionary of Wilson coefficients.""" C = OrderedDict() # try to read all WCs with 0, 2, or 4 fermions; if not found, set to zero for (k, (block, i)) in WC_dict_0f.items(): try: ...
def set_division(self, division): """ Select the "current" division that we'll be working on/with. """ try: division = int(division) except (TypeError, ValueError): raise V1DivisionError('Supplied division %r is not a number' % ...
def function[set_division, parameter[self, division]]: constant[ Select the "current" division that we'll be working on/with. ] <ast.Try object at 0x7da1b039ace0> variable[urlbase] assign[=] binary_operation[constant[v1/%d/] <ast.Mod object at 0x7da2590d6920> tuple[[<ast.Name object ...
keyword[def] identifier[set_division] ( identifier[self] , identifier[division] ): literal[string] keyword[try] : identifier[division] = identifier[int] ( identifier[division] ) keyword[except] ( identifier[TypeError] , identifier[ValueError] ): keyword[raise] id...
def set_division(self, division): """ Select the "current" division that we'll be working on/with. """ try: division = int(division) # depends on [control=['try'], data=[]] except (TypeError, ValueError): raise V1DivisionError('Supplied division %r is not a number' % (divisi...
def update_group_dampening(self, group_id, dampening_id, dampening): """ Update an existing group dampening :param group_id: Group Trigger id attached to dampening :param dampening_id: id of the dampening to be updated :return: Group Dampening created """ data = ...
def function[update_group_dampening, parameter[self, group_id, dampening_id, dampening]]: constant[ Update an existing group dampening :param group_id: Group Trigger id attached to dampening :param dampening_id: id of the dampening to be updated :return: Group Dampening created ...
keyword[def] identifier[update_group_dampening] ( identifier[self] , identifier[group_id] , identifier[dampening_id] , identifier[dampening] ): literal[string] identifier[data] = identifier[self] . identifier[_serialize_object] ( identifier[dampening] ) identifier[url] = identifier[self] ....
def update_group_dampening(self, group_id, dampening_id, dampening): """ Update an existing group dampening :param group_id: Group Trigger id attached to dampening :param dampening_id: id of the dampening to be updated :return: Group Dampening created """ data = self._se...
def nl_socket_modify_cb(sk, type_, kind, func, arg): """Modify the callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L633 Sets specific callback functions in the existing nl_cb class instance stored in the nl_sock socket. Positional arguments:...
def function[nl_socket_modify_cb, parameter[sk, type_, kind, func, arg]]: constant[Modify the callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L633 Sets specific callback functions in the existing nl_cb class instance stored in the nl_sock soc...
keyword[def] identifier[nl_socket_modify_cb] ( identifier[sk] , identifier[type_] , identifier[kind] , identifier[func] , identifier[arg] ): literal[string] keyword[return] identifier[int] ( identifier[nl_cb_set] ( identifier[sk] . identifier[s_cb] , identifier[type_] , identifier[kind] , identifier[func]...
def nl_socket_modify_cb(sk, type_, kind, func, arg): """Modify the callback handler associated with the socket. https://github.com/thom311/libnl/blob/libnl3_2_25/lib/socket.c#L633 Sets specific callback functions in the existing nl_cb class instance stored in the nl_sock socket. Positional arguments:...
def create(vm_): r''' Create a single VM from a data dict. vm\_ The dictionary use to create a VM. Optional vm\_ dict options for overwriting template: region_id Optional - OpenNebula Zone ID memory Optional - In MB cpu Optional - Percent of host CPU to a...
def function[create, parameter[vm_]]: constant[ Create a single VM from a data dict. vm\_ The dictionary use to create a VM. Optional vm\_ dict options for overwriting template: region_id Optional - OpenNebula Zone ID memory Optional - In MB cpu Optio...
keyword[def] identifier[create] ( identifier[vm_] ): literal[string] keyword[try] : keyword[if] identifier[vm_] [ literal[string] ] keyword[and] identifier[config] . identifier[is_profile_configured] ( identifier[__opts__] , identifier[__active_provider_name__] keyword[or] litera...
def create(vm_): """ Create a single VM from a data dict. vm\\_ The dictionary use to create a VM. Optional vm\\_ dict options for overwriting template: region_id Optional - OpenNebula Zone ID memory Optional - In MB cpu Optional - Percent of host CPU to ...
def mask_and_mean_loss(input_tensor, binary_tensor, axis=None): """ Mask a loss by using a tensor filled with 0 or 1 and average correctly. :param input_tensor: A float tensor of shape [batch_size, ...] representing the loss/cross_entropy :param binary_tensor: A float tensor of shape [batch_size, ...] ...
def function[mask_and_mean_loss, parameter[input_tensor, binary_tensor, axis]]: constant[ Mask a loss by using a tensor filled with 0 or 1 and average correctly. :param input_tensor: A float tensor of shape [batch_size, ...] representing the loss/cross_entropy :param binary_tensor: A float tensor o...
keyword[def] identifier[mask_and_mean_loss] ( identifier[input_tensor] , identifier[binary_tensor] , identifier[axis] = keyword[None] ): literal[string] keyword[return] identifier[mean_on_masked] ( identifier[mask_loss] ( identifier[input_tensor] , identifier[binary_tensor] ), identifier[binary_tensor] , ...
def mask_and_mean_loss(input_tensor, binary_tensor, axis=None): """ Mask a loss by using a tensor filled with 0 or 1 and average correctly. :param input_tensor: A float tensor of shape [batch_size, ...] representing the loss/cross_entropy :param binary_tensor: A float tensor of shape [batch_size, ...] ...
def write_json(json_obj, filename, mode="w", print_pretty=True): '''write_json will (optionally,pretty print) a json object to file :param json_obj: the dict to print to json :param filename: the output file to write to :param pretty_print: if True, will use nicer formatting ''' with open(filena...
def function[write_json, parameter[json_obj, filename, mode, print_pretty]]: constant[write_json will (optionally,pretty print) a json object to file :param json_obj: the dict to print to json :param filename: the output file to write to :param pretty_print: if True, will use nicer formatting ] ...
keyword[def] identifier[write_json] ( identifier[json_obj] , identifier[filename] , identifier[mode] = literal[string] , identifier[print_pretty] = keyword[True] ): literal[string] keyword[with] identifier[open] ( identifier[filename] , identifier[mode] ) keyword[as] identifier[filey] : keyword[...
def write_json(json_obj, filename, mode='w', print_pretty=True): """write_json will (optionally,pretty print) a json object to file :param json_obj: the dict to print to json :param filename: the output file to write to :param pretty_print: if True, will use nicer formatting """ with open(filena...
def _run_collect_allelic_counts(pos_file, pos_name, work_dir, data): """Counts by alleles for a specific sample and set of positions. """ out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "structural", "counts")) out_file = os.path.join(out_dir, "%s-%s-counts.tsv" % (dd.get_sample_name(da...
def function[_run_collect_allelic_counts, parameter[pos_file, pos_name, work_dir, data]]: constant[Counts by alleles for a specific sample and set of positions. ] variable[out_dir] assign[=] call[name[utils].safe_makedir, parameter[call[name[os].path.join, parameter[call[name[dd].get_work_dir, param...
keyword[def] identifier[_run_collect_allelic_counts] ( identifier[pos_file] , identifier[pos_name] , identifier[work_dir] , identifier[data] ): literal[string] identifier[out_dir] = identifier[utils] . identifier[safe_makedir] ( identifier[os] . identifier[path] . identifier[join] ( identifier[dd] . identi...
def _run_collect_allelic_counts(pos_file, pos_name, work_dir, data): """Counts by alleles for a specific sample and set of positions. """ out_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), 'structural', 'counts')) out_file = os.path.join(out_dir, '%s-%s-counts.tsv' % (dd.get_sample_name(da...