content stringlengths 42 6.51k |
|---|
def strGet(text, pref='', suf='', index=0, default=None):
"""
This method find prefix, then find suffix and return data between them.
If prefix is empty, prefix is beginnig of input data.
If suffix is empty, suffix is ending of input data.
:param str text: Input data.
:param str pref: Prefix.
:par... |
def remove_digits_string(string):
"""Remove digits from a string and remove "." at the end of the string.
:param string: str to delete the digits from
:return: str without any digits
"""
clean_string = ''.join(i for i in string if not i.isdigit()
).replace("..", ".")
... |
def extract_authors_from_json_list_sting(json_list_str):
"""
Audible provides a list of authors which might includes translators, foreword, adaptors and other contributors.
Examples:
[{'asin': 'B072549W28', 'name': 'Seth Stephens-Davidowitz'}, {'asin': None, 'name': 'Steven Pinker - foreword'}]
... |
def parsenumber(v, strict=False):
"""
Attempt to parse the value as a number, trying :func:`int`, :func:`long`,
:func:`float` and :func:`complex` in that order. If all fail, return the
value as-is.
.. versionadded:: 0.4
.. versionchanged:: 0.7 Set ``strict=True`` to get an exce... |
def _get_positional_body(*args, **kwargs):
"""Verify args and kwargs are valid, and then return the positional body, if users passed it in."""
if len(args) > 1:
raise TypeError("There can only be one positional argument, which is the POST body of this request.")
if "options" in kwargs:
raise... |
def min_conf_filter_predictions(filter_dict, preds, confs, label_dict=None):
""" Filter our predictions based on per label confidence thresholds
Args:
filter_dict (dict): A dict of strings or ints that get mapped a minimum confidence
value. If the keys are strings, label_di... |
def physical_description(physical_description):
"""Physical description for frontend."""
extent = physical_description.get("extent", "")
other_physical_details = physical_description.get("other_physical_details", "")
return f"{extent}, {other_physical_details}" |
def findTotalNMatches(al):
""" Calculate how many bases in alignment match reference, given cigar string
Inputs:
al: pysam alignment read from bamfile
Outputs:
Number of matches, ratio of number of matches to query length
"""
MDtagPos = str(al).find("MD",10) + 6
temp = str(al)[MD... |
def are_values_empty(dry_run_content):
"""Return true if values of dry_run.json are empty."""
for value in dry_run_content.values():
if value:
return False
return True |
def _join_url(*args):
"""Join URL path segments with "/", skipping empty segments."""
return '/'.join(a for a in args if a) |
def print_link(click_data):
"""
Build a NCBI search term link upon Button press
:param click_data: Selected datapoint in scatterplot
:return: search term link
"""
# catch invalid data
if not click_data:
return ""
else:
# build link
output_link = ""
output_... |
def _i2col(i):
"""Given an index, return the column string:
0 = 'A'
27 = 'AB'
758 = 'ACE'
"""
b = (i//26) - 1
if b>=0:
return _i2col(b) + chr(65+(i%26))
return chr(65+(i%26)) |
def ceildiv(numerator, denominator):
"""Ceiling division"""
return -((-numerator)//denominator) |
def contains(a: str, b: str) -> bool:
"""Returns true if a contains all chars in b."""
return all([c in a for c in b]) |
def scale(value):
"""Scale the light sensor values from 0-65535 (AnalogIn range)
to 0-50 (arbitrarily chosen to plot well with temperature)"""
return value / 65535 * 50 |
def calc_check_digit(value):
"""calculate check digit, they are the same for both UPCA and UPCE"""
check_digit=0
odd_pos=True
for char in str(value)[::-1]:
if odd_pos:
check_digit+=int(char)*3
else:
check_digit+=int(char)
odd_pos=not odd_pos #alternate
... |
def default(value, default):
"""Defaults a variable.
Parameters
----------
value
The value to potentially default.
default
The default value.
Returns
-------
any
If ``value`` is ``None``, then ``default`` is returned,
else ``value`` is returned.
"""
... |
def format_sse(event = None, data: str = "") -> str:
"""
Formats data to the event-stream format.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
"""
message = f"data: {data}\n\n"
# If event is specified, prepend "event: {event}\... |
def calc_x_dist(p, q):
"""
:param p: robot position list p
:param q: robot position list q
:return: the x-axis Euclidean distance between p and q
"""
return abs(p[0]-q[0]) |
def _calculate_color_sim(ri, rj):
"""Calculate color similarity using histogram intersection"""
return sum([min(a, b) for a, b in zip(ri["color_hist"], rj["color_hist"])]) |
def int_to_roman(n):
"""
Convert an integer to its standard Roman Numeral representation
"""
V = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
S = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
out = ""
for val,sym in zip(V,S):
while n >= v... |
def bstr(buf):
"""Decode the byte string into a string"""
return buf.decode('utf-8') |
def pwr2modp(k, p):
"""Return 2**k mod p for any integer k"""
if k < 0:
assert p & 1
return pow((p + 1) >> 1, -k, p)
return pow(2, k, p) |
def decode(s, encodings=("ascii", "utf-8", "latin1")):
"""Try to decode given bytes using different encodings.
Taken from: https://stackoverflow.com/a/273631/11782367
"""
for encoding in encodings:
try:
return s.decode(encoding)
except UnicodeDecodeError:
pass
... |
def recursive_dict_filling(dct, keys, value):
"""
Recursively add value to an arbitrary deep dictionary structure based on a list of keys.
"""
if not keys:
return value
else:
if not keys[0] in dct.keys():
dct[keys[0]] = dict()
dct[keys[0]] = recursive_dict_filling... |
def _estimate_geohash_precision(r: int):
"""
Returns hueristic geohash length for the given radius in meters.
:param r: radius in meters
"""
precision = 0
if r > 1000000:
precision = 1
elif r > 250000:
precision = 2
elif r > 50000:
precision = 3
elif r > 1000... |
def _is_sorted(a_list: list) -> bool:
"""
Return True if `a_list` is sorted, False otherwise
"""
for i in range(len(a_list) - 1):
if a_list[i] > a_list[i + 1]:
return False
return True |
def _gt_object_hook(d):
"""JSON stores keys as strings, convert these to integers."""
return {int(k): v for k, v in d.items()} |
def normalize_file_permissions(st_mode):
"""Normalize the permission bits in the st_mode field from stat to 644/755
Popular VCSs only track whether a file is executable or not. The exact
permissions can vary on systems with different umasks. Normalising
to 644 (non executable) or 755 (executable) makes... |
def determine_file_and_source(record):
"""
predict the combination of data source and data type to use for file information
for file type, the preference in the order of fastq, sra, cram_index
for source type, the preference in the order of ftp, galaxy, aspera
the order is from the observation of da... |
def _GenerateFilter(params):
"""Generate a filter object using dot separated object paths.
A list of dot separated paths (foo, foo.bar, foo.baz) is merged into a
dict which can be used as a filter on a received object. Objects are parsed
until a falsy value (such as {}) is reached which includes everything in... |
def get_parent_tuple(value, items):
"""Find the parent tuple of a value in a list.
Args:
value: value to lookup.
items: dict to look up in.
Returns: tuple key."""
for (priority, key) in items:
if key == value:
return (priority, key)
return |
def classname(cls):
"""Create the class name str for __repr__"""
return '.'.join([cls.__class__.__module__, cls.__class__.__name__]) |
def load_data(base: str = "data/Baltruschat") -> dict:
"""Helper function that takes path to working directory and
returns a dictionary containing the paths to the training and testsets.
Parameters
----------
base
path to folder containing dataset sd files
Returns
----------
di... |
def evaluate_rpn(ls):
"""
Question 9.2
"""
tokens = []
for token in ls:
if token in '+-/*':
tk_1 = tokens.pop()
tk_2 = tokens.pop()
if token == '+':
tokens.append(tk_1 + tk_2)
elif token == '-':
tokens.append(tk... |
def juniper_items_to_list_of_dicts(module, data):
"""Recursively convert Juniper PyEZ Table/View items to list of dicts.
"""
resources = []
# data.items() is a list of tuples
for table_key, table_fields in data.items():
# sample:
# ('fxp0', [('neighbor_interface', '1'), ('local_inter... |
def vdc(n, base=2):
"""[summary]
Arguments:
n (int): number
Keyword Arguments:
base (int): [description] (default: {2})
Returns:
int: [description]
"""
vdc, denom = 0.0, 1.0
while n:
denom *= base
n, remainder = divmod(n, base)
vdc += remain... |
def triangulate(strips):
"""A generator for iterating over the faces in a set of
strips. Degenerate triangles in strips are discarded.
>>> triangulate([[1, 0, 1, 2, 3, 4, 5, 6]])
[(0, 2, 1), (1, 2, 3), (2, 4, 3), (3, 4, 5), (4, 6, 5)]
"""
triangles = []
for strip in strips:
if len... |
def longest_common_substring(s1, s2):
"""
From https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring#Python
@param s1: string 1
@param s2: string 2
@return: string: the longest common string!
"""
# noinspection PyUnusedLocal
m = [[0] * (1 + len(s2)) for ... |
def concat_by(string_):
"""
Concat string_ value. If this value is not a string
print and message error
"""
if not isinstance(string_, str):
raise ValueError('Only strings')
return 'Your message is: ' + string_ |
def tcl_request_mock(url, request):
"""
Mock for TCL download URL request.
"""
badbody = b'<?xml version="1.0" encoding="utf-8"?>\n<GOTU><FILE_LIST><FILE><FILE_ID>261497</FILE_ID><DOWNLOAD_URL>/ce570ddc079e2744558f191895e524d02a60476f/cfcdde91ea7f810311d1f973726e390f77a9ff1b/258098/261497</DOWNLOAD_URL>... |
def is_float(value):
"""Checks if the specified value is a float"""
try:
float(value)
return True
except ValueError:
return False |
def roll_and_extract_mid(shape, offset, true_usable_size):
"""Calculate the slice of the roll + extract mid method
:param shape: shape full size data G/FG
:param offset: ith offset (subgrid or facet)
:param true_usable_size: xA_size for subgrid, and yB_size for facet
:return: slice list
"""
... |
def slow_divisible(a=3, b=5, target=1000):
"""
this function calculates the sum of all integers from 0 to
`target' that are divisible by `a' or `b' with a remander
of 0
this is a slow implementation of the algorithm
-------------------------
params:
a, b - the integers that are us... |
def get_safe(dic, *keys):
"""
Safely traverse through dictionary chains
:param dict dic:
:param str keys:
:return:
"""
no_d = dict()
for key in keys:
dic = dic.get(key, no_d)
if dic is no_d:
return None
return dic |
def _expand_versions(versions):
"""
Converts a list of one or more semantic versions into
a sorted list of 'semantically compatible' versions.
1.3.5 = 1.3.5, 1.3.X, 1.X.X
1.2 = 1.2.X, 1.X.X
1 = 1.X.X
"""
assert isinstance(versions, (list, set, str))
versions = list(versi... |
def _check_if_map(value: dict):
"""
BQ is confused when we pass it a map<int> or map<str> type, we should flatten
such dictionaries as List of {"key": key, "value": value}.
This function returns a boolean value,
based on whether the dictionary in question is a map or not.
"""
keys = ... |
def _int_to_hex(input: int) -> str:
"""Given an int, returns a hex string representing bytes."""
def pad_hex(hex: str) -> str:
"""Pad hex to ensure 2 digit hexadecimal format maintained."""
return "0" + hex if len(hex) % 2 else hex
hex = format(input, "02X")
return pad_hex(hex) |
def _format_parameter(parameter: object) -> str:
"""
Format the parameter depending on its type and return
the string representation accepted by the API.
:param parameter: parameter to format
"""
if isinstance(parameter, list):
return ','.join(parameter)
else:
return str(pa... |
def actors_to_movie(data):
"""
Creates a mapping between two actors and their shared movie.
Returns a dictionary with the format {(actor_id_1, actor_id_2): movie_id}.
"""
d = {}
for i in data:
d[(i[0], i[1])] = i[2]
d[(i[1], i[0])] = i[2]
return d |
def get_best_parameters(mdl_dict):
"""
Get param values (defaults as well)
"""
lr = float(mdl_dict.get("learning_rate", "0.001"))
embedding_size = int(mdl_dict.get("embedding_vector_size", "512"))
dropout = float(mdl_dict.get("dropout", "0.2"))
units = int(mdl_dict.get("memory_units", "512")... |
def apply_media(model, media):
"""Applies media <dict> to model by setting the compound /
reaction's upper bounds."""
for rxn_id, upper_bound in media.items():
model.reactions.get_by_id(rxn_id).upper_bound = upper_bound
return model |
def get_flag(bits, bit):
"""
Gets the flag value.
:param bits: The bits
:type bits: int
:param bit: The bit index
:type bit: int
:returns: The flag value
:rtype: bool
"""
return bool(bits & (1 << bit)) |
def split_signature(signature):
"""Split a DRS, or CCG type, into argument and return types.
Args:
signature: The DRS or CCG signature.
Returns:
A 3-tuple of <return type>, [\/], <argument type>. Basic non-functor types are encoded:
<basic-type>, '', ''
See Also:
marbl... |
def join(seq, separator=","):
"""
Description
----------
Concatenate all values in a sequence into a string separated by the separator value.
Parameters
----------
seq : (list or tuple) - sequence of values to concatenate\n
separator : any, optional - value to separate the values in the... |
def format_seconds(n: int) -> str:
"""Format seconds into pretty string format."""
days = int(n // (24 * 3600))
n = n % (24 * 3600)
hours = int(n // 3600)
n %= 3600
minutes = int(n // 60)
n %= 60
seconds = n
if days > 0:
strtime = f'{days}d {(hours)}h:{minutes}m:{int(seconds)... |
def get_avg_values_lists(data):
"""Compute average values for data in lists."""
output = list()
for l in data:
output.append(sum(l)/len(l))
return output |
def HasAbstractFieldPath(abstract_path, store):
"""Whether a store contains abstract_path.
Makes no provision for repeated fields. I suppose if we did we'd
have it mean, that /any/ of the repeated subfields had such a
subpath but, we happen to not need it.
Args:
abstract_path: the path to test.
... |
def parse_headers_values(headers):
"""Parses comma seperated headers
Headers with options and values using = seperator
are trimmed from spaces.
Returns list of header options and valuea.
"""
if headers is None:
return []
return [
"=".join([value.strip(' ') for value in hea... |
def rotate_matrix(m, n):
"""
:type m: list[list[int]]
:type n: int
:rtype: list[list[int]]
"""
max_c = min(len(m), len(m[0])) // 2 if min(len(m), len(m[0])) % 2 == 0 else min(len(m), len(m[0])) // 2 + 1
for c in range(max_c):
for _ in range(n % ((len(m) - 2 * c) * 2 + (((len(m[0]) ... |
def parse_factor_polarity_curation(cur):
"""Parse details from a curation that changes an event's polarity."""
bef_subj = cur['before']['subj']
bef_obj = cur['before']['obj']
aft_subj = cur['after']['subj']
aft_obj = cur['after']['obj']
if bef_subj['polarity'] != aft_subj['polarity']:
r... |
def jwt_get_username_from_payload_handler(payload):
"""
Override this function if username is formatted differently in payload
"""
return payload.get("sub") |
def pf_mobility(phi, gamma):
""" Phase field mobility function. """
# func = 1.-phi**2
# return 0.75 * gamma * 0.5 * (1. + df.sign(func)) * func
return gamma |
def ston(a):
"""
Returns a string equal to a or None
"""
if a:
return str(a)
else:
return None |
def _process_create_policy_version(event: dict) -> list:
""" Process CreatePolicyVersion event. This function doesn't set tags. """
policy_name = event['requestParameters']['policyArn'].split('/')[-1]
policy_new_version = event['responseElements']['policyVersion']['versionId']
return [f"{policy_name}:... |
def noneorbool(s):
"""Turn empty or 'none' string to None, all others to boolean."""
if s.lower() in ("", "none"):
return None
elif s.lower() in ("true", "t", "yes", "y", "1"):
return True
else:
return False |
def truncate_float(value, digits_after_point=2):
"""
Truncate long float numbers
>>> truncate_float(1.1477784, 2)
1.14
"""
pow_10 = 10 ** digits_after_point
return (float(int(value * pow_10))) / pow_10 |
def monthlyCalc(balance, annualInterestRate, monthlyPaymentRate):
"""
input: balance at the start of month
annualInterestRate
monthlyPaymentRate
output: balance at the end of 1 month
"""
balance = balance - monthlyPaymentRate * balance
balance = balance + (annualInterestRate/12) * ... |
def sort_freq_dist(freqdict):
""" Sort frequency distribution. """
aux = [(freqdict[key], key) for key in freqdict]
aux.sort()
aux.reverse()
return aux |
def q_or_y(get, cols):
"""
Checks compustat cols to see which extension ('q', 'y', none) is appropriate and adds it.
For use with quarterly data.
"""
out_list = []
for g in get:
if g in ('fqtr','cusip','fyr','tic','conm'):
out_list.append(g)
continue
... |
def palindrome(word):
"""Create a palindrome from a word.
Args:
word (str): The word.
Returns:
str: The updated palindrome.
>>> palindrome('cool')
>>> 'coollooc'
"""
return '{}{}'.format(word, word[::-1]) |
def check_not_finished_board(board: list) -> bool:
"""
Check if skyscraper board is not finished, i.e., '?' present on the game board.
Return True if finished, False otherwise.
>>> check_not_finished_board(['***21**', '4?????*', '4?????*',\
'*?????5', '*?????*', '*?????*', '*2*1***'])
False
>>... |
def byte_str(s='', encoding='utf-8', input_encoding='utf-8', errors='strict'):
"""
Returns a bytestring version of 's', encoded as specified in 'encoding'.
Accepts str & unicode objects, interpreting non-unicode strings as byte
strings encoded using the given input encoding.
"""
assert isinsta... |
def solution(n):
"""Returns the sum of all fibonacci sequence even elements that are lower
or equals to n.
>>> solution(10)
10
>>> solution(15)
10
>>> solution(2)
2
>>> solution(1)
0
>>> solution(34)
44
"""
if n <= 1:
return 0
a = 0
b = 2
coun... |
def horner( x, *poly_coeffs ):
""" Use Horner's Scheme to evaluate a polynomial
of coefficients *poly_coeffs at location x.
"""
p = 0
for c in poly_coeffs[::-1]:
p = p*x + c
return p |
def get_classmap(classes):
"""
Initializes the classmap of each class's database IDs to training IDs
"""
# Keras requires that the mapping IDs correspond to the index number of the class.
# So we create that mapping (dictionary)
classmap = {class_: index for index, class_ in enumerate(classes)}... |
def conditional_questiongroups(formsets: list, conditions: str, value: str) -> list:
"""
Return a list of questiongroup formsets based on a list of conditions (as
string) and a value used to check against the conditions.
Args:
formsets: List of formset tuples [0] configuration dict and [1] form... |
def resize_if_smaller(box: list, max_dims: tuple, min_size: tuple = (32, 32)):
"""[summary]
Args:
box (list): Bounding Box coordinates [left, top, right, bottom].
max_dims (tuple): Maximum size of x, y dimensions to max out new box coordinates.
min_size (tuple, optional): Resize box if ... |
def get_latest_dump(dump_list):
"""Function: get_latest_dump
Description: Return latest dump from a list of dumps based on epoch date.
Arguments:
(input) dump_list -> List of dumps from a repository.
(output) Name of latest dump.
"""
dump_list = list(dump_list)
last_dump =... |
def parse_itypes(itype_argument):
"""Parses the itype argument and returns a set of strings with all the selected interaction types """
if "all" in itype_argument:
return ["sb", "pc", "ps", "ts", "vdw", "hb", "lhb", "hbbb", "hbsb",
"hbss", "wb", "wb2", "hls", "hlb", "lwb", "lwb2"]
re... |
def remove_common_path_simple(path1, path2):
"""
This just subtracts a string that is the same at the beginning.
path1 gets subtracted from path2
"""
if not path2:
return ''
value = path2.find(path1)
sub_part = None
if value > -1 and value == 0:
... |
def dict_raise_on_duplicates(ordered_pairs):
"""reject duplicate keys"""
my_dict = dict()
for key, values in ordered_pairs.items():
if key in my_dict:
raise ValueError("Duplicate key: {}".format(key, ))
else:
my_dict[key] = values
return my_dict |
def getInt(val):
"""
Converts a string to an integer with a null check
Parameters
----------
val : str
The value to convert to an integer
Returns
-------
val : int
Returns converted str value to an int
Raises
------
None
"""
if(val is None):
... |
def _next_rooted_tree(predecessor, p=None):
"""One iteration of the Beyer-Hedetniemi algorithm."""
if p is None:
p = len(predecessor) - 1
while predecessor[p] == 1:
p -= 1
if p == 0:
return None
q = p - 1
while predecessor[q] != predecessor[p] - 1:
q -= ... |
def _inline_volume_check(inputs, claim_name):
"""Returns either an emptyDir or PVC volumeSpec """
if "emptyDir" in inputs.get("spec", {}):
return {"emptyDir": {}}
else:
return {
"persistentVolumeClaim": {"claimName": claim_name},
} |
def format_dependencies(id_to_deps):
"""Format a dependency graph for printing"""
msg = []
for name, deps in id_to_deps.items():
for parent in deps:
msg.append("%s -> %s" % (name, parent))
if len(deps) == 0:
msg.append('%s -> no deps' % name)
return "\n".join(msg) |
def largest(n, xs):
"""Find the n highest elements in a list"""
return sorted(xs)[-n:] |
def _point_line_halfspace(point, v0, v1):
"""
Check which half-space the point is in relative to line [v0,v1].
Params: Point, v0, and v1 are all arrays with x and y values.
Return: A positive or negative value indicates the respective halfspace.
0 means the point is on the line or the line has zero ... |
def listify(x):
"""If x is a list, nothing is done, else create a one element list out
of it.
Parameters
----------
x : type
can be anything.
Returns
-------
list
either x is a list or a list containing x.
"""
return x if isinstance(x, list) else [x] |
def get_columns(filters):
"""return columns based on filters"""
columns = ["Item:Link/Item:100", "Item Name::150", \
"Description::140", "Warehouse:Link/Warehouse:100", "Balance Qty:Float:100"]
return columns |
def msort(liste, indice):
"""
This function sorts a vector regarding values of the indice 'indice'
Indice start from 0
"""
tmp = [[tbl[indice]]+[tbl] for tbl in liste]
tmp.sort()
liste = [cl[1] for cl in tmp]
del tmp
return liste |
def line_with_summary(line, summary_postfix):
"""Check if the processed line contains dead code measurement summary."""
return line.endswith(summary_postfix) |
def nb_clip(x, a, b):
"""
Clip x between a and b
"""
if x < a:
return a
if x > b:
return b
return x |
def cond_sum(a, b, lb=10, ub=19):
"""
Returns the sum of a and b given that it is in [lb, ub]
lb : lower bound (included) of the interval when it returns 20
ub : upper bound (included) of the interval when it returns 20
"""
summ = a + b
if summ >= lb and summ <= ub:
r... |
def find_empty(board):
"""
Finding the empty space in Sudoku.\n
Here empty space is denoted by "0".\n
Arguments:\n
board: The sudoku board
"""
for i in range(0, len(board)):
for j in range(0, len(board[0])):
if board[i][j] == 0:
return (i, j)... |
def notmat(texto,klines=[
'comisi', 'vierne', 'sabado', 'lunes ',
'martes', 'mierco', 'jueves','doming'
]):
"""Return True if line belongs to materia's info, return False otherwise"""
texto=texto.lower()
texto=texto.strip()
if texto[0:6] in klines:
return True
... |
def node_name(node):
"""
mapping of ID of hydrophone node to name
Parameter
---------
node : str
ID or name of the hydrophone node
Returns
-------
str
name of hydrophone node
"""
# broadband hydrophones
if node == "Oregon_Shelf_Base_Seafloor" or node == "LJ0... |
def iso_string_to_sql_utcdatetime_sqlite(x: str) -> str:
"""
Provides SQLite SQL to convert a column to a ``DATETIME`` in UTC. The
argument ``x`` is the SQL expression to be converted (such as a column
name).
Output like:
.. code-block:: none
2015-11-14 18:52:47.000
2015-11-14... |
def up_diagonal_contains_only_xs(board):
"""Check whether the going up diagonal contains only xs"""
i = len(board) - 1
j = 0
while i >= 0 and j < len(board):
if board[i][j] != "X":
return False
i -= 1
j += 1
return True |
def generate_shape(shape_id):
"""
Utility function called by generate_target
"""
shape = None
if shape_id == 1:
shape = [[0, 0], [0, 1], [1, 0], [1, 1]]
elif shape_id == 2:
shape = [[0, 0], [1, 0], [2, 0], [3, 0]]
elif shape_id == 3:
shape = [[0, 0], [0, 1],... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.