code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def _single_quote_handler_factory(on_single_quote, on_other): """Generates handlers used for classifying tokens that begin with one or more single quotes. Args: on_single_quote (callable): Called when another single quote is found. Accepts the current character's ordinal, the current contex...
def function[_single_quote_handler_factory, parameter[on_single_quote, on_other]]: constant[Generates handlers used for classifying tokens that begin with one or more single quotes. Args: on_single_quote (callable): Called when another single quote is found. Accepts the current character's ordinal,...
keyword[def] identifier[_single_quote_handler_factory] ( identifier[on_single_quote] , identifier[on_other] ): literal[string] @ identifier[coroutine] keyword[def] identifier[single_quote_handler] ( identifier[c] , identifier[ctx] , identifier[is_field_name] = keyword[False] ): keyword[asser...
def _single_quote_handler_factory(on_single_quote, on_other): """Generates handlers used for classifying tokens that begin with one or more single quotes. Args: on_single_quote (callable): Called when another single quote is found. Accepts the current character's ordinal, the current contex...
def dayofyear(self): """Day of the year index (the first of January = 0...). For reasons of consistency between leap years and non-leap years, assuming a daily time step, index 59 is always associated with the 29th of February. Hence, it is missing in non-leap years: >>> from ...
def function[dayofyear, parameter[self]]: constant[Day of the year index (the first of January = 0...). For reasons of consistency between leap years and non-leap years, assuming a daily time step, index 59 is always associated with the 29th of February. Hence, it is missing in non-lea...
keyword[def] identifier[dayofyear] ( identifier[self] ): literal[string] keyword[def] identifier[_dayofyear] ( identifier[date] ): keyword[return] ( identifier[date] . identifier[dayofyear] - literal[int] + (( identifier[date] . identifier[month] > literal[int] ) keyword[a...
def dayofyear(self): """Day of the year index (the first of January = 0...). For reasons of consistency between leap years and non-leap years, assuming a daily time step, index 59 is always associated with the 29th of February. Hence, it is missing in non-leap years: >>> from hydp...
def set_result(self, res): """ The worker thread should call this if it was successful. Unlike normal functions, which will return None if execution is allowed to fall off the end, either set_result() or self_error() must be called, or the the get()ing side will hang. ...
def function[set_result, parameter[self, res]]: constant[ The worker thread should call this if it was successful. Unlike normal functions, which will return None if execution is allowed to fall off the end, either set_result() or self_error() must be called, or the the get()i...
keyword[def] identifier[set_result] ( identifier[self] , identifier[res] ): literal[string] identifier[self] . identifier[result] =( keyword[True] , identifier[res] ) identifier[self] . identifier[_lock] . identifier[release] ()
def set_result(self, res): """ The worker thread should call this if it was successful. Unlike normal functions, which will return None if execution is allowed to fall off the end, either set_result() or self_error() must be called, or the the get()ing side will hang. """ ...
def download_sample_and_align(job, sample, inputs, ids): """ Downloads the sample and runs BWA-kit :param JobFunctionWrappingJob job: Passed by Toil automatically :param tuple(str, list) sample: UUID and URLS for sample :param Namespace inputs: Contains input arguments :param dict ids: FileStor...
def function[download_sample_and_align, parameter[job, sample, inputs, ids]]: constant[ Downloads the sample and runs BWA-kit :param JobFunctionWrappingJob job: Passed by Toil automatically :param tuple(str, list) sample: UUID and URLS for sample :param Namespace inputs: Contains input argument...
keyword[def] identifier[download_sample_and_align] ( identifier[job] , identifier[sample] , identifier[inputs] , identifier[ids] ): literal[string] identifier[uuid] , identifier[urls] = identifier[sample] identifier[r1_url] , identifier[r2_url] = identifier[urls] keyword[if] identifier[len] ( ident...
def download_sample_and_align(job, sample, inputs, ids): """ Downloads the sample and runs BWA-kit :param JobFunctionWrappingJob job: Passed by Toil automatically :param tuple(str, list) sample: UUID and URLS for sample :param Namespace inputs: Contains input arguments :param dict ids: FileStor...
def ean(self, fmt: Optional[EANFormat] = None) -> str: """Generate EAN. To change EAN format, pass parameter ``fmt`` with needed value of the enum object :class:`~mimesis.enums.EANFormat`. :param fmt: Format of EAN. :return: EAN. :raises NonEnumerableError: if fmt is no...
def function[ean, parameter[self, fmt]]: constant[Generate EAN. To change EAN format, pass parameter ``fmt`` with needed value of the enum object :class:`~mimesis.enums.EANFormat`. :param fmt: Format of EAN. :return: EAN. :raises NonEnumerableError: if fmt is not enum E...
keyword[def] identifier[ean] ( identifier[self] , identifier[fmt] : identifier[Optional] [ identifier[EANFormat] ]= keyword[None] )-> identifier[str] : literal[string] identifier[key] = identifier[self] . identifier[_validate_enum] ( identifier[item] = identifier[fmt] , identifier...
def ean(self, fmt: Optional[EANFormat]=None) -> str: """Generate EAN. To change EAN format, pass parameter ``fmt`` with needed value of the enum object :class:`~mimesis.enums.EANFormat`. :param fmt: Format of EAN. :return: EAN. :raises NonEnumerableError: if fmt is not enum...
def get_detail_view(self, request, object, opts=None): """ Instantiates and returns the view class that will generate the actual context for this plugin. """ view = self.get_view(request, self.view_class, opts) view.object = object return view
def function[get_detail_view, parameter[self, request, object, opts]]: constant[ Instantiates and returns the view class that will generate the actual context for this plugin. ] variable[view] assign[=] call[name[self].get_view, parameter[name[request], name[self].view_class, nam...
keyword[def] identifier[get_detail_view] ( identifier[self] , identifier[request] , identifier[object] , identifier[opts] = keyword[None] ): literal[string] identifier[view] = identifier[self] . identifier[get_view] ( identifier[request] , identifier[self] . identifier[view_class] , identifier[opts...
def get_detail_view(self, request, object, opts=None): """ Instantiates and returns the view class that will generate the actual context for this plugin. """ view = self.get_view(request, self.view_class, opts) view.object = object return view
def algorithms(self): """ Returns a list of available load balancing algorithms. """ if self._algorithms is None: uri = "/loadbalancers/algorithms" resp, body = self.method_get(uri) self._algorithms = [alg["name"] for alg in body["algorithms"]] ...
def function[algorithms, parameter[self]]: constant[ Returns a list of available load balancing algorithms. ] if compare[name[self]._algorithms is constant[None]] begin[:] variable[uri] assign[=] constant[/loadbalancers/algorithms] <ast.Tuple object at 0x7...
keyword[def] identifier[algorithms] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_algorithms] keyword[is] keyword[None] : identifier[uri] = literal[string] identifier[resp] , identifier[body] = identifier[self] . identifier[method_get...
def algorithms(self): """ Returns a list of available load balancing algorithms. """ if self._algorithms is None: uri = '/loadbalancers/algorithms' (resp, body) = self.method_get(uri) self._algorithms = [alg['name'] for alg in body['algorithms']] # depends on [control=['...
def settings(self): """Retrieve and cache settings from server""" if not self.__settings: self.__settings = self.request('get', 'settings').json() return self.__settings
def function[settings, parameter[self]]: constant[Retrieve and cache settings from server] if <ast.UnaryOp object at 0x7da2054a58d0> begin[:] name[self].__settings assign[=] call[call[name[self].request, parameter[constant[get], constant[settings]]].json, parameter[]] return[name[sel...
keyword[def] identifier[settings] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[__settings] : identifier[self] . identifier[__settings] = identifier[self] . identifier[request] ( literal[string] , literal[string] ). identifier[json] () ...
def settings(self): """Retrieve and cache settings from server""" if not self.__settings: self.__settings = self.request('get', 'settings').json() # depends on [control=['if'], data=[]] return self.__settings
def _in_stoplist(self, entity): """Return True if the entity is in the stoplist.""" start = 0 end = len(entity) # Adjust boundaries to exclude disallowed prefixes/suffixes for prefix in IGNORE_PREFIX: if entity.startswith(prefix): # print('%s removing ...
def function[_in_stoplist, parameter[self, entity]]: constant[Return True if the entity is in the stoplist.] variable[start] assign[=] constant[0] variable[end] assign[=] call[name[len], parameter[name[entity]]] for taget[name[prefix]] in starred[name[IGNORE_PREFIX]] begin[:] ...
keyword[def] identifier[_in_stoplist] ( identifier[self] , identifier[entity] ): literal[string] identifier[start] = literal[int] identifier[end] = identifier[len] ( identifier[entity] ) keyword[for] identifier[prefix] keyword[in] identifier[IGNORE_PREFIX] : ...
def _in_stoplist(self, entity): """Return True if the entity is in the stoplist.""" start = 0 end = len(entity) # Adjust boundaries to exclude disallowed prefixes/suffixes for prefix in IGNORE_PREFIX: if entity.startswith(prefix): # print('%s removing %s' % (currenttext, prefix))...
def _get_seqprop_to_seqprop_alignment(self, seqprop1, seqprop2): """Return the alignment stored in self.sequence_alignments given a seqprop + another seqprop""" if isinstance(seqprop1, str): seqprop1_id = seqprop1 else: seqprop1_id = seqprop1.id if isinstance(seqp...
def function[_get_seqprop_to_seqprop_alignment, parameter[self, seqprop1, seqprop2]]: constant[Return the alignment stored in self.sequence_alignments given a seqprop + another seqprop] if call[name[isinstance], parameter[name[seqprop1], name[str]]] begin[:] variable[seqprop1_id] assign[...
keyword[def] identifier[_get_seqprop_to_seqprop_alignment] ( identifier[self] , identifier[seqprop1] , identifier[seqprop2] ): literal[string] keyword[if] identifier[isinstance] ( identifier[seqprop1] , identifier[str] ): identifier[seqprop1_id] = identifier[seqprop1] keywor...
def _get_seqprop_to_seqprop_alignment(self, seqprop1, seqprop2): """Return the alignment stored in self.sequence_alignments given a seqprop + another seqprop""" if isinstance(seqprop1, str): seqprop1_id = seqprop1 # depends on [control=['if'], data=[]] else: seqprop1_id = seqprop1.id if...
def get_group_permissions(self, user_obj, obj=None): """ Returns a set of permission strings that this user has through his/her groups. """ if user_obj.is_anonymous() or obj is not None: return set() if not hasattr(user_obj, '_group_perm_cache'): i...
def function[get_group_permissions, parameter[self, user_obj, obj]]: constant[ Returns a set of permission strings that this user has through his/her groups. ] if <ast.BoolOp object at 0x7da1b25ee650> begin[:] return[call[name[set], parameter[]]] if <ast.UnaryOp o...
keyword[def] identifier[get_group_permissions] ( identifier[self] , identifier[user_obj] , identifier[obj] = keyword[None] ): literal[string] keyword[if] identifier[user_obj] . identifier[is_anonymous] () keyword[or] identifier[obj] keyword[is] keyword[not] keyword[None] : keyword...
def get_group_permissions(self, user_obj, obj=None): """ Returns a set of permission strings that this user has through his/her groups. """ if user_obj.is_anonymous() or obj is not None: return set() # depends on [control=['if'], data=[]] if not hasattr(user_obj, '_group_per...
def set_threshold_override(self, limit_name, warn_percent=None, warn_count=None, crit_percent=None, crit_count=None): """ Override the default warning and critical thresholds used to evaluate the specified limit's usage. Theresholds c...
def function[set_threshold_override, parameter[self, limit_name, warn_percent, warn_count, crit_percent, crit_count]]: constant[ Override the default warning and critical thresholds used to evaluate the specified limit's usage. Theresholds can be specified as a percentage of the limit, o...
keyword[def] identifier[set_threshold_override] ( identifier[self] , identifier[limit_name] , identifier[warn_percent] = keyword[None] , identifier[warn_count] = keyword[None] , identifier[crit_percent] = keyword[None] , identifier[crit_count] = keyword[None] ): literal[string] keyword[try] : ...
def set_threshold_override(self, limit_name, warn_percent=None, warn_count=None, crit_percent=None, crit_count=None): """ Override the default warning and critical thresholds used to evaluate the specified limit's usage. Theresholds can be specified as a percentage of the limit, or as a usag...
def quote_js(text): '''Quotes text to be used as JavaScript string in HTML templates. The result doesn't contain surrounding quotes.''' if isinstance(text, six.binary_type): text = text.decode('utf-8') # for Jinja2 Markup text = text.replace('\\', '\\\\'); text = text.replace('\n', '\\n'); ...
def function[quote_js, parameter[text]]: constant[Quotes text to be used as JavaScript string in HTML templates. The result doesn't contain surrounding quotes.] if call[name[isinstance], parameter[name[text], name[six].binary_type]] begin[:] variable[text] assign[=] call[name[text].d...
keyword[def] identifier[quote_js] ( identifier[text] ): literal[string] keyword[if] identifier[isinstance] ( identifier[text] , identifier[six] . identifier[binary_type] ): identifier[text] = identifier[text] . identifier[decode] ( literal[string] ) identifier[text] = identifier[text] . iden...
def quote_js(text): """Quotes text to be used as JavaScript string in HTML templates. The result doesn't contain surrounding quotes.""" if isinstance(text, six.binary_type): text = text.decode('utf-8') # for Jinja2 Markup # depends on [control=['if'], data=[]] text = text.replace('\\', '\\\\')...
def print_virt_table(self, data): """Print a vertical pretty table from data.""" table = prettytable.PrettyTable() keys = sorted(data.keys()) table.add_column('Keys', keys) table.add_column('Values', [data.get(i) for i in keys]) for tbl in table.align.keys(): ...
def function[print_virt_table, parameter[self, data]]: constant[Print a vertical pretty table from data.] variable[table] assign[=] call[name[prettytable].PrettyTable, parameter[]] variable[keys] assign[=] call[name[sorted], parameter[call[name[data].keys, parameter[]]]] call[name[table]...
keyword[def] identifier[print_virt_table] ( identifier[self] , identifier[data] ): literal[string] identifier[table] = identifier[prettytable] . identifier[PrettyTable] () identifier[keys] = identifier[sorted] ( identifier[data] . identifier[keys] ()) identifier[table] . identifi...
def print_virt_table(self, data): """Print a vertical pretty table from data.""" table = prettytable.PrettyTable() keys = sorted(data.keys()) table.add_column('Keys', keys) table.add_column('Values', [data.get(i) for i in keys]) for tbl in table.align.keys(): table.align[tbl] = 'l' # de...
def chunks(self, size=32, alignment=1): """Return chunks of the data aligned as given by `alignment`. `size` must be a multiple of `alignment`. Each chunk is returned as a named two-tuple of its address and data. """ if (size % alignment) != 0: raise Error( ...
def function[chunks, parameter[self, size, alignment]]: constant[Return chunks of the data aligned as given by `alignment`. `size` must be a multiple of `alignment`. Each chunk is returned as a named two-tuple of its address and data. ] if compare[binary_operation[name[size] <as...
keyword[def] identifier[chunks] ( identifier[self] , identifier[size] = literal[int] , identifier[alignment] = literal[int] ): literal[string] keyword[if] ( identifier[size] % identifier[alignment] )!= literal[int] : keyword[raise] identifier[Error] ( literal[string] . i...
def chunks(self, size=32, alignment=1): """Return chunks of the data aligned as given by `alignment`. `size` must be a multiple of `alignment`. Each chunk is returned as a named two-tuple of its address and data. """ if size % alignment != 0: raise Error('size {} is not a multip...
def find_shows_by_ids(self, show_ids): """doc: http://open.youku.com/docs/doc?id=60 """ url = 'https://openapi.youku.com/v2/shows/show_batch.json' params = { 'client_id': self.client_id, 'show_ids': show_ids } r = requests.get(url, params=params) ...
def function[find_shows_by_ids, parameter[self, show_ids]]: constant[doc: http://open.youku.com/docs/doc?id=60 ] variable[url] assign[=] constant[https://openapi.youku.com/v2/shows/show_batch.json] variable[params] assign[=] dictionary[[<ast.Constant object at 0x7da1b265fd30>, <ast.Const...
keyword[def] identifier[find_shows_by_ids] ( identifier[self] , identifier[show_ids] ): literal[string] identifier[url] = literal[string] identifier[params] ={ literal[string] : identifier[self] . identifier[client_id] , literal[string] : identifier[show_ids] } ...
def find_shows_by_ids(self, show_ids): """doc: http://open.youku.com/docs/doc?id=60 """ url = 'https://openapi.youku.com/v2/shows/show_batch.json' params = {'client_id': self.client_id, 'show_ids': show_ids} r = requests.get(url, params=params) check_error(r) return r.json()
def maybe_reduce(nodes): r"""Reduce nodes in a curve if they are degree-elevated. .. note:: This is a helper for :func:`_full_reduce`. Hence there is no corresponding Fortran speedup. We check if the nodes are degree-elevated by projecting onto the space of degree-elevated curves of t...
def function[maybe_reduce, parameter[nodes]]: constant[Reduce nodes in a curve if they are degree-elevated. .. note:: This is a helper for :func:`_full_reduce`. Hence there is no corresponding Fortran speedup. We check if the nodes are degree-elevated by projecting onto the space ...
keyword[def] identifier[maybe_reduce] ( identifier[nodes] ): literal[string] identifier[_] , identifier[num_nodes] = identifier[nodes] . identifier[shape] keyword[if] identifier[num_nodes] < literal[int] : keyword[return] keyword[False] , identifier[nodes] keyword[elif] identifier[...
def maybe_reduce(nodes): """Reduce nodes in a curve if they are degree-elevated. .. note:: This is a helper for :func:`_full_reduce`. Hence there is no corresponding Fortran speedup. We check if the nodes are degree-elevated by projecting onto the space of degree-elevated curves of th...
def handle_set_statement_group(self, _, __, tokens: ParseResults) -> ParseResults: """Handle a ``SET STATEMENT_GROUP = "X"`` statement.""" self.statement_group = tokens['group'] return tokens
def function[handle_set_statement_group, parameter[self, _, __, tokens]]: constant[Handle a ``SET STATEMENT_GROUP = "X"`` statement.] name[self].statement_group assign[=] call[name[tokens]][constant[group]] return[name[tokens]]
keyword[def] identifier[handle_set_statement_group] ( identifier[self] , identifier[_] , identifier[__] , identifier[tokens] : identifier[ParseResults] )-> identifier[ParseResults] : literal[string] identifier[self] . identifier[statement_group] = identifier[tokens] [ literal[string] ] key...
def handle_set_statement_group(self, _, __, tokens: ParseResults) -> ParseResults: """Handle a ``SET STATEMENT_GROUP = "X"`` statement.""" self.statement_group = tokens['group'] return tokens
def mcmc_sampling(self): """Adjust the weight of each function using mcmc sampling. The initial value of each weight is evenly distribute. Brief introduction: (1)Definition of sample: Sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk} (2)Definitio...
def function[mcmc_sampling, parameter[self]]: constant[Adjust the weight of each function using mcmc sampling. The initial value of each weight is evenly distribute. Brief introduction: (1)Definition of sample: Sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ....
keyword[def] identifier[mcmc_sampling] ( identifier[self] ): literal[string] identifier[init_weight] = identifier[np] . identifier[ones] (( identifier[self] . identifier[effective_model_num] ), identifier[dtype] = identifier[np] . identifier[float] )/ identifier[self] . identifier[effective_model_n...
def mcmc_sampling(self): """Adjust the weight of each function using mcmc sampling. The initial value of each weight is evenly distribute. Brief introduction: (1)Definition of sample: Sample is a (1 * NUM_OF_FUNCTIONS) matrix, representing{w1, w2, ... wk} (2)Definition of...
def haversine_distance(point1, point2): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees). """ lat1, lon1 = point1 lat2, lon2 = point2 # Convert decimal degrees to radians. lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2...
def function[haversine_distance, parameter[point1, point2]]: constant[ Calculate the great circle distance between two points on the earth (specified in decimal degrees). ] <ast.Tuple object at 0x7da1b0395f00> assign[=] name[point1] <ast.Tuple object at 0x7da1b0396650> assign[=] name...
keyword[def] identifier[haversine_distance] ( identifier[point1] , identifier[point2] ): literal[string] identifier[lat1] , identifier[lon1] = identifier[point1] identifier[lat2] , identifier[lon2] = identifier[point2] identifier[lon1] , identifier[lat1] , identifier[lon2] , identifier[la...
def haversine_distance(point1, point2): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees). """ (lat1, lon1) = point1 (lat2, lon2) = point2 # Convert decimal degrees to radians. (lon1, lat1, lon2, lat2) = map(radians, [lon1, lat1, lon2,...
def _concatenate_virtual_arrays(arrs, cols=None, scaling=None): """Return a virtual concatenate of several NumPy arrays.""" return None if not len(arrs) else ConcatenatedArrays(arrs, cols, scaling=scaling)
def function[_concatenate_virtual_arrays, parameter[arrs, cols, scaling]]: constant[Return a virtual concatenate of several NumPy arrays.] return[<ast.IfExp object at 0x7da1b12f1d50>]
keyword[def] identifier[_concatenate_virtual_arrays] ( identifier[arrs] , identifier[cols] = keyword[None] , identifier[scaling] = keyword[None] ): literal[string] keyword[return] keyword[None] keyword[if] keyword[not] identifier[len] ( identifier[arrs] ) keyword[else] identifier[ConcatenatedArrays] (...
def _concatenate_virtual_arrays(arrs, cols=None, scaling=None): """Return a virtual concatenate of several NumPy arrays.""" return None if not len(arrs) else ConcatenatedArrays(arrs, cols, scaling=scaling)
def get_all_devs(auth, url, network_address=None, category=None, label=None): """Takes string input of IP address to issue RESTUL call to HP IMC\n :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.aut...
def function[get_all_devs, parameter[auth, url, network_address, category, label]]: constant[Takes string input of IP address to issue RESTUL call to HP IMC :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url fr...
keyword[def] identifier[get_all_devs] ( identifier[auth] , identifier[url] , identifier[network_address] = keyword[None] , identifier[category] = keyword[None] , identifier[label] = keyword[None] ): literal[string] identifier[base_url] = literal[string] identifier[end_url] = literal[string] key...
def get_all_devs(auth, url, network_address=None, category=None, label=None): """Takes string input of IP address to issue RESTUL call to HP IMC :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth...
def open(url): """ Launches browser depending on os """ if sys.platform == 'win32': os.startfile(url) elif sys.platform == 'darwin': subprocess.Popen(['open', url]) else: try: subprocess.Popen(['xdg-open', url]) except OSError: import webbrowser ...
def function[open, parameter[url]]: constant[ Launches browser depending on os ] if compare[name[sys].platform equal[==] constant[win32]] begin[:] call[name[os].startfile, parameter[name[url]]]
keyword[def] identifier[open] ( identifier[url] ): literal[string] keyword[if] identifier[sys] . identifier[platform] == literal[string] : identifier[os] . identifier[startfile] ( identifier[url] ) keyword[elif] identifier[sys] . identifier[platform] == literal[string] : identifier...
def open(url): """ Launches browser depending on os """ if sys.platform == 'win32': os.startfile(url) # depends on [control=['if'], data=[]] elif sys.platform == 'darwin': subprocess.Popen(['open', url]) # depends on [control=['if'], data=[]] else: try: subprocess.P...
def gps_velocity_df(GPS): '''return GPS velocity vector''' vx = GPS.Spd * cos(radians(GPS.GCrs)) vy = GPS.Spd * sin(radians(GPS.GCrs)) return Vector3(vx, vy, GPS.VZ)
def function[gps_velocity_df, parameter[GPS]]: constant[return GPS velocity vector] variable[vx] assign[=] binary_operation[name[GPS].Spd * call[name[cos], parameter[call[name[radians], parameter[name[GPS].GCrs]]]]] variable[vy] assign[=] binary_operation[name[GPS].Spd * call[name[sin], paramete...
keyword[def] identifier[gps_velocity_df] ( identifier[GPS] ): literal[string] identifier[vx] = identifier[GPS] . identifier[Spd] * identifier[cos] ( identifier[radians] ( identifier[GPS] . identifier[GCrs] )) identifier[vy] = identifier[GPS] . identifier[Spd] * identifier[sin] ( identifier[radians] ( ...
def gps_velocity_df(GPS): """return GPS velocity vector""" vx = GPS.Spd * cos(radians(GPS.GCrs)) vy = GPS.Spd * sin(radians(GPS.GCrs)) return Vector3(vx, vy, GPS.VZ)
def sentences(self): ''' Iterate over <s> XML-like tags and tokenize with nltk ''' for sentence_id, node in enumerate(self.ner_dom.childNodes): ## increment the char index with any text before the <s> ## tag. Crucial assumption here is that the LingPipe XML ...
def function[sentences, parameter[self]]: constant[ Iterate over <s> XML-like tags and tokenize with nltk ] for taget[tuple[[<ast.Name object at 0x7da204960b20>, <ast.Name object at 0x7da204961d50>]]] in starred[call[name[enumerate], parameter[name[self].ner_dom.childNodes]]] begin[:] ...
keyword[def] identifier[sentences] ( identifier[self] ): literal[string] keyword[for] identifier[sentence_id] , identifier[node] keyword[in] identifier[enumerate] ( identifier[self] . identifier[ner_dom] . identifier[childNodes] ): keywor...
def sentences(self): """ Iterate over <s> XML-like tags and tokenize with nltk """ for (sentence_id, node) in enumerate(self.ner_dom.childNodes): ## increment the char index with any text before the <s> ## tag. Crucial assumption here is that the LingPipe XML ## tags are...
def simulate(self, steps, initial_lr): """ Simulates the learning rate scheduler. Parameters ---------- steps: int Number of steps to simulate initial_lr: float Initial learning rate Returns ------- lrs: numpy ndarray ...
def function[simulate, parameter[self, steps, initial_lr]]: constant[ Simulates the learning rate scheduler. Parameters ---------- steps: int Number of steps to simulate initial_lr: float Initial learning rate Returns ------- ...
keyword[def] identifier[simulate] ( identifier[self] , identifier[steps] , identifier[initial_lr] ): literal[string] identifier[test] = identifier[torch] . identifier[ones] ( literal[int] , identifier[requires_grad] = keyword[True] ) identifier[opt] = identifier[torch] . identifier[optim] ...
def simulate(self, steps, initial_lr): """ Simulates the learning rate scheduler. Parameters ---------- steps: int Number of steps to simulate initial_lr: float Initial learning rate Returns ------- lrs: numpy ndarray S...
def pop(self, k, d=_POP_DEFAULT): """Pop an ingredient off of this shelf.""" if d is _POP_DEFAULT: return self._ingredients.pop(k) else: return self._ingredients.pop(k, d)
def function[pop, parameter[self, k, d]]: constant[Pop an ingredient off of this shelf.] if compare[name[d] is name[_POP_DEFAULT]] begin[:] return[call[name[self]._ingredients.pop, parameter[name[k]]]]
keyword[def] identifier[pop] ( identifier[self] , identifier[k] , identifier[d] = identifier[_POP_DEFAULT] ): literal[string] keyword[if] identifier[d] keyword[is] identifier[_POP_DEFAULT] : keyword[return] identifier[self] . identifier[_ingredients] . identifier[pop] ( identifier[...
def pop(self, k, d=_POP_DEFAULT): """Pop an ingredient off of this shelf.""" if d is _POP_DEFAULT: return self._ingredients.pop(k) # depends on [control=['if'], data=[]] else: return self._ingredients.pop(k, d)
def from_file(cls, filename, directory=None, format=None, engine=None, encoding=File._encoding): """Return an instance with the source string read from the given file. Args: filename: Filename for loading/saving the source. directory: (Sub)directory for source ...
def function[from_file, parameter[cls, filename, directory, format, engine, encoding]]: constant[Return an instance with the source string read from the given file. Args: filename: Filename for loading/saving the source. directory: (Sub)directory for source loading/saving and re...
keyword[def] identifier[from_file] ( identifier[cls] , identifier[filename] , identifier[directory] = keyword[None] , identifier[format] = keyword[None] , identifier[engine] = keyword[None] , identifier[encoding] = identifier[File] . identifier[_encoding] ): literal[string] identifier[filepath] = ...
def from_file(cls, filename, directory=None, format=None, engine=None, encoding=File._encoding): """Return an instance with the source string read from the given file. Args: filename: Filename for loading/saving the source. directory: (Sub)directory for source loading/saving and ren...
def main(): """The command line interface of the ``vcs-tool`` program.""" # Initialize logging to the terminal. coloredlogs.install() # Command line option defaults. repository = None revision = None actions = [] # Parse the command line arguments. try: options, arguments = g...
def function[main, parameter[]]: constant[The command line interface of the ``vcs-tool`` program.] call[name[coloredlogs].install, parameter[]] variable[repository] assign[=] constant[None] variable[revision] assign[=] constant[None] variable[actions] assign[=] list[[]] <ast....
keyword[def] identifier[main] (): literal[string] identifier[coloredlogs] . identifier[install] () identifier[repository] = keyword[None] identifier[revision] = keyword[None] identifier[actions] =[] keyword[try] : identifier[options] , identifier[arguments] = i...
def main(): """The command line interface of the ``vcs-tool`` program.""" # Initialize logging to the terminal. coloredlogs.install() # Command line option defaults. repository = None revision = None actions = [] # Parse the command line arguments. try: (options, arguments) =...
def except_clause(self, except_loc, exc_opt): """ (2.6, 2.7) except_clause: 'except' [test [('as' | ',') test]] (3.0-) except_clause: 'except' [test ['as' NAME]] """ type_ = name = as_loc = name_loc = None loc = except_loc if exc_opt: type_, name_opt =...
def function[except_clause, parameter[self, except_loc, exc_opt]]: constant[ (2.6, 2.7) except_clause: 'except' [test [('as' | ',') test]] (3.0-) except_clause: 'except' [test ['as' NAME]] ] variable[type_] assign[=] constant[None] variable[loc] assign[=] name[except_loc]...
keyword[def] identifier[except_clause] ( identifier[self] , identifier[except_loc] , identifier[exc_opt] ): literal[string] identifier[type_] = identifier[name] = identifier[as_loc] = identifier[name_loc] = keyword[None] identifier[loc] = identifier[except_loc] keyword[if] iden...
def except_clause(self, except_loc, exc_opt): """ (2.6, 2.7) except_clause: 'except' [test [('as' | ',') test]] (3.0-) except_clause: 'except' [test ['as' NAME]] """ type_ = name = as_loc = name_loc = None loc = except_loc if exc_opt: (type_, name_opt) = exc_opt l...
def search(self, q, **kwargs): """ You can pass in any of the Summon Search API parameters (without the "s." prefix). For example to remove highlighting: result = api.search("Web", hl=False) See the Summon API documentation for the full list of possible parameters:...
def function[search, parameter[self, q]]: constant[ You can pass in any of the Summon Search API parameters (without the "s." prefix). For example to remove highlighting: result = api.search("Web", hl=False) See the Summon API documentation for the full list of possible ...
keyword[def] identifier[search] ( identifier[self] , identifier[q] ,** identifier[kwargs] ): literal[string] identifier[params] ={ literal[string] : identifier[q] } keyword[for] identifier[k] , identifier[v] keyword[in] identifier[kwargs] . identifier[items] (): identifier[...
def search(self, q, **kwargs): """ You can pass in any of the Summon Search API parameters (without the "s." prefix). For example to remove highlighting: result = api.search("Web", hl=False) See the Summon API documentation for the full list of possible parameters: ...
def append_child(self, name, child): # type: (str, typing.Any) -> ArTree """Append new child and return it.""" temp = ArTree(name, child) self._array.append(temp) return temp
def function[append_child, parameter[self, name, child]]: constant[Append new child and return it.] variable[temp] assign[=] call[name[ArTree], parameter[name[name], name[child]]] call[name[self]._array.append, parameter[name[temp]]] return[name[temp]]
keyword[def] identifier[append_child] ( identifier[self] , identifier[name] , identifier[child] ): literal[string] identifier[temp] = identifier[ArTree] ( identifier[name] , identifier[child] ) identifier[self] . identifier[_array] . identifier[append] ( identifier[temp] ) keyword...
def append_child(self, name, child): # type: (str, typing.Any) -> ArTree 'Append new child and return it.' temp = ArTree(name, child) self._array.append(temp) return temp
def some(predicate, *seqs): """ >>> some(lambda x: x, [0, False, None]) False >>> some(lambda x: x, [None, 0, 2, 3]) 2 >>> some(operator.eq, [0,1,2], [2,1,0]) True >>> some(operator.eq, [1,2], [2,1]) False """ try: if len(seqs) == 1: return ifilter(bool,imap(predicate...
def function[some, parameter[predicate]]: constant[ >>> some(lambda x: x, [0, False, None]) False >>> some(lambda x: x, [None, 0, 2, 3]) 2 >>> some(operator.eq, [0,1,2], [2,1,0]) True >>> some(operator.eq, [1,2], [2,1]) False ] <ast.Try object at 0x7da1b10c7190>
keyword[def] identifier[some] ( identifier[predicate] ,* identifier[seqs] ): literal[string] keyword[try] : keyword[if] identifier[len] ( identifier[seqs] )== literal[int] : keyword[return] identifier[ifilter] ( identifier[bool] , identifier[imap] ( identifier[predicate] , identifier[seqs] [ lit...
def some(predicate, *seqs): """ >>> some(lambda x: x, [0, False, None]) False >>> some(lambda x: x, [None, 0, 2, 3]) 2 >>> some(operator.eq, [0,1,2], [2,1,0]) True >>> some(operator.eq, [1,2], [2,1]) False """ try: if len(seqs) == 1: return ifilter(bool, i...
def show_profiles(name, server, org_vm): """ Create a table of info about the profiles based on getting the references, etc. both in the dependent and antecedent direction. The resulting table is printed. """ rows = [] for profile_inst in server.profiles: pn = profile_name(org_vm, p...
def function[show_profiles, parameter[name, server, org_vm]]: constant[ Create a table of info about the profiles based on getting the references, etc. both in the dependent and antecedent direction. The resulting table is printed. ] variable[rows] assign[=] list[[]] for taget[n...
keyword[def] identifier[show_profiles] ( identifier[name] , identifier[server] , identifier[org_vm] ): literal[string] identifier[rows] =[] keyword[for] identifier[profile_inst] keyword[in] identifier[server] . identifier[profiles] : identifier[pn] = identifier[profile_name] ( identifier[o...
def show_profiles(name, server, org_vm): """ Create a table of info about the profiles based on getting the references, etc. both in the dependent and antecedent direction. The resulting table is printed. """ rows = [] for profile_inst in server.profiles: pn = profile_name(org_vm, p...
async def on_raw_761(self, message): """ Metadata key/value. """ target, targetmeta = self._parse_user(message.params[0]) key, visibility = message.params[1:3] value = message.params[3] if len(message.params) > 3 else None if target not in self._pending['metadata']: ...
<ast.AsyncFunctionDef object at 0x7da207f00ca0>
keyword[async] keyword[def] identifier[on_raw_761] ( identifier[self] , identifier[message] ): literal[string] identifier[target] , identifier[targetmeta] = identifier[self] . identifier[_parse_user] ( identifier[message] . identifier[params] [ literal[int] ]) identifier[key] , identifier...
async def on_raw_761(self, message): """ Metadata key/value. """ (target, targetmeta) = self._parse_user(message.params[0]) (key, visibility) = message.params[1:3] value = message.params[3] if len(message.params) > 3 else None if target not in self._pending['metadata']: return # depends on ...
def topological_nodes(self): """ Yield nodes in topological order. Returns: generator(DAGNode): node in topological order """ return nx.lexicographical_topological_sort(self._multi_graph, key=lambda x: str(x.qargs))
def function[topological_nodes, parameter[self]]: constant[ Yield nodes in topological order. Returns: generator(DAGNode): node in topological order ] return[call[name[nx].lexicographical_topological_sort, parameter[name[self]._multi_graph]]]
keyword[def] identifier[topological_nodes] ( identifier[self] ): literal[string] keyword[return] identifier[nx] . identifier[lexicographical_topological_sort] ( identifier[self] . identifier[_multi_graph] , identifier[key] = keyword[lambda] identifier[x] : identifier[str] ( identifier[x]...
def topological_nodes(self): """ Yield nodes in topological order. Returns: generator(DAGNode): node in topological order """ return nx.lexicographical_topological_sort(self._multi_graph, key=lambda x: str(x.qargs))
def detect_xid_devices(self): """ For all of the com ports connected to the computer, send an XID command '_c1'. If the device response with '_xid', it is an xid device. """ self.__xid_cons = [] for c in self.__com_ports: device_found = False ...
def function[detect_xid_devices, parameter[self]]: constant[ For all of the com ports connected to the computer, send an XID command '_c1'. If the device response with '_xid', it is an xid device. ] name[self].__xid_cons assign[=] list[[]] for taget[name[c]] in s...
keyword[def] identifier[detect_xid_devices] ( identifier[self] ): literal[string] identifier[self] . identifier[__xid_cons] =[] keyword[for] identifier[c] keyword[in] identifier[self] . identifier[__com_ports] : identifier[device_found] = keyword[False] keywo...
def detect_xid_devices(self): """ For all of the com ports connected to the computer, send an XID command '_c1'. If the device response with '_xid', it is an xid device. """ self.__xid_cons = [] for c in self.__com_ports: device_found = False for b in [115200...
def _default_next_colour(particle): """ Default next colour implementation - linear progression through each colour tuple. """ return particle.colours[ (len(particle.colours) - 1) * particle.time // particle.life_time]
def function[_default_next_colour, parameter[particle]]: constant[ Default next colour implementation - linear progression through each colour tuple. ] return[call[name[particle].colours][binary_operation[binary_operation[binary_operation[call[name[len], parameter[name[particle].colo...
keyword[def] identifier[_default_next_colour] ( identifier[particle] ): literal[string] keyword[return] identifier[particle] . identifier[colours] [ ( identifier[len] ( identifier[particle] . identifier[colours] )- literal[int] )* identifier[particle] . identifier[time] // identifier[parti...
def _default_next_colour(particle): """ Default next colour implementation - linear progression through each colour tuple. """ return particle.colours[(len(particle.colours) - 1) * particle.time // particle.life_time]
def make_multiple_uni_disc_packets(cid: tuple, sourceName: str, universes: list) -> List['UniverseDiscoveryPacket']: """ Creates a list with universe discovery packets based on the given data. It creates automatically enough packets for the given universes list. :param cid: the cid to us...
def function[make_multiple_uni_disc_packets, parameter[cid, sourceName, universes]]: constant[ Creates a list with universe discovery packets based on the given data. It creates automatically enough packets for the given universes list. :param cid: the cid to use in all packets :...
keyword[def] identifier[make_multiple_uni_disc_packets] ( identifier[cid] : identifier[tuple] , identifier[sourceName] : identifier[str] , identifier[universes] : identifier[list] )-> identifier[List] [ literal[string] ]: literal[string] identifier[tmpList] =[] keyword[if] identifier[len]...
def make_multiple_uni_disc_packets(cid: tuple, sourceName: str, universes: list) -> List['UniverseDiscoveryPacket']: """ Creates a list with universe discovery packets based on the given data. It creates automatically enough packets for the given universes list. :param cid: the cid to use in...
async def verify_scriptworker_task(chain, obj): """Verify the signing trust object. Currently the only check is to make sure it was run on a scriptworker. Args: chain (ChainOfTrust): the chain we're operating on obj (ChainOfTrust or LinkOfTrust): the trust object for the signing task. ...
<ast.AsyncFunctionDef object at 0x7da204566c80>
keyword[async] keyword[def] identifier[verify_scriptworker_task] ( identifier[chain] , identifier[obj] ): literal[string] identifier[errors] =[] keyword[if] identifier[obj] . identifier[worker_impl] != literal[string] : identifier[errors] . identifier[append] ( literal[string] . identifier[...
async def verify_scriptworker_task(chain, obj): """Verify the signing trust object. Currently the only check is to make sure it was run on a scriptworker. Args: chain (ChainOfTrust): the chain we're operating on obj (ChainOfTrust or LinkOfTrust): the trust object for the signing task. ...
def calcgain(self, ant1, ant2, skyfreq, pol): """ Calculates the complex gain product (g1*g2) for a pair of antennas. """ select = self.select[n.where( (self.skyfreq[self.select] == skyfreq) & (self.polarization[self.select] == pol) )[0]] if len(select): # for when telcal solutions do...
def function[calcgain, parameter[self, ant1, ant2, skyfreq, pol]]: constant[ Calculates the complex gain product (g1*g2) for a pair of antennas. ] variable[select] assign[=] call[name[self].select][call[call[name[n].where, parameter[binary_operation[compare[call[name[self].skyfreq][name[self].se...
keyword[def] identifier[calcgain] ( identifier[self] , identifier[ant1] , identifier[ant2] , identifier[skyfreq] , identifier[pol] ): literal[string] identifier[select] = identifier[self] . identifier[select] [ identifier[n] . identifier[where] (( identifier[self] . identifier[skyfreq] [ identifie...
def calcgain(self, ant1, ant2, skyfreq, pol): """ Calculates the complex gain product (g1*g2) for a pair of antennas. """ select = self.select[n.where((self.skyfreq[self.select] == skyfreq) & (self.polarization[self.select] == pol))[0]] if len(select): # for when telcal solutions don't exist ...
def read_data(data_file, dataformat, name_mode): """ Load data_file described by a dataformat dict. Parameters ---------- data_file : str Path to data file, including extension. dataformat : dict A dataformat dict, see example below. name_mode : str How to identyfy s...
def function[read_data, parameter[data_file, dataformat, name_mode]]: constant[ Load data_file described by a dataformat dict. Parameters ---------- data_file : str Path to data file, including extension. dataformat : dict A dataformat dict, see example below. name_mode ...
keyword[def] identifier[read_data] ( identifier[data_file] , identifier[dataformat] , identifier[name_mode] ): literal[string] keyword[with] identifier[open] ( identifier[data_file] ) keyword[as] identifier[f] : identifier[lines] = identifier[f] . identifier[readlines] () keyword[if] lite...
def read_data(data_file, dataformat, name_mode): """ Load data_file described by a dataformat dict. Parameters ---------- data_file : str Path to data file, including extension. dataformat : dict A dataformat dict, see example below. name_mode : str How to identyfy s...
def _column_pad_filter(self, next_filter): """ Expand blank lines caused from overflow of other columns to blank whitespace. E.g. INPUT: [ ["1a", "2a"], [None, "2b"], ["1b", "2c"], [None, "2d"] ] OUTPUT:...
def function[_column_pad_filter, parameter[self, next_filter]]: constant[ Expand blank lines caused from overflow of other columns to blank whitespace. E.g. INPUT: [ ["1a", "2a"], [None, "2b"], ["1b", "2c"], [None, "2d"] ...
keyword[def] identifier[_column_pad_filter] ( identifier[self] , identifier[next_filter] ): literal[string] identifier[next] ( identifier[next_filter] ) keyword[while] keyword[True] : identifier[line] = identifier[list] (( keyword[yield] )) keyword[for] identifi...
def _column_pad_filter(self, next_filter): """ Expand blank lines caused from overflow of other columns to blank whitespace. E.g. INPUT: [ ["1a", "2a"], [None, "2b"], ["1b", "2c"], [None, "2d"] ] OUTPUT: [ ...
def check_successful_tx(web3: Web3, txid: str, timeout=180) -> Tuple[dict, dict]: """See if transaction went through (Solidity code did not throw). :return: Transaction receipt and transaction info """ receipt = wait_for_transaction_receipt(web3=web3, txid=txid, timeout=timeout) txinfo = web3.eth.ge...
def function[check_successful_tx, parameter[web3, txid, timeout]]: constant[See if transaction went through (Solidity code did not throw). :return: Transaction receipt and transaction info ] variable[receipt] assign[=] call[name[wait_for_transaction_receipt], parameter[]] variable[txinfo...
keyword[def] identifier[check_successful_tx] ( identifier[web3] : identifier[Web3] , identifier[txid] : identifier[str] , identifier[timeout] = literal[int] )-> identifier[Tuple] [ identifier[dict] , identifier[dict] ]: literal[string] identifier[receipt] = identifier[wait_for_transaction_receipt] ( identi...
def check_successful_tx(web3: Web3, txid: str, timeout=180) -> Tuple[dict, dict]: """See if transaction went through (Solidity code did not throw). :return: Transaction receipt and transaction info """ receipt = wait_for_transaction_receipt(web3=web3, txid=txid, timeout=timeout) txinfo = web3.eth.ge...
def parse_args(): """ Parse the args, returns if the type of update: Major, minor, fix """ parser = argparse.ArgumentParser() parser.add_argument('-M', action='store_true') parser.add_argument('-m', action='store_true') parser.add_argument('-f', action='store_true') args = parser.parse_a...
def function[parse_args, parameter[]]: constant[ Parse the args, returns if the type of update: Major, minor, fix ] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, parameter[constant[-M]]] call[name[parser].add_argument,...
keyword[def] identifier[parse_args] (): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] () identifier[parser] . identifier[add_argument] ( literal[string] , identifier[action] = literal[string] ) identifier[parser] . identifier[add_argument] ( literal[string...
def parse_args(): """ Parse the args, returns if the type of update: Major, minor, fix """ parser = argparse.ArgumentParser() parser.add_argument('-M', action='store_true') parser.add_argument('-m', action='store_true') parser.add_argument('-f', action='store_true') args = parser.parse_a...
def listclip(list_, num, fromback=False): r""" DEPRICATE: use slices instead Args: list_ (list): num (int): Returns: sublist: CommandLine: python -m utool.util_list --test-listclip Example1: >>> # ENABLE_DOCTEST >>> import utool as ut >...
def function[listclip, parameter[list_, num, fromback]]: constant[ DEPRICATE: use slices instead Args: list_ (list): num (int): Returns: sublist: CommandLine: python -m utool.util_list --test-listclip Example1: >>> # ENABLE_DOCTEST >>> impo...
keyword[def] identifier[listclip] ( identifier[list_] , identifier[num] , identifier[fromback] = keyword[False] ): literal[string] keyword[if] identifier[num] keyword[is] keyword[None] : identifier[num_] = identifier[len] ( identifier[list_] ) keyword[else] : identifier[num_] = id...
def listclip(list_, num, fromback=False): """ DEPRICATE: use slices instead Args: list_ (list): num (int): Returns: sublist: CommandLine: python -m utool.util_list --test-listclip Example1: >>> # ENABLE_DOCTEST >>> import utool as ut >>...
def sell(self, account_id, **params): """https://developers.coinbase.com/api/v2#sell-bitcoin""" if 'amount' not in params and 'total' not in params: raise ValueError("Missing required parameter: 'amount' or 'total'") for required in ['currency']: if required not in params...
def function[sell, parameter[self, account_id]]: constant[https://developers.coinbase.com/api/v2#sell-bitcoin] if <ast.BoolOp object at 0x7da18c4ccee0> begin[:] <ast.Raise object at 0x7da18c4cc310> for taget[name[required]] in starred[list[[<ast.Constant object at 0x7da18c4cdb70>]]] begi...
keyword[def] identifier[sell] ( identifier[self] , identifier[account_id] ,** identifier[params] ): literal[string] keyword[if] literal[string] keyword[not] keyword[in] identifier[params] keyword[and] literal[string] keyword[not] keyword[in] identifier[params] : keyword[raise]...
def sell(self, account_id, **params): """https://developers.coinbase.com/api/v2#sell-bitcoin""" if 'amount' not in params and 'total' not in params: raise ValueError("Missing required parameter: 'amount' or 'total'") # depends on [control=['if'], data=[]] for required in ['currency']: if re...
def _base_type(self): """Return str like 'enum.numeric' representing dimension type. This string is a 'type.subclass' concatenation of the str keys used to identify the dimension type in the cube response JSON. The '.subclass' suffix only appears where a subtype is present. """ ...
def function[_base_type, parameter[self]]: constant[Return str like 'enum.numeric' representing dimension type. This string is a 'type.subclass' concatenation of the str keys used to identify the dimension type in the cube response JSON. The '.subclass' suffix only appears where a subty...
keyword[def] identifier[_base_type] ( identifier[self] ): literal[string] identifier[type_class] = identifier[self] . identifier[_dimension_dict] [ literal[string] ][ literal[string] ] keyword[if] identifier[type_class] == literal[string] : keyword[return] literal[string] ...
def _base_type(self): """Return str like 'enum.numeric' representing dimension type. This string is a 'type.subclass' concatenation of the str keys used to identify the dimension type in the cube response JSON. The '.subclass' suffix only appears where a subtype is present. """ ...
def _argcheck(*args, **kwargs): """ Check that arguments are consistent with spark array construction. Conditions are: (1) a positional argument is a SparkContext (2) keyword arg 'context' is a SparkContext (3) an argument is a BoltArraySpark, or (4) an argument ...
def function[_argcheck, parameter[]]: constant[ Check that arguments are consistent with spark array construction. Conditions are: (1) a positional argument is a SparkContext (2) keyword arg 'context' is a SparkContext (3) an argument is a BoltArraySpark, or (4) ...
keyword[def] identifier[_argcheck] (* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[try] : keyword[from] identifier[pyspark] keyword[import] identifier[SparkContext] keyword[except] identifier[ImportError] : keyword[return] keyword[False...
def _argcheck(*args, **kwargs): """ Check that arguments are consistent with spark array construction. Conditions are: (1) a positional argument is a SparkContext (2) keyword arg 'context' is a SparkContext (3) an argument is a BoltArraySpark, or (4) an argument is a...
def send(self, message): # usually a json string... """ sends whatever it is to each transport """ for transport in self.transports.values(): transport.protocol.sendMessage(message)
def function[send, parameter[self, message]]: constant[ sends whatever it is to each transport ] for taget[name[transport]] in starred[call[name[self].transports.values, parameter[]]] begin[:] call[name[transport].protocol.sendMessage, parameter[name[message]]]
keyword[def] identifier[send] ( identifier[self] , identifier[message] ): literal[string] keyword[for] identifier[transport] keyword[in] identifier[self] . identifier[transports] . identifier[values] (): identifier[transport] . identifier[protocol] . identifier[sendMessage] ( identi...
def send(self, message): # usually a json string... '\n sends whatever it is to each transport\n ' for transport in self.transports.values(): transport.protocol.sendMessage(message) # depends on [control=['for'], data=['transport']]
def set_maxsize(self, maxsize, **kwargs): """ Set maxsize. This involves creating a new cache and transferring the items. """ new_cache = self._get_cache_impl(self.impl_name, maxsize, **kwargs) self._populate_new_cache(new_cache) self.cache = new_cache
def function[set_maxsize, parameter[self, maxsize]]: constant[ Set maxsize. This involves creating a new cache and transferring the items. ] variable[new_cache] assign[=] call[name[self]._get_cache_impl, parameter[name[self].impl_name, name[maxsize]]] call[name[self]._populate_ne...
keyword[def] identifier[set_maxsize] ( identifier[self] , identifier[maxsize] ,** identifier[kwargs] ): literal[string] identifier[new_cache] = identifier[self] . identifier[_get_cache_impl] ( identifier[self] . identifier[impl_name] , identifier[maxsize] ,** identifier[kwargs] ) identifie...
def set_maxsize(self, maxsize, **kwargs): """ Set maxsize. This involves creating a new cache and transferring the items. """ new_cache = self._get_cache_impl(self.impl_name, maxsize, **kwargs) self._populate_new_cache(new_cache) self.cache = new_cache
def as_event_class(obj): """ Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag """ if is_string(obj): for c in all_subclasses(AbinitEvent): if c.__name__ == obj or c.yaml_tag == obj: return c raise ValueE...
def function[as_event_class, parameter[obj]]: constant[ Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag ] if call[name[is_string], parameter[name[obj]]] begin[:] for taget[name[c]] in starred[call[name[all_...
keyword[def] identifier[as_event_class] ( identifier[obj] ): literal[string] keyword[if] identifier[is_string] ( identifier[obj] ): keyword[for] identifier[c] keyword[in] identifier[all_subclasses] ( identifier[AbinitEvent] ): keyword[if] identifier[c] . identifier[__name__] == i...
def as_event_class(obj): """ Convert obj into a subclass of AbinitEvent. obj can be either a class or a string with the class name or the YAML tag """ if is_string(obj): for c in all_subclasses(AbinitEvent): if c.__name__ == obj or c.yaml_tag == obj: return c # d...
def _displayattrs(attrib, expandattrs): """ Helper function to display the attributes of a Node object in lexicographic order. :param attrib: dictionary with the attributes :param expandattrs: if True also displays the value of the attributes """ if not attrib: return '' if expa...
def function[_displayattrs, parameter[attrib, expandattrs]]: constant[ Helper function to display the attributes of a Node object in lexicographic order. :param attrib: dictionary with the attributes :param expandattrs: if True also displays the value of the attributes ] if <ast.Una...
keyword[def] identifier[_displayattrs] ( identifier[attrib] , identifier[expandattrs] ): literal[string] keyword[if] keyword[not] identifier[attrib] : keyword[return] literal[string] keyword[if] identifier[expandattrs] : identifier[alist] =[ literal[string] % identifier[item] k...
def _displayattrs(attrib, expandattrs): """ Helper function to display the attributes of a Node object in lexicographic order. :param attrib: dictionary with the attributes :param expandattrs: if True also displays the value of the attributes """ if not attrib: return '' # depends ...
def open_recruitment(self, n=1): """Return initial experiment URL list, plus instructions for finding subsequent recruitment events in experiemnt logs. """ logger.info("Opening HotAir recruitment for {} participants".format(n)) recruitments = self.recruit(n) message = "Re...
def function[open_recruitment, parameter[self, n]]: constant[Return initial experiment URL list, plus instructions for finding subsequent recruitment events in experiemnt logs. ] call[name[logger].info, parameter[call[constant[Opening HotAir recruitment for {} participants].format, param...
keyword[def] identifier[open_recruitment] ( identifier[self] , identifier[n] = literal[int] ): literal[string] identifier[logger] . identifier[info] ( literal[string] . identifier[format] ( identifier[n] )) identifier[recruitments] = identifier[self] . identifier[recruit] ( identifier[n] )...
def open_recruitment(self, n=1): """Return initial experiment URL list, plus instructions for finding subsequent recruitment events in experiemnt logs. """ logger.info('Opening HotAir recruitment for {} participants'.format(n)) recruitments = self.recruit(n) message = 'Recruitment reques...
def write(self, data): 'Put, possibly replace, file contents with (new) data' if not hasattr(data, 'read'): data = six.BytesIO(data)#StringIO(data) self.jfs.up(self.path, data)
def function[write, parameter[self, data]]: constant[Put, possibly replace, file contents with (new) data] if <ast.UnaryOp object at 0x7da18f7223b0> begin[:] variable[data] assign[=] call[name[six].BytesIO, parameter[name[data]]] call[name[self].jfs.up, parameter[name[self].path,...
keyword[def] identifier[write] ( identifier[self] , identifier[data] ): literal[string] keyword[if] keyword[not] identifier[hasattr] ( identifier[data] , literal[string] ): identifier[data] = identifier[six] . identifier[BytesIO] ( identifier[data] ) identifier[self] . ident...
def write(self, data): """Put, possibly replace, file contents with (new) data""" if not hasattr(data, 'read'): data = six.BytesIO(data) #StringIO(data) # depends on [control=['if'], data=[]] self.jfs.up(self.path, data)
def from_file(self, fname, lmax=None, format='shtools', kind='real', normalization='4pi', skip=0, header=False, csphase=1, **kwargs): """ Initialize the class with spherical harmonic coefficients from a file. Usage ----- x = SHCoeffs.from_file...
def function[from_file, parameter[self, fname, lmax, format, kind, normalization, skip, header, csphase]]: constant[ Initialize the class with spherical harmonic coefficients from a file. Usage ----- x = SHCoeffs.from_file(filename, [format='shtools', lmax, ...
keyword[def] identifier[from_file] ( identifier[self] , identifier[fname] , identifier[lmax] = keyword[None] , identifier[format] = literal[string] , identifier[kind] = literal[string] , identifier[normalization] = literal[string] , identifier[skip] = literal[int] , identifier[header] = keyword[False] , identifier[...
def from_file(self, fname, lmax=None, format='shtools', kind='real', normalization='4pi', skip=0, header=False, csphase=1, **kwargs): """ Initialize the class with spherical harmonic coefficients from a file. Usage ----- x = SHCoeffs.from_file(filename, [format='shtools', lmax, ...
def content(self): """Function returns the body of the mdn message as a byte string""" if self.payload: message_bytes = mime_to_bytes( self.payload, 0).replace(b'\n', b'\r\n') boundary = b'--' + self.payload.get_boundary().encode('utf-8') temp = messa...
def function[content, parameter[self]]: constant[Function returns the body of the mdn message as a byte string] if name[self].payload begin[:] variable[message_bytes] assign[=] call[call[name[mime_to_bytes], parameter[name[self].payload, constant[0]]].replace, parameter[constant[b'\n'], ...
keyword[def] identifier[content] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[payload] : identifier[message_bytes] = identifier[mime_to_bytes] ( identifier[self] . identifier[payload] , literal[int] ). identifier[replace] ( literal[stri...
def content(self): """Function returns the body of the mdn message as a byte string""" if self.payload: message_bytes = mime_to_bytes(self.payload, 0).replace(b'\n', b'\r\n') boundary = b'--' + self.payload.get_boundary().encode('utf-8') temp = message_bytes.split(boundary) temp....
def get_raw_input(description, default=False): """Get user input from the command line via raw_input / input. description (unicode): Text to display before prompt. default (unicode or False/None): Default value to display with prompt. RETURNS (unicode): User input. """ additional = ' (default: ...
def function[get_raw_input, parameter[description, default]]: constant[Get user input from the command line via raw_input / input. description (unicode): Text to display before prompt. default (unicode or False/None): Default value to display with prompt. RETURNS (unicode): User input. ] ...
keyword[def] identifier[get_raw_input] ( identifier[description] , identifier[default] = keyword[False] ): literal[string] identifier[additional] = literal[string] % identifier[default] keyword[if] identifier[default] keyword[else] literal[string] identifier[prompt] = literal[string] %( identifie...
def get_raw_input(description, default=False): """Get user input from the command line via raw_input / input. description (unicode): Text to display before prompt. default (unicode or False/None): Default value to display with prompt. RETURNS (unicode): User input. """ additional = ' (default: ...
def get_chunk_hash(file, seed, filesz=None, chunksz=DEFAULT_CHUNK_SIZE, bufsz=DEFAULT_BUFFER_SIZE): """returns a hash of a chunk of the file provided. the position of the chunk is determined by the seed. additi...
def function[get_chunk_hash, parameter[file, seed, filesz, chunksz, bufsz]]: constant[returns a hash of a chunk of the file provided. the position of the chunk is determined by the seed. additionally, the hmac of the chunk is calculated from the seed. :param file: a file like object t...
keyword[def] identifier[get_chunk_hash] ( identifier[file] , identifier[seed] , identifier[filesz] = keyword[None] , identifier[chunksz] = identifier[DEFAULT_CHUNK_SIZE] , identifier[bufsz] = identifier[DEFAULT_BUFFER_SIZE] ): literal[string] keyword[if] ( identifier[filesz] keyword[is] keywo...
def get_chunk_hash(file, seed, filesz=None, chunksz=DEFAULT_CHUNK_SIZE, bufsz=DEFAULT_BUFFER_SIZE): """returns a hash of a chunk of the file provided. the position of the chunk is determined by the seed. additionally, the hmac of the chunk is calculated from the seed. :param file: a file ...
def encode(self): """ Encodes the current state of the object into a string. :return: The encoded string """ opt_dict = {} for k, v in self.options.items(): opt_dict[k] = v[0] ss = '{0}://{1}'.format(self.scheme, ','.join(self.hosts)) if self...
def function[encode, parameter[self]]: constant[ Encodes the current state of the object into a string. :return: The encoded string ] variable[opt_dict] assign[=] dictionary[[], []] for taget[tuple[[<ast.Name object at 0x7da207f99ab0>, <ast.Name object at 0x7da207f99060>...
keyword[def] identifier[encode] ( identifier[self] ): literal[string] identifier[opt_dict] ={} keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . identifier[options] . identifier[items] (): identifier[opt_dict] [ identifier[k] ]= identifier[v] [ liter...
def encode(self): """ Encodes the current state of the object into a string. :return: The encoded string """ opt_dict = {} for (k, v) in self.options.items(): opt_dict[k] = v[0] # depends on [control=['for'], data=[]] ss = '{0}://{1}'.format(self.scheme, ','.join(self.h...
def format_data(data): """Format data.""" # Format negative features neg_features = np.array([[data['features'][x]['effect'], data['features'][x]['value'], data['featureNames'][x]] for x in data['features'].keys() if da...
def function[format_data, parameter[data]]: constant[Format data.] variable[neg_features] assign[=] call[name[np].array, parameter[<ast.ListComp object at 0x7da18f8138e0>]] variable[neg_features] assign[=] call[name[np].array, parameter[call[name[sorted], parameter[name[neg_features]]]]] ...
keyword[def] identifier[format_data] ( identifier[data] ): literal[string] identifier[neg_features] = identifier[np] . identifier[array] ([[ identifier[data] [ literal[string] ][ identifier[x] ][ literal[string] ], identifier[data] [ literal[string] ][ identifier[x] ][ literal[string] ], ide...
def format_data(data): """Format data.""" # Format negative features neg_features = np.array([[data['features'][x]['effect'], data['features'][x]['value'], data['featureNames'][x]] for x in data['features'].keys() if data['features'][x]['effect'] < 0]) neg_features = np.array(sorted(neg_features, key=la...
def element_value_should_be(self, locator, expected, strip=False): """Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | Boolean, de...
def function[element_value_should_be, parameter[self, locator, expected, strip]]: constant[Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shad...
keyword[def] identifier[element_value_should_be] ( identifier[self] , identifier[locator] , identifier[expected] , identifier[strip] = keyword[False] ): literal[string] identifier[self] . identifier[_info] ( literal[string] %( identifier[locator] , identifier[expected] )) identifier[element] = identifier[...
def element_value_should_be(self, locator, expected, strip=False): """Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | Boolean, ...
def expectedBody(self, data): """ Read header and wait header value to call next state @param data: Stream that length are to header length (1|2|4 bytes) set next state to callBack body when length read from header are received """ bodyLen = None if data.l...
def function[expectedBody, parameter[self, data]]: constant[ Read header and wait header value to call next state @param data: Stream that length are to header length (1|2|4 bytes) set next state to callBack body when length read from header are received ] variabl...
keyword[def] identifier[expectedBody] ( identifier[self] , identifier[data] ): literal[string] identifier[bodyLen] = keyword[None] keyword[if] identifier[data] . identifier[len] == literal[int] : identifier[bodyLen] = identifier[UInt8] () keyword[elif] identifier[d...
def expectedBody(self, data): """ Read header and wait header value to call next state @param data: Stream that length are to header length (1|2|4 bytes) set next state to callBack body when length read from header are received """ bodyLen = None if data.len == 1: ...
def delete(self): """ Deletes one instance """ if self.instance is None: raise CQLEngineException("DML Query instance attribute is None") ds = DeleteStatement(self.column_family_name, timestamp=self._timestamp, conditionals=self._conditional, if_exists=self._if_exists) for n...
def function[delete, parameter[self]]: constant[ Deletes one instance ] if compare[name[self].instance is constant[None]] begin[:] <ast.Raise object at 0x7da20c6ab460> variable[ds] assign[=] call[name[DeleteStatement], parameter[name[self].column_family_name]] for taget[tuple[[<a...
keyword[def] identifier[delete] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[instance] keyword[is] keyword[None] : keyword[raise] identifier[CQLEngineException] ( literal[string] ) identifier[ds] = identifier[DeleteStatement] ( identifie...
def delete(self): """ Deletes one instance """ if self.instance is None: raise CQLEngineException('DML Query instance attribute is None') # depends on [control=['if'], data=[]] ds = DeleteStatement(self.column_family_name, timestamp=self._timestamp, conditionals=self._conditional, if_exists=self._i...
def _check_stream(self): """Determines which output stream (stdout, stderr, or custom) to use""" if self.stream: try: supported = ('PYCHARM_HOSTED' in os.environ or os.isatty(sys.stdout.fileno())) # a fix for IPython notebook "IOStre...
def function[_check_stream, parameter[self]]: constant[Determines which output stream (stdout, stderr, or custom) to use] if name[self].stream begin[:] <ast.Try object at 0x7da1b1234700> if name[supported] begin[:] if compare[name[self].stream equal[==] co...
keyword[def] identifier[_check_stream] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[stream] : keyword[try] : identifier[supported] =( literal[string] keyword[in] identifier[os] . identifier[environ] keyword[or] ...
def _check_stream(self): """Determines which output stream (stdout, stderr, or custom) to use""" if self.stream: try: supported = 'PYCHARM_HOSTED' in os.environ or os.isatty(sys.stdout.fileno()) # depends on [control=['try'], data=[]] # a fix for IPython notebook "IOStream has no fi...
def __render_videoframe(self): """ Retrieves a new videoframe from the stream. Sets the frame as the __current_video_frame and passes it on to __videorenderfunc() if it is set. """ new_videoframe = self.clip.get_frame(self.clock.time) # Pass it to the callback function if this is set if callable(self.__vi...
def function[__render_videoframe, parameter[self]]: constant[ Retrieves a new videoframe from the stream. Sets the frame as the __current_video_frame and passes it on to __videorenderfunc() if it is set. ] variable[new_videoframe] assign[=] call[name[self].clip.get_frame, parameter[name[self].clock...
keyword[def] identifier[__render_videoframe] ( identifier[self] ): literal[string] identifier[new_videoframe] = identifier[self] . identifier[clip] . identifier[get_frame] ( identifier[self] . identifier[clock] . identifier[time] ) keyword[if] identifier[callable] ( identifier[self] . identifier[__vide...
def __render_videoframe(self): """ Retrieves a new videoframe from the stream. Sets the frame as the __current_video_frame and passes it on to __videorenderfunc() if it is set. """ new_videoframe = self.clip.get_frame(self.clock.time) # Pass it to the callback function if this is set if callable(self....
def _illegal_character(c, ctx, message=''): """Raises an IonException upon encountering the given illegal character in the given context. Args: c (int|None): Ordinal of the illegal character. ctx (_HandlerContext): Context in which the illegal character was encountered. message (Option...
def function[_illegal_character, parameter[c, ctx, message]]: constant[Raises an IonException upon encountering the given illegal character in the given context. Args: c (int|None): Ordinal of the illegal character. ctx (_HandlerContext): Context in which the illegal character was encounte...
keyword[def] identifier[_illegal_character] ( identifier[c] , identifier[ctx] , identifier[message] = literal[string] ): literal[string] identifier[container_type] = identifier[ctx] . identifier[container] . identifier[ion_type] keyword[is] keyword[None] keyword[and] literal[string] keyword[or] ident...
def _illegal_character(c, ctx, message=''): """Raises an IonException upon encountering the given illegal character in the given context. Args: c (int|None): Ordinal of the illegal character. ctx (_HandlerContext): Context in which the illegal character was encountered. message (Option...
def sort_filenames(filenames): """ sort a list of files by filename only, ignoring the directory names """ basenames = [os.path.basename(x) for x in filenames] indexes = [i[0] for i in sorted(enumerate(basenames), key=lambda x:x[1])] return [filenames[x] for x in indexes]
def function[sort_filenames, parameter[filenames]]: constant[ sort a list of files by filename only, ignoring the directory names ] variable[basenames] assign[=] <ast.ListComp object at 0x7da1b17a5de0> variable[indexes] assign[=] <ast.ListComp object at 0x7da1b17a6ad0> return[<ast.Li...
keyword[def] identifier[sort_filenames] ( identifier[filenames] ): literal[string] identifier[basenames] =[ identifier[os] . identifier[path] . identifier[basename] ( identifier[x] ) keyword[for] identifier[x] keyword[in] identifier[filenames] ] identifier[indexes] =[ identifier[i] [ literal[int] ]...
def sort_filenames(filenames): """ sort a list of files by filename only, ignoring the directory names """ basenames = [os.path.basename(x) for x in filenames] indexes = [i[0] for i in sorted(enumerate(basenames), key=lambda x: x[1])] return [filenames[x] for x in indexes]
def zip_namedtuple(nt_list): """ accept list of namedtuple, return a dict of zipped fields """ if not nt_list: return dict() if not isinstance(nt_list, list): nt_list = [nt_list] for nt in nt_list: assert type(nt) == type(nt_list[0]) ret = {k : [v] for k, v in nt_list[0]._asd...
def function[zip_namedtuple, parameter[nt_list]]: constant[ accept list of namedtuple, return a dict of zipped fields ] if <ast.UnaryOp object at 0x7da1b1e042e0> begin[:] return[call[name[dict], parameter[]]] if <ast.UnaryOp object at 0x7da1b1e043d0> begin[:] variable[nt_...
keyword[def] identifier[zip_namedtuple] ( identifier[nt_list] ): literal[string] keyword[if] keyword[not] identifier[nt_list] : keyword[return] identifier[dict] () keyword[if] keyword[not] identifier[isinstance] ( identifier[nt_list] , identifier[list] ): identifier[nt_list] =[ ...
def zip_namedtuple(nt_list): """ accept list of namedtuple, return a dict of zipped fields """ if not nt_list: return dict() # depends on [control=['if'], data=[]] if not isinstance(nt_list, list): nt_list = [nt_list] # depends on [control=['if'], data=[]] for nt in nt_list: as...
def prepare(args): """ %prog prepare pairsfile cdsfile [pepfile] -o paired.cds.fasta Pick sequences from cdsfile to form pairs, ready to be calculated. The pairsfile can be generated from formats.blast.cscore(). The first two columns contain the pair. """ from jcvi.formats.fasta import Fast...
def function[prepare, parameter[args]]: constant[ %prog prepare pairsfile cdsfile [pepfile] -o paired.cds.fasta Pick sequences from cdsfile to form pairs, ready to be calculated. The pairsfile can be generated from formats.blast.cscore(). The first two columns contain the pair. ] from r...
keyword[def] identifier[prepare] ( identifier[args] ): literal[string] keyword[from] identifier[jcvi] . identifier[formats] . identifier[fasta] keyword[import] identifier[Fasta] identifier[p] = identifier[OptionParser] ( identifier[prepare] . identifier[__doc__] ) identifier[p] . identifier[...
def prepare(args): """ %prog prepare pairsfile cdsfile [pepfile] -o paired.cds.fasta Pick sequences from cdsfile to form pairs, ready to be calculated. The pairsfile can be generated from formats.blast.cscore(). The first two columns contain the pair. """ from jcvi.formats.fasta import Fast...
def match_and(self, tokens, item): """Matches and.""" for match in tokens: self.match(match, item)
def function[match_and, parameter[self, tokens, item]]: constant[Matches and.] for taget[name[match]] in starred[name[tokens]] begin[:] call[name[self].match, parameter[name[match], name[item]]]
keyword[def] identifier[match_and] ( identifier[self] , identifier[tokens] , identifier[item] ): literal[string] keyword[for] identifier[match] keyword[in] identifier[tokens] : identifier[self] . identifier[match] ( identifier[match] , identifier[item] )
def match_and(self, tokens, item): """Matches and.""" for match in tokens: self.match(match, item) # depends on [control=['for'], data=['match']]
def find_attr_start_line(self, lines, min_line=4, max_line=9): """ Return line number of the first real attribute and value. The first line is 0. If the 'ATTRIBUTE_NAME' header is not found, return the index after max_line. """ for idx, line in enumerate(lines[min_line:m...
def function[find_attr_start_line, parameter[self, lines, min_line, max_line]]: constant[ Return line number of the first real attribute and value. The first line is 0. If the 'ATTRIBUTE_NAME' header is not found, return the index after max_line. ] for taget[tuple[[<ast....
keyword[def] identifier[find_attr_start_line] ( identifier[self] , identifier[lines] , identifier[min_line] = literal[int] , identifier[max_line] = literal[int] ): literal[string] keyword[for] identifier[idx] , identifier[line] keyword[in] identifier[enumerate] ( identifier[lines] [ identifier[m...
def find_attr_start_line(self, lines, min_line=4, max_line=9): """ Return line number of the first real attribute and value. The first line is 0. If the 'ATTRIBUTE_NAME' header is not found, return the index after max_line. """ for (idx, line) in enumerate(lines[min_line:max_lin...
def objs(self): """ Returns a generator list of tracked objects which are recognized with this profile and are in the current session. """ for obj in self.objects.itervalues(): if obj.sessionid in self.sessions: yield obj
def function[objs, parameter[self]]: constant[ Returns a generator list of tracked objects which are recognized with this profile and are in the current session. ] for taget[name[obj]] in starred[call[name[self].objects.itervalues, parameter[]]] begin[:] if compar...
keyword[def] identifier[objs] ( identifier[self] ): literal[string] keyword[for] identifier[obj] keyword[in] identifier[self] . identifier[objects] . identifier[itervalues] (): keyword[if] identifier[obj] . identifier[sessionid] keyword[in] identifier[self] . identifier[sessions]...
def objs(self): """ Returns a generator list of tracked objects which are recognized with this profile and are in the current session. """ for obj in self.objects.itervalues(): if obj.sessionid in self.sessions: yield obj # depends on [control=['if'], data=[]] # dep...
def allow_cors(func): """This is a decorator which enable CORS for the specified endpoint.""" def wrapper(*args, **kwargs): response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = \ 'PUT, GET, POST, DELETE, OPTIONS' response.he...
def function[allow_cors, parameter[func]]: constant[This is a decorator which enable CORS for the specified endpoint.] def function[wrapper, parameter[]]: call[name[response].headers][constant[Access-Control-Allow-Origin]] assign[=] constant[*] call[name[response].headers...
keyword[def] identifier[allow_cors] ( identifier[func] ): literal[string] keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ): identifier[response] . identifier[headers] [ literal[string] ]= literal[string] identifier[response] . identifier[headers] [ literal[s...
def allow_cors(func): """This is a decorator which enable CORS for the specified endpoint.""" def wrapper(*args, **kwargs): response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = 'PUT, GET, POST, DELETE, OPTIONS' response.headers['Access...
def proto_to_dict(message): """Converts protobuf message instance to dict :param message: protobuf message instance :return: parameters and their values :rtype: dict :raises: :class:`.TypeError` if ``message`` is not a proto message """ if not isinstance(message, _ProtoMessageType): ...
def function[proto_to_dict, parameter[message]]: constant[Converts protobuf message instance to dict :param message: protobuf message instance :return: parameters and their values :rtype: dict :raises: :class:`.TypeError` if ``message`` is not a proto message ] if <ast.UnaryOp objec...
keyword[def] identifier[proto_to_dict] ( identifier[message] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[message] , identifier[_ProtoMessageType] ): keyword[raise] identifier[TypeError] ( literal[string] ) identifier[data] ={} keyword[for] identi...
def proto_to_dict(message): """Converts protobuf message instance to dict :param message: protobuf message instance :return: parameters and their values :rtype: dict :raises: :class:`.TypeError` if ``message`` is not a proto message """ if not isinstance(message, _ProtoMessageType): ...
def process(self, request, response, environ): """ Create a new access token. :param request: The incoming :class:`oauth2.web.Request`. :param response: The :class:`oauth2.web.Response` that will be returned to the client. :param environ: A ``dict`` cont...
def function[process, parameter[self, request, response, environ]]: constant[ Create a new access token. :param request: The incoming :class:`oauth2.web.Request`. :param response: The :class:`oauth2.web.Response` that will be returned to the client. :par...
keyword[def] identifier[process] ( identifier[self] , identifier[request] , identifier[response] , identifier[environ] ): literal[string] identifier[token_data] = identifier[self] . identifier[token_generator] . identifier[create_access_token_data] ( identifier[self] . identifier[refresh_grant_type...
def process(self, request, response, environ): """ Create a new access token. :param request: The incoming :class:`oauth2.web.Request`. :param response: The :class:`oauth2.web.Response` that will be returned to the client. :param environ: A ``dict`` containi...
def transform(self, Z): """TODO: rewrite docstring Transform X separately by each transformer, concatenate results. Parameters ---------- X : array-like or sparse matrix, shape (n_samples, n_features) Input data to be transformed. Returns ------- ...
def function[transform, parameter[self, Z]]: constant[TODO: rewrite docstring Transform X separately by each transformer, concatenate results. Parameters ---------- X : array-like or sparse matrix, shape (n_samples, n_features) Input data to be transformed. Re...
keyword[def] identifier[transform] ( identifier[self] , identifier[Z] ): literal[string] keyword[if] identifier[isinstance] ( identifier[Z] , identifier[DictRDD] ): identifier[X] = identifier[Z] [:, literal[string] ] keyword[else] : identifier[X] = identifier[Z] ...
def transform(self, Z): """TODO: rewrite docstring Transform X separately by each transformer, concatenate results. Parameters ---------- X : array-like or sparse matrix, shape (n_samples, n_features) Input data to be transformed. Returns ------- X...
def describe_api_resource(restApiId, path, region=None, key=None, keyid=None, profile=None): ''' Given rest api id, and an absolute resource path, returns the resource id for the given path. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe...
def function[describe_api_resource, parameter[restApiId, path, region, key, keyid, profile]]: constant[ Given rest api id, and an absolute resource path, returns the resource id for the given path. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_resource m...
keyword[def] identifier[describe_api_resource] ( identifier[restApiId] , identifier[path] , identifier[region] = keyword[None] , identifier[key] = keyword[None] , identifier[keyid] = keyword[None] , identifier[profile] = keyword[None] ): literal[string] identifier[r] = identifier[describe_api_resources] (...
def describe_api_resource(restApiId, path, region=None, key=None, keyid=None, profile=None): """ Given rest api id, and an absolute resource path, returns the resource id for the given path. CLI Example: .. code-block:: bash salt myminion boto_apigateway.describe_api_resource myapi_id res...
def start_date(self) -> Optional[datetime.date]: """ Returns the start date of the set of intervals, or ``None`` if empty. """ if not self.intervals: return None return self.start_datetime().date()
def function[start_date, parameter[self]]: constant[ Returns the start date of the set of intervals, or ``None`` if empty. ] if <ast.UnaryOp object at 0x7da1b190e260> begin[:] return[constant[None]] return[call[call[name[self].start_datetime, parameter[]].date, parameter[]]]
keyword[def] identifier[start_date] ( identifier[self] )-> identifier[Optional] [ identifier[datetime] . identifier[date] ]: literal[string] keyword[if] keyword[not] identifier[self] . identifier[intervals] : keyword[return] keyword[None] keyword[return] identifier[self] ...
def start_date(self) -> Optional[datetime.date]: """ Returns the start date of the set of intervals, or ``None`` if empty. """ if not self.intervals: return None # depends on [control=['if'], data=[]] return self.start_datetime().date()
def from_json(json, cutout=None): """ Converts JSON to a python list of RAMON objects. if `cutout` is provided, the `cutout` attribute of the RAMON object is populated. Otherwise, it's left empty. `json` should be an ID-level dictionary, like so: { 16: { type: "segme...
def function[from_json, parameter[json, cutout]]: constant[ Converts JSON to a python list of RAMON objects. if `cutout` is provided, the `cutout` attribute of the RAMON object is populated. Otherwise, it's left empty. `json` should be an ID-level dictionary, like so: { 16: { ...
keyword[def] identifier[from_json] ( identifier[json] , identifier[cutout] = keyword[None] ): literal[string] keyword[if] identifier[type] ( identifier[json] ) keyword[is] identifier[str] : identifier[json] = identifier[jsonlib] . identifier[loads] ( identifier[json] ) identifier[out_ramon...
def from_json(json, cutout=None): """ Converts JSON to a python list of RAMON objects. if `cutout` is provided, the `cutout` attribute of the RAMON object is populated. Otherwise, it's left empty. `json` should be an ID-level dictionary, like so: { 16: { type: "segme...
def trim(self): """Return the just data defined by the PE headers, removing any overlayed data.""" overlay_data_offset = self.get_overlay_data_start_offset() if overlay_data_offset is not None: return self.__data__[ : overlay_data_offset ] return self.__data__[:]
def function[trim, parameter[self]]: constant[Return the just data defined by the PE headers, removing any overlayed data.] variable[overlay_data_offset] assign[=] call[name[self].get_overlay_data_start_offset, parameter[]] if compare[name[overlay_data_offset] is_not constant[None]] begin[:] ...
keyword[def] identifier[trim] ( identifier[self] ): literal[string] identifier[overlay_data_offset] = identifier[self] . identifier[get_overlay_data_start_offset] () keyword[if] identifier[overlay_data_offset] keyword[is] keyword[not] keyword[None] : keyword[return] ide...
def trim(self): """Return the just data defined by the PE headers, removing any overlayed data.""" overlay_data_offset = self.get_overlay_data_start_offset() if overlay_data_offset is not None: return self.__data__[:overlay_data_offset] # depends on [control=['if'], data=['overlay_data_offset']] ...
def _write_data(self, file): """ Writes case data to file in ReStructuredText format. """ self.write_case_data(file) file.write("Bus Data\n") file.write("-" * 8 + "\n") self.write_bus_data(file) file.write("\n") file.write("Branch Data\n") file.w...
def function[_write_data, parameter[self, file]]: constant[ Writes case data to file in ReStructuredText format. ] call[name[self].write_case_data, parameter[name[file]]] call[name[file].write, parameter[constant[Bus Data ]]] call[name[file].write, parameter[binary_operation[bina...
keyword[def] identifier[_write_data] ( identifier[self] , identifier[file] ): literal[string] identifier[self] . identifier[write_case_data] ( identifier[file] ) identifier[file] . identifier[write] ( literal[string] ) identifier[file] . identifier[write] ( literal[string] * lite...
def _write_data(self, file): """ Writes case data to file in ReStructuredText format. """ self.write_case_data(file) file.write('Bus Data\n') file.write('-' * 8 + '\n') self.write_bus_data(file) file.write('\n') file.write('Branch Data\n') file.write('-' * 11 + '\n') self.wri...
def lookup_symbol(self, symbol, as_of_date, fuzzy=False, country_code=None): """Lookup an equity by symbol. Parameters ---------- symbol : str The ticker symbol to resolve. as_of_...
def function[lookup_symbol, parameter[self, symbol, as_of_date, fuzzy, country_code]]: constant[Lookup an equity by symbol. Parameters ---------- symbol : str The ticker symbol to resolve. as_of_date : datetime or None Look up the last owner of this symbo...
keyword[def] identifier[lookup_symbol] ( identifier[self] , identifier[symbol] , identifier[as_of_date] , identifier[fuzzy] = keyword[False] , identifier[country_code] = keyword[None] ): literal[string] keyword[if] identifier[symbol] keyword[is] keyword[None] : keyword[raise] i...
def lookup_symbol(self, symbol, as_of_date, fuzzy=False, country_code=None): """Lookup an equity by symbol. Parameters ---------- symbol : str The ticker symbol to resolve. as_of_date : datetime or None Look up the last owner of this symbol as of this datetim...
def sql_index(self,index_name,column_names,unique=True): """Add a named index on given columns to improve performance.""" if type(column_names) == str: column_names = [column_names] try: if len(column_names) == 0: raise TypeError except TypeError: ...
def function[sql_index, parameter[self, index_name, column_names, unique]]: constant[Add a named index on given columns to improve performance.] if compare[call[name[type], parameter[name[column_names]]] equal[==] name[str]] begin[:] variable[column_names] assign[=] list[[<ast.Name objec...
keyword[def] identifier[sql_index] ( identifier[self] , identifier[index_name] , identifier[column_names] , identifier[unique] = keyword[True] ): literal[string] keyword[if] identifier[type] ( identifier[column_names] )== identifier[str] : identifier[column_names] =[ identifier[column...
def sql_index(self, index_name, column_names, unique=True): """Add a named index on given columns to improve performance.""" if type(column_names) == str: column_names = [column_names] # depends on [control=['if'], data=[]] try: if len(column_names) == 0: raise TypeError # depe...
def from_file(cls, f): """Load vocab from a file. :param (file) f: a file object, e.g. as returned by calling `open` :return: a vocab object. The 0th line of the file is assigned to index 0, and so on... """ word2index = {} counts = Counter() for i, line in enume...
def function[from_file, parameter[cls, f]]: constant[Load vocab from a file. :param (file) f: a file object, e.g. as returned by calling `open` :return: a vocab object. The 0th line of the file is assigned to index 0, and so on... ] variable[word2index] assign[=] dictionary[[], ...
keyword[def] identifier[from_file] ( identifier[cls] , identifier[f] ): literal[string] identifier[word2index] ={} identifier[counts] = identifier[Counter] () keyword[for] identifier[i] , identifier[line] keyword[in] identifier[enumerate] ( identifier[f] ): identif...
def from_file(cls, f): """Load vocab from a file. :param (file) f: a file object, e.g. as returned by calling `open` :return: a vocab object. The 0th line of the file is assigned to index 0, and so on... """ word2index = {} counts = Counter() for (i, line) in enumerate(f): ...
def parseDoc(self, doc_str, format="xml"): """Parse a OAI-ORE Resource Maps document. See Also: ``rdflib.ConjunctiveGraph.parse`` for documentation on arguments. """ self.parse(data=doc_str, format=format) self._ore_initialized = True return self
def function[parseDoc, parameter[self, doc_str, format]]: constant[Parse a OAI-ORE Resource Maps document. See Also: ``rdflib.ConjunctiveGraph.parse`` for documentation on arguments. ] call[name[self].parse, parameter[]] name[self]._ore_initialized assign[=] constant[True] ...
keyword[def] identifier[parseDoc] ( identifier[self] , identifier[doc_str] , identifier[format] = literal[string] ): literal[string] identifier[self] . identifier[parse] ( identifier[data] = identifier[doc_str] , identifier[format] = identifier[format] ) identifier[self] . identifier[_ore_...
def parseDoc(self, doc_str, format='xml'): """Parse a OAI-ORE Resource Maps document. See Also: ``rdflib.ConjunctiveGraph.parse`` for documentation on arguments. """ self.parse(data=doc_str, format=format) self._ore_initialized = True return self
def _decompose_pattern(self, pattern): """ Given a path pattern with format declaration, generates a four-tuple (glob_pattern, regexp pattern, fields, type map) """ sep = '~lancet~sep~' float_codes = ['e','E','f', 'F','g', 'G', 'n'] typecodes = dict([(k,float) for...
def function[_decompose_pattern, parameter[self, pattern]]: constant[ Given a path pattern with format declaration, generates a four-tuple (glob_pattern, regexp pattern, fields, type map) ] variable[sep] assign[=] constant[~lancet~sep~] variable[float_codes] assign[=] lis...
keyword[def] identifier[_decompose_pattern] ( identifier[self] , identifier[pattern] ): literal[string] identifier[sep] = literal[string] identifier[float_codes] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ...
def _decompose_pattern(self, pattern): """ Given a path pattern with format declaration, generates a four-tuple (glob_pattern, regexp pattern, fields, type map) """ sep = '~lancet~sep~' float_codes = ['e', 'E', 'f', 'F', 'g', 'G', 'n'] typecodes = dict([(k, float) for k in float_...
def verify_and_get_components_ids(topic_id, components_ids, component_types, db_conn=None): """Process some verifications of the provided components ids.""" db_conn = db_conn or flask.g.db_conn if len(components_ids) != len(component_types): msg = 'The number of com...
def function[verify_and_get_components_ids, parameter[topic_id, components_ids, component_types, db_conn]]: constant[Process some verifications of the provided components ids.] variable[db_conn] assign[=] <ast.BoolOp object at 0x7da1b0fc6b30> if compare[call[name[len], parameter[name[components_...
keyword[def] identifier[verify_and_get_components_ids] ( identifier[topic_id] , identifier[components_ids] , identifier[component_types] , identifier[db_conn] = keyword[None] ): literal[string] identifier[db_conn] = identifier[db_conn] keyword[or] identifier[flask] . identifier[g] . identifier[db_conn] ...
def verify_and_get_components_ids(topic_id, components_ids, component_types, db_conn=None): """Process some verifications of the provided components ids.""" db_conn = db_conn or flask.g.db_conn if len(components_ids) != len(component_types): msg = 'The number of component ids does not match the numb...
def jsonify_timedelta(value): """Converts a `datetime.timedelta` to an ISO 8601 duration string for JSON-ification. :param value: something to convert :type value: datetime.timedelta :return: the value after conversion :rtype unicode """ assert isinstance(value, datetime.timedelta) ...
def function[jsonify_timedelta, parameter[value]]: constant[Converts a `datetime.timedelta` to an ISO 8601 duration string for JSON-ification. :param value: something to convert :type value: datetime.timedelta :return: the value after conversion :rtype unicode ] assert[call[name[is...
keyword[def] identifier[jsonify_timedelta] ( identifier[value] ): literal[string] keyword[assert] identifier[isinstance] ( identifier[value] , identifier[datetime] . identifier[timedelta] ) identifier[seconds] = identifier[value] . identifier[total_seconds] () identifier[minutes] , identi...
def jsonify_timedelta(value): """Converts a `datetime.timedelta` to an ISO 8601 duration string for JSON-ification. :param value: something to convert :type value: datetime.timedelta :return: the value after conversion :rtype unicode """ assert isinstance(value, datetime.timedelta) ...
def read(self): """ If there is data available to be read from the transport, reads the data and tries to parse it as a protobuf message. If the parsing succeeds, return a protobuf object. Otherwise, returns None. """ if not self.ready_to_read(): return None ...
def function[read, parameter[self]]: constant[ If there is data available to be read from the transport, reads the data and tries to parse it as a protobuf message. If the parsing succeeds, return a protobuf object. Otherwise, returns None. ] if <ast.UnaryOp object at 0x7da1b0e2...
keyword[def] identifier[read] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[ready_to_read] (): keyword[return] keyword[None] identifier[data] = identifier[self] . identifier[_read] () keyword[if] identifier[data] k...
def read(self): """ If there is data available to be read from the transport, reads the data and tries to parse it as a protobuf message. If the parsing succeeds, return a protobuf object. Otherwise, returns None. """ if not self.ready_to_read(): return None # depends on [contr...
def logpt(self, t, xp, x): """PDF of X_t|X_{t-1}=xp""" return self.ssm.PX(t, xp).logpdf(x)
def function[logpt, parameter[self, t, xp, x]]: constant[PDF of X_t|X_{t-1}=xp] return[call[call[name[self].ssm.PX, parameter[name[t], name[xp]]].logpdf, parameter[name[x]]]]
keyword[def] identifier[logpt] ( identifier[self] , identifier[t] , identifier[xp] , identifier[x] ): literal[string] keyword[return] identifier[self] . identifier[ssm] . identifier[PX] ( identifier[t] , identifier[xp] ). identifier[logpdf] ( identifier[x] )
def logpt(self, t, xp, x): """PDF of X_t|X_{t-1}=xp""" return self.ssm.PX(t, xp).logpdf(x)
def scheduleNextHeartbeat(self, nextRun): """ Schedules the next ping. :param nextRun: when we should run next. :param serverURL: the URL to ping. :return: """ import threading from datetime import datetime tilNextTime = max(nextRun - datetime.utcn...
def function[scheduleNextHeartbeat, parameter[self, nextRun]]: constant[ Schedules the next ping. :param nextRun: when we should run next. :param serverURL: the URL to ping. :return: ] import module[threading] from relative_module[datetime] import module[datetime]...
keyword[def] identifier[scheduleNextHeartbeat] ( identifier[self] , identifier[nextRun] ): literal[string] keyword[import] identifier[threading] keyword[from] identifier[datetime] keyword[import] identifier[datetime] identifier[tilNextTime] = identifier[max] ( identifier[nex...
def scheduleNextHeartbeat(self, nextRun): """ Schedules the next ping. :param nextRun: when we should run next. :param serverURL: the URL to ping. :return: """ import threading from datetime import datetime tilNextTime = max(nextRun - datetime.utcnow().timestamp()...
def opts(self, dictobj): """ Add or update options """ for k in dictobj: self.chart_opts[k] = dictobj[k]
def function[opts, parameter[self, dictobj]]: constant[ Add or update options ] for taget[name[k]] in starred[name[dictobj]] begin[:] call[name[self].chart_opts][name[k]] assign[=] call[name[dictobj]][name[k]]
keyword[def] identifier[opts] ( identifier[self] , identifier[dictobj] ): literal[string] keyword[for] identifier[k] keyword[in] identifier[dictobj] : identifier[self] . identifier[chart_opts] [ identifier[k] ]= identifier[dictobj] [ identifier[k] ]
def opts(self, dictobj): """ Add or update options """ for k in dictobj: self.chart_opts[k] = dictobj[k] # depends on [control=['for'], data=['k']]
def _check_error(response): """Raises an exception if the Spark Cloud returned an error.""" if (not response.ok) or (response.status_code != 200): raise Exception( response.json()['error'] + ': ' + response.json()['error_description'] )
def function[_check_error, parameter[response]]: constant[Raises an exception if the Spark Cloud returned an error.] if <ast.BoolOp object at 0x7da2044c2fe0> begin[:] <ast.Raise object at 0x7da2044c0310>
keyword[def] identifier[_check_error] ( identifier[response] ): literal[string] keyword[if] ( keyword[not] identifier[response] . identifier[ok] ) keyword[or] ( identifier[response] . identifier[status_code] != literal[int] ): keyword[raise] identifier[Exception] ( ident...
def _check_error(response): """Raises an exception if the Spark Cloud returned an error.""" if not response.ok or response.status_code != 200: raise Exception(response.json()['error'] + ': ' + response.json()['error_description']) # depends on [control=['if'], data=[]]
def load_sampleset(self, f, name): '''Read the sampleset from using the HDF5 format. Name is usually in {train, test}.''' self.encoder_x = np.array(f[name + '_encoder_x']) self.decoder_x = np.array(f[name + '_decoder_x']) self.decoder_y = np.array(f[name + '_decoder_y'])
def function[load_sampleset, parameter[self, f, name]]: constant[Read the sampleset from using the HDF5 format. Name is usually in {train, test}.] name[self].encoder_x assign[=] call[name[np].array, parameter[call[name[f]][binary_operation[name[name] + constant[_encoder_x]]]]] name[self].decoder...
keyword[def] identifier[load_sampleset] ( identifier[self] , identifier[f] , identifier[name] ): literal[string] identifier[self] . identifier[encoder_x] = identifier[np] . identifier[array] ( identifier[f] [ identifier[name] + literal[string] ]) identifier[self] . identifier[decoder_x] = ...
def load_sampleset(self, f, name): """Read the sampleset from using the HDF5 format. Name is usually in {train, test}.""" self.encoder_x = np.array(f[name + '_encoder_x']) self.decoder_x = np.array(f[name + '_decoder_x']) self.decoder_y = np.array(f[name + '_decoder_y'])
def links(self): """ Include a self link. """ links = Links() links["self"] = Link.for_( self._operation, self._ns, qs=self._page.to_items(), **self._context ) return links
def function[links, parameter[self]]: constant[ Include a self link. ] variable[links] assign[=] call[name[Links], parameter[]] call[name[links]][constant[self]] assign[=] call[name[Link].for_, parameter[name[self]._operation, name[self]._ns]] return[name[links]]
keyword[def] identifier[links] ( identifier[self] ): literal[string] identifier[links] = identifier[Links] () identifier[links] [ literal[string] ]= identifier[Link] . identifier[for_] ( identifier[self] . identifier[_operation] , identifier[self] . identifier[_ns] , ...
def links(self): """ Include a self link. """ links = Links() links['self'] = Link.for_(self._operation, self._ns, qs=self._page.to_items(), **self._context) return links
def heartbeat(self): ''' Check the heartbeat of the ordering API Args: None Returns: True or False ''' url = '%s/heartbeat' % self.base_url # Auth is not required to hit the heartbeat r = requests.get(url) try: return r.json() == "...
def function[heartbeat, parameter[self]]: constant[ Check the heartbeat of the ordering API Args: None Returns: True or False ] variable[url] assign[=] binary_operation[constant[%s/heartbeat] <ast.Mod object at 0x7da2590d6920> name[self].base_url] variable[r] a...
keyword[def] identifier[heartbeat] ( identifier[self] ): literal[string] identifier[url] = literal[string] % identifier[self] . identifier[base_url] identifier[r] = identifier[requests] . identifier[get] ( identifier[url] ) keyword[try] : keyword[return] i...
def heartbeat(self): """ Check the heartbeat of the ordering API Args: None Returns: True or False """ url = '%s/heartbeat' % self.base_url # Auth is not required to hit the heartbeat r = requests.get(url) try: return r.json() == 'ok' # depends on [control...
def generate_rfc3339(d, local_tz=True): """ generate rfc3339 time format input : d = date type local_tz = use local time zone if true, otherwise mark as utc output : rfc3339 string date format. ex : `2008-04-02T20:00:00+07:00` """ try: if local_tz: d = dateti...
def function[generate_rfc3339, parameter[d, local_tz]]: constant[ generate rfc3339 time format input : d = date type local_tz = use local time zone if true, otherwise mark as utc output : rfc3339 string date format. ex : `2008-04-02T20:00:00+07:00` ] <ast.Try object at 0x7da...
keyword[def] identifier[generate_rfc3339] ( identifier[d] , identifier[local_tz] = keyword[True] ): literal[string] keyword[try] : keyword[if] identifier[local_tz] : identifier[d] = identifier[datetime] . identifier[datetime] . identifier[fromtimestamp] ( identifier[d] ) key...
def generate_rfc3339(d, local_tz=True): """ generate rfc3339 time format input : d = date type local_tz = use local time zone if true, otherwise mark as utc output : rfc3339 string date format. ex : `2008-04-02T20:00:00+07:00` """ try: if local_tz: d = dateti...
def start(self): """ Creates and starts the local API Gateway service. This method will block until the service is stopped manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint to invoke the Lambda function and receive a response. ...
def function[start, parameter[self]]: constant[ Creates and starts the local API Gateway service. This method will block until the service is stopped manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint to invoke the Lambda function an...
keyword[def] identifier[start] ( identifier[self] ): literal[string] identifier[routing_list] = identifier[self] . identifier[_make_routing_list] ( identifier[self] . identifier[api_provider] ) keyword[if] keyword[not] identifier[routing_list] : keyword[raise] identifier[...
def start(self): """ Creates and starts the local API Gateway service. This method will block until the service is stopped manually using an interrupt. After the service is started, callers can make HTTP requests to the endpoint to invoke the Lambda function and receive a response. ...
def _ReadPaddingDataTypeDefinition( self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a padding data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str,...
def function[_ReadPaddingDataTypeDefinition, parameter[self, definitions_registry, definition_values, definition_name, is_member]]: constant[Reads a padding data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_value...
keyword[def] identifier[_ReadPaddingDataTypeDefinition] ( identifier[self] , identifier[definitions_registry] , identifier[definition_values] , identifier[definition_name] , identifier[is_member] = keyword[False] ): literal[string] keyword[if] keyword[not] identifier[is_member] : identifier[erro...
def _ReadPaddingDataTypeDefinition(self, definitions_registry, definition_values, definition_name, is_member=False): """Reads a padding data type definition. Args: definitions_registry (DataTypeDefinitionsRegistry): data type definitions registry. definition_values (dict[str, object]): de...