code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def _load_config(robot_path): """ Used internally by pyfrc, don't call this directly. Loads a json file from sim/config.json and makes the information available to simulation/testing code. """ from . import config config_obj = config.config_obj s...
def function[_load_config, parameter[robot_path]]: constant[ Used internally by pyfrc, don't call this directly. Loads a json file from sim/config.json and makes the information available to simulation/testing code. ] from relative_module[None] import m...
keyword[def] identifier[_load_config] ( identifier[robot_path] ): literal[string] keyword[from] . keyword[import] identifier[config] identifier[config_obj] = identifier[config] . identifier[config_obj] identifier[sim_path] = identifier[join] ( identifier[robot_path] , literal[string] ) ...
def _load_config(robot_path): """ Used internally by pyfrc, don't call this directly. Loads a json file from sim/config.json and makes the information available to simulation/testing code. """ from . import config config_obj = config.config_obj sim_...
def is_date(property_name, *, format=None, present_optional=False, message=None): """Returns a Validation that checks a value as a date.""" # NOTE: Not currently using format param def check(val): """Checks that a value can be parsed as a date.""" if val is None: return present_optional ...
def function[is_date, parameter[property_name]]: constant[Returns a Validation that checks a value as a date.] def function[check, parameter[val]]: constant[Checks that a value can be parsed as a date.] if compare[name[val] is constant[None]] begin[:] return[n...
keyword[def] identifier[is_date] ( identifier[property_name] ,*, identifier[format] = keyword[None] , identifier[present_optional] = keyword[False] , identifier[message] = keyword[None] ): literal[string] keyword[def] identifier[check] ( identifier[val] ): literal[string] keyword[if] ...
def is_date(property_name, *, format=None, present_optional=False, message=None): """Returns a Validation that checks a value as a date.""" # NOTE: Not currently using format param def check(val): """Checks that a value can be parsed as a date.""" if val is None: return present_...
def get_variant(variant_handle, context=None): """Create a variant given its handle (or serialized dict equivalent) Args: variant_handle (`ResourceHandle` or dict): Resource handle, or equivalent serialized dict representation from ResourceHandle.to_dict context (`Resolv...
def function[get_variant, parameter[variant_handle, context]]: constant[Create a variant given its handle (or serialized dict equivalent) Args: variant_handle (`ResourceHandle` or dict): Resource handle, or equivalent serialized dict representation from ResourceHandle.to_dic...
keyword[def] identifier[get_variant] ( identifier[variant_handle] , identifier[context] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[variant_handle] , identifier[dict] ): identifier[variant_handle] = identifier[ResourceHandle] . identifier[from_dict] ( identi...
def get_variant(variant_handle, context=None): """Create a variant given its handle (or serialized dict equivalent) Args: variant_handle (`ResourceHandle` or dict): Resource handle, or equivalent serialized dict representation from ResourceHandle.to_dict context (`Resolv...
def ident(): """ This routine returns the 3x3 identity matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ident_c.html :return: The 3x3 identity matrix. :rtype: 3x3-Element Array of floats """ matrix = stypes.emptyDoubleMatrix() libspice.ident_c(matrix) return stypes.c...
def function[ident, parameter[]]: constant[ This routine returns the 3x3 identity matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ident_c.html :return: The 3x3 identity matrix. :rtype: 3x3-Element Array of floats ] variable[matrix] assign[=] call[name[stypes].emptyD...
keyword[def] identifier[ident] (): literal[string] identifier[matrix] = identifier[stypes] . identifier[emptyDoubleMatrix] () identifier[libspice] . identifier[ident_c] ( identifier[matrix] ) keyword[return] identifier[stypes] . identifier[cMatrixToNumpy] ( identifier[matrix] )
def ident(): """ This routine returns the 3x3 identity matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ident_c.html :return: The 3x3 identity matrix. :rtype: 3x3-Element Array of floats """ matrix = stypes.emptyDoubleMatrix() libspice.ident_c(matrix) return stypes.c...
def unhumanize_bandwidth(bitsstr): ''' Take a string representing a link capacity, e.g., 10 Mb/s, and return an integer representing the number of bits/sec. Recognizes: - 'bits/sec' or 'b/s' are treated as plain bits per second - 'Kb' or 'kb' as thousand bits/sec - 'Mb' or 'mb' a...
def function[unhumanize_bandwidth, parameter[bitsstr]]: constant[ Take a string representing a link capacity, e.g., 10 Mb/s, and return an integer representing the number of bits/sec. Recognizes: - 'bits/sec' or 'b/s' are treated as plain bits per second - 'Kb' or 'kb' as thousand bi...
keyword[def] identifier[unhumanize_bandwidth] ( identifier[bitsstr] ): literal[string] keyword[if] identifier[isinstance] ( identifier[bitsstr] , identifier[int] ): keyword[return] identifier[bitsstr] identifier[mobj] = identifier[re] . identifier[match] ( literal[string] , identifier[bit...
def unhumanize_bandwidth(bitsstr): """ Take a string representing a link capacity, e.g., 10 Mb/s, and return an integer representing the number of bits/sec. Recognizes: - 'bits/sec' or 'b/s' are treated as plain bits per second - 'Kb' or 'kb' as thousand bits/sec - 'Mb' or 'mb' a...
def make_ring_dicts(**kwargs): """Build and return the information about the Galprop rings """ library_yamlfile = kwargs.get('library', 'models/library.yaml') gmm = kwargs.get('GalpropMapManager', GalpropMapManager(**kwargs)) if library_yamlfile is None or library_yamlfile == 'None': return ...
def function[make_ring_dicts, parameter[]]: constant[Build and return the information about the Galprop rings ] variable[library_yamlfile] assign[=] call[name[kwargs].get, parameter[constant[library], constant[models/library.yaml]]] variable[gmm] assign[=] call[name[kwargs].get, parameter[co...
keyword[def] identifier[make_ring_dicts] (** identifier[kwargs] ): literal[string] identifier[library_yamlfile] = identifier[kwargs] . identifier[get] ( literal[string] , literal[string] ) identifier[gmm] = identifier[kwargs] . identifier[get] ( literal[string] , identifier[GalpropMapManager] (** iden...
def make_ring_dicts(**kwargs): """Build and return the information about the Galprop rings """ library_yamlfile = kwargs.get('library', 'models/library.yaml') gmm = kwargs.get('GalpropMapManager', GalpropMapManager(**kwargs)) if library_yamlfile is None or library_yamlfile == 'None': return ...
def v2_runner_on_skipped(self, result, **kwargs): """Run when a task is skipped.""" if self._display.verbosity > 1: self._print_task() self.last_skipped = False line_length = 120 spaces = " " * (31 - len(result._host.name) - 4) line = " * {}...
def function[v2_runner_on_skipped, parameter[self, result]]: constant[Run when a task is skipped.] if compare[name[self]._display.verbosity greater[>] constant[1]] begin[:] call[name[self]._print_task, parameter[]] name[self].last_skipped assign[=] constant[False] ...
keyword[def] identifier[v2_runner_on_skipped] ( identifier[self] , identifier[result] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[self] . identifier[_display] . identifier[verbosity] > literal[int] : identifier[self] . identifier[_print_task] () ident...
def v2_runner_on_skipped(self, result, **kwargs): """Run when a task is skipped.""" if self._display.verbosity > 1: self._print_task() self.last_skipped = False line_length = 120 spaces = ' ' * (31 - len(result._host.name) - 4) line = ' * {}{}- {}'.format(colorize(result...
def convert(source_las, *, point_format_id=None, file_version=None): """ Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id convert to point format 0 >>> las = read_las('pylastests/simple.la...
def function[convert, parameter[source_las]]: constant[ Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id convert to point format 0 >>> las = read_las('pylastests/simple.las') >>> l...
keyword[def] identifier[convert] ( identifier[source_las] ,*, identifier[point_format_id] = keyword[None] , identifier[file_version] = keyword[None] ): literal[string] keyword[if] identifier[point_format_id] keyword[is] keyword[None] : identifier[point_format_id] = identifier[source_las] . iden...
def convert(source_las, *, point_format_id=None, file_version=None): """ Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id convert to point format 0 >>> las = read_las('pylastests/simple.la...
def adapt_array(arr): """ Adapts a Numpy array into an ARRAY string to put into the database. Parameters ---------- arr: array The Numpy array to be adapted into an ARRAY type that can be inserted into a SQL file. Returns ------- ARRAY The adapted array object ...
def function[adapt_array, parameter[arr]]: constant[ Adapts a Numpy array into an ARRAY string to put into the database. Parameters ---------- arr: array The Numpy array to be adapted into an ARRAY type that can be inserted into a SQL file. Returns ------- ARRAY ...
keyword[def] identifier[adapt_array] ( identifier[arr] ): literal[string] identifier[out] = identifier[io] . identifier[BytesIO] () identifier[np] . identifier[save] ( identifier[out] , identifier[arr] ), identifier[out] . identifier[seek] ( literal[int] ) keyword[return] identifier[buffer] ( id...
def adapt_array(arr): """ Adapts a Numpy array into an ARRAY string to put into the database. Parameters ---------- arr: array The Numpy array to be adapted into an ARRAY type that can be inserted into a SQL file. Returns ------- ARRAY The adapted array object ...
def sg_input(shape=None, dtype=sg_floatx, name=None): r"""Creates a placeholder. Args: shape: A tuple/list of integers. If an integers is given, it will turn to a list. dtype: A data type. Default is float32. name: A name for the placeholder. Returns: A wrapped placeholder `Tensor`...
def function[sg_input, parameter[shape, dtype, name]]: constant[Creates a placeholder. Args: shape: A tuple/list of integers. If an integers is given, it will turn to a list. dtype: A data type. Default is float32. name: A name for the placeholder. Returns: A wrapped placeholde...
keyword[def] identifier[sg_input] ( identifier[shape] = keyword[None] , identifier[dtype] = identifier[sg_floatx] , identifier[name] = keyword[None] ): literal[string] keyword[if] identifier[shape] keyword[is] keyword[None] : keyword[return] identifier[tf] . identifier[placeholder] ( identifie...
def sg_input(shape=None, dtype=sg_floatx, name=None): """Creates a placeholder. Args: shape: A tuple/list of integers. If an integers is given, it will turn to a list. dtype: A data type. Default is float32. name: A name for the placeholder. Returns: A wrapped placeholder `Tensor`....
def send(self, alf): ''' Non-blocking send ''' send_alf = SendThread(self.url, alf, self.connection_timeout, self.retry_count) send_alf.start()
def function[send, parameter[self, alf]]: constant[ Non-blocking send ] variable[send_alf] assign[=] call[name[SendThread], parameter[name[self].url, name[alf], name[self].connection_timeout, name[self].retry_count]] call[name[send_alf].start, parameter[]]
keyword[def] identifier[send] ( identifier[self] , identifier[alf] ): literal[string] identifier[send_alf] = identifier[SendThread] ( identifier[self] . identifier[url] , identifier[alf] , identifier[self] . identifier[connection_timeout] , identifier[self] . identifier[retry_count] ) identifier[send_...
def send(self, alf): """ Non-blocking send """ send_alf = SendThread(self.url, alf, self.connection_timeout, self.retry_count) send_alf.start()
def _create_file(self, filename): """Ensure a new file is created and opened for writing.""" file_descriptor = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_EXCL) return os.fdopen(file_descriptor, 'w')
def function[_create_file, parameter[self, filename]]: constant[Ensure a new file is created and opened for writing.] variable[file_descriptor] assign[=] call[name[os].open, parameter[name[filename], binary_operation[binary_operation[name[os].O_WRONLY <ast.BitOr object at 0x7da2590d6aa0> name[os].O_CREA...
keyword[def] identifier[_create_file] ( identifier[self] , identifier[filename] ): literal[string] identifier[file_descriptor] = identifier[os] . identifier[open] ( identifier[filename] , identifier[os] . identifier[O_WRONLY] | identifier[os] . identifier[O_CREAT] | identifier[os] . identifier[O_EX...
def _create_file(self, filename): """Ensure a new file is created and opened for writing.""" file_descriptor = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_EXCL) return os.fdopen(file_descriptor, 'w')
def update(self, muted=values.unset, hold=values.unset, hold_url=values.unset, hold_method=values.unset, announce_url=values.unset, announce_method=values.unset, wait_url=values.unset, wait_method=values.unset, beep_on_exit=values.unset, end_conference_on_exit...
def function[update, parameter[self, muted, hold, hold_url, hold_method, announce_url, announce_method, wait_url, wait_method, beep_on_exit, end_conference_on_exit, coaching, call_sid_to_coach]]: constant[ Update the ParticipantInstance :param bool muted: Whether the participant should be muted...
keyword[def] identifier[update] ( identifier[self] , identifier[muted] = identifier[values] . identifier[unset] , identifier[hold] = identifier[values] . identifier[unset] , identifier[hold_url] = identifier[values] . identifier[unset] , identifier[hold_method] = identifier[values] . identifier[unset] , identifier[a...
def update(self, muted=values.unset, hold=values.unset, hold_url=values.unset, hold_method=values.unset, announce_url=values.unset, announce_method=values.unset, wait_url=values.unset, wait_method=values.unset, beep_on_exit=values.unset, end_conference_on_exit=values.unset, coaching=values.unset, call_sid_to_coach=valu...
def _get_filename_path(self, path): """ Helper function for creating filename without file extension """ feature_filename = os.path.join(path, self.feature_type.value) if self.feature_name is not None: feature_filename = os.path.join(feature_filename, self.feature_name...
def function[_get_filename_path, parameter[self, path]]: constant[ Helper function for creating filename without file extension ] variable[feature_filename] assign[=] call[name[os].path.join, parameter[name[path], name[self].feature_type.value]] if compare[name[self].feature_name is_not ...
keyword[def] identifier[_get_filename_path] ( identifier[self] , identifier[path] ): literal[string] identifier[feature_filename] = identifier[os] . identifier[path] . identifier[join] ( identifier[path] , identifier[self] . identifier[feature_type] . identifier[value] ) keyword[if] ...
def _get_filename_path(self, path): """ Helper function for creating filename without file extension """ feature_filename = os.path.join(path, self.feature_type.value) if self.feature_name is not None: feature_filename = os.path.join(feature_filename, self.feature_name) # depends on [contro...
def job(request): """View for a single job.""" job_id = request.GET.get("job_id") recent_jobs = JobRecord.objects.order_by("-start_time")[0:100] recent_trials = TrialRecord.objects \ .filter(job_id=job_id) \ .order_by("-start_time") trial_records = [] for recent_trial in recent_t...
def function[job, parameter[request]]: constant[View for a single job.] variable[job_id] assign[=] call[name[request].GET.get, parameter[constant[job_id]]] variable[recent_jobs] assign[=] call[call[name[JobRecord].objects.order_by, parameter[constant[-start_time]]]][<ast.Slice object at 0x7da18f...
keyword[def] identifier[job] ( identifier[request] ): literal[string] identifier[job_id] = identifier[request] . identifier[GET] . identifier[get] ( literal[string] ) identifier[recent_jobs] = identifier[JobRecord] . identifier[objects] . identifier[order_by] ( literal[string] )[ literal[int] : litera...
def job(request): """View for a single job.""" job_id = request.GET.get('job_id') recent_jobs = JobRecord.objects.order_by('-start_time')[0:100] recent_trials = TrialRecord.objects.filter(job_id=job_id).order_by('-start_time') trial_records = [] for recent_trial in recent_trials: trial_r...
def decode(self, bytes, raw=False): """decode(bytearray, raw=False) -> value Decodes the given bytearray containing the elapsed time in seconds since the GPS epoch and returns the corresponding Python :class:`datetime`. If the optional parameter ``raw`` is ``True``, the integra...
def function[decode, parameter[self, bytes, raw]]: constant[decode(bytearray, raw=False) -> value Decodes the given bytearray containing the elapsed time in seconds since the GPS epoch and returns the corresponding Python :class:`datetime`. If the optional parameter ``raw`` is ...
keyword[def] identifier[decode] ( identifier[self] , identifier[bytes] , identifier[raw] = keyword[False] ): literal[string] identifier[sec] = identifier[super] ( identifier[Time32Type] , identifier[self] ). identifier[decode] ( identifier[bytes] ) keyword[return] identifier[sec] keyword...
def decode(self, bytes, raw=False): """decode(bytearray, raw=False) -> value Decodes the given bytearray containing the elapsed time in seconds since the GPS epoch and returns the corresponding Python :class:`datetime`. If the optional parameter ``raw`` is ``True``, the integral ...
def get_data_port_m(self, data_port_id): """Searches and returns the model of a data port of a given state The method searches a port with the given id in the data ports of the given state model. If the state model is a container state, not only the input and output data ports are looked at, bu...
def function[get_data_port_m, parameter[self, data_port_id]]: constant[Searches and returns the model of a data port of a given state The method searches a port with the given id in the data ports of the given state model. If the state model is a container state, not only the input and output d...
keyword[def] identifier[get_data_port_m] ( identifier[self] , identifier[data_port_id] ): literal[string] keyword[for] identifier[scoped_var_m] keyword[in] identifier[self] . identifier[scoped_variables] : keyword[if] identifier[scoped_var_m] . identifier[scoped_variable] . identi...
def get_data_port_m(self, data_port_id): """Searches and returns the model of a data port of a given state The method searches a port with the given id in the data ports of the given state model. If the state model is a container state, not only the input and output data ports are looked at, but al...
def p_multiplicative_expr(self, p): """multiplicative_expr : unary_expr | multiplicative_expr MULT unary_expr | multiplicative_expr DIV unary_expr | multiplicative_expr MOD unary_expr """ if len(p) == 2:...
def function[p_multiplicative_expr, parameter[self, p]]: constant[multiplicative_expr : unary_expr | multiplicative_expr MULT unary_expr | multiplicative_expr DIV unary_expr | multiplicative_expr MOD unary_expr ...
keyword[def] identifier[p_multiplicative_expr] ( identifier[self] , identifier[p] ): literal[string] keyword[if] identifier[len] ( identifier[p] )== literal[int] : identifier[p] [ literal[int] ]= identifier[p] [ literal[int] ] keyword[else] : identifier[p] [ lite...
def p_multiplicative_expr(self, p): """multiplicative_expr : unary_expr | multiplicative_expr MULT unary_expr | multiplicative_expr DIV unary_expr | multiplicative_expr MOD unary_expr """ if len(p) == 2: ...
def intify(obj, str_fun=str, use_ord=True, use_hash=True, use_len=True): """FIXME: this is unpythonic and does things you don't expect! FIXME: rename to "integer_from_category" Returns an integer representative of a categorical object (string, dict, etc) >>> intify('1.2345e10') 12345000000 >>...
def function[intify, parameter[obj, str_fun, use_ord, use_hash, use_len]]: constant[FIXME: this is unpythonic and does things you don't expect! FIXME: rename to "integer_from_category" Returns an integer representative of a categorical object (string, dict, etc) >>> intify('1.2345e10') 123450...
keyword[def] identifier[intify] ( identifier[obj] , identifier[str_fun] = identifier[str] , identifier[use_ord] = keyword[True] , identifier[use_hash] = keyword[True] , identifier[use_len] = keyword[True] ): literal[string] keyword[try] : keyword[return] identifier[int] ( identifier[obj] ) k...
def intify(obj, str_fun=str, use_ord=True, use_hash=True, use_len=True): """FIXME: this is unpythonic and does things you don't expect! FIXME: rename to "integer_from_category" Returns an integer representative of a categorical object (string, dict, etc) >>> intify('1.2345e10') 12345000000 >>...
def techport(Id): ''' In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values r...
def function[techport, parameter[Id]]: constant[ In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPor...
keyword[def] identifier[techport] ( identifier[Id] ): literal[string] identifier[base_url] = literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[Id] , identifier[str] ): keyword[raise] identifier[ValueError] ( literal[string] ) keyword[else] : iden...
def techport(Id): """ In order to use this capability, queries can be issued to the system with the following URI format: GET /xml-api/id_parameter Parameter Required? Value Description id_parameter Yes Type: String Default: None The id value of the TechPort record. TechPort values r...
def find_msvcrt(): """ Likely useless and will return None, see https://bugs.python.org/issue23606 Offered for full compatibility, though. """ # Compile Python command for wine-python command = '"from ctypes.util import find_msvcrt; print(find_msvcrt())"' # Start wine-python winepython_p = subprocess.Popen( ...
def function[find_msvcrt, parameter[]]: constant[ Likely useless and will return None, see https://bugs.python.org/issue23606 Offered for full compatibility, though. ] variable[command] assign[=] constant["from ctypes.util import find_msvcrt; print(find_msvcrt())"] variable[winepython_p] assi...
keyword[def] identifier[find_msvcrt] (): literal[string] identifier[command] = literal[string] identifier[winepython_p] = identifier[subprocess] . identifier[Popen] ( literal[string] + identifier[command] , identifier[stdout] = identifier[subprocess] . identifier[PIPE] , identifier[stderr] = ident...
def find_msvcrt(): """ Likely useless and will return None, see https://bugs.python.org/issue23606 Offered for full compatibility, though. """ # Compile Python command for wine-python command = '"from ctypes.util import find_msvcrt; print(find_msvcrt())"' # Start wine-python winepython_p = subprocess.P...
def pre_deploy_assume_role(assume_role_config, context): """Assume role (prior to deployment).""" if isinstance(assume_role_config, dict): assume_role_arn = '' if assume_role_config.get('post_deploy_env_revert'): context.save_existing_iam_env_vars() if assume_role_config.get(...
def function[pre_deploy_assume_role, parameter[assume_role_config, context]]: constant[Assume role (prior to deployment).] if call[name[isinstance], parameter[name[assume_role_config], name[dict]]] begin[:] variable[assume_role_arn] assign[=] constant[] if call[name[assum...
keyword[def] identifier[pre_deploy_assume_role] ( identifier[assume_role_config] , identifier[context] ): literal[string] keyword[if] identifier[isinstance] ( identifier[assume_role_config] , identifier[dict] ): identifier[assume_role_arn] = literal[string] keyword[if] identifier[assum...
def pre_deploy_assume_role(assume_role_config, context): """Assume role (prior to deployment).""" if isinstance(assume_role_config, dict): assume_role_arn = '' if assume_role_config.get('post_deploy_env_revert'): context.save_existing_iam_env_vars() # depends on [control=['if'], dat...
def _try_backup_item(self): """Check if a backup item is available in cache and call the item handler if it is. :return: `True` if backup item was found. :returntype: `bool`""" if not self._backup_state: return False item = self.cache.get_item(self.address, s...
def function[_try_backup_item, parameter[self]]: constant[Check if a backup item is available in cache and call the item handler if it is. :return: `True` if backup item was found. :returntype: `bool`] if <ast.UnaryOp object at 0x7da20c993d00> begin[:] return[constant[Fa...
keyword[def] identifier[_try_backup_item] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_backup_state] : keyword[return] keyword[False] identifier[item] = identifier[self] . identifier[cache] . identifier[get_item] ( identifie...
def _try_backup_item(self): """Check if a backup item is available in cache and call the item handler if it is. :return: `True` if backup item was found. :returntype: `bool`""" if not self._backup_state: return False # depends on [control=['if'], data=[]] item = self.cache....
def destructuring_stmt_handle(self, original, loc, tokens): """Process match assign blocks.""" internal_assert(len(tokens) == 2, "invalid destructuring assignment tokens", tokens) matches, item = tokens out = match_handle(loc, [matches, "in", item, None]) out += self.pattern_erro...
def function[destructuring_stmt_handle, parameter[self, original, loc, tokens]]: constant[Process match assign blocks.] call[name[internal_assert], parameter[compare[call[name[len], parameter[name[tokens]]] equal[==] constant[2]], constant[invalid destructuring assignment tokens], name[tokens]]] ...
keyword[def] identifier[destructuring_stmt_handle] ( identifier[self] , identifier[original] , identifier[loc] , identifier[tokens] ): literal[string] identifier[internal_assert] ( identifier[len] ( identifier[tokens] )== literal[int] , literal[string] , identifier[tokens] ) identifier[mat...
def destructuring_stmt_handle(self, original, loc, tokens): """Process match assign blocks.""" internal_assert(len(tokens) == 2, 'invalid destructuring assignment tokens', tokens) (matches, item) = tokens out = match_handle(loc, [matches, 'in', item, None]) out += self.pattern_error(original, loc, m...
def start(self): """ start """ def main_thread(): # create resp, req thread pool self._create_thread_pool() # start connection, this will block until stop() self.conn_thread = Thread(target=self._conn.connect) self.conn_thread.d...
def function[start, parameter[self]]: constant[ start ] def function[main_thread, parameter[]]: call[name[self]._create_thread_pool, parameter[]] name[self].conn_thread assign[=] call[name[Thread], parameter[]] name[self].conn_thread.daemon...
keyword[def] identifier[start] ( identifier[self] ): literal[string] keyword[def] identifier[main_thread] (): identifier[self] . identifier[_create_thread_pool] () identifier[self] . identifier[conn_thread] = identifier[Thread] ( identifier[target] =...
def start(self): """ start """ def main_thread(): # create resp, req thread pool self._create_thread_pool() # start connection, this will block until stop() self.conn_thread = Thread(target=self._conn.connect) self.conn_thread.daemon = True self.c...
def sync(self): """Synchronise and update the stored state to the in-memory state.""" if self.filepath: serialised_file = open(self.filepath, "w") json.dump(self.state, serialised_file) serialised_file.close() else: print("Filepath to the persisten...
def function[sync, parameter[self]]: constant[Synchronise and update the stored state to the in-memory state.] if name[self].filepath begin[:] variable[serialised_file] assign[=] call[name[open], parameter[name[self].filepath, constant[w]]] call[name[json].dump, parameter...
keyword[def] identifier[sync] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[filepath] : identifier[serialised_file] = identifier[open] ( identifier[self] . identifier[filepath] , literal[string] ) identifier[json] . identifier[dump] ( ide...
def sync(self): """Synchronise and update the stored state to the in-memory state.""" if self.filepath: serialised_file = open(self.filepath, 'w') json.dump(self.state, serialised_file) serialised_file.close() # depends on [control=['if'], data=[]] else: print('Filepath to t...
def clean_by_request(self, request): ''' Remove all futures that were waiting for request `request` since it is done waiting ''' if request not in self.request_map: return for tag, matcher, future in self.request_map[request]: # timeout the future ...
def function[clean_by_request, parameter[self, request]]: constant[ Remove all futures that were waiting for request `request` since it is done waiting ] if compare[name[request] <ast.NotIn object at 0x7da2590d7190> name[self].request_map] begin[:] return[None] for taget[...
keyword[def] identifier[clean_by_request] ( identifier[self] , identifier[request] ): literal[string] keyword[if] identifier[request] keyword[not] keyword[in] identifier[self] . identifier[request_map] : keyword[return] keyword[for] identifier[tag] , identifier[matcher] ...
def clean_by_request(self, request): """ Remove all futures that were waiting for request `request` since it is done waiting """ if request not in self.request_map: return # depends on [control=['if'], data=[]] for (tag, matcher, future) in self.request_map[request]: # timeo...
def do_insertions(insertions, tokens): """ Helper for lexers which must combine the results of several sublexers. ``insertions`` is a list of ``(index, itokens)`` pairs. Each ``itokens`` iterable should be inserted at position ``index`` into the token stream given by the ``tokens`` argument...
def function[do_insertions, parameter[insertions, tokens]]: constant[ Helper for lexers which must combine the results of several sublexers. ``insertions`` is a list of ``(index, itokens)`` pairs. Each ``itokens`` iterable should be inserted at position ``index`` into the token stream given...
keyword[def] identifier[do_insertions] ( identifier[insertions] , identifier[tokens] ): literal[string] identifier[insertions] = identifier[iter] ( identifier[insertions] ) keyword[try] : identifier[index] , identifier[itokens] = identifier[next] ( identifier[insertions] ) keyword[except...
def do_insertions(insertions, tokens): """ Helper for lexers which must combine the results of several sublexers. ``insertions`` is a list of ``(index, itokens)`` pairs. Each ``itokens`` iterable should be inserted at position ``index`` into the token stream given by the ``tokens`` argument...
def sort_by_length(self): """ Sorts dataset by the sequence length. """ self.lengths, indices = self.lengths.sort(descending=True) self.src = [self.src[idx] for idx in indices] self.indices = indices.tolist() self.sorted = True
def function[sort_by_length, parameter[self]]: constant[ Sorts dataset by the sequence length. ] <ast.Tuple object at 0x7da1b1b03970> assign[=] call[name[self].lengths.sort, parameter[]] name[self].src assign[=] <ast.ListComp object at 0x7da1b1b02d40> name[self].indices a...
keyword[def] identifier[sort_by_length] ( identifier[self] ): literal[string] identifier[self] . identifier[lengths] , identifier[indices] = identifier[self] . identifier[lengths] . identifier[sort] ( identifier[descending] = keyword[True] ) identifier[self] . identifier[src] =[ identifie...
def sort_by_length(self): """ Sorts dataset by the sequence length. """ (self.lengths, indices) = self.lengths.sort(descending=True) self.src = [self.src[idx] for idx in indices] self.indices = indices.tolist() self.sorted = True
def boundedFunction(x, minY, ax, ay): ''' limit [function] to a minimum y value ''' y = function(x, ax, ay) return np.maximum(np.nan_to_num(y), minY)
def function[boundedFunction, parameter[x, minY, ax, ay]]: constant[ limit [function] to a minimum y value ] variable[y] assign[=] call[name[function], parameter[name[x], name[ax], name[ay]]] return[call[name[np].maximum, parameter[call[name[np].nan_to_num, parameter[name[y]]], name[minY]]]...
keyword[def] identifier[boundedFunction] ( identifier[x] , identifier[minY] , identifier[ax] , identifier[ay] ): literal[string] identifier[y] = identifier[function] ( identifier[x] , identifier[ax] , identifier[ay] ) keyword[return] identifier[np] . identifier[maximum] ( identifier[np] . identifi...
def boundedFunction(x, minY, ax, ay): """ limit [function] to a minimum y value """ y = function(x, ax, ay) return np.maximum(np.nan_to_num(y), minY)
def set_language(self, editor, language): """ Sets given language to given Model editor. :param editor: Editor to set language to. :type editor: Editor :param language: Language to set. :type language: Language :return: Method success. :rtype: bool ...
def function[set_language, parameter[self, editor, language]]: constant[ Sets given language to given Model editor. :param editor: Editor to set language to. :type editor: Editor :param language: Language to set. :type language: Language :return: Method success. ...
keyword[def] identifier[set_language] ( identifier[self] , identifier[editor] , identifier[language] ): literal[string] identifier[LOGGER] . identifier[debug] ( literal[string] . identifier[format] ( identifier[language] . identifier[name] , identifier[editor] )) keyword[return] identif...
def set_language(self, editor, language): """ Sets given language to given Model editor. :param editor: Editor to set language to. :type editor: Editor :param language: Language to set. :type language: Language :return: Method success. :rtype: bool ""...
def write_to_file(chats, chatfile): """called every time chats are modified""" with open(chatfile, 'w') as handler: handler.write('\n'.join((str(id_) for id_ in chats)))
def function[write_to_file, parameter[chats, chatfile]]: constant[called every time chats are modified] with call[name[open], parameter[name[chatfile], constant[w]]] begin[:] call[name[handler].write, parameter[call[constant[ ].join, parameter[<ast.GeneratorExp object at 0x7da1b0e16f20>]...
keyword[def] identifier[write_to_file] ( identifier[chats] , identifier[chatfile] ): literal[string] keyword[with] identifier[open] ( identifier[chatfile] , literal[string] ) keyword[as] identifier[handler] : identifier[handler] . identifier[write] ( literal[string] . identifier[join] (( identif...
def write_to_file(chats, chatfile): """called every time chats are modified""" with open(chatfile, 'w') as handler: handler.write('\n'.join((str(id_) for id_ in chats))) # depends on [control=['with'], data=['handler']]
def parse_event_record(self, node): """ Parses <EventRecord> @param node: Node containing the <EventRecord> element @type node: xml.etree.Element """ if self.current_simulation == None: self.raise_error('<EventRecord> must be only be used inside a ' + ...
def function[parse_event_record, parameter[self, node]]: constant[ Parses <EventRecord> @param node: Node containing the <EventRecord> element @type node: xml.etree.Element ] if compare[name[self].current_simulation equal[==] constant[None]] begin[:] call...
keyword[def] identifier[parse_event_record] ( identifier[self] , identifier[node] ): literal[string] keyword[if] identifier[self] . identifier[current_simulation] == keyword[None] : identifier[self] . identifier[raise_error] ( literal[string] + literal[string] ) ...
def parse_event_record(self, node): """ Parses <EventRecord> @param node: Node containing the <EventRecord> element @type node: xml.etree.Element """ if self.current_simulation == None: self.raise_error('<EventRecord> must be only be used inside a ' + 'simulation specifi...
def create_redis_client(redis_address, password=None): """Create a Redis client. Args: The IP address, port, and password of the Redis server. Returns: A Redis client. """ redis_ip_address, redis_port = redis_address.split(":") # For this command to work, some other client (on ...
def function[create_redis_client, parameter[redis_address, password]]: constant[Create a Redis client. Args: The IP address, port, and password of the Redis server. Returns: A Redis client. ] <ast.Tuple object at 0x7da18f58f280> assign[=] call[name[redis_address].split, par...
keyword[def] identifier[create_redis_client] ( identifier[redis_address] , identifier[password] = keyword[None] ): literal[string] identifier[redis_ip_address] , identifier[redis_port] = identifier[redis_address] . identifier[split] ( literal[string] ) keyword[return] identifier[redis] . id...
def create_redis_client(redis_address, password=None): """Create a Redis client. Args: The IP address, port, and password of the Redis server. Returns: A Redis client. """ (redis_ip_address, redis_port) = redis_address.split(':') # For this command to work, some other client (o...
def ledger(self, ledger_id): """The ledger details endpoint provides information on a single ledger. `GET /ledgers/{sequence} <https://www.stellar.org/developers/horizon/reference/endpoints/ledgers-single.html>`_ :param int ledger_id: The id of the ledger to look up. :return: T...
def function[ledger, parameter[self, ledger_id]]: constant[The ledger details endpoint provides information on a single ledger. `GET /ledgers/{sequence} <https://www.stellar.org/developers/horizon/reference/endpoints/ledgers-single.html>`_ :param int ledger_id: The id of the ledger to ...
keyword[def] identifier[ledger] ( identifier[self] , identifier[ledger_id] ): literal[string] identifier[endpoint] = literal[string] . identifier[format] ( identifier[ledger_id] = identifier[ledger_id] ) keyword[return] identifier[self] . identifier[query] ( identifier[endpoint] )
def ledger(self, ledger_id): """The ledger details endpoint provides information on a single ledger. `GET /ledgers/{sequence} <https://www.stellar.org/developers/horizon/reference/endpoints/ledgers-single.html>`_ :param int ledger_id: The id of the ledger to look up. :return: The d...
def _parse_file(self): """Preprocess and parse C file into an AST""" # We need to set the CPU type to pull in the right register definitions # only preprocess the file (-E) and get rid of gcc extensions that aren't # supported in ISO C. args = utilities.build_includes(self.arch....
def function[_parse_file, parameter[self]]: constant[Preprocess and parse C file into an AST] variable[args] assign[=] call[name[utilities].build_includes, parameter[call[name[self].arch.includes, parameter[]]]] call[name[args].append, parameter[constant[-E]]] call[name[args].append, par...
keyword[def] identifier[_parse_file] ( identifier[self] ): literal[string] identifier[args] = identifier[utilities] . identifier[build_includes] ( identifier[self] . identifier[arch] . identifier[includes] ()) identifier[args] . identifier[append] ( li...
def _parse_file(self): """Preprocess and parse C file into an AST""" # We need to set the CPU type to pull in the right register definitions # only preprocess the file (-E) and get rid of gcc extensions that aren't # supported in ISO C. args = utilities.build_includes(self.arch.includes()) # arg...
def is_py_script(filename): "Returns True if a file is a python executable." if not os.path.exists(filename) and os.path.isfile(filename): return False elif filename.endswith(".py"): return True elif not os.access(filename, os.X_OK): return False else: try: ...
def function[is_py_script, parameter[filename]]: constant[Returns True if a file is a python executable.] if <ast.BoolOp object at 0x7da1b09ba7a0> begin[:] return[constant[False]]
keyword[def] identifier[is_py_script] ( identifier[filename] ): literal[string] keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[exists] ( identifier[filename] ) keyword[and] identifier[os] . identifier[path] . identifier[isfile] ( identifier[filename] ): keyword[return] ...
def is_py_script(filename): """Returns True if a file is a python executable.""" if not os.path.exists(filename) and os.path.isfile(filename): return False # depends on [control=['if'], data=[]] elif filename.endswith('.py'): return True # depends on [control=['if'], data=[]] elif not ...
def to_binary(self): """Convert N-ary operators to binary operators.""" node = self.node.to_binary() if node is self.node: return self else: return _expr(node)
def function[to_binary, parameter[self]]: constant[Convert N-ary operators to binary operators.] variable[node] assign[=] call[name[self].node.to_binary, parameter[]] if compare[name[node] is name[self].node] begin[:] return[name[self]]
keyword[def] identifier[to_binary] ( identifier[self] ): literal[string] identifier[node] = identifier[self] . identifier[node] . identifier[to_binary] () keyword[if] identifier[node] keyword[is] identifier[self] . identifier[node] : keyword[return] identifier[self] ...
def to_binary(self): """Convert N-ary operators to binary operators.""" node = self.node.to_binary() if node is self.node: return self # depends on [control=['if'], data=[]] else: return _expr(node)
def decompress(data, compression, width, height, depth, version=1): """Decompress raw data. :param data: compressed data bytes. :param compression: compression type, see :py:class:`~psd_tools.constants.Compression`. :param width: width. :param height: height. :param depth: bit depth...
def function[decompress, parameter[data, compression, width, height, depth, version]]: constant[Decompress raw data. :param data: compressed data bytes. :param compression: compression type, see :py:class:`~psd_tools.constants.Compression`. :param width: width. :param height: height...
keyword[def] identifier[decompress] ( identifier[data] , identifier[compression] , identifier[width] , identifier[height] , identifier[depth] , identifier[version] = literal[int] ): literal[string] identifier[length] = identifier[width] * identifier[height] * identifier[depth] // literal[int] identi...
def decompress(data, compression, width, height, depth, version=1): """Decompress raw data. :param data: compressed data bytes. :param compression: compression type, see :py:class:`~psd_tools.constants.Compression`. :param width: width. :param height: height. :param depth: bit depth...
def conditional_write(strm, fmt, value, *args, **kwargs): """Write to stream using fmt and value if value is not None""" if value is not None: strm.write(fmt.format(value, *args, **kwargs))
def function[conditional_write, parameter[strm, fmt, value]]: constant[Write to stream using fmt and value if value is not None] if compare[name[value] is_not constant[None]] begin[:] call[name[strm].write, parameter[call[name[fmt].format, parameter[name[value], <ast.Starred object at 0x...
keyword[def] identifier[conditional_write] ( identifier[strm] , identifier[fmt] , identifier[value] ,* identifier[args] ,** identifier[kwargs] ): literal[string] keyword[if] identifier[value] keyword[is] keyword[not] keyword[None] : identifier[strm] . identifier[write] ( identifier[fmt] . iden...
def conditional_write(strm, fmt, value, *args, **kwargs): """Write to stream using fmt and value if value is not None""" if value is not None: strm.write(fmt.format(value, *args, **kwargs)) # depends on [control=['if'], data=['value']]
def get_tokens(max_value): """Defines tokens. Args: max_value: the maximum numeric range for the token. Returns: list of string tokens in vocabulary. """ vocab = [str(i) for i in range(max_value)] vocab = set(vocab) vocab.update(CodeOp.LITERALS) vocab.update(CodeOp.KEYWORDS) vocab |= set(""....
def function[get_tokens, parameter[max_value]]: constant[Defines tokens. Args: max_value: the maximum numeric range for the token. Returns: list of string tokens in vocabulary. ] variable[vocab] assign[=] <ast.ListComp object at 0x7da1b1ff49d0> variable[vocab] assign[=] call[name...
keyword[def] identifier[get_tokens] ( identifier[max_value] ): literal[string] identifier[vocab] =[ identifier[str] ( identifier[i] ) keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[max_value] )] identifier[vocab] = identifier[set] ( identifier[vocab] ) identifier[vocab] . identi...
def get_tokens(max_value): """Defines tokens. Args: max_value: the maximum numeric range for the token. Returns: list of string tokens in vocabulary. """ vocab = [str(i) for i in range(max_value)] vocab = set(vocab) vocab.update(CodeOp.LITERALS) vocab.update(CodeOp.KEYWORDS) voca...
def get_setting(name): ''' Get the current configuration for the named audit setting Args: name (str): The name of the setting to retrieve Returns: str: The current configuration for the named setting Raises: KeyError: On invalid setting name CommandExecutionError:...
def function[get_setting, parameter[name]]: constant[ Get the current configuration for the named audit setting Args: name (str): The name of the setting to retrieve Returns: str: The current configuration for the named setting Raises: KeyError: On invalid setting name...
keyword[def] identifier[get_setting] ( identifier[name] ): literal[string] identifier[current_settings] = identifier[get_settings] ( identifier[category] = literal[string] ) keyword[for] identifier[setting] keyword[in] identifier[current_settings] : keyword[if] identifier[name] . identifi...
def get_setting(name): """ Get the current configuration for the named audit setting Args: name (str): The name of the setting to retrieve Returns: str: The current configuration for the named setting Raises: KeyError: On invalid setting name CommandExecutionError:...
def ZernikeSequence(x,y,maxRadial=5,epsilon=1e-10): """ Return Zernike values at a given set of x,y coords up to some maximum radial order """ if maxRadial>5: raise ValueError('Code for higher radial orders not implemented') # Derive radius and exp(i*theta) temp = x + 1j*y r1 =...
def function[ZernikeSequence, parameter[x, y, maxRadial, epsilon]]: constant[ Return Zernike values at a given set of x,y coords up to some maximum radial order ] if compare[name[maxRadial] greater[>] constant[5]] begin[:] <ast.Raise object at 0x7da18f7221a0> variable[temp] ...
keyword[def] identifier[ZernikeSequence] ( identifier[x] , identifier[y] , identifier[maxRadial] = literal[int] , identifier[epsilon] = literal[int] ): literal[string] keyword[if] identifier[maxRadial] > literal[int] : keyword[raise] identifier[ValueError] ( literal[string] ) ident...
def ZernikeSequence(x, y, maxRadial=5, epsilon=1e-10): """ Return Zernike values at a given set of x,y coords up to some maximum radial order """ if maxRadial > 5: raise ValueError('Code for higher radial orders not implemented') # depends on [control=['if'], data=[]] # Derive radius and ...
def _pop_params(cls, kwargs): """ Pop entries from the `kwargs` passed to cls.__new__ based on the values in `cls.params`. Parameters ---------- kwargs : dict The kwargs passed to cls.__new__. Returns ------- params : list[(str, objec...
def function[_pop_params, parameter[cls, kwargs]]: constant[ Pop entries from the `kwargs` passed to cls.__new__ based on the values in `cls.params`. Parameters ---------- kwargs : dict The kwargs passed to cls.__new__. Returns ------- ...
keyword[def] identifier[_pop_params] ( identifier[cls] , identifier[kwargs] ): literal[string] identifier[params] = identifier[cls] . identifier[params] keyword[if] keyword[not] identifier[isinstance] ( identifier[params] , identifier[Mapping] ): identifier[params] ={ ident...
def _pop_params(cls, kwargs): """ Pop entries from the `kwargs` passed to cls.__new__ based on the values in `cls.params`. Parameters ---------- kwargs : dict The kwargs passed to cls.__new__. Returns ------- params : list[(str, object)] ...
def get_magsymops(self, data): """ Equivalent to get_symops except for magnetic symmetry groups. Separate function since additional operation for time reversal symmetry (which changes magnetic moments on sites) needs to be returned. """ magsymmops = [] # check to...
def function[get_magsymops, parameter[self, data]]: constant[ Equivalent to get_symops except for magnetic symmetry groups. Separate function since additional operation for time reversal symmetry (which changes magnetic moments on sites) needs to be returned. ] variable[m...
keyword[def] identifier[get_magsymops] ( identifier[self] , identifier[data] ): literal[string] identifier[magsymmops] =[] keyword[if] identifier[data] . identifier[data] . identifier[get] ( literal[string] ): identifier[xyzt] = identifier[data] . identifier[data] ...
def get_magsymops(self, data): """ Equivalent to get_symops except for magnetic symmetry groups. Separate function since additional operation for time reversal symmetry (which changes magnetic moments on sites) needs to be returned. """ magsymmops = [] # check to see if magCI...
def _linearEOM(y,t,pot): """ NAME: linearEOM PURPOSE: the one-dimensional equation-of-motion INPUT: y - current phase-space position t - current time pot - (list of) linearPotential instance(s) OUTPUT: dy/dt HISTORY: 2010-07-13 - Bovy (NYU) ""...
def function[_linearEOM, parameter[y, t, pot]]: constant[ NAME: linearEOM PURPOSE: the one-dimensional equation-of-motion INPUT: y - current phase-space position t - current time pot - (list of) linearPotential instance(s) OUTPUT: dy/dt HISTORY: ...
keyword[def] identifier[_linearEOM] ( identifier[y] , identifier[t] , identifier[pot] ): literal[string] keyword[return] [ identifier[y] [ literal[int] ], identifier[_evaluatelinearForces] ( identifier[pot] , identifier[y] [ literal[int] ], identifier[t] = identifier[t] )]
def _linearEOM(y, t, pot): """ NAME: linearEOM PURPOSE: the one-dimensional equation-of-motion INPUT: y - current phase-space position t - current time pot - (list of) linearPotential instance(s) OUTPUT: dy/dt HISTORY: 2010-07-13 - Bovy (NYU) ...
def _rlfunc(rl,lz,pot): """Function that gives rvc-lz""" thisvcirc= vcirc(pot,rl,use_physical=False) return rl*thisvcirc-lz
def function[_rlfunc, parameter[rl, lz, pot]]: constant[Function that gives rvc-lz] variable[thisvcirc] assign[=] call[name[vcirc], parameter[name[pot], name[rl]]] return[binary_operation[binary_operation[name[rl] * name[thisvcirc]] - name[lz]]]
keyword[def] identifier[_rlfunc] ( identifier[rl] , identifier[lz] , identifier[pot] ): literal[string] identifier[thisvcirc] = identifier[vcirc] ( identifier[pot] , identifier[rl] , identifier[use_physical] = keyword[False] ) keyword[return] identifier[rl] * identifier[thisvcirc] - identifier[lz]
def _rlfunc(rl, lz, pot): """Function that gives rvc-lz""" thisvcirc = vcirc(pot, rl, use_physical=False) return rl * thisvcirc - lz
def write(self, fout=None, fmt=SPARSE, schema_only=False, data_only=False): """ Write an arff structure to a string. """ assert not (schema_only and data_only), 'Make up your mind.' assert fmt in FORMATS, 'Invalid format "%s". Should be one of: %s'...
def function[write, parameter[self, fout, fmt, schema_only, data_only]]: constant[ Write an arff structure to a string. ] assert[<ast.UnaryOp object at 0x7da1b101ce20>] assert[compare[name[fmt] in name[FORMATS]]] variable[close] assign[=] constant[False] if compare[name[f...
keyword[def] identifier[write] ( identifier[self] , identifier[fout] = keyword[None] , identifier[fmt] = identifier[SPARSE] , identifier[schema_only] = keyword[False] , identifier[data_only] = keyword[False] ): literal[string] keyword[assert] keyword[not] ( identifier[schema_only] keyword[and...
def write(self, fout=None, fmt=SPARSE, schema_only=False, data_only=False): """ Write an arff structure to a string. """ assert not (schema_only and data_only), 'Make up your mind.' assert fmt in FORMATS, 'Invalid format "%s". Should be one of: %s' % (fmt, ', '.join(FORMATS)) close = Fal...
def do_macro_kwarg(parser, token): """ Function taking a parsed template tag to a MacroKwargNode. """ try: tag_name, keyword = token.split_contents() except ValueError: raise template.TemplateSyntaxError( "{0} tag requires exactly one argument, a keyword".format( ...
def function[do_macro_kwarg, parameter[parser, token]]: constant[ Function taking a parsed template tag to a MacroKwargNode. ] <ast.Try object at 0x7da207f98d90> variable[nodelist] assign[=] call[name[parser].parse, parameter[tuple[[<ast.Constant object at 0x7da207f9a6b0>]]]] call[na...
keyword[def] identifier[do_macro_kwarg] ( identifier[parser] , identifier[token] ): literal[string] keyword[try] : identifier[tag_name] , identifier[keyword] = identifier[token] . identifier[split_contents] () keyword[except] identifier[ValueError] : keyword[raise] identifier[templ...
def do_macro_kwarg(parser, token): """ Function taking a parsed template tag to a MacroKwargNode. """ try: (tag_name, keyword) = token.split_contents() # depends on [control=['try'], data=[]] except ValueError: raise template.TemplateSyntaxError('{0} tag requires exactly one argumen...
def available_state(self, state: State) -> Tuple[State, ...]: """ Return the state reachable from a given state. """ result = [] for gene in self.genes: result.extend(self.available_state_for_gene(gene, state)) if len(result) > 1 and state in result: result.remove...
def function[available_state, parameter[self, state]]: constant[ Return the state reachable from a given state. ] variable[result] assign[=] list[[]] for taget[name[gene]] in starred[name[self].genes] begin[:] call[name[result].extend, parameter[call[name[self].available_state_fo...
keyword[def] identifier[available_state] ( identifier[self] , identifier[state] : identifier[State] )-> identifier[Tuple] [ identifier[State] ,...]: literal[string] identifier[result] =[] keyword[for] identifier[gene] keyword[in] identifier[self] . identifier[genes] : ident...
def available_state(self, state: State) -> Tuple[State, ...]: """ Return the state reachable from a given state. """ result = [] for gene in self.genes: result.extend(self.available_state_for_gene(gene, state)) # depends on [control=['for'], data=['gene']] if len(result) > 1 and state in result...
def learn_q(self, predicted_q_arr, real_q_arr): ''' Infernce Q-Value. Args: predicted_q_arr: `np.ndarray` of predicted Q-Values. real_q_arr: `np.ndarray` of real Q-Values. ''' """ if self.__q_shape is None: raise Val...
def function[learn_q, parameter[self, predicted_q_arr, real_q_arr]]: constant[ Infernce Q-Value. Args: predicted_q_arr: `np.ndarray` of predicted Q-Values. real_q_arr: `np.ndarray` of real Q-Values. ] constant[ if self.__q_shape...
keyword[def] identifier[learn_q] ( identifier[self] , identifier[predicted_q_arr] , identifier[real_q_arr] ): literal[string] literal[string] identifier[loss] = identifier[self] . identifier[__computable_loss] . identifier[compute_loss] ( identifier[predicted_q_arr] , identifier[real_q_a...
def learn_q(self, predicted_q_arr, real_q_arr): """ Infernce Q-Value. Args: predicted_q_arr: `np.ndarray` of predicted Q-Values. real_q_arr: `np.ndarray` of real Q-Values. """ '\n if self.__q_shape is None:\n raise ValueError(...
def format(self, fmt, locale=None): """ Formats the instance using the given format. :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :rtype: str """ return self._formatter.format(self, fmt,...
def function[format, parameter[self, fmt, locale]]: constant[ Formats the instance using the given format. :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :rtype: str ] return[call[name[self]._...
keyword[def] identifier[format] ( identifier[self] , identifier[fmt] , identifier[locale] = keyword[None] ): literal[string] keyword[return] identifier[self] . identifier[_formatter] . identifier[format] ( identifier[self] , identifier[fmt] , identifier[locale] )
def format(self, fmt, locale=None): """ Formats the instance using the given format. :param fmt: The format to use :type fmt: str :param locale: The locale to use :type locale: str or None :rtype: str """ return self._formatter.format(self, fmt, locale)
def pulse_magnitude(time, magnitude, start, repeat_time=0): """ Implements xmile's PULSE function PULSE: Generate a one-DT wide pulse at the given time Parameters: 2 or 3: (magnitude, first time[, interval]) Without interval or when interval = 0, the PULSE is ...
def function[pulse_magnitude, parameter[time, magnitude, start, repeat_time]]: constant[ Implements xmile's PULSE function PULSE: Generate a one-DT wide pulse at the given time Parameters: 2 or 3: (magnitude, first time[, interval]) Without interval or whe...
keyword[def] identifier[pulse_magnitude] ( identifier[time] , identifier[magnitude] , identifier[start] , identifier[repeat_time] = literal[int] ): literal[string] identifier[t] = identifier[time] () identifier[small] = literal[int] keyword[if] identifier[repeat_time] <= identifier[small] : ...
def pulse_magnitude(time, magnitude, start, repeat_time=0): """ Implements xmile's PULSE function PULSE: Generate a one-DT wide pulse at the given time Parameters: 2 or 3: (magnitude, first time[, interval]) Without interval or when interval = 0, the PULSE is ...
def set_requestable(self, requestable=True): # type: (bool) -> None """Set the dataset to be of type requestable or not Args: requestable (bool): Set whether dataset is requestable. Defaults to True. Returns: None """ self.data['is_requestdata_ty...
def function[set_requestable, parameter[self, requestable]]: constant[Set the dataset to be of type requestable or not Args: requestable (bool): Set whether dataset is requestable. Defaults to True. Returns: None ] call[name[self].data][constant[is_reque...
keyword[def] identifier[set_requestable] ( identifier[self] , identifier[requestable] = keyword[True] ): literal[string] identifier[self] . identifier[data] [ literal[string] ]= identifier[requestable] keyword[if] identifier[requestable] : identifier[self] . identifier[data...
def set_requestable(self, requestable=True): # type: (bool) -> None 'Set the dataset to be of type requestable or not\n\n Args:\n requestable (bool): Set whether dataset is requestable. Defaults to True.\n\n Returns:\n None\n ' self.data['is_requestdata_type'] = re...
def union_sql(view_name, *tables): """This function generates string containing SQL code, that creates a big VIEW, that consists of many SELECTs. >>> utils.union_sql('global', 'foo', 'bar', 'baz') 'CREATE VIEW global SELECT * FROM foo UNION SELECT * FROM bar UNION SELECT * FROM baz' """ if not...
def function[union_sql, parameter[view_name]]: constant[This function generates string containing SQL code, that creates a big VIEW, that consists of many SELECTs. >>> utils.union_sql('global', 'foo', 'bar', 'baz') 'CREATE VIEW global SELECT * FROM foo UNION SELECT * FROM bar UNION SELECT * FROM ba...
keyword[def] identifier[union_sql] ( identifier[view_name] ,* identifier[tables] ): literal[string] keyword[if] keyword[not] identifier[tables] : keyword[raise] identifier[Exception] ( literal[string] ) identifier[ret] = literal[string] identifier[pre] = literal[string] % identifie...
def union_sql(view_name, *tables): """This function generates string containing SQL code, that creates a big VIEW, that consists of many SELECTs. >>> utils.union_sql('global', 'foo', 'bar', 'baz') 'CREATE VIEW global SELECT * FROM foo UNION SELECT * FROM bar UNION SELECT * FROM baz' """ if not ...
def non_parallel(self, vector): """Return True if vectors are non-parallel. Non-parallel vectors are vectors which are neither parallel nor perpendicular to each other. """ if (self.is_parallel(vector) is not True and self.is_perpendicular(vector) is not True): ...
def function[non_parallel, parameter[self, vector]]: constant[Return True if vectors are non-parallel. Non-parallel vectors are vectors which are neither parallel nor perpendicular to each other. ] if <ast.BoolOp object at 0x7da1b0fac280> begin[:] return[constant[True]] ...
keyword[def] identifier[non_parallel] ( identifier[self] , identifier[vector] ): literal[string] keyword[if] ( identifier[self] . identifier[is_parallel] ( identifier[vector] ) keyword[is] keyword[not] keyword[True] keyword[and] identifier[self] . identifier[is_perpendicular] ( identif...
def non_parallel(self, vector): """Return True if vectors are non-parallel. Non-parallel vectors are vectors which are neither parallel nor perpendicular to each other. """ if self.is_parallel(vector) is not True and self.is_perpendicular(vector) is not True: return True # depe...
def add_effect(effect_id, *args, **kwargs): '''If inside a side-effect, adds an effect to it.''' effect = fiber.get_stack_var(SIDE_EFFECT_TAG) if effect is None: return False effect.add_effect(effect_id, *args, **kwargs) return True
def function[add_effect, parameter[effect_id]]: constant[If inside a side-effect, adds an effect to it.] variable[effect] assign[=] call[name[fiber].get_stack_var, parameter[name[SIDE_EFFECT_TAG]]] if compare[name[effect] is constant[None]] begin[:] return[constant[False]] call[n...
keyword[def] identifier[add_effect] ( identifier[effect_id] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[effect] = identifier[fiber] . identifier[get_stack_var] ( identifier[SIDE_EFFECT_TAG] ) keyword[if] identifier[effect] keyword[is] keyword[None] : keyword[re...
def add_effect(effect_id, *args, **kwargs): """If inside a side-effect, adds an effect to it.""" effect = fiber.get_stack_var(SIDE_EFFECT_TAG) if effect is None: return False # depends on [control=['if'], data=[]] effect.add_effect(effect_id, *args, **kwargs) return True
def encode(codec, stream): """Wraps openjp2 library function opj_encode. Encode an image into a JPEG 2000 codestream. Parameters ---------- codec : CODEC_TYPE The jpeg2000 codec. stream : STREAM_TYPE_P The stream to which data is written. Raises ------ RuntimeError...
def function[encode, parameter[codec, stream]]: constant[Wraps openjp2 library function opj_encode. Encode an image into a JPEG 2000 codestream. Parameters ---------- codec : CODEC_TYPE The jpeg2000 codec. stream : STREAM_TYPE_P The stream to which data is written. Rai...
keyword[def] identifier[encode] ( identifier[codec] , identifier[stream] ): literal[string] identifier[OPENJP2] . identifier[opj_encode] . identifier[argtypes] =[ identifier[CODEC_TYPE] , identifier[STREAM_TYPE_P] ] identifier[OPENJP2] . identifier[opj_encode] . identifier[restype] = identifier[check_...
def encode(codec, stream): """Wraps openjp2 library function opj_encode. Encode an image into a JPEG 2000 codestream. Parameters ---------- codec : CODEC_TYPE The jpeg2000 codec. stream : STREAM_TYPE_P The stream to which data is written. Raises ------ RuntimeError...
def CreateMock(self, class_to_mock): """Create a new mock object. Args: # class_to_mock: the class to be mocked class_to_mock: class Returns: MockObject that can be used as the class_to_mock would be. """ new_mock = MockObject(class_to_mock) self._mock_objects.append(new_moc...
def function[CreateMock, parameter[self, class_to_mock]]: constant[Create a new mock object. Args: # class_to_mock: the class to be mocked class_to_mock: class Returns: MockObject that can be used as the class_to_mock would be. ] variable[new_mock] assign[=] call[name[Moc...
keyword[def] identifier[CreateMock] ( identifier[self] , identifier[class_to_mock] ): literal[string] identifier[new_mock] = identifier[MockObject] ( identifier[class_to_mock] ) identifier[self] . identifier[_mock_objects] . identifier[append] ( identifier[new_mock] ) keyword[return] identifier...
def CreateMock(self, class_to_mock): """Create a new mock object. Args: # class_to_mock: the class to be mocked class_to_mock: class Returns: MockObject that can be used as the class_to_mock would be. """ new_mock = MockObject(class_to_mock) self._mock_objects.append(new_mock...
def ip_hide_community_list_holder_community_list_standard_instance(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip = ET.SubElement(config, "ip", xmlns="urn:brocade.com:mgmt:brocade-common-def") hide_community_list_holder = ET.SubElement(ip, "hide-comm...
def function[ip_hide_community_list_holder_community_list_standard_instance, parameter[self]]: constant[Auto Generated Code ] variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]] variable[ip] assign[=] call[name[ET].SubElement, parameter[name[config], constant[i...
keyword[def] identifier[ip_hide_community_list_holder_community_list_standard_instance] ( identifier[self] ,** identifier[kwargs] ): literal[string] identifier[config] = identifier[ET] . identifier[Element] ( literal[string] ) identifier[ip] = identifier[ET] . identifier[SubElement] ( iden...
def ip_hide_community_list_holder_community_list_standard_instance(self, **kwargs): """Auto Generated Code """ config = ET.Element('config') ip = ET.SubElement(config, 'ip', xmlns='urn:brocade.com:mgmt:brocade-common-def') hide_community_list_holder = ET.SubElement(ip, 'hide-community-list-holde...
def _font_name(self, ufo): """Generate a postscript-style font name.""" family_name = ( ufo.info.familyName.replace(" ", "") if ufo.info.familyName is not None else "None" ) style_name = ( ufo.info.styleName.replace(" ", "") if ...
def function[_font_name, parameter[self, ufo]]: constant[Generate a postscript-style font name.] variable[family_name] assign[=] <ast.IfExp object at 0x7da1b1112d70> variable[style_name] assign[=] <ast.IfExp object at 0x7da1b12c4f10> return[call[constant[{}-{}].format, parameter[name[family_...
keyword[def] identifier[_font_name] ( identifier[self] , identifier[ufo] ): literal[string] identifier[family_name] =( identifier[ufo] . identifier[info] . identifier[familyName] . identifier[replace] ( literal[string] , literal[string] ) keyword[if] identifier[ufo] . identifier[...
def _font_name(self, ufo): """Generate a postscript-style font name.""" family_name = ufo.info.familyName.replace(' ', '') if ufo.info.familyName is not None else 'None' style_name = ufo.info.styleName.replace(' ', '') if ufo.info.styleName is not None else 'None' return '{}-{}'.format(family_name, styl...
def cmd_queue_peaks(self): """Generate a list of the requests peaks on the queue. A queue peak is defined by the biggest value on the backend queue on a series of log lines that are between log lines without being queued. .. warning:: Allow to configure up to which pe...
def function[cmd_queue_peaks, parameter[self]]: constant[Generate a list of the requests peaks on the queue. A queue peak is defined by the biggest value on the backend queue on a series of log lines that are between log lines without being queued. .. warning:: Allow ...
keyword[def] identifier[cmd_queue_peaks] ( identifier[self] ): literal[string] identifier[threshold] = literal[int] identifier[peaks] =[] identifier[current_peak] = literal[int] identifier[current_queue] = literal[int] identifier[current_span] = literal[int] ...
def cmd_queue_peaks(self): """Generate a list of the requests peaks on the queue. A queue peak is defined by the biggest value on the backend queue on a series of log lines that are between log lines without being queued. .. warning:: Allow to configure up to which peak c...
def ManagedCreate(super_cls): """Dynamically creates a `create` method for a `ObjectSet.Managed` class that calls the `super_cls.create`. The first positional argument that is passed to the `super_cls.create` is the `_manager` that was set using `ObjectSet.Managed`. The created object is added to t...
def function[ManagedCreate, parameter[super_cls]]: constant[Dynamically creates a `create` method for a `ObjectSet.Managed` class that calls the `super_cls.create`. The first positional argument that is passed to the `super_cls.create` is the `_manager` that was set using `ObjectSet.Managed`. The c...
keyword[def] identifier[ManagedCreate] ( identifier[super_cls] ): literal[string] @ identifier[wraps] ( identifier[super_cls] . identifier[create] ) keyword[async] keyword[def] identifier[_create] ( identifier[self] ,* identifier[args] ,** identifier[kwargs] ): identifier[cls] = identifier[...
def ManagedCreate(super_cls): """Dynamically creates a `create` method for a `ObjectSet.Managed` class that calls the `super_cls.create`. The first positional argument that is passed to the `super_cls.create` is the `_manager` that was set using `ObjectSet.Managed`. The created object is added to t...
def queue_async_stats_job(klass, account, ids, metric_groups, **kwargs): """ Queues a list of metrics for a specified set of object IDs asynchronously """ params = klass._standard_params(ids, metric_groups, **kwargs) params['platform'] = kwargs.get('platform', None) para...
def function[queue_async_stats_job, parameter[klass, account, ids, metric_groups]]: constant[ Queues a list of metrics for a specified set of object IDs asynchronously ] variable[params] assign[=] call[name[klass]._standard_params, parameter[name[ids], name[metric_groups]]] call[...
keyword[def] identifier[queue_async_stats_job] ( identifier[klass] , identifier[account] , identifier[ids] , identifier[metric_groups] ,** identifier[kwargs] ): literal[string] identifier[params] = identifier[klass] . identifier[_standard_params] ( identifier[ids] , identifier[metric_groups] ,** id...
def queue_async_stats_job(klass, account, ids, metric_groups, **kwargs): """ Queues a list of metrics for a specified set of object IDs asynchronously """ params = klass._standard_params(ids, metric_groups, **kwargs) params['platform'] = kwargs.get('platform', None) params['country'] = k...
def on_remove_row(self, event, row_num=-1): """ Remove specified grid row. If no row number is given, remove the last row. """ text = "Are you sure? If you select delete you won't be able to retrieve these rows..." dia = pw.ChooseOne(self, "Yes, delete rows", "Leave rows...
def function[on_remove_row, parameter[self, event, row_num]]: constant[ Remove specified grid row. If no row number is given, remove the last row. ] variable[text] assign[=] constant[Are you sure? If you select delete you won't be able to retrieve these rows...] variable...
keyword[def] identifier[on_remove_row] ( identifier[self] , identifier[event] , identifier[row_num] =- literal[int] ): literal[string] identifier[text] = literal[string] identifier[dia] = identifier[pw] . identifier[ChooseOne] ( identifier[self] , literal[string] , literal[string] , ident...
def on_remove_row(self, event, row_num=-1): """ Remove specified grid row. If no row number is given, remove the last row. """ text = "Are you sure? If you select delete you won't be able to retrieve these rows..." dia = pw.ChooseOne(self, 'Yes, delete rows', 'Leave rows for now', t...
def set_home(self, new_home): """ Sets the user's home. The argument can be a Position object or a tuple containing location data. """ if type(new_home) is Position: self.home = new_home elif type(new_home) is tuple: self.home = Position(location=...
def function[set_home, parameter[self, new_home]]: constant[ Sets the user's home. The argument can be a Position object or a tuple containing location data. ] if compare[call[name[type], parameter[name[new_home]]] is name[Position]] begin[:] name[self].home assig...
keyword[def] identifier[set_home] ( identifier[self] , identifier[new_home] ): literal[string] keyword[if] identifier[type] ( identifier[new_home] ) keyword[is] identifier[Position] : identifier[self] . identifier[home] = identifier[new_home] keyword[elif] identifier[type...
def set_home(self, new_home): """ Sets the user's home. The argument can be a Position object or a tuple containing location data. """ if type(new_home) is Position: self.home = new_home # depends on [control=['if'], data=[]] elif type(new_home) is tuple: self.home =...
def remove_child(self, idx=None, *, name=None, node=None): """Remove a child node from the current node instance. :param idx: Index of child node to be removed. :type idx: int :param name: The first child node found with «name» will be removed. :type name: str :param n...
def function[remove_child, parameter[self, idx]]: constant[Remove a child node from the current node instance. :param idx: Index of child node to be removed. :type idx: int :param name: The first child node found with «name» will be removed. :type name: str :param node...
keyword[def] identifier[remove_child] ( identifier[self] , identifier[idx] = keyword[None] ,*, identifier[name] = keyword[None] , identifier[node] = keyword[None] ): literal[string] keyword[if] ( identifier[idx] keyword[and] identifier[isinstance] ( identifier[idx] , identifier[int] ) keyword[and...
def remove_child(self, idx=None, *, name=None, node=None): """Remove a child node from the current node instance. :param idx: Index of child node to be removed. :type idx: int :param name: The first child node found with «name» will be removed. :type name: str :param node:...
def verbose(self): """ Make it the verbose log. A verbose log can be only shown when user want to see more logs. It works as:: log.verbose.warn('this is a verbose warn') log.verbose.info('this is a verbose info') """ log = copy.copy(self) ...
def function[verbose, parameter[self]]: constant[ Make it the verbose log. A verbose log can be only shown when user want to see more logs. It works as:: log.verbose.warn('this is a verbose warn') log.verbose.info('this is a verbose info') ] vari...
keyword[def] identifier[verbose] ( identifier[self] ): literal[string] identifier[log] = identifier[copy] . identifier[copy] ( identifier[self] ) identifier[log] . identifier[_is_verbose] = keyword[True] keyword[return] identifier[log]
def verbose(self): """ Make it the verbose log. A verbose log can be only shown when user want to see more logs. It works as:: log.verbose.warn('this is a verbose warn') log.verbose.info('this is a verbose info') """ log = copy.copy(self) log._is_ver...
def _get_hanging_wall_coeffs_mag(self, C, mag): """ Returns the hanging wall magnitude term defined in equation 14 """ if mag < 5.5: return 0.0 elif mag > 6.5: return 1.0 + C["a2"] * (mag - 6.5) else: return (mag - 5.5) * (1.0 + C["a2"]...
def function[_get_hanging_wall_coeffs_mag, parameter[self, C, mag]]: constant[ Returns the hanging wall magnitude term defined in equation 14 ] if compare[name[mag] less[<] constant[5.5]] begin[:] return[constant[0.0]]
keyword[def] identifier[_get_hanging_wall_coeffs_mag] ( identifier[self] , identifier[C] , identifier[mag] ): literal[string] keyword[if] identifier[mag] < literal[int] : keyword[return] literal[int] keyword[elif] identifier[mag] > literal[int] : keyword[retur...
def _get_hanging_wall_coeffs_mag(self, C, mag): """ Returns the hanging wall magnitude term defined in equation 14 """ if mag < 5.5: return 0.0 # depends on [control=['if'], data=[]] elif mag > 6.5: return 1.0 + C['a2'] * (mag - 6.5) # depends on [control=['if'], data=['mag...
def template_filter(self, name: Optional[str]=None) -> Callable: """Add a template filter. This is designed to be used as a decorator. An example usage, .. code-block:: python @app.template_filter('name') def to_upper(value): return value.upper() ...
def function[template_filter, parameter[self, name]]: constant[Add a template filter. This is designed to be used as a decorator. An example usage, .. code-block:: python @app.template_filter('name') def to_upper(value): return value.upper() Ar...
keyword[def] identifier[template_filter] ( identifier[self] , identifier[name] : identifier[Optional] [ identifier[str] ]= keyword[None] )-> identifier[Callable] : literal[string] keyword[def] identifier[decorator] ( identifier[func] : identifier[Callable] )-> identifier[Callable] : i...
def template_filter(self, name: Optional[str]=None) -> Callable: """Add a template filter. This is designed to be used as a decorator. An example usage, .. code-block:: python @app.template_filter('name') def to_upper(value): return value.upper() A...
def _number_shapes_ancestors(self, topoTypeA, topoTypeB, topologicalEntity): '''returns the number of shape ancestors If you want to know how many edges a faces has: _number_shapes_ancestors(self, TopAbs_EDGE, TopAbs_FACE, edg) will return the number of edges a faces has @pa...
def function[_number_shapes_ancestors, parameter[self, topoTypeA, topoTypeB, topologicalEntity]]: constant[returns the number of shape ancestors If you want to know how many edges a faces has: _number_shapes_ancestors(self, TopAbs_EDGE, TopAbs_FACE, edg) will return the number of edges a...
keyword[def] identifier[_number_shapes_ancestors] ( identifier[self] , identifier[topoTypeA] , identifier[topoTypeB] , identifier[topologicalEntity] ): literal[string] identifier[topo_set] = identifier[set] () identifier[_map] = identifier[TopTools_IndexedDataMapOfShapeListOfShape] () ...
def _number_shapes_ancestors(self, topoTypeA, topoTypeB, topologicalEntity): """returns the number of shape ancestors If you want to know how many edges a faces has: _number_shapes_ancestors(self, TopAbs_EDGE, TopAbs_FACE, edg) will return the number of edges a faces has @param topoT...
def gisland(self, dae): """Reset g(x) for islanded buses and areas""" if (not self.islanded_buses) and (not self.island_sets): return a, v = list(), list() # for islanded areas without a slack bus # TODO: fix for islanded sets without sw # for island in self...
def function[gisland, parameter[self, dae]]: constant[Reset g(x) for islanded buses and areas] if <ast.BoolOp object at 0x7da18dc9abc0> begin[:] return[None] <ast.Tuple object at 0x7da18dc9baf0> assign[=] tuple[[<ast.Call object at 0x7da18dc9b670>, <ast.Call object at 0x7da18dc99450>]] ...
keyword[def] identifier[gisland] ( identifier[self] , identifier[dae] ): literal[string] keyword[if] ( keyword[not] identifier[self] . identifier[islanded_buses] ) keyword[and] ( keyword[not] identifier[self] . identifier[island_sets] ): keyword[return] identifier[a] , ide...
def gisland(self, dae): """Reset g(x) for islanded buses and areas""" if not self.islanded_buses and (not self.island_sets): return # depends on [control=['if'], data=[]] (a, v) = (list(), list()) # for islanded areas without a slack bus # TODO: fix for islanded sets without sw # for is...
def redirect_to_assignment_override_for_section(self, assignment_id, course_section_id): """ Redirect to the assignment override for a section. Responds with a redirect to the override for the given section, if any (404 otherwise). """ path = {} data = {}...
def function[redirect_to_assignment_override_for_section, parameter[self, assignment_id, course_section_id]]: constant[ Redirect to the assignment override for a section. Responds with a redirect to the override for the given section, if any (404 otherwise). ] variable[p...
keyword[def] identifier[redirect_to_assignment_override_for_section] ( identifier[self] , identifier[assignment_id] , identifier[course_section_id] ): literal[string] identifier[path] ={} identifier[data] ={} identifier[params] ={} literal[string] ...
def redirect_to_assignment_override_for_section(self, assignment_id, course_section_id): """ Redirect to the assignment override for a section. Responds with a redirect to the override for the given section, if any (404 otherwise). """ path = {} data = {} params = {} # ...
def find(self, id, columns=None): """ Find a model by its primary key :param id: The primary key value :type id: mixed :param columns: The columns to retrieve :type columns: list :return: The found model :rtype: orator.Model """ if colum...
def function[find, parameter[self, id, columns]]: constant[ Find a model by its primary key :param id: The primary key value :type id: mixed :param columns: The columns to retrieve :type columns: list :return: The found model :rtype: orator.Model ...
keyword[def] identifier[find] ( identifier[self] , identifier[id] , identifier[columns] = keyword[None] ): literal[string] keyword[if] identifier[columns] keyword[is] keyword[None] : identifier[columns] =[ literal[string] ] keyword[if] identifier[isinstance] ( identifier[...
def find(self, id, columns=None): """ Find a model by its primary key :param id: The primary key value :type id: mixed :param columns: The columns to retrieve :type columns: list :return: The found model :rtype: orator.Model """ if columns is No...
def update_recurring(self, recurring_id, recurring_dict): """ Updates a recurring :param recurring_id: the recurring id :param recurring_dict: dict :return: dict """ return self._create_put_request(resource=RECURRINGS, billomat_id=recurring_id, send_data=recurrin...
def function[update_recurring, parameter[self, recurring_id, recurring_dict]]: constant[ Updates a recurring :param recurring_id: the recurring id :param recurring_dict: dict :return: dict ] return[call[name[self]._create_put_request, parameter[]]]
keyword[def] identifier[update_recurring] ( identifier[self] , identifier[recurring_id] , identifier[recurring_dict] ): literal[string] keyword[return] identifier[self] . identifier[_create_put_request] ( identifier[resource] = identifier[RECURRINGS] , identifier[billomat_id] = identifier[recurrin...
def update_recurring(self, recurring_id, recurring_dict): """ Updates a recurring :param recurring_id: the recurring id :param recurring_dict: dict :return: dict """ return self._create_put_request(resource=RECURRINGS, billomat_id=recurring_id, send_data=recurring_dict)
def iterscan(self, match="*", count=1000): """ Much slower than iter(), but much more memory efficient if k/v's retrieved are one-offs @match: matches member names in the sorted set @count: the user specified the amount of work that should be done at every ca...
def function[iterscan, parameter[self, match, count]]: constant[ Much slower than iter(), but much more memory efficient if k/v's retrieved are one-offs @match: matches member names in the sorted set @count: the user specified the amount of work that should be done ...
keyword[def] identifier[iterscan] ( identifier[self] , identifier[match] = literal[string] , identifier[count] = literal[int] ): literal[string] keyword[if] identifier[self] . identifier[serialized] : keyword[return] identifier[map] ( keyword[lambda] identifier[x] :( id...
def iterscan(self, match='*', count=1000): """ Much slower than iter(), but much more memory efficient if k/v's retrieved are one-offs @match: matches member names in the sorted set @count: the user specified the amount of work that should be done at every call i...
def override_tab_value(data, headers, new_value=' ', **_): """Override tab values in the *data* with *new_value*. :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. :param new_value: The new value to use for tab. :return: The processed dat...
def function[override_tab_value, parameter[data, headers, new_value]]: constant[Override tab values in the *data* with *new_value*. :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. :param new_value: The new value to use for tab. :return...
keyword[def] identifier[override_tab_value] ( identifier[data] , identifier[headers] , identifier[new_value] = literal[string] ,** identifier[_] ): literal[string] keyword[return] (([ identifier[v] . identifier[replace] ( literal[string] , identifier[new_value] ) keyword[if] identifier[isinstance] ( ident...
def override_tab_value(data, headers, new_value=' ', **_): """Override tab values in the *data* with *new_value*. :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. :param new_value: The new value to use for tab. :return: The processed dat...
def _set_dst_vtep_ip_any(self, v, load=False): """ Setter method for dst_vtep_ip_any, mapped from YANG variable /overlay/access_list/type/vxlan/standard/seq/dst_vtep_ip_any (empty) If this variable is read-only (config: false) in the source YANG file, then _set_dst_vtep_ip_any is considered as a private...
def function[_set_dst_vtep_ip_any, parameter[self, v, load]]: constant[ Setter method for dst_vtep_ip_any, mapped from YANG variable /overlay/access_list/type/vxlan/standard/seq/dst_vtep_ip_any (empty) If this variable is read-only (config: false) in the source YANG file, then _set_dst_vtep_ip_any i...
keyword[def] identifier[_set_dst_vtep_ip_any] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ): literal[string] keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ): identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] ) keyword[try] : ...
def _set_dst_vtep_ip_any(self, v, load=False): """ Setter method for dst_vtep_ip_any, mapped from YANG variable /overlay/access_list/type/vxlan/standard/seq/dst_vtep_ip_any (empty) If this variable is read-only (config: false) in the source YANG file, then _set_dst_vtep_ip_any is considered as a private...
def decode(buff): """ Transforms the raw buffer data read in into a list of bytes """ pp = list(map(ord, buff)) if 0 == len(pp) == 1: pp = [] return pp
def function[decode, parameter[buff]]: constant[ Transforms the raw buffer data read in into a list of bytes ] variable[pp] assign[=] call[name[list], parameter[call[name[map], parameter[name[ord], name[buff]]]]] if compare[constant[0] equal[==] call[name[len], parameter[name[pp]]]] begin[:]...
keyword[def] identifier[decode] ( identifier[buff] ): literal[string] identifier[pp] = identifier[list] ( identifier[map] ( identifier[ord] , identifier[buff] )) keyword[if] literal[int] == identifier[len] ( identifier[pp] )== literal[int] : identifier[pp] =[] keyword[return] identifier[pp]
def decode(buff): """ Transforms the raw buffer data read in into a list of bytes """ pp = list(map(ord, buff)) if 0 == len(pp) == 1: pp = [] # depends on [control=['if'], data=[]] return pp
def internal_error (out=stderr, etype=None, evalue=None, tb=None): """Print internal error message (output defaults to stderr).""" print(os.linesep, file=out) print(_("""********** Oops, I did it again. ************* You have found an internal error in LinkChecker. Please write a bug report at %s and inclu...
def function[internal_error, parameter[out, etype, evalue, tb]]: constant[Print internal error message (output defaults to stderr).] call[name[print], parameter[name[os].linesep]] call[name[print], parameter[binary_operation[call[name[_], parameter[constant[********** Oops, I did it again. *****...
keyword[def] identifier[internal_error] ( identifier[out] = identifier[stderr] , identifier[etype] = keyword[None] , identifier[evalue] = keyword[None] , identifier[tb] = keyword[None] ): literal[string] identifier[print] ( identifier[os] . identifier[linesep] , identifier[file] = identifier[out] ) id...
def internal_error(out=stderr, etype=None, evalue=None, tb=None): """Print internal error message (output defaults to stderr).""" print(os.linesep, file=out) print(_('********** Oops, I did it again. *************\n\nYou have found an internal error in LinkChecker. Please write a bug report\nat %s\nand incl...
def auth_get_token(self, check_scope=True): 'Refresh or acquire access_token.' res = self.auth_access_data_raw = self._auth_token_request() return self._auth_token_process(res, check_scope=check_scope)
def function[auth_get_token, parameter[self, check_scope]]: constant[Refresh or acquire access_token.] variable[res] assign[=] call[name[self]._auth_token_request, parameter[]] return[call[name[self]._auth_token_process, parameter[name[res]]]]
keyword[def] identifier[auth_get_token] ( identifier[self] , identifier[check_scope] = keyword[True] ): literal[string] identifier[res] = identifier[self] . identifier[auth_access_data_raw] = identifier[self] . identifier[_auth_token_request] () keyword[return] identifier[self] . identifier[_auth_token_pro...
def auth_get_token(self, check_scope=True): """Refresh or acquire access_token.""" res = self.auth_access_data_raw = self._auth_token_request() return self._auth_token_process(res, check_scope=check_scope)
def modified_environ(*remove: str, **update: str) -> Iterator[None]: """ Temporarily updates the ``os.environ`` dictionary in-place and resets it to the original state when finished. (https://stackoverflow.com/questions/2059482/ python-temporarily-modify-the-current-processs-environment/34333710...
def function[modified_environ, parameter[]]: constant[ Temporarily updates the ``os.environ`` dictionary in-place and resets it to the original state when finished. (https://stackoverflow.com/questions/2059482/ python-temporarily-modify-the-current-processs-environment/34333710#34333710) ...
keyword[def] identifier[modified_environ] (* identifier[remove] : identifier[str] ,** identifier[update] : identifier[str] )-> identifier[Iterator] [ keyword[None] ]: literal[string] identifier[env] = identifier[os] . identifier[environ] identifier[update] = identifier[update] keyword[or] {} id...
def modified_environ(*remove: str, **update: str) -> Iterator[None]: """ Temporarily updates the ``os.environ`` dictionary in-place and resets it to the original state when finished. (https://stackoverflow.com/questions/2059482/ python-temporarily-modify-the-current-processs-environment/34333710...
def get_output_shapes(self): """Get the shapes of the outputs.""" outputs = self.execs[0].outputs shapes = [out.shape for out in outputs] concat_shapes = [] for key, the_shape, axis in zip(self.symbol.list_outputs(), shapes, self.output_layouts): the_shape = list(the...
def function[get_output_shapes, parameter[self]]: constant[Get the shapes of the outputs.] variable[outputs] assign[=] call[name[self].execs][constant[0]].outputs variable[shapes] assign[=] <ast.ListComp object at 0x7da1b2066530> variable[concat_shapes] assign[=] list[[]] for tag...
keyword[def] identifier[get_output_shapes] ( identifier[self] ): literal[string] identifier[outputs] = identifier[self] . identifier[execs] [ literal[int] ]. identifier[outputs] identifier[shapes] =[ identifier[out] . identifier[shape] keyword[for] identifier[out] keyword[in] identifi...
def get_output_shapes(self): """Get the shapes of the outputs.""" outputs = self.execs[0].outputs shapes = [out.shape for out in outputs] concat_shapes = [] for (key, the_shape, axis) in zip(self.symbol.list_outputs(), shapes, self.output_layouts): the_shape = list(the_shape) if axis...
def dirtool(operation, directory): """ Tools For Directories (If Exists, Make And Delete) :raises ValueError: Nor a string or a list was provided. """ operation = operation.lower() if operation == 'exists': return bool(os.path.exists(directory)) if operation == 'create': os....
def function[dirtool, parameter[operation, directory]]: constant[ Tools For Directories (If Exists, Make And Delete) :raises ValueError: Nor a string or a list was provided. ] variable[operation] assign[=] call[name[operation].lower, parameter[]] if compare[name[operation] equal[==]...
keyword[def] identifier[dirtool] ( identifier[operation] , identifier[directory] ): literal[string] identifier[operation] = identifier[operation] . identifier[lower] () keyword[if] identifier[operation] == literal[string] : keyword[return] identifier[bool] ( identifier[os] . identifier[path...
def dirtool(operation, directory): """ Tools For Directories (If Exists, Make And Delete) :raises ValueError: Nor a string or a list was provided. """ operation = operation.lower() if operation == 'exists': return bool(os.path.exists(directory)) # depends on [control=['if'], data=[]] ...
def find_source_files_from_list(self, file_names): """ Finds all source files that actually exists from a list of file names. :param list[str] file_names: The list of file names. """ for file_name in file_names: if os.path.exists(file_name): routine_n...
def function[find_source_files_from_list, parameter[self, file_names]]: constant[ Finds all source files that actually exists from a list of file names. :param list[str] file_names: The list of file names. ] for taget[name[file_name]] in starred[name[file_names]] begin[:] ...
keyword[def] identifier[find_source_files_from_list] ( identifier[self] , identifier[file_names] ): literal[string] keyword[for] identifier[file_name] keyword[in] identifier[file_names] : keyword[if] identifier[os] . identifier[path] . identifier[exists] ( identifier[file_name] ): ...
def find_source_files_from_list(self, file_names): """ Finds all source files that actually exists from a list of file names. :param list[str] file_names: The list of file names. """ for file_name in file_names: if os.path.exists(file_name): routine_name = os.path.sp...
def date_decoder(dic): """Add python types decoding. See JsonEncoder""" if '__date__' in dic: try: d = datetime.date(**{c: v for c, v in dic.items() if not c == "__date__"}) except (TypeError, ValueError): raise json.JSONDecodeError("Corrupted date format !", str(dic), 1)...
def function[date_decoder, parameter[dic]]: constant[Add python types decoding. See JsonEncoder] if compare[constant[__date__] in name[dic]] begin[:] <ast.Try object at 0x7da1b1110940> return[name[d]]
keyword[def] identifier[date_decoder] ( identifier[dic] ): literal[string] keyword[if] literal[string] keyword[in] identifier[dic] : keyword[try] : identifier[d] = identifier[datetime] . identifier[date] (**{ identifier[c] : identifier[v] keyword[for] identifier[c] , identifier[v...
def date_decoder(dic): """Add python types decoding. See JsonEncoder""" if '__date__' in dic: try: d = datetime.date(**{c: v for (c, v) in dic.items() if not c == '__date__'}) # depends on [control=['try'], data=[]] except (TypeError, ValueError): raise json.JSONDecodeEr...
def add(self, name, session, **kwargs): '''taobao.postage.add 添加邮费模板 添加邮费模板 新增的邮费模板属于当前会话用户 postage_mode_types、postage_mode_dests、postage_mode_prices、 postage_mode_increases四个字段组合起来表示邮费的子模板列表。每个邮费子模板都包含了type(邮费类型,有post、 express、ems可以选择)、dest(邮费模板应用地区,每个模板可以使用...
def function[add, parameter[self, name, session]]: constant[taobao.postage.add 添加邮费模板 添加邮费模板 新增的邮费模板属于当前会话用户 postage_mode_types、postage_mode_dests、postage_mode_prices、 postage_mode_increases四个字段组合起来表示邮费的子模板列表。每个邮费子模板都包含了type(邮费类型,有post、 express、ems可以选择)、dest(...
keyword[def] identifier[add] ( identifier[self] , identifier[name] , identifier[session] ,** identifier[kwargs] ): literal[string] identifier[request] = identifier[TOPRequest] ( literal[string] ) identifier[request] [ literal[string] ]= identifier[name] keyword[for] identifier[k...
def add(self, name, session, **kwargs): """taobao.postage.add 添加邮费模板 添加邮费模板 新增的邮费模板属于当前会话用户 postage_mode_types、postage_mode_dests、postage_mode_prices、 postage_mode_increases四个字段组合起来表示邮费的子模板列表。每个邮费子模板都包含了type(邮费类型,有post、 express、ems可以选择)、dest(邮费模板应用地区,每个模板可以使用于多个地...
async def stream(self, event_type: Type[TStreamEvent], num_events: Optional[int] = None) -> AsyncGenerator[TStreamEvent, None]: """ Stream all events that match the specified event type. This returns an ``AsyncIterable[BaseEvent]`` which can be consumed ...
<ast.AsyncFunctionDef object at 0x7da1b0e2c370>
keyword[async] keyword[def] identifier[stream] ( identifier[self] , identifier[event_type] : identifier[Type] [ identifier[TStreamEvent] ], identifier[num_events] : identifier[Optional] [ identifier[int] ]= keyword[None] )-> identifier[AsyncGenerator] [ identifier[TStreamEvent] , keyword[None] ]: literal[...
async def stream(self, event_type: Type[TStreamEvent], num_events: Optional[int]=None) -> AsyncGenerator[TStreamEvent, None]: """ Stream all events that match the specified event type. This returns an ``AsyncIterable[BaseEvent]`` which can be consumed through an ``async for`` loop. An option...
def main(self, argv=None, loop=LOOP_NEVER): """A possible mainline handler for a script, like so: import cmdln class MyCmd(cmdln.Cmdln): name = "mycmd" ... if __name__ == "__main__": MyCmd().main() By default this wil...
def function[main, parameter[self, argv, loop]]: constant[A possible mainline handler for a script, like so: import cmdln class MyCmd(cmdln.Cmdln): name = "mycmd" ... if __name__ == "__main__": MyCmd().main() By defau...
keyword[def] identifier[main] ( identifier[self] , identifier[argv] = keyword[None] , identifier[loop] = identifier[LOOP_NEVER] ): literal[string] keyword[if] identifier[argv] keyword[is] keyword[None] : keyword[import] identifier[sys] identifier[argv] = identifier[sy...
def main(self, argv=None, loop=LOOP_NEVER): """A possible mainline handler for a script, like so: import cmdln class MyCmd(cmdln.Cmdln): name = "mycmd" ... if __name__ == "__main__": MyCmd().main() By default this will us...
def _calc_xy(self, xxx_todo_changeme, angle, length): """ Calculates the coordinates after a specific saccade was made. Parameters: (x,y) : tuple of floats or ints The coordinates before the saccade was made angle : float or int Th...
def function[_calc_xy, parameter[self, xxx_todo_changeme, angle, length]]: constant[ Calculates the coordinates after a specific saccade was made. Parameters: (x,y) : tuple of floats or ints The coordinates before the saccade was made angle : floa...
keyword[def] identifier[_calc_xy] ( identifier[self] , identifier[xxx_todo_changeme] , identifier[angle] , identifier[length] ): literal[string] ( identifier[x] , identifier[y] )= identifier[xxx_todo_changeme] keyword[return] ( identifier[x] +( identifier[cos] ( identifier[radians] ( ident...
def _calc_xy(self, xxx_todo_changeme, angle, length): """ Calculates the coordinates after a specific saccade was made. Parameters: (x,y) : tuple of floats or ints The coordinates before the saccade was made angle : float or int The an...
def toxml(self): """ Exports this object into a LEMS XML object """ return '<ComponentRequirement name="{0}"'.format(self.name) + '' + \ (' description = "{0}"'.format(self.description) if self.description else '') +\ '/>'
def function[toxml, parameter[self]]: constant[ Exports this object into a LEMS XML object ] return[binary_operation[binary_operation[binary_operation[call[constant[<ComponentRequirement name="{0}"].format, parameter[name[self].name]] + constant[]] + <ast.IfExp object at 0x7da1b24aed70>] + c...
keyword[def] identifier[toxml] ( identifier[self] ): literal[string] keyword[return] literal[string] . identifier[format] ( identifier[self] . identifier[name] )+ literal[string] +( literal[string] . identifier[format] ( identifier[self] . identifier[description] ) keyword[if] identifier[self] ....
def toxml(self): """ Exports this object into a LEMS XML object """ return '<ComponentRequirement name="{0}"'.format(self.name) + '' + (' description = "{0}"'.format(self.description) if self.description else '') + '/>'
def flush(self): """Flush all streams.""" if self.__logFileStream is not None: try: self.__logFileStream.flush() except: pass try: os.fsync(self.__logFileStream.fileno()) except: pass ...
def function[flush, parameter[self]]: constant[Flush all streams.] if compare[name[self].__logFileStream is_not constant[None]] begin[:] <ast.Try object at 0x7da1b0973520> <ast.Try object at 0x7da1b09709a0> if compare[name[self].__stdout is_not constant[None]] begin[:] <a...
keyword[def] identifier[flush] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[__logFileStream] keyword[is] keyword[not] keyword[None] : keyword[try] : identifier[self] . identifier[__logFileStream] . identifier[flush] () ...
def flush(self): """Flush all streams.""" if self.__logFileStream is not None: try: self.__logFileStream.flush() # depends on [control=['try'], data=[]] except: pass # depends on [control=['except'], data=[]] try: os.fsync(self.__logFileStream.fileno...
def parse_form_request(api_secret, request): """ >>> parse_form_request("123456",{"nonce": 1451122677, "msg": "helllo", "code": 0, "sign": "DB30F4D1112C20DFA736F65458F89C64"}) <Storage {'nonce': 1451122677, 'msg': 'helllo', 'code': 0, 'sign': 'DB30F4D1112C20DFA736F65458F89C64'}> """ if not c...
def function[parse_form_request, parameter[api_secret, request]]: constant[ >>> parse_form_request("123456",{"nonce": 1451122677, "msg": "helllo", "code": 0, "sign": "DB30F4D1112C20DFA736F65458F89C64"}) <Storage {'nonce': 1451122677, 'msg': 'helllo', 'code': 0, 'sign': 'DB30F4D1112C20DFA736F6545...
keyword[def] identifier[parse_form_request] ( identifier[api_secret] , identifier[request] ): literal[string] keyword[if] keyword[not] identifier[check_sign] ( identifier[api_secret] , identifier[request] ): keyword[raise] identifier[SignError] ( literal[string] ) keyword[return] identif...
def parse_form_request(api_secret, request): """ >>> parse_form_request("123456",{"nonce": 1451122677, "msg": "helllo", "code": 0, "sign": "DB30F4D1112C20DFA736F65458F89C64"}) <Storage {'nonce': 1451122677, 'msg': 'helllo', 'code': 0, 'sign': 'DB30F4D1112C20DFA736F65458F89C64'}> """ if not c...
def _select_binary_stream(self, name, urls): """Download a file from a list of urls, yielding a stream after downloading the file. URLs are tried in order until they succeed. :raises: :class:`BinaryToolFetcher.BinaryNotFound` if requests to all the given urls fail. """ downloaded_successfully = Fa...
def function[_select_binary_stream, parameter[self, name, urls]]: constant[Download a file from a list of urls, yielding a stream after downloading the file. URLs are tried in order until they succeed. :raises: :class:`BinaryToolFetcher.BinaryNotFound` if requests to all the given urls fail. ] ...
keyword[def] identifier[_select_binary_stream] ( identifier[self] , identifier[name] , identifier[urls] ): literal[string] identifier[downloaded_successfully] = keyword[False] identifier[accumulated_errors] =[] keyword[for] identifier[url] keyword[in] identifier[OrderedSet] ( identifier[urls]...
def _select_binary_stream(self, name, urls): """Download a file from a list of urls, yielding a stream after downloading the file. URLs are tried in order until they succeed. :raises: :class:`BinaryToolFetcher.BinaryNotFound` if requests to all the given urls fail. """ downloaded_successfully = Fa...
def size(self): """ size in bytes """ if not self._size: self._size = os.path.getsize(self._path) return self._size
def function[size, parameter[self]]: constant[ size in bytes ] if <ast.UnaryOp object at 0x7da18bcc8d90> begin[:] name[self]._size assign[=] call[name[os].path.getsize, parameter[name[self]._path]] return[name[self]._size]
keyword[def] identifier[size] ( identifier[self] ): literal[string] keyword[if] keyword[not] identifier[self] . identifier[_size] : identifier[self] . identifier[_size] = identifier[os] . identifier[path] . identifier[getsize] ( identifier[self] . identifier[_path] ) keyword...
def size(self): """ size in bytes """ if not self._size: self._size = os.path.getsize(self._path) # depends on [control=['if'], data=[]] return self._size
def _append(self, signature, fields=(), response=None): """ Add a message to the outgoing queue. :arg signature: the signature of the message :arg fields: the fields of the message as a tuple :arg response: a response object to handle callbacks """ self.packer.pack_struc...
def function[_append, parameter[self, signature, fields, response]]: constant[ Add a message to the outgoing queue. :arg signature: the signature of the message :arg fields: the fields of the message as a tuple :arg response: a response object to handle callbacks ] call[...
keyword[def] identifier[_append] ( identifier[self] , identifier[signature] , identifier[fields] =(), identifier[response] = keyword[None] ): literal[string] identifier[self] . identifier[packer] . identifier[pack_struct] ( identifier[signature] , identifier[fields] ) identifier[self] . id...
def _append(self, signature, fields=(), response=None): """ Add a message to the outgoing queue. :arg signature: the signature of the message :arg fields: the fields of the message as a tuple :arg response: a response object to handle callbacks """ self.packer.pack_struct(signat...
def check_house_number(self, token): """ Attempts to find a house number, generally the first thing in an address. If anything is in front of it, we assume it is a building name. """ if self.street and self.house_number is None and re.match(street_num_regex, token.lower()): ...
def function[check_house_number, parameter[self, token]]: constant[ Attempts to find a house number, generally the first thing in an address. If anything is in front of it, we assume it is a building name. ] if <ast.BoolOp object at 0x7da1b112b130> begin[:] if com...
keyword[def] identifier[check_house_number] ( identifier[self] , identifier[token] ): literal[string] keyword[if] identifier[self] . identifier[street] keyword[and] identifier[self] . identifier[house_number] keyword[is] keyword[None] keyword[and] identifier[re] . identifier[match] ( identif...
def check_house_number(self, token): """ Attempts to find a house number, generally the first thing in an address. If anything is in front of it, we assume it is a building name. """ if self.street and self.house_number is None and re.match(street_num_regex, token.lower()): if '/...
def check_if_alive(self): """Check if the content is available on the host server. Returns `True` if available, else `False`. This method is `lazy`-evaluated or only executes when called. :rtype: bool """ try: from urllib2 import urlopen, URLError, HTTPError ...
def function[check_if_alive, parameter[self]]: constant[Check if the content is available on the host server. Returns `True` if available, else `False`. This method is `lazy`-evaluated or only executes when called. :rtype: bool ] <ast.Try object at 0x7da18f09e1d0> if call[nam...
keyword[def] identifier[check_if_alive] ( identifier[self] ): literal[string] keyword[try] : keyword[from] identifier[urllib2] keyword[import] identifier[urlopen] , identifier[URLError] , identifier[HTTPError] keyword[except] identifier[ImportError] : keywor...
def check_if_alive(self): """Check if the content is available on the host server. Returns `True` if available, else `False`. This method is `lazy`-evaluated or only executes when called. :rtype: bool """ try: from urllib2 import urlopen, URLError, HTTPError # depends on [contro...
def safe_unicode(self, buf): """ Safely return an unicode encoded string """ tmp = "" buf = "".join(b for b in buf) for character in buf: tmp += character return tmp
def function[safe_unicode, parameter[self, buf]]: constant[ Safely return an unicode encoded string ] variable[tmp] assign[=] constant[] variable[buf] assign[=] call[constant[].join, parameter[<ast.GeneratorExp object at 0x7da18f58f1c0>]] for taget[name[character]] in sta...
keyword[def] identifier[safe_unicode] ( identifier[self] , identifier[buf] ): literal[string] identifier[tmp] = literal[string] identifier[buf] = literal[string] . identifier[join] ( identifier[b] keyword[for] identifier[b] keyword[in] identifier[buf] ) keyword[for] identifi...
def safe_unicode(self, buf): """ Safely return an unicode encoded string """ tmp = '' buf = ''.join((b for b in buf)) for character in buf: tmp += character # depends on [control=['for'], data=['character']] return tmp
def get_tmaster(self, topologyName, callback=None): """ get tmaster """ isWatching = False # Temp dict used to return result # if callback is not provided. ret = { "result": None } if callback: isWatching = True else: def callback(data): """ Custom ca...
def function[get_tmaster, parameter[self, topologyName, callback]]: constant[ get tmaster ] variable[isWatching] assign[=] constant[False] variable[ret] assign[=] dictionary[[<ast.Constant object at 0x7da2054a75b0>], [<ast.Constant object at 0x7da2054a5210>]] if name[callback] begin[:] ...
keyword[def] identifier[get_tmaster] ( identifier[self] , identifier[topologyName] , identifier[callback] = keyword[None] ): literal[string] identifier[isWatching] = keyword[False] identifier[ret] ={ literal[string] : keyword[None] } keyword[if] identifier[callback] : ...
def get_tmaster(self, topologyName, callback=None): """ get tmaster """ isWatching = False # Temp dict used to return result # if callback is not provided. ret = {'result': None} if callback: isWatching = True # depends on [control=['if'], data=[]] else: def callback(data):...