seed
stringlengths
1
14k
source
stringclasses
2 values
def parse_copy_availability(line): """Parses 'Status-'line for availability. :param line: Line string. :type line: str :return: Availability. :rtype: bool """ if 'Entliehen' in line: return False elif 'Verfügbar' in line: return True else: return False
bigcode/self-oss-instruct-sc2-concepts
def _get_location_extension_feeds(client, customer_id): """Gets the location extension feeds. Args: client: The Google Ads API client. customer_id: The Google Ads customer ID. Returns: The list of location extension feeds. """ googleads_service = client.get_service("GoogleAd...
bigcode/self-oss-instruct-sc2-concepts
def get_fastq_stats(fastq_filehandle): """Return some basic statistics for a fastq file.""" read_count, gc_count, total_base_count = 0, 0, 0 for i, line in enumerate(fastq_filehandle): if i != 1: # only process the reads from the fastq continue read_count += 1 for base i...
bigcode/self-oss-instruct-sc2-concepts
def filter_rule_ids(all_keys, queries): """ From a set of queries (a comma separated list of queries, where a query is either a rule id or a substring thereof), return the set of matching keys from all_keys. When queries is the literal string "all", return all of the keys. """ if not queries: ...
bigcode/self-oss-instruct-sc2-concepts
def is_quoted_retweet(text): """ Determines if the text begins with a quoted retweet :param text: The text to analyze (str) :return: true | false """ return int(text[:2] == '"@')
bigcode/self-oss-instruct-sc2-concepts
import re def lower_intradocument_links(rst): """Lowercase intra-document links Reference names are converted to lowercase when HTML is rendered from reST (https://bit.ly/2yXRPzL). Intra-document links must be lowercased in order to preserve linkage. `The Link <#Target-No.1>`__ -> `The Link <#ta...
bigcode/self-oss-instruct-sc2-concepts
def mean_average(list_of_numbers): """Return the mean average of a list of numbers.""" return sum(list_of_numbers) / len(list_of_numbers)
bigcode/self-oss-instruct-sc2-concepts
import pathlib import json def read_lipids_topH(filenames): """Generate a list of lipid hydrogen topologies. This function read a list of json files containing the topology of a united-atom lipid for reconstructing the missing hydrogens. The list topologies is stored as dictionary were the key i...
bigcode/self-oss-instruct-sc2-concepts
def stringify_steamids(list_of_steamids): """ Args: list_of_steamids: list of steamids Returns: Single string with steamids separated by comma """ return ','.join(list(map(str, list_of_steamids)))
bigcode/self-oss-instruct-sc2-concepts
from typing import OrderedDict def create_epoch_dict(epochs): """ Creates an ordered dictionary of epoch keys and a list of lists, where the first list is the average flux of the bin, and second list the CTE loss slope. Parameters: epochs : list of ints/floats Returns: ...
bigcode/self-oss-instruct-sc2-concepts
def load_list_room_items(data, room_names): """ Loading each room respective list of items. Parameters: data(dict): Nested dictionaries containing all information of the game. room_names(list): List containg room names. Returns: items_list(list): Returns list of roo...
bigcode/self-oss-instruct-sc2-concepts
def convert_to_nvc(vertices, faces): """Convert into format expected by CUDA kernel. Nb of triangles x 3 (vertices) x 3 (xyz-coordinate/vertex) WARNING: Will destroy any resemblance of UVs Args: vertices (torch.Tensor): tensor of all vertices faces (torch.Tensor): tensor of all tri...
bigcode/self-oss-instruct-sc2-concepts
def update_docstring_references(obj, ref="ref"): """ Updates docstring reference names to strings including the function name. Decorator will return the same function with a modified docstring. Sphinx likes unique names - specifically for citations, not so much for footnotes. Parameters -------...
bigcode/self-oss-instruct-sc2-concepts
def is_dataclass_type(cls): """Returns whether cls is a dataclass.""" return isinstance(cls, type) and hasattr(cls, "__dataclass_fields__")
bigcode/self-oss-instruct-sc2-concepts
import pickle def _encode(o): """Encodes an object with cPickle""" return pickle.dumps(o, pickle.HIGHEST_PROTOCOL)
bigcode/self-oss-instruct-sc2-concepts
def get_signal_frame(l4e_data_frame, model_name): """ Converts a dataframe from an L4E style to a Seeq signal style PARAMS ====== l4e_data_frame: pandas.DataFrame (Required) A dataframe returned from lookout_equipment_utils.get_predictions_data_frame() model_nam...
bigcode/self-oss-instruct-sc2-concepts
from typing import Iterable from typing import List from typing import Optional def sorted_dedup(iterable: Iterable) -> List[Optional[int]]: """Sorted deduplication without removing the possibly duplicated `None` values.""" dedup: List[Optional[int]] = [] visited = set() for item in iterable: ...
bigcode/self-oss-instruct-sc2-concepts
def xor(a, b): """Return the XOR of two byte sequences. The length of the result is the length of the shortest.""" return bytes(x ^ y for (x, y) in zip(a, b))
bigcode/self-oss-instruct-sc2-concepts
import uuid def create_api_release( client, resource_group_name, service_name, api_id, api_revision, release_id=None, if_match=None, notes=None): """Creates a new Release for the API.""" if release_id is None: release_id = uuid.uuid4().hex api_id1 = "/apis/" + api_id + ";rev=" + api_revi...
bigcode/self-oss-instruct-sc2-concepts
def cli_parse(parser): """Add method specific options to CLI parser. Parameters ---------- parser : argparse object Returns ---------- Updated argparse object """ parser.add_argument('-M', '--M', type=int, required=False, default=4, h...
bigcode/self-oss-instruct-sc2-concepts
def readme_contents_section_exists(path: str) -> bool: """ Given a README.md path, checks to see if there is a Contents section """ try: with open(path, 'r') as f: return '## Contents' in f.read() except FileNotFoundError: return False
bigcode/self-oss-instruct-sc2-concepts
import math def is_power_of_n(num:int,n :int) ->bool: """ Check whether a number is a power of n. Parameters: num: the number to be checked n: the number those power num is checked Returns: True if number is a power of n, otherwise False """ if num <= 0: ra...
bigcode/self-oss-instruct-sc2-concepts
def hours_to_days(hours): """ Convert the given amount of hours to a 2-tuple `(days, hours)`. """ days = int(hours // 8) hours_left = hours % 8 return days, hours_left
bigcode/self-oss-instruct-sc2-concepts
def get_primes(start, stop): """Return a list of prime numbers in ``range(start, stop)``.""" if start >= stop: return [] primes = [2] for n in range(3, stop + 1, 2): for p in primes: if n % p == 0: break else: primes.append(n) while primes and primes[0] < start: del primes[0] return primes
bigcode/self-oss-instruct-sc2-concepts
def format_number(number): """Format numbers for display. if < 1, return 2 decimal places if <10, return 1 decimal places otherwise, return comma formatted number with no decimal places Parameters ---------- number : float Returns ------- string """ if number == 0: ...
bigcode/self-oss-instruct-sc2-concepts
def filter_channels_by_server(channels, server): """Remove channels that are on the designated server""" chans = [] for channel in channels: sv, chan = channel.split(".", 1) if sv == server: chans.append(chan) return chans
bigcode/self-oss-instruct-sc2-concepts
def isFloat(string): """ is the given string a float? """ try: float(string) except ValueError: return 0 else: return 1
bigcode/self-oss-instruct-sc2-concepts
def transform(m, b, n): """ Given vector 'b', Calculate vector 'a' such that: 2*a-n*one == M * (2*b-n*one), where 'one' = (1, 1) --> a = M*b + (I-M)*one*n/2 M is the transformation matrix, the coordinates of 'a' and 'b' range from 0 to n-1. """ bb = [] for j in range(...
bigcode/self-oss-instruct-sc2-concepts
from typing import Optional from typing import IO def openfile(spec: Optional[str]) -> Optional[IO[str]]: """Open file helper. Args: spec: file/mode spec; for example: * ``file`` uses mode ``w`` * ``file+`` uses mode ``a`` * ``file+r`` uses mode ``r`` Return...
bigcode/self-oss-instruct-sc2-concepts
from pathlib import Path def _get_file_dict(fp,fname): """ Find an image matching fname in the collection This function searches files in a FilePattern object to find the image dictionary that matches the file name, fname. Inputs: fp - A FilePattern object fname - The name of the...
bigcode/self-oss-instruct-sc2-concepts
def index_fasta( f ): """ Makes a simple index for a FastA file :param f: an opened fasta file :return: a dict with the chromosomes as keys and the tell positions as values """ lpos = f.tell() rval = {} # for each line in the fasta l = f.readline() while l != "" : # re...
bigcode/self-oss-instruct-sc2-concepts
from typing import Tuple def _get_output_pad(plain: bool) -> Tuple[int, int, int, int]: """Return the padding for outputs. Args: plain (bool): Only show plain style. No decorations such as boxes or execution counts. Returns: Tuple[int, int, int, int]: The padding for outputs....
bigcode/self-oss-instruct-sc2-concepts
def height(root): """Function to return the height of a binary tree Args: root (Node): The root node of the binary tree Returns: (int): The height of the binary tree """ left = 0 right = 0 if root.left: left = 1 + height(root.left) if root.right: right =...
bigcode/self-oss-instruct-sc2-concepts
def _to_iloc(data): """Get indexible attribute of array, so we can perform axis wise operations.""" return getattr(data, 'iloc', data)
bigcode/self-oss-instruct-sc2-concepts
def build_part_check(part, build_parts): """ check if only specific parts were specified to be build when parsing if the list build_parts is empty, then all parts will be parsed """ if not build_parts: return True return bool(part in build_parts)
bigcode/self-oss-instruct-sc2-concepts
import base64 def generate_aws_checksum(image_checksum: str) -> str: """ Takes an MD5 checksum provided by SciHub and generates a base64-encoded 128-bit version, which S3 will use to validate our file upload See https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Clie...
bigcode/self-oss-instruct-sc2-concepts
def get_model_chain_ids(structure): """ Extracts model and chain ids from structure object. Parameters ---------- structure: Bio.PDB.Structure.Structure Returns ------- struct_id: tuple tuple of (modelid, chainid) """ modelnum = [] chainid = [] for model in str...
bigcode/self-oss-instruct-sc2-concepts
def stats_path(values): """ Return the stats path for the given Values object. """ # The filter() call here will remove any None values, so when we join() # these to get our stat path, only valid components will be joined. return '.'.join(filter(None, [ # plugin name values.plugi...
bigcode/self-oss-instruct-sc2-concepts
def dedupe_n_flatten_list_of_lists(mega_list): """Flatten a list of lists and remove duplicates.""" return list(set([item for sublist in mega_list for item in sublist]))
bigcode/self-oss-instruct-sc2-concepts
def load_std_type(net, name, element): """ Loads standard type data from the data base. Issues a warning if stdtype is unknown. INPUT: **net** - The pandapipes network **name** - name of the standard type as string **element** - "pipe" OUTPUT: **typedata** - dicti...
bigcode/self-oss-instruct-sc2-concepts
def selection_sort(lst): """Implement selection sorting algorithm.""" if len(lst) < 2: return lst def smallest_index(lst): smallest = lst[0] sm_index = 0 for i in range(len(lst)): if lst[i] < smallest: smallest = lst[i] sm_index = ...
bigcode/self-oss-instruct-sc2-concepts
import string def base_encode(number, alphabet=string.ascii_lowercase, fill=None): """Encode a number in an arbitrary base, by default, base 26. """ b = '' while number: number, i = divmod(number, len(alphabet)) b = alphabet[i] + b v = b or alphabet[0] if fill: return ...
bigcode/self-oss-instruct-sc2-concepts
def aXbXa(v1, v2): """ Performs v1 X v2 X v1 where X is the cross product. The input vectors are (x, y) and the cross products are performed in 3D with z=0. The output is the (x, y) component of the 3D cross product. """ x0 = v1[0] x1 = v1[1] x1y0 = x1 * v2[0] x0y1 = x0 * v2[1] ...
bigcode/self-oss-instruct-sc2-concepts
def epoch_init(M, i, j, w): """ Initialize epoch index from daily period, day of week and week of cycle. :param M: Model :param i: period of day :param j: day of week :param w: week of cycle :return: period of cycle in 1..n_prds_per_cycle """ return (w - 1) * M.n_days_per_week() * M...
bigcode/self-oss-instruct-sc2-concepts
def expose( func ): """ Decorator: mark a function as 'exposed' and thus web accessible """ func.exposed = True return func
bigcode/self-oss-instruct-sc2-concepts
def GetEndOfBlock(code, end_op): """Get the last line of block.""" """It returns -1 if it can't find.""" for i in code: if end_op in i: return code.index(i) else: return -1
bigcode/self-oss-instruct-sc2-concepts
def response(context): """Shortcut to the response in context""" return context.response
bigcode/self-oss-instruct-sc2-concepts
def street_address(anon, obj, field, val): """ Generates a random street address - the first line of a full address """ return anon.faker.street_address(field=field)
bigcode/self-oss-instruct-sc2-concepts
def ABCD_eq(b,c,d): """ Basic estimator formula for count in 'A' (signal domain) DEFINITION: A = B x C / D ^ |C | A |----- |D | B 0------> """ return b * c / d
bigcode/self-oss-instruct-sc2-concepts
def decode_text_from_webwx(text): """ 解码从 Web 微信获得到的中文乱码 :param text: 从 Web 微信获得到的中文乱码 """ if isinstance(text, str): try: text = text.encode('raw_unicode_escape').decode() except UnicodeDecodeError: pass return text
bigcode/self-oss-instruct-sc2-concepts
def nested(path, query, *args, **kwargs): """ Creates a nested query for use with nested documents Keyword arguments such as score_mode and others can be added. """ nested = { "path": path, "query": query } nested.update(kwargs) return { "nested": nested }
bigcode/self-oss-instruct-sc2-concepts
def __get_service_names(scenario_config): """ Gets the list of services from the scenario config. If no services are given, an empty list is returned. :param scenario_config: The scenario config. :return: A list of services. [] if no service names are found. """ if 'services' in scenario_con...
bigcode/self-oss-instruct-sc2-concepts
def float_range(start, stop=None, step=None): """Return a list containing an arithmetic progression of floats. Return a list of floats between 0.0 (or start) and stop with an increment of step. This is in functionality to python's range() built-in function but can accept float increments. A...
bigcode/self-oss-instruct-sc2-concepts
def attendance_numbers(brother, events, accepted_excuses): """ Returns the a of the row of the attendance csv containing information about the brother and his attendance at events :param Brother brother: the brother whose information you need the count for :param list[Event] events: th...
bigcode/self-oss-instruct-sc2-concepts
from typing import Optional def _find_month_number(name: str) -> Optional[int]: """Find a month number from its name. Name can be the full name (January) or its three letter abbreviation (jan). The casing does not matter. """ names = ['january', 'february', 'march', 'april', 'may', '...
bigcode/self-oss-instruct-sc2-concepts
def move_down(rows, t): """ A method that takes number of rows in the matrix and coordinates of bomb's position and returns coordinates of neighbour located bellow the bomb. It returns None if there isn't such a neighbour """ x, y = t if x == rows: return None else: return (...
bigcode/self-oss-instruct-sc2-concepts
def get_domain(domain_table): """ A helper function to get the domain for the corresponding cdm domain table :param domain_table: the cdm domain table :return: the domains """ domain = domain_table.split('_')[0].capitalize() return domain
bigcode/self-oss-instruct-sc2-concepts
def _particular_antigen_comp(donor: int, recipient: int) -> tuple: """Returns a particalar antigen compatibility, where each tuple member marks a compatibility for a particular antigen (A, B, Rh-D). If tuple member is non-negative there is a compatibility. For red blood cell compatibility is required t...
bigcode/self-oss-instruct-sc2-concepts
def fmt_price(amt): """ Format price as string with 2 decimals """ return '{:,.2f}'.format(amt)
bigcode/self-oss-instruct-sc2-concepts
def adjust_data(code_list, noun=12, verb=2): """Set the computer to a desired state by adjusting the noun and verb parameters. Parameters ---------- code_list : list opcode as provided by advent of code noun : int, optional the first parameter (in position 1), by default 12 ...
bigcode/self-oss-instruct-sc2-concepts
def computeblocksize(expectedrows, compoundsize, lowercompoundsize): """Calculate the optimum number of superblocks made from compounds blocks. This is useful for computing the sizes of both blocks and superblocks (using the PyTables terminology for blocks in indexes). """ nlowerblocks = (expecte...
bigcode/self-oss-instruct-sc2-concepts
def is_mirrored(rot): """ Return True if an eaglexml rotation is mirrored. """ return rot and rot.startswith('M')
bigcode/self-oss-instruct-sc2-concepts
def WritePacketRaw(header, data): """ Given two raw bytearrays, return a bytearray representing the entire packet """ return header + data
bigcode/self-oss-instruct-sc2-concepts
def total_velocity(vel_l, vel_r): """ calculate total velocity - given left and right velocity """ return (vel_l + vel_r) / 2
bigcode/self-oss-instruct-sc2-concepts
def get_role(obj, role_name): """Return a Role if the specified object has the specified role.""" for role in obj.roles: if role.name == role_name: return role return None
bigcode/self-oss-instruct-sc2-concepts
def parse_operand_subscripts(subscript, shape, op_label_dict): """Parse the subscripts for one operand into an output of 'ndim' labels Parameters ---------- subscript : string the subscript of the operand to be parsed. shape : tuple of int the shape of the input operand op_label...
bigcode/self-oss-instruct-sc2-concepts
from typing import Union def atoi(text: str) -> Union[int, str]: """ Converts strings to integers if they're composed of digits; otherwise returns the strings unchanged. One way of sorting strings with numbers; it will mean that ``"11"`` is more than ``"2"``. """ return int(text) if text.isdig...
bigcode/self-oss-instruct-sc2-concepts
def word_to_list(rw): """Convert the ran_word string into a list of letters""" word = list(rw) return word
bigcode/self-oss-instruct-sc2-concepts
import pickle def load_pickle(byte_file): """Loads a pickled object""" with open(byte_file, "rb") as f: return pickle.load(f)
bigcode/self-oss-instruct-sc2-concepts
def package(qualified_name): """Return the enclosing package name where qualified_name is located. `qualified_name` can be a module inside the package or even an object inside the module. If a package name itself is provided it is returned. """ try: module = __import__(qualified_name, from...
bigcode/self-oss-instruct-sc2-concepts
def indent(text, chars=" ", first=None): """Return text string indented with the given chars >>> string = 'This is first line.\\nThis is second line\\n' >>> print(indent(string, chars="| ")) # doctest: +NORMALIZE_WHITESPACE | This is first line. | This is second line | >>> print(indent(...
bigcode/self-oss-instruct-sc2-concepts
def users_from_passwd(raw): """ Extracts a list of users from a passwd type file. """ users = list() for line in raw.split('\n'): tmp = line.split(':')[0] if len(tmp) > 0: users.append(tmp) return sorted(users)
bigcode/self-oss-instruct-sc2-concepts
def product(l1, l2): """returns the dot product of l1 and l2""" return sum([i1 * i2 for (i1, i2) in zip(l1, l2)])
bigcode/self-oss-instruct-sc2-concepts
import requests def analyzeImg(imgResp, apiKey): """ Sends encoded image through Microsoft computer vision API to get tags and categories. Args: imgResp: image response from urlopening webcam image apiKey: Computer Vision API key Returns: json object with 'categories' and 'tags' as keys """ headers = { ...
bigcode/self-oss-instruct-sc2-concepts
def sum_items(a_list): """ @purpose Returns the sum of all items in a_list, and return 0 if empty list @param a_list: a list of items passed to this function to sum @complexity: Worst Case - O(N): When summing all values of a list with N items Best Case - O(1): when passing empty...
bigcode/self-oss-instruct-sc2-concepts
def parse_distance(distance): """parse comma delimited string returning (latitude, longitude, meters)""" latitude, longitude, meters = [float(n) for n in distance.split(',')] return (latitude, longitude, meters)
bigcode/self-oss-instruct-sc2-concepts
def find_pivot(array, high, low): """ Find the index of the pivot element """ if high < low: return -1 if high == low: return low mid = (high + low)/2 if mid < high and array[mid] > array[mid + 1]: return mid if mid > low and array[mid] < array[mid - 1]: return mid - 1 if array[low] >= array[mid]...
bigcode/self-oss-instruct-sc2-concepts
import requests import shutil def download_file(url, local_file, *, allow_redirects=True, decode=True): """ Download a file. Arguments: url (str): URL to download local_file (str): Local filename to store the downloaded ...
bigcode/self-oss-instruct-sc2-concepts
def pdf2cte(terms_table, table_name): """Generate SQL code to represent Pandas DataFrame as a Common Table Expression""" quotify = lambda c: c # '[' + c + ']' row2tuple_str = lambda row: '(' + ', '.join([ f"'{x}'" if (isinstance(x, str) or isinstance(x, bool)) else str(x) ...
bigcode/self-oss-instruct-sc2-concepts
def always_roll(n): """ Возвращает стратегию, по которой всегда происходит N бросков. >>> strategy = always_roll(5) >>> strategy(0, 0) 5 >>> strategy(99, 99) 5 """ def strategy(score, opponent_score): return n return strategy
bigcode/self-oss-instruct-sc2-concepts
def _get_stream_timestamps(stream: dict): """Retrieve the LSL timestamp array.""" return stream["time_stamps"]
bigcode/self-oss-instruct-sc2-concepts
def newline_space_fix(text): """Replace "newline-space" with "newline". This function was particularly useful when converting between Google Sheets and .xlsx format. Args: text (str): The string to work with Returns: The text with the appropriate fix. """ newline_space = '...
bigcode/self-oss-instruct-sc2-concepts
def is_checkpoint_epoch(cfg, cur_epoch): """Determines if a checkpoint should be saved on current epoch.""" return (cur_epoch + 1) % cfg.TRAIN.CHECKPOINT_PERIOD == 0
bigcode/self-oss-instruct-sc2-concepts
def getCommand(gameCounter: int): """Allows the gamer to enter a command from the console.""" return input("Dynasty (" + str(gameCounter) + ") > ")
bigcode/self-oss-instruct-sc2-concepts
def hide_axis(ax, axis='x', axislabel=True, ticklabels=True, ticks=False, hide_everything=False): """ Hide axis features on an axes instance, including axis label, tick labels, tick marks themselves and everything. Careful: hiding the ticks will also hide grid lines if a grid is on! Para...
bigcode/self-oss-instruct-sc2-concepts
import math def roundup(x, to): """Rounding up to sertain value >>> roundup(7, 8) >>> 8 >>> roundup(8, 8) >>> 8 >>> roundup(9, 8) >>> 16 :param x: value to round :param to: value x will be rounded to :returns: rounded value of x :rtype: int """ return int(math.cei...
bigcode/self-oss-instruct-sc2-concepts
def getWaterYear(date): """ Returns the water year of a given date Parameters ---------- date : datetime-like A datetime or Timestamp object Returns ------- wateryear : string The water year of `date` Example ------- >>> import datetime >>> import wqio ...
bigcode/self-oss-instruct-sc2-concepts
def find_collNames(output_list): """ Return list of collection names collected from refs in output_list. """ colls = [] for out in output_list: if out.kind in {"STEP", "ITEM"}: colls.append(out.collName) elif out.kind == "IF": colls.append(out.refs[0].collName...
bigcode/self-oss-instruct-sc2-concepts
def session_new_user_fixture(session_base): """Load the new user session payload and return it.""" return session_base.format(user_id=1001)
bigcode/self-oss-instruct-sc2-concepts
def collator(batch_list): """ Collate a bunch of multichannel signals based on the size of the longest sample. The samples are cut at the center """ max_len = max([s[0].shape[-1] for s in batch_list]) n_batch = len(batch_list) n_channels_data = batch_list[0][0].shape[0] n_channels_targe...
bigcode/self-oss-instruct-sc2-concepts
def _rel_approx_equal(x, y, rel=1e-7): """Relative test for equality. Example >>> _rel_approx_equal(1.23456, 1.23457) False >>> _rel_approx_equal(1.2345678, 1.2345679) True >>> _rel_approx_equal(0.0, 0.0) True >>> _rel_approx_equal(0.0, 0.1) False >>> _rel_approx_equal(...
bigcode/self-oss-instruct-sc2-concepts
def get(obj: dict, path, default=None): """Gets the deep nested value from a dictionary Arguments: obj {dict} -- Dictionary to retrieve the value from path {list|str} -- List or . delimited string of path describing path. Keyword Arguments: default {mixed} -- default value to retur...
bigcode/self-oss-instruct-sc2-concepts
def dict_is_song(info_dict): """Determine if a dictionary returned by youtube_dl is from a song (and not an album for example).""" if "full album" in info_dict["title"].lower(): return False if int(info_dict["duration"]) > 7200: return False return True
bigcode/self-oss-instruct-sc2-concepts
import socket import ipaddress def forward_lookup(hostname): """Perform a forward lookup of a hostname.""" ip_addresses = {} addresses = list( set(str(ip[4][0]) for ip in socket.getaddrinfo(hostname, None)) ) if addresses is None: return ip_addresses for address in addresses...
bigcode/self-oss-instruct-sc2-concepts
def pots_to_volts(calibration_data): """Convert the potentiometer data units to volts. Parameters ---------- calibration_data : dict All of the digital (DIO) and analog data corresponding to the trodes files for the a calibration recording. For example, as returned by read_data...
bigcode/self-oss-instruct-sc2-concepts
import re def walltime_seconds(walltime): """Given a walltime string, return the number of seconds it represents. Args: walltime (str): Walltime, eg. '01:00:00'. Returns: int: Number of seconds represented by the walltime. Raises: ValueError: If an unsupported walltime forma...
bigcode/self-oss-instruct-sc2-concepts
def arange(start, end, step=1): """ arange behaves just like np.arange(start, end, step). You only need to support positive values for step. >>> arange(1, 3) [1, 2] >>> arange(0, 25, 2) [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24] >>> arange(0, 1231, 34) [0, 34, 68, 102, 136, 170...
bigcode/self-oss-instruct-sc2-concepts
def get_domain_id(ks_client, domain_name): """Return domain ID. :param ks_client: Authenticated keystoneclient :type ks_client: keystoneclient.v3.Client object :param domain_name: Name of the domain :type domain_name: string :returns: Domain ID :rtype: string or None """ all_domains...
bigcode/self-oss-instruct-sc2-concepts
def clean_aliases(aliases): """ Removes unwanted characters from the alias name. This function replaces: -both '/' and '\\\\' with '_'. -# with "", as it is not allowed according to the schema. Can be called prior to registering a new alias if you know it may contain such unwanted char...
bigcode/self-oss-instruct-sc2-concepts
import click def validate_fragment_type(ctx, param, value): """ Validate that a given fragment type exists. """ config = ctx.obj.config if value and not config.has_fragment_type(value): raise click.BadParameter( 'Missing or unknown fragment type: {}'.format(value)) return v...
bigcode/self-oss-instruct-sc2-concepts