content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def delete_meeting(request, club_name, meeting_id): """Meeting is deleted by the host""" meeting = Meeting.objects.get(id=meeting_id) MeetingAttendance.objects.filter(user=request.user, meeting=meeting).delete() meeting.delete() return redirect('meeting_list', club_name)
1a81e001c2cb6175ec4a7693f745f4090c06a8e3
3,646,800
def get_best_gain(mapping, candidate_mappings, weight_dict, instance_len, cur_match_num, lol1=None): """ Hill-climbing method to return the best gain swap/move can get Arguments: mapping: current node mapping candidate_mappings: the candidates mapping list weight_dict: the weight dictionary ...
7b6b7472090eca2296861afaef7fdcc1aafeff0e
3,646,801
def mock_environ(): """Mock for `os.environ.copy`""" return {"SOME_ENV_VAR": "42"}
d68d44d793847f46354a8cf2503b654a40eed92a
3,646,802
def get_bedtools_coverage_cmd(bam_filename, gff_filename, output_filename, require_paired=False): """ Get bedtools command for getting the number of reads from the BAM filename that are strictly contained within each interval of the GFF. ""...
e4d6da3e3e7fe611c3bc3023bea3a76a0003a1f2
3,646,803
from typing import List from typing import Tuple from typing import Dict def get_notes_mapping_dict(notes_list: List) -> Tuple[Dict, np.array]: """ Function get list of midi notes and returns mapping for each note :param notes_list: :return: """ assert len(notes_list) > 0, 'Empty notes list !...
8ea85f83f6d048587ed762272ae19e4176c7d4f3
3,646,804
def p_y_given_x(X, mean_x, variance_x): """ Calculates the probablity of class value being y, given label is x. PARAMETERS ========== X: list Input of unknown class values given by user. mean_x: ndarray(dtype=int,ndim=1,axis=1) Mean for given label. variance_x...
64fc1e5e5c81affdad1cc02f5a62d5ba186a1129
3,646,805
def run_train(cfg, wandb): """Train function starts here Args: cfg (obj `DictConfig`): This is the config from hydra. """ data_directory = cfg.data.data_directory train_batch_size = cfg.data.train_batch_size max_seq_len = cfg.task.max_seq_len # Maximum length per sequence max_pred...
1b454fd28b9c308700fde67336a65e0e54be41ca
3,646,806
def wrf_ll_to_ij(lon, lat, map_proj, truelat1=-999.,truelat2=-999.,stand_lon=999., \ ref_lat=-999,ref_lon=-999,pole_lat=90,pole_lon=0,knowni=-999,\ knownj=-999,dx=-999, dy=-999, latinc=-999., loninc=-999): """ Converts lon/lat values to i/j index values. lon,lat - lat,lon values to ...
9f1cbfa535584d0de1a7e1736fa08def0bb52f71
3,646,807
from typing import List def create_specimen_resource(specimen_identifier: List[dict], patient_reference: dict, specimen_type: str, received_datetime: str = None, collection_datetime: str = None, ...
05f8c314bae1c160e05b7d7c22343d3d195eb262
3,646,808
from typing import List from typing import Dict def get_attribute_slots( tracker: "Tracker", object_attributes: List[Text] ) -> List[Dict[Text, Text]]: """ Copied from rasa_sdk.knowledge_base.utils and overridden as we also need to return the entity role for range queries. If the user mentio...
59876d36adc362c074f6be267d0ccb65735256dd
3,646,809
def pearson_correlation(self, preferences): """ Returns the Pearson Correlation of two user_s, A and B by performing the PPMC calculation on the scatter plot of (a, b) ratings on the shared set of critiqued titles. """ # Store the length to save traversals of the len computation. # If they ...
290bad340c7745883d41f0a6cde809b4ae8c987f
3,646,810
def update_stakeholder(id: int, name: str = None, company: str = None, role: str = None, attitude: str = None, archived: bool = None) -> Stakeholder or None: """ Provide a POST API endpoint for updating a specific stakeholder. :param id: ID of the stakeholder. :param name: Name o...
fd13119e1435535c2ada786e207ab7c5acd9f2ab
3,646,811
def register(): """Sign up user.""" if current_user.is_authenticated: return redirect(url_for("homepage")) form = RegistrationForm() if form.validate_on_submit(): user = User( username=form.username.data, name=form.name.data, email=form.email.data, ...
155365d20fd5838784d4380ae1bc02373ca11bf5
3,646,812
def txt_as_matrix(buff, border): """\ Returns the text QR code as list of [0,1] lists. :param io.StringIO buff: Buffer to read the matrix from. """ res = [] code = buff.getvalue().splitlines() len_without_border = len(code) - border for l in islice(code, border, len_without_border): ...
086e6c0b4f3831288e1ca2c37047b5c0fb6f00e0
3,646,813
def create_logismosb_node(name="LOGISMOSB"): """ This function... :param name: :return: """ node = Node(LOGISMOSB(), name=name) config = read_machine_learning_config() return set_inputs(node, config)
8a1fa419ae94df09802f38badb68b97660d35987
3,646,814
def calc_tract_accessibility(tracts, pois, G, weight='length', func=acc_cumulative_gaussian,k=5, random_seed=None, func_kws={}, pois_weight_column=None,iter_cap=1_000): """ Calculate accessibility by census tract using given...
8c3abdf1da08d74926892bdf597d33066296ba38
3,646,815
def _exp_func(x, a, b, c): """Exponential function of a single variable, x. Parameters ---------- x : float or numpy.ndarray Input data. a : float First parameter. b : float Second parameter. c : float Third parameter. Returns ------- flo...
41b6299561162b41189efcfa14820eb8e12396eb
3,646,816
def seek_inactive(x, start, length, direction=-1, abstol=0): """ Seek inactive region to the left of start Example ------- >>> # _______ | >>> seek_inactive([3, 2, 1, 1, 1, 2, 3, 4, 2], start=7, length=3) (1, slice(2, 4)) When no sufficiently long sequence is fou...
a0029e0c145381b2acf57f77107d75d89c909b39
3,646,817
from typing import Counter def word_cross_product_phi(t1, t2): """Basis for cross-product features. This tends to produce pretty dense representations. Parameters ---------- t1, t2 : `nltk.tree.Tree` As given by `str2tree`. Returns ------- defaultdict Map...
dd5ab36d48abce087afa99b98a05c97a0ee30a76
3,646,818
def cube_filter_highpass(array, mode='laplacian', verbose=True, **kwargs): """ Apply ``frame_filter_highpass`` to the frames of a 3d or 4d cube. Parameters ---------- array : numpy ndarray Input cube, 3d or 4d. mode : str, optional ``mode`` parameter to the ``frame_filter_highpa...
21c689249ad32919dbb410b2b2b9e221ce31f4df
3,646,819
import requests import json def translate_text(text: str, url: str, model_id) -> TranslatedObject: """Translates a text with the url of a translation server. The url is the url that comes up when you start the translation model""" assert type(text) == str, "Text has to be of type string" assert type(u...
54d7f1e93f6452edf140e845795bfc9bfd9bb092
3,646,820
def quantized_avg_pool_run(shape, dtype1, shape_list, dtype2, ksize, strides, padding, data_format, quant_algo, scale_mode, scale_sqrt, attrs): """run function""" if not isinstance(shape_list, (list, tuple, type(None))): raise RuntimeError("shape_lis...
d704d90a3124607c31e2470cdd1b2fafe967e05e
3,646,821
def dry(message, func, *args, **kw): """Wraps a function that performs a destructive operation, so that nothing will happen when a dry run is requested. Runs func with the given arguments and keyword arguments. If this is a dry run, print the message rather than running the function.""" if message ...
4dd73f2640b5f5a063db6b13ec970c309e753f78
3,646,822
def move_cups(current: int, cups: CircularLinkedList) -> int: # return the new current cup """ 1. The crab picks up the three cups that are immediately clockwise of the current cup. They are removed from the circle; cup spacing is adjusted as necessary to maintain the circle. 2. The crab selec...
5f66d5066c29c05bb264bedc6ac4f27ee30e4488
3,646,823
import select from operator import and_ def hire(name, address, salary, manager, is_active, Session=Session): """Add an employee to the bank.""" # get manager_id if manager: firstname, lastname = split_name(manager) with Session() as session: stmt = select(Employee).where(and_...
919e5d2d555d686bdb5f707af2f388f2c8c934fa
3,646,824
def get_colormap(n=18, randomize=True): """ "Get expanded colormap""" n_colors = np.ceil(n / 6) + 1 cols = [] for col in COLORS: pal = sns.light_palette(col, n_colors=n_colors) for rgb in pal[1:]: cols.append(rgb) if randomize: shuffle(cols) # shuffle to break g...
f31ffd3e3667b947e1034617e0165516b942be5a
3,646,825
def partition2(n): """ Coin partitions. Let partition(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be separated into piles in exactly seven different ways, so partition(5)=7. """ # dynamic programming table, table cell (i,j), parition size =...
3537d9eadeb4ba9265c9d9bbe7016f41aecc009e
3,646,826
import torch def all_gather_batch(tensors): """ Performs all_gather operation on the provided tensors. """ # Queue the gathered tensors world_size = get_world_size() # There is no need for reduction in the single-proc case if world_size == 1: return tensors tensor_list = [] ...
640f737f9daf9a934cc97673dcec033caf784c62
3,646,827
def get_duration_and_elevation(table): """"Return an array of duration and elevation gain from an html table""" try: hiking_duration = str(table.contents[0].text.strip()) #av.note: want this to be numeric except: hiking_duration = "" try: elevation_gain_ft = str( ta...
d52ca3c6e5d75ff936e44b452b05790db931dc6e
3,646,828
def show_comparison(model, X_test, y_test, A_test, protected_features, prostprocess_preds): """ Returns Dashboard to show comparison of models based on the trade off of the disparity and accuracy """ FairlearnDashboard(sensitive_features=A_test, sensitive_feature_names=protected_features, ...
bc92c90c67f16c53c8c847556779d1ad923dc56c
3,646,829
def my_edge(bw, threshold): """ 2018.11.26 检测图像边缘 返回检测到的边缘二值图像 阈值用于消去检测到的噪声 时间复杂度: Args: bw: a grey-scale image with 8-bit depth threshold: a decimal between 0 and 1 Returns: bw_edge_binary: 二值化的边缘图像 Raises: """ m, n = bw.shape bw0 = bw.astype(...
ea5ffd4869f0b5636ff73691761bac88316aad34
3,646,830
def csc_matvec(csc, x): """ Matrix vector multiplication using csc format """ if not sparse.isspmatrix_csc(csc): raise Exception("Matrix must be in csc format") nrow, ncol = csc.shape nnz = csc.data.shape[0] if x.size != ncol: print(x.size, ncol) raise Value...
fa04c4e208333327ce6e4073a27b43f17ffb7dea
3,646,831
import sys async def delete_all_groups_for_user( user_id: int, query: CreateActionLogQuery, db: Session = Depends(get_db) ) -> Response: """ When a user removes his/her profile, make the user leave all groups. This API is run asynchronously, and returns a `201 Created` instead of `200 OK`. *...
1bc8fe0ecd2639affea0a90d37d018b11f233ca6
3,646,832
def encode_base58(s) -> bytes: """ Encodes/converts any bytes to Base58 to transmit public key """ count = 0 for c in s: if c == 0: count += 1 else: break num = int.from_bytes(s, 'big') prefix = '1' * count result = '' while num > 0: ...
064867d9185a06f26c8f033ab04ac38621c48869
3,646,833
import os import time import sys def get_config(): """Get config from env vars. Return: dict: Keys are: policy_url, dane_id, policy_file_dir, crypto_path, policy_name, ssids. """ config = {} for x in ["policy_url", "policy_file_dir", "dane_id", "crypto_path", "p...
a2c69da96e2c8ac39230e6d1b277de8951a91abe
3,646,834
import os def unix_only(f): """Only execute on unix systems""" f.__test__ = os.name == "posix" return f
8f20070e75e0277341985c3d528311779aff47d1
3,646,835
def save_chapter( body, source_lang, target_lang, title, public=False, user=None): """Save chapter to database Parameters: body (string): input text source_lang (string): source language target_lang (string): target language title (string): title of the chapter publi...
9d85acb0a08d8e44bac86f7d3c5bec24b67a3cc1
3,646,836
def frequency(g, k, h): """ Computes the frequency for a given wave number and water depth (linear dispersion relationship) :param k: the wave number :param g: -- gravitational acceleration :param h: -- the water depth :returns omega: -- wave frequency """ return np.sqrt(g * k * n...
c81b6721ea874506937d245bd886f129f01b69e2
3,646,837
def primitive_name(method_name): """Given a method_name, returns the corresponding Phylanx primitive. This primarily used for mapping NumPy mapped_methods to Phylanx primitives, but there are also other functions in python that would map to primitives with different name in Phylanx, e.g., `print` is ma...
d6b1cc670503a8e8bade585f0a875b7bde4f743a
3,646,838
import math def _split_pandas_data_with_ratios(data, ratios, seed=SEED, shuffle=False): """Helper function to split pandas DataFrame with given ratios Note: Implementation referenced from `this source <https://stackoverflow.com/questions/38250710/how-to-split-data-into-3-sets-train-validation...
19b2ddd97a803042d1ac27df47a56b5157fd4e96
3,646,839
import requests from datetime import datetime def get_stock_information(stock, country, as_json=False): """ This function retrieves fundamental financial information from the specified stock. The retrieved information from the stock can be valuable as it is additional information that can be used combined...
bfe70fd27c76d743f107056023a127283a76d8c4
3,646,840
from datetime import datetime def check_export_start_date(export_start_dates, export_end_dates, export_day_range): """ Update export_start_date according to the export_end_date so that it could be export_end_date - EXPORT_DAY_RANGE. Parameters: export_start_date: dict ...
ab2466db1107b980506d34de71c5b1849851fd10
3,646,841
import logging def set_verbosity(module_name: str, verbose: bool = False, very_verbose: bool = False) -> logging.Logger: """ Used to set the verbosity of the logger. :param module_name: Name of the module, e.g. ``__name__``. :type module_name: str :param verbose: Enables DEBUG level. :type ver...
cc0d8f37e11968d5f5573bac7ef0529a90cfb6be
3,646,842
from typing import Any def walk_attrs(module: ModuleType, attr_name, converter=Converter()) -> str: """ Create stubs for given class, including all attributes. :param module: :param attr_name: :param converter: :return: """ buf = StringList(convert_indents=True) buf.indent_type = " " if not is_dunder...
13c79acb6943a165a39f6735c67cdb8ceff26b9c
3,646,843
def reformat_adata( adata: AnnData, brain_region: str, num_seq_lanes: int, transgenes_list: str ): """ script that takes in user specified inputs in the data_reformat script transforms dataframe input to usable AnnData output with group cell count labels, df_obs it also makes genes in the index...
9f6e92b7dac8c8e84987676e7c2435a2e34f32e0
3,646,844
def chunks(list_, num_items): """break list_ into n-sized chunks...""" results = [] for i in range(0, len(list_), num_items): results.append(list_[i:i+num_items]) return results
83da5c19c357cc996fc7585533303986bea83689
3,646,845
def form_requires_input(form): """ Returns True if the form has at least one question that requires input """ for question in form.get_questions([]): if question["tag"] not in ("trigger", "label", "hidden"): return True return False
97072a9edc494afa731312aebd1f23dc15bf9f47
3,646,846
import logging import os import re def read_dino_waterlvl_csv(fname, to_mnap=True, read_series=True): """Read dino waterlevel data from a dinoloket csv file. Parameters ---------- fname : str to_mnap : boolean, optional if True a column with 'stand_m_tov_nap' is added to the dataframe ...
4787bc0d7614f2c6d482ac33d991265cbecd2c6d
3,646,847
import zlib import json def on_same_fs(request): """ Accept a POST request to check access to a FS available by a client. :param request: `django.http.HttpRequest` object, containing mandatory parameters filename and checksum. """ filename = request.POST['filename'] checksum_i...
2b19fe8d6a69db9cfeeea740cdcf70003e0c9ed1
3,646,848
from datetime import datetime def get_memo(expense_group: ExpenseGroup, payment_type: str=None) -> str: """ Get the memo from the description of the expense group. :param expense_group: The expense group to get the memo from. :param payment_type: The payment type to use in the memo. :return: The m...
2402d7f0ff89ed7b06300f58f8bfb54c06d67f3f
3,646,849
def get_prefix_for_google_proxy_groups(): """ Return a string prefix for Google proxy groups based on configuration. Returns: str: prefix for proxy groups """ prefix = config.get("GOOGLE_GROUP_PREFIX") if not prefix: raise NotSupported( "GOOGLE_GROUP_PREFIX must be s...
c81d3ede2ba1ad6b8ce716633abbc8e8f91f9a2b
3,646,850
def client(tmpdir): """Test client for the API.""" tmpdir.chdir() views.app.catchall = False return webtest.TestApp(views.app)
516230e96dff76afccc8f8a3a9dc3942c6341797
3,646,851
def list_extract(items, arg): """Extract items from a list of containers Uses Django template lookup rules: tries list index / dict key lookup first, then tries to getattr. If the result is callable, calls with no arguments and uses the return value.. Usage: {{ list_of_lists|list_extract:1 }} (get...
23fb863a7032f37d029e8b8a86b883dbfb4d5e7b
3,646,852
from bs4 import BeautifulSoup def get_links(url): """Scan the text for http URLs and return a set of URLs found, without duplicates""" # look for any http URL in the page links = set() text = get_page(url) soup = BeautifulSoup(text, "lxml") for link in soup.find_all('a'): if 'hr...
70746ba8d28244cf712655fd82a38d358a30779a
3,646,853
from typing import Tuple def get_merkle_root(*leaves: Tuple[str]) -> MerkleNode: """Builds a Merkle tree and returns the root given some leaf values.""" if len(leaves) % 2 == 1: leaves = leaves + (leaves[-1],) def find_root(nodes): newlevel = [ MerkleNode(sha256d(i1.val + i2.v...
d0fae08918b042f87ef955be436f1e3d84a66e8a
3,646,854
import torch import copyreg def BeginBlock(layer_to_call: torch.nn.Module, user_id: str = None, ipu_id: int = None) -> torch.nn.Module: """ Define a block by modifying an existing PyTorch module. You can use this with an existing PyTorch module instance, as follows: >>>...
a43c0d198fcf1f100cbec5bc3d916aeb05fd36d0
3,646,855
import torch def unbatch_nested_tensor(nested_tensor): """Squeeze the first (batch) dimension of each entry in ``nested_tensor``.""" return map_structure(lambda x: torch.squeeze(x, dim=0), nested_tensor)
0691cb1bb851c609747cde9d45b24ca6310fa022
3,646,856
def row2dict(cursor, row): """ タプル型の行データを辞書型に変換 @param cursor: カーソルオブジェクト @param row: 行データ(tuple) @return: 行データ(dict) @see: http://docs.python.jp/3.3/library/sqlite3.html """ d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d
60e0ebed21c35a65784fe94fe5781f61fbe0c97d
3,646,857
def merge(left, right): """this is used for merging two halves """ # print('inside Merge ') result = []; leftIndex = 0; rightIndex = 0; while leftIndex < len(left) and rightIndex < len(right): if left[leftIndex] < right[rightIndex]: result.append(left[leftIndex]) ...
5b0012e102d72a93cf3ce47f9600b7dcef758a3b
3,646,858
import re def parse_query(query): """Parse the given query, returning a tuple of strings list (include, exclude).""" exclude = re.compile(r'(?<=-")[^"]+?(?=")|(?<=-)\w+').findall(query) for w in sorted(exclude, key=lambda i: len(i), reverse=True): query = query.replace(w, '') query = " " + que...
4fe6aac76935af6e5acaa3aedad40d6bc635d4ff
3,646,859
def _m_verify_mg(state, method_name, multigoal, depth, verbose=0): """ Pyhop 2 uses this method to check whether a multigoal-method has achieved the multigoal that it promised to achieve. """ goal_dict = _goals_not_achieved(state,multigoal) if goal_dict: raise Exception(f"depth {depth}: ...
262ae05ab34e37867d5fa83ff86ecbd01391dbe1
3,646,860
def eggs_attribute_decorator(eggs_style): """Applies the eggs style attribute to the function""" def decorator(f): f.eggs = eggs_style @wraps(f) def decorated_function(*args, **kwargs): return f(*args, **kwargs) return decorated_function return decorator
3fe6d6b65b29176cf9fb997697c1b70f01f041bf
3,646,861
def byte_size(num, suffix='B'): """ Return a formatted string indicating the size in bytes, with the proper unit, e.g. KB, MB, GB, TB, etc. :arg num: The number of byte :arg suffix: An arbitrary suffix, like `Bytes` :rtype: float """ for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']: ...
830d4ed401df90bc3a176c52124ed93c53c25c80
3,646,862
def cdsCoverage(genome_coverage, dict_cds, datatype, coverage): """Return Mean Coverage or Raw Counts for each CDS, or their promotor regions for tss and chip""" genome_coverage = [map(int, genome_coverage[0]), map(int, genome_coverage[1])] # CDS coverage is calculated from genome coverage on the entire gen...
637d76347dbe09c3826e496f7c8f5ec0a79f3dbd
3,646,863
def div88(): """ Returns the divider ZZZZZZZZZZZZ :return: divider88 """ return divider88
a2ae79f96ed7530fd2a1f266404ee3b21614a5a9
3,646,864
def laplace_noise(epsilon, shape, dtype, args): """ Similar to foolbox but batched version. :param epsilon: strength of the noise :param bounds: min max for images :param shape: the output shape :param dtype: the output type :return: the noise for images """ scale = epsilon / np.sqrt...
3016db9cebffe47c62f57e05d30442b9786636e8
3,646,865
import six import sys def import_by_path(dotted_path, error_prefix=''): """ Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImproperlyConfigured if something goes wrong. """ try: module_path, class_name = dotted_path.rsplit('.', 1) ...
1bed15dd48a1929c5418862b71cdfda9a0e5dc7b
3,646,866
def grid_convergence(lat, lon, radians=False): """ Given the latitude and longitude of a position, calculate the grid convergence Args: lat: latitude (degrees or radians) lon: longitude (degrees or radians) radians: true if lat/lon in radians Returns: gamma, the grid convergence...
dc60c8325f66fdc2db9b72d2bdc099823f913d26
3,646,867
import uuid import json def _make_index_item(resource_type): """ """ id_prefix = "2c1|" uuid_ = uuid.uuid4().hex tpl = { "access_roles": [ "guillotina.Reader", "guillotina.Reviewer", "guillotina.Owner", "guillotina.Editor", "guillot...
5c11bb14016e42ff36b12ca81fd83e81b71dea9d
3,646,868
import torch def mol_to_graph(mol): """ Converts Mol object to a graph compatible with Pytorch-Geometric Args: mol (Mol): RDKit Mol object Returns: node_feats (LongTensor): features for each node, one-hot encoded by element edge_feats (LongTensor): features for each node, one...
5a3e5169b7a84afae31254e71152fb6cb300bf64
3,646,869
from typing import List import random def _tournament(evaluated_population: List[Eval], tournament_size: int = 5, previous_winner: Chromosome = None) -> Chromosome: """Selects tournament_size number of chromosomes to 'compete' against each other. The chromosome with the highest fitness score '...
29db4c9c4a5332c3e70760f57312b845e29b7a36
3,646,870
def interpolate_drift_table(table, start=0, skip=0, smooth=10): """ Smooth and interpolate a table :param table: fxyz (nm) array :param start: in case of renumbering needed : first frame :param skip: how many frame were skipped :param smooth: gaussian smoothing sigma :return: interpolated ta...
d2296e6eb1b55cf5416d2ab933ef430eb0ace964
3,646,871
def on_mrsim_config_change(): """Update the mrsim.config dict. Only includes density, volume, and #sidebands""" existing_data = ctx.states["local-mrsim-data.data"] fields = ["integration_density", "integration_volume", "number_of_sidebands"] # if existing_data is not None: print(existing_data["conf...
cea2f60ca0de5e8b383a7363adfeea19473b1662
3,646,872
import base64 def decrypt(encrypted, passphrase): """takes encrypted message in base64 and key, returns decrypted string without spaces on the left IMPORTANT: key must be a multiple of 16. Finaly, the strip function is used to remove the spaces from the left of the message""" aes = AES.new(passphrase...
90e10c3e6e07934bc2171fa09febd223db200d70
3,646,873
import tqdm def multi_ale_plot_1d( features, title=None, xlabel=None, ylabel=None, x_rotation=20, markers=("o", "v", "^", "<", ">", "x", "+"), colors=plt.rcParams["axes.prop_cycle"].by_key()["color"], zorders=None, xlabel_skip=2, format_xlabels=True, show_full=True, mar...
761f27a799ff5ba848e152335e77b351c03213ff
3,646,874
import os def load_ckpt(ckpt): """ :param ckpt: ckpt 目录或者 pb 文件 """ config = tf.ConfigProto(allow_soft_placement=True) config.gpu_options.per_process_gpu_memory_fraction = 0.2 if os.path.isdir(ckpt): graph = tf.Graph() with graph.as_default(): sess = tf.Session(co...
1b39d9d6b16a842c7f6f6b289c50f4818bd86c55
3,646,875
async def total_conversations(request: HistoryQuery = HistoryQuery(month=6), collection: str = Depends(Authentication.authenticate_and_get_collection)): """Fetches the counts of conversations of the bot for previous months.""" range_value, message = HistoryProcessor.total_convers...
bc6a292b7ddc598d43c609272f6f45e87842bf21
3,646,876
import sys def restler_fuzzable_datetime(*args, **kwargs) : """ datetime primitive @param args: The argument with which the primitive is defined in the block of the request to which it belongs to. This is a date-time primitive and therefore the arguments will be added ...
a18a6bf53a2b910dc4e510efece7605a5e35db58
3,646,877
import pandas def intersect(table_dfs, col_key): """ intsc tables by column """ col_key_vals = list(unique_everseen(chain(*( table_df[col_key] for table_df in table_dfs)))) lookup_dcts = [lookup_dictionary(table_df, col_key) for table_df in table_dfs] intscd_rows = [] ...
9ca1035d4cd614ae4080c8e9dc9174c7423c28dc
3,646,878
import socket import json def ask_peer(peer_addr, req_type, body_dict, return_json=True): """ Makes request to peer, sending request_msg :param peer_addr: (IP, port) of peer :param req_type: type of request for request header :param body_dict: dictionary of body :param return_json: determines ...
44c8750ef4af487402a5cf5f789bf2a3d8d3fdb7
3,646,879
def describe_instances_header(): """generate output header""" return misc.format_line(( "Account", "Region", "VpcId", "ec2Id", "Type", "State", "ec2Name", "PrivateIPAddress", "PublicIPAddress", "KeyPair...
6939b8e47c15e098733e70fe17392c18cfff9636
3,646,880
def ordered_scaffold_split(dataset, lengths, chirality=True): """ Split a dataset into new datasets with non-overlapping scaffolds and sorted w.r.t. number of each scaffold. Parameters: dataset (Dataset): dataset to split lengths (list of int): expected length for each split. No...
8a3e0ab5c4cf23dcdcb075fc9363452e06c7d22f
3,646,881
import struct def read_plain_byte_array(file_obj, count): """Read `count` byte arrays using the plain encoding.""" return [file_obj.read(struct.unpack(b"<i", file_obj.read(4))[0]) for i in range(count)]
f300d205fda9b1b92ebd505f676b1f76122f994d
3,646,882
import imp def find_django_migrations_module(module_name): """ Tries to locate <module_name>.migrations_django (without actually importing it). Appends either ".migrations_django" or ".migrations" to module_name. For details why: https://docs.djangoproject.com/en/1.7/topics/migrations/#libraries-thi...
fdae121b1341355bc1911d2b4ce9501eb80cf8f3
3,646,883
def big_number(int_in): """Converts a potentially big number into a lisible string. Example: - big_number(10000000) returns '10 000 000'. """ s = str(int_in) position = len(s) counter = 0 out = '' while position != 0: counter += 1 position -= 1 out = s[posit...
7db0dce8ffa1cbea736537efbf2fdd4d8a87c20d
3,646,884
def action_list_to_string(action_list): """Util function for turning an action list into pretty string""" action_list_string = "" for idx, action in enumerate(action_list): action_list_string += f"{action['name']} ({action['action']['class_name']})" if idx == len(action_list) - 1: ...
5e291dd1dbf7b8d8149505a0efc157cbcc22af3b
3,646,885
def segment(img_fpath, bbox_, new_size=None): """ Runs grabcut """ printDBG('[segm] segment(img_fpath=%r, bbox=%r)>' % (img_fpath, bbox_)) num_iters = 5 bgd_model = np.zeros((1, 13 * 5), np.float64) fgd_model = np.zeros((1, 13 * 5), np.float64) mode = cv2.GC_INIT_WITH_MASK # Initialize #...
86cecbe9f5aec2e93f8165c46fb9dfb07a536d45
3,646,886
def test_pandigital_9(*args): """ Test if args together contain the digits 1 through 9 uniquely """ digits = set() digit_count = 0 for a in args: while a > 0: digits.add(a % 10) digit_count += 1 a //= 10 return digit_count == 9 and len(digits) == ...
ad5a738400f7b8a9bea001a13a76798633b9ac61
3,646,887
import os def WMT14( root, split, language_pair=("de", "en"), train_set="train.tok.clean.bpe.32000", valid_set="newstest2013.tok.bpe.32000", test_set="newstest2014.tok.bpe.32000", ): """WMT14 Dataset The available datasets include following: **Language pairs**: +-----+-----+...
6e6e2e020c0394571aaaca1e9d55004111881fb6
3,646,888
def volume_attached(context, volume_id, instance_id, mountpoint): """Ensure that a volume is set as attached.""" return IMPL.volume_attached(context, volume_id, instance_id, mountpoint)
3bfd057dee24bf9a4b51ef6503dd46bacc64210d
3,646,889
def findby1email(session, email): """<comment-ja> メールアドレスを指定して1件のユーザ情報を取得します @param session: Session @type session: sqlalchemy.orm.session.Session @param email: メールアドレス @type email: str @return: karesansui.db.model.user.User </comment-ja> <comment-en> TODO: English Comment </...
0410b7819e7f64b370719fd3c979a735f31db16c
3,646,890
def _startswith( self: str | ir.StringValue, start: str | ir.StringValue ) -> ir.BooleanValue: """Determine whether `self` starts with `end`. Parameters ---------- self String expression start prefix to check for Examples -------- >>> import ibis >>> text = ibis...
dabc7a1e07b38fc99c1f31bb285fc895c890301d
3,646,891
import os def read_XMLs(input_path): """Reads the building XMLs to list of `BuildingInfo` objects Parameters ---------- input_path : str Path where the XMLs are located Returns ------- info_list: list A list of `BuildingInfo` objects with information about each building ...
3d823acd7a87a640a4c343b0f3a9da03df09f420
3,646,892
def _get_all_scopes(blocks): """Get all block-local scopes from an IR. """ all_scopes = [] for label, block in blocks.items(): if not (block.scope in all_scopes): all_scopes.append(block.scope) return all_scopes
daa13a20629dd419d08c9c6026972f666c3f9291
3,646,893
from datetime import datetime def get_equinox_type(date): """Returns a string representing the type of equinox based on what month the equinox occurs on. It is assumed the date being passed has been confirmed to be a equinox. Keyword arguments: date -- a YYYY-MM-DD string. """ month = da...
06b65a54a0ccf681d9f9b57193f5e9d83578f0eb
3,646,894
def mcs_worker(k, mols, n_atms): """Get per-molecule MCS distance vector.""" dists_k = [] n_incomp = 0 # Number of searches terminated before timeout for l in range(k + 1, len(mols)): # Set timeout to halt exhaustive search, which could take minutes result = FindMCS([mols[k], mols[l]], ...
013958a41813181478b3133e107efed5d0370fa6
3,646,895
def get_tally_sort_key(code, status): """ Get a tally sort key The sort key can be used to sort candidates and other tabulation categories, for example the status and tally collections returned by rcv.Tabulation().tabulate(). The sort codes will sort candidates before other tabulation categories; electe...
bd7d643300997903b84b1827174dd1f5ac515156
3,646,896
def plot_corelevel_spectra(coreleveldict, natom_typesdict, exp_references=None, scale_to=-1, show_single=True, show_ref=True, energy_range=None, ...
cda96ea355043073f50e97d0840e2f7e323655e8
3,646,897
def get_lidar_point_cloud(sample_name, frame_calib, velo_dir, intensity=False): """Gets the lidar point cloud in cam0 frame. Args: sample_name: Sample name frame_calib: FrameCalib velo_dir: Velodyne directory Returns: (3, N) point_cloud in the form [[x,...][y,...][z,...]] ...
f1deb8896a2c11d82d6a312f0a8f353a73a1b40d
3,646,898
import posixpath import os def url2filename(url): """Return basename corresponding to url. >>> print(url2filename('http://example.com/path/to/file%C3%80?opt=1')) file?? >>> print(url2filename('http://example.com/slash%2fname')) # '/' in name Traceback (most recent call last): ... ValueErro...
a28b2de4c2dda7fd473d7b50d1bccd1aed47ff0f
3,646,899