code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def cut(self, buffer): """ Turn text object into `ClipboardData` instance. """ from_, to = self.operator_range(buffer.document) from_ += buffer.cursor_position to += buffer.cursor_position to -= 1 # SelectionState does not include the end position, `operator_ran...
def function[cut, parameter[self, buffer]]: constant[ Turn text object into `ClipboardData` instance. ] <ast.Tuple object at 0x7da18bcca6b0> assign[=] call[name[self].operator_range, parameter[name[buffer].document]] <ast.AugAssign object at 0x7da18bcca080> <ast.AugAssign object ...
keyword[def] identifier[cut] ( identifier[self] , identifier[buffer] ): literal[string] identifier[from_] , identifier[to] = identifier[self] . identifier[operator_range] ( identifier[buffer] . identifier[document] ) identifier[from_] += identifier[buffer] . identifier[cursor_position] ...
def cut(self, buffer): """ Turn text object into `ClipboardData` instance. """ (from_, to) = self.operator_range(buffer.document) from_ += buffer.cursor_position to += buffer.cursor_position to -= 1 # SelectionState does not include the end position, `operator_range` does. docum...
def humanize_bytes(size): """ Convert given number of bytes into a human readable representation, i.e. add prefix such as KB, MB, GB, etc. The `size` argument must be a non-negative integer. :param size: integer representing byte size of something :return: string representation of the size, in ...
def function[humanize_bytes, parameter[size]]: constant[ Convert given number of bytes into a human readable representation, i.e. add prefix such as KB, MB, GB, etc. The `size` argument must be a non-negative integer. :param size: integer representing byte size of something :return: string ...
keyword[def] identifier[humanize_bytes] ( identifier[size] ): literal[string] keyword[if] identifier[size] == literal[int] : keyword[return] literal[string] keyword[if] identifier[size] keyword[is] keyword[None] : keyword[return] literal[string] keyword[assert] identifier[size] >= litera...
def humanize_bytes(size): """ Convert given number of bytes into a human readable representation, i.e. add prefix such as KB, MB, GB, etc. The `size` argument must be a non-negative integer. :param size: integer representing byte size of something :return: string representation of the size, in ...
def fix_tour(self, tour): """ Test each scaffold if dropping does not decrease LMS. """ scaffolds, oos = zip(*tour) keep = set() for mlg in self.linkage_groups: lg = mlg.lg for s, o in tour: i = scaffolds.index(s) L ...
def function[fix_tour, parameter[self, tour]]: constant[ Test each scaffold if dropping does not decrease LMS. ] <ast.Tuple object at 0x7da204622590> assign[=] call[name[zip], parameter[<ast.Starred object at 0x7da2046231f0>]] variable[keep] assign[=] call[name[set], parameter[]]...
keyword[def] identifier[fix_tour] ( identifier[self] , identifier[tour] ): literal[string] identifier[scaffolds] , identifier[oos] = identifier[zip] (* identifier[tour] ) identifier[keep] = identifier[set] () keyword[for] identifier[mlg] keyword[in] identifier[self] . identifie...
def fix_tour(self, tour): """ Test each scaffold if dropping does not decrease LMS. """ (scaffolds, oos) = zip(*tour) keep = set() for mlg in self.linkage_groups: lg = mlg.lg for (s, o) in tour: i = scaffolds.index(s) L = [self.get_series(lg, x, xo...
def read_graph(filename, directed=False, weighted=False, default_weight=None): """Read a graph from a text file :param filename: plain text file. All numbers are separated by space. Starts with a line containing n (#vertices) and m (#edges). Then m lines follow, for each edge. ...
def function[read_graph, parameter[filename, directed, weighted, default_weight]]: constant[Read a graph from a text file :param filename: plain text file. All numbers are separated by space. Starts with a line containing n (#vertices) and m (#edges). Then m lines follow, for ea...
keyword[def] identifier[read_graph] ( identifier[filename] , identifier[directed] = keyword[False] , identifier[weighted] = keyword[False] , identifier[default_weight] = keyword[None] ): literal[string] keyword[with] identifier[open] ( identifier[filename] , literal[string] ) keyword[as] identifier[f] : ...
def read_graph(filename, directed=False, weighted=False, default_weight=None): """Read a graph from a text file :param filename: plain text file. All numbers are separated by space. Starts with a line containing n (#vertices) and m (#edges). Then m lines follow, for each edge. ...
def build_columns(self, X, verbose=False): """construct the model matrix columns for the term Parameters ---------- X : array-like Input dataset with n rows verbose : bool whether to show warnings Returns ------- scipy sparse arr...
def function[build_columns, parameter[self, X, verbose]]: constant[construct the model matrix columns for the term Parameters ---------- X : array-like Input dataset with n rows verbose : bool whether to show warnings Returns ------- ...
keyword[def] identifier[build_columns] ( identifier[self] , identifier[X] , identifier[verbose] = keyword[False] ): literal[string] identifier[splines] = identifier[self] . identifier[_terms] [ literal[int] ]. identifier[build_columns] ( identifier[X] , identifier[verbose] = identifier[verbose] ) ...
def build_columns(self, X, verbose=False): """construct the model matrix columns for the term Parameters ---------- X : array-like Input dataset with n rows verbose : bool whether to show warnings Returns ------- scipy sparse array w...
def get_present_elements(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get elements present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
def function[get_present_elements, parameter[self, locator, params, timeout, visible, parent]]: constant[ Get elements present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be f...
keyword[def] identifier[get_present_elements] ( identifier[self] , identifier[locator] , identifier[params] = keyword[None] , identifier[timeout] = keyword[None] , identifier[visible] = keyword[False] , identifier[parent] = keyword[None] ): literal[string] identifier[error_msg] = literal[string] k...
def get_present_elements(self, locator, params=None, timeout=None, visible=False, parent=None): """ Get elements present in the DOM. If timeout is 0 (zero) return WebElement instance or None, else we wait and retry for timeout and raise TimeoutException should the element not be found. ...
def normalize(self): """ Sum the values in a Counter, then create a new Counter where each new value (while keeping the original key) is equal to the original value divided by sum of all the original values (this is sometimes referred to as the normalization constant). https://en.wikipedia.org/wiki/No...
def function[normalize, parameter[self]]: constant[ Sum the values in a Counter, then create a new Counter where each new value (while keeping the original key) is equal to the original value divided by sum of all the original values (this is sometimes referred to as the normalization constant). ...
keyword[def] identifier[normalize] ( identifier[self] ): literal[string] identifier[total] = identifier[sum] ( identifier[self] . identifier[values] ()) identifier[stats] ={ identifier[k] :( identifier[v] / identifier[float] ( identifier[total] )) keyword[for] identifier[k] , identifier[v] keyword[in] id...
def normalize(self): """ Sum the values in a Counter, then create a new Counter where each new value (while keeping the original key) is equal to the original value divided by sum of all the original values (this is sometimes referred to as the normalization constant). https://en.wikipedia.org/wiki/...
def log_player_buys_road(self, player, location): """ :param player: catan.game.Player :param location: string, see hexgrid.location() """ self._logln('{0} buys road, builds at {1}'.format( player.color, location ))
def function[log_player_buys_road, parameter[self, player, location]]: constant[ :param player: catan.game.Player :param location: string, see hexgrid.location() ] call[name[self]._logln, parameter[call[constant[{0} buys road, builds at {1}].format, parameter[name[player].color, ...
keyword[def] identifier[log_player_buys_road] ( identifier[self] , identifier[player] , identifier[location] ): literal[string] identifier[self] . identifier[_logln] ( literal[string] . identifier[format] ( identifier[player] . identifier[color] , identifier[location] ))
def log_player_buys_road(self, player, location): """ :param player: catan.game.Player :param location: string, see hexgrid.location() """ self._logln('{0} buys road, builds at {1}'.format(player.color, location))
def spawn(self, options, port, background=False, prefix=""): "Spawn a daemon instance." self.spawncmd = None # Look for gpsd in GPSD_HOME env variable if os.environ.get('GPSD_HOME'): for path in os.environ['GPSD_HOME'].split(':'): _spawncmd = "%s/gpsd" % path ...
def function[spawn, parameter[self, options, port, background, prefix]]: constant[Spawn a daemon instance.] name[self].spawncmd assign[=] constant[None] if call[name[os].environ.get, parameter[constant[GPSD_HOME]]] begin[:] for taget[name[path]] in starred[call[call[name[os].envi...
keyword[def] identifier[spawn] ( identifier[self] , identifier[options] , identifier[port] , identifier[background] = keyword[False] , identifier[prefix] = literal[string] ): literal[string] identifier[self] . identifier[spawncmd] = keyword[None] keyword[if] identifier[os] . id...
def spawn(self, options, port, background=False, prefix=''): """Spawn a daemon instance.""" self.spawncmd = None # Look for gpsd in GPSD_HOME env variable if os.environ.get('GPSD_HOME'): for path in os.environ['GPSD_HOME'].split(':'): _spawncmd = '%s/gpsd' % path if os.path....
def map_plugin_coro(self, coro_name, *args, **kwargs): """ Call a plugin declared by plugin by its name :param coro_name: :param args: :param kwargs: :return: """ return (yield from self.map(self._call_coro, coro_name, *args, **kwargs))
def function[map_plugin_coro, parameter[self, coro_name]]: constant[ Call a plugin declared by plugin by its name :param coro_name: :param args: :param kwargs: :return: ] return[<ast.YieldFrom object at 0x7da18fe93b50>]
keyword[def] identifier[map_plugin_coro] ( identifier[self] , identifier[coro_name] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[return] ( keyword[yield] keyword[from] identifier[self] . identifier[map] ( identifier[self] . identifier[_call_coro] , identifier[coro_name] ,...
def map_plugin_coro(self, coro_name, *args, **kwargs): """ Call a plugin declared by plugin by its name :param coro_name: :param args: :param kwargs: :return: """ return (yield from self.map(self._call_coro, coro_name, *args, **kwargs))
def get_user_paginator( cls, instance, page=1, item_count=None, items_per_page=50, user_ids=None, GET_params=None, ): """ returns paginator over users belonging to the group :param instance: :param page: :param item_cou...
def function[get_user_paginator, parameter[cls, instance, page, item_count, items_per_page, user_ids, GET_params]]: constant[ returns paginator over users belonging to the group :param instance: :param page: :param item_count: :param items_per_page: :param user_i...
keyword[def] identifier[get_user_paginator] ( identifier[cls] , identifier[instance] , identifier[page] = literal[int] , identifier[item_count] = keyword[None] , identifier[items_per_page] = literal[int] , identifier[user_ids] = keyword[None] , identifier[GET_params] = keyword[None] , ): literal[strin...
def get_user_paginator(cls, instance, page=1, item_count=None, items_per_page=50, user_ids=None, GET_params=None): """ returns paginator over users belonging to the group :param instance: :param page: :param item_count: :param items_per_page: :param user_ids: ...
def iter_series(self, workbook, row, col): """ Yield series dictionaries with values resolved to the final excel formulas. """ for series in self.__series: series = dict(series) series["values"] = series["values"].get_formula(workbook, row, col) if "ca...
def function[iter_series, parameter[self, workbook, row, col]]: constant[ Yield series dictionaries with values resolved to the final excel formulas. ] for taget[name[series]] in starred[name[self].__series] begin[:] variable[series] assign[=] call[name[dict], parameter[n...
keyword[def] identifier[iter_series] ( identifier[self] , identifier[workbook] , identifier[row] , identifier[col] ): literal[string] keyword[for] identifier[series] keyword[in] identifier[self] . identifier[__series] : identifier[series] = identifier[dict] ( identifier[series] ) ...
def iter_series(self, workbook, row, col): """ Yield series dictionaries with values resolved to the final excel formulas. """ for series in self.__series: series = dict(series) series['values'] = series['values'].get_formula(workbook, row, col) if 'categories' in series:...
def get_asset_address(self, asset: str) -> bytes: """ This interface is used to get the smart contract address of ONT otr ONG. :param asset: a string which is used to indicate which asset's contract address we want to get. :return: the contract address of asset in the form of bytearray....
def function[get_asset_address, parameter[self, asset]]: constant[ This interface is used to get the smart contract address of ONT otr ONG. :param asset: a string which is used to indicate which asset's contract address we want to get. :return: the contract address of asset in the form ...
keyword[def] identifier[get_asset_address] ( identifier[self] , identifier[asset] : identifier[str] )-> identifier[bytes] : literal[string] keyword[if] identifier[asset] . identifier[upper] ()== literal[string] : keyword[return] identifier[self] . identifier[__ont_contract] ...
def get_asset_address(self, asset: str) -> bytes: """ This interface is used to get the smart contract address of ONT otr ONG. :param asset: a string which is used to indicate which asset's contract address we want to get. :return: the contract address of asset in the form of bytearray. ...
def save(self, sync_only=False): """ :param sync_only: :type: bool """ entity = datastore.Entity(key=self._key) entity["last_accessed"] = self.last_accessed # todo: restore sync only entity["data"] = self._data if self.expires: entity...
def function[save, parameter[self, sync_only]]: constant[ :param sync_only: :type: bool ] variable[entity] assign[=] call[name[datastore].Entity, parameter[]] call[name[entity]][constant[last_accessed]] assign[=] name[self].last_accessed call[name[entity]][constan...
keyword[def] identifier[save] ( identifier[self] , identifier[sync_only] = keyword[False] ): literal[string] identifier[entity] = identifier[datastore] . identifier[Entity] ( identifier[key] = identifier[self] . identifier[_key] ) identifier[entity] [ literal[string] ]= identifier[self] ....
def save(self, sync_only=False): """ :param sync_only: :type: bool """ entity = datastore.Entity(key=self._key) entity['last_accessed'] = self.last_accessed # todo: restore sync only entity['data'] = self._data if self.expires: entity['expires'] = self.expires # ...
def setError(self, msg=None, title=None): """ Shows and error message """ if msg is not None: self.messageLabel.setText(msg) if title is not None: self.titleLabel.setText(title)
def function[setError, parameter[self, msg, title]]: constant[ Shows and error message ] if compare[name[msg] is_not constant[None]] begin[:] call[name[self].messageLabel.setText, parameter[name[msg]]] if compare[name[title] is_not constant[None]] begin[:] ...
keyword[def] identifier[setError] ( identifier[self] , identifier[msg] = keyword[None] , identifier[title] = keyword[None] ): literal[string] keyword[if] identifier[msg] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[messageLabel] . identifier[setText] ( ide...
def setError(self, msg=None, title=None): """ Shows and error message """ if msg is not None: self.messageLabel.setText(msg) # depends on [control=['if'], data=['msg']] if title is not None: self.titleLabel.setText(title) # depends on [control=['if'], data=['title']]
def page(request, slug, template=u"pages/page.html", extra_context=None): """ Select a template for a page and render it. The request object should have a ``page`` attribute that's added via ``yacms.pages.middleware.PageMiddleware``. The page is loaded earlier via middleware to perform various other...
def function[page, parameter[request, slug, template, extra_context]]: constant[ Select a template for a page and render it. The request object should have a ``page`` attribute that's added via ``yacms.pages.middleware.PageMiddleware``. The page is loaded earlier via middleware to perform variou...
keyword[def] identifier[page] ( identifier[request] , identifier[slug] , identifier[template] = literal[string] , identifier[extra_context] = keyword[None] ): literal[string] keyword[from] identifier[yacms] . identifier[pages] . identifier[middleware] keyword[import] identifier[PageMiddleware] ke...
def page(request, slug, template=u'pages/page.html', extra_context=None): """ Select a template for a page and render it. The request object should have a ``page`` attribute that's added via ``yacms.pages.middleware.PageMiddleware``. The page is loaded earlier via middleware to perform various other...
def p_partselect_pointer_plus(self, p): 'partselect : pointer LBRACKET expression PLUSCOLON expression RBRACKET' p[0] = Partselect(p[1], p[3], Plus( p[3], p[5], lineno=p.lineno(1)), lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
def function[p_partselect_pointer_plus, parameter[self, p]]: constant[partselect : pointer LBRACKET expression PLUSCOLON expression RBRACKET] call[name[p]][constant[0]] assign[=] call[name[Partselect], parameter[call[name[p]][constant[1]], call[name[p]][constant[3]], call[name[Plus], parameter[call[name...
keyword[def] identifier[p_partselect_pointer_plus] ( identifier[self] , identifier[p] ): literal[string] identifier[p] [ literal[int] ]= identifier[Partselect] ( identifier[p] [ literal[int] ], identifier[p] [ literal[int] ], identifier[Plus] ( identifier[p] [ literal[int] ], identifier[p]...
def p_partselect_pointer_plus(self, p): """partselect : pointer LBRACKET expression PLUSCOLON expression RBRACKET""" p[0] = Partselect(p[1], p[3], Plus(p[3], p[5], lineno=p.lineno(1)), lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
def get_net_imbalance(count_per_broker): """Calculate and return net imbalance based on given count of partitions or leaders per broker. Net-imbalance in case of partitions implies total number of extra partitions from optimal count over all brokers. This is also implies, the minimum number of part...
def function[get_net_imbalance, parameter[count_per_broker]]: constant[Calculate and return net imbalance based on given count of partitions or leaders per broker. Net-imbalance in case of partitions implies total number of extra partitions from optimal count over all brokers. This is also impl...
keyword[def] identifier[get_net_imbalance] ( identifier[count_per_broker] ): literal[string] identifier[net_imbalance] = literal[int] identifier[opt_count] , identifier[extra_allowed] = identifier[compute_optimum] ( identifier[len] ( identifier[count_per_broker] ), identifier[sum] ( identifier[count_...
def get_net_imbalance(count_per_broker): """Calculate and return net imbalance based on given count of partitions or leaders per broker. Net-imbalance in case of partitions implies total number of extra partitions from optimal count over all brokers. This is also implies, the minimum number of part...
def write_skycatalog(self,filename): """ Write out the all_radec catalog for this image to a file. """ if self.all_radec is None: return ralist = self.all_radec[0]#.tolist() declist = self.all_radec[1]#.tolist() f = open(filename,'w') f.write("#Sky pos...
def function[write_skycatalog, parameter[self, filename]]: constant[ Write out the all_radec catalog for this image to a file. ] if compare[name[self].all_radec is constant[None]] begin[:] return[None] variable[ralist] assign[=] call[name[self].all_radec][constant[0]] var...
keyword[def] identifier[write_skycatalog] ( identifier[self] , identifier[filename] ): literal[string] keyword[if] identifier[self] . identifier[all_radec] keyword[is] keyword[None] : keyword[return] identifier[ralist] = identifier[self] . identifier[all_radec] [ literal[i...
def write_skycatalog(self, filename): """ Write out the all_radec catalog for this image to a file. """ if self.all_radec is None: return # depends on [control=['if'], data=[]] ralist = self.all_radec[0] #.tolist() declist = self.all_radec[1] #.tolist() f = open(filename, 'w') ...
def generate_api_docs(package, api_dir, clean=False, printlog=True): """Generate a module level API documentation of a python package. Description ----------- Generates markdown API files for each module in a Python package whereas the structure is as follows: `package/package.subpackage/packag...
def function[generate_api_docs, parameter[package, api_dir, clean, printlog]]: constant[Generate a module level API documentation of a python package. Description ----------- Generates markdown API files for each module in a Python package whereas the structure is as follows: `package/packa...
keyword[def] identifier[generate_api_docs] ( identifier[package] , identifier[api_dir] , identifier[clean] = keyword[False] , identifier[printlog] = keyword[True] ): literal[string] keyword[if] identifier[printlog] : identifier[print] ( literal[string] %( literal[int] * literal[string] )) i...
def generate_api_docs(package, api_dir, clean=False, printlog=True): """Generate a module level API documentation of a python package. Description ----------- Generates markdown API files for each module in a Python package whereas the structure is as follows: `package/package.subpackage/packag...
def convert_predictions_to_image_summaries(hook_args): """Optionally converts images from hooks_args to image summaries. Args: hook_args: DecodeHookArgs namedtuple Returns: summaries: list of tf.Summary values if hook_args.decode_hpara """ decode_hparams = hook_args.decode_hparams if not decode_hpa...
def function[convert_predictions_to_image_summaries, parameter[hook_args]]: constant[Optionally converts images from hooks_args to image summaries. Args: hook_args: DecodeHookArgs namedtuple Returns: summaries: list of tf.Summary values if hook_args.decode_hpara ] variable[decode_hparams]...
keyword[def] identifier[convert_predictions_to_image_summaries] ( identifier[hook_args] ): literal[string] identifier[decode_hparams] = identifier[hook_args] . identifier[decode_hparams] keyword[if] keyword[not] identifier[decode_hparams] . identifier[display_decoded_images] : keyword[return] [] ...
def convert_predictions_to_image_summaries(hook_args): """Optionally converts images from hooks_args to image summaries. Args: hook_args: DecodeHookArgs namedtuple Returns: summaries: list of tf.Summary values if hook_args.decode_hpara """ decode_hparams = hook_args.decode_hparams if not deco...
def section(request): """ Determines the current site section from resolved view pattern and adds it to context['section']. Section defaults to the first specified section. """ # If SECTIONS setting is not specified, don't do anything. try: sections = settings.SECTIONS except Attribu...
def function[section, parameter[request]]: constant[ Determines the current site section from resolved view pattern and adds it to context['section']. Section defaults to the first specified section. ] <ast.Try object at 0x7da204345900> variable[section] assign[=] call[call[name[sections...
keyword[def] identifier[section] ( identifier[request] ): literal[string] keyword[try] : identifier[sections] = identifier[settings] . identifier[SECTIONS] keyword[except] identifier[AttributeError] : keyword[return] {} identifier[section] = identifier[sections]...
def section(request): """ Determines the current site section from resolved view pattern and adds it to context['section']. Section defaults to the first specified section. """ # If SECTIONS setting is not specified, don't do anything. try: sections = settings.SECTIONS # depends on [con...
def bundles(ctx): """ List discovered bundles. """ bundles = _get_bundles(ctx.obj.data['env']) print_table(('Name', 'Location'), [(bundle.name, f'{bundle.__module__}.{bundle.__class__.__name__}') for bundle in bundles])
def function[bundles, parameter[ctx]]: constant[ List discovered bundles. ] variable[bundles] assign[=] call[name[_get_bundles], parameter[call[name[ctx].obj.data][constant[env]]]] call[name[print_table], parameter[tuple[[<ast.Constant object at 0x7da20c992860>, <ast.Constant object at 0...
keyword[def] identifier[bundles] ( identifier[ctx] ): literal[string] identifier[bundles] = identifier[_get_bundles] ( identifier[ctx] . identifier[obj] . identifier[data] [ literal[string] ]) identifier[print_table] (( literal[string] , literal[string] ), [( identifier[bundle] . identifier[name] ...
def bundles(ctx): """ List discovered bundles. """ bundles = _get_bundles(ctx.obj.data['env']) print_table(('Name', 'Location'), [(bundle.name, f'{bundle.__module__}.{bundle.__class__.__name__}') for bundle in bundles])
def _set_scroll_area(self, force=False): """ Args: force(bool): Set the scroll area even if no change in height and position is detected Sets the scroll window based on the counter positions """ # Save scroll offset for resizing oldOffset = self.scroll_offse...
def function[_set_scroll_area, parameter[self, force]]: constant[ Args: force(bool): Set the scroll area even if no change in height and position is detected Sets the scroll window based on the counter positions ] variable[oldOffset] assign[=] name[self].scroll_offse...
keyword[def] identifier[_set_scroll_area] ( identifier[self] , identifier[force] = keyword[False] ): literal[string] identifier[oldOffset] = identifier[self] . identifier[scroll_offset] identifier[self] . identifier[scroll_offset] = identifier[newOffset] = identifier[max] ( iden...
def _set_scroll_area(self, force=False): """ Args: force(bool): Set the scroll area even if no change in height and position is detected Sets the scroll window based on the counter positions """ # Save scroll offset for resizing oldOffset = self.scroll_offset self.sc...
def parse_jellyfish_data(self, f): """ Go through the hist file and memorise it """ histogram = {} occurence = 0 for line in f['f']: line = line.rstrip('\n') occurence = int(line.split(" ")[0]) count = int(line.split(" ")[1]) histogram[occu...
def function[parse_jellyfish_data, parameter[self, f]]: constant[ Go through the hist file and memorise it ] variable[histogram] assign[=] dictionary[[], []] variable[occurence] assign[=] constant[0] for taget[name[line]] in starred[call[name[f]][constant[f]]] begin[:] va...
keyword[def] identifier[parse_jellyfish_data] ( identifier[self] , identifier[f] ): literal[string] identifier[histogram] ={} identifier[occurence] = literal[int] keyword[for] identifier[line] keyword[in] identifier[f] [ literal[string] ]: identifier[line] = ident...
def parse_jellyfish_data(self, f): """ Go through the hist file and memorise it """ histogram = {} occurence = 0 for line in f['f']: line = line.rstrip('\n') occurence = int(line.split(' ')[0]) count = int(line.split(' ')[1]) histogram[occurence] = occurence * count # de...
def get_agent_lookup_session(self): """Gets the ``OsidSession`` associated with the agent lookup service. return: (osid.authentication.AgentLookupSession) - an ``AgentLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_...
def function[get_agent_lookup_session, parameter[self]]: constant[Gets the ``OsidSession`` associated with the agent lookup service. return: (osid.authentication.AgentLookupSession) - an ``AgentLookupSession`` raise: OperationFailed - unable to complete request raise: ...
keyword[def] identifier[get_agent_lookup_session] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[supports_agent_lookup] (): keyword[raise] identifier[errors] . identifier[Unimplemented] () keyword[return] identifie...
def get_agent_lookup_session(self): """Gets the ``OsidSession`` associated with the agent lookup service. return: (osid.authentication.AgentLookupSession) - an ``AgentLookupSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_agen...
def ones(self, name, **kwargs): """Create an array. Keyword arguments as per :func:`zarr.creation.ones`.""" return self._write_op(self._ones_nosync, name, **kwargs)
def function[ones, parameter[self, name]]: constant[Create an array. Keyword arguments as per :func:`zarr.creation.ones`.] return[call[name[self]._write_op, parameter[name[self]._ones_nosync, name[name]]]]
keyword[def] identifier[ones] ( identifier[self] , identifier[name] ,** identifier[kwargs] ): literal[string] keyword[return] identifier[self] . identifier[_write_op] ( identifier[self] . identifier[_ones_nosync] , identifier[name] ,** identifier[kwargs] )
def ones(self, name, **kwargs): """Create an array. Keyword arguments as per :func:`zarr.creation.ones`.""" return self._write_op(self._ones_nosync, name, **kwargs)
def handle_json_wrapper_GET(self, handler, parsed_params): """Call handler and output the return value in JSON.""" schedule = self.server.schedule result = handler(parsed_params) content = ResultEncoder().encode(result) self.send_response(200) self.send_header('Content-Type', 'text/plain') s...
def function[handle_json_wrapper_GET, parameter[self, handler, parsed_params]]: constant[Call handler and output the return value in JSON.] variable[schedule] assign[=] name[self].server.schedule variable[result] assign[=] call[name[handler], parameter[name[parsed_params]]] variable[cont...
keyword[def] identifier[handle_json_wrapper_GET] ( identifier[self] , identifier[handler] , identifier[parsed_params] ): literal[string] identifier[schedule] = identifier[self] . identifier[server] . identifier[schedule] identifier[result] = identifier[handler] ( identifier[parsed_params] ) iden...
def handle_json_wrapper_GET(self, handler, parsed_params): """Call handler and output the return value in JSON.""" schedule = self.server.schedule result = handler(parsed_params) content = ResultEncoder().encode(result) self.send_response(200) self.send_header('Content-Type', 'text/plain') s...
def get_mode(device): ''' Report whether the quota system for this device is on or off CLI Example: .. code-block:: bash salt '*' quota.get_mode ''' ret = {} cmd = 'quotaon -p {0}'.format(device) out = __salt__['cmd.run'](cmd, python_shell=False) for line in out.splitlines...
def function[get_mode, parameter[device]]: constant[ Report whether the quota system for this device is on or off CLI Example: .. code-block:: bash salt '*' quota.get_mode ] variable[ret] assign[=] dictionary[[], []] variable[cmd] assign[=] call[constant[quotaon -p {0}...
keyword[def] identifier[get_mode] ( identifier[device] ): literal[string] identifier[ret] ={} identifier[cmd] = literal[string] . identifier[format] ( identifier[device] ) identifier[out] = identifier[__salt__] [ literal[string] ]( identifier[cmd] , identifier[python_shell] = keyword[False] ) ...
def get_mode(device): """ Report whether the quota system for this device is on or off CLI Example: .. code-block:: bash salt '*' quota.get_mode """ ret = {} cmd = 'quotaon -p {0}'.format(device) out = __salt__['cmd.run'](cmd, python_shell=False) for line in out.splitlines...
def _prepare_env(self): # pragma: no cover """Setup the document's environment, if necessary.""" env = self.state.document.settings.env if not hasattr(env, self.directive_name): # Track places where we use this directive, so we can check for # outdated documents in the f...
def function[_prepare_env, parameter[self]]: constant[Setup the document's environment, if necessary.] variable[env] assign[=] name[self].state.document.settings.env if <ast.UnaryOp object at 0x7da1b18000d0> begin[:] variable[state] assign[=] call[name[DirectiveState], parameter[...
keyword[def] identifier[_prepare_env] ( identifier[self] ): literal[string] identifier[env] = identifier[self] . identifier[state] . identifier[document] . identifier[settings] . identifier[env] keyword[if] keyword[not] identifier[hasattr] ( identifier[env] , identifier[self] . identifi...
def _prepare_env(self): # pragma: no cover "Setup the document's environment, if necessary." env = self.state.document.settings.env if not hasattr(env, self.directive_name): # Track places where we use this directive, so we can check for # outdated documents in the future. state = D...
def CopyToDateTimeString(self): """Copies the time elements to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or "YYYY-MM-DD hh:mm:ss.######" or None if time elements are missing. Raises: ValueError: if the precision value is unsupported...
def function[CopyToDateTimeString, parameter[self]]: constant[Copies the time elements to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or "YYYY-MM-DD hh:mm:ss.######" or None if time elements are missing. Raises: ValueError: if the...
keyword[def] identifier[CopyToDateTimeString] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_number_of_seconds] keyword[is] keyword[None] keyword[or] identifier[self] . identifier[fraction_of_second] keyword[is] keyword[None] : keyword[return] keyword[None] ...
def CopyToDateTimeString(self): """Copies the time elements to a date and time string. Returns: str: date and time value formatted as: "YYYY-MM-DD hh:mm:ss" or "YYYY-MM-DD hh:mm:ss.######" or None if time elements are missing. Raises: ValueError: if the precision value is unsupported...
def get_decoder(encoding, flexible=False): """ RETURN FUNCTION TO PERFORM DECODE :param encoding: STRING OF THE ENCODING :param flexible: True IF YOU WISH TO TRY OUR BEST, AND KEEP GOING :return: FUNCTION """ if encoding == None: def no_decode(v): return v return ...
def function[get_decoder, parameter[encoding, flexible]]: constant[ RETURN FUNCTION TO PERFORM DECODE :param encoding: STRING OF THE ENCODING :param flexible: True IF YOU WISH TO TRY OUR BEST, AND KEEP GOING :return: FUNCTION ] if compare[name[encoding] equal[==] constant[None]] begi...
keyword[def] identifier[get_decoder] ( identifier[encoding] , identifier[flexible] = keyword[False] ): literal[string] keyword[if] identifier[encoding] == keyword[None] : keyword[def] identifier[no_decode] ( identifier[v] ): keyword[return] identifier[v] keyword[return] ...
def get_decoder(encoding, flexible=False): """ RETURN FUNCTION TO PERFORM DECODE :param encoding: STRING OF THE ENCODING :param flexible: True IF YOU WISH TO TRY OUR BEST, AND KEEP GOING :return: FUNCTION """ if encoding == None: def no_decode(v): return v return...
def failsafe(func): """ Wraps an app factory to provide a fallback in case of import errors. Takes a factory function to generate a Flask app. If there is an error creating the app, it will return a dummy app that just returns the Flask error page for the exception. This works with the Flask c...
def function[failsafe, parameter[func]]: constant[ Wraps an app factory to provide a fallback in case of import errors. Takes a factory function to generate a Flask app. If there is an error creating the app, it will return a dummy app that just returns the Flask error page for the exception. ...
keyword[def] identifier[failsafe] ( identifier[func] ): literal[string] @ identifier[functools] . identifier[wraps] ( identifier[func] ) keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ): identifier[extra_files] =[] keyword[try] : keyword[re...
def failsafe(func): """ Wraps an app factory to provide a fallback in case of import errors. Takes a factory function to generate a Flask app. If there is an error creating the app, it will return a dummy app that just returns the Flask error page for the exception. This works with the Flask c...
def parse_table_definition_file(file): ''' Read an parse the XML of a table-definition file. @return: an ElementTree object for the table definition ''' logging.info("Reading table definition from '%s'...", file) if not os.path.isfile(file): logging.error("File '%s' does not exist.", fil...
def function[parse_table_definition_file, parameter[file]]: constant[ Read an parse the XML of a table-definition file. @return: an ElementTree object for the table definition ] call[name[logging].info, parameter[constant[Reading table definition from '%s'...], name[file]]] if <ast.U...
keyword[def] identifier[parse_table_definition_file] ( identifier[file] ): literal[string] identifier[logging] . identifier[info] ( literal[string] , identifier[file] ) keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[isfile] ( identifier[file] ): identifier[logging] ...
def parse_table_definition_file(file): """ Read an parse the XML of a table-definition file. @return: an ElementTree object for the table definition """ logging.info("Reading table definition from '%s'...", file) if not os.path.isfile(file): logging.error("File '%s' does not exist.", fil...
def list_build_configurations(page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations """ data = list_build_configurations_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
def function[list_build_configurations, parameter[page_size, page_index, sort, q]]: constant[ List all BuildConfigurations ] variable[data] assign[=] call[name[list_build_configurations_raw], parameter[name[page_size], name[page_index], name[sort], name[q]]] if name[data] begin[:] ...
keyword[def] identifier[list_build_configurations] ( identifier[page_size] = literal[int] , identifier[page_index] = literal[int] , identifier[sort] = literal[string] , identifier[q] = literal[string] ): literal[string] identifier[data] = identifier[list_build_configurations_raw] ( identifier[page_size] , ...
def list_build_configurations(page_size=200, page_index=0, sort='', q=''): """ List all BuildConfigurations """ data = list_build_configurations_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data) # depends on [control=['if'], data=[]]
def get_default_master_type(num_gpus=1): """Returns master_type for trainingInput.""" gpus_to_master_map = { 0: "standard", 1: "standard_p100", 4: "complex_model_m_p100", 8: "complex_model_l_gpu", } if num_gpus not in gpus_to_master_map: raise ValueError("Num gpus must be in %s" % ...
def function[get_default_master_type, parameter[num_gpus]]: constant[Returns master_type for trainingInput.] variable[gpus_to_master_map] assign[=] dictionary[[<ast.Constant object at 0x7da18f00e020>, <ast.Constant object at 0x7da18f00fa30>, <ast.Constant object at 0x7da18f00d8d0>, <ast.Constant object ...
keyword[def] identifier[get_default_master_type] ( identifier[num_gpus] = literal[int] ): literal[string] identifier[gpus_to_master_map] ={ literal[int] : literal[string] , literal[int] : literal[string] , literal[int] : literal[string] , literal[int] : literal[string] , } keyword[if] identif...
def get_default_master_type(num_gpus=1): """Returns master_type for trainingInput.""" gpus_to_master_map = {0: 'standard', 1: 'standard_p100', 4: 'complex_model_m_p100', 8: 'complex_model_l_gpu'} if num_gpus not in gpus_to_master_map: raise ValueError('Num gpus must be in %s' % str(sorted(list(gpus_...
def commonprefix(items): """Get common prefix for completions Return the longest common prefix of a list of strings, but with special treatment of escape characters that might precede commands in IPython, such as %magic functions. Used in tab completion. For a more general function, see os.path.co...
def function[commonprefix, parameter[items]]: constant[Get common prefix for completions Return the longest common prefix of a list of strings, but with special treatment of escape characters that might precede commands in IPython, such as %magic functions. Used in tab completion. For a more g...
keyword[def] identifier[commonprefix] ( identifier[items] ): literal[string] identifier[first_match] = identifier[ESCAPE_RE] . identifier[match] ( identifier[min] ( identifier[items] )) identifier[last_match] = identifier[ESCAPE_RE] . identifier[match] ( identifier[max] ( identifier[items] )...
def commonprefix(items): """Get common prefix for completions Return the longest common prefix of a list of strings, but with special treatment of escape characters that might precede commands in IPython, such as %magic functions. Used in tab completion. For a more general function, see os.path.co...
def get_alpn_proto_negotiated(self): """ Get the protocol that was negotiated by ALPN. :returns: A bytestring of the protocol name. If no protocol has been negotiated yet, returns an empty string. """ data = _ffi.new("unsigned char **") data_len = _ffi.new("...
def function[get_alpn_proto_negotiated, parameter[self]]: constant[ Get the protocol that was negotiated by ALPN. :returns: A bytestring of the protocol name. If no protocol has been negotiated yet, returns an empty string. ] variable[data] assign[=] call[name[_ffi]...
keyword[def] identifier[get_alpn_proto_negotiated] ( identifier[self] ): literal[string] identifier[data] = identifier[_ffi] . identifier[new] ( literal[string] ) identifier[data_len] = identifier[_ffi] . identifier[new] ( literal[string] ) identifier[_lib] . identifier[SSL_get0_...
def get_alpn_proto_negotiated(self): """ Get the protocol that was negotiated by ALPN. :returns: A bytestring of the protocol name. If no protocol has been negotiated yet, returns an empty string. """ data = _ffi.new('unsigned char **') data_len = _ffi.new('unsigned int...
def latrec(radius, longitude, latitude): """ Convert from latitudinal coordinates to rectangular coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latrec_c.html :param radius: Distance of a point from the origin. :type radius: float :param longitude: Longitude of point in ra...
def function[latrec, parameter[radius, longitude, latitude]]: constant[ Convert from latitudinal coordinates to rectangular coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latrec_c.html :param radius: Distance of a point from the origin. :type radius: float :param long...
keyword[def] identifier[latrec] ( identifier[radius] , identifier[longitude] , identifier[latitude] ): literal[string] identifier[radius] = identifier[ctypes] . identifier[c_double] ( identifier[radius] ) identifier[longitude] = identifier[ctypes] . identifier[c_double] ( identifier[longitude] ) ...
def latrec(radius, longitude, latitude): """ Convert from latitudinal coordinates to rectangular coordinates. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/latrec_c.html :param radius: Distance of a point from the origin. :type radius: float :param longitude: Longitude of point in ra...
def removeTopology(self, topology_name, state_manager_name): """ Removes the topology from the local cache. """ topologies = [] for top in self.topologies: if (top.name == topology_name and top.state_manager_name == state_manager_name): # Remove topologyInfo if (topol...
def function[removeTopology, parameter[self, topology_name, state_manager_name]]: constant[ Removes the topology from the local cache. ] variable[topologies] assign[=] list[[]] for taget[name[top]] in starred[name[self].topologies] begin[:] if <ast.BoolOp object at 0x7da2...
keyword[def] identifier[removeTopology] ( identifier[self] , identifier[topology_name] , identifier[state_manager_name] ): literal[string] identifier[topologies] =[] keyword[for] identifier[top] keyword[in] identifier[self] . identifier[topologies] : keyword[if] ( identifier[top] . identifie...
def removeTopology(self, topology_name, state_manager_name): """ Removes the topology from the local cache. """ topologies = [] for top in self.topologies: if top.name == topology_name and top.state_manager_name == state_manager_name: # Remove topologyInfo if (topolog...
def fitNull(self, init_method='emp_cov'): """ fit null model """ self.null = self.mtSet1.fitNull(cache=False, factr=self.factr, init_method=init_method) self.null['NLL'] = self.null['NLL0'] self.mtSet2.null = copy.copy(self.null) return self.null
def function[fitNull, parameter[self, init_method]]: constant[ fit null model ] name[self].null assign[=] call[name[self].mtSet1.fitNull, parameter[]] call[name[self].null][constant[NLL]] assign[=] call[name[self].null][constant[NLL0]] name[self].mtSet2.null assign[=] call[name[copy].cop...
keyword[def] identifier[fitNull] ( identifier[self] , identifier[init_method] = literal[string] ): literal[string] identifier[self] . identifier[null] = identifier[self] . identifier[mtSet1] . identifier[fitNull] ( identifier[cache] = keyword[False] , identifier[factr] = identifier[self] . identifi...
def fitNull(self, init_method='emp_cov'): """ fit null model """ self.null = self.mtSet1.fitNull(cache=False, factr=self.factr, init_method=init_method) self.null['NLL'] = self.null['NLL0'] self.mtSet2.null = copy.copy(self.null) return self.null
def is_inside(directory, fname): """True if fname is inside directory. The parameters should typically be passed to osutils.normpath first, so that . and .. and repeated slashes are eliminated, and the separators are canonical for the platform. The empty string as a dir name is taken as top-of-tre...
def function[is_inside, parameter[directory, fname]]: constant[True if fname is inside directory. The parameters should typically be passed to osutils.normpath first, so that . and .. and repeated slashes are eliminated, and the separators are canonical for the platform. The empty string as a ...
keyword[def] identifier[is_inside] ( identifier[directory] , identifier[fname] ): literal[string] keyword[if] identifier[directory] == identifier[fname] : keyword[return] keyword[True] keyword[if] identifier[directory] == literal[string] : keyword[return] keyword[True...
def is_inside(directory, fname): """True if fname is inside directory. The parameters should typically be passed to osutils.normpath first, so that . and .. and repeated slashes are eliminated, and the separators are canonical for the platform. The empty string as a dir name is taken as top-of-tre...
def addPrivateKey(self, wif): """ Add a private key to the wallet database """ try: pub = self.publickey_from_wif(wif) except Exception: raise InvalidWifError("Invalid Key format!") if str(pub) in self.store: raise KeyAlreadyInStoreException("K...
def function[addPrivateKey, parameter[self, wif]]: constant[ Add a private key to the wallet database ] <ast.Try object at 0x7da1b0109d50> if compare[call[name[str], parameter[name[pub]]] in name[self].store] begin[:] <ast.Raise object at 0x7da1b010aa70> call[name[self].store...
keyword[def] identifier[addPrivateKey] ( identifier[self] , identifier[wif] ): literal[string] keyword[try] : identifier[pub] = identifier[self] . identifier[publickey_from_wif] ( identifier[wif] ) keyword[except] identifier[Exception] : keyword[raise] identifie...
def addPrivateKey(self, wif): """ Add a private key to the wallet database """ try: pub = self.publickey_from_wif(wif) # depends on [control=['try'], data=[]] except Exception: raise InvalidWifError('Invalid Key format!') # depends on [control=['except'], data=[]] if str(pub) i...
def patch_ref(self, sha): """ Patch reference on the origin master branch :param sha: Sha to use for the branch :return: Status of success :rtype: str or self.ProxyError """ uri = "{api}/repos/{origin}/git/refs/heads/{branch}".format( api=self.github_api_url,...
def function[patch_ref, parameter[self, sha]]: constant[ Patch reference on the origin master branch :param sha: Sha to use for the branch :return: Status of success :rtype: str or self.ProxyError ] variable[uri] assign[=] call[constant[{api}/repos/{origin}/git/refs/head...
keyword[def] identifier[patch_ref] ( identifier[self] , identifier[sha] ): literal[string] identifier[uri] = literal[string] . identifier[format] ( identifier[api] = identifier[self] . identifier[github_api_url] , identifier[origin] = identifier[self] . identifier[origin] , ...
def patch_ref(self, sha): """ Patch reference on the origin master branch :param sha: Sha to use for the branch :return: Status of success :rtype: str or self.ProxyError """ uri = '{api}/repos/{origin}/git/refs/heads/{branch}'.format(api=self.github_api_url, origin=self.origin, ...
def load_rules(self, filename): """ Load rules from YAML configuration in the given stream object :param filename: Filename of rule YAML file :return: rules object """ self.logger.debug('Reading rules from %s', filename) try: in_file = open(filename) ...
def function[load_rules, parameter[self, filename]]: constant[ Load rules from YAML configuration in the given stream object :param filename: Filename of rule YAML file :return: rules object ] call[name[self].logger.debug, parameter[constant[Reading rules from %s], name[f...
keyword[def] identifier[load_rules] ( identifier[self] , identifier[filename] ): literal[string] identifier[self] . identifier[logger] . identifier[debug] ( literal[string] , identifier[filename] ) keyword[try] : identifier[in_file] = identifier[open] ( identifier[filename] ) ...
def load_rules(self, filename): """ Load rules from YAML configuration in the given stream object :param filename: Filename of rule YAML file :return: rules object """ self.logger.debug('Reading rules from %s', filename) try: in_file = open(filename) # depends on [co...
def componentsintobranch(idf, branch, listofcomponents, fluid=None): """insert a list of components into a branch fluid is only needed if there are air and water nodes in same object fluid is Air or Water or ''. if the fluid is Steam, use Water""" if fluid is None: fluid = '' componentli...
def function[componentsintobranch, parameter[idf, branch, listofcomponents, fluid]]: constant[insert a list of components into a branch fluid is only needed if there are air and water nodes in same object fluid is Air or Water or ''. if the fluid is Steam, use Water] if compare[name[fluid] i...
keyword[def] identifier[componentsintobranch] ( identifier[idf] , identifier[branch] , identifier[listofcomponents] , identifier[fluid] = keyword[None] ): literal[string] keyword[if] identifier[fluid] keyword[is] keyword[None] : identifier[fluid] = literal[string] identifier[componentlist...
def componentsintobranch(idf, branch, listofcomponents, fluid=None): """insert a list of components into a branch fluid is only needed if there are air and water nodes in same object fluid is Air or Water or ''. if the fluid is Steam, use Water""" if fluid is None: fluid = '' # depends on [...
def processpool_map(task, args, message, concurrency, batchsize=1, nargs=None): """ See http://stackoverflow.com/a/16071616 """ njobs = get_njobs(nargs, args) show_progress = bool(message) batches = grouper(batchsize, tupleise(args)) def batched_task(*batch): return [task(*job) for j...
def function[processpool_map, parameter[task, args, message, concurrency, batchsize, nargs]]: constant[ See http://stackoverflow.com/a/16071616 ] variable[njobs] assign[=] call[name[get_njobs], parameter[name[nargs], name[args]]] variable[show_progress] assign[=] call[name[bool], paramet...
keyword[def] identifier[processpool_map] ( identifier[task] , identifier[args] , identifier[message] , identifier[concurrency] , identifier[batchsize] = literal[int] , identifier[nargs] = keyword[None] ): literal[string] identifier[njobs] = identifier[get_njobs] ( identifier[nargs] , identifier[args] ) ...
def processpool_map(task, args, message, concurrency, batchsize=1, nargs=None): """ See http://stackoverflow.com/a/16071616 """ njobs = get_njobs(nargs, args) show_progress = bool(message) batches = grouper(batchsize, tupleise(args)) def batched_task(*batch): return [task(*job) for ...
def list(self, link_type, product, identifierType=None): """ Retrieve list of linked products :param link_type: type of link, one of 'cross_sell', 'up_sell', 'related' or 'grouped' :param product: ID or SKU of product :param identifierType: Defines whether the pr...
def function[list, parameter[self, link_type, product, identifierType]]: constant[ Retrieve list of linked products :param link_type: type of link, one of 'cross_sell', 'up_sell', 'related' or 'grouped' :param product: ID or SKU of product :param identifierType: ...
keyword[def] identifier[list] ( identifier[self] , identifier[link_type] , identifier[product] , identifier[identifierType] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[call] ( literal[string] , [ identifier[link_type] , identifier[product] , identifier[...
def list(self, link_type, product, identifierType=None): """ Retrieve list of linked products :param link_type: type of link, one of 'cross_sell', 'up_sell', 'related' or 'grouped' :param product: ID or SKU of product :param identifierType: Defines whether the produc...
def _slice(self, start, end): """Used internally to get a slice, without error checking.""" if end == start: return self.__class__() offset = self._offset startbyte, newoffset = divmod(start + offset, 8) endbyte = (end + offset - 1) // 8 bs = self.__class__() ...
def function[_slice, parameter[self, start, end]]: constant[Used internally to get a slice, without error checking.] if compare[name[end] equal[==] name[start]] begin[:] return[call[name[self].__class__, parameter[]]] variable[offset] assign[=] name[self]._offset <ast.Tuple objec...
keyword[def] identifier[_slice] ( identifier[self] , identifier[start] , identifier[end] ): literal[string] keyword[if] identifier[end] == identifier[start] : keyword[return] identifier[self] . identifier[__class__] () identifier[offset] = identifier[self] . identifier[_offs...
def _slice(self, start, end): """Used internally to get a slice, without error checking.""" if end == start: return self.__class__() # depends on [control=['if'], data=[]] offset = self._offset (startbyte, newoffset) = divmod(start + offset, 8) endbyte = (end + offset - 1) // 8 bs = sel...
def set_environment_variable(self, name, value): """ Set the value of an environment variable. .. warning:: The server may reject this request depending on its ``AcceptEnv`` setting; such rejections will fail silently (which is common client practice for this...
def function[set_environment_variable, parameter[self, name, value]]: constant[ Set the value of an environment variable. .. warning:: The server may reject this request depending on its ``AcceptEnv`` setting; such rejections will fail silently (which is common client ...
keyword[def] identifier[set_environment_variable] ( identifier[self] , identifier[name] , identifier[value] ): literal[string] identifier[m] = identifier[Message] () identifier[m] . identifier[add_byte] ( identifier[cMSG_CHANNEL_REQUEST] ) identifier[m] . identifier[add_int] ( ide...
def set_environment_variable(self, name, value): """ Set the value of an environment variable. .. warning:: The server may reject this request depending on its ``AcceptEnv`` setting; such rejections will fail silently (which is common client practice for this par...
def _alter_umask(self): """Temporarily alter umask to custom setting, if applicable""" if self.umask is None: yield # nothing to do else: prev_umask = os.umask(self.umask) try: yield finally: os.umask(prev_umask)
def function[_alter_umask, parameter[self]]: constant[Temporarily alter umask to custom setting, if applicable] if compare[name[self].umask is constant[None]] begin[:] <ast.Yield object at 0x7da18f58e920>
keyword[def] identifier[_alter_umask] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[umask] keyword[is] keyword[None] : keyword[yield] keyword[else] : identifier[prev_umask] = identifier[os] . identifier[umask] ( identifier[sel...
def _alter_umask(self): """Temporarily alter umask to custom setting, if applicable""" if self.umask is None: yield # nothing to do # depends on [control=['if'], data=[]] else: prev_umask = os.umask(self.umask) try: yield # depends on [control=['try'], data=[]] ...
def make_dataframe(result): """ Turns the results of one of the data API calls into a pandas dataframe """ import pandas as pd ret = {} if isinstance(result,dict): if 'timeseries' in result: result = result['timeseries'] for uuid, data in result.items(): df = pd.D...
def function[make_dataframe, parameter[result]]: constant[ Turns the results of one of the data API calls into a pandas dataframe ] import module[pandas] as alias[pd] variable[ret] assign[=] dictionary[[], []] if call[name[isinstance], parameter[name[result], name[dict]]] begin[:] ...
keyword[def] identifier[make_dataframe] ( identifier[result] ): literal[string] keyword[import] identifier[pandas] keyword[as] identifier[pd] identifier[ret] ={} keyword[if] identifier[isinstance] ( identifier[result] , identifier[dict] ): keyword[if] literal[string] keyword[in] ...
def make_dataframe(result): """ Turns the results of one of the data API calls into a pandas dataframe """ import pandas as pd ret = {} if isinstance(result, dict): if 'timeseries' in result: result = result['timeseries'] # depends on [control=['if'], data=['result']] # dep...
def create_new_cookbook(cookbook_name, cookbooks_home): """Create a new cookbook. :param cookbook_name: Name of the new cookbook. :param cookbooks_home: Target dir for new cookbook. """ cookbooks_home = utils.normalize_path(cookbooks_home) if not os.path.exists(cookbooks_home): raise V...
def function[create_new_cookbook, parameter[cookbook_name, cookbooks_home]]: constant[Create a new cookbook. :param cookbook_name: Name of the new cookbook. :param cookbooks_home: Target dir for new cookbook. ] variable[cookbooks_home] assign[=] call[name[utils].normalize_path, parameter[na...
keyword[def] identifier[create_new_cookbook] ( identifier[cookbook_name] , identifier[cookbooks_home] ): literal[string] identifier[cookbooks_home] = identifier[utils] . identifier[normalize_path] ( identifier[cookbooks_home] ) keyword[if] keyword[not] identifier[os] . identifier[path] . identifier...
def create_new_cookbook(cookbook_name, cookbooks_home): """Create a new cookbook. :param cookbook_name: Name of the new cookbook. :param cookbooks_home: Target dir for new cookbook. """ cookbooks_home = utils.normalize_path(cookbooks_home) if not os.path.exists(cookbooks_home): raise Va...
def __register_driver(self, channel, webdriver): "Register webdriver to a channel." # Add to list of webdrivers to cleanup. if not self.__registered_drivers.has_key(channel): self.__registered_drivers[channel] = [] # set to new empty array self.__registered_drivers[channel...
def function[__register_driver, parameter[self, channel, webdriver]]: constant[Register webdriver to a channel.] if <ast.UnaryOp object at 0x7da1b1107700> begin[:] call[name[self].__registered_drivers][name[channel]] assign[=] list[[]] call[call[name[self].__registered_drivers][n...
keyword[def] identifier[__register_driver] ( identifier[self] , identifier[channel] , identifier[webdriver] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[__registered_drivers] . identifier[has_key] ( identifier[channel] ): identifier[self] . iden...
def __register_driver(self, channel, webdriver): """Register webdriver to a channel.""" # Add to list of webdrivers to cleanup. if not self.__registered_drivers.has_key(channel): self.__registered_drivers[channel] = [] # set to new empty array # depends on [control=['if'], data=[]] self.__regi...
def previous_unwrittable_on_row(view, coords): """Return position of the previous (in row) letter that is unwrittable""" x, y = coords minx = -1 for offset in range(x - 1, minx, -1): letter = view[offset, y] if letter not in REWRITABLE_LETTERS: return offset return None
def function[previous_unwrittable_on_row, parameter[view, coords]]: constant[Return position of the previous (in row) letter that is unwrittable] <ast.Tuple object at 0x7da20c6e61d0> assign[=] name[coords] variable[minx] assign[=] <ast.UnaryOp object at 0x7da20c6e6650> for taget[name[off...
keyword[def] identifier[previous_unwrittable_on_row] ( identifier[view] , identifier[coords] ): literal[string] identifier[x] , identifier[y] = identifier[coords] identifier[minx] =- literal[int] keyword[for] identifier[offset] keyword[in] identifier[range] ( identifier[x] - literal[int] , i...
def previous_unwrittable_on_row(view, coords): """Return position of the previous (in row) letter that is unwrittable""" (x, y) = coords minx = -1 for offset in range(x - 1, minx, -1): letter = view[offset, y] if letter not in REWRITABLE_LETTERS: return offset # depends on [...
def measurement_key( val: Any, default: Any = RaiseTypeErrorIfNotProvided): """Get the measurement key for the given value. Args: val: The value which has the measurement key.. default: Determines the fallback behavior when `val` doesn't have a measurement key. If `d...
def function[measurement_key, parameter[val, default]]: constant[Get the measurement key for the given value. Args: val: The value which has the measurement key.. default: Determines the fallback behavior when `val` doesn't have a measurement key. If `default` is not set, a Type...
keyword[def] identifier[measurement_key] ( identifier[val] : identifier[Any] , identifier[default] : identifier[Any] = identifier[RaiseTypeErrorIfNotProvided] ): literal[string] identifier[getter] = identifier[getattr] ( identifier[val] , literal[string] , keyword[None] ) identifier[result] = identi...
def measurement_key(val: Any, default: Any=RaiseTypeErrorIfNotProvided): """Get the measurement key for the given value. Args: val: The value which has the measurement key.. default: Determines the fallback behavior when `val` doesn't have a measurement key. If `default` is not set,...
def add_range_headers(self, range_header): """ Adds several headers that are necessary for a streaming file response, in order for Safari to play audio files. Also sets the HTTP status_code to 206 (partial content). Args: range_header (str): Browser HTTP_RANGE reques...
def function[add_range_headers, parameter[self, range_header]]: constant[ Adds several headers that are necessary for a streaming file response, in order for Safari to play audio files. Also sets the HTTP status_code to 206 (partial content). Args: range_header (str)...
keyword[def] identifier[add_range_headers] ( identifier[self] , identifier[range_header] ): literal[string] identifier[self] [ literal[string] ]= literal[string] identifier[size] = identifier[self] . identifier[ranged_file] . identifier[size] keyword[try] : identifi...
def add_range_headers(self, range_header): """ Adds several headers that are necessary for a streaming file response, in order for Safari to play audio files. Also sets the HTTP status_code to 206 (partial content). Args: range_header (str): Browser HTTP_RANGE request he...
def roles(self): """Return a set with all roles granted to the user.""" roles = [] for ur in self.roleusers: roles.append(ur.role) return set(roles)
def function[roles, parameter[self]]: constant[Return a set with all roles granted to the user.] variable[roles] assign[=] list[[]] for taget[name[ur]] in starred[name[self].roleusers] begin[:] call[name[roles].append, parameter[name[ur].role]] return[call[name[set], paramete...
keyword[def] identifier[roles] ( identifier[self] ): literal[string] identifier[roles] =[] keyword[for] identifier[ur] keyword[in] identifier[self] . identifier[roleusers] : identifier[roles] . identifier[append] ( identifier[ur] . identifier[role] ) keyword[return...
def roles(self): """Return a set with all roles granted to the user.""" roles = [] for ur in self.roleusers: roles.append(ur.role) # depends on [control=['for'], data=['ur']] return set(roles)
def stage_tc(self, owner, staging_data, variable): """Stage data using ThreatConnect API. .. code-block:: javascript [{ "data": { "id": 116, "value": "adversary001-build-testing", "type": "Adversary", "ownerName"...
def function[stage_tc, parameter[self, owner, staging_data, variable]]: constant[Stage data using ThreatConnect API. .. code-block:: javascript [{ "data": { "id": 116, "value": "adversary001-build-testing", "type": "Adversary", ...
keyword[def] identifier[stage_tc] ( identifier[self] , identifier[owner] , identifier[staging_data] , identifier[variable] ): literal[string] identifier[resource_type] = identifier[staging_data] . identifier[pop] ( literal[string] ) keyword[if] identifier[resource_type] keyword...
def stage_tc(self, owner, staging_data, variable): """Stage data using ThreatConnect API. .. code-block:: javascript [{ "data": { "id": 116, "value": "adversary001-build-testing", "type": "Adversary", "ownerName": "q...
def run(self): """ run the plugin """ self.log.info("Resolving module compose") compose_info = self._resolve_compose() set_compose_info(self.workflow, compose_info) override_build_kwarg(self.workflow, 'compose_ids', [compose_info.compose_id])
def function[run, parameter[self]]: constant[ run the plugin ] call[name[self].log.info, parameter[constant[Resolving module compose]]] variable[compose_info] assign[=] call[name[self]._resolve_compose, parameter[]] call[name[set_compose_info], parameter[name[self].workfl...
keyword[def] identifier[run] ( identifier[self] ): literal[string] identifier[self] . identifier[log] . identifier[info] ( literal[string] ) identifier[compose_info] = identifier[self] . identifier[_resolve_compose] () identifier[set_compose_info] ( identifier[self] . identifier...
def run(self): """ run the plugin """ self.log.info('Resolving module compose') compose_info = self._resolve_compose() set_compose_info(self.workflow, compose_info) override_build_kwarg(self.workflow, 'compose_ids', [compose_info.compose_id])
def addPointVectors(self, vectors, name): """ Add a point vector field to the actor's polydata assigning it a name. """ poly = self.polydata(False) if len(vectors) != poly.GetNumberOfPoints(): colors.printc('~times addPointVectors Error: Number of vectors != nr. of po...
def function[addPointVectors, parameter[self, vectors, name]]: constant[ Add a point vector field to the actor's polydata assigning it a name. ] variable[poly] assign[=] call[name[self].polydata, parameter[constant[False]]] if compare[call[name[len], parameter[name[vectors]]] not...
keyword[def] identifier[addPointVectors] ( identifier[self] , identifier[vectors] , identifier[name] ): literal[string] identifier[poly] = identifier[self] . identifier[polydata] ( keyword[False] ) keyword[if] identifier[len] ( identifier[vectors] )!= identifier[poly] . identifier[GetNumb...
def addPointVectors(self, vectors, name): """ Add a point vector field to the actor's polydata assigning it a name. """ poly = self.polydata(False) if len(vectors) != poly.GetNumberOfPoints(): colors.printc('~times addPointVectors Error: Number of vectors != nr. of points', len(vecto...
def favorite_dashboard(self, id, **kwargs): # noqa: E501 """Mark a dashboard as favorite # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.favorite_dashboard(id...
def function[favorite_dashboard, parameter[self, id]]: constant[Mark a dashboard as favorite # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.favorite_dashboard...
keyword[def] identifier[favorite_dashboard] ( identifier[self] , identifier[id] ,** identifier[kwargs] ): literal[string] identifier[kwargs] [ literal[string] ]= keyword[True] keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ): keyword[return] identifier[s...
def favorite_dashboard(self, id, **kwargs): # noqa: E501 'Mark a dashboard as favorite # noqa: E501\n\n # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.favorite_dashboard(id,...
def replace(html, replacements=None): """Performs replacements on given HTML string.""" if not replacements: return html # no replacements html = HTMLFragment(html) for r in replacements: r.replace(html) return unicode(html)
def function[replace, parameter[html, replacements]]: constant[Performs replacements on given HTML string.] if <ast.UnaryOp object at 0x7da18fe911e0> begin[:] return[name[html]] variable[html] assign[=] call[name[HTMLFragment], parameter[name[html]]] for taget[name[r]] in starred...
keyword[def] identifier[replace] ( identifier[html] , identifier[replacements] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[replacements] : keyword[return] identifier[html] identifier[html] = identifier[HTMLFragment] ( identifier[html] ) keyword[for] ident...
def replace(html, replacements=None): """Performs replacements on given HTML string.""" if not replacements: return html # no replacements # depends on [control=['if'], data=[]] html = HTMLFragment(html) for r in replacements: r.replace(html) # depends on [control=['for'], data=['r']]...
def list_vault_ec2_certificate_configurations(self, mount_point='aws-ec2'): """GET /auth/<mount_point>/config/certificates?list=true :param mount_point: :type mount_point: :return: :rtype: """ params = {'list': True} return self._adapter.get('/v1/auth/{0}...
def function[list_vault_ec2_certificate_configurations, parameter[self, mount_point]]: constant[GET /auth/<mount_point>/config/certificates?list=true :param mount_point: :type mount_point: :return: :rtype: ] variable[params] assign[=] dictionary[[<ast.Constant ob...
keyword[def] identifier[list_vault_ec2_certificate_configurations] ( identifier[self] , identifier[mount_point] = literal[string] ): literal[string] identifier[params] ={ literal[string] : keyword[True] } keyword[return] identifier[self] . identifier[_adapter] . identifier[get] ( literal[...
def list_vault_ec2_certificate_configurations(self, mount_point='aws-ec2'): """GET /auth/<mount_point>/config/certificates?list=true :param mount_point: :type mount_point: :return: :rtype: """ params = {'list': True} return self._adapter.get('/v1/auth/{0}/config/cert...
def Read(self, expected_ids, read_data=True): """Read ADB messages and return FileSync packets.""" if self.send_idx: self._Flush() # Read one filesync packet off the recv buffer. header_data = self._ReadBuffered(self.recv_header_len) header = struct.unpack(self.recv_...
def function[Read, parameter[self, expected_ids, read_data]]: constant[Read ADB messages and return FileSync packets.] if name[self].send_idx begin[:] call[name[self]._Flush, parameter[]] variable[header_data] assign[=] call[name[self]._ReadBuffered, parameter[name[self].recv_hea...
keyword[def] identifier[Read] ( identifier[self] , identifier[expected_ids] , identifier[read_data] = keyword[True] ): literal[string] keyword[if] identifier[self] . identifier[send_idx] : identifier[self] . identifier[_Flush] () identifier[header_data] = identi...
def Read(self, expected_ids, read_data=True): """Read ADB messages and return FileSync packets.""" if self.send_idx: self._Flush() # depends on [control=['if'], data=[]] # Read one filesync packet off the recv buffer. header_data = self._ReadBuffered(self.recv_header_len) header = struct.un...
def get_default_settings(sub_scripts, script_order, script_execution_freq, iterator_type): """ assigning the actual script settings depending on the iterator type this might be overwritten by classes that inherit form ScriptIterator Args: sub_scripts: dictionary with the su...
def function[get_default_settings, parameter[sub_scripts, script_order, script_execution_freq, iterator_type]]: constant[ assigning the actual script settings depending on the iterator type this might be overwritten by classes that inherit form ScriptIterator Args: sub_scri...
keyword[def] identifier[get_default_settings] ( identifier[sub_scripts] , identifier[script_order] , identifier[script_execution_freq] , identifier[iterator_type] ): literal[string] keyword[def] identifier[populate_sweep_param] ( identifier[scripts] , identifier[parameter_list] , identifier[trace]...
def get_default_settings(sub_scripts, script_order, script_execution_freq, iterator_type): """ assigning the actual script settings depending on the iterator type this might be overwritten by classes that inherit form ScriptIterator Args: sub_scripts: dictionary with the subscr...
def move_right(self): """Make the drone move right.""" self.at(ardrone.at.pcmd, True, self.speed, 0, 0, 0)
def function[move_right, parameter[self]]: constant[Make the drone move right.] call[name[self].at, parameter[name[ardrone].at.pcmd, constant[True], name[self].speed, constant[0], constant[0], constant[0]]]
keyword[def] identifier[move_right] ( identifier[self] ): literal[string] identifier[self] . identifier[at] ( identifier[ardrone] . identifier[at] . identifier[pcmd] , keyword[True] , identifier[self] . identifier[speed] , literal[int] , literal[int] , literal[int] )
def move_right(self): """Make the drone move right.""" self.at(ardrone.at.pcmd, True, self.speed, 0, 0, 0)
def nvmlDeviceGetBAR1MemoryInfo(handle): r""" /** * Gets Total, Available and Used size of BAR1 memory. * * BAR1 is used to map the FB (device memory) so that it can be directly accessed by the CPU or by 3rd party * devices (peer-to-peer on the PCIE bus). * * For Kepler &tm; or new...
def function[nvmlDeviceGetBAR1MemoryInfo, parameter[handle]]: constant[ /** * Gets Total, Available and Used size of BAR1 memory. * * BAR1 is used to map the FB (device memory) so that it can be directly accessed by the CPU or by 3rd party * devices (peer-to-peer on the PCIE bus). *...
keyword[def] identifier[nvmlDeviceGetBAR1MemoryInfo] ( identifier[handle] ): literal[string] identifier[c_bar1_memory] = identifier[c_nvmlBAR1Memory_t] () identifier[fn] = identifier[_nvmlGetFunctionPointer] ( literal[string] ) identifier[ret] = identifier[fn] ( identifier[handle] , identifier[by...
def nvmlDeviceGetBAR1MemoryInfo(handle): """ /** * Gets Total, Available and Used size of BAR1 memory. * * BAR1 is used to map the FB (device memory) so that it can be directly accessed by the CPU or by 3rd party * devices (peer-to-peer on the PCIE bus). * * For Kepler &tm; or newe...
async def read(self, *_id): """Read data from database table. Accepts ids of entries. Returns list of results if success or string with error code and explanation. read(*id) => [(result), (result)] (if success) read(*id) => [] (if missed) read() => {"error":400, "reason":"Missed required fields"} """ ...
<ast.AsyncFunctionDef object at 0x7da1b0aa51e0>
keyword[async] keyword[def] identifier[read] ( identifier[self] ,* identifier[_id] ): literal[string] keyword[if] keyword[not] identifier[_id] : keyword[return] { literal[string] : literal[int] , literal[string] : literal[string] } identifier[result] =[] keyword[for] identifier[i] keyword[i...
async def read(self, *_id): """Read data from database table. Accepts ids of entries. Returns list of results if success or string with error code and explanation. read(*id) => [(result), (result)] (if success) read(*id) => [] (if missed) read() => {"error":400, "reason":"Missed required fields"} ""...
def _add_manifest_files(zip_file, dir_name, payload_info_list, tag_info_list): """Generate the manifest files and add them to the zip.""" for checksum_algorithm in _get_checksum_algorithm_set(payload_info_list): _add_tag_file( zip_file, dir_name, tag_info_list, ...
def function[_add_manifest_files, parameter[zip_file, dir_name, payload_info_list, tag_info_list]]: constant[Generate the manifest files and add them to the zip.] for taget[name[checksum_algorithm]] in starred[call[name[_get_checksum_algorithm_set], parameter[name[payload_info_list]]]] begin[:] ...
keyword[def] identifier[_add_manifest_files] ( identifier[zip_file] , identifier[dir_name] , identifier[payload_info_list] , identifier[tag_info_list] ): literal[string] keyword[for] identifier[checksum_algorithm] keyword[in] identifier[_get_checksum_algorithm_set] ( identifier[payload_info_list] ): ...
def _add_manifest_files(zip_file, dir_name, payload_info_list, tag_info_list): """Generate the manifest files and add them to the zip.""" for checksum_algorithm in _get_checksum_algorithm_set(payload_info_list): _add_tag_file(zip_file, dir_name, tag_info_list, _gen_manifest_file_tup(payload_info_list, c...
def galactic2fk5(l, b): """ Convert galactic l/b to fk5 ra/dec Parameters ---------- l, b : float Galactic coordinates in radians. Returns ------- ra, dec : float FK5 ecliptic coordinates in radians. """ a = SkyCoord(l, b, unit=(u.radian, u.radian), frame='galac...
def function[galactic2fk5, parameter[l, b]]: constant[ Convert galactic l/b to fk5 ra/dec Parameters ---------- l, b : float Galactic coordinates in radians. Returns ------- ra, dec : float FK5 ecliptic coordinates in radians. ] variable[a] assign[=] cal...
keyword[def] identifier[galactic2fk5] ( identifier[l] , identifier[b] ): literal[string] identifier[a] = identifier[SkyCoord] ( identifier[l] , identifier[b] , identifier[unit] =( identifier[u] . identifier[radian] , identifier[u] . identifier[radian] ), identifier[frame] = literal[string] ) keyword[r...
def galactic2fk5(l, b): """ Convert galactic l/b to fk5 ra/dec Parameters ---------- l, b : float Galactic coordinates in radians. Returns ------- ra, dec : float FK5 ecliptic coordinates in radians. """ a = SkyCoord(l, b, unit=(u.radian, u.radian), frame='galac...
def get_card(self): ''' Get card this checklist is on. ''' card_id = self.get_checklist_information().get('idCard', None) if card_id: return self.client.get_card(card_id)
def function[get_card, parameter[self]]: constant[ Get card this checklist is on. ] variable[card_id] assign[=] call[call[name[self].get_checklist_information, parameter[]].get, parameter[constant[idCard], constant[None]]] if name[card_id] begin[:] return[call[name[self]....
keyword[def] identifier[get_card] ( identifier[self] ): literal[string] identifier[card_id] = identifier[self] . identifier[get_checklist_information] (). identifier[get] ( literal[string] , keyword[None] ) keyword[if] identifier[card_id] : keyword[return] identifier[self] ....
def get_card(self): """ Get card this checklist is on. """ card_id = self.get_checklist_information().get('idCard', None) if card_id: return self.client.get_card(card_id) # depends on [control=['if'], data=[]]
def solve_for(self, var=None): """Ensure that the children is within its parent """ if not self.enable: return margin = self.margin_method() def parent_width(): return self.parent_se[0].value - self.parent_nw[0].value def parent_height(): ...
def function[solve_for, parameter[self, var]]: constant[Ensure that the children is within its parent ] if <ast.UnaryOp object at 0x7da2044c0c70> begin[:] return[None] variable[margin] assign[=] call[name[self].margin_method, parameter[]] def function[parent_width, parame...
keyword[def] identifier[solve_for] ( identifier[self] , identifier[var] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[enable] : keyword[return] identifier[margin] = identifier[self] . identifier[margin_method] () keywor...
def solve_for(self, var=None): """Ensure that the children is within its parent """ if not self.enable: return # depends on [control=['if'], data=[]] margin = self.margin_method() def parent_width(): return self.parent_se[0].value - self.parent_nw[0].value def parent_heigh...
def _get_nop_length(cls, insns): """ Calculate the total size of leading nop instructions. :param insns: A list of capstone insn objects. :return: Number of bytes of leading nop instructions. :rtype: int """ nop_length = 0 if insns and cls._is_noop_insn...
def function[_get_nop_length, parameter[cls, insns]]: constant[ Calculate the total size of leading nop instructions. :param insns: A list of capstone insn objects. :return: Number of bytes of leading nop instructions. :rtype: int ] variable[nop_length] assign[=]...
keyword[def] identifier[_get_nop_length] ( identifier[cls] , identifier[insns] ): literal[string] identifier[nop_length] = literal[int] keyword[if] identifier[insns] keyword[and] identifier[cls] . identifier[_is_noop_insn] ( identifier[insns] [ literal[int] ]): ...
def _get_nop_length(cls, insns): """ Calculate the total size of leading nop instructions. :param insns: A list of capstone insn objects. :return: Number of bytes of leading nop instructions. :rtype: int """ nop_length = 0 if insns and cls._is_noop_insn(insns[0]): ...
def __get_html(self, body=None): """ Returns the html content with given body tag content. :param body: Body tag content. :type body: unicode :return: Html. :rtype: unicode """ output = [] output.append("<html>") output.append("<head>") ...
def function[__get_html, parameter[self, body]]: constant[ Returns the html content with given body tag content. :param body: Body tag content. :type body: unicode :return: Html. :rtype: unicode ] variable[output] assign[=] list[[]] call[name[outp...
keyword[def] identifier[__get_html] ( identifier[self] , identifier[body] = keyword[None] ): literal[string] identifier[output] =[] identifier[output] . identifier[append] ( literal[string] ) identifier[output] . identifier[append] ( literal[string] ) keyword[for] ident...
def __get_html(self, body=None): """ Returns the html content with given body tag content. :param body: Body tag content. :type body: unicode :return: Html. :rtype: unicode """ output = [] output.append('<html>') output.append('<head>') for javascript...
def update_button_status(self): """Function to enable or disable the Ok button. """ # enable/disable ok button if len(self.displaced.currentField()) > 0: self.button_box.button( QtWidgets.QDialogButtonBox.Ok).setEnabled(True) else: self.but...
def function[update_button_status, parameter[self]]: constant[Function to enable or disable the Ok button. ] if compare[call[name[len], parameter[call[name[self].displaced.currentField, parameter[]]]] greater[>] constant[0]] begin[:] call[call[name[self].button_box.button, parame...
keyword[def] identifier[update_button_status] ( identifier[self] ): literal[string] keyword[if] identifier[len] ( identifier[self] . identifier[displaced] . identifier[currentField] ())> literal[int] : identifier[self] . identifier[button_box] . identifier[button] ( ...
def update_button_status(self): """Function to enable or disable the Ok button. """ # enable/disable ok button if len(self.displaced.currentField()) > 0: self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) # depends on [control=['if'], data=[]] else: self.butt...
def main(ctx, host, port, transport_type, timeout, ca_certs): """Connects to a Riemann server to send events or query the index By default, will attempt to contact Riemann on localhost:5555 over TCP. The RIEMANN_HOST and RIEMANN_PORT environment variables can be used to configure the host and port used...
def function[main, parameter[ctx, host, port, transport_type, timeout, ca_certs]]: constant[Connects to a Riemann server to send events or query the index By default, will attempt to contact Riemann on localhost:5555 over TCP. The RIEMANN_HOST and RIEMANN_PORT environment variables can be used to c...
keyword[def] identifier[main] ( identifier[ctx] , identifier[host] , identifier[port] , identifier[transport_type] , identifier[timeout] , identifier[ca_certs] ): literal[string] keyword[if] identifier[transport_type] == literal[string] : keyword[if] identifier[timeout] keyword[is] keyword[not...
def main(ctx, host, port, transport_type, timeout, ca_certs): """Connects to a Riemann server to send events or query the index By default, will attempt to contact Riemann on localhost:5555 over TCP. The RIEMANN_HOST and RIEMANN_PORT environment variables can be used to configure the host and port used...
def snpflow(args): """ %prog snpflow trimmed reference.fasta Run SNP calling pipeline until allele_counts are generated. This includes generation of native files, SNP_Het file. Speedup for fragmented genomes are also supported. """ p = OptionParser(snpflow.__doc__) p.set_fastq_names() ...
def function[snpflow, parameter[args]]: constant[ %prog snpflow trimmed reference.fasta Run SNP calling pipeline until allele_counts are generated. This includes generation of native files, SNP_Het file. Speedup for fragmented genomes are also supported. ] variable[p] assign[=] call...
keyword[def] identifier[snpflow] ( identifier[args] ): literal[string] identifier[p] = identifier[OptionParser] ( identifier[snpflow] . identifier[__doc__] ) identifier[p] . identifier[set_fastq_names] () identifier[p] . identifier[set_cpus] () identifier[opts] , identifier[args] = identifie...
def snpflow(args): """ %prog snpflow trimmed reference.fasta Run SNP calling pipeline until allele_counts are generated. This includes generation of native files, SNP_Het file. Speedup for fragmented genomes are also supported. """ p = OptionParser(snpflow.__doc__) p.set_fastq_names() ...
def get_userplaycount(self): """Returns the number of plays by a given username""" if not self.username: return params = self._get_params() params["username"] = self.username doc = self._request(self.ws_prefix + ".getInfo", True, params) return _number(_ext...
def function[get_userplaycount, parameter[self]]: constant[Returns the number of plays by a given username] if <ast.UnaryOp object at 0x7da1b0b4a0b0> begin[:] return[None] variable[params] assign[=] call[name[self]._get_params, parameter[]] call[name[params]][constant[username]] ...
keyword[def] identifier[get_userplaycount] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[username] : keyword[return] identifier[params] = identifier[self] . identifier[_get_params] () identifier[params] [ literal[str...
def get_userplaycount(self): """Returns the number of plays by a given username""" if not self.username: return # depends on [control=['if'], data=[]] params = self._get_params() params['username'] = self.username doc = self._request(self.ws_prefix + '.getInfo', True, params) return _nu...
def show(self, username): """Return a specific user's info in LDIF format.""" filter = ['(objectclass=posixAccount)', "(uid={})".format(username)] return self.client.search(filter)
def function[show, parameter[self, username]]: constant[Return a specific user's info in LDIF format.] variable[filter] assign[=] list[[<ast.Constant object at 0x7da1b20a86a0>, <ast.Call object at 0x7da1b20a8e50>]] return[call[name[self].client.search, parameter[name[filter]]]]
keyword[def] identifier[show] ( identifier[self] , identifier[username] ): literal[string] identifier[filter] =[ literal[string] , literal[string] . identifier[format] ( identifier[username] )] keyword[return] identifier[self] . identifier[client] . identifier[search] ( identifier[filter]...
def show(self, username): """Return a specific user's info in LDIF format.""" filter = ['(objectclass=posixAccount)', '(uid={})'.format(username)] return self.client.search(filter)
def load_frontends(config, callback, internal_attributes): """ Load all frontend modules specified in the config :type config: satosa.satosa_config.SATOSAConfig :type callback: (satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response :type internal_attributes: dict[str...
def function[load_frontends, parameter[config, callback, internal_attributes]]: constant[ Load all frontend modules specified in the config :type config: satosa.satosa_config.SATOSAConfig :type callback: (satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response :typ...
keyword[def] identifier[load_frontends] ( identifier[config] , identifier[callback] , identifier[internal_attributes] ): literal[string] identifier[frontend_modules] = identifier[_load_plugins] ( identifier[config] . identifier[get] ( literal[string] ), identifier[config] [ literal[string] ], identifi...
def load_frontends(config, callback, internal_attributes): """ Load all frontend modules specified in the config :type config: satosa.satosa_config.SATOSAConfig :type callback: (satosa.context.Context, satosa.internal.InternalData) -> satosa.response.Response :type internal_attributes: dict[str...
def _find_sub_controllers(self, remainder, request): ''' Identifies the correct controller to route to by analyzing the request URI. ''' # need either a get_one or get to parse args method = None for name in ('get_one', 'get'): if hasattr(self, name): ...
def function[_find_sub_controllers, parameter[self, remainder, request]]: constant[ Identifies the correct controller to route to by analyzing the request URI. ] variable[method] assign[=] constant[None] for taget[name[name]] in starred[tuple[[<ast.Constant object at 0x7d...
keyword[def] identifier[_find_sub_controllers] ( identifier[self] , identifier[remainder] , identifier[request] ): literal[string] identifier[method] = keyword[None] keyword[for] identifier[name] keyword[in] ( literal[string] , literal[string] ): keyword[if] ident...
def _find_sub_controllers(self, remainder, request): """ Identifies the correct controller to route to by analyzing the request URI. """ # need either a get_one or get to parse args method = None for name in ('get_one', 'get'): if hasattr(self, name): method =...
def coords(self): """The (X, Y) coordinates of the tablet tool, in mm from the top left corner of the tablet in its current logical orientation and whether they have changed in this event. Use :meth:`transform_coords` for transforming the axes values into a different coordinate space. Note: On some dev...
def function[coords, parameter[self]]: constant[The (X, Y) coordinates of the tablet tool, in mm from the top left corner of the tablet in its current logical orientation and whether they have changed in this event. Use :meth:`transform_coords` for transforming the axes values into a different coordina...
keyword[def] identifier[coords] ( identifier[self] ): literal[string] identifier[x_changed] = identifier[self] . identifier[_libinput] . identifier[libinput_event_tablet_tool_x_has_changed] ( identifier[self] . identifier[_handle] ) identifier[y_changed] = identifier[self] . identifier[_libinput] . iden...
def coords(self): """The (X, Y) coordinates of the tablet tool, in mm from the top left corner of the tablet in its current logical orientation and whether they have changed in this event. Use :meth:`transform_coords` for transforming the axes values into a different coordinate space. Note: On some d...
def universal_read(fname): '''Will open and read a file with universal line endings, trying to decode whatever format it's in (e.g., utf8 or utf16)''' with open(fname,'rU') as f: data = f.read() enc_guess = chardet.detect(data) return data.decode(enc_guess['encoding'])
def function[universal_read, parameter[fname]]: constant[Will open and read a file with universal line endings, trying to decode whatever format it's in (e.g., utf8 or utf16)] with call[name[open], parameter[name[fname], constant[rU]]] begin[:] variable[data] assign[=] call[name[f].read,...
keyword[def] identifier[universal_read] ( identifier[fname] ): literal[string] keyword[with] identifier[open] ( identifier[fname] , literal[string] ) keyword[as] identifier[f] : identifier[data] = identifier[f] . identifier[read] () identifier[enc_guess] = identifier[chardet] . identifier[d...
def universal_read(fname): """Will open and read a file with universal line endings, trying to decode whatever format it's in (e.g., utf8 or utf16)""" with open(fname, 'rU') as f: data = f.read() # depends on [control=['with'], data=['f']] enc_guess = chardet.detect(data) return data.decode(enc...
def is_draft(request): """ A request is considered to be in draft mode if: - it is for *any* admin resource, since the admin site deals only with draft objects and hides the published version from admin users - it is for *any* view in *any* app that deals only with draft object...
def function[is_draft, parameter[request]]: constant[ A request is considered to be in draft mode if: - it is for *any* admin resource, since the admin site deals only with draft objects and hides the published version from admin users - it is for *any* view in *any* app that d...
keyword[def] identifier[is_draft] ( identifier[request] ): literal[string] keyword[if] identifier[PublishingMiddleware] . identifier[is_admin_request] ( identifier[request] ): keyword[return] keyword[True] keyword[if] identifier[PublishingMiddleware] ...
def is_draft(request): """ A request is considered to be in draft mode if: - it is for *any* admin resource, since the admin site deals only with draft objects and hides the published version from admin users - it is for *any* view in *any* app that deals only with draft objects ...
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): """Return a list of dictionaries fit for ARTemplate/Analyses field consumption. """ value = [] # selected services service_uids = form.get("uids", []) ...
def function[process_form, parameter[self, instance, field, form, empty_marker, emptyReturnsMarker]]: constant[Return a list of dictionaries fit for ARTemplate/Analyses field consumption. ] variable[value] assign[=] list[[]] variable[service_uids] assign[=] call[name[form].get...
keyword[def] identifier[process_form] ( identifier[self] , identifier[instance] , identifier[field] , identifier[form] , identifier[empty_marker] = keyword[None] , identifier[emptyReturnsMarker] = keyword[False] ): literal[string] identifier[value] =[] identifier[service_uids] =...
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): """Return a list of dictionaries fit for ARTemplate/Analyses field consumption. """ value = [] # selected services service_uids = form.get('uids', []) # defined partitions partitions = ...
def _process_genes(self, limit=None): """ This method processes the KEGG gene IDs. The label for the gene is pulled as the first symbol in the list of gene symbols; the rest are added as synonyms. The long-form of the gene name is added as a definition. This is ha...
def function[_process_genes, parameter[self, limit]]: constant[ This method processes the KEGG gene IDs. The label for the gene is pulled as the first symbol in the list of gene symbols; the rest are added as synonyms. The long-form of the gene name is added as a definiti...
keyword[def] identifier[_process_genes] ( identifier[self] , identifier[limit] = keyword[None] ): literal[string] identifier[LOG] . identifier[info] ( literal[string] ) keyword[if] identifier[self] . identifier[test_mode] : identifier[graph] = identifier[self] . identifier[t...
def _process_genes(self, limit=None): """ This method processes the KEGG gene IDs. The label for the gene is pulled as the first symbol in the list of gene symbols; the rest are added as synonyms. The long-form of the gene name is added as a definition. This is hardco...
def parse_auth_token_from_request(self, auth_header): """ Parses and returns the Hawk Authorization header if it is present and well-formed. Raises `falcon.HTTPUnauthoried exception` with proper error message """ if not auth_header: raise falcon.HTTPUnauthorized( ...
def function[parse_auth_token_from_request, parameter[self, auth_header]]: constant[ Parses and returns the Hawk Authorization header if it is present and well-formed. Raises `falcon.HTTPUnauthoried exception` with proper error message ] if <ast.UnaryOp object at 0x7da18ede6f80> ...
keyword[def] identifier[parse_auth_token_from_request] ( identifier[self] , identifier[auth_header] ): literal[string] keyword[if] keyword[not] identifier[auth_header] : keyword[raise] identifier[falcon] . identifier[HTTPUnauthorized] ( identifier[description] = literal...
def parse_auth_token_from_request(self, auth_header): """ Parses and returns the Hawk Authorization header if it is present and well-formed. Raises `falcon.HTTPUnauthoried exception` with proper error message """ if not auth_header: raise falcon.HTTPUnauthorized(description='Miss...
def docx_text_from_xml(xml: str, config: TextProcessingConfig) -> str: """ Converts an XML tree of a DOCX file to string contents. Args: xml: raw XML text config: :class:`TextProcessingConfig` control object Returns: contents as a string """ root = ElementTree.fromstrin...
def function[docx_text_from_xml, parameter[xml, config]]: constant[ Converts an XML tree of a DOCX file to string contents. Args: xml: raw XML text config: :class:`TextProcessingConfig` control object Returns: contents as a string ] variable[root] assign[=] call...
keyword[def] identifier[docx_text_from_xml] ( identifier[xml] : identifier[str] , identifier[config] : identifier[TextProcessingConfig] )-> identifier[str] : literal[string] identifier[root] = identifier[ElementTree] . identifier[fromstring] ( identifier[xml] ) keyword[return] identifier[docx_text_fr...
def docx_text_from_xml(xml: str, config: TextProcessingConfig) -> str: """ Converts an XML tree of a DOCX file to string contents. Args: xml: raw XML text config: :class:`TextProcessingConfig` control object Returns: contents as a string """ root = ElementTree.fromstrin...
def update_hmet_card_file(hmet_card_file_path, new_hmet_data_path): """This function updates the paths in the HMET card file to the new location of the HMET data. This is necessary because the file paths are absolute and will need to be updated if moved. Args: hmet_card_file_path(str): Location...
def function[update_hmet_card_file, parameter[hmet_card_file_path, new_hmet_data_path]]: constant[This function updates the paths in the HMET card file to the new location of the HMET data. This is necessary because the file paths are absolute and will need to be updated if moved. Args: hme...
keyword[def] identifier[update_hmet_card_file] ( identifier[hmet_card_file_path] , identifier[new_hmet_data_path] ): literal[string] identifier[hmet_card_file_path_temp] = literal[string] . identifier[format] ( identifier[hmet_card_file_path] ) keyword[try] : identifier[remove] ( identifier[h...
def update_hmet_card_file(hmet_card_file_path, new_hmet_data_path): """This function updates the paths in the HMET card file to the new location of the HMET data. This is necessary because the file paths are absolute and will need to be updated if moved. Args: hmet_card_file_path(str): Location...
def extend_distribution_substation_overvoltage(network, critical_stations): """ Reinforce MV/LV substations due to voltage issues. A parallel standard transformer is installed. Parameters ---------- network : :class:`~.grid.network.Network` critical_stations : :obj:`dict` Dictionar...
def function[extend_distribution_substation_overvoltage, parameter[network, critical_stations]]: constant[ Reinforce MV/LV substations due to voltage issues. A parallel standard transformer is installed. Parameters ---------- network : :class:`~.grid.network.Network` critical_stations ...
keyword[def] identifier[extend_distribution_substation_overvoltage] ( identifier[network] , identifier[critical_stations] ): literal[string] keyword[try] : identifier[standard_transformer] = identifier[network] . identifier[equipment_data] [ literal[string] ]. identifier[loc] [ iden...
def extend_distribution_substation_overvoltage(network, critical_stations): """ Reinforce MV/LV substations due to voltage issues. A parallel standard transformer is installed. Parameters ---------- network : :class:`~.grid.network.Network` critical_stations : :obj:`dict` Dictionar...
def subscribe(self, callback): """Invoke `callback` for all distributions (including existing ones)""" if callback in self.callbacks: return self.callbacks.append(callback) for dist in self: callback(dist)
def function[subscribe, parameter[self, callback]]: constant[Invoke `callback` for all distributions (including existing ones)] if compare[name[callback] in name[self].callbacks] begin[:] return[None] call[name[self].callbacks.append, parameter[name[callback]]] for taget[name[dis...
keyword[def] identifier[subscribe] ( identifier[self] , identifier[callback] ): literal[string] keyword[if] identifier[callback] keyword[in] identifier[self] . identifier[callbacks] : keyword[return] identifier[self] . identifier[callbacks] . identifier[append] ( identifie...
def subscribe(self, callback): """Invoke `callback` for all distributions (including existing ones)""" if callback in self.callbacks: return # depends on [control=['if'], data=[]] self.callbacks.append(callback) for dist in self: callback(dist) # depends on [control=['for'], data=['dis...
def has_split(self, split_name): """ Checks whether or not the split with the given name exists. Parameters ---------- split_name : str name of the split """ if os.path.exists(os.path.join(self.split_dir, split_name)): return True ...
def function[has_split, parameter[self, split_name]]: constant[ Checks whether or not the split with the given name exists. Parameters ---------- split_name : str name of the split ] if call[name[os].path.exists, parameter[call[name[os].path.join, par...
keyword[def] identifier[has_split] ( identifier[self] , identifier[split_name] ): literal[string] keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[split_dir] , identifier[split_name] )): ...
def has_split(self, split_name): """ Checks whether or not the split with the given name exists. Parameters ---------- split_name : str name of the split """ if os.path.exists(os.path.join(self.split_dir, split_name)): return True # depends on [contr...
def offset(self, offset, allow_negative=False, min_begin_value=None, max_end_value=None): """ Move this interval by the given shift ``offset``. The begin and end time points of the translated interval are ensured to be non-negative (i.e., they are maxed with ``0.000``), ...
def function[offset, parameter[self, offset, allow_negative, min_begin_value, max_end_value]]: constant[ Move this interval by the given shift ``offset``. The begin and end time points of the translated interval are ensured to be non-negative (i.e., they are maxed with ``0.000``...
keyword[def] identifier[offset] ( identifier[self] , identifier[offset] , identifier[allow_negative] = keyword[False] , identifier[min_begin_value] = keyword[None] , identifier[max_end_value] = keyword[None] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[offset] ,...
def offset(self, offset, allow_negative=False, min_begin_value=None, max_end_value=None): """ Move this interval by the given shift ``offset``. The begin and end time points of the translated interval are ensured to be non-negative (i.e., they are maxed with ``0.000``), unle...
def get_nameserver_detail_output_show_nameserver_nameserver_nodename(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_nameserver_detail = ET.Element("get_nameserver_detail") config = get_nameserver_detail output = ET.SubElement(get_nameserver_...
def function[get_nameserver_detail_output_show_nameserver_nameserver_nodename, parameter[self]]: constant[Auto Generated Code ] variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]] variable[get_nameserver_detail] assign[=] call[name[ET].Element, parameter[consta...
keyword[def] identifier[get_nameserver_detail_output_show_nameserver_nameserver_nodename] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[config] = identifier[ET] . identifier[Element] ( literal[string] ) identifier[get_nameserver_detail] = identifier[ET] . identifi...
def get_nameserver_detail_output_show_nameserver_nameserver_nodename(self, **kwargs): """Auto Generated Code """ config = ET.Element('config') get_nameserver_detail = ET.Element('get_nameserver_detail') config = get_nameserver_detail output = ET.SubElement(get_nameserver_detail, 'output') ...
def create_upload_specifications(ctx_cli_options, config): # type: (dict, dict) -> List[blobxfer.models.upload.Specification] """Create a list of Upload Specification objects from configuration :param dict ctx_cli_options: cli options :param dict config: config dict :rtype: list :return: list of...
def function[create_upload_specifications, parameter[ctx_cli_options, config]]: constant[Create a list of Upload Specification objects from configuration :param dict ctx_cli_options: cli options :param dict config: config dict :rtype: list :return: list of Upload Specification objects ] ...
keyword[def] identifier[create_upload_specifications] ( identifier[ctx_cli_options] , identifier[config] ): literal[string] identifier[cli_conf] = identifier[ctx_cli_options] [ identifier[ctx_cli_options] [ literal[string] ]] identifier[cli_options] = identifier[cli_conf] [ literal[string] ] ide...
def create_upload_specifications(ctx_cli_options, config): # type: (dict, dict) -> List[blobxfer.models.upload.Specification] 'Create a list of Upload Specification objects from configuration\n :param dict ctx_cli_options: cli options\n :param dict config: config dict\n :rtype: list\n :return: list ...
def nuclear_norm(data): r"""Nuclear norm This method computes the nuclear (or trace) norm of the input data. Parameters ---------- data : np.ndarray Input data array Returns ------- float nuclear norm value Examples -------- >>> from modopt.math.matrix import nucl...
def function[nuclear_norm, parameter[data]]: constant[Nuclear norm This method computes the nuclear (or trace) norm of the input data. Parameters ---------- data : np.ndarray Input data array Returns ------- float nuclear norm value Examples -------- >>> from ...
keyword[def] identifier[nuclear_norm] ( identifier[data] ): literal[string] identifier[u] , identifier[s] , identifier[v] = identifier[np] . identifier[linalg] . identifier[svd] ( identifier[data] ) keyword[return] identifier[np] . identifier[sum] ( identifier[s] )
def nuclear_norm(data): """Nuclear norm This method computes the nuclear (or trace) norm of the input data. Parameters ---------- data : np.ndarray Input data array Returns ------- float nuclear norm value Examples -------- >>> from modopt.math.matrix import nucle...
def parse_makefile_aliases(filepath): ''' Parse a makefile to find commands and substitute variables. Expects a makefile with only aliases and a line return between each command. Returns a dict, with a list of commands for each alias. ''' # -- Parsing the Makefile using ConfigParser # Addi...
def function[parse_makefile_aliases, parameter[filepath]]: constant[ Parse a makefile to find commands and substitute variables. Expects a makefile with only aliases and a line return between each command. Returns a dict, with a list of commands for each alias. ] variable[ini_str] assig...
keyword[def] identifier[parse_makefile_aliases] ( identifier[filepath] ): literal[string] identifier[ini_str] = literal[string] keyword[with] identifier[open] ( identifier[filepath] , literal[string] ) keyword[as] identifier[fd] : identifier[ini_str] = identifier[ini_str] + iden...
def parse_makefile_aliases(filepath): """ Parse a makefile to find commands and substitute variables. Expects a makefile with only aliases and a line return between each command. Returns a dict, with a list of commands for each alias. """ # -- Parsing the Makefile using ConfigParser # Addin...
def last_session_date(self): """Return date/time for start of last session data.""" try: date = self.intervals[1]['ts'] except KeyError: return None date_f = datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%fZ') now = time.time() offset = datetime.fromt...
def function[last_session_date, parameter[self]]: constant[Return date/time for start of last session data.] <ast.Try object at 0x7da20c6c7550> variable[date_f] assign[=] call[name[datetime].strptime, parameter[name[date], constant[%Y-%m-%dT%H:%M:%S.%fZ]]] variable[now] assign[=] call[name[t...
keyword[def] identifier[last_session_date] ( identifier[self] ): literal[string] keyword[try] : identifier[date] = identifier[self] . identifier[intervals] [ literal[int] ][ literal[string] ] keyword[except] identifier[KeyError] : keyword[return] keyword[None] ...
def last_session_date(self): """Return date/time for start of last session data.""" try: date = self.intervals[1]['ts'] # depends on [control=['try'], data=[]] except KeyError: return None # depends on [control=['except'], data=[]] date_f = datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%f...
def tag_audio_file(audio_file, tracklisting): """ Adds tracklisting as list to lyrics tag of audio file if not present. Returns True if successful or not needed, False if tagging fails. """ try: save_tag_to_audio_file(audio_file, tracklisting) # TODO: is IOError required now or would the...
def function[tag_audio_file, parameter[audio_file, tracklisting]]: constant[ Adds tracklisting as list to lyrics tag of audio file if not present. Returns True if successful or not needed, False if tagging fails. ] <ast.Try object at 0x7da20e960bb0> return[name[audio_tagging_successful]]
keyword[def] identifier[tag_audio_file] ( identifier[audio_file] , identifier[tracklisting] ): literal[string] keyword[try] : identifier[save_tag_to_audio_file] ( identifier[audio_file] , identifier[tracklisting] ) keyword[except] ( identifier[IOError] , identifier[mediafile] . ident...
def tag_audio_file(audio_file, tracklisting): """ Adds tracklisting as list to lyrics tag of audio file if not present. Returns True if successful or not needed, False if tagging fails. """ try: save_tag_to_audio_file(audio_file, tracklisting) # depends on [control=['try'], data=[]] # T...