text
stringlengths
78
104k
score
float64
0
0.18
def model_to_json(self, object, cleanup=True): """Take a model instance and return it as a json struct""" model_name = type(object).__name__ if model_name not in self.swagger_dict['definitions']: raise ValidationError("Swagger spec has no definition for model %s" % model_name) ...
0.005319
def body_as_json(self, encoding='UTF-8'): """ The body of the event loaded as a JSON object is the data is compatible. :param encoding: The encoding to use for decoding message data. Default is 'UTF-8' :rtype: dict """ data_str = self.body_as_str(encoding=encodi...
0.008065
def mirror_file(self, path_to, path_from, from_quick_server=True): """Mirrors a file to a different location. Each time the file changes while the process is running it will be copied to 'path_to', overwriting the destination. Parameters ---------- path_to : string...
0.001657
def set_device_name(self, new_name): """Sets a new BLE device name for this SK8. Args: new_name (str): the new device name as an ASCII string, max 20 characters. Returns: True if the name was updated successfully, False otherwise. """ device_name = self...
0.008028
def mass_fraction_within_radius(self, kwargs_lens, center_x, center_y, theta_E, numPix=100): """ computes the mean convergence of all the different lens model components within a spherical aperture :param kwargs_lens: lens model keyword argument list :param center_x: center of the apert...
0.006048
def verify(xml, stream): """ Verify the signaure of an XML document with the given certificate. Returns `True` if the document is signed with a valid signature. Returns `False` if the document is not signed or if the signature is invalid. :param lxml.etree._Element xml: The document to sign ...
0.001292
def help_content(self): """Return the content of help for this step wizard. We only needs to re-implement this method in each wizard step. :returns: A message object contains help. :rtype: m.Message """ help_message = m.Message() help_message.add(m.Text(tr('...
0.005115
def get_log_entries_by_ids(self, log_entry_ids): """Gets a ``LogEntryList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the entries specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`...
0.001968
def list_pools(self): """Fetches a list of all floating IP pools. :returns: List of FloatingIpPool objects """ search_opts = {'router:external': True} return [FloatingIpPool(pool) for pool in self.client.list_networks(**search_opts).get('networks')]
0.006536
def node_sub(self, node_self, node_other): '''node_sub High-level api: Compute the delta of two config nodes. This method is recursive. Assume two config nodes are different. Parameters ---------- node_self : `Element` A config node in the destination confi...
0.000733
def map_to_precursors_on_fly(seqs, names, loci, args): """map sequences to precursors with franpr algorithm to avoid writting on disk""" precursor = precursor_sequence(loci, args.ref).upper() dat = dict() for s, n in itertools.izip(seqs, names): res = pyMatch.Match(precursor, str(s), 1, 3) ...
0.004274
def request_control(self, device_id, access_mode=True): """ Request exclusive control of device :param device_id: id of device :type device_id: int :param access_mode: True=exclusive, False=shared :type access_mode: bool :returns: true if successful :rtyp...
0.003731
def replace_all_caps(x:Collection[str]) -> Collection[str]: "Replace tokens in ALL CAPS in `x` by their lower version and add `TK_UP` before." res = [] for t in x: if t.isupper() and len(t) > 1: res.append(TK_UP); res.append(t.lower()) else: res.append(t) return res
0.020134
def Define(self, name, value = None, comment = None): """ Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. ...
0.010067
def _get_upload_input_manager_cls(self, transfer_future): """Retrieves a class for managing input for an upload based on file type :type transfer_future: s3transfer.futures.TransferFuture :param transfer_future: The transfer future for the request :rtype: class of UploadInputManager ...
0.003119
def fix_variable(self, v, value): """Fix the value of a variable and remove it from the constraint. Args: v (variable): Variable in the constraint to be set to a constant value. val (int): Value assigned to the variable. Values must match the :cl...
0.004217
def get_switchable_as_dense(network, component, attr, snapshots=None, inds=None): """ Return a Dataframe for a time-varying component attribute with values for all non-time-varying components filled in with the default values for the attribute. Parameters ---------- network : pypsa.Network ...
0.002789
def sql( state, host, sql, database=None, # Details for speaking to MySQL via `mysql` CLI mysql_user=None, mysql_password=None, mysql_host=None, mysql_port=None, ): ''' Execute arbitrary SQL against MySQL. + sql: SQL command(s) to execute + database: optional database to open the co...
0.001712
def load_with_cache(file_, recache=False, sampling=1, columns=None, temp_dir='.', data_type='int16'): """@brief This function loads a file from the current directory and saves the cached file to later executions. It's also possible to make a recache or a subsampling of the signal and cho...
0.003785
def get_schema_input_version(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_schema = ET.Element("get_schema") config = get_schema input = ET.SubElement(get_schema, "input") version = ET.SubElement(input, "version") version.te...
0.004577
def save(self, vs, filetype): 'Copy rows to the system clipboard.' # use NTF to generate filename and delete file on context exit with tempfile.NamedTemporaryFile(suffix='.'+filetype) as temp: saveSheets(temp.name, vs) sync(1) p = subprocess.Popen( ...
0.003899
def render(self, rows): """ Join the HTML rows. """ if not rows: return '' li_tags = mark_safe(u"\n".join(format_html(u'<li>{0}</li>', force_text(row)) for row in rows)) if self.title: return format_html(u'<div class="toolbar-title">{0}</div>\n<ul...
0.009281
def project(self, projection): ''' Return coordinates transformed to a given projection Projection should be a basemap or pyproj projection object or similar ''' x, y = projection(self.lon.decimal_degree, self.lat.decimal_degree) return (x, y)
0.006873
def _apply_gradients(self, grads, x, optim_state): """Refer to parent class documentation.""" new_x = [None] * len(x) new_optim_state = { "t": optim_state["t"] + 1., "m": [None] * len(x), "u": [None] * len(x) } t = new_optim_state["t"] for i in xrange(len(x)): g = g...
0.010689
def _initialize_system_sync(self): """Initialize the device adapter by removing all active connections and resetting scan and advertising to have a clean starting state.""" connected_devices = self.bable.list_connected_devices() for device in connected_devices: self.disconnec...
0.007042
def setup_user_mapping(pid, uid=os.getuid(), gid=os.getgid()): """Write uid_map and gid_map in /proc to create a user mapping that maps our user from outside the container to the same user inside the container (and no other users are mapped). @see: http://man7.org/linux/man-pages/man7/user_namespaces.7....
0.005307
def create(self, name, *args, **kwargs): """ Create an instance of this resource type. """ resource_name = self._resource_name(name) log.info( "Creating {} '{}'...".format(self._model_name, resource_name)) resource = self.collection.create(*args, name=resource...
0.005063
def update(self, data, default=False): """Update this :attr:`Config` with ``data``. :param data: must be a ``Mapping`` like object exposing the ``item`` method for iterating through key-value pairs. :param default: if ``True`` the updated :attr:`settings` will also set t...
0.003578
def download_image(self, image_type, image): """ Read file of a project and download it :param image_type: Image type :param image: The path of the image :returns: A file stream """ url = self._getUrl("/{}/images/{}".format(image_type, image)) response =...
0.007519
def get_jpp_env(jpp_dir): """Return the environment dict of a loaded Jpp env. The returned env can be passed to `subprocess.Popen("J...", env=env)` to execute Jpp commands. """ env = { v[0]: ''.join(v[1:]) for v in [ l.split('=') for l in os.popen( "sour...
0.004545
def get_piles(allgenes): """ Before running uniq, we need to compute all the piles. The piles are a set of redundant features we want to get rid of. Input are a list of GffLines features. Output are list of list of features distinct "piles". """ from jcvi.utils.range import Range, range_piles ...
0.005952
def spawn(self, owner, *args, **kwargs): """Spawns a new subordinate actor of `owner` and stores it in this container. jobs = Container() ... jobs.spawn(self, Job) jobs.spawn(self, Job, some_param=123) jobs = Container(Job) ... jobs.spawn(self) j...
0.003963
def ring_is_clockwise(ring): """ Determine if polygon ring coordinates are clockwise. Clockwise signifies outer ring, counter-clockwise an inner ring or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order this c...
0.005348
def isAudio(self): """ Is this stream labelled as an audio stream? """ val=False if self.__dict__['codec_type']: if str(self.__dict__['codec_type']) == 'audio': val=True return val
0.015625
def _init_count_terms(self, annots): ''' Fills in the counts and overall aspect counts. ''' gonotindag = set() gocnts = self.gocnts go2obj = self.go2obj # Fill gocnts with GO IDs in annotations and their corresponding counts for terms in annots.values(...
0.004094
def offload_service_containers(self, service): """ :param service: :return: """ def anonymous(anonymous_service): if not isinstance(anonymous_service, Service): raise TypeError("service must be an instance of Service.") if anonymous_servic...
0.006221
def get_osds(service, device_class=None): """Return a list of all Ceph Object Storage Daemons currently in the cluster (optionally filtered by storage device class). :param device_class: Class of storage device for OSD's :type device_class: str """ luminous_or_later = cmp_pkgrevno('ceph-common'...
0.001235
def expand_dims(self, dim=None, axis=None, **dim_kwargs): """Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape. If dim is already a scalar coordinate, it will be promoted to a 1D coordinate consisting of a single value. ...
0.000644
def from_json_dict(cls, json_dict # type: Dict[str, Any] ): # type: (...) -> StringSpec """ Make a StringSpec object from a dictionary containing its properties. :param dict json_dict: This dictionary must contain an ...
0.002867
def x11(self, data: ['SASdata', str] = None, arima: str = None, by: [str, list] = None, id: [str, list] = None, macurves: str = None, monthly: str = None, output: [str, bool, 'SASdata'] = None, pdweights: str = None, quarter...
0.00985
def weighted_choice(self, probabilities, key): """Makes a weighted choice between several options. Probabilities is a list of 2-tuples, (probability, option). The probabilties don't need to add up to anything, they are automatically scaled.""" try: choice = self.val...
0.002169
def _get_envelopes_min_maxes(envelopes): """ Returns the extrema of the inputted polygonal envelopes. Used for setting chart extent where appropriate. Note tha the ``Quadtree.bounds`` object property serves a similar role. Parameters ---------- envelopes : GeoSeries The envelopes of the...
0.01008
def works(self, member_id): """ This method retrieve a iterable of Works of the given member. args: Member ID (Integer) return: Works() """ context = '%s/%s' % (self.ENDPOINT, str(member_id)) return Works(context=context)
0.007168
def GetRosettaResidueMap(self, ConvertMSEToAtom = False, RemoveIncompleteFinalResidues = False, RemoveIncompleteResidues = False): '''Note: This function ignores any DNA.''' raise Exception('This code looks to be deprecated. Use construct_pdb_to_rosetta_residue_map instead.') chain = None ...
0.00564
def choose_template(self, template): '''Choose a template Args: template: String, choose which template you would like. Returns: None Raises: None ''' n1 = int(template)/10 n2 = int(template)%10 self.send('^TS'+...
0.011765
def rlcomplete(self, text, state): """Return the state-th possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. Parameters ---------- text : string Text to pe...
0.002798
def run(self, cmd, sudo=False, ignore_error=False, success_status=(0,), error_callback=None, custom_log=None, retry=0): """Run a command on the remote host. The command is run on the remote host, if there is a redirected host then the command will be run on that redirected host. See...
0.001944
def can_vote(self, request): """ Determnines whether or not the current user can vote. Returns a bool as well as a string indicating the current vote status, with vote status being one of: 'closed', 'disabled', 'auth_required', 'can_vote', 'voted' """ modelbase_obj = sel...
0.007729
def dihedral(x, dih): """ Perform any of 8 permutations of 90-degrees rotations or flips for image x. """ x = np.rot90(x, dih%4) return x if dih<4 else np.fliplr(x)
0.022727
def reload_accelerators(self, *args): """Reassign an accel_group to guake main window and guake context menu and calls the load_accelerators method. """ if self.accel_group: self.guake.window.remove_accel_group(self.accel_group) self.accel_group = Gtk.AccelGroup() ...
0.00489
def raw_shell(s): 'Not a member of ShellQuoted so we get a useful error for raw strings' if isinstance(s, ShellQuoted): return s.do_not_use_raw_str raise RuntimeError('{0} should have been ShellQuoted'.format(s))
0.00431
def get_infobox(ptree, boxterm="box"): """ Returns parse tree template with title containing <boxterm> as dict: <box> = {<name>: <value>, ...} If simple transform fails, attempts more general assembly: <box> = {'boxes': [{<title>: <parts>}, ...], 'count': <len(boxes)>} ...
0.001333
def GetFunctionText(heading, name): """Returns the needed text to automatically document a function in RSF/sphinx""" und = '-'*len(heading) return r''' %s %s .. autofunction:: %s ''' % (heading, und, name)
0.012931
def to_basestring(value): """Converts a string argument to a subclass of basestring. In python2, byte and unicode strings are mostly interchangeable, so functions that deal with a user-supplied argument in combination with ascii string constants can use either and should return the type the user su...
0.001435
def bestseqs(self,thresh=None): """ m.bestseqs(,thresh=None) -- Return all k-mers that match motif with a score >= thresh """ if not thresh: if self._bestseqs: return self._bestseqs if not thresh: thresh = 0.8 * self.maxscore self._bestseqs = ...
0.016173
def fetch(self): """ Fetch a StepContextInstance :returns: Fetched StepContextInstance :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextInstance """ params = values.of({}) payload = self._version.fetch( 'GET', se...
0.004847
def create_job_template(self, template): """ Creates a job template """ endpoint = self._build_url('jobTemplates') data = self._query_api('POST', endpoint, None, {'Content-Type': 'applica...
0.004808
def status_mercurial(path, ignore_set, options): """Run hg status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since hg does not support them. """ lines = run(['hg', '--config', 'extensions.color=!', 'st'], cwd=path) subrepo...
0.005013
def public_dsn(dsn): '''Transform a standard Sentry DSN into a public one''' m = RE_DSN.match(dsn) if not m: log.error('Unable to parse Sentry DSN') public = '{scheme}://{client_id}@{domain}/{site_id}'.format( **m.groupdict()) return public
0.003623
def __create_index(self, keys, index_options): """Internal create index helper. :Parameters: - `keys`: a list of tuples [(key, type), (key, type), ...] - `index_options`: a dict of index options. """ index_doc = helpers._index_document(keys) index = {"key": i...
0.00122
def apply_settings(self): """Apply settings changed in 'Preferences' dialog box""" qapp = QApplication.instance() # Set 'gtk+' as the default theme in Gtk-based desktops # Fixes Issue 2036 if is_gtk_desktop() and ('GTK+' in QStyleFactory.keys()): try: ...
0.003858
def generate_bio_assembly(data_api, struct_inflator): """Generate the bioassembly data. :param data_api the interface to the decoded data :param struct_inflator the interface to put the data into the client object""" bioassembly_count = 0 for bioassembly in data_api.bio_assembly: bioassembly...
0.003289
def language(cls): """ Return language of the comic as a human-readable language name instead of a 2-character ISO639-1 code. """ lang = 'Unknown (%s)' % cls.lang if pycountry is None: if cls.lang in languages.Languages: lang = languages.Langua...
0.010853
def send_cf_response(event, context, response_status, reason=None, response_data=None, physical_resource_id=None): """Responds to Cloudformation after a create/update/delete operation.""" response_data = response_data or {} reason = reason or "See the details in CloudWatch Log Stream: "...
0.000743
def list_virtual_networks(call=None, kwargs=None): ''' List virtual networks. ''' if kwargs is None: kwargs = {} if call == 'action': raise SaltCloudSystemExit( 'The avail_sizes function must be called with ' '-f or --function' ) netconn = get_co...
0.001105
def binary_to_float(binary_list, lower_bound, upper_bound): """Return a floating point number between lower and upper bounds, from binary. Args: binary_list: list<int>; List of 0s and 1s. The number of bits in this list determine the number of possible values between lower and u...
0.002
def _add_additional_properties(position, properties_dict): """ Sets AdditionalProperties of the ProbModelXML. """ add_prop = etree.SubElement(position, 'AdditionalProperties') for key, value in properties_dict.items(): etree.SubElement(add_prop, 'Property', attrib={'n...
0.008646
def _has_fr_route(self): """Encapsulating the rules for whether the request was to a Flask endpoint""" # 404's, 405's, which might not have a url_rule if self._should_use_fr_error_handler(): return True # for all other errors, just check if FR dispatched the route if ...
0.007026
def value(self, item): # type: (Any) -> Any """ Return value stored in weakref. :param item: Object from which get the value. :return: Value stored in the weakref, otherwise original value. :raise TreeDeletedException: when weakref is already deleted. """ ...
0.006186
def delete(ctx, schema, uuid, object_filter, yes): """Delete stored objects (CAUTION!)""" database = ctx.obj['db'] if schema is None: log('No schema given. Read the help', lvl=warn) return model = database.objectmodels[schema] if uuid: count = model.count({'uuid': uuid}) ...
0.002283
def entries(self): """ reading box configuration entries for all boxes managed by Synergy Supervisor """ list_of_rows = [] try: list_of_rows = self.bc_dao.get_all() except LookupError as e: self.logger.error('MX Exception {0}'.format(e), exc_info=True) ret...
0.008929
def __createHTMNetwork(self, sensorParams, spEnable, spParams, tmEnable, tmParams, clEnable, clParams, anomalyParams): """ Create a CLA network and return it. description: HTMPredictionModel description dictionary (TODO: define schema) Returns: NetworkInfo instance; """ ...
0.011405
def __get_aws_metric(table_name, lookback_window_start, lookback_period, metric_name): """ Returns a metric list from the AWS CloudWatch service, may return None if no metric exists :type table_name: str :param table_name: Name of the DynamoDB table :type lookback_window_start...
0.000657
def _update_project(self, project): '''update one project''' if project['name'] not in self.projects: self.projects[project['name']] = Project(self, project) else: self.projects[project['name']].update(project) project = self.projects[project['name']] if...
0.002759
def get_commands(self): """ Returns commands available to execute :return: list of (name, doc) tuples """ commands = [] for name, value in inspect.getmembers(self): if not inspect.isgeneratorfunction(value): continue if name.startsw...
0.004202
def claimInterface(self, interface): """ Claim (= get exclusive access to) given interface number. Required to receive/send data. Can be used as a context manager: with handle.claimInterface(0): # do stuff # handle.releaseInterface(0) gets automat...
0.003992
def grid_destroy_from_name(job_name): """Destroy all the jobs with a given name. Args: job_name (str): the job name """ jobs = grid_reload_from_name(job_name) for job in jobs: job.delete() logger.info("Killing the job (%s, %s)" % (job.site, job.uid))
0.003401
def _get_videoname(cls, videofile): """parse the `videofile` and return it's basename """ name = os.path.basename(videofile) name = os.path.splitext(name)[0] return name
0.009569
def release(self): """ Release the lock. Removes the PID file to release the lock, or raises an error if the current process does not hold the lock. """ if not self.is_locked(): raise NotLocked("%s is not locked" % self.path) if not self.i_am_loc...
0.004535
def shl(computation: BaseComputation) -> None: """ Bitwise left shift """ shift_length, value = computation.stack_pop(num_items=2, type_hint=constants.UINT256) if shift_length >= 256: result = 0 else: result = (value << shift_length) & constants.UINT_256_MAX computation.sta...
0.00597
def is_valid(self): """Returns True if this form and all subforms (if any) are valid. If all standard form-validation tests pass, uses :class:`~eulxml.xmlmap.XmlObject` validation methods to check for schema-validity (if a schema is associated) and reporting errors. Additonal notes: ...
0.006689
def crossMatchTo(self, reference, radius=1*u.arcsec, visualize=False): ''' Cross-match this catalog onto another reference catalog. If proper motions are included in the reference, then its coordinates will be propagated to the obstime/epoch of this current catalog. Para...
0.002273
def format_choices(self): """Return the choices in string form.""" ce = enumerate(self.choices) f = lambda i, c: '%s (%d)' % (c, i+1) # apply formatter and append help token toks = [f(i,c) for i, c in ce] + ['Help (?)'] return ' '.join(toks)
0.013841
def expectation(self, operator: Union[PauliTerm, PauliSum]): """ Compute the expectation of an operator. :param operator: The operator :return: The operator's expectation value """ if not isinstance(operator, PauliSum): operator = PauliSum([operator]) ...
0.007299
def create_results_dirs(base_path): """Create base path dir and subdirectories Parameters ---------- base_path : str The base path has subdirectories for raw and processed results """ if not os.path.exists(base_path): print("Creating directory {} for results data.".format(base_...
0.00125
def controversial(self, limit=None): """GETs controversial links from this subreddit. Calls :meth:`narwal.Reddit.controversial`. :param limit: max number of links to return """ return self._reddit.controversial(self.display_name, limit=limit)
0.014085
def put_metric_alarm(AlarmName=None, AlarmDescription=None, ActionsEnabled=None, OKActions=None, AlarmActions=None, InsufficientDataActions=None, MetricName=None, Namespace=None, Statistic=None, ExtendedStatistic=None, Dimensions=None, Period=None, Unit=None, EvaluationPeriods=None, Threshold=None, ComparisonOperator=N...
0.006917
def send_to_default_exchange(self, sess_id, message=None): """ Send messages through RabbitMQ's default exchange, which will be delivered through routing_key (sess_id). This method only used for un-authenticated users, i.e. login process. Args: sess_id string: Sessi...
0.004724
def dug(obj, key, value): """ Inverse of dig: recursively set a value in a dictionary, using dot notation. >>> test = {"a":{"b":{"c":1}}} >>> dug(test, "a.b.c", 10) >>> test {'a': {'b': {'c': 10}}} """ array = key.split(".") return _dug(obj, value, *array)
0.003367
def _process_facet_terms(facet_terms): """ We have a list of terms with which we return facets """ elastic_facets = {} for facet in facet_terms: facet_term = {"field": facet} if facet_terms[facet]: for facet_option in facet_terms[facet]: facet_term[facet_option] =...
0.002188
def get_session_list(self, account): """ 获取客服的会话列表 详情请参考 http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html :param account: 完整客服账号 :return: 客服的会话列表 """ res = self._get( 'https://api.weixin.qq.com/customservice/kfsession/getse...
0.004348
def get_smart_contract_event_by_height(self, height: int, is_full: bool = False) -> List[dict]: """ This interface is used to get the corresponding smart contract event based on the height of block. :param height: a decimal height value. :param is_full: :return: the information ...
0.007123
def equals(self,junc): """test equality with another junction""" if self.left.equals(junc.left): return False if self.right.equals(junc.right): return False return True
0.021739
def spec_update_loaderplugin_registry(spec, default=None): """ Resolve a BasePluginLoaderRegistry instance from spec, and update spec[CALMJS_LOADERPLUGIN_REGISTRY] with that value before returning it. """ registry = spec.get(CALMJS_LOADERPLUGIN_REGISTRY) if isinstance(registry, BaseLoaderPl...
0.000542
def write(self, data): """ Send *n* bytes to socket. Args: data(bytes): The data to send. Raises: EOFError: If the socket was closed. """ while data: try: n = self._socket.send(data) except socket.error: ...
0.004535
def validate_data(file_type, bs_data): """ Validates json basis set data against a schema Parameters ---------- file_type : str Type of file to read. May be 'component', 'element', 'table', or 'references' bs_data: Data to be validated Raises ------ RuntimeError ...
0.002581
def join(self, other): """ Returns the smallest possible range spanning both this range and other. Raises :exc:`ValueError` if the ranges do not belong to the same :class:`Buffer`. """ if self.source_buffer != other.source_buffer: raise ValueError if s...
0.00303
def add_tokens_for_pass(self): """Add tokens for a pass to result""" # Make sure pass not added to group again self.groups.empty = False # Remove existing newline/indentation while self.result[-1][0] in (INDENT, NEWLINE): self.result.pop() # Add pass and ind...
0.016097
def to_ulcer_performance_index(prices, rf=0., nperiods=None): """ Converts from prices -> `ulcer performance index <https://www.investopedia.com/terms/u/ulcerindex.asp>`_. See https://en.wikipedia.org/wiki/Ulcer_index Args: * prices (Series, DataFrame): Prices * rf (float, Series): `Ri...
0.004723
def approximate_split(x, num_splits, axis=0): """Split approximately equally into num_splits parts. Args: x: a Tensor num_splits: an integer axis: an integer. Returns: a list of num_splits Tensors. """ size = shape_list(x)[axis] size_splits = [tf.div(size + i, num_splits) for i in range(nu...
0.013333