content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#WAP to accept a string from user and replace all occurrances of first character except for the first character.
name = input("Please enter a string: ")
replaceToken = input("Please enter token to replace: ")
print (name)
name2 = name[0] + name[1:].replace(name[0], replaceToken)
print (name2) | name = input('Please enter a string: ')
replace_token = input('Please enter token to replace: ')
print(name)
name2 = name[0] + name[1:].replace(name[0], replaceToken)
print(name2) |
#!/usr/bin/python3
class Unit:
bydgoszcz = "040410661011"
warszawa = "071412865011"
krakow = "011212161011"
lodz = "051011661011"
wroclaw = "030210564011"
poznan = "023016264011"
gdansk = "042214361011"
szczecin = "023216562011"
lublin = "060611163011"
bialystok = "062013761011"
katowice = "012414869011"
class Variable:
class Demographics:
births = 63221
deaths = 63215
class Population:
total = 72305
male = 72300
female = 72295
male0_4 = 72301
male5_9 = 72302
male10_14 = 72303
male15_19 = 72304
male20_24 = 47711
male25_29 = 47736
male30_34 = 47724
male35_39 = 47712
male40_44 = 47725
male45_49 = 47728
male50_54 = 47706
male55_59 = 47715
male60_64 = 47721
male65_69 = 72243
maleOver70 = 72238
female0_4 = 72296
female5_9 = 72297
female10_14 = 72298
female15_19 = 72299
female20_24 = 47738
female25_29 = 47696
female30_34 = 47695
female35_39 = 47716
female40_44 = 47698
female45_49 = 47727
female50_54 = 47723
female55_59 = 47702
female60_64 = 47693
female65_69 = 72241
femaleOver70 = 72242
CITIES_10 = [
Unit.bydgoszcz,
Unit.warszawa,
Unit.krakow,
Unit.lodz,
Unit.wroclaw,
Unit.poznan,
Unit.gdansk,
Unit.szczecin,
Unit.lublin,
Unit.bialystok,
Unit.katowice,
]
MALES_0_19 = [
Variable.Population.male0_4,
Variable.Population.male5_9,
Variable.Population.male10_14,
Variable.Population.male15_19,
]
MALES_20_39 = [
Variable.Population.male20_24,
Variable.Population.male25_29,
Variable.Population.male30_34,
Variable.Population.male35_39,
]
MALES_40_and_over = [
Variable.Population.male40_44,
Variable.Population.male45_49,
Variable.Population.male50_54,
Variable.Population.male55_59,
Variable.Population.male60_64,
Variable.Population.male65_69,
Variable.Population.maleOver70
]
MALES = MALES_0_19 + MALES_20_39 + MALES_40_and_over
FEMALES_0_19 = [
Variable.Population.female0_4,
Variable.Population.female5_9,
Variable.Population.female10_14,
Variable.Population.female15_19,
]
FEMALES_20_39 = [
Variable.Population.female20_24,
Variable.Population.female25_29,
Variable.Population.female30_34,
Variable.Population.female35_39,
]
FEMALES_40_and_over = [
Variable.Population.female40_44,
Variable.Population.female45_49,
Variable.Population.female50_54,
Variable.Population.female55_59,
Variable.Population.female60_64,
Variable.Population.female65_69,
Variable.Population.femaleOver70
]
FEMALES = FEMALES_0_19 + FEMALES_20_39 + FEMALES_40_and_over
ALL_0_19 = MALES_0_19 + FEMALES_0_19
ALL_20_39 = MALES_20_39 + FEMALES_20_39
| class Unit:
bydgoszcz = '040410661011'
warszawa = '071412865011'
krakow = '011212161011'
lodz = '051011661011'
wroclaw = '030210564011'
poznan = '023016264011'
gdansk = '042214361011'
szczecin = '023216562011'
lublin = '060611163011'
bialystok = '062013761011'
katowice = '012414869011'
class Variable:
class Demographics:
births = 63221
deaths = 63215
class Population:
total = 72305
male = 72300
female = 72295
male0_4 = 72301
male5_9 = 72302
male10_14 = 72303
male15_19 = 72304
male20_24 = 47711
male25_29 = 47736
male30_34 = 47724
male35_39 = 47712
male40_44 = 47725
male45_49 = 47728
male50_54 = 47706
male55_59 = 47715
male60_64 = 47721
male65_69 = 72243
male_over70 = 72238
female0_4 = 72296
female5_9 = 72297
female10_14 = 72298
female15_19 = 72299
female20_24 = 47738
female25_29 = 47696
female30_34 = 47695
female35_39 = 47716
female40_44 = 47698
female45_49 = 47727
female50_54 = 47723
female55_59 = 47702
female60_64 = 47693
female65_69 = 72241
female_over70 = 72242
cities_10 = [Unit.bydgoszcz, Unit.warszawa, Unit.krakow, Unit.lodz, Unit.wroclaw, Unit.poznan, Unit.gdansk, Unit.szczecin, Unit.lublin, Unit.bialystok, Unit.katowice]
males_0_19 = [Variable.Population.male0_4, Variable.Population.male5_9, Variable.Population.male10_14, Variable.Population.male15_19]
males_20_39 = [Variable.Population.male20_24, Variable.Population.male25_29, Variable.Population.male30_34, Variable.Population.male35_39]
males_40_and_over = [Variable.Population.male40_44, Variable.Population.male45_49, Variable.Population.male50_54, Variable.Population.male55_59, Variable.Population.male60_64, Variable.Population.male65_69, Variable.Population.maleOver70]
males = MALES_0_19 + MALES_20_39 + MALES_40_and_over
females_0_19 = [Variable.Population.female0_4, Variable.Population.female5_9, Variable.Population.female10_14, Variable.Population.female15_19]
females_20_39 = [Variable.Population.female20_24, Variable.Population.female25_29, Variable.Population.female30_34, Variable.Population.female35_39]
females_40_and_over = [Variable.Population.female40_44, Variable.Population.female45_49, Variable.Population.female50_54, Variable.Population.female55_59, Variable.Population.female60_64, Variable.Population.female65_69, Variable.Population.femaleOver70]
females = FEMALES_0_19 + FEMALES_20_39 + FEMALES_40_and_over
all_0_19 = MALES_0_19 + FEMALES_0_19
all_20_39 = MALES_20_39 + FEMALES_20_39 |
VERSION = '0.0.1'
DIR_KIND = {
'cache': {'search': '__pycache__', 'help': 'Delete the pycache folders'},
'egg': {'search': 'egg-info', 'help': 'Delete the egg folders'},
}
FILE_KIND = {
'pyc': {'search': '.pyc', 'help': 'Delete the pyc files'},
}
| version = '0.0.1'
dir_kind = {'cache': {'search': '__pycache__', 'help': 'Delete the pycache folders'}, 'egg': {'search': 'egg-info', 'help': 'Delete the egg folders'}}
file_kind = {'pyc': {'search': '.pyc', 'help': 'Delete the pyc files'}} |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def addTwoNumbers(l1: ListNode, l2: ListNode) -> ListNode:
tmp = 0
result = ListNode(0)
dummy = result
while l1 or l2:
v = tmp
if l1:
v += l1.val
l1 = l1.next
if l2:
v += l2.val
l2 = l2.next
result.next = ListNode(v % 10)
tmp = v // 10
result = result.next
if tmp != 0:
result.next = ListNode(tmp)
return dummy.next
if __name__ == "__main__" :
node1 = ListNode(7)
node1.next = ListNode(1)
node1.next.next = ListNode(6)
node2 = ListNode(5)
node2.next = ListNode(9)
node2.next.next = ListNode(8)
node2.next.next.next = ListNode(7)
node2.next.next.next.next = ListNode(6)
result = addTwoNumbers(node1, node2)
while result :
print(result.val)
result = result.next
| class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def add_two_numbers(l1: ListNode, l2: ListNode) -> ListNode:
tmp = 0
result = list_node(0)
dummy = result
while l1 or l2:
v = tmp
if l1:
v += l1.val
l1 = l1.next
if l2:
v += l2.val
l2 = l2.next
result.next = list_node(v % 10)
tmp = v // 10
result = result.next
if tmp != 0:
result.next = list_node(tmp)
return dummy.next
if __name__ == '__main__':
node1 = list_node(7)
node1.next = list_node(1)
node1.next.next = list_node(6)
node2 = list_node(5)
node2.next = list_node(9)
node2.next.next = list_node(8)
node2.next.next.next = list_node(7)
node2.next.next.next.next = list_node(6)
result = add_two_numbers(node1, node2)
while result:
print(result.val)
result = result.next |
class ComplexPolynomialIterationData(object):
iteration_values = None
exploded_indexes = None
remaining_indexes = None
def __init__(self, iteration_values, exploded_indexes, remaining_indexes):
self.iteration_values = iteration_values
self.exploded_indexes = exploded_indexes
self.remaining_indexes = remaining_indexes
def get_iteration_values(self):
return self.iteration_values
def get_exploded_indexes(self):
return self.exploded_indexes
def get_remaining_indexes(self):
return self.remaining_indexes
| class Complexpolynomialiterationdata(object):
iteration_values = None
exploded_indexes = None
remaining_indexes = None
def __init__(self, iteration_values, exploded_indexes, remaining_indexes):
self.iteration_values = iteration_values
self.exploded_indexes = exploded_indexes
self.remaining_indexes = remaining_indexes
def get_iteration_values(self):
return self.iteration_values
def get_exploded_indexes(self):
return self.exploded_indexes
def get_remaining_indexes(self):
return self.remaining_indexes |
begin = int(input())
ending = int(input())
point = int(input())
left = min(begin, ending)
right = max(begin, ending)
distance_left = abs(left - point)
distance_right = abs(right - point)
min_distance = min(distance_left, distance_right)
if left <= point <= right:
print("in")
else:
print("out")
print(min_distance) | begin = int(input())
ending = int(input())
point = int(input())
left = min(begin, ending)
right = max(begin, ending)
distance_left = abs(left - point)
distance_right = abs(right - point)
min_distance = min(distance_left, distance_right)
if left <= point <= right:
print('in')
else:
print('out')
print(min_distance) |
# Esercizio n. 5
# Visualizzare tutti i numeri dispari compresi fra 1 e 50.
n_min = 1
n_max = 50
print("I numeri dispari compresi tra", n_min, "e", n_max, "sono:")
n = n_min
while n <= n_max:
if n % 2 != 0:
print(n, "\t")
n = n + 1
| n_min = 1
n_max = 50
print('I numeri dispari compresi tra', n_min, 'e', n_max, 'sono:')
n = n_min
while n <= n_max:
if n % 2 != 0:
print(n, '\t')
n = n + 1 |
def cheer(n):
'return a string with a silly cheer based on n'
if n <= 1:
return "Hurrah!"
else:
return "Hip " + cheer(n - 1)
x = cheer(5)
print(x)
| def cheer(n):
"""return a string with a silly cheer based on n"""
if n <= 1:
return 'Hurrah!'
else:
return 'Hip ' + cheer(n - 1)
x = cheer(5)
print(x) |
a = 12
print(f"a is {a}")
print(f"Data Type of a is {type(a)}")
b = 3.1415926
print(f"b is {b}")
print(f"Data Type of b is {type(b)}")
c = "message"
print(f"c is {c}")
print(f"Data Type of c is {type(c)}")
d = True
print(f"d is {d}")
print(f"Data Type of d is {type(d)}")
e = None
print(f"e is {e}")
print(f"Data Type of e is {type(e)}")
# type conversion
print("------------------")
print(b, type(b), sep=" | ")
b = int(b)
print(b, type(b), sep=" | ")
b = float(b)
print(b, type(b), sep=" | ")
b = str(b)
print(b, type(b), sep=" | ")
| a = 12
print(f'a is {a}')
print(f'Data Type of a is {type(a)}')
b = 3.1415926
print(f'b is {b}')
print(f'Data Type of b is {type(b)}')
c = 'message'
print(f'c is {c}')
print(f'Data Type of c is {type(c)}')
d = True
print(f'd is {d}')
print(f'Data Type of d is {type(d)}')
e = None
print(f'e is {e}')
print(f'Data Type of e is {type(e)}')
print('------------------')
print(b, type(b), sep=' | ')
b = int(b)
print(b, type(b), sep=' | ')
b = float(b)
print(b, type(b), sep=' | ')
b = str(b)
print(b, type(b), sep=' | ') |
def detectLoop(head):
if head == None:
return False
start = head
next_next_start = head.next
if next_next_start == None:
return False
next_next_start = head.next.next
while next_next_start != None:
start = start.next
next_next_start = next_next_start.next
if next_next_start == None:
return False
next_next_start = next_next_start.next
if start == next_next_start:
return True
return False
| def detect_loop(head):
if head == None:
return False
start = head
next_next_start = head.next
if next_next_start == None:
return False
next_next_start = head.next.next
while next_next_start != None:
start = start.next
next_next_start = next_next_start.next
if next_next_start == None:
return False
next_next_start = next_next_start.next
if start == next_next_start:
return True
return False |
'''
Problem 22
@author: Kevin Ji
'''
def get_value_of_letter(letter):
return ord(letter.upper()) - 64
def get_value_of_word(word):
value = 0
for char in word:
value += get_value_of_letter(char)
return value
# Parse the file, and place the names into a list
file = open("problem_22_names.txt", "r")
names_text = file.read()
names = sorted(names_text.replace("\"", "").split(","))
# Values and scores of names
values = [get_value_of_word(name) for name in names]
scores = [value * (rank + 1) for value, (rank, name) in zip(values, enumerate(names))]
print(sum(scores))
| """
Problem 22
@author: Kevin Ji
"""
def get_value_of_letter(letter):
return ord(letter.upper()) - 64
def get_value_of_word(word):
value = 0
for char in word:
value += get_value_of_letter(char)
return value
file = open('problem_22_names.txt', 'r')
names_text = file.read()
names = sorted(names_text.replace('"', '').split(','))
values = [get_value_of_word(name) for name in names]
scores = [value * (rank + 1) for (value, (rank, name)) in zip(values, enumerate(names))]
print(sum(scores)) |
class Solution:
def maxProfit(self, prices: List[int]) -> int:
i = 0
profit = 0
flag = 0
while i<(len(prices)-1):
if prices[i] < prices[i+1] and flag==0:
profit -= prices[i]
flag = 1
elif prices[i] > prices[i+1] and flag==1:
profit+=prices[i]
flag = 0
i+=1
if(flag==1):
profit += prices[i]
return max(profit,0)
| class Solution:
def max_profit(self, prices: List[int]) -> int:
i = 0
profit = 0
flag = 0
while i < len(prices) - 1:
if prices[i] < prices[i + 1] and flag == 0:
profit -= prices[i]
flag = 1
elif prices[i] > prices[i + 1] and flag == 1:
profit += prices[i]
flag = 0
i += 1
if flag == 1:
profit += prices[i]
return max(profit, 0) |
#List slicing
my_list = [0,1,2,3,4,5,6,7,8,9]
print("list = ",my_list)
print("my_list[0:]",my_list[0:])
print("my_list[:]",my_list[:])
print("my_list[:-1]",my_list[:-1])
print("my_list[1:5]",my_list[1:5])
#list(start:end:step)
print("my_list[1::3]",my_list[1::3])
print("my_list[-1:1:-1]",my_list[-1:1:-1])
sample_url = 'https://mydomain.com'
print("sample_url =",sample_url)
print("reverse", sample_url[::-1]) | my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print('list = ', my_list)
print('my_list[0:]', my_list[0:])
print('my_list[:]', my_list[:])
print('my_list[:-1]', my_list[:-1])
print('my_list[1:5]', my_list[1:5])
print('my_list[1::3]', my_list[1::3])
print('my_list[-1:1:-1]', my_list[-1:1:-1])
sample_url = 'https://mydomain.com'
print('sample_url =', sample_url)
print('reverse', sample_url[::-1]) |
#
# @lc app=leetcode.cn id=253 lang=python3
#
# [253] meeting-rooms-ii
#
None
# @lc code=end | None |
'''
Assigning values to the grid
The grid will look like this:
0,0 | 0,1 | 0,2 | 0,3 | 0,4 | 0,5 | 0,6
1,0 | 1,1 | 1,2 | 1,3 | 1,4 | 1,5 | 1,6
2,0 | 2,1 | 2,2 | 2,3 | 2,4 | 2,5 | 2,6
3,0 | 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | 3,6
4,0 | 4,1 | 4,2 | 4,3 | 4,4 | 4,5 | 4,6
5,0 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | 5,6
'''
N, M = 6, 7
grid = []
grid = [['.' for i in range(M)] for j in range(N)]
dic={ (0,0):0,(0,1):0,(0,2):0,(0,3):0,(0,4):0,(0,5):0,(0,6):0,
(1,0):0,(1,1):0,(1,2):0,(1,3):0,(1,4):0,(1,5):0,(1,6):0,
(2,0):0,(2,1):0,(2,2):0,(2,3):0,(2,4):0,(2,5):0,(2,6):0,
(3,0):0,(3,1):0,(3,2):0,(3,3):0,(3,4):0,(3,5):0,(3,6):0,
(4,0):0,(4,1):0,(4,2):0,(4,3):0,(4,4):0,(4,5):0,(4,6):0,
(5,0):0,(5,1):0,(5,2):0,(5,3):0,(5,4):0,(5,5):0,(5,6):0,
}
#This function prints the grid of Connect Four Game as the game progresses
def print_grid():
print("Player 1: X vs Player 2: O")
print('--' + '---' * M + '--')
for i in range(N):
print(end='| ')
for j in range(M):
print(grid[i][j], end=' ')
print(end='|')
print()
print('--' + '---' * M + '--')
#This function checks if row or column or diagonal is full with same characters
def check_win():
s = ''
for i in range(N - 3):
h = 0
x = i
j = h
while j < M and x < N:
s += grid[x][j]
j += 1
x += 1
if len(s)>=4:
if s[:4] == 'XXXX' or s[:4]=='OOOO':return True
if len(s)>=5:
if s[1:5] == 'XXXX' or s[1:5]=='OOOO':return True
if len(s)>=6:
if s[2:6] == 'XXXX' or s[2:6]=='OOOO':return True
s = ''
s = ''
for i in range(M - 3):
h = 0
x = i
j = h
while j < N and x < M:
s += grid[j][x]
j += 1
x += 1
if len(s)>=4:
if s[:4] == 'XXXX' or s[:4]=='OOOO':return True
if len(s)>=5:
if s[1:5] == 'XXXX' or s[1:5]=='OOOO':return True
if len(s)>=6:
if s[2:6] == 'XXXX' or s[2:6]=='OOOO':return True
s = ''
h += 1
s = ''
for i in range(N):
for j in range(M):
s += grid[i][j]
if s[:4] == 'XXXX' or s[:4]=='OOOO' or s[1:5] == 'XXXX' or s[1:5]=='OOOO'or s[2:6] == 'XXXX' or s[2:6]=='OOOO' or s[3:7] == 'XXXX' or s[3:7]=='OOOO':
return True
s = ''
s = ''
for i in range(M):
for j in range(N):
s += grid[j][i]
if s[:4] == 'XXXX' or s[:4] == 'OOOO' or s[1:5] == 'XXXX' or s[1:5] == 'OOOO' or s[2:6] == 'XXXX' or s[2:6] == 'OOOO':
return True
s = ''
s = ''
for i in range(N - 3):
h = 6
x = i
j = h
while j >= 0 and x < N:
s += grid[x][j]
j -= 1
x += 1
if len(s)>=4:
if s[:4] == 'XXXX' or s[:4]=='OOOO':return True
if len(s)>=5:
if s[1:5] == 'XXXX' or s[1:5]=='OOOO':return True
if len(s)>=6:
if s[2:6] == 'XXXX' or s[2:6]=='OOOO':return True
s = ''
s = ''
z = 6
for i in range(M - 3):
h = 0
j = h
x = z
while j < N and x >= 0:
s += grid[j][x]
j += 1
x -= 1
if len(s)>=4:
if s[:4] == 'XXXX' or s[:4]=='OOOO':return True
if len(s)>=5:
if s[1:5] == 'XXXX' or s[1:5]=='OOOO':return True
if len(s)>=6:
if s[2:6] == 'XXXX' or s[2:6]=='OOOO':return True
z -= 1
s = ''
return False
#This function checks if row or column or diagonal is full with same characters
def check_tie(mark):
f=0
for i in range(N):
for j in range(M):
if dic[(i,j)]==0:
f=1
break
if f==0 and not check_win():
return True
else: return False
pass
#This function checks if given cell is empty or not
def check_empty(i):
if dic[(0,i)]==0:return True
else:return False
#This function checks if given position is valid or not
def check_valid_column(i):
if i>=0 and i<=6: return True
else: return False
#This function sets a value to a cell
def set_cell(i, mark):
h=5
while h>=0:
if dic[(h,i)]==0:
dic[(h,i)]=1
grid[h][i]=mark
break
else: h-=1
#This function clears the grid
def grid_clear():
global grid
global dic
grid.clear()
dic.clear()
grid = [['.' for i in range(M)] for j in range(N)]
dic = {(0, 0): 0, (0, 1): 0, (0, 2): 0, (0, 3): 0, (0, 4): 0, (0, 5): 0, (0, 6): 0,
(1, 0): 0, (1, 1): 0, (1, 2): 0, (1, 3): 0, (1, 4): 0, (1, 5): 0, (1, 6): 0,
(2, 0): 0, (2, 1): 0, (2, 2): 0, (2, 3): 0, (2, 4): 0, (2, 5): 0, (2, 6): 0,
(3, 0): 0, (3, 1): 0, (3, 2): 0, (3, 3): 0, (3, 4): 0, (3, 5): 0, (3, 6): 0,
(4, 0): 0, (4, 1): 0, (4, 2): 0, (4, 3): 0, (4, 4): 0, (4, 5): 0, (4, 6): 0,
(5, 0): 0, (5, 1): 0, (5, 2): 0, (5, 3): 0, (5, 4): 0, (5, 5): 0, (5, 6): 0,
}
#MAIN FUNCTION
def play_game():
print("Connect Four Game!")
print("Welcome...")
print("============================")
player = 0
while True:
#Prints the grid
print_grid()
#Set mark value based on the player
mark = 'X' if player == 0 else 'O'
#Takes input from the user to fill in the grid
print('Player %s' % mark)
i = int(input('Enter the column index: '))
while not check_valid_column(i) or not check_empty(i):
i = int(input('Enter a valid column index: '))
#Set the input position with the mark
set_cell(i, mark)
#Check if the state of the grid has a win state
if check_win():
#Prints the grid
print_grid()
print('Congrats, Player %s is won!' % mark)
break
op_mark = 'O' if player == 0 else 'X'
#Check if the state of the grid has a tie state
if check_tie(mark):
#Prints the grid
print_grid()
print("Woah! That's a tie!")
break
#Player number changes after each turn
player = 1 - player
while True:
grid_clear()
play_game()
c = input('Play Again [Y/N] ')
if c not in 'yY':
breakv | """
Assigning values to the grid
The grid will look like this:
0,0 | 0,1 | 0,2 | 0,3 | 0,4 | 0,5 | 0,6
1,0 | 1,1 | 1,2 | 1,3 | 1,4 | 1,5 | 1,6
2,0 | 2,1 | 2,2 | 2,3 | 2,4 | 2,5 | 2,6
3,0 | 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | 3,6
4,0 | 4,1 | 4,2 | 4,3 | 4,4 | 4,5 | 4,6
5,0 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | 5,6
"""
(n, m) = (6, 7)
grid = []
grid = [['.' for i in range(M)] for j in range(N)]
dic = {(0, 0): 0, (0, 1): 0, (0, 2): 0, (0, 3): 0, (0, 4): 0, (0, 5): 0, (0, 6): 0, (1, 0): 0, (1, 1): 0, (1, 2): 0, (1, 3): 0, (1, 4): 0, (1, 5): 0, (1, 6): 0, (2, 0): 0, (2, 1): 0, (2, 2): 0, (2, 3): 0, (2, 4): 0, (2, 5): 0, (2, 6): 0, (3, 0): 0, (3, 1): 0, (3, 2): 0, (3, 3): 0, (3, 4): 0, (3, 5): 0, (3, 6): 0, (4, 0): 0, (4, 1): 0, (4, 2): 0, (4, 3): 0, (4, 4): 0, (4, 5): 0, (4, 6): 0, (5, 0): 0, (5, 1): 0, (5, 2): 0, (5, 3): 0, (5, 4): 0, (5, 5): 0, (5, 6): 0}
def print_grid():
print('Player 1: X vs Player 2: O')
print('--' + '---' * M + '--')
for i in range(N):
print(end='| ')
for j in range(M):
print(grid[i][j], end=' ')
print(end='|')
print()
print('--' + '---' * M + '--')
def check_win():
s = ''
for i in range(N - 3):
h = 0
x = i
j = h
while j < M and x < N:
s += grid[x][j]
j += 1
x += 1
if len(s) >= 4:
if s[:4] == 'XXXX' or s[:4] == 'OOOO':
return True
if len(s) >= 5:
if s[1:5] == 'XXXX' or s[1:5] == 'OOOO':
return True
if len(s) >= 6:
if s[2:6] == 'XXXX' or s[2:6] == 'OOOO':
return True
s = ''
s = ''
for i in range(M - 3):
h = 0
x = i
j = h
while j < N and x < M:
s += grid[j][x]
j += 1
x += 1
if len(s) >= 4:
if s[:4] == 'XXXX' or s[:4] == 'OOOO':
return True
if len(s) >= 5:
if s[1:5] == 'XXXX' or s[1:5] == 'OOOO':
return True
if len(s) >= 6:
if s[2:6] == 'XXXX' or s[2:6] == 'OOOO':
return True
s = ''
h += 1
s = ''
for i in range(N):
for j in range(M):
s += grid[i][j]
if s[:4] == 'XXXX' or s[:4] == 'OOOO' or s[1:5] == 'XXXX' or (s[1:5] == 'OOOO') or (s[2:6] == 'XXXX') or (s[2:6] == 'OOOO') or (s[3:7] == 'XXXX') or (s[3:7] == 'OOOO'):
return True
s = ''
s = ''
for i in range(M):
for j in range(N):
s += grid[j][i]
if s[:4] == 'XXXX' or s[:4] == 'OOOO' or s[1:5] == 'XXXX' or (s[1:5] == 'OOOO') or (s[2:6] == 'XXXX') or (s[2:6] == 'OOOO'):
return True
s = ''
s = ''
for i in range(N - 3):
h = 6
x = i
j = h
while j >= 0 and x < N:
s += grid[x][j]
j -= 1
x += 1
if len(s) >= 4:
if s[:4] == 'XXXX' or s[:4] == 'OOOO':
return True
if len(s) >= 5:
if s[1:5] == 'XXXX' or s[1:5] == 'OOOO':
return True
if len(s) >= 6:
if s[2:6] == 'XXXX' or s[2:6] == 'OOOO':
return True
s = ''
s = ''
z = 6
for i in range(M - 3):
h = 0
j = h
x = z
while j < N and x >= 0:
s += grid[j][x]
j += 1
x -= 1
if len(s) >= 4:
if s[:4] == 'XXXX' or s[:4] == 'OOOO':
return True
if len(s) >= 5:
if s[1:5] == 'XXXX' or s[1:5] == 'OOOO':
return True
if len(s) >= 6:
if s[2:6] == 'XXXX' or s[2:6] == 'OOOO':
return True
z -= 1
s = ''
return False
def check_tie(mark):
f = 0
for i in range(N):
for j in range(M):
if dic[i, j] == 0:
f = 1
break
if f == 0 and (not check_win()):
return True
else:
return False
pass
def check_empty(i):
if dic[0, i] == 0:
return True
else:
return False
def check_valid_column(i):
if i >= 0 and i <= 6:
return True
else:
return False
def set_cell(i, mark):
h = 5
while h >= 0:
if dic[h, i] == 0:
dic[h, i] = 1
grid[h][i] = mark
break
else:
h -= 1
def grid_clear():
global grid
global dic
grid.clear()
dic.clear()
grid = [['.' for i in range(M)] for j in range(N)]
dic = {(0, 0): 0, (0, 1): 0, (0, 2): 0, (0, 3): 0, (0, 4): 0, (0, 5): 0, (0, 6): 0, (1, 0): 0, (1, 1): 0, (1, 2): 0, (1, 3): 0, (1, 4): 0, (1, 5): 0, (1, 6): 0, (2, 0): 0, (2, 1): 0, (2, 2): 0, (2, 3): 0, (2, 4): 0, (2, 5): 0, (2, 6): 0, (3, 0): 0, (3, 1): 0, (3, 2): 0, (3, 3): 0, (3, 4): 0, (3, 5): 0, (3, 6): 0, (4, 0): 0, (4, 1): 0, (4, 2): 0, (4, 3): 0, (4, 4): 0, (4, 5): 0, (4, 6): 0, (5, 0): 0, (5, 1): 0, (5, 2): 0, (5, 3): 0, (5, 4): 0, (5, 5): 0, (5, 6): 0}
def play_game():
print('Connect Four Game!')
print('Welcome...')
print('============================')
player = 0
while True:
print_grid()
mark = 'X' if player == 0 else 'O'
print('Player %s' % mark)
i = int(input('Enter the column index: '))
while not check_valid_column(i) or not check_empty(i):
i = int(input('Enter a valid column index: '))
set_cell(i, mark)
if check_win():
print_grid()
print('Congrats, Player %s is won!' % mark)
break
op_mark = 'O' if player == 0 else 'X'
if check_tie(mark):
print_grid()
print("Woah! That's a tie!")
break
player = 1 - player
while True:
grid_clear()
play_game()
c = input('Play Again [Y/N] ')
if c not in 'yY':
breakv |
__version__ = '0.1.2'
def version_info():
return tuple([int(i) for i in __version__.split('.')])
| __version__ = '0.1.2'
def version_info():
return tuple([int(i) for i in __version__.split('.')]) |
set1 = set()
set1.add(1)
set2 = {1, 2, 3}
print(set1)
print(set1 | set2)
print(set1 & set2)
| set1 = set()
set1.add(1)
set2 = {1, 2, 3}
print(set1)
print(set1 | set2)
print(set1 & set2) |
youtubePlaylists = [
"PLxAzjHbHvNcUvcajBsGW2VI6fyIWa4sVl", # ProbablePrime
"PLjux6EKYfu0045V_-s5l9biu55fzbWFAO", # Deloious Jax
"PLoAvz0_U4_3wuXXrl8IbyJIYZFdeIgyHm", # Frooxius
"PLSa764cPPsV9saKq_9Sb_izfwgI9cY-8u", # CuriosVR.. coffee
"PLWhfKbDgR4zD-o31sgHqesncjt49Jxou7", # AMoB tutorials
"PLFYjCoKo3ivA67rj20lIsmUG2AQoavYHG", # Alex Drypy Avali
"PLwitPMCdx0xu2KQ7vwoccaPUp-31qfdjK", # Turk
"PLSB-6Ok84ZR0Ow4ziNWuFLGTgf3M1JDKT", # sirkitree
"PLa82mLNo3G469kqA5avK5A2bAyycT6BuJ", # dev tips from Mystic Forge
"PLxzYbxVivbzR5z8FQGfXOmOhx7lfnMxFs", # jiink's neos tutorials
"PLpwEkiuuwBpACPqbsPKuJOLTQsFz4Q-7C", # Nicole+
"PLh_pMt0Xa7j8UQJ3fzJMvdTHduACp4jpP", # Engi
]
| youtube_playlists = ['PLxAzjHbHvNcUvcajBsGW2VI6fyIWa4sVl', 'PLjux6EKYfu0045V_-s5l9biu55fzbWFAO', 'PLoAvz0_U4_3wuXXrl8IbyJIYZFdeIgyHm', 'PLSa764cPPsV9saKq_9Sb_izfwgI9cY-8u', 'PLWhfKbDgR4zD-o31sgHqesncjt49Jxou7', 'PLFYjCoKo3ivA67rj20lIsmUG2AQoavYHG', 'PLwitPMCdx0xu2KQ7vwoccaPUp-31qfdjK', 'PLSB-6Ok84ZR0Ow4ziNWuFLGTgf3M1JDKT', 'PLa82mLNo3G469kqA5avK5A2bAyycT6BuJ', 'PLxzYbxVivbzR5z8FQGfXOmOhx7lfnMxFs', 'PLpwEkiuuwBpACPqbsPKuJOLTQsFz4Q-7C', 'PLh_pMt0Xa7j8UQJ3fzJMvdTHduACp4jpP'] |
def rotate(list, no_rotation):
return list[no_rotation:] + list[:no_rotation]
def message_processor(message):
message = message.upper()
message = message.replace(" ", "")
return message
def select_rotor(rotor_model):
rotor_i_list = ['E','K','M','F','L','G','D','Q','V','Z','N','T','O','W','Y','H','X','U','S','P','A','I','B','R','C','J']
rotor_ii_list = ['A','J','D','K','S','I','R','U','X','B','L','H','W','T','M','C','Q','G','Z','N','P','Y','F','V','O','E']
rotor_iii_list = ['B','D','F','H','J','L','C','P','R','T','X','V','Z','N','Y','E','I','W','G','A','K','M','U','S','Q','O']
rotor_iv_list = ['E','S','O','V','P','Z','J','A','Y','Q','U','I','R','H','X','L','N','F','T','G','K','D','C','M','W','B']
rotor_v_list = ['V','Z','B','R','G','I','T','Y','U','P','S','D','N','H','L','X','A','W','M','J','Q','O','F','E','C','K']
rotor_vi_list = ['J','P','G','V','O','U','M','F','Y','Q','B','E','N','H','Z','R','D','K','A','S','X','L','I','C','T','W']
rotor_vii_list = ['N','Z','J','H','G','R','C','X','M','Y','S','W','B','O','U','F','A','I','V','L','P','E','K','Q','D','T']
rotor_viii_list = ['F','K','Q','H','T','L','X','O','C','B','J','S','P','D','Z','R','A','M','E','W','N','I','U','Y','G','V']
rotor_beta_list = ['L','E','Y','J','V','C','N','I','X','W','P','B','Q','M','D','R','T','A','K','Z','G','F','U','H','O','S']
rotor_gamma_list = ['F','S','O','K','A','N','U','E','R','H','M','B','T','I','Y','C','W','L','Q','P','Z','X','V','G','J','D']
if rotor_model == 'Rotor-I':
rotor_model_list = rotor_i_list
elif rotor_model == 'Rotor-II':
rotor_model_list = rotor_ii_list
elif rotor_model == 'Rotor-III':
rotor_model_list = rotor_iii_list
elif rotor_model == 'Rotor-IV':
rotor_model_list = rotor_iv_list
elif rotor_model == 'Rotor-V':
rotor_model_list = rotor_v_list
elif rotor_model == 'Rotor-VI':
rotor_model_list = rotor_vi_list
elif rotor_model == 'Rotor-VII':
rotor_model_list = rotor_vii_list
elif rotor_model == 'Rotor-VIII':
rotor_model_list = rotor_viii_list
elif rotor_model == 'Rotor-Beta':
rotor_model_list = rotor_beta_list
else:
rotor_model_list = rotor_gamma_list
return rotor_model_list
def select_reflector(reflector_model):
reflector_b_list = ['Y','R','U','H','Q','S','L','D','P','X','N','G','O','K','M','I','E','B','F','Z','C','W','V','J','A','T']
reflector_c_list = ['F','V','P','J','I','A','O','Y','E','D','R','Z','X','W','G','C','T','K','U','Q','S','B','N','M','H','L']
reflector_b_thin_list = ['E','N','K','Q','A','U','Y','W','J','I','C','O','P','B','L','M','D','X','Z','V','F','T','H','R','G','S']
reflector_c_thin_list = ['R','D','O','B','J','N','T','K','V','E','H','M','L','F','C','W','Z','A','X','G','Y','I','P','S','U','Q']
if reflector_model == 'Reflector-B':
reflector_model_list = reflector_b_list
elif reflector_model == 'Reflector-C':
reflector_model_list = reflector_c_list
elif reflector_model == 'Reflector-B Thin':
reflector_model_list = reflector_b_thin_list
else:
reflector_model_list = reflector_c_thin_list
return reflector_model_list
def starter(rotor_list, starter_letter):
starter_index = rotor_list.index(starter_letter)
rotor_list = rotate(rotor_list,starter_index)
return rotor_list
def enigma(message, rotor_slection, reflector_selection, starter_list):
keyboard_list = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
message = message_processor(message)
first_rotor_counter = 0
second_rotor_counter = 0
third_rotor_counter = 0
encrypted_message=""
first_rotor_list = select_rotor(rotor_slection[0])
first_rotor_list = starter(first_rotor_list,starter_list[0])
second_rotor_list = select_rotor(rotor_slection[1])
second_rotor_list = starter(second_rotor_list,starter_list[1])
third_rotor_list = select_rotor(rotor_slection[2])
third_rotor_list = starter(third_rotor_list,starter_list[2])
reflector_list = select_reflector(reflector_selection)
for letter in message:
#Encrypting Message
keyboard = keyboard_list.index(letter)
first_rotor = first_rotor_list[keyboard]
keyboard = keyboard_list.index(first_rotor)
second_rotor = second_rotor_list[keyboard]
keyboard = keyboard_list.index(second_rotor)
third_rotor = third_rotor_list[keyboard]
#Reflector
keyboard = keyboard_list.index(third_rotor)
reflector = reflector_list[keyboard]
#Rotar backtracking
third_rotor = third_rotor_list.index(reflector)
keyboard = keyboard_list[third_rotor]
second_rotor = second_rotor_list.index(keyboard)
keyboard = keyboard_list[second_rotor]
first_rotor = first_rotor_list.index(keyboard)
keyboard = keyboard_list[first_rotor]
#Putting the encrypted letters together in a list
encrypted_message+=keyboard
#Rotating list according to counts
first_rotor_list = rotate(first_rotor_list,1)
first_rotor_counter += 1
if first_rotor_counter == 25:
second_rotor_list = rotate(second_rotor_list,1)
second_rotor_counter += 1
if second_rotor_counter == 25:
third_rotor_list = rotate(third_rotor_list,1)
third_rotor_list += 1
return encrypted_message | def rotate(list, no_rotation):
return list[no_rotation:] + list[:no_rotation]
def message_processor(message):
message = message.upper()
message = message.replace(' ', '')
return message
def select_rotor(rotor_model):
rotor_i_list = ['E', 'K', 'M', 'F', 'L', 'G', 'D', 'Q', 'V', 'Z', 'N', 'T', 'O', 'W', 'Y', 'H', 'X', 'U', 'S', 'P', 'A', 'I', 'B', 'R', 'C', 'J']
rotor_ii_list = ['A', 'J', 'D', 'K', 'S', 'I', 'R', 'U', 'X', 'B', 'L', 'H', 'W', 'T', 'M', 'C', 'Q', 'G', 'Z', 'N', 'P', 'Y', 'F', 'V', 'O', 'E']
rotor_iii_list = ['B', 'D', 'F', 'H', 'J', 'L', 'C', 'P', 'R', 'T', 'X', 'V', 'Z', 'N', 'Y', 'E', 'I', 'W', 'G', 'A', 'K', 'M', 'U', 'S', 'Q', 'O']
rotor_iv_list = ['E', 'S', 'O', 'V', 'P', 'Z', 'J', 'A', 'Y', 'Q', 'U', 'I', 'R', 'H', 'X', 'L', 'N', 'F', 'T', 'G', 'K', 'D', 'C', 'M', 'W', 'B']
rotor_v_list = ['V', 'Z', 'B', 'R', 'G', 'I', 'T', 'Y', 'U', 'P', 'S', 'D', 'N', 'H', 'L', 'X', 'A', 'W', 'M', 'J', 'Q', 'O', 'F', 'E', 'C', 'K']
rotor_vi_list = ['J', 'P', 'G', 'V', 'O', 'U', 'M', 'F', 'Y', 'Q', 'B', 'E', 'N', 'H', 'Z', 'R', 'D', 'K', 'A', 'S', 'X', 'L', 'I', 'C', 'T', 'W']
rotor_vii_list = ['N', 'Z', 'J', 'H', 'G', 'R', 'C', 'X', 'M', 'Y', 'S', 'W', 'B', 'O', 'U', 'F', 'A', 'I', 'V', 'L', 'P', 'E', 'K', 'Q', 'D', 'T']
rotor_viii_list = ['F', 'K', 'Q', 'H', 'T', 'L', 'X', 'O', 'C', 'B', 'J', 'S', 'P', 'D', 'Z', 'R', 'A', 'M', 'E', 'W', 'N', 'I', 'U', 'Y', 'G', 'V']
rotor_beta_list = ['L', 'E', 'Y', 'J', 'V', 'C', 'N', 'I', 'X', 'W', 'P', 'B', 'Q', 'M', 'D', 'R', 'T', 'A', 'K', 'Z', 'G', 'F', 'U', 'H', 'O', 'S']
rotor_gamma_list = ['F', 'S', 'O', 'K', 'A', 'N', 'U', 'E', 'R', 'H', 'M', 'B', 'T', 'I', 'Y', 'C', 'W', 'L', 'Q', 'P', 'Z', 'X', 'V', 'G', 'J', 'D']
if rotor_model == 'Rotor-I':
rotor_model_list = rotor_i_list
elif rotor_model == 'Rotor-II':
rotor_model_list = rotor_ii_list
elif rotor_model == 'Rotor-III':
rotor_model_list = rotor_iii_list
elif rotor_model == 'Rotor-IV':
rotor_model_list = rotor_iv_list
elif rotor_model == 'Rotor-V':
rotor_model_list = rotor_v_list
elif rotor_model == 'Rotor-VI':
rotor_model_list = rotor_vi_list
elif rotor_model == 'Rotor-VII':
rotor_model_list = rotor_vii_list
elif rotor_model == 'Rotor-VIII':
rotor_model_list = rotor_viii_list
elif rotor_model == 'Rotor-Beta':
rotor_model_list = rotor_beta_list
else:
rotor_model_list = rotor_gamma_list
return rotor_model_list
def select_reflector(reflector_model):
reflector_b_list = ['Y', 'R', 'U', 'H', 'Q', 'S', 'L', 'D', 'P', 'X', 'N', 'G', 'O', 'K', 'M', 'I', 'E', 'B', 'F', 'Z', 'C', 'W', 'V', 'J', 'A', 'T']
reflector_c_list = ['F', 'V', 'P', 'J', 'I', 'A', 'O', 'Y', 'E', 'D', 'R', 'Z', 'X', 'W', 'G', 'C', 'T', 'K', 'U', 'Q', 'S', 'B', 'N', 'M', 'H', 'L']
reflector_b_thin_list = ['E', 'N', 'K', 'Q', 'A', 'U', 'Y', 'W', 'J', 'I', 'C', 'O', 'P', 'B', 'L', 'M', 'D', 'X', 'Z', 'V', 'F', 'T', 'H', 'R', 'G', 'S']
reflector_c_thin_list = ['R', 'D', 'O', 'B', 'J', 'N', 'T', 'K', 'V', 'E', 'H', 'M', 'L', 'F', 'C', 'W', 'Z', 'A', 'X', 'G', 'Y', 'I', 'P', 'S', 'U', 'Q']
if reflector_model == 'Reflector-B':
reflector_model_list = reflector_b_list
elif reflector_model == 'Reflector-C':
reflector_model_list = reflector_c_list
elif reflector_model == 'Reflector-B Thin':
reflector_model_list = reflector_b_thin_list
else:
reflector_model_list = reflector_c_thin_list
return reflector_model_list
def starter(rotor_list, starter_letter):
starter_index = rotor_list.index(starter_letter)
rotor_list = rotate(rotor_list, starter_index)
return rotor_list
def enigma(message, rotor_slection, reflector_selection, starter_list):
keyboard_list = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
message = message_processor(message)
first_rotor_counter = 0
second_rotor_counter = 0
third_rotor_counter = 0
encrypted_message = ''
first_rotor_list = select_rotor(rotor_slection[0])
first_rotor_list = starter(first_rotor_list, starter_list[0])
second_rotor_list = select_rotor(rotor_slection[1])
second_rotor_list = starter(second_rotor_list, starter_list[1])
third_rotor_list = select_rotor(rotor_slection[2])
third_rotor_list = starter(third_rotor_list, starter_list[2])
reflector_list = select_reflector(reflector_selection)
for letter in message:
keyboard = keyboard_list.index(letter)
first_rotor = first_rotor_list[keyboard]
keyboard = keyboard_list.index(first_rotor)
second_rotor = second_rotor_list[keyboard]
keyboard = keyboard_list.index(second_rotor)
third_rotor = third_rotor_list[keyboard]
keyboard = keyboard_list.index(third_rotor)
reflector = reflector_list[keyboard]
third_rotor = third_rotor_list.index(reflector)
keyboard = keyboard_list[third_rotor]
second_rotor = second_rotor_list.index(keyboard)
keyboard = keyboard_list[second_rotor]
first_rotor = first_rotor_list.index(keyboard)
keyboard = keyboard_list[first_rotor]
encrypted_message += keyboard
first_rotor_list = rotate(first_rotor_list, 1)
first_rotor_counter += 1
if first_rotor_counter == 25:
second_rotor_list = rotate(second_rotor_list, 1)
second_rotor_counter += 1
if second_rotor_counter == 25:
third_rotor_list = rotate(third_rotor_list, 1)
third_rotor_list += 1
return encrypted_message |
x=int(input())
count=0
for i in range(1,x):
if(x%i==0):
count+=1
if(count!=2):
print("yes")
else:
print("no")
| x = int(input())
count = 0
for i in range(1, x):
if x % i == 0:
count += 1
if count != 2:
print('yes')
else:
print('no') |
print("Hello world!");
print("Hello everybody!");
print("Hello!")
print("Hello my dear friend!")
print("Glad to see you!") | print('Hello world!')
print('Hello everybody!')
print('Hello!')
print('Hello my dear friend!')
print('Glad to see you!') |
# https://cses.fi/problemset/task/1092
n = int(input())
if n % 4 in [1, 2]:
print('NO')
exit()
s1, s2 = '', ''
if n % 4 == 0:
x = n // 2 + 1
for i in range(1, x, 2):
s1 += str(i) + ' ' + str(n - i + 1) + ' '
s2 += str(i + 1) + ' ' + str(n - i) + ' '
else:
s1 = '1 2'
s2 = '3'
for i in range(4, n, 4):
s1 += ' ' + str(i) + ' ' + str(i + 3)
s2 += ' ' + str(i + 1) + ' ' + str(i + 2)
print('YES')
print((n + 1) // 2)
print(s1)
print(n // 2)
print(s2)
| n = int(input())
if n % 4 in [1, 2]:
print('NO')
exit()
(s1, s2) = ('', '')
if n % 4 == 0:
x = n // 2 + 1
for i in range(1, x, 2):
s1 += str(i) + ' ' + str(n - i + 1) + ' '
s2 += str(i + 1) + ' ' + str(n - i) + ' '
else:
s1 = '1 2'
s2 = '3'
for i in range(4, n, 4):
s1 += ' ' + str(i) + ' ' + str(i + 3)
s2 += ' ' + str(i + 1) + ' ' + str(i + 2)
print('YES')
print((n + 1) // 2)
print(s1)
print(n // 2)
print(s2) |
TEST = "test_input.txt"
INPUT = "input.txt"
def read_file(filename):
return open(filename, "r").readlines()
def process_task_1(data):
return len(data)
def process_task_2(data):
return len(data)
def test():
data = read_file(TEST)
assert process_task_1(data) == 0
assert process_task_2(data) == 0
def main():
data = read_file(INPUT)
print(f"Task 1: {process_task_1(data)}")
print(f"Task 2: {process_task_2(data)}")
if __name__ == "__main__":
test()
main()
| test = 'test_input.txt'
input = 'input.txt'
def read_file(filename):
return open(filename, 'r').readlines()
def process_task_1(data):
return len(data)
def process_task_2(data):
return len(data)
def test():
data = read_file(TEST)
assert process_task_1(data) == 0
assert process_task_2(data) == 0
def main():
data = read_file(INPUT)
print(f'Task 1: {process_task_1(data)}')
print(f'Task 2: {process_task_2(data)}')
if __name__ == '__main__':
test()
main() |
#Enter a number and count its digits.
n=int(input("Enter a no.:"))
count=0
a=0
ans=0
while n!=0:
n=n//10
count=count+1
print("Total no. of digits in the number=",count)
| n = int(input('Enter a no.:'))
count = 0
a = 0
ans = 0
while n != 0:
n = n // 10
count = count + 1
print('Total no. of digits in the number=', count) |
# This module defines strings containing XPM data that matches
# Golly's built-in icons (see the XPM data in wxalgos.cpp).
# The strings are used by icon-importer.py and icon_exporter.py.
circles = '''
XPM
/* width height num_colors chars_per_pixel */
"31 31 5 1"
/* colors */
". c #000000"
"B c #404040"
"C c #808080"
"D c #C0C0C0"
"E c #FFFFFF"
/* icon for state 1 */
"..............................."
"..............................."
"..........BCDEEEEEDCB.........."
".........CEEEEEEEEEEEC........."
".......BEEEEEEEEEEEEEEEB......."
"......DEEEEEEEEEEEEEEEEED......"
".....DEEEEEEEEEEEEEEEEEEED....."
"....BEEEEEEEEEEEEEEEEEEEEEB...."
"....EEEEEEEEEEEEEEEEEEEEEEE...."
"...CEEEEEEEEEEEEEEEEEEEEEEEC..."
"..BEEEEEEEEEEEEEEEEEEEEEEEEEB.."
"..CEEEEEEEEEEEEEEEEEEEEEEEEEC.."
"..DEEEEEEEEEEEEEEEEEEEEEEEEED.."
"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."
"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."
"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."
"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."
"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."
"..DEEEEEEEEEEEEEEEEEEEEEEEEED.."
"..CEEEEEEEEEEEEEEEEEEEEEEEEEC.."
"..BEEEEEEEEEEEEEEEEEEEEEEEEEB.."
"...CEEEEEEEEEEEEEEEEEEEEEEEC..."
"....EEEEEEEEEEEEEEEEEEEEEEE...."
"....BEEEEEEEEEEEEEEEEEEEEEB...."
".....DEEEEEEEEEEEEEEEEEEED....."
"......DEEEEEEEEEEEEEEEEED......"
".......BEEEEEEEEEEEEEEEB......."
".........CEEEEEEEEEEEC........."
"..........BCDEEEEEDCB.........."
"..............................."
"..............................."
XPM
/* width height num_colors chars_per_pixel */
"15 15 5 1"
/* colors */
". c #000000"
"B c #404040"
"C c #808080"
"D c #C0C0C0"
"E c #FFFFFF"
/* icon for state 1 */
"..............."
"....BDEEEDB...."
"...DEEEEEEED..."
"..DEEEEEEEEED.."
".BEEEEEEEEEEEB."
".DEEEEEEEEEEED."
".EEEEEEEEEEEEE."
".EEEEEEEEEEEEE."
".EEEEEEEEEEEEE."
".DEEEEEEEEEEED."
".BEEEEEEEEEEEB."
"..DEEEEEEEEED.."
"...DEEEEEEED..."
"....BDEEEDB...."
"..............."
XPM
/* width height num_colors chars_per_pixel */
"7 7 6 1"
/* colors */
". c #000000"
"B c #404040"
"C c #808080"
"D c #C0C0C0"
"E c #FFFFFF"
"F c #E0E0E0"
/* icon for state 1 */
".BFEFB."
"BEEEEEB"
"FEEEEEF"
"EEEEEEE"
"FEEEEEF"
"BEEEEEB"
".BFEFB."
'''
diamonds = '''
XPM
/* width height num_colors chars_per_pixel */
"31 31 2 1"
/* colors */
". c #000000"
"B c #FFFFFF"
/* icon for state 1 */
"..............................."
"..............................."
"...............B..............."
"..............BBB.............."
".............BBBBB............."
"............BBBBBBB............"
"...........BBBBBBBBB..........."
"..........BBBBBBBBBBB.........."
".........BBBBBBBBBBBBB........."
"........BBBBBBBBBBBBBBB........"
".......BBBBBBBBBBBBBBBBB......."
"......BBBBBBBBBBBBBBBBBBB......"
".....BBBBBBBBBBBBBBBBBBBBB....."
"....BBBBBBBBBBBBBBBBBBBBBBB...."
"...BBBBBBBBBBBBBBBBBBBBBBBBB..."
"..BBBBBBBBBBBBBBBBBBBBBBBBBBB.."
"...BBBBBBBBBBBBBBBBBBBBBBBBB..."
"....BBBBBBBBBBBBBBBBBBBBBBB...."
".....BBBBBBBBBBBBBBBBBBBBB....."
"......BBBBBBBBBBBBBBBBBBB......"
".......BBBBBBBBBBBBBBBBB......."
"........BBBBBBBBBBBBBBB........"
".........BBBBBBBBBBBBB........."
"..........BBBBBBBBBBB.........."
"...........BBBBBBBBB..........."
"............BBBBBBB............"
".............BBBBB............."
"..............BBB.............."
"...............B..............."
"..............................."
"..............................."
XPM
/* width height num_colors chars_per_pixel */
"15 15 2 1"
/* colors */
". c #000000"
"B c #FFFFFF"
/* icon for state 1 */
"..............."
".......B......."
"......BBB......"
".....BBBBB....."
"....BBBBBBB...."
"...BBBBBBBBB..."
"..BBBBBBBBBBB.."
".BBBBBBBBBBBBB."
"..BBBBBBBBBBB.."
"...BBBBBBBBB..."
"....BBBBBBB...."
".....BBBBB....."
"......BBB......"
".......B......."
"..............."
XPM
/* width height num_colors chars_per_pixel */
"7 7 2 1"
/* colors */
". c #000000"
"B c #FFFFFF"
/* icon for state 1 */
"...B..."
"..BBB.."
".BBBBB."
"BBBBBBB"
".BBBBB."
"..BBB.."
"...B..."
'''
hexagons = '''
XPM
/* width height num_colors chars_per_pixel */
"31 31 3 1"
/* colors */
". c #000000"
"B c #FFFFFF"
"C c #808080"
/* icon for state 1 */
".....BBC......................."
"....BBBBBC....................."
"...BBBBBBBBC..................."
"..BBBBBBBBBBBC................."
".BBBBBBBBBBBBBBC..............."
"BBBBBBBBBBBBBBBBBC............."
"BBBBBBBBBBBBBBBBBBBC..........."
"CBBBBBBBBBBBBBBBBBBBBC........."
".BBBBBBBBBBBBBBBBBBBBBB........"
".CBBBBBBBBBBBBBBBBBBBBBC......."
"..BBBBBBBBBBBBBBBBBBBBBB......."
"..CBBBBBBBBBBBBBBBBBBBBBC......"
"...BBBBBBBBBBBBBBBBBBBBBB......"
"...CBBBBBBBBBBBBBBBBBBBBBC....."
"....BBBBBBBBBBBBBBBBBBBBBB....."
"....CBBBBBBBBBBBBBBBBBBBBBC...."
".....BBBBBBBBBBBBBBBBBBBBBB...."
".....CBBBBBBBBBBBBBBBBBBBBBC..."
"......BBBBBBBBBBBBBBBBBBBBBB..."
"......CBBBBBBBBBBBBBBBBBBBBBC.."
".......BBBBBBBBBBBBBBBBBBBBBB.."
".......CBBBBBBBBBBBBBBBBBBBBBC."
"........BBBBBBBBBBBBBBBBBBBBBB."
".........CBBBBBBBBBBBBBBBBBBBBC"
"...........CBBBBBBBBBBBBBBBBBBB"
".............CBBBBBBBBBBBBBBBBB"
"...............CBBBBBBBBBBBBBB."
".................CBBBBBBBBBBB.."
"...................CBBBBBBBB..."
".....................CBBBBB...."
".......................CBB....."
XPM
/* width height num_colors chars_per_pixel */
"15 15 3 1"
/* colors */
". c #000000"
"B c #FFFFFF"
"C c #808080"
/* icon for state 1 */
"...BBC........."
"..BBBBBC......."
".BBBBBBBBC....."
"BBBBBBBBBBB...."
"BBBBBBBBBBBB..."
"CBBBBBBBBBBBC.."
".BBBBBBBBBBBB.."
".CBBBBBBBBBBBC."
"..BBBBBBBBBBBB."
"..CBBBBBBBBBBBC"
"...BBBBBBBBBBBB"
"....BBBBBBBBBBB"
".....CBBBBBBBB."
".......CBBBBB.."
".........CBB..."
XPM
/* width height num_colors chars_per_pixel */
"7 7 3 1"
/* colors */
". c #000000"
"B c #FFFFFF"
"C c #808080"
/* icon for state 1 */
".BBC..."
"BBBBB.."
"BBBBBB."
"CBBBBBC"
".BBBBBB"
"..BBBBB"
"...CBB."
'''
triangles = '''
XPM
/* width height num_colors chars_per_pixel */
"31 93 2 1"
/* colors */
". c #000000"
"B c #FFFFFF"
/* icon for state 1 */
"..............................."
"B.............................."
"BB............................."
"BBB............................"
"BBBB..........................."
"BBBBB.........................."
"BBBBBB........................."
"BBBBBBB........................"
"BBBBBBBB......................."
"BBBBBBBBB......................"
"BBBBBBBBBB....................."
"BBBBBBBBBBB...................."
"BBBBBBBBBBBB..................."
"BBBBBBBBBBBBB.................."
"BBBBBBBBBBBBBB................."
"BBBBBBBBBBBBBBB................"
"BBBBBBBBBBBBBBBB..............."
"BBBBBBBBBBBBBBBBB.............."
"BBBBBBBBBBBBBBBBBB............."
"BBBBBBBBBBBBBBBBBBB............"
"BBBBBBBBBBBBBBBBBBBB..........."
"BBBBBBBBBBBBBBBBBBBBB.........."
"BBBBBBBBBBBBBBBBBBBBBB........."
"BBBBBBBBBBBBBBBBBBBBBBB........"
"BBBBBBBBBBBBBBBBBBBBBBBB......."
"BBBBBBBBBBBBBBBBBBBBBBBBB......"
"BBBBBBBBBBBBBBBBBBBBBBBBBB....."
"BBBBBBBBBBBBBBBBBBBBBBBBBBB...."
"BBBBBBBBBBBBBBBBBBBBBBBBBBBB..."
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBB.."
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB."
/* icon for state 2 */
".BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
"..BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
"...BBBBBBBBBBBBBBBBBBBBBBBBBBBB"
"....BBBBBBBBBBBBBBBBBBBBBBBBBBB"
".....BBBBBBBBBBBBBBBBBBBBBBBBBB"
"......BBBBBBBBBBBBBBBBBBBBBBBBB"
".......BBBBBBBBBBBBBBBBBBBBBBBB"
"........BBBBBBBBBBBBBBBBBBBBBBB"
".........BBBBBBBBBBBBBBBBBBBBBB"
"..........BBBBBBBBBBBBBBBBBBBBB"
"...........BBBBBBBBBBBBBBBBBBBB"
"............BBBBBBBBBBBBBBBBBBB"
".............BBBBBBBBBBBBBBBBBB"
"..............BBBBBBBBBBBBBBBBB"
"...............BBBBBBBBBBBBBBBB"
"................BBBBBBBBBBBBBBB"
".................BBBBBBBBBBBBBB"
"..................BBBBBBBBBBBBB"
"...................BBBBBBBBBBBB"
"....................BBBBBBBBBBB"
".....................BBBBBBBBBB"
"......................BBBBBBBBB"
".......................BBBBBBBB"
"........................BBBBBBB"
".........................BBBBBB"
"..........................BBBBB"
"...........................BBBB"
"............................BBB"
".............................BB"
"..............................B"
"..............................."
/* icon for state 3 */
".BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
"B.BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
"BB.BBBBBBBBBBBBBBBBBBBBBBBBBBBB"
"BBB.BBBBBBBBBBBBBBBBBBBBBBBBBBB"
"BBBB.BBBBBBBBBBBBBBBBBBBBBBBBBB"
"BBBBB.BBBBBBBBBBBBBBBBBBBBBBBBB"
"BBBBBB.BBBBBBBBBBBBBBBBBBBBBBBB"
"BBBBBBB.BBBBBBBBBBBBBBBBBBBBBBB"
"BBBBBBBB.BBBBBBBBBBBBBBBBBBBBBB"
"BBBBBBBBB.BBBBBBBBBBBBBBBBBBBBB"
"BBBBBBBBBB.BBBBBBBBBBBBBBBBBBBB"
"BBBBBBBBBBB.BBBBBBBBBBBBBBBBBBB"
"BBBBBBBBBBBB.BBBBBBBBBBBBBBBBBB"
"BBBBBBBBBBBBB.BBBBBBBBBBBBBBBBB"
"BBBBBBBBBBBBBB.BBBBBBBBBBBBBBBB"
"BBBBBBBBBBBBBBB.BBBBBBBBBBBBBBB"
"BBBBBBBBBBBBBBBB.BBBBBBBBBBBBBB"
"BBBBBBBBBBBBBBBBB.BBBBBBBBBBBBB"
"BBBBBBBBBBBBBBBBBB.BBBBBBBBBBBB"
"BBBBBBBBBBBBBBBBBBB.BBBBBBBBBBB"
"BBBBBBBBBBBBBBBBBBBB.BBBBBBBBBB"
"BBBBBBBBBBBBBBBBBBBBB.BBBBBBBBB"
"BBBBBBBBBBBBBBBBBBBBBB.BBBBBBBB"
"BBBBBBBBBBBBBBBBBBBBBBB.BBBBBBB"
"BBBBBBBBBBBBBBBBBBBBBBBB.BBBBBB"
"BBBBBBBBBBBBBBBBBBBBBBBBB.BBBBB"
"BBBBBBBBBBBBBBBBBBBBBBBBBB.BBBB"
"BBBBBBBBBBBBBBBBBBBBBBBBBBB.BBB"
"BBBBBBBBBBBBBBBBBBBBBBBBBBBB.BB"
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBB.B"
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB."
XPM
/* width height num_colors chars_per_pixel */
"15 45 2 1"
/* colors */
". c #000000"
"B c #FFFFFF"
/* icon for state 1 */
"..............."
"B.............."
"BB............."
"BBB............"
"BBBB..........."
"BBBBB.........."
"BBBBBB........."
"BBBBBBB........"
"BBBBBBBB......."
"BBBBBBBBB......"
"BBBBBBBBBB....."
"BBBBBBBBBBB...."
"BBBBBBBBBBBB..."
"BBBBBBBBBBBBB.."
"BBBBBBBBBBBBBB."
/* icon for state 2 */
".BBBBBBBBBBBBBB"
"..BBBBBBBBBBBBB"
"...BBBBBBBBBBBB"
"....BBBBBBBBBBB"
".....BBBBBBBBBB"
"......BBBBBBBBB"
".......BBBBBBBB"
"........BBBBBBB"
".........BBBBBB"
"..........BBBBB"
"...........BBBB"
"............BBB"
".............BB"
"..............B"
"..............."
/* icon for state 3 */
".BBBBBBBBBBBBBB"
"B.BBBBBBBBBBBBB"
"BB.BBBBBBBBBBBB"
"BBB.BBBBBBBBBBB"
"BBBB.BBBBBBBBBB"
"BBBBB.BBBBBBBBB"
"BBBBBB.BBBBBBBB"
"BBBBBBB.BBBBBBB"
"BBBBBBBB.BBBBBB"
"BBBBBBBBB.BBBBB"
"BBBBBBBBBB.BBBB"
"BBBBBBBBBBB.BBB"
"BBBBBBBBBBBB.BB"
"BBBBBBBBBBBBB.B"
"BBBBBBBBBBBBBB."
XPM
/* width height num_colors chars_per_pixel */
"7 21 2 1"
/* colors */
". c #000000"
"B c #FFFFFF"
/* icon for state 1 */
"......."
"B......"
"BB....."
"BBB...."
"BBBB..."
"BBBBB.."
"BBBBBB."
/* icon for state 2 */
".BBBBBB"
"..BBBBB"
"...BBBB"
"....BBB"
".....BB"
"......B"
"......."
/* icon for state 3 */
".BBBBBB"
"B.BBBBB"
"BB.BBBB"
"BBB.BBB"
"BBBB.BB"
"BBBBB.B"
"BBBBBB."
'''
| circles = '\nXPM\n/* width height num_colors chars_per_pixel */\n"31 31 5 1"\n/* colors */\n". c #000000"\n"B c #404040"\n"C c #808080"\n"D c #C0C0C0"\n"E c #FFFFFF"\n/* icon for state 1 */\n"..............................."\n"..............................."\n"..........BCDEEEEEDCB.........."\n".........CEEEEEEEEEEEC........."\n".......BEEEEEEEEEEEEEEEB......."\n"......DEEEEEEEEEEEEEEEEED......"\n".....DEEEEEEEEEEEEEEEEEEED....."\n"....BEEEEEEEEEEEEEEEEEEEEEB...."\n"....EEEEEEEEEEEEEEEEEEEEEEE...."\n"...CEEEEEEEEEEEEEEEEEEEEEEEC..."\n"..BEEEEEEEEEEEEEEEEEEEEEEEEEB.."\n"..CEEEEEEEEEEEEEEEEEEEEEEEEEC.."\n"..DEEEEEEEEEEEEEEEEEEEEEEEEED.."\n"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."\n"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."\n"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."\n"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."\n"..EEEEEEEEEEEEEEEEEEEEEEEEEEE.."\n"..DEEEEEEEEEEEEEEEEEEEEEEEEED.."\n"..CEEEEEEEEEEEEEEEEEEEEEEEEEC.."\n"..BEEEEEEEEEEEEEEEEEEEEEEEEEB.."\n"...CEEEEEEEEEEEEEEEEEEEEEEEC..."\n"....EEEEEEEEEEEEEEEEEEEEEEE...."\n"....BEEEEEEEEEEEEEEEEEEEEEB...."\n".....DEEEEEEEEEEEEEEEEEEED....."\n"......DEEEEEEEEEEEEEEEEED......"\n".......BEEEEEEEEEEEEEEEB......."\n".........CEEEEEEEEEEEC........."\n"..........BCDEEEEEDCB.........."\n"..............................."\n"..............................."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"15 15 5 1"\n/* colors */\n". c #000000"\n"B c #404040"\n"C c #808080"\n"D c #C0C0C0"\n"E c #FFFFFF"\n/* icon for state 1 */\n"..............."\n"....BDEEEDB...."\n"...DEEEEEEED..."\n"..DEEEEEEEEED.."\n".BEEEEEEEEEEEB."\n".DEEEEEEEEEEED."\n".EEEEEEEEEEEEE."\n".EEEEEEEEEEEEE."\n".EEEEEEEEEEEEE."\n".DEEEEEEEEEEED."\n".BEEEEEEEEEEEB."\n"..DEEEEEEEEED.."\n"...DEEEEEEED..."\n"....BDEEEDB...."\n"..............."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"7 7 6 1"\n/* colors */\n". c #000000"\n"B c #404040"\n"C c #808080"\n"D c #C0C0C0"\n"E c #FFFFFF"\n"F c #E0E0E0"\n/* icon for state 1 */\n".BFEFB."\n"BEEEEEB"\n"FEEEEEF"\n"EEEEEEE"\n"FEEEEEF"\n"BEEEEEB"\n".BFEFB."\n'
diamonds = '\nXPM\n/* width height num_colors chars_per_pixel */\n"31 31 2 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n/* icon for state 1 */\n"..............................."\n"..............................."\n"...............B..............."\n"..............BBB.............."\n".............BBBBB............."\n"............BBBBBBB............"\n"...........BBBBBBBBB..........."\n"..........BBBBBBBBBBB.........."\n".........BBBBBBBBBBBBB........."\n"........BBBBBBBBBBBBBBB........"\n".......BBBBBBBBBBBBBBBBB......."\n"......BBBBBBBBBBBBBBBBBBB......"\n".....BBBBBBBBBBBBBBBBBBBBB....."\n"....BBBBBBBBBBBBBBBBBBBBBBB...."\n"...BBBBBBBBBBBBBBBBBBBBBBBBB..."\n"..BBBBBBBBBBBBBBBBBBBBBBBBBBB.."\n"...BBBBBBBBBBBBBBBBBBBBBBBBB..."\n"....BBBBBBBBBBBBBBBBBBBBBBB...."\n".....BBBBBBBBBBBBBBBBBBBBB....."\n"......BBBBBBBBBBBBBBBBBBB......"\n".......BBBBBBBBBBBBBBBBB......."\n"........BBBBBBBBBBBBBBB........"\n".........BBBBBBBBBBBBB........."\n"..........BBBBBBBBBBB.........."\n"...........BBBBBBBBB..........."\n"............BBBBBBB............"\n".............BBBBB............."\n"..............BBB.............."\n"...............B..............."\n"..............................."\n"..............................."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"15 15 2 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n/* icon for state 1 */\n"..............."\n".......B......."\n"......BBB......"\n".....BBBBB....."\n"....BBBBBBB...."\n"...BBBBBBBBB..."\n"..BBBBBBBBBBB.."\n".BBBBBBBBBBBBB."\n"..BBBBBBBBBBB.."\n"...BBBBBBBBB..."\n"....BBBBBBB...."\n".....BBBBB....."\n"......BBB......"\n".......B......."\n"..............."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"7 7 2 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n/* icon for state 1 */\n"...B..."\n"..BBB.."\n".BBBBB."\n"BBBBBBB"\n".BBBBB."\n"..BBB.."\n"...B..."\n'
hexagons = '\nXPM\n/* width height num_colors chars_per_pixel */\n"31 31 3 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n"C c #808080"\n/* icon for state 1 */\n".....BBC......................."\n"....BBBBBC....................."\n"...BBBBBBBBC..................."\n"..BBBBBBBBBBBC................."\n".BBBBBBBBBBBBBBC..............."\n"BBBBBBBBBBBBBBBBBC............."\n"BBBBBBBBBBBBBBBBBBBC..........."\n"CBBBBBBBBBBBBBBBBBBBBC........."\n".BBBBBBBBBBBBBBBBBBBBBB........"\n".CBBBBBBBBBBBBBBBBBBBBBC......."\n"..BBBBBBBBBBBBBBBBBBBBBB......."\n"..CBBBBBBBBBBBBBBBBBBBBBC......"\n"...BBBBBBBBBBBBBBBBBBBBBB......"\n"...CBBBBBBBBBBBBBBBBBBBBBC....."\n"....BBBBBBBBBBBBBBBBBBBBBB....."\n"....CBBBBBBBBBBBBBBBBBBBBBC...."\n".....BBBBBBBBBBBBBBBBBBBBBB...."\n".....CBBBBBBBBBBBBBBBBBBBBBC..."\n"......BBBBBBBBBBBBBBBBBBBBBB..."\n"......CBBBBBBBBBBBBBBBBBBBBBC.."\n".......BBBBBBBBBBBBBBBBBBBBBB.."\n".......CBBBBBBBBBBBBBBBBBBBBBC."\n"........BBBBBBBBBBBBBBBBBBBBBB."\n".........CBBBBBBBBBBBBBBBBBBBBC"\n"...........CBBBBBBBBBBBBBBBBBBB"\n".............CBBBBBBBBBBBBBBBBB"\n"...............CBBBBBBBBBBBBBB."\n".................CBBBBBBBBBBB.."\n"...................CBBBBBBBB..."\n".....................CBBBBB...."\n".......................CBB....."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"15 15 3 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n"C c #808080"\n/* icon for state 1 */\n"...BBC........."\n"..BBBBBC......."\n".BBBBBBBBC....."\n"BBBBBBBBBBB...."\n"BBBBBBBBBBBB..."\n"CBBBBBBBBBBBC.."\n".BBBBBBBBBBBB.."\n".CBBBBBBBBBBBC."\n"..BBBBBBBBBBBB."\n"..CBBBBBBBBBBBC"\n"...BBBBBBBBBBBB"\n"....BBBBBBBBBBB"\n".....CBBBBBBBB."\n".......CBBBBB.."\n".........CBB..."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"7 7 3 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n"C c #808080"\n/* icon for state 1 */\n".BBC..."\n"BBBBB.."\n"BBBBBB."\n"CBBBBBC"\n".BBBBBB"\n"..BBBBB"\n"...CBB."\n'
triangles = '\nXPM\n/* width height num_colors chars_per_pixel */\n"31 93 2 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n/* icon for state 1 */\n"..............................."\n"B.............................."\n"BB............................."\n"BBB............................"\n"BBBB..........................."\n"BBBBB.........................."\n"BBBBBB........................."\n"BBBBBBB........................"\n"BBBBBBBB......................."\n"BBBBBBBBB......................"\n"BBBBBBBBBB....................."\n"BBBBBBBBBBB...................."\n"BBBBBBBBBBBB..................."\n"BBBBBBBBBBBBB.................."\n"BBBBBBBBBBBBBB................."\n"BBBBBBBBBBBBBBB................"\n"BBBBBBBBBBBBBBBB..............."\n"BBBBBBBBBBBBBBBBB.............."\n"BBBBBBBBBBBBBBBBBB............."\n"BBBBBBBBBBBBBBBBBBB............"\n"BBBBBBBBBBBBBBBBBBBB..........."\n"BBBBBBBBBBBBBBBBBBBBB.........."\n"BBBBBBBBBBBBBBBBBBBBBB........."\n"BBBBBBBBBBBBBBBBBBBBBBB........"\n"BBBBBBBBBBBBBBBBBBBBBBBB......."\n"BBBBBBBBBBBBBBBBBBBBBBBBB......"\n"BBBBBBBBBBBBBBBBBBBBBBBBBB....."\n"BBBBBBBBBBBBBBBBBBBBBBBBBBB...."\n"BBBBBBBBBBBBBBBBBBBBBBBBBBBB..."\n"BBBBBBBBBBBBBBBBBBBBBBBBBBBBB.."\n"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB."\n/* icon for state 2 */\n".BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"..BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"...BBBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"....BBBBBBBBBBBBBBBBBBBBBBBBBBB"\n".....BBBBBBBBBBBBBBBBBBBBBBBBBB"\n"......BBBBBBBBBBBBBBBBBBBBBBBBB"\n".......BBBBBBBBBBBBBBBBBBBBBBBB"\n"........BBBBBBBBBBBBBBBBBBBBBBB"\n".........BBBBBBBBBBBBBBBBBBBBBB"\n"..........BBBBBBBBBBBBBBBBBBBBB"\n"...........BBBBBBBBBBBBBBBBBBBB"\n"............BBBBBBBBBBBBBBBBBBB"\n".............BBBBBBBBBBBBBBBBBB"\n"..............BBBBBBBBBBBBBBBBB"\n"...............BBBBBBBBBBBBBBBB"\n"................BBBBBBBBBBBBBBB"\n".................BBBBBBBBBBBBBB"\n"..................BBBBBBBBBBBBB"\n"...................BBBBBBBBBBBB"\n"....................BBBBBBBBBBB"\n".....................BBBBBBBBBB"\n"......................BBBBBBBBB"\n".......................BBBBBBBB"\n"........................BBBBBBB"\n".........................BBBBBB"\n"..........................BBBBB"\n"...........................BBBB"\n"............................BBB"\n".............................BB"\n"..............................B"\n"..............................."\n/* icon for state 3 */\n".BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"B.BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"BB.BBBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"BBB.BBBBBBBBBBBBBBBBBBBBBBBBBBB"\n"BBBB.BBBBBBBBBBBBBBBBBBBBBBBBBB"\n"BBBBB.BBBBBBBBBBBBBBBBBBBBBBBBB"\n"BBBBBB.BBBBBBBBBBBBBBBBBBBBBBBB"\n"BBBBBBB.BBBBBBBBBBBBBBBBBBBBBBB"\n"BBBBBBBB.BBBBBBBBBBBBBBBBBBBBBB"\n"BBBBBBBBB.BBBBBBBBBBBBBBBBBBBBB"\n"BBBBBBBBBB.BBBBBBBBBBBBBBBBBBBB"\n"BBBBBBBBBBB.BBBBBBBBBBBBBBBBBBB"\n"BBBBBBBBBBBB.BBBBBBBBBBBBBBBBBB"\n"BBBBBBBBBBBBB.BBBBBBBBBBBBBBBBB"\n"BBBBBBBBBBBBBB.BBBBBBBBBBBBBBBB"\n"BBBBBBBBBBBBBBB.BBBBBBBBBBBBBBB"\n"BBBBBBBBBBBBBBBB.BBBBBBBBBBBBBB"\n"BBBBBBBBBBBBBBBBB.BBBBBBBBBBBBB"\n"BBBBBBBBBBBBBBBBBB.BBBBBBBBBBBB"\n"BBBBBBBBBBBBBBBBBBB.BBBBBBBBBBB"\n"BBBBBBBBBBBBBBBBBBBB.BBBBBBBBBB"\n"BBBBBBBBBBBBBBBBBBBBB.BBBBBBBBB"\n"BBBBBBBBBBBBBBBBBBBBBB.BBBBBBBB"\n"BBBBBBBBBBBBBBBBBBBBBBB.BBBBBBB"\n"BBBBBBBBBBBBBBBBBBBBBBBB.BBBBBB"\n"BBBBBBBBBBBBBBBBBBBBBBBBB.BBBBB"\n"BBBBBBBBBBBBBBBBBBBBBBBBBB.BBBB"\n"BBBBBBBBBBBBBBBBBBBBBBBBBBB.BBB"\n"BBBBBBBBBBBBBBBBBBBBBBBBBBBB.BB"\n"BBBBBBBBBBBBBBBBBBBBBBBBBBBBB.B"\n"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"15 45 2 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n/* icon for state 1 */\n"..............."\n"B.............."\n"BB............."\n"BBB............"\n"BBBB..........."\n"BBBBB.........."\n"BBBBBB........."\n"BBBBBBB........"\n"BBBBBBBB......."\n"BBBBBBBBB......"\n"BBBBBBBBBB....."\n"BBBBBBBBBBB...."\n"BBBBBBBBBBBB..."\n"BBBBBBBBBBBBB.."\n"BBBBBBBBBBBBBB."\n/* icon for state 2 */\n".BBBBBBBBBBBBBB"\n"..BBBBBBBBBBBBB"\n"...BBBBBBBBBBBB"\n"....BBBBBBBBBBB"\n".....BBBBBBBBBB"\n"......BBBBBBBBB"\n".......BBBBBBBB"\n"........BBBBBBB"\n".........BBBBBB"\n"..........BBBBB"\n"...........BBBB"\n"............BBB"\n".............BB"\n"..............B"\n"..............."\n/* icon for state 3 */\n".BBBBBBBBBBBBBB"\n"B.BBBBBBBBBBBBB"\n"BB.BBBBBBBBBBBB"\n"BBB.BBBBBBBBBBB"\n"BBBB.BBBBBBBBBB"\n"BBBBB.BBBBBBBBB"\n"BBBBBB.BBBBBBBB"\n"BBBBBBB.BBBBBBB"\n"BBBBBBBB.BBBBBB"\n"BBBBBBBBB.BBBBB"\n"BBBBBBBBBB.BBBB"\n"BBBBBBBBBBB.BBB"\n"BBBBBBBBBBBB.BB"\n"BBBBBBBBBBBBB.B"\n"BBBBBBBBBBBBBB."\n\nXPM\n/* width height num_colors chars_per_pixel */\n"7 21 2 1"\n/* colors */\n". c #000000"\n"B c #FFFFFF"\n/* icon for state 1 */\n"......."\n"B......"\n"BB....."\n"BBB...."\n"BBBB..."\n"BBBBB.."\n"BBBBBB."\n/* icon for state 2 */\n".BBBBBB"\n"..BBBBB"\n"...BBBB"\n"....BBB"\n".....BB"\n"......B"\n"......."\n/* icon for state 3 */\n".BBBBBB"\n"B.BBBBB"\n"BB.BBBB"\n"BBB.BBB"\n"BBBB.BB"\n"BBBBB.B"\n"BBBBBB."\n' |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def is_valid(s: str) -> bool:
bracket_pairs = {')': '(', '}': '{', ']': '['}
stack = []
for c in s:
if c in bracket_pairs:
if not stack or stack.pop() != bracket_pairs[c]:
return False
else:
stack.append(c)
return not stack
| def is_valid(s: str) -> bool:
bracket_pairs = {')': '(', '}': '{', ']': '['}
stack = []
for c in s:
if c in bracket_pairs:
if not stack or stack.pop() != bracket_pairs[c]:
return False
else:
stack.append(c)
return not stack |
####### Modules of SSS dataset #######
def euler_to_rotation(euler):
ex = euler[0]
ey = euler[1]
ez = euler[2]
rx = np.array([[1,0,0],[0,np.cos(ex),-1*np.sin(ex)],[0,np.sin(ex),np.cos(ex)]])
ry = np.array([[np.cos(ey),0,np.sin(ey)],[0,1,0],[-1*np.sin(ey),0,np.cos(ey)]])
rz = np.array([[np.cos(ez),-1*np.sin(ez),0],[np.sin(ez),np.cos(ez),0],[0,0,1]])
rotation = rz.dot(ry).dot(rx)
return rotation
def quaternion_to_rotation(quat):
w = quat[0]
x = quat[1]
y = quat[2]
z = quat[3]
rotation = np.array([
[1-2*y*y-2*z*z,2*x*y-2*z*w,2*x*z+2*y*w],
[2*x*y+2*z*w,1-2*x*x-2*z*z,2*y*z-2*x*w],
[2*x*z-2*y*w,2*y*z+2*x*w,1-2*x*x-2*y*y]
])
return rotation
def rotation_to_quaternion(rotation):
m00 = rotation[0][0]
m01 = rotation[0][1]
m02 = rotation[0][2]
m10 = rotation[1][0]
m11 = rotation[1][1]
m12 = rotation[1][2]
m20 = rotation[2][0]
m21 = rotation[2][1]
m22 = rotation[2][2]
tr = m00 + m11 + m22
if tr > 0:
S = math.sqrt(tr+1.0) * 2; # S=4*qw
qw = 0.25 * S;
qx = (m21 - m12) / S;
qy = (m02 - m20) / S;
qz = (m10 - m01) / S;
elif (m00 > m11)&(m00 > m22):
S = math.sqrt(1.0 + m00 - m11 - m22) * 2; # S=4*qx
qw = (m21 - m12) / S;
qx = 0.25 * S;
qy = (m01 + m10) / S;
qz = (m02 + m20) / S;
elif m11 > m22:
S = math.sqrt(1.0 + m11 - m00 - m22) * 2; # S=4*qy
qw = (m02 - m20) / S;
qx = (m01 + m10) / S;
qy = 0.25 * S;
qz = (m12 + m21) / S;
else:
S = math.sqrt(1.0 + m22 - m00 - m11) * 2; # S=4*qz
qw = (m10 - m01) / S;
qx = (m02 + m20) / S;
qy = (m12 + m21) / S;
qz = 0.25 * S;
quaternion = np.array([qw,qx,qy,qz])
return quaternion
def angularVelocity(Rprev,Rlater,step):
A = Rlater.dot(np.transpose(Rprev))
W = 1/(2*step)*(A-np.transpose(A))
angVel = np.array([-1*W[1][2],W[0][2],-1*W[0][1]])
return angVel
# Simple method for approximation angular velocity
def angularVelocity2(Rprev,Rlater,step):
A = Rlater.dot(np.linalg.inv(Rprev))
W = (A-np.eye(3))/step
angVel = np.array([-1*W[1][2],W[0][2],-1*W[0][1]])
return angVel
def getRotation(mat):
R_rectify = mathutils.Matrix(((1,0,0),(0,-1,0),(0,0,-1)))
orien = mat.to_quaternion()
orien = orien.to_matrix() @ R_rectify
orien = orien.to_quaternion()
return orien
# function to retrieve R and t
def getPose(i):
scn.frame_set(i)
mat = scn.camera.matrix_world
t = mat.to_translation()
quat = getRotation(mat)
R = quat.to_matrix()
return [R,t] | def euler_to_rotation(euler):
ex = euler[0]
ey = euler[1]
ez = euler[2]
rx = np.array([[1, 0, 0], [0, np.cos(ex), -1 * np.sin(ex)], [0, np.sin(ex), np.cos(ex)]])
ry = np.array([[np.cos(ey), 0, np.sin(ey)], [0, 1, 0], [-1 * np.sin(ey), 0, np.cos(ey)]])
rz = np.array([[np.cos(ez), -1 * np.sin(ez), 0], [np.sin(ez), np.cos(ez), 0], [0, 0, 1]])
rotation = rz.dot(ry).dot(rx)
return rotation
def quaternion_to_rotation(quat):
w = quat[0]
x = quat[1]
y = quat[2]
z = quat[3]
rotation = np.array([[1 - 2 * y * y - 2 * z * z, 2 * x * y - 2 * z * w, 2 * x * z + 2 * y * w], [2 * x * y + 2 * z * w, 1 - 2 * x * x - 2 * z * z, 2 * y * z - 2 * x * w], [2 * x * z - 2 * y * w, 2 * y * z + 2 * x * w, 1 - 2 * x * x - 2 * y * y]])
return rotation
def rotation_to_quaternion(rotation):
m00 = rotation[0][0]
m01 = rotation[0][1]
m02 = rotation[0][2]
m10 = rotation[1][0]
m11 = rotation[1][1]
m12 = rotation[1][2]
m20 = rotation[2][0]
m21 = rotation[2][1]
m22 = rotation[2][2]
tr = m00 + m11 + m22
if tr > 0:
s = math.sqrt(tr + 1.0) * 2
qw = 0.25 * S
qx = (m21 - m12) / S
qy = (m02 - m20) / S
qz = (m10 - m01) / S
elif (m00 > m11) & (m00 > m22):
s = math.sqrt(1.0 + m00 - m11 - m22) * 2
qw = (m21 - m12) / S
qx = 0.25 * S
qy = (m01 + m10) / S
qz = (m02 + m20) / S
elif m11 > m22:
s = math.sqrt(1.0 + m11 - m00 - m22) * 2
qw = (m02 - m20) / S
qx = (m01 + m10) / S
qy = 0.25 * S
qz = (m12 + m21) / S
else:
s = math.sqrt(1.0 + m22 - m00 - m11) * 2
qw = (m10 - m01) / S
qx = (m02 + m20) / S
qy = (m12 + m21) / S
qz = 0.25 * S
quaternion = np.array([qw, qx, qy, qz])
return quaternion
def angular_velocity(Rprev, Rlater, step):
a = Rlater.dot(np.transpose(Rprev))
w = 1 / (2 * step) * (A - np.transpose(A))
ang_vel = np.array([-1 * W[1][2], W[0][2], -1 * W[0][1]])
return angVel
def angular_velocity2(Rprev, Rlater, step):
a = Rlater.dot(np.linalg.inv(Rprev))
w = (A - np.eye(3)) / step
ang_vel = np.array([-1 * W[1][2], W[0][2], -1 * W[0][1]])
return angVel
def get_rotation(mat):
r_rectify = mathutils.Matrix(((1, 0, 0), (0, -1, 0), (0, 0, -1)))
orien = mat.to_quaternion()
orien = orien.to_matrix() @ R_rectify
orien = orien.to_quaternion()
return orien
def get_pose(i):
scn.frame_set(i)
mat = scn.camera.matrix_world
t = mat.to_translation()
quat = get_rotation(mat)
r = quat.to_matrix()
return [R, t] |
__init__ = ["SpectrographUI_savejsondict","SpectrographUI_loadjsondict"]
def SpectrographUI_savejsondict(self,jdict):
'''Autogenerated code from ui's make/awk trick.'''
jdict['compLampSwitch'] = self.compLampSwitch.isChecked()
jdict['flatLampSwitch'] = self.flatLampSwitch.isChecked()
jdict['heater1Switch'] = self.heater1Switch.isChecked()
jdict['heater2Switch'] = self.heater2Switch.isChecked()
jdict['slitLampSwitch'] = self.slitLampSwitch.isChecked()
jdict['DecPosition'] = self.DecPosition.text()
jdict['PAPosition'] = self.PAPosition.text()
jdict['RAPosition'] = self.RAPosition.text()
jdict['airmassValue'] = self.airmassValue.text()
jdict['focusAbsolute'] = self.focusAbsolute.text()
jdict['focusOffset'] = self.focusOffset.text()
jdict['gratingAbsolute'] = self.gratingAbsolute.text()
jdict['gratingOffset'] = self.gratingOffset.text()
jdict['heater1Delta'] = self.heater1Delta.text()
jdict['heater1SetPoint'] = self.heater1SetPoint.text()
jdict['heater2Delta'] = self.heater2Delta.text()
jdict['heater2SetPoint'] = self.heater2SetPoint.text()
jdict['rotatorAbsolute'] = self.rotatorAbsolute.text()
jdict['rotatorOffset'] = self.rotatorOffset.text()
jdict['rotatorPosition'] = self.rotatorPosition.text()
jdict['temp1Value'] = self.temp1Value.text()
jdict['temp2Value'] = self.temp2Value.text()
jdict['temp3Value'] = self.temp3Value.text()
jdict['temp4Value'] = self.temp4Value.text()
jdict['temp5Value'] = self.temp5Value.text()
jdict['temp6Value'] = self.temp6Value.text()
jdict['temp7Value'] = self.temp7Value.text()
jdict['spectroLog'] = self.spectroLog.toPlainText()
jdict['horizontalSlider'] = self.horizontalSlider.TickPosition()
jdict['focusSteps'] = self.focusSteps.value()
jdict['gratingSteps'] = self.gratingSteps.value()
jdict['rotatorAngle'] = self.rotatorAngle.value()
jdict['rotatorSteps'] = self.rotatorSteps.value()
# def SpectrographUI_savejsondict
def SpectrographUI_loadjsondict(self,jdict):
'''Autogenerated code from ui's make/awk trick.'''
self.compLampSwitch.setChecked(jdict['compLampSwitch'])
self.flatLampSwitch.setChecked(jdict['flatLampSwitch'])
self.heater1Switch.setChecked(jdict['heater1Switch'])
self.heater2Switch.setChecked(jdict['heater2Switch'])
self.slitLampSwitch.setChecked(jdict['slitLampSwitch'])
self.DecPosition.setText(jdict['DecPosition'])
self.PAPosition.setText(jdict['PAPosition'])
self.RAPosition.setText(jdict['RAPosition'])
self.airmassValue.setText(jdict['airmassValue'])
self.focusAbsolute.setText(jdict['focusAbsolute'])
self.focusOffset.setText(jdict['focusOffset'])
self.gratingAbsolute.setText(jdict['gratingAbsolute'])
self.gratingOffset.setText(jdict['gratingOffset'])
self.heater1Delta.setText(jdict['heater1Delta'])
self.heater1SetPoint.setText(jdict['heater1SetPoint'])
self.heater2Delta.setText(jdict['heater2Delta'])
self.heater2SetPoint.setText(jdict['heater2SetPoint'])
self.rotatorAbsolute.setText(jdict['rotatorAbsolute'])
self.rotatorOffset.setText(jdict['rotatorOffset'])
self.rotatorPosition.setText(jdict['rotatorPosition'])
self.temp1Value.setText(jdict['temp1Value'])
self.temp2Value.setText(jdict['temp2Value'])
self.temp3Value.setText(jdict['temp3Value'])
self.temp4Value.setText(jdict['temp4Value'])
self.temp5Value.setText(jdict['temp5Value'])
self.temp6Value.setText(jdict['temp6Value'])
self.temp7Value.setText(jdict['temp7Value'])
self.spectroLog.insertPlainText(jdict['spectroLog'])
self.horizontalSlider.setValue(jdict['horizontalSlider'])
self.focusSteps.setValue(jdict['focusSteps'])
self.gratingSteps.setValue(jdict['gratingSteps'])
self.rotatorAngle.setValue(jdict['rotatorAngle'])
self.rotatorSteps.setValue(jdict['rotatorSteps'])
# def SpectrographUI_loadjsondict
| __init__ = ['SpectrographUI_savejsondict', 'SpectrographUI_loadjsondict']
def spectrograph_ui_savejsondict(self, jdict):
"""Autogenerated code from ui's make/awk trick."""
jdict['compLampSwitch'] = self.compLampSwitch.isChecked()
jdict['flatLampSwitch'] = self.flatLampSwitch.isChecked()
jdict['heater1Switch'] = self.heater1Switch.isChecked()
jdict['heater2Switch'] = self.heater2Switch.isChecked()
jdict['slitLampSwitch'] = self.slitLampSwitch.isChecked()
jdict['DecPosition'] = self.DecPosition.text()
jdict['PAPosition'] = self.PAPosition.text()
jdict['RAPosition'] = self.RAPosition.text()
jdict['airmassValue'] = self.airmassValue.text()
jdict['focusAbsolute'] = self.focusAbsolute.text()
jdict['focusOffset'] = self.focusOffset.text()
jdict['gratingAbsolute'] = self.gratingAbsolute.text()
jdict['gratingOffset'] = self.gratingOffset.text()
jdict['heater1Delta'] = self.heater1Delta.text()
jdict['heater1SetPoint'] = self.heater1SetPoint.text()
jdict['heater2Delta'] = self.heater2Delta.text()
jdict['heater2SetPoint'] = self.heater2SetPoint.text()
jdict['rotatorAbsolute'] = self.rotatorAbsolute.text()
jdict['rotatorOffset'] = self.rotatorOffset.text()
jdict['rotatorPosition'] = self.rotatorPosition.text()
jdict['temp1Value'] = self.temp1Value.text()
jdict['temp2Value'] = self.temp2Value.text()
jdict['temp3Value'] = self.temp3Value.text()
jdict['temp4Value'] = self.temp4Value.text()
jdict['temp5Value'] = self.temp5Value.text()
jdict['temp6Value'] = self.temp6Value.text()
jdict['temp7Value'] = self.temp7Value.text()
jdict['spectroLog'] = self.spectroLog.toPlainText()
jdict['horizontalSlider'] = self.horizontalSlider.TickPosition()
jdict['focusSteps'] = self.focusSteps.value()
jdict['gratingSteps'] = self.gratingSteps.value()
jdict['rotatorAngle'] = self.rotatorAngle.value()
jdict['rotatorSteps'] = self.rotatorSteps.value()
def spectrograph_ui_loadjsondict(self, jdict):
"""Autogenerated code from ui's make/awk trick."""
self.compLampSwitch.setChecked(jdict['compLampSwitch'])
self.flatLampSwitch.setChecked(jdict['flatLampSwitch'])
self.heater1Switch.setChecked(jdict['heater1Switch'])
self.heater2Switch.setChecked(jdict['heater2Switch'])
self.slitLampSwitch.setChecked(jdict['slitLampSwitch'])
self.DecPosition.setText(jdict['DecPosition'])
self.PAPosition.setText(jdict['PAPosition'])
self.RAPosition.setText(jdict['RAPosition'])
self.airmassValue.setText(jdict['airmassValue'])
self.focusAbsolute.setText(jdict['focusAbsolute'])
self.focusOffset.setText(jdict['focusOffset'])
self.gratingAbsolute.setText(jdict['gratingAbsolute'])
self.gratingOffset.setText(jdict['gratingOffset'])
self.heater1Delta.setText(jdict['heater1Delta'])
self.heater1SetPoint.setText(jdict['heater1SetPoint'])
self.heater2Delta.setText(jdict['heater2Delta'])
self.heater2SetPoint.setText(jdict['heater2SetPoint'])
self.rotatorAbsolute.setText(jdict['rotatorAbsolute'])
self.rotatorOffset.setText(jdict['rotatorOffset'])
self.rotatorPosition.setText(jdict['rotatorPosition'])
self.temp1Value.setText(jdict['temp1Value'])
self.temp2Value.setText(jdict['temp2Value'])
self.temp3Value.setText(jdict['temp3Value'])
self.temp4Value.setText(jdict['temp4Value'])
self.temp5Value.setText(jdict['temp5Value'])
self.temp6Value.setText(jdict['temp6Value'])
self.temp7Value.setText(jdict['temp7Value'])
self.spectroLog.insertPlainText(jdict['spectroLog'])
self.horizontalSlider.setValue(jdict['horizontalSlider'])
self.focusSteps.setValue(jdict['focusSteps'])
self.gratingSteps.setValue(jdict['gratingSteps'])
self.rotatorAngle.setValue(jdict['rotatorAngle'])
self.rotatorSteps.setValue(jdict['rotatorSteps']) |
X_threads = 128*8
Y_threads = 1
Invoc_count = 9
start_index = 95
end_index = 107
src_list = []
SHARED_MEM_USE = False
total_shared_mem_size = 1024
domi_list = [89]
domi_val = [0] | x_threads = 128 * 8
y_threads = 1
invoc_count = 9
start_index = 95
end_index = 107
src_list = []
shared_mem_use = False
total_shared_mem_size = 1024
domi_list = [89]
domi_val = [0] |
#encoding:utf-8
subreddit = 'crackwatch'
t_channel = '@r_crackwatch'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'crackwatch'
t_channel = '@r_crackwatch'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
# -*- coding: utf-8 -*-
def implicit_scope(func):
def wrapper(*args):
args[0].scope.append({})
ans = func(*args)
args[0].scope.pop()
return ans
return wrapper
class Solution(object):
def __init__(self):
self.scope = [{}]
@implicit_scope
def evaluate(self, expression):
if not expression.startswith('('):
if expression[0].isdigit() or expression[0] == '-':
return int(expression)
for local in reversed(self.scope):
if expression in local:
return local[expression]
tokens = list(self.parse(expression[5 + (expression[1] == 'm'): -1]))
if expression.startswith('(add'):
return self.evaluate(tokens[0]) + self.evaluate(tokens[1])
elif expression.startswith('(mult'):
return self.evaluate(tokens[0]) * self.evaluate(tokens[1])
else:
for j in range(1, len(tokens), 2):
self.scope[-1][tokens[j-1]] = self.evaluate(tokens[j])
return self.evaluate(tokens[-1])
def parse(self, expression):
bal = 0
buf = []
for token in expression.split():
bal += token.count('(') - token.count(')')
buf.append(token)
if bal == 0:
yield " ".join(buf)
buf = []
if buf:
yield " ".join(buf)
if __name__ == '__main__':
expression = "(add 1 2)"
print(Solution().evaluate(expression))
| def implicit_scope(func):
def wrapper(*args):
args[0].scope.append({})
ans = func(*args)
args[0].scope.pop()
return ans
return wrapper
class Solution(object):
def __init__(self):
self.scope = [{}]
@implicit_scope
def evaluate(self, expression):
if not expression.startswith('('):
if expression[0].isdigit() or expression[0] == '-':
return int(expression)
for local in reversed(self.scope):
if expression in local:
return local[expression]
tokens = list(self.parse(expression[5 + (expression[1] == 'm'):-1]))
if expression.startswith('(add'):
return self.evaluate(tokens[0]) + self.evaluate(tokens[1])
elif expression.startswith('(mult'):
return self.evaluate(tokens[0]) * self.evaluate(tokens[1])
else:
for j in range(1, len(tokens), 2):
self.scope[-1][tokens[j - 1]] = self.evaluate(tokens[j])
return self.evaluate(tokens[-1])
def parse(self, expression):
bal = 0
buf = []
for token in expression.split():
bal += token.count('(') - token.count(')')
buf.append(token)
if bal == 0:
yield ' '.join(buf)
buf = []
if buf:
yield ' '.join(buf)
if __name__ == '__main__':
expression = '(add 1 2)'
print(solution().evaluate(expression)) |
# coding: utf-8
'''
Package exceptions.
'''
class NoSuchContent(Exception): pass
class ContentSyntaxError(Exception): pass
| """
Package exceptions.
"""
class Nosuchcontent(Exception):
pass
class Contentsyntaxerror(Exception):
pass |
old_SYMBOL_INFO = _SYMBOL_INFO
class _SYMBOL_INFO(old_SYMBOL_INFO):
@property
def tag(self):
return SymTagEnum.mapper[self.Tag] | old_symbol_info = _SYMBOL_INFO
class _Symbol_Info(old_SYMBOL_INFO):
@property
def tag(self):
return SymTagEnum.mapper[self.Tag] |
class Solution:
def largestTriangleArea(self, points: List[List[int]]) -> float:
result = 0
lenList = len(points)
for i in range(lenList-2):
x1, y1 = points[i]
for j in range(lenList-1):
x2, y2 = points[j]
for k in range(lenList):
x3, y3 = points[k]
result = max(result, 0.5 * abs((x2-x1) * (y3-y1) - (y2-y1) * (x3-x1)))
# 0.5 * |P1 - P2| * | P2 - P3 |
return result
| class Solution:
def largest_triangle_area(self, points: List[List[int]]) -> float:
result = 0
len_list = len(points)
for i in range(lenList - 2):
(x1, y1) = points[i]
for j in range(lenList - 1):
(x2, y2) = points[j]
for k in range(lenList):
(x3, y3) = points[k]
result = max(result, 0.5 * abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)))
return result |
class ProfileError(Exception):
def __init__(self, code: str):
self.code = code
class ProfileNotFoundError(ProfileError):
def __init__(self, code: str):
super().__init__(code)
def __str__(self):
return f"Profile {self.code} not found"
class ProfileAlreadyExistsError(ProfileError):
def __init__(self, code: str, owner: str):
super().__init__(code)
self.owner = owner
def __str__(self):
return f"Profile with code {self.code} and owner: {self.owner} has already exists"
| class Profileerror(Exception):
def __init__(self, code: str):
self.code = code
class Profilenotfounderror(ProfileError):
def __init__(self, code: str):
super().__init__(code)
def __str__(self):
return f'Profile {self.code} not found'
class Profilealreadyexistserror(ProfileError):
def __init__(self, code: str, owner: str):
super().__init__(code)
self.owner = owner
def __str__(self):
return f'Profile with code {self.code} and owner: {self.owner} has already exists' |
class GotoAckPacket:
def __init__(self):
self.type = "GOTOACK"
self.time = 0
def write(self, writer):
writer.writeInt32(self.time)
def read(self, reader):
self.time = reader.readInt32()
| class Gotoackpacket:
def __init__(self):
self.type = 'GOTOACK'
self.time = 0
def write(self, writer):
writer.writeInt32(self.time)
def read(self, reader):
self.time = reader.readInt32() |
#
# PySNMP MIB module EXTREME-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 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, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection")
extremeAgent, = mibBuilder.importSymbols("EXTREME-BASE-MIB", "extremeAgent")
extremeVlanIfIndex, = mibBuilder.importSymbols("EXTREME-VLAN-MIB", "extremeVlanIfIndex")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, iso, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, ObjectIdentity, Bits, MibIdentifier, ModuleIdentity, Counter64, Counter32, NotificationType, Integer32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "iso", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "ObjectIdentity", "Bits", "MibIdentifier", "ModuleIdentity", "Counter64", "Counter32", "NotificationType", "Integer32", "IpAddress")
RowStatus, TruthValue, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "TextualConvention", "DisplayString")
extremeOspf = ModuleIdentity((1, 3, 6, 1, 4, 1, 1916, 1, 15))
if mibBuilder.loadTexts: extremeOspf.setLastUpdated('0006280000Z')
if mibBuilder.loadTexts: extremeOspf.setOrganization('Extreme Networks, Inc.')
extremeOspfInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1), )
if mibBuilder.loadTexts: extremeOspfInterfaceTable.setStatus('current')
extremeOspfInterfaceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1), ).setIndexNames((0, "EXTREME-VLAN-MIB", "extremeVlanIfIndex"))
if mibBuilder.loadTexts: extremeOspfInterfaceEntry.setStatus('current')
extremeOspfAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: extremeOspfAreaId.setStatus('current')
extremeOspfInterfacePassive = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: extremeOspfInterfacePassive.setStatus('current')
extremeOspfInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: extremeOspfInterfaceStatus.setStatus('current')
mibBuilder.exportSymbols("EXTREME-OSPF-MIB", extremeOspfInterfacePassive=extremeOspfInterfacePassive, PYSNMP_MODULE_ID=extremeOspf, extremeOspf=extremeOspf, extremeOspfAreaId=extremeOspfAreaId, extremeOspfInterfaceEntry=extremeOspfInterfaceEntry, extremeOspfInterfaceStatus=extremeOspfInterfaceStatus, extremeOspfInterfaceTable=extremeOspfInterfaceTable)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection')
(extreme_agent,) = mibBuilder.importSymbols('EXTREME-BASE-MIB', 'extremeAgent')
(extreme_vlan_if_index,) = mibBuilder.importSymbols('EXTREME-VLAN-MIB', 'extremeVlanIfIndex')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(unsigned32, iso, gauge32, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, object_identity, bits, mib_identifier, module_identity, counter64, counter32, notification_type, integer32, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'iso', 'Gauge32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'ObjectIdentity', 'Bits', 'MibIdentifier', 'ModuleIdentity', 'Counter64', 'Counter32', 'NotificationType', 'Integer32', 'IpAddress')
(row_status, truth_value, textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TruthValue', 'TextualConvention', 'DisplayString')
extreme_ospf = module_identity((1, 3, 6, 1, 4, 1, 1916, 1, 15))
if mibBuilder.loadTexts:
extremeOspf.setLastUpdated('0006280000Z')
if mibBuilder.loadTexts:
extremeOspf.setOrganization('Extreme Networks, Inc.')
extreme_ospf_interface_table = mib_table((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1))
if mibBuilder.loadTexts:
extremeOspfInterfaceTable.setStatus('current')
extreme_ospf_interface_entry = mib_table_row((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1)).setIndexNames((0, 'EXTREME-VLAN-MIB', 'extremeVlanIfIndex'))
if mibBuilder.loadTexts:
extremeOspfInterfaceEntry.setStatus('current')
extreme_ospf_area_id = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 1), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
extremeOspfAreaId.setStatus('current')
extreme_ospf_interface_passive = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 2), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
extremeOspfInterfacePassive.setStatus('current')
extreme_ospf_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
extremeOspfInterfaceStatus.setStatus('current')
mibBuilder.exportSymbols('EXTREME-OSPF-MIB', extremeOspfInterfacePassive=extremeOspfInterfacePassive, PYSNMP_MODULE_ID=extremeOspf, extremeOspf=extremeOspf, extremeOspfAreaId=extremeOspfAreaId, extremeOspfInterfaceEntry=extremeOspfInterfaceEntry, extremeOspfInterfaceStatus=extremeOspfInterfaceStatus, extremeOspfInterfaceTable=extremeOspfInterfaceTable) |
class IndigoDevice:
def __init__(self, id, name):
self.id = id
self.name = name
self.states = {}
self.states_meta = {}
self.pluginProps = {}
self.image = None
self.brightness = 0
def updateStateOnServer(self, key, value, uiValue=None, decimalPlaces=0):
self.states[key] = value
self.states_meta[key] = {'value': value, 'uiValue': uiValue, 'decimalPlaces': decimalPlaces}
# update the brightness "helper"
if key == "brightnessLevel":
self.brightness = value
def replacePluginPropsOnServer(self, pluginProps):
self.pluginProps = pluginProps
def updateStateImageOnServer(self, image):
self.image = image
def refreshFromServer(self):
pass
| class Indigodevice:
def __init__(self, id, name):
self.id = id
self.name = name
self.states = {}
self.states_meta = {}
self.pluginProps = {}
self.image = None
self.brightness = 0
def update_state_on_server(self, key, value, uiValue=None, decimalPlaces=0):
self.states[key] = value
self.states_meta[key] = {'value': value, 'uiValue': uiValue, 'decimalPlaces': decimalPlaces}
if key == 'brightnessLevel':
self.brightness = value
def replace_plugin_props_on_server(self, pluginProps):
self.pluginProps = pluginProps
def update_state_image_on_server(self, image):
self.image = image
def refresh_from_server(self):
pass |
# Nama : Eraraya Morenzo Muten
# NIM : 16520002
# Tanggal : 26 Maret 2021
# Program EmpatInteger
# Input: 4 integer: A, B, C, D
# Output: Sifat integer dari A, B, C, D (positif/negatif/nol)
# Jika semua integer positif, tampilkan:
# nilai maksimum, minimum, dan mean olympic
# KAMUS
# variabel
# A, B, C, D : int
# mo : real
# PROCEDURE DAN FUNCTION
def CekInteger (x):
# I.S.: x terdefinisi, bertype int
# F.S.: Jika x positif, maka tertulis di layar: POSITIF
# Jika x negatif, maka tertulis di layar: NEGATIF
# Jika x nol, maka tertulis di layar: NOL
if x>0:
print("POSITIF")
elif x<0:
print("NEGATIF")
elif x==0:
print("NOL")
def Max (a, b, c, d):
# menghasilkan nilai terbesar di antara a, b, c, d (integer)
return max(a,b,c,d)
def Min (a, b, c, d):
# menghasilkan nilai terkecil di antara a, b, c, d (integer)
return min(a,b,c,d)
def IsAllPositif (a, b, c, d):
# menghasilkan True jika a, b, c, d seluruhnya positif
# False jika tidak
return (a>0) and (b>0) and (c>0) and (d>0)
# PROGRAM UTAMA
A = int(input())
B = int(input())
C = int(input())
D = int(input())
# Menuliskan sifat integer
CekInteger(A)
CekInteger(B)
CekInteger(C)
CekInteger(D)
# Penulisan maksimum, minimum, dan mean olympic
if (IsAllPositif(A,B,C,D)):
print(Max(A,B,C,D))
print(Min(A,B,C,D))
mo = (A + B + C + D - Max(A,B,C,D) - Min(A,B,C,D)) / 2
print("%.2f" % mo) # 2 desimal | def cek_integer(x):
if x > 0:
print('POSITIF')
elif x < 0:
print('NEGATIF')
elif x == 0:
print('NOL')
def max(a, b, c, d):
return max(a, b, c, d)
def min(a, b, c, d):
return min(a, b, c, d)
def is_all_positif(a, b, c, d):
return a > 0 and b > 0 and (c > 0) and (d > 0)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
cek_integer(A)
cek_integer(B)
cek_integer(C)
cek_integer(D)
if is_all_positif(A, B, C, D):
print(max(A, B, C, D))
print(min(A, B, C, D))
mo = (A + B + C + D - max(A, B, C, D) - min(A, B, C, D)) / 2
print('%.2f' % mo) |
username = 'ENTER YOUR E-MAIL ID HERE'
password = 'ENTER YOUR PASSWORD HERE'
entry_nodeIp = 'http://py4e-data.dr-chuck.net/json?'
gmaps_api_key = 42
user_agents_list = ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
"Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
] | username = 'ENTER YOUR E-MAIL ID HERE'
password = 'ENTER YOUR PASSWORD HERE'
entry_node_ip = 'http://py4e-data.dr-chuck.net/json?'
gmaps_api_key = 42
user_agents_list = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36', 'Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'] |
# uninhm
# https://atcoder.jp/contests/abc183/tasks/abc183_a
# implementation
print(max(0, int(input())))
| print(max(0, int(input()))) |
d1 = {42: 100}
d2 = {'abc': 'fob'}
d3 = {1e1000: d1}
s = set([frozenset([2,3,4])])
class C(object):
abc = 42
def f(self): pass
cinst = C()
class C2(object):
abc = 42
def __init__(self):
self.oar = 100
self.self = self
def __repr__(self):
return 'myrepr'
def __hex__(self):
return 'myhex'
def f(self): pass
c2inst = C2()
class C3(object):
def __init__(self):
self.abc = 42
self._contents = [1,2]
def __iter__(self):
return iter(self._contents)
def __len__(self):
return len(self._contents)
def __getitem__(self, index):
return self._contents[index]
c3inst = C3()
l = [1, 2, ]
i = 3
pass | d1 = {42: 100}
d2 = {'abc': 'fob'}
d3 = {1e309: d1}
s = set([frozenset([2, 3, 4])])
class C(object):
abc = 42
def f(self):
pass
cinst = c()
class C2(object):
abc = 42
def __init__(self):
self.oar = 100
self.self = self
def __repr__(self):
return 'myrepr'
def __hex__(self):
return 'myhex'
def f(self):
pass
c2inst = c2()
class C3(object):
def __init__(self):
self.abc = 42
self._contents = [1, 2]
def __iter__(self):
return iter(self._contents)
def __len__(self):
return len(self._contents)
def __getitem__(self, index):
return self._contents[index]
c3inst = c3()
l = [1, 2]
i = 3
pass |
url = "https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json"
def turn_right():
turn_left()
turn_left()
turn_left()
def hurdle():
move()
turn_left()
move()
turn_right()
move()
turn_right()
move()
turn_left()
for i in range(1, 7):
hurdle() | url = 'https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json'
def turn_right():
turn_left()
turn_left()
turn_left()
def hurdle():
move()
turn_left()
move()
turn_right()
move()
turn_right()
move()
turn_left()
for i in range(1, 7):
hurdle() |
class Test:
def __init__(self, text):
self.text = text
def text(self):
return self.text
| class Test:
def __init__(self, text):
self.text = text
def text(self):
return self.text |
# Instruments
SST_INSTRUMENT = 'SST'
POEMAS_INSTRUMENT = 'POEMAS'
# File types
TRK_TYPE = 'TRK'
RBD_TYPE = 'RBD'
# Instrument Types
AVAILABLE_SST_TYPES = {
RBD_TYPE: ["bi", "rs", "rf"]
}
AVAILABLE_POEMAS_TYPES = {
TRK_TYPE: ["TRK"]
}
INSTRUMENT_TO_TYPE_MAP = {
SST_INSTRUMENT: AVAILABLE_SST_TYPES,
POEMAS_INSTRUMENT: AVAILABLE_POEMAS_TYPES
}
# Errors
OBJECTS_NOT_FROM_SAME_INSTRUMENT = "Objects are not from the same instrument: {}"
CONCATENATE_NOT_AVAILABLE_ERROR = "Concatenate operation not available for file with type {} from instrument {}"
FILE_NOT_FOUND_ERROR = "File not found: {}"
INVALID_PATH_TO_XML_ERROR = "Invalid path to XML: {}"
INVALID_INSTRUMENT_ERROR = "Invalid instrument: {}"
INVALID_FILE_TYPE_ERROR = "Invalid file type {} for instrument {}."
INVALID_FILE_NAME = "Invalid filename {}"
INVALID_XML_FILE = "Invalid xml type: {}"
FILE_ALREADY_EXISTS = "File {} already exists."
INVALID_LEVEL_TYPE = "This level type is not valid: {}. It must be a integer"
FITS_LEVEL_NOT_AVAILABLE = "Fits level {} is not available for conversion"
CANT_CONVERT_FITS_LEVEL = "Can't get fits level {} for object with level {}, please try a level higher than {}"
COULDNT_MATCH_CONVERTED_DATA_TO_INSTRUMENT = "Couldn't match converted data fom file type {} to instrument {}"
# Others
XML_TABLE_PATH = "xml-tables/{}/{}"
CONCATENATED_DATA = "Concatenated Data"
| sst_instrument = 'SST'
poemas_instrument = 'POEMAS'
trk_type = 'TRK'
rbd_type = 'RBD'
available_sst_types = {RBD_TYPE: ['bi', 'rs', 'rf']}
available_poemas_types = {TRK_TYPE: ['TRK']}
instrument_to_type_map = {SST_INSTRUMENT: AVAILABLE_SST_TYPES, POEMAS_INSTRUMENT: AVAILABLE_POEMAS_TYPES}
objects_not_from_same_instrument = 'Objects are not from the same instrument: {}'
concatenate_not_available_error = 'Concatenate operation not available for file with type {} from instrument {}'
file_not_found_error = 'File not found: {}'
invalid_path_to_xml_error = 'Invalid path to XML: {}'
invalid_instrument_error = 'Invalid instrument: {}'
invalid_file_type_error = 'Invalid file type {} for instrument {}.'
invalid_file_name = 'Invalid filename {}'
invalid_xml_file = 'Invalid xml type: {}'
file_already_exists = 'File {} already exists.'
invalid_level_type = 'This level type is not valid: {}. It must be a integer'
fits_level_not_available = 'Fits level {} is not available for conversion'
cant_convert_fits_level = "Can't get fits level {} for object with level {}, please try a level higher than {}"
couldnt_match_converted_data_to_instrument = "Couldn't match converted data fom file type {} to instrument {}"
xml_table_path = 'xml-tables/{}/{}'
concatenated_data = 'Concatenated Data' |
def get_sunday():
return 'Sunday'
def get_monday():
return 'Monday'
def get_tuesday():
return 'Tuesday'
def get_default():
return 'Unknown'
day = 4
switcher = {
0 : get_sunday,
1 : get_monday,
2 : get_tuesday
}
day_name = switcher.get(day,get_default)()
print(day_name) | def get_sunday():
return 'Sunday'
def get_monday():
return 'Monday'
def get_tuesday():
return 'Tuesday'
def get_default():
return 'Unknown'
day = 4
switcher = {0: get_sunday, 1: get_monday, 2: get_tuesday}
day_name = switcher.get(day, get_default)()
print(day_name) |
CONFIG_FILENAMES = [
'.vintrc.yaml',
'.vintrc.yml',
'.vintrc',
]
| config_filenames = ['.vintrc.yaml', '.vintrc.yml', '.vintrc'] |
# -------------- This file adds actual expected results to submission file -----------------#
f=open('submission.csv','r')
g=open('testHistory.csv','r') # ts.csv generated before
h=open('res.csv','w+')
lines=f.readlines()
i=0
for line in g.readlines():
k=line.split(',')
toWrite=k[5]
h.write(lines[i][0:-1]+','+toWrite+'\n')
i+=1
h.close()
f.close()
g.close()
#----------------- Note ---------------------#
# After this file executed:
# rename res.csv to submission.csv
#--------------------------------------------#
| f = open('submission.csv', 'r')
g = open('testHistory.csv', 'r')
h = open('res.csv', 'w+')
lines = f.readlines()
i = 0
for line in g.readlines():
k = line.split(',')
to_write = k[5]
h.write(lines[i][0:-1] + ',' + toWrite + '\n')
i += 1
h.close()
f.close()
g.close() |
IRIS_BYPASS=False
AWS_REGION = "us-west-1"
IRIS_SNS_TOPIC = "iris-topic"
IRIS_SQS_APP_QUEUE = "iris-test-queue"
IRIS_POLL_INTERVAL = 20
| iris_bypass = False
aws_region = 'us-west-1'
iris_sns_topic = 'iris-topic'
iris_sqs_app_queue = 'iris-test-queue'
iris_poll_interval = 20 |
# This dictionary is to define metrics that we should extract data from and then
# their exposed name as predicted metric
metrics = {
'actual_metric_name1': 'actual_metric_name1_predict',
'actual_metric_name2': 'actual_metric_name2_predict'
}
#
prom_url = 'http://localhost/'
expose_port = 8000
# interval in days
interval = 30
# chunk size in hour
chunk_size = 24 | metrics = {'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict'}
prom_url = 'http://localhost/'
expose_port = 8000
interval = 30
chunk_size = 24 |
def print_hello():
print("hello!")
def print_goodbye():
print("goodbye!") | def print_hello():
print('hello!')
def print_goodbye():
print('goodbye!') |
n = int(input())
primary = []
secondary = []
matrix = []
for _ in range(n):
matrix.append([int(x) for x in input().split()])
for r in range(n):
primary.append(matrix[r][r])
secondary.append(matrix[r][n - 1 -r])
sum_p = (sum([x for x in primary]))
sum_s = (sum([x for x in secondary]))
print(abs(sum_p-sum_s)) | n = int(input())
primary = []
secondary = []
matrix = []
for _ in range(n):
matrix.append([int(x) for x in input().split()])
for r in range(n):
primary.append(matrix[r][r])
secondary.append(matrix[r][n - 1 - r])
sum_p = sum([x for x in primary])
sum_s = sum([x for x in secondary])
print(abs(sum_p - sum_s)) |
# replace with the label of class for which you are interested in building the lexicon;
# this should be the same as the label in your input files
positive_class_label = "on-topic"
# replace the label for the examples that do not belong to the topic of interest
# this should be the same as the label in your input files
negative_class_label ="off-topic"
# lexicon size
lexicon_size = 400 | positive_class_label = 'on-topic'
negative_class_label = 'off-topic'
lexicon_size = 400 |
def loadfile(name):
values = []
f = open(name, "r")
for x in f:
values.append(x)
return values
def day2():
depth = 0
position = 0
depth2 = 0
for i in range(0, len(values)):
value = values[i].split()
if value[0] == "forward":
position += int(value[1])
depth2 += int(value[1]) * depth
elif value[0] == "down":
depth += int(value[1])
elif value[0] == "up":
depth -= int(value[1])
return [position,depth, depth2]
values = loadfile("data.txt")
print(values)
solution = day2()
print("full solution: " + str(solution))
print("solution day2a: " + str(solution[0]*solution[1]))
print("solution day2b: " + str(solution[0]*solution[2])) | def loadfile(name):
values = []
f = open(name, 'r')
for x in f:
values.append(x)
return values
def day2():
depth = 0
position = 0
depth2 = 0
for i in range(0, len(values)):
value = values[i].split()
if value[0] == 'forward':
position += int(value[1])
depth2 += int(value[1]) * depth
elif value[0] == 'down':
depth += int(value[1])
elif value[0] == 'up':
depth -= int(value[1])
return [position, depth, depth2]
values = loadfile('data.txt')
print(values)
solution = day2()
print('full solution: ' + str(solution))
print('solution day2a: ' + str(solution[0] * solution[1]))
print('solution day2b: ' + str(solution[0] * solution[2])) |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version = '1.10.4'
version = '1.10.4'
full_version = '1.10.4'
git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60'
release = True
if not release:
version = full_version
| short_version = '1.10.4'
version = '1.10.4'
full_version = '1.10.4'
git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60'
release = True
if not release:
version = full_version |
# Define a Subtraction Function
def sub(num1, num2):
return num1 - num2
| def sub(num1, num2):
return num1 - num2 |
baseurl='\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>'
for i in range(1, 18):
url = baseurl % (i,i,i,i)
print(url+"\n") | baseurl = '\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>'
for i in range(1, 18):
url = baseurl % (i, i, i, i)
print(url + '\n') |
class Duck:
def swim(self):
print("Duck is swimming!")
def layEggs(self):
print("Duck is laying eggs!")
class Fish:
def swim(self):
print("Fish is swimming!")
def layEggs(self):
print("Fish is laying eggs!")
class Diver:
def swim(self):
print("A human is waddling around in water!")
def saySomethingFunny(self):
print("MATLAB is a real programming language!")
def swim(entity):
entity.swim()
def layEggs(entity):
entity.layEggs()
duck = Duck()
fish = Fish()
diver = Diver()
duck.swim()
duck.layEggs()
fish.swim()
fish.layEggs()
diver.swim()
diver.layEggs()
| class Duck:
def swim(self):
print('Duck is swimming!')
def lay_eggs(self):
print('Duck is laying eggs!')
class Fish:
def swim(self):
print('Fish is swimming!')
def lay_eggs(self):
print('Fish is laying eggs!')
class Diver:
def swim(self):
print('A human is waddling around in water!')
def say_something_funny(self):
print('MATLAB is a real programming language!')
def swim(entity):
entity.swim()
def lay_eggs(entity):
entity.layEggs()
duck = duck()
fish = fish()
diver = diver()
duck.swim()
duck.layEggs()
fish.swim()
fish.layEggs()
diver.swim()
diver.layEggs() |
class main:
a = ''
def func(self):
s = ''
b = '\n\n\ntareq\n\n\n'
for i in b:
if i != '\n':
s += i
print(s)
ii = main()
ii.func()
| class Main:
a = ''
def func(self):
s = ''
b = '\n\n\ntareq\n\n\n'
for i in b:
if i != '\n':
s += i
print(s)
ii = main()
ii.func() |
def lambda_handler(event, context):
message = event['Records'][0]['Sns']['Message']
print("handle message: " + message)
webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV'
http = urllib3.PoolManager()
r = http.request(
'POST',
webhook_url,
body=message.encode('utf-8'),
headers={'Content-Type': 'application/json'}
)
print("webhook post response: " + r.data.decode('utf-8') )
return message
| def lambda_handler(event, context):
message = event['Records'][0]['Sns']['Message']
print('handle message: ' + message)
webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV'
http = urllib3.PoolManager()
r = http.request('POST', webhook_url, body=message.encode('utf-8'), headers={'Content-Type': 'application/json'})
print('webhook post response: ' + r.data.decode('utf-8'))
return message |
class Descritor:
def __init__(self, obj, set=None, get=None, delete=None):
self.obj = obj
self.set = set
self.get = get
self.delete = delete
def __set__(self, obj, val):
print('Estou setando algo')
self.obj = val
def __get__(self, obj, tipo=None):
print('Estou pegango algo')
return self.obj
def __delete__(self, obj):
print('Estou deletando algo')
del self.obj
def __repr__(self):
return self.obj
class NumeroPositivo:
_n = None
def get_n(self):
print('get')
return self._n
def set_n(self, val):
print('set')
if val < 1:
...
else:
self._n = val
def del_n(self):
print('del')
del self._n
n = Descritor(_n)
| class Descritor:
def __init__(self, obj, set=None, get=None, delete=None):
self.obj = obj
self.set = set
self.get = get
self.delete = delete
def __set__(self, obj, val):
print('Estou setando algo')
self.obj = val
def __get__(self, obj, tipo=None):
print('Estou pegango algo')
return self.obj
def __delete__(self, obj):
print('Estou deletando algo')
del self.obj
def __repr__(self):
return self.obj
class Numeropositivo:
_n = None
def get_n(self):
print('get')
return self._n
def set_n(self, val):
print('set')
if val < 1:
...
else:
self._n = val
def del_n(self):
print('del')
del self._n
n = descritor(_n) |
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
PROD = (A*B)
print("PROD =", PROD) | a = int(input())
b = int(input())
prod = A * B
print('PROD =', PROD) |
class Persona:
cedula = 0
nombre = ''
telefono = 0
voto = 0
def __init__(self, cd, nm, tl, vt):
self.cedula = cd
self.nombre = nm
self.telefono = tl
self.voto = vt
def getCedula(self):
return self.cedula
def getNombre(self):
return self.nombre
def getTelefono(self):
return self.telefono
def getVoto(self):
return self.voto
def getTodo(self):
return self.cedula, self.nombre, self.telefono, self.voto
class Estudiante(Persona):
carnet = ''
carrera = ''
def __init__(self, cd, nm, tl, vt):
self.carnet = ''
self.carrera = ''
Persona.__init__(self, cd, nm, tl, vt)
def setCarnet(self, cn):
self.carnet = cn
def setCarrera(self, cr):
self.carrera = cr
def getCarnet(self):
return self.carnet
def getCarrera(self):
return self.carrera
def getTodo(self):
datos = []
datos.append(Estudiante.getCarnet(self))
datos.append(Estudiante.getCarrera(self))
persona = Persona.getTodo(self)
for p in persona:
datos.append(p)
return datos
| class Persona:
cedula = 0
nombre = ''
telefono = 0
voto = 0
def __init__(self, cd, nm, tl, vt):
self.cedula = cd
self.nombre = nm
self.telefono = tl
self.voto = vt
def get_cedula(self):
return self.cedula
def get_nombre(self):
return self.nombre
def get_telefono(self):
return self.telefono
def get_voto(self):
return self.voto
def get_todo(self):
return (self.cedula, self.nombre, self.telefono, self.voto)
class Estudiante(Persona):
carnet = ''
carrera = ''
def __init__(self, cd, nm, tl, vt):
self.carnet = ''
self.carrera = ''
Persona.__init__(self, cd, nm, tl, vt)
def set_carnet(self, cn):
self.carnet = cn
def set_carrera(self, cr):
self.carrera = cr
def get_carnet(self):
return self.carnet
def get_carrera(self):
return self.carrera
def get_todo(self):
datos = []
datos.append(Estudiante.getCarnet(self))
datos.append(Estudiante.getCarrera(self))
persona = Persona.getTodo(self)
for p in persona:
datos.append(p)
return datos |
def stingy(total_lambs):
stingyList = [1, 1]
x, total = 2, 2
while x <= total_lambs:
value = stingyList[x-1] + stingyList[x-2]
stingyList.append(value)
total += int(stingyList[x])
if total > total_lambs:
break
x+= 1
return len(stingyList)
def generous(total_lambs):
generousList = []
x, total = 0, 0
while x <= total_lambs:
current = 2**x
generousList.append(current)
total += current
if total > total_lambs:
break
x += 1
return len(generousList)
def solution(total_lambs):
return stingy(total_lambs) - generous(total_lambs)
if __name__ == "__main__":
i1 = 143
print(solution(i1))
i2 = 10
print(solution(i2)) | def stingy(total_lambs):
stingy_list = [1, 1]
(x, total) = (2, 2)
while x <= total_lambs:
value = stingyList[x - 1] + stingyList[x - 2]
stingyList.append(value)
total += int(stingyList[x])
if total > total_lambs:
break
x += 1
return len(stingyList)
def generous(total_lambs):
generous_list = []
(x, total) = (0, 0)
while x <= total_lambs:
current = 2 ** x
generousList.append(current)
total += current
if total > total_lambs:
break
x += 1
return len(generousList)
def solution(total_lambs):
return stingy(total_lambs) - generous(total_lambs)
if __name__ == '__main__':
i1 = 143
print(solution(i1))
i2 = 10
print(solution(i2)) |
class Account:
def __init__(self):
self.__blocked: bool = False
self.__bound: int = 1000000
self.__balance: int = 0
self.__max_credit: int = -1000
def deposit(self, _sum: int) -> bool:
if self.__blocked :
return False
if _sum < 0 or _sum > self.__bound:
return False
self.__balance += _sum
return True
def withdraw(self, _sum: int) -> bool:
if self.__blocked :
return False
if _sum < 0 or _sum > self.__bound :
return False
if self.__balance <= self.__max_credit + _sum:
return False
self.__balance -= _sum
return True
def get_balance(self) -> int:
return self.__balance
def get_max_credit(self) -> int:
return -self.__max_credit
def is_blocked(self) -> bool:
return self.__blocked
def block(self) -> None:
self.__blocked = True
def unblock(self) -> bool:
if self.__balance < self.__max_credit:
return False
self.__blocked = False
return True
def set_max_credit(self, mc: int) -> bool:
if abs(mc) > self.__bound:
return False
self.__max_credit = -mc
return True
| class Account:
def __init__(self):
self.__blocked: bool = False
self.__bound: int = 1000000
self.__balance: int = 0
self.__max_credit: int = -1000
def deposit(self, _sum: int) -> bool:
if self.__blocked:
return False
if _sum < 0 or _sum > self.__bound:
return False
self.__balance += _sum
return True
def withdraw(self, _sum: int) -> bool:
if self.__blocked:
return False
if _sum < 0 or _sum > self.__bound:
return False
if self.__balance <= self.__max_credit + _sum:
return False
self.__balance -= _sum
return True
def get_balance(self) -> int:
return self.__balance
def get_max_credit(self) -> int:
return -self.__max_credit
def is_blocked(self) -> bool:
return self.__blocked
def block(self) -> None:
self.__blocked = True
def unblock(self) -> bool:
if self.__balance < self.__max_credit:
return False
self.__blocked = False
return True
def set_max_credit(self, mc: int) -> bool:
if abs(mc) > self.__bound:
return False
self.__max_credit = -mc
return True |
def process_sql_file(file_name):
file, string = open(file_name, "r"), ''
# for line in file, remove comments, space out '(' and ')', add line to output string:
for line in file:
line = line.rstrip()
line = line.split('//')[0]
line = line.split('--')[0]
line = line.replace('(', ' ( ')
line = line.replace(')', ' ) ')
string += ' ' + line
file.close()
# remove multi-line comments:
while string.find('/*') > -1 and string.find('*/') > -1:
l_multi_line = string.find('/*')
r_multi_line = string.find('*/')
string = string[:l_multi_line] + string[r_multi_line + 2:]
string = string.lower()
# remove extra whitespaces and make list
words = string.split()
return words
def find_table_names(words, rm_cte=False):
table_names = set()
previous_word = ''
ctes = set()
for word in words:
if rm_cte and word == 'as':
ctes.add(previous_word)
if previous_word == 'from' or previous_word == 'join':
if word != '(':
if rm_cte and word not in ctes:
table_names.add(word)
if not rm_cte:
table_names.add(word)
previous_word = word
return sorted(list(table_names))
# this function assumes that the .sql file does not have any syntax errors:
def find_table_names_from_sql_file(file_name, rm_cte=False):
words = process_sql_file(file_name)
return find_table_names(words, rm_cte=rm_cte)
| def process_sql_file(file_name):
(file, string) = (open(file_name, 'r'), '')
for line in file:
line = line.rstrip()
line = line.split('//')[0]
line = line.split('--')[0]
line = line.replace('(', ' ( ')
line = line.replace(')', ' ) ')
string += ' ' + line
file.close()
while string.find('/*') > -1 and string.find('*/') > -1:
l_multi_line = string.find('/*')
r_multi_line = string.find('*/')
string = string[:l_multi_line] + string[r_multi_line + 2:]
string = string.lower()
words = string.split()
return words
def find_table_names(words, rm_cte=False):
table_names = set()
previous_word = ''
ctes = set()
for word in words:
if rm_cte and word == 'as':
ctes.add(previous_word)
if previous_word == 'from' or previous_word == 'join':
if word != '(':
if rm_cte and word not in ctes:
table_names.add(word)
if not rm_cte:
table_names.add(word)
previous_word = word
return sorted(list(table_names))
def find_table_names_from_sql_file(file_name, rm_cte=False):
words = process_sql_file(file_name)
return find_table_names(words, rm_cte=rm_cte) |
# Membership, identity, and logical operations
x=[1,2,3]
y=[1,2,3]
print(x==y) #test equivalance
print(x is y) #test object identity
x=y # assignment
print(x is y) | x = [1, 2, 3]
y = [1, 2, 3]
print(x == y)
print(x is y)
x = y
print(x is y) |
'''
Created on Nov 20, 2014
This is a dummy to solve dependencies from error.py
@author: Tim Gerhard
'''
# The webfrontend does not dump errors. If this function is called anywhere, this simply doesn't matter.
def dumpError(error):
return | """
Created on Nov 20, 2014
This is a dummy to solve dependencies from error.py
@author: Tim Gerhard
"""
def dump_error(error):
return |
la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals | la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals |
# Write a program that reads a temperature value and the letter C for Celsius or F for
# Fahrenheit. Print whether water is liquid, solid, or gaseous at the given temperature
# at sea level.
type = str(input("Enter the temperature type, C for celsius or F for fahrenheit: "))
temperature = float(input("Enter the temperature: "))
if type == "C":
if temperature >= 0 and temperature < 100:
print("Water is liquid.")
elif temperature >= 100:
print("Water is gaseous.")
else:
print("Water is solid.")
elif type == "F":
if temperature >= 32 and temperature < 132:
print("Water is liquid.")
elif temperature >= 132:
print("Water is gaseous.")
else:
print("Water is solid.") | type = str(input('Enter the temperature type, C for celsius or F for fahrenheit: '))
temperature = float(input('Enter the temperature: '))
if type == 'C':
if temperature >= 0 and temperature < 100:
print('Water is liquid.')
elif temperature >= 100:
print('Water is gaseous.')
else:
print('Water is solid.')
elif type == 'F':
if temperature >= 32 and temperature < 132:
print('Water is liquid.')
elif temperature >= 132:
print('Water is gaseous.')
else:
print('Water is solid.') |
def mike():
print("hola")
mike()
mike()
mike()
mike()
mike()
| def mike():
print('hola')
mike()
mike()
mike()
mike()
mike() |
# Python3 program to count triplets with
# sum smaller than a given value
# Function to count triplets with sum smaller
# than a given value
def countTriplets(arr, n, sum):
# Sort input array
arr.sort()
# Initialize result
ans = 0
# Every iteration of loop counts triplet with
# first element as arr[i].
for i in range(0, n - 2):
# Initialize other two elements as corner elements
# of subarray arr[j+1..k]
j = i + 1
k = n - 1
# Use Meet in the Middle concept
while (j < k):
# If sum of current triplet is more or equal,
# move right corner to look for smaller values
if (arr[i] + arr[j] + arr[k] >= sum):
k = k - 1
# Else move left corner
else:
# This is important. For current i and j, there
# can be total k-j third elements.
ans += (k - j)
j = j + 1
return ans
# Driver program
if __name__ == '__main__':
arr = [5, 3, 4, 7,1]
n = len(arr)
sum = 12
print(countTriplets(arr, n, sum))
| def count_triplets(arr, n, sum):
arr.sort()
ans = 0
for i in range(0, n - 2):
j = i + 1
k = n - 1
while j < k:
if arr[i] + arr[j] + arr[k] >= sum:
k = k - 1
else:
ans += k - j
j = j + 1
return ans
if __name__ == '__main__':
arr = [5, 3, 4, 7, 1]
n = len(arr)
sum = 12
print(count_triplets(arr, n, sum)) |
class UnknownResponseType(Exception):
pass
class UnknownDatetime(Exception):
pass
| class Unknownresponsetype(Exception):
pass
class Unknowndatetime(Exception):
pass |
t=int(input())
for i in range(t):
s=int(input())
m=s%12
if m==1:
print(s+11,'WS')
elif m==2:
print(s+9,'MS')
elif m==3:
print(s+7,'AS')
elif m==4:
print(s+5,'AS')
elif m==5:
print(s+3,'MS')
elif m==6:
print(s+1,'WS')
elif m==7:
print(s-1,'WS')
elif m==8:
print(s-3,'MS')
elif m==9:
print(s-5,'AS')
elif m==10:
print(s-7,'AS')
elif m==11:
print(s-9,'MS')
elif m==0:
print(s-11,'WS')
# t=int(input())
# for i in range(t):
# s=int(input())
# m=s%12
# l=11
# if m==0:
# print(s-11,'WS')
# for i in range(1,12):
# if m==i:
# print(s+l)
# else:
# l=l-2
| t = int(input())
for i in range(t):
s = int(input())
m = s % 12
if m == 1:
print(s + 11, 'WS')
elif m == 2:
print(s + 9, 'MS')
elif m == 3:
print(s + 7, 'AS')
elif m == 4:
print(s + 5, 'AS')
elif m == 5:
print(s + 3, 'MS')
elif m == 6:
print(s + 1, 'WS')
elif m == 7:
print(s - 1, 'WS')
elif m == 8:
print(s - 3, 'MS')
elif m == 9:
print(s - 5, 'AS')
elif m == 10:
print(s - 7, 'AS')
elif m == 11:
print(s - 9, 'MS')
elif m == 0:
print(s - 11, 'WS') |
def mergeSortedArrays(L, R):
sorted_array = []
i = j = 0
while i < len(L) and j < len(R):
if L[i] < R[j]:
sorted_array.append(L[i])
i += 1
else:
sorted_array.append(R[j])
j += 1
# When we run out of elements in either L or M,
# pick up the remaining elements and put in A[p..r]
while i < len(L):
sorted_array.append(L[i])
i += 1
while j < len(R):
sorted_array.append(R[j])
j += 1
return sorted_array
def mergeSort(nums):
# exit condition!!! Important for a recursion!
if (len(nums) <= 1):
return nums
# split the array to two smaller arrays
middle = len(nums) // 2
L = nums[:middle]
R = nums[middle:]
# sort the smalle5r arrays
L = mergeSort(L)
R = mergeSort(R)
nums = mergeSortedArrays(L, R)
return nums
array = [6, 5, 12, 10, 9, 1]
mergeSort(array)
print(array) | def merge_sorted_arrays(L, R):
sorted_array = []
i = j = 0
while i < len(L) and j < len(R):
if L[i] < R[j]:
sorted_array.append(L[i])
i += 1
else:
sorted_array.append(R[j])
j += 1
while i < len(L):
sorted_array.append(L[i])
i += 1
while j < len(R):
sorted_array.append(R[j])
j += 1
return sorted_array
def merge_sort(nums):
if len(nums) <= 1:
return nums
middle = len(nums) // 2
l = nums[:middle]
r = nums[middle:]
l = merge_sort(L)
r = merge_sort(R)
nums = merge_sorted_arrays(L, R)
return nums
array = [6, 5, 12, 10, 9, 1]
merge_sort(array)
print(array) |
"abcd".startswith("ab") #returns True
"abcd".endswith("zn") #returns False
"bb" in "abab" #returns False
"ab" in "abab" #returns True
loc = "abab".find("bb") #returns -1
loc = "abab".find("ab") #returns 0
loc = "abab".find("ab",loc+1) #returns 2
| 'abcd'.startswith('ab')
'abcd'.endswith('zn')
'bb' in 'abab'
'ab' in 'abab'
loc = 'abab'.find('bb')
loc = 'abab'.find('ab')
loc = 'abab'.find('ab', loc + 1) |
SOLVERS = (
{
'type': 'local',
'name': 'leo3',
'pretty-name': 'Leo III',
'version': '1.4',
'command': 'leo3 %s -t %d',
},
{
'type': 'local',
'name': 'cvc4',
'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s',
},
{
'type': 'local',
'name': 'picosat',
'command': './solvers/picosat-tptp.sh -L %d %s',
},
{
'type': 'local',
'name': 'satisfiable-dummy',
'command': './solvers/satisfiable-dummy.sh %s -t %d',
},
{
'type': 'local',
'name': 'unsatisfiable-dummy',
'command': './solvers/unsatisfiable-dummy.sh %s -t %d',
},
{
'type': 'local',
'name': 'gaveup-dummy',
'command': './solvers/gaveup-dummy.sh %s -t %d',
},
) | solvers = ({'type': 'local', 'name': 'leo3', 'pretty-name': 'Leo III', 'version': '1.4', 'command': 'leo3 %s -t %d'}, {'type': 'local', 'name': 'cvc4', 'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s'}, {'type': 'local', 'name': 'picosat', 'command': './solvers/picosat-tptp.sh -L %d %s'}, {'type': 'local', 'name': 'satisfiable-dummy', 'command': './solvers/satisfiable-dummy.sh %s -t %d'}, {'type': 'local', 'name': 'unsatisfiable-dummy', 'command': './solvers/unsatisfiable-dummy.sh %s -t %d'}, {'type': 'local', 'name': 'gaveup-dummy', 'command': './solvers/gaveup-dummy.sh %s -t %d'}) |
SEED_URLS = [
"https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/pathfinder-kingmaker-definitive-edition/bphqqn22gb7l?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/call-of-duty-modern-warfare---digital-standard-edition/9NVQBQ3F6W9W?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/ori-and-the-will-of-the-wisps/9N8CD0XZKLP4?activetab=pivot:overviewtab",
"https://www.microsoft.com/EN-CA/p/red-dead-redemption-2/9N2ZDN7NWQKV?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/tom-clancys-rainbow-six-siege-deluxe-edition/9p30k2nxwh82?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/pillars-of-eternity-complete-edition/bs34vnw7h61f?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/pillars-of-eternity-ii-deadfire-ultimate-edition/9pjd2kmx7tz6?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/astroneer/9nblggh43kzb?cid=msft_web_chart&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/farm-together/9mxsdjxfzq25?cid=msft_web_chart&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/Mafia-III-Definitive-Edition/BVZLS7XZ68KF?rtc=1&activetab=pivot:overviewtab",
"https://www.microsoft.com/EN-CA/p/little-nightmares/BWD88K55MK5W?id=Pubsalegame_Week13&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/Nexomon-Extinction/9NCJR504WXT0?rtc=1&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/GreedFall/BWMH4RQ4Q06F?rtc=1&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/outriders-standard-edition/9p12rcxbf02p?activetab=pivot:overviewtab",
]
| seed_urls = ['https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/pathfinder-kingmaker-definitive-edition/bphqqn22gb7l?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/call-of-duty-modern-warfare---digital-standard-edition/9NVQBQ3F6W9W?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/ori-and-the-will-of-the-wisps/9N8CD0XZKLP4?activetab=pivot:overviewtab', 'https://www.microsoft.com/EN-CA/p/red-dead-redemption-2/9N2ZDN7NWQKV?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/tom-clancys-rainbow-six-siege-deluxe-edition/9p30k2nxwh82?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/pillars-of-eternity-complete-edition/bs34vnw7h61f?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/pillars-of-eternity-ii-deadfire-ultimate-edition/9pjd2kmx7tz6?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/astroneer/9nblggh43kzb?cid=msft_web_chart&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/farm-together/9mxsdjxfzq25?cid=msft_web_chart&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/Mafia-III-Definitive-Edition/BVZLS7XZ68KF?rtc=1&activetab=pivot:overviewtab', 'https://www.microsoft.com/EN-CA/p/little-nightmares/BWD88K55MK5W?id=Pubsalegame_Week13&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/Nexomon-Extinction/9NCJR504WXT0?rtc=1&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/GreedFall/BWMH4RQ4Q06F?rtc=1&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/outriders-standard-edition/9p12rcxbf02p?activetab=pivot:overviewtab'] |
# salva no copiateste.txt o mesmo conteudo do teste.txt
with open('teste.txt', 'r') as arquivolido:
with open('copiateste.txt', 'w') as arquivocriado:
for linha in arquivolido:
arquivocriado.write(linha)
| with open('teste.txt', 'r') as arquivolido:
with open('copiateste.txt', 'w') as arquivocriado:
for linha in arquivolido:
arquivocriado.write(linha) |
class Event:
def __init__(self, event_type, time, direction, intersection):
self.event_type = event_type
self.time = time
self.direction = direction
self.intersection = intersection
| class Event:
def __init__(self, event_type, time, direction, intersection):
self.event_type = event_type
self.time = time
self.direction = direction
self.intersection = intersection |
#write import statement for reverse string function
'''
10 points
Write a main function to ....
Loop as long as user types y.
Prompt user for a string (assume user will always give you good data).
Pass the string to the reverse string function and display the reversed string
'''
| """
10 points
Write a main function to ....
Loop as long as user types y.
Prompt user for a string (assume user will always give you good data).
Pass the string to the reverse string function and display the reversed string
""" |
day = str(input())
if (day == "Monday") or (day == "Tuesday") or (day == "Friday"):
print("12")
elif (day == "Wednesday") or (day == "Thursday"):
print("14")
else:
print("16") | day = str(input())
if day == 'Monday' or day == 'Tuesday' or day == 'Friday':
print('12')
elif day == 'Wednesday' or day == 'Thursday':
print('14')
else:
print('16') |
def two_fer(name=""):
if not name.strip():
return "One for you, one for me."
else:
return "One for {}, one for me.".format(name)
| def two_fer(name=''):
if not name.strip():
return 'One for you, one for me.'
else:
return 'One for {}, one for me.'.format(name) |
class Args:
def __init__(self, config, checkpoint):
self.cfg = config
self.checkpoint = checkpoint
self.sp = True
self.detector = "yolo"
self.inputpath = "./"
self.inputlist = ""
self.inputimg = ""
self.outputpath = "examples/res/"
self.save_img = False
self.vis = False
self.profile = False
self.format = "open"
self.min_box_area = 0
self.detbatch = 5
self.posebatch = 80
self.eval = False
self.gpus = "0"
self.qsize = 1024
self.flip = False
self.debug = False
self.video = ""
self.webcam = 1
self.save_video = False
self.vis_fast = False
self.pose_track = False | class Args:
def __init__(self, config, checkpoint):
self.cfg = config
self.checkpoint = checkpoint
self.sp = True
self.detector = 'yolo'
self.inputpath = './'
self.inputlist = ''
self.inputimg = ''
self.outputpath = 'examples/res/'
self.save_img = False
self.vis = False
self.profile = False
self.format = 'open'
self.min_box_area = 0
self.detbatch = 5
self.posebatch = 80
self.eval = False
self.gpus = '0'
self.qsize = 1024
self.flip = False
self.debug = False
self.video = ''
self.webcam = 1
self.save_video = False
self.vis_fast = False
self.pose_track = False |
PANDA_MODELS = dict(
gt_joints='dream-panda-gt_joints--495831',
predict_joints='dream-panda-predict_joints--173472',
)
KUKA_MODELS = dict(
gt_joints='dream-kuka-gt_joints--192228',
predict_joints='dream-kuka-predict_joints--990681',
)
BAXTER_MODELS = dict(
gt_joints='dream-baxter-gt_joints--510055',
predict_joints='dream-baxter-predict_joints--519984',
)
OWI_MODELS = dict(
predict_joints='craves-owi535-predict_joints--295440',
)
PANDA_ABLATION_REFERENCE_POINT_MODELS = dict(
link0='dream-panda-gt_joints-reference_point=link0--864695',
link1='dream-panda-gt_joints-reference_point=link1--499756',
link2='dream-panda-gt_joints-reference_point=link2--905185',
link4='dream-panda-gt_joints-reference_point=link4--913645',
link5='dream-panda-gt_joints-reference_point=link5--669469',
link9='dream-panda-gt_joints-reference_point=hand--588677',
)
PANDA_ABLATION_ANCHOR_MODELS = dict(
link0='dream-panda-predict_joints-anchor=link0--90648',
link1='dream-panda-predict_joints-anchor=link1--375503',
link2='dream-panda-predict_joints-anchor=link2--463951',
link4='dream-panda-predict_joints-anchor=link4--388856',
link5='dream-panda-predict_joints-anchor=link5--249745',
link9='dream-panda-predict_joints-anchor=link9--106543',
random_all='dream-panda-predict_joints-anchor=random_all--116995',
random_top3='dream-panda-predict_joints-anchor=random_top_3_largest--65378',
random_top5=PANDA_MODELS['predict_joints'],
)
PANDA_ABLATION_ITERATION_MODELS = {
'n_train_iter=1': 'dream-panda-predict_joints-n_train_iter=1--752826',
'n_train_iter=2': 'dream-panda-predict_joints-n_train_iter=2--949003',
'n_train_iter=5': 'dream-panda-predict_joints-n_train_iter=5--315150',
}
RESULT_ID = 1804
DREAM_PAPER_RESULT_IDS = [
f'dream-{robot}-dream-all-models--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')
]
DREAM_KNOWN_ANGLES_RESULT_IDS = [
f'dream-{robot}-knownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')
]
DREAM_UNKNOWN_ANGLES_RESULT_IDS = [
f'dream-{robot}-unknownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')
]
PANDA_KNOWN_ANGLES_ITERATIVE_RESULT_IDS = [
f'dream-panda-orb-knownq--{RESULT_ID}',
f'dream-panda-orb-knownq-online--{RESULT_ID}'
]
CRAVES_LAB_RESULT_IDS = [
f'craves-lab-unknownq--{RESULT_ID}'
]
CRAVES_YOUTUBE_RESULT_IDS = [
f'craves-youtube-unknownq-focal={focal}--{RESULT_ID}' for focal in (500, 750, 1000, 1250, 1500, 1750, 2000)
]
PANDA_KNOWN_ANGLES_ABLATION_RESULT_IDS = [
f'dream-panda-orb-knownq-link{link_id}--{RESULT_ID}' for link_id in (0, 1, 2, 4, 5, 9)
]
PANDA_UNKNOWN_ANGLES_ABLATION_RESULT_IDS = [
f'dream-panda-orb-unknownq-{anchor}--{RESULT_ID}'
for anchor in ('link5', 'link2', 'link1', 'link0', 'link4', 'link9', 'random_all', 'random_top5', 'random_top3')
]
PANDA_ITERATIONS_ABLATION_RESULT_IDS = [
f'dream-panda-orb-train_K={train_K}--{RESULT_ID}'
for train_K in (1, 2, 3, 5)
]
| panda_models = dict(gt_joints='dream-panda-gt_joints--495831', predict_joints='dream-panda-predict_joints--173472')
kuka_models = dict(gt_joints='dream-kuka-gt_joints--192228', predict_joints='dream-kuka-predict_joints--990681')
baxter_models = dict(gt_joints='dream-baxter-gt_joints--510055', predict_joints='dream-baxter-predict_joints--519984')
owi_models = dict(predict_joints='craves-owi535-predict_joints--295440')
panda_ablation_reference_point_models = dict(link0='dream-panda-gt_joints-reference_point=link0--864695', link1='dream-panda-gt_joints-reference_point=link1--499756', link2='dream-panda-gt_joints-reference_point=link2--905185', link4='dream-panda-gt_joints-reference_point=link4--913645', link5='dream-panda-gt_joints-reference_point=link5--669469', link9='dream-panda-gt_joints-reference_point=hand--588677')
panda_ablation_anchor_models = dict(link0='dream-panda-predict_joints-anchor=link0--90648', link1='dream-panda-predict_joints-anchor=link1--375503', link2='dream-panda-predict_joints-anchor=link2--463951', link4='dream-panda-predict_joints-anchor=link4--388856', link5='dream-panda-predict_joints-anchor=link5--249745', link9='dream-panda-predict_joints-anchor=link9--106543', random_all='dream-panda-predict_joints-anchor=random_all--116995', random_top3='dream-panda-predict_joints-anchor=random_top_3_largest--65378', random_top5=PANDA_MODELS['predict_joints'])
panda_ablation_iteration_models = {'n_train_iter=1': 'dream-panda-predict_joints-n_train_iter=1--752826', 'n_train_iter=2': 'dream-panda-predict_joints-n_train_iter=2--949003', 'n_train_iter=5': 'dream-panda-predict_joints-n_train_iter=5--315150'}
result_id = 1804
dream_paper_result_ids = [f'dream-{robot}-dream-all-models--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')]
dream_known_angles_result_ids = [f'dream-{robot}-knownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')]
dream_unknown_angles_result_ids = [f'dream-{robot}-unknownq--{RESULT_ID}' for robot in ('panda', 'kuka', 'baxter')]
panda_known_angles_iterative_result_ids = [f'dream-panda-orb-knownq--{RESULT_ID}', f'dream-panda-orb-knownq-online--{RESULT_ID}']
craves_lab_result_ids = [f'craves-lab-unknownq--{RESULT_ID}']
craves_youtube_result_ids = [f'craves-youtube-unknownq-focal={focal}--{RESULT_ID}' for focal in (500, 750, 1000, 1250, 1500, 1750, 2000)]
panda_known_angles_ablation_result_ids = [f'dream-panda-orb-knownq-link{link_id}--{RESULT_ID}' for link_id in (0, 1, 2, 4, 5, 9)]
panda_unknown_angles_ablation_result_ids = [f'dream-panda-orb-unknownq-{anchor}--{RESULT_ID}' for anchor in ('link5', 'link2', 'link1', 'link0', 'link4', 'link9', 'random_all', 'random_top5', 'random_top3')]
panda_iterations_ablation_result_ids = [f'dream-panda-orb-train_K={train_K}--{RESULT_ID}' for train_k in (1, 2, 3, 5)] |
n = int(input())
narr = list(map(int,input().split()))
ev,od = 0,0
for i in range(n):
if narr[i]%2==0: ev+=narr[i]
else: od+=narr[i]
print(od-ev) | n = int(input())
narr = list(map(int, input().split()))
(ev, od) = (0, 0)
for i in range(n):
if narr[i] % 2 == 0:
ev += narr[i]
else:
od += narr[i]
print(od - ev) |
# Here we assume that cs_array has the dimensions (n_bins, n_chans, n_seg)
# Where n_chans is the number of channels of interest
## cs_array has been filtered before this step
cs_avg = np.mean(cs_array, axis=-1)
## Take the IFFT of the cross spectrum to get the CCF
ccf_avg = fftpack.ifft(cs_avg, axis=0).real
ccf_array = fftpack.ifft(cs_array, axis=0).real
## Apply normalization
ccv_avg *= (2.0 / np.float(n_bins) / ref_rms)
ccf_array *= (2.0 / np.float(n_bins) / ref_rms)
## Compute the standard error on each ccf bin from the segment-to-segment
## variations.
ccf_resid = (ccf_array.T - ccf_avg.T).T
## Eqn 2.3 from S. Vaughan 2013, "Scientific Inference"
sample_var = np.sum(ccf_resid**2, axis=2) / (meta_dict['n_seg'] - 1)
## Eqn 2.4 from S. Vaughan 2013, "Scientific Inference"
standard_error = np.sqrt(sample_var / meta_dict['n_seg'])
return ccf_avg, standard_error
| cs_avg = np.mean(cs_array, axis=-1)
ccf_avg = fftpack.ifft(cs_avg, axis=0).real
ccf_array = fftpack.ifft(cs_array, axis=0).real
ccv_avg *= 2.0 / np.float(n_bins) / ref_rms
ccf_array *= 2.0 / np.float(n_bins) / ref_rms
ccf_resid = (ccf_array.T - ccf_avg.T).T
sample_var = np.sum(ccf_resid ** 2, axis=2) / (meta_dict['n_seg'] - 1)
standard_error = np.sqrt(sample_var / meta_dict['n_seg'])
return (ccf_avg, standard_error) |
int_list = list(map(int, input().split()))
movement = int(input())
for i in range(movement):
int_list.append(int_list[0])
int_list.remove(int_list[0])
print(int_list)
| int_list = list(map(int, input().split()))
movement = int(input())
for i in range(movement):
int_list.append(int_list[0])
int_list.remove(int_list[0])
print(int_list) |
total = 0
count = 0
average = 0
smallest = None
largest = None
print('before largest:', largest)
while True:
inp = input('>')
if inp == "done":
break
try:
if float(inp):
total += float(inp)
count += 1
new_value = float(inp)
if largest is None or new_value > largest:
largest = new_value
print('new_largest is', largest)
if smallest is None or new_value < smallest:
smallest = new_value
print('new_smallest is', smallest)
except ValueError:
print('invalid input')
if count != 0:
print('done')
print('largest is', largest)
print('smallest is', smallest)
print('count is', count)
print(total)
print('average=', total / count)
else:
print('enter a number please')
| total = 0
count = 0
average = 0
smallest = None
largest = None
print('before largest:', largest)
while True:
inp = input('>')
if inp == 'done':
break
try:
if float(inp):
total += float(inp)
count += 1
new_value = float(inp)
if largest is None or new_value > largest:
largest = new_value
print('new_largest is', largest)
if smallest is None or new_value < smallest:
smallest = new_value
print('new_smallest is', smallest)
except ValueError:
print('invalid input')
if count != 0:
print('done')
print('largest is', largest)
print('smallest is', smallest)
print('count is', count)
print(total)
print('average=', total / count)
else:
print('enter a number please') |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-AlarmMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AlarmMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:28 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, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint")
DateAndTime, DisplayString, Unsigned32, RowPointer = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-StandardTextualConventionsMIB", "DateAndTime", "DisplayString", "Unsigned32", "RowPointer")
HexString, Hex, DigitString, AsciiString = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-TextualConventionsMIB", "HexString", "Hex", "DigitString", "AsciiString")
mscPassportMIBs, mscPassportTraps = mibBuilder.importSymbols("Nortel-MsCarrier-MscPassport-UsefulDefinitionsMIB", "mscPassportMIBs", "mscPassportTraps")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, IpAddress, TimeTicks, MibIdentifier, Counter32, NotificationType, Unsigned32, Gauge32, Counter64, iso, Integer32, ModuleIdentity, Bits, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "IpAddress", "TimeTicks", "MibIdentifier", "Counter32", "NotificationType", "Unsigned32", "Gauge32", "Counter64", "iso", "Integer32", "ModuleIdentity", "Bits", "NotificationType")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
alarmMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4))
mscAlarmTrap = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2))
mscMandatoryAlarmInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7))
mscComponentRowPointer = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 1), RowPointer())
if mibBuilder.loadTexts: mscComponentRowPointer.setStatus('mandatory')
mscComponentName = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 2), DisplayString())
if mibBuilder.loadTexts: mscComponentName.setStatus('mandatory')
mscEventTime = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 3), DateAndTime())
if mibBuilder.loadTexts: mscEventTime.setStatus('mandatory')
mscActiveListStatus = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("message", 0), ("set", 1), ("clear", 2))))
if mibBuilder.loadTexts: mscActiveListStatus.setStatus('mandatory')
mscSeverity = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("indeterminate", 0), ("critical", 1), ("major", 2), ("minor", 3), ("warning", 4), ("cleared", 5))))
if mibBuilder.loadTexts: mscSeverity.setStatus('mandatory')
mscAlarmType = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("communications", 0), ("qualityOfService", 1), ("processing", 2), ("equipment", 3), ("environmental", 4), ("security", 5), ("operator", 6), ("debug", 7), ("unknown", 8))))
if mibBuilder.loadTexts: mscAlarmType.setStatus('mandatory')
mscProbableCause = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21, 22, 23, 24, 25, 26, 27, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 80, 81, 82, 83, 84, 90, 91, 92, 93, 100, 101, 102, 110, 111, 112, 113, 114, 120, 121, 122, 200, 201, 202, 203, 204))).clone(namedValues=NamedValues(("lossOfSignal", 0), ("lossOfFrame", 1), ("framingError", 2), ("localTransmissionError", 3), ("remoteTransmissionError", 4), ("callEstablishmentError", 5), ("degradedSignal", 6), ("commSubsystemFailure", 7), ("commProtocolError", 8), ("lanError", 9), ("dteDceInterfaceError", 10), ("responseTimeExcessive", 20), ("queueSizeExceeded", 21), ("bandwidthReduced", 22), ("retransmissionRateReduced", 23), ("thresholdCrossed", 24), ("performanceDegraded", 25), ("congestion", 26), ("atOrNearCapacity", 27), ("storageCapacityProblem", 40), ("versionMismatch", 41), ("corruptData", 42), ("cpuCyclesLimitExceeded", 43), ("softwareError", 44), ("softwareProgramError", 45), ("softwareProgramTermination", 46), ("fileError", 47), ("outOfMemory", 48), ("underlyingResourceUnavail", 49), ("applicationSubsystemFailure", 50), ("configurationError", 51), ("powerProblem", 60), ("timingProblem", 61), ("processorProblem", 62), ("datasetModemError", 63), ("multiplexorProblem", 64), ("receiverFailure", 65), ("transmitterFailure", 66), ("outputDeviceError", 67), ("inputDeviceError", 68), ("ioDeviceError", 69), ("equipmentFailure", 70), ("adapterError", 71), ("duplicateInfo", 80), ("infoMissing", 81), ("infoModification", 82), ("infoOutOfSequence", 83), ("unexpectedInfo", 84), ("denialOfService", 90), ("outOfService", 91), ("proceduralError", 92), ("otherOperational", 93), ("cableTamper", 100), ("intrusionDetection", 101), ("otherPhysical", 102), ("authenticationFailure", 110), ("breachOfConfidence", 111), ("nonRepudiationFailure", 112), ("unauthorizedAccess", 113), ("otherSecurityService", 114), ("delayedInfo", 120), ("keyExpired", 121), ("outOfHoursActivity", 122), ("operationalCondition", 200), ("debugging", 201), ("unknown", 202), ("inactiveVirtualCircuit", 203), ("networkServerIntervention", 204))))
if mibBuilder.loadTexts: mscProbableCause.setStatus('mandatory')
mscNtpIndex = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 8), DigitString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8))
if mibBuilder.loadTexts: mscNtpIndex.setStatus('mandatory')
mscCommentData = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 9), AsciiString().subtype(subtypeSpec=ValueSizeConstraint(0, 750)))
if mibBuilder.loadTexts: mscCommentData.setStatus('mandatory')
mscOptionalAlarmInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8))
mscNotificationID = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 1), Hex())
if mibBuilder.loadTexts: mscNotificationID.setStatus('mandatory')
mscLpForHierClear = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 2), RowPointer())
if mibBuilder.loadTexts: mscLpForHierClear.setStatus('mandatory')
mscOperatorData = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 3), HexString().subtype(subtypeSpec=ValueSizeConstraint(0, 750)))
if mibBuilder.loadTexts: mscOperatorData.setStatus('mandatory')
mscPid = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 25)))
if mibBuilder.loadTexts: mscPid.setStatus('mandatory')
mscFileName = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 5), DisplayString())
if mibBuilder.loadTexts: mscFileName.setStatus('mandatory')
mscFileLineNumber = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 6), Unsigned32())
if mibBuilder.loadTexts: mscFileLineNumber.setStatus('mandatory')
mscFileVersion = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 7), DisplayString())
if mibBuilder.loadTexts: mscFileVersion.setStatus('mandatory')
mscInternalData = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 8), HexString().subtype(subtypeSpec=ValueSizeConstraint(0, 750)))
if mibBuilder.loadTexts: mscInternalData.setStatus('mandatory')
mscProvisionalAlarmInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9))
mscCid = MibScalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9, 1), Unsigned32())
if mibBuilder.loadTexts: mscCid.setStatus('mandatory')
mscCriticalAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,1)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData"))
mscMajorAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,2)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData"))
mscMinorAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,3)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData"))
mscWarningAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,4)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData"))
mscClearedAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,5)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData"))
mscIndeterminateAlarm = NotificationType((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0,6)).setObjects(("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentRowPointer"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscComponentName"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscEventTime"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscActiveListStatus"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscSeverity"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscAlarmType"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscProbableCause"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscNtpIndex"), ("Nortel-MsCarrier-MscPassport-AlarmMIB", "mscCommentData"))
alarmGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1))
alarmGroupCA = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1))
alarmGroupCA01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2))
alarmGroupCA01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2, 2))
alarmNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2))
alarmNotificationsGroupCA01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2, 1))
alarmCapabilities = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3))
alarmCapabilitiesCA = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1))
alarmCapabilitiesCA01 = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2))
alarmCapabilitiesCA01A = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2, 2))
mibBuilder.exportSymbols("Nortel-MsCarrier-MscPassport-AlarmMIB", mscCommentData=mscCommentData, alarmCapabilitiesCA01=alarmCapabilitiesCA01, alarmCapabilitiesCA01A=alarmCapabilitiesCA01A, alarmCapabilities=alarmCapabilities, mscOptionalAlarmInfo=mscOptionalAlarmInfo, alarmNotificationsGroupCA01A=alarmNotificationsGroupCA01A, mscProvisionalAlarmInfo=mscProvisionalAlarmInfo, mscWarningAlarm=mscWarningAlarm, mscAlarmTrap=mscAlarmTrap, alarmCapabilitiesCA=alarmCapabilitiesCA, mscMandatoryAlarmInfo=mscMandatoryAlarmInfo, mscComponentRowPointer=mscComponentRowPointer, mscNtpIndex=mscNtpIndex, alarmGroup=alarmGroup, alarmNotifications=alarmNotifications, mscProbableCause=mscProbableCause, mscMinorAlarm=mscMinorAlarm, mscActiveListStatus=mscActiveListStatus, mscLpForHierClear=mscLpForHierClear, alarmGroupCA01A=alarmGroupCA01A, mscAlarmType=mscAlarmType, mscNotificationID=mscNotificationID, mscFileLineNumber=mscFileLineNumber, mscClearedAlarm=mscClearedAlarm, alarmGroupCA01=alarmGroupCA01, mscFileVersion=mscFileVersion, mscOperatorData=mscOperatorData, mscMajorAlarm=mscMajorAlarm, alarmGroupCA=alarmGroupCA, mscSeverity=mscSeverity, mscComponentName=mscComponentName, mscIndeterminateAlarm=mscIndeterminateAlarm, mscFileName=mscFileName, mscInternalData=mscInternalData, alarmMIB=alarmMIB, mscPid=mscPid, mscCriticalAlarm=mscCriticalAlarm, mscCid=mscCid, mscEventTime=mscEventTime)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint')
(date_and_time, display_string, unsigned32, row_pointer) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-StandardTextualConventionsMIB', 'DateAndTime', 'DisplayString', 'Unsigned32', 'RowPointer')
(hex_string, hex, digit_string, ascii_string) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-TextualConventionsMIB', 'HexString', 'Hex', 'DigitString', 'AsciiString')
(msc_passport_mi_bs, msc_passport_traps) = mibBuilder.importSymbols('Nortel-MsCarrier-MscPassport-UsefulDefinitionsMIB', 'mscPassportMIBs', 'mscPassportTraps')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, ip_address, time_ticks, mib_identifier, counter32, notification_type, unsigned32, gauge32, counter64, iso, integer32, module_identity, bits, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'IpAddress', 'TimeTicks', 'MibIdentifier', 'Counter32', 'NotificationType', 'Unsigned32', 'Gauge32', 'Counter64', 'iso', 'Integer32', 'ModuleIdentity', 'Bits', 'NotificationType')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
alarm_mib = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4))
msc_alarm_trap = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2))
msc_mandatory_alarm_info = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7))
msc_component_row_pointer = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 1), row_pointer())
if mibBuilder.loadTexts:
mscComponentRowPointer.setStatus('mandatory')
msc_component_name = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 2), display_string())
if mibBuilder.loadTexts:
mscComponentName.setStatus('mandatory')
msc_event_time = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 3), date_and_time())
if mibBuilder.loadTexts:
mscEventTime.setStatus('mandatory')
msc_active_list_status = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('message', 0), ('set', 1), ('clear', 2))))
if mibBuilder.loadTexts:
mscActiveListStatus.setStatus('mandatory')
msc_severity = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5))).clone(namedValues=named_values(('indeterminate', 0), ('critical', 1), ('major', 2), ('minor', 3), ('warning', 4), ('cleared', 5))))
if mibBuilder.loadTexts:
mscSeverity.setStatus('mandatory')
msc_alarm_type = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('communications', 0), ('qualityOfService', 1), ('processing', 2), ('equipment', 3), ('environmental', 4), ('security', 5), ('operator', 6), ('debug', 7), ('unknown', 8))))
if mibBuilder.loadTexts:
mscAlarmType.setStatus('mandatory')
msc_probable_cause = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21, 22, 23, 24, 25, 26, 27, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 80, 81, 82, 83, 84, 90, 91, 92, 93, 100, 101, 102, 110, 111, 112, 113, 114, 120, 121, 122, 200, 201, 202, 203, 204))).clone(namedValues=named_values(('lossOfSignal', 0), ('lossOfFrame', 1), ('framingError', 2), ('localTransmissionError', 3), ('remoteTransmissionError', 4), ('callEstablishmentError', 5), ('degradedSignal', 6), ('commSubsystemFailure', 7), ('commProtocolError', 8), ('lanError', 9), ('dteDceInterfaceError', 10), ('responseTimeExcessive', 20), ('queueSizeExceeded', 21), ('bandwidthReduced', 22), ('retransmissionRateReduced', 23), ('thresholdCrossed', 24), ('performanceDegraded', 25), ('congestion', 26), ('atOrNearCapacity', 27), ('storageCapacityProblem', 40), ('versionMismatch', 41), ('corruptData', 42), ('cpuCyclesLimitExceeded', 43), ('softwareError', 44), ('softwareProgramError', 45), ('softwareProgramTermination', 46), ('fileError', 47), ('outOfMemory', 48), ('underlyingResourceUnavail', 49), ('applicationSubsystemFailure', 50), ('configurationError', 51), ('powerProblem', 60), ('timingProblem', 61), ('processorProblem', 62), ('datasetModemError', 63), ('multiplexorProblem', 64), ('receiverFailure', 65), ('transmitterFailure', 66), ('outputDeviceError', 67), ('inputDeviceError', 68), ('ioDeviceError', 69), ('equipmentFailure', 70), ('adapterError', 71), ('duplicateInfo', 80), ('infoMissing', 81), ('infoModification', 82), ('infoOutOfSequence', 83), ('unexpectedInfo', 84), ('denialOfService', 90), ('outOfService', 91), ('proceduralError', 92), ('otherOperational', 93), ('cableTamper', 100), ('intrusionDetection', 101), ('otherPhysical', 102), ('authenticationFailure', 110), ('breachOfConfidence', 111), ('nonRepudiationFailure', 112), ('unauthorizedAccess', 113), ('otherSecurityService', 114), ('delayedInfo', 120), ('keyExpired', 121), ('outOfHoursActivity', 122), ('operationalCondition', 200), ('debugging', 201), ('unknown', 202), ('inactiveVirtualCircuit', 203), ('networkServerIntervention', 204))))
if mibBuilder.loadTexts:
mscProbableCause.setStatus('mandatory')
msc_ntp_index = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 8), digit_string().subtype(subtypeSpec=value_size_constraint(8, 8)).setFixedLength(8))
if mibBuilder.loadTexts:
mscNtpIndex.setStatus('mandatory')
msc_comment_data = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 7, 9), ascii_string().subtype(subtypeSpec=value_size_constraint(0, 750)))
if mibBuilder.loadTexts:
mscCommentData.setStatus('mandatory')
msc_optional_alarm_info = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8))
msc_notification_id = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 1), hex())
if mibBuilder.loadTexts:
mscNotificationID.setStatus('mandatory')
msc_lp_for_hier_clear = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 2), row_pointer())
if mibBuilder.loadTexts:
mscLpForHierClear.setStatus('mandatory')
msc_operator_data = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 3), hex_string().subtype(subtypeSpec=value_size_constraint(0, 750)))
if mibBuilder.loadTexts:
mscOperatorData.setStatus('mandatory')
msc_pid = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 25)))
if mibBuilder.loadTexts:
mscPid.setStatus('mandatory')
msc_file_name = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 5), display_string())
if mibBuilder.loadTexts:
mscFileName.setStatus('mandatory')
msc_file_line_number = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 6), unsigned32())
if mibBuilder.loadTexts:
mscFileLineNumber.setStatus('mandatory')
msc_file_version = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 7), display_string())
if mibBuilder.loadTexts:
mscFileVersion.setStatus('mandatory')
msc_internal_data = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 8, 8), hex_string().subtype(subtypeSpec=value_size_constraint(0, 750)))
if mibBuilder.loadTexts:
mscInternalData.setStatus('mandatory')
msc_provisional_alarm_info = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9))
msc_cid = mib_scalar((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2, 9, 1), unsigned32())
if mibBuilder.loadTexts:
mscCid.setStatus('mandatory')
msc_critical_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 1)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData'))
msc_major_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 2)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData'))
msc_minor_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 3)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData'))
msc_warning_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 4)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData'))
msc_cleared_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 5)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData'))
msc_indeterminate_alarm = notification_type((1, 3, 6, 1, 4, 1, 562, 36, 2, 1, 3, 2) + (0, 6)).setObjects(('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentRowPointer'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscComponentName'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscEventTime'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscActiveListStatus'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscSeverity'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscAlarmType'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscProbableCause'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscNtpIndex'), ('Nortel-MsCarrier-MscPassport-AlarmMIB', 'mscCommentData'))
alarm_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1))
alarm_group_ca = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1))
alarm_group_ca01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2))
alarm_group_ca01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 1, 1, 2, 2))
alarm_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2))
alarm_notifications_group_ca01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 2, 1))
alarm_capabilities = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3))
alarm_capabilities_ca = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1))
alarm_capabilities_ca01 = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2))
alarm_capabilities_ca01_a = mib_identifier((1, 3, 6, 1, 4, 1, 562, 36, 2, 2, 4, 3, 1, 2, 2))
mibBuilder.exportSymbols('Nortel-MsCarrier-MscPassport-AlarmMIB', mscCommentData=mscCommentData, alarmCapabilitiesCA01=alarmCapabilitiesCA01, alarmCapabilitiesCA01A=alarmCapabilitiesCA01A, alarmCapabilities=alarmCapabilities, mscOptionalAlarmInfo=mscOptionalAlarmInfo, alarmNotificationsGroupCA01A=alarmNotificationsGroupCA01A, mscProvisionalAlarmInfo=mscProvisionalAlarmInfo, mscWarningAlarm=mscWarningAlarm, mscAlarmTrap=mscAlarmTrap, alarmCapabilitiesCA=alarmCapabilitiesCA, mscMandatoryAlarmInfo=mscMandatoryAlarmInfo, mscComponentRowPointer=mscComponentRowPointer, mscNtpIndex=mscNtpIndex, alarmGroup=alarmGroup, alarmNotifications=alarmNotifications, mscProbableCause=mscProbableCause, mscMinorAlarm=mscMinorAlarm, mscActiveListStatus=mscActiveListStatus, mscLpForHierClear=mscLpForHierClear, alarmGroupCA01A=alarmGroupCA01A, mscAlarmType=mscAlarmType, mscNotificationID=mscNotificationID, mscFileLineNumber=mscFileLineNumber, mscClearedAlarm=mscClearedAlarm, alarmGroupCA01=alarmGroupCA01, mscFileVersion=mscFileVersion, mscOperatorData=mscOperatorData, mscMajorAlarm=mscMajorAlarm, alarmGroupCA=alarmGroupCA, mscSeverity=mscSeverity, mscComponentName=mscComponentName, mscIndeterminateAlarm=mscIndeterminateAlarm, mscFileName=mscFileName, mscInternalData=mscInternalData, alarmMIB=alarmMIB, mscPid=mscPid, mscCriticalAlarm=mscCriticalAlarm, mscCid=mscCid, mscEventTime=mscEventTime) |
def insertion_sort(a):
for i in range (1,len(a)):
c=a[i]
k=i-1
while (k>=0) and (c<=a[k]) :
a[k+1] = a[k]
k=k-1
a[k+1] = c
n=int(input("Enter No. Of Elements in List :-s "))
a=[i for i in range (n)]
print ("Enter the Elements one after the other :- ")
for i in range (n):
a[i]=int(input())
insertion_sort(a)
print(a)
| def insertion_sort(a):
for i in range(1, len(a)):
c = a[i]
k = i - 1
while k >= 0 and c <= a[k]:
a[k + 1] = a[k]
k = k - 1
a[k + 1] = c
n = int(input('Enter No. Of Elements in List :-s '))
a = [i for i in range(n)]
print('Enter the Elements one after the other :- ')
for i in range(n):
a[i] = int(input())
insertion_sort(a)
print(a) |
total = int(input())
b_num = 0
b_x = 0
b_y = 0
for i in range(total):
num, x, y = map(int, input().split())
mn = num - b_num
mx = abs(x - b_x)
my = abs(y - b_y)
if mn < mx + my:
print("No")
exit()
else:
if b_num % 2 == (mx + my) % 2:
mn = num
b_x = x
b_y = y
else:
# print("{} {} {}".format(b_num, mx, my))
print("No")
exit()
print("Yes")
| total = int(input())
b_num = 0
b_x = 0
b_y = 0
for i in range(total):
(num, x, y) = map(int, input().split())
mn = num - b_num
mx = abs(x - b_x)
my = abs(y - b_y)
if mn < mx + my:
print('No')
exit()
elif b_num % 2 == (mx + my) % 2:
mn = num
b_x = x
b_y = y
else:
print('No')
exit()
print('Yes') |
# uninhm
# https://atcoder.jp/contests/abc164/tasks/abc164_c
# dictionary
a = {}
ans = 0
n = int(input())
for _ in range(n):
i = input()
ans += a.get(i, 1)
a[i] = 0
print(ans)
| a = {}
ans = 0
n = int(input())
for _ in range(n):
i = input()
ans += a.get(i, 1)
a[i] = 0
print(ans) |
class UnionFind:
def __init__(self, size):
self.parent = list(range(size))
self.component = [[i] for i in range(size)]
def root(self, i):
if self.parent[i] != i:
self.parent[i] = self.root(self.parent[i])
return self.parent[i]
def unite(self, i, j):
i, j = self.root(i), self.root(j)
if len(self.component[i]) < len(self.component[j]):
i, j = j, i
self.parent[j] = i
self.component[i] += self.component[j]
| class Unionfind:
def __init__(self, size):
self.parent = list(range(size))
self.component = [[i] for i in range(size)]
def root(self, i):
if self.parent[i] != i:
self.parent[i] = self.root(self.parent[i])
return self.parent[i]
def unite(self, i, j):
(i, j) = (self.root(i), self.root(j))
if len(self.component[i]) < len(self.component[j]):
(i, j) = (j, i)
self.parent[j] = i
self.component[i] += self.component[j] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class TClassStatic(object):
obj_num = 0
def __init__(self, data):
self.data = data
TClassStatic.obj_num += 1
def printself(self):
print("self.data: ", self.data)
@staticmethod
def smethod():
print("the number of obj is : ", TClassStatic.obj_num)
@classmethod
def cmethod(cls):
print("cmethod : ", cls.obj_num)
print(';first')
cls.smethod()
print('last')
def main():
objA = TClassStatic(10)
objB = TClassStatic(12)
objA.printself()
objB.printself()
objA.smethod()
objB.cmethod()
print("------------------------------")
TClassStatic.smethod()
TClassStatic.cmethod()
if __name__ == "__main__":
main() | class Tclassstatic(object):
obj_num = 0
def __init__(self, data):
self.data = data
TClassStatic.obj_num += 1
def printself(self):
print('self.data: ', self.data)
@staticmethod
def smethod():
print('the number of obj is : ', TClassStatic.obj_num)
@classmethod
def cmethod(cls):
print('cmethod : ', cls.obj_num)
print(';first')
cls.smethod()
print('last')
def main():
obj_a = t_class_static(10)
obj_b = t_class_static(12)
objA.printself()
objB.printself()
objA.smethod()
objB.cmethod()
print('------------------------------')
TClassStatic.smethod()
TClassStatic.cmethod()
if __name__ == '__main__':
main() |
# This code is connected with '18 - Modules.py'
def kgs_to_lbs(weight):
return 2.20462 * weight
def lbs_t_kgs(weight):
return 0.453592 * weight
| def kgs_to_lbs(weight):
return 2.20462 * weight
def lbs_t_kgs(weight):
return 0.453592 * weight |
n=int(input())
arr=[]
game=True
for i in range(n):
arr.append((input()))
for j in range(n):
if "OO" in arr[j]:
print("YES")
ind=arr[j].index("OO")
if ind==0 and arr[j][ind+1]=="O":
arr[j]="++|"+arr[j][3]+arr[j][4]
if ind==3 and arr[j][ind+1]=="O":
arr[j]=arr[j][0]+arr[j][1]+"|"+"++"
game=False
break
if game==True:
print('NO')
else:
for k in range(n):
print(arr[k]) | n = int(input())
arr = []
game = True
for i in range(n):
arr.append(input())
for j in range(n):
if 'OO' in arr[j]:
print('YES')
ind = arr[j].index('OO')
if ind == 0 and arr[j][ind + 1] == 'O':
arr[j] = '++|' + arr[j][3] + arr[j][4]
if ind == 3 and arr[j][ind + 1] == 'O':
arr[j] = arr[j][0] + arr[j][1] + '|' + '++'
game = False
break
if game == True:
print('NO')
else:
for k in range(n):
print(arr[k]) |
class A:
def spam(self):
print('A.spam')
class B(A):
def spam(self):
print('B.spam')
super().spam() # Call parent spam()
class C:
def __init__(self):
self.x = 0
class D(C):
def __init__(self):
super().__init__()
self.y = 1
d = D()
print(d.y)
class Base:
def __init__(self):
print('Base.__init__')
class A(Base):
def __init__(self):
Base.__init__(self)
print('A.__init__') | class A:
def spam(self):
print('A.spam')
class B(A):
def spam(self):
print('B.spam')
super().spam()
class C:
def __init__(self):
self.x = 0
class D(C):
def __init__(self):
super().__init__()
self.y = 1
d = d()
print(d.y)
class Base:
def __init__(self):
print('Base.__init__')
class A(Base):
def __init__(self):
Base.__init__(self)
print('A.__init__') |
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[0], ' FIRST ITEM')
print(foo[len(foo) - 1], ' LAST ITEM') | foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[0], ' FIRST ITEM')
print(foo[len(foo) - 1], ' LAST ITEM') |
# Copyright 2017 Citrix Systems
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def set_host_enabled(session, enabled):
args = {"enabled": enabled}
return session.call_plugin('xenhost.py', 'set_host_enabled', args)
def get_host_uptime(session):
return session.call_plugin('xenhost.py', 'host_uptime', {})
def get_host_data(session):
return session.call_plugin('xenhost.py', 'host_data', {})
def get_pci_type(session, pci_device):
return session.call_plugin_serialized('xenhost.py', 'get_pci_type',
pci_device)
def get_pci_device_details(session):
return session.call_plugin_serialized('xenhost.py',
'get_pci_device_details')
| def set_host_enabled(session, enabled):
args = {'enabled': enabled}
return session.call_plugin('xenhost.py', 'set_host_enabled', args)
def get_host_uptime(session):
return session.call_plugin('xenhost.py', 'host_uptime', {})
def get_host_data(session):
return session.call_plugin('xenhost.py', 'host_data', {})
def get_pci_type(session, pci_device):
return session.call_plugin_serialized('xenhost.py', 'get_pci_type', pci_device)
def get_pci_device_details(session):
return session.call_plugin_serialized('xenhost.py', 'get_pci_device_details') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.