content stringlengths 42 6.51k |
|---|
def lr_accuracy(it_before, ot_before_ground, num_nodes, num_train):
"""
Parameters
----------
it_before: list
ot_before_ground: list
num_nodes: int
num_train: int
Returns
---------
accuracy: float
"""
error = 0
for each_sample in range(num_train):
for each_no... |
def get_index_positions(list_of_elements, element):
"""
Returns the indexes of all occurrences of the given 'element' in
the list of columns 'list_of_elements'.
:param list_of_elements: the list of the columns of the data frame
:param element: the name of the column to find
:return: list of inde... |
def two_uint32_to_uint64(a: int, b: int) -> int:
"""Convert two uint32 to uint64"""
a_bin = f"{a:032b}"
b_bin = f"{b:032b}"
if len(a_bin) != 32 or len(b_bin) != 32 or a < 0 or b < 0:
raise ValueError(
f"Either `a` or `b` are not positive or cannot be represented as a uint32: {a}, {b}... |
def checkdigit(code:str) -> str:
"""
Fungsi yang menghitung checkdigit dari 12 digit EAN-13 code dan mengembalikan checkdigitnya dalam bentuk string.
"""
# Konstanta untuk "weight" setiap digit (misal, digit ke-3 (index 2) weightnya 1)
POSITION_WEIGHT = (1,3,1,3,1,3,1,3,1,3,1,3)
# Nilai awal wei... |
def get_log_name(log_group):
"""
This will parse the log group to get the filename of the log. Benastalk creates log groups with the the filepath of
the log, example: '/aws/elasticbeanstalk/env-name/var/log/eb-activity.log'.
:param log_group: full or partial log group
:return: the l... |
def get_button_code(label, url, is_default=False):
"""create a html button"""
css_class = u' default' if is_default else ''
html = " "
html += """<button class="btn btn-primary cust-btn{2}" onclick="window.location=\'{1}\'">{0}</button>""".format(
label, url, css_class
)
#jav... |
def format_formula(formula):
"""Converts str of chemical formula into latex format for labelling purposes
Parameters
----------
formula: str
Chemical formula
"""
formatted_formula = ""
number_format = ""
for i, s in enumerate(formula):
if s.isdigit():
if ... |
def aadharNumVerify(aadhar) :
"""
Reference : https://stackoverflow.com/questions/27686384/validating-the-aadhar-card-number-in-a-application
"""
verhoeff_table_d = (
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
(1, 2, 3, 4, 0, 6, 7, 8, 9, 5),
(2, 3, 4, 0, 1, 7, 8, 9, 5, 6),
(... |
def constructpageurl(pagename):
"""Given a natural-text page name, e.g 'Flag of Thailand', returns a url pointing to a wikipedia
page (if one exists) for that page name
:param pagename: The name of a wikipedia page
:type pagename: String
:return: The url of a wikipedia page with the name p... |
def modinv(a, n):
"""Compute the modular inverse of a modulo n
See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers.
"""
t1, t2 = 0, 1
r1, r2 = n, a
while r2 != 0:
q = r1 // r2
t1, t2 = t2, t1 - q * t2
r1, r2 = r2, r1 - q * r2
if r1 > 1:
... |
def iob2(tags):
""" Check if tags have valid IOB format.
If tags are in IOB1 format, they are converted to IOB2.
Args:
tags (list): list of tags
Returns:
bool: true if valid IOB format, false otherwise
Check that tags have a valid IOB format.
Tags in IOB1 format are converted ... |
def createDictionary(keyList, valueList):
"""
Creates and returns a dictionary from the keyList and valueList supplied
keyUriList List of key uris
valueList List of values
"""
dict = {}
for index in range(len(keyList)):
dict[keyList[index]] = valueList[index]
# Logger.... |
def remove_duplicates(from_list):
"""
The function list() will convert an item to a list.
The function set() will convert an item to a set.
A set is similar to a list, but all values must be unique.
Converting a list to a set removes all duplicate values.
We then convert i... |
def compute_number(attributes):
""" Compute the number of a mention.
Args:
attributes (dict(str, object)): Attributes of the mention, must contain
values for "type", "head_index" and "pos".
Returns:
str: the number of the mention -- one of UNKNOWN, SINGULAR and PLURAL.
"""
... |
def pick_username(names):
"""
>>> pick_username(["JonaThan TanoTo", "WeiYue Li"])
'JonaThan TanoTo'
>>> pick_username(["JonaThan TanoTo", "WeiYue Li", "ShuBham KauShal"])
'ShuBham KauShal'
>>> pick_username(["JonaThan TanoTo", "WeiYue Li", \
"ShuBham KauShal", "MARINA"])
'MARINA'
... |
def subtract_matricies(m, n):
"""
1 2 1 0 0 2
3 4 - 1 2 = 2 2
5 6 4 2 1 4
"""
row_count = len(m)
return [[m[row][col] - n[row][col] for col in range(row_count)] for row in range(row_count)] |
def _normalize_framerate(rate, min_rate=16, max_rate=32):
"""Limits the frame rate between min_rate and max_rate by integer multiples.
"""
if rate < min_rate:
factor = min_rate // rate
if min_rate % rate > 0:
factor += 1
return rate * factor
if rate > max_rate:
... |
def utf8_cut(bytestr, maxlen):
"""Cuts an utf8 bytestring in two parts where the left is at most maxlen
long, and both are valid utf8 strings.
"""
left = bytestr[:maxlen].decode('utf-8', 'ignore').encode('utf-8')
return left, bytestr[len(left):] |
def cigar_has_no_indels(pairs):
"""
Are there non-match/mismatch symbols in cigar?
:param pairs:
:return: bool
"""
total = 0
for c,i in pairs:
if c in ["I", "D", "N", "S", "H", "P"]:
return False
return True |
def ecaf(R, Ni):
""" R: classical ECA rule number
Ni: 3-site neighborhood of site i
returns: the next state of site i
"""
k = sum(j << i for i, j in enumerate(Ni[::-1]))
if R & (1 << k):
return 1
else:
return 0 |
def mkdir(directory):
"""Checks if given directory path exists, if not creates it.
Parameters
----------
directory : string
folderpath location. (Does not have to exist)
Returns
-------
None
"""
import os
if not os.path.exists(directory):
os.makedirs(dire... |
def check_whether_date_in_range(search_date, start_date, end_date):
"""Check whether the search date is in a valid time range."""
if search_date > end_date:
return False
if search_date < start_date:
return False
return True |
def get_trace_from_object(_object):
"""Get trace from response payload"""
if not _object:
return None
trace = _object.trace
return [trace] if trace else None |
def makename2refdct(commdct):
"""make the name2refs dict in the idd_index"""
refdct = {}
for comm in commdct: # commdct is a list of dict
try:
idfobj = comm[0]['idfobj'].upper()
field1 = comm[1]
if 'Name' in field1['field']:
references = field1['re... |
def schedule_1_amount(responses, derived):
""" Return the amount as defined in schedule 1 for child support """
try:
if derived['show_fact_sheet_b'] or derived['show_fact_sheet_c']:
return derived['guideline_amounts_difference_total']
else:
return float(responses.get('pa... |
def get_iou(box1, box2):
"""Computes the value of intersection over union (IoU) of two boxes.
Args:
box1 (array): first box
box2 (array): second box
Returns:
float: IoU value
"""
b1_x1, b1_y1, b1_x2, b1_y2 = tuple(box1)
b2_x1, b2_y1, b2_x2, b2_y2 = tuple(box2)
xA = ... |
def get_tokens(sequences, lower=False, upper=False):
"""Returns a sorted list of all unique characters of a list of sequences.
Args:
sequences: An iterable of string sequences.
lower: Whether to lower-case sequences before computing tokens.
upper: Whether to upper-case sequences before computing tokens... |
def parse_user_data(user_data):
"""
input: string, user data from front end.
output: a list of dict
"""
if not user_data:
return []
user_data_list = user_data.split(';')
ret = list()
for i in range(len(user_data_list)):
data = user_data_list[i].strip().rstrip('\n').rstrip... |
def get_items(_item):
"""
"""
_str = []
_int = []
if type(_item) is str:
_str.append(_item)
elif type(_item) is int:
_int.append(_item)
else:
print(' ** warining item {:} not recognized'
.format(_item))
return _str, _int |
def line_box(points_horizon_all, points_vertical_all, points_horizon, points_vertical):
"""
determine the grids
:param points_horizon_all:list, horizon lines completed
:param points_vertical_all:list, vertical lines completed
:param points_horizon:list, horizon lines not completed
:param p... |
def _safe_report_name(name):
"""Reports with '+' in target name won't show correctly in ResultStore"""
return name.replace('+', 'p') |
def div(divided, divisor):
""" Perform safe division. """
return divided / divisor if divisor != 0 else 0.0 |
def CountFrequency(my_list):
"""
"""
#| - CountFrequency
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
return(freq)
#__| |
def restore_tag_name(tag_name: str) -> str:
"""Reverts the function :py:func:`xml_tag_name`::
>>> restore_tag_name('ANONYMOUS_Series__')
':Series'
"""
if tag_name[-2:] == "__" and tag_name[:10] == "ANONYMOUS_":
return ':' + tag_name[10:-2]
return tag_name |
def _get_prediction_length(predictions_dict):
"""Returns the length of the prediction based on the index
of the first SEQUENCE_END token.
"""
tokens_iter = enumerate(predictions_dict["predicted_tokens"])
return next(((i + 1) for i, _ in tokens_iter if _ == "SEQUENCE_END"),
len(prediction... |
def get_pull_test_images_steps(test_image_suffix):
"""Returns steps to pull testing versions of base-images and tag them so that
they are used in builds."""
images = [
'gcr.io/oss-fuzz-base/base-builder',
'gcr.io/oss-fuzz-base/base-builder-swift',
'gcr.io/oss-fuzz-base/base-builder-jvm',
'... |
def _none_2_empty(text) -> str:
"""Translate None to empty string."""
if text is None:
return ""
return text |
def sanitize_script_content(content: str) -> str:
"""Sanitize the content of a ``<script>`` tag."""
# note escaping addresses https://github.com/jupyter/jupyter-sphinx/issues/184
return content.replace("</script>", r"<\/script>") |
def escape_curly_brackets(url_path):
"""Double brackets in regex of url_path for escape string formatting."""
if ("{" and "}") in url_path:
url_path = url_path.replace("{", "{{").replace("}", "}}")
return url_path |
def add_date_end(record: dict):
"""
Function to make ``date_end`` ``date_start`` if ``measure_stage`` is "Lift"
Parameters
----------
record : dict
Input record.
Returns
-------
type
Record with date_end changed conditionally, or original record.
"""
if record... |
def gor_func(x, a1, a2, exp):
"""this function calculates the gor for a given x """
return a1 * x**exp + a2 |
def dict_to_iso_date(date_dict):
"""
Convert pywikiboty-style date dictionary
to ISO string ("2002-10-23").
@param date_dict: dictionary like
{"year" : 2002, "month" : 10, "day" : 23}
"""
iso_date = ""
if "year" in date_dict:
iso_date += str(date_dict["year"])
if "month" in ... |
def mapping_for_switch(mapping):
"""Return dict from values
:param: mapping - dict with tuple as keys
"""
return {key[0]: value for key, value in mapping.items()} |
def partial_product(start, stop):
"""Product of integers in range(start, stop, 2), computed recursively.
start and stop should both be odd, with start <= stop.
"""
numfactors = stop - start >> 1
if not numfactors:
return 1
elif numfactors == 1:
return start
else:
mid... |
def is_array_type (name):
###############################################################################
"""
>>> is_array_type('array(T)')
True
>>> is_array_type('array')
False
>>> is_array_type('array(T)')
True
"""
return name[0:6]=="array(" and name[-1]==")" |
def merge_connected(lists):
""" Merge sets with common elements (find connected graphs problem).
Examples:
Input: [{0, 1}, {0, 1}, {2, 3}, {2, 3}, {4, 5}, {4, 5}, {6, 7}, {6, 7}, {8, 9}, {8, 9}, {10}, {11}]
Output: [{0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10}, {11}]
"""
sets = [s... |
def partition(lst, start, end):
"""
Partitions the list from index 'start' to index 'end' by choosing the last
element as a pivot.
Partitions all smaller elements to the left and all greater or equal
elements to the right of the pivot. Based on Hoares partition scheme.
:return: The pivot index... |
def _infer_n_classes(n_classes, queue):
"""
Helper function for inferring the n_classes parameter from a list of
SleepStudy pairs
"""
if n_classes is not None:
return int(n_classes)
else:
with queue.get_random_study() as ss:
return ss.n_classes |
def identity(n):
"""
:param n: dimension for nxn matrix
:type n: int
:return: Identity matrix of shape [n, n]
"""
n = int(n)
return [[int(row == column) for column in range(n)] for row in range(n)] |
def format_dict(d):
""" Format nested dictionaries to a readable string. """
s = ['']
def helper(d, s, depth=0):
for k,v in sorted(d.items(), key=lambda x: x[0]):
if isinstance(v, dict):
s[0] += (" ")*depth + ("%s: {" % k) + ',\n'
helper(v, s, depth+1)
... |
def enter_manually_interview_assisted(user, **kwargs):
"""helper to determine if we're in `enter manually - interview assisted`
Looks for 'entry_method' in kwargs - returns true if it has value
'interview assisted', false otherwise.
"""
return kwargs.get('entry_method') == 'interview assisted' |
def is_pair(part):
"""
>>> is_pair([4])
False
>>> is_pair([4, 4])
True
>>> is_pair([6, 9])
False
"""
if len(part) != 2:
return False
return part[0] == part[1] |
def calc_V_capped(V_dsc, v_cap):
"""Clip all values of `V_dsc` above `v_cap`."""
return V_dsc.mask(V_dsc > v_cap, other=v_cap) if v_cap and v_cap > 0 else V_dsc |
def reflect_action(action_):
"""
reflecting action
swap left and right key
reflecting pitch ['camera'][1]
:param action_: MineRL action dict
:return:
"""
action_['left'], action_['right'] = action_['right'], action_['left']
action_['camera'][1] *= -1.0
return action_ |
def query_table3(song):
"""
This function returns the SQL neccessary to get all users who listened to the song name passed as an argument to this function.
"""
return "select user_name from WHERE_SONG where song_name = '{}';".format(song) |
def check_morphology(l):
"""Proposes reductions of words to their stem if the stem or another
morphological variant is also present in l"""
tags = set(l)
pairs = []
for w in l:
if w.endswith('s'):
stem = w[:-1]
variants = set([stem + suffix for suffix in ['','ed'... |
def mc_estimates(run_sum, run_sum_squares, n):
"""Returns sample mean and variance from sum and sum of squares
:param run_sum: float
The sum of the samples
:param run_sum_squares: float
The sum of the squares of the samples
:param n: int
The number of samples
:return: 2-t... |
def relpath(path):
"""Convert the given path to a relative path.
This is the inverse of abspath(), stripping a leading '/' from the
path if it is present.
:param path: Path to adjust
>>> relpath('/a/b')
'a/b'
"""
return path.lstrip('/') |
def build_meta_header(host, meta_header):
"""
Progressively build the meta header host by host
:param host: current host to add to meta header
:type host: dict
:param meta_header: meta header to build
:type meta_header: dict
:return:
"""
# If found host doesn't exists in dict, we cr... |
def normalized_name(player):
"""Normalizes the player name."""
player_name = str(player)
# for char1, char2 in [('/', '-'), ('\\', ''), ('$', '')]:
# player_name = player_name.replace(char1, char2)
return player_name |
def get_checksum(num, length):
"""Return checksum."""
sum_digits = sum([
int(digit) * (length + 1 - i)
for i, digit in enumerate(str(num).zfill(length))])
checksum = (11 - (sum_digits % 11)) % 11
return checksum if checksum != 10 else None |
def construct_path_from_root(node, root):
"""the non-recursive way!"""
path_from_root = [node['label']]
while node['parent']:
node = node['parent']
path_from_root = [node['label']] + path_from_root
return path_from_root |
def fix_species(species, spec_agnostic=False):
""" Expects a list of strings containing the species.
Return a list of lists of single chars"""
fixed = []
for sys in species:
fixed.append([])
for spec in sys:
if spec_agnostic:
if spec.upper() == spec:
... |
def qmag(q):
"""
Returns the euclidean length or magnitude of quaternion q
"""
return (pow(sum(e*e for e in q), 0.5)) |
def f(a:int,b:int)->int:
""" Retourne la soustraction de a et b"""
#x:int
#x:int
return a-b |
def get_extension(t_path):
""" Get extension of the file
:param t_path: path or name of the file
:return: string with extension of the file or empty string if we failed
to get it
"""
path_parts = str.split(t_path, '.')
extension = path_parts[-1:][0]
extension = extension.lower()
re... |
def player(board):
"""
Returns player who has the next turn on a board.
"""
# raise NotImplementedError
X_count = 0
O_count = 0
for i in board :
for j in i :
if j == 'X':
X_count += 1
elif j == 'O':
O_count += 1
if X_count ... |
def get_pos_counts(tagged_text):
""" Calculate the total number of types for each part of speech taggers. """
pos_counts = {}
for item in tagged_text:
if item[1] in pos_counts.keys():
pos_counts[item[1]] += 1
else:
pos_counts.update({item[1]: 1})
return pos_counts |
def selection_sort(array):
"""My selection sort implementation"""
for idx in range(len(array) - 1):
lowest_idx = idx
for search_idx in range(idx + 1, len(array)):
if array[search_idx] < array[lowest_idx]:
lowest_idx = search_idx
array[lowest_idx], array[idx] =... |
def rename_params(prefix, params):
""" Rename the name of the keys of a dictionnary by adding a
prefix to the existing name
Parameters:
prefix -- prefix
file -- dictionnary
"""
return {f'{prefix}-' + str(key): val for key, val in params.items()} |
def get_job_metrics_entry(name, value):
"""
Get a formatted job metrics entry.
Return a a job metrics substring with the format 'name=value ' (return empty entry if value is not set).
:param name: job metrics parameter name (string).
:param value: job metrics parameter value (string).
:return: ... |
def compute_returns(next_value, rewards, masks, gamma=0.99):
""" Function that computes the return z_i following the equation (6) of the paper"""
R = next_value
returns = []
for step in reversed(range(len(rewards))):
R = rewards[step] + gamma * R * masks[step]
returns.insert(0, R)
re... |
def recommend_random(query, ratings, k=10):
"""
Recommends a list of k random movie ids
"""
return [1, 20, 34, 25] |
def get_value_steps(x, f):
"""
Given a stepwise function f represented as a list
of the leftmost points in the intervals, returns
f(x). The rightmost intervals extends infinitely to the right
and the leftmost to the left
Returns:
the pair (x, f(x)) if x is in the domain of f (to the... |
def simple_function():
"""
This is a simple function which does nothing
:rtype : int
"""
print('Hi, I am a simple function')
return 1 |
def move_lists(items, from_lists, to_lists) :
"""Function to move an item from one list to another."""
if type(from_lists) == list():
for i,val in enumerate(items):
from_lists[i].remove(val)
to_lists[i].append(val)
else:
for val in items:
... |
def _is_arraylike(input_array):
"""Check whether the input is array-like."""
return (hasattr(input_array, '__len__') or
hasattr(input_array, 'shape') or
hasattr(input_array, '__array__')) |
def s3_uri_str(s3_protocol, s3_bucket_name, s3_key) -> str:
"""A valid S3 URI comprised of 's3://{bucket}/{key}'
This s3_uri_str may not exist yet; for an object that exists, use
the `s3_uri_object` fixture instead.
:return: str
"""
return f"{s3_protocol}{s3_bucket_name}/{s3_key}" |
def header_row(add_rv=False) -> str:
"""Header row for output file."""
if add_rv:
header = (
"temp,logg,feh,alpha,band,resolution,vsini,sampling,"
"rv,correctflag,quality,cond1,cond2,cond3\n"
)
else:
header = (
"temp,logg,feh,alpha,band,resolution,... |
def swap_keys(keys):
"""Modifies the given list of strings, changing last character from
'1' to '2' and vice versa (if applicable).
E.g. 'sku1' is changed to 'sku2' and vice versa."""
def swap_key(key):
c = key[-1:]
if c == '1': key = "{}{}".format(key[:-1], '2')
elif c == '2': k... |
def union_dicts(*dicts):
"""Use update() to combine all dicts into one.
This builds a new dictionary, into which we ``update()`` each element
of ``dicts`` in order. Items from later dictionaries will override
items from earlier dictionaries.
Args:
dicts (list): list of dictionaries
R... |
def adjacent_chars(a, b, offsets, th):
"""
DESCRIPTION: Define if two sentences are adjacent measured in characters
INPUT: a <int> - Sentence a index,
b <int> - Sentence b index
offsets <list of tuples (int, int)> - Contain the char offset and length of each sentence
th <in... |
def float_to_char(f: float, f_min: float = -100., f_max: float = 50.) -> int:
"""Translates float number ``f`` from ``f_min`` to ``f_max`` to char from -128 to 127.
Parameters
----------
``f`` : float
value to translate
``f_min`` : float, optional
(default is -100)
``f_max``... |
def glTypesNice(types):
"""Make types into English words"""
return types.replace('_',' ').title() |
def split_address(address):
"""Splits a url into a protocol, host name and port"""
if '://' in address:
protocol, address = address.split('://')
else:
protocol = 'http'
if ':' in address:
address, port = address.split(':')
else:
port = 443 if protocol == 'https' else... |
def are_all_this_type(type, *objects):
"""Return True if all objects are instances of this type.
Args:
type: Type to check against, e.g str, dict
objects: *args of objects. Each of these will be checked against type.
Returns:
True is all objects are instances of specified Type.
... |
def find_sublist(haystack, needle):
"""Return the index at which the sequence needle appears in the
sequence haystack, or -1 if it is not found, using the Boyer-
Moore-Horspool algorithm. The elements of needle and haystack must
be hashable.
https://codereview.stackexchange.com/questions/19627/findi... |
def sqnorm(v):
"""
Compute the squared euclidean norm of the vector v.
Input:
v A vector of polynomials
Output:
res The squared euclidean norm of v
Format: Coefficient
"""
res = 0
for elt in v:
for coef in elt:
res += coef ** 2
ret... |
def if_key_exists(key, dictionary):
"""
Returns if key exists, if not return 0, used for stats
"""
if key in dictionary:
return dictionary[key]
return 0 |
def rain_sum(p, prev):
""" Compute amount (sum) of consecutive rainfall
Parameters
----------
p : array
rainfall amount in open over previous 24 hours [mm].
prev : array
Previous sum of consecutive rain.
prev_start = 0.0
Returns
-------
array
sum of consecutive rainfall [mm]
"""
if... |
def normalize_package_name_for_code(package: str) -> str:
"""Normalize given string into a valid python package for code usage.
Parameters
------------------------
package: str,
The name of the package.
Raises
------------------------
ValueError,
When the name of the packag... |
def __sync_ranges(frame_durations, frame_rates, frame_ranges, frame_offsets):
"""
Synchronize frame_ranges, i.e. make sure that frame_ranges match after the offset is applied
"""
post_offset_bounds = (0,min(frame_durations))
for ix_range in range(0,len(frame_ranges)):
frame_range = frame_ran... |
def splitKernel(kernel, value):
"""recalculate the kernel according to the given foreground value"""
kernel_shape = (len(kernel), len(kernel[0]))
result = kernel
r = 0
while r < kernel_shape[0]:
c = 0
while c < kernel_shape[1]:
if kernel[r][c] == value:
re... |
def parse_aura_dimensions(dimensions):
"""
Takes an input like {10x10x100} and returns a tuple of 10,10,100
:param dimensions: A string type of the dimensions of an aura file
:return: A tuple with aura dimensions.
"""
l, w, n = dimensions[dimensions.find("{") + 1: dimensions.rfind("}")].split(... |
def list_between(begin, end, r):
"""Returns the list of players from begin to end (inclusive)."""
if begin <= end:
return list(range(begin, end+1))
return list(range(begin, r.nPlayers)) + list(range(end+1)) |
def isNumber(input):
"""Check whether input is a valid (float) number."""
try:
float(input)
return True
except ValueError:
return False |
def DNAtoRNA(data, mode='dna'):
"""
Enter a string of nucleotides and this fuction will return the rna
equivalent or the dna equivelent. To convert rna back to dna use
the optional \'rna\' argument.
"""
mode.lower()
modetypes = ['dna', 'rna']
if mode not in modetypes:
raise Typ... |
def create_cloud_event_msg(msg_id, msg_type, source, time, identifier, json_data_body): # pylint: disable=too-many-arguments # noqa E501
# industry standard arguments for this message
"""Create a payload for the email service."""
cloud_event_msg = {
'specversion': '1.x-wip',
'type': msg_typ... |
def convert_hubs_to_datastores(hubs, datastores):
"""Get filtered subset of datastores as represented by hubs.
:param hubs: represents a sub set of datastore ids
:param datastores: represents all candidate datastores
:returns: that subset of datastores objects that are also present in hubs
"""
... |
def header(content_type="text/html", filename=None):
""" Return the header needed for a CGI application.
@param content_type: The type of content delivered (optional, defaults to text/html)
@param filename: Set the content to be a downloadable file (optional)
"""
output = "Content-Type: " + str(content_type) +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.