content
stringlengths
35
416k
sha1
stringlengths
40
40
id
int64
0
710k
import argparse def parse_args(): """ Create the help menu prompts and parse the given attributes. If an optional argument is not provided in the command line, the default attribute values are used. If the user provides the same valid feature set id or the same valid method multiple times, the du...
0bf687d302b5c7d69d98f81a2bae69d130f33855
639,007
def partition(array, low, high): """ This function takes last element as pivot, places the pivot element at its correct position in sorted array, and places all smaller (smaller than pivot) to left of pivot and all greater elements to right of pivot. """ pivot = array[high] i = low -...
318310e6e2e39d506fba79fe7839839d8b29ede4
639,008
import time def time_it(func): """ """ def wrapper(*args, **kwargs): """Returns random words from a file Parameters ---------- path : str, OSX words list by default The path of the words file num : int, at least 1 word by default The numb...
04f325db055d7ba8dadba55240e77631801009ad
639,009
def get_name(): """ should return the name of the tool as listed on http://qcomp.org/competition/2020/""" return "mcsta"
e87c8663c14f54d2f76fde44d413cb93f2760f29
639,010
def swap(array, i, j): """меняет местами два элемента в массиве""" arr2 = array[:] arr2[i], arr2[j] = arr2[j], arr2[i] return arr2
1d5a85786ea03681126928310f8e8c71c2a87cc9
639,011
import operator def majority_cnt(class_list): """ 从标签列表中得出出现次数最多的标签 :param class_list: 应该是标签的列表 :return: """ class_count = {} for vote in class_list: if vote not in class_count.keys(): class_count[vote] = 0 class_count[vote] += 1 sorted_class_count = sorted(...
9a44bc943a484ac459773cdf7dd217a8ef9a3244
639,012
import numpy def unpack_sequence(sequence_binary_encoded: numpy.ndarray) -> numpy.ndarray: """ Unpack a sequence of numbers represented with 8-bits to its signed integer representation using numpy. :param sequence_binary_encoded: the 8-bit numbers sequence to unpack (in the form of a numpy array, ndarray...
5f24a31af1db729f44436e57e4a25ed7dbe8911a
639,014
def find_module(course, module_name): """ Uses module name to find the corresponding module """ for module in course.get_modules(): if module.name == module_name: return module
b7ae98bcd52d32b2687f5f780ba4a038f332f934
639,015
import collections def _create_family_to_faces(notofonts, name_fn): """Notofonts is a collection of NotoFonts. Return a map from preferred family to a list of preferred subfamily.""" family_to_faces = collections.defaultdict(set) for noto_font in notofonts: if noto_font.fmt == 'ttc': continue ...
cc6a921b9ece09725e192fd2ed7deb684b256385
639,017
import requests def get_recent_kills(sysid): """ Retrieves recent metrics for specified system in list format for ease of parsing :param sysid: the integer value ID of the system to be checked :return: List of npc_kills, pod_kills, ship_kills for the specified system. """ interaction_list = [...
1011a87f55756874e91695856fb10ba241bdc85c
639,018
import errno def errors_numbers(errnames): """utility to build a list of socket errors""" return set([getattr(errno, k) for k in errnames if hasattr(errno,k)])
ac554245157529ee2c5069fdf1c13aeded3bbd4e
639,019
import hashlib def get_hash(filepath): """ Get's a file objects' hash """ with open(filepath, "rb") as fobj: file_hash = hashlib.md5() chunk = fobj.read(8192) while chunk: file_hash.update(chunk) chunk = fobj.read(8192) return file_hash
7ed54c6e6906c0fb14f644a405b10528ef09ee98
639,020
def convert_to_physical(a_coeffs, b_coeffs, logic_x, logic_y): """ Convert to physical coordinates from logical coordinates. Parameters ---------- a_coeffs : array Perspective transformation coefficients for alpha. b_coeffs : array Perspective transformation coefficients for bet...
a18602ce1276348926c86863ef33c67d7280176a
639,021
def split_seconds_human_readable(seconds): """ splits the seconds argument into hour, minute, seconds, and fractional_seconds components. Does no formatting itself, but used by format_seconds_human_readable(...) for formatting seconds as a human-redable HH::MM:SS.FRACTIONAL time. """ if isinstance(...
9cbb8588f27ded71c43a8803ab52db0603c2ad49
639,023
import inspect def has_required_functions(ref): """Validates if there are the required functions to configure and execute a spark program Parameters: ref (module): Python module that acts as entrypoint Returns: bool: True if has the required functions """ return (hasattr(ref, 'c...
b7998449723f57525d513a05961ec55ef3fcf294
639,024
import enum def _fromflagname(cls, name:str, default=...) -> enum.Enum: """Returns the flag enum from the the specified name when `default` argument is defined: returns `default` on invalid name otherwise: raises `KeyError` on invalid name """ if default is not Ellipsis: ...
f35c00d18be388b818f5ad289942e295bbbc0717
639,025
def leer_palabras(path_archivo): """ De un copy-paste de paginas de wikipedia, etc. """ with open(path_archivo) as archivo_palabras: return [palabra.strip().lower()[:6] for palabra in archivo_palabras.read().split()]
d5c63a623d4173a03da9cefd37cfd3f022c5923a
639,026
import hmac import hashlib import base64 def gen_sig(key, data): """ Generates a HMAC RFC-2104 signature :key: your key :data: string to sign """ signature = hmac.new(key.encode('utf-8'), data.encode('utf-8'), hashlib.sha1) sig = signature.digest() # base64 encode b64 = base64.b64e...
ca4f094b438be2209ae6e370bc08cfd751efab48
639,027
import requests def get_page(url: str, store_num: str= '095'): """ Given a Microcenter URL, return request object :param url: str, microcenter url :param store_num: str, store number as string, defaults to MO - Brentwood :return: requests.model.Response, html from url """ headers = { ...
02eb540cd26f9552b22c9ad305553080054df3d5
639,028
def split(inp): """ Like os.path.split, but splits at EVERY backslash and fowardslash. """ return tuple(inp.replace('\\', '/').split('/'))
cf4310358b3625757456e68aa0bfd6b80f1427a5
639,029
def _clang_copts(objc_fragment): """Returns copts that should be passed to `clang` from the `objc` fragment. Args: objc_fragment: The `objc` configuration fragment. Returns: A list of `clang` copts. """ # In general, every compilation mode flag from native `objc_*` rules should be...
59436298ecfbde75d0f90ba5f07811b328f42ff5
639,030
def create_pytest_param_str_id(f): # type: (...) -> str """ Returns an id that can be used as a pytest id, from an object. :param f: :return: """ if callable(f) and hasattr(f, '__name__'): return f.__name__ else: return str(f)
26fd71c0bf19da99d901e428e35daec1e4c4a0bb
639,032
def typename(obj, docp=False, qualp=False): """Typename of the obj object retval-> module:obj<doc> when obj is callable and qualp=False module:class.obj<doc> when obj is callable and qualp=True module:class<doc> when obj is a class or an instance of a class ...
f0b55d878f1618586a99e5751a7a76ac5335f8fd
639,033
import logging import re def parse_line(line): """parse_line Parse a single line from the output of mixerctl -v :param line: """ if len(line.split("=")) != 2: logging.warning( "don't know what to do with line '{}', no '='".format(line)) return (line, {}) nam...
8db95c6c9ce1541473e2bda308851a9a4f02c8bf
639,034
def scenario_only_sos_model_dict(): """Config for a SosModel with one scenario """ return { 'name': 'test_sos_model', 'description': 'Readable description of the sos model', 'scenarios': [ { 'name': 'climate', 'scenario': 'UKCP09 High emiss...
9461810b0841976031c282abd1d16be66334100c
639,035
def ProbEarly(pmf): """ <= 37 """ rate = 0.0 for w, p in pmf.Items(): if w > 37: continue rate += p return rate
83dadb46823cec5916cc022e4f19f9ab170d848a
639,036
from pathlib import Path def get_y_fn(x): """ this function finds the files for the target images to create the dataset, which is then used to create the dataloaders """ parent = 'train' if 'train' in str(x) else 'valid' fname = x.name.split('.')[0] + "_target.tif" # print(x.stem) #fn ...
49e419c8e68229529a38734d031fd6c5e294694d
639,037
def get_validate_num(send_data: list): """ 取最后2位,对0xFF取余数 :param send_data: :return: """ return sum(send_data) % 256
d0134bef49aea3e0616dea179262fbf8c2eace19
639,038
def deserializeString(cls, expr, name): """Used by Pickle to reconstruct a string-based histogrammar.util.UserFcn from Pickle data.""" out = cls.__new__(cls) out.expr = expr out.name = name return out
214cc61ee20b10f904207fbfa17f73b57686078a
639,039
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 += "{} ({})".format(action["name"], action["action"]["class_name"]) if idx == len(action_list) - 1: ...
f785bf34f0d0dd29fd5be7bd3b75d2dfc7d77da2
639,040
from typing import Dict from typing import Any def drop_private_keys(full_dict: Dict[str, Any]) -> Dict[str, Any]: """Filter for entries in the full dictionary that have numerical values""" return {key: value for key, value in full_dict.items() if key[0] != "_"}
a266a990c09cdd280fbc3def4bdb852e9f58e04e
639,041
def to_package_name(text): """ to_package_name(text) strips out all invalid characters and converts to lower-case, replacing slashes with periods """ t = text.strip().lower().replace('/','.').replace('\\','.').replace('-','.') clean = "" clean_chars = 'QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm123456...
348ac7d117cc9f4cc27f0548eccb54459c8a586c
639,042
def solve_a(grid): """Solve Part A""" overlapping = 0 for pos in grid: # count how many ids are stored at each position # any inches with more than one claim id are considered overlapping if len(grid[pos]) > 1: overlapping += 1 return overlapping
e83f05817b7ee1728de169d94f842d8465562a50
639,043
import json def _GenerateCopyCommand(from_path, to_path, comment=None): """Returns a Dockerfile entry that copies a file from host to container. Args: from_path: (str) Path of the source in host. to_path: (str) Path to the destination in the container. comment: (str) A comment explaining the copy ope...
c1c5fb832cbde60f4ebed675b231a15166159673
639,044
import argparse def get_input_args(): """ The training script allows users to choose from at least two different architectures available from torchvision.models The training script allows users to set hyperparameters for learning rate, number of hidden units, and training epochs The training script al...
75e120ce803c6e3cf445542b2904af46bc269462
639,045
from unittest.mock import patch def patch_rng(return_value): """Decorator returning a @patch decorator for 'fake_logs.weighted_choice'.""" def decorator(fn): def decorated(self): with patch("fake_logs.weighted_choice.random.uniform", return_value=return_value): return fn(self) return decorated return de...
5fa5abad2823c0cbb18e7eae41e2f5c9e15e35e9
639,047
def is_valid_git_refname(refname): """check if a string is a valid branch-name/ref-name for git Input: refname: string to validate Output: True if 'refname' is a valid branch name in git. False if it fails to meet any of the criteria described in the man page for 'git check-ref-format', al...
f5ea7057e202df0c821f3c7a52882cee6d95f6d3
639,048
def background_column(s, background=255, threshold=None): """Report whether all values in a column are the same.""" a = s.to_numpy() return (a[0] == a).all() and a[0] == background
2127a6c9dda865ff6d1ca0cb513b828e5bd8aaba
639,049
import os def get_local_file_location(relative_file_name): """ This function... :param relative_file_name: :return: """ # credit: http://stackoverflow.com/questions/7165749/open-file-in-a-relative-location-in-python script_dir = os.path.abspath( os.path.dirname(__file__) ) #...
92e4d551cc3a58741b8848f7a8468b5b1af943ca
639,050
def _is_parsable_header(structure): """ Determines if a PDS4 header structure can be parsed into plain text. Header structures that can be displayed as text are: (1) Plain-text Headers (2) Headers that can be turned into plain-text via a parser """ return structure.is_header() and has...
ccc06066651c7babfd13970b2bb9dc78c0967c5a
639,052
def where(cond, x, y): """Do same operation as np.where code from: https://discuss.pytorch.org/t/how-can-i-do-the-operation-the-same-as-np-where/1329/8 """ cond = cond.float() return (cond*x) + ((1-cond)*y)
7c8f7d5fcd1a73ce71e08c06c47a7f101cf8931c
639,053
def getInfoTableHtml(columns, rows, tableClass): """ Convert @rows, which is the output of getParamInfo(), into an HTML table. @columns is a list of columns to use in the table. @tableClass is the HTML class to put on the HTML table element, available for CSS styling. """ nonEmptyColumns = [c...
b765db3e102f6114d59e0905d03adff0af2c5c91
639,054
import click from typing import Type from typing import Optional from typing import Any def find_ctx_dict_instance( ctx: click.Context, at_key: str, instance_type: Type) -> Optional[Any]: """Return the first `ctx.obj` of type `dict` containing an instance of specified type at specified key. T...
d084b61aec2628c90dbbd77fe648bc794be2b0b9
639,055
def eta(z, x, beta): """ Eq. (6) from Ref[1] (coeffient of alpha) Note that 'x' here corresponds to 'chi = x/rho', and 'z' here corresponds to 'xi = z/2/rho' in the paper. """ return -6 * z / beta**2 / (1+x)
8af87428a80da9e8630aa6356215bd925482feaf
639,056
import importlib def class_from_dotted_path(dotted_path): """Loads a Python class from the supplied Python dot-separated class path. The class must be visible according to the PYTHONPATH variable contents. Example: ``"package.subpackage.module.MyClass" --> MyClass`` Args: dotted_path...
4888ea47ffe3395452550fe2109df53d500f75f9
639,057
def get_author_data(author): """Creates a author object from a PRAW Redditor instance Parameters: author (praw.models.Redditor): PRAW Redditor instance Returns: dict: object with information about a Reddit user, like his name or id """ try: if (author == None): retur...
7d61df20d22c524ba6eb7c2f6ecc2f1eb44ee55f
639,058
def get_units_title(unit_type): """ Get the title for units """ units_title = "m" if unit_type == 'english': units_title = "ft" return units_title
d032f50661ad42aed97aff7f2b19ebb9d8ebc366
639,060
def crop_to_bottom_half(image): """Return only the bottom half of image.""" image = image.crop((0, image.size[1] / 2, image.size[0], image.size[1])) return image
7e8f7e106e483afdf26242de0963e1033bdf9720
639,062
import re def parse_cg_history(fh): """Parse sirius.py.nlcg output """ rgx = '\s*([0-9]+)\s+([0-9e\+\-\.]+)\s+([0-9e\+\-\.]+)\s+([0-9e\+\-\.]+)' out = [] for line in fh.readlines(): match = re.match(rgx, line.strip()) if match: i = int(match.group(1)) F = ...
b5ca656d00125e6cbf044ba800d674b18d12431d
639,063
def userid_post(self, team_id): """ Create a new user --- tags: - users parameters: - in: body name: body schema: id: User required: - email - name properties: email: type: string description: email for user ...
3e2e9628cc3e19db74f1db415f5a4130e26cf45c
639,064
import argparse def parse_arguments(): """ Command line shortcut to run conversion script. Usage example: $ python convert_openephys.py --output path_to/output.nwb --file_raw path_to/file_raw.ap.bin --file_lfp path_to/file_lfp.lf.bin --file_expo path_to/file_expo.xml --f...
95163b7b894b90d843740de4a819162eb6d01260
639,065
def number_to_base(n, b): """ translates a decimal number to a different base in a list of digits Args: n: the decimal number b: the new base Returns: A list of digits in the new base """ if n == 0: return [0] digits = [] while n: digits.append(int...
103cf77bfaa03321e1d9cae04b4900f1faab5727
639,066
def traj_name_filter(traj, string): """ Filter out trajectories that have the given `string` in the `traj.traj_name` """ return string in traj.traj_name
33ceb6d04db30c87dfb2e6615c753c228dae1470
639,067
from enum import Enum def _defaultMetaSerialize(value): """ Is called by `json.dumps()` whenever it encounters an object it does not know how to serialize. Currently handles: 1. Any object with a `serialize()` method, which is assumed to be a helper method. 1. `numpy` scalars as well as `...
220d9d727248b7fa8f32210c11e8ee60ad2c2d69
639,068
import sys def parse_her_header(filename): """ This function parses the her file header to try to figure out what units to use """ # Default unit is meters unit = "m" try: input_file = open(filename, 'r') for line in input_file: line = line.strip() ...
17eefedb7254dd9924e37f4271b3c6f6fb36db6d
639,070
import requests def get_income(acc, api_key): """ Return the income of the customer """ res = requests.get("https://api.td-davinci.com/api/customers/" + acc, headers={'Authorization': api_key}) res_data = res.json() data = res_data["result"] return data["totalIncome"]
06c098b964c8f0a39614a145e92ae66d60ca678e
639,071
import torch def _pixel_to_clip(pix_pos, depth_map, params): """ :param pix_pos: position in pixel space, (2, N) :param depth_map: depth map, (H, W) :return: clip_pos position in clip space, (4, N) """ x_pix = pix_pos[0, :] y_pix = pix_pos[1, :] H, W = depth_map.shape f = params....
f7572134c2e30bf7b163938d9eab0cf041c27eed
639,072
import os def __get_first_unused_loop_device() -> str: """ returns the path to the first unused loop device (e.g. /dev/loop4) """ return os.popen('losetup -f').read().strip()
6699b846a0987da6b4b175f279ab23ca81128f23
639,074
def replace_dict_values(source, replacements): """Creates a copy of the source dictionary and replaces all values specified in a replacement list :param source: The source dictionary :param replacements: The replacements. This is a list of key/value tuples, where dots in the key describe the hierarchy ...
eb554ac21999155d7eaae94a877d9f81c8857c05
639,075
from typing import Dict from typing import Any def version_only() -> Dict[str, Any]: """Input file with only a compose-file-version specified.""" return {"compose-file-version": "4.0"}
a0f4a0dc975efd007ada8c2a42ba943df5a3d77e
639,076
def nested_set(dic, keys, value): """ :param dic: :param keys: :param value: :return: """ dictionary = dic for key in keys[:-1]: dic = dic.setdefault(key, {}) dic[keys[-1]] = value return dictionary
bd2890dce2a5a0d0fc8dc3fa5fa5163c0010fc4c
639,077
from datetime import datetime def change_date_format(date: str) -> str: """ Parsing "%Y-%m-%d to %m/%d/%Y """ datetime_object = datetime.strptime(date, "%Y-%m-%d") return datetime_object.strftime("%m/%d/%Y")
284910b267e87f4616b4d0e8aa4aefd3db9fcafe
639,078
def iflatten_instance(iterable, terminate_on_kls=(str,)): """Derivative of snakeoil.lists.iflatten_instance; flatten an object. Given an object, flatten it into a single depth iterable- stopping descent on objects that either aren't iterable, or match isinstance(obj, terminate_on_kls). Example: >>> print ...
3fd46a46ac04107ef490396c2ae92c7d2626a786
639,079
def existing_database(database): """ Returns: Database: Created in sync gateway. """ database.create() return database
28c0151da151160ec5649f47d3c14d11d0895cba
639,080
def get_rows(rows, header): """ takes the rows and header and returns a dict for each row with { key : <td> } """ header = [x.text_content().strip() for x in header] keyed_rows = [] for r in rows: dict_row = {} for k,v in zip(header, r.xpath('td')): dict_row.update({k...
f432d09aeec35012641ace4f6c395b07e22f57a5
639,081
def jogador_pontuacao(jogador): """ Seletor do TAD jogador Devolve o valor da pontucao do jogador Argumentos: jogador -- jogador """ return jogador[1]
9cc54804212e89b576b333354f0db7ad06e28c90
639,082
import pkg_resources def package_filename(name: str) -> str: """Get fullpath of a package filename specified by the base filename. Args: name: base name of the package file Returns: Fullpath of the package file """ return pkg_resources.resource_filename('line_item_manager', ...
0b88de3ccc6bb644769bba50a58ea4a883387522
639,083
def pigment(depigm, incpigm, cga, anyga): """ any pigm abn (depig, inc pig, noncentral GA) Returns: 0, 1, 88 """ if depigm == 1 or incpigm == 1 or (anyga == 1 and cga == 0): return 1 elif depigm == 0 and incpigm == 0 and anyga == 0: return 0 else: return 88
e7b0d641d14dbeb85a56cb8677efa7d8a774400b
639,084
def unique(elements): """ Returns a list of unique elements from the `elements`. :param elements: the input elements. :type elements: list :return: the list of unique elements :rtype: list """ element_set = set() unique_list = [] for element in elements: if isinstance(el...
b05767271b9cef779cb26e17f136e82361a6a5a5
639,085
import random def exponential(value): """ Set retry time exponentially; per the "+ 1," begin at a minimum of one second. """ return random.random() * (2 ** value) + 1
a30c4bcf2d300b09ea9f1df293359098da8e85a7
639,086
def pyparser_matcher(text, pos): """syntactically correct python code""" line_end = text.find('\n', pos) if line_end == -1: return None try: c = compile(text[pos:line_end], '__abac_model__.py', 'eval') except SyntaxError: return None return c, line_end
6bc6364330b153b21a9de42b1f322ba410614016
639,087
def customer_2(accounts) -> str: """Get another customer address.""" return accounts[2]
65b5e9f0330cd5dd9777d4e7a90a17b81ec56064
639,088
def custom_account(threescale, request, testconfig): """Parametrized custom Account Args: :param params: dict for remote call, rawobj.Account should be used """ def _custom_account(params, autoclean=True, threescale_client=threescale): acc = threescale_client.accounts.create(params=para...
6678d7d7e24a1452715eb318af621fdd3bbb443a
639,089
def type_error_msg_2(self, operand: str, other) -> str: """Return a python built-in like error message""" return "'{0}' not supported between instances of '{1}' and '{2}'".format( operand, self.__class__.__name__, other.__class__.__name__)
bb0dbaee5d4c8d97a1b27e431fc041b2a3f5cf20
639,091
def extract_state_fips(fips: str) -> str: """Extracts the state FIPS code from a county or state FIPS code.""" return fips[:2]
241bab8540c32c4e41597723bd42bc7b35a7d303
639,092
from collections import Counter def prepare_full_vrt_dicts(vrt_file_dict, vrt_dt_dict): """ takes vrt file and datetime file dicts and combines into one final dict """ # imports # notify print('Combining vrt files and datetimes per band.') # checks # get list of...
90f51240ef48cd6337878fbeec0844b424800b87
639,093
import re def clean_doc(doc): """Cleans a document, extracts meta data, returns a dictionary""" # Split header and text topmarker = "Body" if re.search("\n" + topmarker + ".?\n", doc) is not None: headersplit = re.split("\n" + topmarker + ".?\n", doc) header = headersplit[0] ...
24f2b2f784ab21eb8743d0c12095c620d6ea7025
639,094
import os def create_barcode_hussle_dict(): """Turn TSV-file to dict. Read tab seperated file with our barcodenumber and the official one. Return dict with our number as key and the official as value. """ basedir = os.path.dirname(os.path.abspath(__file__)) barcodedict = dict() with open(...
e6ed01cca7760f1e226252511cdbbbc90e37a00f
639,095
def kolibri_userinfo(claims, user): """ Fill claims with the information available in the Kolibri database """ claims["name"] = user.full_name return claims
29f64178481de1b06250c2171e5ea8c51170298c
639,096
import re def get_first_image(content): """Returns a url to the first image found in a html string.""" matches = re.findall(r'<img([^<]+)>', content) for match in matches: match_src = re.search(r'src="([^"]+)', match) if match_src: return match_src.group(1) return None
db3c9abf391d1f3e0350064e8655ac2460edc597
639,098
import torch def run_planner_on_true_kp(model, data_dict, batch_size): """ Teacher forced inference on planner decoder Args: data_dict: ph_bank_tensor: [batch_size x max_ph_size x max_ph_len] ph_bank_sel_ind_inputs_tensor: [batch_size x max_sent_num x max_ph_size] ...
844dfa054caa6e077321ac235f8b4e09d0d1bba4
639,099
def cut_inv(n, deck_len, x): """Where is the card at position x before this cut?""" return (x + n) % deck_len
74911d8f532ac280c50a43d9303911a523241f10
639,100
def get_slide_id(full_filename:str) -> str: """get slide id Get slide id from the slideviewer full file name. The full_filename in the slideview csv is of the format: year;HOBS_ID;slide_id.svs for example: 2013;HobS13-283072057510;1435197.svs Args: full_filename (str): full filename o...
fd225d7803318e79659833f64d3069d3056ec698
639,101
from datetime import datetime def timer(start_time=None): """Counting processing time :parameter start_time: if None start to computing time, if not None compute total processing time :type start_time: None, datetime :return start datetime or print out total processing time """ # Get starting ...
79e993abb2c87417035616ee29c7c084823fdc8e
639,102
def at_drop(arg, length): """ %s N \t\t -- drop N elements from list/string. """ return arg.value[int(length):]
95d21cc4bc70074b99335a609d9cafe7f622bcd2
639,103
import random def insere_randomico(lista, qtd_insercao): """ Insere n elementos de acordo com a quantidade passada por parametro qtd_insercao -- quantidade a ser inserida na lista """ for contador in range(qtd_insercao): lista.append(random.randint(1,10000)) random.shuffle(lista) r...
d7c16c71831cb2104d789abfbb678e8ac07f4eae
639,104
import os def _fo_wrnew(fpath, mode): """Creates and opens a regular file in write-only, raises an error if it exists""" return os.open(fpath, os.O_WRONLY | os.O_CREAT | os.O_EXCL, mode)
4441c0c276310daf7862b14eed6dc847bf49f434
639,105
def strip_output_logs(output): """Strips logs such as 'Add user ... ' etc from output returned by env_up. Returns env description. """ return output.strip().split('\n')[-1]
36c5aefb4ed523819a45dd565bfa59698e06ab62
639,106
from typing import List import subprocess def run_external_command(command: List[str]) -> str: """Wrapper to ease the use of calling external programs""" process = subprocess.Popen(command, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output, _ = process.communicate() ret = process.wai...
856904547ffbd4c513a900f68ed2f4a456c9ae1c
639,107
def sum_str(a, b): """Add two strings of ints and return string.""" if a == '' or a == ' ': a = 0 if b == '' or b == ' ': b = 0 return str(int(a) + int(b))
bb8f4a6c34ef5c803b3dfe8b9a05fd5e84dba5cc
639,108
def InitialILCInput(t, T, u0, uT): """ Conduct linear interpolation in the time domain for the torque and force applied at the shoulder joints by the user of the PLLO, in order to initialize the ILC algorithm. Arguments t: Time in [s]. T: Duration of ascension phase in [s]. ...
0b9c534d7d5ca429e312b07363d3e7599f77467e
639,109
def unifymorphfeat(feats, percolatefeatures=None): """Get the sorted union of features for a sequence of feature vectors. :param feats: a sequence of strings of comma/dot separated feature vectors. :param percolatefeatures: if a set is given, select only these features; by default all features are used. >>> pri...
f9d628e56732f8567699f29b5810a0d7955bf1be
639,110
def get_data_info(image_datasets): """ This function just returns information about our image datasets Parameters: - image_datasets: the image_datasets for the proejct Returns: - dataset_sizes: the size for each dataset - class_names: the name for each class ...
d87ec367697599b0c7c1771016b50450d9a98415
639,111
def sanitizers_from_args(args): """Returns the sanitizers enabled by a given set of ldflags.""" sanitizers = set() for arg in args: if arg.startswith('-fsanitize='): sanitizer_list = arg.partition('=')[2] sanitizers |= set(sanitizer_list.split(',')) elif arg.startswit...
2a45712d460eb46edff71883dbf724e60c034438
639,112
def join(seq, string="", func=None): """Create a list from sequence. *string* is appended to each element but the last. *func* is applied to every element before appending *string*. """ if func is None: func = lambda x: x return [func(x) + string for x in seq[:-1]] + [func(seq[-1])]
4e0e2b500d88c3c81ebb028098244378065ce42d
639,113
def pillar_tree_root_dir(integration_files_dir): """ Fixture which returns the salt pillar tree root directory path. Creates the directory if it does not yet exist. """ dirname = integration_files_dir / "pillar-tree" dirname.mkdir(exist_ok=True) return dirname
d15f3c8e1871c470604d54d7fb0a344581323511
639,114
import torch def print_params(model, print_name=False): """ """ n_tr, n_nontr = 0, 0 for p in model.parameters(): n_params = torch.prod(torch.tensor(p.shape)).item() if p.requires_grad: n_tr += n_params else: n_nontr += n_params # str_info = "n_t...
f49301874ae76d7d5a1f7331c9bcd00172b6f4c0
639,115
def _toIPv6AddrString(intIPv6AddrInteger): """Convert the IPv6 address integer to the IPv6 address string. :param int intIPv6AddrInteger: IPv6 address integer. :return: IPv6 address string that adopted the full represented. :rtype: str Example:: intIPv6AddrInteger R...
d61c180b4ea87e55129c253c339ad8a3adaaf268
639,116
def fn(groups, lsv_fn): """Greater than function""" field, value = groups return lambda data: float(lsv_fn(data, field)) > float(value)
f597b44c116ebc47532b9a7de994e8b15f480e48
639,117
def _get_cmd(*args): """Combines the non-interactive zypper command with arguments/subcommands""" cmd = ['/usr/bin/zypper', '--quiet', '--non-interactive'] cmd.extend(args) return cmd
a91e91c12d1ab3c7b7fcd3ae68db21544bfac1b0
639,118