content stringlengths 42 6.51k |
|---|
def numDistinct(n):
"""Find the number of disctinct terms in a^b for 2<=a<=n and 2<=b<=n"""
powList = []
for i in range(2, n + 1):
for j in range(2, n + 1):
powList.append(pow(i, j))
powList.sort()
numDistinct = 1
index = 1
while index < len(powList):
if powList[i... |
def get_age_distribution_min(selectpicker_id: str) -> int:
"""
:param selectpicker_id:
:return:
"""
min_values = {
"0": 0,
"1": 19,
"2": 26,
"3": 36,
"4": 46,
"5": 56
}
return min_values.get(selectpicker_id, 0) |
def _get_bnd_key(idx1, idx2, bond_keys):
"""get bond key for two atoms
"""
for bnd in bond_keys:
if idx1 in bnd and idx2 in bnd:
return bnd |
def _pick_mimetype(env):
"""Detect the http indicated mime to send back.
Note that as it gets into the ACCEPT header honoring, it only looks for
application/json and else gives up and assumes html. This is because
browsers are very chaotic about ACCEPT HEADER. It is assumed that
XMLHttpRequest.se... |
def is_leap_year(yr):
""" Is the integer year (0-100000) a leap year
return true on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400
"""
return bool(not yr % 4 and (yr % 100 or n... |
def lazy_get(d, key, func, *args, **kwargs):
"""dict.get(k, f()) will evaluate b() even if s exists. This is a workaround.
"""
try:
return d[key]
except KeyError:
return func(*args, **kwargs) |
def find_closest(lst, n):
"""
:type l: list
:type n: int
:rtype: int
Finds the largest number equal to or less than a provided number in a sorted list
"""
# I don't trust that this array is sorted... also guarantees sorted in ascending order
nums = sorted(lst) # Optional, don't ... |
def mitigation_time(step_list):
"""
Compute mitigation duration for each mitigation change
"""
breaks = []
for i in range(len(step_list)-1):
breaks.append(step_list[i+1]-step_list[i])
return breaks |
def get_skoo_range(gr_val, skoo_sz):
""" Return
"""
k = 0
while gr_val > skoo_sz:
gr_val -= skoo_sz
k += 1
return k |
def determine_image(py_version):
"""
Determines which Docker image to use for CodeBuild based on the Python
version being used on AWS Lambda.
Parameters
----------
py_version : str
Python version being used. Must be one of "2.7", "3.6", or "3.7"
Returns
-------
str
... |
def extract_diff(a, b):
"""
removes all key,value pairs in a, that are also in b
e.g.
extract_diff(
{"value":"a", "text": "A", "more": {"value":"a", "text": "A"}},
{"value": "a", "map": {}, "more": {"value": "a"}})
=> {'text': 'A', 'more': {'text': 'A'}}
@param a:
@param b:
@retu... |
def process_tool_dict(t_d, current_tool=None):
"""takes a dictionary of workflow steps and adds a new entry"""
if current_tool is None:
current_tool = {}
result = current_tool
# each step has at most one installable tool
for step in t_d.keys():
tool = t_d[step]
if "tool_shed_... |
def is_subiteration(a, b):
"""
returns True if that each hash sequence in 'a' is a prefix for
the corresponding sequence indexed by the same node in 'b'.
"""
return all(b[node][: len(hashes)] == hashes for node, hashes in a.items()) |
def create_vulnerability_dictionary(qid, title,
ip, name, category, severity,
solution, diagnosis, consequence):
"""
Creates a vulnerability dictionary.
:param qid: integer Qualys ID of the vulnerability.
:param title: string,... |
def intparse(text):
"""Parse a command line argument as an integer.
Accepts 0x and other prefixes to allow other bases to be used."""
return int(text, 0) |
def _legendre(x_val, num_nodes) -> float:
"""
Calculates legendre function using recurrent formula for homogeneous polynomials
"""
if num_nodes == 0:
return 1
if num_nodes == 1:
return x_val
return (2 * num_nodes - 1) / num_nodes * _legendre(x_val, num_nodes - 1) * x_val - (
... |
def prefix_compression(texts, policy=None):
"""Return common prefix string abiding policy and compressed texts string list."""
if not texts: # Early out return empty prefix and empty sequence
return '', texts
if not isinstance(texts, (list, tuple)):
texts = [texts]
prefix_guard, first, ... |
def box_sizing(keyword):
"""Validation for the ``box-sizing`` property from css3-ui"""
return keyword in ('padding-box', 'border-box', 'content-box') |
def _whctrs(anchor):
"""Return width, height, x center, and y center for an anchor (window)."""
w = anchor[2] - anchor[0] + 1
h = anchor[3] - anchor[1] + 1
ctr_x = anchor[0] + 0.5 * (w - 1)
ctr_y = anchor[1] + 0.5 * (h - 1)
return w, h, ctr_x, ctr_y |
def ipv6_prefix_to_mask(prefix):
"""
ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str
"""
if prefix > 128 or prefix < 0:
r... |
def intersect(list1, list2):
"""
Given two lists, get a new list consisting of the elements only contained
in *both of the input lists*, while preserving the ordering.
"""
return [x for x in list1 if x in list2] |
def get_genome_keys(genome):
"""
Helper function to get data table keys for a genome
Params:
-------
genome: genome requested, string referring to assembly
Returns:
--------
keys: dict of keys """
if genome == "mm10":
keys = {'x':'x_um_abs',
... |
def count(arr, value):
"""
Counts the occurrences of the value in the given iterable.
:param arr: The iterable.
:param value: The value to count.
:return: The number of occurrences.
"""
total = 0
for element in arr:
try:
iter(element)
total += count(eleme... |
def Renormalize(similarity,
metric = "carbo",
customrange = None,
):
"""
Renormalizes a similarity metric to the range [0:1]
:param similarity: Similarity score.
:param mode: (optional) Mode of similarity score
:param customrange: (optional) Custom range of similarity... |
def build_function_call(function_def, user_arguments):
"""
Parameters
----------
function_def: function definition map with following keys
- name: name of the function
- parameters: list with description of all parameters of this function
- name
- optional?
... |
def get_catalog_record_REMS_identifier(cr):
"""Get REMS identifier for a catalog record.
Args:
cr (dict): A catalog record.
Returns:
str: Retruns the REMS identifier for a dataset. If not foyunf then ''.
"""
return cr.get('rems_identifier', '') |
def _sortkey(filename):
"""
Key for sorting filenames based on angular momentum and parity.
Example filename: 'log_Sc44_GCLSTsdpfsdgix5pn_j0n.txt'
(angular momentum = 0).
"""
tmp = filename.split("_")[-1]
tmp = tmp.split(".")[0]
# parity = tmp[-1]
spin = int(tmp[1:-1])
# return... |
def max_palindrome_centered_at(ss,i,j):
"""
The maximal palindrome in string ss,
centered at the index between
i and j. If i and j are the same, then
this becomes the index.
"""
if j==i+1:
l_ix = i; r_ix = j
elif j==i:
l_ix=r_ix=i
else:
raise Exception("Invali... |
def aways_true(number: int):
"""
This function always return True.
Of course the square of a number is always bigger than its doubling.
"""
return number * 2 < number ** 2 |
def pretty_print_seconds(seconds, n_labels=0, separator=" "):
"""
Converts a number of seconds to a readable time string.
Parameters
----------
seconds : float or int
number of seconds to represent, gets rounded with int()
n_labels : int
number of levels of label to show. For ex... |
def imshape(mip):
"""Compute image size for different mip levels"""
return 4000 // 2 **mip, 6000 // 2 **mip |
def two_or_more(string):
"""
A regex wrapper for an arbitrary string.
Allows an arbitrary number of successive valid matches (at least two) to be matched.
"""
return r'(?:{:s}){{2,}}'.format(string) |
def bbox_validzone(bbox, shape):
"""Given an image shape, get the coordinate (in the bbox reference)
of the pixels that are within the image boundaries"""
H, W = shape
wt, ht, wb, hb = bbox
val_ht = -ht if ht < 0 else 0
val_wt = -wt if wt < 0 else 0
val_hb = H - ht if hb > H else hb - ht
... |
def ee_bands(collection):
"""
Earth Engine band names
"""
dic = {
'Sentinel2': ['B4','B3','B2','B8'],
'Landsat7': ['B3','B2','B1','B4']
}
return dic[collection] |
def _compute_density_score(labels, preferred_nr: int) -> float:
"""
Density score according to Talbot.
"""
return 1 - max(len(labels) / preferred_nr, preferred_nr / len(labels)) |
def response_json(status, count, data):
"""Generates JSON for http responses
:param status: True if data is valid and there are no errors, False otherwise
:type valid: boolean
:param code: http response code
:type code: int
:param count: Total number of fields in data
:type count: int
... |
def umple(imagine, punct):
"""
Fills the image with * characters
:param imagine: the image/matrix
:param punct: the position from where to start filling
:return: the filled image
"""
positionx, positiony = punct[0], punct[1]
if imagine[positionx][positiony] == '*':
return
ima... |
def _annotate(db_dict, ref):
"""Function to access reference links, and handle when those links are not in DB table
Takes a dict of databases and a database name"""
if ref in db_dict:
return db_dict[ref]["!IdentifiersOrgPrefix"]
else:
return "https://identifiers.org/" + ref |
def get_cache_key(prefix, date_offset):
"""Gets the cache key to be used"""
if date_offset in ['1',1]:
return prefix + ".Tomorrow"
return prefix + ".Today" |
def parity_integer_to_string(i: int) -> str:
"""
Convert 1 to '+' and -1 to '-'.
Parameters
----------
i : int
Parity in integer representation.
Returns
-------
: str
The string representation of the parity.
"""
if i == 1: return '+'
else: return '-' |
def array_pyxll_function_4(x):
"""returns the types of the elements as strings"""
# x will always be a 2d array - list of lists.
return [[type(e) for e in row] for row in x] |
def populate_errors(errors):
"""
Method for populating errors from WTF forms
@param errors: Flask-WTF form errors object
@return: Final list of errors
"""
error_list = []
for key, values in errors.items():
error_list.append({'field': key, 'errors': values})
return error_list |
def count_interior_point(x, y, a, b, sigma=0.25):
"""
Count the number of interior points.
:param x:
:param y:
:param a:
:param b:
:param sigma:
:return:
"""
number = 0
for i in range(len(x)):
y_estimate = a * x[i] + b
if abs(y_estimate - y[i]) < sigma:
... |
def es_vocal(letra):
"""
La funcion es vocal determina si una letra es vocal
>>> es_vocal('A')
True
>>> es_vocal('e')
True
>>> es_vocal('Z')
False
>>> es_vocal('io')
False
:param letra: string de longitud 1
:return: True si es una vocal False de lo contrario
"""
... |
def rgba2rgb(rgba, max_val=1):
"""Convert color code from ``rgba`` to ``rgb``"""
alpha = rgba[-1]
rgb = rgba[:-1]
type_ = int if max_val == 255 else float
# compute the color as alpha against white
return tuple([type_(alpha * e + (1 - alpha) * max_val) for e in rgb]) |
def snake_case(word: str) -> str:
"""Convert capital case to snake case.
Only alphanumerical characters are allowed. Only inserts camelcase
between a consecutive lower and upper alphabetical character and
lowers first letter.
"""
out = ''
if len(word) == 0:
return out
cur_char: ... |
def crop_lsun_image_coords( height: int,
width: int,
crop_size: int):
"""
Get coordinates for cropping images (y1, y2, x1, x2)
The original images are either (x, 256) or (256, x) where x>= 256
Args:
crop_size : Crop size of image
"... |
def exempt_parameters(src_list, ref_list):
"""Remove element from src_list that is in ref_list"""
res = []
for x in src_list:
flag = True
for y in ref_list:
if x is y:
flag = False
break
if flag:
res.append(x)
return res |
def get_sorted_end_activities_list(end_activities):
"""
Gets sorted end attributes list
Parameters
----------
end_activities
Dictionary of end attributes associated with their count
Returns
----------
listact
Sorted end attributes list
"""
listact = []
for e... |
def key2label(string, gyr=False):
"""latex labels for different strings"""
def_fmt = r'${}$'
convert = {'Av': r'$A_V$',
'dmod': r'$\mu$',
'lage': r'$\log\ \rm{Age\ (yr)}$',
'logZ': r'$\log\ \rm{Z}$',
'fit': r'$\rm{Fit\ Parameter}$',
... |
def convert_bcp47_case(language_code):
"""
en -> en
fr -> fr
fr-ca -> fr-CA
es-mx -> es-MX
zh-cn -> zh-CN
zh-hant -> zh-Hant
zh-hans -> zh-Hans
"""
language_country = language_code.split('-')
if len(language_country) > 1:
if len(language_country[1]) > 2:
l... |
def sum_until_negative(a_list):
"""
@purpose Summing items in a list, stops as soon as a negative number is reached.
If first item is negative, or list is empty, returns 0
@parameter
a_list: A list passed to be summed until negative number reached
@Complexity: Worst Case - O(N): g... |
def get_urls(artist):
"""
Gets the urls.
This function takes an artits name and returns the urls of the first two pages
"""
artist_name = artist.lower().strip().split(' ')
artist_name = '-'.join(artist_name)
all_pages = []
for i in range(1, 3):
page = f"https://www.metrolyrics.... |
def bool_on_off(value):
"""Convert True/False to on/off correspondingly."""
return 'on' if value else 'off' |
def freqToNote(f):
"""Converts frequency to the closest MIDI note number with pitch bend value
for finer control. A4 corresponds to the note number 69 (concert pitch
is set to 440Hz by default). The default pitch bend range is 4 half tones.
"""
from math import log
concertPitch = 440.... |
def isHiddenName(astr):
""" Return True if this string name denotes a hidden par or section """
if astr is not None and len(astr) > 2 and astr.startswith('_') and \
astr.endswith('_'):
return True
else:
return False |
def has_core_metadata(response, file_type):
"""
Return True if a query response contains core metadata, False otherwise.
"""
try:
# try to access the core_metadata
response["data"][file_type][0]["core_metadata_collections"][0]
except:
return False
return True |
def get_shortened_file_name(filename):
"""Creates shortened variant of filename"""
len_limit = 30
msg_length = len(filename)
if msg_length > len_limit:
return '...{}'.format(filename[-len_limit:])
else:
return filename |
def hailstone(n):
"""Calculates the hailstone sequence of `n`."""
if n == 1:
return [1]
else:
return [n] + hailstone(n // 2 if n % 2 == 0 else 3 * n + 1) |
def merge_string_with_overlap(string1, string2):
"""
Merge two Strings that has a common substring.
"""
idx = 0
while not string2.startswith(string1[idx:]):
idx += 1
return string1[:idx] + string2 |
def _get_underlying_classmethod_function(f):
"""Hack for older python versions..."""
class TemporaryClass(object):
func = f
if isinstance(f, staticmethod):
return TemporaryClass.func
return TemporaryClass.func.im_func |
def dict_add(dict_use, key, obj):
"""Simple wrapper to add obj to dictionary if it doesn't exist. Used in fitter.Fitter when defining defaults
Parameters
----------
dict_use: Dictionary
dictionary to be, possibly, updated
key: str
key to update, only updated if the key doesn... |
def windrose(
speed,
direction,
facet,
n_directions=12,
n_speeds=5,
speed_cuts="NA",
col_pal="GnBu",
ggtheme="grey",
legend_title="Wind Speed",
calm_wind=0,
variable_wind=990,
n_col=1,
):
"""
Plot a windrose showing the wind speed and direction for given
facet... |
def add_total_and_padding(src, field ,name):
"""
src - rows to add
field - dict field to use as total
name - name to display in total row
return - list with total row added to the last and a 1 empty row for padding at top and bottom
"""
total = list(filter(lambda... |
def get_formatted_time(seconds):
"""Turn seconds into days, hours, minutes, and seconds.
Not related to UCube.
:param seconds: Amount of seconds to convert.
"""
seconds = round(seconds)
minute, sec = divmod(seconds, 60)
hour, minute = divmod(minute, 60)
day, hour = divmod(hour, 24)
... |
def create_aliases(col_name, prov_aliases):
"""
Expand out the aliases
"""
aliases=[col_name.lower()]
if prov_aliases and prov_aliases != '':
for alias in prov_aliases.split(','):
aliases.append(alias)
aliases.append(alias.lower())
return aliases |
def get_operation_values(program, parameters, modes):
"""Get values from program, based on parameters and modes."""
val1, val2 = [
program[param] if mode == 0 else param
for param, mode in zip(parameters, modes)
]
return val1, val2 |
def list_multiply(LIST_A, LIST_B):
""" Sums two lists of integers and multiplies them together
>>> list_multiply([3,4],[3,4])
49
>>> list_multiply([1,2,3,4],[10,20])
300
"""
TOTAL_A = 0
for i in LIST_A:
TOTAL_A += i
TOTAL_B = 0
counter = 0
while True:
... |
def is_record(path: str) -> bool:
"""
Is filename a record file?
:param (str) path: User-supplied filename.
:return: True if filename is valid record file; otherwise False.
:rtype: bool
"""
return path.find("..") == -1 |
def _pressure_factor(pressure_units_in: str, pressure_units_out: str) -> float:
"""helper method for convert_pressure"""
factor = 1.0
if pressure_units_in in ['psf', 'lb/ft^2']:
pass
elif pressure_units_in in ['psi', 'lb/in^2']:
factor *= 144
elif pressure_units_in == 'Pa':
f... |
def find_css(value, css_class):
"""open_tag if condition"""
if css_class in value.split(" "):
return True
return False |
def generate_sensor_format(field_names, field_data_types, units):
""" Return proper JSON format for sensor based on form submission.
Format structure is a dictionary of dictionaries """
sensor_format = {}
fields = zip(field_names, field_data_types, units)
for field in fields:
sensor_form... |
def lmap(function, *iterables):
"""
>>> lmap(pow, (2, 3, 10), (5, 2, 3))
[32, 9, 1000]
"""
return list(map(function, *iterables)) |
def score_efo(endpoint_doids, efo_doids):
"""Compute a score for a match of two sets of DOIDs.
Score is built with:
- number of DOID that matches in the 2 sets
- number of DOID attributed to the EFO but not the endpoint
Sorting these, the last item is the best. It will have the maximum
number ... |
def tree_to_preterminals(tree):
"""
return a list of the preterminals in the tree.
"""
if len(tree) == 2:
return (tree[0],)
else:
# inefficient but it doesnt matter.
return tree_to_preterminals(tree[1]) + tree_to_preterminals(tree[2]) |
def search(value, list, key):
"""
# Search for an element in a list and return element
"""
return [element for element in list if element[key] == value] |
def sol(n):
"""
Standard DP problem
The width is 4 always, so we need to worry only about the length
which can be reduced either by 1 or by 4 i.e keeping the tile
horizontally or vertically
"""
dp = [0]*(n+1)
if n < 4:
return 1
dp[0] = 1 # If the length is 0, there is no so... |
def weighted_rate(iter, **kwargs):
"""
Computes a weighted rate over the elements of the iterator.
"""
def weight_method_default(x):
return 1
weight_idx = kwargs['weight_idx'] if 'weight_idx' in kwargs else 1
val_idx = kwargs['val_idx'] if 'val_idx' in kwargs else 1
weight_meth... |
def rangecmp(interval_a, interval_b):
"""Compare half-open intervals [a, b) and [c, d)
They compare equal if there is overlap.
"""
(a, b) = interval_a
(c, d) = interval_b
if (a, b) == (c, d):
return 0
if (a, b) > (c, d):
return -rangecmp((c, d), (a, b))
if c < b < d:
... |
def read_dict(dictionary, key, dict_name=None):
"""
Retrieves a value from a dictionary, raising an error message if the
specified key is not valid
:param dict dictionary:
:param any key:
:param str|unicode dict_name: name of dictionary, for error message
:return: value corresponding to key
... |
def index(row):
"""Return index of benchmark from name listed in vm_benchmark_file"""
return int(row[0].split('_')[0].split('/')[1]) |
def convert_seq_notation(sequence, source="pdeep", target="prosit"):
"""Convertes between different notation styles of peptide sequences with modifications. Currently only supports
conversion from pdeep to prosit notation."""
if source == "pdeep" and target == "prosit":
seq, modifications = sequence.split("|"... |
def files_list(start, end):
"""Generate url list with given start and end of indexes"""
resultlist = []
for i in range(start, end):
resultlist.append(f"page_{i}.html")
return resultlist |
def lengthOfLongestSubstring(s: str) -> int:
"""Given a string, find the length of the longest substring without repeating characters
Solution:
We use a window approach here so we can optimize and iterate just once through the list. When we find a repeat
character, we keep the part of the subst... |
def quick_sort(arr):
"""Implementation of the quick sort algorithm
Arguments:
arr {list} -- array to be sorted
Returns:
list -- the sorted list
"""
if len(arr) < 2:
return arr
else:
pivot = arr[0]
less_than_pivot = [num for num in arr[1:] if num < pivot]... |
def problem_6(limit=100):
"""The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural
numbers and... |
def calculate_bitwise_complement(n):
"""
0 ^ 0 = 0
1 ^ 1 = 0
0 ^ 1 = 1
"""
left = n
k_bit_set = 1
while left > 0:
left >>= 1
print(bin(n), bin(k_bit_set))
n ^= k_bit_set
k_bit_set <<= 1
return n |
def last_remaining(n: int, m: int) -> int:
"""
Parameters
-----------
n: n nums from 0~n-1
m: the mth num will be deleted
Returns
---------
out: the remain num.
Notes
------
"""
if n <= 0 or m <= 0:
return -1
lst = list(range(n))
index = 0
wh... |
def dli(x,y,x1,x2,y1,y2,m11,m12,m21,m22):
"""Double Linear Interpolation"""
first_xs = ((x2-x)/(x2-x1))
second_xs = ((x-x1)/(x2-x1))
first_ys = ((y2-y)/(y2-y1))
second_ys = ((y-y1)/(y2-y1))
m11 *= first_xs
m12 *= second_xs
m21 *= first_xs
m22 *= second_xs
return (m11 + m12)*first... |
def put_pixel(color: list, pixels: list, w: int, cord: tuple) -> list:
"""[Put pixel at coordinate]
Args:
color (list): [color of the pixel]
pixels (list): [list of pixels]
w (int): [width of the image]
cord (list): [tuple of x,y]
Returns:
list: [list of pi... |
def file_requires_unicode(x):
"""
Returns `True` if the given writable file-like object requires Unicode
to be written to it.
"""
try:
x.write(b'')
except TypeError:
return True
else:
return False |
def _add_two_lists(list1, list2):
"""
Add together two lists of numbers of the same length.
"""
if len(list1) != len(list2):
raise IndexError()
return [(list1[idx] + list2[idx]) for idx in range(len(list1))] |
def _determinant(matrix):
"""
Calculate the determinant of an N-Dimensional square matrix
:param matrix: Matrix to calculate determinant of
:return: Determinant of matrix
"""
if len(matrix) == 2:
return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]
return sum(_determi... |
def radix_sort(elements):
"""
Use the simple radix sort algorithm to sort the :param elements.
:param bucket_size: the distribution buckets' size
:param elements: a integer sequence in which the function __get_item__ and __len__ were implemented()
:return: the sorted elements in increasing order
... |
def empty_default(xs, default):
""""
If zero length array is passed, returns default.
Otherwise returns the origional array.
"""
xs = list(xs)
if len(xs) == 0:
return list(default)
else:
return xs |
def word_frequency(list_of_words):
"""
<word_frequency> will take a list of word strings and return a dictionary with
the words as keys and the number of occurances of the word in <list_of_words> as
the values.
Example: word_frequency(["to", "be", "or", "not", "to", "be"]) would return
... |
def is_elf(filename):
"""
check if the file is a linux ELF file
"""
with open(filename, "rb") as f:
# i've honestly never seen an ELF file that didn't start with this
if f.read(4) == b"\x7fELF":
return True
return False |
def update_words_nodict(current_words, new_words):
""" Determine words to add and delete for words update.
Parameters:
list(string). Currently existing words
list(string). Words after update
Return:
list(string). Words to keep
list(string). Words t... |
def remove_skips(mat, col_names, row_names, skips):
""" remove rows and columns if their name contains something in list
"""
dead_rows = []
dead_cols = []
# scan rows and columns, remembering indexes to delete
for skip in skips:
if len(skip) > 0:
for i in range(len(row_names)... |
def str_or_none(value):
"""
Convert value to unicode string if its not none.
"""
if value is None:
return None
else:
return str(value) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.