content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def ScreenToMouse(pt): """Convert a value in screen coordinates to mouse coordinates. Mouse coordinates are specified as a percentage of screen dimensions, normalized to 16 bits. 0 represents the far left/top of the screen, 65535 represents the far right/bottom. This function assumes that the size of the s...
6b25230f87d581b9cb91bca029b68f004f413fbf
3,635,800
def triadic_closure_algorithm(): """ How to do triadic closure. """ ans = """ I would suggest the following strategy: 1. Pick a node 1. For every pair of neighbors: 1. If neighbors are not connected, then this is a potential triangle to close. This strategy gives you potential triadic closures...
2ee1ca511975f6f7d4ef0a2f55c95f70bc3a56da
3,635,801
from typing import Optional import tarfile import os import stat def _stat_to_tarinfo( base_path: str, arch_path: str, *, umask: Optional[int] = None, follow_link=True ) -> tarfile.TarInfo: """ Convert a stat_result into a TarInfo structure. """ tarinfo = tarfile.TarInfo() if follow_link: ...
3a0f42c983b3d7cee75059c044f4d24794ef016b
3,635,802
def parsed_args_gen(): """Returns a function which creates an emulated parsed_args from kwargs """ def generator(**kwargs): pdict = {} for k, v in kwargs.items(): pdict[k] = v return AttrDict(pdict) return generator
27cd56860ed4e1eca736b91b9a476b554df68512
3,635,803
def floordiv(a, b): """Compute the floordiv of two expressions. Parameters ---------- a : PrimExpr The left hand operand b : PrimExpr The right hand operand Returns ------- res : PrimExpr The result expression. """ return _ffi_api._OpFloorDiv(a, b)
9796e7c169e500c3ed7388d5f2756f3bc1fb478e
3,635,804
import typing import inspect def optional(converter: typing.Callable) -> typing.Any: """ A modified version of attrs optional decorator that supports both `None` and `MISSING` Type annotations will be inferred from the wrapped converter's, if it has any. args: converter: The convertor th...
e44d0baa06859271d9ab1e37a7f14a5bfcc452ef
3,635,805
def convert_symbol(mpl_symbol): """Convert mpl marker symbol to plotly symbol and return symbol.""" if isinstance(mpl_symbol, list): symbol = list() for s in mpl_symbol: symbol += [convert_symbol(s)] return symbol elif mpl_symbol in SYMBOL_MAP: return SYMBOL_MAP[m...
931316aa19d1292bd9905292edf3bf9117209874
3,635,806
from typing import Dict def remove_none_dict(input_dict: Dict) -> Dict: """ removes all none values from a dict :param input_dict: any dictionary in the world is OK :return: same dictionary but without None values """ return {key: value for key, value in input_dict.items() if value is not None...
3f91d653a680f0f9d842ab44cbbb9ea4142c12ab
3,635,807
def get_host(request, host_id, segment_id): """return single host """ return openstack_connection(request).get_host(host_id, segment_id)
0c214a73c302ea5acb7de98723e9520dfd56acba
3,635,808
def _GetAttachedDevices(blacklist_file, test_device): """Get all attached devices. Args: test_device: Name of a specific device to use. Returns: A list of attached devices. """ blacklist = (device_blacklist.Blacklist(blacklist_file) if blacklist_file else None) attac...
bcbba1cf2297dffc9648145ee27c9dc75d266448
3,635,809
import numpy def li_dong_2016_load_uy_profiles(): """ Load and return the y-velocity profiles (digitized from Fig. 4b). Returns ------- numpy.ndarray y positions as a 1D array of floats. numpy.ndarray y-velocity (plus x position) as a 1D array of floats. """ filepath = DA...
5847483141589c2b0cd8135ac688eb560c82cd71
3,635,810
def msg_queue_mode(params): """ Generate outgoing messages for `queue_mode_...` commands. The supported option is ``set``. Parameters ---------- params : list List of parameters of the command. The first two elements of the list are expected to be ``mode`` and ``set`` keywords. ...
b52368fdab3667e33fef010e5119c9a12a0eb63e
3,635,811
import warnings def read_tiff(path, pages=None): """ Reads in a tiff stack :param path: Full path to file :param pages: list or numpy array of pages to load :return: height x width x num_pages array of image files """ # Get number of requested pages if pages is None: num_pages...
6bc181b445cade4bd1d18f2fabb4e655af97d73b
3,635,812
import pandas import base64 import csv def parse_file_buffer_to_seldon_request(file): """ Reads file buffer and parse to seldon request. Parameters ---------- file : dict Spooled temporary file. Returns ------- dict Seldon API request Raises ------ BadReq...
4df8b477d0d3b4be0159550ebcc7a2162398e512
3,635,813
import os def is_pro(): """Check if working in PRO""" return os.environ.get("VTASKS_ENV", "False") == "True"
e193f5d6e4c24d57a2903fcb5714d5f7a8473fcb
3,635,814
def load(data_dir, config, use_feature_transform=False, numeric=False, categorical=False): """ Load specific dataset. Args: data_dir (str): path to the dataset directory. config (dict): general dict with settings. use_feature_transform (bool): apply dense feature transform or not ...
27aa0cea9bd393f860790f7fbfe7207386678f9e
3,635,815
from datahandlers.mnist_data import MNISTData as CVData from datahandlers.mnist_auto_data import MNISTAutoData as CVData from datahandlers.fashionmnist_data import FashionMNISTData as CVData from datahandlers.cifar10_data import CIFAR10Data as CVData import torchvision import datasets import torch def generate_comput...
c274245a71002d89b9b171cbd431ddbd627644bd
3,635,816
import yaml def create(client, spec: str, namespace: str = "default", timeout=100): """Create a CronJob. :batch_v1_api: The Batch V1 API object. :spec: A valid CronJob YAML manifest. :namespace: The namespace of the CronJob. :timeout: Timeout in seconds to wait for object creation/modification ...
da305d5a6af566c8dd465d191f5c842019bedff8
3,635,817
import os def pick_projects(directory): """ Finds all subdirectories in directory containing a .json file :param directory: string containing directory of subdirectories to search :return: list projects found under the given directory """ ext = '.json' subs = [x[0] for x in os.walk(directo...
577668e5f7729bb3fcfa39398b7fade9475fefbe
3,635,818
def get_expanded_types(types, type_hierarchy): """Expands a set of types with both more specific and more generic types (i.e., all super-types and sub-types).""" expanded_types = set() for type in types: # Adding all supertypes. expanded_types.update(get_type_path(type, type_hierarchy)) ...
a0f08ea1f96e960fedf1fe2a88139608a681cac1
3,635,819
import os import jinja2 def render(template, **kwargs): """Render a Jinja2 template. Parameters ---------- template : str Name of the template file (without '.template' suffix). It must be located in the directory 'pywrap/template_data'. kwargs : dict Template arguments. ...
93ea2c9bc95e4586b8f25a12b66a8c5b4d32f673
3,635,820
def inject_where(builder): """ helper function to append to the query the generated where clause :param builder: the current builder :return: """ query = builder.v.query if callable(query): return builder lower = query.lower() where = lower.find(' where ') before = -1 for before_q in [' group ...
78682f5c3712ffcb9e96a8c7c624d6f0177884ec
3,635,821
import colorsys def loadCPT(path): """A function that loads a .cpt file and converts it into a colormap for the colorbar. This code was adapted from the GEONETClass Tutorial written by Diego Souza, retrieved 18 July 2019. https://geonetcast.wordpress.com/2017/06/02/geonetclass-manipulating-goes-16-d...
3af8c564899c89afb3d6a4cc87ac90009526b2a4
3,635,822
def main(): """ The main function to execute upon call. Returns ------- int returns integer 0 for safe executions. """ print("Program to find the character from an input ASCII value.") ascii_val = int(input("Enter ASCII value to find character: ")) print("\nASCII {asci} ...
45bec0eb658cc17005b97e6fa812c806f5b77440
3,635,823
import random def get_random_greeting(): """ Return random greeting message. """ return random.choice(GREETINGS)
89d4a93105ffe1a241730088388eaf4ffeff71da
3,635,824
def dyad_completion(w): """ Return the dyadic completion of ``w``. Return ``w`` if ``w`` is already dyadic. We assume the input is a tuple of nonnegative Fractions or integers which sum to 1. Examples -------- >>> w = (Fraction(1,3), Fraction(1,3), Fraction(1, 3)) >>> dyad_complet...
3631e4db62607e18a22e652009747f25a8a585c7
3,635,825
def create_pv_string_points(x_coord: float, y_coord: float, string_width: float, string_height: float ) -> [Polygon, np.ndarray]: """ :param x_coord: :param y_coord: :param string_width: ...
212e666efa51d60fcf29da4afbbff498d6d94197
3,635,826
def phasor(H): """ Caculate phasor values from given histogram g = 1 / N * sum(H * cos(f)) s = 1 / N * sum(H * sin(f)) =========================================================================== Input Meaning ---------- --------------------------------------------------------------- ...
4034ec4e9a35c2792bd52a860ba61c729b80dcba
3,635,827
def if_stmt(cond, body, orelse): """Functional form of an if statement. Args: cond: Boolean. body: Callable with no arguments, and outputs of the positive (if) branch as return type. orelse: Callable with no arguments, and outputs of the negative (else) branch as return type. Returns...
88db6bacfca094e94c8cec165e871127f8498175
3,635,828
import os def download_file(save_dir, filename, url, md5=None): """ Download the file from the url to specified directory. Check md5 value when the file is exists, if the md5 value is the same as the existed file, just use the older file, if not, will download the file from the url. Args: ...
9b0d0e4a19a8347bff7f2288eda402dccbe91e88
3,635,829
def load_db(DB_Filename, ValueType, ValueColumnIdx, KeyColumnIdx): """Loads a database contained in file 'DB_Filename'. Creates a python dictionary that maps from a string (contained in column KeyColumnIdx) to a number set or a single number (contained in column ValueColumnIdx). NOTE: The 'key...
3291b3230a6b18945f26b16675d6d6fc27baba53
3,635,830
def createFoodObject(dataset, row): """ Create food URI and triples related to food properties """ food_onto_term = str(row['Food Ontology Term']) food_label = row['Food'] food_type = row['NEW Food Type'] food_amount = row['NEW Food Matrix'] food_source = food_amount.split('\n')[0].repla...
686ab766c7341e538741e20b0f70a32215db6daa
3,635,831
from re import T def business(): """ RESTful CRUD controller """ def rheader_table(r): if r.record: return TABLE( TR( TH("%s: %s" % (T("Name"), r.record.business_name)), TH("%s: %s %s" % (T("Address"), ...
c7b237196f4a614327b54fd4b53950aa16d18331
3,635,832
from pathlib import Path def points_from_svg(svg_file_path): """ Takes a SVG file as an input and returns a list of points in the complex plane from its path. """ # Read SVG into a list of curves. paths, attributes = svg2paths(svg_file_path) curves = paths[0] # Get a list of the coordinates from...
a3fe434cda819b6c15f5ef3e854ab99455b879b6
3,635,833
from typing import List from typing import Callable from typing import Optional import functools import operator def cluster_mols( mols: List[Chem.rdchem.Mol], cutoff: float = 0.2, feature_fn: Callable = None, n_jobs: Optional[int] = 1, ): """Cluster a set of molecules using the butina clustering ...
f38425183f42a994ba158a37a8b86463b7bf784d
3,635,834
import os import shutil import re import fileinput import sys def match_depends(module): """ Check for matching dependencies. This inspects spell's dependencies with the desired states and returns 'False' if a recast is needed to match them. It also adds required lines to the system-wide depends file...
f77123097bfdd23fac0f1f7604b5a7d3ac6fee1b
3,635,835
from typing import Optional from typing import Tuple def reshape_shuffle_ctg(fhr: np.array, uc: np.array, y: np.array, time: Optional[np.array]) -> Tuple[np.array, np.array, np.array, Optional[np.array], Optional[np.array]]: """ Reshape and optionally shuffle inputs and targets for the keras/tf input in model...
5986d80fb31dbe87e7d4f65f750a2ff6d77cf27a
3,635,836
from typing import Optional from typing import Tuple import requests def do_project(project: str) -> Optional[Tuple[str, str, str]]: """ Query Anitya and zypper for current version. """ max_version = None prog_id = anitya_find_project_id(proj_name=project) if prog_id: res = requests.ge...
0011b617453a3358ce30c2d13a9c4cb0492d090e
3,635,837
def save_channel_videoid(channel_id: str, video_id: str): """儲存單個影片ID與頻道ID Args: channel_id (str): [channel_id] video_id (str): [video_id] Returns: [bool]]: [suss/fail] """ schemas = { "video_id": video_id, "channel_id": channel_id } play_list_model ...
f3c1c59cb5ff8f540335480b075fa4b6889e7733
3,635,838
def mark_point(mark_point=None, **kwargs): """ :param mark_point: 标记点,有'min', 'max', 'average'可选 :param kwargs: :return: """ return _mark(mark_point, **kwargs)
21287c07e77f69ce672ef1371225fad7f357277d
3,635,839
def get_keys(opts): """Gets keys from keystore and known-hosts store""" hosts = KnownHostsStore() serverkey = hosts.serverkey(opts.vip_address) key_store = KeyStore() publickey = key_store.public secretkey = key_store.secret return {"publickey": publickey, "secretkey": secretkey, ...
668447b134201e2b68e982d9cdf6219cb578dfff
3,635,840
def _get_model_ptr_from_binary(binary_path=None, byte_string=None): """Returns a pointer to an mjModel from the contents of a MuJoCo model binary. Args: binary_path: Path to an MJB file (as produced by MjModel.save_binary). byte_string: String of bytes (as returned by MjModel.to_bytes). One of `binary...
a2aede03e3e137596bd8de689aad69272749d884
3,635,841
from typing import List def emulate_decoding_routine(vw, function_index, function: int, context, max_instruction_count: int) -> List[Delta]: """ Emulate a function with a given context and extract the CPU and memory contexts at interesting points during emulation. These "interesting points" include c...
e663e3ce225fe5603a7debabb22ef9614f0a74ac
3,635,842
def probs_to_costs(costs, beta=.5): """ Transform probabilities to costs (in-place) """ p_min = 0.001 p_max = 1. - p_min costs = (p_max - p_min) * costs + p_min # probabilities to costs, second term is boundary bias costs = np.log((1. - costs) / costs) + np.log((1. - beta) / beta) return...
77307ef656a8146286028d957d0bed64cda01a17
3,635,843
def requires_ids_or_filenames(method): """ A decorator for spectrum library methods that require either a list of Ids or a list of filenames. :param method: A method belonging to a sub-class of SpectrumLibrary. """ def wrapper(model, *args, **kwargs): have_ids = ("ids" in kwargs) a...
df4cb705f11567e8e5a23da730aead8e7c90f378
3,635,844
from typing import List from typing import Tuple import requests import fnmatch def _list_nsrr( db_slug: str, subfolder: str = '', pattern: str = '*', shallow: bool = False, ) -> List[Tuple[str, str]]: """ Recursively list filenames and checksums for a dataset. Specify a subfolder and/or ...
7c0dbf352046245b189266435a4408ed739d99dd
3,635,845
def red(): """ Returns the red RGB tensor Returns ------- Tensor the (1,3,) red tensor """ return color2float(Uint8Tensor([237, 28, 36]))
7c627c88ca34f8b54f54711dfdf8a9b0301daa8b
3,635,846
from io import StringIO def get_temporary_text_file(contents, filename): """ Creates a temporary text file :param contents: contents of the file :param filename: name of the file :type contents: str :type filename: str """ f = StringIO() flength = f.write(contents) text_file =...
7b29cb3b7bf09e78f24574555acfb24784dd9ccb
3,635,847
import sys def print_wf_integrity_stats(stats, workflow_id, dax_label, fmt): """ Prints the integrity statistics of workflow stats : workflow statistics object reference workflow_id : UUID of workflow dax_label : Name of workflow format : Format of report ('text' or 'csv') """...
f244d4c47e86ae7ad8d0448fa688fdaaf893b4d4
3,635,848
def build_dynamic_focal_key_loss(task_cfgs): """According to "Dynamic Task Prioritization for Multitask Learning" by Michelle Guo et al.""" losses = {} for task_cfg in task_cfgs: name = task_cfg['name'] losses[name] = build_dynamic_focal_key_task(task_cfg) return WeightModule(losses...
0b687461fea2cc73bf8671e1a1e97a32a422103c
3,635,849
from typing import Tuple from typing import Dict from typing import Union from typing import Optional import glob def settings_from_task_id( task_id: int, inj_data_path: str = "./data_raw_injections/task_files/", ) -> Tuple[str, Dict[str, Union[str, Optional[Dict[str, str]], bool, int]], int]: """Returns ...
ccf3a49934b63c561ee76e3cde837fb9f8ae1fcf
3,635,850
import io import tokenize def remove_comments_and_docstrings(source): """ Returns *source* minus comments and docstrings. .. note:: Uses Python's built-in tokenize module to great effect. Example:: def noop(): # This is a comment ''' Does nothing. ''' ...
ffd185fc2517342e9eb0e596c431838009befde5
3,635,851
def get_arg_loc(callingconvention: str, bytecounter: int, size: int) -> str: """Return a string that denotes the location of a given function argument.""" index = bytecounter // 4 if index < 0: raise Exception( "Argument index cannot be smaller than zero: " + str(index)) if callingc...
fffd44a5d47e28fd571ee05a8332a570c24ddf95
3,635,852
import pathlib import tqdm def alignments_pass(alignments: pathlib.Path) -> Alignments: """Peform a single pass on all alignments to calculate meta information.""" meta = Alignments() for speaker in tqdm(list(alignments.glob("*")), desc="Alignment Pass"): # To ignore hidden files etc. i...
bf5068e9fae3b3ae21188c7a76fb21b91045e465
3,635,853
def BRepBlend_HCurve2dTool_Intervals(*args): """ :param C: :type C: Handle_Adaptor2d_HCurve2d & :param T: :type T: TColStd_Array1OfReal & :param S: :type S: GeomAbs_Shape :rtype: void """ return _BRepBlend.BRepBlend_HCurve2dTool_Intervals(*args)
7443a54617ebec6602521ed2e7cb765845972e46
3,635,854
import itertools def get_block_objects(disasm, nodes, func_addr): """ Get a list of objects to be displayed in a block in disassembly view. Objects may include instructions, stack variables, and labels. :param angr.analyses.Disassembly disasm: The angr Disassembly Analysis instance. :param ite...
400e1ae5a42bfcb24bd66a6b301504efefc04619
3,635,855
def new_lunar_system_in_time(time_JD=2457099.5|units.day): """ Initial conditions of Solar system -- particle set with the sun + eight moons, at the center-of-mass reference frame. Defined attributes: name, mass, radius, x, y, z, vx, vy, vz """ time_0 = 2457099.5 | units.day delta_JD = time_JD-time_...
7380e3b3f56c065865fbe64c1841a59851298113
3,635,856
import os def read_annot(fname): """Read a Freesurfer annotation from a .annot file. Note : Copied from nibabel Parameters ---------- fname : str Path to annotation file Returns ------- annot : numpy array, shape=(n_verts) Annotation id at each vertex ctab : numpy ...
af9a0c535b9ed001b0fe9493e5d582d7db080e8a
3,635,857
import copy def overlap3(data): """ """ # dataC = copy.copy(data) temp = [[] for i in range(0, 12)] index = int(dataC[0][0][5 : 7]) for x in dataC: temp[(index % 12) - 1].append(x[1:]) index += 1 final = [] for x in temp: final.append(np.array(x)) r...
7baeb8bf5741b75262ca329b91e3a8625a5ad61c
3,635,858
def gen_qsub_script(exp, run_type): """Populate qsub script with settings""" reps = {} qsub_path = '' if config.is_cp_job(run_type): reps = gen_cp_qsub_constants(exp, run_type) else: reps = gen_mask_qsub_constants(exp, run_type) qsub_script = '' qsub_template_path = config.get_template_qsub(run...
66c7cf39512a0dfe8c1f7d62ed9542560eb0f927
3,635,859
import torch def quat_diff_rad(a: torch.Tensor, b: torch.Tensor) -> torch.Tensor: """ Get the difference in radians between two quaternions. Args: a: first quaternion, shape (N, 4) b: second quaternion, shape (N, 4) Returns: Difference in radians, shape (N,) """ b_conj...
fe6d63dbe1b0bfc4d834af18e2260032ea405e25
3,635,860
def PairsMerging(xIn: list): """ Recursive function for merging pairs formed at the first step Parameters ---------- xIn : list xIn - input list containing pairs of subarrays for sorting. Returns ------- Merged pair. """ # print(xIn,"input array for Pairs Merging") # De...
83e2c36c2eb77b9acdfa6390bb79467dc5b788c7
3,635,861
def generate_dataset_db( connection_string: str, file_name: str, include_null: bool ) -> str: """ Given a database connection string, extract all tables/fields from it and write out a boilerplate dataset manifest, excluding optional null attributes. """ db_engine = get_db_engine(connection_strin...
e80c43f98c608e63c61cda50d952bd13fded4bce
3,635,862
def salt(secret: str) -> str: """A PBKDF salt.""" return sha256(secret.encode("utf-8")).hexdigest()
edbbf13dd4ce72c8bdaf272267de13704ce9930e
3,635,863
async def async_get_service( hass: HomeAssistant, config: ConfigType, discovery_info: DiscoveryInfoType | None = None, ) -> KNXNotificationService | None: """Get the KNX notification service.""" if not discovery_info or not discovery_info["platform_config"]: return None platform_config ...
9ffb1c0f2736dfde2aca18a73648c99f43c8d0f6
3,635,864
import re import warnings from sys import base_prefix def docx_to_df(file_path): """ Convert docx file to dataframe Parameters ---------- file_path : str A file path of documnet Returns ------- dataframe speech | transcript_filepath | id | transcriber_id | wave_filep...
7a1a73ad12d5ec4a9e4f3ef367a8a282d6999819
3,635,865
def _is_referenced_by_a_stack_frame_name(referrers, obj, name): """ Is there a reference among the given referrers, that is a stack frame, which contains a local variable of the given name, which points to the object of interest? :param referrers: The references to scan. :param obj: The object o...
c8ba5fcffc407d52a672b0ab9d95217c2886747c
3,635,866
from .py4cytoscape_utils import node_name_to_node_suid from .py4cytoscape_utils import edge_name_to_edge_suid def get_table_value(table, row_name, column, namespace='default', network=None, base_url=DEFAULT_BASE_URL): """Retrieve the value from a specific row and column from node, edge or network tables. Arg...
6ad91abd6c7d5bb2db735b2d1f30e8d3c2dc152f
3,635,867
def prettify_name_tuple(tup): """ Processes the intersect tuples from the steam API. """ res = [] for name in tup: res.append(name.split("_")[0]) return ", ".join(res)
68d9e7170f02cf4a5de434806e7abcd99e5a77e7
3,635,868
def init_repository(path, bare=False, flags=C.GIT_REPOSITORY_INIT_MKPATH, mode=0, workdir_path=None, description=None, template_path=None, initial_head=None, origin_url=None): """ Creates a new Git repository in the given *path*. If *bare* is True the repository will be bare, i.e....
1660cf767ddc393506d461d5c029f2f408c4b6de
3,635,869
def carrington_rotation_number_relative(time, lon): """ A function that returns the decimal carrington rotation number for a spacecraft position that may not be at the same place at earth. In this case you know the carrington longitude of the spacecraft, and want to convert that to a decimal carrington ...
b771ba70edca7b546605cfede35053dabb3717bf
3,635,870
import os import sys def wrap_elasticluster(args): """Wrap elasticluster commands to avoid need to call separately. - Uses .bcbio/elasticluster as default configuration location. - Sets NFS client parameters for elasticluster Ansible playbook. Uses async clients which provide better throughput on r...
1288510358305caea3f69656e0576d06c8c2f837
3,635,871
def deproject(center,depth,K,pose=None): """ center.shape = [1,2] depth.shape = [1,1] K.shape = [3,3] """ out_gt = center * depth out_gt = np.concatenate((out_gt, depth), 1) # out_gt = [1,3] inv_K = np.linalg.inv(K.T) xyz = np.dot(out_gt, inv_K) return xyz
62a996fc00453e9541a64c05c84b88fe316fa08e
3,635,872
import requests def get_branches(repo_id: str): """ Gets the branches from desired repository. :param repo_id: repo id :return: list(dict) """ branches = requests.get(url=BRANCHES_API_URL.format(repo_id), headers=HEADER).json() return [parse_branch(branch) for branch in branches]
80a8f84c6652ab63bdf11a5daa0447d4c60d7443
3,635,873
def lfs_cart_portlet(context, title=None): """Tag to render the cart portlet. """ if title is None: title = _(u"Cart") portlet = CartPortlet() portlet.title = title return { "html": portlet.render(context) }
2791272ccc3ed3a0e38deb0f153e82c6528bbbb7
3,635,874
def test_declarative_barb_gfs_knots(): """Test making a contour plot.""" data = xr.open_dataset(get_test_data('GFS_test.nc', as_file_obj=False)) barb = BarbPlot() barb.data = data barb.level = 300 * units.hPa barb.field = ['u-component_of_wind_isobaric', 'v-component_of_wind_isobaric'] barb...
d4bb384802460354a93514c8be70fb699e16f481
3,635,875
from typing import Iterable def new(entities: Iterable[DXFEntity] = None, query: str = "*") -> EntityQuery: """Start a new query based on sequence `entities`. The `entities` argument has to be an iterable of :class:`~ezdxf.entities.DXFEntity` or inherited objects and returns an :class:`EntityQuery` object...
37b65767ec61c319da09518d438b7bc791f659c9
3,635,876
def create_pydot_graph(op_nodes, data_nodes, param_nodes, edges, rankdir='TB', styles=None): """Low-level API to create a PyDot graph (dot formatted). """ pydot_graph = pydot.Dot('Net', graph_type='digraph', rankdir=rankdir) op_node_style = {'shape': 'record', 'fillcolor': '#6495ED...
2b15ef833ef968d752ecbc19e705facac2038255
3,635,877
import requests def info_session(request, session_type): """Information session request form.""" if not SESSION_TYPES.get(session_type): raise Http404 if request.method == 'POST': form = InfoSessionForm(session_type, request.POST) if form.is_valid(): cd = form.cleaned_d...
028d2832d728b4569473cd5b010c8da25d3717bf
3,635,878
def transform_frame(frame, transformation_matrix): """ transform the selected region to bird's eye view :param frame: the original image :param transformation_matrix: the transformation matrix :return: the image after transform, width scale, and height scale """ rows, cols, _ = frame.shape ...
4652c855b29c17a208e4d7d054a7090fa82a6181
3,635,879
def _annotation_dict_all_filter(data, query): """Match edges with the given dictionary as a sub-dictionary. :param dict data: A PyBEL edge data dictionary :param dict query: The annotation query dict to match :rtype: bool """ annotations = data.get(ANNOTATIONS) if annotations is None: ...
bd71eaa995242afbad3c158874cf86bb1708d7c3
3,635,880
def split_storm_info(storm_list): """split_storm_info takes a list of strings and creates a pandas dataframe for the data set taken off the NHC archive. This function is called in the main to find all storms.""" name, cycloneNum, year, stormType, basin, filename = [], [], [], [], [], [] for line in...
fe41e6cf6dfa3d4be1c5549bd29284d0a29a5d90
3,635,881
import sys def open_file(file_name): """ Opens a comma separated CSV file Parameters ---------- file_name: string The path to the CSV file. Returns: -------- Output: the opened file """ # Checks for file not found and perrmission errors try: f = open(file_n...
21e3abe90fbfb169568ef051fa3f130cc7f1315a
3,635,882
def linear_inshape(module_masks, mask): """ Coarse grained input mask does not change the shape of weights and output tensor Parameters ---------- module_masks : ModuleMasks The ModuleMasks instance of the linear mask : CoarseMask The mask of its input tensor Returns --...
51661e74575fe2b924ce6fa4a67c4b47ee53ea99
3,635,883
def test_enable_8021q_3(monkeypatch): """Verify that enable_802q_1 function return exception if 8021q can not be loaded. """ cmd_list = [] def mockreturn(command): cmd_list.append(command) so = "8021q" if command == "lsmod | grep ^8021q": so = "" return CmdS...
f1cf3e6679d1d3c1bb8a25ff2873ae787164cb7d
3,635,884
def prep_data_for_feature_gen(data): """Restructure OANDA data to use it for TA-Lib feature generation""" inputs = { 'open': np.array([x['openMid'] for x in data]), 'high': np.array([x['highMid'] for x in data]), 'low': np.array([x['lowMid'] for x in data]), 'close': np.array([x[...
a9666a24486e19196c2c13ebd198675207fc8d32
3,635,885
def matriz_krylov(A, x, n_iters=None): """Genera una matriz de krylov dada una matriz A y un vector x. Cada columna de la matriz es la iteración i de A^i*x. Args: A (matriz): Matriz de aplicación x (vector): Vector base n_iters (int, optional): Número de iteraciones. Por defecto es el n...
5463ca2db8d1d638f5ef7ab0ee258416dceccd62
3,635,886
def test_case_result_score(answers, user_test_id): """ Calculate result score for test. Check every user's answer (check_answer), calculate number of correct answers. @param answers: dict of pairs question_id and list of answers. @param user_test_id: UserTestCase object id --> int @return: res...
1d4efae6f50a5d9cc4ed655e47056d066c53abac
3,635,887
def AtensDeltaV(df): """Delta V calculation for Atens asteroids, where a < 1.""" df['ut2'] = 2 - 2*np.cos(df.i/2)*np.sqrt(2*df.Q - df.Q**2) df['uc2'] = 3/df.Q - 1 - (2/df.Q)*np.sqrt(2 - df.Q) df['ur2'] = 3/df.Q - 1/df.a - ( (2/df.Q)*np.cos(df.i/2)*np.sqrt(df.a*(1-df.e**2)/df.Q)) return df
6996a921020b8474dc119c0384062288d1d138b7
3,635,888
from pypy.interpreter import gateway def init__builtin__(space): """NOT_RPYTHON""" ##SECTION## ## filename '<codegen /Users/steve/Documents/MIT TPP/2009-2010/6.893/project/pypy-dist/pypy/interpreter/gateway.py:824>' ## function 'pypy_init' ## firstlineno 2 ##SECTION## # global declarations # global object g3...
c583fd15c33aeefddf67116aff63b30d26edb366
3,635,889
import scipy import numpy def CalculateXuIndex(mol): """ ################################################################# Calculation of Xu index ---->Xu Usage: result=CalculateXuIndex(mol) Input: mol is a molecule object Output: resul...
0123f3ea82bb89ef7923e7f1638aafd8fbfe9fb0
3,635,890
def register_dataclass(registry: ServiceRegistry, target, for_, context=None): """ Generic injectory factory for dataclasses """ # Note: This function could be a decorator which already knows # the registry, has all the targets, and can do them in one # container that it makes. For example: # from ...
50453755c6c132cf4cf38fd727935c306dc7082d
3,635,891
async def async_setup_entry(hass, config_entry): """Set up the UniFi component.""" if DOMAIN not in hass.data: hass.data[DOMAIN] = {} controller = UniFiController(hass, config_entry) controller_id = get_controller_id_from_config_entry(config_entry) hass.data[DOMAIN][controller_id] = contr...
52c4409532c10899a9b9b621b762bf92b3a58b59
3,635,892
import os def file_to_dataframe(file_id, compression='infer', client=None, **read_kwargs): """Load a :class:`~pandas.DataFrame` from a CSV stored in a Civis File The :class:`~pandas.DataFrame` will be read directly from Civis without copying the CSV to a local file on disk. Par...
c675602890c94dcf549d4235be50a5662151ed72
3,635,893
from typing import Union from typing import Optional import warnings def dataset_to_xy( dataset: Dataset, target_columns: Union[str, list], qid_column: Optional[str], ): """Convert Merlin Dataset to XGBoost DMatrix""" df = dataset.to_ddf() qid = None if qid_column: df = df.sort_va...
201e5bf5513f35bd683bfad7bcf4ecb8b255cd93
3,635,894
def clean_data(df): """Clean data included in the DataFrame and transform categories part INPUT df -- type pandas DataFrame OUTPUT df -- cleaned pandas DataFrame """ categories = df['categories'].str.split(pat=';', expand=True) row = categories.loc[0] colnames = [] for entry in r...
40319f0f739e532bd559f14c70d988b7257c6fa3
3,635,895
def compute_timeline(agents, ts_tuple, dep_ivs): """ Compute the timeline of events that can occur in the field. Given the departure intervals of the agents, this function computes a common timeline of events that captures all possible occurances of events in the field. Parameters ---------- agents: A list ...
12d99be139a4327552231dc2802d165d114139fe
3,635,896
import unittest def test_suite(): """Test suite including all test suites""" testSuite = unittest.TestSuite() testSuite.addTest(test_randomdata.test_suite()) return testSuite
8ac9cfcfebf9255f2cab01db9d4a1a53a3d24871
3,635,897
def eHealthClass_setupPulsioximeterForNextReading(): """eHealthClass_setupPulsioximeterForNextReading()""" return _ehealth.eHealthClass_setupPulsioximeterForNextReading()
d48cfd85752a75ca27e33794e18058a89f03a291
3,635,898
import scipy def hist_argmaxima2(hist, maxima_thresh=.8): """ must take positive only values Setup: >>> # ENABLE_DOCTEST >>> from vtool_ibeis.histogram import * # NOQA GridSearch: >>> hist1 = np.array([1, .9, .8, .99, .99, 1.1, .9, 1.0, 1.0]) >>> hist2 = np.array([1,...
4d7e3cf343f9604389d39c82c69c0f0eeb59a383
3,635,899