code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def load_bot_parameters(config_bundle) -> ConfigObject: """ Initializes the agent in the bundle's python file and asks it to provide its custom configuration object where its parameters can be set. :return: the parameters as a ConfigObject """ # Python file relative to the config location. p...
def function[load_bot_parameters, parameter[config_bundle]]: constant[ Initializes the agent in the bundle's python file and asks it to provide its custom configuration object where its parameters can be set. :return: the parameters as a ConfigObject ] variable[python_file] assign[=] nam...
keyword[def] identifier[load_bot_parameters] ( identifier[config_bundle] )-> identifier[ConfigObject] : literal[string] identifier[python_file] = identifier[config_bundle] . identifier[python_file] identifier[agent_class_wrapper] = identifier[import_agent] ( identifier[python_file] ) identi...
def load_bot_parameters(config_bundle) -> ConfigObject: """ Initializes the agent in the bundle's python file and asks it to provide its custom configuration object where its parameters can be set. :return: the parameters as a ConfigObject """ # Python file relative to the config location. p...
def cipher(rkey, pt, Nk=4): """AES encryption cipher.""" assert Nk in {4, 6, 8} Nr = Nk + 6 rkey = rkey.reshape(4*(Nr+1), 32) pt = pt.reshape(128) # first round state = add_round_key(pt, rkey[0:4]) for i in range(1, Nr): state = sub_bytes(state) state = shift_rows(stat...
def function[cipher, parameter[rkey, pt, Nk]]: constant[AES encryption cipher.] assert[compare[name[Nk] in <ast.Set object at 0x7da1b0c65840>]] variable[Nr] assign[=] binary_operation[name[Nk] + constant[6]] variable[rkey] assign[=] call[name[rkey].reshape, parameter[binary_operation[constan...
keyword[def] identifier[cipher] ( identifier[rkey] , identifier[pt] , identifier[Nk] = literal[int] ): literal[string] keyword[assert] identifier[Nk] keyword[in] { literal[int] , literal[int] , literal[int] } identifier[Nr] = identifier[Nk] + literal[int] identifier[rkey] = identifier[rkey] ....
def cipher(rkey, pt, Nk=4): """AES encryption cipher.""" assert Nk in {4, 6, 8} Nr = Nk + 6 rkey = rkey.reshape(4 * (Nr + 1), 32) pt = pt.reshape(128) # first round state = add_round_key(pt, rkey[0:4]) for i in range(1, Nr): state = sub_bytes(state) state = shift_rows(sta...
def get_table_description(self, cursor, table_name, identity_check=True): """Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the table's fields for th...
def function[get_table_description, parameter[self, cursor, table_name, identity_check]]: constant[Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the...
keyword[def] identifier[get_table_description] ( identifier[self] , identifier[cursor] , identifier[table_name] , identifier[identity_check] = keyword[True] ): literal[string] identifier[columns] =[[ identifier[c] [ literal[int] ], identifier[c] [ literal[int] ], keyword[None] , identifie...
def get_table_description(self, cursor, table_name, identity_check=True): """Returns a description of the table, with DB-API cursor.description interface. The 'auto_check' parameter has been added to the function argspec. If set to True, the function will check each of the table's fields for the ...
def rm_(key, recurse=False, profile=None, **kwargs): ''' .. versionadded:: 2014.7.0 Delete a key from etcd. Returns True if the key was deleted, False if it was not and None if there was a failure. CLI Example: .. code-block:: bash salt myminion etcd.rm /path/to/key salt my...
def function[rm_, parameter[key, recurse, profile]]: constant[ .. versionadded:: 2014.7.0 Delete a key from etcd. Returns True if the key was deleted, False if it was not and None if there was a failure. CLI Example: .. code-block:: bash salt myminion etcd.rm /path/to/key ...
keyword[def] identifier[rm_] ( identifier[key] , identifier[recurse] = keyword[False] , identifier[profile] = keyword[None] ,** identifier[kwargs] ): literal[string] identifier[client] = identifier[__utils__] [ literal[string] ]( identifier[__opts__] , identifier[profile] ,** identifier[kwargs] ) keyw...
def rm_(key, recurse=False, profile=None, **kwargs): """ .. versionadded:: 2014.7.0 Delete a key from etcd. Returns True if the key was deleted, False if it was not and None if there was a failure. CLI Example: .. code-block:: bash salt myminion etcd.rm /path/to/key salt my...
def parse_string(xml): """ Returns a slash-formatted string from the given XML representation. The return value is a TokenString (for MBSP) or TaggedString (for Pattern). """ string = "" # Traverse all the <sentence> elements in the XML. dom = XML(xml) for sentence in dom(XML_SENTENCE): ...
def function[parse_string, parameter[xml]]: constant[ Returns a slash-formatted string from the given XML representation. The return value is a TokenString (for MBSP) or TaggedString (for Pattern). ] variable[string] assign[=] constant[] variable[dom] assign[=] call[name[XML], parame...
keyword[def] identifier[parse_string] ( identifier[xml] ): literal[string] identifier[string] = literal[string] identifier[dom] = identifier[XML] ( identifier[xml] ) keyword[for] identifier[sentence] keyword[in] identifier[dom] ( identifier[XML_SENTENCE] ): identifier[_anchors] ...
def parse_string(xml): """ Returns a slash-formatted string from the given XML representation. The return value is a TokenString (for MBSP) or TaggedString (for Pattern). """ string = '' # Traverse all the <sentence> elements in the XML. dom = XML(xml) for sentence in dom(XML_SENTENCE): ...
def _find_observable_paths(extra_files=None): """Finds all paths that should be observed.""" rv = set( os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x) for x in sys.path ) for filename in extra_files or (): rv.add(os.path.dirname(os.path.abspath(f...
def function[_find_observable_paths, parameter[extra_files]]: constant[Finds all paths that should be observed.] variable[rv] assign[=] call[name[set], parameter[<ast.GeneratorExp object at 0x7da2047eb9a0>]] for taget[name[filename]] in starred[<ast.BoolOp object at 0x7da2047eb3d0>] begin[:] ...
keyword[def] identifier[_find_observable_paths] ( identifier[extra_files] = keyword[None] ): literal[string] identifier[rv] = identifier[set] ( identifier[os] . identifier[path] . identifier[dirname] ( identifier[os] . identifier[path] . identifier[abspath] ( identifier[x] )) keyword[if] identifier[o...
def _find_observable_paths(extra_files=None): """Finds all paths that should be observed.""" rv = set((os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x) for x in sys.path)) for filename in extra_files or (): rv.add(os.path.dirname(os.path.abspath(filename))) # depends...
def register_commands(package=None, version=None, release=None, srcdir='.'): """ This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``. """ if package is not None: warnings.warn('The package argument to genera...
def function[register_commands, parameter[package, version, release, srcdir]]: constant[ This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``. ] if compare[name[package] is_not constant[None]] begin[:] ...
keyword[def] identifier[register_commands] ( identifier[package] = keyword[None] , identifier[version] = keyword[None] , identifier[release] = keyword[None] , identifier[srcdir] = literal[string] ): literal[string] keyword[if] identifier[package] keyword[is] keyword[not] keyword[None] : ident...
def register_commands(package=None, version=None, release=None, srcdir='.'): """ This function generates a dictionary containing customized commands that can then be passed to the ``cmdclass`` argument in ``setup()``. """ if package is not None: warnings.warn('The package argument to generat...
def get_mod_time(self, path): """ Returns a datetime object representing the last time the file was modified :param path: remote file path :type path: string """ conn = self.get_conn() ftp_mdtm = conn.sendcmd('MDTM ' + path) time_val = ftp_mdtm[4:] ...
def function[get_mod_time, parameter[self, path]]: constant[ Returns a datetime object representing the last time the file was modified :param path: remote file path :type path: string ] variable[conn] assign[=] call[name[self].get_conn, parameter[]] variable[ftp...
keyword[def] identifier[get_mod_time] ( identifier[self] , identifier[path] ): literal[string] identifier[conn] = identifier[self] . identifier[get_conn] () identifier[ftp_mdtm] = identifier[conn] . identifier[sendcmd] ( literal[string] + identifier[path] ) identifier[time_val] = ...
def get_mod_time(self, path): """ Returns a datetime object representing the last time the file was modified :param path: remote file path :type path: string """ conn = self.get_conn() ftp_mdtm = conn.sendcmd('MDTM ' + path) time_val = ftp_mdtm[4:] # time_val optiona...
def plugin(module, *args, **kwargs): """ Decorator to extend a package to a view. The module can be a class or function. It will copy all the methods to the class ie: # Your module.py my_ext(view, **kwargs): class MyExtension(object): def my_view(self): ...
def function[plugin, parameter[module]]: constant[ Decorator to extend a package to a view. The module can be a class or function. It will copy all the methods to the class ie: # Your module.py my_ext(view, **kwargs): class MyExtension(object): def my_vie...
keyword[def] identifier[plugin] ( identifier[module] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[def] identifier[wrap] ( identifier[f] ): identifier[m] = identifier[module] ( identifier[f] ,* identifier[args] ,** identifier[kwargs] ) keyword[if] identifier[insp...
def plugin(module, *args, **kwargs): """ Decorator to extend a package to a view. The module can be a class or function. It will copy all the methods to the class ie: # Your module.py my_ext(view, **kwargs): class MyExtension(object): def my_view(self): ...
def dafps(nd, ni, dc, ic): """ Pack (assemble) an array summary from its double precision and integer components. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafps_c.html :param nd: Number of double precision components. :type nd: int :param ni: Number of integer components. ...
def function[dafps, parameter[nd, ni, dc, ic]]: constant[ Pack (assemble) an array summary from its double precision and integer components. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafps_c.html :param nd: Number of double precision components. :type nd: int :param ni: N...
keyword[def] identifier[dafps] ( identifier[nd] , identifier[ni] , identifier[dc] , identifier[ic] ): literal[string] identifier[dc] = identifier[stypes] . identifier[toDoubleVector] ( identifier[dc] ) identifier[ic] = identifier[stypes] . identifier[toIntVector] ( identifier[ic] ) identifier[out...
def dafps(nd, ni, dc, ic): """ Pack (assemble) an array summary from its double precision and integer components. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dafps_c.html :param nd: Number of double precision components. :type nd: int :param ni: Number of integer components. ...
def standard_streamer(parsing_functions, parse_satoshi_int=parse_satoshi_int): """ Create a satoshi_streamer, which parses and packs using the bitcoin protocol (mostly the custom way arrays and integers are parsed and packed). """ streamer = Streamer() streamer.register_array_count_parse(parse_s...
def function[standard_streamer, parameter[parsing_functions, parse_satoshi_int]]: constant[ Create a satoshi_streamer, which parses and packs using the bitcoin protocol (mostly the custom way arrays and integers are parsed and packed). ] variable[streamer] assign[=] call[name[Streamer], para...
keyword[def] identifier[standard_streamer] ( identifier[parsing_functions] , identifier[parse_satoshi_int] = identifier[parse_satoshi_int] ): literal[string] identifier[streamer] = identifier[Streamer] () identifier[streamer] . identifier[register_array_count_parse] ( identifier[parse_satoshi_int] ) ...
def standard_streamer(parsing_functions, parse_satoshi_int=parse_satoshi_int): """ Create a satoshi_streamer, which parses and packs using the bitcoin protocol (mostly the custom way arrays and integers are parsed and packed). """ streamer = Streamer() streamer.register_array_count_parse(parse_s...
def create_virtualenv(self): """ Populate venv from preloaded image """ return task.create_virtualenv(self.target, self.datadir, self._preload_image(), self._get_container_name)
def function[create_virtualenv, parameter[self]]: constant[ Populate venv from preloaded image ] return[call[name[task].create_virtualenv, parameter[name[self].target, name[self].datadir, call[name[self]._preload_image, parameter[]], name[self]._get_container_name]]]
keyword[def] identifier[create_virtualenv] ( identifier[self] ): literal[string] keyword[return] identifier[task] . identifier[create_virtualenv] ( identifier[self] . identifier[target] , identifier[self] . identifier[datadir] , identifier[self] . identifier[_preload_image] (), identifier...
def create_virtualenv(self): """ Populate venv from preloaded image """ return task.create_virtualenv(self.target, self.datadir, self._preload_image(), self._get_container_name)
def total_items(self, request): """ Get total number of items in the basket """ n_total = 0 for item in self.get_queryset(request): n_total += item.quantity return Response(data={"quantity": n_total}, status=status.HTTP_200_OK)
def function[total_items, parameter[self, request]]: constant[ Get total number of items in the basket ] variable[n_total] assign[=] constant[0] for taget[name[item]] in starred[call[name[self].get_queryset, parameter[name[request]]]] begin[:] <ast.AugAssign object at 0x7...
keyword[def] identifier[total_items] ( identifier[self] , identifier[request] ): literal[string] identifier[n_total] = literal[int] keyword[for] identifier[item] keyword[in] identifier[self] . identifier[get_queryset] ( identifier[request] ): identifier[n_total] += ide...
def total_items(self, request): """ Get total number of items in the basket """ n_total = 0 for item in self.get_queryset(request): n_total += item.quantity # depends on [control=['for'], data=['item']] return Response(data={'quantity': n_total}, status=status.HTTP_200_OK)
def hexbin(x, y, color="purple", **kwargs): """Seaborn-compatible hexbin plot. See also: http://seaborn.pydata.org/tutorial/axis_grids.html#mapping-custom-functions-onto-the-grid """ if HAS_SEABORN: cmap = sns.light_palette(color, as_cmap=True) else: cmap = "Purples" plt.hexbin(...
def function[hexbin, parameter[x, y, color]]: constant[Seaborn-compatible hexbin plot. See also: http://seaborn.pydata.org/tutorial/axis_grids.html#mapping-custom-functions-onto-the-grid ] if name[HAS_SEABORN] begin[:] variable[cmap] assign[=] call[name[sns].light_palette, param...
keyword[def] identifier[hexbin] ( identifier[x] , identifier[y] , identifier[color] = literal[string] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[HAS_SEABORN] : identifier[cmap] = identifier[sns] . identifier[light_palette] ( identifier[color] , identifier[as_cmap] = keyword[...
def hexbin(x, y, color='purple', **kwargs): """Seaborn-compatible hexbin plot. See also: http://seaborn.pydata.org/tutorial/axis_grids.html#mapping-custom-functions-onto-the-grid """ if HAS_SEABORN: cmap = sns.light_palette(color, as_cmap=True) # depends on [control=['if'], data=[]] else: ...
def visit_Name(self, node): """ Get range for parameters for examples or false branching. """ return self.add(node, self.result[node.id])
def function[visit_Name, parameter[self, node]]: constant[ Get range for parameters for examples or false branching. ] return[call[name[self].add, parameter[name[node], call[name[self].result][name[node].id]]]]
keyword[def] identifier[visit_Name] ( identifier[self] , identifier[node] ): literal[string] keyword[return] identifier[self] . identifier[add] ( identifier[node] , identifier[self] . identifier[result] [ identifier[node] . identifier[id] ])
def visit_Name(self, node): """ Get range for parameters for examples or false branching. """ return self.add(node, self.result[node.id])
def geocode(address, required_precision_km=1.): """ Identifies the coordinates of an address :param address: the address to be geocoded :type value: String :param required_precision_km: the maximum permissible geographic uncertainty for the geocoding :type required_precision...
def function[geocode, parameter[address, required_precision_km]]: constant[ Identifies the coordinates of an address :param address: the address to be geocoded :type value: String :param required_precision_km: the maximum permissible geographic uncertainty for the geocoding ...
keyword[def] identifier[geocode] ( identifier[address] , identifier[required_precision_km] = literal[int] ): literal[string] identifier[geocoded] = identifier[geocoder] . identifier[google] ( identifier[address] ) identifier[precision_km] = identifier[geocode_confidences] [ identifier[geocoded] . iden...
def geocode(address, required_precision_km=1.0): """ Identifies the coordinates of an address :param address: the address to be geocoded :type value: String :param required_precision_km: the maximum permissible geographic uncertainty for the geocoding :type required_precisio...
def reverse_geocode(self, lat, lng, **kwargs): """ Given a latitude & longitude, return an address for that point from OpenCage's Geocoder. :param lat: Latitude :param lng: Longitude :return: Results from OpenCageData :rtype: dict :raises RateLimitExceededError: ...
def function[reverse_geocode, parameter[self, lat, lng]]: constant[ Given a latitude & longitude, return an address for that point from OpenCage's Geocoder. :param lat: Latitude :param lng: Longitude :return: Results from OpenCageData :rtype: dict :raises RateLim...
keyword[def] identifier[reverse_geocode] ( identifier[self] , identifier[lat] , identifier[lng] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[geocode] ( identifier[_query_for_reverse_geocoding] ( identifier[lat] , identifier[lng] ),** identifier[kwargs] )
def reverse_geocode(self, lat, lng, **kwargs): """ Given a latitude & longitude, return an address for that point from OpenCage's Geocoder. :param lat: Latitude :param lng: Longitude :return: Results from OpenCageData :rtype: dict :raises RateLimitExceededError: if y...
async def filter(self, request): """Filter collection.""" collection = self.collection self.filter_form.process(request.query) data = self.filter_form.data self.filter_form.active = any(o and o is not DEFAULT for o in data.values()) for flt in self.columns_filters: ...
<ast.AsyncFunctionDef object at 0x7da1b235df60>
keyword[async] keyword[def] identifier[filter] ( identifier[self] , identifier[request] ): literal[string] identifier[collection] = identifier[self] . identifier[collection] identifier[self] . identifier[filter_form] . identifier[process] ( identifier[request] . identifier[query] ) ...
async def filter(self, request): """Filter collection.""" collection = self.collection self.filter_form.process(request.query) data = self.filter_form.data self.filter_form.active = any((o and o is not DEFAULT for o in data.values())) for flt in self.columns_filters: try: col...
def username(self, template: Optional[str] = None) -> str: """Generate username by template. Supported template placeholders: (U, l, d) Supported separators: (-, ., _) Template must contain at least one "U" or "l" placeholder. If template is None one of the following template...
def function[username, parameter[self, template]]: constant[Generate username by template. Supported template placeholders: (U, l, d) Supported separators: (-, ., _) Template must contain at least one "U" or "l" placeholder. If template is None one of the following templates ...
keyword[def] identifier[username] ( identifier[self] , identifier[template] : identifier[Optional] [ identifier[str] ]= keyword[None] )-> identifier[str] : literal[string] identifier[MIN_DATE] = literal[int] identifier[MAX_DATE] = literal[int] identifier[DEFAULT_TEMPLATE] = lite...
def username(self, template: Optional[str]=None) -> str: """Generate username by template. Supported template placeholders: (U, l, d) Supported separators: (-, ., _) Template must contain at least one "U" or "l" placeholder. If template is None one of the following templates is u...
def _true_anom_to_phase(true_anom, period, ecc, per0): """ TODO: add documentation """ phshift = 0 mean_anom = true_anom - (ecc*sin(true_anom))*u.deg Phi = (mean_anom + per0) / (360*u.deg) - 1./4 # phase = Phi - (phshift - 0.25 + per0/(360*u.deg)) * period phase = (Phi*u.d - (phshift ...
def function[_true_anom_to_phase, parameter[true_anom, period, ecc, per0]]: constant[ TODO: add documentation ] variable[phshift] assign[=] constant[0] variable[mean_anom] assign[=] binary_operation[name[true_anom] - binary_operation[binary_operation[name[ecc] * call[name[sin], parameter...
keyword[def] identifier[_true_anom_to_phase] ( identifier[true_anom] , identifier[period] , identifier[ecc] , identifier[per0] ): literal[string] identifier[phshift] = literal[int] identifier[mean_anom] = identifier[true_anom] -( identifier[ecc] * identifier[sin] ( identifier[true_anom] ))* identifi...
def _true_anom_to_phase(true_anom, period, ecc, per0): """ TODO: add documentation """ phshift = 0 mean_anom = true_anom - ecc * sin(true_anom) * u.deg Phi = (mean_anom + per0) / (360 * u.deg) - 1.0 / 4 # phase = Phi - (phshift - 0.25 + per0/(360*u.deg)) * period phase = (Phi * u.d - (ph...
def add_spatial_unit_condition(self, droppable_id, container_id, spatial_unit, match=True): """stub""" if not isinstance(spatial_unit, abc_mapping_primitives.SpatialUnit): raise InvalidArgument('spatial_unit is not a SpatialUnit') self.my_osid_object_form._my_map['spatialUnitConditi...
def function[add_spatial_unit_condition, parameter[self, droppable_id, container_id, spatial_unit, match]]: constant[stub] if <ast.UnaryOp object at 0x7da20c796560> begin[:] <ast.Raise object at 0x7da20c7943d0> call[call[name[self].my_osid_object_form._my_map][constant[spatialUnitConditi...
keyword[def] identifier[add_spatial_unit_condition] ( identifier[self] , identifier[droppable_id] , identifier[container_id] , identifier[spatial_unit] , identifier[match] = keyword[True] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[spatial_unit] , identifier[ab...
def add_spatial_unit_condition(self, droppable_id, container_id, spatial_unit, match=True): """stub""" if not isinstance(spatial_unit, abc_mapping_primitives.SpatialUnit): raise InvalidArgument('spatial_unit is not a SpatialUnit') # depends on [control=['if'], data=[]] self.my_osid_object_form._my_...
def hostname_for_event(self, clean_server_name): """Return a reasonable hostname for a replset membership event to mention.""" uri = urlsplit(clean_server_name) if '@' in uri.netloc: hostname = uri.netloc.split('@')[1].split(':')[0] else: hostname = uri.netloc.spl...
def function[hostname_for_event, parameter[self, clean_server_name]]: constant[Return a reasonable hostname for a replset membership event to mention.] variable[uri] assign[=] call[name[urlsplit], parameter[name[clean_server_name]]] if compare[constant[@] in name[uri].netloc] begin[:] ...
keyword[def] identifier[hostname_for_event] ( identifier[self] , identifier[clean_server_name] ): literal[string] identifier[uri] = identifier[urlsplit] ( identifier[clean_server_name] ) keyword[if] literal[string] keyword[in] identifier[uri] . identifier[netloc] : identifi...
def hostname_for_event(self, clean_server_name): """Return a reasonable hostname for a replset membership event to mention.""" uri = urlsplit(clean_server_name) if '@' in uri.netloc: hostname = uri.netloc.split('@')[1].split(':')[0] # depends on [control=['if'], data=[]] else: hostname ...
def spherical_matrix(theta, phi, axes='sxyz'): """ Give a spherical coordinate vector, find the rotation that will transform a [0,0,1] vector to those coordinates Parameters ----------- theta: float, rotation angle in radians phi: float, rotation angle in radians Returns --------...
def function[spherical_matrix, parameter[theta, phi, axes]]: constant[ Give a spherical coordinate vector, find the rotation that will transform a [0,0,1] vector to those coordinates Parameters ----------- theta: float, rotation angle in radians phi: float, rotation angle in radians ...
keyword[def] identifier[spherical_matrix] ( identifier[theta] , identifier[phi] , identifier[axes] = literal[string] ): literal[string] identifier[result] = identifier[euler_matrix] ( literal[int] , identifier[phi] , identifier[theta] , identifier[axes] = identifier[axes] ) keyword[return] identifier...
def spherical_matrix(theta, phi, axes='sxyz'): """ Give a spherical coordinate vector, find the rotation that will transform a [0,0,1] vector to those coordinates Parameters ----------- theta: float, rotation angle in radians phi: float, rotation angle in radians Returns --------...
def to_api_data(self, restrict_keys=None): """ Returns a dict to communicate with the server :param restrict_keys: a set of keys to restrict the returned data to :rtype: dict """ cc = self._cc # alias data = { cc('column_width'): self._column_width, ...
def function[to_api_data, parameter[self, restrict_keys]]: constant[ Returns a dict to communicate with the server :param restrict_keys: a set of keys to restrict the returned data to :rtype: dict ] variable[cc] assign[=] name[self]._cc variable[data] assign[=] dictionar...
keyword[def] identifier[to_api_data] ( identifier[self] , identifier[restrict_keys] = keyword[None] ): literal[string] identifier[cc] = identifier[self] . identifier[_cc] identifier[data] ={ identifier[cc] ( literal[string] ): identifier[self] . identifier[_column_width] , ...
def to_api_data(self, restrict_keys=None): """ Returns a dict to communicate with the server :param restrict_keys: a set of keys to restrict the returned data to :rtype: dict """ cc = self._cc # alias data = {cc('column_width'): self._column_width, cc('horizontal_alignment'): self....
def _moveCachedFile(from_key, to_key): ''' Move a file atomically within the cache: used to make cached files available at known keys, so they can be used by other processes. ''' cache_dir = folders.cacheDirectory() from_path = os.path.join(cache_dir, from_key) to_path = os.path.join(cache...
def function[_moveCachedFile, parameter[from_key, to_key]]: constant[ Move a file atomically within the cache: used to make cached files available at known keys, so they can be used by other processes. ] variable[cache_dir] assign[=] call[name[folders].cacheDirectory, parameter[]] va...
keyword[def] identifier[_moveCachedFile] ( identifier[from_key] , identifier[to_key] ): literal[string] identifier[cache_dir] = identifier[folders] . identifier[cacheDirectory] () identifier[from_path] = identifier[os] . identifier[path] . identifier[join] ( identifier[cache_dir] , identifier[from_key...
def _moveCachedFile(from_key, to_key): """ Move a file atomically within the cache: used to make cached files available at known keys, so they can be used by other processes. """ cache_dir = folders.cacheDirectory() from_path = os.path.join(cache_dir, from_key) to_path = os.path.join(cache_d...
def terminal_width(value): """Returns the width of the string it would be when displayed.""" if isinstance(value, bytes): value = value.decode("utf8", "ignore") return sum(map(get_width, map(ord, value)))
def function[terminal_width, parameter[value]]: constant[Returns the width of the string it would be when displayed.] if call[name[isinstance], parameter[name[value], name[bytes]]] begin[:] variable[value] assign[=] call[name[value].decode, parameter[constant[utf8], constant[ignore]]] ...
keyword[def] identifier[terminal_width] ( identifier[value] ): literal[string] keyword[if] identifier[isinstance] ( identifier[value] , identifier[bytes] ): identifier[value] = identifier[value] . identifier[decode] ( literal[string] , literal[string] ) keyword[return] identifier[sum] ( ide...
def terminal_width(value): """Returns the width of the string it would be when displayed.""" if isinstance(value, bytes): value = value.decode('utf8', 'ignore') # depends on [control=['if'], data=[]] return sum(map(get_width, map(ord, value)))
def sort_kate_imports(add_imports=(), remove_imports=()): """Sorts imports within Kate while maintaining cursor position and selection, even if length of file changes.""" document = kate.activeDocument() view = document.activeView() position = view.cursorPosition() selection = view.selectionRange() ...
def function[sort_kate_imports, parameter[add_imports, remove_imports]]: constant[Sorts imports within Kate while maintaining cursor position and selection, even if length of file changes.] variable[document] assign[=] call[name[kate].activeDocument, parameter[]] variable[view] assign[=] call[na...
keyword[def] identifier[sort_kate_imports] ( identifier[add_imports] =(), identifier[remove_imports] =()): literal[string] identifier[document] = identifier[kate] . identifier[activeDocument] () identifier[view] = identifier[document] . identifier[activeView] () identifier[position] = identifier[...
def sort_kate_imports(add_imports=(), remove_imports=()): """Sorts imports within Kate while maintaining cursor position and selection, even if length of file changes.""" document = kate.activeDocument() view = document.activeView() position = view.cursorPosition() selection = view.selectionRange() ...
def get_recipe(cls, name, ctx): '''Returns the Recipe with the given name, if it exists.''' name = name.lower() if not hasattr(cls, "recipes"): cls.recipes = {} if name in cls.recipes: return cls.recipes[name] recipe_file = None for recipes_dir in...
def function[get_recipe, parameter[cls, name, ctx]]: constant[Returns the Recipe with the given name, if it exists.] variable[name] assign[=] call[name[name].lower, parameter[]] if <ast.UnaryOp object at 0x7da1b2121960> begin[:] name[cls].recipes assign[=] dictionary[[], []] ...
keyword[def] identifier[get_recipe] ( identifier[cls] , identifier[name] , identifier[ctx] ): literal[string] identifier[name] = identifier[name] . identifier[lower] () keyword[if] keyword[not] identifier[hasattr] ( identifier[cls] , literal[string] ): identifier[cls] . iden...
def get_recipe(cls, name, ctx): """Returns the Recipe with the given name, if it exists.""" name = name.lower() if not hasattr(cls, 'recipes'): cls.recipes = {} # depends on [control=['if'], data=[]] if name in cls.recipes: return cls.recipes[name] # depends on [control=['if'], data=['...
def handle_tags(userdata, macros): """Insert macro values or auto export variables in UserData scripts. :param userdata: The UserData script. :type userdata: str :param macros: UserData macros as key value pair. :type macros: dict :return: UserData script with the macros...
def function[handle_tags, parameter[userdata, macros]]: constant[Insert macro values or auto export variables in UserData scripts. :param userdata: The UserData script. :type userdata: str :param macros: UserData macros as key value pair. :type macros: dict :return: User...
keyword[def] identifier[handle_tags] ( identifier[userdata] , identifier[macros] ): literal[string] identifier[macro_vars] = identifier[re] . identifier[findall] ( literal[string] , identifier[userdata] ) keyword[for] identifier[macro_var] keyword[in] identifier[macro_vars] : ...
def handle_tags(userdata, macros): """Insert macro values or auto export variables in UserData scripts. :param userdata: The UserData script. :type userdata: str :param macros: UserData macros as key value pair. :type macros: dict :return: UserData script with the macros rep...
def argmin_random_tie(seq, fn): """Return an element with lowest fn(seq[i]) score; break ties at random. Thus, for all s,f: argmin_random_tie(s, f) in argmin_list(s, f)""" best_score = fn(seq[0]); n = 0 for x in seq: x_score = fn(x) if x_score < best_score: best, best_score =...
def function[argmin_random_tie, parameter[seq, fn]]: constant[Return an element with lowest fn(seq[i]) score; break ties at random. Thus, for all s,f: argmin_random_tie(s, f) in argmin_list(s, f)] variable[best_score] assign[=] call[name[fn], parameter[call[name[seq]][constant[0]]]] variable...
keyword[def] identifier[argmin_random_tie] ( identifier[seq] , identifier[fn] ): literal[string] identifier[best_score] = identifier[fn] ( identifier[seq] [ literal[int] ]); identifier[n] = literal[int] keyword[for] identifier[x] keyword[in] identifier[seq] : identifier[x_score] = identif...
def argmin_random_tie(seq, fn): """Return an element with lowest fn(seq[i]) score; break ties at random. Thus, for all s,f: argmin_random_tie(s, f) in argmin_list(s, f)""" best_score = fn(seq[0]) n = 0 for x in seq: x_score = fn(x) if x_score < best_score: (best, best_sco...
def remove_all_lambda_permissions(app_name='', env='', region='us-east-1'): """Remove all foremast-* permissions from lambda. Args: app_name (str): Application name env (str): AWS environment region (str): AWS region """ session = boto3.Session(profile_name=env, region_name=regi...
def function[remove_all_lambda_permissions, parameter[app_name, env, region]]: constant[Remove all foremast-* permissions from lambda. Args: app_name (str): Application name env (str): AWS environment region (str): AWS region ] variable[session] assign[=] call[name[boto3...
keyword[def] identifier[remove_all_lambda_permissions] ( identifier[app_name] = literal[string] , identifier[env] = literal[string] , identifier[region] = literal[string] ): literal[string] identifier[session] = identifier[boto3] . identifier[Session] ( identifier[profile_name] = identifier[env] , identifi...
def remove_all_lambda_permissions(app_name='', env='', region='us-east-1'): """Remove all foremast-* permissions from lambda. Args: app_name (str): Application name env (str): AWS environment region (str): AWS region """ session = boto3.Session(profile_name=env, region_name=regi...
def get_array_shape(self, key): """Return array's shape""" data = self.model.get_data() return data[key].shape
def function[get_array_shape, parameter[self, key]]: constant[Return array's shape] variable[data] assign[=] call[name[self].model.get_data, parameter[]] return[call[name[data]][name[key]].shape]
keyword[def] identifier[get_array_shape] ( identifier[self] , identifier[key] ): literal[string] identifier[data] = identifier[self] . identifier[model] . identifier[get_data] () keyword[return] identifier[data] [ identifier[key] ]. identifier[shape]
def get_array_shape(self, key): """Return array's shape""" data = self.model.get_data() return data[key].shape
def create_snippet(self, name, body, timeout=None): """ API call to create a Snippet """ payload = { 'name': name, 'body': body } return self._api_request( self.SNIPPETS_ENDPOINT, self.HTTP_POST, payload=payload, tim...
def function[create_snippet, parameter[self, name, body, timeout]]: constant[ API call to create a Snippet ] variable[payload] assign[=] dictionary[[<ast.Constant object at 0x7da1aff1cd00>, <ast.Constant object at 0x7da1aff1e4a0>], [<ast.Name object at 0x7da1aff1efe0>, <ast.Name object at 0x7da1aff1e920...
keyword[def] identifier[create_snippet] ( identifier[self] , identifier[name] , identifier[body] , identifier[timeout] = keyword[None] ): literal[string] identifier[payload] ={ literal[string] : identifier[name] , literal[string] : identifier[body] } keyword[retu...
def create_snippet(self, name, body, timeout=None): """ API call to create a Snippet """ payload = {'name': name, 'body': body} return self._api_request(self.SNIPPETS_ENDPOINT, self.HTTP_POST, payload=payload, timeout=timeout)
def has_printout( state, index, not_printed_msg=None, pre_code=None, name=None, copy=False ): """Check if the right printouts happened. ``has_printout()`` will look for the printout in the solution code that you specified with ``index`` (0 in this case), rerun the ``print()`` call in the solution proce...
def function[has_printout, parameter[state, index, not_printed_msg, pre_code, name, copy]]: constant[Check if the right printouts happened. ``has_printout()`` will look for the printout in the solution code that you specified with ``index`` (0 in this case), rerun the ``print()`` call in the solution p...
keyword[def] identifier[has_printout] ( identifier[state] , identifier[index] , identifier[not_printed_msg] = keyword[None] , identifier[pre_code] = keyword[None] , identifier[name] = keyword[None] , identifier[copy] = keyword[False] ): literal[string] identifier[extra_msg] = literal[string] ident...
def has_printout(state, index, not_printed_msg=None, pre_code=None, name=None, copy=False): """Check if the right printouts happened. ``has_printout()`` will look for the printout in the solution code that you specified with ``index`` (0 in this case), rerun the ``print()`` call in the solution process, ca...
def _getkey(self, args, kwargs): """Get hash key from args and kwargs. args and kwargs must be hashable. :param tuple args: called vargs. :param dict kwargs: called keywords. :return: hash(tuple(args) + tuple((key, val) for key in sorted(kwargs)). :rtype: int.""" ...
def function[_getkey, parameter[self, args, kwargs]]: constant[Get hash key from args and kwargs. args and kwargs must be hashable. :param tuple args: called vargs. :param dict kwargs: called keywords. :return: hash(tuple(args) + tuple((key, val) for key in sorted(kwargs)). ...
keyword[def] identifier[_getkey] ( identifier[self] , identifier[args] , identifier[kwargs] ): literal[string] identifier[values] = identifier[list] ( identifier[args] ) identifier[keys] = identifier[sorted] ( identifier[list] ( identifier[kwargs] )) keyword[for] identifier[ke...
def _getkey(self, args, kwargs): """Get hash key from args and kwargs. args and kwargs must be hashable. :param tuple args: called vargs. :param dict kwargs: called keywords. :return: hash(tuple(args) + tuple((key, val) for key in sorted(kwargs)). :rtype: int.""" values...
def load_cdx_for_dupe(self, url, timestamp, digest, cdx_loader): """ If a cdx_server is available, return response from server, otherwise empty list """ if not cdx_loader: return iter([]) filters = [] filters.append('!mime:warc/revisit') if ...
def function[load_cdx_for_dupe, parameter[self, url, timestamp, digest, cdx_loader]]: constant[ If a cdx_server is available, return response from server, otherwise empty list ] if <ast.UnaryOp object at 0x7da18f58dc30> begin[:] return[call[name[iter], parameter[list[[]]]...
keyword[def] identifier[load_cdx_for_dupe] ( identifier[self] , identifier[url] , identifier[timestamp] , identifier[digest] , identifier[cdx_loader] ): literal[string] keyword[if] keyword[not] identifier[cdx_loader] : keyword[return] identifier[iter] ([]) identifier[filte...
def load_cdx_for_dupe(self, url, timestamp, digest, cdx_loader): """ If a cdx_server is available, return response from server, otherwise empty list """ if not cdx_loader: return iter([]) # depends on [control=['if'], data=[]] filters = [] filters.append('!mime:warc/revi...
def index(self, pkt_num): """Return datagram index.""" int_check(pkt_num) for counter, datagram in enumerate(self.datagram): if pkt_num in datagram.index: return counter return None
def function[index, parameter[self, pkt_num]]: constant[Return datagram index.] call[name[int_check], parameter[name[pkt_num]]] for taget[tuple[[<ast.Name object at 0x7da20c7943a0>, <ast.Name object at 0x7da20c795510>]]] in starred[call[name[enumerate], parameter[name[self].datagram]]] begin[:] ...
keyword[def] identifier[index] ( identifier[self] , identifier[pkt_num] ): literal[string] identifier[int_check] ( identifier[pkt_num] ) keyword[for] identifier[counter] , identifier[datagram] keyword[in] identifier[enumerate] ( identifier[self] . identifier[datagram] ): ke...
def index(self, pkt_num): """Return datagram index.""" int_check(pkt_num) for (counter, datagram) in enumerate(self.datagram): if pkt_num in datagram.index: return counter # depends on [control=['if'], data=[]] # depends on [control=['for'], data=[]] return None
def consume_message( method): """ Decorator for methods handling requests from RabbitMQ The goal of this decorator is to perform the tasks common to all methods handling requests: - Log the raw message to *stdout* - Decode the message into a Python dictionary - Log errors to *stder...
def function[consume_message, parameter[method]]: constant[ Decorator for methods handling requests from RabbitMQ The goal of this decorator is to perform the tasks common to all methods handling requests: - Log the raw message to *stdout* - Decode the message into a Python dictionary ...
keyword[def] identifier[consume_message] ( identifier[method] ): literal[string] keyword[def] identifier[wrapper] ( identifier[self] , identifier[channel] , identifier[method_frame] , identifier[header_frame] , identifier[body] ): identifier[sys] . identifier[stdo...
def consume_message(method): """ Decorator for methods handling requests from RabbitMQ The goal of this decorator is to perform the tasks common to all methods handling requests: - Log the raw message to *stdout* - Decode the message into a Python dictionary - Log errors to *stderr* - ...
def topographic_error(self, X, batch_size=1): """ Calculate the topographic error. The topographic error is a measure of the spatial organization of the map. Maps in which the most similar neurons are also close on the grid have low topographic error and indicate that a problem ...
def function[topographic_error, parameter[self, X, batch_size]]: constant[ Calculate the topographic error. The topographic error is a measure of the spatial organization of the map. Maps in which the most similar neurons are also close on the grid have low topographic error and...
keyword[def] identifier[topographic_error] ( identifier[self] , identifier[X] , identifier[batch_size] = literal[int] ): literal[string] identifier[dist] = identifier[self] . identifier[transform] ( identifier[X] , identifier[batch_size] ) identifier[res] = identifier[dis...
def topographic_error(self, X, batch_size=1): """ Calculate the topographic error. The topographic error is a measure of the spatial organization of the map. Maps in which the most similar neurons are also close on the grid have low topographic error and indicate that a problem has ...
def initialize(): """ Attempts to load default configuration from Configuration.path, returns status Loads the contents of the file referenced in Configuration.path and parses it's JSON contents. Iterates over the contents of the resulting dictionary and converts the contents in...
def function[initialize, parameter[]]: constant[ Attempts to load default configuration from Configuration.path, returns status Loads the contents of the file referenced in Configuration.path and parses it's JSON contents. Iterates over the contents of the resulting dictionary a...
keyword[def] identifier[initialize] (): literal[string] keyword[try] : identifier[f] = identifier[open] ( identifier[Configuration] . identifier[path] , literal[string] ) identifier[data] = identifier[f] . identifier[read] () identifier[f] . identifier[close] ...
def initialize(): """ Attempts to load default configuration from Configuration.path, returns status Loads the contents of the file referenced in Configuration.path and parses it's JSON contents. Iterates over the contents of the resulting dictionary and converts the contents into a...
def track_strategy_worker(self, strategy, name, interval=10, **kwargs): """跟踪下单worker :param strategy: 策略id :param name: 策略名字 :param interval: 轮询策略的时间间隔,单位为秒""" while True: try: transactions = self.query_strategy_transaction( strate...
def function[track_strategy_worker, parameter[self, strategy, name, interval]]: constant[跟踪下单worker :param strategy: 策略id :param name: 策略名字 :param interval: 轮询策略的时间间隔,单位为秒] while constant[True] begin[:] <ast.Try object at 0x7da207f019c0> for taget[name[tra...
keyword[def] identifier[track_strategy_worker] ( identifier[self] , identifier[strategy] , identifier[name] , identifier[interval] = literal[int] ,** identifier[kwargs] ): literal[string] keyword[while] keyword[True] : keyword[try] : identifier[transactions] = identif...
def track_strategy_worker(self, strategy, name, interval=10, **kwargs): """跟踪下单worker :param strategy: 策略id :param name: 策略名字 :param interval: 轮询策略的时间间隔,单位为秒""" while True: try: transactions = self.query_strategy_transaction(strategy, **kwargs) # depends on [control=...
def get(self, url): '''Get the entity that corresponds to URL.''' robots_url = Robots.robots_url(url) if robots_url not in self.cache: self.cache[robots_url] = ExpiringObject(partial(self.factory, robots_url)) return self.cache[robots_url].get()
def function[get, parameter[self, url]]: constant[Get the entity that corresponds to URL.] variable[robots_url] assign[=] call[name[Robots].robots_url, parameter[name[url]]] if compare[name[robots_url] <ast.NotIn object at 0x7da2590d7190> name[self].cache] begin[:] call[name[self...
keyword[def] identifier[get] ( identifier[self] , identifier[url] ): literal[string] identifier[robots_url] = identifier[Robots] . identifier[robots_url] ( identifier[url] ) keyword[if] identifier[robots_url] keyword[not] keyword[in] identifier[self] . identifier[cache] : ...
def get(self, url): """Get the entity that corresponds to URL.""" robots_url = Robots.robots_url(url) if robots_url not in self.cache: self.cache[robots_url] = ExpiringObject(partial(self.factory, robots_url)) # depends on [control=['if'], data=['robots_url']] return self.cache[robots_url].get(...
def inference(self, dataRDD, feed_timeout=600, qname='input'): """*For InputMode.SPARK only*: Feeds Spark RDD partitions into the TensorFlow worker nodes and returns an RDD of results It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD and provide valid data for the outp...
def function[inference, parameter[self, dataRDD, feed_timeout, qname]]: constant[*For InputMode.SPARK only*: Feeds Spark RDD partitions into the TensorFlow worker nodes and returns an RDD of results It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD and provide vali...
keyword[def] identifier[inference] ( identifier[self] , identifier[dataRDD] , identifier[feed_timeout] = literal[int] , identifier[qname] = literal[string] ): literal[string] identifier[logging] . identifier[info] ( literal[string] ) keyword[assert] identifier[self] . identifier[input_mode] == identi...
def inference(self, dataRDD, feed_timeout=600, qname='input'): """*For InputMode.SPARK only*: Feeds Spark RDD partitions into the TensorFlow worker nodes and returns an RDD of results It is the responsibility of the TensorFlow "main" function to interpret the rows of the RDD and provide valid data for the outp...
def refresh(self): """Update all environment variables from ``os.environ``. Use if ``os.environ`` was modified dynamically *after* you accessed an environment namespace with ``biome``. """ super(Habitat, self).update(self.get_environ(self._prefix))
def function[refresh, parameter[self]]: constant[Update all environment variables from ``os.environ``. Use if ``os.environ`` was modified dynamically *after* you accessed an environment namespace with ``biome``. ] call[call[name[super], parameter[name[Habitat], name[self]]].upd...
keyword[def] identifier[refresh] ( identifier[self] ): literal[string] identifier[super] ( identifier[Habitat] , identifier[self] ). identifier[update] ( identifier[self] . identifier[get_environ] ( identifier[self] . identifier[_prefix] ))
def refresh(self): """Update all environment variables from ``os.environ``. Use if ``os.environ`` was modified dynamically *after* you accessed an environment namespace with ``biome``. """ super(Habitat, self).update(self.get_environ(self._prefix))
def check_station_location_lat(self, ds): """ Checks station lat attributes are set """ gmin = self.std_check(ds, 'geospatial_lat_min') gmax = self.std_check(ds, 'geospatial_lat_max') msgs = [] count = 2 if not gmin: count -= 1 msg...
def function[check_station_location_lat, parameter[self, ds]]: constant[ Checks station lat attributes are set ] variable[gmin] assign[=] call[name[self].std_check, parameter[name[ds], constant[geospatial_lat_min]]] variable[gmax] assign[=] call[name[self].std_check, parameter[na...
keyword[def] identifier[check_station_location_lat] ( identifier[self] , identifier[ds] ): literal[string] identifier[gmin] = identifier[self] . identifier[std_check] ( identifier[ds] , literal[string] ) identifier[gmax] = identifier[self] . identifier[std_check] ( identifier[ds] , literal...
def check_station_location_lat(self, ds): """ Checks station lat attributes are set """ gmin = self.std_check(ds, 'geospatial_lat_min') gmax = self.std_check(ds, 'geospatial_lat_max') msgs = [] count = 2 if not gmin: count -= 1 msgs.append("Attr 'geospatial_lat_mi...
def list_ar (archive, compression, cmd, verbosity, interactive): """List a AR archive.""" opts = 't' if verbosity > 1: opts += 'v' return [cmd, opts, archive]
def function[list_ar, parameter[archive, compression, cmd, verbosity, interactive]]: constant[List a AR archive.] variable[opts] assign[=] constant[t] if compare[name[verbosity] greater[>] constant[1]] begin[:] <ast.AugAssign object at 0x7da1b0784250> return[list[[<ast.Name object at...
keyword[def] identifier[list_ar] ( identifier[archive] , identifier[compression] , identifier[cmd] , identifier[verbosity] , identifier[interactive] ): literal[string] identifier[opts] = literal[string] keyword[if] identifier[verbosity] > literal[int] : identifier[opts] += literal[string] ...
def list_ar(archive, compression, cmd, verbosity, interactive): """List a AR archive.""" opts = 't' if verbosity > 1: opts += 'v' # depends on [control=['if'], data=[]] return [cmd, opts, archive]
def gridplot(children, sizing_mode=None, toolbar_location='above', ncols=None, plot_width=None, plot_height=None, toolbar_options=None, merge_tools=True): ''' Create a grid of plots rendered on separate canvases. The ``gridplot`` function builds a single toolbar for all the plots in the grid. ...
def function[gridplot, parameter[children, sizing_mode, toolbar_location, ncols, plot_width, plot_height, toolbar_options, merge_tools]]: constant[ Create a grid of plots rendered on separate canvases. The ``gridplot`` function builds a single toolbar for all the plots in the grid. ``gridplot`` is desi...
keyword[def] identifier[gridplot] ( identifier[children] , identifier[sizing_mode] = keyword[None] , identifier[toolbar_location] = literal[string] , identifier[ncols] = keyword[None] , identifier[plot_width] = keyword[None] , identifier[plot_height] = keyword[None] , identifier[toolbar_options] = keyword[None] , id...
def gridplot(children, sizing_mode=None, toolbar_location='above', ncols=None, plot_width=None, plot_height=None, toolbar_options=None, merge_tools=True): """ Create a grid of plots rendered on separate canvases. The ``gridplot`` function builds a single toolbar for all the plots in the grid. ``gridplot`` ...
def clean(self, value): """ Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised. """ value = self.to_python(value) self.validate(value) return value
def function[clean, parameter[self, value]]: constant[ Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised. ] variable[value] assign[=] call[name[self].to_python, pa...
keyword[def] identifier[clean] ( identifier[self] , identifier[value] ): literal[string] identifier[value] = identifier[self] . identifier[to_python] ( identifier[value] ) identifier[self] . identifier[validate] ( identifier[value] ) keyword[return] identifier[value]
def clean(self, value): """ Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised. """ value = self.to_python(value) self.validate(value) return value
def create_expansions(self, environment_id, collection_id, expansions, **kwargs): """ Create or update expansion list. Create or replace the Expansion list for this collection. The maximum number of expanded terms per collection is `500`. The current ex...
def function[create_expansions, parameter[self, environment_id, collection_id, expansions]]: constant[ Create or update expansion list. Create or replace the Expansion list for this collection. The maximum number of expanded terms per collection is `500`. The current expansion l...
keyword[def] identifier[create_expansions] ( identifier[self] , identifier[environment_id] , identifier[collection_id] , identifier[expansions] , ** identifier[kwargs] ): literal[string] keyword[if] identifier[environment_id] keyword[is] keyword[None] : keyword[raise] identifier[V...
def create_expansions(self, environment_id, collection_id, expansions, **kwargs): """ Create or update expansion list. Create or replace the Expansion list for this collection. The maximum number of expanded terms per collection is `500`. The current expansion list is replaced with ...
def format(self, record): """Format log record.""" format_orig = self._fmt self._fmt = self.get_level_fmt(record.levelno) record.prefix = self.prefix record.plugin_id = self.plugin_id result = logging.Formatter.format(self, record) self._fmt = format_orig ...
def function[format, parameter[self, record]]: constant[Format log record.] variable[format_orig] assign[=] name[self]._fmt name[self]._fmt assign[=] call[name[self].get_level_fmt, parameter[name[record].levelno]] name[record].prefix assign[=] name[self].prefix name[record].plugi...
keyword[def] identifier[format] ( identifier[self] , identifier[record] ): literal[string] identifier[format_orig] = identifier[self] . identifier[_fmt] identifier[self] . identifier[_fmt] = identifier[self] . identifier[get_level_fmt] ( identifier[record] . identifier[levelno] ) ...
def format(self, record): """Format log record.""" format_orig = self._fmt self._fmt = self.get_level_fmt(record.levelno) record.prefix = self.prefix record.plugin_id = self.plugin_id result = logging.Formatter.format(self, record) self._fmt = format_orig return result
def genHostCert(self, name, signas=None, outp=None, csr=None, sans=None): ''' Generates a host keypair. Args: name (str): The name of the host keypair. signas (str): The CA keypair to sign the new host keypair with. outp (synapse.lib.output.Output): The outpu...
def function[genHostCert, parameter[self, name, signas, outp, csr, sans]]: constant[ Generates a host keypair. Args: name (str): The name of the host keypair. signas (str): The CA keypair to sign the new host keypair with. outp (synapse.lib.output.Output): Th...
keyword[def] identifier[genHostCert] ( identifier[self] , identifier[name] , identifier[signas] = keyword[None] , identifier[outp] = keyword[None] , identifier[csr] = keyword[None] , identifier[sans] = keyword[None] ): literal[string] identifier[pkey] , identifier[cert] = identifier[self] . identif...
def genHostCert(self, name, signas=None, outp=None, csr=None, sans=None): """ Generates a host keypair. Args: name (str): The name of the host keypair. signas (str): The CA keypair to sign the new host keypair with. outp (synapse.lib.output.Output): The output bu...
def _import(self, datadict): """ Internal method to import instance variables data from a dictionary :param dict datadict: The dictionary containing variables values. """ self.GUID = datadict.get("GUID", uuid.uuid1()) self.FileName = datadict.get("FileName", "") ...
def function[_import, parameter[self, datadict]]: constant[ Internal method to import instance variables data from a dictionary :param dict datadict: The dictionary containing variables values. ] name[self].GUID assign[=] call[name[datadict].get, parameter[constant[GUID], call[n...
keyword[def] identifier[_import] ( identifier[self] , identifier[datadict] ): literal[string] identifier[self] . identifier[GUID] = identifier[datadict] . identifier[get] ( literal[string] , identifier[uuid] . identifier[uuid1] ()) identifier[self] . identifier[FileName] = identifier[datad...
def _import(self, datadict): """ Internal method to import instance variables data from a dictionary :param dict datadict: The dictionary containing variables values. """ self.GUID = datadict.get('GUID', uuid.uuid1()) self.FileName = datadict.get('FileName', '') self.Name = data...
def check_output(params): """ Python 2.6 support: subprocess.check_output from Python 2.7. """ popen = subprocess.Popen(params, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) output, _ = popen.communicate() returncode = popen.poll() if returncode ...
def function[check_output, parameter[params]]: constant[ Python 2.6 support: subprocess.check_output from Python 2.7. ] variable[popen] assign[=] call[name[subprocess].Popen, parameter[name[params]]] <ast.Tuple object at 0x7da1b25d00d0> assign[=] call[name[popen].communicate, parameter[]...
keyword[def] identifier[check_output] ( identifier[params] ): literal[string] identifier[popen] = identifier[subprocess] . identifier[Popen] ( identifier[params] , identifier[shell] = keyword[True] , identifier[stderr] = identifier[subprocess] . identifier[STDOUT] , identifier[stdout] = identifier[sub...
def check_output(params): """ Python 2.6 support: subprocess.check_output from Python 2.7. """ popen = subprocess.Popen(params, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) (output, _) = popen.communicate() returncode = popen.poll() if returncode != 0: error = subpro...
def _estimate_progress_completion_time(self, now): """ Estimate the moment when the underlying process is expected to reach completion. This function should only return future times. Also this function is not allowed to return time moments less than self._next_poll_time if the actual pr...
def function[_estimate_progress_completion_time, parameter[self, now]]: constant[ Estimate the moment when the underlying process is expected to reach completion. This function should only return future times. Also this function is not allowed to return time moments less than self._next...
keyword[def] identifier[_estimate_progress_completion_time] ( identifier[self] , identifier[now] ): literal[string] keyword[assert] identifier[self] . identifier[_next_poll_time] >= identifier[now] identifier[tlast] , identifier[wlast] = identifier[self] . identifier[_progress_data] [- l...
def _estimate_progress_completion_time(self, now): """ Estimate the moment when the underlying process is expected to reach completion. This function should only return future times. Also this function is not allowed to return time moments less than self._next_poll_time if the actual progre...
def _setup_dest_conn(self, dest_conn_id, results_bucket_name, results_dest_name): """ Setup results connection. Retrieves s3 connection and makes sure we've got location details (bucket, filename) :param dest_conn_id: :param results_bucket_name: :param results_dest_name: ...
def function[_setup_dest_conn, parameter[self, dest_conn_id, results_bucket_name, results_dest_name]]: constant[ Setup results connection. Retrieves s3 connection and makes sure we've got location details (bucket, filename) :param dest_conn_id: :param results_bucket_name: :param ...
keyword[def] identifier[_setup_dest_conn] ( identifier[self] , identifier[dest_conn_id] , identifier[results_bucket_name] , identifier[results_dest_name] ): literal[string] identifier[conn] = identifier[BaseHook] . identifier[_get_connection_from_env] ( identifier[dest_conn_id] ) keyword[i...
def _setup_dest_conn(self, dest_conn_id, results_bucket_name, results_dest_name): """ Setup results connection. Retrieves s3 connection and makes sure we've got location details (bucket, filename) :param dest_conn_id: :param results_bucket_name: :param results_dest_name: """ ...
def sls_id(id_, mods, test=None, queue=False, **kwargs): ''' Call a single ID from the named module(s) and handle all requisites The state ID comes *before* the module ID(s) on the command line. id ID to call mods Comma-delimited list of modules to search for given id and its requ...
def function[sls_id, parameter[id_, mods, test, queue]]: constant[ Call a single ID from the named module(s) and handle all requisites The state ID comes *before* the module ID(s) on the command line. id ID to call mods Comma-delimited list of modules to search for given id an...
keyword[def] identifier[sls_id] ( identifier[id_] , identifier[mods] , identifier[test] = keyword[None] , identifier[queue] = keyword[False] ,** identifier[kwargs] ): literal[string] identifier[conflict] = identifier[_check_queue] ( identifier[queue] , identifier[kwargs] ) keyword[if] identifier[conf...
def sls_id(id_, mods, test=None, queue=False, **kwargs): """ Call a single ID from the named module(s) and handle all requisites The state ID comes *before* the module ID(s) on the command line. id ID to call mods Comma-delimited list of modules to search for given id and its requ...
def prepare_satellites(self, satellites): """Update the following attributes of a realm:: * nb_*satellite type*s * self.potential_*satellite type*s (satellite types are scheduler, reactionner, poller, broker and receiver) :param satellites: dict of SatelliteLink objects ...
def function[prepare_satellites, parameter[self, satellites]]: constant[Update the following attributes of a realm:: * nb_*satellite type*s * self.potential_*satellite type*s (satellite types are scheduler, reactionner, poller, broker and receiver) :param satellites: dict of S...
keyword[def] identifier[prepare_satellites] ( identifier[self] , identifier[satellites] ): literal[string] keyword[for] identifier[sat_type] keyword[in] [ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ]: keyword[for] identifier[sat_...
def prepare_satellites(self, satellites): """Update the following attributes of a realm:: * nb_*satellite type*s * self.potential_*satellite type*s (satellite types are scheduler, reactionner, poller, broker and receiver) :param satellites: dict of SatelliteLink objects :t...
def create_session(cls, session_id, user_id): """ Save a new session to the database Using the ['AUTH']['MAX_SESSIONS'] config setting a session with be created within the MAX_SESSIONS limit. Once this limit is hit, delete the earliest session. """ ...
def function[create_session, parameter[cls, session_id, user_id]]: constant[ Save a new session to the database Using the ['AUTH']['MAX_SESSIONS'] config setting a session with be created within the MAX_SESSIONS limit. Once this limit is hit, delete the earliest session. ...
keyword[def] identifier[create_session] ( identifier[cls] , identifier[session_id] , identifier[user_id] ): literal[string] identifier[count] = identifier[SessionModel] . identifier[count] ( identifier[user_id] ) keyword[if] identifier[count] < identifier[current_app] . identifier[conf...
def create_session(cls, session_id, user_id): """ Save a new session to the database Using the ['AUTH']['MAX_SESSIONS'] config setting a session with be created within the MAX_SESSIONS limit. Once this limit is hit, delete the earliest session. """ count = Session...
def load_genotypes(self, pheno_covar): """Load all data into memory and propagate valid individuals to \ pheno_covar. :param pheno_covar: Phenotype/covariate object is updated with subject information :return: None """ first_genotype = 6 pheno_col =...
def function[load_genotypes, parameter[self, pheno_covar]]: constant[Load all data into memory and propagate valid individuals to pheno_covar. :param pheno_covar: Phenotype/covariate object is updated with subject information :return: None ] variable[first_genoty...
keyword[def] identifier[load_genotypes] ( identifier[self] , identifier[pheno_covar] ): literal[string] identifier[first_genotype] = literal[int] identifier[pheno_col] = literal[int] keyword[if] keyword[not] identifier[DataParser] . identifier[has_sex] : identifi...
def load_genotypes(self, pheno_covar): """Load all data into memory and propagate valid individuals to pheno_covar. :param pheno_covar: Phenotype/covariate object is updated with subject information :return: None """ first_genotype = 6 pheno_col = 5 if not DataPa...
def decode_json(json_input: Union[str, None] = None): """ Simple wrapper of json.load and json.loads. If json_input is None the output is an empty dictionary. If the input is a string that ends in .json it is decoded using json.load. Otherwise it is decoded using json.loads. Parameters ---...
def function[decode_json, parameter[json_input]]: constant[ Simple wrapper of json.load and json.loads. If json_input is None the output is an empty dictionary. If the input is a string that ends in .json it is decoded using json.load. Otherwise it is decoded using json.loads. Parameters ...
keyword[def] identifier[decode_json] ( identifier[json_input] : identifier[Union] [ identifier[str] , keyword[None] ]= keyword[None] ): literal[string] keyword[if] identifier[json_input] keyword[is] keyword[None] : keyword[return] {} keyword[else] : keyword[if] identifier[isinsta...
def decode_json(json_input: Union[str, None]=None): """ Simple wrapper of json.load and json.loads. If json_input is None the output is an empty dictionary. If the input is a string that ends in .json it is decoded using json.load. Otherwise it is decoded using json.loads. Parameters -----...
def dispatch(self, **kwargs): """Runs the saved search and returns the resulting search job. :param `kwargs`: Additional dispatch arguments (optional). For details, see the `POST saved/searches/{name}/dispatch <http://docs.splunk.com/Documentation/Splun...
def function[dispatch, parameter[self]]: constant[Runs the saved search and returns the resulting search job. :param `kwargs`: Additional dispatch arguments (optional). For details, see the `POST saved/searches/{name}/dispatch <http://docs.splunk.com/Do...
keyword[def] identifier[dispatch] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[response] = identifier[self] . identifier[post] ( literal[string] ,** identifier[kwargs] ) identifier[sid] = identifier[_load_sid] ( identifier[response] ) keyword[return] id...
def dispatch(self, **kwargs): """Runs the saved search and returns the resulting search job. :param `kwargs`: Additional dispatch arguments (optional). For details, see the `POST saved/searches/{name}/dispatch <http://docs.splunk.com/Documentation/Splunk/la...
def setup_resume(self): """ Setup debugger to "resume" execution """ self.frame_calling = None self.frame_stop = None self.frame_return = None self.frame_suspend = False self.pending_stop = False if not IKBreakpoint.any_active_breakpoint: self....
def function[setup_resume, parameter[self]]: constant[ Setup debugger to "resume" execution ] name[self].frame_calling assign[=] constant[None] name[self].frame_stop assign[=] constant[None] name[self].frame_return assign[=] constant[None] name[self].frame_suspend assign[...
keyword[def] identifier[setup_resume] ( identifier[self] ): literal[string] identifier[self] . identifier[frame_calling] = keyword[None] identifier[self] . identifier[frame_stop] = keyword[None] identifier[self] . identifier[frame_return] = keyword[None] identifier[sel...
def setup_resume(self): """ Setup debugger to "resume" execution """ self.frame_calling = None self.frame_stop = None self.frame_return = None self.frame_suspend = False self.pending_stop = False if not IKBreakpoint.any_active_breakpoint: self.disable_tracing() # depends on ...
def fraction_correct_fuzzy_linear(x_values, y_values, x_cutoff = 1.0, x_fuzzy_range = 0.1, y_scalar = 1.0, y_cutoff = None): '''A version of fraction_correct which is more forgiving at the boundary positions. In fraction_correct, if the x value is 1.01 and the y value is 0.99 (with cutoffs of 1.0) then that ...
def function[fraction_correct_fuzzy_linear, parameter[x_values, y_values, x_cutoff, x_fuzzy_range, y_scalar, y_cutoff]]: constant[A version of fraction_correct which is more forgiving at the boundary positions. In fraction_correct, if the x value is 1.01 and the y value is 0.99 (with cutoffs of 1.0) then...
keyword[def] identifier[fraction_correct_fuzzy_linear] ( identifier[x_values] , identifier[y_values] , identifier[x_cutoff] = literal[int] , identifier[x_fuzzy_range] = literal[int] , identifier[y_scalar] = literal[int] , identifier[y_cutoff] = keyword[None] ): literal[string] identifier[num_points] = iden...
def fraction_correct_fuzzy_linear(x_values, y_values, x_cutoff=1.0, x_fuzzy_range=0.1, y_scalar=1.0, y_cutoff=None): """A version of fraction_correct which is more forgiving at the boundary positions. In fraction_correct, if the x value is 1.01 and the y value is 0.99 (with cutoffs of 1.0) then that pair eva...
def makeJob(tool, jobobj, step_inputs, runtime_context): """Create the correct Toil Job object for the CWL tool (workflow, job, or job wrapper for dynamic resource requirements.) """ if tool.tool["class"] == "Workflow": wfjob = CWLWorkflow(tool, jobobj, runtime_context) followOn = Reso...
def function[makeJob, parameter[tool, jobobj, step_inputs, runtime_context]]: constant[Create the correct Toil Job object for the CWL tool (workflow, job, or job wrapper for dynamic resource requirements.) ] if compare[call[name[tool].tool][constant[class]] equal[==] constant[Workflow]] begin[:...
keyword[def] identifier[makeJob] ( identifier[tool] , identifier[jobobj] , identifier[step_inputs] , identifier[runtime_context] ): literal[string] keyword[if] identifier[tool] . identifier[tool] [ literal[string] ]== literal[string] : identifier[wfjob] = identifier[CWLWorkflow] ( identifier[too...
def makeJob(tool, jobobj, step_inputs, runtime_context): """Create the correct Toil Job object for the CWL tool (workflow, job, or job wrapper for dynamic resource requirements.) """ if tool.tool['class'] == 'Workflow': wfjob = CWLWorkflow(tool, jobobj, runtime_context) followOn = Resol...
def set_position(self, x, y, width, height): """Set window top-left corner position and size""" SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0))
def function[set_position, parameter[self, x, y, width, height]]: constant[Set window top-left corner position and size] call[name[SetWindowPos], parameter[name[self]._hwnd, constant[None], name[x], name[y], name[width], name[height], call[name[ctypes].c_uint, parameter[constant[0]]]]]
keyword[def] identifier[set_position] ( identifier[self] , identifier[x] , identifier[y] , identifier[width] , identifier[height] ): literal[string] identifier[SetWindowPos] ( identifier[self] . identifier[_hwnd] , keyword[None] , identifier[x] , identifier[y] , identifier[width] , identifier[heigh...
def set_position(self, x, y, width, height): """Set window top-left corner position and size""" SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0))
def UV_B(self): """ returns UV = all respected U->Ux in ternary coding (1=V,2=U) """ h = reduce(lambda x,y:x&y,(B(g,self.width-1) for g in self)) return UV_B(h, self.width)
def function[UV_B, parameter[self]]: constant[ returns UV = all respected U->Ux in ternary coding (1=V,2=U) ] variable[h] assign[=] call[name[reduce], parameter[<ast.Lambda object at 0x7da2044c02b0>, <ast.GeneratorExp object at 0x7da2044c0640>]] return[call[name[UV_B], parameter[name...
keyword[def] identifier[UV_B] ( identifier[self] ): literal[string] identifier[h] = identifier[reduce] ( keyword[lambda] identifier[x] , identifier[y] : identifier[x] & identifier[y] ,( identifier[B] ( identifier[g] , identifier[self] . identifier[width] - literal[int] ) keyword[for] identifier[g...
def UV_B(self): """ returns UV = all respected U->Ux in ternary coding (1=V,2=U) """ h = reduce(lambda x, y: x & y, (B(g, self.width - 1) for g in self)) return UV_B(h, self.width)
def headers_to_use(self): ''' Defines features of columns to be used in multiqc table ''' headers = OrderedDict() headers['total.reads'] = { 'title': 'Total reads', 'description': 'Total number of reads', 'format': '{:,.0f}', 'scal...
def function[headers_to_use, parameter[self]]: constant[ Defines features of columns to be used in multiqc table ] variable[headers] assign[=] call[name[OrderedDict], parameter[]] call[name[headers]][constant[total.reads]] assign[=] dictionary[[<ast.Constant object at 0x7da18c4ce...
keyword[def] identifier[headers_to_use] ( identifier[self] ): literal[string] identifier[headers] = identifier[OrderedDict] () identifier[headers] [ literal[string] ]={ literal[string] : literal[string] , literal[string] : literal[string] , literal[string] : lit...
def headers_to_use(self): """ Defines features of columns to be used in multiqc table """ headers = OrderedDict() headers['total.reads'] = {'title': 'Total reads', 'description': 'Total number of reads', 'format': '{:,.0f}', 'scale': 'Greys'} headers['total.gigabases'] = {'title': 'Total...
def update_payTo(apps, schema_editor): ''' With the new TransactionParty model, the senders and recipients of financial transactions are held in one place. So, we need to loop through old ExpenseItems, RevenueItems, and GenericRepeatedExpense and move their old party references to the new party mod...
def function[update_payTo, parameter[apps, schema_editor]]: constant[ With the new TransactionParty model, the senders and recipients of financial transactions are held in one place. So, we need to loop through old ExpenseItems, RevenueItems, and GenericRepeatedExpense and move their old party refe...
keyword[def] identifier[update_payTo] ( identifier[apps] , identifier[schema_editor] ): literal[string] identifier[TransactionParty] = identifier[apps] . identifier[get_model] ( literal[string] , literal[string] ) identifier[ExpenseItem] = identifier[apps] . identifier[get_model] ( literal[string] , l...
def update_payTo(apps, schema_editor): """ With the new TransactionParty model, the senders and recipients of financial transactions are held in one place. So, we need to loop through old ExpenseItems, RevenueItems, and GenericRepeatedExpense and move their old party references to the new party mod...
def defragment6(packets): """ Performs defragmentation of a list of IPv6 packets. Packets are reordered. Crap is dropped. What lacks is completed by 'X' characters. """ # Remove non fragments lst = [x for x in packets if IPv6ExtHdrFragment in x] if not lst: return [] id = lst[0...
def function[defragment6, parameter[packets]]: constant[ Performs defragmentation of a list of IPv6 packets. Packets are reordered. Crap is dropped. What lacks is completed by 'X' characters. ] variable[lst] assign[=] <ast.ListComp object at 0x7da1b21e1360> if <ast.UnaryOp object at ...
keyword[def] identifier[defragment6] ( identifier[packets] ): literal[string] identifier[lst] =[ identifier[x] keyword[for] identifier[x] keyword[in] identifier[packets] keyword[if] identifier[IPv6ExtHdrFragment] keyword[in] identifier[x] ] keyword[if] keyword[not] identifier[lst] : ...
def defragment6(packets): """ Performs defragmentation of a list of IPv6 packets. Packets are reordered. Crap is dropped. What lacks is completed by 'X' characters. """ # Remove non fragments lst = [x for x in packets if IPv6ExtHdrFragment in x] if not lst: return [] # depends on [c...
def get_source_id(self): """Gets the ``Resource Id`` of the source of this asset. The source is the original owner of the copyright of this asset and may differ from the creator of this asset. The source for a published book written by Margaret Mitchell would be Macmillan. The s...
def function[get_source_id, parameter[self]]: constant[Gets the ``Resource Id`` of the source of this asset. The source is the original owner of the copyright of this asset and may differ from the creator of this asset. The source for a published book written by Margaret Mitchell would ...
keyword[def] identifier[get_source_id] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[bool] ( identifier[self] . identifier[_my_map] [ literal[string] ]): keyword[raise] identifier[errors] . identifier[IllegalState] ( literal[string] ) ke...
def get_source_id(self): """Gets the ``Resource Id`` of the source of this asset. The source is the original owner of the copyright of this asset and may differ from the creator of this asset. The source for a published book written by Margaret Mitchell would be Macmillan. The sourc...
def stream_events(self, inputs, ew): """This function handles all the action: splunk calls this modular input without arguments, streams XML describing the inputs to stdin, and waits for XML on stdout describing events. If you set use_single_instance to True on the scheme in get_scheme,...
def function[stream_events, parameter[self, inputs, ew]]: constant[This function handles all the action: splunk calls this modular input without arguments, streams XML describing the inputs to stdin, and waits for XML on stdout describing events. If you set use_single_instance to True o...
keyword[def] identifier[stream_events] ( identifier[self] , identifier[inputs] , identifier[ew] ): literal[string] keyword[for] identifier[input_name] , identifier[input_item] keyword[in] identifier[six] . identifier[iteritems] ( identifier[inputs] . identifier[inputs] ): ...
def stream_events(self, inputs, ew): """This function handles all the action: splunk calls this modular input without arguments, streams XML describing the inputs to stdin, and waits for XML on stdout describing events. If you set use_single_instance to True on the scheme in get_scheme, it ...
def call(self, method, *args, **params): """Calls a method on the server.""" transaction_id = params.get("transaction_id") if not transaction_id: self.transaction_id += 1 transaction_id = self.transaction_id obj = params.get("obj") args = [method, tran...
def function[call, parameter[self, method]]: constant[Calls a method on the server.] variable[transaction_id] assign[=] call[name[params].get, parameter[constant[transaction_id]]] if <ast.UnaryOp object at 0x7da18ede7490> begin[:] <ast.AugAssign object at 0x7da18ede7730> ...
keyword[def] identifier[call] ( identifier[self] , identifier[method] ,* identifier[args] ,** identifier[params] ): literal[string] identifier[transaction_id] = identifier[params] . identifier[get] ( literal[string] ) keyword[if] keyword[not] identifier[transaction_id] : i...
def call(self, method, *args, **params): """Calls a method on the server.""" transaction_id = params.get('transaction_id') if not transaction_id: self.transaction_id += 1 transaction_id = self.transaction_id # depends on [control=['if'], data=[]] obj = params.get('obj') args = [meth...
def business_hours_schedule_holidays(self, id, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/schedules#list-holidays-for-a-schedule" api_path = "/api/v2/business_hours/schedules/{id}/holidays.json" api_path = api_path.format(id=id) return self.call(api_path, **kwargs)
def function[business_hours_schedule_holidays, parameter[self, id]]: constant[https://developer.zendesk.com/rest_api/docs/core/schedules#list-holidays-for-a-schedule] variable[api_path] assign[=] constant[/api/v2/business_hours/schedules/{id}/holidays.json] variable[api_path] assign[=] call[name...
keyword[def] identifier[business_hours_schedule_holidays] ( identifier[self] , identifier[id] ,** identifier[kwargs] ): literal[string] identifier[api_path] = literal[string] identifier[api_path] = identifier[api_path] . identifier[format] ( identifier[id] = identifier[id] ) keyw...
def business_hours_schedule_holidays(self, id, **kwargs): """https://developer.zendesk.com/rest_api/docs/core/schedules#list-holidays-for-a-schedule""" api_path = '/api/v2/business_hours/schedules/{id}/holidays.json' api_path = api_path.format(id=id) return self.call(api_path, **kwargs)
def refractory_VDI_k(ID, T=None): r'''Returns thermal conductivity of a refractory material from a table in [1]_. Here, thermal conductivity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, thermal conductivity is not a fu...
def function[refractory_VDI_k, parameter[ID, T]]: constant[Returns thermal conductivity of a refractory material from a table in [1]_. Here, thermal conductivity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, thermal...
keyword[def] identifier[refractory_VDI_k] ( identifier[ID] , identifier[T] = keyword[None] ): literal[string] keyword[if] identifier[T] keyword[is] keyword[None] : keyword[return] identifier[float] ( identifier[refractories] [ identifier[ID] ][ literal[int] ][ literal[int] ]) keyword[else...
def refractory_VDI_k(ID, T=None): """Returns thermal conductivity of a refractory material from a table in [1]_. Here, thermal conductivity is a function of temperature between 673.15 K and 1473.15 K according to linear interpolation among 5 equally-spaced points. Here, thermal conductivity is not a fun...
def inasafe_sub_analysis_summary_field_value( exposure_key, field, feature, parent): """Retrieve a value from field in the specified exposure analysis layer. """ _ = feature, parent # NOQA project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) projec...
def function[inasafe_sub_analysis_summary_field_value, parameter[exposure_key, field, feature, parent]]: constant[Retrieve a value from field in the specified exposure analysis layer. ] variable[_] assign[=] tuple[[<ast.Name object at 0x7da1b0c0dc60>, <ast.Name object at 0x7da1b0c0d720>]] v...
keyword[def] identifier[inasafe_sub_analysis_summary_field_value] ( identifier[exposure_key] , identifier[field] , identifier[feature] , identifier[parent] ): literal[string] identifier[_] = identifier[feature] , identifier[parent] identifier[project_context_scope] = identifier[QgsExpressionContextU...
def inasafe_sub_analysis_summary_field_value(exposure_key, field, feature, parent): """Retrieve a value from field in the specified exposure analysis layer. """ _ = (feature, parent) # NOQA project_context_scope = QgsExpressionContextUtils.projectScope(QgsProject.instance()) project = QgsProject.i...
def cleanup(args): """ cdstarcat cleanup Deletes objects with no bitstreams from CDSTAR and the catalog. """ with _catalog(args) as cat: n, d, r = len(cat), [], [] for obj in cat: if not obj.bitstreams: if obj.is_special: print('removi...
def function[cleanup, parameter[args]]: constant[ cdstarcat cleanup Deletes objects with no bitstreams from CDSTAR and the catalog. ] with call[name[_catalog], parameter[name[args]]] begin[:] <ast.Tuple object at 0x7da1b1352590> assign[=] tuple[[<ast.Call object at 0x7da1b13...
keyword[def] identifier[cleanup] ( identifier[args] ): literal[string] keyword[with] identifier[_catalog] ( identifier[args] ) keyword[as] identifier[cat] : identifier[n] , identifier[d] , identifier[r] = identifier[len] ( identifier[cat] ),[],[] keyword[for] identifier[obj] keyword[i...
def cleanup(args): """ cdstarcat cleanup Deletes objects with no bitstreams from CDSTAR and the catalog. """ with _catalog(args) as cat: (n, d, r) = (len(cat), [], []) for obj in cat: if not obj.bitstreams: if obj.is_special: print('re...
def set_defaults(key): """ Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have falsey redshifts Parameters ---------- key: str Returns ------- decorator A decorator that wraps the setter function to set defaults ...
def function[set_defaults, parameter[key]]: constant[ Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have falsey redshifts Parameters ---------- key: str Returns ------- decorator A decorator that wraps the sett...
keyword[def] identifier[set_defaults] ( identifier[key] ): literal[string] keyword[def] identifier[decorator] ( identifier[func] ): @ identifier[functools] . identifier[wraps] ( identifier[func] ) keyword[def] identifier[wrapper] ( identifier[phase] , identifier[new_value] ): ...
def set_defaults(key): """ Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have falsey redshifts Parameters ---------- key: str Returns ------- decorator A decorator that wraps the setter function to set defaults ...
def paintEvent(self, event): """ Override Qt method. Painting the scroll flag area """ make_flag = self.make_flag_qrect # Fill the whole painting area painter = QPainter(self) painter.fillRect(event.rect(), self.editor.sideareas_color) # Paint wa...
def function[paintEvent, parameter[self, event]]: constant[ Override Qt method. Painting the scroll flag area ] variable[make_flag] assign[=] name[self].make_flag_qrect variable[painter] assign[=] call[name[QPainter], parameter[name[self]]] call[name[painter].fill...
keyword[def] identifier[paintEvent] ( identifier[self] , identifier[event] ): literal[string] identifier[make_flag] = identifier[self] . identifier[make_flag_qrect] identifier[painter] = identifier[QPainter] ( identifier[self] ) identifier[painter] . identifier[fillRect...
def paintEvent(self, event): """ Override Qt method. Painting the scroll flag area """ make_flag = self.make_flag_qrect # Fill the whole painting area painter = QPainter(self) painter.fillRect(event.rect(), self.editor.sideareas_color) # Paint warnings and todos block...
def report(self): """ Performs rollups, prints report of sockets opened. """ aggregations = dict( (test, Counter().rollup(values)) for test, values in self.socket_warnings.items() ) total = sum( len(warnings) for warnings in...
def function[report, parameter[self]]: constant[ Performs rollups, prints report of sockets opened. ] variable[aggregations] assign[=] call[name[dict], parameter[<ast.GeneratorExp object at 0x7da20c990730>]] variable[total] assign[=] call[name[sum], parameter[<ast.GeneratorExp ob...
keyword[def] identifier[report] ( identifier[self] ): literal[string] identifier[aggregations] = identifier[dict] ( ( identifier[test] , identifier[Counter] (). identifier[rollup] ( identifier[values] )) keyword[for] identifier[test] , identifier[values] keyword[in] identifier[s...
def report(self): """ Performs rollups, prints report of sockets opened. """ aggregations = dict(((test, Counter().rollup(values)) for (test, values) in self.socket_warnings.items())) total = sum((len(warnings) for warnings in self.socket_warnings.values())) def format_test_statistics(t...
def box(self, x0, y0, width, height): """Create a box on ASCII canvas. Args: x0 (int): x coordinate of the box corner. y0 (int): y coordinate of the box corner. width (int): box width. height (int): box height. """ assert width > 1 ...
def function[box, parameter[self, x0, y0, width, height]]: constant[Create a box on ASCII canvas. Args: x0 (int): x coordinate of the box corner. y0 (int): y coordinate of the box corner. width (int): box width. height (int): box height. ] ass...
keyword[def] identifier[box] ( identifier[self] , identifier[x0] , identifier[y0] , identifier[width] , identifier[height] ): literal[string] keyword[assert] identifier[width] > literal[int] keyword[assert] identifier[height] > literal[int] identifier[width] -= literal[int] ...
def box(self, x0, y0, width, height): """Create a box on ASCII canvas. Args: x0 (int): x coordinate of the box corner. y0 (int): y coordinate of the box corner. width (int): box width. height (int): box height. """ assert width > 1 assert heig...
def update_attributes(self, attr_dict): """Updates the directives attribute from a dictionary object. This will only update the directives for processes that have been defined in the subclass. Parameters ---------- attr_dict : dict Dictionary containing the ...
def function[update_attributes, parameter[self, attr_dict]]: constant[Updates the directives attribute from a dictionary object. This will only update the directives for processes that have been defined in the subclass. Parameters ---------- attr_dict : dict ...
keyword[def] identifier[update_attributes] ( identifier[self] , identifier[attr_dict] ): literal[string] identifier[valid_directives] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ] keyword[for] id...
def update_attributes(self, attr_dict): """Updates the directives attribute from a dictionary object. This will only update the directives for processes that have been defined in the subclass. Parameters ---------- attr_dict : dict Dictionary containing the attr...
def invalid_request_content(message): """ Creates a Lambda Service InvalidRequestContent Response Parameters ---------- message str Message to be added to the body of the response Returns ------- Flask.Response A response object r...
def function[invalid_request_content, parameter[message]]: constant[ Creates a Lambda Service InvalidRequestContent Response Parameters ---------- message str Message to be added to the body of the response Returns ------- Flask.Response ...
keyword[def] identifier[invalid_request_content] ( identifier[message] ): literal[string] identifier[exception_tuple] = identifier[LambdaErrorResponses] . identifier[InvalidRequestContentException] keyword[return] identifier[BaseLocalService] . identifier[service_response] ( id...
def invalid_request_content(message): """ Creates a Lambda Service InvalidRequestContent Response Parameters ---------- message str Message to be added to the body of the response Returns ------- Flask.Response A response object repre...
def allocate_time_signal(self): """! @brief Analyses output dynamic and calculates time signal (signal vector information) of network output. @return (list) Time signal of network output. """ if self.__ccore_pcnn_dynamic_pointer is not None: ...
def function[allocate_time_signal, parameter[self]]: constant[! @brief Analyses output dynamic and calculates time signal (signal vector information) of network output. @return (list) Time signal of network output. ] if compare[name[self].__ccore_pcnn_dynamic...
keyword[def] identifier[allocate_time_signal] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[__ccore_pcnn_dynamic_pointer] keyword[is] keyword[not] keyword[None] : keyword[return] identifier[wrapper] . identifier[pcnn_dynamic_allocate_time_sig...
def allocate_time_signal(self): """! @brief Analyses output dynamic and calculates time signal (signal vector information) of network output. @return (list) Time signal of network output. """ if self.__ccore_pcnn_dynamic_pointer is not None: return wrapper.pc...
def geotiff(self, **kwargs): """ Creates a geotiff on the filesystem Args: path (str): optional, path to write the geotiff file to, default is ./output.tif proj (str): optional, EPSG string of projection to reproject to spec (str): optional, if set to 'rgb', write ou...
def function[geotiff, parameter[self]]: constant[ Creates a geotiff on the filesystem Args: path (str): optional, path to write the geotiff file to, default is ./output.tif proj (str): optional, EPSG string of projection to reproject to spec (str): optional, if set t...
keyword[def] identifier[geotiff] ( identifier[self] ,** identifier[kwargs] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[kwargs] : identifier[kwargs] [ literal[string] ]= identifier[self] . identifier[proj] keyword[return] identifier...
def geotiff(self, **kwargs): """ Creates a geotiff on the filesystem Args: path (str): optional, path to write the geotiff file to, default is ./output.tif proj (str): optional, EPSG string of projection to reproject to spec (str): optional, if set to 'rgb', write out co...
def is_client_ip_address_blacklisted(request: AxesHttpRequest) -> bool: """ Check if the given request refers to a blacklisted IP. """ if is_ip_address_in_blacklist(request.axes_ip_address): return True if settings.AXES_ONLY_WHITELIST and not is_ip_address_in_whitelist(request.axes_ip_addr...
def function[is_client_ip_address_blacklisted, parameter[request]]: constant[ Check if the given request refers to a blacklisted IP. ] if call[name[is_ip_address_in_blacklist], parameter[name[request].axes_ip_address]] begin[:] return[constant[True]] if <ast.BoolOp object at 0x7d...
keyword[def] identifier[is_client_ip_address_blacklisted] ( identifier[request] : identifier[AxesHttpRequest] )-> identifier[bool] : literal[string] keyword[if] identifier[is_ip_address_in_blacklist] ( identifier[request] . identifier[axes_ip_address] ): keyword[return] keyword[True] key...
def is_client_ip_address_blacklisted(request: AxesHttpRequest) -> bool: """ Check if the given request refers to a blacklisted IP. """ if is_ip_address_in_blacklist(request.axes_ip_address): return True # depends on [control=['if'], data=[]] if settings.AXES_ONLY_WHITELIST and (not is_ip_ad...
def defer_sync(self, func): """ Arrange for `func()` to execute on :class:`Broker` thread, blocking the current thread until a result or exception is available. :returns: Return value of `func()`. """ latch = Latch() def wrapper(): try: ...
def function[defer_sync, parameter[self, func]]: constant[ Arrange for `func()` to execute on :class:`Broker` thread, blocking the current thread until a result or exception is available. :returns: Return value of `func()`. ] variable[latch] assign[=] call[na...
keyword[def] identifier[defer_sync] ( identifier[self] , identifier[func] ): literal[string] identifier[latch] = identifier[Latch] () keyword[def] identifier[wrapper] (): keyword[try] : identifier[latch] . identifier[put] ( identifier[func] ()) k...
def defer_sync(self, func): """ Arrange for `func()` to execute on :class:`Broker` thread, blocking the current thread until a result or exception is available. :returns: Return value of `func()`. """ latch = Latch() def wrapper(): try: latch...
def in_range(x: int, minimum: int, maximum: int) -> bool: """ Return True if x is >= minimum and <= maximum. """ return (x >= minimum and x <= maximum)
def function[in_range, parameter[x, minimum, maximum]]: constant[ Return True if x is >= minimum and <= maximum. ] return[<ast.BoolOp object at 0x7da1b032bf10>]
keyword[def] identifier[in_range] ( identifier[x] : identifier[int] , identifier[minimum] : identifier[int] , identifier[maximum] : identifier[int] )-> identifier[bool] : literal[string] keyword[return] ( identifier[x] >= identifier[minimum] keyword[and] identifier[x] <= identifier[maximum] )
def in_range(x: int, minimum: int, maximum: int) -> bool: """ Return True if x is >= minimum and <= maximum. """ return x >= minimum and x <= maximum
def getPivotPoint(self,data): """ Returns the point this bone pivots around on the given entity. This method works recursively by calling its parent and then adding its own offset. The resulting coordinate is relative to the entity, not the world. """ pp...
def function[getPivotPoint, parameter[self, data]]: constant[ Returns the point this bone pivots around on the given entity. This method works recursively by calling its parent and then adding its own offset. The resulting coordinate is relative to the entity, not the w...
keyword[def] identifier[getPivotPoint] ( identifier[self] , identifier[data] ): literal[string] identifier[ppos] = identifier[self] . identifier[parent] . identifier[getPivotPoint] ( identifier[data] ) identifier[rot] = identifier[self] . identifier[parent] . identifier[getRot] ( identifie...
def getPivotPoint(self, data): """ Returns the point this bone pivots around on the given entity. This method works recursively by calling its parent and then adding its own offset. The resulting coordinate is relative to the entity, not the world. """ ppos = se...
def keysym_to_string(keysym): '''Translate a keysym (16 bit number) into a python string. This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear, XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other values it returns None.''' # ISO latin 1, LSB is the code if keysym...
def function[keysym_to_string, parameter[keysym]]: constant[Translate a keysym (16 bit number) into a python string. This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear, XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other values it returns None.] if compare[b...
keyword[def] identifier[keysym_to_string] ( identifier[keysym] ): literal[string] keyword[if] identifier[keysym] & literal[int] == literal[int] : keyword[return] identifier[chr] ( identifier[keysym] & literal[int] ) keyword[if] identifier[keysym] keyword[in] [ identifier[XK_BackSpa...
def keysym_to_string(keysym): """Translate a keysym (16 bit number) into a python string. This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear, XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other values it returns None.""" # ISO latin 1, LSB is the code if keysym ...
def get_objective_nodes(self, objective_id=None, ancestor_levels=None, descendant_levels=None, include_siblings=None): """Gets a portion of the hierarchy for the given objective. arg: obje...
def function[get_objective_nodes, parameter[self, objective_id, ancestor_levels, descendant_levels, include_siblings]]: constant[Gets a portion of the hierarchy for the given objective. arg: objective_id (osid.id.Id): the Id to query arg: ancestor_levels (cardinal): the maximum number of ...
keyword[def] identifier[get_objective_nodes] ( identifier[self] , identifier[objective_id] = keyword[None] , identifier[ancestor_levels] = keyword[None] , identifier[descendant_levels] = keyword[None] , identifier[include_siblings] = keyword[None] ): literal[string] keyword[if] identifier[obje...
def get_objective_nodes(self, objective_id=None, ancestor_levels=None, descendant_levels=None, include_siblings=None): """Gets a portion of the hierarchy for the given objective. arg: objective_id (osid.id.Id): the Id to query arg: ancestor_levels (cardinal): the maximum number of ...
def connected_components(graph): """ Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component. """ recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes(...
def function[connected_components, parameter[graph]]: constant[ Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component. ] variable[recursionlimit] assign[=] call[name[g...
keyword[def] identifier[connected_components] ( identifier[graph] ): literal[string] identifier[recursionlimit] = identifier[getrecursionlimit] () identifier[setrecursionlimit] ( identifier[max] ( identifier[len] ( identifier[graph] . identifier[nodes] ())* literal[int] , identifier[recursionlimit] ))...
def connected_components(graph): """ Connected components. @type graph: graph, hypergraph @param graph: Graph. @rtype: dictionary @return: Pairing that associates each node to its connected component. """ recursionlimit = getrecursionlimit() setrecursionlimit(max(len(graph.nodes(...
def cyclic_decoder(self,codewords): """ Decodes a vector of cyclic coded codewords. parameters ---------- codewords: vector of codewords to be decoded. Numpy array of integers expected. returns ------- decoded_blocks: vector of decoded bi...
def function[cyclic_decoder, parameter[self, codewords]]: constant[ Decodes a vector of cyclic coded codewords. parameters ---------- codewords: vector of codewords to be decoded. Numpy array of integers expected. returns ------- decoded_...
keyword[def] identifier[cyclic_decoder] ( identifier[self] , identifier[codewords] ): literal[string] keyword[if] ( identifier[len] ( identifier[codewords] )% identifier[self] . identifier[n] keyword[or] identifier[len] ( identifier[codewords] )< identifier[self] . identifier[n] ): ...
def cyclic_decoder(self, codewords): """ Decodes a vector of cyclic coded codewords. parameters ---------- codewords: vector of codewords to be decoded. Numpy array of integers expected. returns ------- decoded_blocks: vector of decoded bits ...
def cli(parser): ''' Currently a cop-out -- just calls easy_install ''' parser.add_argument('-n', '--dry-run', action='store_true', help='Print uninstall actions without running') parser.add_argument('packages', nargs='+', help='Packages to install') opts = parser.parse_args() for package i...
def function[cli, parameter[parser]]: constant[ Currently a cop-out -- just calls easy_install ] call[name[parser].add_argument, parameter[constant[-n], constant[--dry-run]]] call[name[parser].add_argument, parameter[constant[packages]]] variable[opts] assign[=] call[name[parser]...
keyword[def] identifier[cli] ( identifier[parser] ): literal[string] identifier[parser] . identifier[add_argument] ( literal[string] , literal[string] , identifier[action] = literal[string] , identifier[help] = literal[string] ) identifier[parser] . identifier[add_argument] ( literal[string] , identif...
def cli(parser): """ Currently a cop-out -- just calls easy_install """ parser.add_argument('-n', '--dry-run', action='store_true', help='Print uninstall actions without running') parser.add_argument('packages', nargs='+', help='Packages to install') opts = parser.parse_args() for package in...
def extract_sentences(nodes, token_node_indices): """ given a list of ``SaltNode``\s, returns a list of lists, where each list contains the indices of the nodes belonging to that sentence. """ sents = [] tokens = [] for i, node in enumerate(nodes): if i in token_node_indices: ...
def function[extract_sentences, parameter[nodes, token_node_indices]]: constant[ given a list of ``SaltNode``\s, returns a list of lists, where each list contains the indices of the nodes belonging to that sentence. ] variable[sents] assign[=] list[[]] variable[tokens] assign[=] list...
keyword[def] identifier[extract_sentences] ( identifier[nodes] , identifier[token_node_indices] ): literal[string] identifier[sents] =[] identifier[tokens] =[] keyword[for] identifier[i] , identifier[node] keyword[in] identifier[enumerate] ( identifier[nodes] ): keyword[if] identifie...
def extract_sentences(nodes, token_node_indices): """ given a list of ``SaltNode``\\s, returns a list of lists, where each list contains the indices of the nodes belonging to that sentence. """ sents = [] tokens = [] for (i, node) in enumerate(nodes): if i in token_node_indices: ...
def _validate_interop_ns(self, interop_ns): """ Validate whether the specified Interop namespace exists in the WBEM server, by communicating with it. If the specified Interop namespace exists, this method sets the :attr:`interop_ns` property of this object to that namespace and ...
def function[_validate_interop_ns, parameter[self, interop_ns]]: constant[ Validate whether the specified Interop namespace exists in the WBEM server, by communicating with it. If the specified Interop namespace exists, this method sets the :attr:`interop_ns` property of this ob...
keyword[def] identifier[_validate_interop_ns] ( identifier[self] , identifier[interop_ns] ): literal[string] identifier[test_classname] = literal[string] keyword[try] : identifier[self] . identifier[_conn] . identifier[EnumerateInstanceNames] ( identifier[test_classname] , ...
def _validate_interop_ns(self, interop_ns): """ Validate whether the specified Interop namespace exists in the WBEM server, by communicating with it. If the specified Interop namespace exists, this method sets the :attr:`interop_ns` property of this object to that namespace and ...
def _get_group_cached_perms(self): """ Set group cache. """ if not self.group: return {} perms = Permission.objects.filter( group=self.group, ) group_permissions = {} for perm in perms: group_permissions[( ...
def function[_get_group_cached_perms, parameter[self]]: constant[ Set group cache. ] if <ast.UnaryOp object at 0x7da1b045f970> begin[:] return[dictionary[[], []]] variable[perms] assign[=] call[name[Permission].objects.filter, parameter[]] variable[group_permissio...
keyword[def] identifier[_get_group_cached_perms] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[group] : keyword[return] {} identifier[perms] = identifier[Permission] . identifier[objects] . identifier[filter] ( identifi...
def _get_group_cached_perms(self): """ Set group cache. """ if not self.group: return {} # depends on [control=['if'], data=[]] perms = Permission.objects.filter(group=self.group) group_permissions = {} for perm in perms: group_permissions[perm.object_id, perm.conten...
def get_build_template(): '''get default build template. ''' base = get_installdir() name = "%s/main/templates/build/singularity-cloudbuild.json" % base if os.path.exists(name): bot.debug("Found template %s" %name) return read_json(name) bot.warning("Template %s not found." % n...
def function[get_build_template, parameter[]]: constant[get default build template. ] variable[base] assign[=] call[name[get_installdir], parameter[]] variable[name] assign[=] binary_operation[constant[%s/main/templates/build/singularity-cloudbuild.json] <ast.Mod object at 0x7da2590d6920> na...
keyword[def] identifier[get_build_template] (): literal[string] identifier[base] = identifier[get_installdir] () identifier[name] = literal[string] % identifier[base] keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[name] ): identifier[bot] . identifier[...
def get_build_template(): """get default build template. """ base = get_installdir() name = '%s/main/templates/build/singularity-cloudbuild.json' % base if os.path.exists(name): bot.debug('Found template %s' % name) return read_json(name) # depends on [control=['if'], data=[]] b...
def dummytable(numrows=100, fields=(('foo', partial(random.randint, 0, 100)), ('bar', partial(random.choice, ('apples', 'pears', 'bananas', 'oranges'))), ('baz', random.random)), wait=0, se...
def function[dummytable, parameter[numrows, fields, wait, seed]]: constant[ Construct a table with dummy data. Use `numrows` to specify the number of rows. Set `wait` to a float greater than zero to simulate a delay on each row generation (number of seconds per row). E.g.:: >>> import petl ...
keyword[def] identifier[dummytable] ( identifier[numrows] = literal[int] , identifier[fields] =(( literal[string] , identifier[partial] ( identifier[random] . identifier[randint] , literal[int] , literal[int] )), ( literal[string] , identifier[partial] ( identifier[random] . identifier[choice] ,( literal[string] , l...
def dummytable(numrows=100, fields=(('foo', partial(random.randint, 0, 100)), ('bar', partial(random.choice, ('apples', 'pears', 'bananas', 'oranges'))), ('baz', random.random)), wait=0, seed=None): """ Construct a table with dummy data. Use `numrows` to specify the number of rows. Set `wait` to a float gre...
def on_content_type(handlers, default=None, error='The requested content type does not match any of those allowed'): """Returns a content in a different format based on the clients provided content type, should pass in a dict with the following format: {'[content-type]': action, ......
def function[on_content_type, parameter[handlers, default, error]]: constant[Returns a content in a different format based on the clients provided content type, should pass in a dict with the following format: {'[content-type]': action, ... } ] def functi...
keyword[def] identifier[on_content_type] ( identifier[handlers] , identifier[default] = keyword[None] , identifier[error] = literal[string] ): literal[string] keyword[def] identifier[output_type] ( identifier[data] , identifier[request] , identifier[response] ): identifier[handler] = identifier[h...
def on_content_type(handlers, default=None, error='The requested content type does not match any of those allowed'): """Returns a content in a different format based on the clients provided content type, should pass in a dict with the following format: {'[content-type]': action, ......
def lookup_field(key, lookup_type=None, placeholder=None, html_class="div", select_type="strapselect", mapping="uuid"): """Generates a lookup field for form definitions""" if lookup_type is None: lookup_type = key if placeholder is None: placeholder = "Select a " + lookup_...
def function[lookup_field, parameter[key, lookup_type, placeholder, html_class, select_type, mapping]]: constant[Generates a lookup field for form definitions] if compare[name[lookup_type] is constant[None]] begin[:] variable[lookup_type] assign[=] name[key] if compare[name[place...
keyword[def] identifier[lookup_field] ( identifier[key] , identifier[lookup_type] = keyword[None] , identifier[placeholder] = keyword[None] , identifier[html_class] = literal[string] , identifier[select_type] = literal[string] , identifier[mapping] = literal[string] ): literal[string] keyword[if] identi...
def lookup_field(key, lookup_type=None, placeholder=None, html_class='div', select_type='strapselect', mapping='uuid'): """Generates a lookup field for form definitions""" if lookup_type is None: lookup_type = key # depends on [control=['if'], data=['lookup_type']] if placeholder is None: p...