content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/python3 nCoreData = { #nCore username between quotation marks "username": "", #nCore password between quotation marks "password": "", #Waiting time before checking the torrent(s) "timeDuration": 90 }
n_core_data = {'username': '', 'password': '', 'timeDuration': 90}
#!/usr/bin/env python3 ''' Python Implementation of Quick Select input : array of values, n (index @ which value is required) output : Value of element at nth index of array ''' def QuickSelect(arr, n): print(arr, n) pivot = arr[0] left = [x for x in arr[1:] if x < pivot] right = [x for x in arr[1:] if x >= pivo...
""" Python Implementation of Quick Select input : array of values, n (index @ which value is required) output : Value of element at nth index of array """ def quick_select(arr, n): print(arr, n) pivot = arr[0] left = [x for x in arr[1:] if x < pivot] right = [x for x in arr[1:] if x >= pivot] index...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def leafSimilar(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool: def get_leaves(...
class Solution: def leaf_similar(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) -> bool: def get_leaves(root, leaves): if root: if not root.left and (not root.right): leaves.append(root.val) else: get_leaves(r...
description = 'Virtual Analyzer devices' group = 'lowlevel' excludes = ['analyzer'] devices = dict( ana = device('nicos.devices.tas.Monochromator', description = 'virtual analyzer', unit = 'A-1', dvalue = 3.355, theta = 'ath', twotheta = 'att', focush = None, ...
description = 'Virtual Analyzer devices' group = 'lowlevel' excludes = ['analyzer'] devices = dict(ana=device('nicos.devices.tas.Monochromator', description='virtual analyzer', unit='A-1', dvalue=3.355, theta='ath', twotheta='att', focush=None, focusv=None, abslimits=(0.1, 10), scatteringsense=1, crystalside=1), ath=de...
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) l=list() for i in range(x+1): for j in range(y+1): for k in range(z+1): if(i+j+k!=n): l.append([i,j,k]) print(l) ...
if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) l = list() for i in range(x + 1): for j in range(y + 1): for k in range(z + 1): if i + j + k != n: l.append([i, j, k]) print(l)
class Node: def __init__(self, data): self.data = data def __str__(self): return f'Node > {self.data}' class Edge: def __init__(self, Node , weight): self.Node = Node self.weight = weight class Graph: def __init__(self): self.adjacency_list = {} def add_no...
class Node: def __init__(self, data): self.data = data def __str__(self): return f'Node > {self.data}' class Edge: def __init__(self, Node, weight): self.Node = Node self.weight = weight class Graph: def __init__(self): self.adjacency_list = {} def add_...
store = dict() fhand = open('words.txt') count = 0 words = fhand.read().split() for i in words: count += 1 if i in store: continue store[i] = count print(store) if 'is' in store: print('True') else: print('False')
store = dict() fhand = open('words.txt') count = 0 words = fhand.read().split() for i in words: count += 1 if i in store: continue store[i] = count print(store) if 'is' in store: print('True') else: print('False')
PROTO = "bolt" USER = "neo4j" PASSWORD = "MyStrongPassword" HOSTNAME = "0.0.0.0" PORT = "8000"
proto = 'bolt' user = 'neo4j' password = 'MyStrongPassword' hostname = '0.0.0.0' port = '8000'
expected_output = { 'vrf': { 'default': { 'address_family': { 'ipv4': { 'instance': { '1': { 'areas': { '0.0.0.0': { 'area_id': '0.0.0.0',...
expected_output = {'vrf': {'default': {'address_family': {'ipv4': {'instance': {'1': {'areas': {'0.0.0.0': {'area_id': '0.0.0.0', 'area_type': 'normal', 'existed': '2d05h', 'authentication': 'Message-digest', 'numbers': {'active_interfaces': 3, 'interfaces': 4, 'loopback_interfaces': 1, 'passive_interfaces': 0}, 'stati...
#Copyright (c) 2021 Rauan Asetov #License: http://opensource.org/licenses/MIT #Repetition MaxValue = 1000000 MinValue = 0 #Time DefaultTime = 3 #Url DefaultUrl = 'http://127.0.0.1'
max_value = 1000000 min_value = 0 default_time = 3 default_url = 'http://127.0.0.1'
def asterisc_it(n): if isinstance(n, list): for i in range(len(n)): n[i] = str(n[i]) n_str = ''.join(n) else: n_str = str(n) prev = False result = "" for s in n_str: if int(s) % 2 == 0: if prev == True: result = re...
def asterisc_it(n): if isinstance(n, list): for i in range(len(n)): n[i] = str(n[i]) n_str = ''.join(n) else: n_str = str(n) prev = False result = '' for s in n_str: if int(s) % 2 == 0: if prev == True: result = result + '*' ...
def info_command(packages): if 'clang' in packages: packages[packages.index('clang')] = 'llvm' return 'sudo pkg rquery "%n %v %dn=%dv" {}'.format(' '.join(packages)) def parse_info(output): info = {} output = output.strip() lines = output.split("\n") for line in lines: pkg, v...
def info_command(packages): if 'clang' in packages: packages[packages.index('clang')] = 'llvm' return 'sudo pkg rquery "%n %v %dn=%dv" {}'.format(' '.join(packages)) def parse_info(output): info = {} output = output.strip() lines = output.split('\n') for line in lines: (pkg, ver...
# A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). # # Write a function to determine if a number is strobogrammatic. The number is represented as a string. # # Example 1: # # Input: "69" # Output: true # Example 2: # # Input: "88" # Output: true # Example 3: #...
class Solution: def is_strobogrammatic(self, num): dict = {'6': '9', '9': '6', '8': '8', '0': '0', '1': '1'} pointer = len(num) - 1 nums = [] while pointer >= 0: if num[pointer] not in dict: return False nums.append(dict[num[pointer]]) ...
def solution(n): res = [0, 1] if n >= 2: for i in range(2, n + 1): fibo = (res[i - 1] + res[i - 2]) % 1234567 res.append(fibo) return res[n] print(solution(5))
def solution(n): res = [0, 1] if n >= 2: for i in range(2, n + 1): fibo = (res[i - 1] + res[i - 2]) % 1234567 res.append(fibo) return res[n] print(solution(5))
# Modified Kaprekar Numbers # Developer: Murillo Grubler # Link: https://www.hackerrank.com/challenges/kaprekar-numbers/problem # Time complexity: O(n) # Complete the kaprekarNumbers function below. def kaprekarNumbers(p, q): values = [] if p == 0 or p == 1: values.append(1) p = 2 for i in...
def kaprekar_numbers(p, q): values = [] if p == 0 or p == 1: values.append(1) p = 2 for i in range(p, q + 1): num = str(i ** 2) if len(num) > 1: (left_number, right_number) = (int(num[:len(num) // 2]), int(num[len(num) // 2:])) if left_number + right_n...
def column_from_index(text, token): last_cr = text.rfind('\n', 0, token.index) if last_cr < 0: last_cr = -1 return token.index - last_cr
def column_from_index(text, token): last_cr = text.rfind('\n', 0, token.index) if last_cr < 0: last_cr = -1 return token.index - last_cr
__author__ = 'adriangrepo' VERSION = "0.10.5a" BASEPATH = "VelocityModelling/VelocityData/data/" ISOCALCSPATH = BASEPATH+"IsoCalcs/" ISOCALCSOUTPUTPATH = ISOCALCSPATH+"Output/" PLOTSOUTPUTPATH = ISOCALCSOUTPUTPATH+"Plots/" MISSINGCALCSPATH = BASEPATH+"MissingCalcs/" DELTACALCSPATH = BASEPATH+"DeltaCalcs/" TESTDATAPA...
__author__ = 'adriangrepo' version = '0.10.5a' basepath = 'VelocityModelling/VelocityData/data/' isocalcspath = BASEPATH + 'IsoCalcs/' isocalcsoutputpath = ISOCALCSPATH + 'Output/' plotsoutputpath = ISOCALCSOUTPUTPATH + 'Plots/' missingcalcspath = BASEPATH + 'MissingCalcs/' deltacalcspath = BASEPATH + 'DeltaCalcs/' tes...
# # PySNMP MIB module XYLAN-POS3-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-POS3-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:45:19 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) ...
# File: antenna.py # Description: An antenna that sends and receives packets from a channel # Last Modified: May 9, 2018 # Modified By: Sky Hoffert class Antenna(): '''Antenna used for sending data''' def __init__(self): self._type = '' self._gain = 0.0 self._pattern = ( ...
class Antenna: """Antenna used for sending data""" def __init__(self): self._type = '' self._gain = 0.0 self._pattern = ([], [], []) def send_packet(self, packet, channel): channel.enter(packet)
class Solution: def isPalindrome(self, number: int) -> bool: if number == 0: return True if number % 10 == 0 or number < 0: return False right = 0 while number > right: right = 10 * right + number % 10 number //= 10 return number == right or (number =...
class Solution: def is_palindrome(self, number: int) -> bool: if number == 0: return True if number % 10 == 0 or number < 0: return False right = 0 while number > right: right = 10 * right + number % 10 number //= 10 return num...
class MyError(Exception): pass def run(): raise MyError('my error message')
class Myerror(Exception): pass def run(): raise my_error('my error message')
class LoginError(Exception): def __init__(self, username, password): self.username = username self.password = password def __str__(self): return f'{self.username} {self.password} is wrong' class TooManyReqError(Exception): def __str__(self): return 'You have sent too many r...
class Loginerror(Exception): def __init__(self, username, password): self.username = username self.password = password def __str__(self): return f'{self.username} {self.password} is wrong' class Toomanyreqerror(Exception): def __str__(self): return 'You have sent too many...
def convert_sample_to_shot_persona(sample, with_knowledge=None): prefix = "Persona Information:\n" for s in sample["meta"]: prefix += s+"\n" prefix += "Dialogue:\n" for turn in sample["dialogue"]: prefix += f"User: {turn[0]}" +"\n" if turn[1] == "": prefix += f"Perso...
def convert_sample_to_shot_persona(sample, with_knowledge=None): prefix = 'Persona Information:\n' for s in sample['meta']: prefix += s + '\n' prefix += 'Dialogue:\n' for turn in sample['dialogue']: prefix += f'User: {turn[0]}' + '\n' if turn[1] == '': prefix += f'Per...
def standard_encode(i,N): format_style = '0' + str(N) + 'b' return format(i, format_style) def gray_code(i,N): gray=i^(i>>1) return "{0:0{1}b}".format(gray,N)
def standard_encode(i, N): format_style = '0' + str(N) + 'b' return format(i, format_style) def gray_code(i, N): gray = i ^ i >> 1 return '{0:0{1}b}'.format(gray, N)
# The esdt_dir can be looked up at # https://goldsmr4.gesdisc.eosdis.nasa.gov/data/ # https://goldsmr5.sci.gsfc.nasa.gov/data/ var_list = { "dewpt": { "esdt_dir": "M2T1NXSLV.5.12.4", "collection": "tavg1_2d_slv_Nx", "merra_name": "T2MDEW", "standard_name": "dew_point_temperature", ...
var_list = {'dewpt': {'esdt_dir': 'M2T1NXSLV.5.12.4', 'collection': 'tavg1_2d_slv_Nx', 'merra_name': 'T2MDEW', 'standard_name': 'dew_point_temperature', 'cell_methods': 'time: mean', 'least_significant_digit': 3}, 'evspsbl': {'esdt_dir': 'M2T1NXFLX.5.12.4', 'collection': 'tavg1_2d_flx_Nx', 'merra_name': 'EVAP', 'standa...
## Copyright 2018 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. load(":check_protocol_compatibility.bzl", _ProtocolCompatibilityInfo = "ProtocolCompatibilityInfo") _protocol_generated = [ "gen/src/inspector/protoc...
load(':check_protocol_compatibility.bzl', _ProtocolCompatibilityInfo='ProtocolCompatibilityInfo') _protocol_generated = ['gen/src/inspector/protocol/Forward.h', 'gen/src/inspector/protocol/Protocol.cpp', 'gen/src/inspector/protocol/Protocol.h', 'gen/src/inspector/protocol/Console.cpp', 'gen/src/inspector/protocol/Conso...
class ModelAmigo: def __init__(self, dado_txt): self.dado_txt = dado_txt self.pessoa_envia_id = None self.pessoa_aceite_id = None self.data_envio_convite = None self.data_aceite_convite = None self.data_recuse_convite = None def tratar_dados(self): self.pessoa_envia_id = self.dado_txt[0] self.pessoa...
class Modelamigo: def __init__(self, dado_txt): self.dado_txt = dado_txt self.pessoa_envia_id = None self.pessoa_aceite_id = None self.data_envio_convite = None self.data_aceite_convite = None self.data_recuse_convite = None def tratar_dados(self): self....
def initialize(context): context.spy = sid(8554) context.sso = sid(32270) def handle_data(context, data): mavg1 = data[context.spy].mavg(75) mavg2 = data[context.spy].mavg(425) if mavg1 > mavg2: order_target_percent(context.sso, 1.00) elif mavg1 < mavg2: order_target_percent(c...
def initialize(context): context.spy = sid(8554) context.sso = sid(32270) def handle_data(context, data): mavg1 = data[context.spy].mavg(75) mavg2 = data[context.spy].mavg(425) if mavg1 > mavg2: order_target_percent(context.sso, 1.0) elif mavg1 < mavg2: order_target_percent(cont...
## Is this a triangle? ## 7 kyu ## https://www.codewars.com/kata/56606694ec01347ce800001b def is_triangle(a, b, c): return sum([a,b,c]) - max([a,b,c]) > max([a,b,c])
def is_triangle(a, b, c): return sum([a, b, c]) - max([a, b, c]) > max([a, b, c])
def print_shapes(x_train, y_train, x_valid, y_valid, x_test, y_test): print('\nTrain set shape: Input {} Target {}'.format(x_train.shape, y_train.shape)) print('Valid set shape: Input {} Target {}'.format(x_valid.shape, y_valid.shape)) print('Test set shape: Input {} Target {}\n'.format(x_test.shape, y_test...
def print_shapes(x_train, y_train, x_valid, y_valid, x_test, y_test): print('\nTrain set shape: Input {} Target {}'.format(x_train.shape, y_train.shape)) print('Valid set shape: Input {} Target {}'.format(x_valid.shape, y_valid.shape)) print('Test set shape: Input {} Target {}\n'.format(x_test.shape, y_test...
# Implements the vigenere cipher message = 'barry is the spy' encrypted = 'dfc aruw fsti gr vjtwhr wznj? vmph otis! cbx swv jipreneo uhllj kpi rahjib eg fjdkwkedhmp!' alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' encryptionKey = 'friends' keyword = 'dog' def encrypt(message, key): result = '' message = ...
message = 'barry is the spy' encrypted = 'dfc aruw fsti gr vjtwhr wznj? vmph otis! cbx swv jipreneo uhllj kpi rahjib eg fjdkwkedhmp!' alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' encryption_key = 'friends' keyword = 'dog' def encrypt(message, key): result = '' message = message.lower() key = key.lower() i =...
s = 0 i = 0 for c in range(1, 501, 2): if c%3==0: s += c i += 1 print(i) print(f'A soma de todos os numeros impares multiplos de 3 e {s}')
s = 0 i = 0 for c in range(1, 501, 2): if c % 3 == 0: s += c i += 1 print(i) print(f'A soma de todos os numeros impares multiplos de 3 e {s}')
# Input - [1,2,3,4,[5,6,7,8],[9,10]] # Output - [1,2,3,4,5,6,7,8,9,10] lst = [1,2,3,4,[5,6,7,8],[9,10]] flat = [] for sub in lst: if isinstance(sub, list): flat.extend(sub) else: flat.append(sub)
lst = [1, 2, 3, 4, [5, 6, 7, 8], [9, 10]] flat = [] for sub in lst: if isinstance(sub, list): flat.extend(sub) else: flat.append(sub)
#Ricky Deegan # a function to square numbers def power(x, y): ans = x y = y -1 while y > 0: ans = ans * x y = y - 1 return ans print (power (2, 3))
def power(x, y): ans = x y = y - 1 while y > 0: ans = ans * x y = y - 1 return ans print(power(2, 3))
def max_profit(price, s, e): if e <= s: return 0 profit = 0 for i in range(s, e): for j in range(i + 1, end + 1): if price[j] > price[i]: curr_profit = price[j] - price[i] + max_profit(price, s, i - 1) + max_profit(price, j + 1, ...
def max_profit(price, s, e): if e <= s: return 0 profit = 0 for i in range(s, e): for j in range(i + 1, end + 1): if price[j] > price[i]: curr_profit = price[j] - price[i] + max_profit(price, s, i - 1) + max_profit(price, j + 1, e) day_to_buy.appen...
count = 0 def createBoard(): row = [0 for i in range(9)] board = [row.copy() for i in range(10)] return board def printBoard(board): for i in range(9): for j in range(9): print(board[i][j], end="") print() # board = createBoard() # printBoard(board) def isValidArray(a)...
count = 0 def create_board(): row = [0 for i in range(9)] board = [row.copy() for i in range(10)] return board def print_board(board): for i in range(9): for j in range(9): print(board[i][j], end='') print() def is_valid_array(a): freq = [0 for i in range(11)] n = ...
# -*- coding: utf-8 -*- ''' File name: code\counting_binary_matrices\sol_626.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #626 :: Counting Binary Matrices # # For more information see: # https://projecteuler.net/problem=626 # Problem ...
""" File name: code\\counting_binary_matrices\\sol_626.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nA binary matrix is a matrix consisting entirely of 0s and 1s. Consider the following transformations that can be performed on a binary matrix:\n\nSwap any two rows\nSwap a...
class BaseStrategy(object): def get_next_move(self, board): raise NotImplentedError class MoveFirst(BaseStrategy): pass
class Basestrategy(object): def get_next_move(self, board): raise NotImplentedError class Movefirst(BaseStrategy): pass
def main0(): x: i32 x = (2+3)*5 print(x) main0() # Not implemented yet in LPython: #if __name__ == "__main__": # main()
def main0(): x: i32 x = (2 + 3) * 5 print(x) main0()
age = input("How old are you? ") height = input("How tall are you? ") weight = input("How much do you weight? ") print("So, you're", age," old,", height," tall and ", weight," heavy.")
age = input('How old are you? ') height = input('How tall are you? ') weight = input('How much do you weight? ') print("So, you're", age, ' old,', height, ' tall and ', weight, ' heavy.')
#----------------------------------------------- def indice(item, lista): if item in lista: return lista[item] else: return None #----------------------------------------------- # testes lista = [1, "oi", 3.14, 7, True] # teste 1 if indice("oi",lista) == 1: print("Passou no primeiro te...
def indice(item, lista): if item in lista: return lista[item] else: return None lista = [1, 'oi', 3.14, 7, True] if indice('oi', lista) == 1: print('Passou no primeiro teste! :-)') else: print('Nao passou no primeiro teste! :-(') if indice(True, lista) == 4: print('Passou no segundo ...
class ValidateResponseMixin: def _is_response_ok(self): raise NotImplementedError() def _get_error(self): raise NotImplementedError() def validate(self, raise_exception=True): if self._is_response_ok(): return error = self._get_error() if raise_exception...
class Validateresponsemixin: def _is_response_ok(self): raise not_implemented_error() def _get_error(self): raise not_implemented_error() def validate(self, raise_exception=True): if self._is_response_ok(): return error = self._get_error() if raise_exce...
n = int(input()) arr = [int(x) for x in input().split()] X = sum(arr) X -= 1 r = X % (n+1) count = 0 # print("sum", X) for f in range(5): r += 1 r %= (n+1) if r == 0: count += 1 print(5-count)
n = int(input()) arr = [int(x) for x in input().split()] x = sum(arr) x -= 1 r = X % (n + 1) count = 0 for f in range(5): r += 1 r %= n + 1 if r == 0: count += 1 print(5 - count)
class ConsoleColours: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' FOREGROUND_BLACK = '\33[30m' FOREGROUND_RED = '\33[31m' FOREGROUND_GREEN ...
class Consolecolours: header = '\x1b[95m' okblue = '\x1b[94m' okcyan = '\x1b[96m' okgreen = '\x1b[92m' warning = '\x1b[93m' fail = '\x1b[91m' endc = '\x1b[0m' bold = '\x1b[1m' underline = '\x1b[4m' foreground_black = '\x1b[30m' foreground_red = '\x1b[31m' foreground_green...
COUNTERS = { 'packets', 'unicast packets', 'bytes', 'error packets', 'discard packets', 'pause packets' } def name_to_metric(name: str) -> str: return 'switch_port_' + name.replace(' ', '_') + '_total'
counters = {'packets', 'unicast packets', 'bytes', 'error packets', 'discard packets', 'pause packets'} def name_to_metric(name: str) -> str: return 'switch_port_' + name.replace(' ', '_') + '_total'
# https://leetcode.com/problems/combinations/ class Solution: def combine(self, n: int, k: int) -> List[List[int]]: res = [] combo = [] def backtrack(start): #basecase if len(combo) == k: res.append(combo[:]) return ...
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: res = [] combo = [] def backtrack(start): if len(combo) == k: res.append(combo[:]) return for i in range(start, n + 1): combo.append(i) ...
def check_idl_python_bridge(input_arg): print('Python: ' + input_arg) if True: output_arg = input_arg else: output_arg = '' return output_arg
def check_idl_python_bridge(input_arg): print('Python: ' + input_arg) if True: output_arg = input_arg else: output_arg = '' return output_arg
def missingNumbers(arr, brr): difference = [] unique_numbers = set(brr) for number in unique_numbers: times_in_brr = brr.count(number) times_in_arr = arr.count(number) if times_in_brr != times_in_arr: difference.append(number) return difference
def missing_numbers(arr, brr): difference = [] unique_numbers = set(brr) for number in unique_numbers: times_in_brr = brr.count(number) times_in_arr = arr.count(number) if times_in_brr != times_in_arr: difference.append(number) return difference
class MyClass(object): # Defining class def __init__(self, x, y, z): self.var1 = x # public data member self._var2 = y # protected data member self.__var3 = z # private data member obj = MyClass(3,4,5) print(obj.var1) obj.var1 = 10 print(obj.var1) print(obj._var2) obj._var2 = 12 p...
class Myclass(object): def __init__(self, x, y, z): self.var1 = x self._var2 = y self.__var3 = z obj = my_class(3, 4, 5) print(obj.var1) obj.var1 = 10 print(obj.var1) print(obj._var2) obj._var2 = 12 print(obj._var2)
# # PySNMP MIB module SONUS-TRUNK-GROUP-RESOURCES-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SONUS-TRUNK-GROUP-RESOURCES-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:02:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pytho...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ...
#!/usr/bin/env python ''' Copyright (C) 2019, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'Oracle Cloud (Oracle)' def is_waf(self): schemes = [ self.matchContent(r'<title>fw_error_www'), self.matchContent(r'src=\"/oralogo_small\.gif\"'), self.matchContent(r...
""" Copyright (C) 2019, WAFW00F Developers. See the LICENSE file for copying permission. """ name = 'Oracle Cloud (Oracle)' def is_waf(self): schemes = [self.matchContent('<title>fw_error_www'), self.matchContent('src=\\"/oralogo_small\\.gif\\"'), self.matchContent('www\\.oracleimg\\.com/us/assets/metrics/ora_ocom...
''' Problem Statement : That Is My Score Link : https://www.codechef.com/DEC19B/problems/WATSCORE Score : 100 ''' test = int(input()) for t in range(test): submissions = int(input()) data = {key:[0] for key in range(1,12)} for sub in range(submissions): pi,si = ...
""" Problem Statement : That Is My Score Link : https://www.codechef.com/DEC19B/problems/WATSCORE Score : 100 """ test = int(input()) for t in range(test): submissions = int(input()) data = {key: [0] for key in range(1, 12)} for sub in range(submissions): (pi, si) = input()....
# --- Day 1: Not Quite Lisp --- f = open("input.txt", "r").read() floor = 0 i = 1 basement_trigger = -1 for c in f: if c == "(": floor += 1 elif c == ")": floor -= 1 if floor < 0 and basement_trigger == -1: basement_trigger = i else: i += 1 print("The instructions take Santa to floor " + str(floor) + "...
f = open('input.txt', 'r').read() floor = 0 i = 1 basement_trigger = -1 for c in f: if c == '(': floor += 1 elif c == ')': floor -= 1 if floor < 0 and basement_trigger == -1: basement_trigger = i else: i += 1 print('The instructions take Santa to floor ' + str(floor) + '....
# 1. Define a function named is_two. It should accept one input and return True if the passed input is either the number or the string 2, False otherwise. def is_two(x): return x == '2' or x == 2 # 2. Define a function named is_vowel. It should return True if the passed string is a vowel, False otherwise. def is...
def is_two(x): return x == '2' or x == 2 def is_vowel(letter): return letter == 'a' or letter == 'e' or letter == 'i' or (letter == 'o') or (letter == 'u') def is_consonant(letter): letters = 'abcdefghijklmnopqrstuvwxyz' return len(letter) == 1 and letter.isalpha() and (not is_vowel(letter)) is_conson...
#Implemente um programa que calcule o ano de nascimento #de uma pessoa a partir de sua idade e do ano atual. idade=int(input("Informe sua idade: ")) ano_atual=2021 ano_nasc=2021-idade print(f"O ano de nascimento eh {ano_nasc}")
idade = int(input('Informe sua idade: ')) ano_atual = 2021 ano_nasc = 2021 - idade print(f'O ano de nascimento eh {ano_nasc}')
LIST_STATE_FEATURE = [ "cur_phase_index", "lane_vehicle_cnt", "time_this_phase", "stop_vehicle_thres1", "lane_queue_length", "lane_vehicle_left_cnt", "lane_waiting_time", "terminal" ] DIC_REWARD_INFO = { "sum_lane_queue_length": 0, "sum_lane_wait_time": 0, "sum_lane_vehicle...
list_state_feature = ['cur_phase_index', 'lane_vehicle_cnt', 'time_this_phase', 'stop_vehicle_thres1', 'lane_queue_length', 'lane_vehicle_left_cnt', 'lane_waiting_time', 'terminal'] dic_reward_info = {'sum_lane_queue_length': 0, 'sum_lane_wait_time': 0, 'sum_lane_vehicle_left_cnt': 0, 'sum_duration_vehicle_left': 0, 's...
# CS+ startup python script ThrowExceptSave = common.ThrowExcept common.ThrowExcept = True try: if ScriptStarted == True: pass except: ScriptStarted = False common.ThrowExcept = ThrowExceptSave del ThrowExceptSave if ScriptStarted == False: ScriptStarted = True common.Hook(__file__) def After...
throw_except_save = common.ThrowExcept common.ThrowExcept = True try: if ScriptStarted == True: pass except: script_started = False common.ThrowExcept = ThrowExceptSave del ThrowExceptSave if ScriptStarted == False: script_started = True common.Hook(__file__) def after_download(): throw_exc...
N=int(input()) if N==1: print(0) exit() i,sosu=2,True while i*i<=N: if N%i==0: sosu=False break i+=1 if sosu: i=N print(N-N//i)
n = int(input()) if N == 1: print(0) exit() (i, sosu) = (2, True) while i * i <= N: if N % i == 0: sosu = False break i += 1 if sosu: i = N print(N - N // i)
# # PySNMP MIB module Juniper-PACKET-MIRROR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-PACKET-MIRROR-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:03:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, constraints_intersection, value_range_constraint, single_value_constraint) ...
# # PySNMP MIB module UDPLITE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UDPLITE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:21:15 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, 0...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
class Ssid(object): def __init__(self, db): self.db = db def get_clients(self, client=None): c = self.db.cursor() d = self.db.cursor() if client: search_criteria = 'and client = ?' search_params = (client,) else: search_criteria = '' ...
class Ssid(object): def __init__(self, db): self.db = db def get_clients(self, client=None): c = self.db.cursor() d = self.db.cursor() if client: search_criteria = 'and client = ?' search_params = (client,) else: search_criteria = '' ...
class SpicerError(Exception): pass class SpiceError(SpicerError): def __init__(self, function): self.function = function def __str__(self): return "SPICE: Calulating {} failed.".format(self.function) class MissingParameterError(SpicerError): def __init__(self, txt): self.txt...
class Spicererror(Exception): pass class Spiceerror(SpicerError): def __init__(self, function): self.function = function def __str__(self): return 'SPICE: Calulating {} failed.'.format(self.function) class Missingparametererror(SpicerError): def __init__(self, txt): self.txt...
def merge(head1, head2): temp=None if head1==None: return head2 if head2==None: return head1 if head1.data<=head2.data: temp=head1 temp.next=merge(head1.next,head2) else: temp=head2 temp.next=merge(head1,head2.next) return temp def mergeKLists...
def merge(head1, head2): temp = None if head1 == None: return head2 if head2 == None: return head1 if head1.data <= head2.data: temp = head1 temp.next = merge(head1.next, head2) else: temp = head2 temp.next = merge(head1, head2.next) return temp d...
def sjfScheduling(processesArray, executionTimeArray, periodArray, arrivalTimeArray, logFile) : exec_count = 0 LCM = max((map(lambda x: x[1], processesArray))) while 1: ind = 0 for j in range(0, len(processesArray)): if LCM % processesArray[j][1] == 0: ind = ind +...
def sjf_scheduling(processesArray, executionTimeArray, periodArray, arrivalTimeArray, logFile): exec_count = 0 lcm = max(map(lambda x: x[1], processesArray)) while 1: ind = 0 for j in range(0, len(processesArray)): if LCM % processesArray[j][1] == 0: ind = ind + 1...
class Solution: def canConstruct(self, ransomNote: str, magazine: str) -> bool: for i in ransomNote: if i in magazine: magazine=magazine.replace(i,'',1) else: return False return True
class Solution: def can_construct(self, ransomNote: str, magazine: str) -> bool: for i in ransomNote: if i in magazine: magazine = magazine.replace(i, '', 1) else: return False return True
num = str(input()) [int(i) for i in str(num)] n = sorted(num, reverse=True) print(n) if n[0] > n[1]: print(n[1]) else: buf = 0 for j in n: if n[buf] < n[0]: print(n[buf]) break else: buf += 1
num = str(input()) [int(i) for i in str(num)] n = sorted(num, reverse=True) print(n) if n[0] > n[1]: print(n[1]) else: buf = 0 for j in n: if n[buf] < n[0]: print(n[buf]) break else: buf += 1
def do_twice(f, x): f(x) f(x) def print_spam(x): print(x) do_twice(print_spam, 'Bem vindo')
def do_twice(f, x): f(x) f(x) def print_spam(x): print(x) do_twice(print_spam, 'Bem vindo')
def run(program): ip, a, seen = 0, 0, set() while ip not in seen and ip < len(program): seen.add(ip) op, arg = program[ip] if op == "acc": a += int(arg) elif op == "jmp": ip += int(arg) - 1 ip += 1 return ('loop' if ip in seen else 'ended', a) def make_terminate(pr...
def run(program): (ip, a, seen) = (0, 0, set()) while ip not in seen and ip < len(program): seen.add(ip) (op, arg) = program[ip] if op == 'acc': a += int(arg) elif op == 'jmp': ip += int(arg) - 1 ip += 1 return ('loop' if ip in seen else 'ended...
class BitCode: def __init__(self): pass '''Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 3] return 2.''' def missingNumber(self, nums): x = 0 for i in range(len(nums)+1):...
class Bitcode: def __init__(self): pass 'Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, \n find the one that is missing from the array.\n For example,Given nums = [0, 1, 3] return 2.' def missing_number(self, nums): x = 0 for i in range(len(nums) + 1...
def read_fastas(fp): name, seq = None, [] for line in fp: line = line.rstrip() if line.startswith(">"): line = line[1:] if name: yield (name, ''.join(seq)) name, seq = line, [] else: seq.append(line) if name: yield (name, ''.join(seq)) ...
def read_fastas(fp): (name, seq) = (None, []) for line in fp: line = line.rstrip() if line.startswith('>'): line = line[1:] if name: yield (name, ''.join(seq)) (name, seq) = (line, []) else: seq.append(line) if name: ...
total = 0 for x in range(0, 1000): if x % 5 == 0 or x % 3 == 0: total += x print(str(total))
total = 0 for x in range(0, 1000): if x % 5 == 0 or x % 3 == 0: total += x print(str(total))
def twoDimensional(arr): sumCollection = [] for i in range(0, len(arr)-2): for j in range(0, len(arr[i])-2): a = arr[i][j] b = arr[i][j+1] c = arr[i][j+2] d = arr[i+1][j+1] e = arr[i+2][j] f = arr[i+2][j+1] g = arr[i+2]...
def two_dimensional(arr): sum_collection = [] for i in range(0, len(arr) - 2): for j in range(0, len(arr[i]) - 2): a = arr[i][j] b = arr[i][j + 1] c = arr[i][j + 2] d = arr[i + 1][j + 1] e = arr[i + 2][j] f = arr[i + 2][j + 1] ...
class Solution: def minimumEffort(self, tasks: List[List[int]]) -> int: # minimum effort needed lo = sum(actual for actual, min_required in tasks) hi = sum(min_required for actual, min_required in tasks) max_min_required = max(min_required for _, min_required in tasks) lo = m...
class Solution: def minimum_effort(self, tasks: List[List[int]]) -> int: lo = sum((actual for (actual, min_required) in tasks)) hi = sum((min_required for (actual, min_required) in tasks)) max_min_required = max((min_required for (_, min_required) in tasks)) lo = max(lo, max_min_req...
def findFrequency(string1): all_freq = dict() for i in string1: if i in all_freq: all_freq[i] += 1 else: all_freq[i] = 1 return "Count of all characters in this string is :\n {}".format(str(all_freq)) if __name__ == '__main__': string1 = input("Enter the strin...
def find_frequency(string1): all_freq = dict() for i in string1: if i in all_freq: all_freq[i] += 1 else: all_freq[i] = 1 return 'Count of all characters in this string is :\n {}'.format(str(all_freq)) if __name__ == '__main__': string1 = input('Enter the string: ...
# https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/ class Solution: def countNegatives(self, grid: List[List[int]]) -> int: count = 0 for i in range(0, len(grid)): for j in range(0, len(grid[0])): if grid[i][j] < 0: ...
class Solution: def count_negatives(self, grid: List[List[int]]) -> int: count = 0 for i in range(0, len(grid)): for j in range(0, len(grid[0])): if grid[i][j] < 0: count += 1 return count
walk = input() ans, add = 1, 1 for char in walk: if char == 'L': ans *= 2 elif char == 'R': ans = 2 * ans + add elif char == '*': ans = 5 * ans + add add = 3 * add print(ans)
walk = input() (ans, add) = (1, 1) for char in walk: if char == 'L': ans *= 2 elif char == 'R': ans = 2 * ans + add elif char == '*': ans = 5 * ans + add add = 3 * add print(ans)
class BreadthFirstSearch: def __init__(self, graph, start): self.marked = [] self.edgeTo = [] self.bfs(graph, start) def bfs(self, graph, start): queue = [start] self.marked[start] = True while len(queue) > 0: v = queue.pop(0) for w in gr...
class Breadthfirstsearch: def __init__(self, graph, start): self.marked = [] self.edgeTo = [] self.bfs(graph, start) def bfs(self, graph, start): queue = [start] self.marked[start] = True while len(queue) > 0: v = queue.pop(0) for w in gr...
#!/usr/bin/env python # https://www.codechef.com/APRIL21A/problems/CHAOSEMP/ LIMIT = 10**18 # with d = 0 we just do binary search def solve0(): x0 = y0 = -LIMIT x1 = y1 = LIMIT while True: x = (x0 + x1) // 2 y = (y0 + y1) // 2 print('1 {} {}'.format(x, y)) ans = input() ...
limit = 10 ** 18 def solve0(): x0 = y0 = -LIMIT x1 = y1 = LIMIT while True: x = (x0 + x1) // 2 y = (y0 + y1) // 2 print('1 {} {}'.format(x, y)) ans = input() if ans == 'FAILED' or ans == 'O': return if ans[0] == 'N': x0 = x + 1 ...
#!/usr/bin/env python3 config = { 'genius_api_token': '', 'artists_input_file': 'artists.json', 'lyrics_result_file': 'lyrics.json', 'stats_result_file': 'stats.json', 'analyze_threshold': 10000 }
config = {'genius_api_token': '', 'artists_input_file': 'artists.json', 'lyrics_result_file': 'lyrics.json', 'stats_result_file': 'stats.json', 'analyze_threshold': 10000}
grid = { 'labels': { 'subscribed subjects': { 'row': 0, 'column': 3, "rowspan": 1, "columnspan": 1, 'sticky': 's', 'padx': 0, 'pady': 0 }, "possible subjects": { "row": 0, "column": 0,...
grid = {'labels': {'subscribed subjects': {'row': 0, 'column': 3, 'rowspan': 1, 'columnspan': 1, 'sticky': 's', 'padx': 0, 'pady': 0}, 'possible subjects': {'row': 0, 'column': 0, 'rowspan': 1, 'columnspan': 1, 'sticky': 's', 'padx': 0, 'pady': 0}}, 'buttons': {'subscribe': {'row': 1, 'column': 2, 'rowspan': 1, 'column...
no_file = "There is no file field" no_selected_file = "No file has been selected", wrong_extension = "Only .png, .jpg and .jpeg files are allowed" failed_ocr = "OCR failed"
no_file = 'There is no file field' no_selected_file = ('No file has been selected',) wrong_extension = 'Only .png, .jpg and .jpeg files are allowed' failed_ocr = 'OCR failed'
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/1196/A t = int(input()) for _ in range(t): l = list(map(int,input().split())) print(sum(l)//2)
t = int(input()) for _ in range(t): l = list(map(int, input().split())) print(sum(l) // 2)
SAMPLE_RATE = 16000 SPEC_HOP_LENGTH = 512 SPEC_DIM = 229 MIN_PITCH = 21 MAX_PITCH = 108
sample_rate = 16000 spec_hop_length = 512 spec_dim = 229 min_pitch = 21 max_pitch = 108
class Node: key = None value = None def __init__(self, key, value): self.key = key self.value = value self.next = None self.prev = None def __repr__(self): return '<Node key={} next={} prev={} />'.format( self.key, self.next.key if self....
class Node: key = None value = None def __init__(self, key, value): self.key = key self.value = value self.next = None self.prev = None def __repr__(self): return '<Node key={} next={} prev={} />'.format(self.key, self.next.key if self.next else '', self.prev.ke...
class Blue: def __init__(self): self.test = "test" def get_value(self): return 1 def catch_me_if_you_can(self): return 0 def get_blue_value(self): return "blue" def get_purple_value(self): return "purple" class Cat: def __init__(self): self.t...
class Blue: def __init__(self): self.test = 'test' def get_value(self): return 1 def catch_me_if_you_can(self): return 0 def get_blue_value(self): return 'blue' def get_purple_value(self): return 'purple' class Cat: def __init__(self): self....
# From https://github.com/ricequant/rqalpha/issues/5 def init(context): context.stocks = ['000300.XSHG', '000905.XSHG', '000012.XSHG'] def handle_bar(context, bar_dict): [hs, zz, gz] = context.stocks history20 = history(20, '1d', 'close') hsIncrease = history20[hs][-1] - history20[hs][0] zzIncrease = histo...
def init(context): context.stocks = ['000300.XSHG', '000905.XSHG', '000012.XSHG'] def handle_bar(context, bar_dict): [hs, zz, gz] = context.stocks history20 = history(20, '1d', 'close') hs_increase = history20[hs][-1] - history20[hs][0] zz_increase = history20[zz][-1] - history20[zz][0] positio...
local_server_config: dict = { # 'host': 'localhost', 'host': '0.0.0.0', "publicPath": "/", "disableHostCheck": True, }
local_server_config: dict = {'host': '0.0.0.0', 'publicPath': '/', 'disableHostCheck': True}
''' Implementation of a Simplex Solver object. It detects when the optimal resolution was found and has a step() method where one full iteration will be the doneself. The vertex method returns the optimal solution. ''' class SimplexSolver: def __init__(self, a, b, c, basis, clean_c_row = False): self.a = a...
""" Implementation of a Simplex Solver object. It detects when the optimal resolution was found and has a step() method where one full iteration will be the doneself. The vertex method returns the optimal solution. """ class Simplexsolver: def __init__(self, a, b, c, basis, clean_c_row=False): self.a = a ...
__author__ = 'thurley' class Htmlwriter: # file object def __init__(self, filename): self.f = open(filename, 'w') def make_document(self, head, body): self.f.write("<!DOCTYPE html>\n<html>") self.f.write("<header>" + head + "</header>")...
__author__ = 'thurley' class Htmlwriter: def __init__(self, filename): self.f = open(filename, 'w') def make_document(self, head, body): self.f.write('<!DOCTYPE html>\n<html>') self.f.write('<header>' + head + '</header>') self.f.write('<body>' + body + '</body>') self...
def simple_assembler(program): res={} index=0 while index<len(program): command=program[index].split(" ") if command[0]=="mov": try: res[command[1]]=int(command[2]) except: res[command[1]]=res[command[2]] elif command[0]=="inc":...
def simple_assembler(program): res = {} index = 0 while index < len(program): command = program[index].split(' ') if command[0] == 'mov': try: res[command[1]] = int(command[2]) except: res[command[1]] = res[command[2]] elif comm...
def do_a_thing(): print("I am doing a thing ") def do_another_thing(): print("I am doing another thing ")
def do_a_thing(): print('I am doing a thing ') def do_another_thing(): print('I am doing another thing ')
# [Silent Crusade] Chance? Or Fate? STARLING = 9120221 BLACK_WING_HENCHMAN = 9300470 sm.setSpeakerID(STARLING) sm.sendNext("They're going to launch their attack any moment! " "We'll all be beaten if we let it happen! Take them down!") for i in range(7): sm.spawnMob(BLACK_WING_HENCHMAN, -391, 64, Fals...
starling = 9120221 black_wing_henchman = 9300470 sm.setSpeakerID(STARLING) sm.sendNext("They're going to launch their attack any moment! We'll all be beaten if we let it happen! Take them down!") for i in range(7): sm.spawnMob(BLACK_WING_HENCHMAN, -391, 64, False) sm.startQuest(parentID)
a = abs(int(input())) b = abs(int(input())) c = abs(int(input())) x = 0 if a % 2 == 0: x = x + 1 elif b % 2 == 0: x = x + 1 elif c % 2 == 0: x = x + 1 if a > 0 and a % 2 == 1: x = x + 1 elif b > 0 and b % 2 == 1: x = x + 1 elif c > 0 and c % 2 == 1: x = x + 1 if x == 2: ...
a = abs(int(input())) b = abs(int(input())) c = abs(int(input())) x = 0 if a % 2 == 0: x = x + 1 elif b % 2 == 0: x = x + 1 elif c % 2 == 0: x = x + 1 if a > 0 and a % 2 == 1: x = x + 1 elif b > 0 and b % 2 == 1: x = x + 1 elif c > 0 and c % 2 == 1: x = x + 1 if x == 2: print('YES') else: ...
def is_armstrong_number(number): digits = list(map(int, str(number))) number_of_digits = len(digits) sum = 0 for digit in digits: sum += digit**number_of_digits return True if sum == number else False
def is_armstrong_number(number): digits = list(map(int, str(number))) number_of_digits = len(digits) sum = 0 for digit in digits: sum += digit ** number_of_digits return True if sum == number else False
print ('Script Aula 1 - Desafio 1') print ('Crie um script python que leia o nome de uma pessoa e mostra uma mensagemde boas vindas de acordo com o valor digitado') nome = input ('Qual seu nome?') print ('Seja bem vindo gafanhoto', nome)
print('Script Aula 1 - Desafio 1') print('Crie um script python que leia o nome de uma pessoa e mostra uma mensagemde boas vindas de acordo com o valor digitado') nome = input('Qual seu nome?') print('Seja bem vindo gafanhoto', nome)
#!/usr/bin/env python3 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 __version__ = "0.0.1" __author__ = "Rafael Rivero"
__version__ = '0.0.1' __author__ = 'Rafael Rivero'
def swap_diagonal(m): n=len(m) for i in range(n): m[i][i],m[i][n-i-1]=m[i][n-i-1],m[i][i] for i in range(n): for j in range(n): print(m[i][j],end=' ') print(' ') matrix = [[0, 1, 2], [3, 4, 5], [6, 7, 8]] # swap diagon...
def swap_diagonal(m): n = len(m) for i in range(n): (m[i][i], m[i][n - i - 1]) = (m[i][n - i - 1], m[i][i]) for i in range(n): for j in range(n): print(m[i][j], end=' ') print(' ') matrix = [[0, 1, 2], [3, 4, 5], [6, 7, 8]] swap_diagonal(matrix)
dolar = float(input("Digite o valor em dolares: ")) def calcReais(dolar): reais = dolar * 2.4 print("Reais: ", reais) calcReais(dolar)
dolar = float(input('Digite o valor em dolares: ')) def calc_reais(dolar): reais = dolar * 2.4 print('Reais: ', reais) calc_reais(dolar)
def checkio(expr): stack = [] for c in expr: if c in set(["{", "[", "("]): stack.append(c) if c == "}": if len(stack) <= 0 or stack[-1] != "{": return False stack.pop() if c == "]": if len(stack) <= 0 or stack[-1] != "[": ...
def checkio(expr): stack = [] for c in expr: if c in set(['{', '[', '(']): stack.append(c) if c == '}': if len(stack) <= 0 or stack[-1] != '{': return False stack.pop() if c == ']': if len(stack) <= 0 or stack[-1] != '[': ...
# # PySNMP MIB module CISCO-SNAPSHOT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SNAPSHOT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:55:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_union, single_value_constraint, constraints_intersection, value_range_constraint) ...