code
stringlengths
75
104k
code_sememe
stringlengths
47
309k
token_type
stringlengths
215
214k
code_dependency
stringlengths
75
155k
def disconnected(self, client): """Call this method when a client disconnected.""" if client not in self.clients: # already disconnected. return self.clients.remove(client) self._log_disconnected(client) self._close(client)
def function[disconnected, parameter[self, client]]: constant[Call this method when a client disconnected.] if compare[name[client] <ast.NotIn object at 0x7da2590d7190> name[self].clients] begin[:] return[None] call[name[self].clients.remove, parameter[name[client]]] call[name[se...
keyword[def] identifier[disconnected] ( identifier[self] , identifier[client] ): literal[string] keyword[if] identifier[client] keyword[not] keyword[in] identifier[self] . identifier[clients] : keyword[return] identifier[self] . identifier[clients] . identifier[r...
def disconnected(self, client): """Call this method when a client disconnected.""" if client not in self.clients: # already disconnected. return # depends on [control=['if'], data=[]] self.clients.remove(client) self._log_disconnected(client) self._close(client)
def set_restriction(self, command, user, event_types): """ Adds restriction for given `command`. :param command: command on which the restriction should be set. :type command: str :param user: username for which the restriction applies. :type user: str :param eve...
def function[set_restriction, parameter[self, command, user, event_types]]: constant[ Adds restriction for given `command`. :param command: command on which the restriction should be set. :type command: str :param user: username for which the restriction applies. :type u...
keyword[def] identifier[set_restriction] ( identifier[self] , identifier[command] , identifier[user] , identifier[event_types] ): literal[string] identifier[self] . identifier[commands_rights] [ identifier[command] ][ identifier[user] . identifier[lower] ()]= identifier[event_types] keywo...
def set_restriction(self, command, user, event_types): """ Adds restriction for given `command`. :param command: command on which the restriction should be set. :type command: str :param user: username for which the restriction applies. :type user: str :param event_t...
def use_active_sequence_rule_enabler_view(self): """Pass through to provider SequenceRuleEnablerLookupSession.use_active_sequence_rule_enabler_view""" self._operable_views['sequence_rule_enabler'] = ACTIVE # self._get_provider_session('sequence_rule_enabler_lookup_session') # To make sure the s...
def function[use_active_sequence_rule_enabler_view, parameter[self]]: constant[Pass through to provider SequenceRuleEnablerLookupSession.use_active_sequence_rule_enabler_view] call[name[self]._operable_views][constant[sequence_rule_enabler]] assign[=] name[ACTIVE] for taget[name[session]] in sta...
keyword[def] identifier[use_active_sequence_rule_enabler_view] ( identifier[self] ): literal[string] identifier[self] . identifier[_operable_views] [ literal[string] ]= identifier[ACTIVE] keyword[for] identifier[session] keyword[in] identifier[self] . identifier[_get_provider_...
def use_active_sequence_rule_enabler_view(self): """Pass through to provider SequenceRuleEnablerLookupSession.use_active_sequence_rule_enabler_view""" self._operable_views['sequence_rule_enabler'] = ACTIVE # self._get_provider_session('sequence_rule_enabler_lookup_session') # To make sure the session is tr...
def validate_model(cursor, model): """Validates the model using a series of checks on bits of the data.""" # Check the license is one valid for publication. _validate_license(model) _validate_roles(model) # Other required metadata includes: title, summary required_metadata = ('title', 'summary'...
def function[validate_model, parameter[cursor, model]]: constant[Validates the model using a series of checks on bits of the data.] call[name[_validate_license], parameter[name[model]]] call[name[_validate_roles], parameter[name[model]]] variable[required_metadata] assign[=] tuple[[<ast....
keyword[def] identifier[validate_model] ( identifier[cursor] , identifier[model] ): literal[string] identifier[_validate_license] ( identifier[model] ) identifier[_validate_roles] ( identifier[model] ) identifier[required_metadata] =( literal[string] , literal[string] ,) keyword[f...
def validate_model(cursor, model): """Validates the model using a series of checks on bits of the data.""" # Check the license is one valid for publication. _validate_license(model) _validate_roles(model) # Other required metadata includes: title, summary required_metadata = ('title', 'summary')...
def get_template_id(template_name, auth, url): """ Helper function takes str input of folder name and returns str numerical id of the folder. :param folder_name: str name of the folder :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC R...
def function[get_template_id, parameter[template_name, auth, url]]: constant[ Helper function takes str input of folder name and returns str numerical id of the folder. :param folder_name: str name of the folder :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
keyword[def] identifier[get_template_id] ( identifier[template_name] , identifier[auth] , identifier[url] ): literal[string] identifier[object_list] = identifier[get_cfg_template] ( identifier[auth] = identifier[auth] , identifier[url] = identifier[url] ) keyword[for] identifier[object] keyword[in] ...
def get_template_id(template_name, auth, url): """ Helper function takes str input of folder name and returns str numerical id of the folder. :param folder_name: str name of the folder :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC R...
def StoreResults(self, responses): """Stores the responses.""" client_id = responses.request.client_id if responses.success: logging.info("Client %s has a file %s.", client_id, self.args.filename) else: logging.info("Client %s has no file %s.", client_id, self.args.filename) self.MarkC...
def function[StoreResults, parameter[self, responses]]: constant[Stores the responses.] variable[client_id] assign[=] name[responses].request.client_id if name[responses].success begin[:] call[name[logging].info, parameter[constant[Client %s has a file %s.], name[client_id], name...
keyword[def] identifier[StoreResults] ( identifier[self] , identifier[responses] ): literal[string] identifier[client_id] = identifier[responses] . identifier[request] . identifier[client_id] keyword[if] identifier[responses] . identifier[success] : identifier[logging] . identifier[info] ( l...
def StoreResults(self, responses): """Stores the responses.""" client_id = responses.request.client_id if responses.success: logging.info('Client %s has a file %s.', client_id, self.args.filename) # depends on [control=['if'], data=[]] else: logging.info('Client %s has no file %s.', cli...
def get(self, request, *args, **kwargs): """ Return a :class:`.django.http.JsonResponse`. Example:: { 'results': [ { 'text': "foo", 'id': 123 } ], ...
def function[get, parameter[self, request]]: constant[ Return a :class:`.django.http.JsonResponse`. Example:: { 'results': [ { 'text': "foo", 'id': 123 } ], ...
keyword[def] identifier[get] ( identifier[self] , identifier[request] ,* identifier[args] ,** identifier[kwargs] ): literal[string] identifier[self] . identifier[widget] = identifier[self] . identifier[get_widget_or_404] () identifier[self] . identifier[term] = identifier[kwargs] . identif...
def get(self, request, *args, **kwargs): """ Return a :class:`.django.http.JsonResponse`. Example:: { 'results': [ { 'text': "foo", 'id': 123 } ], 'mo...
def send_rally_point(self, i): '''send rally points from fenceloader''' p = self.rallyloader.rally_point(i) p.target_system = self.target_system p.target_component = self.target_component self.master.mav.send(p)
def function[send_rally_point, parameter[self, i]]: constant[send rally points from fenceloader] variable[p] assign[=] call[name[self].rallyloader.rally_point, parameter[name[i]]] name[p].target_system assign[=] name[self].target_system name[p].target_component assign[=] name[self].targe...
keyword[def] identifier[send_rally_point] ( identifier[self] , identifier[i] ): literal[string] identifier[p] = identifier[self] . identifier[rallyloader] . identifier[rally_point] ( identifier[i] ) identifier[p] . identifier[target_system] = identifier[self] . identifier[target_system] ...
def send_rally_point(self, i): """send rally points from fenceloader""" p = self.rallyloader.rally_point(i) p.target_system = self.target_system p.target_component = self.target_component self.master.mav.send(p)
def reconnect(): """ reconnect signals """ post_save.connect(node_created_handler, sender=Node) node_status_changed.connect(node_status_changed_handler) pre_delete.connect(node_deleted_handler, sender=Node)
def function[reconnect, parameter[]]: constant[ reconnect signals ] call[name[post_save].connect, parameter[name[node_created_handler]]] call[name[node_status_changed].connect, parameter[name[node_status_changed_handler]]] call[name[pre_delete].connect, parameter[name[node_deleted_handle...
keyword[def] identifier[reconnect] (): literal[string] identifier[post_save] . identifier[connect] ( identifier[node_created_handler] , identifier[sender] = identifier[Node] ) identifier[node_status_changed] . identifier[connect] ( identifier[node_status_changed_handler] ) identifier[pre_delete] ...
def reconnect(): """ reconnect signals """ post_save.connect(node_created_handler, sender=Node) node_status_changed.connect(node_status_changed_handler) pre_delete.connect(node_deleted_handler, sender=Node)
def time_sp(self): """ Writing specifies the amount of time the motor will run when using the `run-timed` command. Reading returns the current value. Units are in milliseconds. """ self._time_sp, value = self.get_attr_int(self._time_sp, 'time_sp') return value
def function[time_sp, parameter[self]]: constant[ Writing specifies the amount of time the motor will run when using the `run-timed` command. Reading returns the current value. Units are in milliseconds. ] <ast.Tuple object at 0x7da1b1646e60> assign[=] call[name[self].get...
keyword[def] identifier[time_sp] ( identifier[self] ): literal[string] identifier[self] . identifier[_time_sp] , identifier[value] = identifier[self] . identifier[get_attr_int] ( identifier[self] . identifier[_time_sp] , literal[string] ) keyword[return] identifier[value]
def time_sp(self): """ Writing specifies the amount of time the motor will run when using the `run-timed` command. Reading returns the current value. Units are in milliseconds. """ (self._time_sp, value) = self.get_attr_int(self._time_sp, 'time_sp') return value
def add_path(self, nodes, t=None): """Add a path at time t. Parameters ---------- nodes : iterable container A container of nodes. t : snapshot id (default=None) See Also -------- add_path, add_cycle Examples -------- ...
def function[add_path, parameter[self, nodes, t]]: constant[Add a path at time t. Parameters ---------- nodes : iterable container A container of nodes. t : snapshot id (default=None) See Also -------- add_path, add_cycle Examples ...
keyword[def] identifier[add_path] ( identifier[self] , identifier[nodes] , identifier[t] = keyword[None] ): literal[string] identifier[nlist] = identifier[list] ( identifier[nodes] ) identifier[interaction] = identifier[zip] ( identifier[nlist] [:- literal[int] ], identifier[nlist] [ liter...
def add_path(self, nodes, t=None): """Add a path at time t. Parameters ---------- nodes : iterable container A container of nodes. t : snapshot id (default=None) See Also -------- add_path, add_cycle Examples -------- >>>...
def _iter_names(self): """ Generate a key/value pair for each name in this table. The key is a (platform_id, name_id) 2-tuple and the value is the unicode text corresponding to that key. """ table_format, count, strings_offset = self._table_header table_bytes = se...
def function[_iter_names, parameter[self]]: constant[ Generate a key/value pair for each name in this table. The key is a (platform_id, name_id) 2-tuple and the value is the unicode text corresponding to that key. ] <ast.Tuple object at 0x7da20c991e40> assign[=] name[self...
keyword[def] identifier[_iter_names] ( identifier[self] ): literal[string] identifier[table_format] , identifier[count] , identifier[strings_offset] = identifier[self] . identifier[_table_header] identifier[table_bytes] = identifier[self] . identifier[_table_bytes] keyword[for]...
def _iter_names(self): """ Generate a key/value pair for each name in this table. The key is a (platform_id, name_id) 2-tuple and the value is the unicode text corresponding to that key. """ (table_format, count, strings_offset) = self._table_header table_bytes = self._table_...
def generate_minion_id(): ''' Return only first element of the hostname from all possible list. :return: ''' try: ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first()) except TypeError: ret = None return ret or 'localhost'
def function[generate_minion_id, parameter[]]: constant[ Return only first element of the hostname from all possible list. :return: ] <ast.Try object at 0x7da1b2089270> return[<ast.BoolOp object at 0x7da1b208aec0>]
keyword[def] identifier[generate_minion_id] (): literal[string] keyword[try] : identifier[ret] = identifier[salt] . identifier[utils] . identifier[stringutils] . identifier[to_unicode] ( identifier[_generate_minion_id] (). identifier[first] ()) keyword[except] identifier[TypeError] : ...
def generate_minion_id(): """ Return only first element of the hostname from all possible list. :return: """ try: ret = salt.utils.stringutils.to_unicode(_generate_minion_id().first()) # depends on [control=['try'], data=[]] except TypeError: ret = None # depends on [control=[...
def get_next_name(old, fmt='%i'): """Return the next name that numerically follows `old`""" nums = re.findall('\d+', old) if not nums: raise ValueError("Could not get the next name because the old name " "has no numbers in it") num0 = nums[-1] num1 = str(int(num0) + ...
def function[get_next_name, parameter[old, fmt]]: constant[Return the next name that numerically follows `old`] variable[nums] assign[=] call[name[re].findall, parameter[constant[\d+], name[old]]] if <ast.UnaryOp object at 0x7da1b2372140> begin[:] <ast.Raise object at 0x7da1b2372530> ...
keyword[def] identifier[get_next_name] ( identifier[old] , identifier[fmt] = literal[string] ): literal[string] identifier[nums] = identifier[re] . identifier[findall] ( literal[string] , identifier[old] ) keyword[if] keyword[not] identifier[nums] : keyword[raise] identifier[ValueError] ( ...
def get_next_name(old, fmt='%i'): """Return the next name that numerically follows `old`""" nums = re.findall('\\d+', old) if not nums: raise ValueError('Could not get the next name because the old name has no numbers in it') # depends on [control=['if'], data=[]] num0 = nums[-1] num1 = str...
def where_earliest(cls, user_id): """ Get earilest session by created_at timestamp """ return cls.query.filter_by(user_id=user_id)\ .order_by(cls.created_at.asc()).first()
def function[where_earliest, parameter[cls, user_id]]: constant[ Get earilest session by created_at timestamp ] return[call[call[call[name[cls].query.filter_by, parameter[]].order_by, parameter[call[name[cls].created_at.asc, parameter[]]]].first, parameter[]]]
keyword[def] identifier[where_earliest] ( identifier[cls] , identifier[user_id] ): literal[string] keyword[return] identifier[cls] . identifier[query] . identifier[filter_by] ( identifier[user_id] = identifier[user_id] ). identifier[order_by] ( identifier[cls] . identifier[created_at] . identifi...
def where_earliest(cls, user_id): """ Get earilest session by created_at timestamp """ return cls.query.filter_by(user_id=user_id).order_by(cls.created_at.asc()).first()
def get_brightness(self, refresh=False): """Get dimmer brightness. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. Converts the Vera level property for dimmable lights from a percentage to the 0 - 25...
def function[get_brightness, parameter[self, refresh]]: constant[Get dimmer brightness. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. Converts the Vera level property for dimmable lights from a percentage ...
keyword[def] identifier[get_brightness] ( identifier[self] , identifier[refresh] = keyword[False] ): literal[string] keyword[if] identifier[refresh] : identifier[self] . identifier[refresh] () identifier[brightness] = literal[int] identifier[percent] = identifier[se...
def get_brightness(self, refresh=False): """Get dimmer brightness. Refresh data from Vera if refresh is True, otherwise use local cache. Refresh is only needed if you're not using subscriptions. Converts the Vera level property for dimmable lights from a percentage to the 0 - 255 sc...
def vb_get_network_addresses(machine_name=None, machine=None, wait_for_pattern=None): ''' TODO distinguish between private and public addresses A valid machine_name or a machine is needed to make this work! !!! Guest prerequisite: GuestAddition !!! Thanks to Shrikant Havale for the StackO...
def function[vb_get_network_addresses, parameter[machine_name, machine, wait_for_pattern]]: constant[ TODO distinguish between private and public addresses A valid machine_name or a machine is needed to make this work! !!! Guest prerequisite: GuestAddition !!! Thanks to Shrikant Haval...
keyword[def] identifier[vb_get_network_addresses] ( identifier[machine_name] = keyword[None] , identifier[machine] = keyword[None] , identifier[wait_for_pattern] = keyword[None] ): literal[string] keyword[if] identifier[machine_name] : identifier[machine] = identifier[vb_get_box] (). identifier[f...
def vb_get_network_addresses(machine_name=None, machine=None, wait_for_pattern=None): """ TODO distinguish between private and public addresses A valid machine_name or a machine is needed to make this work! !!! Guest prerequisite: GuestAddition !!! Thanks to Shrikant Havale for the StackO...
def tile_to_quadkey(tile, level): """Transform tile coordinates to a quadkey""" tile_x = tile[0] tile_y = tile[1] quadkey = "" for i in xrange(level): bit = level - i digit = ord('0') mask = 1 << (bit - 1) # if (bit - 1) > 0 else 1 >> (bit - 1...
def function[tile_to_quadkey, parameter[tile, level]]: constant[Transform tile coordinates to a quadkey] variable[tile_x] assign[=] call[name[tile]][constant[0]] variable[tile_y] assign[=] call[name[tile]][constant[1]] variable[quadkey] assign[=] constant[] for taget[name[i]] in ...
keyword[def] identifier[tile_to_quadkey] ( identifier[tile] , identifier[level] ): literal[string] identifier[tile_x] = identifier[tile] [ literal[int] ] identifier[tile_y] = identifier[tile] [ literal[int] ] identifier[quadkey] = literal[string] keyword[for] identifier...
def tile_to_quadkey(tile, level): """Transform tile coordinates to a quadkey""" tile_x = tile[0] tile_y = tile[1] quadkey = '' for i in xrange(level): bit = level - i digit = ord('0') mask = 1 << bit - 1 # if (bit - 1) > 0 else 1 >> (bit - 1) if tile_x & mask is not ...
def parse_bind(bind): """Parses a connection string and creates SQL trace metadata""" if isinstance(bind, Connection): engine = bind.engine else: engine = bind m = re.match(r"Engine\((.*?)\)", str(engine)) if m is not None: u = urlparse(m.group(1)) # Add Scheme to use...
def function[parse_bind, parameter[bind]]: constant[Parses a connection string and creates SQL trace metadata] if call[name[isinstance], parameter[name[bind], name[Connection]]] begin[:] variable[engine] assign[=] name[bind].engine variable[m] assign[=] call[name[re].match, param...
keyword[def] identifier[parse_bind] ( identifier[bind] ): literal[string] keyword[if] identifier[isinstance] ( identifier[bind] , identifier[Connection] ): identifier[engine] = identifier[bind] . identifier[engine] keyword[else] : identifier[engine] = identifier[bind] identif...
def parse_bind(bind): """Parses a connection string and creates SQL trace metadata""" if isinstance(bind, Connection): engine = bind.engine # depends on [control=['if'], data=[]] else: engine = bind m = re.match('Engine\\((.*?)\\)', str(engine)) if m is not None: u = urlpars...
def process_placeholder_image(self): """ Process the field's placeholder image. Ensures the placeholder image has been saved to the same storage class as the field in a top level folder with a name specified by settings.VERSATILEIMAGEFIELD_SETTINGS['placeholder_directory_name'] ...
def function[process_placeholder_image, parameter[self]]: constant[ Process the field's placeholder image. Ensures the placeholder image has been saved to the same storage class as the field in a top level folder with a name specified by settings.VERSATILEIMAGEFIELD_SETTINGS['pl...
keyword[def] identifier[process_placeholder_image] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[placeholder_image_name] : keyword[return] identifier[placeholder_image_name] = keyword[None] identifier[placeholder_image] = identifi...
def process_placeholder_image(self): """ Process the field's placeholder image. Ensures the placeholder image has been saved to the same storage class as the field in a top level folder with a name specified by settings.VERSATILEIMAGEFIELD_SETTINGS['placeholder_directory_name'] ...
def compute_err_score(true_positives, n_ref, n_est): """Compute error score metrics. Parameters ---------- true_positives : np.ndarray Array containing the number of true positives at each time point. n_ref : np.ndarray Array containing the number of reference frequencies at each ti...
def function[compute_err_score, parameter[true_positives, n_ref, n_est]]: constant[Compute error score metrics. Parameters ---------- true_positives : np.ndarray Array containing the number of true positives at each time point. n_ref : np.ndarray Array containing the number of r...
keyword[def] identifier[compute_err_score] ( identifier[true_positives] , identifier[n_ref] , identifier[n_est] ): literal[string] identifier[n_ref_sum] = identifier[float] ( identifier[n_ref] . identifier[sum] ()) keyword[if] identifier[n_ref_sum] == literal[int] : identifier[warnings] . i...
def compute_err_score(true_positives, n_ref, n_est): """Compute error score metrics. Parameters ---------- true_positives : np.ndarray Array containing the number of true positives at each time point. n_ref : np.ndarray Array containing the number of reference frequencies at each ti...
def setCheckedDetails(self, checked): """Sets which components are checked :param checked: dictionary of stimtype:list<attribute names> for which components and their attributes should be checked :type checked: dict """ layout = self.layout() for i in range(layout.count(...
def function[setCheckedDetails, parameter[self, checked]]: constant[Sets which components are checked :param checked: dictionary of stimtype:list<attribute names> for which components and their attributes should be checked :type checked: dict ] variable[layout] assign[=] call[na...
keyword[def] identifier[setCheckedDetails] ( identifier[self] , identifier[checked] ): literal[string] identifier[layout] = identifier[self] . identifier[layout] () keyword[for] identifier[i] keyword[in] identifier[range] ( identifier[layout] . identifier[count] ()): identi...
def setCheckedDetails(self, checked): """Sets which components are checked :param checked: dictionary of stimtype:list<attribute names> for which components and their attributes should be checked :type checked: dict """ layout = self.layout() for i in range(layout.count()): ...
def name(self): """Class name.""" return ffi.string(lib.EnvGetDefclassName(self._env, self._cls)).decode()
def function[name, parameter[self]]: constant[Class name.] return[call[call[name[ffi].string, parameter[call[name[lib].EnvGetDefclassName, parameter[name[self]._env, name[self]._cls]]]].decode, parameter[]]]
keyword[def] identifier[name] ( identifier[self] ): literal[string] keyword[return] identifier[ffi] . identifier[string] ( identifier[lib] . identifier[EnvGetDefclassName] ( identifier[self] . identifier[_env] , identifier[self] . identifier[_cls] )). identifier[decode] ()
def name(self): """Class name.""" return ffi.string(lib.EnvGetDefclassName(self._env, self._cls)).decode()
def registerWebAdaptor(self, webAdaptorURL, machineName, machineIP, isAdminEnabled, description, httpPort, httpsPort): """ You can use this operation to register the ArcGIS Web Adaptor from your ArcGIS Server. By registering the Web Adaptor with the server, yo...
def function[registerWebAdaptor, parameter[self, webAdaptorURL, machineName, machineIP, isAdminEnabled, description, httpPort, httpsPort]]: constant[ You can use this operation to register the ArcGIS Web Adaptor from your ArcGIS Server. By registering the Web Adaptor with the server, yo...
keyword[def] identifier[registerWebAdaptor] ( identifier[self] , identifier[webAdaptorURL] , identifier[machineName] , identifier[machineIP] , identifier[isAdminEnabled] , identifier[description] , identifier[httpPort] , identifier[httpsPort] ): literal[string] identifier[url] = identifier[self] ....
def registerWebAdaptor(self, webAdaptorURL, machineName, machineIP, isAdminEnabled, description, httpPort, httpsPort): """ You can use this operation to register the ArcGIS Web Adaptor from your ArcGIS Server. By registering the Web Adaptor with the server, you are telling the server to tru...
def method_name_exist(self, meth_name): """Check if there is already a meth_name method in the current class It is useful before allowing to rename a method to check name does not already exist. """ methods = self.current_class.get_methods() for m in methods: ...
def function[method_name_exist, parameter[self, meth_name]]: constant[Check if there is already a meth_name method in the current class It is useful before allowing to rename a method to check name does not already exist. ] variable[methods] assign[=] call[name[self].curren...
keyword[def] identifier[method_name_exist] ( identifier[self] , identifier[meth_name] ): literal[string] identifier[methods] = identifier[self] . identifier[current_class] . identifier[get_methods] () keyword[for] identifier[m] keyword[in] identifier[methods] : keyword[if]...
def method_name_exist(self, meth_name): """Check if there is already a meth_name method in the current class It is useful before allowing to rename a method to check name does not already exist. """ methods = self.current_class.get_methods() for m in methods: if m.name ...
def plot_point(self, x, y, visible=True, color='black', size=5): """ Places a single point on the grid :param x: the x coordinate :param y: the y coordinate :param visible: True if the individual point should be visible :param color: the color of the point :param...
def function[plot_point, parameter[self, x, y, visible, color, size]]: constant[ Places a single point on the grid :param x: the x coordinate :param y: the y coordinate :param visible: True if the individual point should be visible :param color: the color of the point ...
keyword[def] identifier[plot_point] ( identifier[self] , identifier[x] , identifier[y] , identifier[visible] = keyword[True] , identifier[color] = literal[string] , identifier[size] = literal[int] ): literal[string] identifier[xp] =( identifier[self] . identifier[px_x] *( identifier[x] - identifier...
def plot_point(self, x, y, visible=True, color='black', size=5): """ Places a single point on the grid :param x: the x coordinate :param y: the y coordinate :param visible: True if the individual point should be visible :param color: the color of the point :param siz...
def approximate_size(size, a_kilobyte_is_1024_bytes=True): ''' Humansize.py from Dive into Python3 Mark Pilgrim - http://www.diveintopython3.net/ Copyright (c) 2009, Mark Pilgrim, All rights reserved. Convert a file size to human-readable form. Keyword arguments: size -- file size in bytes ...
def function[approximate_size, parameter[size, a_kilobyte_is_1024_bytes]]: constant[ Humansize.py from Dive into Python3 Mark Pilgrim - http://www.diveintopython3.net/ Copyright (c) 2009, Mark Pilgrim, All rights reserved. Convert a file size to human-readable form. Keyword arguments: s...
keyword[def] identifier[approximate_size] ( identifier[size] , identifier[a_kilobyte_is_1024_bytes] = keyword[True] ): literal[string] identifier[size] = identifier[float] ( identifier[size] ) keyword[if] identifier[size] < literal[int] : keyword[raise] identifier[ValueError] ( literal[st...
def approximate_size(size, a_kilobyte_is_1024_bytes=True): """ Humansize.py from Dive into Python3 Mark Pilgrim - http://www.diveintopython3.net/ Copyright (c) 2009, Mark Pilgrim, All rights reserved. Convert a file size to human-readable form. Keyword arguments: size -- file size in bytes ...
def update_pypsa_storage(pypsa, storages, storages_lines): """ Adds storages and their lines to pypsa representation of the edisgo graph. This function effects the following attributes of the pypsa network: components ('StorageUnit'), storage_units, storage_units_t (p_set, q_set), buses, lines ...
def function[update_pypsa_storage, parameter[pypsa, storages, storages_lines]]: constant[ Adds storages and their lines to pypsa representation of the edisgo graph. This function effects the following attributes of the pypsa network: components ('StorageUnit'), storage_units, storage_units_t (p_set...
keyword[def] identifier[update_pypsa_storage] ( identifier[pypsa] , identifier[storages] , identifier[storages_lines] ): literal[string] identifier[bus] ={ literal[string] :[], literal[string] :[], literal[string] :[], literal[string] :[]} identifier[line] ={ literal[string] :[], literal[string]...
def update_pypsa_storage(pypsa, storages, storages_lines): """ Adds storages and their lines to pypsa representation of the edisgo graph. This function effects the following attributes of the pypsa network: components ('StorageUnit'), storage_units, storage_units_t (p_set, q_set), buses, lines ...
def leave_group(self, group_jid): """ Leaves a specific group :param group_jid: The JID of the group to leave """ log.info("[+] Leaving group {}".format(group_jid)) return self._send_xmpp_element(group_adminship.LeaveGroupRequest(group_jid))
def function[leave_group, parameter[self, group_jid]]: constant[ Leaves a specific group :param group_jid: The JID of the group to leave ] call[name[log].info, parameter[call[constant[[+] Leaving group {}].format, parameter[name[group_jid]]]]] return[call[name[self]._send_xm...
keyword[def] identifier[leave_group] ( identifier[self] , identifier[group_jid] ): literal[string] identifier[log] . identifier[info] ( literal[string] . identifier[format] ( identifier[group_jid] )) keyword[return] identifier[self] . identifier[_send_xmpp_element] ( identifier[group_admi...
def leave_group(self, group_jid): """ Leaves a specific group :param group_jid: The JID of the group to leave """ log.info('[+] Leaving group {}'.format(group_jid)) return self._send_xmpp_element(group_adminship.LeaveGroupRequest(group_jid))
def add(self, data_bytes): '''Feed ASCII string or bytes to the signature function''' try: if isinstance(data_bytes, basestring): # Python 2.7 compatibility data_bytes = map(ord, data_bytes) except NameError: if isinstance(data_bytes, str): # This branch...
def function[add, parameter[self, data_bytes]]: constant[Feed ASCII string or bytes to the signature function] <ast.Try object at 0x7da18bc715a0> for taget[name[b]] in starred[name[data_bytes]] begin[:] <ast.AugAssign object at 0x7da204620d00> for taget[name[_]] in starred[ca...
keyword[def] identifier[add] ( identifier[self] , identifier[data_bytes] ): literal[string] keyword[try] : keyword[if] identifier[isinstance] ( identifier[data_bytes] , identifier[basestring] ): identifier[data_bytes] = identifier[map] ( identifier[ord] , identifier[d...
def add(self, data_bytes): """Feed ASCII string or bytes to the signature function""" try: if isinstance(data_bytes, basestring): # Python 2.7 compatibility data_bytes = map(ord, data_bytes) # depends on [control=['if'], data=[]] # depends on [control=['try'], data=[]] except NameErro...
def set_version(self, version): """ Set the version number of the certificate. Note that the version value is zero-based, eg. a value of 0 is V1. :param version: The version number of the certificate. :type version: :py:class:`int` :return: ``None`` """ ...
def function[set_version, parameter[self, version]]: constant[ Set the version number of the certificate. Note that the version value is zero-based, eg. a value of 0 is V1. :param version: The version number of the certificate. :type version: :py:class:`int` :return: ``...
keyword[def] identifier[set_version] ( identifier[self] , identifier[version] ): literal[string] keyword[if] keyword[not] identifier[isinstance] ( identifier[version] , identifier[int] ): keyword[raise] identifier[TypeError] ( literal[string] ) identifier[_lib] . identifie...
def set_version(self, version): """ Set the version number of the certificate. Note that the version value is zero-based, eg. a value of 0 is V1. :param version: The version number of the certificate. :type version: :py:class:`int` :return: ``None`` """ if not i...
def main(): """Builds a yaml file""" parser = argparse.ArgumentParser(description='Compose a yaml file.') parser.add_argument( 'root', type=argparse.FileType('r'), help='The root yaml file to compose.' ) args = parser.parse_args() result = yaml.load(args.root, Loader=Co...
def function[main, parameter[]]: constant[Builds a yaml file] variable[parser] assign[=] call[name[argparse].ArgumentParser, parameter[]] call[name[parser].add_argument, parameter[constant[root]]] variable[args] assign[=] call[name[parser].parse_args, parameter[]] variable[result...
keyword[def] identifier[main] (): literal[string] identifier[parser] = identifier[argparse] . identifier[ArgumentParser] ( identifier[description] = literal[string] ) identifier[parser] . identifier[add_argument] ( literal[string] , identifier[type] = identifier[argparse] . identifier[FileTy...
def main(): """Builds a yaml file""" parser = argparse.ArgumentParser(description='Compose a yaml file.') parser.add_argument('root', type=argparse.FileType('r'), help='The root yaml file to compose.') args = parser.parse_args() result = yaml.load(args.root, Loader=ComposeLoader) print(yaml.dump...
def get_largest_component(G, strongly=False): """ Return a subgraph of the largest weakly or strongly connected component from a directed graph. Parameters ---------- G : networkx multidigraph strongly : bool if True, return the largest strongly instead of weakly connected c...
def function[get_largest_component, parameter[G, strongly]]: constant[ Return a subgraph of the largest weakly or strongly connected component from a directed graph. Parameters ---------- G : networkx multidigraph strongly : bool if True, return the largest strongly instead of w...
keyword[def] identifier[get_largest_component] ( identifier[G] , identifier[strongly] = keyword[False] ): literal[string] identifier[start_time] = identifier[time] . identifier[time] () identifier[original_len] = identifier[len] ( identifier[list] ( identifier[G] . identifier[nodes] ())) keywor...
def get_largest_component(G, strongly=False): """ Return a subgraph of the largest weakly or strongly connected component from a directed graph. Parameters ---------- G : networkx multidigraph strongly : bool if True, return the largest strongly instead of weakly connected c...
def print_boolean_net(self, out_file=None): """Return a Boolean network from the assembled graph. See https://github.com/ialbert/booleannet for details about the format used to encode the Boolean rules. Parameters ---------- out_file : Optional[str] A file n...
def function[print_boolean_net, parameter[self, out_file]]: constant[Return a Boolean network from the assembled graph. See https://github.com/ialbert/booleannet for details about the format used to encode the Boolean rules. Parameters ---------- out_file : Optional[str...
keyword[def] identifier[print_boolean_net] ( identifier[self] , identifier[out_file] = keyword[None] ): literal[string] identifier[init_str] = literal[string] keyword[for] identifier[node_key] keyword[in] identifier[self] . identifier[graph] . identifier[nodes] (): identif...
def print_boolean_net(self, out_file=None): """Return a Boolean network from the assembled graph. See https://github.com/ialbert/booleannet for details about the format used to encode the Boolean rules. Parameters ---------- out_file : Optional[str] A file name ...
def _getAnnotationAnalysis(self, varFile): """ Assembles metadata within the VCF header into a GA4GH Analysis object. :return: protocol.Analysis """ header = varFile.header analysis = protocol.Analysis() formats = header.formats.items() infos = header.inf...
def function[_getAnnotationAnalysis, parameter[self, varFile]]: constant[ Assembles metadata within the VCF header into a GA4GH Analysis object. :return: protocol.Analysis ] variable[header] assign[=] name[varFile].header variable[analysis] assign[=] call[name[protocol]....
keyword[def] identifier[_getAnnotationAnalysis] ( identifier[self] , identifier[varFile] ): literal[string] identifier[header] = identifier[varFile] . identifier[header] identifier[analysis] = identifier[protocol] . identifier[Analysis] () identifier[formats] = identifier[header]...
def _getAnnotationAnalysis(self, varFile): """ Assembles metadata within the VCF header into a GA4GH Analysis object. :return: protocol.Analysis """ header = varFile.header analysis = protocol.Analysis() formats = header.formats.items() infos = header.info.items() filter...
def fork_processes(num_processes: Optional[int], max_restarts: int = None) -> int: """Starts multiple worker processes. If ``num_processes`` is None or <= 0, we detect the number of cores available on this machine and fork that number of child processes. If ``num_processes`` is given and > 0, we fork t...
def function[fork_processes, parameter[num_processes, max_restarts]]: constant[Starts multiple worker processes. If ``num_processes`` is None or <= 0, we detect the number of cores available on this machine and fork that number of child processes. If ``num_processes`` is given and > 0, we fork that...
keyword[def] identifier[fork_processes] ( identifier[num_processes] : identifier[Optional] [ identifier[int] ], identifier[max_restarts] : identifier[int] = keyword[None] )-> identifier[int] : literal[string] keyword[if] identifier[max_restarts] keyword[is] keyword[None] : identifier[max_restar...
def fork_processes(num_processes: Optional[int], max_restarts: int=None) -> int: """Starts multiple worker processes. If ``num_processes`` is None or <= 0, we detect the number of cores available on this machine and fork that number of child processes. If ``num_processes`` is given and > 0, we fork tha...
def argument_search(self): """ Uses the command line arguments to fill the search function and call it. """ arguments, _ = self.argparser.parse_known_args() return self.search(**vars(arguments))
def function[argument_search, parameter[self]]: constant[ Uses the command line arguments to fill the search function and call it. ] <ast.Tuple object at 0x7da1afe78bb0> assign[=] call[name[self].argparser.parse_known_args, parameter[]] return[call[name[self].search, parameter[]]...
keyword[def] identifier[argument_search] ( identifier[self] ): literal[string] identifier[arguments] , identifier[_] = identifier[self] . identifier[argparser] . identifier[parse_known_args] () keyword[return] identifier[self] . identifier[search] (** identifier[vars] ( identifier[argumen...
def argument_search(self): """ Uses the command line arguments to fill the search function and call it. """ (arguments, _) = self.argparser.parse_known_args() return self.search(**vars(arguments))
def get_update_api(self, resource): """ Generates the meta descriptor for the resource listing api. """ update_api = { 'path': '/%s/{id}/' % resource.get_api_name(), 'description': 'Operations on %s' % resource.model.__name__, 'operations': [ { ...
def function[get_update_api, parameter[self, resource]]: constant[ Generates the meta descriptor for the resource listing api. ] variable[update_api] assign[=] dictionary[[<ast.Constant object at 0x7da1b1f9dba0>, <ast.Constant object at 0x7da1b1f9cd00>, <ast.Constant object at 0x7da1b1f9e020>], [<ast.Bi...
keyword[def] identifier[get_update_api] ( identifier[self] , identifier[resource] ): literal[string] identifier[update_api] ={ literal[string] : literal[string] % identifier[resource] . identifier[get_api_name] (), literal[string] : literal[string] % identifier[resource] . identi...
def get_update_api(self, resource): """ Generates the meta descriptor for the resource listing api. """ update_api = {'path': '/%s/{id}/' % resource.get_api_name(), 'description': 'Operations on %s' % resource.model.__name__, 'operations': [{'httpMethod': 'PUT', 'nickname': 'update%ss' % resource.model.__name__...
def template(self): """ Create a rules file in ipset --restore format """ s = Template(self._IPSET_TEMPLATE) return s.substitute(sets='\n'.join(self.sets), date=datetime.today())
def function[template, parameter[self]]: constant[ Create a rules file in ipset --restore format ] variable[s] assign[=] call[name[Template], parameter[name[self]._IPSET_TEMPLATE]] return[call[name[s].substitute, parameter[]]]
keyword[def] identifier[template] ( identifier[self] ): literal[string] identifier[s] = identifier[Template] ( identifier[self] . identifier[_IPSET_TEMPLATE] ) keyword[return] identifier[s] . identifier[substitute] ( identifier[sets] = literal[string] . identifier[join] ( identifier[self] . identifier[sets...
def template(self): """ Create a rules file in ipset --restore format """ s = Template(self._IPSET_TEMPLATE) return s.substitute(sets='\n'.join(self.sets), date=datetime.today())
def summary(self, input_size=None, hashsummary=False): """ Print a model summary """ if input_size is None: print(self) print("-" * 120) number = sum(p.numel() for p in self.model.parameters()) print("Number of model parameters: {:,}".format(number)) ...
def function[summary, parameter[self, input_size, hashsummary]]: constant[ Print a model summary ] if compare[name[input_size] is constant[None]] begin[:] call[name[print], parameter[name[self]]] call[name[print], parameter[binary_operation[constant[-] * constant[120]]]] ...
keyword[def] identifier[summary] ( identifier[self] , identifier[input_size] = keyword[None] , identifier[hashsummary] = keyword[False] ): literal[string] keyword[if] identifier[input_size] keyword[is] keyword[None] : identifier[print] ( identifier[self] ) identifier[p...
def summary(self, input_size=None, hashsummary=False): """ Print a model summary """ if input_size is None: print(self) print('-' * 120) number = sum((p.numel() for p in self.model.parameters())) print('Number of model parameters: {:,}'.format(number)) print('-' * 120) #...
def start(self) -> pd.Timestamp: """Returns the minimum timestamp value of the DataFrame.""" start = self.data.timestamp.min() self.data = self.data.assign(start=start) return start
def function[start, parameter[self]]: constant[Returns the minimum timestamp value of the DataFrame.] variable[start] assign[=] call[name[self].data.timestamp.min, parameter[]] name[self].data assign[=] call[name[self].data.assign, parameter[]] return[name[start]]
keyword[def] identifier[start] ( identifier[self] )-> identifier[pd] . identifier[Timestamp] : literal[string] identifier[start] = identifier[self] . identifier[data] . identifier[timestamp] . identifier[min] () identifier[self] . identifier[data] = identifier[self] . identifier[data] . id...
def start(self) -> pd.Timestamp: """Returns the minimum timestamp value of the DataFrame.""" start = self.data.timestamp.min() self.data = self.data.assign(start=start) return start
def _dt_array_cmp(cls, op): """ Wrap comparison operations to convert datetime-like to datetime64 """ opname = '__{name}__'.format(name=op.__name__) nat_result = opname == '__ne__' def wrapper(self, other): if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): retu...
def function[_dt_array_cmp, parameter[cls, op]]: constant[ Wrap comparison operations to convert datetime-like to datetime64 ] variable[opname] assign[=] call[constant[__{name}__].format, parameter[]] variable[nat_result] assign[=] compare[name[opname] equal[==] constant[__ne__]] ...
keyword[def] identifier[_dt_array_cmp] ( identifier[cls] , identifier[op] ): literal[string] identifier[opname] = literal[string] . identifier[format] ( identifier[name] = identifier[op] . identifier[__name__] ) identifier[nat_result] = identifier[opname] == literal[string] keyword[def] identi...
def _dt_array_cmp(cls, op): """ Wrap comparison operations to convert datetime-like to datetime64 """ opname = '__{name}__'.format(name=op.__name__) nat_result = opname == '__ne__' def wrapper(self, other): if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): retu...
def publish(self, channel_id): """ publish: publishes tree to Kolibri Args: channel_id (str): channel's id on Kolibri Studio Returns: None """ payload = { "channel_id":channel_id, } response = config.SESSION.post(config.publish_...
def function[publish, parameter[self, channel_id]]: constant[ publish: publishes tree to Kolibri Args: channel_id (str): channel's id on Kolibri Studio Returns: None ] variable[payload] assign[=] dictionary[[<ast.Constant object at 0x7da2046222c0>], [<ast....
keyword[def] identifier[publish] ( identifier[self] , identifier[channel_id] ): literal[string] identifier[payload] ={ literal[string] : identifier[channel_id] , } identifier[response] = identifier[config] . identifier[SESSION] . identifier[post] ( identifier[config] . ide...
def publish(self, channel_id): """ publish: publishes tree to Kolibri Args: channel_id (str): channel's id on Kolibri Studio Returns: None """ payload = {'channel_id': channel_id} response = config.SESSION.post(config.publish_channel_url(), data=json.dumps(pay...
def show_clusters(clusters, sample, covariances, means, figure = None, display = True): """! @brief Draws clusters and in case of two-dimensional dataset draws their ellipses. @param[in] clusters (list): Clusters that were allocated by the algorithm. @param[in] sample (list...
def function[show_clusters, parameter[clusters, sample, covariances, means, figure, display]]: constant[! @brief Draws clusters and in case of two-dimensional dataset draws their ellipses. @param[in] clusters (list): Clusters that were allocated by the algorithm. @param[in] samp...
keyword[def] identifier[show_clusters] ( identifier[clusters] , identifier[sample] , identifier[covariances] , identifier[means] , identifier[figure] = keyword[None] , identifier[display] = keyword[True] ): literal[string] identifier[visualizer] = identifier[cluster_visualizer] () ide...
def show_clusters(clusters, sample, covariances, means, figure=None, display=True): """! @brief Draws clusters and in case of two-dimensional dataset draws their ellipses. @param[in] clusters (list): Clusters that were allocated by the algorithm. @param[in] sample (list): Dataset th...
def show(name, root=None): ''' .. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name> ''' ret = {} out = __salt__['cmd.ru...
def function[show, parameter[name, root]]: constant[ .. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name> ] variabl...
keyword[def] identifier[show] ( identifier[name] , identifier[root] = keyword[None] ): literal[string] identifier[ret] ={} identifier[out] = identifier[__salt__] [ literal[string] ]( identifier[_systemctl_cmd] ( literal[string] , identifier[name] , identifier[root] = identifier[root] ), identifie...
def show(name, root=None): """ .. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name> """ ret = {} out = __salt__['cmd.ru...
def print_entitlements(opts, data, page_info=None, show_list_info=True): """Print entitlements as a table or output in another format.""" if utils.maybe_print_as_json(opts, data, page_info): return headers = ["Name", "Token", "Created / Updated", "Identifier"] rows = [] for entitlement in ...
def function[print_entitlements, parameter[opts, data, page_info, show_list_info]]: constant[Print entitlements as a table or output in another format.] if call[name[utils].maybe_print_as_json, parameter[name[opts], name[data], name[page_info]]] begin[:] return[None] variable[headers] as...
keyword[def] identifier[print_entitlements] ( identifier[opts] , identifier[data] , identifier[page_info] = keyword[None] , identifier[show_list_info] = keyword[True] ): literal[string] keyword[if] identifier[utils] . identifier[maybe_print_as_json] ( identifier[opts] , identifier[data] , identifier[page_...
def print_entitlements(opts, data, page_info=None, show_list_info=True): """Print entitlements as a table or output in another format.""" if utils.maybe_print_as_json(opts, data, page_info): return # depends on [control=['if'], data=[]] headers = ['Name', 'Token', 'Created / Updated', 'Identifier']...
def MoveCursorToInnerPos(self, x: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> tuple: """ Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. ...
def function[MoveCursorToInnerPos, parameter[self, x, y, ratioX, ratioY, simulateMove]]: constant[ Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move to self.BoundingRec...
keyword[def] identifier[MoveCursorToInnerPos] ( identifier[self] , identifier[x] : identifier[int] = keyword[None] , identifier[y] : identifier[int] = keyword[None] , identifier[ratioX] : identifier[float] = literal[int] , identifier[ratioY] : identifier[float] = literal[int] , identifier[simulateMove] : identifier[b...
def MoveCursorToInnerPos(self, x: int=None, y: int=None, ratioX: float=0.5, ratioY: float=0.5, simulateMove: bool=True) -> tuple: """ Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, i...
def api_notifications(): """Receive MTurk REST notifications.""" event_type = request.values['Event.1.EventType'] assignment_id = request.values['Event.1.AssignmentId'] # Add the notification to the queue. db.logger.debug('rq: Queueing %s with id: %s for worker_function', event_...
def function[api_notifications, parameter[]]: constant[Receive MTurk REST notifications.] variable[event_type] assign[=] call[name[request].values][constant[Event.1.EventType]] variable[assignment_id] assign[=] call[name[request].values][constant[Event.1.AssignmentId]] call[name[db].logg...
keyword[def] identifier[api_notifications] (): literal[string] identifier[event_type] = identifier[request] . identifier[values] [ literal[string] ] identifier[assignment_id] = identifier[request] . identifier[values] [ literal[string] ] identifier[db] . identifier[logger] . identifier[debu...
def api_notifications(): """Receive MTurk REST notifications.""" event_type = request.values['Event.1.EventType'] assignment_id = request.values['Event.1.AssignmentId'] # Add the notification to the queue. db.logger.debug('rq: Queueing %s with id: %s for worker_function', event_type, assignment_id) ...
def running(concurrent=False): ''' Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time. CLI Example: .. code-block:: bash salt '*' state.running ''' ...
def function[running, parameter[concurrent]]: constant[ Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time. CLI Example: .. code-block:: bash salt '*'...
keyword[def] identifier[running] ( identifier[concurrent] = keyword[False] ): literal[string] identifier[ret] =[] keyword[if] identifier[concurrent] : keyword[return] identifier[ret] identifier[active] = identifier[__salt__] [ literal[string] ]( literal[string] ) keyword[for] id...
def running(concurrent=False): """ Return a list of strings that contain state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time. CLI Example: .. code-block:: bash salt '*' state.running """ ...
def mag_field_df(MAG, ofs=None): '''calculate magnetic field strength from raw magnetometer (dataflash version)''' mag = Vector3(MAG.MagX, MAG.MagY, MAG.MagZ) offsets = Vector3(MAG.OfsX, MAG.OfsY, MAG.OfsZ) if ofs is not None: mag = (mag - offsets) + Vector3(ofs[0], ofs[1], ofs[2]) return ma...
def function[mag_field_df, parameter[MAG, ofs]]: constant[calculate magnetic field strength from raw magnetometer (dataflash version)] variable[mag] assign[=] call[name[Vector3], parameter[name[MAG].MagX, name[MAG].MagY, name[MAG].MagZ]] variable[offsets] assign[=] call[name[Vector3], parameter[...
keyword[def] identifier[mag_field_df] ( identifier[MAG] , identifier[ofs] = keyword[None] ): literal[string] identifier[mag] = identifier[Vector3] ( identifier[MAG] . identifier[MagX] , identifier[MAG] . identifier[MagY] , identifier[MAG] . identifier[MagZ] ) identifier[offsets] = identifier[Vector3] ...
def mag_field_df(MAG, ofs=None): """calculate magnetic field strength from raw magnetometer (dataflash version)""" mag = Vector3(MAG.MagX, MAG.MagY, MAG.MagZ) offsets = Vector3(MAG.OfsX, MAG.OfsY, MAG.OfsZ) if ofs is not None: mag = mag - offsets + Vector3(ofs[0], ofs[1], ofs[2]) # depends on [...
def oauth_register(form): """Register user if possible. :param form: A form instance. :returns: A :class:`invenio_accounts.models.User` instance. """ if form.validate(): data = form.to_dict() if not data.get('password'): data['password'] = '' user = register_user...
def function[oauth_register, parameter[form]]: constant[Register user if possible. :param form: A form instance. :returns: A :class:`invenio_accounts.models.User` instance. ] if call[name[form].validate, parameter[]] begin[:] variable[data] assign[=] call[name[form].to_dict,...
keyword[def] identifier[oauth_register] ( identifier[form] ): literal[string] keyword[if] identifier[form] . identifier[validate] (): identifier[data] = identifier[form] . identifier[to_dict] () keyword[if] keyword[not] identifier[data] . identifier[get] ( literal[string] ): ...
def oauth_register(form): """Register user if possible. :param form: A form instance. :returns: A :class:`invenio_accounts.models.User` instance. """ if form.validate(): data = form.to_dict() if not data.get('password'): data['password'] = '' # depends on [control=['if'...
def _message_generator(self): """Iterate over processed messages in the receive queue. :rtype: generator[~uamqp.message.Message] """ self.open() auto_complete = self.auto_complete self.auto_complete = False receiving = True message = None try: ...
def function[_message_generator, parameter[self]]: constant[Iterate over processed messages in the receive queue. :rtype: generator[~uamqp.message.Message] ] call[name[self].open, parameter[]] variable[auto_complete] assign[=] name[self].auto_complete name[self].auto_com...
keyword[def] identifier[_message_generator] ( identifier[self] ): literal[string] identifier[self] . identifier[open] () identifier[auto_complete] = identifier[self] . identifier[auto_complete] identifier[self] . identifier[auto_complete] = keyword[False] identifier[rec...
def _message_generator(self): """Iterate over processed messages in the receive queue. :rtype: generator[~uamqp.message.Message] """ self.open() auto_complete = self.auto_complete self.auto_complete = False receiving = True message = None try: while receiving: ...
def _check_invalid_longitudes(self): ''' Checks to ensure that all longitudes are in the range -180. to 180 ''' idlon = self.strain.data['longitude'] > 180. if np.any(idlon): self.strain.data['longitude'][idlon] = \ self.strain.data['longitude'][idlon]...
def function[_check_invalid_longitudes, parameter[self]]: constant[ Checks to ensure that all longitudes are in the range -180. to 180 ] variable[idlon] assign[=] compare[call[name[self].strain.data][constant[longitude]] greater[>] constant[180.0]] if call[name[np].any, parameter...
keyword[def] identifier[_check_invalid_longitudes] ( identifier[self] ): literal[string] identifier[idlon] = identifier[self] . identifier[strain] . identifier[data] [ literal[string] ]> literal[int] keyword[if] identifier[np] . identifier[any] ( identifier[idlon] ): identif...
def _check_invalid_longitudes(self): """ Checks to ensure that all longitudes are in the range -180. to 180 """ idlon = self.strain.data['longitude'] > 180.0 if np.any(idlon): self.strain.data['longitude'][idlon] = self.strain.data['longitude'][idlon] - 360.0 # depends on [control=[...
def _deriv_arctan2(y, x): """Derivative of the arctan2 function""" r2 = x*x + y*y df_dy = x / r2 df_dx = -y / r2 return np.hstack([df_dy, df_dx])
def function[_deriv_arctan2, parameter[y, x]]: constant[Derivative of the arctan2 function] variable[r2] assign[=] binary_operation[binary_operation[name[x] * name[x]] + binary_operation[name[y] * name[y]]] variable[df_dy] assign[=] binary_operation[name[x] / name[r2]] variable[df_dx] as...
keyword[def] identifier[_deriv_arctan2] ( identifier[y] , identifier[x] ): literal[string] identifier[r2] = identifier[x] * identifier[x] + identifier[y] * identifier[y] identifier[df_dy] = identifier[x] / identifier[r2] identifier[df_dx] =- identifier[y] / identifier[r2] keyword[return] ...
def _deriv_arctan2(y, x): """Derivative of the arctan2 function""" r2 = x * x + y * y df_dy = x / r2 df_dx = -y / r2 return np.hstack([df_dy, df_dx])
def do_parse(infilename: str, jsonfilename: Optional[str], rdffilename: Optional[str], rdffmt: str, context: Optional[str] = None) -> bool: """ Parse the jsg in infilename and save the results in outfilename :param infilename: name of the file containing the ShExC :param jsonfilename: targe...
def function[do_parse, parameter[infilename, jsonfilename, rdffilename, rdffmt, context]]: constant[ Parse the jsg in infilename and save the results in outfilename :param infilename: name of the file containing the ShExC :param jsonfilename: target ShExJ equivalent :param rdffilename: target Sh...
keyword[def] identifier[do_parse] ( identifier[infilename] : identifier[str] , identifier[jsonfilename] : identifier[Optional] [ identifier[str] ], identifier[rdffilename] : identifier[Optional] [ identifier[str] ], identifier[rdffmt] : identifier[str] , identifier[context] : identifier[Optional] [ identifier[str] ]...
def do_parse(infilename: str, jsonfilename: Optional[str], rdffilename: Optional[str], rdffmt: str, context: Optional[str]=None) -> bool: """ Parse the jsg in infilename and save the results in outfilename :param infilename: name of the file containing the ShExC :param jsonfilename: target ShExJ equival...
def write_c_string( self, value ): """ Read a zero terminated (C style) string """ self.file.write( value ) self.file.write( b'\0' )
def function[write_c_string, parameter[self, value]]: constant[ Read a zero terminated (C style) string ] call[name[self].file.write, parameter[name[value]]] call[name[self].file.write, parameter[constant[b'\x00']]]
keyword[def] identifier[write_c_string] ( identifier[self] , identifier[value] ): literal[string] identifier[self] . identifier[file] . identifier[write] ( identifier[value] ) identifier[self] . identifier[file] . identifier[write] ( literal[string] )
def write_c_string(self, value): """ Read a zero terminated (C style) string """ self.file.write(value) self.file.write(b'\x00')
def allowed_transitions(constraint_type: str, labels: Dict[int, str]) -> List[Tuple[int, int]]: """ Given labels and a constraint type, returns the allowed transitions. It will additionally include transitions for the start and end states, which are used by the conditional random field. Parameters ...
def function[allowed_transitions, parameter[constraint_type, labels]]: constant[ Given labels and a constraint type, returns the allowed transitions. It will additionally include transitions for the start and end states, which are used by the conditional random field. Parameters ---------- ...
keyword[def] identifier[allowed_transitions] ( identifier[constraint_type] : identifier[str] , identifier[labels] : identifier[Dict] [ identifier[int] , identifier[str] ])-> identifier[List] [ identifier[Tuple] [ identifier[int] , identifier[int] ]]: literal[string] identifier[num_labels] = identifier[len]...
def allowed_transitions(constraint_type: str, labels: Dict[int, str]) -> List[Tuple[int, int]]: """ Given labels and a constraint type, returns the allowed transitions. It will additionally include transitions for the start and end states, which are used by the conditional random field. Parameters ...
def intcomma(value): """ Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """ orig = str(value) new = re.sub("^(-?\d+)(\d{3})", '\g<1>,\g<2>', orig) if orig == ne...
def function[intcomma, parameter[value]]: constant[ Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. ] variable[orig] assign[=] call[name[str], parameter[name[val...
keyword[def] identifier[intcomma] ( identifier[value] ): literal[string] identifier[orig] = identifier[str] ( identifier[value] ) identifier[new] = identifier[re] . identifier[sub] ( literal[string] , literal[string] , identifier[orig] ) keyword[if] identifier[orig] == identifier[new] : ...
def intcomma(value): """ Borrowed from django.contrib.humanize Converts an integer to a string containing commas every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'. """ orig = str(value) new = re.sub('^(-?\\d+)(\\d{3})', '\\g<1>,\\g<2>', orig) if orig =...
def _do_resolve_index( python_bin: str, solver: PythonSolver, *, all_solvers: typing.List[PythonSolver], requirements: typing.List[str], exclude_packages: set = None, transitive: bool = True, subgraph_check_api: str = None, ) -> dict: """Perform resolution of requirements against the...
def function[_do_resolve_index, parameter[python_bin, solver]]: constant[Perform resolution of requirements against the given solver.] variable[index_url] assign[=] name[solver].release_fetcher.index_url variable[source] assign[=] name[solver].release_fetcher.source variable[packages_see...
keyword[def] identifier[_do_resolve_index] ( identifier[python_bin] : identifier[str] , identifier[solver] : identifier[PythonSolver] , *, identifier[all_solvers] : identifier[typing] . identifier[List] [ identifier[PythonSolver] ], identifier[requirements] : identifier[typing] . identifier[List] [ identifier[str...
def _do_resolve_index(python_bin: str, solver: PythonSolver, *, all_solvers: typing.List[PythonSolver], requirements: typing.List[str], exclude_packages: set=None, transitive: bool=True, subgraph_check_api: str=None) -> dict: """Perform resolution of requirements against the given solver.""" index_url = solver....
def remove_root(self, model, setter=None): ''' Remove a model as root model from this Document. Changes to this model may still trigger ``on_change`` callbacks on this document, if the model is still referred to by other root models. Args: model (Model) : ...
def function[remove_root, parameter[self, model, setter]]: constant[ Remove a model as root model from this Document. Changes to this model may still trigger ``on_change`` callbacks on this document, if the model is still referred to by other root models. Args: mode...
keyword[def] identifier[remove_root] ( identifier[self] , identifier[model] , identifier[setter] = keyword[None] ): literal[string] keyword[if] identifier[model] keyword[not] keyword[in] identifier[self] . identifier[_roots] : keyword[return] identifier[self] . identifier...
def remove_root(self, model, setter=None): """ Remove a model as root model from this Document. Changes to this model may still trigger ``on_change`` callbacks on this document, if the model is still referred to by other root models. Args: model (Model) : ...
def graph_from_edges(edge_list, node_prefix='', directed=False): """Creates a basic graph out of an edge list. The edge list has to be a list of tuples representing the nodes connected by the edge. The values can be anything: bool, int, float, str. If the graph is undirected by default, it is only...
def function[graph_from_edges, parameter[edge_list, node_prefix, directed]]: constant[Creates a basic graph out of an edge list. The edge list has to be a list of tuples representing the nodes connected by the edge. The values can be anything: bool, int, float, str. If the graph is undirected ...
keyword[def] identifier[graph_from_edges] ( identifier[edge_list] , identifier[node_prefix] = literal[string] , identifier[directed] = keyword[False] ): literal[string] keyword[if] identifier[edge_list] keyword[is] keyword[None] : identifier[edge_list] =[] identifier[graph_type] = literal...
def graph_from_edges(edge_list, node_prefix='', directed=False): """Creates a basic graph out of an edge list. The edge list has to be a list of tuples representing the nodes connected by the edge. The values can be anything: bool, int, float, str. If the graph is undirected by default, it is only...
def time_remaining_est(self, completed_iter): """Estimate the remaining time left. Parameters: completed_iter (int): Number of iterations completed. Returns: est_time: Estimated time remaining. """ if completed_iter: t_r_est = (time.time() - ...
def function[time_remaining_est, parameter[self, completed_iter]]: constant[Estimate the remaining time left. Parameters: completed_iter (int): Number of iterations completed. Returns: est_time: Estimated time remaining. ] if name[completed_iter] begin[:...
keyword[def] identifier[time_remaining_est] ( identifier[self] , identifier[completed_iter] ): literal[string] keyword[if] identifier[completed_iter] : identifier[t_r_est] =( identifier[time] . identifier[time] ()- identifier[self] . identifier[t_start] )/ identifier[completed_iter] *...
def time_remaining_est(self, completed_iter): """Estimate the remaining time left. Parameters: completed_iter (int): Number of iterations completed. Returns: est_time: Estimated time remaining. """ if completed_iter: t_r_est = (time.time() - self.t_start...
def _maybe_handle(self, prefix, handler, path, params, data=None): """Apply the handler if the prefix matches.""" if path.startswith(prefix): relpath = path[len(prefix):] if data: handler(relpath, params, data) else: handler(relpath, params) return True else: re...
def function[_maybe_handle, parameter[self, prefix, handler, path, params, data]]: constant[Apply the handler if the prefix matches.] if call[name[path].startswith, parameter[name[prefix]]] begin[:] variable[relpath] assign[=] call[name[path]][<ast.Slice object at 0x7da1b1eee980>] ...
keyword[def] identifier[_maybe_handle] ( identifier[self] , identifier[prefix] , identifier[handler] , identifier[path] , identifier[params] , identifier[data] = keyword[None] ): literal[string] keyword[if] identifier[path] . identifier[startswith] ( identifier[prefix] ): identifier[relpath] = iden...
def _maybe_handle(self, prefix, handler, path, params, data=None): """Apply the handler if the prefix matches.""" if path.startswith(prefix): relpath = path[len(prefix):] if data: handler(relpath, params, data) # depends on [control=['if'], data=[]] else: handler...
def export_identities(self, outfile, source=None): """Export identities information to a file. The method exports information related to unique identities, to the given 'outfile' output file. When 'source' parameter is given, only those unique identities which have one or more ...
def function[export_identities, parameter[self, outfile, source]]: constant[Export identities information to a file. The method exports information related to unique identities, to the given 'outfile' output file. When 'source' parameter is given, only those unique identities which hav...
keyword[def] identifier[export_identities] ( identifier[self] , identifier[outfile] , identifier[source] = keyword[None] ): literal[string] identifier[exporter] = identifier[SortingHatIdentitiesExporter] ( identifier[self] . identifier[db] ) identifier[dump] = identifier[exporter] . ident...
def export_identities(self, outfile, source=None): """Export identities information to a file. The method exports information related to unique identities, to the given 'outfile' output file. When 'source' parameter is given, only those unique identities which have one or more iden...
def is_creation_model(instance, attribute, value): """Must include at least a ``name`` key.""" creation_name = value.get('name') if not isinstance(creation_name, str): instance_name = instance.__class__.__name__ err_str = ("'name' must be given as a string in the '{attr}' " ...
def function[is_creation_model, parameter[instance, attribute, value]]: constant[Must include at least a ``name`` key.] variable[creation_name] assign[=] call[name[value].get, parameter[constant[name]]] if <ast.UnaryOp object at 0x7da20c7cbeb0> begin[:] variable[instance_name] as...
keyword[def] identifier[is_creation_model] ( identifier[instance] , identifier[attribute] , identifier[value] ): literal[string] identifier[creation_name] = identifier[value] . identifier[get] ( literal[string] ) keyword[if] keyword[not] identifier[isinstance] ( identifier[creation_name] , identifi...
def is_creation_model(instance, attribute, value): """Must include at least a ``name`` key.""" creation_name = value.get('name') if not isinstance(creation_name, str): instance_name = instance.__class__.__name__ err_str = "'name' must be given as a string in the '{attr}' parameter of a '{cls...
def fit_upper_harmonic(phi, intensities, order): """ Fit upper harmonic function to a set of (angle, intensity) pairs. With ``order`` set to 3 or 4, the resulting amplitudes, divided by the semimajor axis length and local gradient, measure the deviations from perfect ellipticity. The harmonic ...
def function[fit_upper_harmonic, parameter[phi, intensities, order]]: constant[ Fit upper harmonic function to a set of (angle, intensity) pairs. With ``order`` set to 3 or 4, the resulting amplitudes, divided by the semimajor axis length and local gradient, measure the deviations from perfect ...
keyword[def] identifier[fit_upper_harmonic] ( identifier[phi] , identifier[intensities] , identifier[order] ): literal[string] identifier[an] = identifier[bn] = literal[int] keyword[def] identifier[optimize_func] ( identifier[x] ): keyword[return] ( identifier[x] [ literal[int] ]+ identif...
def fit_upper_harmonic(phi, intensities, order): """ Fit upper harmonic function to a set of (angle, intensity) pairs. With ``order`` set to 3 or 4, the resulting amplitudes, divided by the semimajor axis length and local gradient, measure the deviations from perfect ellipticity. The harmonic ...
def index(self, index, doc_type, body, id=None, params=None): """ Adds or updates a typed JSON document in a specific index, making it searchable. `<http://elasticsearch.org/guide/reference/api/index_/>`_ :arg index: The name of the index :arg doc_type: The type of the document ...
def function[index, parameter[self, index, doc_type, body, id, params]]: constant[ Adds or updates a typed JSON document in a specific index, making it searchable. `<http://elasticsearch.org/guide/reference/api/index_/>`_ :arg index: The name of the index :arg doc_type: The type...
keyword[def] identifier[index] ( identifier[self] , identifier[index] , identifier[doc_type] , identifier[body] , identifier[id] = keyword[None] , identifier[params] = keyword[None] ): literal[string] identifier[_] , identifier[data] = keyword[yield] identifier[self] . identifier[transport] . iden...
def index(self, index, doc_type, body, id=None, params=None): """ Adds or updates a typed JSON document in a specific index, making it searchable. `<http://elasticsearch.org/guide/reference/api/index_/>`_ :arg index: The name of the index :arg doc_type: The type of the document ...
def get_comment_section(self, force_reload=False, reverse=False): """Get CommentSection instance representing all comments for thread. :arg force_reload=False: Whether to force reloading comments directly or allow using what is cached ...
def function[get_comment_section, parameter[self, force_reload, reverse]]: constant[Get CommentSection instance representing all comments for thread. :arg force_reload=False: Whether to force reloading comments directly or allow using what is cached ...
keyword[def] identifier[get_comment_section] ( identifier[self] , identifier[force_reload] = keyword[False] , identifier[reverse] = keyword[False] ): literal[string] keyword[if] identifier[self] . identifier[content] keyword[is] keyword[not] keyword[None] keyword[and] keyword[not] identifier...
def get_comment_section(self, force_reload=False, reverse=False): """Get CommentSection instance representing all comments for thread. :arg force_reload=False: Whether to force reloading comments directly or allow using what is cached in ...
def _get_avro_type(val): """Infer avro type for the current input. """ if isinstance(val, dict): assert val.get("class") == "File" or "File" in val.get("class") return "File" elif isinstance(val, (tuple, list)): types = [] for ctype in [_get_avro_type(v) for v in val]: ...
def function[_get_avro_type, parameter[val]]: constant[Infer avro type for the current input. ] if call[name[isinstance], parameter[name[val], name[dict]]] begin[:] assert[<ast.BoolOp object at 0x7da18f09fc10>] return[constant[File]]
keyword[def] identifier[_get_avro_type] ( identifier[val] ): literal[string] keyword[if] identifier[isinstance] ( identifier[val] , identifier[dict] ): keyword[assert] identifier[val] . identifier[get] ( literal[string] )== literal[string] keyword[or] literal[string] keyword[in] identifier[v...
def _get_avro_type(val): """Infer avro type for the current input. """ if isinstance(val, dict): assert val.get('class') == 'File' or 'File' in val.get('class') return 'File' # depends on [control=['if'], data=[]] elif isinstance(val, (tuple, list)): types = [] for ctype...
def get_font(self, bold, oblique): """ Get the font based on bold and italic flags. """ if bold and oblique: return self.fonts['BOLDITALIC'] elif bold: return self.fonts['BOLD'] elif oblique: return self.fonts['ITALIC'] else: ...
def function[get_font, parameter[self, bold, oblique]]: constant[ Get the font based on bold and italic flags. ] if <ast.BoolOp object at 0x7da18bc73e80> begin[:] return[call[name[self].fonts][constant[BOLDITALIC]]]
keyword[def] identifier[get_font] ( identifier[self] , identifier[bold] , identifier[oblique] ): literal[string] keyword[if] identifier[bold] keyword[and] identifier[oblique] : keyword[return] identifier[self] . identifier[fonts] [ literal[string] ] keyword[elif] identifi...
def get_font(self, bold, oblique): """ Get the font based on bold and italic flags. """ if bold and oblique: return self.fonts['BOLDITALIC'] # depends on [control=['if'], data=[]] elif bold: return self.fonts['BOLD'] # depends on [control=['if'], data=[]] elif oblique: ...
def get_state(self, caller): """ Get per-program state. """ if caller in self.state: return self.state[caller] else: rv = self.state[caller] = DictObject() return rv
def function[get_state, parameter[self, caller]]: constant[ Get per-program state. ] if compare[name[caller] in name[self].state] begin[:] return[call[name[self].state][name[caller]]]
keyword[def] identifier[get_state] ( identifier[self] , identifier[caller] ): literal[string] keyword[if] identifier[caller] keyword[in] identifier[self] . identifier[state] : keyword[return] identifier[self] . identifier[state] [ identifier[caller] ] keyword[else] : ...
def get_state(self, caller): """ Get per-program state. """ if caller in self.state: return self.state[caller] # depends on [control=['if'], data=['caller']] else: rv = self.state[caller] = DictObject() return rv
def dialect_class(self, adapter): """Get dialect sql class by adapter""" if self.dialects.get(adapter): return self.dialects[adapter] try: class_prefix = getattr( __import__('db.' + adapter, globals(), locals(), ['__class_prefix_...
def function[dialect_class, parameter[self, adapter]]: constant[Get dialect sql class by adapter] if call[name[self].dialects.get, parameter[name[adapter]]] begin[:] return[call[name[self].dialects][name[adapter]]] <ast.Try object at 0x7da2054a7d30> call[name[self].dialects][name[ada...
keyword[def] identifier[dialect_class] ( identifier[self] , identifier[adapter] ): literal[string] keyword[if] identifier[self] . identifier[dialects] . identifier[get] ( identifier[adapter] ): keyword[return] identifier[self] . identifier[dialects] [ identifier[adapter] ] k...
def dialect_class(self, adapter): """Get dialect sql class by adapter""" if self.dialects.get(adapter): return self.dialects[adapter] # depends on [control=['if'], data=[]] try: class_prefix = getattr(__import__('db.' + adapter, globals(), locals(), ['__class_prefix__']), '__class_prefix__'...
def get_memory_region(x, query_block_shape, memory_flange, q_indices): """Get the memory regions that surround a 2d query. The memory regions will be the left and top right. Args: x: A tensor with shape [batch, heads, height, width, depth] query_block_shape: a 2-d tuple of integers memory_flange: ...
def function[get_memory_region, parameter[x, query_block_shape, memory_flange, q_indices]]: constant[Get the memory regions that surround a 2d query. The memory regions will be the left and top right. Args: x: A tensor with shape [batch, heads, height, width, depth] query_block_shape: a 2-d tupl...
keyword[def] identifier[get_memory_region] ( identifier[x] , identifier[query_block_shape] , identifier[memory_flange] , identifier[q_indices] ): literal[string] identifier[x_query_padded] = identifier[pad_to_multiple_2d] ( identifier[x] , identifier[query_block_shape] ) identifier[x_center] = identif...
def get_memory_region(x, query_block_shape, memory_flange, q_indices): """Get the memory regions that surround a 2d query. The memory regions will be the left and top right. Args: x: A tensor with shape [batch, heads, height, width, depth] query_block_shape: a 2-d tuple of integers memory_flange...
def _check_api_limits(gh_session, api_required=250, sleep_time=15): """ Simplified check for API limits If necessary, spin in place waiting for API to reset before returning. See: https://developer.github.com/v3/#rate-limiting """ api_rates = gh_session.rate_limit() api_remaining = api_ra...
def function[_check_api_limits, parameter[gh_session, api_required, sleep_time]]: constant[ Simplified check for API limits If necessary, spin in place waiting for API to reset before returning. See: https://developer.github.com/v3/#rate-limiting ] variable[api_rates] assign[=] call[na...
keyword[def] identifier[_check_api_limits] ( identifier[gh_session] , identifier[api_required] = literal[int] , identifier[sleep_time] = literal[int] ): literal[string] identifier[api_rates] = identifier[gh_session] . identifier[rate_limit] () identifier[api_remaining] = identifier[api_rates] [ liter...
def _check_api_limits(gh_session, api_required=250, sleep_time=15): """ Simplified check for API limits If necessary, spin in place waiting for API to reset before returning. See: https://developer.github.com/v3/#rate-limiting """ api_rates = gh_session.rate_limit() api_remaining = api_rat...
def gradient_stops(self): """|GradientStops| object providing access to stops of this gradient. Raises |TypeError| when fill is not gradient (call `fill.gradient()` first). Each stop represents a color between which the gradient smoothly transitions. """ if self.type != ...
def function[gradient_stops, parameter[self]]: constant[|GradientStops| object providing access to stops of this gradient. Raises |TypeError| when fill is not gradient (call `fill.gradient()` first). Each stop represents a color between which the gradient smoothly transitions. ]...
keyword[def] identifier[gradient_stops] ( identifier[self] ): literal[string] keyword[if] identifier[self] . identifier[type] != identifier[MSO_FILL] . identifier[GRADIENT] : keyword[raise] identifier[TypeError] ( literal[string] ) keyword[return] identifier[self] . identif...
def gradient_stops(self): """|GradientStops| object providing access to stops of this gradient. Raises |TypeError| when fill is not gradient (call `fill.gradient()` first). Each stop represents a color between which the gradient smoothly transitions. """ if self.type != MSO_FILL...
def is_assignee_on(self, login, repository): """Checks if this user can be assigned to issues on login/repository. :returns: :class:`bool` """ url = self._build_url('repos', login, repository, 'assignees', self.login) return self._boolean(self._get(...
def function[is_assignee_on, parameter[self, login, repository]]: constant[Checks if this user can be assigned to issues on login/repository. :returns: :class:`bool` ] variable[url] assign[=] call[name[self]._build_url, parameter[constant[repos], name[login], name[repository], constant[...
keyword[def] identifier[is_assignee_on] ( identifier[self] , identifier[login] , identifier[repository] ): literal[string] identifier[url] = identifier[self] . identifier[_build_url] ( literal[string] , identifier[login] , identifier[repository] , literal[string] , identifier[self] . ident...
def is_assignee_on(self, login, repository): """Checks if this user can be assigned to issues on login/repository. :returns: :class:`bool` """ url = self._build_url('repos', login, repository, 'assignees', self.login) return self._boolean(self._get(url), 204, 404)
def argv(cls, name, short_name=None, type=None, help=None): """ Set command line arguments as a source Parses the command line arguments described by the parameters. Args: name: the long name of the argument (foo) short_name: the optional short name of the argument (f) ...
def function[argv, parameter[cls, name, short_name, type, help]]: constant[ Set command line arguments as a source Parses the command line arguments described by the parameters. Args: name: the long name of the argument (foo) short_name: the optional short name of the a...
keyword[def] identifier[argv] ( identifier[cls] , identifier[name] , identifier[short_name] = keyword[None] , identifier[type] = keyword[None] , identifier[help] = keyword[None] ): literal[string] identifier[cls] . identifier[__hierarchy] . identifier[append] ( identifier[argv] . identifier[Argv] (...
def argv(cls, name, short_name=None, type=None, help=None): """ Set command line arguments as a source Parses the command line arguments described by the parameters. Args: name: the long name of the argument (foo) short_name: the optional short name of the argument (f) ...
def _fill(self, values): """Add extra values to fill the line""" zero = self.view.y(min(max(self.zero, self._box.ymin), self._box.ymax)) # Check to see if the data has been padded with "none's" # Fill doesn't work correctly otherwise end = len(values) - 1 while end > 0: ...
def function[_fill, parameter[self, values]]: constant[Add extra values to fill the line] variable[zero] assign[=] call[name[self].view.y, parameter[call[name[min], parameter[call[name[max], parameter[name[self].zero, name[self]._box.ymin]], name[self]._box.ymax]]]] variable[end] assign[=] binar...
keyword[def] identifier[_fill] ( identifier[self] , identifier[values] ): literal[string] identifier[zero] = identifier[self] . identifier[view] . identifier[y] ( identifier[min] ( identifier[max] ( identifier[self] . identifier[zero] , identifier[self] . identifier[_box] . identifier[ymin] ), iden...
def _fill(self, values): """Add extra values to fill the line""" zero = self.view.y(min(max(self.zero, self._box.ymin), self._box.ymax)) # Check to see if the data has been padded with "none's" # Fill doesn't work correctly otherwise end = len(values) - 1 while end > 0: (x, y) = values[e...
def uplinkBusy(): """UPLINK BUSY Section 9.1.46""" name = "Uplink Busy" a = TpPd(pd=0x6) b = MessageType(mesType=0x2a) # 00101010 packet = a / b return packet
def function[uplinkBusy, parameter[]]: constant[UPLINK BUSY Section 9.1.46] variable[name] assign[=] constant[Uplink Busy] variable[a] assign[=] call[name[TpPd], parameter[]] variable[b] assign[=] call[name[MessageType], parameter[]] variable[packet] assign[=] binary_operation[na...
keyword[def] identifier[uplinkBusy] (): literal[string] identifier[name] = literal[string] identifier[a] = identifier[TpPd] ( identifier[pd] = literal[int] ) identifier[b] = identifier[MessageType] ( identifier[mesType] = literal[int] ) identifier[packet] = identifier[a] / identifier[b] ...
def uplinkBusy(): """UPLINK BUSY Section 9.1.46""" name = 'Uplink Busy' a = TpPd(pd=6) b = MessageType(mesType=42) # 00101010 packet = a / b return packet
def set_dataset_year_range(self, dataset_year, dataset_end_year=None): # type: (Union[str, int], Optional[Union[str, int]]) -> None """Set dataset date as a range from year or start and end year. Args: dataset_year (Union[str, int]): Dataset year given as string or int d...
def function[set_dataset_year_range, parameter[self, dataset_year, dataset_end_year]]: constant[Set dataset date as a range from year or start and end year. Args: dataset_year (Union[str, int]): Dataset year given as string or int dataset_end_year (Optional[Union[str, int]]): Da...
keyword[def] identifier[set_dataset_year_range] ( identifier[self] , identifier[dataset_year] , identifier[dataset_end_year] = keyword[None] ): literal[string] keyword[if] identifier[isinstance] ( identifier[dataset_year] , identifier[int] ): identifier[dataset_date] = literal[string...
def set_dataset_year_range(self, dataset_year, dataset_end_year=None): # type: (Union[str, int], Optional[Union[str, int]]) -> None 'Set dataset date as a range from year or start and end year.\n\n Args:\n dataset_year (Union[str, int]): Dataset year given as string or int\n dataset...
def append_dist_to_shapes(feed: "Feed") -> "Feed": """ Calculate and append the optional ``shape_dist_traveled`` field in ``feed.shapes`` in terms of the distance units ``feed.dist_units``. Return the resulting Feed. Notes ----- - As a benchmark, using this function on `this Portland feed ...
def function[append_dist_to_shapes, parameter[feed]]: constant[ Calculate and append the optional ``shape_dist_traveled`` field in ``feed.shapes`` in terms of the distance units ``feed.dist_units``. Return the resulting Feed. Notes ----- - As a benchmark, using this function on `this Po...
keyword[def] identifier[append_dist_to_shapes] ( identifier[feed] : literal[string] )-> literal[string] : literal[string] keyword[if] identifier[feed] . identifier[shapes] keyword[is] keyword[None] : keyword[raise] identifier[ValueError] ( literal[string] ) identifier[f...
def append_dist_to_shapes(feed: 'Feed') -> 'Feed': """ Calculate and append the optional ``shape_dist_traveled`` field in ``feed.shapes`` in terms of the distance units ``feed.dist_units``. Return the resulting Feed. Notes ----- - As a benchmark, using this function on `this Portland feed ...
def run_check(self, data): """Check for uncommon words and difficult words in file.""" if not data: sys.exit(1) data, sentences, chars, num_words = self.pre_check(data) w_dict = Counter(data) uniq_len, uncommon, uncom_len = self.gsl(w_dict) non_dchall_set = Co...
def function[run_check, parameter[self, data]]: constant[Check for uncommon words and difficult words in file.] if <ast.UnaryOp object at 0x7da20e955390> begin[:] call[name[sys].exit, parameter[constant[1]]] <ast.Tuple object at 0x7da20e956890> assign[=] call[name[self].pre_check...
keyword[def] identifier[run_check] ( identifier[self] , identifier[data] ): literal[string] keyword[if] keyword[not] identifier[data] : identifier[sys] . identifier[exit] ( literal[int] ) identifier[data] , identifier[sentences] , identifier[chars] , identifier[num_words] = ...
def run_check(self, data): """Check for uncommon words and difficult words in file.""" if not data: sys.exit(1) # depends on [control=['if'], data=[]] (data, sentences, chars, num_words) = self.pre_check(data) w_dict = Counter(data) (uniq_len, uncommon, uncom_len) = self.gsl(w_dict) non...
def get_part(self, vertex_in, vertices_border): """List all vertices that are connected to vertex_in, but are not included in or 'behind' vertices_border. """ vertices_new = set(self.neighbors[vertex_in]) vertices_part = set([vertex_in]) while len(vertices_new) > 0: ...
def function[get_part, parameter[self, vertex_in, vertices_border]]: constant[List all vertices that are connected to vertex_in, but are not included in or 'behind' vertices_border. ] variable[vertices_new] assign[=] call[name[set], parameter[call[name[self].neighbors][name[vertex_in]...
keyword[def] identifier[get_part] ( identifier[self] , identifier[vertex_in] , identifier[vertices_border] ): literal[string] identifier[vertices_new] = identifier[set] ( identifier[self] . identifier[neighbors] [ identifier[vertex_in] ]) identifier[vertices_part] = identifier[set] ([ iden...
def get_part(self, vertex_in, vertices_border): """List all vertices that are connected to vertex_in, but are not included in or 'behind' vertices_border. """ vertices_new = set(self.neighbors[vertex_in]) vertices_part = set([vertex_in]) while len(vertices_new) > 0: pivot = ve...
def link_to(self, model, idx, self_idx): """ Register (self.name, self.idx) in `model._from` Returns ------- """ if model in self.system.loaded_groups: # access group instance grp = self.system.__dict__[model] # doing it one by one ...
def function[link_to, parameter[self, model, idx, self_idx]]: constant[ Register (self.name, self.idx) in `model._from` Returns ------- ] if compare[name[model] in name[self].system.loaded_groups] begin[:] variable[grp] assign[=] call[name[self].system._...
keyword[def] identifier[link_to] ( identifier[self] , identifier[model] , identifier[idx] , identifier[self_idx] ): literal[string] keyword[if] identifier[model] keyword[in] identifier[self] . identifier[system] . identifier[loaded_groups] : identifier[grp] = identifier[se...
def link_to(self, model, idx, self_idx): """ Register (self.name, self.idx) in `model._from` Returns ------- """ if model in self.system.loaded_groups: # access group instance grp = self.system.__dict__[model] # doing it one by one for (i, self_i...
def EI(inc): """ Given a mean inclination value of a distribution of directions, this function calculates the expected elongation of this distribution using a best-fit polynomial of the TK03 GAD secular variation model (Tauxe and Kent, 2004). Parameters ---------- inc : inclination in d...
def function[EI, parameter[inc]]: constant[ Given a mean inclination value of a distribution of directions, this function calculates the expected elongation of this distribution using a best-fit polynomial of the TK03 GAD secular variation model (Tauxe and Kent, 2004). Parameters ------...
keyword[def] identifier[EI] ( identifier[inc] ): literal[string] identifier[poly_tk03] =[ literal[int] ,- literal[int] ,- literal[int] , literal[int] ] keyword[return] identifier[poly_tk03] [ literal[int] ]* identifier[inc] ** literal[int] + identifier[poly_tk03] [ literal[int] ]* identifier[inc...
def EI(inc): """ Given a mean inclination value of a distribution of directions, this function calculates the expected elongation of this distribution using a best-fit polynomial of the TK03 GAD secular variation model (Tauxe and Kent, 2004). Parameters ---------- inc : inclination in d...
def get_as_string_with_default(self, key, default_value): """ Converts map element into a string or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: string value ot the element or defa...
def function[get_as_string_with_default, parameter[self, key, default_value]]: constant[ Converts map element into a string or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: string v...
keyword[def] identifier[get_as_string_with_default] ( identifier[self] , identifier[key] , identifier[default_value] ): literal[string] identifier[value] = identifier[self] . identifier[get] ( identifier[key] ) keyword[return] identifier[StringConverter] . identifier[to_string_with_defaul...
def get_as_string_with_default(self, key, default_value): """ Converts map element into a string or returns default value if conversion is not possible. :param key: an index of element to get. :param default_value: the default value :return: string value ot the element or default ...
def reply(self, connection, reply, orig_req): """Send an asynchronous reply to an earlier request. Parameters ---------- connection : ClientConnection object The client to send the reply to. reply : Message object The reply message to send. orig_r...
def function[reply, parameter[self, connection, reply, orig_req]]: constant[Send an asynchronous reply to an earlier request. Parameters ---------- connection : ClientConnection object The client to send the reply to. reply : Message object The reply mess...
keyword[def] identifier[reply] ( identifier[self] , identifier[connection] , identifier[reply] , identifier[orig_req] ): literal[string] keyword[if] identifier[isinstance] ( identifier[connection] , identifier[ClientRequestConnection] ): identifier[self] . identifier[_logger] . identi...
def reply(self, connection, reply, orig_req): """Send an asynchronous reply to an earlier request. Parameters ---------- connection : ClientConnection object The client to send the reply to. reply : Message object The reply message to send. orig_req :...
def build_db_query(fields_names, field_values): """ method builds query dictionary by zipping together DB field names with the field values """ if isinstance(field_values, string_types): field_values = [field_values] if len(fields_names) != len(field_values): raise ValueError('Error: unable...
def function[build_db_query, parameter[fields_names, field_values]]: constant[ method builds query dictionary by zipping together DB field names with the field values ] if call[name[isinstance], parameter[name[field_values], name[string_types]]] begin[:] variable[field_values] assign[=] ...
keyword[def] identifier[build_db_query] ( identifier[fields_names] , identifier[field_values] ): literal[string] keyword[if] identifier[isinstance] ( identifier[field_values] , identifier[string_types] ): identifier[field_values] =[ identifier[field_values] ] keyword[if] identifier[len] ( ...
def build_db_query(fields_names, field_values): """ method builds query dictionary by zipping together DB field names with the field values """ if isinstance(field_values, string_types): field_values = [field_values] # depends on [control=['if'], data=[]] if len(fields_names) != len(field_values): ...
def spread(self, X): """ Calculate the average spread for each node. The average spread is a measure of how far each neuron is from the data points which cluster to it. Parameters ---------- X : numpy array The input data. Returns --...
def function[spread, parameter[self, X]]: constant[ Calculate the average spread for each node. The average spread is a measure of how far each neuron is from the data points which cluster to it. Parameters ---------- X : numpy array The input data. ...
keyword[def] identifier[spread] ( identifier[self] , identifier[X] ): literal[string] identifier[distance] , identifier[_] = identifier[self] . identifier[distance_function] ( identifier[X] , identifier[self] . identifier[weights] ) identifier[dists_per_neuron] = identifier[defaultdict] ( ...
def spread(self, X): """ Calculate the average spread for each node. The average spread is a measure of how far each neuron is from the data points which cluster to it. Parameters ---------- X : numpy array The input data. Returns ------...
def shapes(self): """Get all time-slice shapes, in order, from this reservation on.""" shapes = [] curRes = self while curRes is not None: shapes.append(curRes.shape) curRes = curRes.nReservation return shapes
def function[shapes, parameter[self]]: constant[Get all time-slice shapes, in order, from this reservation on.] variable[shapes] assign[=] list[[]] variable[curRes] assign[=] name[self] while compare[name[curRes] is_not constant[None]] begin[:] call[name[shapes].append, p...
keyword[def] identifier[shapes] ( identifier[self] ): literal[string] identifier[shapes] =[] identifier[curRes] = identifier[self] keyword[while] identifier[curRes] keyword[is] keyword[not] keyword[None] : identifier[shapes] . identifier[append] ( identifier[curR...
def shapes(self): """Get all time-slice shapes, in order, from this reservation on.""" shapes = [] curRes = self while curRes is not None: shapes.append(curRes.shape) curRes = curRes.nReservation # depends on [control=['while'], data=['curRes']] return shapes
def _interfaces_ip(out): """ Uses ip to return a dictionary of interfaces with various information about each (up/down state, ip address, netmask, and hwaddr) """ ret = dict() def parse_network(value, cols): """ Return a tuple of ip, netmask, broadcast based on the curre...
def function[_interfaces_ip, parameter[out]]: constant[ Uses ip to return a dictionary of interfaces with various information about each (up/down state, ip address, netmask, and hwaddr) ] variable[ret] assign[=] call[name[dict], parameter[]] def function[parse_network, parameter[valu...
keyword[def] identifier[_interfaces_ip] ( identifier[out] ): literal[string] identifier[ret] = identifier[dict] () keyword[def] identifier[parse_network] ( identifier[value] , identifier[cols] ): literal[string] identifier[brd] = keyword[None] keyword[if] literal[string...
def _interfaces_ip(out): """ Uses ip to return a dictionary of interfaces with various information about each (up/down state, ip address, netmask, and hwaddr) """ ret = dict() def parse_network(value, cols): """ Return a tuple of ip, netmask, broadcast based on the curre...
def complex_state_generator_bravo(last_state=''): """Pick a state.""" from random import choice states = ['ALPHA', 'BRAVO', 'BRAVO', 'DONE'] if last_state: states.remove(last_state) # Slightly lower chances of previous state. state = choice(states) logging.info('Generating a state......
def function[complex_state_generator_bravo, parameter[last_state]]: constant[Pick a state.] from relative_module[random] import module[choice] variable[states] assign[=] list[[<ast.Constant object at 0x7da20c6a8130>, <ast.Constant object at 0x7da20c6a86a0>, <ast.Constant object at 0x7da20c6a8280>, <...
keyword[def] identifier[complex_state_generator_bravo] ( identifier[last_state] = literal[string] ): literal[string] keyword[from] identifier[random] keyword[import] identifier[choice] identifier[states] =[ literal[string] , literal[string] , literal[string] , literal[string] ] keyword[if] ...
def complex_state_generator_bravo(last_state=''): """Pick a state.""" from random import choice states = ['ALPHA', 'BRAVO', 'BRAVO', 'DONE'] if last_state: states.remove(last_state) # Slightly lower chances of previous state. # depends on [control=['if'], data=[]] state = choice(states) ...
def _conv(self, name, x, filter_size, in_filters, out_filters, strides): """Convolution.""" with tf.variable_scope(name): n = filter_size * filter_size * out_filters kernel = tf.get_variable( "DW", [filter_size, filter_size, in_filters, out_filters], ...
def function[_conv, parameter[self, name, x, filter_size, in_filters, out_filters, strides]]: constant[Convolution.] with call[name[tf].variable_scope, parameter[name[name]]] begin[:] variable[n] assign[=] binary_operation[binary_operation[name[filter_size] * name[filter_size]] * name[ou...
keyword[def] identifier[_conv] ( identifier[self] , identifier[name] , identifier[x] , identifier[filter_size] , identifier[in_filters] , identifier[out_filters] , identifier[strides] ): literal[string] keyword[with] identifier[tf] . identifier[variable_scope] ( identifier[name] ): id...
def _conv(self, name, x, filter_size, in_filters, out_filters, strides): """Convolution.""" with tf.variable_scope(name): n = filter_size * filter_size * out_filters kernel = tf.get_variable('DW', [filter_size, filter_size, in_filters, out_filters], tf.float32, initializer=tf.random_normal_initi...
def mkdir(self, pathobj, _): """ Creates remote directory Note that this operation is not recursive """ if not pathobj.drive or not pathobj.root: raise RuntimeError("Full path required: '%s'" % str(pathobj)) if pathobj.exists(): raise OSError(17, ...
def function[mkdir, parameter[self, pathobj, _]]: constant[ Creates remote directory Note that this operation is not recursive ] if <ast.BoolOp object at 0x7da204962f20> begin[:] <ast.Raise object at 0x7da1b086eb60> if call[name[pathobj].exists, parameter[]] begin...
keyword[def] identifier[mkdir] ( identifier[self] , identifier[pathobj] , identifier[_] ): literal[string] keyword[if] keyword[not] identifier[pathobj] . identifier[drive] keyword[or] keyword[not] identifier[pathobj] . identifier[root] : keyword[raise] identifier[RuntimeError] ( ...
def mkdir(self, pathobj, _): """ Creates remote directory Note that this operation is not recursive """ if not pathobj.drive or not pathobj.root: raise RuntimeError("Full path required: '%s'" % str(pathobj)) # depends on [control=['if'], data=[]] if pathobj.exists(): ...
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: """ Handles the requirements in the target repository, returns a path to a executable of the virtualenv. """ return str(self.get_or_create_venv(repo_path).resolve() / "bin" / "python")
def function[get_or_create_environment, parameter[self, repo, branch, git_repo, repo_path]]: constant[ Handles the requirements in the target repository, returns a path to a executable of the virtualenv. ] return[call[name[str], parameter[binary_operation[binary_operation[call[call[name[self].get_or...
keyword[def] identifier[get_or_create_environment] ( identifier[self] , identifier[repo] : identifier[str] , identifier[branch] : identifier[str] , identifier[git_repo] : identifier[Repo] , identifier[repo_path] : identifier[Path] )-> identifier[str] : literal[string] keyword[return] identifier[st...
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str: """ Handles the requirements in the target repository, returns a path to a executable of the virtualenv. """ return str(self.get_or_create_venv(repo_path).resolve() / 'bin' / 'python')
def user_stats(request): """ JSON of user stats of the user GET parameters: html (bool): turn on the HTML version of the API, defaults to false user (int): identifier of the user, defaults to logged user concepts (list): list of identifiers of concepts, defaults to...
def function[user_stats, parameter[request]]: constant[ JSON of user stats of the user GET parameters: html (bool): turn on the HTML version of the API, defaults to false user (int): identifier of the user, defaults to logged user concepts (list): list of ident...
keyword[def] identifier[user_stats] ( identifier[request] ): literal[string] identifier[user] = identifier[get_user_id] ( identifier[request] ) identifier[language] = identifier[get_language] ( identifier[request] ) identifier[concepts] = keyword[None] keyword[if] literal[string] keyword...
def user_stats(request): """ JSON of user stats of the user GET parameters: html (bool): turn on the HTML version of the API, defaults to false user (int): identifier of the user, defaults to logged user concepts (list): list of identifiers of concepts, defaults to...
def get_last_doc(self): """Returns the last document stored in the Solr engine. """ #search everything, sort by descending timestamp, return 1 row try: result = self.solr.search('*:*', sort='_ts desc', rows=1) except ValueError: return None for r ...
def function[get_last_doc, parameter[self]]: constant[Returns the last document stored in the Solr engine. ] <ast.Try object at 0x7da1b11c5660> for taget[name[r]] in starred[name[result]] begin[:] call[name[r]][constant[_id]] assign[=] call[name[r].pop, parameter[name[self].u...
keyword[def] identifier[get_last_doc] ( identifier[self] ): literal[string] keyword[try] : identifier[result] = identifier[self] . identifier[solr] . identifier[search] ( literal[string] , identifier[sort] = literal[string] , identifier[rows] = literal[int] ) keyword[...
def get_last_doc(self): """Returns the last document stored in the Solr engine. """ #search everything, sort by descending timestamp, return 1 row try: result = self.solr.search('*:*', sort='_ts desc', rows=1) # depends on [control=['try'], data=[]] except ValueError: return Non...
def remove_armor(armored_data): """Decode armored data into its binary form.""" stream = io.BytesIO(armored_data) lines = stream.readlines()[3:-1] data = base64.b64decode(b''.join(lines)) payload, checksum = data[:-3], data[-3:] assert util.crc24(payload) == checksum return payload
def function[remove_armor, parameter[armored_data]]: constant[Decode armored data into its binary form.] variable[stream] assign[=] call[name[io].BytesIO, parameter[name[armored_data]]] variable[lines] assign[=] call[call[name[stream].readlines, parameter[]]][<ast.Slice object at 0x7da1b12f1510>...
keyword[def] identifier[remove_armor] ( identifier[armored_data] ): literal[string] identifier[stream] = identifier[io] . identifier[BytesIO] ( identifier[armored_data] ) identifier[lines] = identifier[stream] . identifier[readlines] ()[ literal[int] :- literal[int] ] identifier[data] = identifie...
def remove_armor(armored_data): """Decode armored data into its binary form.""" stream = io.BytesIO(armored_data) lines = stream.readlines()[3:-1] data = base64.b64decode(b''.join(lines)) (payload, checksum) = (data[:-3], data[-3:]) assert util.crc24(payload) == checksum return payload
def angular_separation(lonp1, latp1, lonp2, latp2): """ Compute the angles between lon / lat points p1 and p2 given in radians. On the unit sphere, this also corresponds to the great circle distance. p1 and p2 can be numpy arrays of the same length. """ xp1, yp1, zp1 = lonlat2xyz(lonp1, latp1) ...
def function[angular_separation, parameter[lonp1, latp1, lonp2, latp2]]: constant[ Compute the angles between lon / lat points p1 and p2 given in radians. On the unit sphere, this also corresponds to the great circle distance. p1 and p2 can be numpy arrays of the same length. ] <ast.Tupl...
keyword[def] identifier[angular_separation] ( identifier[lonp1] , identifier[latp1] , identifier[lonp2] , identifier[latp2] ): literal[string] identifier[xp1] , identifier[yp1] , identifier[zp1] = identifier[lonlat2xyz] ( identifier[lonp1] , identifier[latp1] ) identifier[xp2] , identifier[yp2] , ide...
def angular_separation(lonp1, latp1, lonp2, latp2): """ Compute the angles between lon / lat points p1 and p2 given in radians. On the unit sphere, this also corresponds to the great circle distance. p1 and p2 can be numpy arrays of the same length. """ (xp1, yp1, zp1) = lonlat2xyz(lonp1, latp1)...
def _fix_path(): """Finds the google_appengine directory and fixes Python imports to use it.""" import os import sys all_paths = os.environ.get('PYTHONPATH').split(os.pathsep) for path_dir in all_paths: dev_appserver_path = os.path.join(path_dir, 'dev_appserver.py') if os.path.exists(dev_appserver_pat...
def function[_fix_path, parameter[]]: constant[Finds the google_appengine directory and fixes Python imports to use it.] import module[os] import module[sys] variable[all_paths] assign[=] call[call[name[os].environ.get, parameter[constant[PYTHONPATH]]].split, parameter[name[os].pathsep]] ...
keyword[def] identifier[_fix_path] (): literal[string] keyword[import] identifier[os] keyword[import] identifier[sys] identifier[all_paths] = identifier[os] . identifier[environ] . identifier[get] ( literal[string] ). identifier[split] ( identifier[os] . identifier[pathsep] ) keyword[for] identif...
def _fix_path(): """Finds the google_appengine directory and fixes Python imports to use it.""" import os import sys all_paths = os.environ.get('PYTHONPATH').split(os.pathsep) for path_dir in all_paths: dev_appserver_path = os.path.join(path_dir, 'dev_appserver.py') if os.path.exists...