content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def zero(*args): arguments = str(args) current_number = 0 if '+' in arguments: for elem in args: number = current_number if elem == '+None': result = number + current_number return result number_2 = int(elem) result = nu...
def zero(*args): arguments = str(args) current_number = 0 if '+' in arguments: for elem in args: number = current_number if elem == '+None': result = number + current_number return result number_2 = int(elem) result = nu...
class ApiError(Exception): """An error status code was returned when querying the HTTP API""" pass class AuthError(ApiError): """An 401 Unauthorized status code was returned when querying the API""" pass class NonUniqueIdentifier(ApiError): pass class ObjectNotFound(ApiError): pass
class Apierror(Exception): """An error status code was returned when querying the HTTP API""" pass class Autherror(ApiError): """An 401 Unauthorized status code was returned when querying the API""" pass class Nonuniqueidentifier(ApiError): pass class Objectnotfound(ApiError): pass
#Pizza #Burger #Fries - > Peri Peri mala # > normal order ="" #initialization print("-----Crunch n Munch-------") while order!="exit" : order = input("Enter your order - ") if order == "pizza" or order == "burger" : print ("Your order is "+order+" Preparation in progress...") ...
order = '' print('-----Crunch n Munch-------') while order != 'exit': order = input('Enter your order - ') if order == 'pizza' or order == 'burger': print('Your order is ' + order + ' Preparation in progress...') continue if order == 'fries': with_periperi = input('fries with Peri P...
""" Parameter retrieval exceptions """ class GetParameterError(Exception): """When a provider raises an exception on parameter retrieval""" class TransformParameterError(Exception): """When a provider fails to transform a parameter value"""
""" Parameter retrieval exceptions """ class Getparametererror(Exception): """When a provider raises an exception on parameter retrieval""" class Transformparametererror(Exception): """When a provider fails to transform a parameter value"""
# Spec: https://docs.python.org/2/library/types.html print(None) # TypeType # print(True) # LOAD_NAME??? print(1) # print(1L) # Long print(1.1) # ComplexType print("abc") # print(u"abc") # Structural below print((1, 2)) # Tuple can be any length, but fixed after declared x = (1,2) print(x[0]) # Tuple can be any length,...
print(None) print(1) print(1.1) print('abc') print((1, 2)) x = (1, 2) print(x[0]) print([1, 2, 3]) print(int(1)) print(int(1.2)) print(float(1)) print(float(1.2)) assert type(1 - 2) is int assert type(2 / 3) is float x = 1 assert type(x) is int assert type(x - 1) is int a = bytes([1, 2, 3]) print(a) b = bytes([1, 2, 3]...
n = int(input()) v = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 for i in range(n): xy = v[i] - c[i] if xy > 0: ans += xy print(ans)
n = int(input()) v = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 for i in range(n): xy = v[i] - c[i] if xy > 0: ans += xy print(ans)
# Hello World # My first python git repo if __name__ == "__main__": print("Hello World")
if __name__ == '__main__': print('Hello World')
class Motor: """ doctest para motor >>> # testando motor >>> motor=Motor() >>> motor.acelerar() >>> motor.velocidade 1 >>> motor.frear() >>> motor.velocidade 0 """ def __init__(self, velocidade=0): self.velocidade = velocidade def acelerar(self): sel...
class Motor: """ doctest para motor >>> # testando motor >>> motor=Motor() >>> motor.acelerar() >>> motor.velocidade 1 >>> motor.frear() >>> motor.velocidade 0 """ def __init__(self, velocidade=0): self.velocidade = velocidade def acelerar(self): se...
def bingo(array): ctr = 0 for i in [2, 9, 14, 7, 15]: if i in list(set(array)): ctr += 1 if ctr == 5: return "WIN" else: return "LOSE"
def bingo(array): ctr = 0 for i in [2, 9, 14, 7, 15]: if i in list(set(array)): ctr += 1 if ctr == 5: return 'WIN' else: return 'LOSE'
# # PySNMP MIB module CISCO-PSM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-PSM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:39:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, constraints_union, single_value_constraint) ...
# Given a year, determine whether it is a leap year. If it is a leap year, # return the Boolean True, otherwise return False. # Note that the code stub provided reads from STDIN and # passes arguments to the is_leap function. It is only necessary to complete the is_leap function. def is_leap(year): leap = False ...
def is_leap(year): leap = False if year % 4 == 0: leap = True if year % 100 == 0: leap = False if year % 400 == 0: leap = True return leap
def media(n1=int(input("introduce la nota ")),n2=int(input("introduce la nota ")), n3=int(input("introduce la nota ")),n4=int(input("introduce la nota "))): notaMedia=(n1+n2+n3+n4)/4 if notaMedia>15: return print("Alumno con talento") elif notaMedia>=12 and notaMedia<=15: return print("C...
def media(n1=int(input('introduce la nota ')), n2=int(input('introduce la nota ')), n3=int(input('introduce la nota ')), n4=int(input('introduce la nota '))): nota_media = (n1 + n2 + n3 + n4) / 4 if notaMedia > 15: return print('Alumno con talento') elif notaMedia >= 12 and notaMedia <= 15: ...
check = 'Coderbunker whatever' bool(check.find('Coderbunker')) print(bool(check)) if check == 'Coderbunker whatever': print('what')
check = 'Coderbunker whatever' bool(check.find('Coderbunker')) print(bool(check)) if check == 'Coderbunker whatever': print('what')
add_pointer_input = { "type": "object", "additionalProperties": False, "properties": {"pointer": {"type": "string"}, "weight": {"type": "integer"}, "key": {"type": "string"}}, "required": ["pointer", "weight"], } remove_pointer_input = { "type": "object", "additionalProperties": False, "prop...
add_pointer_input = {'type': 'object', 'additionalProperties': False, 'properties': {'pointer': {'type': 'string'}, 'weight': {'type': 'integer'}, 'key': {'type': 'string'}}, 'required': ['pointer', 'weight']} remove_pointer_input = {'type': 'object', 'additionalProperties': False, 'properties': {'pointer': {'type': 's...
# 415. Add Strings # Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. # # Note: # # The length of both num1 and num2 is < 5100. # Both num1 and num2 contains only digits 0-9. # Both num1 and num2 does not contain any leading zero. # You must not use ...
class Solution(object): def add_strings(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ if not num1: return num2 if not num2: return num1 i = len(num1) - 1 j = len(num2) - 1 carry = 0 ...
# Finding peak element 1D of array of int def findPeakRec(arr,low,high,n): mid = low + (low + high) / 2 mid = int(mid) if ((mid == 0 or arr[mid - 1] <= arr[mid]) and (mid == n - 1 or arr[mid + 1] <= arr[mid])): return arr[mid] elif arr[mid] < arr[mid-1]: #find left retur...
def find_peak_rec(arr, low, high, n): mid = low + (low + high) / 2 mid = int(mid) if (mid == 0 or arr[mid - 1] <= arr[mid]) and (mid == n - 1 or arr[mid + 1] <= arr[mid]): return arr[mid] elif arr[mid] < arr[mid - 1]: return find_peak_rec(arr, low, mid - 1, n) else: return fi...
"""Decoder for the NEC infrared transmission protocol Implemented according to this specification: https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol """ _TOLERANCE = 0.25 class _UnexpectedPulse(Exception): pass class _Pulse(object): def __init__(self, durationms): duratio...
"""Decoder for the NEC infrared transmission protocol Implemented according to this specification: https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol """ _tolerance = 0.25 class _Unexpectedpulse(Exception): pass class _Pulse(object): def __init__(self, durationms): duration =...
def Length(L): C = 0 for _ in L: C+=1 return C N = int(input('\nEnter number of elements in list to be entered: ')) L = [] for i in range(0,N): L.append(input('Enter an element: ')) print('\nLength of list:',Length(L))
def length(L): c = 0 for _ in L: c += 1 return C n = int(input('\nEnter number of elements in list to be entered: ')) l = [] for i in range(0, N): L.append(input('Enter an element: ')) print('\nLength of list:', length(L))
def f(): print("this is the f() function") return 0 def fib(n): if n < 2: return n return fib(n-1) + fib(n-2) def fib_not_recursive(n): x = 0 y = 1 if n == 0: return x elif n == 1: return y while n-2 >= 0: x,y = y,x+y n -= 1 return y if __name__ == '__main__': fib_generated_by_recurse = [fib(i)...
def f(): print('this is the f() function') return 0 def fib(n): if n < 2: return n return fib(n - 1) + fib(n - 2) def fib_not_recursive(n): x = 0 y = 1 if n == 0: return x elif n == 1: return y while n - 2 >= 0: (x, y) = (y, x + y) n -= 1 ...
class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right class BTreeData: def __init__(self, n: Node, isTarget: bool): self.n = n self.isTarget = isTarget class Solution: def findSecondLargest(self, root: Node) -> Node: return self._helper(root).n ...
class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right class Btreedata: def __init__(self, n: Node, isTarget: bool): self.n = n self.isTarget = isTarget class Solution: def find_second_largest(self, root: No...
__all__ = ['ImgFormat'] class ImgFormat(): JPEG = 'jpeg' PNG = 'png'
__all__ = ['ImgFormat'] class Imgformat: jpeg = 'jpeg' png = 'png'
#!usr/bin/env python3 # Use standard library functions to search strings for content sample_str = "The quick brown fox jumps over the lazy dog" # startsWith and endsWith functions print(sample_str.startswith("The")) print(sample_str.startswith("the")) print(sample_str.endswith("dog")) # the find function starts sea...
sample_str = 'The quick brown fox jumps over the lazy dog' print(sample_str.startswith('The')) print(sample_str.startswith('the')) print(sample_str.endswith('dog')) print(sample_str.find('the')) print(sample_str.rfind('the')) print('the' in sample_str) new_str = sample_str.replace('lazy', 'tired') print(new_str) print(...
self.description = "Install a package with an existing file matching a negated --overwrite pattern" p = pmpkg("dummy") p.files = ["foobar"] self.addpkg(p) self.filesystem = ["foobar*"] self.args = "-U --overwrite=foobar --overwrite=!foo* %s" % p.filename() self.addrule("!PACMAN_RETCODE=0") self.addrule("!PKG_EXIST=...
self.description = 'Install a package with an existing file matching a negated --overwrite pattern' p = pmpkg('dummy') p.files = ['foobar'] self.addpkg(p) self.filesystem = ['foobar*'] self.args = '-U --overwrite=foobar --overwrite=!foo* %s' % p.filename() self.addrule('!PACMAN_RETCODE=0') self.addrule('!PKG_EXIST=dumm...
config_DMLPDTP2_linear = { "lr": 0.0000001, "target_stepsize": 0.0403226567555006, "feedback_wd": 9.821494271391093e-05, "lr_fb": 0.0022485520139920064, "sigma": 0.06086642605203958, "out_dir": "logs/STRegression/DMLPDTP2_linear", "network_type": "DMLPDTP2", "recurrent_input": False, ...
config_dmlpdtp2_linear = {'lr': 1e-07, 'target_stepsize': 0.0403226567555006, 'feedback_wd': 9.821494271391093e-05, 'lr_fb': 0.0022485520139920064, 'sigma': 0.06086642605203958, 'out_dir': 'logs/STRegression/DMLPDTP2_linear', 'network_type': 'DMLPDTP2', 'recurrent_input': False, 'hidden_fb_activation': 'linear', 'size_...
''' #list1 = ["Jiggu","JJ","gg","GG"] tuple = ("Jiggu","JJ","gg","GG") #for item in list1: #print(item) for item in tuple: print(item) '''
""" #list1 = ["Jiggu","JJ","gg","GG"] tuple = ("Jiggu","JJ","gg","GG") #for item in list1: #print(item) for item in tuple: print(item) """
class DisplayUnitType(Enum,IComparable,IFormattable,IConvertible): """ The units and display format used to format numbers as strings. Also used for unit conversions. enum DisplayUnitType,values: DUT_1_RATIO (182),DUT_ACRES (7),DUT_AMPERES (69),DUT_ATMOSPHERES (54),DUT_BARS (55),DUT_BRITISH_THERMAL_UNIT_PER...
class Displayunittype(Enum, IComparable, IFormattable, IConvertible): """ The units and display format used to format numbers as strings. Also used for unit conversions. enum DisplayUnitType,values: DUT_1_RATIO (182),DUT_ACRES (7),DUT_AMPERES (69),DUT_ATMOSPHERES (54),DUT_BARS (55),DUT_BRITISH_THERMAL_UNIT_P...
# program for check two strings are anagram or not # https://www.geeksforgeeks.org/check-whether-two-strings-are-anagram-of-each-other/ # time complexity is O(n) and space is O(1) def isAnagram(str1, str2): if(len(str1) != len(str2)): return False count = 0 # sum up all the chars ascii va...
def is_anagram(str1, str2): if len(str1) != len(str2): return False count = 0 for i in str1: count += ord(i) for i in str2: count -= ord(i) return count == 0 def is_anagram(str1, str2): if len(str1) != len(str2): return False str1 = sorted(str1) str2 = so...
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # interfaceLabels : Save and delete labels for interfaces def get_all_interface_labels( self, active: bool = None, ) -> dict: """Get all configured interface labels. Can filter response for active labels or inactive labels...
def get_all_interface_labels(self, active: bool=None) -> dict: """Get all configured interface labels. Can filter response for active labels or inactive labels with ``active`` parameter. .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpoint * -...
''' Provides one variable __version__. Caution: All code in here will be executed by setup.py. ''' __version__ = '0.2.2'
""" Provides one variable __version__. Caution: All code in here will be executed by setup.py. """ __version__ = '0.2.2'
class Pipe(object): def __init__(self, function): self.function = function def __ror__(self, other): return self.function(other) def __call__(self, *args, **kwargs): return Pipe(lambda x: self.function(x, *args, **kwargs))
class Pipe(object): def __init__(self, function): self.function = function def __ror__(self, other): return self.function(other) def __call__(self, *args, **kwargs): return pipe(lambda x: self.function(x, *args, **kwargs))
def cprint(c): r, i = c.real, c.imag if r != 0: if i > 0: print('{:.2f} + {:.2f}i'.format(r, i)) elif i < 0: print('{:.2f} - {:.2f}i'.format(r, abs(i))) else: print('{:.2f}'.format(r)) else: if i != 0: print('{:.2f}i'.format(i))...
def cprint(c): (r, i) = (c.real, c.imag) if r != 0: if i > 0: print('{:.2f} + {:.2f}i'.format(r, i)) elif i < 0: print('{:.2f} - {:.2f}i'.format(r, abs(i))) else: print('{:.2f}'.format(r)) elif i != 0: print('{:.2f}i'.format(i)) else: ...
"""October 5th, 2020: Write a Python function called counts that takes a list as input and returns a dictionary of unique items in the list as keys and the number of times each item appears as values. So, the input ['A', 'A', 'B', 'C', 'A'] should have output {'A': 3, 'B': 1, 'C': 1} . Your code should not depend o...
"""October 5th, 2020: Write a Python function called counts that takes a list as input and returns a dictionary of unique items in the list as keys and the number of times each item appears as values. So, the input ['A', 'A', 'B', 'C', 'A'] should have output {'A': 3, 'B': 1, 'C': 1} . Your code should not depend on an...
ei = 3 suu1 = int(ei) suu2 = int(ei*ei) suu3 = int(ei*ei*ei) print(suu1 + suu2 + suu3)
ei = 3 suu1 = int(ei) suu2 = int(ei * ei) suu3 = int(ei * ei * ei) print(suu1 + suu2 + suu3)
# Write your frequency_dictionary function here: def frequency_dictionary(words): freqs = {} for word in words: if word not in freqs: freqs[word] = 0 freqs[word] += 1 return freqs # Uncomment these function calls to test your function: print(frequency_dictionary(["apple", "apple", "cat", 1])) # sho...
def frequency_dictionary(words): freqs = {} for word in words: if word not in freqs: freqs[word] = 0 freqs[word] += 1 return freqs print(frequency_dictionary(['apple', 'apple', 'cat', 1])) print(frequency_dictionary([0, 0, 0, 0, 0]))
a = {} a["ad ad asd"] = 4 b = 4 if (b is a["ad ad asd"]): print("jaka") else: print ("luka") print (str([[0, 0, 0], [0, 0, 0], [0, 0, 0]]))
a = {} a['ad ad asd'] = 4 b = 4 if b is a['ad ad asd']: print('jaka') else: print('luka') print(str([[0, 0, 0], [0, 0, 0], [0, 0, 0]]))
def calc_percentage_at_k(test, pred, k): # sort scores, ascending pred, test = zip(*sorted(zip(pred, test))) pred, test = list(pred), list(test) pred.reverse() test.reverse() # calculates number of values to consider n_percentage = round(len(pred) * k / 100) # check if predicted is ...
def calc_percentage_at_k(test, pred, k): (pred, test) = zip(*sorted(zip(pred, test))) (pred, test) = (list(pred), list(test)) pred.reverse() test.reverse() n_percentage = round(len(pred) * k / 100) (tp, fp) = (0, 0) for i in range(n_percentage): if test[i] == 1: tp += 1 ...
print("Enter elements:") arr=list(map(int,input().split())) for i in range(1, len(arr)): val=arr[i] j=i-1 while j>=0 and val<arr[j]: arr[j+1]=arr[j] j-=1 arr[j+1]=val print(arr)
print('Enter elements:') arr = list(map(int, input().split())) for i in range(1, len(arr)): val = arr[i] j = i - 1 while j >= 0 and val < arr[j]: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = val print(arr)
class Solution: def maximumScore(self, nums: List[int], multipliers: List[int]) -> int: n, m = len(nums), len(multipliers) dp = [[0] * (m + 1) for _ in range(m + 1)] for i in range(m - 1, -1, -1): for left in range(i, -1, -1): mult = multipliers[i] ...
class Solution: def maximum_score(self, nums: List[int], multipliers: List[int]) -> int: (n, m) = (len(nums), len(multipliers)) dp = [[0] * (m + 1) for _ in range(m + 1)] for i in range(m - 1, -1, -1): for left in range(i, -1, -1): mult = multipliers[i] ...
HOST = 'localhost' PORT = 27017 # -- HTTP-SESSION Settings -- HTTP_SESSION_TOKEN_TIMEOUT = 0 HTTP_SESSION_TOKEN_SIZE = 24 # -- Existing Commands -- COMMANDS_UNKNOWN = ['login', 'me', 'asset', 'user', 'plugin'] COMMANDS_USER = ['login', 'user', 'me', 'asset', 'logout', 'plugin', 'document', 'following', 'followers', 'fo...
host = 'localhost' port = 27017 http_session_token_timeout = 0 http_session_token_size = 24 commands_unknown = ['login', 'me', 'asset', 'user', 'plugin'] commands_user = ['login', 'user', 'me', 'asset', 'logout', 'plugin', 'document', 'following', 'followers', 'follow'] commands_admin = [''].append(COMMANDS_USER) mace_...
# Time: O(n) # Space: O(n) # mono stack, prefix sum, optimized from solution2 class Solution(object): def totalStrength(self, strength): """ :type strength: List[int] :rtype: int """ MOD = 10**9+7 curr = 0 prefix = [0]*(len(strength)+1) for i in xran...
class Solution(object): def total_strength(self, strength): """ :type strength: List[int] :rtype: int """ mod = 10 ** 9 + 7 curr = 0 prefix = [0] * (len(strength) + 1) for i in xrange(len(strength)): curr = (curr + strength[i]) % MOD ...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param p, a tree node # @param q, a tree node # @return a boolean def isSameTree(self, p, q): if p ...
class Solution: def is_same_tree(self, p, q): if p == None or q == None: return p == q return p.val == q.val and self.isSameTree(p.left, q.left) and self.isSameTree(p.right, q.right)
sentence = "What is the Airspeed Velocity of an Unladen Swallow?".split() count = {word:len(word) for word in sentence} print(count)
sentence = 'What is the Airspeed Velocity of an Unladen Swallow?'.split() count = {word: len(word) for word in sentence} print(count)
"""Day 2 funcs""" def interpret_instructions(instructions: str) -> list[tuple[str, int]]: """Reads instructions and returns a list of directions and numbers""" ret: list[tuple[str, int]] = [] instruction_list = instructions.split("\n") for instruction in instruction_list: instruction_tokens = ...
"""Day 2 funcs""" def interpret_instructions(instructions: str) -> list[tuple[str, int]]: """Reads instructions and returns a list of directions and numbers""" ret: list[tuple[str, int]] = [] instruction_list = instructions.split('\n') for instruction in instruction_list: instruction_tokens = i...
skaitli = [1, 5, 3, 9, 7, 11, 4] skaitli2 = [5, 8, 12, 77, 44, 13] print(skaitli) print(skaitli[4]) sajauts_saraksts = ["Maris", 1, 2, 3, "Liepa", ["burkani", 12]] print(sajauts_saraksts) skaitli_kopa = skaitli + skaitli2 skaitli_kopa.sort() print(skaitli_kopa)
skaitli = [1, 5, 3, 9, 7, 11, 4] skaitli2 = [5, 8, 12, 77, 44, 13] print(skaitli) print(skaitli[4]) sajauts_saraksts = ['Maris', 1, 2, 3, 'Liepa', ['burkani', 12]] print(sajauts_saraksts) skaitli_kopa = skaitli + skaitli2 skaitli_kopa.sort() print(skaitli_kopa)
""" Helper to get relation to extractors, questions and their weights """ def weight_to_string(extractor, weight_index, question: str = None): """ naming for a weight :param extractor: :param weight_index: :return: """ if extractor == 'action': if weight_index == 0: ret...
""" Helper to get relation to extractors, questions and their weights """ def weight_to_string(extractor, weight_index, question: str=None): """ naming for a weight :param extractor: :param weight_index: :return: """ if extractor == 'action': if weight_index == 0: return...
TIME_FORMAT = "%Y-%m-%d, %H:%M:%S" FILE_TRAIN_DATA_STATS = "train_data_stats.txt" FILE_EVAL_DATA_STATS = "eval_data_stats.txt" FILE_PREV_EVAL_DATA_STATS = "prev_eval_data_stats.txt" FILE_DATA_SCHEMA = "schema.txt" FILE_EVAL_RESULT = "eval_result.txt" VALIDATION_SUCCESS = "success" VALIDATION_FAIL = "fail"
time_format = '%Y-%m-%d, %H:%M:%S' file_train_data_stats = 'train_data_stats.txt' file_eval_data_stats = 'eval_data_stats.txt' file_prev_eval_data_stats = 'prev_eval_data_stats.txt' file_data_schema = 'schema.txt' file_eval_result = 'eval_result.txt' validation_success = 'success' validation_fail = 'fail'
class Color(object): def __init__(self, r : float, g : float, b : float): self.r = r self.g = g self.b = b def tuple(self): return (self.r, self.g, self.b) class Gray(Color): # intensity bet def __init__(self, intensity : float): self.r = self.g = self.b = intensity self.intensity = int...
class Color(object): def __init__(self, r: float, g: float, b: float): self.r = r self.g = g self.b = b def tuple(self): return (self.r, self.g, self.b) class Gray(Color): def __init__(self, intensity: float): self.r = self.g = self.b = intensity self.inte...
# # PySNMP MIB module MPLS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:04:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
def RC(value, tolerance=5.0, power=None, package="0603",pkgcode="07"): res = {"manufacturer": "Yageo"} suffix = ['R', 'K', 'M'] digits = 3 if tolerance < 5 else 2 while value >= 1000: value = value/1000. suffix.pop(0) suffix = suffix[0] whole = str(int(value)) decimal = str(...
def rc(value, tolerance=5.0, power=None, package='0603', pkgcode='07'): res = {'manufacturer': 'Yageo'} suffix = ['R', 'K', 'M'] digits = 3 if tolerance < 5 else 2 while value >= 1000: value = value / 1000.0 suffix.pop(0) suffix = suffix[0] whole = str(int(value)) decimal = s...
class Animal(object): def run(self): print('Animal is running...') def eat(self): print('Animal is eating...') class Dog(Animal): def run(self): print('Dog is running...') class Cat(Animal): def __init__(self): self.name = 'Tom' def __str__(self): ret...
class Animal(object): def run(self): print('Animal is running...') def eat(self): print('Animal is eating...') class Dog(Animal): def run(self): print('Dog is running...') class Cat(Animal): def __init__(self): self.name = 'Tom' def __str__(self): retur...
x = [15 ,12, 8, 8, 7, 7, 7, 6, 5, 3] y = [10 ,25, 17, 11, 13, 17, 20, 13, 9, 15] n = len(x) xy = [x[i] * y[i] for i in range(n)] x_square = [x[i] * x[i] for i in range(n)] avg_x = sum(x) / n avg_y = sum(y) / n avg_xy = sum(xy) / n avg_xsqr = sum(x_square) / n m = ((avg_x * avg_y) - avg_xy) / (avg_x ** 2 - avg_xsqr) c =...
x = [15, 12, 8, 8, 7, 7, 7, 6, 5, 3] y = [10, 25, 17, 11, 13, 17, 20, 13, 9, 15] n = len(x) xy = [x[i] * y[i] for i in range(n)] x_square = [x[i] * x[i] for i in range(n)] avg_x = sum(x) / n avg_y = sum(y) / n avg_xy = sum(xy) / n avg_xsqr = sum(x_square) / n m = (avg_x * avg_y - avg_xy) / (avg_x ** 2 - avg_xsqr) c = a...
#MenuTitle: Activate all Bold instances # -*- coding: utf-8 -*- __doc__=""" Activate all Bold instances (and deactivates all others) Ignores instances where custom parameter "familyName" == "Master Condensed" or "Master Wide" """ thisFont = Glyphs.font Glyphs.clearLog() Glyphs.showMacroWindow() for instance in th...
__doc__ = '\nActivate all Bold instances (and deactivates all others)\nIgnores instances where custom parameter "familyName" == "Master Condensed" or "Master Wide"\n' this_font = Glyphs.font Glyphs.clearLog() Glyphs.showMacroWindow() for instance in thisFont.instances: if instance.active: instance.active = ...
""" Sorting the array into a wave-like array. For eg: arr[] = {1,2,3,4,5} Output: 2 1 4 3 5 """ def convertToWave(length,array): for i in range(0, length - length%2, 2): #swapping alternatively temp=array[i] array[i]=array[i+1] array[i+1]=temp return array arr = list(map...
""" Sorting the array into a wave-like array. For eg: arr[] = {1,2,3,4,5} Output: 2 1 4 3 5 """ def convert_to_wave(length, array): for i in range(0, length - length % 2, 2): temp = array[i] array[i] = array[i + 1] array[i + 1] = temp return array arr = list(map(int, input('Enter the el...
filename_prefix = 'Rebuttal-SawyerLift-ADR' xlabel = 'Environment steps (3M)' ylabel = "Average Discounted Rewards" mopa_cutoff_step = 1000000 others_cutoff_step = 2000000 max_step = 3000000 max_y_axis_value = 110 legend = False data_key = "train_ep/rew_discounted" bc_y_value = 34.77 plot_labels = { "Ours": [ ...
filename_prefix = 'Rebuttal-SawyerLift-ADR' xlabel = 'Environment steps (3M)' ylabel = 'Average Discounted Rewards' mopa_cutoff_step = 1000000 others_cutoff_step = 2000000 max_step = 3000000 max_y_axis_value = 110 legend = False data_key = 'train_ep/rew_discounted' bc_y_value = 34.77 plot_labels = {'Ours': ['Rebuttal_O...
class Credential: """ Class that generates new instances of users. """ credential_list = [] def __init__(self,credential_name,user_name,password,email): self.credential_name = credential_name self.user_name = user_name self.password = password self.email = email ...
class Credential: """ Class that generates new instances of users. """ credential_list = [] def __init__(self, credential_name, user_name, password, email): self.credential_name = credential_name self.user_name = user_name self.password = password self.email = email ...
def say_hello(): print('Hello') def say_goodbye(): print('Goodbye')
def say_hello(): print('Hello') def say_goodbye(): print('Goodbye')
# coding: utf-8 """***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * re...
"""***************************************************************************** * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to ...
_base_ = "./ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py" OUTPUT_DIR = "output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/glue" DATASETS = dict( TRAIN=("lm_real_glue_train",), TRAIN2=("lm_pbr_glue_train",), TRAIN2_RATIO=0.0, TEST=("lm_real_glue_test",) ) MODEL = dict( WEIGHTS="output/gd...
_base_ = './ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py' output_dir = 'output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/glue' datasets = dict(TRAIN=('lm_real_glue_train',), TRAIN2=('lm_pbr_glue_train',), TRAIN2_RATIO=0.0, TEST=('lm_real_glue_test',)) model = dict(WEIGHTS='output/gdrn/lm_pbr/r...
class DefaultConfigurations: @staticmethod def get(): return {}
class Defaultconfigurations: @staticmethod def get(): return {}
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/asyn.py') freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/core.py') freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/__init__.py') freeze('../../../../../../Micropython-Library-Development/lib...
freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/asyn.py') freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/core.py') freeze('../../../../../../Micropython-Library-Development/lib/', 'uasyncio/__init__.py') freeze('../../../../../../Micropython-Library-Development/lib...
name = "Bob" greeting = "Hello, Bob" print(greeting) name = "Rolf" print(greeting) greeting = f"Hello, {name}" print(greeting) # -- name = "Anne" print( greeting ) # This still prints "Hello, Rolf" because `greeting` was calculated earlier. print( f"Hello, {name}" ) # This is correct, since it uses `nam...
name = 'Bob' greeting = 'Hello, Bob' print(greeting) name = 'Rolf' print(greeting) greeting = f'Hello, {name}' print(greeting) name = 'Anne' print(greeting) print(f'Hello, {name}') greeting = 'Hello, {}' with_name = greeting.format('Rolf') print(with_name) longer_phrase = 'Hello, {}. Today is {}.' formatted = longer_ph...
""" Brian Kerninghan - Count the number of set bits in an integer Time Complexity - O(log n) Key idea: n & (n-1) """ def count(n): count = 0 while (n != 0): n = n & (n-1) count += 1 return count #n = int(raw_input("Enter any interger \n")) #print brian_kerninghan(n)
""" Brian Kerninghan - Count the number of set bits in an integer Time Complexity - O(log n) Key idea: n & (n-1) """ def count(n): count = 0 while n != 0: n = n & n - 1 count += 1 return count
class Player: def __init__(self, player_id: int, nickname: str, websocket, is_vip: bool = False): self.player_id = player_id self.nickname = nickname self.is_vip = is_vip self.websocket = websocket def __repr__(self): return 'Player({}, {})'.format(self.player_id, self.n...
class Player: def __init__(self, player_id: int, nickname: str, websocket, is_vip: bool=False): self.player_id = player_id self.nickname = nickname self.is_vip = is_vip self.websocket = websocket def __repr__(self): return 'Player({}, {})'.format(self.player_id, self.ni...
Word = "Hello" Letters = [] for w in Word: print(w) if w == "e": print("Funny") Letters.append(w) print(Letters) Numbers = [1,2,3,4,5] for l in Numbers: print(l) Numbers1 = [] # for num in range(10): for num in range(-1, 13, 3): Numbers.append(num) prin...
word = 'Hello' letters = [] for w in Word: print(w) if w == 'e': print('Funny') Letters.append(w) print(Letters) numbers = [1, 2, 3, 4, 5] for l in Numbers: print(l) numbers1 = [] for num in range(-1, 13, 3): Numbers.append(num) print(num) counter = 1 while counter <= 10: print(count...
def ROTRIGHT(i: int, bits: int) -> int: return i >> bits | i << 32 - bits # Two Extreme Bits (8 bits) def TEB(i: int) -> int: return ((i & 0x80) >> 6) | (i & 1) # Two Extreme Bits Reversed (8 bits) def TEBR(i: int) -> int: return (i & 0xFF) >> 7 | (i & 1) << 1 # Middles Extreme Bits (32 bits) def MEB(...
def rotright(i: int, bits: int) -> int: return i >> bits | i << 32 - bits def teb(i: int) -> int: return (i & 128) >> 6 | i & 1 def tebr(i: int) -> int: return (i & 255) >> 7 | (i & 1) << 1 def meb(i: int) -> int: return teb(i >> 24) << 6 | teb(i >> 16) << 4 | teb(i >> 8) << 2 | teb(i) lookup_reverse...
game = [[0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' ']] frame_counter = 0 # Ask score for frames for frame in game: if frame_counter < 4: shot_number = 0 for shot in range(2): game[frame_counter][shot_number] = int(input(f'Score for frame {frame_counter ...
game = [[0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' '], [0, 0, 0, ' ']] frame_counter = 0 for frame in game: if frame_counter < 4: shot_number = 0 for shot in range(2): game[frame_counter][shot_number] = int(input(f'Score for frame {frame_counter + 1}, shot {shot_number +...
# Prime Numbers, Sieve of Eratosthenes def prime_list(min_num, max_num): sieve = [True] * (max_num + 1) # Sieve of Eratosthenes m = int(max_num ** 0.5) # sqrt(n) for i in range(2, m + 1): if sieve[i] == True: for j in range(i+i, max_num+1, i): sieve[j] = False siev...
def prime_list(min_num, max_num): sieve = [True] * (max_num + 1) m = int(max_num ** 0.5) for i in range(2, m + 1): if sieve[i] == True: for j in range(i + i, max_num + 1, i): sieve[j] = False sieve[1] = False return [i for i in range(min_num, max_num + 1) if sieve...
class Status(object): """This encapsulates the Twitter reply to a tweet.""" def __init__(self, status): """This initializes the object storing metadata.""" self._status = status @property def id(self): return self._status.id @property def username(self): """Thi...
class Status(object): """This encapsulates the Twitter reply to a tweet.""" def __init__(self, status): """This initializes the object storing metadata.""" self._status = status @property def id(self): return self._status.id @property def username(self): """Thi...
letters = ['o', 's', 'h', 'a', 'd', 'a'] print(letters.index('h')) print(letters.index('d')) print(max(letters)) print(min(letters)) print(letters.count('a')) print(letters.remove('h')) #after remove r from the list print(letters) #reverse the whole list print(letters.reverse()) print(letters)
letters = ['o', 's', 'h', 'a', 'd', 'a'] print(letters.index('h')) print(letters.index('d')) print(max(letters)) print(min(letters)) print(letters.count('a')) print(letters.remove('h')) print(letters) print(letters.reverse()) print(letters)
def isPalindromeLinkedList(self, head: ListNode) -> bool: arr = [] while head: arr.append(head.val) head = head.next return arr == arr[::-1]
def is_palindrome_linked_list(self, head: ListNode) -> bool: arr = [] while head: arr.append(head.val) head = head.next return arr == arr[::-1]
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/1020/A def f(l): dist = lambda a,b:a-b if a>b else b-a global a,b ta,fa,tb,fb = l ht = dist(ta,tb) if (fa>=a and fa<=b) or (fb>=a and fb<=b) or ht==0: return ht + dist(fa,fb) return ht + min(dist(fa,a)+dist(fb,a),dist(f...
def f(l): dist = lambda a, b: a - b if a > b else b - a global a, b (ta, fa, tb, fb) = l ht = dist(ta, tb) if fa >= a and fa <= b or (fb >= a and fb <= b) or ht == 0: return ht + dist(fa, fb) return ht + min(dist(fa, a) + dist(fb, a), dist(fa, b) + dist(fb, b)) (n, h, a, b, k) = list(map...
#!/usr/bin/env python data = [ [ 7, [ 3.50016331673, 7.37909364700, 8.02381229401, 8.01285839081, 9.77704334259, 9.15692901611, 8.73682498932, 7.93067312241 ], ], [ 4.202, [ 2.06499981880, 2.08285713196, 2.18571448326, 2.1921432018...
data = [[7, [3.50016331673, 7.379093647, 8.02381229401, 8.01285839081, 9.77704334259, 9.15692901611, 8.73682498932, 7.93067312241]], [4.202, [2.0649998188, 2.08285713196, 2.18571448326, 2.19214320183, 2.19214320183, 2.19357180595, 2.19500041008, 2.19714307785]], [9.8592, [3.56500029564, 3.61142873764, 3.63214302063, 3....
def solution(string, markers): output = [] for line in string.split("\n"): containsCommentIndicator = "" for c in line: if c in markers: containsCommentIndicator = c break if containsCommentIndicator != "": line = line[:line.find(containsCommentIndicator)] line = line.rstrip(" ") output.appe...
def solution(string, markers): output = [] for line in string.split('\n'): contains_comment_indicator = '' for c in line: if c in markers: contains_comment_indicator = c break if containsCommentIndicator != '': line = line[:line.fin...
__author__ = 'The dashQC_fmri developers' __copyright__ = 'Copyright 2018, The SIMEXP lab' __credits__ = [ 'Jonathan Armoza', 'Pierre Bellec', 'Yassine Benhajali', 'Sebastian Urchs' ] __license__ = 'MIT' __maintainer__ = 'Sebastian Urchs' __email__ = 'sebastian.urchs@mail.mcgill.com' __status__ = 'Prototype' __url...
__author__ = 'The dashQC_fmri developers' __copyright__ = 'Copyright 2018, The SIMEXP lab' __credits__ = ['Jonathan Armoza', 'Pierre Bellec', 'Yassine Benhajali', 'Sebastian Urchs'] __license__ = 'MIT' __maintainer__ = 'Sebastian Urchs' __email__ = 'sebastian.urchs@mail.mcgill.com' __status__ = 'Prototype' __url__ = 'h...
__title__ = 'fipeapi' __description__ = 'Python Extra Oficial API for REST Request to consult Vehicles Prices.' __url__ = 'https://github.com/deibsoncarvalho/tabela-fipe-api' __version__ = '0.1.0' __author__ = 'Deibson Carvalho' __author_email__ = 'eu@deibsoncarvalho.com' __license__ = 'Apache 2.0' __copyright__ = 'Cop...
__title__ = 'fipeapi' __description__ = 'Python Extra Oficial API for REST Request to consult Vehicles Prices.' __url__ = 'https://github.com/deibsoncarvalho/tabela-fipe-api' __version__ = '0.1.0' __author__ = 'Deibson Carvalho' __author_email__ = 'eu@deibsoncarvalho.com' __license__ = 'Apache 2.0' __copyright__ = 'Cop...
def _update_Spr(Gp, Gr, Rpr, Spr_shape, I, B, t): # F Reconstruction F = np.zeros(Spr_shape) F += np.linalg.multi_dot((Gp.T, Rpr[0], Gr)) Gk = Gp * I[:, t][:, np.newaxis] Ik = np.reshape(I[:, t], (len(I[:, t]), 1)) bk = np.reshape(B[t, :], (1, len(B[t, :]))) F += 2*np.linalg.multi_dot((Gk.T,...
def _update__spr(Gp, Gr, Rpr, Spr_shape, I, B, t): f = np.zeros(Spr_shape) f += np.linalg.multi_dot((Gp.T, Rpr[0], Gr)) gk = Gp * I[:, t][:, np.newaxis] ik = np.reshape(I[:, t], (len(I[:, t]), 1)) bk = np.reshape(B[t, :], (1, len(B[t, :]))) f += 2 * np.linalg.multi_dot((Gk.T, Ik, bk)) a = Gp...
with open("vocab_origin.txt", "r") as f: lines = f.readlines() for i in range(185): lines.append("<s_{}>".format(i)) with open("vocab.txt", "w") as f: for line in lines: f.write(line.strip() + "\n")
with open('vocab_origin.txt', 'r') as f: lines = f.readlines() for i in range(185): lines.append('<s_{}>'.format(i)) with open('vocab.txt', 'w') as f: for line in lines: f.write(line.strip() + '\n')
# Go to http://apps.twitter.com and create an app. # The consumer key and secret will be generated for you API_KEY = "" API_SECRET_KEY = "" # After the step above, you will be redirected to your app's page. # Create an access token under the the "Your access token" section ACCESS_TOKEN = "" ACCESS_TOKEN_SECRET = ""
api_key = '' api_secret_key = '' access_token = '' access_token_secret = ''
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. UNTRIAGED = 0 TRIAGED_INCORRECT = 1 TRIAGED_CORRECT = 2 TRIAGED_UNSURE = 3 TRIAGE_STATUS_TO_DESCRIPTION = { UNTRIAGED: 'Untriaged', TRIAGED_INCORRE...
untriaged = 0 triaged_incorrect = 1 triaged_correct = 2 triaged_unsure = 3 triage_status_to_description = {UNTRIAGED: 'Untriaged', TRIAGED_INCORRECT: 'Incorrect', TRIAGED_CORRECT: 'Correct', TRIAGED_UNSURE: 'Unsure'}
#!/usr/bin/env python Nmp = 345 nbound = [0]*1037 step = 0 for l in open('test'): step += 1 for i in range(Nmp): if int(l[i]) > 0: nbound[i] += 1 for i in range(Nmp): print ('%i %i %f' % (i+1, nbound[i], nbound[i] / float(step)))
nmp = 345 nbound = [0] * 1037 step = 0 for l in open('test'): step += 1 for i in range(Nmp): if int(l[i]) > 0: nbound[i] += 1 for i in range(Nmp): print('%i %i %f' % (i + 1, nbound[i], nbound[i] / float(step)))
def file_upload(f): with open('static/upload/'+f.name,'wb+') as destination: for i in f.chunks(): destination.write(i)
def file_upload(f): with open('static/upload/' + f.name, 'wb+') as destination: for i in f.chunks(): destination.write(i)
def calculate_s(data_counts, qubit_indices, pauli_bases): number_of_data_points = 0 s = 0 #print("qubit_indices", qubit_indices) #print("pauli_bases", pauli_bases) #print("data_counts", data_counts.items()) # loop through indices and read measurments for key, value in data_counts.i...
def calculate_s(data_counts, qubit_indices, pauli_bases): number_of_data_points = 0 s = 0 for (key, value) in data_counts.items(): number_of_data_points += value number_of_1s = 0 for i in range(len(qubit_indices)): if key[qubit_indices[i]] == '1': if pauli...
def longest_linked_list_chain(keys, buckets, loops=10): """ Rolls `keys` number of random keys into `buckets` buckets and counts the collisions. Run `loops` number of times. """ for i in range(loops): key_counts = {} for i in range(buckets): key_counts[i] = 0 ...
def longest_linked_list_chain(keys, buckets, loops=10): """ Rolls `keys` number of random keys into `buckets` buckets and counts the collisions. Run `loops` number of times. """ for i in range(loops): key_counts = {} for i in range(buckets): key_counts[i] = 0 ...
lisi = 1 lisi1 = 1 lisi2 = 2 zhangsan3 = 3 lisi3 = 3 dev = 1
lisi = 1 lisi1 = 1 lisi2 = 2 zhangsan3 = 3 lisi3 = 3 dev = 1
#################################################################### # ### k8s_resource_keys.py ### #################################################################### # ### Author: SAS Institute Inc. ### ############################################...
class Kubernetesresourcekeys(object): """ Class providing static access to commonly used key names in Kubernetes resources (list is not all-inclusive). """ addresses = 'addresses' annotations = 'annotations' annotation_proxy_body_size = 'nginx.ingress.kubernetes.io/proxy-body-size' annotatio...
decimal = int(input("Decimal: ")) binary = "" while decimal != 0: rest = decimal % 2 binary = str(rest) + binary decimal = decimal // 2 print ("Binary: %s" % binary)
decimal = int(input('Decimal: ')) binary = '' while decimal != 0: rest = decimal % 2 binary = str(rest) + binary decimal = decimal // 2 print('Binary: %s' % binary)
def swap_in_place(arr, idx1, idx2): new_arr = arr[:] if idx1 > len(arr) - 1 or idx2 > len(arr) - 1: return arr new_arr.insert(idx1, new_arr.pop(idx2)) #print(new_arr) new_arr.insert(idx2, new_arr.pop(idx1 + 1)) return new_arr def test_case(arr, idx1, idx2, solution, test_func): out...
def swap_in_place(arr, idx1, idx2): new_arr = arr[:] if idx1 > len(arr) - 1 or idx2 > len(arr) - 1: return arr new_arr.insert(idx1, new_arr.pop(idx2)) new_arr.insert(idx2, new_arr.pop(idx1 + 1)) return new_arr def test_case(arr, idx1, idx2, solution, test_func): output = test_func(arr, ...
""" This file provides a library of music exception types that are used throughout the project to better report errors to the user. Exception Types: TabException - general exception type for the project used to report general errors in the tab that cannot be reported more specifically MeasureException - caused by the...
""" This file provides a library of music exception types that are used throughout the project to better report errors to the user. Exception Types: TabException - general exception type for the project used to report general errors in the tab that cannot be reported more specifically MeasureException - caused by the...
# you can use print for debugging purposes, e.g. # print "this is a debug message" # The strategy is to iterate through the string, putting each character onto # a specific stack, depending on its type. # A, When we put the character onto the stack, we check to see if the one before it # is an opposite - eg. { then }...
def solution(S): annihilate = {')': '(', ']': '[', '}': '{'} stack = [] if not S: return 1 for char in S: if char in annihilate.keys() and len(stack) > 0: if stack[-1] == annihilate[char]: stack.pop() else: stack.append(char) ...
""" Functions for positioning geometry """ def CheckFeasibility(newPart, candidatePositionIndex, sheet): candidatePosition = sheet.extremePoints[candidatePositionIndex] check = True for i in range(2): # check if violate sheet limits if newPart.Dim[i] + candidatePosition[i] > sheet.useableSize[i]: check =...
""" Functions for positioning geometry """ def check_feasibility(newPart, candidatePositionIndex, sheet): candidate_position = sheet.extremePoints[candidatePositionIndex] check = True for i in range(2): if newPart.Dim[i] + candidatePosition[i] > sheet.useableSize[i]: check = False f...
def prepare(base_class, engine): """ Reflect base class to current database engine. """ base_class.prepare(engine, reflect=True)
def prepare(base_class, engine): """ Reflect base class to current database engine. """ base_class.prepare(engine, reflect=True)
class Pattern_Twenty_Three: '''Pattern twenty_three ooooooooooooooooo ooooooooooooooooo ooooooooooooooooo oooo oooo oooo ooooooooooooooooo ooooooooooooooooo ooooooooooooooooo oooo oooo ...
class Pattern_Twenty_Three: """Pattern twenty_three ooooooooooooooooo ooooooooooooooooo ooooooooooooooooo oooo oooo oooo ooooooooooooooooo ooooooooooooooooo ooooooooooooooooo oooo oooo ...
expected_output = { 'chassis_feature': 'V2 AC PEM', 'clei': 'IPMUP00BRB', 'desc': 'ASR 9006 4 Line Card Slot Chassis with V2 AC PEM', 'device_family': 'ASR', 'device_series': '9006', 'num_line_cards': 4, 'pid': 'ASR-9006-AC-V2', 'rack_num': 0, 'sn': 'FOX1810G8LR', 'top_assy_num...
expected_output = {'chassis_feature': 'V2 AC PEM', 'clei': 'IPMUP00BRB', 'desc': 'ASR 9006 4 Line Card Slot Chassis with V2 AC PEM', 'device_family': 'ASR', 'device_series': '9006', 'num_line_cards': 4, 'pid': 'ASR-9006-AC-V2', 'rack_num': 0, 'sn': 'FOX1810G8LR', 'top_assy_num': '68-4235-02', 'vid': 'V02'}
directions_2 = [ [ 1, 0 ], [ 0, 1 ], [ 2, 0 ], [ 0, 2 ], [ 1, 1 ], [ 1, -1 ], [ 3, 0 ], [ 0, 3 ], [ 1, 2 ], [ 2, 1 ], [ 1, -2 ], [-2, 1 ], [ 4, 0 ], [ 0, 4 ], [ 1, 3 ], [ 3, 1 ], [ 1, -3 ], [-3, 1 ], [ 2, 2 ], [ 2, -2 ], [ 5, 0 ], [ 0, 5 ], [ 1, 4 ...
directions_2 = [[1, 0], [0, 1], [2, 0], [0, 2], [1, 1], [1, -1], [3, 0], [0, 3], [1, 2], [2, 1], [1, -2], [-2, 1], [4, 0], [0, 4], [1, 3], [3, 1], [1, -3], [-3, 1], [2, 2], [2, -2], [5, 0], [0, 5], [1, 4], [4, 1], [1, -4], [-4, 1], [2, 3], [3, 2], [2, -3], [-3, 2], [-1, 0], [0, -1], [-2, 0], [0, -2], [-1, -1], [-1, 1],...
ALL_NODES_TYPE = '<all>' ALL_PRIMITIVES_TYPES = '<all-primitives>' ALL_REGION_TYPES = '<all-regions>' ALL_CONDITIONS_TYPES = '<all-conditions>' LOCATION_OR_WAYPOINT = '<location-or-waypoint>' STRING_TYPE = '<string>' NUMBER_TYPE = '<number>' BOOLEAN_TYPE = '<boolean>' ENUM_TYPE = '<enum>' ARBITRARY_OBJ_TYPE = '<arbit...
all_nodes_type = '<all>' all_primitives_types = '<all-primitives>' all_region_types = '<all-regions>' all_conditions_types = '<all-conditions>' location_or_waypoint = '<location-or-waypoint>' string_type = '<string>' number_type = '<number>' boolean_type = '<boolean>' enum_type = '<enum>' arbitrary_obj_type = '<arbitra...
# 2021-02-08 # Emma Benjaminson # Implementation of Linked List # for ch2-p1 (at least) # need init, delete methods (possibly traverse?) # singly linked list for now # class Node # this will contain init method # attribute is next which is pointer to the next node class Node: def __init__(self, data): s...
class Node: def __init__(self, data): self.data = data self.next = None def __repr__(self): return self.data class Linkedlist: def __init__(self, nodes=None): self.head = None if nodes is not None: node = node(data=nodes.pop(0)) self.head =...
#To find first index of an element in an array. def firstIndex(arr, si, x): l = len(arr) #length of array. if l == 0: #base case return -1 if arr[si] == x: #if element is found at start index of an array then return that index. return si return firstIndex(arr, si+1, x) #recursive call...
def first_index(arr, si, x): l = len(arr) if l == 0: return -1 if arr[si] == x: return si return first_index(arr, si + 1, x) arr = [] n = int(input('Enter size of array : ')) for i in range(n): ele = int(input()) arr.append(ele) x = int(input('Enter element to be searched ')) pri...
rest_api_version = 99 extensions = dict( required_params=['training_frame', 'x'], validate_required_params="", set_required_params=""" parms$training_frame <- training_frame if(!missing(x)) parms$ignored_columns <- .verify_datacols(training_frame, x)$cols_ignore """, with_model=""" model@model$aggreg...
rest_api_version = 99 extensions = dict(required_params=['training_frame', 'x'], validate_required_params='', set_required_params='\nparms$training_frame <- training_frame\nif(!missing(x))\n parms$ignored_columns <- .verify_datacols(training_frame, x)$cols_ignore\n', with_model='\nmodel@model$aggregated_frame_id <- mo...
# SPDX-License-Identifier: MIT # Copyright (c) 2020 Akumatic # #https://adventofcode.com/2020/day/12 def readFile() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return [line.strip() for line in f.readlines()] def part1(input: list) -> int: x, y = 0, 0 dirs = ((1,0), (0, ...
def read_file() -> list: with open(f"{__file__.rstrip('code.py')}input.txt", 'r') as f: return [line.strip() for line in f.readlines()] def part1(input: list) -> int: (x, y) = (0, 0) dirs = ((1, 0), (0, 1), (-1, 0), (0, -1)) idx = 0 for instruction in input: action = instruction[0] ...
print("Please inser the following") print() adjective = input("adjetive: ") animal = input("animal: ") verb1 = input("verb: ") exclamation = input("exclamation: ") verb2 = input ("verb: ") verb3 = input("verb: ") print() print() print("Your story is: ") print() print(f"The other day, I was really in trouble. It all sta...
print('Please inser the following') print() adjective = input('adjetive: ') animal = input('animal: ') verb1 = input('verb: ') exclamation = input('exclamation: ') verb2 = input('verb: ') verb3 = input('verb: ') print() print() print('Your story is: ') print() print(f"The other day, I was really in trouble. It all star...