text
stringlengths
78
104k
score
float64
0
0.18
def parse_elem(element): """Parse a OSM node XML element. Args: element (etree.Element): XML Element to parse Returns: Node: Object representing parsed element """ ident = int(element.get('id')) latitude = element.get('lat') longitude = e...
0.004619
def make_naive(value, timezone): """ Makes an aware datetime.datetime naive in a given time zone. """ value = value.astimezone(timezone) if hasattr(timezone, 'normalize'): # available for pytz time zones value = timezone.normalize(value) return value.replace(tzinfo=None)
0.003215
def predict(self, x): """ Predict values for a single data point or an RDD of points using the model trained. """ if isinstance(x, RDD): return x.map(lambda v: self.predict(v)) x = _convert_to_vector(x) if self.numClasses == 2: margin = se...
0.00141
def compile_graphql_to_gremlin(schema, graphql_string, type_equivalence_hints=None): """Compile the GraphQL input using the schema into a Gremlin query and associated metadata. Args: schema: GraphQL schema object describing the schema of the graph to be queried graphql_string: the GraphQL query...
0.00874
def make_tarball(src_dir): """ Make gzipped tarball from a source directory :param src_dir: source directory :raises TypeError: if src_dir is not str """ if type(src_dir) != str: raise TypeError('src_dir must be str') output_file = src_dir + ".tar.gz" log.msg("Wrapping tarball '...
0.001927
def _create_RSA_private_key(self, bytes): """ Instantiates an RSA key from bytes. Args: bytes (byte string): Bytes of RSA private key. Returns: private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKe...
0.003584
def parse_doc_str(text=None, is_untabbed=True, is_stripped=True, tab=None, split_character="::"): """ Returns a str of the parsed doc for example the following would return 'a:A\nb:B' :: a:A b:B :param text: str of the text to parse, by ...
0.004785
def initialize_baremetal_switch_interfaces(self, interfaces): """Initialize Nexus interfaces and for initial baremetal event. This get/create port channel number, applies channel-group to ethernet interface, and initializes trunking on interface. :param interfaces: Receive a list of in...
0.001464
def get_objects(self, path, marker=None, limit=settings.CLOUD_BROWSER_DEFAULT_LIST_LIMIT): """Get objects. **Pseudo-directory Notes**: Rackspace has two approaches to pseudo- directories within the (really) flat storage object namespace: 1. Dummy directory storage...
0.001403
def enable(self, msgid, scope="package", line=None, ignore_unknown=False): """reenable message of the given id""" self._set_msg_status( msgid, enable=True, scope=scope, line=line, ignore_unknown=ignore_unknown ) self._register_by_id_managed_msg(msgid, line, is_disabled=False)
0.009375
def parse_workflow_call_body_io_map(self, i): """ Required. :param i: :return: """ io_map = OrderedDict() if isinstance(i, wdl_parser.Terminal): raise NotImplementedError elif isinstance(i, wdl_parser.Ast): raise NotImplementedErro...
0.005427
def train(self, train_set, valid_set=None, test_set=None, train_size=None): '''We train over mini-batches and evaluate periodically.''' iteration = 0 while True: if not iteration % self.config.test_frequency and test_set: try: self.test(iteration, ...
0.002034
def iter_all_users(self, number=-1, etag=None, per_page=None): """Iterate over every user in the order they signed up for GitHub. :param int number: (optional), number of users to return. Default: -1, returns all of them :param str etag: (optional), ETag from a previous request to t...
0.00303
def solve_series(self, x0, params, varied_data, varied_idx, internal_x0=None, solver=None, propagate=True, **kwargs): """ Solve system for a set of parameters in which one is varied Parameters ---------- x0 : array_like Guess (subject to ``self.post_proc...
0.001489
def reduce_to_cycles(self): """ Iteratively eliminate leafs to reduce the set of objects to only those that build cycles. Return the reduced graph. If there are no cycles, None is returned. """ if not self._reduced: reduced = copy(self) reduced.obj...
0.002389
def get_all_connected_interfaces(): """! @brief Returns all the connected devices with a CMSIS-DAPv2 interface.""" # find all cmsis-dap devices try: all_devices = usb.core.find(find_all=True, custom_match=HasCmsisDapv2Interface()) except usb.core.NoBackendError: c...
0.004932
def parse_config(self, config_source): """ Parses a landslide configuration file and returns a normalized python dict. """ self.log(u"Config %s" % config_source) try: raw_config = configparser.RawConfigParser() raw_config.read(config_source) ...
0.002859
def _determine_nTrackIterations(self,nTrackIterations): """Determine a good value for nTrackIterations based on the misalignment between stream and orbit; just based on some rough experience for now""" if not nTrackIterations is None: self.nTrackIterations= nTrackIterations retur...
0.014085
def parse_xml(sentence, tab="\t", id=""): """ Returns the given Sentence object as an XML-string (plain bytestring, UTF-8 encoded). The tab delimiter is used as indendation for nested elements. The id can be used as a unique identifier per sentence for chunk id's and anchors. For example: "I...
0.007165
def save(self): """Write changed .pth file back to disk""" if not self.dirty: return data = '\n'.join(map(self.make_relative, self.paths)) if data: log.debug("Saving %s", self.filename) data = ( "import sys; sys.__plen = len(sys.path)\...
0.002139
def set_slats_level(self, slatsLevel=0.0, shutterLevel=None): """ sets the slats and shutter level Args: slatsLevel(float): the new level of the slats. 0.0 = open, 1.0 = closed, shutterLevel(float): the new level of the shutter. 0.0 = open, 1.0 = closed, None = use the current v...
0.00554
def glossary( self, term, definition): """*genarate a MMD glossary* **Key Arguments:** - ``term`` -- the term to add as a glossary item - ``definition`` -- the definition of the glossary term **Return:** - ``glossary`` -- ...
0.005521
def on_connection_open(self, connection): """This method is called by pika once the connection to RabbitMQ has been established. :type connection: pika.TornadoConnection """ LOGGER.debug('Connection opened') connection.add_on_connection_blocked_callback( sel...
0.003546
def trim_data_back_to(monthToKeep): """ This method will remove data from the summary text file and the dictionary file for tests that occurs before the number of months specified by monthToKeep. :param monthToKeep: :return: """ global g_failed_tests_info_dict current_time = time.time()...
0.005769
def profiler(profiles, projectpath,parameters,serviceid,servicename,serviceurl,printdebug=None): """Given input files and parameters, produce metadata for outputfiles. Returns a list of matched profiles (empty if none match), and a program.""" parameters = sanitizeparameters(parameters) matched = [] p...
0.024958
def all_folders( path_name, keyword='', has_date=False, date_fmt=DATE_FMT ) -> list: """ Search all folders with criteria Returned list will be sorted by last modified Args: path_name: full path name keyword: keyword to search has_date: whether has date in file name (def...
0.003683
def _run__http(self, action, replace): """More complex HTTP query.""" query = action['query'] # self._debug = True url = '{type}://{host}{path}'.format(path=query['path'], **action) content = None method = query.get('method', "get").lower() self.debug("{} {} url={...
0.002204
def _try_join_cancelled_thread(thread): """Join a thread, but if the thread doesn't terminate for some time, ignore it instead of waiting infinitely.""" thread.join(10) if thread.is_alive(): logging.warning("Thread %s did not terminate within grace period after cancellation", ...
0.008902
def get_request_data(self, var_name, full_data=False): """ :param var_name: :param full_data: If you want `.to_array()` with this data, ready to be sent. :return: A tuple of `to_array()` dict and the files (:py:func:`InputFile.get_request_files()`). Files can be None, if...
0.007498
def push_chunk(self, x, timestamp=0.0, pushthrough=True): """Push a list of samples into the outlet. samples -- A list of samples, either as a list of lists or a list of multiplexed values. timestamp -- Optionally the capture time of the most recent sample, in ...
0.005102
def delete_file(self, fid): """ Delete file from WeedFS :param string fid: File ID """ url = self.get_file_url(fid) return self.conn.delete_data(url)
0.010101
def type_to_string(t): """Get string representation of memory type""" if t == MemoryElement.TYPE_I2C: return 'I2C' if t == MemoryElement.TYPE_1W: return '1-wire' if t == MemoryElement.TYPE_DRIVER_LED: return 'LED driver' if t == MemoryElement.T...
0.003656
def archive(folder, dry_run=False): "Move an active project to the archive." # error handling on archive_dir already done in main() for f in folder: if not os.path.exists(f): bail('folder does not exist: ' + f) _archive_safe(folder, PROJ_ARCHIVE, dry_run=dry_run)
0.003322
def _eval_kwargs(self): """Evaluates any parameterized methods in the kwargs""" evaled_kwargs = {} for k, v in self.p.kwargs.items(): if util.is_param_method(v): v = v() evaled_kwargs[k] = v return evaled_kwargs
0.007067
def send_contact(chat_id, phone_number, first_name, last_name=None, reply_to_message_id=None, reply_markup=None, disable_notification=False, **kwargs): """ Use this method to send phone contacts. :param chat_id: Unique identifier for the target chat or username of the tar...
0.004566
def scale_0to1(image_in, exclude_outliers_below=False, exclude_outliers_above=False): """Scale the two images to [0, 1] based on min/max from both. Parameters ----------- image_in : ndarray Input image exclude_outliers_{below,above} : float Lower/upper...
0.001043
def _request_new_chunk(self): """ Called to request a new chunk of data to be read from the Crazyflie """ # Figure out the length of the next request new_len = self._bytes_left if new_len > _ReadRequest.MAX_DATA_LENGTH: new_len = _ReadRequest.MAX_DATA_LENGTH ...
0.002649
def add_exac_info(genes, alias_genes, exac_lines): """Add information from the exac genes Currently we only add the pLi score on gene level The exac resource only use HGNC symbol to identify genes so we need our alias mapping. Args: genes(dict): Dictionary with all genes ...
0.007895
def create_from_hdu(cls, hdu, ebins=None): """ Creates an HPX object from a FITS header. hdu : The FITS hdu ebins : Energy bin edges [optional] """ convname = HPX.identify_HPX_convention(hdu.header) conv = HPX_FITS_CONVENTIONS[convname] try: pixel...
0.00431
def add_command(self, handler, name=None): """Add a subcommand `name` which invokes `handler`. """ if name is None: name = docstring_to_subcommand(handler.__doc__) # TODO: Prevent overwriting 'help'? self._commands[name] = handler
0.007067
def mine_urls(urls, params=None, callback=None, **kwargs): """Concurrently retrieve URLs. :param urls: A set of URLs to concurrently retrieve. :type urls: iterable :param params: (optional) The URL parameters to send with each request. :type params: dict :param callback: (o...
0.004098
def _generate_examples(self, archive_paths, objects_getter, bboxes_getter, prefixes=None): """Yields examples.""" trainable_classes = set( self.info.features['objects_trainable']['label'].names) for i, archive_path in enumerate(archive_paths): prefix = prefixes[i] if p...
0.00613
def set_current_canvas(canvas): """ Make a canvas active. Used primarily by the canvas itself. """ # Notify glir canvas.context._do_CURRENT_command = True # Try to be quick if canvasses and canvasses[-1]() is canvas: return # Make this the current cc = [c() for c in canvasses if...
0.004376
def _validate_alias_name(alias_name): """ Check if the alias name is valid. Args: alias_name: The name of the alias to validate. """ if not alias_name: raise CLIError(EMPTY_ALIAS_ERROR) if not re.match('^[a-zA-Z]', alias_name): raise CLIError(INVALID_STARTING_CHAR_ERROR...
0.002915
def _iter_convert_to_object(self, iterable): """Iterable yields tuples of (binsha, mode, name), which will be converted to the respective object representation""" for binsha, mode, name in iterable: path = join_path(self.path, name) try: yield self._map_id...
0.01002
def ParseID3v1(data): """Parse an ID3v1 tag, returning a list of ID3v2.4 frames.""" try: data = data[data.index(b'TAG'):] except ValueError: return None if 128 < len(data) or len(data) < 124: return None # Issue #69 - Previous versions of Mutagen, when encountering # ou...
0.000559
def transformer_tall_train_uniencdec(): """Train CNN/DM with a unidirectional encoder and decoder.""" hparams = transformer_tall() hparams.max_input_seq_length = 750 hparams.max_target_seq_length = 100 hparams.optimizer = "true_adam" hparams.learning_rate_schedule = ("linear_warmup*constant*cosdecay") hpa...
0.024123
def _from_dict(cls, _dict): """Initialize a RuntimeEntity object from a json dictionary.""" args = {} if 'entity' in _dict: args['entity'] = _dict.get('entity') else: raise ValueError( 'Required property \'entity\' not present in RuntimeEntity JSON...
0.004488
def start(self): """Start process.""" logger.debug(str(' '.join(self._cmd_list))) if not self._fired: self._partial_ouput = None self._process.start(self._cmd_list[0], self._cmd_list[1:]) self._timer.start() else: raise CondaProcessWorker(...
0.004773
def to_pickle(graph: BELGraph, file: Union[str, BinaryIO], protocol: int = HIGHEST_PROTOCOL) -> None: """Write this graph to a pickle object with :func:`networkx.write_gpickle`. Note that the pickle module has some incompatibilities between Python 2 and 3. To export a universally importable pickle, choose ...
0.007508
def umi_transform(data): """ transform each read by identifying the barcode and UMI for each read and putting the information in the read name """ fq1 = data["files"][0] umi_dir = os.path.join(dd.get_work_dir(data), "umis") safe_makedir(umi_dir) transform = dd.get_umi_type(data) if ...
0.001747
def read(self, to_read, timeout_ms): """Reads data from this file. in to_read of type int Number of bytes to read. in timeout_ms of type int Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout. return data of type s...
0.007177
def _set_alarm_owner(self, v, load=False): """ Setter method for alarm_owner, mapped from YANG variable /rmon/alarm_entry/alarm_owner (owner-string) If this variable is read-only (config: false) in the source YANG file, then _set_alarm_owner is considered as a private method. Backends looking to pop...
0.005211
def new_event(event): """ Requests a new event be created in the store. http://msdn.microsoft.com/en-us/library/aa564690(v=exchg.140).aspx <m:CreateItem SendMeetingInvitations="SendToAllAndSaveCopy" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="htt...
0.006725
def get_resampled_top_edge(self, angle_var=0.1): """ This methods computes a simplified representation of a fault top edge by removing the points that are not describing a change of direction, provided a certain tolerance angle. :param float angle_var: Number represe...
0.001404
def content(): """Helper method that returns just the content. This method was added so that the text could be reused in the dock_help module. .. versionadded:: 3.2.2 :returns: A message object without brand element. :rtype: safe.messaging.message.Message """ message = m.Message() ...
0.000253
def update(self, new_games): """ new_games is a list of .tfrecord.zz new game records. """ new_games.sort(key=os.path.basename) first_new_game = None for idx, game in enumerate(new_games): timestamp = file_timestamp(game) if timestamp <= self.examples[-1][0]: ...
0.002445
def plot_fit(self): """ Add the fit to the plot. """ self.plt.plot(*self.fit.fit, **self.options['fit'])
0.014706
def _group_filter_values(seg, filter_indices, ms_per_input): """ Takes a list of 1s and 0s and returns a list of tuples of the form: ['y/n', timestamp]. """ ret = [] for filter_value, (_segment, timestamp) in zip(filter_indices, seg.generate_frames_as_segments(ms_per_input)): if filter_v...
0.003956
def _remove_wire_nets(block): """ Remove all wire nodes from the block. """ wire_src_dict = _ProducerList() wire_removal_set = set() # set of all wirevectors to be removed # one pass to build the map of value producers and # all of the nets and wires to be removed for net in block.logic: ...
0.00087
def doesIntersect(self, other): ''' :param: other - Line subclass :return: boolean Returns True iff: ccw(self.A,self.B,other.A) * ccw(self.A,self.B,other.B) <= 0 and ccw(other.A,other.B,self.A) * ccw(other.A,other.B,self.B) <= 0 ''' if s...
0.003781
def onMessageReceived(self, method_frame, properties, body): """ React to received message - deserialize it, add it to users reaction function stored in ``self.react_fn`` and send back result. If `Exception` is thrown during process, it is sent back instead of message. ...
0.001511
def get_locale(self): """ Retrieve the best matching locale using request headers .. note:: Probably one of the thing to enhance quickly. :rtype: str """ best_match = request.accept_languages.best_match(['de', 'fr', 'en', 'la']) if best_match is None: if len...
0.003922
def _add_labels(self, axes, dtype): """Given a 2x2 array of axes, add x and y labels Parameters ---------- axes: numpy.ndarray, 2x2 A numpy array containing the four principal axes of an SIP plot dtype: string Can be either 'rho' or 'r', indicating the ty...
0.001741
def geocode( self, query, query_type='StreetAddress', maximum_responses=25, is_freeform=False, filtering=None, exactly_one=True, timeout=DEFAULT_SENTINEL, ): """ Return a location point by address. ...
0.001082
def _from_json(json_data): """ Creates a Earthquake from json data. :param json_data: The raw json data to parse :type json_data: dict :returns: Earthquake """ try: coordinates = json_data['geometry']['coordinates'] except KeyError: ...
0.003683
def export(self, output_folder): """Export matrices as ``*.npy`` files to an output folder.""" if not os.path.exists(output_folder): os.makedirs(output_folder) self._interact_with_folder(output_folder, 'w')
0.008264
def multiple_choice_field_data(field, **kwargs): """ Return random value for MultipleChoiceField >>> CHOICES = [('YNG', 'Child'), ('MIDDLE', 'Parent') ,('OLD', 'GrandParent')] >>> result = any_form_field(forms.MultipleChoiceField(choices=CHOICES)) >>> type(result) <type 'str'> """ if fi...
0.005935
def set_window_refresh_callback(window, cbfun): """ Sets the refresh callback for the specified window. Wrapper for: GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun); """ window_addr = ctypes.cast(ctypes.pointer(window), ...
0.002257
def par_compute_residuals(i): """Compute components of the residual and stopping thresholds that can be done in parallel. Parameters ---------- i : int Index of group to compute """ # Compute the residuals in parallel, need to check if the residuals # depend on alpha global m...
0.002715
def import_project(controller, project_id, stream, location=None, name=None, keep_compute_id=False): """ Import a project contain in a zip file You need to handle OSerror exceptions :param controller: GNS3 Controller :param project_id: ID of the project to import :param stream: A io.BytesIO of...
0.002505
def calculate_backend(name_from_env, backends=None): """ Calculates which backend to use with the following algorithm: - Try to read the GOLESS_BACKEND environment variable. Usually 'gevent' or 'stackless'. If a value is set but no backend is available or it fails to be created, this func...
0.000599
def _update_yaw_and_pitch(self): """ Updates the camera vectors based on the current yaw and pitch """ front = Vector3([0.0, 0.0, 0.0]) front.x = cos(radians(self.yaw)) * cos(radians(self.pitch)) front.y = sin(radians(self.pitch)) front.z = sin(radians(self.yaw)) ...
0.003738
def get_interfaces(zone, permanent=True): ''' List interfaces bound to a zone .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' firewalld.get_interfaces zone ''' cmd = '--zone={0} --list-interfaces'.format(zone) if permanent: cmd += ' --permanent'...
0.002778
def augment(module_name, base_class): """Call the augment() method for all of the derived classes in the module """ for name, cls in inspect.getmembers(sys.modules[module_name], lambda x : inspect.isclass(x) and issubclass(x, base_class) ): if cls == base_class:...
0.016484
def see_form(self, url): """ Assert the existence of a HTML form that submits to the given URL. """ elements = ElementSelector( world.browser, str('//form[@action="%s"]' % url), filter_displayed=True, ) if not elements: raise AssertionError("Expected form not fou...
0.003077
def read_tree(input, schema): '''Read a tree from a string or file Args: ``input`` (``str``): Either a tree string, a path to a tree file (plain-text or gzipped), or a DendroPy Tree object ``schema`` (``str``): The schema of ``input`` (DendroPy, Newick, NeXML, or Nexus) Returns: *...
0.005666
def download_count_upload(job, master_ip, input_file, output_file, kmer_length, spark_conf, memory, sudo): ''' Runs k-mer counting...
0.003392
def any_contains_any(strings, candidates): """Whether any of the strings contains any of the candidates.""" for string in strings: for c in candidates: if c in string: return True
0.004386
def GetMemZippedMB(self): '''Undocumented.''' counter = c_uint() ret = vmGuestLib.VMGuestLib_GetMemZippedMB(self.handle.value, byref(counter)) if ret != VMGUESTLIB_ERROR_SUCCESS: raise VMGuestLibException(ret) return counter.value
0.014815
def clear_data(self): """Removes the content data. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # cjshaw@mit.edu, Jan 9, 2015 # Removes t...
0.004444
def route(rule=None, blueprint=None, defaults=None, endpoint=None, is_member=False, methods=None, only_if=None, **rule_options): """ Decorator to set default route rules for a view function. The arguments this function accepts are very similar to Flask's :meth:`~flask.Flask.route`, however, th...
0.002213
def media_url(self, with_ssl=False): """ Used to return a base media URL. Depending on whether we're serving media remotely or locally, this either hands the decision off to the backend, or just uses the value in settings.STATIC_URL. args: with_ssl: (bool) If T...
0.004167
def request(self, api_commands, *, timeout=None): """Make a request. Timeout is in seconds.""" if not isinstance(api_commands, list): return self._execute(api_commands, timeout=timeout) command_results = [] for api_command in api_commands: result = self._execute...
0.004706
def create_child_ref(self, transform_path, child_id=None): """ Creates a new child TransformRef with transform_path specified. :param transform_path: :param child_id: :return: TransformRef child """ transform_ref = TransformRef(transform_path, child_id) se...
0.005263
def get_tail(self): """Gets tail :return: Tail of linked list """ node = self.head last_node = self.head while node is not None: last_node = node node = node.next_node return last_node
0.007491
def coerce(self, value): """Coerce a single value according to this parameter's settings. @param value: A L{str}, or L{None}. If L{None} is passed - meaning no value is avalable at all, not even the empty string - and this parameter is optional, L{self.default} will be returned....
0.001727
def get_user(login, hashes=False): ''' Get user account details login : string login name hashes : boolean include NTHASH and LMHASH in verbose output CLI Example: .. code-block:: bash salt '*' pdbedit.get kaylee ''' users = list_users(verbose=True, hashes=has...
0.002674
def hoist_mutation(self, random_state): """Perform the hoist mutation operation on the program. Hoist mutation selects a random subtree from the embedded program to be replaced. A random subtree of that subtree is then selected and this is 'hoisted' into the original subtrees location t...
0.001696
def _get_parent_id_list(self, qualifier_id, hierarchy_id): """Returns list of parent id strings for qualifier_id in hierarchy. Uses memcache if caching is enabled. """ if self._caching_enabled(): key = 'parent_id_list_{0}'.format(str(qualifier_id)) # If configu...
0.004643
def random_array(shape, mean=128., std=20.): """Creates a uniformly distributed random array with the given `mean` and `std`. Args: shape: The desired shape mean: The desired mean (Default value = 128) std: The desired std (Default value = 20) Returns: Random numpy array of given `...
0.005085
def py_lnotab(self): """The encoded lnotab that python uses to compute when lines start. Note ---- See Objects/lnotab_notes.txt in the cpython source for more details. """ reverse_lnotab = reverse_dict(self.lnotab) py_lnotab = [] prev_instr = 0 pr...
0.002073
def window(iterable, size=2): ''' yields wondows of a given size ''' iterable = iter(iterable) d = deque(islice(iterable, size-1), maxlen=size) for _ in map(d.append, iterable): yield tuple(d)
0.00463
def load_map_projection(filename, center=None, center_right=None, radius=None, method='orthographic', registration='native', chirality=None, sphere_radius=None, pre_affine=None, post_affine=None, meta_data=None): ''' load_map_projection(fil...
0.008671
def get_environmental_configuration(self, id_or_uri): """ Returns a description of the environmental configuration (supported feature set, calibrated minimum & maximum power, location & dimensions, ...) of the resource. Args: id_or_uri: Can be either the Unma...
0.005415
def counter(self, key, value, timestamp=None): """Set a counter value If the inner key does not exist is is created :param key: counter to update :type key: str :param value: counter value :type value: float :return: An alignak_stat brok if broks are enabled els...
0.002195
def closing_address(self, block_identifier: BlockSpecification) -> Optional[Address]: """ Returns the address of the closer of the channel. """ return self.token_network.closing_address( participant1=self.participant1, participant2=self.participant2, block_identifier=...
0.007444
def line(self, x1, y1, x2, y2, draw=True): '''Draws a line from (x1,y1) to (x2,y2)''' p = self._path self.newpath() self.moveto(x1,y1) self.lineto(x2,y2) self.endpath(draw=draw) self._path = p return p
0.015094
def lazy_parallelize(func, result, processes=None, partition_size=None): """ Lazily computes an iterable in parallel, and returns them in pool chunks :param func: Function to apply :param result: Data to apply to :param processes: Number of processes to use in parallel :param partition_size: Siz...
0.002141
def get_gpg_home( appname, config_dir=None ): """ Get the GPG keyring directory for a particular application. Return the path. """ assert is_valid_appname(appname) config_dir = get_config_dir( config_dir ) path = os.path.join( config_dir, "gpgkeys", appname ) return path
0.023102