content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def fetch_all_issue_by_entity_type(project_id,entity_type, entity_id): """ find all the issue in a project by entity type and entity id """ issues = Issue.query.filter_by(project_id=project_id, entity_type=entity_type,entity_id=entity_id).all() return list(map(lambda issue: to_json(issue), issues))
dd7e50136b229b1d7a3569789af5f60d22006d08
3,619,964
def bivariate_gaussian(true, pred): """ Stabilized rank-agnostic bivariate gaussian probability function (pdf) Returns results of eq # 24 of http://arxiv.org/abs/1308.0850 :param true: truth values with at least [mu1, mu2] :param pred: values predicted with at least [mu1, mu2, sigma1, sigma2, rho] ...
f1ae2de6e21d24636bbd38b9c0a7212997f81e39
3,619,965
import base64 def gen_counters_and_filters_from_strategy(s, dimension, before_sleep, trigger_variable_name): """ 生成counter列表,以及每个counter列表相关联的条件 :return: (counters, filters) """ counters = [] collect_counters = [] filters = [] sleep_found = False for tid, t in enumerate(s.terms)...
e343998a183d7c9201f9c16e499fda7f1b6dcbd0
3,619,966
def connect(): """ connect to libvirt must be called before any other calls in this library! :return: boolean """ global is_init global conn if is_init is True: return True else: conn = libvirt.open(None) if conn is None: raise Exception("Could not...
247aeebd77a14fea49e56b02670c596d9b47f64e
3,619,967
def lemmatizeAndStem(word): """ Lemmatize and stem a word. Change a verb to its present tense, and reduce the word to its root forms. Parameters: word: string The word the user wants to lemmatize and stem Returns: The lemmatized and stemmed word """ stemmer = Sno...
ee1da2ccbb1199d4fa8a120cbeba909302fe58c0
3,619,968
def _magni_test_var_in_globals_func(*args, **kwargs): """Test function used in some tests.""" return 'magni_test_var' in globals()
c4209abbc865e65644df919678dd11ddbad24e7e
3,619,969
def overlap(layer, interval): """ calculate the thickness for a layer that overlapping with an interval :param layer: (from_depth, to_depth) :param interval: (from_depth, to_depth) :return: the overlapping thickness """ res = 0 if layer[0] >= interval[0] and layer[1] <= interval[1]: # c...
f77fdc433f79cf7990416a97cc9edfcbcc860585
3,619,970
from typing import Callable from typing import Any import inspect from typing import get_type_hints import functools def wrap_class_callback(cls: type[ClassCallback]) -> Callable[..., Any]: """Function to wrap class callbacks in a function callback equivalent to: 1. Creating an instance of the class 2. Ad...
765421d3fded62b0ddb64902299d1d8f413500e0
3,619,971
import zipfile def _extract_info(archive, info): """ Extracts the contents of an archive info object ;param archive: An archive from _open_archive() :param info: An info object from _list_archive_members() :return: None, or a byte string of the file contents """ ...
3014a9e85077f33522aaf466c9bef3bd020d252b
3,619,972
def _space_all_but_first(s: str, n_spaces: int) -> str: """Pad all lines except the first with n_spaces spaces""" lines = s.splitlines() for i in range(1, len(lines)): lines[i] = " " * n_spaces + lines[i] return "\n".join(lines)
36da5eb15a9ab5fa473831b5440ffa88495f6cac
3,619,973
import signal def filter_signal( x: np.ndarray, fs: float, min_freq: float, max_freq: float, notch_freqs: list[float], order: int = 5 ) -> np.ndarray: """Filter sEMG signal with a Butterworth bandpass filter. Parameters ---------- x: np.ndarray sEMG data with shape (n_...
498129c3231da755e593a7e84e636023ff75d58a
3,619,974
from datetime import datetime def get_colour(duration, duration_in_traffic): """Return a colour to provide an idea of the current traffic. Gives a visual representation of the amount of traffic on route. :param duration: A duration string, like "4 mins" :param duration_in_traffic: A duration in traf...
e6e2f10046d9c08c9480ae38638b304258aab600
3,619,975
def get_all_translations(rna_sequence, genetic_code): """Get a list of all amino acid sequences encoded by an RNA sequence. All three reading frames of `rna_sequence` are scanned from 'left' to 'right', and the generation of a sequence of amino acids is started whenever the start codon 'AUG' is found. ...
e5e3fa652f5f170f71d1574465c8d23cc8170013
3,619,976
from dacy.datasets import female_names, male_names from dfm.description.match_counter import MatchCounter from typing import List from typing import Dict def get_gender_name_patterns() -> List[Dict[str, list]]: """Gets a list of all gendered first names in Denmark from DaCy, and converts to a list of lowercase sp...
aa6c5847be19fb2a51fad7631bf66a1ecf47ed76
3,619,977
def parse_hue_api_response(response): """Take in the Hue API json response.""" data_dict = {} # The list of sensors, referenced by their hue_id. # Loop over all keys (1,2 etc) to identify sensors and get data. for key in response.keys(): sensor = response[key] modelid = sensor['model...
2e16ae3ded2182f8914dca36f599dcb801b6c286
3,619,979
def fix_and_score_evidence(validated_evs, datasources_to_datatypes, evidence_manager): """take line as a dict, convert into an evidence object and apply a list of modifiers: fix_evidence, and if valid then score_evidence, extend data and inject loci """ left, right = None, None ev = Evidence(validat...
2f71e226553bbed4eb801990034cf66e71060c3e
3,619,980
def fix_brackets(placeholder: str) -> str: """Fix the imbalanced brackets in placeholder. When ptype is not null, regex matching might grab a placeholder with } missing. This function fix the missing bracket. Args: placeholder: string placeholder of RuntimeParameter Returns: Placeholder with re-bal...
5fa4a83eeca676c58c33038add62a0c5bed7fe8b
3,619,982
def _generate_upsert_sql(mon_loc): """ Generate SQL to insert/update for Oracle. """ mon_loc_db = [(k, _manipulate_values(v, k in TIME_COLUMNS)) for k, v in mon_loc.items()] all_columns = ','.join(col for (col, _) in mon_loc_db) all_values = ','.join(value for (_, value) in mon_loc_db) updat...
67e2f91d208ac91d31346b82769f070375ba5c38
3,619,983
def make_sparse(arr, kind='block', fill_value=nan): """ Convert ndarray to sparse format Parameters ---------- arr : ndarray kind : {'block', 'integer'} fill_value : NaN or another value Returns ------- (sparse_values, index) : (ndarray, SparseIndex) """ arr = np.asarra...
b42e403c91d166732154cf16ea697358389db297
3,619,984
def preprocess_image(image, labels, prediction=False): """ format for tf model + open image and prepare it for resnet """ if prediction==False: image = tf.io.read_file(image) image = tf.io.decode_image(image, channels=3,expand_animations = False) image = tf.cast(image, tf.float32) / ...
204dc32dd9d4b6288382c4bfb67e1ae3511e51a6
3,619,985
def application(environ, start_response): """Do something fun""" form = parse_formvars(environ) huc12 = form.get("huc12", "000000000000")[:12] scenario = int(form.get("scenario", 0)) start_response("200 OK", [("Content-type", "image/png")]) return [make_plot(huc12, scenario)]
ff35c425e43bef3527416f2e6781af0c91fde48b
3,619,986
from pathlib import Path def run(args): """ Run GPROF-NN algorithm. Args: args: The namespace object provided by the top-level parser. """ mp.set_start_method("spawn") # # Check and load inputs. # model = Path(args.model) if not model.exists(): LOGGER.error("...
2ef3f90e797aaf52fc22a59e62357ac22c3c9426
3,619,988
def segmentation_to_rgb(seg_im, N, colors=None): """ Helper function to visualize segmentations as RGB frames. NOTE: assumes that geom IDs go up to N at most - if not, multiple geoms might be assigned to the same color. """ # ensure all values lie within [0, N] seg_im = np.mod(seg_im, N) ...
6381af3b0760a045ef7a0d913e9427b60323bb3c
3,619,990
def a_1d_worse(a_1d): """a_1d worsened by constant offset.""" return a_1d + OFFSET
899b57007f0a939d380d6e5bd9f2d3e2ef4dffaf
3,619,991
def ParseRangeHeader(range_header): """Parse HTTP Range header. Args: range_header: A str representing the value of a range header as retrived from Range or X-AppEngine-BlobRange. Returns: Tuple (start, end): start: Start index of blob to retrieve. May be negative index. end: None or ...
ad37fd1532edd9519073c93aa73402b3c7d0a404
3,619,992
def _get_required_consent_subjects() -> set[Subject]: """Return the consent subjects required for this brand.""" return consent_subject_service.get_subjects_required_for_brand(g.brand_id)
f330ab6abee82e3c0b88a723155a8e30355f31ed
3,619,995
from typing import Any from typing import List def init_args( cls: Any, ) -> List[str]: """ Return the __init__ args (minus 'self') for @cls Args: cls: class, instance or callable Returns: The arguments minus 'self' """ # This looks insanely goofy, but seems to literally be th...
2d867049f3c1f4937d0d8a7042315644cef219ae
3,619,996
def analyse_start(deal: Deal, declarer_is_first: bool = False) -> int: """ Calculate the most tricks declarer can make. :param deal: The deal to analyse :param declarer_is_first: The algorithm assumes that the person who leads is to the left of the declarer (as would be the case with the first card led to a ha...
7391fd3482c673d019318a3f9f61342784911526
3,619,997
import re def create_url(url): """ modifying the given url so that it returns JSON data when we do a GET requests later in this script """ # extract the branch name from the given url (e.g master) branch = re.findall(r"\/tree\/(.*?)\/", url)[0] api_url = url.replace("https://github.com", "https://api.githu...
682343d1e7462ef224865b659357716e55cd22cd
3,619,998
import secrets def generate_token_urlsafe(unique=False, nbytes=32): """Generate an URL-safe random token.""" return secrets.token_urlsafe(nbytes=nbytes)
5bdab6879f241a7459653e5ec363110263f0c171
3,619,999
def get_challenge_phase_by_slug(request, slug): """ Returns a particular challenge phase details by pk """ try: challenge_phase = ChallengePhase.objects.get(slug=slug) except ChallengePhase.DoesNotExist: response_data = { "error": "Challenge phase with slug {} does not ex...
169902fa80f1a02b21bf8902f2888f2a0d73624a
3,620,000
import re def parse_multiline(element, poe_implicit_split = False): """ Get data from a row & regroup tag-separated string (<br/>) in a list poe_implicit_split: <number>( to )<number> for Implicit Mods extraction (optional) """ res = [] for data in element: content = [] for x in data.strings: ...
ef59fe17a3b221086276baa67448d0870b838f71
3,620,001
def pil_to_cv(pil): """ Convert an image loaded from PIL to opencv format The main difference is that PIL uses [R, G, B] and opencv uses [B, G, R]. Args: pil: An image loaded from PIL function Returns: cv_img: The corresponding image in opencv format """ pil...
242eb812aae3eb8fa77cbc21bc4b351268e21393
3,620,002
def get_characteristics(trajectory, dim): """ Function return characteristics for given scenario :param char_set: enum, information about characteristic set scenario :param path_to_file: str, path to file with trajectory :param typ: str, type of diffusion i.e sub, super, rand :param motion: str,...
ca0a56279034cc8b6fde8802b49d75b22466696e
3,620,003
def introspection(): """Gets the base class for the introspection class. We have to use the configured base back-end's introspection class for this. """ return base_backend_instance().introspection.__class__
283d36ec9ff12bb1e1372fba4f4ee5b9c4a30027
3,620,006
def _kickoff_df(fpl_data_dict, pos, footballer_func): """ return kickoff from week df based on position""" return _fetch_history_df(fpl_data_dict, pos, footballer_func, {"kickoff_time": "kickoff_time"})
12c983af1012067f6c767d9de2c899b5d057933f
3,620,007
def score_sig_1D_base(true_signatures, pred_signatures): """ percent of mutations with the right signature Parameters ---------- true_signatures: iterable array-like of length N (number of mutations), with the true signature for each mutation pred_signat...
cd04cef1c7eecea8da804fe631fedc18c33b4d11
3,620,009
def compute_apparent_power(f, j, seconds_per_file, values): """ Apparent power is the product of the voltage RMS and the current RMS. """ cs = [n for n in list(f) if 'current' in n] apparent_power = dict() for cs_i, _ in enumerate(cs): if 'voltage' in list(f): voltage_name ...
76f7b903bce2f340d0494524f3d0d2ad40e6422e
3,620,010
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') Session.configure(bind=engine) MailboxManager.init(settings['maildir_path']) config = Configurator(settings=settings) config.add_renderer( ...
28330cd67b4be3f49ef930f8d2a9b50749a623c1
3,620,011
def charge_density(location, rho_bulk, charge, surface_potential, temperature=300, permittivity=80, species='Na'): """The density of ions near a charged surface. Calculates the number density of ions of a species, at a distance of "location" away from a metal/solution interface. The metal is charged, and thus the d...
1cc9717fd28d2d4ce040a1b960e08e4ba9236371
3,620,012
import decimal def _dict_decimal_to_float(my_dict): """If any values in dictionary are of dtype 'Decimal', cast to float so can be JSONified. """ for key, val in my_dict.items(): if isinstance(val, decimal.Decimal): my_dict[key] = float(val) return my_dict
7d1741322782c49b9b8a6a7369344797439ff00b
3,620,013
from typing import Optional from typing import Callable from typing import Dict def get_augment_preprocess( augment_params: ml_collections.ConfigDict, *, colorjitter_params: Optional[ml_collections.ConfigDict] = None, randerasing_params: Optional[ml_collections.ConfigDict] = None, mean: Optional[t...
1ae9633d09c0f12dbeedfc34dcce5779623110f1
3,620,014
import random def cutmixup(img1, img2, mixup_prob=1.0, mixup_alpha=1.0, cutmix_prob=1.0, cutmix_alpha=1.0): # (α1 / α2) -> 0.7 / 1.2 """ CutMix with the Mixup-ed image. CutMix and Mixup procedure use hyper-parameter α1 and α2 respectively. """ c = _cutmix(img2, cutmix_prob, cutmix_alpha) if c...
0868e16c2a99278368ab68c3894c1bd11194a248
3,620,015
def is_pattern_match(s, exclude, include): """check if pattern match with 'include' and 'exclude' option """ if is_windows: exclude = to_unix_path(exclude) include = to_unix_path(include) if exclude == None: return True elif include == None: return (not pattern_match(...
63e008b9332fc0708b8155b27da7be858ba8e5ea
3,620,016
def translate_filter_titles(filters): """ Translates filter titles according to the selected language Args: filters (dict): Contains the filters that shall be translated Returns: Returns the modified filters """ if filters.get("searchText", {}).get("title", "") != "": filter...
a9cf454dc21c3d3f7206902a83d847a6b8bb0e30
3,620,017
def print_available(key): """Return available models for certain parameter space Parameters ---------- key : str available parameters are [cloud, distance, gravity, metallicity, phase, temp] Returns ------- str, list input key and list of available values """ return key, header[key].unique()
c564a6d5b7c1fd4cfeb98dab7fc5d2e52dcbbb7c
3,620,018
def search(endpoint, query, sort=None, order=None, page=1, per_page=100, strict=False): """ `endpoint:str = 'users','repositories','commits'` `query:str` - users: ------ https://developer.github.com/v3/search/#search-users https://help.github.com/en/github/searching-for-information-on-gith...
fa71616cbca39cc76295340249f9a2801ec657b0
3,620,019
def augment_Q(Q): """Augment the transition matrix Q such that it is in the from required in order to solve. In essence this function gets M and b where: - M = the transpose of {the transition matrix Q with the last column replaced with a column of ones} - b = a vector of the...
09e63368f22152f03d22d4e21c2bf370754ebe8d
3,620,020
def string2cycles(string): """ Convert string from user input to permutation in cycle notation as list :param string: Permutation as string :type string: string :return: Returns permutation in cycle notation as list :rtype: list """ groups = string.split(')(') items = [] for i...
5a10f270fb934a1b22f61e84e61f679f2cad5f79
3,620,021
def gram_schmidt(basis): """ Performs Gram Schmidt Orthogonlization of a basis_o :param basis: list of numpy ndarray of shape (2,M) of M samples :rtype: list of numpy ndarray :return basis_o: orthogonlized basis """ b1 = basis[0] b2 = basis[1] basis1 = b1 / sqrt(innerprod_q2(b1, b...
403b5bd86bcf893268cb28752b7c0fd58520bb6a
3,620,023
import json def fetch_joke(): """Fetch jokes""" request = Request('http://api.icndb.com/jokes/random?limitTo=[nerdy]') response = urlopen(request) joke = json.loads(response.read())['value']['joke'] return joke
46fc2816386103b78a9251747819d721f0f0297f
3,620,024
def create(reference_set_dict, monotone_relationship, minval=None, maxval=None): """ Create a scoring function that maps objects with N attributes to scores. Required arguments: reference_set_dict -- A reference set mapping objects to scores. monotone_relationship -- A length-N vector with +1/-1 entries. +1 ...
2e7fc4bade833bf1cd4c69d370f5e0c1ebcfe959
3,620,026
import re def split_at_whitespace(string): """Like string.split(), but keeps empty words as empty words.""" return re.split(__WHITESPACE_SPLIT, string)
1862c955b02d648c8b43a31b8e92e2cdda395363
3,620,027
def _make_list_value_pb(values): """Construct of ListValue protobufs. :type values: list of scalar :param values: Row data :rtype: :class:`~google.protobuf.struct_pb2.ListValue` :returns: protobuf """ return ListValue(values=[_make_value_pb(value) for value in values])
a7028b695fe8fe7ba46304d4f03ae8a91b6be85c
3,620,028
def sciper2name(sciper): """Convert a sciper to a name, using EPFL's LDAP""" return search_attr_in_ldap(sciper, 'cn') or _("Unknown name")
cb991b80e03164b0536dd8dea527b5421f5c2461
3,620,029
from datetime import datetime def title1(): """ Ученое звание """ title = Person.Title() title.date = datetime(2010, 1, 1) title.title = 'доц.' return title
f7aeb02bc98379d4f94278185898cf887834ad2d
3,620,030
def from_args(it, key, lo, hi, prefix, reverse, max_, include, max_phys): """This function is a stand-in until the core.py API is refurbished.""" if key: it.set_exact(key) return it.forward() elif prefix: it.set_prefix(prefix) else: if lo: it.set_lo(lo) ...
859e716e5eb32be10806de400b97fdf0e4770ed4
3,620,031
def bump_version(version_array, level): """ Perform ++1 action on the array [x, y, z] cell, Input values are assumed to be validated :param version_array: int array of [x, y, z] validated array :param level: string represents major|minor|patch :return: int array with new value """ if typ...
8a26db1694cf777915cc8c170355fd77ea4e9e66
3,620,032
def all_event_tweets(request): """Summary of tweets and submission of tweets""" return render(request, 'manage/all_event_tweets.html')
7ae215dd6a6ca1576af0cfd9af60dc9286a33370
3,620,033
def map_persons_to_known_ldap_user(person_record, session): """ Since the exported persons table contains records without email from various sources, we have to try to map it to an existing record or create a new one. The ldap fetched users have an attendee created with first_name, last_name an...
9638adb1aed2a46ed6267c00b9020dd989d04b4c
3,620,034
def print_usage(): """ Print commandline usage :return: returns 1 for for exit code purposes :rtype: int """ print(""" Usage: {0} --help-info {0} [options] input.json output.json Options: --overwrite Overwrite output file -a field=val Only add a field if it doesn't exi...
5ef1e795b3a3fa6037750d2d63b1ac8989f20e20
3,620,035
from typing import Dict from typing import Any async def list_of_speakers_slide( all_data: AllData, element: Dict[str, Any], projector_id: int ) -> Dict[str, Any]: """ List of speakers slide. Returns all usernames, that are on the list of speaker of a slide. """ list_of_speakers_id = element....
90bddfe2a6401c4e0f1bdbd0a6d6eb624423f93b
3,620,036
from typing import Tuple def calculate_intervals(values: np.array) -> Tuple[int]: """Calculate intervals between the provided note values.""" return tuple( [(next_note - note) % 12 for note, next_note in zip(values, values[1:])] )
0a3103db568c5b418f2c78f3ba1f216d6c8fb914
3,620,037
from datetime import datetime def get_time_with_timezone(time_delta): """Parameter is timezone offset from UTC in seconds. Returns a string H:M:S.""" return (datetime.datetime.now() + datetime.timedelta(seconds=time_delta)).strftime("%H:%M") + " UTC" + str(time_delta / 3600)
1b0381234c2cdeb5e7738df7303538083f873ba0
3,620,038
def shallFreezeAllStdlib(): """*bool* = **not** shallFollowStandardLibrary""" return not shallFollowStandardLibrary()
0cd50ffb7b0eb1a9aa5e411187c373ee1002c03e
3,620,039
def _get_timestep_lookup_function(control_loop_period, memory_loc, rtf_key): """ Creates a customized timestep lookup function for a SynchronizedTimedLoop :param control_loop_period: duration in [s] of each timed loop :param memory_loc: location in shared memory to get() data from :param rtf_key: ke...
500e61c0cbb38012bbce18dfc6f648c78a4b3f36
3,620,040
import re def finditer(pattern, string, flags=0): """Finditer after applying backrefs.""" return re.finditer(_apply_search_backrefs(pattern, flags), string, flags)
ee472668784ebcb80d78ccf4b71fba4121691908
3,620,041
def stretched_exponential_series(Lambda = 1.0, Beta = 1.0, n = 1, xmin = 1.0, discrete = False): """ Generator to generate a stream of numbers taken from stretched exponential distribution. **Parameters** Lambda : Float/Integer, Lambda constant for the distribution. Default value is 1...
53ca7792e03e0dac88a257618d637dd115f37bd1
3,620,042
def decode_mint_to(instruction: TransactionInstruction) -> MintToParams: """Decode a mint to token transaction and retrieve the instruction params.""" parsed_data = __parse_and_validate_instruction(instruction, 3, InstructionType.MINT_TO) return MintToParams( program_id=instruction.program_id, ...
4a42f57184066e5e420ec189c72c9868aab68ec0
3,620,043
def daemonize(func): """ A function wrapper that checks daemon flags. This wrapper as it is assumes that the calling class has a daemon attribute. """ def _wrapper(self, *args, d_init=False, **kwargs): if d_init: self.daemon.d_init.append((func, self, args, kwargs)) retur...
3f7b52c319be0a570e8c4843d061e1d0387982af
3,620,044
import functools def authenticated_user(method): """Decorate methods with this to require that the user be logged in.""" @functools.wraps(method) def wrapper(self, *args, **kwargs): if not self.current_user: if self.request.method in ("GET", "HEAD"): url = self.get_logi...
f287b3a1f5e364c03dbf41316e9e37577163caf3
3,620,046
import base64 import re def make_string_to_dict(base64_headers: str) -> dict: """分割: """ d = {} s = base64.decodebytes(base64_headers.encode('utf-8')).decode('utf-8') string_list_by_line = s.strip().split('\n') for each in string_list_by_line: each = each.strip() # 去除:开头的 ...
b00eb4b1c69031882b6eacf6d97f67ef4d620f1b
3,620,047
def _find_converter(type_: type, /) -> MaybeNone[ConverterT]: """ !!! note: This is a Future object that will be relevant in future versions of petuhlang. There is no point in using it right now. """ for types in __converters__.keys(): if type_ in types or type_ is types:...
a92aadb9d63c9e947abac018796246ad71ba6061
3,620,048
def proccess_host(host): """ :param host: This should be a dict where host['host'] is an ip address :return: """ host['country_code'] = gi_country.country_code_by_addr(host['host']) host['country_name'] = gi_country.country_name_by_addr(host['host']) host['asn'] = gi_asn.asn_by_addr(host['h...
990d2bf96700ee2f75331ca009ac422126b15809
3,620,049
def trajectory_2d( tracks, image=None, labels=None, color=None, xlim=None, ylim=None, cmap=None, cbar=False, cbar_width=30, show_points=False, line_kws=None, scat_kws=None, im_kws=None, dpi=None, scale=1., margin=None ): """ 2d plot of trajectories. ...
7cf737cf96dcb2b60764914ababf6600c22038e0
3,620,051
def plan_validation(user, plan=None, on_activation=False): """ Validates validator that represents quotas in a given system :param user: :param plan: :return: """ if plan is None: # if plan is not given, the default is to use current plan of the user plan = user.userplan.plan...
94ad3a1b2d49ac519706781a62084928826bb4e6
3,620,053
from re import A from re import M from re import T from re import S from re import I from re import L from re import U from re import X def flairgen(submission): """Convert letters in string to inline flair codes - regular mode. Input string -> converts as list -> output string Iterates through tuples of ...
11eade517eecbda42dffe3db18bedab2052c396e
3,620,054
def vm_modify(vm_uuid): """ Render the details of the VM """ run=libvirt_test() form=ModifyVMForm() _,vm_detail=run.api_get_domain_detail(vm_uuid) if form.validate_on_submit(): #department.name = form.name.data #department.description = form.description.data #db.sessi...
4af36f4132a9defa3bc96dd653a5f32cfb9fa793
3,620,055
def edit_on_keypress_seq_corr(word): """ #### this is the BALL of the @word ### """ word = word.encode('ascii', 'ignore') keypress_w = KB.word_to_keyseq(word) return list(KB.keyseq_insert_edits(keypress_w, allowed_keys, allowed_keys)) # for i, c in enumerate(keypress_w): # f...
b6c46efe4effcb1d8998205d7d31edd86578b17d
3,620,056
from typing import Optional from typing import Set def marker_algorithm(psi: HornFormulaSet) -> Optional[Set[Variable]]: """ Applies Marker Algorithm to given Horn Formula and returns either minimal model (if satisfiable) or None :param psi: Horn Formula represented as HornFormulaSet :return: Minimal ...
e25e060e1c1b9d81931a50a009a36d1055c5640e
3,620,057
def read_toc(toc_file): """Reads Table of Contents from the given file object 'f'. Each line in file should be in form <'*' x level> <page number> <description> 'level' of the next line should be at most one '*' larger than that of previous line. First line should contain encoding name. Exam...
3e2fc5fa334cf6c91c3a1436ae315561daab5578
3,620,059
def register(): """ Register a user to the application :rtype: flask.wrappers.Response :return: Registration status """ account_json = request.get_json() username = account_json.get('username', None) password = account_json.get('password', None) db = get_db() error = None i...
3dc1fe2f50e8d89dc7c16be67f9b248c3b2dd380
3,620,060
import struct def make_error(error_code): """ Makes and returns Error message.""" temp_payload = struct.pack('<B', error_code) payload = bytearray(temp_payload) message = HibikeMessage(MESSAGE_TYPES["Error"], payload) return message
226a5bb557503eadbe3fb34c4938fda55d5e8fe0
3,620,061
from sage.rings.infinity import Infinity def solve_ineq_fourier(ineq,vars=None): """ Solves sytem of inequalities using Maxima and fourier elimination Can be used for system of linear inequalities and for some types of nonlinear inequalities. For examples see the section EXAMPLES below and http:/...
944f23551c220b3b9fe9f0e139454c6ca36eabcb
3,620,062
def get_cursor(connection): """ Gets a cursor from a given connection. :type MySQLdb.connections.Connection :param connection: A mysql connection :rtype MySQLdb.cursors.SSDictCursor :return A mysql cursor """ return connection.cursor()
dc1e9b99bff6b43eb324161026196358d318f59c
3,620,063
def make_pes_mess_str(spc_dct, rxn_lst, pes_idx, pesgrp_num, unstable_chnls, run_prefix, save_prefix, label_dct, tsk_key_dct, pes_param_dct, thy_dct, pes_model_dct_i, spc_model_dct_i, spc_model): """ Write ...
ca38381481d8d43aafb65dfb71e61d21e436b9ca
3,620,064
def specimens_extract(spec_file='specimens.txt', output_file='specimens.xls', landscape=False, longtable=False, output_dir_path='.', input_dir_path='', latex=False): """ Extracts specimen results from a MagIC 3.0 format specimens.txt file. Default output format is an Excel file. t...
ee55ff511ac4d8b2b26ba5ddf3d14d1d018bd60a
3,620,065
def _get_flim(flim, fscale, freq, sfreq=None): """Get reasonable frequency limits.""" if flim is None: if freq is None: flim = [0.1 if fscale == 'log' else 0., sfreq / 2.] else: if fscale == 'linear': flim = [freq[0]] else: flim...
5424e6b43b20ec95127e5bed941f44bfbede1731
3,620,067
import collections def get_programs(): """Get the counts of how many users belong to each program.""" users = m.User.objects().only('program_name') programs_names = [user.short_program_name for user in users] program_frequencies = collections.Counter(programs_names) programs = [] for program...
8ab828e3b96b3672d99f0fd5f706d865b0d840cd
3,620,069
def halt(sending=False, removing=False): """ READ for the HALT command, SEND it, or CLEAN the HALT file. IMPORTANT: In order to prevents the system from ignoring your halt commands, please don't forget to include this test in your (heavy) loops! Examples: ...
f86bc23e85da8944e9b66b10be07330703530c72
3,620,070
def _popup_footer(view, details): """ Generate a footer for the package popup that indicates how the package is installed. """ return """ {shipped} <span class="status">Ships with Sublime</span> &nbsp; &nbsp; {installed} <span class="status">In Installed Packages Folder</span> &nbsp;...
8f159f75990e87c8d431bb2dd1d01e648079ac96
3,620,071
def process_chunk( archive: ZipFile, layer_id: str, chunk_name: str, imagesize: list[int], tilesize: int, columns: int, rows: int, difference_x: int, difference_y: int, strict: bool ) -> tuple[Image.Image, tuple[int, int]]: """iterate through chunks, decompress them, create images""" # G...
ffe289d13ddd87bcb744c11cb7ef20c9d5c1de9e
3,620,072
def testForUnevenHandles(glyph): """ Handles should share the workload as evenly as possible. """ unevenHandles = {} for index, contour in enumerate(glyph): prevPoint = contour[-1].onCurve for segment in contour: if segment.type == "curve": # create rays p...
41c44d741305de4e5c7174c7b2f5bac7a70107ad
3,620,073
def get_all_pages_url(ptt_index_url): """accroding get_max_pages, generate each page url index, index0, index1, ... , index == indexMax """ max_page = get_max_pages(ptt_index_url) url_head = ptt_index_url.split('index')[0] all_urls = ["{}index{}.html".format(url_head, i) for i in range(1...
1b94d7f0cfdd9a2ee35e35fd9544136024f819c6
3,620,074
import logging def query_tweets_once(query, limit=None, num_tweets=0): """ Queries twitter for all the tweets you want! It will load all pages it gets from twitter. However, twitter might out of a sudden stop serving new pages, in that case, use the `query_tweets` method. Note that this function ...
834ea5536f53e3659cd3ca5142e3ae3b410b1d35
3,620,075
def trycast(new_type, value, default=None): """ Attempt to cast `value` as `new_type` or `default` if conversion fails """ try: default = new_type(value) finally: return default
d670f545fb1853dfd95da1de961e44ee5a477c5f
3,620,076
def unwrap(*args, **kwargs): """Unwraps the tuple into function parameters before calling the function. This is not implemented on the Java side yet. """ return _function_decorator(args, kwargs, { 'parameters' : 'unwrap' })
7b16d71c58ea3922b1b30f7c9f5623dc47696a37
3,620,078
from re import I def msigma(i): """Returns a Pauli matrix sigma_i. i=1,2,3 See Also ======== http://en.wikipedia.org/wiki/Pauli_matrices Examples ======== >>> from sympy.physics.matrices import msigma >>> msigma(1) [0, 1] [1, 0] """ if i == 1: mat = ( ( ...
d23aec2d1f60bd82ee19ac40b22e6923c064df31
3,620,080
def _generate_wireless_settings_data(settings): """Generates a wireless settings data array to push to the router from the given wireless settings.""" settings.ensure_valid() data = {'ssid1': settings.ssid, 'channel': settings.channel, 'Save': 'Save'} if settings.is_enabled: data['ap'] = 1...
d41d13f56ecd813d01d2c9223db0b69ad26af5ae
3,620,081
import json def load(tfrecord_file, meta_data_file, model_spec): """Loads data from tfrecord file and metada file.""" dataset = input_pipeline.single_file_dataset( tfrecord_file, model_spec.get_name_to_features()) dataset = dataset.map( model_spec.select_data_from_record, num_parallel_calls=t...
ee25b910f6868dc5def5d9699b7a5cd03f5abb0d
3,620,082