text
stringlengths
78
104k
score
float64
0
0.18
def exists(self, path): """ Use ``hadoop fs -stat`` to check file existence. """ cmd = load_hadoop_cmd() + ['fs', '-stat', path] logger.debug('Running file existence check: %s', subprocess.list2cmdline(cmd)) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subpro...
0.005
def unpack_fraction(num: str) -> str: """ Returns unpacked fraction string 5/2 -> 2 1/2 """ nums = [int(n) for n in num.split('/') if n] if len(nums) == 2 and nums[0] > nums[1]: over = nums[0] // nums[1] rem = nums[0] % nums[1] return f'{over} {rem}/{nums[1]}' return num
0.003135
def from_wire(rdclass, rdtype, wire, current, rdlen, origin = None): """Build an rdata object from wire format This function attempts to dynamically load a class which implements the specified rdata class and type. If there is no class-and-type-specific implementation, the GenericRdata class is us...
0.002817
def terminate(self, signal_chain=KILL_CHAIN, kill_wait=KILL_WAIT_SEC, purge=True): """Ensure a process is terminated by sending a chain of kill signals (SIGTERM, SIGKILL).""" alive = self.is_alive() if alive: logger.debug('terminating {}'.format(self._name)) for signal_type in signal_chain: ...
0.01474
def normalRDD(sc, size, numPartitions=None, seed=None): """ Generates an RDD comprised of i.i.d. samples from the standard normal distribution. To transform the distribution in the generated RDD from standard normal to some other normal N(mean, sigma^2), use C{RandomRDDs...
0.002865
def remove(self, experiment): """Remove the configuration of an experiment""" try: project_path = self.projects[self[experiment]['project']]['root'] except KeyError: return config_path = osp.join(project_path, '.project', experiment + '.yml') for f in [con...
0.00432
def generate(env): """Add Builders and construction variables for masm to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) for suffix in ASSuffixes: static_obj.add_action(suffix, SCons.Defaults.ASAction) shared_obj.add_action(suffix, SCons.Defaults.ASAction) ...
0.00541
def unique_id(self): """Creates a unique ID for the `Atom` based on its parents. Returns ------- unique_id : (str, str, str) (polymer.id, residue.id, atom.id) """ chain = self.parent.parent.id residue = self.parent.id return chain, residue, se...
0.006154
def print_packet_count(): """Print the number of packets grouped by packet name.""" for name in archive.list_packet_names(): packet_count = 0 for group in archive.list_packet_histogram(name): for rec in group.records: packet_count += rec.count print(' {: <40}...
0.002801
def replace_one(self, filter, replacement, upsert=False, bypass_document_validation=False, collation=None, session=None): """Replace a single document matching the filter. >>> for doc in db.test.find({}): ... print(doc) ... {u'...
0.001817
def render_image(self, rgbobj, dst_x, dst_y): """Render the image represented by (rgbobj) at dst_x, dst_y in the pixel space. *** internal method-- do not use *** """ self.logger.debug("redraw surface=%s" % (self.surface)) if self.surface is None: return ...
0.002797
def get_user_modified_lines(self): """ Output: {file_path: [(line_a_start, line_a_end), (line_b_start, line_b_end)]} Lines ranges are sorted and not overlapping """ # I assume that git diff: # - doesn't mix diffs from different files, # - diffs are not overlappin...
0.003652
def byName(cls, name, recurse=True, default=None): """ Returns the addon whose name matches the inputted name. If the optional recurse flag is set to True, then all the base classes will be searched for the given addon as well. If no addon is found, the default is returned. ...
0.003686
def resolve_one(self, correlation_id, key): """ Resolves a single connection parameters by its key. :param correlation_id: (optional) transaction id to trace execution through call chain. :param key: a key to uniquely identify the connection. :return: a resolved connection. ...
0.007394
def find_blocked_biomass_precursors(reaction, model): """ Return a list of all biomass precursors that cannot be produced. Parameters ---------- reaction : cobra.core.reaction.Reaction The biomass reaction of the model under investigation. model : cobra.Model The metabolic model...
0.000847
def _match_operator(self, p, value): """ Returns True or False if the operator (&, |, or ! with filters, or ^ with filters) matches the value dictionary """ if p[0] == '!': return self._OPERATOR_MAP[p[0]](self._match(p[1], value)) elif p[0] == '^': return ...
0.009381
def get_unique_reads(self, ignore_haplotype=False, shallow=False): """ Pull out alignments of uniquely-aligning reads :param ignore_haplotype: whether to regard allelic multiread as uniquely-aligning read :param shallow: whether to copy sparse 3D matrix only or not :return...
0.005629
def getAnalysisServiceSettings(self, uid): """Returns a dictionary with the settings for the analysis service that match with the uid provided. If there are no settings for the analysis service and analysis requests: 1. looks for settings in AR's ARTemplate. If found, returns t...
0.001587
def num_samples(self, sr=None): """ Return the number of samples. Args: sr (int): Calculate the number of samples with the given sampling-rate. If None use the native sampling-rate. Returns: int: Number of samples """ native...
0.003484
def request_access_token(self, access_code): "Request access token from GitHub" token_response = request_session.post( "https://github.com/login/oauth/access_token", data={ "client_id": self.oauth_client_id, "client_secret": self.oauth_client_secre...
0.003992
def items(self, *args, **kwargs): """ Return the list of items within this tag. This function is only applicable in search results from PlexServer :func:`~plexapi.server.PlexServer.search()`. """ if not self.key: raise BadRequest('Key is not defined for this tag: %s' % se...
0.01087
def _check_operations(ctx, need_ops, arg): ''' Checks an allow or a deny caveat. The need_ops parameter specifies whether we require all the operations in the caveat to be declared in the context. ''' ctx_ops = ctx.get(OP_KEY, []) if len(ctx_ops) == 0: if need_ops: f = arg.sp...
0.001585
def get_texture(self, label: str) -> Union[moderngl.Texture, moderngl.TextureArray, moderngl.Texture3D, moderngl.TextureCube]: """ Get a texture by label Args: label (str): The label for the texture to fetch Returns: ...
0.011655
def disable_tracing(self): """ Disable tracing if it is disabled and debugged program is running, else do nothing. :return: False if tracing has been disabled, True else. """ _logger.x_debug("disable_tracing()") #self.dump_tracing_state("before disable_tracing()") ...
0.008065
def quickinfo(self): """ Returns a short string describing some of the options of the actor. :return: the info, None if not available :rtype: str """ return "incremental: " + str(self.config["incremental"]) \ + ", custom: " + str(self.config["use_custom_lo...
0.007299
def get_zone(server, token, domain, keyword='', raw_flag=False): """Retrieve zone records. Argument: server: TonicDNS API server token: TonicDNS API authentication token domain: Specify domain name keyword: Search keyword x-authentication-token: token """ metho...
0.001876
def get_profile(self): """ Get my own profile """ r = self._session.get(API_URL + "/logins/me") r.raise_for_status() return r.json()
0.01105
def fdfilter(data, *filt, **kwargs): """Filter a frequency-domain data object See Also -------- gwpy.frequencyseries.FrequencySeries.filter gwpy.spectrogram.Spectrogram.filter """ # parse keyword args inplace = kwargs.pop('inplace', False) analog = kwargs.pop('analog', False) fs...
0.001062
def init_registry_from_json(mongo, filename, clear_collection=False): """Initialize a model registry with a list of model definitions that are stored in a given file in Json format. Parameters ---------- mongo : scodata.MongoDBFactory Connector for MongoDB filename : string Path...
0.001608
def badge_width(self): """The total width of badge. >>> badge = Badge('pylint', '5', font_name='DejaVu Sans,Verdana,Geneva,sans-serif', ... font_size=11) >>> badge.badge_width 91 """ return self.get_text_width(' ' + ' ' * int(float(self.num_paddin...
0.010309
def create_NT_hashed_password_v1(passwd, user=None, domain=None): "create NT hashed password" # if the passwd provided is already a hash, we just return the second half if re.match(r'^[\w]{32}:[\w]{32}$', passwd): return binascii.unhexlify(passwd.split(':')[1]) digest = hashlib.new('md4', passw...
0.002717
def sra_download_paired_end(credentials, instance_config, instance_name, script_dir, sra_run_acc, output_dir, **kwargs): """Download paired-end reads from SRA and convert to gzip'ed FASTQ files. TODO: docstring""" template = _TEMPLATE_ENV.get_template('sra_download_paired-e...
0.004231
def get_uids(self): """Returns a uids list of the objects this action must be performed against to. If no values for uids param found in the request, returns the uid of the current context """ uids = self.get_uids_from_request() if not uids and api.is_object(self.context)...
0.005155
def value_get(method_name): """ Creates a getter that will call value's method with specified name using the context's key as first argument. @param method_name: the name of a method belonging to the value. @type method_name: str """ def value_get(value, context, **_params): method ...
0.002364
def nl_list_for_each_entry(pos, head, member): """https://github.com/thom311/libnl/blob/libnl3_2_25/include/netlink/list.h#L79. Positional arguments: pos -- class instance holding an nl_list_head instance. head -- nl_list_head class instance. member -- attribute (string). Returns: Generato...
0.001664
def create_user(self, claims): """Return object for a newly created user account.""" email = claims.get('email') username = self.get_username(claims) return self.UserModel.objects.create_user(username, email)
0.008333
def _rest_make_phenotypes(): #phenotype sources neuroner = Path(devconfig.git_local_base, 'neuroNER/resources/bluima/neuroner/hbp_morphology_ontology.obo').as_posix() neuroner1 = Path(devconfig.git_local_base, 'neuroNER/resources/bluima/neuroner/hbp_electrophysiology_ontolog...
0.009853
def _upsample(self, method, limit=None, fill_value=None): """ Parameters ---------- method : string {'backfill', 'bfill', 'pad', 'ffill'} method for upsampling limit : int, default None Maximum size gap to fill when reindexing fill_value : scalar, ...
0.001871
def clean_file_name(filename, unique=True, replace="_", force_nt=False): """ Return a filename version, which has no characters in it which are forbidden. On Windows these are for example <, /, ?, ... The intention of this function is to allow distribution of files to different OSes. :param filena...
0.003617
def get_periodicfeatures( pfpickle, lcbasedir, outdir, fourierorder=5, # these are depth, duration, ingress duration transitparams=(-0.01,0.1,0.1), # these are depth, duration, depth ratio, secphase ebparams=(-0.2,0.3,0.7,0.5), pdiff_threshold=1.0e...
0.00183
def _data(self, copy=False): """ Get all data associated with the container as key value pairs. """ data = {} for key, obj in self.__dict__.items(): if isinstance(obj, (pd.Series, pd.DataFrame, pd.SparseSeries, pd.SparseDataFrame)): if copy: ...
0.006977
def get_account_funds(self, wallet=None, session=None, lightweight=None): """ Get available to bet amount. :param str wallet: Name of the wallet in question :param requests.session session: Requests session object :param bool lightweight: If True will return dict not a resource ...
0.004702
def program_binary_data(cls, session, address, data): """! @brief Helper routine to write a single chunk of data. The session options for chip_erase and trust_crc are used. @param cls @param session The session instance. @param address Start address of the data ...
0.00969
def update_field(self, f, obj): """ update a field :param str f: name of field to be updated. :param obj: value of field to be updated. """ n = self.get_private_name(f) if not hasattr(self, n): raise AttributeError('{0} is not in {1}'.format(n, self.__class__...
0.007576
def find_transition(self, gene: Gene, multiplexes: Tuple[Multiplex, ...]) -> Transition: """ Find and return a transition in the model for the given gene and multiplexes. Raise an AttributeError if there is no multiplex in the graph with the given name. """ multiplexes = tuple(m...
0.013025
def copy(self): """ Copy this object into a new object of the same type. The returned object will not have a parent object. """ copyClass = self.copyClass if copyClass is None: copyClass = self.__class__ copied = copyClass() copied.copyData(sel...
0.005814
def _save_config(self, filename=None): """ Save the given user configuration. """ if filename is None: filename = self._config_filename parent_path = os.path.dirname(filename) if not os.path.isdir(parent_path): os.makedirs(parent_path) with...
0.005025
def sync_media(self, sync_set=None, clean=0, iter_local_paths=0): """ Uploads select media to an Apache accessible directory. """ # Ensure a site is selected. self.genv.SITE = self.genv.SITE or self.genv.default_site r = self.local_renderer clean = int(clean) ...
0.004306
def validate(self, data): """Apply a JSON schema to an object""" try: schema_path = os.path.normpath(SCHEMA_ROOT) location = u'file://%s' % (schema_path) fs_resolver = resolver.LocalRefResolver(location, self.schema) jsonschema.Draft3Validator(self.schema,...
0.005848
def _get_demand_array_construct(self): """ Returns a construct for an array of power demand data. """ bus_no = integer.setResultsName("bus_no") s_rating = real.setResultsName("s_rating") # MVA p_direction = real.setResultsName("p_direction") # p.u. q_direction = real.setR...
0.008894
def modify_mempool(mempool, remove=0, add=0, verbose=False): """ Given a list of txids (mempool), add and remove some items to simulate an out of sync mempool. """ for i in range(remove): popped = mempool.pop() if verbose: print("removed:", popped) for i in range(add): n...
0.006803
def execute(self, processProtocol, command, env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None): """Execute a process on the remote machine using SSH @param processProtocol: the ProcessProtocol instance to connect @param executable: the executable program to run ...
0.00306
def ULE(a: BitVec, b: BitVec) -> Bool: """Create an unsigned less than expression. :param a: :param b: :return: """ return Or(ULT(a, b), a == b)
0.005917
def execute_command_in_message(controller, cliargs, clioptions, message): """ Runs the command in message['command'], which is one of: 'start' / 'stop'. Updates the chef's initial command line args and options with args and options provided in message['args'] and message['options']. """ SUPPORTE...
0.002703
def range_minmax(ranges): """ Returns the span of a collection of ranges where start is the smallest of all starts, and end is the largest of all ends. >>> ranges = [(30, 45), (40, 50), (10, 100)] >>> range_minmax(ranges) (10, 100) """ rmin = min(ranges)[0] rmax = max(ranges, key=la...
0.002793
def must_stop(self): """ Return True if the worker must stop when the current loop is over. """ return bool(self.terminate_gracefuly and self.end_signal_caught or self.num_loops >= self.max_loops or self.end_forced or self.wanted_end_date and datetime.ut...
0.014245
def solvePerfForesight(solution_next,DiscFac,LivPrb,CRRA,Rfree,PermGroFac): ''' Solves a single period consumption-saving problem for a consumer with perfect foresight. Parameters ---------- solution_next : ConsumerSolution The solution to next period's one period problem. DiscFac : flo...
0.013
def emulate_until(self, target: int): """ Tells the CPU to set up a concrete unicorn emulator and use it to execute instructions until target is reached. :param target: Where Unicorn should hand control back to Manticore. Set to 0 for all instructions. """ self._concrete...
0.009368
def get_sql(self, with_default_expression=True): ''' Returns an SQL expression describing the field (e.g. for CREATE TABLE). :param with_default_expression: If True, adds default value to sql. It doesn't affect fields with alias and materialized values. ''' if with_de...
0.002729
def save_history(self, f): """Saves the history of ``NeuralNet`` as a json file. In order to use this feature, the history must only contain JSON encodable Python data structures. Numpy and PyTorch types should not be in the history. Parameters ---------- f : fil...
0.001781
def apmAggregate(self, **criteria): """collect all match history's apm data to report player's calculated MMR""" apms = [m.apm(self) for m in self.matchSubset(**criteria)] if not apms: return 0 # no apm information without match history return sum(apms) / len(apms)
0.016835
def download_object(container_name, object_name, destination_path, profile, overwrite_existing=False, delete_on_failure=True, **libcloud_kwargs): ''' Download an object to the specified destination path. :param container_name: Container name :type container_name: ``str`` :para...
0.002978
def find_worst(rho, pval, m=1, rlim=.10, plim=.35): """Find the N "worst", i.e. insignificant/random and low, correlations Parameters ---------- rho : ndarray, list 1D array with correlation coefficients pval : ndarray, list 1D array with p-values m : int The desired n...
0.000389
def extract_hook_names(ent): """Extract hook names from the given entity""" hnames = [] for hook in ent["hooks"]["enter"] + ent["hooks"]["exit"]: hname = os.path.basename(hook["fpath_orig"]) hname = os.path.splitext(hname)[0] hname = hname.strip() hname = hname.replace("_ent...
0.002049
def dangling(self): """ List of entities that aren't included in a closed path Returns ---------- dangling: (n,) int, index of self.entities """ if len(self.paths) == 0: return np.arange(len(self.entities)) else: included = np.hsta...
0.00432
def _create_raw_data(self): """ Gathers the different sections ids and creates a string as first cookie data. :return: A dictionary like: {'analyses':'all','analysisrequest':'all','worksheets':'all'} """ result = {} for section in self.get_sections():...
0.005155
def validate_user(user, device, token): ''' Send a message to a Pushover user or group. :param user: The user or group name, either will work. :param device: The device for the user. :param token: The PushOver token. ''' res = { ...
0.002421
def get_basic_functional_groups(self, func_groups=None): """ Identify functional groups that cannot be identified by the Ertl method of get_special_carbon and get_heteroatoms, such as benzene rings, methyl groups, and ethyl groups. TODO: Think of other functional groups that are...
0.002178
def get_session(region, profile=None): """Creates a boto3 session with a cache Args: region (str): The region for the session profile (str): The profile for the session Returns: :class:`boto3.session.Session`: A boto3 session with credential caching """ if profi...
0.001166
def encode(input, output_filename): """Encodes the input data with reed-solomon error correction in 223 byte blocks, and outputs each block along with 32 parity bytes to a new file by the given filename. input is a file-like object The outputted image will be in png format, and will be 255 by x pi...
0.00442
def get_success_url(self): """ Returns the url to redirect to after a successful update. if `self.redirect_to_view` is None the current url will be used. Otherwise the get_view_url will be called on the current bundle using `self.redirect_to_view` as the view name. If th...
0.003195
def diff(name_a, name_b=None, **kwargs): ''' Display the difference between a snapshot of a given filesystem and another snapshot of that filesystem from a later time or the current contents of the filesystem. name_a : string name of snapshot name_b : string (optional) name of s...
0.00346
def add_gene_info(self, variant_obj, gene_panels=None): """Add extra information about genes from gene panels Args: variant_obj(dict): A variant from the database gene_panels(list(dict)): List of panels from database """ gene_panels = gene_panels or [] #...
0.002313
def redistribute_duplicates(data): """Given a dictionary of photo sets, will look at lat/lon between sets, if they match, randomly move them around so the google map markeres do not overlap """ coordinate_list=[] # Build a list of coordinates for myset in data['sets']: coordinat...
0.021251
def disconnect(self): """disconnect events""" self.canvas.mpl_disconnect(self._cidmotion) self.canvas.mpl_disconnect(self._ciddraw)
0.012903
def acked_tuple(self, stream_id, complete_latency_ns): """Apply updates to the ack metrics""" self.update_count(self.ACK_COUNT, key=stream_id) self.update_reduced_metric(self.COMPLETE_LATENCY, complete_latency_ns, key=stream_id)
0.008333
def get_asset_composition_design_session(self, proxy): """Gets the session for creating asset compositions. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.repository.AssetCompositionDesignSession) - an ``AssetCompositionDesignSession`` raise: NullArgument - ``p...
0.00346
def cache_affected_objects_review_history(portal): """Fills the review_history_cache dict. The keys are the uids of the objects to be bound to new workflow and the values are their current review_history """ logger.info("Caching review_history ...") query = dict(portal_type=NEW_SENAITE_WORKFLOW_BIND...
0.002928
def from_taxtable(cls, taxtable_fp): """ Generate a node from an open handle to a taxtable, as generated by ``taxit taxtable`` """ r = csv.reader(taxtable_fp) headers = next(r) rows = (collections.OrderedDict(list(zip(headers, i))) for i in r) row = next(...
0.002421
def add(self, *tasks): """ Interfaces the GraphNode `add` method """ nodes = [x.node for x in tasks] self.node.add(*nodes) return self
0.011494
def _sign_of(money): """Determines the amount sign of a money instance Args: money (:class:`endpoints_management.gen.servicecontrol_v1_messages.Money`): the instance to test Return: int: 1, 0 or -1 """ units = money.units nanos = money.nanos if units: if units ...
0.003945
def configure_retrievefor(self, ns, definition): """ Register a relation endpoint. The definition's func should be a retrieve function, which must: - accept kwargs for path data and optional request data - return an item The definition's request_schema will be used to p...
0.004283
def has_types(self, types, all_=True): ''' Check whether the current component list matches all Stim types in the types argument. Args: types (Stim, list): a Stim class or iterable of Stim classes. all_ (bool): if True, all input types must match; if False, at ...
0.003328
def match(self, url): """ Return a list of all active Messages which match the given URL. """ return list({ message for message in self.active() if message.is_global or message.match(url) })
0.007605
def _PromptUserForInput(self, input_text): """Prompts user for an input. Args: input_text (str): text used for prompting the user for input. Returns: str: input read from the user. """ self._output_writer.Write('{0:s}: '.format(input_text)) return self._input_reader.Read()
0.003215
def transfer_command( batch, sync_level, recursive, destination, source, label, preserve_mtime, verify_checksum, encrypt, submission_id, dry_run, delete, deadline, skip_activation_check, notify, perf_cc, perf_p, perf_pp, perf_udt, ): """ ...
0.000796
def accept_publication_license(cursor, publication_id, user_id, document_ids, is_accepted=False): """Accept or deny the document license for the publication (``publication_id``) and user (at ``user_id``) for the documents (listed by id as ``document_ids``). """ cursor...
0.00165
def fan_speed(self, speed: int = None) -> bool: """Adjust Fan Speed by Specifying 1,2,3 as argument or cycle through speeds increasing by one""" body = helpers.req_body(self.manager, 'devicestatus') body['uuid'] = self.uuid head = helpers.req_headers(self.manager) if ...
0.001712
def verify(token, key, algorithms, verify=True): """Verifies a JWS string's signature. Args: token (str): A signed JWS to be verified. key (str or dict): A key to attempt to verify the payload with. Can be individual JWK or JWK set. algorithms (str or list): Valid algorithms...
0.0044
def delete(self, database, key, callback=None): """ Delete an item from the given database. :param database: The database from which to delete the value. :type database: .BlobDatabaseID :param key: The key to delete. :type key: uuid.UUID :param callback: A callba...
0.006211
def create_new_space(self, space_definition, callback=None): """ Creates a new Space. The incoming Space does not include an id, but must include a Key and Name, and should include a Description. :param space_definition (dict): The dictionary describing the new space. Must include keys ...
0.006522
def get_pages(self, url, page=1, page_size=100, yield_pages=False, **filters): """ Get all pages at url, yielding individual results :param url: the url to fetch :param page: start from this page :param page_size: results per page :param yield_pages: yield whole pages rat...
0.002205
def load_config(filename=None, text=None, test=False, commit=True, debug=False, replace=False, commit_in=None, commit_at=None, revert_in=None, revert_at=None, c...
0.00223
def set_default_option(cls, key, value): """Class method. Set the default value of the option `key` (string) to `value` for all future instances of the class. Note that this does not affect existing instances or the instance called from.""" cls._default_options.update(cls._optio...
0.005831
def _validate_checksum(self, buffer): """Validate the buffer response against the checksum. When reading the serial interface, data will come back in a raw format with an included checksum process. :returns: bool """ self._log.debug("Validating the buffer") if l...
0.002334
def _example_rt_data(quote_ctx): """ 获取分时数据,输出 时间,数据状态,开盘多少分钟,目前价,昨收价,平均价,成交量,成交额 """ stock_code_list = ["US.AAPL", "HK.00700"] ret_status, ret_data = quote_ctx.subscribe(stock_code_list, ft.SubType.RT_DATA) if ret_status != ft.RET_OK: print(ret_data) exit() for stk_code in...
0.003454
def _call_zincrby(self, command, value, *args, **kwargs): """ This command update a score of a given value. But it can be a new value of the sorted set, so we index it. """ if self.indexable: self.index([value]) return self._traverse_command(command, value, *a...
0.005988
def Ergun(dp, voidage, vs, rho, mu, L=1): r'''Calculates pressure drop across a packed bed of spheres using a correlation developed in [1]_, as shown in [2]_ and [3]_. Eighteenth most accurate correlation overall in the review of [2]_. Most often presented in the following form: .. math:: ...
0.000994
def _calc_T_var(self,X) -> int: """Calculate the number of samples, T, from the shape of X""" shape = X.shape tensor_rank: int = len(shape) if tensor_rank == 0: return 1 if tensor_rank == 1: return shape[0] if tensor_rank == 2: if shape...
0.008989
def bio_write(self, buf): """ If the Connection was created with a memory BIO, this method can be used to add bytes to the read end of that memory BIO. The Connection can then read the bytes (for example, in response to a call to :meth:`recv`). :param buf: The string to...
0.002786