content stringlengths 42 6.51k |
|---|
def PIL_box(rectangle):
"""Represent a Rectangle in PIL's Coordinate System.
See https://pillow.readthedocs.io/en/stable/handbook/concepts.html#coordinate-system
"""
x, y, width, height = rectangle
return (x, y, x + width, y + height) |
def remove_none_entries(obj):
"""Remove dict entries that are ``None``.
This is cascaded in case of nested dicts/collections.
"""
if isinstance(obj, dict):
return {k: remove_none_entries(v) for k, v in obj.items() if v is not None}
elif isinstance(obj, (list, tuple, set)):
return ty... |
def events_to_map(shifts):
"""
Convert a list of shifts to a map of shifts
"""
shift_map = {}
for shift in shifts:
start_date = shift['start_dt']
if start_date in shift_map:
shift_map[start_date].append(shift)
else:
shift_map[start_date] = [shift]
... |
def flatten(l):
"""
Flatten list of lists
:param l:
:return:
"""
return [item for sublist in l for item in sublist] |
def validate_ipaddress_version(ipaddress_version):
"""
Validate IPAddress version for IPSet
Property: IPSet.IPAddressVersion
"""
VALID_IP_VERSION = ("IPV4", "IPV6")
if ipaddress_version not in VALID_IP_VERSION:
raise ValueError(
"IPSet IPAddressVersion must be one of: %s" %... |
def _error_traceback_html(exc_info, traceback):
"""
Generates error traceback HTML.
:param tuple exc_info:
Output of :func:`sys.exc_info` function.
:param traceback:
Output of :func:`traceback.format_exc` function.
"""
html = """
<html>
<head>
... |
def remove_deleted_datasets_from_results(result):
"""Remove datasets marked as removed from results.
Arguments:
result (dict): Results with all datasets.
Returns:
dict: Results where removed datasets are removed.
"""
new_results = [
dataset for dataset in result.get("resul... |
def equal(lst):
"""
are all elements of lst equal?
"""
return lst.count(lst[0]) == len(lst) |
def get_size_format(b, factor=1024, suffix="B"):
"""
Scale bytes to its proper byte format
e.g:
1253656 => '1.20MB'
1253656678 => '1.17GB'
"""
for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]:
if b < factor:
return f"{b:.2f}{unit}{suffix}"
b /= factor
... |
def zoom_fit(screen, bounds, balanced=True):
"""What affine transform will zoom-fit the given items?
screen: (w,h) of the viewing region
bounds: (x,y,w,h) of the items to fit
balance: Should the x and y scales match?
returns: [translate x, translate y, scale x, scale y]
"""
... |
def get_symbol_freq_in_senteces(symbol, sentences):
"""
:param symbol: The symbol which frequency we calculater
:param sentences: a list of the sentences, representing the document / search space
:return: the number of occurrences of the given symbol among the words in the search space.
"""
fre... |
def trial_division(n):
"""[Trial Division](https://en.wikipedia.org/wiki/Trial_division)
Arguments:
n (Integer): Number to factor
Returns:
Array: List of factors of n
"""
a = []
while n % 2 == 0:
a.append(2)
n /= 2
f = 3
while f * f <= n:
if (n %... |
def decode_conditions(conditions: str):
"""
Decode the conditions from a JCN mnemonic to a decimal value.
Parameters
----------
conditions: str, mandatory
List of a maximum of 4 conditions
Returns
-------
int_conditions: int
Integer value of the conditions
Raises
... |
def dirname(p):
"""Returns the directory component of a pathname"""
i = p.rfind('/') + 1
assert i >= 0
head = p[:i]
if head and head != '/' * len(head):
head = head.rstrip('/')
return head |
def calculate_distance(a, b):
"""Calculate the distance between two points on the board (manhatan).
:type a: tuple
:param a: the first point on the board
:type b: tuple
:param b: the second point on the board
:rtype: interger
"""
dx = (a[2] - b[2]) ** 2
dy = (a[1] - b[1]) ** 2
... |
def parse_tags(targs):
"""
Tags can be in the forma key:value or simply value
"""
tags = {}
for t in targs:
split_tag = t.split(':')
if len(split_tag) > 1:
tags['tag:' + split_tag[0]] = split_tag[1]
else:
tags['tag:' + split_tag[0]] = ''
return tag... |
def _to_11_bit(data):
"""
Convert a bytearray to an list of 11-bit numbers.
Args:
data (bytes): bytearray to convert to 11-bit numbers
Returns:
int[]: list of 11-bit numbers
"""
buffer = 0
num_of_bits = 0
output = []
for i in range(len(data)):
buffer |= data... |
def translate_es_name(name):
"""Translate Elasticsearch name to PostgreSQL name.
Replaces dashes with underscores.
"""
if name == '@timestamp':
return 'timestamp'
return name.replace('-', '_') |
def search_disabled(request):
"""Facility for disabling search functionality.
This may be used in the future to automatically disable search if the search
backend goes down.
"""
return dict(SEARCH_DISABLED=False)
# return dict(SEARCH_DISABLED=not settings.DEBUG) |
def grubler_f(m, n, j, *f_i):
"""
Formular (2.4). Grubler's formula for calculation of Degrees of Freedom (DoF) of a mechanism.
:param m: DoF of a link. For planar mechanisms, m = 3; for spatial mechanisms, m = 6.
:param n: Number of links.
:param j: Number of joints.
:param f_i: DoF brought by ... |
def itoa(num, base=10):
""" Convert a decimal number to its equivalent in another base.
This is essentially the inverse of int(num, base).
"""
negative = num < 0
if negative:
num = -num
digits = []
while num > 0:
num, last_digit = divmod(num, base)
digits.append('0123456789... |
def factorial_tail_rec(n):
"""
Python does not support tail-call optimization so writing factorial in
tail call style will not offer additional benefits in terms of efficient
context passing during recursion. Recursion is considered "non-pythonic"
and should be avoided.
"""
def auxiliary(c, ... |
def delve(o,*k):
"""
Return items from a nested dict.
"""
return delve(o[k[0]],*k[1:]) if len(k)>1 else o[k[0]] |
def genSubstr(string, n):
"""
Generate all substrings of max length n for string
"""
length = len(string)
res = [string[i: j] for i in range(0, length)
for j in range(i + 1, min(i + n + 1, length + 1))]
return res |
def wrap_seq_for_applescript(seq):
"""Wrap a Python sequence in braces and quotes for use in AppleScript"""
quoted = [f'"{item}"' for item in seq]
joined = ', '.join(quoted)
wrapped = '{' + joined + '}'
return wrapped |
def _s_for(seq):
"""Returns a string of comma-separated %s markers for each
element of the sequence; i.e. returns '%s, %s, %s, %s, %s'
for a 5-element sequence. For SQL queries.
"""
return ', '.join(['%s'] * len(seq)) |
def replace_value_with_choice(data, replacements):
"""
:param data: list of dictionaries
:param replacements: dict of {attribute: choices} to replace
:return: list of dictionaries
"""
for attribute, choices in replacements.items():
choice_dict = dict(choices)
for item in data:
... |
def rectify(sid):
"""Make it match our nomenclature."""
if len(sid) == 4 and sid.startswith("K"):
return sid[1:]
return sid |
def cent_from_year(year):
""" takes an integer and returns the matching century """
if year == 0:
return 1
elif year < 0:
return -(year - 1) // -100
else:
return (year - 1) // 100 + 1 |
def Root_body(cont_Object_f):
"""
:param cont_Object_f: The sequence of "f" values of Object objects contained in this Root
:type cont_Object_f: Array
"""
return '\n'.join(s for s in cont_Object_f if s is not None) |
def div_round_up(x, n):
"""Divides a number x by another integer n and rounds up the result
Parameters
----------
x: int
Numerator
n: int
Denominator
Returns
-------
result: int
Result
Example
-------
>>> from pymatting import *
>>> div_round_up... |
def press_JSME_data_book(t_k):
"""From the JSME data book
Parameters
----------
t_k, K
Returns
-------
Vapor pressure, Pa
References
----------
Antoine equation fit, found in
The Japan Society of Mechanical Engineers (JSME),
JSME Data Book: Heat Transfer, fifth ed.,
... |
def args(**kwargs):
"""return a list with `growlnotify` cli arguments"""
args = []
for k, v in kwargs.items():
short = len(k) == 1
string = "-%s" % k if short else "--%s" % k
if isinstance(v, bool):
"""flag, e.g.: -s, --sticky"""
if v:
args += ... |
def generate_partial_word(word, correct_guess_list):
"""generates the word with all correctly chosen letters"""
temp_partial_word = ""
# for each letter either put a dash or a letter
for i in range(len(word)):
matches = False
for letter in correct_guess_list:
if letter == word[i]:
temp_partial_word ... |
def get_file_id(doc, file_name):
"""
Helper function to access data when MongoObserver is used.
Go through all files in doc and return the id of the file with file_name.
"""
r = list(filter(lambda dic: dic['name'] == file_name, doc['artifacts']))
assert len(r) == 1
return r[0]['file_id'] |
def format_command(command):
"""
Formats a command for displaying on screen.
"""
args = []
for arg in command:
if ' ' in arg:
args.append('"' + arg + '"')
else:
args.append(arg)
return ' '.join(args) |
def _find_swift_version(args):
"""Returns the value of the `-swift-version` argument, if found.
Args:
args: The command-line arguments to be scanned.
Returns:
The value of the `-swift-version` argument, or None if it was not found in
the argument list.
"""
# Note that the argument can occur mult... |
def linear(x1, y1, x2, y2):
""" Returns m and c from y = mx + c """
# y-y1 = m(x-x1)
# m = (y2 - y1) / (x2 - x1)
# y = (y2 - y1) / (x2 - x1) * (x - x1) + y1
m = (y2 - y1) / (x2 - x1)
c = y1 - m*x1
return m, c |
def get_mave_csv_schematype_from_exception(exception):
"""Get MAVE CSV schema type from exception string.
E.g. get 'score' from:
Error [400]: [...] No such file [...]: '/Users/[...]/9ff4b4d6-daea-4178-b170-7b24c77ce0c0-score.csv'
Args:
exception (str): Exception messaged raised due to a MAVE CS... |
def _ensure_unicode(text):
"""Return a unicode object for the given text.
Args:
text (bytes or unicode):
The text to decode.
Returns:
unicode: The decoded text.
"""
if isinstance(text, bytes):
text = text.decode('utf-8')
return text |
def _unescape_new_lines(commit_message):
"""
:type commit_message: str
"""
return commit_message.replace('$$', '\n') |
def sumfeat(obj_list, feat):
"""a helper method that calculates the sum of a target feature over a list of objects
Args:
obj_list: a list of objects
feat: a string containing the name of the target feature
Returns:
the sum of the target feature over the given ... |
def to_tuple(set_sentences):
"""
Change each sentence to tuple of words.
INPUT: set_sentences a set of sentences
OUTPUT: set_tuples a set of corresponding tuples
"""
result = set()
for sentence in set_sentences:
result.add(tuple(sentence.split()))
return result |
def split_board(board_args):
"""
Splits the board args
:param board_args:
:return:
"""
board = []
card_1 = board_args[0:2]
board.append(card_1)
card_2 = board_args[2:4]
board.append(card_2)
card_3 = board_args[4:6]
board.append(card_3)
card_4 = board_args[6:8]
... |
def uniform_cdf(x):
"""returns the probability that
a uniform random variable is <= x"""
if x < 0:
return 0
elif x < 1:
return x
else:
return 1 |
def parse_command(line):
"""Split given line in command to execute on the remote system and
commands to pipe/redirect the output to on the host.
Pipe:
"ll | grep foo" -> ('ll', 'grep foo')
Redirect:
"cat /root/conf > conf" -> ('cat /root/conf', 'cat > conf')
Pipe found first, redirect p... |
def reformat_ssh_key_to_pem_bytes(ssh_key_str: str) -> bytes:
"""
reformat the ssh key string to pem format bytes for github client.
:param ssh_key_str: utf-8 string without header and footer for the github app rsa private key
:return: pem formatted private key in bytes with header and footer
"""
... |
def _get_warmup_factor_at_iter(
method: str, iter: int, warmup_iters: int, warmup_factor: float
) -> float:
"""
Return the learning rate warmup factor at a specific iteration.
See :paper:`ImageNet in 1h` for more details.
Args:
method (str): warmup method; either "constant" or "line... |
def mapValues(key, dict_obj):
"""
mapValues(func: function, obj: dict)
transformed dict values with "func"
args:
func = L x: -x; obj = {"a":0, "b":1}
retun:
transformed dict
{"a": 0, "b": -1}
"""
for k,v in dict_obj.items():
di... |
def check_type(lst, t):
"""Checks if all elements of list ``lst`` are of one of the types in ``t``.
:param lst: list to check
:param t: list of types that the elements in list should have
:return: Bool
"""
for el in lst:
if type(el) not in t:
return False
return True |
def _err():
"""Connection mock error"""
return 'error', [] |
def enc(x, codec='ascii'):
"""Encodes a string for SGML/XML/HTML"""
if isinstance(x, bytes):
return ''
x = x.replace('&', '&').replace('>', '>').replace('<', '<').replace('"', '"')
if codec:
x = x.encode(codec, 'xmlcharrefreplace')
return x |
def is_unique_corr(x):
"""Check that ``x`` has no duplicate elements.
Args:
x (list): elements to be compared.
Returns:
bool: True if ``x`` has duplicate elements, otherwise False
"""
return len(set(x)) == len(x) |
def _GenerateGstorageLink(c, p, b):
"""Generate Google storage link given channel, platform, and build."""
return 'gs://chromeos-releases/%s-channel/%s/%s/' % (c, p, b) |
def valid_band_combo(request):
"""Return true if band combo is valid, False if not."""
valid = [1, 2, 3, 4, 5, 6, 7, 9]
try:
# handles error if band1, 2 or 3 doesn't exist
bands = [int(request.params.get('band1')),
int(request.params.get('band2')),
int(reque... |
def parse_quotes(cmd, quotes=True, string=True):
""" parses quotes """
string_literals = ['\'', '\"']
args = []
words = cmd
open_q = False
if quotes:
for quote in string_literals:
if quote in cmd:
if cmd.count(quote) % 2 != 0:
raise ValueEr... |
def char_to_string(ll):
"""Convert 2-D list of chars to 1-D list of strings."""
# https://stackoverflow.com/questions/23618218/numpy-bytes-to-plain-string
# bytes_string.decode('UTF-8')
# We might be able to do this a bit more shorthand as we did in Python2.x
# i.e return [''.join(x).strip() for x... |
def terminals(tree):
"""Returns a list of the terminal strings in tree"""
def _terminals(node, terms):
if isinstance(node, list):
for child in node[1:]:
_terminals(child, terms)
else:
terms.append(node)
terms = []
_terminals(tree... |
def merge_sort(intervals):
"""
Merges and sorts the intervals in a list.
It's an alternative of merge_gaps() that sort the list before merging.
Should be faster but I haven't campared them yet.
"""
sorted_by_lower_bound = sorted(intervals, key=lambda tup: tup[0])
merged = []
for higher ... |
def spacify_number(number):
""" Takes a number and returns a string with spaces every 3 numbers
"""
nb_rev = str(number)[::-1]
new_chain = ''
for val, letter in enumerate(nb_rev):
if val%3==0:
new_chain += ' '
new_chain += letter
final_chain = new_chain[::-1]
retu... |
def return_name_html(info):
"""
In the PBP html the name is in a format like: 'Center - MIKE RICHARDS'
Some also have a hyphen in their last name so can't just split by '-'
:param info: position and name
:return: name
"""
s = info.index('-') # Find first hyphen
return info[s + 1:].str... |
def second_order_derivative(w, x, order=2):
""" Return the value of d2y/dx2 at point x.
"""
result = 2 * w[0]
return result |
def sigmoid_backward(dA, cache):
"""
partial derivative of single SIGMOID unit
Arguments:
dA -- post-activation gradient
cache -- (Z, A), the pre/post-activation matrix
Returns:
dZ -- gradient of cost with respect to Z
"""
A = cache[1]
dZ = dA * A * (1-A)
return dZ |
def tell_domain_tls_name(d):
"""
>>> tell_domain_tls_name('*.example.com')
'example-com'
>>> tell_domain_tls_name('prometheus.example.com')
'prometheus-example-com'
"""
parts = d.split('.')
if parts[0] == '*':
parts = parts[1:]
return '-'.join(parts) |
def make_proposals(preferences):
""" Takes in a dictionary with key equal to a participant and
value equal to a list of that participant's preferences.
Function iterates over each participant in order to find and return
a record of the proposals in the form of a dictionary.
Each pa... |
def from_hex(hex_data: str, delimiter: str = " ") -> bytes:
"""Converts hexadecimal byte string into bytes object"""
if delimiter == "":
data = [hex_data[i:i+2] for i in range(0, len(hex_data), 2)]
else:
data = hex_data.split(delimiter)
data = [int(byte, 16) for byte in data]
return ... |
def symbol_transform(symbol):
"""Transform symbol for XueQiu."""
return ''.join(symbol.split('.')[::-1]) |
def cleanup_code( content):
"""Automatically removes code blocks from the code."""
# remove ```py\n```
if content.startswith('```') and content.endswith('```'):
return '\n'.join(content.split('\n')[1:-1])
# remove `foo`
return content.strip('` \n') |
def _calculate_positives_negatives(target_details):
"""
Takes expected and actual target values, generating true and false positives and negatives,
including the actual correct # of positive and negative values.
"""
true_positive = 0
true_negative = 0
false_negative = 0
false_positive =... |
def rgba2hex(rgba):
"""Convert rgba values to hex."""
# Slice the tuple so that
# we don't get alpha and
# convert values to 8 bit ints
rgb = tuple([min(max(int(255 * i), 0), 255) for i in rgba[:3]])
return "#{0:02x}{1:02x}{2:02x}".format(*rgb) |
def flatten(arr):
"""
Flatten the given 2D array
"""
return [item for sublist in arr for item in sublist] |
def get_training_or_validation_split(samples, labels, validation_split, subset):
"""Potentially restict samples & labels to a training or validation split.
# Arguments
samples: List of elements.
labels: List of corresponding labels.
validation_split: Float, fraction of data to reserve f... |
def get_link_color(link_loss: int) -> str:
"""
This function returns the failure color code based on the percentage of the lost packets
"""
result = ""
failure_colors = [
"#ffffff",
"#ffeeee",
"#ffdddd",
"#ffcccc",
"#ffbbbb",
"#ffaaaa",
"#ff88... |
def proteins_from_rf(aa_seq):
"""Search sequence for start and stop codons and compute all possible
proteins in an amino acid sequence to return a list of possible proteins"""
current_prot = []
proteins = []
for aa in aa_seq:
if aa == "_":
# STOP accumulating amino acids if STOP... |
def flatten_one_level(iterable, is_nested, get_nested):
"""
Returns [get_nested(e) if is_nested(e) else e for e in iterable]
"""
return [get_nested(e) if is_nested(e) else e for e in iterable] |
def calc_dDdc_fn(c, dc, D_fn):
"""
Computes dD/dc given a functional form to estimate D(c).
"""
# computes diffusivity at given concentration and one step size away [m^2/s]
D1 = D_fn(c)
D2 = D_fn(c + dc)
# computes dD/dc using forward difference formula [m^2/s / kg/m^3]
dDdc = (D2 - D1) ... |
def update_full_dict_projections(nodes, full_dict_projections, t_dict_proj):
"""
Full dict embeddings is a dictionary where keys are nodes and values are their embedding in the latest time stamp
they have shown up, i.e. if a node is in oth time stamps t and k where t < k, then its embedding here is of
t... |
def _get_domain(domains, domain_spec):
"""A helper routine to find materials/cells for load_from_hdf5(...)"""
# If domain_spec is an integer, it must be a domain ID
if isinstance(domain_spec, int) and domain_spec in domains:
return domains[domain_spec]
# If domain_spec is a string, it must be ... |
def word_sentiment_feature(word):
""" Given a word, it returns a dictonary of the first letter of the word"""
first_l = word[0]
# features is of the dictionary type having only one feature
features = {"first letter": first_l}
return features |
def find_overlap(ls_one, ls_two):
"""
Question 8.5: Find overlap in two linked lists
without cycles
"""
# find length of list one
len_one = 0
len_two = 0
head_one = ls_one
head_two = ls_two
while head_one:
head_one = head_one.next
len_one += 1
while head_two... |
def _ListToDict(env_vars_list):
"""Converts [{'key': key, 'value': value}, ...] list to dict."""
return {item.key: item.value for item in env_vars_list} |
def _sugar(s):
"""Shorten strings that are too long for decency."""
# s = s.replace("{", "{{").replace("}", "}}")
if len(s) > 30:
return s[:10] + " ... " + s[-10:]
else:
return s |
def json_lookup(json_data, key):
"""
Give a key "a.b.c", look up json_data['a']['b']['c']
Returns None if any of the keys were not found.
"""
sofar = json_data
for k in key.split("."):
try:
sofar = sofar[k]
except:
return None
return sofar |
def node_is_in_list(node,list_of_nodes):
"""
Check if the node is present in the list of nodes
"""
for node2 in list_of_nodes:
if node is node2:
return True
return False |
def unique(listCheck):
""" Check that all elements of list are unique
https://stackoverflow.com/a/5281641"""
seen = set()
return not any(tuple(i) in seen or seen.add(tuple(i)) for i in listCheck) |
def get_text(obj):
"""Small helper function to get the text from a Beautiful Soup object
unless it is None in which case return None"""
return None if obj is None else obj.text |
def is_blank(value: str) -> bool:
"""check string is None OR is empty or blank
Arguments: string tested
"""
return not (value and value.strip()) |
def print_alignment(match, test_instance, gold_instance, flip=False):
""" print the alignment based on a match
Args:
match: current match, denoted by a list
test_instance: instances of AMR 1
gold_instance: instances of AMR 2
filp: filp the test/gold or not"""
result = []
for i, m in enum... |
def _valid_spatial(validation_method, value):
"""
Executes a given validation method and returns whether or not any validation
messages were generated.
:param function validation_method: The validation method to execute
:param Any value: The value to validate
:rtype: bool
"""
errors = {... |
def SplitProcessor_FindCleanBreak( sw, vertical, pos, list_panes, bx, by, bw, bh ):
"""
Finds a split on an axis within the specified bounds, if found returns True, otherwise False.
This shares an edge case with tmux that is an inherent limitation in the way that tmux works.
For more information on th... |
def get_rain_svg(risk_of_rain: float) -> str:
"""
Get SVG path to risk of rain icon
:param risk_of_rain: Risk of rain between 0 and 1
:return: path to SVG resource
"""
if risk_of_rain < 0.33:
return 'Icons/Shades.svg'
return 'Icons/Umbrella.svg' |
def _merge(left_list, right_list):
"""Merge two lists with the result being sorted using __lt__
operator / method
"""
final = [] # k3
# index1, index2 for left and right lists respectively
i1, i2 = 0, 0 # k4
for ... |
def flatten(data):
"""
Flattens the given data structure.
Returns:
list[str]
"""
list_ = []
if isinstance(data, list):
[list_.extend(flatten(item)) for item in data]
elif isinstance(data, dict):
[list_.extend(flatten(item)) for item in data.values()]
else:
... |
def update(event, context):
"""
Place your code to handle Update events here
To return a failure to CloudFormation simply raise an exception, the exception message will be sent to CloudFormation Events.
"""
physical_resource_id = event['PhysicalResourceId']
response_data = {'blah': 'upda... |
def Likelihood(evidence, hypo):
"""Computes the likelihood of the evidence assuming the hypothesis is true.
Args:
evidence: a tuple of (number of heads, number of tails)
hypo: float probability of heads
Returns:
probability of tossing the given number of heads and tails with a
... |
def nested_counter(nested_list, inner_index, outer_index):
"""
Return the counter of a nested list.
Usage in template:
{% load list_to_columns %}
{% for outer_loop in nested_list %}
{% for inner_loop in outer_loop %}
{{ nested_counter nested_list forloop.counter... |
def forceIterable(x):
"""Forces a non iterable object into a list, otherwise returns itself
:param list x: the object
:return: object as a list
:rtype: list"""
if not getattr(x, '__iter__', False):
return list([x])
else:
return x |
def match_ot(gold_ote_sequence, pred_ote_sequence):
"""
calculate the number of correctly predicted opinion target
:param gold_ote_sequence: gold standard opinion target sequence
:param pred_ote_sequence: predicted opinion target sequence
:return: matched number
"""
n_hit = 0
for t in pr... |
def check_is_faang(item):
"""
Function checks that record belongs to FAANG project
:param item: item to check
:return: True if item has FAANG project label and False otherwise
"""
if 'characteristics' in item and 'project' in item['characteristics']:
for project in item['characteristics'... |
def scale_between(minval, maxval, numStops):
""" Scale a min and max value to equal interval domain with
numStops discrete values
"""
scale = []
if numStops < 2:
return [minval, maxval]
elif maxval < minval:
raise ValueError()
else:
domain = maxval - minval
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.