content stringlengths 42 6.51k |
|---|
def relative_class_counts(data):
"""input: a dict mapping class keys to their absolute counts
output: a dict mapping class keys to their relative counts"""
counts_items = sum(data.values())
return {k: 1.0 * v / counts_items for k, v in data.items()} |
def split_message(message: str, limit: int=2000):
"""Splits a message into a list of messages if it exceeds limit.
Messages are only split at new lines.
Discord message limits:
Normal message: 2000
Embed description: 2048
Embed field name: 256
Embed field value: 1024"""
... |
def list_union(lst1, lst2):
"""
Combines two lists by the union of their values
Parameters
----------
lst1, lst2 : list
lists to combine
Returns
-------
final_list : list
union of values in lst1 and lst2
"""
final_list = set(lst1).union(set(lst2))
return f... |
def get_arg_to_class(class_names):
"""Constructs dictionary from argument to class names.
# Arguments
class_names: List of strings containing the class names.
# Returns
Dictionary mapping integer to class name.
"""
return dict(zip(list(range(len(class_names))), class_names)) |
def _gc(seq: str) -> float:
"""Return the GC ratio of a sequence."""
return float(seq.count("G") + seq.count("C")) / float(len(seq)) |
def quote_text(text, markup, username=""):
"""
Quote message using selected markup.
"""
if markup == 'markdown':
return '>'+text.replace('\n','\n>').replace('\r','\n>') + '\n'
elif markup == 'bbcode':
if username is not "":
username = '="%s"' % username
return '... |
def sanitize_email(user_email: str) -> str:
"""
Given a formatted email like "Jordan M <remailable@getneutrality.org>",
return just the "remailable@getneutrality.org" part.
"""
email_part = user_email.split()[-1]
if email_part.startswith("<"):
email_part = email_part[1:]
if email_par... |
def get_del_bino_type(ita):
"""
This function will take a ita value and return the Fitzpatrick skin tone scale
https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0241843&type=printable
:param ita:
:return:
"""
if ita < -30:
return "dark"
elif -30 < ita <= 10:
... |
def x(bytes_obj):
"""
Convenience function to convert bytes object to even-length hex string (excluding 0x)
"""
assert type(bytes_obj) is bytes
return bytes_obj.hex() |
def get_switchport_config_commands(name, existing, proposed, module):
"""Gets commands required to config a given switchport interface
"""
proposed_mode = proposed.get("mode")
existing_mode = existing.get("mode")
commands = []
command = None
if proposed_mode != existing_mode:
if pr... |
def find_epsilon(epsilon, epoch, update_epsilon, start_updates=499):
""" Updates epsilon ("random guessing rate") based on epoch. """
if epsilon <= 0.1:
epsilon = 0.1
elif (not (epoch % update_epsilon)) and epoch > start_updates:
epsilon -= 0.1
return epsilon |
def convert_list_of_strings_to_list_of_tuples(x: list) -> list:
"""Convert e.g. ['(12, 5)', '(5, 12)'] to [(12, 5), (5, 12)]
:param x: list of strings
:return: list of tuples
"""
return [tuple(int(s) for s in i[1:-1].split(',')) for i in x] |
def left_to_right_check(input_line: str, pivot: int) -> bool:
"""
Check row-wise visibility from left to right.
Return True if number of building from the left-most hint is visible looking to the right,
False otherwise.
input_line - representing board row.
pivot - number on the left-most hint o... |
def generate_spider(start_url, template_names):
"""Generate an slybot spider"""
return {
'start_urls': [start_url],
'links_to_follow': 'none',
'follow_patterns': [],
'exclude_patterns': [],
'template_names': template_names
} |
def find_neighbors(faces, npoints):
"""
Generate the list of unique, sorted indices of neighboring vertices
for all vertices in the faces of a triangular mesh.
Parameters
----------
faces : list of lists of three integers
the integers for each face are indices to vertices, starting from... |
def plural(quantity, one, plural):
"""
>>> plural(1, '%d dead frog', '%d dead frogs')
'1 dead frog'
>>> plural(2, '%d dead frog', '%d dead frogs')
'2 dead frogs'
"""
if quantity == 1:
return one.replace("%d", "%d" % quantity)
return plural.replace("%d", "%d" % quantity) |
def solution(numerator: int = 1, digit: int = 1000) -> int:
"""
Considering any range can be provided,
because as per the problem, the digit d < 1000
>>> solution(1, 10)
7
>>> solution(10, 100)
97
>>> solution(10, 1000)
983
"""
the_digit = 1
longest_list_lengt... |
def bx_2_dec(VALUE, ALPHABET, BASE):
"""
Converts from base X to decimal
"""
POSITION = 0
TOTAL_DEC_VALUE = 0
# Loop over string reversed
for PLACE in VALUE[::-1]:
TOTAL_DEC_VALUE += pow(BASE, POSITION) * ALPHABET.index(PLACE)
POSITION += 1
return TOTAL_DEC_VALUE |
def getVecIndex(msb: int, lsb: int, index: int) -> int:
"""Get the index in the list of [msb, ..., index, ... , lsb]
index -> index in verilog slicing
"""
if lsb > msb:
return index - msb
return msb - index |
def make_partitions(items, test):
"""
Partitions items into sets based on the outcome of ``test(item1, item2)``.
Pairs of items for which `test` returns `True` end up in the same set.
Parameters
----------
items : collections.abc.Iterable[collections.abc.Hashable]
Items to partition
... |
def states_hash(states):
"""Generate a hash of a list of states."""
return "|".join(sorted(states)) |
def be32toh(buf):
# named after the c library function
"""Convert big-endian 4byte int to a python numeric value."""
out = (ord(buf[0]) << 24) + (ord(buf[1]) << 16) + \
(ord(buf[2]) << 8) + ord(buf[3])
return out |
def java_string(text):
"""Transforms string output for java, cs, and objective-c code
"""
text = "%s" % text
return text.replace(""", "\"").replace("\"", "\\\"") |
def eval_filter(y_true, y_pred, threshold=0.5):
"""
Args:
y_true (list): true execution labels
y_pred (list): predicted execution probabilities
threshold (float): if p<threshold: skip the execution
Return:
label_acc (float): inference accuracy, only punishes False Negative c... |
def _convert_name(list_of_names, mapping_dict):
"""
returns a (copy) of the list var where all recognized variable names are converted to a standardized name specified
by the keys of the mapping_dict
"""
if isinstance(list_of_names,str):
type_of_input_list = 'string'
list_of_names = ... |
def genomic_del4_abs_37(genomic_del4_37_loc):
"""Create test fixture absolute copy number variation"""
return {
"type": "AbsoluteCopyNumber",
"_id": "ga4gh:VAC.gXM6rRlCid3C1DmUGT2XynmGXDvt80P6",
"subject": genomic_del4_37_loc,
"copies": {"type": "Number", "value": 4}
} |
def slurp(text, offset, test):
"""Starting at offset in text, find a substring where all characters pass
test. Return the begin and end position and the substring."""
begin = offset
end = offset
length = len(text)
while offset < length:
char = text[offset]
if test(char):
... |
def get_model_name(config: dict) -> str:
"""Return model name or `Unnamed`."""
return config['model']['name'] if 'model' in config and 'name' in config['model'] else 'Unnamed' |
def getManagedObjectTypeName(mo):
"""
Returns the short type name of the passed managed object
e.g. VirtualMachine
Args:
mo (vim.ManagedEntity)
"""
return mo.__class__.__name__.rpartition(".")[2] |
def merge(a, b):
""" Merging 2 lists """
i = 0
k = 0
c = []
while i < len(a) and k < len(b):
if a[i] <= b[k]:
c.append(a[i])
i += 1
else:
c.append(b[k])
k += 1
while i < len(a):
c.append(a[i])
i += 1
... |
def get_max_words_with_ngrams(max_words, word_ngrams):
"""
Calculate the length of the longest possible sentence
:param max_words: int, the length of the longest sentence
:param word_ngrams: int
:return: int, the length of the longest sentence with word n-grams
"""
max_words_with_ng = 1
... |
def f(x):
"""
>>> f(4.5)
7.25
>>> f(-4.5)
-5.25
>>> f(1)
-0.5
"""
if x <= -2:
return 1 - (x + 2)**2
if x > 2:
return 1 + (x - 2)**2
return -x/2 |
def isClose(float1, float2):
"""
Helper function - are two floating point values close?
"""
return abs(float1 - float2) < .01 |
def extract_uris(data):
"""Convert a text/uri-list to a python list of (still escaped) URIs"""
lines = data.split('\r\n')
out = []
for l in lines:
if l == chr(0):
continue # (gmc adds a '\0' line)
if l and l[0] != '#':
out.append(l)
return out |
def rem_num(num, lis):
""" Removes all instances of a number 'num', from list lis. """
return [ele for ele in lis if ele != num] |
def input_incorrectness_test(user_input, range_of_answers, case_matters=False):
"""
This function returns True if user_input NOT in range_of_answers.
"""
error_msg = "That wasn't a correct input. Try two letters."
user_incorrect = True
if case_matters == False:
user_input = user_i... |
def is_prime(n: int) -> bool:
"""
Primality test using 6k+-1 optimization.
See https://en.wikipedia.org/wiki/Primality_test for explanation and details.
Returns True if n is prime, False otherwise."""
if n <= 3:
return n > 1
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
... |
def get_html_xml_path(path, build_name):
"""Parse and replace $BUILD_NAME variable in the path.
Args:
path(str): path to html report
build_name(str): software build number
Returns:
str: modified path to html report
"""
try:
return path.replace("__BUILD_NAME__", b... |
def _attributes_equal(new_attributes, old_attributes):
"""
Compare attributes (dict) by value to determine if a state is changed
:param new_attributes: dict containing attributes
:param old_attributes: dict containing attributes
:return bool: result of the comparison between new_attributes and
... |
def sumfunc(x):
"""
Incremental function
This function increments input value.
It returns the value that the input value added one.
"""
x = x + 1
return x |
def unique_from_array(array):
"""takes an array and removes duplicates
@param array: array object, the array to evaluate
@returns: an array with unique values
>>> unique_from_array([1, 23, 32, 1, 23, 44, 2, 1])
[1, 23, 32, 44, 2]
>>> unique_from_array(["uno", "dos", "uno", 2, 1])
["uno", "... |
def get_name(obj, _=None):
"""Dictionary function for getting name and dob from dict"""
return "{} is born on {}".format(obj.get('name'), obj.get('dob')) |
def strike_through(text: str) -> str:
"""Returns a strike-through version of the input text"""
result = ''
for c in text:
result = result + c + '\u0336'
return result |
def digit(n, base=10):
"""
>>> digit(1234)
[4, 3, 2, 1]
"""
lst = []
while n > 0:
lst.append(n % base)
n //= base
return lst |
def height_fun(x, x0, A, xt):
"""
Model the height of a cantilevered microubule.
The MT is fixed at x0 and pulled up. A is the shape giving/ scaling factor,
equal to F/EI, where F ist the forc acting on the MT at xt, and EI is the
flexural regidity of the mictotubule.
"""
def heaviside(... |
def get_maxprofits(legs, classes):
"""Loops through each leg and gets the maximum profit of that leg
The max profit is added as key to the legs dictionary
Parameters
----------
legs : list of dictionaries
List of dictionaries, where each dictionary represents a leg
classes : dictionary... |
def _num_columns(data):
"""Find the number of columns in a raw data source.
Args:
data: 2D numpy array, 1D record array, or list of lists representing the
contents of the source dataframe.
Returns:
num_columns: number of columns in the data.
"""
if hasattr(data, 'shape'): # True for numpy arr... |
def type_casting(number):
"""take the text input and type cast them into floating numbers"""
try:
number = float(number)
except Exception:
# exception occurs from comma utilization for decimal points
number = float(number.replace(',', '.'))
return number |
def _int_endf(s):
"""Convert string to int. Used for INTG records where blank entries
indicate a 0.
Parameters
----------
s : str
Integer or spaces
Returns
-------
integer
The number or 0
"""
s = s.strip()
return int(s) if s else 0 |
def station_coordinates(stations):
"""Build and return the lists of
latitudes, longitudes and station names respectively"""
latitudes = []
longitudes = []
texts = []
for station in stations:
latitudes.append(station.coord[0])
longitudes.append(station.coord[1])
tex... |
def _tzoffset2iso8601zone(seconds):
"""Takes an offset, such as from _tzoffset(), and returns an ISO 8601
compliant zone specification. Please note that the result of
_tzoffset() is the negative of what time.localzone and time.altzone is.
"""
return "%+03d:%02d" % divmod((seconds // 60), 60) |
def get_solution_file_name(file_name):
"""
Return the name of the file in which save the solution
:param file_name: the name of the file.
:return: A .sol filename
:rtype: str
"""
if file_name is None:
return None
if file_name.endswith('.sol'):
return file_name
else:... |
def cmd_exists(cmd):
"""Check whether cmd exists on system."""
# https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
import subprocess
return subprocess.call(['type ' + cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 |
def get_next_cursor(res):
"""Extract the next_cursor field from a message object. This is
used by all Web API calls which get paginated results.
"""
metadata = res.get('response_metadata')
if not metadata:
return None
return metadata.get('next_cursor', None) |
def xpath_literal(s):
"""
http://stackoverflow.com/questions/6937525/escaping-xpath-literal-with-python
"""
if "'" not in s:
return "'%s'" % s
if '"' not in s:
return '"%s"' % s
return "concat('%s')" % s.replace("'", "',\"'\",'") |
def none_of(*words: str) -> str:
"""
Format words to query results containing none of the undesired words.
This also works with the **on_site** restriction to exclude undesired domains.
:param words: List of undesired words
:return: String in the format google understands
"""
return " ".joi... |
def divide_into_chunks(array, chunk_size):
"""Divide a given iterable into pieces of a given size
Args:
array (list or str or tuple): Subscriptable datatypes (containers)
chunk_size (int): Size of each piece (except possibly the last one)
Returns:
list or str or tuple: ... |
def assert_subclass(objs, subclass):
"""
Assert there is a object of subclass.
"""
for obj in objs:
if issubclass(subclass, type(obj)):
return True
return False |
def calc_probs(wordList):
"""
Creates a dictionary of all the words and their associated word count.
Parameters:
wordlist (list[str]): list containing all of the words of the
chosen text
Returns:
list[str]: a list of all the words
prob... |
def ct_bytes_compare(a, b):
"""
Constant-time string compare.
http://codahale.com/a-lesson-in-timing-attacks/
"""
if not isinstance(a, bytes):
a = a.decode('utf8')
if not isinstance(b, bytes):
b = b.decode('utf8')
if len(a) != len(b):
return False
result = 0
... |
def parse_server_name(server_name):
"""Split a server name into host/port parts.
Args:
server_name (str): server name to parse
Returns:
Tuple[str, int|None]: host/port parts.
Raises:
ValueError if the server name could not be parsed.
"""
try:
if server_name[-1]... |
def texnum(x, mfmt='{}', noone=False):
"""
Convert number into latex
"""
m, e = "{:e}".format(x).split('e')
m, e = float(m), int(e)
mx = mfmt.format(m)
if e == 0:
if m == 1:
return "" if noone else "1"
return mx
ex = r"10^{{{}}}".format(e)
if m == 1:
... |
def fib_rec(n):
"""
Series - 1, 1, 2, 3, 5, 8, 13
`n` starts from 0.
:param n:
:return:
"""
if n < 2:
return 1
return fib_rec(n-1) + fib_rec(n-2) |
def get_intercept(args):
"""
if args are something that should be handled by terrapy, not
terraform, indicate and yield cmd name
"""
is_intercept = False
mod_args = None
if len(args) > 0 and args[0] == 'clean':
is_intercept = True
mod_args = ['clean']
return is_intercept... |
def append_hostname(machine_name, num_list):
"""
Helper method to append the hostname to node numbers.
:param machine_name: The name of the cluster.
:param num_list: The list of nodes to be appended to the cluster name.
:return: A hostlist string with the hostname and node numbers.
"""
hos... |
def parse_model_http(model_metadata, model_config):
"""
Check the configuration of a model to make sure it meets the
requirements for an image classification network (as expected by
this client)
"""
if len(model_metadata['inputs']) != 1:
raise Exception("expecting 1 input, got {}".format... |
def get_voigt_mapping(n):
"""
Get the voigt index to true index mapping for a given number of indices.
"""
voigt_indices = [[0,0],[1,1],[2,2],[1,2],[0,2],[0,1],[2,1],[2,0],[1,0]]
if (n%2):
indices = [[0],[1],[2]]
n-=1
else:
indices = [[]]
for _ in r... |
def major_element(arr, n):
"""
major element is nothing but which occurs in array >= n/2 times
:param arr: list
:param n: len of array
:return: major ele
we can use Moore Voting algorithm -->Explore
"""
count_dict = dict()
majority = n // 2
for ele in arr:
if ele in coun... |
def color2int(red, green, blue, magic):
"""Convert rgb-tuple to an int value."""
return -((magic << 24) + (red << 16) + (green << 8) + blue) & 0xffffffff |
def batch_files(pool_size, limit):
""" Create batches of files to process by a multiprocessing Pool """
batch_size = limit // pool_size
filenames = []
for i in range(pool_size):
batch = []
for j in range(i * batch_size, (i + 1) * batch_size):
filename = 'numbers/numbers_%d... |
def to_string(b):
"""Return the parameter as type 'str', possibly encoding it.
In Python2, the 'str' type is the same as 'bytes'. In Python3, the
'str' type is (essentially) Python2's 'unicode' type, and 'bytes' is
distinct.
"""
if isinstance(b, str):
# In Python2, this branch is taken... |
def createVskDataDict(labels,data):
"""Creates a dictionary of vsk file values from labels and data.
Parameters
----------
labels : array
List of label names for vsk file values.
data : array
List of subject measurement values corresponding to the label
names in `labels`.
Returns
-------... |
def flip(a):
"""
>>> flip([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
[[7, 8, 9], [4, 5, 6], [1, 2, 3]]
"""
# n = len(a)
# for x in range(n // 2):
# for y in range(n):
# a[n-x-1][y], a[x][y] = a[x][y], a[n-x-1][y]
return a[::-1] |
def power_level(serial: int, x: int, y: int) -> int:
"""Compute the power level of the fuel cell at x, y.
"""
rack_id = x + 10
p = rack_id * y + serial
p *= rack_id
p = (p // 100) % 10
return p - 5 |
def merge_sort(L):
"""
Sorts a list in increasing order.
This algorithm uses merge sort.
@param L: a list (in general unsorted)
@return: a reference containing an ascending order
sorted version of L
"""
def merge_lists(L1, L2):
"""
Merge two sort... |
def vbc(vb=0,vc=0):
"""
Parameters
----------
vb : TYPE, optional
DESCRIPTION. The default is 0.
vc : TYPE, optional
DESCRIPTION. The default is 0.
Returns
-------
None.
"""
voltage = vb - vc
return voltage |
def t_area_eff(t_str: str) -> float:
"""Calculate area of a triangle (efficient).
Args:
t_str: <str> triangle shape as a string.
Returns: <float> triangle area.
"""
return (t_str.count('\n') - 2) ** 2 / 2 |
def tetra_clean(instr: str) -> bool:
"""Return True if string contains only unambiguous IUPAC nucleotide symbols.
:param instr: str, nucleotide sequence
We are assuming that a low frequency of IUPAC ambiguity symbols doesn't
affect our calculation.
"""
if set(instr) - set("ACGT"):
ret... |
def url_last(url, exclude_params=False):
"""
Gets the last segment of a url.
Example: url = "https://www.bad-actor.services/some/thing" == "thing"
:param url: Url to parse.
:type url: str
:param exclude_params: Exludes paramters from the last segment of the url.
:type exclude_params: Bool
... |
def visibility(vis):
"""Function to format visibility"""
if vis == 'None':
return {'parsed' : 'None', 'value' : 'None', 'unit' : 'None',
'string': 'N/A'}
if 'VV' not in vis:
value = vis[:-2]
unit = 'SM'
unit_english = 'Statute Miles'
else:
value ... |
def compare_version(version, pair_version):
"""
Args:
version (str): The first version string needed to be compared.
The format of version string should be as follow : "xxx.yyy.zzz".
pair_version (str): The second version string needed to be compared.
The format of versi... |
def calculate_number_of_castles(land):
"""Returns number of castles that can be built on input land array."""
print(land)
direction = 0 # 0 represents start, 1 means up, -1 means down
previous_plot = None
castles = 0
for index, plot in enumerate(land):
output_string = 'Index: %s Value:... |
def complete_record_ids(record, domain):
"""Ensures that a record's record_id fields are prefixed with a domain."""
def complete(record, field):
id = record.get(field)
if id and '/' not in id:
record[field] = '%s/%s' % (domain, id)
complete(record, 'person_record_id')
complet... |
def string_to_dict(string):
"""Return dictionary from string "key1=value1, key2=value2"."""
if string:
pairs = [s.strip() for s in string.split(",")]
return dict(pair.split("=") for pair in pairs) |
def get_grams(str):
"""
Return a set of tri-grams (each tri-gram is a tuple) given a string:
Ex: 'Dekel' --> {('d', 'e', 'k'), ('k', 'e', 'l'), ('e', 'k', 'e')}
"""
lstr = str.lower()
return set(zip(lstr, lstr[1:], lstr[2:])) |
def check_band_below_faint_limits(bands, mags):
"""
Check if a star's magnitude for a certain band is below the the
faint limit for that band.
Parameters
----------
bands : str or list
Band(s) to check (e.g. ['SDSSgMag', 'SDSSiMag'].
mags : float or list
Magnitude(s) of the ... |
def get_container_port_ip(server_pid, port_name):
"""
Get the container port IP.
Input:
- The container pid.
- The name of the port (e.g, as shown in ifconfig)
"""
return "ip netns exec {} ifconfig {} | grep \"inet \" | xargs | cut -d \' \' -f 2".format(s... |
def round_base(x, base=.05):
""""rounds the value up to the nearest base"""
return base * round(float(x) / base) |
def compare(
data_a: list,
data_b: list
):
""" Compares two sets of evaluated data with the same
Args:
data_a (list):
data set A
data_b (list):
data set B
Returns:
A String "Correct/Total Answers" and the percentage
"""
... |
def fuzzy_not(arg):
"""
Not in fuzzy logic
will return Not if arg is a boolean value, and None if argument
is None
>>> from sympy.logic.boolalg import fuzzy_not
>>> fuzzy_not(True)
False
>>> fuzzy_not(None)
>>> fuzzy_not(False)
True
"""
if arg is None:
return
... |
def Fence(Token,Fence1='\"',Fence2='\"'):
"""
This function takes token and returns it with Fence1 leading and Fence2
trailing it. By default the function fences with quotations, but it
doesn't have to.
For example:
A = Fence("hi there")
B = Fence("hi there","'","'")
C = Fenc... |
def __assert_sorted(collection):
"""Check if collection is ascending sorted, if not - raises :py:class:`ValueError`
:param collection: collection
:return: True if collection is ascending sorted
:raise: :py:class:`ValueError` if collection is not ascending sorted
Examples:
>>> __assert_sorted([... |
def countBits(n):
""" Consider a number x and half of the number (x//2).
The binary representation of x has all the digits as
the binary representation of x//2 followed by an additional
digit at the last position. Therefore, we can find the number
of set bits in x by finding the number of set b... |
def rapmap_pseudo_paired(job, config, name, samples, flags):
"""Run RapMap Pseudo-Mapping procedure on paired-end sequencing data
:param config: The configuration dictionary.
:type config: dict.
:param name: sample name.
:type name: str.
:param samples: The samples info and config dictionary.
... |
def check_same_keys(d1, d2):
"""Check if dictionaries have same keys or not.
Args:
d1: The first dict.
d2: The second dict.
Raises:
ValueError if both keys do not match.
"""
if d1.keys() == d2.keys():
return True
raise ValueError("Keys for both the dictionaries ... |
def sanitize(rev, sep='\t'):
"""Converts a for-each-ref line to a name/value pair.
"""
splitrev = rev.split(sep)
branchval = splitrev[0]
branchname = splitrev[1].strip()
if branchname.startswith("refs/heads/"):
branchname = branchname[11:]
return branchname, branchval |
def compute_line_intersection_point(x1, y1, x2, y2, x3, y3, x4, y4):
"""Compute the intersection point of two lines.
Taken from https://stackoverflow.com/a/20679579 .
Parameters
----------
x1 : number
x coordinate of the first point on line 1.
(The lines extends beyond this point.)... |
def validate_input_version(input_version):
"""Check that an input id is a number without spaces"""
if ' ' in input_version:
return False
# create a set of invalid characters
return str(input_version).isdigit() |
def _int_formatter(val, chars, delta, left=False):
"""
Format float to int.
Usage of this is shown here:
https://github.com/tammoippen/plotille/issues/11
"""
align = "<" if left else ""
return "{:{}{}d}".format(int(val), align, chars) |
def schema_url(base_url):
"""URL of the schema of the running application."""
return f"{base_url}/swagger.yaml" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.