code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def fetch(self, select=None, include=None): """ 从服务器获取当前对象所有的值,如果与本地值不同,将会覆盖本地的值。 :return: 当前对象 """ data = {} if select: if not isinstance(select, (list, tuple)): raise TypeError('select parameter must be a list or a tuple') data['...
def function[fetch, parameter[self, select, include]]: constant[ 从服务器获取当前对象所有的值,如果与本地值不同,将会覆盖本地的值。 :return: 当前对象 ] variable[data] assign[=] dictionary[[], []] if name[select] begin[:] if <ast.UnaryOp object at 0x7da1b0efb0a0> begin[:] <ast.Rai...
keyword[def] identifier[fetch] ( identifier[self] , identifier[select] = keyword[None] , identifier[include] = keyword[None] ): literal[string] identifier[data] ={} keyword[if] identifier[select] : keyword[if] keyword[not] identifier[isinstance] ( identifier[select] ,( iden...
def fetch(self, select=None, include=None): """ 从服务器获取当前对象所有的值,如果与本地值不同,将会覆盖本地的值。 :return: 当前对象 """ data = {} if select: if not isinstance(select, (list, tuple)): raise TypeError('select parameter must be a list or a tuple') # depends on [control=['if'], data=[]...
def unify_partitions(self): """For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children. """ partitions = self.collect_segment_partitions() # For each group, copy the segment partitions to the parent partitions,...
def function[unify_partitions, parameter[self]]: constant[For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children. ] variable[partitions] assign[=] call[name[self].collect_segment_partitions, parameter[]] with ca...
keyword[def] identifier[unify_partitions] ( identifier[self] ): literal[string] identifier[partitions] = identifier[self] . identifier[collect_segment_partitions] () keyword[with] identifier[self] . identifier[progress] . identifier[start] ( literal[string] , literal[...
def unify_partitions(self): """For all of the segments for a partition, create the parent partition, combine the children into the parent, and delete the children. """ partitions = self.collect_segment_partitions() # For each group, copy the segment partitions to the parent partitions, then # de...
def _update_table_names(name, dat): """ Model placement is subject to change. That means all names within the model (names are path-dependent) are also subject to change. Whichever name is decided, the inner data needs to match it. :param dict dat: Metadata :param str name: Table name :return d...
def function[_update_table_names, parameter[name, dat]]: constant[ Model placement is subject to change. That means all names within the model (names are path-dependent) are also subject to change. Whichever name is decided, the inner data needs to match it. :param dict dat: Metadata :param str...
keyword[def] identifier[_update_table_names] ( identifier[name] , identifier[dat] ): literal[string] keyword[for] identifier[_tabletype] keyword[in] [ literal[string] , literal[string] , literal[string] ]: identifier[_ttname] = literal[string] . identifier[format] ( identifier[_tabletype] ) ...
def _update_table_names(name, dat): """ Model placement is subject to change. That means all names within the model (names are path-dependent) are also subject to change. Whichever name is decided, the inner data needs to match it. :param dict dat: Metadata :param str name: Table name :return d...
def request_data(cls, time, site_id, derived=False): """Retreive IGRA version 2 data for one station. Parameters -------- site_id : str 11-character IGRA2 station identifier. time : datetime The date and time of the desired observation. If list of two tim...
def function[request_data, parameter[cls, time, site_id, derived]]: constant[Retreive IGRA version 2 data for one station. Parameters -------- site_id : str 11-character IGRA2 station identifier. time : datetime The date and time of the desired observatio...
keyword[def] identifier[request_data] ( identifier[cls] , identifier[time] , identifier[site_id] , identifier[derived] = keyword[False] ): literal[string] identifier[igra2] = identifier[cls] () keyword[if] identifier[derived] : identifier[igra2] . identifier[ftpsite...
def request_data(cls, time, site_id, derived=False): """Retreive IGRA version 2 data for one station. Parameters -------- site_id : str 11-character IGRA2 station identifier. time : datetime The date and time of the desired observation. If list of two times i...
def get(args): """ Get a river by name. """ m = RiverManager(args.hosts) r = m.get(args.name) if r: print(json.dumps(r, indent=2)) else: sys.exit(1)
def function[get, parameter[args]]: constant[ Get a river by name. ] variable[m] assign[=] call[name[RiverManager], parameter[name[args].hosts]] variable[r] assign[=] call[name[m].get, parameter[name[args].name]] if name[r] begin[:] call[name[print], parameter[cal...
keyword[def] identifier[get] ( identifier[args] ): literal[string] identifier[m] = identifier[RiverManager] ( identifier[args] . identifier[hosts] ) identifier[r] = identifier[m] . identifier[get] ( identifier[args] . identifier[name] ) keyword[if] identifier[r] : identifier[print] ( id...
def get(args): """ Get a river by name. """ m = RiverManager(args.hosts) r = m.get(args.name) if r: print(json.dumps(r, indent=2)) # depends on [control=['if'], data=[]] else: sys.exit(1)
def validate(): """ Validate that the currently installed version of spaCy is compatible with the installed models. Should be run after `pip install -U spacy`. """ msg = Printer() with msg.loading("Loading compatibility table..."): r = requests.get(about.__compatibility__) if r.s...
def function[validate, parameter[]]: constant[ Validate that the currently installed version of spaCy is compatible with the installed models. Should be run after `pip install -U spacy`. ] variable[msg] assign[=] call[name[Printer], parameter[]] with call[name[msg].loading, parameter...
keyword[def] identifier[validate] (): literal[string] identifier[msg] = identifier[Printer] () keyword[with] identifier[msg] . identifier[loading] ( literal[string] ): identifier[r] = identifier[requests] . identifier[get] ( identifier[about] . identifier[__compatibility__] ) keywor...
def validate(): """ Validate that the currently installed version of spaCy is compatible with the installed models. Should be run after `pip install -U spacy`. """ msg = Printer() with msg.loading('Loading compatibility table...'): r = requests.get(about.__compatibility__) if r.s...
def parse_options(arguments): """Parse command line arguments. The parsing logic is fairly simple. It can only parse long-style parameters of the form:: --key value Several parameters can be defined in the environment and will be used unless explicitly overridden with command-line argument...
def function[parse_options, parameter[arguments]]: constant[Parse command line arguments. The parsing logic is fairly simple. It can only parse long-style parameters of the form:: --key value Several parameters can be defined in the environment and will be used unless explicitly overri...
keyword[def] identifier[parse_options] ( identifier[arguments] ): literal[string] identifier[arguments] = identifier[arguments] [ literal[int] :] identifier[options] ={} keyword[while] identifier[arguments] : identifier[key] = identifier[arguments] . identifier[pop] ( literal[int] ) ...
def parse_options(arguments): """Parse command line arguments. The parsing logic is fairly simple. It can only parse long-style parameters of the form:: --key value Several parameters can be defined in the environment and will be used unless explicitly overridden with command-line argument...
def _closeCompletion(self): """Close completion, if visible. Delete widget """ if self._widget is not None: self._widget.close() self._widget = None self._completionOpenedManually = False
def function[_closeCompletion, parameter[self]]: constant[Close completion, if visible. Delete widget ] if compare[name[self]._widget is_not constant[None]] begin[:] call[name[self]._widget.close, parameter[]] name[self]._widget assign[=] constant[None] ...
keyword[def] identifier[_closeCompletion] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[_widget] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[_widget] . identifier[close] () identifier[self] . identifier[_widg...
def _closeCompletion(self): """Close completion, if visible. Delete widget """ if self._widget is not None: self._widget.close() self._widget = None self._completionOpenedManually = False # depends on [control=['if'], data=[]]
def read_times(self, filename=None): """ Read true time step data from individual time steps. Returns ------- steps : array The time steps. times : array The times of the time steps. nts : array The normalized times of the time...
def function[read_times, parameter[self, filename]]: constant[ Read true time step data from individual time steps. Returns ------- steps : array The time steps. times : array The times of the time steps. nts : array The normal...
keyword[def] identifier[read_times] ( identifier[self] , identifier[filename] = keyword[None] ): literal[string] identifier[aux] = identifier[nm] . identifier[array] ([], identifier[dtype] = identifier[nm] . identifier[float64] ) keyword[return] identifier[aux] . identifier[astype] ( iden...
def read_times(self, filename=None): """ Read true time step data from individual time steps. Returns ------- steps : array The time steps. times : array The times of the time steps. nts : array The normalized times of the time ste...
def compute_stats(array, stats, weights): """ :param array: an array of R elements (which can be arrays) :param stats: a sequence of S statistic functions :param weights: a list of R weights :returns: an array of S elements (which can be arrays) """ result = n...
def function[compute_stats, parameter[array, stats, weights]]: constant[ :param array: an array of R elements (which can be arrays) :param stats: a sequence of S statistic functions :param weights: a list of R weights :returns: an array of S elements (which can be...
keyword[def] identifier[compute_stats] ( identifier[array] , identifier[stats] , identifier[weights] ): literal[string] identifier[result] = identifier[numpy] . identifier[zeros] (( identifier[len] ( identifier[stats] ),)+ identifier[array] . identifier[shape] [ literal[int] :], identifier[array] . identif...
def compute_stats(array, stats, weights): """ :param array: an array of R elements (which can be arrays) :param stats: a sequence of S statistic functions :param weights: a list of R weights :returns: an array of S elements (which can be arrays) """ result = n...
def plat_specific_errors(*errnames): """Return error numbers for all errors in errnames on this platform. The 'errno' module contains different global constants depending on the specific platform (OS). This function will return the list of numeric values for a given list of potential names. """ ...
def function[plat_specific_errors, parameter[]]: constant[Return error numbers for all errors in errnames on this platform. The 'errno' module contains different global constants depending on the specific platform (OS). This function will return the list of numeric values for a given list of potent...
keyword[def] identifier[plat_specific_errors] (* identifier[errnames] ): literal[string] identifier[missing_attr] = identifier[set] ([ keyword[None] ,]) identifier[unique_nums] = identifier[set] ( identifier[getattr] ( identifier[errno] , identifier[k] , keyword[None] ) keyword[for] identifier[k] ke...
def plat_specific_errors(*errnames): """Return error numbers for all errors in errnames on this platform. The 'errno' module contains different global constants depending on the specific platform (OS). This function will return the list of numeric values for a given list of potential names. """ ...
def execute(self, time_interval): """ Execute the factor over the given time interval :param time_interval: :return: """ logging.info('{} with sink node {} running from {} to {}'.format( self.tool.__class__.__name__, self.sink.node_id, time_interval.start, ti...
def function[execute, parameter[self, time_interval]]: constant[ Execute the factor over the given time interval :param time_interval: :return: ] call[name[logging].info, parameter[call[constant[{} with sink node {} running from {} to {}].format, parameter[name[self].too...
keyword[def] identifier[execute] ( identifier[self] , identifier[time_interval] ): literal[string] identifier[logging] . identifier[info] ( literal[string] . identifier[format] ( identifier[self] . identifier[tool] . identifier[__class__] . identifier[__name__] , identifier[self] . identif...
def execute(self, time_interval): """ Execute the factor over the given time interval :param time_interval: :return: """ logging.info('{} with sink node {} running from {} to {}'.format(self.tool.__class__.__name__, self.sink.node_id, time_interval.start, time_interval.end)) ...
def add_review_date(self, doc, reviewed): """Sets the review date. Raises CardinalityError if already set. OrderError if no reviewer defined before. Raises SPDXValueError if invalid reviewed value. """ if len(doc.reviews) != 0: if not self.review_date_set: ...
def function[add_review_date, parameter[self, doc, reviewed]]: constant[Sets the review date. Raises CardinalityError if already set. OrderError if no reviewer defined before. Raises SPDXValueError if invalid reviewed value. ] if compare[call[name[len], parameter[name[doc].review...
keyword[def] identifier[add_review_date] ( identifier[self] , identifier[doc] , identifier[reviewed] ): literal[string] keyword[if] identifier[len] ( identifier[doc] . identifier[reviews] )!= literal[int] : keyword[if] keyword[not] identifier[self] . identifier[review_date_set] : ...
def add_review_date(self, doc, reviewed): """Sets the review date. Raises CardinalityError if already set. OrderError if no reviewer defined before. Raises SPDXValueError if invalid reviewed value. """ if len(doc.reviews) != 0: if not self.review_date_set: self.review...
def current_version(): """ Get the current version number from setup.py """ # Monkeypatch setuptools.setup so we get the verison number import setuptools version = [None] def monkey_setup(**settings): version[0] = settings['version'] old_setup = setuptools.setup setuptools...
def function[current_version, parameter[]]: constant[ Get the current version number from setup.py ] import module[setuptools] variable[version] assign[=] list[[<ast.Constant object at 0x7da2054a6f20>]] def function[monkey_setup, parameter[]]: call[name[version]][cons...
keyword[def] identifier[current_version] (): literal[string] keyword[import] identifier[setuptools] identifier[version] =[ keyword[None] ] keyword[def] identifier[monkey_setup] (** identifier[settings] ): identifier[version] [ literal[int] ]= identifier[settings] [ literal[stri...
def current_version(): """ Get the current version number from setup.py """ # Monkeypatch setuptools.setup so we get the verison number import setuptools version = [None] def monkey_setup(**settings): version[0] = settings['version'] old_setup = setuptools.setup setuptools.s...
def get_topclasses(cls): """Gets the base classes that are in pycbc.""" bases = [c for c in inspect.getmro(cls) if c.__module__.startswith('pycbc') and c != cls] return ', '.join(['{}.{}'.format(c.__module__, c.__name__) for c in bases])
def function[get_topclasses, parameter[cls]]: constant[Gets the base classes that are in pycbc.] variable[bases] assign[=] <ast.ListComp object at 0x7da20c990fd0> return[call[constant[, ].join, parameter[<ast.ListComp object at 0x7da207f00580>]]]
keyword[def] identifier[get_topclasses] ( identifier[cls] ): literal[string] identifier[bases] =[ identifier[c] keyword[for] identifier[c] keyword[in] identifier[inspect] . identifier[getmro] ( identifier[cls] ) keyword[if] identifier[c] . identifier[__module__] . identifier[startswith] ( literal...
def get_topclasses(cls): """Gets the base classes that are in pycbc.""" bases = [c for c in inspect.getmro(cls) if c.__module__.startswith('pycbc') and c != cls] return ', '.join(['{}.{}'.format(c.__module__, c.__name__) for c in bases])
def get_result(api, trans_id, id_get): ''' Check if the given id_get and trans_id is from a valid transaction. ''' check_values = {'api': api, 'id_get': id_get, 'trans_id': trans_id} check_transaction = requests.post(CHECK_URL_FINAL, data=check_values) result = check_transaction.text if res...
def function[get_result, parameter[api, trans_id, id_get]]: constant[ Check if the given id_get and trans_id is from a valid transaction. ] variable[check_values] assign[=] dictionary[[<ast.Constant object at 0x7da18dc04fd0>, <ast.Constant object at 0x7da18dc04670>, <ast.Constant object at 0x7da...
keyword[def] identifier[get_result] ( identifier[api] , identifier[trans_id] , identifier[id_get] ): literal[string] identifier[check_values] ={ literal[string] : identifier[api] , literal[string] : identifier[id_get] , literal[string] : identifier[trans_id] } identifier[check_transaction] = identifi...
def get_result(api, trans_id, id_get): """ Check if the given id_get and trans_id is from a valid transaction. """ check_values = {'api': api, 'id_get': id_get, 'trans_id': trans_id} check_transaction = requests.post(CHECK_URL_FINAL, data=check_values) result = check_transaction.text if resu...
def eval(self, text): """Respond to text entered by the user. :param text: the user's input """ program = Program(text, echo=self.echo, transforms=self.transforms) tokens = program.gen_tokens() for sentence in program.gen_sentences(tokens, self.aliases): if s...
def function[eval, parameter[self, text]]: constant[Respond to text entered by the user. :param text: the user's input ] variable[program] assign[=] call[name[Program], parameter[name[text]]] variable[tokens] assign[=] call[name[program].gen_tokens, parameter[]] for tage...
keyword[def] identifier[eval] ( identifier[self] , identifier[text] ): literal[string] identifier[program] = identifier[Program] ( identifier[text] , identifier[echo] = identifier[self] . identifier[echo] , identifier[transforms] = identifier[self] . identifier[transforms] ) identifier[tok...
def eval(self, text): """Respond to text entered by the user. :param text: the user's input """ program = Program(text, echo=self.echo, transforms=self.transforms) tokens = program.gen_tokens() for sentence in program.gen_sentences(tokens, self.aliases): if self.echo: ...
def from_windows_handle(std_handle): """ Use the Windows Console Handles API to get the console width, where ``std_handle`` is the WINAPI ``GetStdHandle`` input (e.g. STD_INPUT_HANDLE). https://msdn.microsoft.com/library/windows/desktop/ms682075 """ from ctypes i...
def function[from_windows_handle, parameter[std_handle]]: constant[ Use the Windows Console Handles API to get the console width, where ``std_handle`` is the WINAPI ``GetStdHandle`` input (e.g. STD_INPUT_HANDLE). https://msdn.microsoft.com/library/windows/desktop/ms682075 ...
keyword[def] identifier[from_windows_handle] ( identifier[std_handle] ): literal[string] keyword[from] identifier[ctypes] keyword[import] identifier[windll] , identifier[c_ushort] identifier[handle] = identifier[windll] . identifier[kernel32] . identifier[GetStdHandle] ( ident...
def from_windows_handle(std_handle): """ Use the Windows Console Handles API to get the console width, where ``std_handle`` is the WINAPI ``GetStdHandle`` input (e.g. STD_INPUT_HANDLE). https://msdn.microsoft.com/library/windows/desktop/ms682075 """ from ctypes import wi...
def supply_and_demand( lcm, choosers, alternatives, alt_segmenter, price_col, base_multiplier=None, clip_change_low=0.75, clip_change_high=1.25, iterations=5, multiplier_func=None): """ Adjust real estate prices to compensate for supply and demand effects. Parameters ---------- ...
def function[supply_and_demand, parameter[lcm, choosers, alternatives, alt_segmenter, price_col, base_multiplier, clip_change_low, clip_change_high, iterations, multiplier_func]]: constant[ Adjust real estate prices to compensate for supply and demand effects. Parameters ---------- lcm : Locati...
keyword[def] identifier[supply_and_demand] ( identifier[lcm] , identifier[choosers] , identifier[alternatives] , identifier[alt_segmenter] , identifier[price_col] , identifier[base_multiplier] = keyword[None] , identifier[clip_change_low] = literal[int] , identifier[clip_change_high] = literal[int] , identifier[it...
def supply_and_demand(lcm, choosers, alternatives, alt_segmenter, price_col, base_multiplier=None, clip_change_low=0.75, clip_change_high=1.25, iterations=5, multiplier_func=None): """ Adjust real estate prices to compensate for supply and demand effects. Parameters ---------- lcm : LocationChoiceM...
def inflate(self): """Load the collection from the server, if necessary.""" if not self._is_inflated: self.check_version() for k, v in self._filter.items(): if '[' in v: self._filter[k] = ast.literal_eval(v) self.load(self.client.ge...
def function[inflate, parameter[self]]: constant[Load the collection from the server, if necessary.] if <ast.UnaryOp object at 0x7da1b2344b80> begin[:] call[name[self].check_version, parameter[]] for taget[tuple[[<ast.Name object at 0x7da1b2344730>, <ast.Name object at 0x...
keyword[def] identifier[inflate] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_is_inflated] : identifier[self] . identifier[check_version] () keyword[for] identifier[k] , identifier[v] keyword[in] identifier[self] . iden...
def inflate(self): """Load the collection from the server, if necessary.""" if not self._is_inflated: self.check_version() for (k, v) in self._filter.items(): if '[' in v: self._filter[k] = ast.literal_eval(v) # depends on [control=['if'], data=['v']] # depends on [...
def _action_allowed(self, action): """ participation actions can be disabled on layer level, or disabled on a per node basis """ if getattr(self.layer.participation_settings, '{0}_allowed'.format(action)) is False: return False else: return getattr(self.participation_settings, '{0}_a...
def function[_action_allowed, parameter[self, action]]: constant[ participation actions can be disabled on layer level, or disabled on a per node basis ] if compare[call[name[getattr], parameter[name[self].layer.participation_settings, call[constant[{0}_allowed].format, parameter[name[action]]]]...
keyword[def] identifier[_action_allowed] ( identifier[self] , identifier[action] ): literal[string] keyword[if] identifier[getattr] ( identifier[self] . identifier[layer] . identifier[participation_settings] , literal[string] . identifier[format] ( identifier[action] )) keyword[is] keyword[False] : ...
def _action_allowed(self, action): """ participation actions can be disabled on layer level, or disabled on a per node basis """ if getattr(self.layer.participation_settings, '{0}_allowed'.format(action)) is False: return False # depends on [control=['if'], data=[]] else: return get...
def optimise_newton(x, a, c, tolerance=0.001): """ Optimise value of x using newton gauss """ x_new = x x_old = x-1 # dummy value while np.abs(x_new - x_old).sum() > tolerance: x_old = x_new x_new = newton_update(x_old, a, c) return x_new
def function[optimise_newton, parameter[x, a, c, tolerance]]: constant[ Optimise value of x using newton gauss ] variable[x_new] assign[=] name[x] variable[x_old] assign[=] binary_operation[name[x] - constant[1]] while compare[call[call[name[np].abs, parameter[binary_operation[na...
keyword[def] identifier[optimise_newton] ( identifier[x] , identifier[a] , identifier[c] , identifier[tolerance] = literal[int] ): literal[string] identifier[x_new] = identifier[x] identifier[x_old] = identifier[x] - literal[int] keyword[while] identifier[np] . identifier[abs] ( identifier[x_n...
def optimise_newton(x, a, c, tolerance=0.001): """ Optimise value of x using newton gauss """ x_new = x x_old = x - 1 # dummy value while np.abs(x_new - x_old).sum() > tolerance: x_old = x_new x_new = newton_update(x_old, a, c) # depends on [control=['while'], data=[]] retu...
def insert_model(self, model, *, upsert=None): """Inserts a record for the given model. If model's primary key is auto, the primary key will be set appropriately. """ pkname = model.primary_key_name include_keys = set(model.attrs.keys()).difference(model.exclude_keys_sql) if model.primary_key_...
def function[insert_model, parameter[self, model]]: constant[Inserts a record for the given model. If model's primary key is auto, the primary key will be set appropriately. ] variable[pkname] assign[=] name[model].primary_key_name variable[include_keys] assign[=] call[call[name[set], p...
keyword[def] identifier[insert_model] ( identifier[self] , identifier[model] ,*, identifier[upsert] = keyword[None] ): literal[string] identifier[pkname] = identifier[model] . identifier[primary_key_name] identifier[include_keys] = identifier[set] ( identifier[model] . identifier[attrs] . identifier[...
def insert_model(self, model, *, upsert=None): """Inserts a record for the given model. If model's primary key is auto, the primary key will be set appropriately. """ pkname = model.primary_key_name include_keys = set(model.attrs.keys()).difference(model.exclude_keys_sql) if model.primary_key_i...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the SignatureVerify response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, support...
def function[read, parameter[self, input_stream, kmip_version]]: constant[ Read the data encoding the SignatureVerify response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, support...
keyword[def] identifier[read] ( identifier[self] , identifier[input_stream] , identifier[kmip_version] = identifier[enums] . identifier[KMIPVersion] . identifier[KMIP_1_0] ): literal[string] identifier[super] ( identifier[SignatureVerifyResponsePayload] , identifier[self] ). identifier[read] ( ...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the SignatureVerify response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting ...
def stem(self, word): """ Stem an Arabic word and return the stemmed form. :param word: string :return: string """ # set initial values self.is_verb = True self.is_noun = True self.is_defined = False self.suffix_verb_step2a_success = Fals...
def function[stem, parameter[self, word]]: constant[ Stem an Arabic word and return the stemmed form. :param word: string :return: string ] name[self].is_verb assign[=] constant[True] name[self].is_noun assign[=] constant[True] name[self].is_defined assig...
keyword[def] identifier[stem] ( identifier[self] , identifier[word] ): literal[string] identifier[self] . identifier[is_verb] = keyword[True] identifier[self] . identifier[is_noun] = keyword[True] identifier[self] . identifier[is_defined] = keyword[False] ide...
def stem(self, word): """ Stem an Arabic word and return the stemmed form. :param word: string :return: string """ # set initial values self.is_verb = True self.is_noun = True self.is_defined = False self.suffix_verb_step2a_success = False self.suffix_verb_st...
def merge_ordered(left, right, on=None, left_on=None, right_on=None, left_by=None, right_by=None, fill_method=None, suffixes=('_x', '_y'), how='outer'): """Perform merge with optional filling/interpolation designed for ordered data like tim...
def function[merge_ordered, parameter[left, right, on, left_on, right_on, left_by, right_by, fill_method, suffixes, how]]: constant[Perform merge with optional filling/interpolation designed for ordered data like time series data. Optionally perform group-wise merge (see examples) Parameters --...
keyword[def] identifier[merge_ordered] ( identifier[left] , identifier[right] , identifier[on] = keyword[None] , identifier[left_on] = keyword[None] , identifier[right_on] = keyword[None] , identifier[left_by] = keyword[None] , identifier[right_by] = keyword[None] , identifier[fill_method] = keyword[None] , identi...
def merge_ordered(left, right, on=None, left_on=None, right_on=None, left_by=None, right_by=None, fill_method=None, suffixes=('_x', '_y'), how='outer'): """Perform merge with optional filling/interpolation designed for ordered data like time series data. Optionally perform group-wise merge (see examples) ...
def scale_and_center(mol): """Center and Scale molecule 2D coordinates. This method changes mol coordinates directly to center but not scale. This method returns width, height and MLB(median length of bond) and scaling will be done by drawer method with these values. Returns: width: float ...
def function[scale_and_center, parameter[mol]]: constant[Center and Scale molecule 2D coordinates. This method changes mol coordinates directly to center but not scale. This method returns width, height and MLB(median length of bond) and scaling will be done by drawer method with these values. ...
keyword[def] identifier[scale_and_center] ( identifier[mol] ): literal[string] identifier[cnt] = identifier[mol] . identifier[atom_count] () keyword[if] identifier[cnt] < literal[int] : identifier[mol] . identifier[size2d] =( literal[int] , literal[int] , literal[int] ) identifier[m...
def scale_and_center(mol): """Center and Scale molecule 2D coordinates. This method changes mol coordinates directly to center but not scale. This method returns width, height and MLB(median length of bond) and scaling will be done by drawer method with these values. Returns: width: float ...
def _iso_name_and_parent_from_path(self, iso_path): # type: (bytes) -> Tuple[bytes, dr.DirectoryRecord] ''' An internal method to find the parent directory record and name given an ISO path. If the parent is found, return a tuple containing the basename of the path and the paren...
def function[_iso_name_and_parent_from_path, parameter[self, iso_path]]: constant[ An internal method to find the parent directory record and name given an ISO path. If the parent is found, return a tuple containing the basename of the path and the parent directory record object. ...
keyword[def] identifier[_iso_name_and_parent_from_path] ( identifier[self] , identifier[iso_path] ): literal[string] identifier[splitpath] = identifier[utils] . identifier[split_path] ( identifier[iso_path] ) identifier[name] = identifier[splitpath] . identifier[pop] () identif...
def _iso_name_and_parent_from_path(self, iso_path): # type: (bytes) -> Tuple[bytes, dr.DirectoryRecord] '\n An internal method to find the parent directory record and name given an\n ISO path. If the parent is found, return a tuple containing the\n basename of the path and the parent direc...
def _assert_command_dict(self, struct, name, path=None, extra_info=None): """Checks whether struct is a command dict (e.g. it's a dict and has 1 key-value pair.""" self._assert_dict(struct, name, path, extra_info) if len(struct) != 1: err = [self._format_error_path(path + [name])] ...
def function[_assert_command_dict, parameter[self, struct, name, path, extra_info]]: constant[Checks whether struct is a command dict (e.g. it's a dict and has 1 key-value pair.] call[name[self]._assert_dict, parameter[name[struct], name[name], name[path], name[extra_info]]] if compare[call[name...
keyword[def] identifier[_assert_command_dict] ( identifier[self] , identifier[struct] , identifier[name] , identifier[path] = keyword[None] , identifier[extra_info] = keyword[None] ): literal[string] identifier[self] . identifier[_assert_dict] ( identifier[struct] , identifier[name] , identifier[pa...
def _assert_command_dict(self, struct, name, path=None, extra_info=None): """Checks whether struct is a command dict (e.g. it's a dict and has 1 key-value pair.""" self._assert_dict(struct, name, path, extra_info) if len(struct) != 1: err = [self._format_error_path(path + [name])] err.append...
def render_field_path(field_names): """Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block: python data = { 'aa': { ...
def function[render_field_path, parameter[field_names]]: constant[Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block: python da...
keyword[def] identifier[render_field_path] ( identifier[field_names] ): literal[string] identifier[result] =[] keyword[for] identifier[field_name] keyword[in] identifier[field_names] : identifier[match] = identifier[_SIMPLE_FIELD_NAME] . identifier[match] ( identifier[field_name] ) ...
def render_field_path(field_names): """Create a **field path** from a list of nested field names. A **field path** is a ``.``-delimited concatenation of the field names. It is used to represent a nested field. For example, in the data .. code-block: python data = { 'aa': { ...
def _tsne(self, P, degrees_of_freedom, n_samples, random_state, X_embedded, neighbors=None, skip_num_points=0): """Runs t-SNE.""" # t-SNE minimizes the Kullback-Leiber divergence of the Gaussians P # and the Student's t-distributions Q. The optimization algorithm that # we ...
def function[_tsne, parameter[self, P, degrees_of_freedom, n_samples, random_state, X_embedded, neighbors, skip_num_points]]: constant[Runs t-SNE.] variable[params] assign[=] call[name[X_embedded].ravel, parameter[]] variable[opt_args] assign[=] dictionary[[<ast.Constant object at 0x7da18eb57f70...
keyword[def] identifier[_tsne] ( identifier[self] , identifier[P] , identifier[degrees_of_freedom] , identifier[n_samples] , identifier[random_state] , identifier[X_embedded] , identifier[neighbors] = keyword[None] , identifier[skip_num_points] = literal[int] ): literal[string] ...
def _tsne(self, P, degrees_of_freedom, n_samples, random_state, X_embedded, neighbors=None, skip_num_points=0): """Runs t-SNE.""" # t-SNE minimizes the Kullback-Leiber divergence of the Gaussians P # and the Student's t-distributions Q. The optimization algorithm that # we use is batch gradient descent ...
def add_state_machine(self, state_machine): """Add a state machine to the list of managed state machines. If there is no active state machine set yet, then set as active state machine. :param state_machine: State Machine Object :raises exceptions.AttributeError: if the passed state ...
def function[add_state_machine, parameter[self, state_machine]]: constant[Add a state machine to the list of managed state machines. If there is no active state machine set yet, then set as active state machine. :param state_machine: State Machine Object :raises exceptions.Attribute...
keyword[def] identifier[add_state_machine] ( identifier[self] , identifier[state_machine] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[state_machine] , identifier[StateMachine] ): keyword[raise] identifier[AttributeError] ( literal[string] ) ...
def add_state_machine(self, state_machine): """Add a state machine to the list of managed state machines. If there is no active state machine set yet, then set as active state machine. :param state_machine: State Machine Object :raises exceptions.AttributeError: if the passed state mach...
def update_dialog_node(self, workspace_id, dialog_node, new_dialog_node=None, new_description=None, new_conditions=None, new_parent=None, ...
def function[update_dialog_node, parameter[self, workspace_id, dialog_node, new_dialog_node, new_description, new_conditions, new_parent, new_previous_sibling, new_output, new_context, new_metadata, new_next_step, new_title, new_node_type, new_event_name, new_variable, new_actions, new_digress_in, new_digress_out, new_...
keyword[def] identifier[update_dialog_node] ( identifier[self] , identifier[workspace_id] , identifier[dialog_node] , identifier[new_dialog_node] = keyword[None] , identifier[new_description] = keyword[None] , identifier[new_conditions] = keyword[None] , identifier[new_parent] = keyword[None] , identifier[new_...
def update_dialog_node(self, workspace_id, dialog_node, new_dialog_node=None, new_description=None, new_conditions=None, new_parent=None, new_previous_sibling=None, new_output=None, new_context=None, new_metadata=None, new_next_step=None, new_title=None, new_node_type=None, new_event_name=None, new_variable=None, new_a...
def bulk_update(self, request): """Put multiple items in the basket, removing anything that already exists """ # Delete everything in the basket bid = utils.destroy_basket(request) for item_data in request.data: item = BasketItem(basket_id=bid, **item...
def function[bulk_update, parameter[self, request]]: constant[Put multiple items in the basket, removing anything that already exists ] variable[bid] assign[=] call[name[utils].destroy_basket, parameter[name[request]]] for taget[name[item_data]] in starred[name[request].data] beg...
keyword[def] identifier[bulk_update] ( identifier[self] , identifier[request] ): literal[string] identifier[bid] = identifier[utils] . identifier[destroy_basket] ( identifier[request] ) keyword[for] identifier[item_data] keyword[in] identifier[request] . identifier[data] ...
def bulk_update(self, request): """Put multiple items in the basket, removing anything that already exists """ # Delete everything in the basket bid = utils.destroy_basket(request) for item_data in request.data: item = BasketItem(basket_id=bid, **item_data) item.save() # de...
def render_and_create_dir(dirname, context, output_dir, environment, overwrite_if_exists=False): """Render name of a directory, create the directory, return its path.""" name_tmpl = environment.from_string(dirname) rendered_dirname = name_tmpl.render(**context) dir_to_create =...
def function[render_and_create_dir, parameter[dirname, context, output_dir, environment, overwrite_if_exists]]: constant[Render name of a directory, create the directory, return its path.] variable[name_tmpl] assign[=] call[name[environment].from_string, parameter[name[dirname]]] variable[render...
keyword[def] identifier[render_and_create_dir] ( identifier[dirname] , identifier[context] , identifier[output_dir] , identifier[environment] , identifier[overwrite_if_exists] = keyword[False] ): literal[string] identifier[name_tmpl] = identifier[environment] . identifier[from_string] ( identifier[dirname...
def render_and_create_dir(dirname, context, output_dir, environment, overwrite_if_exists=False): """Render name of a directory, create the directory, return its path.""" name_tmpl = environment.from_string(dirname) rendered_dirname = name_tmpl.render(**context) dir_to_create = os.path.normpath(os.path.j...
def gen_docs(corpus, lemmatize, rm_stops): """Open and process files from a corpus. Return a list of sentences for an author. Each sentence is itself a list of tokenized words. """ assert corpus in ['phi5', 'tlg'] if corpus == 'phi5': language = 'latin' filepaths = assemble_phi5_au...
def function[gen_docs, parameter[corpus, lemmatize, rm_stops]]: constant[Open and process files from a corpus. Return a list of sentences for an author. Each sentence is itself a list of tokenized words. ] assert[compare[name[corpus] in list[[<ast.Constant object at 0x7da204347c40>, <ast.Constant ob...
keyword[def] identifier[gen_docs] ( identifier[corpus] , identifier[lemmatize] , identifier[rm_stops] ): literal[string] keyword[assert] identifier[corpus] keyword[in] [ literal[string] , literal[string] ] keyword[if] identifier[corpus] == literal[string] : identifier[language] = literal...
def gen_docs(corpus, lemmatize, rm_stops): """Open and process files from a corpus. Return a list of sentences for an author. Each sentence is itself a list of tokenized words. """ assert corpus in ['phi5', 'tlg'] if corpus == 'phi5': language = 'latin' filepaths = assemble_phi5_auth...
def files_in_dir(path, extension): """Enumartes the files in path with the given extension""" ends = '.{0}'.format(extension) return (f for f in os.listdir(path) if f.endswith(ends))
def function[files_in_dir, parameter[path, extension]]: constant[Enumartes the files in path with the given extension] variable[ends] assign[=] call[constant[.{0}].format, parameter[name[extension]]] return[<ast.GeneratorExp object at 0x7da1b20efeb0>]
keyword[def] identifier[files_in_dir] ( identifier[path] , identifier[extension] ): literal[string] identifier[ends] = literal[string] . identifier[format] ( identifier[extension] ) keyword[return] ( identifier[f] keyword[for] identifier[f] keyword[in] identifier[os] . identifier[listdir] ( identi...
def files_in_dir(path, extension): """Enumartes the files in path with the given extension""" ends = '.{0}'.format(extension) return (f for f in os.listdir(path) if f.endswith(ends))
def get_intercept_only_candidate_models(data, weights_col): """ Return a list of a single candidate intercept-only model. Parameters ---------- data : :any:`pandas.DataFrame` A DataFrame containing at least the column ``meter_value``. DataFrames of this form can be made using the ...
def function[get_intercept_only_candidate_models, parameter[data, weights_col]]: constant[ Return a list of a single candidate intercept-only model. Parameters ---------- data : :any:`pandas.DataFrame` A DataFrame containing at least the column ``meter_value``. DataFrames of this fo...
keyword[def] identifier[get_intercept_only_candidate_models] ( identifier[data] , identifier[weights_col] ): literal[string] identifier[model_type] = literal[string] identifier[formula] = literal[string] keyword[if] identifier[weights_col] keyword[is] keyword[None] : identifier[wei...
def get_intercept_only_candidate_models(data, weights_col): """ Return a list of a single candidate intercept-only model. Parameters ---------- data : :any:`pandas.DataFrame` A DataFrame containing at least the column ``meter_value``. DataFrames of this form can be made using the ...
def admin_view_reverse_fk_links(modeladmin: ModelAdmin, obj, reverse_fk_set_field: str, missing: str = "(None)", use_str: bool = True, separator: str = "<br>", ...
def function[admin_view_reverse_fk_links, parameter[modeladmin, obj, reverse_fk_set_field, missing, use_str, separator, view_type, current_app]]: constant[ Get multiple Django admin site URL for multiple objects linked to our object of interest (where the other objects have foreign keys to our objec...
keyword[def] identifier[admin_view_reverse_fk_links] ( identifier[modeladmin] : identifier[ModelAdmin] , identifier[obj] , identifier[reverse_fk_set_field] : identifier[str] , identifier[missing] : identifier[str] = literal[string] , identifier[use_str] : identifier[bool] = keyword[True] , identifier[separator] ...
def admin_view_reverse_fk_links(modeladmin: ModelAdmin, obj, reverse_fk_set_field: str, missing: str='(None)', use_str: bool=True, separator: str='<br>', view_type: str='change', current_app: str=None) -> str: """ Get multiple Django admin site URL for multiple objects linked to our object of interest (wher...
def seek(self, recIndex): """Seek to the beginning of the record identified by its record index. A succeeding read will load this record in memory. Args:: recIndex index of the record in the vdata; numbering starts at 0. Legal values range from 0 ...
def function[seek, parameter[self, recIndex]]: constant[Seek to the beginning of the record identified by its record index. A succeeding read will load this record in memory. Args:: recIndex index of the record in the vdata; numbering starts at 0. Legal v...
keyword[def] identifier[seek] ( identifier[self] , identifier[recIndex] ): literal[string] keyword[if] identifier[recIndex] > identifier[self] . identifier[_nrecs] - literal[int] : keyword[if] identifier[recIndex] == identifier[self] . identifier[_nrecs] : keyword[r...
def seek(self, recIndex): """Seek to the beginning of the record identified by its record index. A succeeding read will load this record in memory. Args:: recIndex index of the record in the vdata; numbering starts at 0. Legal values range from 0 ...
def read_node_label_matrix(file_path, separator, numbering="matlab"): """ Reads node-label pairs in csv format and returns a list of tuples and a node-label matrix. Inputs: - file_path: The path where the node-label matrix is stored. - separator: The delimiter among values (e.g. ",", "\t", " ...
def function[read_node_label_matrix, parameter[file_path, separator, numbering]]: constant[ Reads node-label pairs in csv format and returns a list of tuples and a node-label matrix. Inputs: - file_path: The path where the node-label matrix is stored. - separator: The delimiter among valu...
keyword[def] identifier[read_node_label_matrix] ( identifier[file_path] , identifier[separator] , identifier[numbering] = literal[string] ): literal[string] identifier[file_row_generator] = identifier[get_file_row_generator] ( identifier[file_path] , identifier[separator] ) identifier[file_row] ...
def read_node_label_matrix(file_path, separator, numbering='matlab'): """ Reads node-label pairs in csv format and returns a list of tuples and a node-label matrix. Inputs: - file_path: The path where the node-label matrix is stored. - separator: The delimiter among values (e.g. ",", " ", " "...
def remove_entity(self, name): """ Remove an entity from the model. :param name: The name of the entity to remove. """ entity_to_remove = None for e in self.entities: if e.name == name: entity_to_remove = e if entity_to_remove is not ...
def function[remove_entity, parameter[self, name]]: constant[ Remove an entity from the model. :param name: The name of the entity to remove. ] variable[entity_to_remove] assign[=] constant[None] for taget[name[e]] in starred[name[self].entities] begin[:] ...
keyword[def] identifier[remove_entity] ( identifier[self] , identifier[name] ): literal[string] identifier[entity_to_remove] = keyword[None] keyword[for] identifier[e] keyword[in] identifier[self] . identifier[entities] : keyword[if] identifier[e] . identifier[name] == i...
def remove_entity(self, name): """ Remove an entity from the model. :param name: The name of the entity to remove. """ entity_to_remove = None for e in self.entities: if e.name == name: entity_to_remove = e # depends on [control=['if'], data=[]] # depends on [c...