content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
base_rf.fit(X_train, y_train)
under_rf.fit(X_train, y_train)
over_rf.fit(X_train, y_train)
plot_roc_and_precision_recall_curves([
("original", base_rf),
("undersampling", under_rf),
("oversampling", over_rf),
]) | base_rf.fit(X_train, y_train)
under_rf.fit(X_train, y_train)
over_rf.fit(X_train, y_train)
plot_roc_and_precision_recall_curves([('original', base_rf), ('undersampling', under_rf), ('oversampling', over_rf)]) |
# The view that is shown for normal use of this app
# Button name for front page
SUPERUSER_SETTINGS_VIEW = 'twitterapp.views.site_setup'
| superuser_settings_view = 'twitterapp.views.site_setup' |
'''Write a Python program to empty a variable without destroying it.
Sample data: n=20
d = {"x":200}
Expected Output : 0
{}'''
n = 20
d = {"x":200}
print(type(n)())
print(type(d)()) | """Write a Python program to empty a variable without destroying it.
Sample data: n=20
d = {"x":200}
Expected Output : 0
{}"""
n = 20
d = {'x': 200}
print(type(n)())
print(type(d)()) |
{
"name": "Module Wordpess Mysql",
"author": "Tedezed",
"version": "0.1",
"frontend": "wordpress",
"backend": "mysql",
"check_app": True,
"update_app_password": True,
"update_secret": True,
"executable": False,
}
| {'name': 'Module Wordpess Mysql', 'author': 'Tedezed', 'version': '0.1', 'frontend': 'wordpress', 'backend': 'mysql', 'check_app': True, 'update_app_password': True, 'update_secret': True, 'executable': False} |
# Copyright (c) 2011-2020 Eric Froemling
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# -----------------------------------------------------------------------------
# This file was automatically generated from "doom_shroom.ma"
# pylint: disable=all
points = {}
# noinspection PyDictCreation
boxes = {}
boxes['area_of_interest_bounds'] = (0.4687647786, 2.320345088,
-3.219423694) + (0.0, 0.0, 0.0) + (
21.34898078, 10.25529817, 14.67298352)
points['ffa_spawn1'] = (-5.828122667, 2.301094498,
-3.445694701) + (1.0, 1.0, 2.682935578)
points['ffa_spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1.0, 1.0,
2.682935578)
points['ffa_spawn3'] = (0.8835145921, 2.307217208,
-0.3552854962) + (4.455517747, 1.0, 0.2723037175)
points['ffa_spawn4'] = (0.8835145921, 2.307217208,
-7.124335491) + (4.455517747, 1.0, 0.2723037175)
points['flag1'] = (-7.153737138, 2.251993091, -3.427368878)
points['flag2'] = (8.103769491, 2.320591215, -3.548878069)
points['flag_default'] = (0.5964565429, 2.373456481, -4.241969517)
boxes['map_bounds'] = (0.4566560559, 1.332051421, -3.80651373) + (
0.0, 0.0, 0.0) + (27.75073129, 14.44528216, 22.9896617)
points['powerup_spawn1'] = (5.180858712, 4.278900266, -7.282758712)
points['powerup_spawn2'] = (-3.236908759, 4.159702067, -0.3232556512)
points['powerup_spawn3'] = (5.082843398, 4.159702067, -0.3232556512)
points['powerup_spawn4'] = (-3.401729203, 4.278900266, -7.425891191)
points['shadow_lower_bottom'] = (0.5964565429, -0.2279530265, 3.368035253)
points['shadow_lower_top'] = (0.5964565429, 0.6982784189, 3.368035253)
points['shadow_upper_bottom'] = (0.5964565429, 5.413250948, 3.368035253)
points['shadow_upper_top'] = (0.5964565429, 7.891484473, 3.368035253)
points['spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0,
2.682935578)
points['spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1.0, 1.0,
2.682935578)
| points = {}
boxes = {}
boxes['area_of_interest_bounds'] = (0.4687647786, 2.320345088, -3.219423694) + (0.0, 0.0, 0.0) + (21.34898078, 10.25529817, 14.67298352)
points['ffa_spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0, 2.682935578)
points['ffa_spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1.0, 1.0, 2.682935578)
points['ffa_spawn3'] = (0.8835145921, 2.307217208, -0.3552854962) + (4.455517747, 1.0, 0.2723037175)
points['ffa_spawn4'] = (0.8835145921, 2.307217208, -7.124335491) + (4.455517747, 1.0, 0.2723037175)
points['flag1'] = (-7.153737138, 2.251993091, -3.427368878)
points['flag2'] = (8.103769491, 2.320591215, -3.548878069)
points['flag_default'] = (0.5964565429, 2.373456481, -4.241969517)
boxes['map_bounds'] = (0.4566560559, 1.332051421, -3.80651373) + (0.0, 0.0, 0.0) + (27.75073129, 14.44528216, 22.9896617)
points['powerup_spawn1'] = (5.180858712, 4.278900266, -7.282758712)
points['powerup_spawn2'] = (-3.236908759, 4.159702067, -0.3232556512)
points['powerup_spawn3'] = (5.082843398, 4.159702067, -0.3232556512)
points['powerup_spawn4'] = (-3.401729203, 4.278900266, -7.425891191)
points['shadow_lower_bottom'] = (0.5964565429, -0.2279530265, 3.368035253)
points['shadow_lower_top'] = (0.5964565429, 0.6982784189, 3.368035253)
points['shadow_upper_bottom'] = (0.5964565429, 5.413250948, 3.368035253)
points['shadow_upper_top'] = (0.5964565429, 7.891484473, 3.368035253)
points['spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0, 2.682935578)
points['spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1.0, 1.0, 2.682935578) |
#!/usr/bin/python
# -*- utf-8 -*-
class Solution:
# @param nums, a list of integer
# @param k, num of steps
# @return nothing, please modify the nums list in-place.
def rotate(self, nums, k):
copy = [e for e in nums]
l = len(nums)
k = l - k % l
for i in range(l):
nums[i] = copy[(k + i) % l]
def rotate2(self, nums, k):
if not nums:
return
l = len(nums)
for i in range(k % l):
last = nums[-1]
for j in range(l-1, 0, -1):
nums[j] = nums[j-1]
nums[0] = last
def rotate3(self, nums, k):
# Todo third method
# Fixme rotate([1, 2, 3, 4, 5, 6], 2)
if not nums:
return
l = len(nums)
k = k % l
if k == 0:
return
last = nums[0]
cur = k
for e in nums:
nums[cur], last = last, nums[cur]
cur = (cur + k) % l
if __name__ == '__main__':
s = Solution()
l = [1, 2, 3, 4, 5, 6, 7]
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 0)
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 3)
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 6)
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 9)
print(l)
l = [1, 2, 3, 4, 5, 6]
s.rotate(l, 2)
print(l)
| class Solution:
def rotate(self, nums, k):
copy = [e for e in nums]
l = len(nums)
k = l - k % l
for i in range(l):
nums[i] = copy[(k + i) % l]
def rotate2(self, nums, k):
if not nums:
return
l = len(nums)
for i in range(k % l):
last = nums[-1]
for j in range(l - 1, 0, -1):
nums[j] = nums[j - 1]
nums[0] = last
def rotate3(self, nums, k):
if not nums:
return
l = len(nums)
k = k % l
if k == 0:
return
last = nums[0]
cur = k
for e in nums:
(nums[cur], last) = (last, nums[cur])
cur = (cur + k) % l
if __name__ == '__main__':
s = solution()
l = [1, 2, 3, 4, 5, 6, 7]
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 0)
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 3)
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 6)
print(l)
l = [1, 2, 3, 4, 5, 6, 7]
s.rotate(l, 9)
print(l)
l = [1, 2, 3, 4, 5, 6]
s.rotate(l, 2)
print(l) |
# Enter your code for "camelCase" here.
def to_camel(ident):
def a(x):
return x
def b(x):
return x[0].upper() + x[1::]
def c():
yield a
while True:
yield b
d = c()
return "".join(d.__next__()(x) for x in ident.split("_"))
| def to_camel(ident):
def a(x):
return x
def b(x):
return x[0].upper() + x[1:]
def c():
yield a
while True:
yield b
d = c()
return ''.join((d.__next__()(x) for x in ident.split('_'))) |
# Write a program that asks the user to input any positive integer
# and outputs the successive values of the following calculation.
# At each step calculate the next value by taking the current value and,
# if it is even, divide it by two, but if it is odd, multiply it by three and add one.
# Have the program end if the current value is one.
# There is an ambiguity in the question, however:
# What if the user enters one?
# I chose not to end the program immediately in this case.
# In order not to end the program immediately if the user
# enters one, a 'while (x != 1)': loop will not work.
# Instead, a 'while true:' loop can be used, which breaks
# once 'x = 1'. I appreciate that 'while true:' is not
# generally considered best practice, but the absence of
# of a 'do-while' loop in python makes this unavoidable.
# Store the user's input as an integer.
x = int(input("Enter a positive integer and see what happens: "))
print(x)
# As there is no do-while loop built into Python,
# Use a 'while-true' loop that ends (with 'break') once the relevant variable equals one.
while True:
# To calculate the variable's next value, use an if-else block:
# to determine if the variable is even, use the modulus operator (x % 2 = 0);
# in all other cases the variable is odd.
if x % 2 == 0:
# use floor division '//' so that an integer rather than a float results.
x = x // 2
print(x)
else:
x = (x * 3) + 1
print(x)
if x == 1:
break
| x = int(input('Enter a positive integer and see what happens: '))
print(x)
while True:
if x % 2 == 0:
x = x // 2
print(x)
else:
x = x * 3 + 1
print(x)
if x == 1:
break |
class BatmanQuotes(object):
@staticmethod
def get_quote(quotes, hero):
index = int(sorted(hero)[0])
return {'B':'Batman: ','R':'Robin: ','J':'Joker: '}[hero[0]] + quotes[index]
| class Batmanquotes(object):
@staticmethod
def get_quote(quotes, hero):
index = int(sorted(hero)[0])
return {'B': 'Batman: ', 'R': 'Robin: ', 'J': 'Joker: '}[hero[0]] + quotes[index] |
class Node:
starting = True
ending = False
name = ""
weight = [1, 20]
active = True
edge_length = 0
nodes = []
def __init__(self, name, grid, posX, posY, active):
self.name = name # Name of the node
self.grid = grid # Which grid the node will be placed
self.posX = posX # Position X on the grid
self.posY = posY # Position Y on the grid
self.active = active # Is active
pass
def add(self, newNode):
#To DO
self.nodes.append(newNode)
print("Added new node")
pass
def remove(self, node):
#To DO
self.nodes = []
print("The node has been removed")
pass
def update(self, index, node):
self.nodes.pop(index)
self.nodes.insert(index, node)
print("The node has been updated")
pass
| class Node:
starting = True
ending = False
name = ''
weight = [1, 20]
active = True
edge_length = 0
nodes = []
def __init__(self, name, grid, posX, posY, active):
self.name = name
self.grid = grid
self.posX = posX
self.posY = posY
self.active = active
pass
def add(self, newNode):
self.nodes.append(newNode)
print('Added new node')
pass
def remove(self, node):
self.nodes = []
print('The node has been removed')
pass
def update(self, index, node):
self.nodes.pop(index)
self.nodes.insert(index, node)
print('The node has been updated')
pass |
#!/usr/bin/env python3
dna = "ATGCAGGGGAAACATGATTCAGGAC"
#Make all lowercase
lowerDNA = dna.lower()
#Replace the complementary ones
complA = lowerDNA.replace('a','T')
complAT = complA.replace('t','A')
complATG = complAT.replace('g','C')
complATGC = complATG.replace('c','G')
#reverse the complement
revDNA = complATGC[::-1]
#Print out the answers
print("Original Sequence\t5'",dna,"5'")
print("Complement\t\t3'",complATGC,"5'")
print("Reverse Complement\t5'",revDNA,"3'")
| dna = 'ATGCAGGGGAAACATGATTCAGGAC'
lower_dna = dna.lower()
compl_a = lowerDNA.replace('a', 'T')
compl_at = complA.replace('t', 'A')
compl_atg = complAT.replace('g', 'C')
compl_atgc = complATG.replace('c', 'G')
rev_dna = complATGC[::-1]
print("Original Sequence\t5'", dna, "5'")
print("Complement\t\t3'", complATGC, "5'")
print("Reverse Complement\t5'", revDNA, "3'") |
# with open("ReadMe.txt",'r') as file:
# print(file.read()) # Hello from Python 201
# # Running after adding the second line to the .txt file
# with open("ReadMe.txt",'r') as file:
# print(file.read()) # Hello from Python 201
# # This is a new line
# # Running after adding the second line to the .txt file
# with open("ReadMe.txt",'r') as file:
# pass
# print(file.read()) # Traceback (most recent call last):
# # File "ReadingFiles.py", line 15, in <module>
# # print(file.read())
# # ValueError: I/O operation on closed file.
# Assigning the content to a variable and then reading the file
with open("ReadMe.txt",'r') as file:
content = file.read()
# python has closed the file
print("The content is", content) # The content is Hello from Python 201
# This is a new line
| with open('ReadMe.txt', 'r') as file:
content = file.read()
print('The content is', content) |
__all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__']
__author__ = 'Henrik Nyman'
__license__ = 'MIT'
__version__ = '0.1'
__credits__ = ['Henrik Nyman']
__maintainer__ = 'Henrik Nyman'
| __all__ = ['__author__', '__license__', '__version__', '__credits__', '__maintainer__']
__author__ = 'Henrik Nyman'
__license__ = 'MIT'
__version__ = '0.1'
__credits__ = ['Henrik Nyman']
__maintainer__ = 'Henrik Nyman' |
def ssort(array):
for i in range(len(array)):
indxMin = i
for j in range(i+1, len(array)):
if array[j] < array[indxMin]:
indxMin = j
tmp = array[indxMin]
array[indxMin] = array[i]
array[i] = tmp
return array
| def ssort(array):
for i in range(len(array)):
indx_min = i
for j in range(i + 1, len(array)):
if array[j] < array[indxMin]:
indx_min = j
tmp = array[indxMin]
array[indxMin] = array[i]
array[i] = tmp
return array |
depl_user = 'darulez'
depl_group = 'docker'
# defaults file for ansible-docker-apps-generator
assembly_path = 'apps-assembly'
apps_path = './apps-universe'
stacks_path = './stacks-universe'
default_docker_network = 'hoa_network'
docker_main_sections = ['docker_from', 'docker_init', 'docker_reqs', 'docker_core', 'docker_post']
| depl_user = 'darulez'
depl_group = 'docker'
assembly_path = 'apps-assembly'
apps_path = './apps-universe'
stacks_path = './stacks-universe'
default_docker_network = 'hoa_network'
docker_main_sections = ['docker_from', 'docker_init', 'docker_reqs', 'docker_core', 'docker_post'] |
class FastLabelException(Exception):
def __init__(self, message, errcode):
super(FastLabelException, self).__init__(
"<Response [{}]> {}".format(errcode, message)
)
self.code = errcode
class FastLabelInvalidException(FastLabelException, ValueError):
pass
| class Fastlabelexception(Exception):
def __init__(self, message, errcode):
super(FastLabelException, self).__init__('<Response [{}]> {}'.format(errcode, message))
self.code = errcode
class Fastlabelinvalidexception(FastLabelException, ValueError):
pass |
'''ALUMNA: HUAMANI TACOMA ANDY
EJERCICIO : PAINT DASH GRIDS-DFS-RECURSIVE'''
# DESCRIPCION: IMPLEMENTACION DE DFS-RECURSIVE PARA PINTAR LOS DASH GRIDS DE UNA MATRIZ
def dfs_recursive(matrix, startX, startY, simbVisited, simbPared):
# TABLERO, POSICION INICIALX, POSICION INICIALY, SIMBOLO VISITADO, SIMBOLO PARED
try:
if(matrix[startX][startY] != simbPared): # SI EL ELEMENTO NO ES PARED
matrix[startX][startY] = simbVisited # SE CAMBIA POR EL SIMBOLO VISITADO
else: # SI ES PARED NO SE VISITA
print("es pared, no se pude pintar") # SE IMPRIME
return matrix # SE RETORNA LA MATRIZ
except: # SI LA POSICION ESTA FUERA DE LOS LIMITES
print("Fuera del os limites") # SE IMPRIME
return matrix # SE RETORNA LA MATRIZ
print("Punto Central: (" + str(startX)+","+str(startY)+")") # SE IMPRIME LA POSICION DEL PUNTO CENTRAL
dx = [-1,0,1,0] # VECTOR DE MOVIMIENTO EN X
dy = [0,1,0,-1] # VECTOR DE MOVIMIENTO EN Y
for i in range(4): # SE REALIZA EL RECORRIDO EN TODAS LAS DIRECCIONES
nx = dx[i] + startX # SE OBTIENE LA POSICION EN X
ny = dy[i] + startY # SE OBTIENE LA POSICION EN Y
if((nx >= 0 and nx < len(matrix)) and (ny >= 0 and ny < len(matrix[startX]))): # SI LA POSICION ESTA DENTRO DEL TABLERO
if(matrix[nx][ny] != simbVisited and matrix[nx][ny] != simbPared): # SI EL ELEMENTO NO ESTA VISITADO Y NO ES PARED
dfs_recursive(matrix, nx, ny, simbVisited, simbPared) # SE LLAMA AL METODO RECURSIVO
return matrix # SE RETORNA LA MATRIZ
# IMPRIMIR LA MATRIZ
def printMatrix(matrix):
for i in matrix:
for j in i:
print(" " , j , end=" ")
print()
# CASO DE PRUEBA
# MATRIZ
matrix = [
["#","#","#","#","#","#"],
["#","-","-","-","-","#"],
["#","-","-","-","-","#"],
["#","-","-","-","-","#"],
["#","-","-","-","#","-"],
["#","#","#","#","-","-"],
]
# PRUEBA 01
# MATRIZ INICIAL
printMatrix(matrix)
# MATRIZ DE VISITADOS
printMatrix(dfs_recursive(matrix, 1, 2, "o", "#"))
print("\n---------------------------------------------------------")
# PRUEBA 02
# MATRIZ INICIAL
printMatrix(matrix)
# MATRIZ DE VISITADOS
printMatrix(dfs_recursive(matrix, 5, 5, "o", "#")) | """ALUMNA: HUAMANI TACOMA ANDY
EJERCICIO : PAINT DASH GRIDS-DFS-RECURSIVE"""
def dfs_recursive(matrix, startX, startY, simbVisited, simbPared):
try:
if matrix[startX][startY] != simbPared:
matrix[startX][startY] = simbVisited
else:
print('es pared, no se pude pintar')
return matrix
except:
print('Fuera del os limites')
return matrix
print('Punto Central: (' + str(startX) + ',' + str(startY) + ')')
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
for i in range(4):
nx = dx[i] + startX
ny = dy[i] + startY
if (nx >= 0 and nx < len(matrix)) and (ny >= 0 and ny < len(matrix[startX])):
if matrix[nx][ny] != simbVisited and matrix[nx][ny] != simbPared:
dfs_recursive(matrix, nx, ny, simbVisited, simbPared)
return matrix
def print_matrix(matrix):
for i in matrix:
for j in i:
print(' ', j, end=' ')
print()
matrix = [['#', '#', '#', '#', '#', '#'], ['#', '-', '-', '-', '-', '#'], ['#', '-', '-', '-', '-', '#'], ['#', '-', '-', '-', '-', '#'], ['#', '-', '-', '-', '#', '-'], ['#', '#', '#', '#', '-', '-']]
print_matrix(matrix)
print_matrix(dfs_recursive(matrix, 1, 2, 'o', '#'))
print('\n---------------------------------------------------------')
print_matrix(matrix)
print_matrix(dfs_recursive(matrix, 5, 5, 'o', '#')) |
__all__ = ["PACK_HEADER_MAX"]
# max scanned length of packet header
PACK_HEADER_MAX = 60
| __all__ = ['PACK_HEADER_MAX']
pack_header_max = 60 |
'''We sort a large sublist of a given list and go on reducing the size of the list until all elements are sorted.'''
def shellSort(input_list):
mid = len(input_list) // 2
while mid > 0:
for i in range(mid, len(input_list)):
temp = input_list[i]
j = i
# Sort the sub list for this gap
while j >= mid and input_list[j - mid] > temp:
input_list[j] = input_list[j - mid]
j = j - mid
input_list[j] = temp
# Reduce the gap for the next element
mid = mid // 2
list = [25, 2, 30, 1, 45, 39, 11, 110, 29]
shellSort(list)
print(list) | """We sort a large sublist of a given list and go on reducing the size of the list until all elements are sorted."""
def shell_sort(input_list):
mid = len(input_list) // 2
while mid > 0:
for i in range(mid, len(input_list)):
temp = input_list[i]
j = i
while j >= mid and input_list[j - mid] > temp:
input_list[j] = input_list[j - mid]
j = j - mid
input_list[j] = temp
mid = mid // 2
list = [25, 2, 30, 1, 45, 39, 11, 110, 29]
shell_sort(list)
print(list) |
#Esta es la respuesta del control
def sumarLista(lista, largo):
if (largo == 0):
return 0
else:
return lista[largo - 1] + sumarLista(lista, largo - 1)
def Desglosar(numero:int,lista=[]):
def rev(l):
if len(l) == 0: return []
return [l[-1]] + rev(l[:-1])
if numero==0:
reversa=rev(lista)
return reversa
else:
lista.append(numero)
return Desglosar(numero-1,lista)
def combinar(lista, contador = 0, listaaux = []):
if contador == len(lista):
return [listaaux]
x = combinar(lista, contador + 1, listaaux)
y = combinar(lista, contador + 1, listaaux + [lista[contador]])
return x + y
n=int(input("Ingrese N:"))
k=int(input("Ingrese K:"))
if n<1 or k<1:
print("Debe ser un valor entero positivo")
else:
desglosar=Desglosar(n)
combinar=combinar(desglosar)
contador=0
while contador < len(combinar):
if sumarLista(combinar[contador], len(combinar[contador])) == k:
print(*combinar[contador])
contador = contador + 1
| def sumar_lista(lista, largo):
if largo == 0:
return 0
else:
return lista[largo - 1] + sumar_lista(lista, largo - 1)
def desglosar(numero: int, lista=[]):
def rev(l):
if len(l) == 0:
return []
return [l[-1]] + rev(l[:-1])
if numero == 0:
reversa = rev(lista)
return reversa
else:
lista.append(numero)
return desglosar(numero - 1, lista)
def combinar(lista, contador=0, listaaux=[]):
if contador == len(lista):
return [listaaux]
x = combinar(lista, contador + 1, listaaux)
y = combinar(lista, contador + 1, listaaux + [lista[contador]])
return x + y
n = int(input('Ingrese N:'))
k = int(input('Ingrese K:'))
if n < 1 or k < 1:
print('Debe ser un valor entero positivo')
else:
desglosar = desglosar(n)
combinar = combinar(desglosar)
contador = 0
while contador < len(combinar):
if sumar_lista(combinar[contador], len(combinar[contador])) == k:
print(*combinar[contador])
contador = contador + 1 |
# Utility functions for incrementing counts in dictionaries or appending to a list of values
def add_to_dict_num(D, k, v=1):
if k in D:
D[k] += v
else:
D[k] = v
def add_to_dict_list(D, k, v):
if k in D:
D[k].append(v)
else:
D[k] = [v]
def report(min_verbosity, *args):
if report.verbosity >= min_verbosity:
print(f'[{report.context}]', *args)
| def add_to_dict_num(D, k, v=1):
if k in D:
D[k] += v
else:
D[k] = v
def add_to_dict_list(D, k, v):
if k in D:
D[k].append(v)
else:
D[k] = [v]
def report(min_verbosity, *args):
if report.verbosity >= min_verbosity:
print(f'[{report.context}]', *args) |
'''
Created on Mar 19, 2022
@author: mballance
'''
class ActivityBlockMetaT(type):
def __init__(self, name, bases, dct):
pass
def __enter__(self):
print("ActivityBlockMetaT.__enter__")
def __exit__(self, t, v, tb):
pass
| """
Created on Mar 19, 2022
@author: mballance
"""
class Activityblockmetat(type):
def __init__(self, name, bases, dct):
pass
def __enter__(self):
print('ActivityBlockMetaT.__enter__')
def __exit__(self, t, v, tb):
pass |
# -*- coding:utf-8 -*-
class Solution:
def LeftRotateString(self, s, n):
# write code here
if len(s)==0:
return s
s = list(s)
def flip(s,start,end):
for i in range(start,(start+end)//2 + 1):
s[i],s[end-i+start] = s[end - i+start],s[i]
return s
n %= len(s)
s = flip(s,0,n-1)
s = flip(s,n,len(s)-1)
s = flip(s,0,len(s)-1)
return "".join(s) | class Solution:
def left_rotate_string(self, s, n):
if len(s) == 0:
return s
s = list(s)
def flip(s, start, end):
for i in range(start, (start + end) // 2 + 1):
(s[i], s[end - i + start]) = (s[end - i + start], s[i])
return s
n %= len(s)
s = flip(s, 0, n - 1)
s = flip(s, n, len(s) - 1)
s = flip(s, 0, len(s) - 1)
return ''.join(s) |
'''
question link- https://leetcode.com/problems/sum-of-all-subset-xor-totals/
Sum of All Subset XOR Totals
Question statement:
The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.
For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.
'''
def subsetXORSum(self, nums):
l = len(nums)
res = 0
stack = [(0, 0)]
while stack:
pos, xor = stack.pop()
res+=xor
for i in range(pos, l):
stack.append((i+1, xor^nums[i]))
return res
| """
question link- https://leetcode.com/problems/sum-of-all-subset-xor-totals/
Sum of All Subset XOR Totals
Question statement:
The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.
For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.
"""
def subset_xor_sum(self, nums):
l = len(nums)
res = 0
stack = [(0, 0)]
while stack:
(pos, xor) = stack.pop()
res += xor
for i in range(pos, l):
stack.append((i + 1, xor ^ nums[i]))
return res |
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
ans = [1]*n
for i in range(1,m):
for j in range(1,n):
ans[j] = ans[j-1] + ans[j]
return ans[-1] if m and n else 0 | class Solution:
def unique_paths(self, m: int, n: int) -> int:
ans = [1] * n
for i in range(1, m):
for j in range(1, n):
ans[j] = ans[j - 1] + ans[j]
return ans[-1] if m and n else 0 |
'''
Write a Python program to compute the sum of all items of a
given array of integers where each integer is multiplied by its
index. Return 0 if there is no number.
Sample Input:
[1,2,3,4]
[-1,-2,-3,-4]
[]
Sample Output:
20
-20
0
'''
def sum_index_multiplier(nums):
# use enumerate to return count and value
#single line of return statement with for
return sum(j*i for i, j in enumerate(nums))
print(sum_index_multiplier([1,2,3,4]))
print(sum_index_multiplier([-1,-2,-3,-4]))
print(sum_index_multiplier([]))
| """
Write a Python program to compute the sum of all items of a
given array of integers where each integer is multiplied by its
index. Return 0 if there is no number.
Sample Input:
[1,2,3,4]
[-1,-2,-3,-4]
[]
Sample Output:
20
-20
0
"""
def sum_index_multiplier(nums):
return sum((j * i for (i, j) in enumerate(nums)))
print(sum_index_multiplier([1, 2, 3, 4]))
print(sum_index_multiplier([-1, -2, -3, -4]))
print(sum_index_multiplier([])) |
class Node:
def __init__(self, data=None):
self.data = data
self.left = None
self.right = None
class BinaryTree:
def __init__(self, root):
self.root = Node(root)
def display(self, start, traversal=""):
if start != None:
traversal += (str(start.data) + " ")
traversal = self.display(start.left, traversal)
traversal = self.display(start.right, traversal)
return traversal
def is_bst(self):
start = self.root
traversal = ""
if start.data != None:
if start.left.data > start.data:
return False
if start.right.data < start.data:
return False
self.display(start.left, traversal)
self.display(start.right, traversal)
return True
def highest_value(self, start, traversal):
if start != None:
if start.data > traversal:
traversal = start.data
traversal = self.highest_value(start.left, traversal)
traversal = self.highest_value(start.right, traversal)
return traversal
def lowest_value(self, start, traversal):
if start != None:
if start.data < traversal:
traversal = start.data
traversal = self.lowest_value(start.left, traversal)
traversal = self.lowest_value(start.right, traversal)
return traversal | class Node:
def __init__(self, data=None):
self.data = data
self.left = None
self.right = None
class Binarytree:
def __init__(self, root):
self.root = node(root)
def display(self, start, traversal=''):
if start != None:
traversal += str(start.data) + ' '
traversal = self.display(start.left, traversal)
traversal = self.display(start.right, traversal)
return traversal
def is_bst(self):
start = self.root
traversal = ''
if start.data != None:
if start.left.data > start.data:
return False
if start.right.data < start.data:
return False
self.display(start.left, traversal)
self.display(start.right, traversal)
return True
def highest_value(self, start, traversal):
if start != None:
if start.data > traversal:
traversal = start.data
traversal = self.highest_value(start.left, traversal)
traversal = self.highest_value(start.right, traversal)
return traversal
def lowest_value(self, start, traversal):
if start != None:
if start.data < traversal:
traversal = start.data
traversal = self.lowest_value(start.left, traversal)
traversal = self.lowest_value(start.right, traversal)
return traversal |
class Solution:
def expandFromMiddle(self, s:str, l:int, r:int):
while (l >= 0 and r < len(s) and s[l] == s[r]):
l -= 1
r += 1
return (r - l - 1)
def longestPalindrome(self, s: str) -> str:
if len(s) < 1: return 0
start = 0
end = 0
for i in range(len(s)):
l1 = self.expandFromMiddle(s, i, i)
l2 = self.expandFromMiddle(s, i, i+1)
ls = max(l1,l2)
if ls > end - start:
start = i - ((ls - 1)//2)
end = i + (ls//2)
return s[start: end+1]
if __name__ == "__main__":
sol = Solution()
s = "babab"
s = "cbbd"
# s = 'bb'
# s = "babc"
# s = "aca"
# s = "defggbac"
# s = 'a'
s = "babad"
# s = "ccc"
s = "abb"
# s = "reifadyqgztixemwswtccodfnchcovrmiooffbbijkecuvlvukecutasfxqcqygltrogrdxlrslbnzktlanycgtniprjlospzhhgdrqcwlukbpsrumxguskubokxcmswjnssbkutdhppsdckuckcbwbxpmcmdicfjxaanoxndlfpqwneytatcbyjmimyawevmgirunvmdvxwdjbiqszwhfhjmrpexfwrbzkipxfowcbqjckaotmmgkrbjvhihgwuszdrdiijkgjoljjdubcbowvxslctleblfmdzmvdkqdxtiylabrwaccikkpnpsgcotxoggdydqnuogmxttcycjorzrtwtcchxrbbknfmxnonbhgbjjypqhbftceduxgrnaswtbytrhuiqnxkivevhprcvhggugrmmxolvfzwadlnzdwbtqbaveoongezoymdrhywxcxvggsewsxckucmncbrljskgsgtehortuvbtrsfisyewchxlmxqccoplhlzwutoqoctgfnrzhqctxaqacmirrqdwsbdpqttmyrmxxawgtjzqjgffqwlxqxwxrkgtzqkgdulbxmfcvxcwoswystiyittdjaqvaijwscqobqlhskhvoktksvmguzfankdigqlegrxxqpoitdtykfltohnzrcgmlnhddcfmawiriiiblwrttveedkxzzagdzpwvriuctvtrvdpqzcdnrkgcnpwjlraaaaskgguxzljktqvzzmruqqslutiipladbcxdwxhmvevsjrdkhdpxcyjkidkoznuagshnvccnkyeflpyjzlcbmhbytxnfzcrnmkyknbmtzwtaceajmnuyjblmdlbjdjxctvqcoqkbaszvrqvjgzdqpvmucerumskjrwhywjkwgligkectzboqbanrsvynxscpxqxtqhthdytfvhzjdcxgckvgfbldsfzxqdozxicrwqyprgnadfxsionkzzegmeynye"
print(sol.longestPalindrome(s))
| class Solution:
def expand_from_middle(self, s: str, l: int, r: int):
while l >= 0 and r < len(s) and (s[l] == s[r]):
l -= 1
r += 1
return r - l - 1
def longest_palindrome(self, s: str) -> str:
if len(s) < 1:
return 0
start = 0
end = 0
for i in range(len(s)):
l1 = self.expandFromMiddle(s, i, i)
l2 = self.expandFromMiddle(s, i, i + 1)
ls = max(l1, l2)
if ls > end - start:
start = i - (ls - 1) // 2
end = i + ls // 2
return s[start:end + 1]
if __name__ == '__main__':
sol = solution()
s = 'babab'
s = 'cbbd'
s = 'babad'
s = 'abb'
print(sol.longestPalindrome(s)) |
class Paddle():
def __init__(self, x1, x2 , y1, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
#private method
def __setPaddleRight(self):
self.x1 = 4
self.x2 = 4
self.y1 = 0
self.y2 = 1
display.set_pixel(self.x1, self.y1, 9)
display.set_pixel(self.x2, self.y2, 9)
#private method
def __setPaddleLeft(self):
self.x1 = 0
self.x2 = 0
self.y1 = 4
self.y2 = 3
display.set_pixel(self.x1, self.y1, 9)
display.set_pixel(self.x2, self.y2, 9)
def startGame(self):
self.__setPaddleLeft()
self.__setPaddleRight()
def moveUp(self):
self.y1 -= 1
self.y2 -= 1
if self.y1 or self.y2 == 0:
return self.y1, self.y2
def moveDown(self):
self.y += 1
self.y += 1
if self.y1 or self.y2 == 0:
return self.y1, self.y2
def getCurrentPosition(self):
return self.x1, self.y1, self.x2, self.y2
def update(self):
display.set_pixel(self.x1, self.y1, 9)
display.set_pixel(self.x2, self.y2, 9)
| class Paddle:
def __init__(self, x1, x2, y1, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
def __set_paddle_right(self):
self.x1 = 4
self.x2 = 4
self.y1 = 0
self.y2 = 1
display.set_pixel(self.x1, self.y1, 9)
display.set_pixel(self.x2, self.y2, 9)
def __set_paddle_left(self):
self.x1 = 0
self.x2 = 0
self.y1 = 4
self.y2 = 3
display.set_pixel(self.x1, self.y1, 9)
display.set_pixel(self.x2, self.y2, 9)
def start_game(self):
self.__setPaddleLeft()
self.__setPaddleRight()
def move_up(self):
self.y1 -= 1
self.y2 -= 1
if self.y1 or self.y2 == 0:
return (self.y1, self.y2)
def move_down(self):
self.y += 1
self.y += 1
if self.y1 or self.y2 == 0:
return (self.y1, self.y2)
def get_current_position(self):
return (self.x1, self.y1, self.x2, self.y2)
def update(self):
display.set_pixel(self.x1, self.y1, 9)
display.set_pixel(self.x2, self.y2, 9) |
N, C, S, *l = map(int, open(0).read().split())
c = 0
S -= 1
ans = 0
for i in l:
ans += c == S
c = (c+i+N)%N
ans += c == S
print(ans) | (n, c, s, *l) = map(int, open(0).read().split())
c = 0
s -= 1
ans = 0
for i in l:
ans += c == S
c = (c + i + N) % N
ans += c == S
print(ans) |
def mensagem(cor='', msg='', firula='', tamanho=0):
if '\n' in msg:
linha = msg.find('\n')
else:
linha = len(msg)
limpa = '\033[m'
if tamanho == 0:
tamanho = firula * (linha + 4)
if firula == '':
print(f'{cor} {msg} {limpa}')
else:
print(f'{cor}{tamanho}{limpa}')
print(f'{cor} {msg} \033[m')
print(f'{cor}{tamanho}{limpa}')
| def mensagem(cor='', msg='', firula='', tamanho=0):
if '\n' in msg:
linha = msg.find('\n')
else:
linha = len(msg)
limpa = '\x1b[m'
if tamanho == 0:
tamanho = firula * (linha + 4)
if firula == '':
print(f'{cor} {msg} {limpa}')
else:
print(f'{cor}{tamanho}{limpa}')
print(f'{cor} {msg} \x1b[m')
print(f'{cor}{tamanho}{limpa}') |
'''
Leetcode Problem number 687.
Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.
The length of path between two nodes is represented by the number of edges between them.
'''
class Solution:
def longestUnivaluePath(self, root: TreeNode) -> int:
self.max_path = 0;
if(root is None or (root.left is None and root.right is None )):
pass
else:
self.find_max_path(root)
return self.max_path
def set_max_value(self,new_val)-> None:
self.max_path = new_val
def find_max_path(self, root: TreeNode) -> int:
'''
finds longest path of 1 value and updates the overall maximum value.
return : current node's maximum matching value
'''
if(root is None or (root.left is None and root.right is None )):
return 0
cur_length=0
left_is_same = False
left_max_path = 0
right_max_path = 0
if(root.left):
left_max_path = self.find_max_path(root.left)
if(root.left.val == root.val ):
cur_length += 1 + left_max_path;
left_is_same = True
else:
cur_length = 0;
if(root.right):
right_max_path = self.find_max_path(root.right)
if(root.right.val == root.val and left_is_same):
self.set_max_value(max(self.max_path, cur_length + 1 + right_max_path))
if(root.right.val == root.val):
cur_length = max(1 + right_max_path, cur_length);
self.set_max_value(max(self.max_path,cur_length))
return cur_length
| """
Leetcode Problem number 687.
Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.
The length of path between two nodes is represented by the number of edges between them.
"""
class Solution:
def longest_univalue_path(self, root: TreeNode) -> int:
self.max_path = 0
if root is None or (root.left is None and root.right is None):
pass
else:
self.find_max_path(root)
return self.max_path
def set_max_value(self, new_val) -> None:
self.max_path = new_val
def find_max_path(self, root: TreeNode) -> int:
"""
finds longest path of 1 value and updates the overall maximum value.
return : current node's maximum matching value
"""
if root is None or (root.left is None and root.right is None):
return 0
cur_length = 0
left_is_same = False
left_max_path = 0
right_max_path = 0
if root.left:
left_max_path = self.find_max_path(root.left)
if root.left.val == root.val:
cur_length += 1 + left_max_path
left_is_same = True
else:
cur_length = 0
if root.right:
right_max_path = self.find_max_path(root.right)
if root.right.val == root.val and left_is_same:
self.set_max_value(max(self.max_path, cur_length + 1 + right_max_path))
if root.right.val == root.val:
cur_length = max(1 + right_max_path, cur_length)
self.set_max_value(max(self.max_path, cur_length))
return cur_length |
class Except(Exception):
def __init__(*args, **kwargs):
Exception.__init__(*args, **kwargs)
def CheckExceptions(data):
raise Except(data)
| class Except(Exception):
def __init__(*args, **kwargs):
Exception.__init__(*args, **kwargs)
def check_exceptions(data):
raise except(data) |
del_items(0x80145350)
SetType(0x80145350, "void _cd_seek(int sec)")
del_items(0x801453BC)
SetType(0x801453BC, "void init_cdstream(int chunksize, unsigned char *buf, int bufsize)")
del_items(0x801453E4)
SetType(0x801453E4, "void flush_cdstream()")
del_items(0x80145438)
SetType(0x80145438, "void reset_cdstream()")
del_items(0x80145468)
SetType(0x80145468, "void kill_stream_handlers()")
del_items(0x80145498)
SetType(0x80145498, "void stream_cdready_handler(unsigned char status, unsigned char *result, int idx, int i, int sec, struct CdlLOC subcode[3])")
del_items(0x80145684)
SetType(0x80145684, "void install_stream_handlers()")
del_items(0x801456C0)
SetType(0x801456C0, "void cdstream_service()")
del_items(0x801457B0)
SetType(0x801457B0, "int cdstream_get_chunk(unsigned char **data, struct strheader **h)")
del_items(0x801458C8)
SetType(0x801458C8, "int cdstream_is_last_chunk()")
del_items(0x801458E0)
SetType(0x801458E0, "void cdstream_discard_chunk()")
del_items(0x80145A00)
SetType(0x80145A00, "void close_cdstream()")
del_items(0x80145A40)
SetType(0x80145A40, "void wait_cdstream()")
del_items(0x80145AF8)
SetType(0x80145AF8, "int open_cdstream(char *fname, int secoffs, int seclen)")
del_items(0x80145BFC)
SetType(0x80145BFC, "int set_mdec_img_buffer(unsigned char *p)")
del_items(0x80145C30)
SetType(0x80145C30, "void start_mdec_decode(unsigned char *data, int x, int y, int w, int h)")
del_items(0x80145DB4)
SetType(0x80145DB4, "void DCT_out_handler()")
del_items(0x80145E50)
SetType(0x80145E50, "void init_mdec(unsigned char *vlc_buffer, unsigned char *vlc_table)")
del_items(0x80145EC0)
SetType(0x80145EC0, "void init_mdec_buffer(char *buf, int size)")
del_items(0x80145EDC)
SetType(0x80145EDC, "int split_poly_area(struct POLY_FT4 *p, struct POLY_FT4 *bp, int offs, struct RECT *r, int sx, int sy, int correct)")
del_items(0x801462CC)
SetType(0x801462CC, "void rebuild_mdec_polys(int x, int y)")
del_items(0x801464A0)
SetType(0x801464A0, "void clear_mdec_frame()")
del_items(0x801464AC)
SetType(0x801464AC, "void draw_mdec_polys()")
del_items(0x801467F8)
SetType(0x801467F8, "void invalidate_mdec_frame()")
del_items(0x8014680C)
SetType(0x8014680C, "int is_frame_decoded()")
del_items(0x80146818)
SetType(0x80146818, "void init_mdec_polys(int x, int y, int w, int h, int bx1, int by1, int bx2, int by2, int correct)")
del_items(0x80146BA8)
SetType(0x80146BA8, "void set_mdec_poly_bright(int br)")
del_items(0x80146C10)
SetType(0x80146C10, "int init_mdec_stream(unsigned char *buftop, int sectors_per_frame, int mdec_frames_per_buffer)")
del_items(0x80146C60)
SetType(0x80146C60, "void init_mdec_audio(int rate)")
del_items(0x80146D68)
SetType(0x80146D68, "void kill_mdec_audio()")
del_items(0x80146D98)
SetType(0x80146D98, "void stop_mdec_audio()")
del_items(0x80146DBC)
SetType(0x80146DBC, "void play_mdec_audio(unsigned char *data, struct asec *h)")
del_items(0x80147054)
SetType(0x80147054, "void set_mdec_audio_volume(short vol, struct SpuVoiceAttr voice_attr)")
del_items(0x80147120)
SetType(0x80147120, "void resync_audio()")
del_items(0x80147150)
SetType(0x80147150, "void stop_mdec_stream()")
del_items(0x801471A4)
SetType(0x801471A4, "void dequeue_stream()")
del_items(0x80147290)
SetType(0x80147290, "void dequeue_animation()")
del_items(0x80147440)
SetType(0x80147440, "void decode_mdec_stream(int frames_elapsed)")
del_items(0x80147620)
SetType(0x80147620, "void play_mdec_stream(char *filename, int speed, int start, int end)")
del_items(0x801476D4)
SetType(0x801476D4, "void clear_mdec_queue()")
del_items(0x80147700)
SetType(0x80147700, "void StrClearVRAM()")
del_items(0x801477C0)
SetType(0x801477C0, "short PlayFMVOverLay(char *filename, int w, int h)")
del_items(0x80147C84)
SetType(0x80147C84, "unsigned short GetDown__C4CPad(struct CPad *this)")
| del_items(2148815696)
set_type(2148815696, 'void _cd_seek(int sec)')
del_items(2148815804)
set_type(2148815804, 'void init_cdstream(int chunksize, unsigned char *buf, int bufsize)')
del_items(2148815844)
set_type(2148815844, 'void flush_cdstream()')
del_items(2148815928)
set_type(2148815928, 'void reset_cdstream()')
del_items(2148815976)
set_type(2148815976, 'void kill_stream_handlers()')
del_items(2148816024)
set_type(2148816024, 'void stream_cdready_handler(unsigned char status, unsigned char *result, int idx, int i, int sec, struct CdlLOC subcode[3])')
del_items(2148816516)
set_type(2148816516, 'void install_stream_handlers()')
del_items(2148816576)
set_type(2148816576, 'void cdstream_service()')
del_items(2148816816)
set_type(2148816816, 'int cdstream_get_chunk(unsigned char **data, struct strheader **h)')
del_items(2148817096)
set_type(2148817096, 'int cdstream_is_last_chunk()')
del_items(2148817120)
set_type(2148817120, 'void cdstream_discard_chunk()')
del_items(2148817408)
set_type(2148817408, 'void close_cdstream()')
del_items(2148817472)
set_type(2148817472, 'void wait_cdstream()')
del_items(2148817656)
set_type(2148817656, 'int open_cdstream(char *fname, int secoffs, int seclen)')
del_items(2148817916)
set_type(2148817916, 'int set_mdec_img_buffer(unsigned char *p)')
del_items(2148817968)
set_type(2148817968, 'void start_mdec_decode(unsigned char *data, int x, int y, int w, int h)')
del_items(2148818356)
set_type(2148818356, 'void DCT_out_handler()')
del_items(2148818512)
set_type(2148818512, 'void init_mdec(unsigned char *vlc_buffer, unsigned char *vlc_table)')
del_items(2148818624)
set_type(2148818624, 'void init_mdec_buffer(char *buf, int size)')
del_items(2148818652)
set_type(2148818652, 'int split_poly_area(struct POLY_FT4 *p, struct POLY_FT4 *bp, int offs, struct RECT *r, int sx, int sy, int correct)')
del_items(2148819660)
set_type(2148819660, 'void rebuild_mdec_polys(int x, int y)')
del_items(2148820128)
set_type(2148820128, 'void clear_mdec_frame()')
del_items(2148820140)
set_type(2148820140, 'void draw_mdec_polys()')
del_items(2148820984)
set_type(2148820984, 'void invalidate_mdec_frame()')
del_items(2148821004)
set_type(2148821004, 'int is_frame_decoded()')
del_items(2148821016)
set_type(2148821016, 'void init_mdec_polys(int x, int y, int w, int h, int bx1, int by1, int bx2, int by2, int correct)')
del_items(2148821928)
set_type(2148821928, 'void set_mdec_poly_bright(int br)')
del_items(2148822032)
set_type(2148822032, 'int init_mdec_stream(unsigned char *buftop, int sectors_per_frame, int mdec_frames_per_buffer)')
del_items(2148822112)
set_type(2148822112, 'void init_mdec_audio(int rate)')
del_items(2148822376)
set_type(2148822376, 'void kill_mdec_audio()')
del_items(2148822424)
set_type(2148822424, 'void stop_mdec_audio()')
del_items(2148822460)
set_type(2148822460, 'void play_mdec_audio(unsigned char *data, struct asec *h)')
del_items(2148823124)
set_type(2148823124, 'void set_mdec_audio_volume(short vol, struct SpuVoiceAttr voice_attr)')
del_items(2148823328)
set_type(2148823328, 'void resync_audio()')
del_items(2148823376)
set_type(2148823376, 'void stop_mdec_stream()')
del_items(2148823460)
set_type(2148823460, 'void dequeue_stream()')
del_items(2148823696)
set_type(2148823696, 'void dequeue_animation()')
del_items(2148824128)
set_type(2148824128, 'void decode_mdec_stream(int frames_elapsed)')
del_items(2148824608)
set_type(2148824608, 'void play_mdec_stream(char *filename, int speed, int start, int end)')
del_items(2148824788)
set_type(2148824788, 'void clear_mdec_queue()')
del_items(2148824832)
set_type(2148824832, 'void StrClearVRAM()')
del_items(2148825024)
set_type(2148825024, 'short PlayFMVOverLay(char *filename, int w, int h)')
del_items(2148826244)
set_type(2148826244, 'unsigned short GetDown__C4CPad(struct CPad *this)') |
# Sets an error rate of %0.025 (1 in 4,000) with a capacity of 5MM items.
# See https://hur.st/bloomfilter/?n=5000000&p=0.00025&m=& for more information
# 5MM was chosen for being a whole number roughly 2x the size of our most dense sparse plugin output in late July 2020.
DEFAULT_ERROR_RATE = 0.00025
DEFAULT_CAPACITY = 5000000
KEY_PREFIX = "fwan_dataset_bf:"
# The bloom filters are only useful for per-file-hash Firmware Analysis plugins with sparse output, as those are the
# scenarios where we are likely to avoid unnecessary object storage fetches.
exclusions = [
"augeas", # firmware-file-level
"file_hashes", # too dense
"file_tree", # firmware-level
"file_type", # too dense
"unpack_report", # irrelevant
"unpack_failed", # irrelevant
"printable_strings", # too dense
]
exclusion_prefixes = [
"firmware_cpes", # firmware-level
"sbom", # sbom/unified is firmware-level, sbom/apt_file is irrelevant
"similarity_hash", # irrelevant
]
| default_error_rate = 0.00025
default_capacity = 5000000
key_prefix = 'fwan_dataset_bf:'
exclusions = ['augeas', 'file_hashes', 'file_tree', 'file_type', 'unpack_report', 'unpack_failed', 'printable_strings']
exclusion_prefixes = ['firmware_cpes', 'sbom', 'similarity_hash'] |
fp = open("./packet.csv", "r")
vals = fp.readlines()
count = 1
pre_val = 0
current = 0
sampling_rate = 31
val_bins = []
for i in range(len(vals)):
pre_val = current
current = int(vals[i])
if current == pre_val:
count = count + 1
else:
count = 1
if count == sampling_rate:
val_bins.append(pre_val)
count = 1
pre_val = 0
current = 0
next_bins = []
for i in range(len(val_bins) // 2):
b0 = val_bins[i * 2]
b1 = val_bins[i * 2 + 1]
if b0 == 1 and b1 == 0:
next_bins.append(1)
elif b0 == 0 and b1 == 1:
next_bins.append(0)
val_bins = next_bins[3:]
c = 0
for i in range(len(val_bins)):
val = int(val_bins[i])
c = (c << 1) | val
if i % 8 == 7:
print(chr(c), end="")
c = 0
print("")
| fp = open('./packet.csv', 'r')
vals = fp.readlines()
count = 1
pre_val = 0
current = 0
sampling_rate = 31
val_bins = []
for i in range(len(vals)):
pre_val = current
current = int(vals[i])
if current == pre_val:
count = count + 1
else:
count = 1
if count == sampling_rate:
val_bins.append(pre_val)
count = 1
pre_val = 0
current = 0
next_bins = []
for i in range(len(val_bins) // 2):
b0 = val_bins[i * 2]
b1 = val_bins[i * 2 + 1]
if b0 == 1 and b1 == 0:
next_bins.append(1)
elif b0 == 0 and b1 == 1:
next_bins.append(0)
val_bins = next_bins[3:]
c = 0
for i in range(len(val_bins)):
val = int(val_bins[i])
c = c << 1 | val
if i % 8 == 7:
print(chr(c), end='')
c = 0
print('') |
'''
Specifies the username and password required to log into the iNaturalist website.
These variables are imported into the 'inaturalist_scraper.py' script
'''
username = 'your_iNaturalist_username_here'
password = 'your_iNaturalist_password_here' | """
Specifies the username and password required to log into the iNaturalist website.
These variables are imported into the 'inaturalist_scraper.py' script
"""
username = 'your_iNaturalist_username_here'
password = 'your_iNaturalist_password_here' |
FRONT_LEFT_WHEEL_TOPIC = "/capo_front_left_wheel_controller/command"
FRONT_RIGHT_WHEEL_TOPIC = "/capo_front_right_wheel_controller/command"
# BACK_RIGHT_WHEEL_TOPIC = "/capo_rear_left_wheel_controller/command",
# BACK_LEFT_WHEEL_TOPIC = "/capo_rear_right_wheel_controller/command"
HEAD_JOINT_TOPIC = "/capo_head_rotation_controller/command"
CAPO_JOINT_STATES = '/joint_states'
TOPNAV_FEEDBACK_TOPIC = '/topnav/feedback'
TOPNAV_GUIDELINES_TOPIC = 'topnav/guidelines'
GAZEBO_MODEL_STATES_TOPIC = "/gazebo/model_states"
| front_left_wheel_topic = '/capo_front_left_wheel_controller/command'
front_right_wheel_topic = '/capo_front_right_wheel_controller/command'
head_joint_topic = '/capo_head_rotation_controller/command'
capo_joint_states = '/joint_states'
topnav_feedback_topic = '/topnav/feedback'
topnav_guidelines_topic = 'topnav/guidelines'
gazebo_model_states_topic = '/gazebo/model_states' |
# -*- coding:utf-8 -*-
pizzas = ['fruit', 'buff', 'milk', 'zhishi', 'little']
# for pizza in pizzas:
# print(pizza)
# print(pizza.title() + ", I like eat !")
# print("I like eat pizza!")
pizzas_bak = pizzas[:]
pizzas.append('chicken')
pizzas_bak.append('dog')
print(pizzas_bak)
print(pizzas) | pizzas = ['fruit', 'buff', 'milk', 'zhishi', 'little']
pizzas_bak = pizzas[:]
pizzas.append('chicken')
pizzas_bak.append('dog')
print(pizzas_bak)
print(pizzas) |
class Solution:
def reformatDate(self, date: str) -> str:
pattern = re.compile(r'[0-9]+')
dateList=date.split(' ')
day=pattern.findall(dateList[0])[0]
monthList=["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
month=monthList.index(dateList[1])+1
year=dateList[2]
return year+'-'+str(month).zfill(2)+'-'+str(day).zfill(2) | class Solution:
def reformat_date(self, date: str) -> str:
pattern = re.compile('[0-9]+')
date_list = date.split(' ')
day = pattern.findall(dateList[0])[0]
month_list = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
month = monthList.index(dateList[1]) + 1
year = dateList[2]
return year + '-' + str(month).zfill(2) + '-' + str(day).zfill(2) |
inp = open('input_d24.txt').read().strip().split('\n')
graph = dict()
n = 0
yn = len(inp)
xn = len(inp[0])
poss = '01234567'
def find_n(ton):
for y in range(len(inp)):
for x in range(len(inp[y])):
if inp[y][x] == str(ton):
return (x,y)
def exists(n, found):
for ele in list(graph[n]):
if ele[0] == int(found):
return True
return False
def find_adj(x,y):
res = set()
for (a,b) in [(x-1,y), (x+1,y), (x,y-1), (x,y+1)]:
if a >= 0 and a < xn and b >= 0 and b < yn:
if inp[b][a] != '#':
res.add((a,b))
return res
for n in range(8):
x,y = find_n(n)
if n not in graph:
graph[n] = set()
visited = set()
queue = [((x,y), set([(x,y)]))]
while queue:
(vertex, path) = queue.pop(0)
for nex in find_adj(*vertex) - path:
if nex in visited:
continue
visited.add(nex)
found = inp[nex[1]][nex[0]]
if found in poss:
if not exists(n,found):
graph[n].add((int(found), len(path)))
if int(found) not in graph:
graph[int(found)] = set()
graph[int(found)].add((n, len(path)))
else:
p = path.copy()
p.add(nex)
queue.append((nex, p))
print(graph)
print('bruteforcing TSP (fun times)')
smallest = 10000
queue = [(0, set([0]), 0)]
while queue:
(current, visited, count) = queue.pop(0)
if count >= smallest:
continue
for pos in graph[current]:
nv = visited.copy()
nv.add(pos[0])
nc = count + pos[1]
if all([int(p) in nv for p in poss]) and pos[0] == 0 and nc < smallest:
smallest = nc
print(smallest)
elif pos[0] not in visited and nc < smallest:
queue.append((pos[0], nv, nc))
print(smallest)
| inp = open('input_d24.txt').read().strip().split('\n')
graph = dict()
n = 0
yn = len(inp)
xn = len(inp[0])
poss = '01234567'
def find_n(ton):
for y in range(len(inp)):
for x in range(len(inp[y])):
if inp[y][x] == str(ton):
return (x, y)
def exists(n, found):
for ele in list(graph[n]):
if ele[0] == int(found):
return True
return False
def find_adj(x, y):
res = set()
for (a, b) in [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)]:
if a >= 0 and a < xn and (b >= 0) and (b < yn):
if inp[b][a] != '#':
res.add((a, b))
return res
for n in range(8):
(x, y) = find_n(n)
if n not in graph:
graph[n] = set()
visited = set()
queue = [((x, y), set([(x, y)]))]
while queue:
(vertex, path) = queue.pop(0)
for nex in find_adj(*vertex) - path:
if nex in visited:
continue
visited.add(nex)
found = inp[nex[1]][nex[0]]
if found in poss:
if not exists(n, found):
graph[n].add((int(found), len(path)))
if int(found) not in graph:
graph[int(found)] = set()
graph[int(found)].add((n, len(path)))
else:
p = path.copy()
p.add(nex)
queue.append((nex, p))
print(graph)
print('bruteforcing TSP (fun times)')
smallest = 10000
queue = [(0, set([0]), 0)]
while queue:
(current, visited, count) = queue.pop(0)
if count >= smallest:
continue
for pos in graph[current]:
nv = visited.copy()
nv.add(pos[0])
nc = count + pos[1]
if all([int(p) in nv for p in poss]) and pos[0] == 0 and (nc < smallest):
smallest = nc
print(smallest)
elif pos[0] not in visited and nc < smallest:
queue.append((pos[0], nv, nc))
print(smallest) |
array = []
for i in range (16):
# array.append([i,0])
array.append([i,5])
print(array) | array = []
for i in range(16):
array.append([i, 5])
print(array) |
#
# PySNMP MIB module Juniper-PPPOE-PROFILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-PPPOE-PROFILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:03:50 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:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection")
juniMibs, = mibBuilder.importSymbols("Juniper-MIBs", "juniMibs")
JuniEnable, JuniSetMap = mibBuilder.importSymbols("Juniper-TC", "JuniEnable", "JuniSetMap")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
IpAddress, ModuleIdentity, MibIdentifier, Integer32, Gauge32, iso, Counter32, TimeTicks, Unsigned32, Counter64, NotificationType, ObjectIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "ModuleIdentity", "MibIdentifier", "Integer32", "Gauge32", "iso", "Counter32", "TimeTicks", "Unsigned32", "Counter64", "NotificationType", "ObjectIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
juniPppoeProfileMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46))
juniPppoeProfileMIB.setRevisions(('2008-06-18 10:29', '2005-07-13 11:40', '2004-06-10 19:25', '2003-03-11 21:58', '2002-09-16 21:44', '2002-08-15 20:34', '2002-08-15 19:07', '2001-03-21 18:32',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: juniPppoeProfileMIB.setRevisionsDescriptions(('Added juniPppoeProfileMaxSessionOverride object.', 'Added MTU control object.', 'Added Remote Circuit Id Capture object.', 'Added Service Name Table object.', 'Replaced Unisphere names with Juniper names.', 'Added PADI flag and packet trace support.', 'Added duplicate MAC address indicator and AC-NAME tag objects.', 'Initial version of this MIB module.',))
if mibBuilder.loadTexts: juniPppoeProfileMIB.setLastUpdated('200806181029Z')
if mibBuilder.loadTexts: juniPppoeProfileMIB.setOrganization('Juniper Networks, Inc.')
if mibBuilder.loadTexts: juniPppoeProfileMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: [email protected]')
if mibBuilder.loadTexts: juniPppoeProfileMIB.setDescription('The point-to-point protocol over Ethernet (PPPoE) profile MIB for the Juniper enterprise.')
juniPppoeProfileObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1))
juniPppoeProfile = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1))
juniPppoeProfileTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1), )
if mibBuilder.loadTexts: juniPppoeProfileTable.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileTable.setDescription('This table contains profiles for configuring PPPoE interfaces/sessions. Entries in this table are created/deleted as a side-effect of corresponding operations to the juniProfileNameTable in the Juniper-PROFILE-MIB.')
juniPppoeProfileEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1), ).setIndexNames((0, "Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileId"))
if mibBuilder.loadTexts: juniPppoeProfileEntry.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileEntry.setDescription('A profile describing configuration of a PPPoE interface and its subinterfaces (sessions).')
juniPppoeProfileId = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: juniPppoeProfileId.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileId.setDescription('The integer identifier associated with this profile. A value for this identifier is determined by locating or creating a profile name in the juniProfileNameTable.')
juniPppoeProfileSetMap = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 2), JuniSetMap()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileSetMap.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileSetMap.setDescription("A bitmap representing which objects in this entry have been explicitly configured. See the definition of the JuniSetMap TEXTUAL-CONVENTION for details of use. The INDEX object(s) and this object are excluded from representation (i.e. their bits are never set). When a SET request does not explicitly configure JuniSetMap, bits in JuniSetMap are set as a side-effect of configuring other profile attributes in the same entry. If, however, a SET request explicitly configures JuniSetMap, the explicitly configured value overrides 1) any previous bit settings, and 2) any simultaneous 'side-effect' settings that would otherwise occur. Once set, bits can only be cleared by explicitly configuring JuniSetMap.")
juniPppoeProfileMaxNumSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileMaxNumSessions.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileMaxNumSessions.setDescription('The maximum number of PPPoE sessions (subinterfaces) that can be configured on the main PPPoE interface created using this profile. A value of zero indicates no bound is configured.')
juniPppoeProfileSubMotm = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileSubMotm.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileSubMotm.setDescription('A message to send via a PADM on the sub-interface when this profile is applied to the IP interface above this PPPoE sub- interface. A client may choose to display this message to the user.')
juniPppoeProfileSubUrl = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileSubUrl.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileSubUrl.setDescription('A URL to be sent via a PADM on the sub-interface when this profile is applied to the IP interface above this PPPoE sub-interface. The string entered here can have several substitutions applied: %D is replaced with the profile name %d is replaced with the domain name %u is replaced with the user name %U is replaced with the user/domain name together %% is replaced with the % character The resulting string must not be greater than 127 octets long. The client may use this URL as the initial web-page for the user.')
juniPppoeProfileDupProtect = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 6), JuniEnable().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileDupProtect.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileDupProtect.setDescription('Flag to control whether duplicate MAC addresses are allowed')
juniPppoeProfileAcName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileAcName.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileAcName.setDescription('The name to use for the AC-NAME tag that is sent in any PADO that is sent on this interface.')
juniPppoeProfilePadiFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 8), JuniEnable().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfilePadiFlag.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfilePadiFlag.setDescription('The PPPoE major interface parameter PADI flag controls whether to always repsond to a PADI with a PADO regardless of the ability to create the session and allow the session establish phase to resolve it.')
juniPppoeProfilePacketTrace = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 9), JuniEnable().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfilePacketTrace.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfilePacketTrace.setDescription('The PPPoE major interface parameter packet tracing flag controls whether packet tracing is enable or not.')
juniPppoeProfileServiceNameTableName = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileServiceNameTableName.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileServiceNameTableName.setDescription('The PPPoE Service name table controls behavior of PADO control packets.')
juniPppoeProfilePadrRemoteCircuitIdCapture = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 11), JuniEnable().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfilePadrRemoteCircuitIdCapture.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfilePadrRemoteCircuitIdCapture.setDescription('The PPPoE major interface parameter PADR remote circuit id capture flag controls whether the remote circuit id string possibly contained in the PADR packet will be saved and used by AAA to replace the NAS-PORT-ID field.')
juniPppoeProfileMtu = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), ValueRangeConstraint(66, 65535), )).clone(1494)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileMtu.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileMtu.setDescription('The initial Maximum Transmit Unit (MTU) that the PPPoE major interface entity will advertise to the remote entity. If the value of this variable is 1 then the local PPPoE entity will use an MTU value determined by its underlying media interface. If the value of this variable is 2 then the local PPPoE entity will use a value determined by the PPPoE Max-Mtu-Tag transmitted from the client in the PADR packet. If no Max-Mtu-Tag is received, the value defaults to a maximum of 1494. The operational MTU is limited by the MTU of the underlying media interface minus the PPPoE frame overhead.')
juniPppoeProfileMaxSessionOverride = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("override", 1), ("ignore", 2))).clone('ignore')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: juniPppoeProfileMaxSessionOverride.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileMaxSessionOverride.setDescription('Configure the action to be taken by PPPoE when RADIUS server returns the PPPoE max-session value: override Override the current PPPoE max-session value with the value returned by RADIUS server Ignore Ignore the max-session value returned by RADIUS server')
juniPppoeProfileConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4))
juniPppoeProfileCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1))
juniPppoeProfileGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2))
juniPppoeProfileCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 1)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileCompliance = juniPppoeProfileCompliance.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileCompliance.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE Profile MIB. This statement became obsolete when the duplicate MAC address indicator and AC-NAME tag were added.')
juniPppoeCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 2)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup2"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeCompliance2 = juniPppoeCompliance2.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeCompliance2.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when PADI flag, AC-name and packet trace objects were added.')
juniPppoeCompliance3 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 3)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup3"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeCompliance3 = juniPppoeCompliance3.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeCompliance3.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when the service name table was added.')
juniPppoeCompliance4 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 4)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup4"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeCompliance4 = juniPppoeCompliance4.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeCompliance4.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when the remote circuit id capture was added.')
juniPppoeCompliance5 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 5)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup5"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeCompliance5 = juniPppoeCompliance5.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeCompliance5.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE MIB. This statement became obsolete when support was added for MTU configuration.')
juniPppoeCompliance6 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 6)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup6"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeCompliance6 = juniPppoeCompliance6.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeCompliance6.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE MIB. This statement became obsolete when support was added for juniPppoeProfileMaxSessionOverride.')
juniPppoeCompliance7 = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 7)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileGroup7"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeCompliance7 = juniPppoeCompliance7.setStatus('current')
if mibBuilder.loadTexts: juniPppoeCompliance7.setDescription('The compliance statement for entities which implement the Juniper PPPoE Profile MIB.')
juniPppoeProfileGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 1)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup = juniPppoeProfileGroup.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileGroup.setDescription('Obsolete collection of objects providing management of profile functionality for PPPoE interfaces in a Juniper product. This group became obsolete when the duplicate MAC address indicator and AC-NAME tag objects were added.')
juniPppoeProfileGroup2 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 2)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup2 = juniPppoeProfileGroup2.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileGroup2.setDescription('Obsolete collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product. This group became obsolete when PADI flag, AC-name and packet trace objects were added.')
juniPppoeProfileGroup3 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 3)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup3 = juniPppoeProfileGroup3.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileGroup3.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juniPppoeProfileGroup4 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 4)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup4 = juniPppoeProfileGroup4.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileGroup4.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juniPppoeProfileGroup5 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 5)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadrRemoteCircuitIdCapture"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup5 = juniPppoeProfileGroup5.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileGroup5.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juniPppoeProfileGroup6 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 6)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadrRemoteCircuitIdCapture"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMtu"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup6 = juniPppoeProfileGroup6.setStatus('obsolete')
if mibBuilder.loadTexts: juniPppoeProfileGroup6.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juniPppoeProfileGroup7 = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 7)).setObjects(("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSetMap"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxNumSessions"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubMotm"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileSubUrl"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileDupProtect"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileAcName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadiFlag"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePacketTrace"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileServiceNameTableName"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfilePadrRemoteCircuitIdCapture"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMtu"), ("Juniper-PPPOE-PROFILE-MIB", "juniPppoeProfileMaxSessionOverride"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juniPppoeProfileGroup7 = juniPppoeProfileGroup7.setStatus('current')
if mibBuilder.loadTexts: juniPppoeProfileGroup7.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
mibBuilder.exportSymbols("Juniper-PPPOE-PROFILE-MIB", juniPppoeCompliance5=juniPppoeCompliance5, juniPppoeProfileGroup2=juniPppoeProfileGroup2, juniPppoeProfileMtu=juniPppoeProfileMtu, juniPppoeProfile=juniPppoeProfile, juniPppoeProfileSetMap=juniPppoeProfileSetMap, juniPppoeProfilePadiFlag=juniPppoeProfilePadiFlag, juniPppoeProfileTable=juniPppoeProfileTable, juniPppoeProfileDupProtect=juniPppoeProfileDupProtect, juniPppoeCompliance4=juniPppoeCompliance4, juniPppoeProfileGroup=juniPppoeProfileGroup, juniPppoeProfileMIB=juniPppoeProfileMIB, juniPppoeProfileGroup4=juniPppoeProfileGroup4, juniPppoeProfileCompliances=juniPppoeProfileCompliances, juniPppoeProfileAcName=juniPppoeProfileAcName, juniPppoeProfileGroup3=juniPppoeProfileGroup3, juniPppoeProfilePadrRemoteCircuitIdCapture=juniPppoeProfilePadrRemoteCircuitIdCapture, juniPppoeProfileSubMotm=juniPppoeProfileSubMotm, juniPppoeProfilePacketTrace=juniPppoeProfilePacketTrace, juniPppoeProfileEntry=juniPppoeProfileEntry, juniPppoeProfileGroup5=juniPppoeProfileGroup5, juniPppoeProfileMaxSessionOverride=juniPppoeProfileMaxSessionOverride, juniPppoeCompliance2=juniPppoeCompliance2, juniPppoeProfileGroups=juniPppoeProfileGroups, juniPppoeCompliance6=juniPppoeCompliance6, juniPppoeProfileCompliance=juniPppoeProfileCompliance, juniPppoeCompliance3=juniPppoeCompliance3, juniPppoeCompliance7=juniPppoeCompliance7, juniPppoeProfileGroup6=juniPppoeProfileGroup6, juniPppoeProfileMaxNumSessions=juniPppoeProfileMaxNumSessions, juniPppoeProfileId=juniPppoeProfileId, juniPppoeProfileConformance=juniPppoeProfileConformance, PYSNMP_MODULE_ID=juniPppoeProfileMIB, juniPppoeProfileObjects=juniPppoeProfileObjects, juniPppoeProfileServiceNameTableName=juniPppoeProfileServiceNameTableName, juniPppoeProfileSubUrl=juniPppoeProfileSubUrl, juniPppoeProfileGroup7=juniPppoeProfileGroup7)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection')
(juni_mibs,) = mibBuilder.importSymbols('Juniper-MIBs', 'juniMibs')
(juni_enable, juni_set_map) = mibBuilder.importSymbols('Juniper-TC', 'JuniEnable', 'JuniSetMap')
(object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup')
(ip_address, module_identity, mib_identifier, integer32, gauge32, iso, counter32, time_ticks, unsigned32, counter64, notification_type, object_identity, bits, mib_scalar, mib_table, mib_table_row, mib_table_column) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'ModuleIdentity', 'MibIdentifier', 'Integer32', 'Gauge32', 'iso', 'Counter32', 'TimeTicks', 'Unsigned32', 'Counter64', 'NotificationType', 'ObjectIdentity', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
juni_pppoe_profile_mib = module_identity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46))
juniPppoeProfileMIB.setRevisions(('2008-06-18 10:29', '2005-07-13 11:40', '2004-06-10 19:25', '2003-03-11 21:58', '2002-09-16 21:44', '2002-08-15 20:34', '2002-08-15 19:07', '2001-03-21 18:32'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
juniPppoeProfileMIB.setRevisionsDescriptions(('Added juniPppoeProfileMaxSessionOverride object.', 'Added MTU control object.', 'Added Remote Circuit Id Capture object.', 'Added Service Name Table object.', 'Replaced Unisphere names with Juniper names.', 'Added PADI flag and packet trace support.', 'Added duplicate MAC address indicator and AC-NAME tag objects.', 'Initial version of this MIB module.'))
if mibBuilder.loadTexts:
juniPppoeProfileMIB.setLastUpdated('200806181029Z')
if mibBuilder.loadTexts:
juniPppoeProfileMIB.setOrganization('Juniper Networks, Inc.')
if mibBuilder.loadTexts:
juniPppoeProfileMIB.setContactInfo(' Juniper Networks, Inc. Postal: 10 Technology Park Drive Westford, MA 01886-3146 USA Tel: +1 978 589 5800 Email: [email protected]')
if mibBuilder.loadTexts:
juniPppoeProfileMIB.setDescription('The point-to-point protocol over Ethernet (PPPoE) profile MIB for the Juniper enterprise.')
juni_pppoe_profile_objects = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1))
juni_pppoe_profile = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1))
juni_pppoe_profile_table = mib_table((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1))
if mibBuilder.loadTexts:
juniPppoeProfileTable.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileTable.setDescription('This table contains profiles for configuring PPPoE interfaces/sessions. Entries in this table are created/deleted as a side-effect of corresponding operations to the juniProfileNameTable in the Juniper-PROFILE-MIB.')
juni_pppoe_profile_entry = mib_table_row((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1)).setIndexNames((0, 'Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileId'))
if mibBuilder.loadTexts:
juniPppoeProfileEntry.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileEntry.setDescription('A profile describing configuration of a PPPoE interface and its subinterfaces (sessions).')
juni_pppoe_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
juniPppoeProfileId.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileId.setDescription('The integer identifier associated with this profile. A value for this identifier is determined by locating or creating a profile name in the juniProfileNameTable.')
juni_pppoe_profile_set_map = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 2), juni_set_map()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileSetMap.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileSetMap.setDescription("A bitmap representing which objects in this entry have been explicitly configured. See the definition of the JuniSetMap TEXTUAL-CONVENTION for details of use. The INDEX object(s) and this object are excluded from representation (i.e. their bits are never set). When a SET request does not explicitly configure JuniSetMap, bits in JuniSetMap are set as a side-effect of configuring other profile attributes in the same entry. If, however, a SET request explicitly configures JuniSetMap, the explicitly configured value overrides 1) any previous bit settings, and 2) any simultaneous 'side-effect' settings that would otherwise occur. Once set, bits can only be cleared by explicitly configuring JuniSetMap.")
juni_pppoe_profile_max_num_sessions = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileMaxNumSessions.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileMaxNumSessions.setDescription('The maximum number of PPPoE sessions (subinterfaces) that can be configured on the main PPPoE interface created using this profile. A value of zero indicates no bound is configured.')
juni_pppoe_profile_sub_motm = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 127))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileSubMotm.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileSubMotm.setDescription('A message to send via a PADM on the sub-interface when this profile is applied to the IP interface above this PPPoE sub- interface. A client may choose to display this message to the user.')
juni_pppoe_profile_sub_url = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 127))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileSubUrl.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileSubUrl.setDescription('A URL to be sent via a PADM on the sub-interface when this profile is applied to the IP interface above this PPPoE sub-interface. The string entered here can have several substitutions applied: %D is replaced with the profile name %d is replaced with the domain name %u is replaced with the user name %U is replaced with the user/domain name together %% is replaced with the % character The resulting string must not be greater than 127 octets long. The client may use this URL as the initial web-page for the user.')
juni_pppoe_profile_dup_protect = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 6), juni_enable().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileDupProtect.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileDupProtect.setDescription('Flag to control whether duplicate MAC addresses are allowed')
juni_pppoe_profile_ac_name = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 7), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileAcName.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileAcName.setDescription('The name to use for the AC-NAME tag that is sent in any PADO that is sent on this interface.')
juni_pppoe_profile_padi_flag = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 8), juni_enable().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfilePadiFlag.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfilePadiFlag.setDescription('The PPPoE major interface parameter PADI flag controls whether to always repsond to a PADI with a PADO regardless of the ability to create the session and allow the session establish phase to resolve it.')
juni_pppoe_profile_packet_trace = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 9), juni_enable().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfilePacketTrace.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfilePacketTrace.setDescription('The PPPoE major interface parameter packet tracing flag controls whether packet tracing is enable or not.')
juni_pppoe_profile_service_name_table_name = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 10), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileServiceNameTableName.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileServiceNameTableName.setDescription('The PPPoE Service name table controls behavior of PADO control packets.')
juni_pppoe_profile_padr_remote_circuit_id_capture = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 11), juni_enable().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfilePadrRemoteCircuitIdCapture.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfilePadrRemoteCircuitIdCapture.setDescription('The PPPoE major interface parameter PADR remote circuit id capture flag controls whether the remote circuit id string possibly contained in the PADR packet will be saved and used by AAA to replace the NAS-PORT-ID field.')
juni_pppoe_profile_mtu = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(value_range_constraint(1, 1), value_range_constraint(2, 2), value_range_constraint(66, 65535))).clone(1494)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileMtu.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileMtu.setDescription('The initial Maximum Transmit Unit (MTU) that the PPPoE major interface entity will advertise to the remote entity. If the value of this variable is 1 then the local PPPoE entity will use an MTU value determined by its underlying media interface. If the value of this variable is 2 then the local PPPoE entity will use a value determined by the PPPoE Max-Mtu-Tag transmitted from the client in the PADR packet. If no Max-Mtu-Tag is received, the value defaults to a maximum of 1494. The operational MTU is limited by the MTU of the underlying media interface minus the PPPoE frame overhead.')
juni_pppoe_profile_max_session_override = mib_table_column((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 1, 1, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('override', 1), ('ignore', 2))).clone('ignore')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
juniPppoeProfileMaxSessionOverride.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileMaxSessionOverride.setDescription('Configure the action to be taken by PPPoE when RADIUS server returns the PPPoE max-session value: override Override the current PPPoE max-session value with the value returned by RADIUS server Ignore Ignore the max-session value returned by RADIUS server')
juni_pppoe_profile_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4))
juni_pppoe_profile_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1))
juni_pppoe_profile_groups = mib_identifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2))
juni_pppoe_profile_compliance = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 1)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_compliance = juniPppoeProfileCompliance.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileCompliance.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE Profile MIB. This statement became obsolete when the duplicate MAC address indicator and AC-NAME tag were added.')
juni_pppoe_compliance2 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 2)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup2'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_compliance2 = juniPppoeCompliance2.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeCompliance2.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when PADI flag, AC-name and packet trace objects were added.')
juni_pppoe_compliance3 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 3)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup3'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_compliance3 = juniPppoeCompliance3.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeCompliance3.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when the service name table was added.')
juni_pppoe_compliance4 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 4)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup4'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_compliance4 = juniPppoeCompliance4.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeCompliance4.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE profile MIB. This statement became obsolete when the remote circuit id capture was added.')
juni_pppoe_compliance5 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 5)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup5'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_compliance5 = juniPppoeCompliance5.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeCompliance5.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE MIB. This statement became obsolete when support was added for MTU configuration.')
juni_pppoe_compliance6 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 6)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup6'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_compliance6 = juniPppoeCompliance6.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeCompliance6.setDescription('Obsolete compliance statement for entities which implement the Juniper PPPoE MIB. This statement became obsolete when support was added for juniPppoeProfileMaxSessionOverride.')
juni_pppoe_compliance7 = module_compliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 1, 7)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileGroup7'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_compliance7 = juniPppoeCompliance7.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeCompliance7.setDescription('The compliance statement for entities which implement the Juniper PPPoE Profile MIB.')
juni_pppoe_profile_group = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 1)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group = juniPppoeProfileGroup.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileGroup.setDescription('Obsolete collection of objects providing management of profile functionality for PPPoE interfaces in a Juniper product. This group became obsolete when the duplicate MAC address indicator and AC-NAME tag objects were added.')
juni_pppoe_profile_group2 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 2)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileDupProtect'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileAcName'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group2 = juniPppoeProfileGroup2.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileGroup2.setDescription('Obsolete collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product. This group became obsolete when PADI flag, AC-name and packet trace objects were added.')
juni_pppoe_profile_group3 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 3)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileDupProtect'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileAcName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadiFlag'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePacketTrace'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group3 = juniPppoeProfileGroup3.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileGroup3.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juni_pppoe_profile_group4 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 4)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileDupProtect'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileAcName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadiFlag'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePacketTrace'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileServiceNameTableName'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group4 = juniPppoeProfileGroup4.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileGroup4.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juni_pppoe_profile_group5 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 5)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileDupProtect'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileAcName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadiFlag'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePacketTrace'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileServiceNameTableName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadrRemoteCircuitIdCapture'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group5 = juniPppoeProfileGroup5.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileGroup5.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juni_pppoe_profile_group6 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 6)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileDupProtect'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileAcName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadiFlag'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePacketTrace'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileServiceNameTableName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadrRemoteCircuitIdCapture'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMtu'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group6 = juniPppoeProfileGroup6.setStatus('obsolete')
if mibBuilder.loadTexts:
juniPppoeProfileGroup6.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
juni_pppoe_profile_group7 = object_group((1, 3, 6, 1, 4, 1, 4874, 2, 2, 46, 4, 2, 7)).setObjects(('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSetMap'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxNumSessions'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubMotm'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileSubUrl'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileDupProtect'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileAcName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadiFlag'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePacketTrace'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileServiceNameTableName'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfilePadrRemoteCircuitIdCapture'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMtu'), ('Juniper-PPPOE-PROFILE-MIB', 'juniPppoeProfileMaxSessionOverride'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
juni_pppoe_profile_group7 = juniPppoeProfileGroup7.setStatus('current')
if mibBuilder.loadTexts:
juniPppoeProfileGroup7.setDescription('A collection of objects providing management of profile functionality for PPPOE interfaces in a Juniper product.')
mibBuilder.exportSymbols('Juniper-PPPOE-PROFILE-MIB', juniPppoeCompliance5=juniPppoeCompliance5, juniPppoeProfileGroup2=juniPppoeProfileGroup2, juniPppoeProfileMtu=juniPppoeProfileMtu, juniPppoeProfile=juniPppoeProfile, juniPppoeProfileSetMap=juniPppoeProfileSetMap, juniPppoeProfilePadiFlag=juniPppoeProfilePadiFlag, juniPppoeProfileTable=juniPppoeProfileTable, juniPppoeProfileDupProtect=juniPppoeProfileDupProtect, juniPppoeCompliance4=juniPppoeCompliance4, juniPppoeProfileGroup=juniPppoeProfileGroup, juniPppoeProfileMIB=juniPppoeProfileMIB, juniPppoeProfileGroup4=juniPppoeProfileGroup4, juniPppoeProfileCompliances=juniPppoeProfileCompliances, juniPppoeProfileAcName=juniPppoeProfileAcName, juniPppoeProfileGroup3=juniPppoeProfileGroup3, juniPppoeProfilePadrRemoteCircuitIdCapture=juniPppoeProfilePadrRemoteCircuitIdCapture, juniPppoeProfileSubMotm=juniPppoeProfileSubMotm, juniPppoeProfilePacketTrace=juniPppoeProfilePacketTrace, juniPppoeProfileEntry=juniPppoeProfileEntry, juniPppoeProfileGroup5=juniPppoeProfileGroup5, juniPppoeProfileMaxSessionOverride=juniPppoeProfileMaxSessionOverride, juniPppoeCompliance2=juniPppoeCompliance2, juniPppoeProfileGroups=juniPppoeProfileGroups, juniPppoeCompliance6=juniPppoeCompliance6, juniPppoeProfileCompliance=juniPppoeProfileCompliance, juniPppoeCompliance3=juniPppoeCompliance3, juniPppoeCompliance7=juniPppoeCompliance7, juniPppoeProfileGroup6=juniPppoeProfileGroup6, juniPppoeProfileMaxNumSessions=juniPppoeProfileMaxNumSessions, juniPppoeProfileId=juniPppoeProfileId, juniPppoeProfileConformance=juniPppoeProfileConformance, PYSNMP_MODULE_ID=juniPppoeProfileMIB, juniPppoeProfileObjects=juniPppoeProfileObjects, juniPppoeProfileServiceNameTableName=juniPppoeProfileServiceNameTableName, juniPppoeProfileSubUrl=juniPppoeProfileSubUrl, juniPppoeProfileGroup7=juniPppoeProfileGroup7) |
class Solution(object):
def isValidSudoku(self, board):
return (self.is_row_valid(board) and
self.is_col_valid(board) and
self.is_square_valid(board))
def is_row_valid(self, board):
for row in board:
if not self.is_unit_valid(row):
return False
return True
def is_col_valid(self, board):
# zip turns column into tuple
for col in zip(*board):
if not self.is_unit_valid(col):
return False
return True
def is_square_valid(self, board):
for i in (0, 3, 6):
for j in (0, 3, 6):
square = [board[x][y] for x in range(i, i + 3) for y in range(j, j + 3)]
if not self.is_unit_valid(square):
return False
return True
def is_unit_valid(self, unit):
unit = [i for i in unit if i != '.']
return len(set(unit)) == len(unit)
test1 = [
["5","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
["8",".",".",".","6",".",".",".","3"],
["4",".",".","8",".","3",".",".","1"],
["7",".",".",".","2",".",".",".","6"],
[".","6",".",".",".",".","2","8","."],
[".",".",".","4","1","9",".",".","5"],
[".",".",".",".","8",".",".","7","9"]
]
test2 = [
["8","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
["8",".",".",".","6",".",".",".","3"],
["4",".",".","8",".","3",".",".","1"],
["7",".",".",".","2",".",".",".","6"],
[".","6",".",".",".",".","2","8","."],
[".",".",".","4","1","9",".",".","5"],
[".",".",".",".","8",".",".","7","9"]
]
solver = Solution()
print(solver.isValidSudoku(test1)) | class Solution(object):
def is_valid_sudoku(self, board):
return self.is_row_valid(board) and self.is_col_valid(board) and self.is_square_valid(board)
def is_row_valid(self, board):
for row in board:
if not self.is_unit_valid(row):
return False
return True
def is_col_valid(self, board):
for col in zip(*board):
if not self.is_unit_valid(col):
return False
return True
def is_square_valid(self, board):
for i in (0, 3, 6):
for j in (0, 3, 6):
square = [board[x][y] for x in range(i, i + 3) for y in range(j, j + 3)]
if not self.is_unit_valid(square):
return False
return True
def is_unit_valid(self, unit):
unit = [i for i in unit if i != '.']
return len(set(unit)) == len(unit)
test1 = [['5', '3', '.', '.', '7', '.', '.', '.', '.'], ['6', '.', '.', '1', '9', '5', '.', '.', '.'], ['.', '9', '8', '.', '.', '.', '.', '6', '.'], ['8', '.', '.', '.', '6', '.', '.', '.', '3'], ['4', '.', '.', '8', '.', '3', '.', '.', '1'], ['7', '.', '.', '.', '2', '.', '.', '.', '6'], ['.', '6', '.', '.', '.', '.', '2', '8', '.'], ['.', '.', '.', '4', '1', '9', '.', '.', '5'], ['.', '.', '.', '.', '8', '.', '.', '7', '9']]
test2 = [['8', '3', '.', '.', '7', '.', '.', '.', '.'], ['6', '.', '.', '1', '9', '5', '.', '.', '.'], ['.', '9', '8', '.', '.', '.', '.', '6', '.'], ['8', '.', '.', '.', '6', '.', '.', '.', '3'], ['4', '.', '.', '8', '.', '3', '.', '.', '1'], ['7', '.', '.', '.', '2', '.', '.', '.', '6'], ['.', '6', '.', '.', '.', '.', '2', '8', '.'], ['.', '.', '.', '4', '1', '9', '.', '.', '5'], ['.', '.', '.', '.', '8', '.', '.', '7', '9']]
solver = solution()
print(solver.isValidSudoku(test1)) |
n = int(input())
D = [list(map(int,input().split())) for i in range(n)]
D.sort(key = lambda t: t[0])
S = 0
for i in D:
S += i[1]
S = (S+1)//2
S2 = 0
for i in D:
S2 += i[1]
if S2 >= S:
print(i[0])
break | n = int(input())
d = [list(map(int, input().split())) for i in range(n)]
D.sort(key=lambda t: t[0])
s = 0
for i in D:
s += i[1]
s = (S + 1) // 2
s2 = 0
for i in D:
s2 += i[1]
if S2 >= S:
print(i[0])
break |
#!/usr/local/bin/python3
# Copyright 2019 NineFx Inc.
# Justin Baum
# 20 May 2019
# Precis Code-Generator ReasonML
# https://github.com/NineFX/smeagol/blob/master/spec/code_gen/precis_cp.txt
fp = open('unicodedata.txt', 'r')
ranges = []
line = fp.readline()
prev = ""
start = 0
while line:
if len(line) < 2: break
linesplit = line.split(";")
if ", First" in line:
nextline = fp.readline().split(";")
start = int(linesplit[0], 16)
finish = int(nextline[0], 16)
code = linesplit[4]
ranges.append((start, finish + 1, code))
else:
code = linesplit[4]
if code != prev:
value = int(linesplit[0], 16)
ranges.append((start, value, prev if len(prev) != 0 else "Illegal"))
start = value
prev = code
line = fp.readline()
def splitHalf(listy):
if len(listy) <= 2:
print("switch (point) {")
for item in listy:
if item[0] == item[1] - 1:
print(" | point when (point == " + str(item[0]) + ") => " + str(item[2]))
else:
print(" | point when (point >= " + str(item[0]) + " && point < " + str(item[1]) +") => " + str(item[2]))
print("| _point => raise(PrecisUtils.PrecisError(BidiError))")
print("}")
return
splitValue = listy[len(listy)//2]
firstHalf = listy[:len(listy)//2]
secondHalf = listy[len(listy)//2:]
print("if (point < " +str(splitValue[0]) + ") {")
splitHalf(firstHalf)
print("} else {")
splitHalf(secondHalf)
print("}")
splitHalf(ranges)
| fp = open('unicodedata.txt', 'r')
ranges = []
line = fp.readline()
prev = ''
start = 0
while line:
if len(line) < 2:
break
linesplit = line.split(';')
if ', First' in line:
nextline = fp.readline().split(';')
start = int(linesplit[0], 16)
finish = int(nextline[0], 16)
code = linesplit[4]
ranges.append((start, finish + 1, code))
else:
code = linesplit[4]
if code != prev:
value = int(linesplit[0], 16)
ranges.append((start, value, prev if len(prev) != 0 else 'Illegal'))
start = value
prev = code
line = fp.readline()
def split_half(listy):
if len(listy) <= 2:
print('switch (point) {')
for item in listy:
if item[0] == item[1] - 1:
print(' | point when (point == ' + str(item[0]) + ') => ' + str(item[2]))
else:
print(' | point when (point >= ' + str(item[0]) + ' && point < ' + str(item[1]) + ') => ' + str(item[2]))
print('| _point => raise(PrecisUtils.PrecisError(BidiError))')
print('}')
return
split_value = listy[len(listy) // 2]
first_half = listy[:len(listy) // 2]
second_half = listy[len(listy) // 2:]
print('if (point < ' + str(splitValue[0]) + ') {')
split_half(firstHalf)
print('} else {')
split_half(secondHalf)
print('}')
split_half(ranges) |
# Public Attributes
class Employee:
def __init__(self, ID, salary):
# all properties are public
self.ID = ID
self.salary = salary
def displayID(self):
print("ID:", self.ID)
Steve = Employee(3789, 2500)
Steve.displayID()
print(Steve.salary) | class Employee:
def __init__(self, ID, salary):
self.ID = ID
self.salary = salary
def display_id(self):
print('ID:', self.ID)
steve = employee(3789, 2500)
Steve.displayID()
print(Steve.salary) |
m: int; n: int; j: int; i: int
m = int(input("Quantas linhas vai ter cada matriz? "))
n = int(input("Quantas colunas vai ter cada matriz? "))
A: [[int]] = [[0 for x in range(n)] for x in range(m)]
B: [[int]] = [[0 for x in range(n)] for x in range(m)]
C: [[int]] = [[0 for x in range(n)] for x in range(m)]
print("Digite os valores da matriz A:")
for i in range(0, m):
for j in range(0, n):
A[i][j] = int(input(f"Elemento [{i},{j}]: "))
print("Digite os valores da matriz B:")
for i in range(0, m):
for j in range(0, n):
B[i][j] = int(input(f"Elemento [{i},{j}]: "))
for i in range(0, m):
for j in range(0, n):
C[i][j] = A[i][j] + B[i][j]
print("MATRIZ SOMA:")
for i in range(0, m):
for j in range(0, n):
print(f"{C[i][j]} ", end="")
print()
| m: int
n: int
j: int
i: int
m = int(input('Quantas linhas vai ter cada matriz? '))
n = int(input('Quantas colunas vai ter cada matriz? '))
a: [[int]] = [[0 for x in range(n)] for x in range(m)]
b: [[int]] = [[0 for x in range(n)] for x in range(m)]
c: [[int]] = [[0 for x in range(n)] for x in range(m)]
print('Digite os valores da matriz A:')
for i in range(0, m):
for j in range(0, n):
A[i][j] = int(input(f'Elemento [{i},{j}]: '))
print('Digite os valores da matriz B:')
for i in range(0, m):
for j in range(0, n):
B[i][j] = int(input(f'Elemento [{i},{j}]: '))
for i in range(0, m):
for j in range(0, n):
C[i][j] = A[i][j] + B[i][j]
print('MATRIZ SOMA:')
for i in range(0, m):
for j in range(0, n):
print(f'{C[i][j]} ', end='')
print() |
# class Tree:
# def __init__(self, val, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def solve(self, root):
stack = []
stack.append(root)
level = -1
min_sum = float('inf')
l = 0
while stack:
new = []
s = 0
for node in stack:
if node.left:
new.append(node.left)
if node.right:
new.append(node.right)
s += node.val
if s < min_sum:
level = l
min_sum = s
l += 1
stack = new
return level
| class Solution:
def solve(self, root):
stack = []
stack.append(root)
level = -1
min_sum = float('inf')
l = 0
while stack:
new = []
s = 0
for node in stack:
if node.left:
new.append(node.left)
if node.right:
new.append(node.right)
s += node.val
if s < min_sum:
level = l
min_sum = s
l += 1
stack = new
return level |
def ack ( m, n ):
'''
ack: Evaluates Ackermann function with the given arguments
m: Positive integer value
n: Positive integer value
'''
# Guard against error from incorrect input
if n < 0 or (not isinstance(n, int)):
return "Error: n is either negative or not an integer"
if m < 0 or (not isinstance(m, int)):
return "Error: m is either negative or not an integer"
if m == 0:
return n + 1
elif m > 0 and n == 0:
return ack(m-1, 1)
else:
return ack(m-1, ack(m, n-1))
print(ack(3, 4)) | def ack(m, n):
"""
ack: Evaluates Ackermann function with the given arguments
m: Positive integer value
n: Positive integer value
"""
if n < 0 or not isinstance(n, int):
return 'Error: n is either negative or not an integer'
if m < 0 or not isinstance(m, int):
return 'Error: m is either negative or not an integer'
if m == 0:
return n + 1
elif m > 0 and n == 0:
return ack(m - 1, 1)
else:
return ack(m - 1, ack(m, n - 1))
print(ack(3, 4)) |
def love():
lover = 'sure'
lover
| def love():
lover = 'sure'
lover |
#
class OtsUtil(object):
STEP_THRESHOLD = 408
step = 0
@staticmethod
def log(msg):
if OtsUtil.step >= OtsUtil.STEP_THRESHOLD:
print(msg) | class Otsutil(object):
step_threshold = 408
step = 0
@staticmethod
def log(msg):
if OtsUtil.step >= OtsUtil.STEP_THRESHOLD:
print(msg) |
#Program to Remove Punctuations From a String
string="Wow! What a beautiful nature!"
new_string=string.replace("!","")
print(new_string)
| string = 'Wow! What a beautiful nature!'
new_string = string.replace('!', '')
print(new_string) |
def condensate_to_gas_equivalence(api, stb):
"Derivation from real gas equation"
Tsc = 519.57 # standard temp in Rankine
psc = 14.7 # standard pressure in psi
R = 10.732
rho_w = 350.16 # water density in lbm/STB
so = 141.5 / (api + 131.5) # so: specific gravity of oil (dimensionless)
Mo = 5854 / (api - 8.811) # molecular weight of oil
n = (rho_w * so) / Mo
V1stb = ((n * R * Tsc) / psc)
V = V1stb * stb
return(V)
def general_equivalence(gamma, M):
"Calculate equivalence of 1 STB of water/condensate to scf of gas"
# gamma: specific gravity of condensate/water. oil specific gravity use formula: so=141.5/(api+131.5). water specific gravity = 1
# M: molecular weight of condensate/water. oil: Mo = 5854 / (api - 8.811). water: Mw = 18
V1stb = 132849 * (gamma / M)
return(V1stb)
| def condensate_to_gas_equivalence(api, stb):
"""Derivation from real gas equation"""
tsc = 519.57
psc = 14.7
r = 10.732
rho_w = 350.16
so = 141.5 / (api + 131.5)
mo = 5854 / (api - 8.811)
n = rho_w * so / Mo
v1stb = n * R * Tsc / psc
v = V1stb * stb
return V
def general_equivalence(gamma, M):
"""Calculate equivalence of 1 STB of water/condensate to scf of gas"""
v1stb = 132849 * (gamma / M)
return V1stb |
def fibonacci():
number = 0
previous_number = 1
while True:
if number == 0:
yield number
number += previous_number
if number == 1:
yield number
number += previous_number
if number == 2:
yield previous_number
if number > 1:
yield number
cutternt_number = previous_number
previous_number = number
number = cutternt_number + previous_number
generator = fibonacci()
for i in range(5):
print(next(generator))
| def fibonacci():
number = 0
previous_number = 1
while True:
if number == 0:
yield number
number += previous_number
if number == 1:
yield number
number += previous_number
if number == 2:
yield previous_number
if number > 1:
yield number
cutternt_number = previous_number
previous_number = number
number = cutternt_number + previous_number
generator = fibonacci()
for i in range(5):
print(next(generator)) |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
return str(self.data)
def count_unival_trees(root):
if not root:
return 0
elif not root.left and not root.right:
return 1
elif not root.left and root.data == root.right.data:
return 1 + count_unival_trees(root.right)
elif not root.right and root.data == root.left.data:
return 1 + count_unival_trees(root.left)
child_counts = count_unival_trees(root.left) + count_unival_trees(root.right)
current_node_count = 0
if root.data == root.left.data and root.data == root.left.data:
current_node_count = 1
return current_node_count + child_counts
node_a = Node('0')
node_b = Node('1')
node_c = Node('0')
node_d = Node('1')
node_e = Node('0')
node_f = Node('1')
node_g = Node('1')
node_a.left = node_b
node_a.right = node_c
node_c.left = node_d
node_c.right = node_e
node_d.left = node_f
node_d.right = node_g
assert count_unival_trees(None) == 0
assert count_unival_trees(node_a) == 5
assert count_unival_trees(node_c) == 4
assert count_unival_trees(node_g) == 1
assert count_unival_trees(node_d) == 3
| class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __repr__(self):
return str(self.data)
def count_unival_trees(root):
if not root:
return 0
elif not root.left and (not root.right):
return 1
elif not root.left and root.data == root.right.data:
return 1 + count_unival_trees(root.right)
elif not root.right and root.data == root.left.data:
return 1 + count_unival_trees(root.left)
child_counts = count_unival_trees(root.left) + count_unival_trees(root.right)
current_node_count = 0
if root.data == root.left.data and root.data == root.left.data:
current_node_count = 1
return current_node_count + child_counts
node_a = node('0')
node_b = node('1')
node_c = node('0')
node_d = node('1')
node_e = node('0')
node_f = node('1')
node_g = node('1')
node_a.left = node_b
node_a.right = node_c
node_c.left = node_d
node_c.right = node_e
node_d.left = node_f
node_d.right = node_g
assert count_unival_trees(None) == 0
assert count_unival_trees(node_a) == 5
assert count_unival_trees(node_c) == 4
assert count_unival_trees(node_g) == 1
assert count_unival_trees(node_d) == 3 |
# List Operations and Functions
# '+' Operator
print('-----------+ Operator------------')
a = [1,2,3]
b = [4,5,6]
c = a + b
print(c)
print('----------* Operator--------------')
# '*' Operator
a1 = a * 2
print(a1)
print('--------len function----------------')
print(len(a))
print('--------max function----------------')
print(max(a))
print('--------min function----------------')
print(min(a))
print('--------sum function----------------')
print(sum(a))
print("----------Average--------------")
mylist = []
while(True):
value = (input("Enter the number: "))
if value == 'done': break
value = float(value)
mylist.append(value)
average = sum(mylist)/len(mylist)
print("Average : ", average)
# Strings and Lists
print("----------Strings to Lists split function--------------")
mystring = 'Sagar Sanjeev Potnis'
print(mystring)
newlist = mystring.split()
print(newlist)
mystring1 = 'Sagar-Sanjeev-Potnis'
print(mystring1)
newlist1 = mystring1.split('-')
print(newlist1)
print("---------- List to String join function--------------")
joinstring = " ".join(newlist)
print(joinstring)
print("----------map function--------------")
print("Please Enter list :")
maplist = list(map(int, input().split()))
print(maplist)
print("----------Pitfalls and how to avoid them--------------")
pitylist = [5,4,3,2,1]
pitylist = sorted(pitylist)
print(pitylist)
# Sorted function does not modify original list unline sort fucntion!!! so it is better
| print('-----------+ Operator------------')
a = [1, 2, 3]
b = [4, 5, 6]
c = a + b
print(c)
print('----------* Operator--------------')
a1 = a * 2
print(a1)
print('--------len function----------------')
print(len(a))
print('--------max function----------------')
print(max(a))
print('--------min function----------------')
print(min(a))
print('--------sum function----------------')
print(sum(a))
print('----------Average--------------')
mylist = []
while True:
value = input('Enter the number: ')
if value == 'done':
break
value = float(value)
mylist.append(value)
average = sum(mylist) / len(mylist)
print('Average : ', average)
print('----------Strings to Lists split function--------------')
mystring = 'Sagar Sanjeev Potnis'
print(mystring)
newlist = mystring.split()
print(newlist)
mystring1 = 'Sagar-Sanjeev-Potnis'
print(mystring1)
newlist1 = mystring1.split('-')
print(newlist1)
print('---------- List to String join function--------------')
joinstring = ' '.join(newlist)
print(joinstring)
print('----------map function--------------')
print('Please Enter list :')
maplist = list(map(int, input().split()))
print(maplist)
print('----------Pitfalls and how to avoid them--------------')
pitylist = [5, 4, 3, 2, 1]
pitylist = sorted(pitylist)
print(pitylist) |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "9de928d7",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import csv\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8f1478f8",
"metadata": {},
"outputs": [],
"source": [
"#Set Path\n",
"pollCSV = os.path.join('Resources', 'election_data.CSV')\n",
"pollCSV = r'C:\\Users\\rzh00\\Documents\\gt-virt-atl-data-pt-09-2021-u-c-master\\02-Homework\\03-Python\\Instructions\\PyPoll\\Resources\\election_data.csv'"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "0f207e3c",
"metadata": {},
"outputs": [],
"source": [
"#Varibales\n",
"candi = []\n",
"vote_count = []\n",
"vote_percent = []\n",
"\n",
"num_vote = 0"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "08423af7",
"metadata": {},
"outputs": [],
"source": [
"#Open CSV\n",
"with open(pollCSV) as csvfile:\n",
" csvreader = csv.reader(csvfile, delimiter = ',')\n",
" csvheader = next(csvreader)\n",
" for row in csvreader: \n",
" num_vote = num_vote + 1 # total votes\n",
" candi_name = row[2] # adding candidate name to array\n",
" \n",
" if candi_name not in candi: #conditional to append any new candidates \n",
" candi.append(candi_name)\n",
" index = candi.index(row[2])\n",
" vote_count.append(1)\n",
" else:\n",
" index = candi.index(row[2])\n",
" vote_count[index] += 1\n",
" \n",
" for i in vote_count: # find the percentage of the votes recieved\n",
" percent = round((i/num_vote) * 100)\n",
" percent = '%.3f%%' % percent\n",
" vote_percent.append(percent)\n",
" \n",
" winner = max(vote_count) # determine winner and update the value\n",
" index = vote_count.index(winner)\n",
" candi_winner = candi[index]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "400521a2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Election Results\n",
"--------------------\n",
"Total Votes[4436463, 1408401, 985880, 211260]\n",
"--------------------\n",
"Khan: 63.000% (4436463)\n",
"Correy: 20.000% (1408401)\n",
"Li: 14.000% (985880)\n",
"O'Tooley: 3.000% (211260)\n",
"--------------------\n",
"Winning Candidate: 4436463\n"
]
}
],
"source": [
"#Print Results\n",
"print('Election Results')\n",
"print('-' * 20)\n",
"print(f'Total Votes' + str(vote_count))\n",
"print('-' * 20)\n",
"for i in range(len(candi)):\n",
" print(f'{candi[i]}: {str(vote_percent[i])} ({str(vote_count[i])})')\n",
"print('-' * 20)\n",
"print(f'Winning Candidate: {winner}')"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "18e81981",
"metadata": {},
"outputs": [],
"source": [
"result = os.path.join('output', 'result.txt')\n",
"result = r'C:\\Users\\rzh00\\Documents\\gt-virt-atl-data-pt-09-2021-u-c-master\\02-Homework\\03-Python\\Instructions\\PyPoll\\result.txt'\n",
"\n",
"with open(result, 'w') as txt:\n",
" txt.write('Election Results')\n",
" txt.write('-' * 20)\n",
" txt.write(f'Total Votes' + str(vote_count))\n",
" txt.write('-' * 20)\n",
" for i in range(len(candi)):\n",
" txt.write(f'{candi[i]}: {str(vote_percent[i])} ({str(vote_count[i])})')\n",
" txt.write('-' * 20)\n",
" txt.write(f'Winning Candidate: {winner}')\n",
" txt.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c5893e30",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
| {'cells': [{'cell_type': 'code', 'execution_count': 1, 'id': '9de928d7', 'metadata': {}, 'outputs': [], 'source': ['import os\n', 'import csv\n', 'import pandas as pd']}, {'cell_type': 'code', 'execution_count': 2, 'id': '8f1478f8', 'metadata': {}, 'outputs': [], 'source': ['#Set Path\n', "pollCSV = os.path.join('Resources', 'election_data.CSV')\n", "pollCSV = r'C:\\Users\\rzh00\\Documents\\gt-virt-atl-data-pt-09-2021-u-c-master\\02-Homework\\03-Python\\Instructions\\PyPoll\\Resources\\election_data.csv'"]}, {'cell_type': 'code', 'execution_count': 3, 'id': '0f207e3c', 'metadata': {}, 'outputs': [], 'source': ['#Varibales\n', 'candi = []\n', 'vote_count = []\n', 'vote_percent = []\n', '\n', 'num_vote = 0']}, {'cell_type': 'code', 'execution_count': 7, 'id': '08423af7', 'metadata': {}, 'outputs': [], 'source': ['#Open CSV\n', 'with open(pollCSV) as csvfile:\n', " csvreader = csv.reader(csvfile, delimiter = ',')\n", ' csvheader = next(csvreader)\n', ' for row in csvreader: \n', ' num_vote = num_vote + 1 # total votes\n', ' candi_name = row[2] # adding candidate name to array\n', ' \n', ' if candi_name not in candi: #conditional to append any new candidates \n', ' candi.append(candi_name)\n', ' index = candi.index(row[2])\n', ' vote_count.append(1)\n', ' else:\n', ' index = candi.index(row[2])\n', ' vote_count[index] += 1\n', ' \n', ' for i in vote_count: # find the percentage of the votes recieved\n', ' percent = round((i/num_vote) * 100)\n', " percent = '%.3f%%' % percent\n", ' vote_percent.append(percent)\n', ' \n', ' winner = max(vote_count) # determine winner and update the value\n', ' index = vote_count.index(winner)\n', ' candi_winner = candi[index]']}, {'cell_type': 'code', 'execution_count': 16, 'id': '400521a2', 'metadata': {}, 'outputs': [{'name': 'stdout', 'output_type': 'stream', 'text': ['Election Results\n', '--------------------\n', 'Total Votes[4436463, 1408401, 985880, 211260]\n', '--------------------\n', 'Khan: 63.000% (4436463)\n', 'Correy: 20.000% (1408401)\n', 'Li: 14.000% (985880)\n', "O'Tooley: 3.000% (211260)\n", '--------------------\n', 'Winning Candidate: 4436463\n']}], 'source': ['#Print Results\n', "print('Election Results')\n", "print('-' * 20)\n", "print(f'Total Votes' + str(vote_count))\n", "print('-' * 20)\n", 'for i in range(len(candi)):\n', " print(f'{candi[i]}: {str(vote_percent[i])} ({str(vote_count[i])})')\n", "print('-' * 20)\n", "print(f'Winning Candidate: {winner}')"]}, {'cell_type': 'code', 'execution_count': 14, 'id': '18e81981', 'metadata': {}, 'outputs': [], 'source': ["result = os.path.join('output', 'result.txt')\n", "result = r'C:\\Users\\rzh00\\Documents\\gt-virt-atl-data-pt-09-2021-u-c-master\\02-Homework\\03-Python\\Instructions\\PyPoll\\result.txt'\n", '\n', "with open(result, 'w') as txt:\n", " txt.write('Election Results')\n", " txt.write('-' * 20)\n", " txt.write(f'Total Votes' + str(vote_count))\n", " txt.write('-' * 20)\n", ' for i in range(len(candi)):\n', " txt.write(f'{candi[i]}: {str(vote_percent[i])} ({str(vote_count[i])})')\n", " txt.write('-' * 20)\n", " txt.write(f'Winning Candidate: {winner}')\n", ' txt.close()']}, {'cell_type': 'code', 'execution_count': null, 'id': 'c5893e30', 'metadata': {}, 'outputs': [], 'source': []}], 'metadata': {'kernelspec': {'display_name': 'Python 3', 'language': 'python', 'name': 'python3'}, 'language_info': {'codemirror_mode': {'name': 'ipython', 'version': 3}, 'file_extension': '.py', 'mimetype': 'text/x-python', 'name': 'python', 'nbconvert_exporter': 'python', 'pygments_lexer': 'ipython3', 'version': '3.8.8'}}, 'nbformat': 4, 'nbformat_minor': 5} |
text = input().split(' ')
new_text = ''
for word in text:
if len(word) > 4:
if word[:2] in word[2:]:
word = word[2:]
new_text += ' ' + word
print(new_text[1:]) | text = input().split(' ')
new_text = ''
for word in text:
if len(word) > 4:
if word[:2] in word[2:]:
word = word[2:]
new_text += ' ' + word
print(new_text[1:]) |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ""
resLen = 0
while True:
if len(strs[0]) == resLen:
return strs[0]
curChar = strs[0][resLen]
for i in range(1, len(strs)):
if len(strs[i]) == resLen or strs[i][resLen] != curChar:
return strs[0][: resLen]
resLen += 1
return strs[0][: resLen]
| class Solution:
def longest_common_prefix(self, strs: List[str]) -> str:
if len(strs) == 0:
return ''
res_len = 0
while True:
if len(strs[0]) == resLen:
return strs[0]
cur_char = strs[0][resLen]
for i in range(1, len(strs)):
if len(strs[i]) == resLen or strs[i][resLen] != curChar:
return strs[0][:resLen]
res_len += 1
return strs[0][:resLen] |
#!python3
# -*- coding:utf-8 -*-
'''
this code is a sample of code for learn how to use python test modules.
'''
def aaa():
'''
printing tree ! mark.
'''
print("!!!")
def bbb():
'''
printing tree chars.
'''
print("BBB")
def ccc():
'''
printing number with loop.
'''
for i in range(5):
print(i)
| """
this code is a sample of code for learn how to use python test modules.
"""
def aaa():
"""
printing tree ! mark.
"""
print('!!!')
def bbb():
"""
printing tree chars.
"""
print('BBB')
def ccc():
"""
printing number with loop.
"""
for i in range(5):
print(i) |
# Project Framework default is 1 (Model/View/Provider)
# src is source where is the lib folder located
def startmain(src="flutterproject/myapp/lib", pkg="Provider", file="app_widget", home="",
project_framework=1, autoconfigfile=True):
maindart = open(src + "/main.dart", "w")
if project_framework == 1:
maindart.write(
"import 'package:flutter/material.dart';\n"
"import '" + pkg + "/" + file + ".dart';\n\n"
"void main() => runApp(AppWidget());")
else:
print("This project framework is not avaliable yet. :(")
maindart.close()
if autoconfigfile:
configfile(home, src, pkg, file)
# Its not recomended use this manually
def configfile(home, src, pkg, file):
app_widgetdart = open(src+"/"+pkg+"/"+file+".dart", "w")
if home == "":
app_widgetdart.write("import 'package:flutter/material.dart';\n\n"
"class AppWidget extends StatelessWidget {\n"
" @override\n"
" Widget build(BuildContext context) {\n"
" return MaterialApp();\n"
" }\n"
"}")
else:
app_widgetdart.write("import 'package:flutter/material.dart';\n"
"import '../View/Screens/homepage.dart';\n\n"
"class AppWidget extends StatelessWidget {\n"
" @override\n"
" Widget build(BuildContext context) {\n"
" return MaterialApp(\n"
" home:" + home + "(),\n"
" );\n"
" }\n"
"}")
app_widgetdart.close()
| def startmain(src='flutterproject/myapp/lib', pkg='Provider', file='app_widget', home='', project_framework=1, autoconfigfile=True):
maindart = open(src + '/main.dart', 'w')
if project_framework == 1:
maindart.write("import 'package:flutter/material.dart';\nimport '" + pkg + '/' + file + ".dart';\n\nvoid main() => runApp(AppWidget());")
else:
print('This project framework is not avaliable yet. :(')
maindart.close()
if autoconfigfile:
configfile(home, src, pkg, file)
def configfile(home, src, pkg, file):
app_widgetdart = open(src + '/' + pkg + '/' + file + '.dart', 'w')
if home == '':
app_widgetdart.write("import 'package:flutter/material.dart';\n\nclass AppWidget extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return MaterialApp();\n }\n}")
else:
app_widgetdart.write("import 'package:flutter/material.dart';\nimport '../View/Screens/homepage.dart';\n\nclass AppWidget extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n home:" + home + '(),\n );\n }\n}')
app_widgetdart.close() |
# Avg week temperature
print("Enter temperatures of 7 days:")
a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
g = float(input())
print("Average temperature:", (a+b+c+d+e+f+g)/7)
| print('Enter temperatures of 7 days:')
a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())
f = float(input())
g = float(input())
print('Average temperature:', (a + b + c + d + e + f + g) / 7) |
def digitSum(n,step):
res=0
while(n>0):
res+=n%10
n=n//10
step+=1
if(res<=9):
return (res,step)
else:
return digitSum(res,step)
t=int(input())
for _ in range(t):
minstep=[99999999 for i in range(10)] #cache
hitratio=[0 for i in range(10)]
maxhit=0
n,d=[int(x) for x in input().strip().split()]
if(n==1):
print("{0} {1}".format(n,0))
continue
if(d>9):
d=digitSum(d,0)[0] #minimize it to single digit
steps=0
if(n>9):
n,steps=digitSum(n,steps)
minstep[n]=min(minstep[n],steps)
minstep[n]=min(minstep[n],steps)
hitratio[n]+=1
maxhit=max(maxhit,hitratio[n])
if(n==1):
print("{0} {1}".format(n,steps))
continue
iteration=1
while(n!=1 and iteration<(10**8)):
iteration+=1
#print(minstep)
n=n+d
steps+=1
if(n<10):
minstep[n] = min(minstep[n],steps)
hitratio[n]+=1
maxhit=max(maxhit,hitratio[n])
if(n>9):
n,steps=digitSum(n,steps)
minstep[n] = min(minstep[n],steps)
hitratio[n]+=1
maxhit=max(maxhit,hitratio[n])
if(maxhit>100):
break
tempmin=10
for i in range(2,10):
if(minstep[i]!=99999999 and i<tempmin):
tempmin=i
print("{0} {1}".format(tempmin,minstep[tempmin]))
| def digit_sum(n, step):
res = 0
while n > 0:
res += n % 10
n = n // 10
step += 1
if res <= 9:
return (res, step)
else:
return digit_sum(res, step)
t = int(input())
for _ in range(t):
minstep = [99999999 for i in range(10)]
hitratio = [0 for i in range(10)]
maxhit = 0
(n, d) = [int(x) for x in input().strip().split()]
if n == 1:
print('{0} {1}'.format(n, 0))
continue
if d > 9:
d = digit_sum(d, 0)[0]
steps = 0
if n > 9:
(n, steps) = digit_sum(n, steps)
minstep[n] = min(minstep[n], steps)
minstep[n] = min(minstep[n], steps)
hitratio[n] += 1
maxhit = max(maxhit, hitratio[n])
if n == 1:
print('{0} {1}'.format(n, steps))
continue
iteration = 1
while n != 1 and iteration < 10 ** 8:
iteration += 1
n = n + d
steps += 1
if n < 10:
minstep[n] = min(minstep[n], steps)
hitratio[n] += 1
maxhit = max(maxhit, hitratio[n])
if n > 9:
(n, steps) = digit_sum(n, steps)
minstep[n] = min(minstep[n], steps)
hitratio[n] += 1
maxhit = max(maxhit, hitratio[n])
if maxhit > 100:
break
tempmin = 10
for i in range(2, 10):
if minstep[i] != 99999999 and i < tempmin:
tempmin = i
print('{0} {1}'.format(tempmin, minstep[tempmin])) |
######################################################
# #
# author #
# Parth Lathiya #
# https://www.cse.iitb.ac.in/~parthiitb/ #
# #
######################################################
at = int(input().strip())
for att in range(at):
u = list(map(int, input().strip().split()))
u.remove(len(u)-1)
print(max(u)) | at = int(input().strip())
for att in range(at):
u = list(map(int, input().strip().split()))
u.remove(len(u) - 1)
print(max(u)) |
# 15/15
num_of_flicks = int(input())
art = []
for _ in range(num_of_flicks):
coords = input().split(",")
art.append((int(coords[0]), int(coords[1])))
lowest_x = min(art, key=lambda x: x[0])[0] - 1
lowest_y = min(art, key=lambda x: x[1])[1] - 1
highest_x = max(art, key=lambda x: x[0])[0] + 1
highest_y = max(art, key=lambda x: x[1])[1] + 1
print(f"{lowest_x},{lowest_y}")
print(f"{highest_x},{highest_y}")
| num_of_flicks = int(input())
art = []
for _ in range(num_of_flicks):
coords = input().split(',')
art.append((int(coords[0]), int(coords[1])))
lowest_x = min(art, key=lambda x: x[0])[0] - 1
lowest_y = min(art, key=lambda x: x[1])[1] - 1
highest_x = max(art, key=lambda x: x[0])[0] + 1
highest_y = max(art, key=lambda x: x[1])[1] + 1
print(f'{lowest_x},{lowest_y}')
print(f'{highest_x},{highest_y}') |
print("Leap Year Range Calculator: ")
year1=int(input("Enter First Year: "))
year2 = int(input("Enter Last Year: "))
while year1<=year2:
if year1 % 4 == 0 :
print(year1,"is a leap year")
year1= year1 + 1
| print('Leap Year Range Calculator: ')
year1 = int(input('Enter First Year: '))
year2 = int(input('Enter Last Year: '))
while year1 <= year2:
if year1 % 4 == 0:
print(year1, 'is a leap year')
year1 = year1 + 1 |
#
# PySNMP MIB module MITEL-IPVIRTUAL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MITEL-IPVIRTUAL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:03:05 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:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ValueSizeConstraint")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
IpAddress, iso, Unsigned32, Counter64, TimeTicks, Bits, enterprises, ModuleIdentity, Gauge32, ObjectIdentity, Integer32, NotificationType, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "iso", "Unsigned32", "Counter64", "TimeTicks", "Bits", "enterprises", "ModuleIdentity", "Gauge32", "ObjectIdentity", "Integer32", "NotificationType", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32")
RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention")
mitelIpGrpIpVirtualGroup = ModuleIdentity((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4))
mitelIpGrpIpVirtualGroup.setRevisions(('2003-03-24 09:31', '1999-03-01 00:00',))
if mibBuilder.loadTexts: mitelIpGrpIpVirtualGroup.setLastUpdated('200303240931Z')
if mibBuilder.loadTexts: mitelIpGrpIpVirtualGroup.setOrganization('MITEL Corporation')
mitel = MibIdentifier((1, 3, 6, 1, 4, 1, 1027))
mitelProprietary = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4))
mitelPropIpNetworking = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 8))
mitelIpNetRouter = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1))
mitelRouterIpGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1))
mitelIpVGrpPortTable = MibTable((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1), )
if mibBuilder.loadTexts: mitelIpVGrpPortTable.setStatus('current')
mitelIpVGrpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1), ).setIndexNames((0, "MITEL-IPVIRTUAL-MIB", "mitelIpVGrpPortTableNetAddr"), (0, "MITEL-IPVIRTUAL-MIB", "mitelIpVGrpPortTableIfIndex"))
if mibBuilder.loadTexts: mitelIpVGrpPortEntry.setStatus('current')
mitelIpVGrpPortTableNetAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpPortTableNetAddr.setStatus('current')
mitelIpVGrpPortTableNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mitelIpVGrpPortTableNetMask.setStatus('current')
mitelIpVGrpPortTableIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpPortTableIfIndex.setStatus('current')
mitelIpVGrpPortTableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 12), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mitelIpVGrpPortTableStatus.setStatus('current')
mitelIpVGrpPortTableCfgMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("static", 1), ("addressless", 2), ("dhcp", 3), ("ipcp", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mitelIpVGrpPortTableCfgMethod.setStatus('current')
mitelIpVGrpRipTable = MibTable((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2), )
if mibBuilder.loadTexts: mitelIpVGrpRipTable.setStatus('current')
mitelIpVGrpRipEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1), ).setIndexNames((0, "MITEL-IPVIRTUAL-MIB", "mitelIpVGrpTableRipIpAddr"))
if mibBuilder.loadTexts: mitelIpVGrpRipEntry.setStatus('current')
mitelIpVGrpTableRipIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpTableRipIpAddr.setStatus('current')
mitelIpVGrpTableRipRxPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpTableRipRxPkts.setStatus('current')
mitelIpVGrpTableRipRxBadPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpTableRipRxBadPkts.setStatus('current')
mitelIpVGrpTableRipRxBadRtes = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpTableRipRxBadRtes.setStatus('current')
mitelIpVGrpTableRipTxUpdates = MibTableColumn((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mitelIpVGrpTableRipTxUpdates.setStatus('current')
mibBuilder.exportSymbols("MITEL-IPVIRTUAL-MIB", mitelIpVGrpTableRipRxBadRtes=mitelIpVGrpTableRipRxBadRtes, mitel=mitel, mitelIpVGrpRipTable=mitelIpVGrpRipTable, mitelIpVGrpPortTableNetMask=mitelIpVGrpPortTableNetMask, mitelIpVGrpPortTableStatus=mitelIpVGrpPortTableStatus, mitelIpGrpIpVirtualGroup=mitelIpGrpIpVirtualGroup, mitelIpVGrpPortTable=mitelIpVGrpPortTable, mitelIpVGrpTableRipIpAddr=mitelIpVGrpTableRipIpAddr, mitelIpNetRouter=mitelIpNetRouter, PYSNMP_MODULE_ID=mitelIpGrpIpVirtualGroup, mitelIpVGrpPortEntry=mitelIpVGrpPortEntry, mitelIpVGrpPortTableIfIndex=mitelIpVGrpPortTableIfIndex, mitelProprietary=mitelProprietary, mitelPropIpNetworking=mitelPropIpNetworking, mitelIpVGrpTableRipRxPkts=mitelIpVGrpTableRipRxPkts, mitelIpVGrpRipEntry=mitelIpVGrpRipEntry, mitelIpVGrpTableRipRxBadPkts=mitelIpVGrpTableRipRxBadPkts, mitelRouterIpGroup=mitelRouterIpGroup, mitelIpVGrpPortTableCfgMethod=mitelIpVGrpPortTableCfgMethod, mitelIpVGrpTableRipTxUpdates=mitelIpVGrpTableRipTxUpdates, mitelIpVGrpPortTableNetAddr=mitelIpVGrpPortTableNetAddr)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ValueSizeConstraint')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(ip_address, iso, unsigned32, counter64, time_ticks, bits, enterprises, module_identity, gauge32, object_identity, integer32, notification_type, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'iso', 'Unsigned32', 'Counter64', 'TimeTicks', 'Bits', 'enterprises', 'ModuleIdentity', 'Gauge32', 'ObjectIdentity', 'Integer32', 'NotificationType', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32')
(row_status, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'DisplayString', 'TextualConvention')
mitel_ip_grp_ip_virtual_group = module_identity((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4))
mitelIpGrpIpVirtualGroup.setRevisions(('2003-03-24 09:31', '1999-03-01 00:00'))
if mibBuilder.loadTexts:
mitelIpGrpIpVirtualGroup.setLastUpdated('200303240931Z')
if mibBuilder.loadTexts:
mitelIpGrpIpVirtualGroup.setOrganization('MITEL Corporation')
mitel = mib_identifier((1, 3, 6, 1, 4, 1, 1027))
mitel_proprietary = mib_identifier((1, 3, 6, 1, 4, 1, 1027, 4))
mitel_prop_ip_networking = mib_identifier((1, 3, 6, 1, 4, 1, 1027, 4, 8))
mitel_ip_net_router = mib_identifier((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1))
mitel_router_ip_group = mib_identifier((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1))
mitel_ip_v_grp_port_table = mib_table((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1))
if mibBuilder.loadTexts:
mitelIpVGrpPortTable.setStatus('current')
mitel_ip_v_grp_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1)).setIndexNames((0, 'MITEL-IPVIRTUAL-MIB', 'mitelIpVGrpPortTableNetAddr'), (0, 'MITEL-IPVIRTUAL-MIB', 'mitelIpVGrpPortTableIfIndex'))
if mibBuilder.loadTexts:
mitelIpVGrpPortEntry.setStatus('current')
mitel_ip_v_grp_port_table_net_addr = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 1), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpPortTableNetAddr.setStatus('current')
mitel_ip_v_grp_port_table_net_mask = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 2), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
mitelIpVGrpPortTableNetMask.setStatus('current')
mitel_ip_v_grp_port_table_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 11), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpPortTableIfIndex.setStatus('current')
mitel_ip_v_grp_port_table_status = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 12), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mitelIpVGrpPortTableStatus.setStatus('current')
mitel_ip_v_grp_port_table_cfg_method = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 1, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('static', 1), ('addressless', 2), ('dhcp', 3), ('ipcp', 4)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
mitelIpVGrpPortTableCfgMethod.setStatus('current')
mitel_ip_v_grp_rip_table = mib_table((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2))
if mibBuilder.loadTexts:
mitelIpVGrpRipTable.setStatus('current')
mitel_ip_v_grp_rip_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1)).setIndexNames((0, 'MITEL-IPVIRTUAL-MIB', 'mitelIpVGrpTableRipIpAddr'))
if mibBuilder.loadTexts:
mitelIpVGrpRipEntry.setStatus('current')
mitel_ip_v_grp_table_rip_ip_addr = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 1), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpTableRipIpAddr.setStatus('current')
mitel_ip_v_grp_table_rip_rx_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpTableRipRxPkts.setStatus('current')
mitel_ip_v_grp_table_rip_rx_bad_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpTableRipRxBadPkts.setStatus('current')
mitel_ip_v_grp_table_rip_rx_bad_rtes = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpTableRipRxBadRtes.setStatus('current')
mitel_ip_v_grp_table_rip_tx_updates = mib_table_column((1, 3, 6, 1, 4, 1, 1027, 4, 8, 1, 1, 4, 2, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mitelIpVGrpTableRipTxUpdates.setStatus('current')
mibBuilder.exportSymbols('MITEL-IPVIRTUAL-MIB', mitelIpVGrpTableRipRxBadRtes=mitelIpVGrpTableRipRxBadRtes, mitel=mitel, mitelIpVGrpRipTable=mitelIpVGrpRipTable, mitelIpVGrpPortTableNetMask=mitelIpVGrpPortTableNetMask, mitelIpVGrpPortTableStatus=mitelIpVGrpPortTableStatus, mitelIpGrpIpVirtualGroup=mitelIpGrpIpVirtualGroup, mitelIpVGrpPortTable=mitelIpVGrpPortTable, mitelIpVGrpTableRipIpAddr=mitelIpVGrpTableRipIpAddr, mitelIpNetRouter=mitelIpNetRouter, PYSNMP_MODULE_ID=mitelIpGrpIpVirtualGroup, mitelIpVGrpPortEntry=mitelIpVGrpPortEntry, mitelIpVGrpPortTableIfIndex=mitelIpVGrpPortTableIfIndex, mitelProprietary=mitelProprietary, mitelPropIpNetworking=mitelPropIpNetworking, mitelIpVGrpTableRipRxPkts=mitelIpVGrpTableRipRxPkts, mitelIpVGrpRipEntry=mitelIpVGrpRipEntry, mitelIpVGrpTableRipRxBadPkts=mitelIpVGrpTableRipRxBadPkts, mitelRouterIpGroup=mitelRouterIpGroup, mitelIpVGrpPortTableCfgMethod=mitelIpVGrpPortTableCfgMethod, mitelIpVGrpTableRipTxUpdates=mitelIpVGrpTableRipTxUpdates, mitelIpVGrpPortTableNetAddr=mitelIpVGrpPortTableNetAddr) |
def Reverse(Dna):
tt = {
'A' : 'T',
'T' : 'A',
'G' : 'C',
'C' : 'G',
}
ans = ''
for a in Dna:
ans += tt[a]
return ans[::-1]
def main(infile, outfile):
# Read the input, but do something non-trivial instead of count the lines in the file
inp = lines = [line.rstrip('\n') for line in infile]
print(inp)
output = str(Reverse(inp[0]))
# For debugging, print something to console
print(output)
# Write the output.
outfile.write(output) | def reverse(Dna):
tt = {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G'}
ans = ''
for a in Dna:
ans += tt[a]
return ans[::-1]
def main(infile, outfile):
inp = lines = [line.rstrip('\n') for line in infile]
print(inp)
output = str(reverse(inp[0]))
print(output)
outfile.write(output) |
# configuracoes pessoais
PERSONAL_NAME = 'YOU'
# configuracoes de email
EMAIL = 'your gmail account'
PASSWORD = 'your gmail PASSWORD'
RECEIVER_EMAIL = 'email to forward the contact messages'
# configuracoes do Google ReCaptha
SECRET_KEY = "Google ReCaptha's Secret key"
SITE_KEY = "Google ReCaptha's Site key"
APP_SECRET_KEY = '65#9DMN_T'
SKILLS = [
{
'name': 'Quick learner',
'strength': '90%'
},
{
'name': 'Flask',
'strength': '70%'
},
{
'name': 'Javascript',
'strength': '50%'
},
{
'name': 'Unit Test',
'strength': '30%'
}
]
EXPERINCES = [
{
'name': 'Intership',
'company': 'Stark Industries',
'location': 'New York City',
'working_period': 'May 2014 - June 2016',
'job_description': 'Developed tests for Mark IV, also designed some helmets for Mr. Stark.'
},
{
'name': 'Developer',
'company': 'Matrix',
'location': 'New York City',
'working_period': 'June 2016 - Currently',
'job_description': 'Created the main training prograns for martial arts.'
}
]
EDUCATION = [
{
'name': 'Bachelor of Computer Science',
'institution': 'University of Brasil',
'location': 'Brasil',
'graduation_year': '2016'
# 'extra_information': None
}
]
OBJECTIVE = 'Python developer'
| personal_name = 'YOU'
email = 'your gmail account'
password = 'your gmail PASSWORD'
receiver_email = 'email to forward the contact messages'
secret_key = "Google ReCaptha's Secret key"
site_key = "Google ReCaptha's Site key"
app_secret_key = '65#9DMN_T'
skills = [{'name': 'Quick learner', 'strength': '90%'}, {'name': 'Flask', 'strength': '70%'}, {'name': 'Javascript', 'strength': '50%'}, {'name': 'Unit Test', 'strength': '30%'}]
experinces = [{'name': 'Intership', 'company': 'Stark Industries', 'location': 'New York City', 'working_period': 'May 2014 - June 2016', 'job_description': 'Developed tests for Mark IV, also designed some helmets for Mr. Stark.'}, {'name': 'Developer', 'company': 'Matrix', 'location': 'New York City', 'working_period': 'June 2016 - Currently', 'job_description': 'Created the main training prograns for martial arts.'}]
education = [{'name': 'Bachelor of Computer Science', 'institution': 'University of Brasil', 'location': 'Brasil', 'graduation_year': '2016'}]
objective = 'Python developer' |
def test():
a = 10
fun1 = lambda: a
fun1()
print(a)
a += 1
fun1()
print(a)
return fun1
fun = test()
print(f"Fun: {fun()}")
| def test():
a = 10
fun1 = lambda : a
fun1()
print(a)
a += 1
fun1()
print(a)
return fun1
fun = test()
print(f'Fun: {fun()}') |
class DmpIo():
def __init__(self):
# inputs
self.event = None
self.username = None
self.password = None | class Dmpio:
def __init__(self):
self.event = None
self.username = None
self.password = None |
#
# PySNMP MIB module CISCO-STACK-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-STACK-CAPABILITY
# Produced by pysmi-0.3.4 at Wed May 1 12:12:54 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:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint")
ciscoAgentCapability, = mibBuilder.importSymbols("CISCO-SMI", "ciscoAgentCapability")
AgentCapabilities, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "AgentCapabilities", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, Gauge32, Counter64, Counter32, Integer32, Bits, ModuleIdentity, iso, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, MibIdentifier, IpAddress, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Gauge32", "Counter64", "Counter32", "Integer32", "Bits", "ModuleIdentity", "iso", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "MibIdentifier", "IpAddress", "NotificationType")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
ciscoStackCapability = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 7, 378))
ciscoStackCapability.setRevisions(('2008-03-19 00:00', '2006-03-15 00:00', '2005-01-19 00:00', '2003-12-17 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ciscoStackCapability.setRevisionsDescriptions(('Added ciscoStackCapCatOSV08R0701PCat6k for Cisco CatOS 8.7(1).', 'Add VARIATIONs for notifications chassisAlarmOff, chassisAlarmOn, moduleDown and moduleUp, in ciscoStackCapCatOSV08R0101Cat6k.', 'Added ciscoStackCapV12R0112cE01PCat6k for Cisco IOS 12.1(12c)E1.', 'Initial version of this MIB module.',))
if mibBuilder.loadTexts: ciscoStackCapability.setLastUpdated('200803190000Z')
if mibBuilder.loadTexts: ciscoStackCapability.setOrganization('Cisco Systems, Inc.')
if mibBuilder.loadTexts: ciscoStackCapability.setContactInfo(' Cisco Systems Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: [email protected], [email protected]')
if mibBuilder.loadTexts: ciscoStackCapability.setDescription('The capabilities description of CISCO-STACK-MIB.')
ciscoStackCapCatOSV08R0101Cat6k = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 1))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapCatOSV08R0101Cat6k = ciscoStackCapCatOSV08R0101Cat6k.setProductRelease('Cisco CatOS 8.1(1) on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapCatOSV08R0101Cat6k = ciscoStackCapCatOSV08R0101Cat6k.setStatus('current')
if mibBuilder.loadTexts: ciscoStackCapCatOSV08R0101Cat6k.setDescription('CISCO-STACK-MIB capabilities.')
ciscoStackCapV12R0111bEXCat6k = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 2))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapV12R0111bEXCat6k = ciscoStackCapV12R0111bEXCat6k.setProductRelease('Cisco IOS 12.1(11b)EX on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapV12R0111bEXCat6k = ciscoStackCapV12R0111bEXCat6k.setStatus('current')
if mibBuilder.loadTexts: ciscoStackCapV12R0111bEXCat6k.setDescription('CISCO-STACK-MIB capabilities.')
ciscoStackCapV12R0112cE01PCat6k = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 3))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapV12R0112cE01PCat6k = ciscoStackCapV12R0112cE01PCat6k.setProductRelease('Cisco IOS 12.1(12c)E1 on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapV12R0112cE01PCat6k = ciscoStackCapV12R0112cE01PCat6k.setStatus('current')
if mibBuilder.loadTexts: ciscoStackCapV12R0112cE01PCat6k.setDescription('CISCO-STACK-MIB capabilities.')
ciscoStackCapCatOSV08R0701PCat6k = AgentCapabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 4))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapCatOSV08R0701PCat6k = ciscoStackCapCatOSV08R0701PCat6k.setProductRelease('Cisco CatOS 8.7(1) on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoStackCapCatOSV08R0701PCat6k = ciscoStackCapCatOSV08R0701PCat6k.setStatus('current')
if mibBuilder.loadTexts: ciscoStackCapCatOSV08R0701PCat6k.setDescription('CISCO-STACK-MIB capabilities.')
mibBuilder.exportSymbols("CISCO-STACK-CAPABILITY", ciscoStackCapCatOSV08R0101Cat6k=ciscoStackCapCatOSV08R0101Cat6k, ciscoStackCapability=ciscoStackCapability, PYSNMP_MODULE_ID=ciscoStackCapability, ciscoStackCapCatOSV08R0701PCat6k=ciscoStackCapCatOSV08R0701PCat6k, ciscoStackCapV12R0112cE01PCat6k=ciscoStackCapV12R0112cE01PCat6k, ciscoStackCapV12R0111bEXCat6k=ciscoStackCapV12R0111bEXCat6k)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint')
(cisco_agent_capability,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoAgentCapability')
(agent_capabilities, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'AgentCapabilities', 'NotificationGroup', 'ModuleCompliance')
(object_identity, gauge32, counter64, counter32, integer32, bits, module_identity, iso, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, mib_identifier, ip_address, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'Gauge32', 'Counter64', 'Counter32', 'Integer32', 'Bits', 'ModuleIdentity', 'iso', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'MibIdentifier', 'IpAddress', 'NotificationType')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
cisco_stack_capability = module_identity((1, 3, 6, 1, 4, 1, 9, 7, 378))
ciscoStackCapability.setRevisions(('2008-03-19 00:00', '2006-03-15 00:00', '2005-01-19 00:00', '2003-12-17 00:00'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
ciscoStackCapability.setRevisionsDescriptions(('Added ciscoStackCapCatOSV08R0701PCat6k for Cisco CatOS 8.7(1).', 'Add VARIATIONs for notifications chassisAlarmOff, chassisAlarmOn, moduleDown and moduleUp, in ciscoStackCapCatOSV08R0101Cat6k.', 'Added ciscoStackCapV12R0112cE01PCat6k for Cisco IOS 12.1(12c)E1.', 'Initial version of this MIB module.'))
if mibBuilder.loadTexts:
ciscoStackCapability.setLastUpdated('200803190000Z')
if mibBuilder.loadTexts:
ciscoStackCapability.setOrganization('Cisco Systems, Inc.')
if mibBuilder.loadTexts:
ciscoStackCapability.setContactInfo(' Cisco Systems Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: [email protected], [email protected]')
if mibBuilder.loadTexts:
ciscoStackCapability.setDescription('The capabilities description of CISCO-STACK-MIB.')
cisco_stack_cap_cat_osv08_r0101_cat6k = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 1))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_cat_osv08_r0101_cat6k = ciscoStackCapCatOSV08R0101Cat6k.setProductRelease('Cisco CatOS 8.1(1) on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_cat_osv08_r0101_cat6k = ciscoStackCapCatOSV08R0101Cat6k.setStatus('current')
if mibBuilder.loadTexts:
ciscoStackCapCatOSV08R0101Cat6k.setDescription('CISCO-STACK-MIB capabilities.')
cisco_stack_cap_v12_r0111b_ex_cat6k = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 2))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_v12_r0111b_ex_cat6k = ciscoStackCapV12R0111bEXCat6k.setProductRelease('Cisco IOS 12.1(11b)EX on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_v12_r0111b_ex_cat6k = ciscoStackCapV12R0111bEXCat6k.setStatus('current')
if mibBuilder.loadTexts:
ciscoStackCapV12R0111bEXCat6k.setDescription('CISCO-STACK-MIB capabilities.')
cisco_stack_cap_v12_r0112c_e01_p_cat6k = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 3))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_v12_r0112c_e01_p_cat6k = ciscoStackCapV12R0112cE01PCat6k.setProductRelease('Cisco IOS 12.1(12c)E1 on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_v12_r0112c_e01_p_cat6k = ciscoStackCapV12R0112cE01PCat6k.setStatus('current')
if mibBuilder.loadTexts:
ciscoStackCapV12R0112cE01PCat6k.setDescription('CISCO-STACK-MIB capabilities.')
cisco_stack_cap_cat_osv08_r0701_p_cat6k = agent_capabilities((1, 3, 6, 1, 4, 1, 9, 7, 378, 4))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_cat_osv08_r0701_p_cat6k = ciscoStackCapCatOSV08R0701PCat6k.setProductRelease('Cisco CatOS 8.7(1) on Catalyst 6000/6500\n and Cisco 7600 series devices.')
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_stack_cap_cat_osv08_r0701_p_cat6k = ciscoStackCapCatOSV08R0701PCat6k.setStatus('current')
if mibBuilder.loadTexts:
ciscoStackCapCatOSV08R0701PCat6k.setDescription('CISCO-STACK-MIB capabilities.')
mibBuilder.exportSymbols('CISCO-STACK-CAPABILITY', ciscoStackCapCatOSV08R0101Cat6k=ciscoStackCapCatOSV08R0101Cat6k, ciscoStackCapability=ciscoStackCapability, PYSNMP_MODULE_ID=ciscoStackCapability, ciscoStackCapCatOSV08R0701PCat6k=ciscoStackCapCatOSV08R0701PCat6k, ciscoStackCapV12R0112cE01PCat6k=ciscoStackCapV12R0112cE01PCat6k, ciscoStackCapV12R0111bEXCat6k=ciscoStackCapV12R0111bEXCat6k) |
description = 'system setup'
group = 'lowlevel'
sysconfig = dict(
cache='localhost',
instrument='ESTIA',
experiment='Exp',
datasinks=['conssink', 'filesink', 'daemonsink'],
)
modules = ['nicos.commands.standard']
includes = ['temp']
devices = dict(
ESTIA=device('nicos.devices.instrument.Instrument',
description='instrument object',
instrument='estia',
responsible='Artur Glavic <[email protected]>',
website='https://confluence.esss.lu.se/display/ESTIA',
operators=['ESS', 'PSI'],
facility='Paul Scherrer Institut (PSI)',
),
Sample=device('nicos.devices.sample.Sample',
description='The currently used sample',
),
Exp=device('nicos.devices.experiment.Experiment',
description='experiment object',
dataroot='/opt/nicos-data',
sendmail=True,
serviceexp='p0',
sample='Sample',
),
filesink=device('nicos.devices.datasinks.AsciiScanfileSink',
),
conssink=device('nicos.devices.datasinks.ConsoleScanSink',
),
daemonsink=device('nicos.devices.datasinks.DaemonSink',
),
Space=device('nicos.devices.generic.FreeSpace',
description='The amount of free space for storing data',
path='/opt/nicos-data',
minfree=5,
),
)
| description = 'system setup'
group = 'lowlevel'
sysconfig = dict(cache='localhost', instrument='ESTIA', experiment='Exp', datasinks=['conssink', 'filesink', 'daemonsink'])
modules = ['nicos.commands.standard']
includes = ['temp']
devices = dict(ESTIA=device('nicos.devices.instrument.Instrument', description='instrument object', instrument='estia', responsible='Artur Glavic <[email protected]>', website='https://confluence.esss.lu.se/display/ESTIA', operators=['ESS', 'PSI'], facility='Paul Scherrer Institut (PSI)'), Sample=device('nicos.devices.sample.Sample', description='The currently used sample'), Exp=device('nicos.devices.experiment.Experiment', description='experiment object', dataroot='/opt/nicos-data', sendmail=True, serviceexp='p0', sample='Sample'), filesink=device('nicos.devices.datasinks.AsciiScanfileSink'), conssink=device('nicos.devices.datasinks.ConsoleScanSink'), daemonsink=device('nicos.devices.datasinks.DaemonSink'), Space=device('nicos.devices.generic.FreeSpace', description='The amount of free space for storing data', path='/opt/nicos-data', minfree=5)) |
a = float(input())
b = float(input())
c = float(input())
media = (a * 2 + b * 3 + c * 5) / (2 + 3 + 5)
print("MEDIA = {:.1f}".format(media))
| a = float(input())
b = float(input())
c = float(input())
media = (a * 2 + b * 3 + c * 5) / (2 + 3 + 5)
print('MEDIA = {:.1f}'.format(media)) |
#Aula 7
#Dicionarios
lista = []
# dicionario = {'Nome':'Matheus', 'Sobrenome': 'Schuetz' }
# print(dicionario)
# print(dicionario['Sobrenome'])
nome = 'Maria'
lista_notas = [10,20,50,70]
media = sum(lista_notas)/len(lista_notas)
situacao = 'Reprovado'
if media >=7:
situacao = 'Aprovado'
dicionario_alunos = {'Nome':nome, 'Lista_Notas':lista_notas, 'Media':media, 'Situacao':situacao}
print(f"{dicionario_alunos['Nome']} - {dicionario_alunos['Situacao']}")
| lista = []
nome = 'Maria'
lista_notas = [10, 20, 50, 70]
media = sum(lista_notas) / len(lista_notas)
situacao = 'Reprovado'
if media >= 7:
situacao = 'Aprovado'
dicionario_alunos = {'Nome': nome, 'Lista_Notas': lista_notas, 'Media': media, 'Situacao': situacao}
print(f"{dicionario_alunos['Nome']} - {dicionario_alunos['Situacao']}") |
TEACHER_AUTHORITIES = [
'VIEW_PROFILE',
'JUDGE_TASK',
'SHARE_TASK',
'VIEW_ABSENT',
'SUBMIT_LESSON',
'VIEW_LESSON',
'VIEW_ACTIVITY',
'EDIT_PROFILE',
'GIVE_TASK',
'VIEW_TASK',
'ADD_ABSENT'
]
STUDENT_AUTHORITIES = [
'VIEW_PROFILE',
'VIEW_LESSON',
'VIEW_ACTIVITY',
'VIEW_TASK_FRAGMENT',
'DOING_TASK',
'VIEW_ABSENT',
'EDIT_PROFILE',
]
OTHER_AUTHORITIES = [
'VIEW_LESSON',
'VIEW_MAP',
'VIEW_CHALLENGE'
'EDIT_SCHOOL',
'EDIT_PROFILE',
'DO_CHALLENGE',
'ADD_SCHOOL'
]
| teacher_authorities = ['VIEW_PROFILE', 'JUDGE_TASK', 'SHARE_TASK', 'VIEW_ABSENT', 'SUBMIT_LESSON', 'VIEW_LESSON', 'VIEW_ACTIVITY', 'EDIT_PROFILE', 'GIVE_TASK', 'VIEW_TASK', 'ADD_ABSENT']
student_authorities = ['VIEW_PROFILE', 'VIEW_LESSON', 'VIEW_ACTIVITY', 'VIEW_TASK_FRAGMENT', 'DOING_TASK', 'VIEW_ABSENT', 'EDIT_PROFILE']
other_authorities = ['VIEW_LESSON', 'VIEW_MAP', 'VIEW_CHALLENGEEDIT_SCHOOL', 'EDIT_PROFILE', 'DO_CHALLENGE', 'ADD_SCHOOL'] |
def _init():
global _global_dict
_global_dict = {}
def set_value(key, value):
_global_dict[key] = value
def get_value(key):
return _global_dict.get(key)
_init() | def _init():
global _global_dict
_global_dict = {}
def set_value(key, value):
_global_dict[key] = value
def get_value(key):
return _global_dict.get(key)
_init() |
#
# PySNMP MIB module CISCO-VLAN-GROUP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VLAN-GROUP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:02:29 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:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
Cisco2KVlanList, = mibBuilder.importSymbols("CISCO-TC", "Cisco2KVlanList")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
Unsigned32, IpAddress, ModuleIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Counter64, NotificationType, ObjectIdentity, Gauge32, Integer32, TimeTicks, Counter32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "IpAddress", "ModuleIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Counter64", "NotificationType", "ObjectIdentity", "Gauge32", "Integer32", "TimeTicks", "Counter32", "MibIdentifier")
RowStatus, TextualConvention, DisplayString, StorageType = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "DisplayString", "StorageType")
ciscoVlanGroupMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 709))
ciscoVlanGroupMIB.setRevisions(('2011-03-22 00:00', '2009-11-20 00:00',))
if mibBuilder.loadTexts: ciscoVlanGroupMIB.setLastUpdated('201103220000Z')
if mibBuilder.loadTexts: ciscoVlanGroupMIB.setOrganization('Cisco Systems, Inc.')
ciscoVlanGroupMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 0))
ciscoVlanGroupMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 1))
ciscoVlanGroupMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 2))
cvgConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1), )
if mibBuilder.loadTexts: cvgConfigTable.setStatus('current')
cvgConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1), ).setIndexNames((0, "CISCO-VLAN-GROUP-MIB", "cvgConfigGroupName"))
if mibBuilder.loadTexts: cvgConfigEntry.setStatus('current')
cvgConfigGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 1), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 32)))
if mibBuilder.loadTexts: cvgConfigGroupName.setStatus('current')
cvgConfigVlansFirst2K = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 2), Cisco2KVlanList()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cvgConfigVlansFirst2K.setStatus('current')
cvgConfigVlansSecond2K = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 3), Cisco2KVlanList()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cvgConfigVlansSecond2K.setStatus('current')
cvgConfigStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 4), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cvgConfigStorageType.setStatus('current')
cvgConfigRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cvgConfigRowStatus.setStatus('current')
cvgConfigTableSize = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cvgConfigTableSize.setStatus('current')
ciscoVlanGroupMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 1))
ciscoVlanGroupMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 2))
ciscoVlanGroupMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 1, 1)).setObjects(("CISCO-VLAN-GROUP-MIB", "ciscoVlanGroupConfigGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoVlanGroupMIBCompliance = ciscoVlanGroupMIBCompliance.setStatus('deprecated')
ciscoVlanGroupMIBCompliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 1, 2)).setObjects(("CISCO-VLAN-GROUP-MIB", "ciscoVlanGroupConfigGroup"), ("CISCO-VLAN-GROUP-MIB", "cvgConfigTableSizeGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoVlanGroupMIBCompliance2 = ciscoVlanGroupMIBCompliance2.setStatus('current')
ciscoVlanGroupConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 2, 1)).setObjects(("CISCO-VLAN-GROUP-MIB", "cvgConfigVlansFirst2K"), ("CISCO-VLAN-GROUP-MIB", "cvgConfigVlansSecond2K"), ("CISCO-VLAN-GROUP-MIB", "cvgConfigRowStatus"), ("CISCO-VLAN-GROUP-MIB", "cvgConfigStorageType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoVlanGroupConfigGroup = ciscoVlanGroupConfigGroup.setStatus('current')
cvgConfigTableSizeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 2, 2)).setObjects(("CISCO-VLAN-GROUP-MIB", "cvgConfigTableSize"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cvgConfigTableSizeGroup = cvgConfigTableSizeGroup.setStatus('current')
mibBuilder.exportSymbols("CISCO-VLAN-GROUP-MIB", cvgConfigEntry=cvgConfigEntry, cvgConfigTableSizeGroup=cvgConfigTableSizeGroup, cvgConfigTable=cvgConfigTable, ciscoVlanGroupConfigGroup=ciscoVlanGroupConfigGroup, ciscoVlanGroupMIBNotifs=ciscoVlanGroupMIBNotifs, ciscoVlanGroupMIBGroups=ciscoVlanGroupMIBGroups, cvgConfigGroupName=cvgConfigGroupName, ciscoVlanGroupMIBConform=ciscoVlanGroupMIBConform, ciscoVlanGroupMIBCompliance2=ciscoVlanGroupMIBCompliance2, ciscoVlanGroupMIB=ciscoVlanGroupMIB, ciscoVlanGroupMIBCompliance=ciscoVlanGroupMIBCompliance, PYSNMP_MODULE_ID=ciscoVlanGroupMIB, cvgConfigRowStatus=cvgConfigRowStatus, cvgConfigVlansFirst2K=cvgConfigVlansFirst2K, ciscoVlanGroupMIBCompliances=ciscoVlanGroupMIBCompliances, cvgConfigVlansSecond2K=cvgConfigVlansSecond2K, ciscoVlanGroupMIBObjects=ciscoVlanGroupMIBObjects, cvgConfigTableSize=cvgConfigTableSize, cvgConfigStorageType=cvgConfigStorageType)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection')
(cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt')
(cisco2_k_vlan_list,) = mibBuilder.importSymbols('CISCO-TC', 'Cisco2KVlanList')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(unsigned32, ip_address, module_identity, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, counter64, notification_type, object_identity, gauge32, integer32, time_ticks, counter32, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'IpAddress', 'ModuleIdentity', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'Counter64', 'NotificationType', 'ObjectIdentity', 'Gauge32', 'Integer32', 'TimeTicks', 'Counter32', 'MibIdentifier')
(row_status, textual_convention, display_string, storage_type) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TextualConvention', 'DisplayString', 'StorageType')
cisco_vlan_group_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 709))
ciscoVlanGroupMIB.setRevisions(('2011-03-22 00:00', '2009-11-20 00:00'))
if mibBuilder.loadTexts:
ciscoVlanGroupMIB.setLastUpdated('201103220000Z')
if mibBuilder.loadTexts:
ciscoVlanGroupMIB.setOrganization('Cisco Systems, Inc.')
cisco_vlan_group_mib_notifs = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 0))
cisco_vlan_group_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 1))
cisco_vlan_group_mib_conform = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 2))
cvg_config_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1))
if mibBuilder.loadTexts:
cvgConfigTable.setStatus('current')
cvg_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1)).setIndexNames((0, 'CISCO-VLAN-GROUP-MIB', 'cvgConfigGroupName'))
if mibBuilder.loadTexts:
cvgConfigEntry.setStatus('current')
cvg_config_group_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 1), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(1, 32)))
if mibBuilder.loadTexts:
cvgConfigGroupName.setStatus('current')
cvg_config_vlans_first2_k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 2), cisco2_k_vlan_list()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cvgConfigVlansFirst2K.setStatus('current')
cvg_config_vlans_second2_k = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 3), cisco2_k_vlan_list()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cvgConfigVlansSecond2K.setStatus('current')
cvg_config_storage_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 4), storage_type().clone('volatile')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cvgConfigStorageType.setStatus('current')
cvg_config_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 1, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
cvgConfigRowStatus.setStatus('current')
cvg_config_table_size = mib_scalar((1, 3, 6, 1, 4, 1, 9, 9, 709, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cvgConfigTableSize.setStatus('current')
cisco_vlan_group_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 1))
cisco_vlan_group_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 2))
cisco_vlan_group_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 1, 1)).setObjects(('CISCO-VLAN-GROUP-MIB', 'ciscoVlanGroupConfigGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_vlan_group_mib_compliance = ciscoVlanGroupMIBCompliance.setStatus('deprecated')
cisco_vlan_group_mib_compliance2 = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 1, 2)).setObjects(('CISCO-VLAN-GROUP-MIB', 'ciscoVlanGroupConfigGroup'), ('CISCO-VLAN-GROUP-MIB', 'cvgConfigTableSizeGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_vlan_group_mib_compliance2 = ciscoVlanGroupMIBCompliance2.setStatus('current')
cisco_vlan_group_config_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 2, 1)).setObjects(('CISCO-VLAN-GROUP-MIB', 'cvgConfigVlansFirst2K'), ('CISCO-VLAN-GROUP-MIB', 'cvgConfigVlansSecond2K'), ('CISCO-VLAN-GROUP-MIB', 'cvgConfigRowStatus'), ('CISCO-VLAN-GROUP-MIB', 'cvgConfigStorageType'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cisco_vlan_group_config_group = ciscoVlanGroupConfigGroup.setStatus('current')
cvg_config_table_size_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 709, 2, 2, 2)).setObjects(('CISCO-VLAN-GROUP-MIB', 'cvgConfigTableSize'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cvg_config_table_size_group = cvgConfigTableSizeGroup.setStatus('current')
mibBuilder.exportSymbols('CISCO-VLAN-GROUP-MIB', cvgConfigEntry=cvgConfigEntry, cvgConfigTableSizeGroup=cvgConfigTableSizeGroup, cvgConfigTable=cvgConfigTable, ciscoVlanGroupConfigGroup=ciscoVlanGroupConfigGroup, ciscoVlanGroupMIBNotifs=ciscoVlanGroupMIBNotifs, ciscoVlanGroupMIBGroups=ciscoVlanGroupMIBGroups, cvgConfigGroupName=cvgConfigGroupName, ciscoVlanGroupMIBConform=ciscoVlanGroupMIBConform, ciscoVlanGroupMIBCompliance2=ciscoVlanGroupMIBCompliance2, ciscoVlanGroupMIB=ciscoVlanGroupMIB, ciscoVlanGroupMIBCompliance=ciscoVlanGroupMIBCompliance, PYSNMP_MODULE_ID=ciscoVlanGroupMIB, cvgConfigRowStatus=cvgConfigRowStatus, cvgConfigVlansFirst2K=cvgConfigVlansFirst2K, ciscoVlanGroupMIBCompliances=ciscoVlanGroupMIBCompliances, cvgConfigVlansSecond2K=cvgConfigVlansSecond2K, ciscoVlanGroupMIBObjects=ciscoVlanGroupMIBObjects, cvgConfigTableSize=cvgConfigTableSize, cvgConfigStorageType=cvgConfigStorageType) |
def hello_world():
print("hello world")
# [REQ-002]
def hello_world_2():
print("hello world")
# [/REQ-002]
| def hello_world():
print('hello world')
def hello_world_2():
print('hello world') |
class Solution:
def solve(self, s, pairs):
letters = set(ascii_lowercase)
leaders = {letter:letter for letter in letters}
followers = {letter:[letter] for letter in letters}
for a,b in pairs:
if leaders[a] == leaders[b]: continue
if len(followers[a]) < len(followers[b]): a,b = b,a
old_leader = leaders[b]
new_leader = leaders[a]
for follower in followers[old_leader]:
leaders[follower] = new_leader
followers[new_leader].append(follower)
followers[old_leader] = []
return all(leaders[s[i]]==leaders[s[~i]] for i in range(len(s)))
| class Solution:
def solve(self, s, pairs):
letters = set(ascii_lowercase)
leaders = {letter: letter for letter in letters}
followers = {letter: [letter] for letter in letters}
for (a, b) in pairs:
if leaders[a] == leaders[b]:
continue
if len(followers[a]) < len(followers[b]):
(a, b) = (b, a)
old_leader = leaders[b]
new_leader = leaders[a]
for follower in followers[old_leader]:
leaders[follower] = new_leader
followers[new_leader].append(follower)
followers[old_leader] = []
return all((leaders[s[i]] == leaders[s[~i]] for i in range(len(s)))) |
prompt = "How old are you?"
message = ""
while message != 'quit':
message = input(prompt)
if message != 'quit':
age = int(message)
if age < 3:
print("Free")
elif age < 12:
print("The fare is 10 dollar")
else:
print("The fare is 15 dollar")
| prompt = 'How old are you?'
message = ''
while message != 'quit':
message = input(prompt)
if message != 'quit':
age = int(message)
if age < 3:
print('Free')
elif age < 12:
print('The fare is 10 dollar')
else:
print('The fare is 15 dollar') |
# Variables
first_name = "Ada"
# print function followed by variable name.
print("Hello,", first_name)
print(first_name, "is learning Python")
# print takes multiple arguments.
print("These", "will be", "joined together by spaces")
# input statement.
first_name = input("What is your first name? ")
print("Hello,", first_name)
| first_name = 'Ada'
print('Hello,', first_name)
print(first_name, 'is learning Python')
print('These', 'will be', 'joined together by spaces')
first_name = input('What is your first name? ')
print('Hello,', first_name) |
def extractThehlifestyleCom(item):
'''
Parser for 'thehlifestyle.com'
'''
tstr = str(item['tags']).lower()
if 'review' in tstr:
return None
if 'actors' in tstr:
return None
if 'game' in tstr:
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('The Beloved Imperial Consort translation', 'The Beloved Imperial Consort', 'translated'),
('Good Morning, Miss Undercover Translation', 'Good Morning, Miss Undercover', 'translated'),
('Hilarous Pampered Consort Translation', 'Hilarous Pampered Consort', 'translated'),
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', 'oel'),
]
for tagname, name, tl_type in tagmap:
if tagname in item['tags']:
return buildReleaseMessageWithType(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
return False | def extract_thehlifestyle_com(item):
"""
Parser for 'thehlifestyle.com'
"""
tstr = str(item['tags']).lower()
if 'review' in tstr:
return None
if 'actors' in tstr:
return None
if 'game' in tstr:
return None
(vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [('The Beloved Imperial Consort translation', 'The Beloved Imperial Consort', 'translated'), ('Good Morning, Miss Undercover Translation', 'Good Morning, Miss Undercover', 'translated'), ('Hilarous Pampered Consort Translation', 'Hilarous Pampered Consort', 'translated'), ('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel')]
for (tagname, name, tl_type) in tagmap:
if tagname in item['tags']:
return build_release_message_with_type(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
return False |
ATTACK = '-'
SUPPORT = '+'
NEUTRAL = '0'
CRITICAL_SUPPORT = '+!'
CRITICAL_ATTACK = '-!'
WEAK_SUPPORT = '+*'
WEAK_ATTACK = '-*'
NON_SUPPORT = '+~'
NON_ATTACK = '-~'
TRIPOLAR_RELATIONS = [ATTACK, SUPPORT, NEUTRAL]
QUADPOLAR_RELATIONS = [ATTACK, SUPPORT, NEUTRAL, CRITICAL_SUPPORT]
def get_type(val):
if val > 0:
return SUPPORT
elif val < 0:
return ATTACK
else:
return NEUTRAL
def get_relations_set(G, rel=None):
return set([edge for edge in G.edges if rel is None or G.edges[edge]['type'] == rel]) | attack = '-'
support = '+'
neutral = '0'
critical_support = '+!'
critical_attack = '-!'
weak_support = '+*'
weak_attack = '-*'
non_support = '+~'
non_attack = '-~'
tripolar_relations = [ATTACK, SUPPORT, NEUTRAL]
quadpolar_relations = [ATTACK, SUPPORT, NEUTRAL, CRITICAL_SUPPORT]
def get_type(val):
if val > 0:
return SUPPORT
elif val < 0:
return ATTACK
else:
return NEUTRAL
def get_relations_set(G, rel=None):
return set([edge for edge in G.edges if rel is None or G.edges[edge]['type'] == rel]) |
# repeating strings
s = "?"
for i in range(4):
print(s, end="")
print()
print(s * 4)
# looping strings
text = "This is an example."
count = 0
for char in text:
# isalpha() returns true if the character is a-z
if char.isalpha():
count += 1 | s = '?'
for i in range(4):
print(s, end='')
print()
print(s * 4)
text = 'This is an example.'
count = 0
for char in text:
if char.isalpha():
count += 1 |
CREDENTIALS = {
'username': 'Replace with your WA username',
'password': 'Replace with your WA password (b64)'
}
DEFAULT_RECIPIENTS = ('[email protected]', '[email protected]',)
HOST_NOTIFICATION = '%(emoji)s %(type)s HOST ALERT %(emoji)s\n\n' + \
'Host %(host)s, %(address)s is %(state)s.\n\n' + \
'%(info)s\n\n' + \
'%(time)s'
SERVICE_NOTIFICATION = '%(emoji)s %(type)s SERVICE ALERT %(emoji)s\n\n' + \
'Service %(service)s @ %(host)s, %(address)s is %(state)s.\n\n' + \
'%(info)s\n\n' + \
'%(time)s' | credentials = {'username': 'Replace with your WA username', 'password': 'Replace with your WA password (b64)'}
default_recipients = ('[email protected]', '[email protected]')
host_notification = '%(emoji)s %(type)s HOST ALERT %(emoji)s\n\n' + 'Host %(host)s, %(address)s is %(state)s.\n\n' + '%(info)s\n\n' + '%(time)s'
service_notification = '%(emoji)s %(type)s SERVICE ALERT %(emoji)s\n\n' + 'Service %(service)s @ %(host)s, %(address)s is %(state)s.\n\n' + '%(info)s\n\n' + '%(time)s' |
'''9. Write a Python program to get the difference between the two lists. '''
def difference_twoLists(lst1, lst2):
lst1 = set(lst1)
lst2 = set(lst2)
return list(lst1 - lst2)
print(difference_twoLists([1, 2, 3, 4], [4, 5, 6, 7]))
print(difference_twoLists([1, 2, 3, 4], [0, 5, 6, 7]))
print(difference_twoLists([1, 2, 3, 4], [3, 5, 6, 7])) | """9. Write a Python program to get the difference between the two lists. """
def difference_two_lists(lst1, lst2):
lst1 = set(lst1)
lst2 = set(lst2)
return list(lst1 - lst2)
print(difference_two_lists([1, 2, 3, 4], [4, 5, 6, 7]))
print(difference_two_lists([1, 2, 3, 4], [0, 5, 6, 7]))
print(difference_two_lists([1, 2, 3, 4], [3, 5, 6, 7])) |
'''
module for implementation of
cycle sort
'''
def cycle_sort(arr: list):
writes = 0
for cycleStart in range(0, len(arr) - 1):
item = arr[cycleStart]
pos = cycleStart
for i in range(cycleStart + 1, len(arr)):
if (arr[i] < item):
pos += 1
if (pos == cycleStart):
continue
while (item == arr[pos]):
pos += 1
arr[pos], item = item, arr[pos]
writes += 1
while (pos != cycleStart):
pos = cycleStart
for i in range(cycleStart + 1, len(arr)):
if (arr[i] < item):
pos += 1
while (item == arr[pos]):
pos += 1
arr[pos], item = item, arr[pos]
writes += 1
return arr
'''
PyAlgo
Devansh Singh
''' | """
module for implementation of
cycle sort
"""
def cycle_sort(arr: list):
writes = 0
for cycle_start in range(0, len(arr) - 1):
item = arr[cycleStart]
pos = cycleStart
for i in range(cycleStart + 1, len(arr)):
if arr[i] < item:
pos += 1
if pos == cycleStart:
continue
while item == arr[pos]:
pos += 1
(arr[pos], item) = (item, arr[pos])
writes += 1
while pos != cycleStart:
pos = cycleStart
for i in range(cycleStart + 1, len(arr)):
if arr[i] < item:
pos += 1
while item == arr[pos]:
pos += 1
(arr[pos], item) = (item, arr[pos])
writes += 1
return arr
'\nPyAlgo\nDevansh Singh\n' |
class Script:
@staticmethod
def main():
cities = ["Albuquerque", "Anaheim", "Anchorage", "Arlington", "Atlanta", "Aurora", "Austin", "Bakersfield", "Baltimore", "Boston", "Buffalo", "Charlotte-Mecklenburg", "Cincinnati", "Cleveland", "Colorado Springs", "Corpus Christi", "Dallas", "Denver", "Detroit", "El Paso", "Fort Wayne", "Fort Worth", "Fresno", "Greensboro", "Henderson", "Houston", "Indianapolis", "Jacksonville", "Jersey City", "Kansas City", "Las Vegas", "Lexington", "Lincoln", "Long Beach", "Los Angeles", "Louisville Metro", "Memphis", "Mesa", "Miami", "Milwaukee", "Minneapolis", "Mobile", "Nashville", "New Orleans", "New York", "Newark", "Oakland", "Oklahoma City", "Omaha", "Philadelphia", "Phoenix", "Pittsburgh", "Plano", "Portland", "Raleigh", "Riverside", "Sacramento", "San Antonio", "San Diego", "San Francisco", "San Jose", "Santa Ana", "Seattle", "St. Louis", "St. Paul", "Stockton", "Tampa", "Toledo", "Tucson", "Tulsa", "Virginia Beach", "Washington", "Wichita"]
first_alb = ((cities[0] if 0 < len(cities) else None) == "Albuquerque")
second_alb = ((cities[1] if 1 < len(cities) else None) == "Albuquerque")
first_last = ((cities[0] if 0 < len(cities) else None) == python_internal_ArrayImpl._get(cities, (len(cities) - 1)))
print(str(first_alb))
print(str(second_alb))
print(str(first_last))
class python_internal_ArrayImpl:
@staticmethod
def _get(x,idx):
if ((idx > -1) and ((idx < len(x)))):
return x[idx]
else:
return None
Script.main() | class Script:
@staticmethod
def main():
cities = ['Albuquerque', 'Anaheim', 'Anchorage', 'Arlington', 'Atlanta', 'Aurora', 'Austin', 'Bakersfield', 'Baltimore', 'Boston', 'Buffalo', 'Charlotte-Mecklenburg', 'Cincinnati', 'Cleveland', 'Colorado Springs', 'Corpus Christi', 'Dallas', 'Denver', 'Detroit', 'El Paso', 'Fort Wayne', 'Fort Worth', 'Fresno', 'Greensboro', 'Henderson', 'Houston', 'Indianapolis', 'Jacksonville', 'Jersey City', 'Kansas City', 'Las Vegas', 'Lexington', 'Lincoln', 'Long Beach', 'Los Angeles', 'Louisville Metro', 'Memphis', 'Mesa', 'Miami', 'Milwaukee', 'Minneapolis', 'Mobile', 'Nashville', 'New Orleans', 'New York', 'Newark', 'Oakland', 'Oklahoma City', 'Omaha', 'Philadelphia', 'Phoenix', 'Pittsburgh', 'Plano', 'Portland', 'Raleigh', 'Riverside', 'Sacramento', 'San Antonio', 'San Diego', 'San Francisco', 'San Jose', 'Santa Ana', 'Seattle', 'St. Louis', 'St. Paul', 'Stockton', 'Tampa', 'Toledo', 'Tucson', 'Tulsa', 'Virginia Beach', 'Washington', 'Wichita']
first_alb = (cities[0] if 0 < len(cities) else None) == 'Albuquerque'
second_alb = (cities[1] if 1 < len(cities) else None) == 'Albuquerque'
first_last = (cities[0] if 0 < len(cities) else None) == python_internal_ArrayImpl._get(cities, len(cities) - 1)
print(str(first_alb))
print(str(second_alb))
print(str(first_last))
class Python_Internal_Arrayimpl:
@staticmethod
def _get(x, idx):
if idx > -1 and idx < len(x):
return x[idx]
else:
return None
Script.main() |
fig, ax = create_map_background()
# Contour 1 - Temperature, dotted
cs2 = ax.contour(lon, lat, tmpk_850.to('degC'), range(-50, 50, 2),
colors='grey', linestyles='dotted', transform=dataproj)
plt.clabel(cs2, fontsize=10, inline=1, inline_spacing=10, fmt='%i',
rightside_up=True, use_clabeltext=True)
# Contour 2
clev850 = np.arange(0, 4000, 30)
cs = ax.contour(lon, lat, hght_850, clev850, colors='k',
linewidths=1.0, linestyles='solid', transform=dataproj)
plt.clabel(cs, fontsize=10, inline=1, inline_spacing=10, fmt='%i',
rightside_up=True, use_clabeltext=True)
# Filled contours - Temperature advection
contours = [-3, -2.2, -2, -1.5, -1, -0.5, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
cf = ax.contourf(lon, lat, tmpc_adv_850*3600, contours,
cmap='bwr', extend='both', transform=dataproj)
plt.colorbar(cf, orientation='horizontal', pad=0, aspect=50,
extendrect=True, ticks=contours)
# Vector
ax.barbs(lon, lat, uwnd_850.to('kts').m, vwnd_850.to('kts').m,
regrid_shape=15, transform=dataproj)
# Titles
plt.title('850-hPa Geopotential Heights, Temperature (C), \
Temp Adv (C/h), and Wind Barbs (kts)', loc='left')
plt.title('VALID: {}'.format(vtime), loc='right')
plt.tight_layout()
plt.show()
| (fig, ax) = create_map_background()
cs2 = ax.contour(lon, lat, tmpk_850.to('degC'), range(-50, 50, 2), colors='grey', linestyles='dotted', transform=dataproj)
plt.clabel(cs2, fontsize=10, inline=1, inline_spacing=10, fmt='%i', rightside_up=True, use_clabeltext=True)
clev850 = np.arange(0, 4000, 30)
cs = ax.contour(lon, lat, hght_850, clev850, colors='k', linewidths=1.0, linestyles='solid', transform=dataproj)
plt.clabel(cs, fontsize=10, inline=1, inline_spacing=10, fmt='%i', rightside_up=True, use_clabeltext=True)
contours = [-3, -2.2, -2, -1.5, -1, -0.5, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
cf = ax.contourf(lon, lat, tmpc_adv_850 * 3600, contours, cmap='bwr', extend='both', transform=dataproj)
plt.colorbar(cf, orientation='horizontal', pad=0, aspect=50, extendrect=True, ticks=contours)
ax.barbs(lon, lat, uwnd_850.to('kts').m, vwnd_850.to('kts').m, regrid_shape=15, transform=dataproj)
plt.title('850-hPa Geopotential Heights, Temperature (C), Temp Adv (C/h), and Wind Barbs (kts)', loc='left')
plt.title('VALID: {}'.format(vtime), loc='right')
plt.tight_layout()
plt.show() |
#Ejercicio 01
def binarySearch(arr, valor):
#Dado un arreglo y un elemento
#Busca el elemento dado en el arreglo
inicio = 0
final = len(arr) - 1
while inicio <= final:
medio = (inicio + final) // 2
if arr[medio] == valor:
return True
elif arr[medio] < valor:
inicio = medio + 1
elif arr[medio] > valor:
final = medio -1
return False
arreglo = [2,4,8,9,10,22,25,26,28,29,30,42,45,56]
print(binarySearch(arreglo,22))
print(binarySearch(arreglo,24))
| def binary_search(arr, valor):
inicio = 0
final = len(arr) - 1
while inicio <= final:
medio = (inicio + final) // 2
if arr[medio] == valor:
return True
elif arr[medio] < valor:
inicio = medio + 1
elif arr[medio] > valor:
final = medio - 1
return False
arreglo = [2, 4, 8, 9, 10, 22, 25, 26, 28, 29, 30, 42, 45, 56]
print(binary_search(arreglo, 22))
print(binary_search(arreglo, 24)) |
# William Thompson (wtt53)
# Software Testing and QA
# Assignment 1: Test Driven Development
# Retirement: Takes current age (int), annual salary (float),
# percent of annual salary saved (float), and savings goal (float)
# and outputs what age savings goal will be met
def calc_retirement(age, salary, percent, goal):
# cast each variable as its proper data type
try:
age = int(age)
salary = float(salary)
percent = float(percent)
goal = float(goal)
except Exception:
return (False)
# check each value to make sure it is in the proper range
if ((age < 15 or age > 99)
or (salary <= 0)
or (percent <= 0)
or (goal <= 0)):
return (False)
# savings from salary without employer's 35%
rawAnnualSavings = salary * (percent / 100)
# total annual savings including employer's 35%
annualSavings = rawAnnualSavings + (rawAnnualSavings * 0.35)
# total savings so far
currentSavings = 0.00
# add annual savings to total savings for each year until age 100
for i in range(age, 100):
currentSavings += annualSavings
if currentSavings >= goal:
return("You will meet your savings goal at age "+str(i))
# Notify user if they will not meet their goal
return("Sorry, your goal won't be met.")
| def calc_retirement(age, salary, percent, goal):
try:
age = int(age)
salary = float(salary)
percent = float(percent)
goal = float(goal)
except Exception:
return False
if (age < 15 or age > 99) or salary <= 0 or percent <= 0 or (goal <= 0):
return False
raw_annual_savings = salary * (percent / 100)
annual_savings = rawAnnualSavings + rawAnnualSavings * 0.35
current_savings = 0.0
for i in range(age, 100):
current_savings += annualSavings
if currentSavings >= goal:
return 'You will meet your savings goal at age ' + str(i)
return "Sorry, your goal won't be met." |
def solution(value):
print("Solution: {}".format(value))
| def solution(value):
print('Solution: {}'.format(value)) |
def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the message will be displayed
assert not world_df is None, "Your answer for world_df does not exist. Have you loaded the TopoJSON data to the correct variable name?"
assert "topo_feature" in __solution__, "The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function."
assert (
"quantitative" in __solution__ or
"pop_density:Q" in __solution__
), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data."
assert type(world_df) == alt.UrlData, "world_df does not appear to be an Altair UrlData object. Have you assigned the Altair UrlData object for the TopoJSON data to the correct variable?"
assert world_df.url == data.world_110m.url, "Make sure you are loading the data from correct url."
assert (world_df.format != alt.utils.schemapi.Undefined and
world_df.format.type == 'topojson'
), "The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function."
assert world_df.format.feature == "countries", "Make sure to specify 'countries' feature when loading the TopoJSON file using alt.topo_feature()."
assert not pop_dense_plot is None, "Your answer for pop_dense_plot does not exist. Have you assigned the plot to the correct variable name?"
assert type(pop_dense_plot) == alt.Chart, "pop_dense_plot does not appear to be an Altair Chart object. Have you assigned the Altair Chart object for the plot to the correct variable?"
assert pop_dense_plot.mark == 'geoshape', "Make sure you are using mark_geoshape for pop_dense_plot."
assert pop_dense_plot.encoding.color != alt.utils.schemapi.Undefined and (
pop_dense_plot.encoding.color.shorthand in {'pop_density:quantitative', 'pop_density:Q'} or
(pop_dense_plot.encoding.color.shorthand == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative') or
pop_dense_plot.encoding.color.field in {'pop_density:quantitative', 'pop_density:Q'} or
(pop_dense_plot.encoding.color.field == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative')
), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data."
assert pop_dense_plot.encoding.color.scale != alt.utils.schemapi.Undefined and (
pop_dense_plot.encoding.color.scale.scheme != alt.utils.schemapi.Undefined
), "Make sure to specify a colour scheme."
assert pop_dense_plot.encoding.color.scale.domainMid == 81, "Make sure you set the domainMid of the color scale as the global median (81)."
assert type(pop_dense_plot.transform) == list and (
len(pop_dense_plot.transform) == 1 and
pop_dense_plot.transform[0]['from'] != alt.utils.schemapi.Undefined and
pop_dense_plot.transform[0]['from'].fields == ['pop_density'] and
pop_dense_plot.transform[0]['from'].key
), "Make sure you use .transform_lookup() to lookup the column 'pop_density' from the gapminder_df data using 'id' as the connecting column. Hint: 'pop_density' should be inside a list."
assert pop_dense_plot.projection != alt.utils.schemapi.Undefined and (
pop_dense_plot.projection.scale == 80
), "Make sure you use 'equalEarth' projection. Hint: you can use .project() method with type argument to specify projection type."
__msg__.good("You're correct, well done!")
| def test():
assert not world_df is None, 'Your answer for world_df does not exist. Have you loaded the TopoJSON data to the correct variable name?'
assert 'topo_feature' in __solution__, 'The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function.'
assert 'quantitative' in __solution__ or 'pop_density:Q' in __solution__, "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data."
assert type(world_df) == alt.UrlData, 'world_df does not appear to be an Altair UrlData object. Have you assigned the Altair UrlData object for the TopoJSON data to the correct variable?'
assert world_df.url == data.world_110m.url, 'Make sure you are loading the data from correct url.'
assert world_df.format != alt.utils.schemapi.Undefined and world_df.format.type == 'topojson', 'The loaded data should be in TopoJSON format. In order to read TopoJSON file correctly, you need to use the alt.topo_feature() function.'
assert world_df.format.feature == 'countries', "Make sure to specify 'countries' feature when loading the TopoJSON file using alt.topo_feature()."
assert not pop_dense_plot is None, 'Your answer for pop_dense_plot does not exist. Have you assigned the plot to the correct variable name?'
assert type(pop_dense_plot) == alt.Chart, 'pop_dense_plot does not appear to be an Altair Chart object. Have you assigned the Altair Chart object for the plot to the correct variable?'
assert pop_dense_plot.mark == 'geoshape', 'Make sure you are using mark_geoshape for pop_dense_plot.'
assert pop_dense_plot.encoding.color != alt.utils.schemapi.Undefined and (pop_dense_plot.encoding.color.shorthand in {'pop_density:quantitative', 'pop_density:Q'} or (pop_dense_plot.encoding.color.shorthand == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative') or pop_dense_plot.encoding.color.field in {'pop_density:quantitative', 'pop_density:Q'} or (pop_dense_plot.encoding.color.field == 'pop_density' and pop_dense_plot.encoding.color.type == 'quantitative')), "Make sure you use pop_density column from gapminder_df for the color encoding. Hint: since pop_density column does not exist in world_df, Altair can't infer its data type and you need to specify that it is quantitative data."
assert pop_dense_plot.encoding.color.scale != alt.utils.schemapi.Undefined and pop_dense_plot.encoding.color.scale.scheme != alt.utils.schemapi.Undefined, 'Make sure to specify a colour scheme.'
assert pop_dense_plot.encoding.color.scale.domainMid == 81, 'Make sure you set the domainMid of the color scale as the global median (81).'
assert type(pop_dense_plot.transform) == list and (len(pop_dense_plot.transform) == 1 and pop_dense_plot.transform[0]['from'] != alt.utils.schemapi.Undefined and (pop_dense_plot.transform[0]['from'].fields == ['pop_density']) and pop_dense_plot.transform[0]['from'].key), "Make sure you use .transform_lookup() to lookup the column 'pop_density' from the gapminder_df data using 'id' as the connecting column. Hint: 'pop_density' should be inside a list."
assert pop_dense_plot.projection != alt.utils.schemapi.Undefined and pop_dense_plot.projection.scale == 80, "Make sure you use 'equalEarth' projection. Hint: you can use .project() method with type argument to specify projection type."
__msg__.good("You're correct, well done!") |
class SimpleSpriteList:
def __init__(self) -> None:
self.sprites = list()
def draw(self) -> None:
for sprite in self.sprites:
sprite.draw()
def update(self) -> None:
for sprite in self.sprites:
sprite.update()
def append(self, sprite) -> None:
self.sprites.append(sprite)
def remove(self, sprite) -> None:
self.sprites.remove(sprite)
def pop(self, index: int = -1):
self.sprites.pop(index)
def clear(self) -> None:
self.sprites.clear()
| class Simplespritelist:
def __init__(self) -> None:
self.sprites = list()
def draw(self) -> None:
for sprite in self.sprites:
sprite.draw()
def update(self) -> None:
for sprite in self.sprites:
sprite.update()
def append(self, sprite) -> None:
self.sprites.append(sprite)
def remove(self, sprite) -> None:
self.sprites.remove(sprite)
def pop(self, index: int=-1):
self.sprites.pop(index)
def clear(self) -> None:
self.sprites.clear() |
numberLines = int(input())
while 0 < numberLines:
number = int(input())
sum = 0
for i in range(number):
if i%3 == 0 or i%5 == 0:
sum = sum + i
print(sum)
numberLines = numberLines - 1 | number_lines = int(input())
while 0 < numberLines:
number = int(input())
sum = 0
for i in range(number):
if i % 3 == 0 or i % 5 == 0:
sum = sum + i
print(sum)
number_lines = numberLines - 1 |
#Mock class for GPIO
BOARD = 1
BCM = 2
OUT = 1
IN = 1
HIGH = 1
LOW = 0
def setmode(a):
print ("setmode GPIO",a)
def setup(a, b):
print ("setup GPIO", a, b)
def output(a, b):
print ("output GPIO", a, b)
def cleanup():
print ("cleanup GPIO", a, b)
def setwarnings(flag):
print ("setwarnings", flag)
| board = 1
bcm = 2
out = 1
in = 1
high = 1
low = 0
def setmode(a):
print('setmode GPIO', a)
def setup(a, b):
print('setup GPIO', a, b)
def output(a, b):
print('output GPIO', a, b)
def cleanup():
print('cleanup GPIO', a, b)
def setwarnings(flag):
print('setwarnings', flag) |
# Damage Skin - Violetta
success = sm.addDamageSkin(2433197)
if success:
sm.chat("The Damage Skin - Violetta has been added to your account's damage skin collection.")
| success = sm.addDamageSkin(2433197)
if success:
sm.chat("The Damage Skin - Violetta has been added to your account's damage skin collection.") |
#!/usr/bin/env python3
formulas = [
"XNd perr",
"PNd (PNd (call And (XNu exc)))",
"PNd (han And (XNd (exc And (XBu call))))",
"G (exc --> XBu call)",
"T Ud exc",
"PNd (PNd (T Ud exc))",
"G ((call And pa And ((~ ret) Ud WRx)) --> XNu exc)",
"PNd (PBu call)",
"PNd (PNd (PNd (PBu call)))",
"XNd (PNd (PBu call))",
"G ((call And pa And (PNu exc Or XNu exc)) --> (PNu eb Or XNu eb))",
"F (HNd pb)",
"F (HBd pb)",
"F (pa And (call HUd pc))",
"F (pc And (call HSd pa))",
"G ((pc And (XNu exc)) --> ((~ pa) HSd pb))",
"G ((call And pb) --> (~ pc) HUu perr)",
"F (HNu perr)",
"F (HBu perr)",
"F (pa And (call HUu pb))",
"F (pb And (call HSu pa))",
"G (call --> XNd ret)",
"G (call --> Not (PNu exc))",
"G ((call And pa) --> ~ (PNu exc Or XNu exc))",
"G (exc --> ~ (PBu (call And pa) Or XBu (call And pa)))",
"G ((call And pb And (call Sd (call And pa))) --> (PNu exc Or XNu exc))",
"G (han --> XNu ret)",
"T Uu exc",
"PNd (PNd (T Uu exc))",
"PNd (PNd (PNd (T Uu exc)))",
"G (call And pc --> (T Uu (exc And XBd han)))",
"call Ud (ret And perr)",
"XNd (call And ((call Or exc) Su pb))",
"PNd (PNd ((call Or exc) Uu ret))"]
n = 11
for form in formulas:
with open(str(n) + '-generic-larger.pomc', 'w') as f:
f.write('formulas = ' + form + ';\n')
f.write('include = "../../Mcall.inc";\n\n')
f.write('include = "opa.inc";')
n += 1
| formulas = ['XNd perr', 'PNd (PNd (call And (XNu exc)))', 'PNd (han And (XNd (exc And (XBu call))))', 'G (exc --> XBu call)', 'T Ud exc', 'PNd (PNd (T Ud exc))', 'G ((call And pa And ((~ ret) Ud WRx)) --> XNu exc)', 'PNd (PBu call)', 'PNd (PNd (PNd (PBu call)))', 'XNd (PNd (PBu call))', 'G ((call And pa And (PNu exc Or XNu exc)) --> (PNu eb Or XNu eb))', 'F (HNd pb)', 'F (HBd pb)', 'F (pa And (call HUd pc))', 'F (pc And (call HSd pa))', 'G ((pc And (XNu exc)) --> ((~ pa) HSd pb))', 'G ((call And pb) --> (~ pc) HUu perr)', 'F (HNu perr)', 'F (HBu perr)', 'F (pa And (call HUu pb))', 'F (pb And (call HSu pa))', 'G (call --> XNd ret)', 'G (call --> Not (PNu exc))', 'G ((call And pa) --> ~ (PNu exc Or XNu exc))', 'G (exc --> ~ (PBu (call And pa) Or XBu (call And pa)))', 'G ((call And pb And (call Sd (call And pa))) --> (PNu exc Or XNu exc))', 'G (han --> XNu ret)', 'T Uu exc', 'PNd (PNd (T Uu exc))', 'PNd (PNd (PNd (T Uu exc)))', 'G (call And pc --> (T Uu (exc And XBd han)))', 'call Ud (ret And perr)', 'XNd (call And ((call Or exc) Su pb))', 'PNd (PNd ((call Or exc) Uu ret))']
n = 11
for form in formulas:
with open(str(n) + '-generic-larger.pomc', 'w') as f:
f.write('formulas = ' + form + ';\n')
f.write('include = "../../Mcall.inc";\n\n')
f.write('include = "opa.inc";')
n += 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.