content
stringlengths
22
815k
id
int64
0
4.91M
def validate(model, model_name: str, dataloader_valid, class_weights, epoch: int, validations_dir: str, save_oof=True): """ Validate model at the epoch end Input: model: current model dataloader_valid: dataloader for the validation fold device: CUDA o...
5,326,600
def shared_empty(dim=2, dtype=None): """ Shortcut to create an empty Theano shared variable with the specified number of dimensions. """ if dtype is None: dtype = theano.config.floatX shp = tuple([1] * dim) return theano.shared(np.zeros(shp, dtype=dtype))
5,326,601
def _cleanup_session_var(request, var): """Cleanup Session var helper @param request: is a Django request object @param var: is a variable to cleanup session for""" try: request.session[var] = None del request.session[var] except KeyError: pass
5,326,602
def add_kwds(dictionary, key, value): """ A simple helper function to initialize our dictionary if it is None and then add in a single keyword if the value is not None. It doesn't add any keywords at all if passed value==None. Parameters ---------- dictionary: dict (or None) A dictio...
5,326,603
def parse_private_key(data, password): """ Identifies, decrypts and returns a cryptography private key object. """ # PEM if is_pem(data): if b"ENCRYPTED" in data: if password is None: raise TypeError("No password provided for encrypted key.") try: ...
5,326,604
def _get_cindex(circ, name, index): """ Find the classical bit index. Args: circ: The Qiskit QuantumCircuit in question name: The name of the classical register index: The qubit's relative index inside the register Returns: The classical bit's absolute index if all regi...
5,326,605
def test_store_public_key_for_other_economy_is_not_enabled(): """ Case: send transaction request, to store certificate public key for other, when economy isn't enabled. Expect: public key information is stored to blockchain linked to owner address. Owner hasn't paid for storing. """ new_public_key_p...
5,326,606
def sys_firewall_disallow_incoming_postgresql(): """ Disallow postgresql (port 5432) requests to this server - Ex: (cmd)""" sudo('ufw delete allow postgresql') sudo('ufw disable; echo "y" | ufw enable; sudo ufw status verbose')
5,326,607
def get_bin(pdf: str) -> str: """ Get the bins of the pdf, e.g. './00/02/Br_J_Cancer_1977_Jan_35(1)_78-86.tar.gz' returns '00/02'. """ parts = pdf.split('/') return parts[-3] + '/' + parts[-2] + '/'
5,326,608
def to_symbol(text): """Return the corresponding string representing the websites. :param str text: TODO :returns: TODO """ text = text.upper() if text in ("BGM", "BANGUMI"): return "bgm" elif text in ("MAL", "MYANIMELIST"): return "mal" else: return None
5,326,609
def burkert_density(r, r_s, rho_o): """ Burkert dark matter density profile """ x = r / r_s density = rho_o / ( (x) * (1.0 + x)**2) return density.to('g/cm**3')
5,326,610
def create_engine(user, password, database, host='127.0.0.1', port=5432, **kwargs): """ Create the engine connect the database. Use postgreSQL database. """ import psycopg2 global engine # set psycopg2 module select unicode result psycopg2.extensions.register_type(psycopg2.extensions.UNI...
5,326,611
def send_file(path): """ Route for file downloads """ # If the document path has a tilde, expand it path_prefix = expanduser(DOCUMENT_DIRECTORY_PATH) return send_from_directory(path_prefix, path)
5,326,612
def locations__single(request, location_id: int): """ Renders the locations page, when a single location has been selected. """ context = {'geolocation': request.session.get('geolocation'), 'location_error': request.session.get('location_error')} try: location_id = validat...
5,326,613
def test_ignoredInClass(): """An C{__all__} definition does not suppress unused import warnings in a class scope.""" flakes(''' class foo: import bar __all__ = ["bar"] ''', m.UnusedImport)
5,326,614
def page_not_found(e): """ Application wide 404 error handler """ return render_template('404.html', base_template=appbuilder.base_template, appbuilder=appbuilder), 404
5,326,615
def licols(A, tol=1e-10): """ Extracts a linearly independent set of columns from a given matrix A. Solution found at https://nl.mathworks.com/matlabcentral/answers/108835-how-to-get-only-linearly-independent-rows-in-a-matrix-or-to-remove-linear-dependency-b-w-rows-in-a-m :param A: matrix :param to...
5,326,616
def GetArchivePath (): """Return the archive path as defined by the L{PathEnvironmentVariable}, or C{None} if that variable is not defined.""" import os return os.environ.get(PathEnvironmentVariable)
5,326,617
def area_description(area,theory_expt): """ Generate plain-language name of research area from database codes. """ area_name_by_area = { "As" : "Astrophysics", "BP" : "Biophysics", "CM" : "Condensed matter", "HE" : "High energy", "NS" : "Network science", ...
5,326,618
def parse_username_password_hostname(remote_url): """ Parse a command line string and return username, password, remote hostname and remote path. :param remote_url: A command line string. :return: A tuple, containing username, password, remote hostname and remote path. """ assert remote_url ...
5,326,619
def main(api_endpoint, credentials, project_id, device_model_id, device_id, device_config, lang, verbose, input_audio_file, output_audio_file, audio_sample_rate, audio_sample_width, audio_iter_size, audio_block_size, audio_flush_size, grpc_deadline, once, *args, **kwargs): ...
5,326,620
def _random_inverse_gaussian_no_gradient(shape, loc, concentration, seed): """Sample from Inverse Gaussian distribution.""" # See https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution or # https://www.jstor.org/stable/2683801 dtype = dtype_util.common_dtype([loc, concentration], tf.float32) concentratio...
5,326,621
def optParse(): """Parses commandline options.""" parser = OptionParser(prog=__applicationName__, version="%prog " + __version__) parser.set_usage("%prog [options] filename") parser.add_option("--autobrief", action="store_true", dest="autobrief", help="use the docstring summary line as \\brief description" ) ...
5,326,622
def create_options_example_switcher(sw): """Add example actions.""" sw.clear() sw.set_placeholder_text('Select Action') section = _('change view') sw.add_item(title=_('Indent Using Spaces'), description='Test', section=section, shortcut='Ctrl+I') sw.add_item(title=_('Indent Using...
5,326,623
def test_data_arithmetic(): """ Tests arithmetic operations between :class:`Data` objects and values. """ grid = Grid(shape=(16, 16, 16)) u = Function(name='yu3D', grid=grid, space_order=0) u.data[:] = 1 # Simple arithmetic assert np.all(u.data == 1) assert np.all(u.data + 2. == 3.)...
5,326,624
def resolve(path): """ fully resolve a path: resolve env vars ($HOME etc.) -> expand user (~) -> make absolute Returns: pathlib.Path: resolved absolute path """ return Path(expandvars(str(path))).expanduser().resolve()
5,326,625
def i_select_database(): """ Selects Balsam database by setting the index of BALSAM_DB_PATH environment variable from the dropdown list. """ from ipywidgets import interact databasepaths = get_databases() interact(activate_database,db=[(i,db) for i,db in enumerate(databasepaths)]) return
5,326,626
def human_turn(board, hum_token): """ makes a human player's turn, changes the board accordingly """ while True: try: human_turn = input('\nEnter the number of the gameboard cell you want to \n' 'place your token in (or enter "quit" to exit):\n')...
5,326,627
def sas_2J1x_x(x): """return 2*J1(x)/x""" if np.isscalar(x): retvalue = 2*sas_J1(x)/x if x != 0 else 1. else: with np.errstate(all='ignore'): retvalue = 2*sas_J1(x)/x retvalue[x == 0] = 1. return retvalue
5,326,628
def get_alpha_given_w(M, last_wrong): """ :param M: Matrix of weights in dim. Number of Obs.x Number of Rounds :param last_wrong: Binary vector of wrong classified obs. at the last round. :return: """ alpha = [] for i in range(M.shape[1] - 1): er = np.dot(M[:, i], (M[:, i + 1] > M[:...
5,326,629
def get_cross_matrix(vec: ndarray) -> ndarray: """Get the matrix equivalent of cross product. S() in (10.68) cross_product_matrix(vec1)@vec2 == np.cross(vec1, vec2) Hint: see (10.5) Args: vec (ndarray[3]): vector Returns: S (ndarray[3,3]): cross product matrix equivalent """ ...
5,326,630
def apply_proteomics_elastic_relaxation( original_model: Model, objective_rule: Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE, ) -> Tuple[Model, Set]: """Relax the problem by relaxing the protein concentration constraints. The relaxed problems will be determined via Elastic filtering, retur...
5,326,631
def skip_node(node): """Whether to skip a step in the traceback based on ast node type.""" return isinstance(node, (ast.If, ast.While, ast.For))
5,326,632
def lorentzian_sim(xdata, Amp, Width, Center): """ Estimates sum of Lorentzian functions where: Amp = 1 X N lorentzian of amplitudes Width = 1 X N lorentzian of widths Center = 1 X N lorentzian of centers xdata = 1XN indepedent variable """ # Convert to arrays (just in case): Amp =...
5,326,633
def test_ignore_unknown_properties(): """Test Resource unknown base properties.""" data = resource_data() data['prop1'] = 'property1' data['prop2'] = 'property2' assert len(data) == 4 res = Resource(**data) assert len(res.data) == 2 assert res.whitelist is False with pytest.raises...
5,326,634
def convertASTtoThreeAddrForm(ast): """Convert an AST to a three address form. Three address form is (op, reg1, reg2, reg3), where reg1 is the destination of the result of the instruction. I suppose this should be called three register form, but three address form is found in compiler theory. ...
5,326,635
def aggregate_corrupt_metrics(metrics, corruption_types, max_intensity, alexnet_errors_path=None, fine_metrics=False): """Aggregates metrics across intensities and corruption types.""" results = {...
5,326,636
def lc_reverse_integer(n): """ Given a 32-bit signed integer, reverse digits of an integer. Assume we are dealing with an environment which could only hold integers within the 32-bit signed integer range. For the purpose of this problem, assume that your function returns 0 when the reversed integer over...
5,326,637
def hard_swish(x_tens: Tensor, inplace: bool = False): """ | Hardswish layer implementation: | 0 for x <= -3 | x for x >= 3 | x * (x + 3) / 6 otherwise More information can be found in the paper `here <https://arxiv.org/abs/1905.02244>`__. :param x_tens: the input tensor to pe...
5,326,638
def assert_equal_containers_state(expected_containers_list=None, timeout=120, interval=2, recreate_expected=False): """compare all overcloud container states with using two lists: one is current , the other some past list first time this m...
5,326,639
def init_pin_callback(box, nb): # required by Whand """ This function is always called by whand_io.py Only needs to perform something if input pins are accessed through interrupts Assigns callback for interrupt box is one instance of the hardware nb is an in...
5,326,640
def get_buttons(): """ renders the ok and cancel buttons. Called from get_body() """ # this is going to be what we actually do when someone clicks the button def ok_button_callback(button): raise ExitPasterDemo(exit_token='ok') # leading spaces to center it....seems like there should be a bet...
5,326,641
def dist_weights(distfile, weight_type, ids, cutoff, inverse=False): """ Returns a distance-based weights object using user-defined options Parameters ---------- distfile: string, a path to distance csv file weighttype: string, either 'threshold' or 'knn' ids: a numpy array of id values...
5,326,642
def install_to_temp_directory(pip_dependency: str, temp_dir: Optional[str] = None) -> str: """Install the given pip dependency specifier to a temporary directory. Args: pip_dependency: Path to a wheel file or a pip dependency specifier (e.g. "setuptools==18.0"). te...
5,326,643
def alias_phased_obs_with_phase(x, y, start, end): """ :param x: a list containing phases :param y: a list containing observations :param start: start phase :param end: end phase :return: aliased phases and observations """ x = [float(n) for n in x] y = [float(n) for n in y] if...
5,326,644
def create_storage_account(subscription: str, resource_group: str, name: str) -> None: """Creates an Azure storage account. Also adds upload access, as well as possibility to list/generate access keys, to the user creating it (i.e. the currently logged in user). Note that Azure documentation states tha...
5,326,645
def get_os(): """ Checks the OS of the system running and alters the directory structure accordingly :return: The directory location of the Wordlists folder """ if platform.system() == "Windows": wordlist_dir = "Wordlists\\" else: wordlist_dir = "Wordlists/" return wordlist_d...
5,326,646
def _try_warp(image, transform_, large_warp_dim, dsize, max_dsize, new_origin, flags, borderMode, borderValue): """ Helper for warp_affine """ if large_warp_dim == 'auto': # this is as close as we can get to actually discovering SHRT_MAX since # it's not introspectable thro...
5,326,647
def read_leaderboard( *, db: Session = Depends(deps.get_db), rank_type: schemas.RankType, skip: int = None, limit: int = 10, min_studied: int = 10, deck_id: int = None, date_start: datetime = None, date_end: datetime = None, current_user: m...
5,326,648
def getMultiFeatureOnsets(XAudio, Fs, hopSize): """ Call Essentia's implemtation of multi feature beat tracking :param XAudio: Numpy array of raw audio samples :param Fs: Sample rate :param hopSize: Hop size of each onset function value :returns (tempo, beats): Average tempo, numpy array ...
5,326,649
def execute( cool: str = typer.Option(..., "--cool",help="Path to cool file"), out: str = typer.Option(..., "--out", "-o", help="Path to output directory"), norm: str = typer.Option('KR',"--norm",help="Normalization method. It should be one of the column name of Cooler.bin(). Check it with Cooler.bins().col...
5,326,650
def check_derivation(derivation, premises, conclusion): """Checks if a derivation is ok. If it is, returns an empty list, otherwise returns [step, error] Does not check if the conclusion and premises are ok, for that there is another function""" for step in sorted(derivation): try: # ...
5,326,651
def plot_psha_psa_sigma( vs30_values: List, mag_dict: Dict, period_values: List, result_dict: Dict, plot_directory: pathlib.PosixPath, ): """Plots for pSA sigma versus T Parameters ---------- vs30_values: List list of Vs30s mag_dict: Dict Dictionary with a differ...
5,326,652
def __trunc__(self,l) : """Return a bitstring formed by truncating self to length |l|; if l < 0, from left""" if not isint(l) : raise IndexError('length not an integer'); if l < 0 : B = self._B; if self._l <= max(B,-l) : return __itrunc__(type(self)(self),l); s = type(self)(); i...
5,326,653
def transpose(expr: Expr, params: Dict[str, np.ndarray], schedule: Schedule, net: Dict[Expr, Expr], op_idx: Dict[str, int], RELAY_2_XLAYER: Dict[str, Callable], **kwargs) -> XLayer: """ Relay Transpose to XLayer converter R...
5,326,654
def version_list_url(content): """Returns a URL to list of content model versions, filtered by `content`'s grouper """ versionable = _cms_extension().versionables_by_content[content.__class__] return _version_list_url( versionable, **versionable.grouping_values(content, relation_suffix=False...
5,326,655
def as_ops(xs): """ Converts an iterable of values to a tuple of Ops using as_op. Arguments: xs: An iterable of values. Returns: A tuple of Ops. """ return tuple(as_op(x) for x in xs)
5,326,656
def send_neighbors(): """ The node sends its neighbors to the requesting node. :return: <json> This node's neighbors. """ bc_nodes_mutex.acquire() neighbors = blockchain.nodes neighbors_dict = {} for i, node in enumerate(neighbors): neighbors_dict[i] = node bc_nodes_mutex.r...
5,326,657
def get_db_home(db_home_id: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDbHomeResult: """ This data source provides details about a specific Db Home resource in Oracle Cloud Infrastructure Database service. Gets information about the specified Database ...
5,326,658
def alpha_080(code, end_date=None, fq="pre"): """ 公式: (VOLUME-DELAY(VOLUME,5))/DELAY(VOLUME,5)*100 Inputs: code: 股票池 end_date: 查询日期 Outputs: 因子的值 """ end_date = to_date_str(end_date) func_name = sys._getframe().f_code.co_name return JQDataClient.instance()....
5,326,659
def sync(clone, fetch): """Sync repositories in current profile.""" def do_sync(manifest: RepositoryManifest): repo = manifest.handle if not repo.exists(): if clone: with operation('Cloning', repo): Repo.clone_from(manifest.remote_url, manifest.lo...
5,326,660
def all_daily_file_paths_for_month(hemisphere, year, month, search_paths): """Return a list of all the filenames available for the given year and month. """ start_date = dt.date(year, month, 1) end_date = dt.date(year, month, monthrange(year, month)[1]) return daily_file_paths_in_date_range(hemisph...
5,326,661
def uniques_only(iterable): """ This works only for sequence, but not for all iterable """ items = [] for i, n in enumerate(iterable): if n not in iterable[:i]: items.append(n) return items
5,326,662
def CreateHardlink(target, output): """Recursively create a hardlink named output pointing to target. Args: target: path to an existing file or directory output: path to the newly created hardlink If output already exists, it is first removed. In all cases, the parent directory containing output is cr...
5,326,663
def test_unquotefromdtd_unimplemented_cases(): """Test unimplemented unquoting DTD cases.""" assert dtd.unquotefromdtd('"Color &amp; Light"') == "Color & Light" assert dtd.unquotefromdtd('"Color &amp; &block;"') == "Color & &block;" assert dtd.unquotefromdtd('"&lt;p&gt; and &lt;/p&gt;"') == "<p> and </p...
5,326,664
def init_rooms(): """ Creates a directory for rooms if it does not exist. """ if not os.path.exists('r'): os.mkdir('r')
5,326,665
def str2date(start_time_str): """ 将到到期日中的大写中文字符转化为标准数字格式 2020年1月1日 --> 2020-1-1 """ list_s = [i for i in start_time_str] num_list = [] for index, s in enumerate(list_s): list_s[index] = CN_NUM.get(s, s) if isinstance(list_s[index], int): num_list.append((index, s...
5,326,666
def load_base_qb(): """ load base QB components """ print "base QB4ST loaded via static ontology file"
5,326,667
def load_omnical_metrics(filename): """Load an omnical metrics file. Parameters ---------- filename : str Path to an omnical metrics file. Returns ------- metrics : dict A dictionary containing omnical metrics. Raises ------ IOError: If the filetype inf...
5,326,668
def indexDocElement(es_Url, awsauth, docData): """ Loads completed document to Elasticsearch index. PARAMS: es_url - Elasticsearch Url for PUT requests awsauth - AWS credentials for Elasticsearch docData - formated dict like object to update elasticsearch record. """ try: heade...
5,326,669
def getexpdata(madobj,code,odir): """ gets all experiments for all available times (between years 1900 and 2100) note month and day canNOT be 0 or you'll get an empty list in return code: instrument code from Pandas Series """ # this is list of all experiments for this instrument for all time ...
5,326,670
def tsallis(ion_temp, avg_temp, n): """ Non-normalized probability of an ion at ion-temp using a Tsallis distribution :param ion_temp: temperature of ion (K) :param avg_temp: average temperature of ions (K) :param n: average harmonic oscillator level :return: value """ kb = 1.38e-23 ...
5,326,671
def nasnet_dual_path_sequential(return_two=True, first_ordinals=0, last_ordinals=0, can_skip_input=False): """ NASNet specific dual path sequential container. Parameters: ---------- return_two : bool, de...
5,326,672
def _extractRGBFromHex(hexCode): """ Extract RGB information from an hexadecimal color code Parameters: hexCode (string): an hexadecimal color code Returns: A tuple containing Red, Green and Blue information """ hexCode = hexCode.lstrip('#') # Remove the '#' from the string ...
5,326,673
def summarise(indices, fields, **kwargs): """Summarise taxonomy.""" summary = {} meta = kwargs['meta'] try: if 'taxid' in meta.taxon: summary.update({'taxid': meta.taxon['taxid']}) names = [] for rank in ('superkingdom', 'kingdom', 'phylum', 'class', 'order', 'family'...
5,326,674
def main(): """ main funcion """ Tools.mnnconvert(sys.argv) return 0
5,326,675
def _get_active_user_p_by_date(start_date, end_date, *, seed=None): """Generate a trajectory for % daily active users (DAU). The series is a random walk with drift. DAU % starts between approx. 20-30% range and then follows random walk with drift over time. In bad cases, DAU % might halve within a yea...
5,326,676
def get_unknow_opttrans_attr(path): """Utility method that gives a `dict` of unknown optional transitive path attributes of `path`. Returns dict: <key> - attribute type code, <value> - unknown path-attr. """ path_attrs = path.pathattr_map unknown_opt_tran_attrs = {} for _, attr in path_attr...
5,326,677
def get_user_partition_groups(course_key, user_partitions, user, partition_dict_key='name'): """ Collect group ID for each partition in this course for this user. Arguments: course_key (CourseKey) user_partitions (list[UserPartition]) user (User) partition_dict_key - i.e. 'i...
5,326,678
def getemptybracket(league, testyear): """ Generates an empty bracket for the current year. Does not work for any other year due to the url only containing info for the current year. Prefer to use the output yaml as a guide and correct as needed each year :param league: league: str, mens or womens leagu...
5,326,679
def test_skip_multiple_dates(): """Test multiple skip date entries, with a skip date range""" cal = models.Calendar() cal.title = "Test" cal.start_date = date(2021, 1, 1) cal.end_date = date(2021, 12, 31) cal.save() models.SkipDate.objects.create(calendar=cal, date=date(2021, 1, 5)) m...
5,326,680
def kendall_tau(solar_ts, wind_ts): """ Compute Kendall's tau correlation between the given solar and wind timeseries data. Return just the correlation coefficient. Parameters ---------- solar_ts : ndarray Solar time-series vector for a single site wind_ts : ndarray Wind tim...
5,326,681
def register_all(keras_objects: bool = True, custom_kernels: bool = True) -> None: """Register TensorFlow Addons' objects in TensorFlow global dictionaries. When loading a Keras model that has a TF Addons' function, it is needed for this function to be known by the Keras deserialization process. There...
5,326,682
def get_single_intersight_object(intersight_api_key_id, intersight_api_key, intersight_api_path, object_moid, object_type="object", intersight_base_ur...
5,326,683
def test_osx_memdata_with_comma(): """ test osx memdata method when comma returns """ def _cmd_side_effect(cmd): if "hw.memsize" in cmd: return "4294967296" elif "vm.swapusage" in cmd: return "total = 1024,00M used = 160,75M free = 863,25M (encrypted)" wi...
5,326,684
def convert_html_to_dash(el, style=None): """[Quite] Conveniently auto-converts whole input HTML into the corresponding Python Dash HTML components. Uses Beautiful Soup to auto-parse into required HTML elements ('el') if given str input. Parameters ---------- el : bs.element.NavigableString...
5,326,685
def _ice_d2gdt2(temp,pres): """Calculate ice Gibbs free energy TT-derivative. Calculate the second derivative of the specific Gibbs free energy of ice with respect to temperature. :arg float temp: Temperature in K. :arg float pres: Pressure in Pa. :returns: Gibbs free energy derivative...
5,326,686
def runTrainingCases(client, caseNums, start_time, end_time, endPerc = 99): """ Main function to run the training cases Args: client: XPlane Client caseNums: indices of cases to run ------------------- endPerc: percentage down runway to end trajectory and res...
5,326,687
def ifht(A, dln, mu, offset=0.0, bias=0.0): """ifht multimethod.""" return (Dispatchable(A, np.ndarray),)
5,326,688
def make_import_names_callback(library_calls, library_addr): """ Return a callback function used by idaapi.enum_import_names(). """ def callback(ea, name, ordinal): """ Callback function to retrieve code references to library calls. """ library_calls[name] = [] library_addr[name] = ea ...
5,326,689
def test_many(h3): """Manage many buckets.""" count = 100 # More than 10 assert h3.list_buckets() == [] for i in range(count): assert h3.create_bucket('bucket%d' % i) == True for i in random.sample(range(count), 10): with pytest.raises(pyh3lib.H3ExistsError): h3.creat...
5,326,690
def is_leap_year_test(): """Test the is_leap_year(year) function.""" test_cases = [1800, 1900, 1600, 2000, 1324, 2020, 3001, 2029] result_list = [False, False, True, True, True, True, False, False] for i in range(len(test_cases)): tested = is_leap_year(test_cases[i]) result = result_list...
5,326,691
def test_param(param_def): """Test that parameter definitions are correct.""" assert param_def.options == {'scope': 'list'} assert param_def.fixed == {'a': 1, 'b': 2, 'c': 3} assert param_def.free == {'f': [0, 1]} assert param_def.dependent == {'d': '2 + mean([a, b])'} assert param_def.dynamic =...
5,326,692
def has_reuse_port(*, use_env=True): """Return true if the platform indicates support for SO_REUSEPORT. Can be overridden by explicitly setting ``AIOCOAP_REUSE_PORT`` to 1 or 0.""" if use_env and os.environ.get('AIOCOAP_REUSE_PORT'): return bool(int(os.environ['AIOCOAP_REUSE_PORT'])) retu...
5,326,693
def unNormalizeData(normalizedData, data_mean, data_std, dimensions_to_ignore, actions, one_hot): """Borrowed from SRNN code. Reads a csv file and returns a float32 matrix. https://github.com/asheshjain399/RNNexp/blob/srnn/structural_rnn/CRFProblems/H3.6m/generateMotionData.py#L12 Args normalizedData...
5,326,694
def rbf_approx(t, y, centers, eps, C): """ function to return vector field of a single point (rbf) :param t: time (for solve_ivp) :param y: single point :param centers: all centers :param eps: radius of gaussians :param C: coefficient matrix, found with least squares :return: derivative ...
5,326,695
def show(ctx): """show Freeldep variables""" pass
5,326,696
def get_preview_fragment(request, descriptor, context): """ Returns the HTML returned by the XModule's student_view or author_view (if available), specified by the descriptor and idx. """ module = _load_preview_module(request, descriptor) preview_view = AUTHOR_VIEW if has_author_view(module) el...
5,326,697
def expr_close(src, size = 5): """ Same result as core.morpho.Close(), faster and workable in 32 bit. """ close = expr_dilate(src, size) return expr_erode(close, size)
5,326,698
def recent_records(request): """ The landing view, at /. """ interval = request.GET.get('interval', 'month') days = 31 if interval == 'week': days = 7 recent_records, last_processed = _get_recent_records_range(0, NR_OF_RECENT_RECORDS, days) context = { 'active': 'home'...
5,326,699