content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
str1= input("enter a string :") l1 ="" for i in str1 [::-1]: l1 = i+l1 print(l1) if str1 == l1: print("string is a palindrome") else : print("string is not a palindrome")
str1 = input('enter a string :') l1 = '' for i in str1[::-1]: l1 = i + l1 print(l1) if str1 == l1: print('string is a palindrome') else: print('string is not a palindrome')
""" Default values : DO NOT CHANGE !!!""" LOG_FORMAT = "%(asctime)s: %(levelname)s: %(message)s" DATE_FORMAT = "%Y-%m-%d %H:%M:%S" MAXITERATIONS = 100 LIFE_PARAMETERS = {"theta_i":30,"theta_fl":36,"theta_gfl":28.6, "R":4.87,"n":1,"tau":3.5,"m":1,"A":-13.391, "B":6972.15,"num_...
""" Default values : DO NOT CHANGE !!!""" log_format = '%(asctime)s: %(levelname)s: %(message)s' date_format = '%Y-%m-%d %H:%M:%S' maxiterations = 100 life_parameters = {'theta_i': 30, 'theta_fl': 36, 'theta_gfl': 28.6, 'R': 4.87, 'n': 1, 'tau': 3.5, 'm': 1, 'A': -13.391, 'B': 6972.15, 'num_of_iteration': 4} default_...
def evalRec(env, rec): """hl_reportable""" return (len(set(rec.Genes) & { 'ABHD12', 'ACTG1', 'ADGRV1', 'AIFM1', 'ATP6V1B1', 'BCS1L', 'BSND', 'CABP2', 'CACNA1D', 'CDC14A', '...
def eval_rec(env, rec): """hl_reportable""" return len(set(rec.Genes) & {'ABHD12', 'ACTG1', 'ADGRV1', 'AIFM1', 'ATP6V1B1', 'BCS1L', 'BSND', 'CABP2', 'CACNA1D', 'CDC14A', 'CDH23', 'CEACAM16', 'CEP78', 'CHD7', 'CIB2', 'CISD2', 'CLDN14', 'CLIC5', 'CLPP', 'CLRN1', 'COCH', 'COL11A2', 'DIAPH1', 'DIAPH3', 'DMXL2', 'DN...
# https://github.com/git/git/blob/master/Documentation/technical/index-format.txt class GitIndexEntry(object): # The last time a file's metadata changed. This is a tuple (seconds, nanoseconds) ctime = None # The last time a file's data changed. This is a tuple (seconds, nanoseconds) mtime = None #...
class Gitindexentry(object): ctime = None mtime = None dev = None ino = None mode_type = None mode_permissions = None uui = None gid = None size = None object = None flag_assume_valid = None flag_extended = None flag_stage = None flag_name_length = None name =...
__version__ = '7.8.0' _optional_dependencies = [ { 'name': 'CuPy', 'packages': [ 'cupy-cuda120', 'cupy-cuda114', 'cupy-cuda113', 'cupy-cuda112', 'cupy-cuda111', 'cupy-cuda110', 'cupy-cuda102', 'cupy-cud...
__version__ = '7.8.0' _optional_dependencies = [{'name': 'CuPy', 'packages': ['cupy-cuda120', 'cupy-cuda114', 'cupy-cuda113', 'cupy-cuda112', 'cupy-cuda111', 'cupy-cuda110', 'cupy-cuda102', 'cupy-cuda101', 'cupy-cuda100', 'cupy-cuda92', 'cupy-cuda91', 'cupy-cuda90', 'cupy-cuda80', 'cupy'], 'specifier': '>=7.7.0,<8.0.0'...
side_a=int(input("Enter the first side(a):")) side_b=int(input("Enter the second side(b):")) side_c=int(input("Enter the third side(c):")) if side_a==side_b and side_a==side_c: print("The triangle is an equilateral triangle.") elif side_a==side_b or side_a==side_c or side_b==side_c: print("The triangle is...
side_a = int(input('Enter the first side(a):')) side_b = int(input('Enter the second side(b):')) side_c = int(input('Enter the third side(c):')) if side_a == side_b and side_a == side_c: print('The triangle is an equilateral triangle.') elif side_a == side_b or side_a == side_c or side_b == side_c: print('The t...
# -*- coding: utf-8 -*- """ Created on Sat Aug 22 19:07:30 2020 @author: Abhishek Mukherjee """ class Solution: def reorderLogFiles(self, logs: List[str]) -> List[str]: letLog=[] digLog=[] for i in range(len(logs)): temp=[] temp=logs...
""" Created on Sat Aug 22 19:07:30 2020 @author: Abhishek Mukherjee """ class Solution: def reorder_log_files(self, logs: List[str]) -> List[str]: let_log = [] dig_log = [] for i in range(len(logs)): temp = [] temp = logs[i].split(' ') if temp[1].isdigi...
_base_ = [ '../_base_/models/cascade_rcnn_r50_fpn.py', './dataset_base.py', './scheduler_base.py', '../_base_/default_runtime.py' ] model = dict( pretrained='open-mmlab://resnext101_32x4d', backbone=dict( type='DetectoRS_ResNeXt', pretrained='open-mmlab://resnext101_32x4d', ...
_base_ = ['../_base_/models/cascade_rcnn_r50_fpn.py', './dataset_base.py', './scheduler_base.py', '../_base_/default_runtime.py'] model = dict(pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='DetectoRS_ResNeXt', pretrained='open-mmlab://resnext101_32x4d', depth=101, groups=32, base_width=4, conv_cfg=dict...
def decodeLongLong(lst): high = int(lst[0]) << 32 low = int(lst[1]) if low < 0: low += 4294967296 if high < 0: high += 4294967296 return high + low def encodeLongLong(i): high = int(i / 4294967296) low = i - high return high, low def parseOk(str): if str == 'ok': return True else: return False def ...
def decode_long_long(lst): high = int(lst[0]) << 32 low = int(lst[1]) if low < 0: low += 4294967296 if high < 0: high += 4294967296 return high + low def encode_long_long(i): high = int(i / 4294967296) low = i - high return (high, low) def parse_ok(str): if str == '...
class AttributeDict(object): """ A class to convert a nested Dictionary into an object with key-values accessibly using attribute notation (AttributeDict.attribute) instead of key notation (Dict["key"]). This class recursively sets Dicts to objects, allowing you to recurse down nested dicts (like: A...
class Attributedict(object): """ A class to convert a nested Dictionary into an object with key-values accessibly using attribute notation (AttributeDict.attribute) instead of key notation (Dict["key"]). This class recursively sets Dicts to objects, allowing you to recurse down nested dicts (like: A...
# # PySNMP MIB module ENTERASYS-NAC-APPLIANCE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-NAC-APPLIANCE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:04:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
class Unsubclassable: def __init_subclass__(cls, **kwargs): raise TypeError('Unacceptable base type') def prevent_subclassing(): raise TypeError('Unacceptable base type') def final_class(cls): setattr(cls, '__init_subclass__', prevent_subclassing) return cls class UnsubclassableType(type)...
class Unsubclassable: def __init_subclass__(cls, **kwargs): raise type_error('Unacceptable base type') def prevent_subclassing(): raise type_error('Unacceptable base type') def final_class(cls): setattr(cls, '__init_subclass__', prevent_subclassing) return cls class Unsubclassabletype(type):...
def solve(): # Read input R, C, H, V = map(int, input().split()) choco = [] for _ in range(R): choco.append([0] * C) choco_row, choco_col = [0]*R, [0]*C num_choco = 0 for i in range(R): row = input() for j in range(C): if row[j] == '@': cho...
def solve(): (r, c, h, v) = map(int, input().split()) choco = [] for _ in range(R): choco.append([0] * C) (choco_row, choco_col) = ([0] * R, [0] * C) num_choco = 0 for i in range(R): row = input() for j in range(C): if row[j] == '@': choco_col[...
class Solution(object): def maximumWealth(self, accounts): """ :type accounts: List[List[int]] :rtype: int """ # Runtime: 36 ms # Memory: 13.5 MB return max(map(sum, accounts))
class Solution(object): def maximum_wealth(self, accounts): """ :type accounts: List[List[int]] :rtype: int """ return max(map(sum, accounts))
""" Main application entry point. python -m digibujogens ... """ def main(): """ Execute the application. """ raise NotImplementedError # Make the script executable. if __name__ == "__main__": raise SystemExit(main())
""" Main application entry point. python -m digibujogens ... """ def main(): """ Execute the application. """ raise NotImplementedError if __name__ == '__main__': raise system_exit(main())
""" --- Day 14: Docking Data --- As your ferry approaches the sea port, the captain asks for your help again. The computer system that runs this port isn't compatible with the docking program on the ferry, so the docking parameters aren't being correctly initialized in the docking program's memory. After a brief inspe...
""" --- Day 14: Docking Data --- As your ferry approaches the sea port, the captain asks for your help again. The computer system that runs this port isn't compatible with the docking program on the ferry, so the docking parameters aren't being correctly initialized in the docking program's memory. After a brief inspe...
""" You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twen...
""" You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twen...
#Definicion de la clase #antes de empezar una clase se declara de la siguiente manera class Lamp: _LAMPS = [''' . . | , \ ' / ` ,-. ' --- ( ) --- \ / _|=|_ |_____| ''', ''' ,-. ( ) \ / _|=|_ |___...
class Lamp: _lamps = ["\n .\n . | ,\n \\ ' /\n ` ,-. '\n --- ( ) ---\n \\ /\n _|=|_\n |_____|\n ", '\n ,-.\n ( )\n \\ /\n _|=|_\n |_____|\n '] def __init__(self, is_turned_on): self._is_turned_on = i...
votes_t_shape = [3, 0, 1, 2] for i in range(6 - 4): votes_t_shape += [i + 4] print(votes_t_shape)
votes_t_shape = [3, 0, 1, 2] for i in range(6 - 4): votes_t_shape += [i + 4] print(votes_t_shape)
"""Internal API endpoint constant library. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | ...
"""Internal API endpoint constant library. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | ...
#/ <reference path="./testBlocks/mb.ts" /> def function_0(): basic.showNumber(7) basic.forever(function_0)
def function_0(): basic.showNumber(7) basic.forever(function_0)
# # PySNMP MIB module HH3C-PPPOE-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-PPPOE-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:16:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ...
name = input("masukkan nama pembeli = ") alamat= input("Alamat = ") NoTelp = input("No Telp = ") print("\n") print("=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============") print("Pilih Jenis Mobil :") print("\t 1.Daihatsu ") print("\t 2.Honda ") print("\t 3.Toyota ") print("") pilihan = int(input("Pil...
name = input('masukkan nama pembeli = ') alamat = input('Alamat = ') no_telp = input('No Telp = ') print('\n') print('=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============') print('Pilih Jenis Mobil :') print('\t 1.Daihatsu ') print('\t 2.Honda ') print('\t 3.Toyota ') print('') pilihan = int(input('P...
""" ABP analyzer and graphics tests """ cases = [ ('Run Pymodel Graphics to generate dot file from FSM model, no need use pma', 'pmg ABP'), ('Generate SVG file from dot', 'dotsvg ABP'), # Now display ABP.dot in browser ('Run PyModel Analyzer to generate FSM from original FSM, should be the...
""" ABP analyzer and graphics tests """ cases = [('Run Pymodel Graphics to generate dot file from FSM model, no need use pma', 'pmg ABP'), ('Generate SVG file from dot', 'dotsvg ABP'), ('Run PyModel Analyzer to generate FSM from original FSM, should be the same', 'pma ABP'), ('Run PyModel Graphics to generate a file of...
""" Question: Nim Game My Submissions Question You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones. Bot...
""" Question: Nim Game My Submissions Question You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones. Bot...
#!/bin/python3 with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f: data = f.read() f.closed start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM') end = data.find('} metadata_data_t;') data = data[start:end] metadata = data.split("\n") metalist = list() for line in metadata: if (line.starts...
with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f: data = f.read() f.closed start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM') end = data.find('} metadata_data_t;') data = data[start:end] metadata = data.split('\n') metalist = list() for line in metadata: if line.startswith(' INCLUDE'):...
def g(A, n): if A == -1: return 0 return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0) def f(A, B): result = 0 for i in range(48): t = 1 << i if (g(B, t) - g(A - 1, t)) % 2 == 1: result += t return result A, B = map(int, input().split()) print(f(A, B))
def g(A, n): if A == -1: return 0 return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0) def f(A, B): result = 0 for i in range(48): t = 1 << i if (g(B, t) - g(A - 1, t)) % 2 == 1: result += t return result (a, b) = map(int, input().split()) print(f(A, B))
# Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements. def move_zeros(array): #your code here new_array = [] new_index = 0 while len(array) > 0: item = array.pop(0) if item == 0 and not type(item) == bool : ...
def move_zeros(array): new_array = [] new_index = 0 while len(array) > 0: item = array.pop(0) if item == 0 and (not type(item) == bool): new_array.append(item) else: new_array.insert(new_index, item) new_index = new_index + 1 return new_array
def construct_tag_data(tag_name, attrs=None, value=None, sorting=None): data = { '_name': tag_name, '_attrs': attrs or [], '_value': value, } if sorting: data['_sorting'] = sorting return data def add_simple_child(data, child_friendly_name, child_tag_name, child_attr...
def construct_tag_data(tag_name, attrs=None, value=None, sorting=None): data = {'_name': tag_name, '_attrs': attrs or [], '_value': value} if sorting: data['_sorting'] = sorting return data def add_simple_child(data, child_friendly_name, child_tag_name, child_attrs=None, child_value=None): data...
# # PySNMP MIB module CISCO-DOT11-QOS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-QOS-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:55:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ...
""" Next lexicographical permutation algorithm https://www.nayuki.io/page/next-lexicographical-permutation-algorithm """ def next_lexo(S): b = S[-1] for i, a in enumerate(reversed(S[:-1]), 2): if a < b: # we have the pivot a for j, b in enumerate(reversed(S), 1): ...
""" Next lexicographical permutation algorithm https://www.nayuki.io/page/next-lexicographical-permutation-algorithm """ def next_lexo(S): b = S[-1] for (i, a) in enumerate(reversed(S[:-1]), 2): if a < b: for (j, b) in enumerate(reversed(S), 1): if b > a: ...
def hamming(n): """Returns the nth hamming number""" hamming = {1} x = 1 while len(hamming) <= n * 3.5: new_hamming = {1} for i in hamming: new_hamming.add(i * 2) new_hamming.add(i * 3) new_hamming.add(i * 5) # merge new number into hamming set...
def hamming(n): """Returns the nth hamming number""" hamming = {1} x = 1 while len(hamming) <= n * 3.5: new_hamming = {1} for i in hamming: new_hamming.add(i * 2) new_hamming.add(i * 3) new_hamming.add(i * 5) hamming = hamming.union(new_hamming...
''' Created on Jan 18, 2018 @author: riteshagarwal ''' java = False rest = False cli = False
""" Created on Jan 18, 2018 @author: riteshagarwal """ java = False rest = False cli = False
async def handler(context): return await context.data
async def handler(context): return await context.data
def default_evaluator(model, X_test, y_test): """A simple evaluator that takes in a model, and a test set, and returns the loss. Args: model: The model to evaluate. X_test: The features matrix of the test set. y_test: The one-hot labels matrix of the test set. ...
def default_evaluator(model, X_test, y_test): """A simple evaluator that takes in a model, and a test set, and returns the loss. Args: model: The model to evaluate. X_test: The features matrix of the test set. y_test: The one-hot labels matrix of the test set. ...
class APIError(Exception): """ Base exception for the API app """ pass class APIResourcePatternError(APIError): """ Raised when an app tries to override an existing URL regular expression pattern """ pass
class Apierror(Exception): """ Base exception for the API app """ pass class Apiresourcepatternerror(APIError): """ Raised when an app tries to override an existing URL regular expression pattern """ pass
dataset_type = 'UNITER_VqaDataset' data_root = '/home/datasets/mix_data/UNITER/VQA/' train_datasets = ['train'] test_datasets = ['minival'] # name not in use, but have defined one to run vqa_cfg = dict( train_txt_dbs=[ data_root + 'vqa_train.db', data_root + 'vqa_trainval.db', data_root +...
dataset_type = 'UNITER_VqaDataset' data_root = '/home/datasets/mix_data/UNITER/VQA/' train_datasets = ['train'] test_datasets = ['minival'] vqa_cfg = dict(train_txt_dbs=[data_root + 'vqa_train.db', data_root + 'vqa_trainval.db', data_root + 'vqa_vg.db'], train_img_dbs=[data_root + 'coco_train2014/', data_root + 'coco_v...
# Debug print levels for fine-grained debug trace output control DNFQUEUE = (1 << 0) # netfilterqueue DGENPKT = (1 << 1) # Generic packet handling DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis DCB = (1 << 3) # Packet handlign callbacks DPROCFS = (1 << 4) # procfs DIPTBLS = (...
dnfqueue = 1 << 0 dgenpkt = 1 << 1 dgenpktv = 1 << 2 dcb = 1 << 3 dprocfs = 1 << 4 diptbls = 1 << 5 dnonloc = 1 << 6 ddpf = 1 << 7 ddpfv = 1 << 8 dipnat = 1 << 9 dmangle = 1 << 10 dpcap = 1 << 11 dign = 1 << 12 dftp = 1 << 13 dmisc = 1 << 27 dcomp = 268435455 dflag = 4026531840 devery = 268435455 devery2 = 2415919103 d...
""" Module: 'display' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 class TFT: '' BLACK = 0 BLUE = 255 BMP = 2 BOTTOM = -9004 CENTER = -9003 COLOR_BI...
""" Module: 'display' on M5 FlowUI v1.4.0-beta """ class Tft: """""" black = 0 blue = 255 bmp = 2 bottom = -9004 center = -9003 color_bits16 = 16 color_bits24 = 24 cyan = 65535 darkcyan = 32896 darkgreen = 32768 darkgrey = 8421504 font_7seg = 9 font__comic = 4 ...
types_of_people = 10 x = f"There are {types_of_people} types of people." binary = "binary" do_not = "don't" y = f"Those who know {binary} and those who {do_not}." print(x) print(y) print(f"I said: {x}") print(f"I also said: '{y}'") hilarious = False joke_evaluation = "Isn't that joke so funny?! {}" print(joke_eval...
types_of_people = 10 x = f'There are {types_of_people} types of people.' binary = 'binary' do_not = "don't" y = f'Those who know {binary} and those who {do_not}.' print(x) print(y) print(f'I said: {x}') print(f"I also said: '{y}'") hilarious = False joke_evaluation = "Isn't that joke so funny?! {}" print(joke_evaluatio...
class LineSegment3D(object): """A class to represent a 3D line segment.""" def __init__(self, p1, p2): """Initialize with two endpoints.""" if p1 > p2: p1, p2 = (p2, p1) self.p1 = p1 self.p2 = p2 self.count = 1 def __len__(self): """Line segment...
class Linesegment3D(object): """A class to represent a 3D line segment.""" def __init__(self, p1, p2): """Initialize with two endpoints.""" if p1 > p2: (p1, p2) = (p2, p1) self.p1 = p1 self.p2 = p2 self.count = 1 def __len__(self): """Line segmen...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:26:47 2019 @author: sercangul """ n = 5 xy = [map(int, input().split()) for _ in range(n)] sx, sy, sx2, sxy = map(sum, zip(*[(x, y, x**2, x * y) for x, y in xy])) b = (n * sxy - sx * sy) / (n * sx2 - sx**2) a = (sy / n) - b * (sx / n) print('...
""" Created on Mon Jun 3 19:26:47 2019 @author: sercangul """ n = 5 xy = [map(int, input().split()) for _ in range(n)] (sx, sy, sx2, sxy) = map(sum, zip(*[(x, y, x ** 2, x * y) for (x, y) in xy])) b = (n * sxy - sx * sy) / (n * sx2 - sx ** 2) a = sy / n - b * (sx / n) print('{:.3f}'.format(a + b * 80))
def create_array(n): res=[] i=1 while i<=n: res.append(i) i += 1 return res
def create_array(n): res = [] i = 1 while i <= n: res.append(i) i += 1 return res
class Popularity: ''' Popularity( length=20 ) Used to iteratively calculate the average overall popularity of an algorithm's recommendations. Parameters ----------- length : int Coverage@length training_df : dataframe determines how many distinct item_ids there are in the ...
class Popularity: """ Popularity( length=20 ) Used to iteratively calculate the average overall popularity of an algorithm's recommendations. Parameters ----------- length : int Coverage@length training_df : dataframe determines how many distinct item_ids there are in the ...
def create_auction(self): expected_http_status = '201 Created' request_data = {"data": self.auction} entrypoint = '/auctions' response = self.app.post_json(entrypoint, request_data) self.assertEqual(response.status, expected_http_status) def create_auction_check_minNumberOfQualifiedBids(self): ...
def create_auction(self): expected_http_status = '201 Created' request_data = {'data': self.auction} entrypoint = '/auctions' response = self.app.post_json(entrypoint, request_data) self.assertEqual(response.status, expected_http_status) def create_auction_check_min_number_of_qualified_bids(self): ...
#=========================================================================== # # Crystalfontz Raspberry-Pi Python example library for FTDI / BridgeTek # EVE graphic accelerators. # #--------------------------------------------------------------------------- # # This file is part of the port/adaptation of existin...
eve_device = 811 eve_clock_speed = 60000000 touch_resistive = False touch_capacitive = False touch_goodix_capacitive = False lcd_swizzle = 2 lcd_pclkpol = 0 lcd_drive_10_ma = 0 lcd_pclk_cspread = 0 lcd_dither = 0 lcd_pclk = 5 hpx = 240 hsw = 10 hbp = 20 hfp = 10 hpp = 209 lcd_width = HPX lcd_hsync0 = HFP lcd_hsync1 = H...
INPUT_FILE = "../../input/09.txt" Point = tuple[int, int] Heightmap = dict[Point, int] Basin = set[Point] def parse_input() -> Heightmap: """ Parses the input and returns a Heightmap """ with open(INPUT_FILE) as f: heights = [[int(x) for x in line.strip()] for line in f] heightmap: Heigh...
input_file = '../../input/09.txt' point = tuple[int, int] heightmap = dict[Point, int] basin = set[Point] def parse_input() -> Heightmap: """ Parses the input and returns a Heightmap """ with open(INPUT_FILE) as f: heights = [[int(x) for x in line.strip()] for line in f] heightmap: Heightma...
class Car(object): """ Car class that can be used to instantiate various vehicles. It takes in arguments that depict the type, model, and name of the vehicle """ def __init__(self, name="General", model="GM", car_type="saloon"): num_of_wheels = 4 num_of_doors = 4 ...
class Car(object): """ Car class that can be used to instantiate various vehicles. It takes in arguments that depict the type, model, and name of the vehicle """ def __init__(self, name='General', model='GM', car_type='saloon'): num_of_wheels = 4 num_of_doors = 4 ...
"""Test discovery of entities for device-specific schemas for the Z-Wave JS integration.""" async def test_iblinds_v2(hass, client, iblinds_v2, integration): """Test that an iBlinds v2.0 multilevel switch value is discovered as a cover.""" node = iblinds_v2 assert node.device_class.specific.label == "Unus...
"""Test discovery of entities for device-specific schemas for the Z-Wave JS integration.""" async def test_iblinds_v2(hass, client, iblinds_v2, integration): """Test that an iBlinds v2.0 multilevel switch value is discovered as a cover.""" node = iblinds_v2 assert node.device_class.specific.label == 'Unuse...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
"""Automatically generated unit tests list - DO NOT EDIT.""" google_cloud_cpp_common_unit_tests = ['common_options_test.cc', 'future_generic_test.cc', 'future_generic_then_test.cc', 'future_void_test.cc', 'future_void_then_test.cc', 'iam_bindings_test.cc', 'internal/algorithm_test.cc', 'internal/api_client_header_test....
class Any2Int: def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool): self.min_count = min_count self.include_UNK = include_UNK self.include_PAD = include_PAD self.frozen = False self.UNK_i = -1 self.UNK_s = "<UNK>" self.PAD_i = -2 ...
class Any2Int: def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool): self.min_count = min_count self.include_UNK = include_UNK self.include_PAD = include_PAD self.frozen = False self.UNK_i = -1 self.UNK_s = '<UNK>' self.PAD_i = -2 ...
# Test definitions for Lit, the LLVM test runner. # # This is reusing the LLVM Lit test runner in the interim until the new build # rules are upstreamed. # TODO(b/136126535): remove this custom rule. """Lit runner globbing test """ load("//tensorflow:tensorflow.bzl", "filegroup") load("@bazel_skylib//lib:paths.bzl", "...
"""Lit runner globbing test """ load('//tensorflow:tensorflow.bzl', 'filegroup') load('@bazel_skylib//lib:paths.bzl', 'paths') load('//tensorflow:tensorflow.bzl', 'tf_cc_test', 'tf_native_cc_binary', 'tf_copts') _default_test_file_exts = ['mlir', '.pbtxt', '.td'] _default_driver = '@llvm-project//mlir:run_lit.sh' _defa...
""" These are functions to add to the configure context. """ def __checkCanLink(context, source, source_type, message_libname, real_libs=[]): """ Check that source can be successfully compiled and linked against real_libs. Keyword arguments: source -- source to try to compile source_type -- type of source file, ...
""" These are functions to add to the configure context. """ def __check_can_link(context, source, source_type, message_libname, real_libs=[]): """ Check that source can be successfully compiled and linked against real_libs. Keyword arguments: source -- source to try to compile source_type -- type of source f...
class CharEnumerator(object): """ Supports iterating over a System.String object and reading its individual characters. This class cannot be inherited. """ def ZZZ(self): """hardcoded/mock instance of the class""" return CharEnumerator() instance=ZZZ() """hardcoded/returns an instance of the class""" de...
class Charenumerator(object): """ Supports iterating over a System.String object and reading its individual characters. This class cannot be inherited. """ def zzz(self): """hardcoded/mock instance of the class""" return char_enumerator() instance = zzz() 'hardcoded/returns an instance ...
# model settings model = dict( type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D', backbone=dict( type='ResNet3d', depth=18, pretrained=None, pretrained2d=False, norm_eval=False, conv_cfg=dict(type='Conv3d'), norm_cfg=dict(type='SyncBN', requires...
model = dict(type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D', backbone=dict(type='ResNet3d', depth=18, pretrained=None, pretrained2d=False, norm_eval=False, conv_cfg=dict(type='Conv3d'), norm_cfg=dict(type='SyncBN', requires_grad=True, eps=0.001), act_cfg=dict(type='ReLU'), conv1_kernel=(3, 7, 7), conv1_st...
""" Disjoint set. Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure """ class Node: def __init__(self, data: int) -> None: self.data = data self.rank: int self.parent: Node def make_set(x: Node) -> None: """ Make x as a set. """ # rank is the di...
""" Disjoint set. Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure """ class Node: def __init__(self, data: int) -> None: self.data = data self.rank: int self.parent: Node def make_set(x: Node) -> None: """ Make x as a set. """ x.rank = 0 x....
class SeqIter: def __init__(self,l): self.l = l self.i = 0 self.stop = False def __len__(self): return len(self.l) def __list__(self): l = [] while True: try: l.append(self.__next__()) except StopIteration: ...
class Seqiter: def __init__(self, l): self.l = l self.i = 0 self.stop = False def __len__(self): return len(self.l) def __list__(self): l = [] while True: try: l.append(self.__next__()) except StopIteration: ...
def quicksort(xs): if len(xs) == 0: return [] pivot = xs[0] xs = xs[1:] left = [x for x in xs if x <= pivot] right = [x for x in xs if x > pivot] res = quicksort(left) res.append(pivot) res += quicksort(right) return res xs = [1, 3, 2, 4, 5, 2] sorted_xs = quicksort(xs)
def quicksort(xs): if len(xs) == 0: return [] pivot = xs[0] xs = xs[1:] left = [x for x in xs if x <= pivot] right = [x for x in xs if x > pivot] res = quicksort(left) res.append(pivot) res += quicksort(right) return res xs = [1, 3, 2, 4, 5, 2] sorted_xs = quicksort(xs)
# # PySNMP MIB module CISCO-TRUSTSEC-POLICY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TRUSTSEC-POLICY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:14:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ...
""" Simple file to validate that maketests is working. Call maketests via: >>> from x7.shell import *; maketests('x7.sample.needs_tests') """ def needs_a_test(a, b): return a+b
""" Simple file to validate that maketests is working. Call maketests via: >>> from x7.shell import *; maketests('x7.sample.needs_tests') """ def needs_a_test(a, b): return a + b
class Event: def __init__(self): self.handlers = set() def subscribe(self, func): self.handlers.add(func) def unsubscribe(self, func): self.handlers.remove(func) def emit(self, *args): for func in self.handlers: func(*args)
class Event: def __init__(self): self.handlers = set() def subscribe(self, func): self.handlers.add(func) def unsubscribe(self, func): self.handlers.remove(func) def emit(self, *args): for func in self.handlers: func(*args)
dataset_type = 'FlyingChairs' data_root = 'data/FlyingChairs_release' img_norm_cfg = dict(mean=[0., 0., 0.], std=[255., 255., 255.], to_rgb=False) global_transform = dict( translates=(0.05, 0.05), zoom=(1.0, 1.5), shear=(0.86, 1.16), rotate=(-10., 10.)) relative_transform = dict( translates=(0.00...
dataset_type = 'FlyingChairs' data_root = 'data/FlyingChairs_release' img_norm_cfg = dict(mean=[0.0, 0.0, 0.0], std=[255.0, 255.0, 255.0], to_rgb=False) global_transform = dict(translates=(0.05, 0.05), zoom=(1.0, 1.5), shear=(0.86, 1.16), rotate=(-10.0, 10.0)) relative_transform = dict(translates=(0.00375, 0.00375), zo...
"""TurboGears project related information""" version = "2.4.3" description = "Next generation TurboGears" long_description=""" TurboGears brings together a best of breed python tools to create a flexible, full featured, and easy to use web framework. TurboGears 2 provides an integrated and well tested set of tools for...
"""TurboGears project related information""" version = '2.4.3' description = 'Next generation TurboGears' long_description = '\nTurboGears brings together a best of breed python tools\nto create a flexible, full featured, and easy to use web\nframework.\n\nTurboGears 2 provides an integrated and well tested set of tool...
__all__ = ("DottedMarkupLanguageException", "DecodeError") class DottedMarkupLanguageException(Exception): """Base class for all exceptions in this module.""" pass class DecodeError(DottedMarkupLanguageException): """Raised when there is an error decoding a string.""" pass
__all__ = ('DottedMarkupLanguageException', 'DecodeError') class Dottedmarkuplanguageexception(Exception): """Base class for all exceptions in this module.""" pass class Decodeerror(DottedMarkupLanguageException): """Raised when there is an error decoding a string.""" pass
security = """ New Web users get the Roles "User,Nosy" New Email users get the Role "User" Role "admin": User may access the rest interface (Rest Access) User may access the web interface (Web Access) User may access the xmlrpc interface (Xmlrpc Access) User may create everything (Create) User may edit everything ...
security = '\nNew Web users get the Roles "User,Nosy"\nNew Email users get the Role "User"\nRole "admin":\n User may access the rest interface (Rest Access)\n User may access the web interface (Web Access)\n User may access the xmlrpc interface (Xmlrpc Access)\n User may create everything (Create)\n User may edit every...
tc = int(input()) while tc: tc -= 1 best = 0 n, x = map(int, input().split()) for i in range(n): s, r = map(int, input().split()) if x >= s: best = max(best, r) print(best)
tc = int(input()) while tc: tc -= 1 best = 0 (n, x) = map(int, input().split()) for i in range(n): (s, r) = map(int, input().split()) if x >= s: best = max(best, r) print(best)
# # Copyright (c) 2020, Andrey "Limych" Khrolenok <andrey@khrolenok.ru> # Creative Commons BY-NC-SA 4.0 International Public License # (see LICENSE.md or https://creativecommons.org/licenses/by-nc-sa/4.0/) # """ The Snowtire binary sensor. For more details about this platform, please refer to the documentation at h...
""" The Snowtire binary sensor. For more details about this platform, please refer to the documentation at https://github.com/Limych/ha-snowtire/ """
## # This class encapsulates a Region Of Interest, which may be either horizontal # (pixels) or vertical (rows/lines). class ROI: def __init__(self, start, end): self.start = start self.end = end self.len = end - start + 1 def valid(self): return self.start >= 0 and self.start ...
class Roi: def __init__(self, start, end): self.start = start self.end = end self.len = end - start + 1 def valid(self): return self.start >= 0 and self.start < self.end def crop(self, spectrum): return spectrum[self.start:self.end + 1] def contains(self, valu...
__all__ = ['EnemyBucketWithStar', 'Nut', 'Beam', 'Enemy', 'Friend', 'Hero', 'Launcher', 'Rotor', 'SpikeyBuddy', 'Star', 'Wizard', 'EnemyEquipedRotor', 'CyclingEnemyObject', 'Joi...
__all__ = ['EnemyBucketWithStar', 'Nut', 'Beam', 'Enemy', 'Friend', 'Hero', 'Launcher', 'Rotor', 'SpikeyBuddy', 'Star', 'Wizard', 'EnemyEquipedRotor', 'CyclingEnemyObject', 'Joints', 'Bomb', 'Contacts']
days_of_week = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday', 'Sunday'] operation = '' options = ['Info', 'Check-in/Out', 'Edit games', 'Back'] admins = ['admin1_telegram_nickname', 'admin2_telegram_nickname'] avail_days = [] TOKEN = 'bot_token' group_id = id_of_group_chat
days_of_week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] operation = '' options = ['Info', 'Check-in/Out', 'Edit games', 'Back'] admins = ['admin1_telegram_nickname', 'admin2_telegram_nickname'] avail_days = [] token = 'bot_token' group_id = id_of_group_chat
#analysis function for three level game def stat_analysis(c1,c2,c3): #ask question for viewing analysis of game analysis=input('\nDo you want to see your game analysis? (Yes/No) ') if analysis=='Yes': levels=['Level 1','Level 2','Level 3'] #calculating the score of levels l...
def stat_analysis(c1, c2, c3): analysis = input('\nDo you want to see your game analysis? (Yes/No) ') if analysis == 'Yes': levels = ['Level 1', 'Level 2', 'Level 3'] l1_score = c1 * 10 l2_score = c2 * 10 l3_score = c3 * 10 level_score = [l1_score, l2_score, l3_score] ...
# -*- coding: utf-8 -*- __author__ = """Hendrix Demers""" __email__ = 'hendrix.demers@mail.mcgill.ca' __version__ = '0.1.0'
__author__ = 'Hendrix Demers' __email__ = 'hendrix.demers@mail.mcgill.ca' __version__ = '0.1.0'
#!/usr/bin/env python3 def date_time(time): months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] hour, minute = int(time[11:13]), int(time[14:16]) return f"{int(time[0:2])} {months[int(time[3:5])-1]} {time[6:10]} year {h...
def date_time(time): months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] (hour, minute) = (int(time[11:13]), int(time[14:16])) return f"{int(time[0:2])} {months[int(time[3:5]) - 1]} {time[6:10]} year {hour} hour{('s' if hour != ...
item1='phone' item1_price = 100 item1_quantity = 5 item1_price_total = item1_price * item1_quantity print(type(item1)) # str print(type(item1_price)) # int print(type(item1_quantity)) # int print(type(item1_price_total)) # int # output: # <class 'str'> # <class 'int'> # ...
item1 = 'phone' item1_price = 100 item1_quantity = 5 item1_price_total = item1_price * item1_quantity print(type(item1)) print(type(item1_price)) print(type(item1_quantity)) print(type(item1_price_total))
a = int(input()) while a: for x in range(a-1): out = '*' + ' ' * (a-x-2) + '*' + ' ' * (a-x-2) + '*' print(out.center(2*a-1)) print('*' * (2 * a - 1)) for x in range(a-1): out = '*' + ' ' * x + '*' + ' ' * x + '*' print(out.center(2*a-1)) a = int(input())
a = int(input()) while a: for x in range(a - 1): out = '*' + ' ' * (a - x - 2) + '*' + ' ' * (a - x - 2) + '*' print(out.center(2 * a - 1)) print('*' * (2 * a - 1)) for x in range(a - 1): out = '*' + ' ' * x + '*' + ' ' * x + '*' print(out.center(2 * a - 1)) a = int(input...
class Dataset: _data = None _first_text_col = 'text' _second_text_col = None _label_col = 'label' def __init__(self): self._idx = 0 if self._data is None: raise Exception('Dataset is not loaded') def __iter__(self): return self def __next__(self): ...
class Dataset: _data = None _first_text_col = 'text' _second_text_col = None _label_col = 'label' def __init__(self): self._idx = 0 if self._data is None: raise exception('Dataset is not loaded') def __iter__(self): return self def __next__(self): ...
"Actions for compiling resx files" load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetResourceInfo", ) def _make_runner_arglist(dotnet, source, output, resgen): args = dotnet.actions.args() if type(source) == "Target": args.add_all(source.files) else: args.add(so...
"""Actions for compiling resx files""" load('@io_bazel_rules_dotnet//dotnet/private:providers.bzl', 'DotnetResourceInfo') def _make_runner_arglist(dotnet, source, output, resgen): args = dotnet.actions.args() if type(source) == 'Target': args.add_all(source.files) else: args.add(source) ...
class OCDSMergeError(Exception): """Base class for exceptions from within this package""" class MissingDateKeyError(OCDSMergeError, KeyError): """Raised when a release is missing a 'date' key""" def __init__(self, key, message): self.key = key self.message = message def __str__(self)...
class Ocdsmergeerror(Exception): """Base class for exceptions from within this package""" class Missingdatekeyerror(OCDSMergeError, KeyError): """Raised when a release is missing a 'date' key""" def __init__(self, key, message): self.key = key self.message = message def __str__(self):...
n=int(input("Enter number ")) fact=1 for i in range(1,n+1): fact=fact*i print("Factorial is ",fact)
n = int(input('Enter number ')) fact = 1 for i in range(1, n + 1): fact = fact * i print('Factorial is ', fact)
# Fractional Knapsack wt = [40,50,30,10,10,40,30] pro = [30,20,20,25,5,35,15] n = len(wt) data = [ (i,pro[i],wt[i]) for i in range(n) ] bag = 100 data.sort(key=lambda x: x[1]/x[2], reverse=True) profit=0 ans=[] i=0 while i<n: if data[i][2]<=bag: bag-=data[i][2] ans.append(data[i...
wt = [40, 50, 30, 10, 10, 40, 30] pro = [30, 20, 20, 25, 5, 35, 15] n = len(wt) data = [(i, pro[i], wt[i]) for i in range(n)] bag = 100 data.sort(key=lambda x: x[1] / x[2], reverse=True) profit = 0 ans = [] i = 0 while i < n: if data[i][2] <= bag: bag -= data[i][2] ans.append(data[i][0]) pro...
class DeviceSettings: def __init__(self, settings): self._id = settings["id"] self._title = settings["title"] self._type = settings["type"]["name"] self._value = settings["value"] @property def id(self): return self._id @property def value(self): ret...
class Devicesettings: def __init__(self, settings): self._id = settings['id'] self._title = settings['title'] self._type = settings['type']['name'] self._value = settings['value'] @property def id(self): return self._id @property def value(self): re...
word = input("Enter a word: ") if word == "a": print("one; any") elif word == "apple": print("familiar, round fleshy fruit") elif word == "rhinoceros": print("large thick-skinned animal with one or two horns on its nose") else: print("That word must not exist. This dictionary is very comprehensive.")
word = input('Enter a word: ') if word == 'a': print('one; any') elif word == 'apple': print('familiar, round fleshy fruit') elif word == 'rhinoceros': print('large thick-skinned animal with one or two horns on its nose') else: print('That word must not exist. This dictionary is very comprehensive.')
cnt = int(input()) num = list(map(int, input())) sum = 0 for i in range(len(num)): sum = sum + num[i] print(sum)
cnt = int(input()) num = list(map(int, input())) sum = 0 for i in range(len(num)): sum = sum + num[i] print(sum)
def test_xrange(judge_command): judge_command( "XRANGE somestream - +", {"command": "XRANGE", "key": "somestream", "stream_id": ["-", "+"]}, ) judge_command( "XRANGE somestream 1526985054069 1526985055069", { "command": "XRANGE", "key": "somestream", ...
def test_xrange(judge_command): judge_command('XRANGE somestream - +', {'command': 'XRANGE', 'key': 'somestream', 'stream_id': ['-', '+']}) judge_command('XRANGE somestream 1526985054069 1526985055069', {'command': 'XRANGE', 'key': 'somestream', 'stream_id': ['1526985054069', '1526985055069']}) judge_comma...
""":mod:`sider.warnings` --- Warning categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module defines several custom warning category classes. """ class SiderWarning(Warning): """All warning classes used by Sider extend this base class.""" class PerformanceWarning(SiderWarning, RuntimeWarning): ...
""":mod:`sider.warnings` --- Warning categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module defines several custom warning category classes. """ class Siderwarning(Warning): """All warning classes used by Sider extend this base class.""" class Performancewarning(SiderWarning, RuntimeWarning): ...
MEDIA_SEARCH = """ query ($search: String, $type: MediaType, $exclude: MediaFormat, $isAdult: Boolean) { Media(search: $search, type: $type, format_not: $exclude, isAdult: $isAdult) { id type format title { english romaji native } synonyms status description start...
media_search = '\nquery ($search: String, $type: MediaType, $exclude: MediaFormat, $isAdult: Boolean) {\n Media(search: $search, type: $type, format_not: $exclude, isAdult: $isAdult) {\n id\n type\n format\n title {\n english\n romaji\n native\n }\n synonyms\n status\n descriptio...
def decode(word1,word2,code): if len(word1)==1: code+=word1+word2 return code else: code+=word1[0]+word2[0] return decode(word1[1:],word2[1:],code) Alice='Ti rga eoe esg o h ore"ermetsCmuainls' Bob='hspormdcdsamsaefrtecus Hraina optcoae"' print(decode(Alice,Bob,''))
def decode(word1, word2, code): if len(word1) == 1: code += word1 + word2 return code else: code += word1[0] + word2[0] return decode(word1[1:], word2[1:], code) alice = 'Ti rga eoe esg o h ore"ermetsCmuainls' bob = 'hspormdcdsamsaefrtecus Hraina optcoae"' print(decode(Alice, Bo...
# constants for configuration parameters of our tensorflow models LABEL = "label" IDS = "ids" # LABEL_PAD_ID is used to pad multi-label training examples. # It should be < 0 to avoid index out of bounds errors by tf.one_hot. LABEL_PAD_ID = -1 HIDDEN_LAYERS_SIZES = "hidden_layers_sizes" SHARE_HIDDEN_LAYERS = "share_hid...
label = 'label' ids = 'ids' label_pad_id = -1 hidden_layers_sizes = 'hidden_layers_sizes' share_hidden_layers = 'share_hidden_layers' transformer_size = 'transformer_size' num_transformer_layers = 'number_of_transformer_layers' num_heads = 'number_of_attention_heads' unidirectional_encoder = 'unidirectional_encoder' ke...
PROTO = { 'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'], 'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'], 'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'], 'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy']...
proto = {'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'], 'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'], 'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'], 'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy'], 'spaceone.monit...
"""Ingredient dto. """ class Ingredient(): """Class to represent an ingredient. """ def __init__(self, name, availability_per_month): self.name = name self.availability_per_month = availability_per_month def __repr__(self): return """{} is the name.""".format(self.name)
"""Ingredient dto. """ class Ingredient: """Class to represent an ingredient. """ def __init__(self, name, availability_per_month): self.name = name self.availability_per_month = availability_per_month def __repr__(self): return '{} is the name.'.format(self.name)
# -*- coding: utf-8 -*- class Config(object): def __init__(self): self.init_scale = 0.1 self.learning_rate = 1.0 self.max_grad_norm = 5 self.num_layers = 2 self.slice_size = 30 self.hidden_size = 200 self.max_epoch = 13 self.keep_prob = 0.8 se...
class Config(object): def __init__(self): self.init_scale = 0.1 self.learning_rate = 1.0 self.max_grad_norm = 5 self.num_layers = 2 self.slice_size = 30 self.hidden_size = 200 self.max_epoch = 13 self.keep_prob = 0.8 self.lr_const_epoch = 4 ...
{ 'targets': [ { # have to specify 'liblib' here since gyp will remove the first one :\ 'target_name': 'mysql_bindings', 'sources': [ 'src/mysql_bindings.cc', 'src/mysql_bindings_connection.cc', 'src/mysql_bindings_result.cc', 'src/mysql_bindings_statement.cc', ...
{'targets': [{'target_name': 'mysql_bindings', 'sources': ['src/mysql_bindings.cc', 'src/mysql_bindings_connection.cc', 'src/mysql_bindings_result.cc', 'src/mysql_bindings_statement.cc'], 'conditions': [['OS=="win"', {}, {'libraries': ['<!@(mysql_config --libs_r)']}], ['OS=="mac"', {'xcode_settings': {'OTHER_CFLAGS': [...
# TODO turn prints into actual error raise, they are print for testing def qSystemInitErrors(init): def newFunction(obj, **kwargs): init(obj, **kwargs) if obj._genericQSys__dimension is None: className = obj.__class__.__name__ print(className + ' requires a dimension') ...
def q_system_init_errors(init): def new_function(obj, **kwargs): init(obj, **kwargs) if obj._genericQSys__dimension is None: class_name = obj.__class__.__name__ print(className + ' requires a dimension') elif obj.frequency is None: class_name = obj.__clas...
""" some math tools """ class MathTools: """ some math tools """ def add(a, b): """ add two values """ return a + b def sub(a, b): """ subtract two values """
""" some math tools """ class Mathtools: """ some math tools """ def add(a, b): """ add two values """ return a + b def sub(a, b): """ subtract two values """
def insertion_sort(l): for i in range(1, len(l)): j = i - 1 key = l[i] while (j >= 0) and (l[j] > key): l[j + 1] = l[j] j -= 1 l[j + 1] = key m = int(input().strip()) ar = [int(i) for i in input().strip().split()] insertion_sort(ar) print(" ".join(map(str, a...
def insertion_sort(l): for i in range(1, len(l)): j = i - 1 key = l[i] while j >= 0 and l[j] > key: l[j + 1] = l[j] j -= 1 l[j + 1] = key m = int(input().strip()) ar = [int(i) for i in input().strip().split()] insertion_sort(ar) print(' '.join(map(str, ar)))
age = 24 print("My age is " + str(age) + " years ") # the above procedure is tedious since we dont really want to include str for every number we encounter #Method1 Replacement Fields print("My age is {0} years ".format(age)) # {0} is the actual replacement field, number important for multiple replacement fields ...
age = 24 print('My age is ' + str(age) + ' years ') print('My age is {0} years '.format(age)) print('There are {0} days in {1}, {2}, {3}, {4}, {5}, {6} and {7} '.format(31, 'January', 'March', 'May', 'july', 'August', 'october', 'december')) print('January:{2}\nFebruary:{0}\nMarch:{2}\nApril:{1}\n'.format(28, 30, 31)) ...
def Euler0001(): max = 1000 sum = 0 for i in range(1, max): if i%3 == 0 or i%5 == 0: sum += i print(sum) Euler0001()
def euler0001(): max = 1000 sum = 0 for i in range(1, max): if i % 3 == 0 or i % 5 == 0: sum += i print(sum) euler0001()
""" Person class """ # Create a Person class with the following properties # 1. name # 2. age # 3. social security number class Person: def __init__(self, name, age, social_number): self.name = name self.age = age self.social = social_number p1 = Person("John", 36, "111-11-1111") print...
""" Person class """ class Person: def __init__(self, name, age, social_number): self.name = name self.age = age self.social = social_number p1 = person('John', 36, '111-11-1111') print(p1.name) print(p1.age) print(p1.social)
""" Module for higher level SharePoint REST api actions - utilize methods in the api.py module """ class Site(): def __init__(self, sp): self.sp = sp @property def info(self): endpoint = "_api/site" value = self.sp.get(endpoint).json() return value @property def w...
""" Module for higher level SharePoint REST api actions - utilize methods in the api.py module """ class Site: def __init__(self, sp): self.sp = sp @property def info(self): endpoint = '_api/site' value = self.sp.get(endpoint).json() return value @property def web...
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
"""Build defs for TF/NumPy/JAX-variadic libraries & tests.""" no_rewrite_needed = ['internal:all_util', 'internal:docstring_util', 'internal:reparameterization', 'layers', 'platform_google'] rewriter_target = '//tensorflow_probability/substrates/meta:rewrite' runfiles_root = 'tensorflow_probability/' def _substrate_sr...