content
stringlengths
22
815k
id
int64
0
4.91M
def pre_search(cs, term, planlove): """ This hook is called before a (quicklove or regular) search, and is passed the same arguments as is the search function: - the search ``term`` - ``planlove``, a boolean of whether to restrict search to planlove. """ pass
5,350,600
def dequote(str): """Will remove single or double quotes from the start and end of a string and return the result.""" quotechars = "'\"" while len(str) and str[0] in quotechars: str = str[1:] while len(str) and str[-1] in quotechars: str = str[0:-1] return str
5,350,601
def uccsd_singlet_paramsize(n_qubits, n_electrons): """Determine number of independent amplitudes for singlet UCCSD Args: n_qubits(int): Number of qubits/spin-orbitals in the system n_electrons(int): Number of electrons in the reference state Returns: Number of independent paramete...
5,350,602
def test_bq27546_exists(): """ Command: ls -l /sys/class/power_supply/bq27546-0 Results: Exit code 0 if valid Exit code 127 if no such file or directory """ resp = run_command( ["ls", "-l", "/sys/class/power_supply/bq27546-0"], return_exit_values=True ) assert resp ...
5,350,603
def create_topic_rule_destination(destinationConfiguration=None): """ Creates a topic rule destination. The destination must be confirmed prior to use. See also: AWS API Documentation Exceptions :example: response = client.create_topic_rule_destination( destinationConfiguration={ ...
5,350,604
def variance(timeseries: SummarizerAxisTimeseries, param: dict): """ Calculate the variance of the timeseries """ v_mean = mean(timeseries) # Calculate variance v_variance = 0 for ts, value in timeseries.values(): v_variance = (value - v_mean)**2 # Average v_variance = len(timeseries.values) i...
5,350,605
def mutate_bone_length(population, opt, gen_idx, method='simple'): """ Randomly mutate bone length in a population to increase variation in subject size. For example, H36M only contains adults yet you can modify bone length to represent children. Since the posture and subject size are indepen...
5,350,606
def test_radial_velocity1(): """ Put a central at (5, 5, 5) in a box WITHOUT periodic boundary conditions, with the central moving in the direction (3, 0, 0). Place all satellites at the point (6, 5, 5), moving in the direction (2, 0, 0), i.e., in the negative radial direction that is aligned with the x...
5,350,607
def setup_i2c_sensor(sensor_class, sensor_name, i2c_bus, errors): """ Initialise one of the I2C connected sensors, returning None on error.""" if i2c_bus is None: # This sensor uses the multipler and there was an error initialising that. return None try: sensor = sensor_class(i2c_bus...
5,350,608
def argparse_textwrap_unwrap_first_paragraph(doc): """Join by single spaces all the leading lines up to the first empty line""" index = (doc + "\n\n").index("\n\n") lines = doc[:index].splitlines() chars = " ".join(_.strip() for _ in lines) alt_doc = chars + doc[index:] return alt_doc
5,350,609
def iterator(x, y, z, coeff, repeat, radius=0): """ compute an array of positions visited by recurrence relation """ c_iterator.restype = ctypes.POINTER(ctypes.c_double * (3 * repeat)) start = to_double_ctype(np.array([x, y, z])) coeff = to_double_ctype(coeff) out = to_double_ctype(np.zeros(3 * rep...
5,350,610
def test_baked_django_docs_with_how_to_index(cookies): """Test Django docs how-to index template file has been generated correctly.""" default_django = cookies.bake() index_path = default_django.project_path / "docs/source/how-tos/index-how-to.rst" index_file = index_path.read_text().splitlines() ...
5,350,611
def open_pep( search: str, base_url: str = BASE_URL, pr: int | None = None, dry_run: bool = False ) -> str: """Open this PEP in the browser""" url = pep_url(search, base_url, pr) if not dry_run: import webbrowser webbrowser.open_new_tab(url) print(url) return url
5,350,612
def default_build_component(): """ Builds the component artifacts and recipes based on the build system specfied in the project configuration. Based on the artifacts specified in the recipe, the built component artifacts are copied over to greengrass component artifacts build folder and the artifact ur...
5,350,613
def random_sparse_matrix(n, n_add_elements_frac=None, n_add_elements=None, elements=(-1, 1, -2, 2, 10), add_elements=(-1, 1)): """Get a random matrix where there are n_elements.""" n_total_elements = n * n n_diag_elements = n fra...
5,350,614
def is_uuid_like(val): """Returns validation of a value as a UUID. :param val: Value to verify :type val: string :returns: bool .. versionchanged:: 1.1.1 Support non-lowercase UUIDs. """ try: return str(uuid.UUID(val)).replace("-", "") == _format_uuid_string(val) except ...
5,350,615
def is_positive_integer(value: str) -> int: """ Helper function for argparse. Raise an exception if value is not a positive integer. """ int_value = int(value) if int_value <= 0: raise argparse.ArgumentTypeError("{} is not a positive integer".format(value)) return int_value
5,350,616
def merge_overlapped_spans(spans: List[Tuple[int, int]]) -> List[Tuple[int, int]]: """ Merge overlapped spans Parameters ---------- spans: input list of spans Returns ------- merged spans """ span_sets = list() for span in spans: span_set = set(range(span[0], span[...
5,350,617
def network(dataframe, author_col_name, target_col_name, source_col_name=None): """ This function runs a Network analysis on the dataset provided. :param dataframe: DataFrame containing the data on which to conduct the activity analysis. It must contain at least an *author*, a *target* and a *sourc...
5,350,618
def get_cert_and_update_domain( zappa_instance, lambda_name, api_stage, domain=None, manual=False, ): """ Main cert installer path. """ try: create_domain_key() create_domain_csr(domain) get_cert(zappa_instance) create_chained_certificate() w...
5,350,619
def _ww3_ounp_contents(run_date, run_type): """ :param str run_type: :param run_date: :py:class:`arrow.Arrow` :return: ww3_ounp.inp file contents :rtype: str """ start_date = ( run_date.format("YYYYMMDD") if run_type == "nowcast" else run_date.shift(days=+1).format("...
5,350,620
def combine_votes(votes_files, to_prediction, to_file, method=0, prediction_info=NORMAL_FORMAT, input_data_list=None, exclude=None): """Combines the votes found in the votes' files and stores predictions. votes_files: should contain the list of file names to_predic...
5,350,621
def EMLP(rep_in,rep_out,group,ch=384,num_layers=3): """ Equivariant MultiLayer Perceptron. If the input ch argument is an int, uses the hands off uniform_rep heuristic. If the ch argument is a representation, uses this representation for the hidden layers. Individual layer representations ca...
5,350,622
def decompress(data): """ Decompress data in one shot. """ return GzipFile(fileobj=BytesIO(data), mode='rb').read()
5,350,623
def str_to_rgb(arg): """Convert an rgb string 'rgb(x,y,z)' to a list of ints [x,y,z].""" return list( map(int, re.match(r'rgb\((\d+),\s*(\d+),\s*(\d+)\)', arg).groups()) )
5,350,624
def divide_tarball(tarball: tarData, num: int) -> None: """Subdivide 'tarball' into 'num' tarballs. Will create 'num' new tarballs in current directory. Each tarball will have this format: "1.tar", "2.tar", etc. """ #TODO, direct output tarballs to tars/ dir # refactor to retu...
5,350,625
def vshift(x, shifts=0): """shift batch of images vertically""" return paddle.roll(x, int(shifts*x.shape[2]), axis=2)
5,350,626
def index(): """Shows book titles and descriptions""" tagid = request.query.tagid books = [] if tagid: try: tag = Tag.get(tagid) books = tag.books.all() except Tag.DoesNotExist: pass if not books: books = Book.all().order_by("title") return dict(books=book...
5,350,627
def delete_file(sender, instance, **kwargs): """ This function deletes the associated file from the file storage when it's instance is deleted from the database """ file_path = instance._file.path if os.path.exists(file_path): os.remove(file_path)
5,350,628
def _GetExternalDataConfig(file_path_or_simple_spec, use_avro_logical_types=False, parquet_enum_as_string=False, parquet_enable_list_inference=False): """Returns a ExternalDataConfiguration from the file or specification string. Deter...
5,350,629
def _linux_iqn(): """ Return iSCSI IQN from a Linux host. """ ret = [] initiator = "/etc/iscsi/initiatorname.iscsi" try: with salt.utils.files.fopen(initiator, "r") as _iscsi: for line in _iscsi: line = line.strip() if line.startswith("Initiat...
5,350,630
def getAndSaveDocuments(base_url, delay=None): """Get and save meta and object XML from node :param delay: Delay, in seconds, between getting documents. :output Subdirectories of the folder `result`, in the form of `result/{NODE_IDENTIFIER}/{INDEX}-{meta-object}.xml` """ sampled_documents_filepath = getScri...
5,350,631
def generate_file_storage_name(file_uri: str, suffix: str) -> str: """ Generate a filename using the hash of the file contents and some provided suffix. Parameters ---------- file_uri: str The URI to the file to hash. suffix: str The suffix to append to the hash as a part of the...
5,350,632
def mullerlyer_parameters(illusion_strength=0, difference=0, size_min=0.5, distance=1): """Compute Parameters for Müller-Lyer Illusion. Parameters ---------- illusion_strength : float The strength of the arrow shapes in biasing the perception of lines of unequal lengths. A positive sign ...
5,350,633
def filter_for_corsi(pbp): """ Filters given dataframe for goal, shot, miss, and block events :param pbp: a dataframe with column Event :return: pbp, filtered for corsi events """ return filter_for_event_types(pbp, {'Goal', 'Shot', 'Missed Shot', 'Blocked Shot'})
5,350,634
def challenges(ctx): """ Challenges and related options. """ if ctx.invoked_subcommand is None: welcome_text = """Welcome to the EvalAI CLI. Use evalai challenges --help for viewing all the options.""" echo(welcome_text)
5,350,635
def plot_spectra( spectra: Sequence[Spectrum], style: str, ax: Axes, labels: ITER_STR = None, colors: ITER_STR = None, alphas: ITER_FLOAT = None, markers: ITER_STR = None, linestyles: ITER_STR = None, linewidths: ITER_FLOAT = None, peaks: dict | bool = False, ): """ Plot ...
5,350,636
def upload(msg: Dict, public_key: bytes, ipns_keypair_name: str = '') -> Tuple[str, str]: """Upload encrypted string to IPFS. This can be manifest files, results, or anything that's been already encrypted. Optionally pins the file to IPNS. Pass in the IPNS key name To get IPNS key name, see ...
5,350,637
async def test_prefer_master(): """ If we ask the discoverer to prefer_master it should return a master node before returning a replica. """ discoverer = get_discoverer(None, None, "10.0.0.1", 2113, prefer_master) gossip = data.make_gossip("10.0.0.1", "10.0.0.2") with aioresponses() as mock...
5,350,638
def test_add_key_fails_bad_key(): """Test that 'aea add-key' fails because the key is not valid.""" oldcwd = os.getcwd() runner = CliRunner() agent_name = "myagent" with tempfile.TemporaryDirectory() as tmpdir: with mock.patch.object(aea.crypto.helpers.logger, "error") as mock_logger_error: ...
5,350,639
def test_sakai_auth_url(oauth_mock): """ Test auth url retrieval for Sakai. Test that we can retrieve a formatted Oauth1 URL for Sakai """ def mock_fetch_token(mock_oauth_token, mock_oauth_token_secret): def mock_token_getter(mock_url): return { 'oauth_token': mo...
5,350,640
def main(test_package_path, test_package, args): """Command line dialogs for creating a new file This method checks ``args`` for optional arguments for each of its prompts. If these are set to something other than ``None``, their corresponding input prompts will be skipped unless validation for that pa...
5,350,641
def cteRoster(*args, **keywords): """ Dynamic library stub function """ pass
5,350,642
def nodes_and_groups(expr: Expression) -> Tuple[List[Expression], Iterable[List[int]]]: """ Returns a list of all sub-expressions, and an iterable of lists of indices to sub-expressions that are equivalent. Example 1: (let (x 3) add ( (let (z 3) (add z (add x x))) ...
5,350,643
def masterxprv_from_electrummnemonic(mnemonic: Mnemonic, passphrase: str = "", network: str = 'mainnet') -> bytes: """Return BIP32 master extended private key from Electrum mnemonic. Note that for a 'standard' mnemonic the derivation pat...
5,350,644
def test_getLastDateList(gregorian: str, tzolkin: TzolkinDate) -> None: """Test `Tzolkin.getLastDateList`.""" gregorian_date = datetime.datetime.strptime( gregorian, USED_DATEFMT ).date() - datetime.timedelta(days=1) to_test = Tzolkin.fromDateString(date_str=gregorian, fmt=USED_DATEFMT) tz_l...
5,350,645
def release_(ctx, version, branch, master_branch, release_branch, changelog_base, force): """ Release a branch. Note that this differs from the create-release command: 1. Create a Github release with the version as its title. 2. Create a commit bumping the version of setup.py on top of t...
5,350,646
async def test_full_flow_implementation(hass): """Test registering an implementation and finishing flow works.""" gen_authorize_url = AsyncMock(return_value="https://example.com") convert_code = AsyncMock(return_value={"access_token": "yoo"}) config_flow.register_flow_implementation( hass, "test...
5,350,647
def tmp_bind( logger: TLLogger, **tmp_values: Any ) -> Generator[TLLogger, None, None]: """ Bind *tmp_values* to *logger* & memorize current state. Rewind afterwards. """ saved = as_immutable(logger)._context try: yield logger.bind(**tmp_values) # type: ignore finally: logge...
5,350,648
def rename(tax_idx, tax_queries, outdir, column=1, header=False): """ Renaming queries with new taxonomic classifications. All entries that cannot be re-named will be excluded in the output. """ # converting tax_idx to a simple index idx = {} # {old_tax : new_tax} for x in tax_idx: ...
5,350,649
def TryRevision(rev, profile, args): """Downloads revision |rev|, unzips it, and opens it for the user to test. |profile| is the profile to use.""" # Do this in a temp dir so we don't collide with user files. cwd = os.getcwd() tempdir = tempfile.mkdtemp(prefix='bisect_tmp') os.chdir(tempdir) # Download t...
5,350,650
def get_namedtuple_from_paramnames(owner, parnames): """ Returns the namedtuple classname for parameter names :param owner: Owner of the parameters, usually the spotpy setup :param parnames: Sequence of parameter names :return: Class """ # Get name of owner class typename = type(owner)....
5,350,651
def readNotificationGap(alarmName): """ Returns the notificationGap of the specified alarm from the database """ cur = conn.cursor() cur.execute('Select notificationGap FROM Alarms WHERE name is "%s"' % alarmName) gapNotification = int(cur.fetchone()[0]) conn.commit() return gapNotificat...
5,350,652
def vertical_line(p1, p2, p3): """ 过点p3,与直线p1,p2垂直的线 互相垂直的线,斜率互为互倒数 :param p1: [x,y] :param p2: [x,y] :param p3: [x,y] :return: 新方程的系数[na,nb,nc] """ line = fit_line(p1, p2) a, b, c = line # ax+by+c=0;一般b为-1 # 以下获取垂线的系数na,nb,nc if a == 0.: # 原方程为y=c ;新方程为x=-nc na...
5,350,653
def _get_value(key, entry): """ :param key: :param entry: :return: """ if key in entry: if entry[key] and str(entry[key]).lower() == "true": return True elif entry[key] and str(entry[key]).lower() == "false": return False return entry[key] ret...
5,350,654
def calculate_bounded_area(x0, y0, x1, y1): """ Calculate the area bounded by two potentially-nonmonotonic 2D data sets This function is written to calculate the area between two arbitrary piecewise-linear curves. The method was inspired by the arbitrary polygon filling routines in vector software prog...
5,350,655
def test_check_loop_sync(caplog): """Test check_loop does nothing when called from thread.""" hasync.check_loop() assert "Detected I/O inside the event loop" not in caplog.text
5,350,656
def login(): """ Login to APIC-EM northbound APIs in shell. Returns: Client (NbClientManager) which is already logged in. """ try: client = NbClientManager( server=APIC, username=APIC_USER, password=APIC_PASSWORD, connect=...
5,350,657
def transfocator_compute_configuration(photon_energy_ev,s_target,\ symbol=["Be","Be","Be"], density=[1.845,1.845,1.845],\ nlenses_max = [15,3,1], nlenses_radii = [500e-4,1000e-4,1500e-4], lens_diameter=0.05, \ sigmaz=6.46e-4, alpha = 0.55, \ tf_p=5960, tf_q=3800, verbose=...
5,350,658
def update_contour(): """ Finds contours in the current color image and uses them to update contour_center and contour_area """ global contour_center global contour_area image = rc.camera.get_color_image() if image is None: contour_center = None contour_area = 0 els...
5,350,659
def flickrapi_fn(fn_name, fn_args, # format: () fn_kwargs, # format: dict() attempts=3, waittime=5, randtime=False, caughtcode='000'): """ flickrapi_fn Runs flickrapi fn_name function handing over **fn_k...
5,350,660
def test_network_cabling_mutually_exclusive_ips_and_file(): """Test that the `canu report network cabling` command only accepts IPs from command line OR file input, not both.""" with runner.isolated_filesystem(): result = runner.invoke( cli, [ "--cache", ...
5,350,661
def send_task_event(state, task, send_event_func, event): """ Send a task event delegating to 'send_event_func' which will send events to RabbitMQ or use the workflow context logger in local context :param state: the task state (valid: ['sending', 'started', 'rescheduled', 'succee...
5,350,662
def load_data(CWD): """ loads the data from a parquet file specified below input: CWD = current working directory path output: df_raw = raw data from parquet file as pandas dataframe """ folderpath_processed_data = CWD + '/data_sample.parquet' df_raw = pd.read_parquet(folderpath_processed_da...
5,350,663
def run_command(cmd): """Run command, return output as string.""" output = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True).communicate()[0] return output.decode("ascii")
5,350,664
def http_body(): """ Returns random binary body data. """ return strategies.binary(min_size=0, average_size=600, max_size=1500)
5,350,665
def run(data_s: str) -> tuple[int, int]: """Solve the puzzles.""" results = [check(line) for line in data_s.splitlines()] part1 = sum(result.error_score for result in results) part2 = int(median(result.completion_score for result in results if result.ok)) return part1, part2
5,350,666
def _getRotatingFileHandler(filename, mode='a', maxBytes=1000000, backupCount=0, encoding='utf-8', uid=None, gid=None): """Get a :class:`logging.RotatingFileHandler` with a logfile which is readable+writable only by the given **uid** and **gid**. :param str filename: The full pa...
5,350,667
def _inject(*args, **kwargs): """Inject variables into the arguments of a function or method. This is almost identical to decorating with functools.partial, except we also propagate the wrapped function's __name__. """ def injector(f): assert callable(f) @functools.wraps(f) ...
5,350,668
def frame_drop_correctors_ready(): """ Checks to see if the frame drop correctors 'seq_and_image_corr' topics are all being published. There should be a corrector topic for each camera. """ camera_assignment = get_camera_assignment() number_of_cameras = len(camera_assignment) number_of_c...
5,350,669
def loads(content: str) -> List[Dict[str, Any]]: """ Load the given YAML string """ template = list(yaml.load_all(content, Loader=SafeLineLoader)) # Convert an empty file to an empty dict if template is None: template = {} return template
5,350,670
def celery_worker(level="debug"): """Run the Celery process.""" cmd = 'celery worker -A framework.tasks -l {0}'.format(level) run(bin_prefix(cmd))
5,350,671
def get_ndim_horizontal_coords(easting, northing): """ Return the number of dimensions of the horizontal coordinates arrays Also check if the two horizontal coordinates arrays same dimensions. Parameters ---------- easting : nd-array Array for the easting coordinates northing : nd-...
5,350,672
async def info(): """ API information endpoint Returns: [json] -- [description] app version, environment running in (dev/prd), Doc/Redoc link, Lincense information, and support information """ if RELEASE_ENV.lower() == "dev": main_url = "http://localhost:5000" else: ...
5,350,673
async def info(request: FasttextRequest): """ Returns info about the supervised model TODO - Add authentication :param request: :return: """ app: FasttextServer = request.app model: SupervisedModel = app.get_supervised_model() model_info = { "dimensions": model.get_dimension...
5,350,674
def main(): """Start of the program.""" args = parse_arguments(sys.argv[1:]) settings = get_settings(args) args.func(settings)
5,350,675
def hard_example_mining(dist_mat, labels, return_inds=False): """For each anchor, find the hardest positive and negative sample. Args: dist_mat: pytorch Variable, pair wise distance between samples, shape [N, N] labels: pytorch LongTensor, with shape [N] return_inds: whether to return the indi...
5,350,676
def getSerialPorts(): """ Lists serial port names :raises EnvironmentError: On unsupported or unknown platforms :returns: A list of the serial ports available on the system """ print("Getting all available serial ports...") print("This may take a sec...") if...
5,350,677
def test_create_project_environment_success(temporary_folder, temporary_home, fake_popen): """Test full cycle for creating an environment from conda.""" fake_popen.set_cmd_attrs('virtualenv --version', returncode=0) fake_popen.set_cmd_attrs('git --version', return...
5,350,678
def create_schema(force=False, checkfirst=True): """Create the tables and schema on the ModMon database. Parameters ---------- force : bool, optional Unless True ask for confirmation before taking potentially destructive action if checkfirst is False, by default False checkfirst : b...
5,350,679
def dt_list_cached_mappings(): """ >>> old_state = test_config.setup() >>> import doctest >>> doctest.ELLIPSIS_MARKER = '-ignore-' >>> ListScript("crds.list --cached-mappings --full-path")() # doctest: +ELLIPSIS -ignore-/mappings/hst/hst.pmap -ignore-/mappings/hst/hst_0001.pmap -ignore-/...
5,350,680
def trace(func): """Trace and capture provenance info inside a method /function.""" setup_logging() @wraps(func) def wrapper(*args, **kwargs): activity = func.__name__ activity_id = get_activity_id() # class_instance = args[0] class_instance = func class_instanc...
5,350,681
def plot_images(images: list): """Plots a list of images, arranging them in a rectangular fashion""" num_plots = len(images) rows = round(math.sqrt(num_plots)) cols = math.ceil(math.sqrt(num_plots)) for k, img in enumerate(images): plt.subplot(rows, cols, k + 1) plt.axis('off') ...
5,350,682
def _(path): """ Degenerate behavior for pathlib.Path objects. """ yield path
5,350,683
def broadcast_ms_tensors(network, ms_tensors, broadcast_ndim): """Broadcast TensorRT tensors to the specified dimension by pre-padding shape 1 dims""" broadcasted_ms_tensors = [None] * len(ms_tensors) for i, t in enumerate(ms_tensors): tensor = network.nodes[t] if len(tensor.shape) < broad...
5,350,684
def get_rbf_gamma_based_in_median_heuristic(X: np.array, standardize: bool = False) -> float: """ Function implementing a heuristic to estimate the width of an RBF kernel (as defined in the Scikit-learn package) from data. :param X: array-like, shape = (n_samples, n_features), feature matrix :para...
5,350,685
def winter_storm( snd: xarray.DataArray, thresh: str = "25 cm", freq: str = "AS-JUL" ) -> xarray.DataArray: """Days with snowfall over threshold. Number of days with snowfall accumulation greater or equal to threshold. Parameters ---------- snd : xarray.DataArray Surface snow depth. ...
5,350,686
def remove_dir_edge(g, x, y): """Removes the directed edge x --> y""" if g.has_edge(x, y): g.remove_edge(x, y)
5,350,687
def add_site(site, url_file): """ For an OOI site, assemble a curated list of all the instruments and data streams that are available for data explorations. This file will create a YAML file per site. Additional HITL work is required to further clean-up and check the list, and pruning streams and method...
5,350,688
def _check_whitelist_members(rule_members=None, policy_members=None): """Whitelist: Check that policy members ARE in rule members. If a policy member is NOT found in the rule members, add it to the violating members. Args: rule_members (list): IamPolicyMembers allowed in the rule. poli...
5,350,689
def get_mac(): """This function returns the first MAC address of the NIC of the PC without colon""" return ':'.join(re.findall('..', '%012x' % uuid.getnode())).replace(':', '')
5,350,690
async def get_clusters(session, date): """ :param session: :return: """ url = "%s/file/clusters" % BASE_URL params = {'date': date} return await get(session, url, params)
5,350,691
def extract_attributes_from_entity(json_object): """ returns the attributes from a json representation Args: @param json_object: JSON representation """ if json_object.has_key('attributes'): items = json_object['attributes'] attributes = recursive_for_attribute_v2(items) ...
5,350,692
def get_config_with_api_token(tempdir, get_config, api_auth_token): """ Get a ``_Config`` object. :param TempDir tempdir: A temporary directory in which to create the Tahoe-LAFS node associated with the configuration. :param (bytes -> bytes -> _Config) get_config: A function which takes a ...
5,350,693
def make_journal_title(): """ My journal is weekly. There's a config option 'journal_day' that lets me set the day of the week that my journal is based on. So, if I don't pass in a specific title, it will just create a new journal titled 'Journal-date-of-next-journal-day.md'. """ #TODO: Make the generated ...
5,350,694
def setrange(y1, y2, container=None): """Changes the range of the current container""" if container is None: _checkContainer() container = current.container container.setRange(y1, y2)
5,350,695
def calc_base_matrix_1qutrit_y_01() -> np.ndarray: """Return the base matrix corresponding to the y-axis w.r.t. levels 0 and 1.""" l = [[0, -1j, 0], [1j, 0, 0], [0, 0, 0]] mat = np.array(l, dtype=np.complex128) return mat
5,350,696
def get_feature_names_small(ionnumber): """ feature names for the fixed peptide length feature vectors """ names = [] names += ["pmz", "peplen"] for c in ["bas", "heli", "hydro", "pI"]: names.append("sum_" + c) for c in ["mz", "bas", "heli", "hydro", "pI"]: names.append("mean_" + c) names.append("mz_ion"...
5,350,697
def vectorproduct(a,b): """ Return vector cross product of input vectors a and b """ a1, a2, a3 = a b1, b2, b3 = b return [a2*b3 - a3*b2, a3*b1 - a1*b3, a1*b2 - a2*b1]
5,350,698
def test_accept_friend_request_makes_users_follow_each_other(actor, requester): """ Friends should follow each other when a friendship is initiated. """ send_friend_request(actor=requester, to_user=actor) accept_friend_request(actor, requester) assert actor.following.is_connected(requester) ...
5,350,699