seed
stringlengths
1
14k
source
stringclasses
2 values
def checkstyle_source_to_error_type(source): """Convert a checkstyle error source to an error type """ class_name = source.split('.')[-1] if class_name.endswith('Check'): type = class_name[:-len('Check')] else: type = class_name return type
bigcode/self-oss-instruct-sc2-concepts
def mpad(msg, size): """Pad a byte string to multiple of size bytes. """ amount = size - len(msg) % size return msg + b'\0' * amount
bigcode/self-oss-instruct-sc2-concepts
import requests def getJsons(game_number, codes, api_version = "0.1", url = "https://np.ironhelmet.com/api"): """ Returns a list of values collected via the API :param str game_number: Number of the game you wish to visualize data from :param list co...
bigcode/self-oss-instruct-sc2-concepts
def get_end_linenumber(text): """Utility to get the last line's number in a Tk text widget.""" return int(float(text.index('end-1c')))
bigcode/self-oss-instruct-sc2-concepts
import re def _strip_time(desc): """Strips time from play description.""" return re.sub('^\([^)]+\)', '', desc).strip()
bigcode/self-oss-instruct-sc2-concepts
def find_digit_sum(num): """Return the sum of digits in num.""" num = str(num) digit_sum = 0 for char in num: digit_sum += int(char) return digit_sum
bigcode/self-oss-instruct-sc2-concepts
def rgb2gray(rgb,biases = [1/3,1/3,1/3]): """ Calculate gray image value from RGB value. May include bias values to correct for luminance differences in layers. Parameters ---------- rgb : TYPE DESCRIPTION. biases : TYPE, optional DESCRIPTION. The default is [1/3,1/3,1/3]. ...
bigcode/self-oss-instruct-sc2-concepts
import _operator def _basic_math_operation(df, new_column, column_1, column_2, op): """ Basic mathematical operation to apply operator on `column_1` and `column_2` Both can be either a number or the name of a column of `df` Will create a new column named `new_column` """ if not isinstance(colu...
bigcode/self-oss-instruct-sc2-concepts
import re def load_help(txtfile): """ Returns a list of strings split with ': ' """ with open(txtfile, 'r') as f: s = f.read() s = re.sub('\n',': ', s) li = s.split(': ') return li
bigcode/self-oss-instruct-sc2-concepts
def eV(E): """ Returns photon energy in eV if specified in eV or KeV. Assumes that any value that is less than 100 is in KeV. Parameters ---------- E : float The input energy to convert to eV Returns ------- E : float Energy converted to eV from KeV """ ...
bigcode/self-oss-instruct-sc2-concepts
def sort_paper_list(paper_list): """Sort the paper list by paper year.""" keyfunc = lambda paper: paper['year'] sorted_paper_list = sorted(paper_list, key=keyfunc) return sorted_paper_list
bigcode/self-oss-instruct-sc2-concepts
def replaceStringBlocks(str, startId, endId, newContent): """ Replaces all string sections in blocks given by startId and endId tags by newContent. :param str str: Text content to be updated. :param str startId: Start identifier of the block to be replaced. :param str endId: End identifier of the block...
bigcode/self-oss-instruct-sc2-concepts
def sliceFromString(sliceString): """Convert a text string into a valid slice object which can be used as indices for a list or array. >>> sliceFromString("0:10") slice(0,10,None) >>> sliceFromString("0::3") slice(0,None,3) >>> sliceFromString("-8:") slice(-8,None,None) """ slic...
bigcode/self-oss-instruct-sc2-concepts
def get_individual_decision_makers(decision_maker_list): """Return list of individual decision makers.""" individual_dms = [] for dm in decision_maker_list: individual_dms += dm.decision_makers return individual_dms
bigcode/self-oss-instruct-sc2-concepts
def _ByStartAndCreationTime(job): """Sort key that sorts jobs by start time, newest and unstarted first. All unstarted jobs will be first and sorted by their creation timestamp, all started jobs will be second and sorted by their start time. Args: job: googlecloudsdk.api_lib.run.job.Job Returns: Th...
bigcode/self-oss-instruct-sc2-concepts
import math def time_to_hhmmssmmm(time_value, decimal_separator="."): """ Format the given time value into a ``HH:MM:SS.mmm`` string. Examples: :: 12 => 00:00:12.000 12.345 => 00:00:12.345 12.345432 => 00:00:12.345 12.345678 => 00:00:12.346 83 => ...
bigcode/self-oss-instruct-sc2-concepts
def _net_working_capital(column): """ Uses balance sheet to net working capital """ current_assets = column["Total current assets"] current_liabilities = column["Total current liabilities"] return current_assets - current_liabilities
bigcode/self-oss-instruct-sc2-concepts
import json def load_vocab(vocab_path): """ Load word -> index and index -> word mappings :param vocab_path: where the word-index map is saved :return: word2idx, idx2word """ with open(vocab_path, 'r') as f: data = json.loads(f.read()) word2idx = data idx2word = dict([(v, k) f...
bigcode/self-oss-instruct-sc2-concepts
def get_enzyme_reactions(eid, db): """ For a given ec number return associated reaction ids :param eid: enzyme id format "EC-x.x.x.x" :param db: database dict :return: """ erids = [] if eid[:3] != "EC-": eid = "EC-{}".format(eid) for rid, react in db['reactions'].items(): ...
bigcode/self-oss-instruct-sc2-concepts
def computeRamp(f): """ The ramp function is defined as r(x) = f if f(x)>=0 0 if f(x)<0 which is equal to max(x, 0) """ return (f+abs(f))/2
bigcode/self-oss-instruct-sc2-concepts
def mask_spec(spec, spec_thresh=0.9, offset=1e-10): """ mask threshold a spectrogram to be above some % of the maximum power """ mask = spec >= (spec.max(axis=0, keepdims=1) * spec_thresh + offset) return spec * mask
bigcode/self-oss-instruct-sc2-concepts
def get_mat_info(struct): """ Get some basic information of the structure, e.g. name, configuration Parameters ---------- struct: pymatgen.structure Returns ------- name: string The name of the structure configuration: list The configuration of t...
bigcode/self-oss-instruct-sc2-concepts
def multiply(*args): """ :param args: This represents the group of ints that are to be multiplied :return: This returns the total product of all numbers that were multiplied """ total = 1 for arg in args: if type(arg) is int: total *= arg return total
bigcode/self-oss-instruct-sc2-concepts
def collect(*args): """Collect arguments as a tuple :rtype: tuple :param args: tuple of arguments :return: args """ return args
bigcode/self-oss-instruct-sc2-concepts
def filtersubset(linking, el2kbid, gold_els): """ remove from linking and rom el2kbid all mentions that are not in gold_els """ newlinking = dict() new_el2kbid = dict() for kbid in linking.keys(): mentions = linking[kbid] for m in mentions: if m in gold_els: ...
bigcode/self-oss-instruct-sc2-concepts
def _get_frequency_of_segment_in_list(seg, seg_list): """ Counts the frequency of a given segment or token in a list of segments/tokens. """ return seg_list.count(seg)
bigcode/self-oss-instruct-sc2-concepts
import re def match_device(device): """Matches device name and returns prefix, suffix""" match = re.match("(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$", device) if not match: return None return match.groups()
bigcode/self-oss-instruct-sc2-concepts
def assure_tuple_or_list(obj): """Given an object, wrap into a tuple if not list or tuple """ if isinstance(obj, list) or isinstance(obj, tuple): return obj return (obj,)
bigcode/self-oss-instruct-sc2-concepts
def LoadData(data, multiline=False, source='<data>'): """Turn key=value content into a dict Note: If you're designing a new data store, please use json rather than this format. This func is designed to work with legacy/external files where json isn't an option. Only UTF-8 content is supported currently. ...
bigcode/self-oss-instruct-sc2-concepts
import torch def collate_fn(data): """ Creates a mini-batch, overriding default_collate function in order to provide batches with input sorted by length. """ # sort such that input line lengths are in decreasing order # requirement for using torch.nn.utils.rnn.pack_packed_sequence data.sor...
bigcode/self-oss-instruct-sc2-concepts
def _exp_warn_msg(cls): """Generate a warning message experimental features""" pfx = cls if isinstance(cls, type): pfx = cls.__name__ msg = ('%s is experimental -- it may be removed in the future and ' 'is not guaranteed to maintain backward compatibility') % pfx return msg
bigcode/self-oss-instruct-sc2-concepts
def prepare_chronotrack_result_json(text): """ :param text: string from /load-model that contains embedded json - assumed the callback function is an empty string :return: the embedded json (str) """ return text.lstrip("(").rstrip(");")
bigcode/self-oss-instruct-sc2-concepts
from typing import Iterable import functools import operator def product(iterable: Iterable): """ Multiplies all elements of iterable and returns result ATTRIBUTION: code provided by Raymond Hettinger on SO https://stackoverflow.com/questions/595374/whats-the-function-like-sum-but-for-multiplication-...
bigcode/self-oss-instruct-sc2-concepts
def cipher_ca(text, d1, d2): """Caesar or Atbash encoding/decoding. Supply both dictionaries via d1 and d2""" result = '' for c in text: if c not in d1: result += c else: result += d2[d1.index(c)] return result
bigcode/self-oss-instruct-sc2-concepts
def parse_user_data(user): """Parse the user's information into a dictionary.""" data = { "id": user.id, "email": user.email, "username": user.username, "active": user.active, "confirmed": user.confirmed_at is not None, "preferences": dict(user.preferences or {}),...
bigcode/self-oss-instruct-sc2-concepts
def djoin(*tup): """ Convenience method to join strings with dots :rtype: str """ if len(tup) == 1 and isinstance(tup[0], list): return '.'.join(tup[0]) return '.'.join(tup)
bigcode/self-oss-instruct-sc2-concepts
def achromat(power, Va, Vb): """Compute lens powers for a thin doublet achromat, given their V-numbers.""" power_a = (Va/(Va - Vb))*power power_b = (Vb/(Vb - Va))*power return power_a, power_b
bigcode/self-oss-instruct-sc2-concepts
def _make_env(environment): """Change from Docker environment to Kubernetes env Args: environment (dict): Docker-style environment data Returns: list: Kubernetes-style env data """ env = [] for key, value in environment.items(): env.append({"name": key, "value": value})...
bigcode/self-oss-instruct-sc2-concepts
def find_proxy(ip,port,proxies): """ 根据ip,端口查找符合条件的代理 :param ip: 查询ip :param port: 查询端口 :param proxies: 查找的代理IP列表,类型[{'ip':<ip>,'port':<port>,...},...] :return:符合条件的代理数据 dict类型 {'ip':<ip>,'port':<port>,...} """ for i in proxies: if isinstance(i,dict): if i['ip']==ip a...
bigcode/self-oss-instruct-sc2-concepts
def _get_sv_callers(items): """ return a sorted list of all of the structural variant callers run """ callers = [] for data in items: for sv in data.get("sv", []): callers.append(sv["variantcaller"]) return list(set([x for x in callers if x != "sv-ensemble"])).sort()
bigcode/self-oss-instruct-sc2-concepts
import json def parse_acl_v2(data): """ Parses a version-2 Swift ACL string and returns a dict of ACL info. :param data: string containing the ACL data in JSON format :returns: A dict (possibly empty) containing ACL info, e.g.: {"groups": [...], "referrers": [...]} :returns: None if...
bigcode/self-oss-instruct-sc2-concepts
def check_numeric_indicator(var: str, index: str, messages: list) -> bool: """Checks that variable's numeric indicator is "0", "1" or "2". Parameters ---------- var : str Metadata variable in criteria. index : str Numeric indicator. messages : list Message to print i...
bigcode/self-oss-instruct-sc2-concepts
def defang_text(text): """ Function to normalize quoted data to be sql compliant :param text: Text to be defang'd :return: Defang'd text """ text = text.replace("'", "''") text = text.replace('"', '""') return text
bigcode/self-oss-instruct-sc2-concepts
def get_process_metric(row, flag, ck_frame, metric, verbose=False): """ Returns the value for the given metric for a particular source :param row: the data frame row for the test :param flag: true if that's a production class; false if a test :param ck_frame: the frame with all the ck metrics :p...
bigcode/self-oss-instruct-sc2-concepts
def _IsLegacy(discovery_rest_url): """Returns whether the given discovery URL uses legacy discovery. Args: discovery_rest_url: a str containing a discovery URL for an API. Returns: True if the discovery URL is determined to be a legacy, otherwise False. """ if 'googleapis.com/$discovery' in discover...
bigcode/self-oss-instruct-sc2-concepts
def get_spec(field, query='', query_dsl=''): """Returns aggregation specs for a term of filtered events. The aggregation spec will summarize values of an attribute whose events fall under a filter. Args: field (str): this denotes the event attribute that is used for aggregation. ...
bigcode/self-oss-instruct-sc2-concepts
def max_length(obj): """ Return the maximum length of obj or any of its sublists, if obj is a list. otherwise return 0. @param object|list obj: object to return length of @rtype: int >>> max_length(17) 0 >>> max_length([1, 2, 3, 17]) 4 >>> max_length([[1, 2, 3, 3], 4, [4, 5]]) ...
bigcode/self-oss-instruct-sc2-concepts
def _compute_olympic_average(scores, dropped_scores, max_dropped_scores): """Olympic average by dropping the top and bottom max_dropped_scores: If max_dropped_scores == 1, then we compute a normal olympic score. If max_dropped_scores > 1, then we drop more than one scores from the top and bottom and ave...
bigcode/self-oss-instruct-sc2-concepts
def robot_paint(grid, painted_locations, current, instruction_list): """Makes robot paint given location on grid. Updates and returns grid, painted_locations. """ painted_locations.add(current) if instruction_list[0] == 0: grid[current[0]][current[1]] = '.' elif instruction_list[0] == 1: ...
bigcode/self-oss-instruct-sc2-concepts
def _GetFormatCharForStructUnpack(int_width): """Gets the sample's integer format char to use with struct.unpack. It is assumed that 1-byte width samples are unsigned, all other sizes are signed. Args: int_width: (int) width of the integer in bytes. Can be 1, 2, or 4. Returns: The format char corre...
bigcode/self-oss-instruct-sc2-concepts
def get_keys_of_max_n(dict_obj, n): """Returns the keys that maps to the top n max values in the given dict. Example: -------- >>> dict_obj = {'a':2, 'b':1, 'c':5} >>> get_keys_of_max_n(dict_obj, 2) ['a', 'c'] """ return sorted([ item[0] for item in sorted( d...
bigcode/self-oss-instruct-sc2-concepts
def accuracy_predicted_substation(**kwargs: dict) -> bool: """ Calculates whether the substation where the changes are predicted at corresponds to the substation with the label changes. Parameters ---------- **kwargs['Y_subchanged_idx'] : int The index of the substation where the 'true'...
bigcode/self-oss-instruct-sc2-concepts
def text_if_str(to_type, text_or_primitive): """ Convert to a type, assuming that strings can be only unicode text (not a hexstr) @param to_type is a function that takes the arguments (primitive, hexstr=hexstr, text=text), eg~ to_bytes, to_text, to_hex, to_int, etc @param hexstr_or_primitive in...
bigcode/self-oss-instruct-sc2-concepts
def check_format(number='1989592KJAB'): """ Description ----------- Function to check format compliance of US phone numbers, namely the length should be exactly 11 digits, and the first digit must be with 1 :param number: Input phone number as a string :return: True if valid format, false if...
bigcode/self-oss-instruct-sc2-concepts
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 -...
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
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 = [...
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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(...
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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: ...
bigcode/self-oss-instruct-sc2-concepts
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 = { ...
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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)
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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)
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
def get_units_title(unit_type): """ Get the title for units """ units_title = "m" if unit_type == 'english': units_title = "ft" return units_title
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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 `...
bigcode/self-oss-instruct-sc2-concepts
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"]
bigcode/self-oss-instruct-sc2-concepts
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 ...
bigcode/self-oss-instruct-sc2-concepts
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")
bigcode/self-oss-instruct-sc2-concepts
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 ...
bigcode/self-oss-instruct-sc2-concepts
def jogador_pontuacao(jogador): """ Seletor do TAD jogador Devolve o valor da pontucao do jogador Argumentos: jogador -- jogador """ return jogador[1]
bigcode/self-oss-instruct-sc2-concepts
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', ...
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
def customer_2(accounts) -> str: """Get another customer address.""" return accounts[2]
bigcode/self-oss-instruct-sc2-concepts
def extract_state_fips(fips: str) -> str: """Extracts the state FIPS code from a county or state FIPS code.""" return fips[:2]
bigcode/self-oss-instruct-sc2-concepts
def kolibri_userinfo(claims, user): """ Fill claims with the information available in the Kolibri database """ claims["name"] = user.full_name return claims
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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 ...
bigcode/self-oss-instruct-sc2-concepts
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))
bigcode/self-oss-instruct-sc2-concepts
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]. ...
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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 ...
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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])]
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
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...
bigcode/self-oss-instruct-sc2-concepts
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
bigcode/self-oss-instruct-sc2-concepts
from typing import Callable def return_constant_value(value: float) -> Callable: """ For situations below in which we just need a function that returns a constant value. Args: value: The value that the function will return Returns: The function that returns the value, ignoring the ti...
bigcode/self-oss-instruct-sc2-concepts
def anyviolation(tickets, i, rule): """ does the i'th field in any ticket violate the given rule? """ for ticket in tickets: val = ticket.values[i] if rule.anyok(val): continue return True return False
bigcode/self-oss-instruct-sc2-concepts
def list_isos(cfg, distribution, isos): """generate a list with available ISOs""" for release in cfg[distribution]['isos']: for flavour in cfg[distribution]['iso_flavours']: for architecture in cfg[distribution]['architectures']: name = '-'.join((distribution, release, archit...
bigcode/self-oss-instruct-sc2-concepts