text
stringlengths
78
104k
score
float64
0
0.18
def format_param_list(listed_params, output_name): ''' Utility method for formatting lists of parameters for api consumption Useful for email address lists, etc Args: listed_params (list of values) - the list to format output_name (str) - the p...
0.00846
def handle(client_message, handle_event_entry=None, to_object=None): """ Event handler """ message_type = client_message.get_message_type() if message_type == EVENT_ENTRY and handle_event_entry is not None: key = None if not client_message.read_bool(): key = client_message.read_d...
0.001959
def mount_point_ready(self, path): """! Check if a mount point is ready for file operations @return Returns True if the given path exists, False otherwise @details Calling the Windows command `dir` instead of using the python `os.path.exists`. The latter causes a Python error box to appe...
0.005658
def setbpf(self, bpf): """Set number of bits per float output""" self._bpf = min(bpf, self.BPF) self._rng_n = int((self._bpf + self.RNG_RANGE_BITS - 1) / self.RNG_RANGE_BITS)
0.015152
def map_exp_ids(self, exp): """Maps ids to feature names. Args: exp: list of tuples [(id, weight), (id,weight)] Returns: list of tuples (feature_name, weight) """ names = self.exp_feature_names if self.discretized_feature_names is not None: ...
0.004819
def _execute_command(self, command, *args): """Execute the state transition command.""" try: command(*args) except libvirt.libvirtError as error: raise RuntimeError("Unable to execute command. %s" % error)
0.007905
def remove_ext(fname): """Removes the extension from a filename """ bn = os.path.basename(fname) return os.path.splitext(bn)[0]
0.006993
def golowtran(c1: Dict[str, Any]) -> xarray.Dataset: """directly run Fortran code""" # %% default parameters c1.setdefault('time', None) defp = ('h1', 'h2', 'angle', 'im', 'iseasn', 'ird1', 'range_km', 'zmdl', 'p', 't') for p in defp: c1.setdefault(p, 0) c1.setdefault('wmol', [0]*12) # %% ...
0.003209
def inpaint(self): """ Replace masked-out elements in an array using an iterative image inpainting algorithm. """ import inpaint filled = inpaint.replace_nans(np.ma.filled(self.raster_data, np.NAN).astype(np.float32), 3, 0.01, 2) self.raster_data = np.ma.masked_invalid(filled)
0.012903
def p2s(self, p=None): """Convert from plot to screen coordinates""" if not p: p = [0, 0] s = self.p2c(p) return self.c2s(s)
0.019108
def isconst(cls, val): ''' Whether the value is a string color literal. Checks for a well-formed hexadecimal color value or a named color. Args: val (str) : the value to check Returns: True, if the value is a string color literal ''' return isi...
0.006977
def is_daylight_saving_hour(self, datetime): """Check if a datetime is a daylight saving time.""" if not self.daylight_saving_period: return False return self.daylight_saving_period.isTimeIncluded(datetime.hoy)
0.00813
def labels(self, value): """ Setter for **self.__labels** attribute. :param value: Attribute value. :type value: tuple """ if value is not None: assert type(value) is tuple, "'{0}' attribute: '{1}' type is not 'tuple'!".format("labels", value) ass...
0.007645
def merge_Fm(dfs_data): """Merges Fm-1 and Fm, as defined on page 19 of the paper.""" FG = dfs_data['FG'] m = FG['m'] FGm = FG[m] FGm1 = FG[m-1] if FGm[0]['u'] < FGm1[0]['u']: FGm1[0]['u'] = FGm[0]['u'] if FGm[0]['v'] > FGm1[0]['v']: FGm1[0]['v'] = FGm[0]['v'] if FGm[1...
0.002083
def _logger_stream(self): """Add stream logging handler.""" sh = logging.StreamHandler() sh.set_name('sh') sh.setLevel(logging.INFO) sh.setFormatter(self._logger_formatter) self.log.addHandler(sh)
0.008197
def _deleteTrackers(self, trackers): """ Delete the given signup trackers and their associated signup resources. @param trackers: sequence of L{_SignupTrackers} """ for tracker in trackers: if tracker.store is None: # we're not updating the list of l...
0.001976
def signature_verify(self, message, signature, uid=None, cryptographic_parameters=None): """ Verify a message signature using the specified signing key. Args: message (bytes): The bytes of the signed message. Required. signature (bytes): The byte...
0.001131
def netconf_config_change_changed_by_server_or_user_server_server(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") netconf_config_change = ET.SubElement(config, "netconf-config-change", xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications") chang...
0.006211
def dense_to_one_hot(labels_dense, num_classes): """Convert class labels from scalars to one-hot vectors.""" num_labels = labels_dense.shape[0] index_offset = np.arange(num_labels) * num_classes labels_one_hot = np.zeros((num_labels, num_classes)) labels_one_hot.flat[index_offset...
0.005291
def _area_is_empty(self, screen, write_position): """ Return True when the area below the write position is still empty. (For floats that should not hide content underneath.) """ wp = write_position Transparent = Token.Transparent for y in range(wp.ypos, wp.ypos ...
0.003165
def tree_prune_tax_ids(self, tree, tax_ids): """Prunes a tree back to contain only the tax_ids in the list and their parents. Parameters ---------- tree : `skbio.tree.TreeNode` The root node of the tree to perform this operation on. tax_ids : `list` A `li...
0.005848
def lte(max_value): """ Validates that a field value is less than or equal to the value given to this validator. """ def validate(value): if value > max_value: return e("{} is not less than or equal to {}", value, max_value) return validate
0.003521
def run_command(self, input_file, output_dir=None): """Return the command for running bfconvert as a list. :param input_file: path to microscopy image to be converted :param ouput_dir: directory to write output tiff files to :returns: list """ base_name = os.path...
0.005042
def rect(self, x, y, width, height, color): """ See the Processing function rect(): https://processing.org/reference/rect_.html """ self.context.set_source_rgb(*color) self.context.rectangle(self.tx(x), self.ty(y), self.tx(width), self.ty(height)) self.context.fil...
0.009288
def get_environments(self): """ Returns the environments """ response = self.ebs.describe_environments(application_name=self.app_name, include_deleted=False) return response['DescribeEnvironmentsResponse']['DescribeEnvironmentsResult']['Environments']
0.013746
def expand(expression): """ Expand a reference expression to individual spans. Also works on space-separated ID lists, although a sequence of space characters will be considered a delimiter. >>> expand('a1') 'a1' >>> expand('a1[3:5]') 'a1[3:5]' >>> expand('a1[3:5+6:7]') 'a1[3:5]...
0.001289
def generate_secret(length=30): """ Generate an ASCII secret using random.SysRandom Based on oauthlib's common.generate_token function """ rand = random.SystemRandom() ascii_characters = string.ascii_letters + string.digits return ''.join(rand.choice(ascii_characters) for _ in range(length...
0.003106
def _execute_if_not_empty(func): """ Execute function only if one of input parameters is not empty """ def wrapper(*args, **kwargs): if any(args[1:]) or any(kwargs.items()): return func(*args, **kwargs) return wrapper
0.004016
def watchTextSelection(self, event=None): """ Callback used to see if there is a new text selection. In certain cases we manually add the text to the clipboard (though on most platforms the correct behavior happens automatically). """ # Note that this isn't perfect - it is a key click be...
0.003663
def shape_type(self): """ Unique integer identifying the type of this shape, like ``MSO_SHAPE_TYPE.TEXT_BOX``. """ if self.is_placeholder: return MSO_SHAPE_TYPE.PLACEHOLDER if self._sp.has_custom_geometry: return MSO_SHAPE_TYPE.FREEFORM if ...
0.003578
def replace_blocks(self, blocks): """Replace multiple blocks. blocks must be a list of tuples where each tuple consists of (namespace, offset, key, data, flags)""" start = 0 bulk_insert = self.bulk_insert blocks_len = len(blocks) select = 'SELECT ?,?,?,?,?' query ...
0.002692
def threshold_image(img, bkground_thresh, bkground_value=0.0): """ Thresholds a given image at a value or percentile. Replacement value can be specified too. Parameters ----------- image_in : ndarray Input image bkground_thresh : float a threshold value to identify the ba...
0.001672
def to_dict(self, depth=-1, **kwargs): """Returns a dict representation of the object.""" out = super(Link, self).to_dict(depth=-1, **kwargs) out['url'] = self.url return out
0.009709
def imagedatadict_to_ndarray(imdict): """ Converts the ImageData dictionary, imdict, to an nd image. """ arr = imdict['Data'] im = None if isinstance(arr, parse_dm3.array.array): im = numpy.asarray(arr, dtype=arr.typecode) elif isinstance(arr, parse_dm3.structarray): t = tupl...
0.003456
def make_variant(cls, converters, re_opts=None, compiled=False, strict=True): """ Creates a type converter for a number of type converter alternatives. The first matching type converter is used. REQUIRES: type_converter.pattern attribute :param converters: List of type converte...
0.002447
def _detect_byteorder(ccp4file): """Detect the byteorder of stream `ccp4file` and return format character. Try all endinaness and alignment options until we find something that looks sensible ("MAPS " in the first 4 bytes). (The ``machst`` field could be used to obtain endianness, but ...
0.003311
def _get_stddevs(self, C, mag, stddev_types, sites): """ Return standard deviation as defined on page 29 in equation 8a,b,c and 9. """ num_sites = sites.vs30.size sigma_intra = np.zeros(num_sites) # interevent stddev tau = sigma_intra + C['tau'] ...
0.001957
def age_ratios(): """Helper to get list of age ratio from the options dialog. :returns: List of age ratio. :rtype: list """ # FIXME(IS) set a correct parameter container parameter_container = None youth_ratio = parameter_container.get_parameter_by_guid( ...
0.003035
def indent(text, amount, ch=' '): """Indents a string by the given amount of characters.""" padding = amount * ch return ''.join(padding+line for line in text.splitlines(True))
0.005319
def i2c_slave_last_transmit_size(self): """Returns the number of bytes transmitted by the slave.""" ret = api.py_aa_i2c_slave_write_stats(self.handle) _raise_error_if_negative(ret) return ret
0.008969
async def get(self, key): """Decode the value.""" value = await self.conn.get(key) if self.cfg.jsonpickle: if isinstance(value, bytes): return jsonpickle.decode(value.decode('utf-8')) if isinstance(value, str): return jsonpickle.decode(val...
0.005797
def export(self, name, columns, points): """Write the points to the Cassandra cluster.""" logger.debug("Export {} stats to Cassandra".format(name)) # Remove non number stats and convert all to float (for Boolean) data = {k: float(v) for (k, v) in dict(zip(columns, points)).iteritems() i...
0.006313
def add_unique_template_variables(self, options): """Update map template variables specific to a raster visual""" options.update(dict( tiles_url=self.tiles_url, tiles_size=self.tiles_size, tiles_minzoom=self.tiles_minzoom, tiles_maxzoom=self.tiles_maxzoom,...
0.007444
def update(self, puts, deletes): """Applies the given puts and deletes atomically. Args: puts (:iterable:`tuple`): an iterable of key/value pairs to insert deletes (:iterable:str:) an iterable of keys to delete """ with self._lmdb.begin(write=True, buffers=True) ...
0.001263
def to_dict(self): """ Convert the object into a json serializable dictionary. Note: It uses the private method _save_to_input_dict of the parent. :return dict: json serializable dictionary containing the needed information to instantiate the object """ input_dict = su...
0.009202
def getlanguages(self, event): """Compile and return a human readable list of registered translations""" self.log('Client requests all languages.', lvl=verbose) result = { 'component': 'hfos.ui.clientmanager', 'action': 'getlanguages', 'data': language_token_...
0.007317
def bind(self, queue='', exchange='', routing_key='', virtual_host='/', arguments=None): """Bind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name ...
0.002457
def to_json(self): """ Returns the JSON representation of the webhook. """ result = super(Webhook, self).to_json() result.update({ 'name': self.name, 'url': self.url, 'topics': self.topics, 'httpBasicUsername': self.http_basic_user...
0.003484
def blacklist(self, term=None): """List blacklisted entries. When no term is given, the method will list the entries that exist in the blacklist. If 'term' is set, the method will list only those entries that match with that term. :param term: term to match """ ...
0.003656
def run_without_time_limit(self, cmd): """Runs docker command without time limit. Args: cmd: list with the command line arguments which are passed to docker binary Returns: how long it took to run submission in seconds Raises: WorkerError: if error occurred during execution ...
0.003413
def scoreatpercentile(inlist, percent): """ Returns the score at a given percentile relative to the distribution given by inlist. Usage: lscoreatpercentile(inlist,percent) """ if percent > 1: print("\nDividing percent>1 by 100 in lscoreatpercentile().\n") percent = percent / 100.0 targetc...
0.003205
def _compile_interpretation(data): """ Compile the interpretation data into a list of multiples, based on the keys provided. Disassemble the key to figure out how to place the data :param dict data: Interpretation data (unsorted) :return dict: Interpretation data (sorted) """ # KEY FORMAT : ...
0.002511
def trocar_codigo_de_ativacao(self, novo_codigo_ativacao, opcao=constantes.CODIGO_ATIVACAO_REGULAR, codigo_emergencia=None): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSA...
0.010938
def cyvcf2(context, vcf, include, exclude, chrom, start, end, loglevel, silent, individual, no_inds): """fast vcf parsing with cython + htslib""" coloredlogs.install(log_level=loglevel) start_parsing = datetime.now() log.info("Running cyvcf2 version %s", __version__) if include and exclu...
0.002977
def detect(self, color_im, depth_im, cfg, camera_intr, T_camera_world, vis_foreground=False, vis_segmentation=False, segmask=None): """Detects all relevant objects in an rgbd image pair using foreground masking. Parameters ---------- color_im : :obj:`ColorI...
0.004089
def branch(self, name, desc=None): """ Create a branch of this repo at 'name'. :param name: Name of new branch :param desc: Repo description. :return: New Local instance. """ return Local.new(path=os.path.join(self.path, name), desc=desc, bare=True)
0.009772
def uint8_3(self, name): """parse a tuple of 3 uint8 values""" self._assert_is_string(name) frame = self._next_frame() if len(frame) != 3: raise MessageParserError("Expected exacty 3 byte for 3 unit8 values") vals = unpack("BBB", frame) self.results.__dict__[n...
0.008547
def simxAddStatusbarMessage(clientID, message, operationMode): ''' Please have a look at the function description/documentation in the V-REP user manual ''' if (sys.version_info[0] == 3) and (type(message) is str): message=message.encode('utf-8') return c_AddStatusbarMessage(clientID, messa...
0.008876
def thanks(request, redirect_url=settings.LOGIN_REDIRECT_URL): """A user gets redirected here after hitting Twitter and authorizing your app to use their data. This is the view that stores the tokens you want for querying data. Pay attention to this. """ # Now that we've got the magic tokens back ...
0.003538
def _check_preferences(prefs, pref_type=None): """Check cipher, digest, and compression preference settings. MD5 is not allowed. This is `not 1994`__. SHA1 is allowed_ grudgingly_. __ http://www.cs.colorado.edu/~jrblack/papers/md5e-full.pdf .. _allowed: http://eprint.iacr.org/2008/469.pdf .. _grud...
0.003751
def gettext(message): """ Translate the 'message' string. It uses the current thread to find the translation object to use. If no current translation is activated, the message will be run through the default translation object. """ global _default _default = _default or translation(DEFAULT_L...
0.002193
def get_terminal_size(p_getter=None): """ Try to determine terminal size at run time. If that is not possible, returns the default size of 80x24. By default, the size is determined with provided get_terminal_size by shutil. Sometimes an UI may want to specify the desired width, then it can prov...
0.003844
def delete_host(zone, name, nameserver='127.0.0.1', timeout=5, port=53, **kwargs): ''' Delete the forward and reverse records for a host. Returns true if any records are deleted. CLI Example: .. code-block:: bash salt ns1 ddns.delete_host example.com host1 ''' fqd...
0.000829
def get(self, deviceId): """ lists all known active measurements. """ measurementsByName = self.measurements.get(deviceId) if measurementsByName is None: return [] else: return list(measurementsByName.values())
0.007092
def get_instance(self, payload): """ Build an instance of WorkerStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.work...
0.006803
def config_mode(self, config_command="config term", pattern=""): """ Enter into configuration mode on remote device. Cisco IOS devices abbreviate the prompt at 20 chars in config mode """ if not pattern: pattern = re.escape(self.base_prompt[:16]) return super...
0.004662
def filedir_lookup(self, p, fd=None): """ A helper method for find_file() that looks up a directory for a file we're trying to find. This only creates the Dir Node if it exists on-disk, since if the directory doesn't exist we know we won't find any files in it... :-) I...
0.002266
def new_template(template_name: str, ordering: int, formatting: dict=None, **kwargs): """ Templates have no unique ID. :param template_name: :param ordering: :param formatting: :param kwargs: :return: """ if formatting is not None: kwar...
0.006188
def send_metric(self, name, metric): """Send metric and its snapshot.""" config = SERIALIZER_CONFIG[class_name(metric)] mmap( self._buffered_send_metric, self.serialize_metric( metric, name, config['keys'], ...
0.002743
def rtouches(self, span): """ Returns true if the start of this span touches the right (ending) side of the given span. """ if isinstance(span, list): return [sp for sp in span if self._rtouches(sp)] return self._rtouches(span)
0.010714
def parents(self, id, level=None, featuretype=None, order_by=None, reverse=False, completely_within=False, limit=None): """ Return parents of feature `id`. {_relation_docstring} """ return self._relation( id, join_on='parent', join_to='child', level=le...
0.006536
def add_qtl_to_marker(marker, qtls): """Add the number of QTLs found for a given marker. :arg marker, the marker we are looking for the QTL's. :arg qtls, the list of all QTLs found. """ cnt = 0 for qtl in qtls: if qtl[-1] == marker[0]: cnt = cnt + 1 marker.append(str(c...
0.002924
def create_hooks(use_tfdbg=False, use_dbgprofile=False, dbgprofile_kwargs=None, use_validation_monitor=False, validation_monitor_kwargs=None, use_early_stopping=False, early_stopping_kwargs=None): """Create train and...
0.006632
def report_intermediate_result(metric): """Reports intermediate result to Assessor. metric: serializable object. """ global _intermediate_seq assert _params is not None, 'nni.get_next_parameter() needs to be called before report_intermediate_result' metric = json_tricks.dumps({ 'paramete...
0.003521
def gamma(self, x, y, kwargs, diff=diff): """ computes the shear :return: gamma1, gamma2 """ f_xx, f_xy, f_yx, f_yy = self.hessian(x, y, kwargs, diff=diff) gamma1 = 1./2 * (f_xx - f_yy) gamma2 = f_xy return gamma1, gamma2
0.007018
def Backup(self, duration=0): ''' method to use when a backup tag is encountered in musicXML. Moves back in the bar by <duration> :param duration: :return: ''' total = 0 duration_total = duration * 4 children = self.GetChildrenIndexes() notes = 0 ...
0.003082
def get_location(self): """ Return the absolute location of this widget on the Screen, taking into account the current state of the Frame that is displaying it and any label offsets of the Widget. :returns: A tuple of the form (<X coordinate>, <Y coordinate>). """ origin...
0.008529
def _compress_data(self, data, options): '''Compress data''' compression_algorithm_id = options['compression_algorithm_id'] if compression_algorithm_id not in self.compression_algorithms: raise Exception('Unknown compression algorithm id: %d' % compressio...
0.002797
def plot_script_validate(self, script): """ checks the plottype of the script and plots it accordingly Args: script: script to be plotted """ script.plot_validate([self.matplotlibwidget_1.figure, self.matplotlibwidget_2.figure]) self.matplotlibwidget_1.draw(...
0.008333
def unstack(self, dim=None): """ Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions. New dimensions will be added at the end. Parameters ---------- dim : str or sequence of str, optional Dimension(s) over which to ...
0.00137
def resource(url_prefix_or_resource_cls: Union[str, Type[Resource]], resource_cls: Optional[Type[Resource]] = None, *, member_param: Optional[str] = None, unique_member_param: Optional[str] = None, rules: Optional[Iterable[Union[Route, RouteGenerator]]] =...
0.002223
def register_classes(): """Register these classes with the `LinkFactory` """ CopyBaseROI.register_class() CopyBaseROI_SG.register_class() SimulateROI.register_class() SimulateROI_SG.register_class() RandomDirGen.register_class() RandomDirGen_SG.register_class()
0.00346
def load_pickle(file, encoding=None): """Load a pickle file. Args: file (str): Path to pickle file Returns: object: Loaded object from pickle file """ # TODO: test set encoding='latin1' for 2/3 incompatibility if encoding: with open(file, 'rb') as f: return...
0.004808
def _parse_status(self, output): ''' Unit testing is so much easier when Vagrant is removed from the equation. ''' parsed = self._parse_machine_readable_output(output) statuses = [] # group tuples by target name # assuming tuples are sorted by target name,...
0.002509
def render_cvmfs_sc(cvmfs_volume): """Render REANA_CVMFS_SC_TEMPLATE.""" name = CVMFS_REPOSITORIES[cvmfs_volume] rendered_template = dict(REANA_CVMFS_SC_TEMPLATE) rendered_template['metadata']['name'] = "csi-cvmfs-{}".format(name) rendered_template['parameters']['repository'] = cvmfs_volume retu...
0.002941
def start_order_threading(self): """开启查询子线程(实盘中用) """ self.if_start_orderthreading = True self.order_handler.if_start_orderquery = True self.trade_engine.create_kernel('ORDER', daemon=True) self.trade_engine.start_kernel('ORDER') self.sync_order_and_deal()
0.006369
def find_multiline_pattern(self, regexp, cursor, findflag): """Reimplement QTextDocument's find method Add support for *multiline* regular expressions""" pattern = to_text_string(regexp.pattern()) text = to_text_string(self.toPlainText()) try: regobj = re.comp...
0.001736
def check_and_order_id_inputs(rid, ridx, cid, cidx, row_meta_df, col_meta_df): """ Makes sure that (if entered) id inputs entered are of one type (string id or index) Input: - rid (list or None): if not None, a list of rids - ridx (list or None): if not None, a list of indexes - cid ...
0.002155
def report( vulnerabilities, fileobj, print_sanitised, ): """ Prints issues in color-coded text format. Args: vulnerabilities: list of vulnerabilities to report fileobj: The output file object, which may be sys.stdout """ n_vulnerabilities = len(vulnerabilities) unsa...
0.002577
def _parse_json_with_fieldnames(self): """ Parse the raw JSON with all attributes/methods defined in the class, except for the ones defined starting with '_' or flagged in cls._TO_EXCLUDE. The final result is stored in self.json """ for key in dir(self): if n...
0.004862
def get_next_valid_day(self, timestamp): """Get next valid day for timerange :param timestamp: time we compute from :type timestamp: int :return: timestamp of the next valid day (midnight) in LOCAL time. :rtype: int | None """ if self.get_next_future_timerange_va...
0.003984
def path_to_str(path): """ Convert pathlib.Path objects to str; return other objects as-is. """ try: from pathlib import Path as _Path except ImportError: # Python < 3.4 class _Path: pass if isinstance(path, _Path): return str(path) return path
0.003322
def cmdline(argv, flags): """A cmdopts wrapper that takes a list of flags and builds the corresponding cmdopts rules to match those flags.""" rules = dict([(flag, {'flags': ["--%s" % flag]}) for flag in flags]) return parse(argv, rules)
0.003922
def _construct_deployment(self, rest_api): """Constructs and returns the ApiGateway Deployment. :param model.apigateway.ApiGatewayRestApi rest_api: the RestApi for this Deployment :returns: the Deployment to which this SAM Api corresponds :rtype: model.apigateway.ApiGatewayDeployment ...
0.006329
def add(self, target, args=None, kwargs=None, **options): """Add an Async job to this context. Takes an Async object or the arguments to construct an Async object as arguments. Returns the newly added Async object. """ from furious.async import Async from furious.batche...
0.003472
def addDataToQueue(self, coordinate, reset, sequenceId): """ Add the given data item to the sensor's internal queue. Calls to compute will cause items in the queue to be dequeued in FIFO order. @param coordinate A list containing the N-dimensional integer coordinate space to be en...
0.005025
def write(self, writer=None, encoding='utf-8', indent=0, newline='', omit_declaration=False, node_depth=0, quote_char='"'): """ Serialize this node and its descendants to text, writing the output to a given *writer* or to stdout. :param writer: an object such as a file or st...
0.002491
def _url_base64_encode(msg): """ Base64 encodes a string using the URL-safe characters specified by Amazon. """ msg_base64 = base64.b64encode(msg) msg_base64 = msg_base64.replace('+', '-') msg_base64 = msg_base64.replace('=', '_') msg_base64 = msg_base64.r...
0.005525
def write_area_data(self, file): """ Writes area data to file. """ file.write("%% area data" + "\n") file.write("%\tno.\tprice_ref_bus" + "\n") file.write("areas = [" + "\n") # TODO: Implement areas file.write("\t1\t1;" + "\n") file.write("];" + "\n")
0.006329
def setup(self): "Connect incoming connection to a telnet session" try: self.TERM = self.request.term except: pass self.setterm(self.TERM) self.sock = self.request._sock for k in self.DOACK.keys(): self.sendcommand(self.DOACK[k], k) ...
0.007444