content
stringlengths
22
815k
id
int64
0
4.91M
def api(path:str): """Associate a path with a given method.""" def inner(fn): fn.path = Path(path) return fn return inner
5,299,700
def wlan_exp_init_time(nodes, time_base=0, output=False, verbose=False, repeat=1): """Initialize the time on all of the WLAN Exp nodes. Attributes: nodes -- A list of nodes on which to initialize the time. time_base -- optional time base output -- optional output to see jitter acro...
5,299,701
def GilmoreEick_equation(t, x): """Compute one integration step using the Gilmore--Eick equations. """ global T R = x[0] R_dot = x[1] pg = x[2] pinf = sc_pstat - sc_pac * np.sin(sc_omega * t) pinf_dot = -sc_pac * sc_omega * np.cos(sc_omega * t) T_gas = T_gas_0 * pg * R ** 3 /...
5,299,702
def hello_world(): # TODO add costring """ Note add docstring """ return "hello cma"
5,299,703
def generate_boutiques_descriptor( module, interface_name, container_image, container_type, container_index=None, verbose=False, save=False, save_path=None, author=None, ignore_inputs=None, tags=None, ): """ Generate a JSON Boutiques description of a Nipype interface....
5,299,704
def get_cblip_correction(wsp): """ Get the cblip based distortion correction warp Required workspace attributes ----------------------------- - ``calib`` : Calibration image - ``cblip`` : Phase-encode-reversed calibration image - ``echospacing`` : - ``pedir`` : Updated workspa...
5,299,705
def findAbsFuncUFromRelaU(CompMean, ru): """ :param CompMean: :param ru: :return: """ result = CompMean * ru resultString = result.to_eng_string() intPart = resultString.split('.')[0] try: # may not have '.' decimalPart = resultString.split('.')[1] digit...
5,299,706
def get_all_services(as_json=False, as_json_schema=False): """Get all registered services, as objects (default) as JSON, or as JSON schema. :param bool as_json: If True, return JSON instead of objects. Supersedes as_json_schema. :param bool as_json_schema: If True, return JSON schema instead of objects. ...
5,299,707
def gen_jets_groomed_precrit(num_events, z_cut, beta, f, jet_type='quark', radius=1., acc='LL'): """Generates a list of num_events jet_type jets through angularity based parton showering. """ # Setting up for angularities jet_list = [] f...
5,299,708
def _build_page(page, config, files, nav, env, dirty=False): """ Pass a Page to theme template and write output to site_dir. """ try: # When --dirty is used, only build the page if the file has been modified since the # previous build of the output. if dirty and not page.file.is_modifie...
5,299,709
def jouer(): """Short function to quick lauch a game""" import Game.morpion as m jeu = m.Morpion() partie = Partie(jeu, ["axel","gab"]) partie.launch()
5,299,710
def fixture_encode_flac_u8(): """fixture_encode_flac_u8""" wav_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "test_audio", "ZASFX_ADSR_no_sustain.wav", ) audio = tf.audio.decode_wav(tf.io.read_file(wav_path)) value = audio.audio value = (value + 1.0) / ...
5,299,711
def test_comment_with_noqa_plus_docstring_file(env): """Test that file with comments, noqa, docstring does not cause errors.""" with env.open('comments_plus.py', 'wt') as comments_plus: comments_plus.write( '#!/usr/bin/env python3\n' '# -*- coding: utf-8 -*-\n' '# Use...
5,299,712
def randn(*args, **kwargs): """ In ``treetensor``, you can use ``randn`` to create a tree of tensors with numbers obey standard normal distribution. Example:: >>> import torch >>> import treetensor.torch as ttorch >>> ttorch.randn(2, 3) # the same as torch.randn(2, 3) ...
5,299,713
def parse_host_port(address, default_port=None): """ Parse an endpoint address given in the form "host:port". """ if isinstance(address, tuple): return address if address.startswith('tcp:'): address = address[4:] def _fail(): raise ValueError("invalid address %r" % (addr...
5,299,714
def test_get_queryset_with_reverse_foreign_key(): """ Test retrieving a Django queryset with reverse foreign-key relationships. """ thread = Thread.objects.create(title="My thread topic") thread2 = Thread.objects.create(title="Another topic") for content in ("I agree.", "I disagree!", "lol"): ...
5,299,715
def synapses2nodepoints(x, layer_scale): """Generate nodepoints (point A, point B) from synapses for given neuron(s). Parameters ---------- x : CatmaidNeuron | CatmaidNeuronList or TreeNeuron | NeuronList neuron or neuronlist of different formats layer_scale : int | float ...
5,299,716
def cli(target_directory, project_type): """ Initializes a new Art Engine project """ click.echo("Init started ...") if project_type == "simple": config_file_name = "config_files/simple_instance_config.py" project_template = appconfig.simple_project_template elif project_type == ...
5,299,717
def p52(): """ Smallest integer n s.t n,2*n,...,6*n all have same digits. """ # Returns the digits in the decimal representation of a positive integer n def digits(n): ret = [] while n > 0: ret.append(n % 10) n = n / 10 ret.sort() return ret # C...
5,299,718
def get_microphone_class(system: str) -> Type[RhasspyActor]: """Get class type for profile microphone.""" assert system in [ "arecord", "pyaudio", "dummy", "hermes", "stdin", "http", "gstreamer", ], ("Unknown microphone system: %s" % system) if sy...
5,299,719
def fit_gibbs_global_batch_aligned(hdx_set, initial_guess, r1=2, r2=5, epochs=100000, patience=50, stop_loss=0.05, optimizer='SGD', **optimizer_kwargs): """ Batch fit gibbs free energies to two HDX measurements. The supplied HDXMeasurementSet must have alignment information (supplied by HDXMe...
5,299,720
def addition(a,b): """ return sum of a and b """ c = a + b if abs(c) > Largest: if c < 0: return -(Largest) return Largest return c
5,299,721
def draw_background(window): """ This function draws the background. Specifically, the sky and ground. """ # Draw the sky in the top two-thirds arcade.draw_rectangle_filled(SCREEN_WIDTH / 2, SCREEN_HEIGHT * 2 / 3, SCREEN_WIDTH - 1, SCREEN_HEIGHT * 2 / 3, ...
5,299,722
def panoimg(): """Panoramic US image of a musculoskeletal muscle """ return _load(os.path.join(data_dir, "panoramic_echo.jpg"))
5,299,723
def subscribe_in_pubsubhubbub(channel_id: str) -> int: """The subscription request to find out when a new video arrives on a specific channel is made from this function. Basically here the necessary data for this activity is informed for Pubsubhubbub Parameters ---------- channel_id : str ...
5,299,724
def hsv_complement_color(h, s, v): """ get the complement of a rgb color :param h: Hue value (0-360) :param s: Saturation value (0-255) :param v: Value value (0-255) :return: HSV tuple """ # perform 180° hue change tmp = 180 if h > 180: tmp = -tmp return h + tmp, s, v
5,299,725
def _outside_all_rewrites(): """'Break out' of a tpu.rewrite() (or shard(), etc.).""" with ops.control_dependencies(None): yield
5,299,726
def test_range_function(): """Range function If you do need to iterate over a sequence of numbers, the built-in function range() comes in handy. It generates arithmetic progressions. In many ways the object returned by range() behaves as if it is a list, but in fact it isn’t. It is an object which...
5,299,727
def write_dat_file(output_file, args_to_write, arguments): """ write a simple .dat file with the arguments specified in args_to_write, drawn from the arguments dictionary""" if any(arg in arguments for arg in args_to_write): output_file = make_file_path(output_file, arguments) print("Writin...
5,299,728
def test_ocsp_with_bogus_cache_files(tmpdir): """ Attempt to use bogus OCSP response data """ cache_file_name, target_hosts = _store_cache_in_file(tmpdir) # reading cache file cache_data = {} ocsp_asn1crypto.read_ocsp_response_cache_file(cache_file_name, cache_data) assert cache_data, "...
5,299,729
def get_complex_polar(mag, angle): """Angle must be in radians""" # TODO: this doesn't belong here. return mag * np.exp(1j * angle)
5,299,730
def average(input_file, fig, txt): """Average the data contained in a dA or dCD file. """ with h5py.File(input_file, "r+") as file: compute.average(file) if txt: extract.save_avg_as_txt(file, Path(txt)) if fig: extract.save_avg_da_figures(file, Path(fig)) ...
5,299,731
def telegram_bot_sendtext(bot_message: str, *, bot_token: str, bot_chatid: str): """Send a notification to a telegram channel. Args: bot_message (str): Message you want to send. Returns: [request]: Returns a request object which is the response to send to the channel. """ send...
5,299,732
def focal_loss(output: torch.Tensor, target: torch.Tensor, reduction: str = "mean", normalized: bool = False, gamma=2, reduced_threshold: Optional[float] = None, eps: float = 1e-6, from_logits=False) -> torch.Tensor...
5,299,733
def preprocess_words_scores(type2freq_1, type2score_1, type2freq_2, type2score_2, stop_lens, stop_words, handle_missing_scores): """ Filters stop words according to a list of words or stop lens on the scores Parameters ---------- type2freq_1, type2freq_2: dict Ke...
5,299,734
def forward(apps, schema_editor): """ Add missing Profile to existing users. """ User = apps.get_model("auth", "User") UserProfile = apps.get_model("core", "UserProfile") for user in User.objects.all(): UserProfile.objects.create(user=user)
5,299,735
def load_mappings_file(fpath: Path) -> list: """ Read the mappings file shared by Abu farha (CVPR'18) to read the class names. """ res = [] with open(fpath, 'r') as fin: for line in fin: res.append(line.rpartition(' ')[-1].strip()) # convert to dict return dict(zip(re...
5,299,736
def check_creation(cfg): """ Simple target to run after creation to see if scripts can be run """ creds = googleapi.Creds(cfg) service = creds.serv('script', cfg) request = {"function": "getFilesDirWithType", "parameters": [cfg['project_dir']], } out = googleapi...
5,299,737
def copy_var(tasks, name, from_name, to_name): """Copy a variable to a new name. """ for task in tasks: if task is not None: task[to_name] = task[from_name] yield task
5,299,738
def _satisfies_wolfe(val_0, val_c, f_lim, sufficient_decrease_param, curvature_param): """Checks whether the Wolfe or approx Wolfe conditions are satisfied. The Wolfe conditions are a set of stopping criteria for an inexact line se...
5,299,739
def load_edf(eeg_file): """This function uses mne library. WARNING: The function has strange behaviour, please don't use""" data = mne.io.read_raw_edf(eeg_file) sfreq = data.info['sfreq'] signals = data.get_data() return signals, int(sfreq)
5,299,740
def module_parents(module_name): """ >>> list(module_parents('a.b')) ['a.b', 'a', ''] """ spl = module_name.split(".") for i in range(len(spl), 0, -1): yield ".".join(spl[0:i]) if module_name: yield ""
5,299,741
def get_clean_codes(stressed_endings, assonance=False, relaxation=False): """Clean syllables from stressed_endings depending on the rhyme kind, assonance or consonant, and some relaxation of diphthongs for rhyming purposes. Stress is also marked by upper casing the corresponding syllable. The codes for ...
5,299,742
def fit_parabola(x1,x2,x3,y1,y2,y3): """Returns the parabola coefficients a,b,c given 3 data points [y(x)=a*x**2+b*x+c]""" denom = (x1-x2)*(x1-x3)*(x2-x3) a = (x3*(y2-y1)+x2*(y1-y3)+x1*(y3-y2))/denom b = (x1**2*(y2-y3)+x3**2*(y1-y2)+x2**2*(y3-y1))/denom c = (x2**2*(x3*y1-x1*y3)+x2*(x1**2*y3-x3**2*y1...
5,299,743
def download(sensor, id): """ Create a .csv file of requested sensor and id and delete it later """ # Get (list of dict) records from data_api records = api_get_data(sensor, id)['data'] # Use Pandas for easy csv creation df = pd.DataFrame.from_records(records) if 'datetime' in df.c...
5,299,744
def _augment(image, op): """Image augmentation""" if op[0]: image = np.rot90(image, 1) if op[1]: image = np.fliplr(image) if op[2]: image = np.flipud(image) return image
5,299,745
def generate_list(usb_dict: dict) -> list: """ wrapper for list conversion :param usb_dict: usb dictionary :return: list of usb devices for tui print """ devices = [] for usb in usb_dict.values(): devices.append(usb) return devices
5,299,746
def file_test_list(tmpdir_factory, string_test_list): """An example of output from tempest run --list-tests """ filename = tmpdir_factory.mktemp('data').join('file_test_list_one').strpath with open(filename, 'w') as f: f.write(string_test_list) return filename
5,299,747
def verify_account_activity(account_activity): """ Verify IdentityNow Account Activity. """ assert account_activity['id'] is not None assert account_activity['name'] is not None assert account_activity['created'] is not None assert account_activity['modified'] is not None assert account_...
5,299,748
def read_companies(excel_file: ExcelFile) -> pd.DataFrame: """ :param excel_file: (ExcelFile) :return melted_companies: (DataFrame) code | (String) date | (Datetime) name | (String) ... """ # Read excel file. raw_companies = excel_file.parse(COMPANY, sk...
5,299,749
def writePKA(protein, filename=None, reference="neutral", direction="folding", options=None): """ Write the pka-file based on the given protein """ verbose = options.verbose if options is not None else False if filename == None: filename = "%s.pka" % (protein.name) file = open(filename, 'w...
5,299,750
def test_collection_invalid_data_play(): """Test that collection as a dict at the play level fails with parser error""" collection_name = {'name': 'foo'} with pytest.raises(AnsibleParserError): Play.load(dict( name="test play", hosts=['foo'], gather_facts=False, ...
5,299,751
def check_level(level): """ Check if given level is valid and return a normalized copy. """ if level is None: return DEFAULT_LEVEL if level not in LOG_LEVELS: raise ValueError(f"invalid debug level: {level!r}") return level
5,299,752
def GXY_B2( code, error, mag=0.002617993877991494, propagation='random', NEV=True, **kwargs ): """ SPE 90408 Table 4 """ dpde = np.full((len(error.survey_rad), 3), [0., 0., 1.]) dpde[:, 2] = np.where( error.survey.inc_rad <= kwargs['header']['XY Static Gyro']['End Inc'], cos(...
5,299,753
def is_lead_worker(rank): """ -1 = means serial code so main proc = lead worker = master 0 = first rank is the lead worker (in charge of printing, logging, checkpoiniting etc.) :return: """ am_I_lead_worker = rank == 0 or is_running_serially(rank) return am_I_lead_worker
5,299,754
def handler408(request): """ Custom response handler """ return HttpResponse(content="Custom 408 handler", status=408)
5,299,755
def postgresPreflight(connection): """ Pre-flight function for PostgreSQL connections: enable standard conforming strings, and set a non-infinite statement timeout. """ c = connection.cursor() # Turn on standard conforming strings. This option is _required_ if # you want to get correct beh...
5,299,756
def resolve_type_id_to_type_name(type_id, raise_exception=True): """ Resolves an EVE Online type_id to type_name. Falls back to ESI if not found in static database. Returns None if not found. """ query = "select typeName from invTypes where typeID = %s" % type_id type_name = query_static_databa...
5,299,757
def create_environment(home_dir, site_packages=True, clear=False, unzip_setuptools=False, use_distribute=False): """ Creates a new environment in ``home_dir``. If ``site_packages`` is true (the default) then the global ``site-packages/`` directory will be on the path. If ``c...
5,299,758
def FindTasksByName(searchstr, ignore_case=True): """ Search the list of tasks by name. params: searchstr: str - a regex like string to search for task ignore_case: bool - If False then exact matching will be enforced returns: [] - array of task object. Empty if ...
5,299,759
def _get_model_checkpoint_directory(_params): """ :param _params: [argparse.Namespace] attr: experiment_name, run_name, pretrained_model_name, dataset_name, .. :return: model_checkpoint_directory [str] """ return join(env_variable("DIR_CHECKPOINTS"), _params.experiment_run_name_nr)
5,299,760
def create_pgosm_db(): """Creates the pgosm database and prepares with PostGIS and osm schema """ sql_raw = 'CREATE DATABASE pgosm;' conn = get_db_conn(db_name='postgres') LOGGER.debug('Setting Pg conn to enable autocommit - required for drop/create DB') conn.autocommit = True conn.execute(...
5,299,761
def cli_api_view(name: str): """ """ params = { "<[name-api-capitalize]>": name.capitalize(), "<[name-api-pluralize]>": p.plural(name.lower()), "<[name-api-lower]>": name.lower(), "_nclass": p.plural(name.lower()) } create_api_view('.', dirname, params) add_string...
5,299,762
def run_clients(): """Force create driver for client """ clients = request.form.get('clients') if not clients: return jsonify({'Error': 'no clients provided'}) result = {} for client_id in clients.split(','): if client_id not in drivers: init_client(client_id) init_timer(client_id) result[client_id] ...
5,299,763
def makeDataGetRequest(endpoint, apiKey, data={}): """ Helper function to make post request :param str endpoint: Endpoint to hit :param str apiKey: Api key to use to build header :param dict json: Optional json data """ headers = {'X-API-KEY': apiKey, 'Content-Type': 'application/json'} ...
5,299,764
def gauss_pdf(x, a = 1, mu = 0, sigma = 1, bg = 0): """using scipy module function """ return a*norm.pdf(x, mu, sigma) + bg
5,299,765
def compute_emissions(tdf, df_with_emission_functions, dict_of_fuel_types_in_tdf): """Compute instantaneous emissions with equations used in [Nyhan et al. (2016)]. For each point in a TrajDataFrame, computes instantaneous emissions of 4 pollutants (CO_2, NO_x, PM, VOC). Parameters ---------- tdf : TrajDataFrame ...
5,299,766
def _otbn_assemble_sources(ctx): """Helper function that, for each source file in the provided context, adds an action to the context that invokes the otbn assember (otbn-as), producing a corresponding object file. Returns a list of all object files that will be generated by these actions. """ c...
5,299,767
def reset_line_breaks(curr_boundary={}): """ Builds a fresh line breaks dictionary while keeping any information provided concerning line boundaries. Parameters ---------- curr_boundary: dict Line boundaries to be preserved Returns ------- dict The newly initialize...
5,299,768
def stop(M, i): """ Check if the algorithm converged. :param M: input matrix :param i: iteration steo :return: boolean: True if converged """ # this saves time, so we dont have to do multiplication in the first 7 iterations if i > 6: M_temp = M ** 2 - M m = M_temp.max() -...
5,299,769
def getTurnHold(mouse_x, mouse_y, army): """Get hold on list of turn""" x, y = getTileAtPixel(mouse_x, mouse_y) if x is not None and y is not None: direction = getDirectionByPosition(x, y, army) if direction == UP: return [[x, y], [x + 1, y], [x - 1, y]] elif direction ==...
5,299,770
def sorted_binop_expected_locs(binop_expected_locs): """Sorted expected locs when used in tests for sample generation.""" sort_by = attrgetter("lineno", "col_offset", "end_lineno", "end_col_offset") return sorted(binop_expected_locs, key=sort_by)
5,299,771
def InrecaMoreIsBetter(caseAttrib, queryValue, jump, weight): """ Returns the similarity of two numbers following the INRECA - More is better formula. """ try: queryValue = float(queryValue) # build query string queryFnc = { "function_score": { "query": { "match_all": {} }, "script_score...
5,299,772
def sigmoid_prime(x: Tensor) -> Tensor: """ Derivation of the sigmoid activation function. derivation: f'(x) = f(x) * (1 - f(x)) Args: x (:obj:`Tensor`): input to the function Returns: :obj:`Tensor`: f'(x), applies derivation of activation function """ return sigm...
5,299,773
def process_xml(xml_sitemap, regex): """ extract links from xml """ site_map_paths = set([]) url_paths = set([]) try: # need to strip namespaces ns_stripped = ET.iterparse(StringIO(xml_sitemap)) for _, element in ns_stripped: if '}' in element.tag: ele...
5,299,774
def lvar (inlist): """ Returns the variance of the values in the passed list using N-1 for the denominator (i.e., for estimating population variance). Usage: lvar(inlist) """ n = len(inlist) mn = mean(inlist) deviations = [0]*len(inlist) for i in range(len(inlist)): deviations[i] = inlist...
5,299,775
def diceroll(num_faces: str = "6") -> None: """Roll a dice and print the result Parameters ---------- num_faces : str, optional The faces of the die, by default 6 """ print(random.randint(1, int(num_faces)))
5,299,776
def glove_embeddings(text_data, vids, paddings=50): """Get glove embeddings of text, video pairs. Args: text_data (list): list of text data. vids (list): list of video data paddings (int, optional): Amount to left-pad data if it's less than some size. Defaults to 50. Returns: ...
5,299,777
def get_args(): """ Get command-line arguments. """ parser = argparse.ArgumentParser( description='get extent of the given image') parser.add_argument( 'path_img', metavar='path_img', type=str, nargs='+', help='path of the remote sensing image (.tif)') return parser.parse_a...
5,299,778
def function_scope_seed(request): """A function scope fixture that manages rng seeds. This fixture automatically initializes the python, numpy and mxnet random number generators randomly on every test run. def test_ok_with_random_data(): ... To fix the seed used for a test case mark the test...
5,299,779
def sbert_encoder(text_list, pretrained_reference='distilbert-base-nli-stsb-mean-tokens'): """ Helper function using sentence_transformers which simplifies the embedding call Args: text_list (list): list of strings to embed pretrained_reference (string, optional): the pretrained model to us...
5,299,780
def param_description(): """ Description for the script """ print("The parameters are\n" + "pileup_file: the pileup file you want to filter\n" + "out_file: the name of the output file\n" + "site_list: the name of the file where each line is (char, pos) that we want to filte...
5,299,781
def find_reasonable_font(): """Try to return system font path, or some other font""" if sys.platform.startswith("win"): path = "C:/Windows/Fonts/arial.ttf" if exists(path): return path else: return None else: with open(get_res_path("qlibs/text/linux_fo...
5,299,782
def check_pipeline_config(cfg, pure_pipelines): """ Check pipeline configuration, displaying a message in the Notebook for every problem found. Returns whether the configuration is usable at all. """ (okay, messages) = cfg.is_valid(pure_pipelines=pure_pipelines) for msg in messages: ...
5,299,783
def swapAMP(oldAMP, newAMP): """ Swap delivery of messages from an old L{AMP} instance to a new one. This is useful for implementors of L{StoreSpawnerService} since they will typically want to create one protocol for initializing the store, and another for processing application commands. @par...
5,299,784
def get_effective_reminder_time(): """ Isolate this particular use of now() so that the effective reminder time is practical to patch within tests. """ return now()
5,299,785
def do_pack(): """generates a tgz archive""" try: date = datetime.now().strftime("%Y%m%d%H%M%S") if isdir("versions") is False: local("mkdir versions") file_name = "versions/web_static_{}.tgz".format(date) local("tar -cvzf {} web_static".format(file_name)) ret...
5,299,786
def test_delete_existing_dataset(public_dataset, mock_app, database): """Test the command line to delete an existing dataset""" # test add a dataset_obj using the app cli runner = mock_app.test_cli_runner() dataset = public_dataset # When a dataset is inserted into database result = runner.in...
5,299,787
def jaccard(box_a, box_b): """Compute the jaccard overlap of two sets of boxes. Args: box_a: (tensor) Ground truth bounding boxes, Shape: [num_objects,4] box_b: (tensor) Prior boxes from priorbox layers, Shape: [num_priors,4] Return: jaccard overlap: (tensor) Shape: [box_a.size(0), b...
5,299,788
def test(probs = range(1, 19), /, *, n=None, factor=None, fmin=0, mem="max", verb=1, blmvm=False, output=sys.stdout, **kwds): """Run one or several tests from the MINPACK-1 Project. Usage: optm_minpack1_test(probs=range(1,19)) Argument `probs` is a single problem number (in the range 1:...
5,299,789
def show_states_func(sp): """Function returning states for each frame """ E0 = sp.params["E0"] dE = sp.params["dE"] omega = sp.params["omega"] return [[E0,"--k"], [E0+dE, "--b"], [E0+dE-omega, "--r"]]
5,299,790
def pack_images( images ): """Returns the packed images (all of same size)""" width = images[0].size[0] height = images[0].size[1] out_width = min([len(images), 10]) * width out_height = ((len(images)-1) / 10 + 1) * height out_image = Image.new("RGBA", (out_width,out_height)) x = 0 y...
5,299,791
def makeDelayedFunctionCall(func, args, kwargs): """Utility function for creating a lazily-evaluated function call.""" props = set().union(*(requiredProperties(arg) for arg in itertools.chain(args, kwargs.values()))) def value(context): subvalues = (valueInContext(arg, context) for arg in ar...
5,299,792
def elina_scalar_cmp_int(scalar, b): """ Compare an ElinaScalar to a double. Parameters ----------- scalar : ElinaScalarPtr Pointer to the ElinaScalar that needs to be compared. b : c_int Integer to be compared. Returns ------- result : c_int The res...
5,299,793
def get_budget_entries(request): """returns budgets with the given id """ logger.debug("get_budget_entries starts") budget_id = request.matchdict.get('id', -1) budget = Budget.query.filter(Budget.id == budget_id).first() if not budget: transaction.abort() return Response('No bud...
5,299,794
def test_incorrect_weights(tmp_path): """Test land-sea with incorrect weights""" kgo_dir = acc.kgo_root() / "nbhood-land-and-sea/topographic_bands" input_path = kgo_dir / "input.nc" mask_path = kgo_dir / "topographic_bands_land.nc" weights_path = kgo_dir / "weights_any_surface.nc" output_path = ...
5,299,795
def desktop(): """ This function returns the full path to the desktop directory :return: """ return os.path.expanduser("~/Desktop")
5,299,796
def recurse( plugins: Iterable[Plugin], plugin_type: Type[PluginType] = Plugin, ) -> Generator[PluginType, None, None]: """Yields each plugin, recursively. Args: plugins: Plugins to iterate over. plugin_type: Type of plugin to yield. """ for plugin in plugins: if isinstance(plugin, MetaPlug...
5,299,797
def get_extra_idx(metric): """Collects the extra indexes added by Operations for the metric tree. Args: metric: A Metric instance. Returns: A tuple of column names which are just the index of metric.compute_on(df). """ extra_idx = metric.extra_index[:] children_idx = [ get_extra_idx(c) for c...
5,299,798
def test_pickled_parameterizing_string(monkeypatch): """Test pickle-ability of a formatters.ParameterizingString.""" from blessed.formatters import ParameterizingString, FormattingString # simply send()/recv() over multiprocessing Pipe, a simple # pickle.loads(dumps(...)) did not reproduce this issue, ...
5,299,799