content stringlengths 42 6.51k |
|---|
def is_kw_matched(single_word, kw_list, kw_count=1):
"""
Checks to see if there are any keywords in the single word and returns
a boolean
Args:
single_word: String to be examined for keywords
kw_list: List of strings to look for inside the single word
kw_count: Minimum Number of... |
def v_first_option(options):
"""
Return the first value in a menu-select options structure. This is useful when
you create an options structure and you want the first item as the placeholder or
the default selected value.
Parameters
----------
options : list[dict]
The menu select o... |
def build_bridge_body(bridge_dict, portid):
"""
Removes interface from bridge table
:param bridge_dict: current bridge configuration
:param interface_uri: interface uri that shall be removed
:return: json object (dict)
"""
uri = "/rest/v1/system/ports/{}".format(portid)
if uri not in bri... |
def czyMur(mapObj, x, y):
"""Zwraca True jesli (x,y) pozycja na mapie jest murem,
w.p.p. zwraca False"""
if x < 0 or x >= len(mapObj) or y < 0 or y >= len(mapObj[x]):
return False # (x,y) nie sa na mapie
elif mapObj[x][y] in ('#'):
return True # mur na drodze
return False |
def num_or_none(num: int) -> str:
"""
@brief Return a number string of a number. If the number is 0 then return '-'.
For example:
``` python
>>> num_or_none(1)
'1'
>>> num_or_none(-5)
'-5'
>>> num_or_none(0)
'-'
```
"""
if num == 0:
return "-"
else:
... |
def mounts(prefix, __mounts):
"""
Compute the mountpoints of the current user.
Args:
prefix: Define where the job was running if it ran on a cluster.
mounts: All mounts the user currently uses in his file system.
Return:
mntpoints
"""
i = 0
mntpoints = []
for mou... |
def letter_parser(input_letter, num_teams):
"""Parses the letter input into an int a-0, b-1, c-2..."""
if len(input_letter) != 1 or type(input_letter) != str:
raise ValueError('Try Again! Make sure to enter a one letter alphanumeric character')
value = ord(input_letter) - ord('a')
if value < 0 o... |
def custom_tag_string(tag_string: str) -> list:
"""Tag string parser."""
if not tag_string:
return []
if ',' not in tag_string and ' ' not in tag_string:
return [tag_string]
tags = []
for i, tag in enumerate(tag_string.split(',')):
tags.append(tag.strip().lower().replace(' ',... |
def remove_parity_bits(data):
"""Removes the parity bits from the (response) data"""
return bytes(b & 0x7f for b in data) |
def decode(inp):
"""
convert the data from the sensor to 4 values
:param inp: the bits read from the sensor
:return: 4 values containing the temp and humidity
"""
res = [0] * 5
bits = []
ix = 0
try:
if inp[0] == 1: ix = inp.index(0, ix) # skip to first 0
ix = inp.ind... |
def _affine(nngp, W_std, b_std):
"""Get [co]variances of affine outputs if inputs have [co]variances `nngp`.
The output is assumed to be `xW + b`, where `x` is the input, `W` is a matrix
of i.i.d. Gaussian weights with std `W_std`, `b` is a vector of i.i.d.
Gaussian biases with std `b_std`.
Args:
nn... |
def knot2mph(k):
"""
Converts knots to miles per hour.
"""
if k == None:
return None
return k * 1.15078 |
def apply_function_no_tags(input_string: str, functions: list) -> str:
"""strips the given text and apply the given functions
:param input_string: string to strip
:param functions: a list of functions to apply to input_string
:return: striped text
"""
stripped_text = ''
contents = input_str... |
def col_row_to_pos(col, row, m):
"""
Given col, row and m (number of columns) returns the corresponding
position on the chess board
"""
return row * m + col |
def remove_quotes(string):
""" remove all (double) quotes"""
return string.replace("'", "").replace('"', '') |
def playlist_transform(s,t,compareType="Song"):
"""
Computes the edit distance for two playlists s and t, and prints the minimal edits
required to transform playlist s into playlist t.
Inputs:
s: 1st playlist (format: list of (track name, artist, genre) triples)
t: 2nd playlist (format... |
def gen_from_source(source):
"""Returns a generator from a source tuple.
Source tuples are of the form (callable, args) where callable(*args)
returns either a generator or another source tuple.
This allows indefinite regeneration of data sources."""
while isinstance(source, tuple):
... |
def get_phase_left_with_startpeptide(dct, startpeptide):
""" get the phase on the left with correct start peptide"""
correct_ones = list()
for phase_left in range(0,3):
pep_phased, dna_leftover_left, dna_leftover_right = dct[phase_left]
if startpeptide in pep_phased:
correct_ones... |
def convertKeyValueToString(dict,key) -> str:
""" converts a single key value pair into a concatenated string"""
if dict and key:
# force cast key to string
val = dict[key]
valStr = str(val)
keyStr = str(key)
concantStr = keyStr + valStr
else:
concantStr = ""... |
def print_list(items):
"""Return TeX lines of an itemize element."""
lines = []
lines.append('\\begin{itemize}\n')
for item in items:
lines.append('\\item ' + item + '\n')
lines.append('\\end{itemize}\n')
return lines |
def copy(obj):
"""
This method will return a copy for a python primitive object.
It will not work for class objects unless they implement the
__init__(other) constructor
"""
if hasattr(obj,'copy'):
o = obj.copy()
else:
try:
o = type(obj)(other=obj)
except:
... |
def filter(rec, labels):
"""returns record with only detected objects that appear in label list"""
count = 0
new_rec = {
"file": rec["file"],
}
for label in labels:
if label in rec.keys():
count += 1
new_rec[label] = rec[label]
if count:
return new... |
def bbox_intersection(b1_coords, b1_dimensions, b2_coords, b2_dimensions):
"""
determine the (x, y)-coordinates of the intersection rectangle
b1_coords (int, int):
The origin of the bbox one
b2_coords (int, int):
THe origin of the bbox two
b1_dimensions (int, int):
The ... |
def shorten_url(url):
"""Shortens the passed url using shorte.st's API."""
# QUICK AND DIRTY AND TEMPORARY STUFF:
return url
from chirps.credentials import SHORTE_ST_TOKEN
response = requests.put(
"https://api.shorte.st/v1/data/url",
{"urlToShorten": url}, headers={"public-api-t... |
def insertion_sort(lis):
"""
Insert each element of unsorted list in the right location in sorted list
"""
for i in range(1, len(lis)):
j = i
while lis[j] < lis[j - 1] and j > 0:
lis[j], lis[j - 1] = lis[j - 1], lis[j]
j -= 1
return lis |
def ztf_sky_brightness(bands=''):
"""
Sample from the ZTF sky brightness distribution
"""
dist = {'g': 22.01, 'r': 21.15, 'i': 19.89}
return [dist[b] for b in bands.split(',')] |
def _calculate_num_runs_failures(list_of_results):
"""Caculate number of runs and failures for a particular test.
Args:
list_of_results: (List) of JobResult object.
Returns:
A tuple of total number of runs and failures.
"""
num_runs = len(list_of_results) # By default, there is 1 run per JobResu... |
def basic(s, coeffs):
"""Performs the "standard" de Casteljau algorithm."""
r = 1 - s
degree = len(coeffs) - 1
pk = list(coeffs)
for k in range(degree):
new_pk = []
for j in range(degree - k):
new_pk.append(r * pk[j] + s * pk[j + 1])
# Update the "current" values... |
def rotate_letter(letter, rotation):
"""Rotates [uppercase] characters around the alphabet. Works in both directions.
:param letter: The letter to be rotations.
:param rotation: The number of positions to rotate.
:return: The rotations letter.
"""
# invalid input
if len(letter) != 1:
... |
def get_magnetic_galaxy_dir(galaxy: str, data_directory: str) -> str:
""" Get the full path to a specific galaxy directory
Args:
galaxy (str): Name of the galaxy
data_directory (str): dr2 data directory
Returns:
str: Path to galaxy directory
"""
return data_directory + "/ma... |
def get_flat_matrix_idx(i, j, n):
"""
Convert (i, j) indices of matrix to index of flattened upper-triangular
vector.
"""
return n*i - i*(i + 1) // 2 + j - i - 1 |
def uniq(objectSequence):
"""Remove the duplicates from a list while keeping the original
list order"""
l = []
d = {}
for o in objectSequence:
if o not in d:
d[o] = None
l.append(o)
return l |
def intersection_indices(a, b):
"""
:param list a, b: two lists of variables from different factors.
returns a tuple of
(indices in a of the variables that are in both a and b,
indices of those same variables within the list b)
For example, intersection_indices([1,2,5,4,6],[3,5,1,2... |
def is_number(string):
"""Function to test whether a string is a float number"""
try:
float(string)
return True
except ValueError: return False |
def sprint_cmd_list(cmd_list):
"""Returns column of click-able commands from list."""
try:
ret = ''
for cmd in cmd_list:
ret += '/' + cmd + '\n'
return ret
except Exception as E:
print(E) |
def balanced_error(refrxn, refeq, rrat, m=0.03, p=10.0):
"""
:param refrxn:
:param refeq:
:param rrat:
:param m: minimum permitted weight for a point
:param p: multiples of abs(refeq) above refeq to which zero-line in head is displaced
:return:
"""
one = float(1)
q = one if rrat... |
def ensure_list(parameter):
""" Wraps parameter in a list if it is not one and returns it.
@rtype : list
"""
return parameter if isinstance(parameter, list) else [parameter] |
def strip_suffixes(s, suffixes=()):
"""
Return the `s` string with any of the string in the `suffixes` set
striped. Normalize and strip spacing.
"""
s = s.split()
while s and s[-1].lower() in suffixes:
s = s[:-1]
s = u' '.join(s)
return s |
def ms_to_hours(milliseconds):
"""Convert milliseconds into format (h)h:mm:ss"""
seconds = milliseconds / 1000
minutes = seconds // 60
seconds -= minutes * 60
hours = minutes // 60
minutes -= hours * 60
if minutes < 10:
minutes = '0' + str(int(minutes))
else:
minutes = st... |
def _parse_slice(value):
"""
Parses a `slice()` from string, like `start:stop:step`.
"""
if value:
parts = value.split(':')
if len(parts) == 1:
# slice(stop)
parts = [None, parts[0]]
# else: slice(start, stop[, step])
else:
# slice()
pa... |
def is_blank_line(line, allow_spaces=0):
"""Check if a line is blank.
Return whether a line is blank. allow_spaces specifies whether to
allow whitespaces in a blank line. A true value signifies that a
line containing whitespaces as well as end-of-line characters
should be considered blank.
"... |
def active_users(account, days_back):
""" Returns query for finding active users (since days_back value)."""
query_string = f"""SELECT DISTINCT useridentity.arn
FROM behold
WHERE account = '{account}'
AND useridentity.type = 'IAMUser'
AND useridentity.arn IS NOT NULL
AND ... |
def GoodString(value):
"""
>>> GoodString(2)
'2'
"""
try:
return str(value)
except UnicodeEncodeError:
return value |
def remove_excess_whitespace(maybe_text):
"""Removes excess whitespace from maybe_text if this argument
is a string.
:param maybe_text: An object that might be a string.
"""
if isinstance(maybe_text, str):
maybe_text = ' '.join(maybe_text.split())
maybe_text = maybe_text.strip()
... |
def get_sr(rij, n):
"""
"""
sr = ((1 - (rij)**2) / (n - 2))**0.5
return sr |
def list_of_dicts(lst):
"""
Helper to turn a list into dictionaries
This is because depending on how an object is created, strings can be
represented internally as either string or bitarray.
This behaviour is due to a performance optimisation I don't want to remove
so, I compare with normalise... |
def uint_to_float(x_int, x_min, x_max, bits):
"""
Converts unsigned int to float
"""
span = float(x_max - x_min)
offset = float(x_min)
return (float(x_int)) * span / (float((1 << bits) - 1)) + offset |
def arrangeCoins(n):
"""
:type n: int
:rtype: int
"""
i=1
while i*(i-1)/2<=n:
i+=1
return i-2 |
def _is_overlap(reg_start, reg_end, start_loop_idx, all_idx, regions):
"""
Chech whether [reg_start, reg_end] overlap with `regions`
"""
overlap_idx = []
first_time_ovlp = True
next_start_idx = start_loop_idx
for i in all_idx[start_loop_idx:]:
if reg_start > regions[i][1]: ... |
def squared(n):
"""This prints the square"""
square = n ** 2
print("%s squared is %s" % (n, square))
return n, square |
def reverse_list2(head):
"""Not so fantastic code"""
new_head = None # this is where we build the reversed list (reusing the existing nodes)
while head:
temp = head # temp is a reference to a node we're moving from one list to the other
head = temp.next # the first two assignments pop the... |
def merge_keys(sql_server):
"""
To match with their respective API's, we have a slightly different "merge_keys" value
when a user is using snowflake.
:param sql_server:
:return:
"""
sql_name, _ = sql_server
if sql_name == "snowflake":
return {"list": "list", "sell": "sell"}
... |
def complex_points(z):
"""
Input:
------
z : Complex Number
Output:
-------
~Tuple :
Real and Imaginary part of z, in a tuple, (Re(z), Im(z))
"""
return (z.real, z.imag) |
def get_vpc_name(vpc):
"""Fetches VPC Name (as tag) from VPC."""
for tag in vpc.get('Tags', []):
if tag['Key'].lower() == 'name':
return tag['Value']
return None |
def get_pixel_color(x, y):
""" Given a zero-indexed x,y position, return the corresponding color.
.. note::
See :py:func:`get_rgb_data` for a description of the RGGB pattern.
Returns:
str: one of 'R', 'G1', 'G2', 'B'
"""
x = int(x)
y = int(y)
if x % 2 == 0:
if y % ... |
def retrieval_tp_with_altlabels(gold, predicted_sets):
"""
Compute rtrue positives on the given gold set and predicted set.
Note that it doesn't take into account the order or repeating elements.
:param gold: the set of gold retrieved elements
:param predicted_sets: the set of predicted elements
... |
def insensitive_compare3(s1: str, s2: str) -> bool:
"""
==> Same as `One Away Strings` problem that I solved before
Assume strings are equal if the edit distance is <= 1
Edits: Add, Remove, Update
- Time Complexity: O(longest of len(s1) & len(s2))
- Space Complexity: O(1)
"""
len1 = le... |
def withquerytype(query, is_function=False):
"""
Parse query type from query component
>>> withquerytype('{a: 5, ...}')
('update', '{a: 5}')
>>> withquerytype('{a: 5}')
('map', '{a: 5}')
>>> withquerytype('(.a > 5)')
('filter', '(.a > 5)')
>>> withquerytype('count()', True)
('fu... |
def polygonal(k, n):
""" Polygonal numbers - https://en.wikipedia.org/wiki/Polygonal_number """
return n + (k - 2) * n * (n - 1) // 2 |
def Horner(betas, t):
"""Use Horner's method to evaluate a polynomial.
betas: coefficients in decreasing order of power.
t: where to evaluate
"""
total = 0
for beta in betas:
total = total * t + beta
return total |
def Jy2K(S, theta, lam):
"""
Convert Jansky/beam to Kelvin, taken from
https://science.nrao.edu/facilities/vla/proposing/TBconv
S: Flux in Jy/beam
theta: FWHM of the telescope in radians
lam: Wavelength of the observation in m
Returns: Brightness temperature in K
"""
return 0.32e-... |
def get_lr(optimizers):
"""Get current learning rates from runner."""
return {name: [group['lr'] for group in optimizer.param_groups] for name, optimizer in optimizers.items()} |
def find_all(s,ch):
"""
Find all instances of a character in a string
"""
return [i for i, ltr in enumerate(s) if ltr == ch] |
def extractTails(aligns, reads, outFq, minLength=100):
"""
0x1 -- template has multiple segments in sequencing
0x40 -- first segment in template
0x80 -- last segment in template
Tail names will get _[pe][01].*:\d+
on the end to hold metadata of:
_ -- A delimieter
[01] -- Strand of p... |
def GetBuilderIdString(luci_project, luci_bucket, luci_builder):
"""Returns the builder_id in string representation."""
return '{}/{}/{}'.format(luci_project, luci_bucket, luci_builder) |
def cnprog_pagesize(context):
"""
display the pagesize selection boxes for paginator
"""
if (context["is_paginated"]):
return {
"base_url": context["base_url"],
"pagesize" : context["pagesize"],
"is_paginated": context["is_paginated"]
} |
def check_character(line, character):
"""Checks if a line contains a specific character
Params:
line (unicode)
Returns:
true if line does contain the specific character
"""
if character in line:
return True
else:
return False |
def remove_duplicate_words(s):
"""
Removes all duplicate words from a string, leaving only single (first) words entries.
:param s: a string of spaced words.
:return: string with each word only once.
"""
words = []
for x in s.split():
if x not in words:
words.append(x)
... |
def get_programs_json_list(all_programs):
"""
Make json objects of the user programs and add them to a list.
:param all_programs: Program
:return:
"""
programs = []
for program in all_programs:
programs.append(program.json())
return programs |
def get_columns(filters):
"""return columns based on filters"""
columns = [
{
"fieldname":"item",
"fieldtype":"Data",
"label":"Month",
"width":200
},
{
"fieldname":"in_qty",
"fieldtype":"Float",
"label":"In Qty",
... |
def log2chr(val):
"""
For the log-base 2 of val, return the numeral or letter
corresponding to val (which is < 36). Hence, 1 return '0',
2 return '1', 2*15 returns 'f', 2*16 returns 'g', etc.
"""
p = 0
while val >= 2:
p += 1
val /= 2
if p < 10:
return chr(ord('0'... |
def update_csv_link(start_date, end_date, lat_min, lat_max, lon_min, lon_max, ground_stations=None):
"""Updates the link to the CSV download
Returns
-------
link : str
Link that redirects to the Flask route to download the CSV based on selected filters
"""
link = '/dash/downloadCSV?sta... |
def _parse_description(metadata_field):
"""
Parse the description field from the metadata if available.
Limit to the first 2000 characters.
"""
try:
if 'description' in metadata_field:
return metadata_field['description'][:2000]
except TypeError:
return None |
def get_imindices_str(fovbounds):
"""
This returns a string representing the FOV indices
Args:
-----
fovbounds - list of [rowmin, rowmax, colmin, colmax]
Returns:
--------
string representation of indices
"""
return "_rowmin{}".format(fovbounds[0]) + \
"_rowmax... |
def _ftext_size(area, max_weight, plot_metric = None):
"""
custom text size accroding to weight matrix element value
"""
plot_metric = plot_metric if plot_metric is not None else "precision"
min_thresh = max_weight/6
_text_size = {area > 0 and area < min_thresh: 8,
... |
def detect_replaced_functions(function_calls):
"""
:param function_calls: list of tuples ((address old (int), number of xrefs before(int)), (address_new(int), number_of_xrefs (int)))
:return: list of tuples (function_call, function_call)
"""
added = {}
removed = {}
for function_call_before,... |
def decode_path_segment(s):
"""Django decodes URL elements before passing them to views, but passes "%2f" ("/")
through undecoded.
Why..?
"""
return s.replace("%2f", "/").replace("%2F", "/") |
def gen_waveform_name(ch, cw):
"""
Return a standard waveform name based on channel and codeword number.
Note the use of 1-based indexing of the channels. To clarify, the
'ch' argument to this function is 0-based, but the naming of the actual
waveforms as well as the signal outputs of the instrumen... |
def _convert_price(raw_price):
"""Convert the prices, adjusting for two decimals while loading the raw file.
Parameters:
raw_price (str): The price to be converted, the last two characters are the decimals.
Returns:
(float64): Converted price.
"""
return float(raw_price) / 100.0 |
def to_ewkt(polygon, srid) -> str:
"""Creates a WKT representation of a Simple Feature polygon.
:returns: The WKT string of ``polygon``
"""
ring = [" ".join(map(str, i)) for i in polygon[0]]
ewkt = f'SRID={srid};POLYGON(({",".join(ring)}))'
return ewkt |
def area(r):
"""een conflicterende docstring MIJN CODE IS BELANGRIJKER"""
return 3.14*r**2 |
def _check_ogrn(ogrn):
"""Validates OGRN code"""
if not ogrn:
return False
if len(ogrn) == 13:
delimeter = 11
elif len(ogrn) == 15:
delimeter = 13
else:
return False
main_part = int(ogrn[:-1]) % delimeter % 10
checksum = int(ogrn[-1])
return main_part == ... |
def replaceCharAwithCharB(string:str, charA:str, charB:str, n:int = 0):
"""
Given a `string` replace all the `charA` present with the
`charB`
"""
if len(string) == 0 or len(string) == n:
return string
if string[n] == charA:
string = string[:n] + charB + string[n+1:]
return r... |
def processHrefSubstitutions(hrefs, prefix):
"""
Process the list of hrefs by prepending the supplied prefix. If the href is a
list of hrefs, then prefix each item in the list and expand into the results. The
empty string is represented by a single "-" in an href list.
@param hrefs: list of URIs to... |
def subsample_for_vis(eval_task_ids, tasks_per_template):
"""Keep only 1 task per template."""
templates_sel = {}
res = []
eval_task_ids = sorted(eval_task_ids) # For repro
for task_id in eval_task_ids:
this_temp = task_id.split(':')[0]
if this_temp not in templates_sel:
... |
def get_comma_separated_condition_keys(condition_keys):
"""
:param condition_keys: String containing multiple condition keys, separated by double spaces
:return: result: String containing multiple condition keys, comma-separated
"""
result = condition_keys.replace(' ', ',') # replace the double sp... |
def split_sortby(sort_by):
""""Split the value of sortBy.
sortBy can have a trailing 'ASC' oder 'DESC'.
This function returns the fieldname and 'ASC' or 'DESC' as tuple.
"""
asc_desc = 'ASC'
if sort_by.lower().endswith('asc'):
sort_by_value = sort_by[:-3]
elif sort_by.lower().e... |
def sum_recursive(seq):
"""
The sum of a sequence has a simple, recursive definition. We've defined the sum of a sequence
in two cases:
- the base case states that the sum of a zero length sequence is 0
- the recursive case states that the sum of a sequence is the first value plus the sum of the
... |
def update_pos(pos1,pos2):
"""
Get the coordinate of the bounding box containing two parts
:param pos1: Coordinate of the first part.
:param pos2: Coordinate of the second part.
:return: Coordinate of the bounding box containing the two parts
"""
x1 = min(pos1[0],pos2[0])
y1 = min(pos1[1... |
def splitext(p):
""" Split file extension """
sep='\\'
altsep = '/'
extsep = '.'
sepIndex = p.rfind(sep)
if altsep:
altsepIndex = p.rfind(altsep)
sepIndex = max(sepIndex, altsepIndex)
dotIndex = p.rfind(extsep)
if dotIndex > sepIndex:
filenameIndex = sepIndex + 1
while filenameIndex < dotIndex:
if p... |
def arfcn_to_freq(band_indicator, arfcn):
"""
Input: arfcn = absolute radio-frequency channel number (ARFCN)
band_indicator = band designation
(for more info: https://en.wikipedia.org/wiki/Absolute_radio-frequency_channel_number)
Output: frequency calucalated
returns -1 f... |
def has_no_trailing_zeroes(string):
"""
True if string has no trailing zeroes, False otherwise.
PARAMETERS:
string : str
RETURNS: bool
"""
return len(str(int(string))) == len(string) |
def b2f(b):
"""bool to float"""
return 1.0 if b == "True" else 0.0 |
def _is_list_like(obj):
"""
Return True if object acts like a list
"""
try: obj + []
except TypeError: return False
return True |
def delta_te(in_values, te1=None, te2=None):
"""
Read :math:`\Delta_\text{TE}` from BIDS metadata dict
"""
if isinstance(in_values, float):
te2 = in_values
te1 = 0.0
if isinstance(in_values, dict):
te1 = in_values.get('EchoTime1')
te2 = in_values.get('EchoTime2')
... |
def context_combination(
log_level,
worker_port,
include_schema_registry,
include_rocksdb,
ci_provider,
):
"""Fixture that parametrize the function where it's used."""
return {
"log_level": log_level,
"worker_port": worker_port,
"include_schema_registry": include_sche... |
def cal_accuracy(sample_label_prob_dict_list, test_label_list):
"""
:param
sample_label_prob_dict_list:
[
{1: 0.2, 2:0.15, 3:0.2, ..., 9:0.1}
{1: 0.2, 2:0.15, 3:0.2, ..., 9:0.1}
...
]
test_label_list:
[1,2,5,6,8,... |
def helper_set_same_eff_all_tech(technologies, eff_achieved_factor=1):
"""Helper function to assing same achieved efficiency
Parameters
----------
technologies : dict
Technologies
eff_achieved_factor : float,default=1
Factor showing the fraction of how much an efficiency is achieved... |
def normalize_column_to_length(col, desired_count):
"""Given the value(s) for a column, normalize to a desired length.
If `col` is a scalar, it's duplicated in a list the desired number of
times. If `col` is a list, it must have 0, 1, or the desired number of
elements, in which cases `None` or the sin... |
def is_int(msg):
"""Default method used to check whether text pulled from console consumer is a message.
return int or None
"""
try:
return int(msg)
except:
return None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.