content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Strip(object):
def plotSurf(self):
for cyc in self.cut_cycs:
self.df = None
print("file to analyse: ",self.file)
myResults = RTQuICData_feat(self.file, numCycles =cyc)
self.df = myResults.getData()
self.addSurflabels()
for param in self.params:
x_, y_ = 'Surf conc', param
sns.stripplot(x = x_,y = y_,hue = "Seed", data = self.df)
plt.title("Effect of "+self.surf_name+ " on RTQuIC "+param+ ": "+ str(cyc//4)+ " hours ")
plt.legend([],[], frameon=False)
plt.show()
del self.df
| class Strip(object):
def plot_surf(self):
for cyc in self.cut_cycs:
self.df = None
print('file to analyse: ', self.file)
my_results = rt_qu_ic_data_feat(self.file, numCycles=cyc)
self.df = myResults.getData()
self.addSurflabels()
for param in self.params:
(x_, y_) = ('Surf conc', param)
sns.stripplot(x=x_, y=y_, hue='Seed', data=self.df)
plt.title('Effect of ' + self.surf_name + ' on RTQuIC ' + param + ': ' + str(cyc // 4) + ' hours ')
plt.legend([], [], frameon=False)
plt.show()
del self.df |
class Demo:
def __init__(self):
pass
def runDemo(self):
print("Hi , This is demo !") | class Demo:
def __init__(self):
pass
def run_demo(self):
print('Hi , This is demo !') |
# 40 ms ; faster than 97.67 %
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
if not root:
return root
ret = root
out = [[]]
q = deque()
q.append(root)
q.append(None)
while len(q):
temp = q.popleft()
out[-1].append(temp)
if temp.left:
q.append(temp.left)
if temp.right:
q.append(temp.right)
if q[0] == None:
q.popleft()
if len(q):
start = out[-1][0]
for node in out[-1][1:]:
start.next = node
start = node
out.append([])
q.append(None)
start = out[-1][0]
for node in out[-1][1:]:
start.next = node
start = node
return ret | """
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
if not root:
return root
ret = root
out = [[]]
q = deque()
q.append(root)
q.append(None)
while len(q):
temp = q.popleft()
out[-1].append(temp)
if temp.left:
q.append(temp.left)
if temp.right:
q.append(temp.right)
if q[0] == None:
q.popleft()
if len(q):
start = out[-1][0]
for node in out[-1][1:]:
start.next = node
start = node
out.append([])
q.append(None)
start = out[-1][0]
for node in out[-1][1:]:
start.next = node
start = node
return ret |
def median(l):
tmp = l
tmp.sort()
n = len(tmp)
m = n // 2
if n % 2:
return tmp[m]
else:
return (tmp[m] + tmp[m-1]) // 2
n = int(input())
x_ = []
y_ = []
for i in range(n):
x, y = [int(j) for j in input().split()]
x_.append(x)
y_.append(y)
y_cable = median(y_)
cable = max(x_) - min(x_)
cable += sum([abs(y - y_cable) for y in y_])
print(cable)
| def median(l):
tmp = l
tmp.sort()
n = len(tmp)
m = n // 2
if n % 2:
return tmp[m]
else:
return (tmp[m] + tmp[m - 1]) // 2
n = int(input())
x_ = []
y_ = []
for i in range(n):
(x, y) = [int(j) for j in input().split()]
x_.append(x)
y_.append(y)
y_cable = median(y_)
cable = max(x_) - min(x_)
cable += sum([abs(y - y_cable) for y in y_])
print(cable) |
class libro():
def __init__(self,prestamo,devolucion,dame_info):
self.prestamo = prestamo
self.devolucion = devolucion
self.dame_info = dame_info
def get_prestamo(self):
return
def get_devolucion(self):
return
def get_dame_info(self):
return
| class Libro:
def __init__(self, prestamo, devolucion, dame_info):
self.prestamo = prestamo
self.devolucion = devolucion
self.dame_info = dame_info
def get_prestamo(self):
return
def get_devolucion(self):
return
def get_dame_info(self):
return |
class Solution:
def findClosestNumber(self, nums: List[int]) -> int:
nums.sort(key=lambda x: (abs(x), -x))
return nums[0]
| class Solution:
def find_closest_number(self, nums: List[int]) -> int:
nums.sort(key=lambda x: (abs(x), -x))
return nums[0] |
# Create a program that has a tuple fully populated with a count in full, from zero to twenty.
# Your program should read a number on the keyboard (between 0 and 20) and show it in full.
full = ('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight',
'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',
'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty')
while True:
number = int(input('Enter a number between 0 and 20: '))
if 0 <= number <= 20:
print(f'You typed the number \033[1:32m{full[number]}\033[m.')
choice = ' '
while choice not in 'YN':
choice = str(input('Do you want to continue? [Y/N] ')).strip().upper()[0]
if choice in 'N':
break
else:
print('Try again.', end=' ')
print('END')
| full = ('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty')
while True:
number = int(input('Enter a number between 0 and 20: '))
if 0 <= number <= 20:
print(f'You typed the number \x1b[1:32m{full[number]}\x1b[m.')
choice = ' '
while choice not in 'YN':
choice = str(input('Do you want to continue? [Y/N] ')).strip().upper()[0]
if choice in 'N':
break
else:
print('Try again.', end=' ')
print('END') |
class Node:
def __init__(self, data):
self.val = data
self.next = None
def __str__(self):
return str(self.val)
class LinkedList:
def __init__(self):
self.head = None
self._size = 0
def append(self, el):
if self.head:
pointer = self.head
j = 0
while pointer.next:
pointer = pointer.next
pointer.next = Node(el)
else:
self.head = Node(el)
self._size = self._size + 1
def get(self, index: int):
if index > (self._size - 1):
return ValueError("Index error")
pointer = self.head
for _ in range(index):
if pointer:
pointer = pointer.next
return pointer
def __len__(self):
return self._size
if __name__ == '__main__':
my_list = LinkedList()
my_list.append(5)
my_list.append(7)
my_list.append(10)
for i in range(len(my_list)):
print(f"Element in {i} position: ", my_list.get(i))
print("---------------------------")
print(my_list.get(0), my_list.get(1), my_list.get(2), my_list.get(3))
| class Node:
def __init__(self, data):
self.val = data
self.next = None
def __str__(self):
return str(self.val)
class Linkedlist:
def __init__(self):
self.head = None
self._size = 0
def append(self, el):
if self.head:
pointer = self.head
j = 0
while pointer.next:
pointer = pointer.next
pointer.next = node(el)
else:
self.head = node(el)
self._size = self._size + 1
def get(self, index: int):
if index > self._size - 1:
return value_error('Index error')
pointer = self.head
for _ in range(index):
if pointer:
pointer = pointer.next
return pointer
def __len__(self):
return self._size
if __name__ == '__main__':
my_list = linked_list()
my_list.append(5)
my_list.append(7)
my_list.append(10)
for i in range(len(my_list)):
print(f'Element in {i} position: ', my_list.get(i))
print('---------------------------')
print(my_list.get(0), my_list.get(1), my_list.get(2), my_list.get(3)) |
version = '0.6.4'
version_cmd = 'consul -v'
depends = ['unzip']
download_url = 'https://releases.hashicorp.com/consul/VERSION/consul_VERSION_linux_amd64.zip'
install_script = """
unzip -o consul_VERSION_linux_amd64.zip
mv -f consul /usr/local/bin/consul
"""
| version = '0.6.4'
version_cmd = 'consul -v'
depends = ['unzip']
download_url = 'https://releases.hashicorp.com/consul/VERSION/consul_VERSION_linux_amd64.zip'
install_script = '\nunzip -o consul_VERSION_linux_amd64.zip\nmv -f consul /usr/local/bin/consul\n' |
'''input
2000
'''
inp = int(input(''))
print(int((inp-1)*inp*(inp+1)/6+inp)) | """input
2000
"""
inp = int(input(''))
print(int((inp - 1) * inp * (inp + 1) / 6 + inp)) |
"""
def find_next_wildcard(s, n):
for i in range(n, len(s)):
if s[i] == '?':
index = i
break
else:
index = i+1
return index
def wildcard_main(s):
#print(len(s), [n for n in range(3,2)])
wildcard(s, find_next_wildcard(s, 0))
def wildcard(s, n):
if n == len(s):
print(s)
elif n < len(s):
for i in (0,1):
s[n] = str(i)
wildcard(s, find_next_wildcard(s,n))
s[n] = '?'
wildcard_main(list("0?1?"))
"""
def _wildcard(str, i):
if i == len(str):
print("".join(str))
return
if str[i] == "?":
str[i] = "0"
_wildcard(str, i+1)
str[i] = "1"
_wildcard(str, i+1)
str[i] = "?"
else:
_wildcard(str, i+1)
def wildcard(str):
_wildcard(list(str), 0)
strings = ["i",
"",
"?",
"??",
"???",
"0?",
"?1",
"1?0?"]
for str in strings:
print("Wildcards of {}:".format(str))
wildcard(str)
| """
def find_next_wildcard(s, n):
for i in range(n, len(s)):
if s[i] == '?':
index = i
break
else:
index = i+1
return index
def wildcard_main(s):
#print(len(s), [n for n in range(3,2)])
wildcard(s, find_next_wildcard(s, 0))
def wildcard(s, n):
if n == len(s):
print(s)
elif n < len(s):
for i in (0,1):
s[n] = str(i)
wildcard(s, find_next_wildcard(s,n))
s[n] = '?'
wildcard_main(list("0?1?"))
"""
def _wildcard(str, i):
if i == len(str):
print(''.join(str))
return
if str[i] == '?':
str[i] = '0'
_wildcard(str, i + 1)
str[i] = '1'
_wildcard(str, i + 1)
str[i] = '?'
else:
_wildcard(str, i + 1)
def wildcard(str):
_wildcard(list(str), 0)
strings = ['i', '', '?', '??', '???', '0?', '?1', '1?0?']
for str in strings:
print('Wildcards of {}:'.format(str))
wildcard(str) |
"""
=========
Associate
=========
Widgets for association rules.
"""
# Category description for the widget registry
NAME = "WISE 2 Tools"
DESCRIPTION = "Widgets for WISE 2"
BACKGROUND = "#FD8D8D"
ICON = "icons/tools.png"
PRIORITY = 303
| """
=========
Associate
=========
Widgets for association rules.
"""
name = 'WISE 2 Tools'
description = 'Widgets for WISE 2'
background = '#FD8D8D'
icon = 'icons/tools.png'
priority = 303 |
#File name: SUDOKU.py
#Finding unsige cell
def FindUnsignedLocation(Board, l):
for row in range(0,9):
for col in range(0,9):
if (Board[row][col] == 0):
l[0] = row
l[1] = col
return True
return False
def InRow(Board, row, num):
for i in range(0,9):
if (Board[row][i] == num):
return True
return False
def InCol(Board, col, num):
for i in range(0,9):
if (Board[i][col] == num):
return True
return False
def InBox(Board, row, col, num):
for i in range(0,3):
for j in range(0,3):
if (Board[i + row][j + col] == num):
return True
return False
def isSafe(Board, row, col, num):
return not InCol(Board, col, num) and not InRow(Board, row, num) and not InBox(Board, row - row % 3, col - col % 3, num)
def SolveSudoku(Board):
l=[0,0]
if (not FindUnsignedLocation(Board, l)):
return True
row = l[0]
col = l[1]
for num in range(1,10):
if (isSafe(Board, row, col, num)):
Board[row][col] = num
if (SolveSudoku(Board)):
return True
Board[row][col] = 0
return False | def find_unsigned_location(Board, l):
for row in range(0, 9):
for col in range(0, 9):
if Board[row][col] == 0:
l[0] = row
l[1] = col
return True
return False
def in_row(Board, row, num):
for i in range(0, 9):
if Board[row][i] == num:
return True
return False
def in_col(Board, col, num):
for i in range(0, 9):
if Board[i][col] == num:
return True
return False
def in_box(Board, row, col, num):
for i in range(0, 3):
for j in range(0, 3):
if Board[i + row][j + col] == num:
return True
return False
def is_safe(Board, row, col, num):
return not in_col(Board, col, num) and (not in_row(Board, row, num)) and (not in_box(Board, row - row % 3, col - col % 3, num))
def solve_sudoku(Board):
l = [0, 0]
if not find_unsigned_location(Board, l):
return True
row = l[0]
col = l[1]
for num in range(1, 10):
if is_safe(Board, row, col, num):
Board[row][col] = num
if solve_sudoku(Board):
return True
Board[row][col] = 0
return False |
[
[0.02175933, 0.03332428, 0.04187784, 0.03716728, 0.0308031, 0.01415677],
[0.02346025, 0.03427124, 0.04290557, 0.0354381, 0.02346025, 0.01953654],
]
| [[0.02175933, 0.03332428, 0.04187784, 0.03716728, 0.0308031, 0.01415677], [0.02346025, 0.03427124, 0.04290557, 0.0354381, 0.02346025, 0.01953654]] |
def limits(signed, bit_size):
signed_limit = 2 ** (bit_size - 1)
return (-signed_limit, signed_limit - 1) if signed else (0, 2 * signed_limit - 1)
def str_int(signed, bit_size):
s = "u" if not signed else ""
s += "int"
s += "%s" % bit_size
return s
def assert_int_in_range(value, signed, bit_size):
min_val, max_val = limits(signed, bit_size)
if value < min_val or value > max_val:
s_typ = str_int(signed, bit_size)
lim = limits(signed, bit_size)
raise(ValueError("%d not in range of %s %s" % (value, s_typ, lim)))
def assert_integers_in_range(values, signed, bit_size):
for value in values:
assert_int_in_range(value, signed, bit_size)
| def limits(signed, bit_size):
signed_limit = 2 ** (bit_size - 1)
return (-signed_limit, signed_limit - 1) if signed else (0, 2 * signed_limit - 1)
def str_int(signed, bit_size):
s = 'u' if not signed else ''
s += 'int'
s += '%s' % bit_size
return s
def assert_int_in_range(value, signed, bit_size):
(min_val, max_val) = limits(signed, bit_size)
if value < min_val or value > max_val:
s_typ = str_int(signed, bit_size)
lim = limits(signed, bit_size)
raise value_error('%d not in range of %s %s' % (value, s_typ, lim))
def assert_integers_in_range(values, signed, bit_size):
for value in values:
assert_int_in_range(value, signed, bit_size) |
def alternatingCharacters(s):
deleted = 0
for i in range(0,len(s)):
while True:
if i+1 < len(s):
if s[i] == s[i+1]:
s.pop(i+1)
deleted += 1
else:
break
else:
return deleted
return deleted
print(alternatingCharacters(['a','a','a','a']))
#WRONG ANSWERS ---- DO IT AGAIN
| def alternating_characters(s):
deleted = 0
for i in range(0, len(s)):
while True:
if i + 1 < len(s):
if s[i] == s[i + 1]:
s.pop(i + 1)
deleted += 1
else:
break
else:
return deleted
return deleted
print(alternating_characters(['a', 'a', 'a', 'a'])) |
class Solution:
# @param {integer[]} nums
# @return {integer[]}
def singleNumber(self, nums):
xor = reduce(operator.xor, nums)
res = reduce(operator.xor, (x for x in nums if x & xor & -xor))
return [res, res ^ xor]
| class Solution:
def single_number(self, nums):
xor = reduce(operator.xor, nums)
res = reduce(operator.xor, (x for x in nums if x & xor & -xor))
return [res, res ^ xor] |
class Solution:
def num_decodings(self, s: str) -> int:
self.memoize = {}
return self.find(s)
def find(self, s):
if s in self.memoize:
return self.memoize[s]
elif s == '':
return 1
else:
qty = 0
if int(s[:1]) > 0:
qty = self.find(s[1:])
self.memoize[s[1:]] = qty
if len(s) >= 2 and 0 < int(s[:2]) <= 26 and s[0] != '0':
qty += self.find(s[2:])
self.memoize[s[2:]] = qty - self.memoize[s[1:]]
return qty
if __name__ == '__main__':
solution = Solution()
s = ('927297167251227735495393942768951823971422829346'
'3398742522722274929422229859968434281231132695842184')
print(solution.num_decodings(s))
| class Solution:
def num_decodings(self, s: str) -> int:
self.memoize = {}
return self.find(s)
def find(self, s):
if s in self.memoize:
return self.memoize[s]
elif s == '':
return 1
else:
qty = 0
if int(s[:1]) > 0:
qty = self.find(s[1:])
self.memoize[s[1:]] = qty
if len(s) >= 2 and 0 < int(s[:2]) <= 26 and (s[0] != '0'):
qty += self.find(s[2:])
self.memoize[s[2:]] = qty - self.memoize[s[1:]]
return qty
if __name__ == '__main__':
solution = solution()
s = '9272971672512277354953939427689518239714228293463398742522722274929422229859968434281231132695842184'
print(solution.num_decodings(s)) |
"""
FUNCTIONS:
1. Write a Python function to find the Max of three numbers.
2. Write a Python program to reverse a string.
Sample String : "1234abcd"
Expected Output : "dcba4321"
3. Write a Python function to sum all the numbers in a list.
Sample List : (8, 2, 3, 0, 7)
Expected Output : 20
4. Write a Python function to calculate the factorial of a number
(a non-negative integer). The function accepts the number as an argument.
5. Write a Python function to multiply all the numbers in a list.
Sample List : (8, 2, 3, -1, 7)
Expected Output : -336
6. Write a Python function that accepts a string and calculate the number of
upper case letters and lower case letters.
Sample String : 'The quick Brow Fox'
Expected Output :
No. of Upper case characters : 3
No. of Lower case Characters : 12
7. Write a Python function that takes a list and returns a new list with unique
elements of the first list.
Sample List : [1,2,3,3,3,3,4,5]
Unique List : [1, 2, 3, 4, 5]
8. Write a Python function that takes a number as a parameter and check the
number is prime or not.
Note : A prime number (or a prime) is a natural number greater than 1 and that
has no positive divisors other than 1 and itself.
9. Write a Python program to make a chain of function decorators (bold, italic,
underline etc.) in Python.
10. Write a Python program to execute a string containing Python code.
11. Write a Python program to access a function inside a function.
12. Write a Python program to detect the number of local variables declared in
a function.
13. Write a Python program to print the even numbers from a given list.
Sample List : [1, 2, 3, 4, 5, 6, 7, 8, 9]
Expected Result : [2, 4, 6, 8]
14. Write a Python function to check whether a number is perfect or not.
According to Wikipedia : In number theory, a perfect number is a positive integer
that is equal to the sum of its proper positive divisors, that is, the sum of
its positive divisors excluding the number itself (also known as its aliquot sum).
Equivalently, a perfect number is a number that is half the sum of all of its
positive divisors (including itself).
Example : The first perfect number is 6, because 1, 2, and 3 are its proper
positive divisors, and 1 + 2 + 3 = 6. Equivalently, the number 6 is equal to
half the sum of all its positive divisors: ( 1 + 2 + 3 + 6 ) / 2 = 6. The next
perfect number is 28 = 1 + 2 + 4 + 7 + 14. This is followed by the perfect
numbers 496 and 8128.
15. Write a Python program that accepts a hyphen-separated sequence of words
as input and prints the words in a hyphen-separated sequence after sorting
them alphabetically.
Sample Items : green-red-yellow-black-white
Expected Result : black-green-red-white-yellow
MODULES:
Write Python module example with proper structure
""" | """
FUNCTIONS:
1. Write a Python function to find the Max of three numbers.
2. Write a Python program to reverse a string.
Sample String : "1234abcd"
Expected Output : "dcba4321"
3. Write a Python function to sum all the numbers in a list.
Sample List : (8, 2, 3, 0, 7)
Expected Output : 20
4. Write a Python function to calculate the factorial of a number
(a non-negative integer). The function accepts the number as an argument.
5. Write a Python function to multiply all the numbers in a list.
Sample List : (8, 2, 3, -1, 7)
Expected Output : -336
6. Write a Python function that accepts a string and calculate the number of
upper case letters and lower case letters.
Sample String : 'The quick Brow Fox'
Expected Output :
No. of Upper case characters : 3
No. of Lower case Characters : 12
7. Write a Python function that takes a list and returns a new list with unique
elements of the first list.
Sample List : [1,2,3,3,3,3,4,5]
Unique List : [1, 2, 3, 4, 5]
8. Write a Python function that takes a number as a parameter and check the
number is prime or not.
Note : A prime number (or a prime) is a natural number greater than 1 and that
has no positive divisors other than 1 and itself.
9. Write a Python program to make a chain of function decorators (bold, italic,
underline etc.) in Python.
10. Write a Python program to execute a string containing Python code.
11. Write a Python program to access a function inside a function.
12. Write a Python program to detect the number of local variables declared in
a function.
13. Write a Python program to print the even numbers from a given list.
Sample List : [1, 2, 3, 4, 5, 6, 7, 8, 9]
Expected Result : [2, 4, 6, 8]
14. Write a Python function to check whether a number is perfect or not.
According to Wikipedia : In number theory, a perfect number is a positive integer
that is equal to the sum of its proper positive divisors, that is, the sum of
its positive divisors excluding the number itself (also known as its aliquot sum).
Equivalently, a perfect number is a number that is half the sum of all of its
positive divisors (including itself).
Example : The first perfect number is 6, because 1, 2, and 3 are its proper
positive divisors, and 1 + 2 + 3 = 6. Equivalently, the number 6 is equal to
half the sum of all its positive divisors: ( 1 + 2 + 3 + 6 ) / 2 = 6. The next
perfect number is 28 = 1 + 2 + 4 + 7 + 14. This is followed by the perfect
numbers 496 and 8128.
15. Write a Python program that accepts a hyphen-separated sequence of words
as input and prints the words in a hyphen-separated sequence after sorting
them alphabetically.
Sample Items : green-red-yellow-black-white
Expected Result : black-green-red-white-yellow
MODULES:
Write Python module example with proper structure
""" |
side = 1080
frames = 48
def shape(thickness):
fill(0)
stroke(1)
strokeWidth(1)
with savedState():
rotate(startAngle + f * (endAngle - startAngle), (thickness*0.1, thickness*0.1))
rect(0 - (thickness/2), 0 - (thickness/2), thickness, thickness)
for i in range(frames):
phase = 2 * pi * i / frames
startAngle = 90 * sin(phase)
endAngle = 180 * sin(phase + 0.5 * pi)
f = i / side
points = []
x = side * 0.1
y = side * 0.9
points.append((x, y))
while x < side*0.9:
x += 2
if x < side*0.25:
y = (-5.3333 * (x - (side * 0.1))) + (side * 0.9)
elif x < side*0.5:
y = (3.2 * (x - (side * 0.25))) + (side * 0.1)
elif x < side*0.75:
y = (-3.2 * (x - (side * 0.5))) + (side * 0.9)
elif x < side*0.9:
y = (5.3333 * (x - (side * 0.75))) + (side * 0.1)
points.append((x, y))
newPage(side, side)
fill(0)
rect(0, 0, side, side)
for point in points:
with savedState():
translate(point[0], point[1])
shape(side*0.1)
saveImage('~/Desktop/23_36_DAYS_OF_TYPE_2020.mp4') | side = 1080
frames = 48
def shape(thickness):
fill(0)
stroke(1)
stroke_width(1)
with saved_state():
rotate(startAngle + f * (endAngle - startAngle), (thickness * 0.1, thickness * 0.1))
rect(0 - thickness / 2, 0 - thickness / 2, thickness, thickness)
for i in range(frames):
phase = 2 * pi * i / frames
start_angle = 90 * sin(phase)
end_angle = 180 * sin(phase + 0.5 * pi)
f = i / side
points = []
x = side * 0.1
y = side * 0.9
points.append((x, y))
while x < side * 0.9:
x += 2
if x < side * 0.25:
y = -5.3333 * (x - side * 0.1) + side * 0.9
elif x < side * 0.5:
y = 3.2 * (x - side * 0.25) + side * 0.1
elif x < side * 0.75:
y = -3.2 * (x - side * 0.5) + side * 0.9
elif x < side * 0.9:
y = 5.3333 * (x - side * 0.75) + side * 0.1
points.append((x, y))
new_page(side, side)
fill(0)
rect(0, 0, side, side)
for point in points:
with saved_state():
translate(point[0], point[1])
shape(side * 0.1)
save_image('~/Desktop/23_36_DAYS_OF_TYPE_2020.mp4') |
#define a dictionary data structure
#dictionaries have a key : value pair for elements
example_dict = {
"class":"Astr 119",
"prof":"Brant",
"awesomeness":10
}
print(type(example_dict))
#get a value using a key
course = example_dict["class"]
print(course)
#change a value using a key
example_dict["awesomeness"]+=1
print(example_dict)
#print element by element using a for loop
for x in example_dict.keys():
print(x,example_dict[x]) | example_dict = {'class': 'Astr 119', 'prof': 'Brant', 'awesomeness': 10}
print(type(example_dict))
course = example_dict['class']
print(course)
example_dict['awesomeness'] += 1
print(example_dict)
for x in example_dict.keys():
print(x, example_dict[x]) |
"""
Solution for Leet Code 657.
"""
class Solution:
def judgeCircle(moves):
i = j = 0
for move in moves:
if move is 'U':
i += 1
elif move is 'D':
i -= 1
elif move is 'L':
j += 1
else:
j -= 1
return i == j == 0
print(Solution.judgeCircle("UDUD")) | """
Solution for Leet Code 657.
"""
class Solution:
def judge_circle(moves):
i = j = 0
for move in moves:
if move is 'U':
i += 1
elif move is 'D':
i -= 1
elif move is 'L':
j += 1
else:
j -= 1
return i == j == 0
print(Solution.judgeCircle('UDUD')) |
class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 0
if len(nums) == 1:
return nums[0]
m = [0] * len(nums)
m[0] = nums[0]
m[1] = m[0] if m[0] > nums[1] else nums[1]
for i in range(2, len(nums)):
c = nums[i] + m[i - 2]
m[i] = c if c > m[i - 1] else m[i - 1]
return m[len(nums) - 1]
if __name__ == '__main__':
S = Solution()
print(S.rob([5,2,6,3,1,7])) | class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 0
if len(nums) == 1:
return nums[0]
m = [0] * len(nums)
m[0] = nums[0]
m[1] = m[0] if m[0] > nums[1] else nums[1]
for i in range(2, len(nums)):
c = nums[i] + m[i - 2]
m[i] = c if c > m[i - 1] else m[i - 1]
return m[len(nums) - 1]
if __name__ == '__main__':
s = solution()
print(S.rob([5, 2, 6, 3, 1, 7])) |
# Python 3 Program to find
# sum of Fibonacci numbers
# Computes value of first
# fibonacci numbers
def calculateSum(n) :
if (n <= 0) :
return 0
fibo =[0] * (n+1)
fibo[1] = 1
# Initialize result
sm = fibo[0] + fibo[1]
# Add remaining terms
for i in range(2,n+1) :
fibo[i] = fibo[i-1] + fibo[i-2]
sm = sm + fibo[i]
return sm
n=int(input())
print("Sum of Fibonacci numbers is : " ,
calculateSum(n))
| def calculate_sum(n):
if n <= 0:
return 0
fibo = [0] * (n + 1)
fibo[1] = 1
sm = fibo[0] + fibo[1]
for i in range(2, n + 1):
fibo[i] = fibo[i - 1] + fibo[i - 2]
sm = sm + fibo[i]
return sm
n = int(input())
print('Sum of Fibonacci numbers is : ', calculate_sum(n)) |
# Calculando descontos
produto = float(input('Qual o valor do produto ? R$ '))
novo = produto - (produto * 5 / 100)
print('O produto com 5% de desconto ficara : R$ {:.2f} '.format(novo))
| produto = float(input('Qual o valor do produto ? R$ '))
novo = produto - produto * 5 / 100
print('O produto com 5% de desconto ficara : R$ {:.2f} '.format(novo)) |
def can_build(env, platform):
return platform=="android" or platform=="iphone"
def configure(env):
if (env['platform'] == 'android'):
env.android_add_dependency("implementation \"com.android.support:support-v4:28.0.0\"")
env.android_add_dependency("implementation \"com.google.android.gms:play-services-location:16.0.0\"")
env.android_add_java_dir("android")
env.android_add_to_permissions("android/AndroidPermissionsChunk.xml")
env.disable_module()
if env['platform'] == "iphone":
env.Append(FRAMEWORKPATH=['modules/location/ios/lib'])
env.Append(LINKFLAGS=['-ObjC', '-framework','CoreLocation'])
| def can_build(env, platform):
return platform == 'android' or platform == 'iphone'
def configure(env):
if env['platform'] == 'android':
env.android_add_dependency('implementation "com.android.support:support-v4:28.0.0"')
env.android_add_dependency('implementation "com.google.android.gms:play-services-location:16.0.0"')
env.android_add_java_dir('android')
env.android_add_to_permissions('android/AndroidPermissionsChunk.xml')
env.disable_module()
if env['platform'] == 'iphone':
env.Append(FRAMEWORKPATH=['modules/location/ios/lib'])
env.Append(LINKFLAGS=['-ObjC', '-framework', 'CoreLocation']) |
class Node(object):
TRUE = 't'
FALSE = 'f'
QUERY = '?'
NOTHING = '-'
def __init__(self, name):
self.name = name
self.status = self.NOTHING
self.cpt = []
self.index = None
self.__children = []
self.__parents = []
return
def __str__(self):
return self.name
def addCPT(self, cpt):
self.cpt = cpt
def addChild(self, node):
self.__children.append(node)
node.__parents.append(self)
def children(self):
return self.__children
def parents(self):
return self.__parents
| class Node(object):
true = 't'
false = 'f'
query = '?'
nothing = '-'
def __init__(self, name):
self.name = name
self.status = self.NOTHING
self.cpt = []
self.index = None
self.__children = []
self.__parents = []
return
def __str__(self):
return self.name
def add_cpt(self, cpt):
self.cpt = cpt
def add_child(self, node):
self.__children.append(node)
node.__parents.append(self)
def children(self):
return self.__children
def parents(self):
return self.__parents |
# -*- coding: utf-8 -*-
'''
File name: code\su_doku\sol_96.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #96 :: Su Doku
#
# For more information see:
# https://projecteuler.net/problem=96
# Problem Statement
'''
Su Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.
0 0 39 0 00 0 1
0 2 03 0 58 0 6
6 0 00 0 14 0 0
0 0 87 0 00 0 6
1 0 20 0 07 0 8
9 0 00 0 82 0 0
0 0 28 0 00 0 5
6 0 92 0 30 1 0
5 0 00 0 93 0 0
4 8 39 6 72 5 1
9 2 13 4 58 7 6
6 5 78 2 14 9 3
5 4 87 2 91 3 6
1 3 25 6 47 9 8
9 7 61 3 82 4 5
3 7 28 1 46 9 5
6 8 92 5 34 1 7
5 1 47 6 93 8 2
A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.
The 6K text file, sudoku.txt (right click and 'Save Link/Target As...'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).
By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above.
'''
# Solution
# Solution Approach
'''
'''
| """
File name: code\\su_doku\\sol_96.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
'\nSu Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.\n\n\n0 0 39 0 00 0 1\n0 2 03 0 58 0 6\n6 0 00 0 14 0 0\n0 0 87 0 00 0 6\n1 0 20 0 07 0 8\n9 0 00 0 82 0 0\n0 0 28 0 00 0 5\n6 0 92 0 30 1 0\n5 0 00 0 93 0 0\n\n\n\n4 8 39 6 72 5 1\n9 2 13 4 58 7 6\n6 5 78 2 14 9 3\n5 4 87 2 91 3 6\n1 3 25 6 47 9 8\n9 7 61 3 82 4 5\n3 7 28 1 46 9 5\n6 8 92 5 34 1 7\n5 1 47 6 93 8 2\n\n\nA well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.\nThe 6K text file, sudoku.txt (right click and \'Save Link/Target As...\'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).\nBy solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above.\n'
'\n' |
array = [list(map(int, input().split())) for i in range(5)]
check = [list(map(int, input().split())) for i in range(5)]
def checkBingo(arr):
bingoNum = 0
rightSlide = 0
leftSlide = 0
for i in range(5):
colZeroNum = 0
verZeroNum = 0
for j in range(5):
if(arr[i][j] == 0):
colZeroNum += 1
if(arr[j][i] == 0):
verZeroNum += 1
if(i == j and arr[i][j]==0):
rightSlide += 1
if((i + j) == 4 and arr[i][j]==0):
leftSlide += 1
if(colZeroNum == 5):
bingoNum+=1
if(verZeroNum == 5):
bingoNum+=1
if(leftSlide == 5):
bingoNum+=1
if(rightSlide == 5):
bingoNum+=1
return bingoNum
def checkArr(num, arr):
for i in range(5):
for j in range(5):
if(arr[i][j] == num):
arr[i][j] = 0
bingoNum = checkBingo(arr)
return bingoNum
for i in range(5):
for j in range(5):
bingonum = checkArr(check[i][j], array)
#print(array)
if(bingonum >= 3):
print(i * 5 + j + 1)
break
if(bingonum >= 3):
break
| array = [list(map(int, input().split())) for i in range(5)]
check = [list(map(int, input().split())) for i in range(5)]
def check_bingo(arr):
bingo_num = 0
right_slide = 0
left_slide = 0
for i in range(5):
col_zero_num = 0
ver_zero_num = 0
for j in range(5):
if arr[i][j] == 0:
col_zero_num += 1
if arr[j][i] == 0:
ver_zero_num += 1
if i == j and arr[i][j] == 0:
right_slide += 1
if i + j == 4 and arr[i][j] == 0:
left_slide += 1
if colZeroNum == 5:
bingo_num += 1
if verZeroNum == 5:
bingo_num += 1
if leftSlide == 5:
bingo_num += 1
if rightSlide == 5:
bingo_num += 1
return bingoNum
def check_arr(num, arr):
for i in range(5):
for j in range(5):
if arr[i][j] == num:
arr[i][j] = 0
bingo_num = check_bingo(arr)
return bingoNum
for i in range(5):
for j in range(5):
bingonum = check_arr(check[i][j], array)
if bingonum >= 3:
print(i * 5 + j + 1)
break
if bingonum >= 3:
break |
def seq_search(lst, element):
pos = 0
found = False
while pos < len(lst) and not found:
if lst[pos] == element:
found = True
else:
pos += 1
return found
arr = [1,2,3,4,5,56]
print(seq_search(arr,3))
print(seq_search(arr,56))
print(seq_search(arr,1))
print(seq_search(arr,6)) | def seq_search(lst, element):
pos = 0
found = False
while pos < len(lst) and (not found):
if lst[pos] == element:
found = True
else:
pos += 1
return found
arr = [1, 2, 3, 4, 5, 56]
print(seq_search(arr, 3))
print(seq_search(arr, 56))
print(seq_search(arr, 1))
print(seq_search(arr, 6)) |
#!/usr/bin/env python3
# https://abc061.contest.atcoder.jp/tasks/abc061_b
n, m = map(int, input().split())
a = [0] * n
for _ in range(m):
u, v = map(int, input().split())
a[u - 1] += 1
a[v - 1] += 1
for x in a: print(x)
| (n, m) = map(int, input().split())
a = [0] * n
for _ in range(m):
(u, v) = map(int, input().split())
a[u - 1] += 1
a[v - 1] += 1
for x in a:
print(x) |
languages = [
{
'language' : 'lang_cpp',
'display_name' : 'C++',
'build_configurations' :
[
{
'compiler': 'msvc',
'builder': 'build_cpp_sources_with_msvc',
},
{
'compiler': 'gcc',
'builder': 'build_cpp_sources_with_gcc',
},
{
'compiler': 'clang',
'builder': 'build_cpp_sources_with_clang',
}
]
},
{
'language' : 'lang_d',
'display_name' : 'D',
'build_configurations' :
[
{
'compiler' : 'dmd',
'builder' : 'build_d_sources_with_dmd',
},
{
'compiler' : 'gdc',
'builder' : 'build_d_sources_with_gdc',
},
{
'compiler' : 'ldc',
'builder' : 'build_d_sources_with_ldc',
}
]
},
{
'language' : 'lang_go',
'display_name' : 'Go',
'build_configurations' :
[
{
'compiler' : 'go',
'builder' : 'build_go_sources',
},
{
'compiler' : 'gccgo',
'builder' : 'build_go_sources_with_gccgo',
}
]
}
]
| languages = [{'language': 'lang_cpp', 'display_name': 'C++', 'build_configurations': [{'compiler': 'msvc', 'builder': 'build_cpp_sources_with_msvc'}, {'compiler': 'gcc', 'builder': 'build_cpp_sources_with_gcc'}, {'compiler': 'clang', 'builder': 'build_cpp_sources_with_clang'}]}, {'language': 'lang_d', 'display_name': 'D', 'build_configurations': [{'compiler': 'dmd', 'builder': 'build_d_sources_with_dmd'}, {'compiler': 'gdc', 'builder': 'build_d_sources_with_gdc'}, {'compiler': 'ldc', 'builder': 'build_d_sources_with_ldc'}]}, {'language': 'lang_go', 'display_name': 'Go', 'build_configurations': [{'compiler': 'go', 'builder': 'build_go_sources'}, {'compiler': 'gccgo', 'builder': 'build_go_sources_with_gccgo'}]}] |
"""
This module contains the various utilities that may be useful in lab
anaylysis and operating on the waveforms.
"""
| """
This module contains the various utilities that may be useful in lab
anaylysis and operating on the waveforms.
""" |
# Python Comments
# Single line comment
print("End of line comment, which will ignore anything after # and treat is as comment \n\n") # End of line comments
# This
# is
# Multi line comments
print("Multi line comment is nothing but using the # to be prefixed at start of the line.\n\n")
"""
Well this
is also another way to write
multi line comments.
This is actually a string value in multi line
since this is not assigned to any variable,
it is treated as multi line comments.
Let's see it by assigning a variable and print the variable
to see what will happen.
"""
# print(f"Lets print the multiline string \n {s1}")
x = 4
y = 2
z = 0
# z = x + y
# z = x - y
print(z)
print("This is used while debugging, its single line "
"comment but we have commented the code logic itself"
" which will be ignored by the Python interpreter while executing")
| print('End of line comment, which will ignore anything after # and treat is as comment \n\n')
print('Multi line comment is nothing but using the # to be prefixed at start of the line.\n\n')
"\nWell this\nis also another way to write\nmulti line comments.\nThis is actually a string value in multi line\nsince this is not assigned to any variable,\nit is treated as multi line comments.\n\nLet's see it by assigning a variable and print the variable\nto see what will happen. \n"
x = 4
y = 2
z = 0
print(z)
print('This is used while debugging, its single line comment but we have commented the code logic itself which will be ignored by the Python interpreter while executing') |
# %%
# Ensure the target is unchanged
# assert all(y_tr.sort_index() == original_y_train.sort_index())
# Ensure the target is unchanged (unshuffled!)
# assert all(y_tr == original_y_train)
# %% Predict on X_tr for comparison
y_tr_predicted = clf_grid_BEST.predict(X_tr)
# original_y_train.value_counts()
# y_tr.cat.codes.value_counts()
# y_tr_predicted.value_counts()
# y_tr.value_counts()
train_kappa = kappa(y_tr, y_tr_predicted)
logging.info("Metric on training set: {:0.3f}".format(train_kappa))
# these_labels = list(label_maps['AdoptionSpeed'].values())
sk.metrics.confusion_matrix(y_tr, y_tr_predicted)
#%% Predict on X_cv for cross validation
if CV_FRACTION > 0:
y_cv_predicted = clf_grid_BEST.predict(X_cv)
train_kappa_cv = kappa(y_cv, y_cv_predicted)
logging.info("Metric on Cross Validation set: {:0.3f}".format(train_kappa_cv))
sk.metrics.confusion_matrix(y_cv, y_cv_predicted)
#%% Predict on Test set
# NB we only want the defaulters column!
logging.info("Predicting on X_te".format())
predicted = clf_grid_BEST.predict(X_te)
# raise "Lost the sorting of y!"
#%% Open the submission
# with zipfile.ZipFile(path_data / "test.zip").open("sample_submission.csv") as f:
# df_submission = pd.read_csv(f, delimiter=',')
logging.info("Creating submission".format())
df_submission_template = pd.read_csv(path_data / 'test' / 'sample_submission.csv', delimiter=',')
df_submission = pd.DataFrame({'PetID': df_submission_template.PetID, 'AdoptionSpeed': [int(i) for i in predicted]})
#%% Collect predicitons
df_submission.head()
#%% Create csv
logging.info("Saving submission to csv.".format())
df_submission.to_csv('submission.csv', index=False) | y_tr_predicted = clf_grid_BEST.predict(X_tr)
train_kappa = kappa(y_tr, y_tr_predicted)
logging.info('Metric on training set: {:0.3f}'.format(train_kappa))
sk.metrics.confusion_matrix(y_tr, y_tr_predicted)
if CV_FRACTION > 0:
y_cv_predicted = clf_grid_BEST.predict(X_cv)
train_kappa_cv = kappa(y_cv, y_cv_predicted)
logging.info('Metric on Cross Validation set: {:0.3f}'.format(train_kappa_cv))
sk.metrics.confusion_matrix(y_cv, y_cv_predicted)
logging.info('Predicting on X_te'.format())
predicted = clf_grid_BEST.predict(X_te)
logging.info('Creating submission'.format())
df_submission_template = pd.read_csv(path_data / 'test' / 'sample_submission.csv', delimiter=',')
df_submission = pd.DataFrame({'PetID': df_submission_template.PetID, 'AdoptionSpeed': [int(i) for i in predicted]})
df_submission.head()
logging.info('Saving submission to csv.'.format())
df_submission.to_csv('submission.csv', index=False) |
def fun(a,b,c,d,e,f):
if(a>=d and b>=e and c>=f) and (a>d or b>e or c>f):
return 1
elif(a<=d and b<=e and c<=f) and (a<d or b<e or c<f):
return 1
return 0
for i in range(int(input())):
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
c = [int(j) for j in input().split()]
if(fun(a[0],a[1],a[2],b[0],b[1],b[2]) and fun(a[0],a[1],a[2],c[0],c[1],c[2]) and fun(c[0],c[1],c[2],b[0],b[1],b[2])):
print('yes')
else:
print('no')
| def fun(a, b, c, d, e, f):
if (a >= d and b >= e and (c >= f)) and (a > d or b > e or c > f):
return 1
elif (a <= d and b <= e and (c <= f)) and (a < d or b < e or c < f):
return 1
return 0
for i in range(int(input())):
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
c = [int(j) for j in input().split()]
if fun(a[0], a[1], a[2], b[0], b[1], b[2]) and fun(a[0], a[1], a[2], c[0], c[1], c[2]) and fun(c[0], c[1], c[2], b[0], b[1], b[2]):
print('yes')
else:
print('no') |
"""
Demos on some detailed use cases for Dragonfly. We use domains and configurations
from an electrolyte design task, but use synthetic functions instead.
-- kirthevasank
"""
| """
Demos on some detailed use cases for Dragonfly. We use domains and configurations
from an electrolyte design task, but use synthetic functions instead.
-- kirthevasank
""" |
class TwoSum:
def __init__(self, arr , target: int) :
self.arr = arr
self.target = target
def get_to_sum(self):
i = 0
while i<len(arr):
val = target - arr[i]
if val in arr[i+1:]:
return [i, arr.index(val, i+1)]
else:
i += 1
if __name__ == "__main__":
arr = [3,2,4]
target = 6
two_sum = TwoSum(arr=arr, target=target)
print(two_sum.get_to_sum()) # [1,2]
| class Twosum:
def __init__(self, arr, target: int):
self.arr = arr
self.target = target
def get_to_sum(self):
i = 0
while i < len(arr):
val = target - arr[i]
if val in arr[i + 1:]:
return [i, arr.index(val, i + 1)]
else:
i += 1
if __name__ == '__main__':
arr = [3, 2, 4]
target = 6
two_sum = two_sum(arr=arr, target=target)
print(two_sum.get_to_sum()) |
def all_are_none(*args) -> bool:
"""
Return True if all args are None.
"""
return all([arg is None for arg in args])
def none_are_none(*args) -> bool:
"""
Return True if no args are None.
"""
return not any([arg is None for arg in args])
def any_are_not_none(*args) -> bool:
"""
Return True if any arg is not None.
"""
return any([arg is not None for arg in args])
def any_are_none(*args) -> bool:
"""
Return True if any arg is None.
"""
return any([arg is None for arg in args])
def one_is_none(*args) -> bool:
"""
Return True if exactly one arg is None.
"""
return sum([arg is None for arg in args]) == 1
def one_is_not_none(*args) -> bool:
"""
Return True if exactly one arg is not None.
"""
return sum([arg is not None for arg in args]) == 1
| def all_are_none(*args) -> bool:
"""
Return True if all args are None.
"""
return all([arg is None for arg in args])
def none_are_none(*args) -> bool:
"""
Return True if no args are None.
"""
return not any([arg is None for arg in args])
def any_are_not_none(*args) -> bool:
"""
Return True if any arg is not None.
"""
return any([arg is not None for arg in args])
def any_are_none(*args) -> bool:
"""
Return True if any arg is None.
"""
return any([arg is None for arg in args])
def one_is_none(*args) -> bool:
"""
Return True if exactly one arg is None.
"""
return sum([arg is None for arg in args]) == 1
def one_is_not_none(*args) -> bool:
"""
Return True if exactly one arg is not None.
"""
return sum([arg is not None for arg in args]) == 1 |
mod = pow(10, 9)+7
match = dict()
for i in range(26):
match[chr(i+97)] = i+1
def rabin_karp(text, pattern):
n, m = len(text), len(pattern)
if n < m:
return False
hash_pattern = 0
i = 0
for p in pattern[::-1]:
hash_pattern = (hash_pattern + pow(26, i, mod) * match[p]) % mod
i += 1
hash_window = 0
i = 0
for t in text[:m][::-1]:
hash_window = (hash_window + pow(26, i, mod) * match[t]) % mod
i += 1
i = m-1
while i < n:
if hash_pattern == hash_window:
j, k = i-m+1, 0
r = True
while k < m:
if pattern[k] != text[j]:
r = False
break
j += 1
k += 1
if r:
return r
hash_window = (hash_window - pow(26, m-1, mod) * match[text[i-m+1]] + mod) % mod
i += 1
if i < n:
hash_window = (hash_window * 26) % mod
hash_window = (hash_window + match[text[i]]) % mod
return False
print(rabin_karp("opaospanwapaosopanwarlosj", "panwar"))
| mod = pow(10, 9) + 7
match = dict()
for i in range(26):
match[chr(i + 97)] = i + 1
def rabin_karp(text, pattern):
(n, m) = (len(text), len(pattern))
if n < m:
return False
hash_pattern = 0
i = 0
for p in pattern[::-1]:
hash_pattern = (hash_pattern + pow(26, i, mod) * match[p]) % mod
i += 1
hash_window = 0
i = 0
for t in text[:m][::-1]:
hash_window = (hash_window + pow(26, i, mod) * match[t]) % mod
i += 1
i = m - 1
while i < n:
if hash_pattern == hash_window:
(j, k) = (i - m + 1, 0)
r = True
while k < m:
if pattern[k] != text[j]:
r = False
break
j += 1
k += 1
if r:
return r
hash_window = (hash_window - pow(26, m - 1, mod) * match[text[i - m + 1]] + mod) % mod
i += 1
if i < n:
hash_window = hash_window * 26 % mod
hash_window = (hash_window + match[text[i]]) % mod
return False
print(rabin_karp('opaospanwapaosopanwarlosj', 'panwar')) |
class GenericRetriesHandler:
def __init__(self, *args, **kwargs):
self.count = 0
def is_eligible(self, response):
raise NotImplementedError
def increment(self):
self.count += 1
| class Genericretrieshandler:
def __init__(self, *args, **kwargs):
self.count = 0
def is_eligible(self, response):
raise NotImplementedError
def increment(self):
self.count += 1 |
class Solution(object):
def rotateString(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
"""
if not all([A, B]):
return A == B
if len(A) != len(B):
return False
pos = B.rfind(A[0])
while pos != -1:
if self.isRotate(A, B, pos):
return True
pos = B.rfind(A[0],0, pos-1)
def isRotate(A, B, pos):
pass
def rotateString01(self, A, B):
if not all([A, B]):
return A == B
if len(A) != len(B):
return False
for i in range(0, len(A)):
head = A[0]
A = A[1:] + head
if A == B:
return True
return False
| class Solution(object):
def rotate_string(self, A, B):
"""
:type A: str
:type B: str
:rtype: bool
"""
if not all([A, B]):
return A == B
if len(A) != len(B):
return False
pos = B.rfind(A[0])
while pos != -1:
if self.isRotate(A, B, pos):
return True
pos = B.rfind(A[0], 0, pos - 1)
def is_rotate(A, B, pos):
pass
def rotate_string01(self, A, B):
if not all([A, B]):
return A == B
if len(A) != len(B):
return False
for i in range(0, len(A)):
head = A[0]
a = A[1:] + head
if A == B:
return True
return False |
def get_answer(lines):
# print(lines)
lowwater = 0
highwater = len(lines) - 1
j = highwater
# print(f"highwater= {highwater}, lowwater= {lowwater}")
while lowwater < j:
sum = lines[lowwater] + lines[j]
if sum == 2020:
return(lines[lowwater] * lines[j])
elif lowwater == (j-1) or sum < 2020:
lowwater += 1
j = highwater
elif sum > 2020:
j -= 1
print(f"highwater= {j}, lowwater= {lowwater}")
return(0)
def main():
lines = []
with open("01-input-sorted") as fp:
for line in fp:
lines.append(int(line))
answer = get_answer(lines)
if answer > 0:
print(answer)
else:
print("No answer")
if __name__ == '__main__':
main()
| def get_answer(lines):
lowwater = 0
highwater = len(lines) - 1
j = highwater
while lowwater < j:
sum = lines[lowwater] + lines[j]
if sum == 2020:
return lines[lowwater] * lines[j]
elif lowwater == j - 1 or sum < 2020:
lowwater += 1
j = highwater
elif sum > 2020:
j -= 1
print(f'highwater= {j}, lowwater= {lowwater}')
return 0
def main():
lines = []
with open('01-input-sorted') as fp:
for line in fp:
lines.append(int(line))
answer = get_answer(lines)
if answer > 0:
print(answer)
else:
print('No answer')
if __name__ == '__main__':
main() |
#===========================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#============================================================================
# Copyright (C) 2005 XenSource Ltd
#============================================================================
def isCharConvertible(c):
"""Assert that the given value is convertible to a character using the %c
conversion. This implies that c is either an integer, or a character
(i.e. a string of length 1).
"""
assert (isinstance(c, int) or
(isinstance(c, str) and
len(c) == 1)), "%s is not convertible to a character" % c
| def is_char_convertible(c):
"""Assert that the given value is convertible to a character using the %c
conversion. This implies that c is either an integer, or a character
(i.e. a string of length 1).
"""
assert isinstance(c, int) or (isinstance(c, str) and len(c) == 1), '%s is not convertible to a character' % c |
defaults = {
"Wiki homepage": "Contents",
"Default tab on page load": ("History", "Articles", "Tabs"),
"Save pasted images as": ("JPEG", "PNG"),
}
DB_SCHEMA = 0
PRODUCT_NAME = "Folio"
PRODUCT_VERSION = "0.0.7a"
PRODUCT = f"{PRODUCT_NAME} ver {PRODUCT_VERSION}"
| defaults = {'Wiki homepage': 'Contents', 'Default tab on page load': ('History', 'Articles', 'Tabs'), 'Save pasted images as': ('JPEG', 'PNG')}
db_schema = 0
product_name = 'Folio'
product_version = '0.0.7a'
product = f'{PRODUCT_NAME} ver {PRODUCT_VERSION}' |
qtd=(int(input("Enter with the quantity: ")))
if(qtd<1):
while True:
print("Error! The quantity needs to be positive")
qtd=(int(input("Enter with the quantity: ")))
if not(qtd<1):
break
def converter(number):
return number*-1
number=[]
for i in range(qtd):
number.append(float(input("Enter with the number: ")))
if(number[i]<0):
print("This position in list had the negative number converted to be a positive number")
print("Pre-converted number: ", number[i])
number[i]=converter(number[i])
print("Converted number: ", number[i])
elif(number[i]>0):
print("This position in list had the positive number converted to be a negative number")
print("Pre-converted number: ", number[i])
number[i]=converter(number[i])
print("Converted number: ", number[i])
else:
print("Zero is a neutral number")
| qtd = int(input('Enter with the quantity: '))
if qtd < 1:
while True:
print('Error! The quantity needs to be positive')
qtd = int(input('Enter with the quantity: '))
if not qtd < 1:
break
def converter(number):
return number * -1
number = []
for i in range(qtd):
number.append(float(input('Enter with the number: ')))
if number[i] < 0:
print('This position in list had the negative number converted to be a positive number')
print('Pre-converted number: ', number[i])
number[i] = converter(number[i])
print('Converted number: ', number[i])
elif number[i] > 0:
print('This position in list had the positive number converted to be a negative number')
print('Pre-converted number: ', number[i])
number[i] = converter(number[i])
print('Converted number: ', number[i])
else:
print('Zero is a neutral number') |
class Bar:
def __init__(
self,
ticker: str,
ts: int,
open: float,
high: float,
low: float,
close: float,
adj_close: float,
volume: int,
_id: int = None
) -> None:
self.id = _id
self.ticker = ticker
self.date = ts
self.open = open
self.high = high
self.low = low
self.close = close
self.adj_close = adj_close
self.volume = volume
class Bars:
def __init__(self, bar) -> None:
self.bar = bar
def save(self) -> None:
pass
def add(self):
pass
| class Bar:
def __init__(self, ticker: str, ts: int, open: float, high: float, low: float, close: float, adj_close: float, volume: int, _id: int=None) -> None:
self.id = _id
self.ticker = ticker
self.date = ts
self.open = open
self.high = high
self.low = low
self.close = close
self.adj_close = adj_close
self.volume = volume
class Bars:
def __init__(self, bar) -> None:
self.bar = bar
def save(self) -> None:
pass
def add(self):
pass |
"""Hello World
https://exercism.org/tracks/python/exercises/hello-world
"""
def hello() -> str:
"""Hello.
Returns:
str: Hello world response.
"""
return "Hello, World!"
| """Hello World
https://exercism.org/tracks/python/exercises/hello-world
"""
def hello() -> str:
"""Hello.
Returns:
str: Hello world response.
"""
return 'Hello, World!' |
#quick Sorting
def quick_sort(list):
if len(list)<2:
return list
else:
pivot=int(list.pop())
right_items,left_items=[],[]
for item in list:
if int(item)>pivot:
right_items.append(int(item))
else:
left_items.append(int(item))
return quick_sort(left_items)+[pivot]+quick_sort(right_items)
a=input("enter numbers separated by space :"). split()
print(quick_sort(a))
| def quick_sort(list):
if len(list) < 2:
return list
else:
pivot = int(list.pop())
(right_items, left_items) = ([], [])
for item in list:
if int(item) > pivot:
right_items.append(int(item))
else:
left_items.append(int(item))
return quick_sort(left_items) + [pivot] + quick_sort(right_items)
a = input('enter numbers separated by space :').split()
print(quick_sort(a)) |
TABLE_CLOTH_DELTA = 0.6
TABLE_CLOTH_TEXTILE_PRICE = 7
CARRE_TEXTILE_PRICE = 9
USD_TO_BGN = 1.85
number_of_tables = int(input('Rectangular tables'))
table_length = float(input('Tables length'))
table_width = float(input('Table width'))
area_table_cloth = (table_length + TABLE_CLOTH_DELTA) * (table_width + TABLE_CLOTH_DELTA)
carre_side = table_length / 2
area_carre = carre_side ** 2
needed_table_cloth = number_of_tables * area_table_cloth
needed_carre_cloth = number_of_tables * area_carre
cloth_price = needed_table_cloth * TABLE_CLOTH_TEXTILE_PRICE
carre_price = needed_carre_cloth * CARRE_TEXTILE_PRICE
total_usd = carre_price + cloth_price
total_bgn = total_usd * USD_TO_BGN
print(f'{total_usd:.2f} USD')
print(f'{total_bgn:.2f} BGN')
| table_cloth_delta = 0.6
table_cloth_textile_price = 7
carre_textile_price = 9
usd_to_bgn = 1.85
number_of_tables = int(input('Rectangular tables'))
table_length = float(input('Tables length'))
table_width = float(input('Table width'))
area_table_cloth = (table_length + TABLE_CLOTH_DELTA) * (table_width + TABLE_CLOTH_DELTA)
carre_side = table_length / 2
area_carre = carre_side ** 2
needed_table_cloth = number_of_tables * area_table_cloth
needed_carre_cloth = number_of_tables * area_carre
cloth_price = needed_table_cloth * TABLE_CLOTH_TEXTILE_PRICE
carre_price = needed_carre_cloth * CARRE_TEXTILE_PRICE
total_usd = carre_price + cloth_price
total_bgn = total_usd * USD_TO_BGN
print(f'{total_usd:.2f} USD')
print(f'{total_bgn:.2f} BGN') |
# Copyright 2009-2017 Ram Rachum.
# This program is distributed under the MIT license.
data = '''James
John
Robert
Michael
William
David
Richard
Charles
Joseph
Thomas
Christopher
Daniel
Paul
Mark
Donald
George
Kenneth
Steven
Edward
Brian
Ronald
Anthony
Kevin
Jason
Matthew
Gary
Timothy
Jose
Larry
Jeffrey
Frank
Scott
Eric
Stephen
Andrew
Raymond
Gregory
Joshua
Jerry
Dennis
Walter
Patrick
Peter
Harold
Douglas
Henry
Carl
Arthur
Ryan
Roger
Joe
Juan
Jack
Albert
Jonathan
Justin
Terry
Gerald
Keith
Samuel
Willie
Ralph
Lawrence
Nicholas
Roy
Benjamin
Bruce
Brandon
Adam
Harry
Fred
Wayne
Billy
Steve
Louis
Jeremy
Aaron
Randy
Howard
Eugene
Carlos
Russell
Bobby
Victor
Martin
Ernest
Phillip
Todd
Jesse
Craig
Alan
Shawn
Clarence
Sean
Philip
Chris
Johnny
Earl
Jimmy
Antonio
Danny
Bryan
Tony
Luis
Mike
Stanley
Leonard
Nathan
Dale
Manuel
Rodney
Curtis
Norman
Allen
Marvin
Vincent
Glenn
Jeffery
Travis
Jeff
Chad
Jacob
Lee
Melvin
Alfred
Kyle
Francis
Bradley
Jesus
Herbert
Frederick
Ray
Joel
Edwin
Don
Eddie
Ricky
Troy
Randall
Barry
Alexander
Bernard
Mario
Leroy
Francisco
Marcus
Micheal
Theodore
Clifford
Miguel
Oscar
Jay
Jim
Tom
Calvin
Alex
Jon
Ronnie
Bill
Lloyd
Tommy
Leon
Derek
Warren
Darrell
Jerome
Floyd
Leo
Alvin
Tim
Wesley
Gordon
Dean
Greg
Jorge
Dustin
Pedro
Derrick
Dan
Lewis
Zachary
Corey
Herman
Maurice
Vernon
Roberto
Clyde
Glen
Hector
Shane
Ricardo
Sam
Rick
Lester
Brent
Ramon
Charlie
Tyler
Gilbert
Gene
Marc
Reginald
Ruben
Brett
Angel
Nathaniel
Rafael
Leslie
Edgar
Milton
Raul
Ben
Chester
Cecil
Duane
Franklin
Andre
Elmer
Brad
Gabriel
Ron
Mitchell
Roland
Arnold
Harvey
Jared
Adrian
Karl
Cory
Claude
Erik
Darryl
Jamie
Neil
Jessie
Christian
Javier
Fernando
Clinton
Ted
Mathew
Tyrone
Darren
Lonnie
Lance
Cody
Julio
Kelly
Kurt
Allan
Nelson
Guy
Clayton
Hugh
Max
Dwayne
Dwight
Armando
Felix
Jimmie
Everett
Jordan
Ian
Wallace
Ken
Bob
Jaime
Casey
Alfredo
Alberto
Dave
Ivan
Johnnie
Sidney
Byron
Julian
Isaac
Morris
Clifton
Willard
Daryl
Ross
Virgil
Andy
Marshall
Salvador
Perry
Kirk
Sergio
Marion
Tracy
Seth
Kent
Terrance
Rene
Eduardo
Terrence
Enrique
Freddie
Wade
Austin
Stuart
Fredrick
Arturo
Alejandro
Jackie
Joey
Nick
Luther
Wendell
Jeremiah
Evan
Julius
Dana
Donnie
Otis
Shannon
Trevor
Oliver
Luke
Homer
Gerard
Doug
Kenny
Hubert
Angelo
Shaun
Lyle
Matt
Lynn
Alfonso
Orlando
Rex
Carlton
Ernesto
Cameron
Neal
Pablo
Lorenzo
Omar
Wilbur
Blake
Grant
Horace
Roderick
Kerry
Abraham
Willis
Rickey
Jean
Ira
Andres
Cesar
Johnathan
Malcolm
Rudolph
Damon
Kelvin
Rudy
Preston
Alton
Archie
Marco
Wm
Pete
Randolph
Garry
Geoffrey
Jonathon
Felipe
Bennie
Gerardo
Ed
Dominic
Robin
Loren
Delbert
Colin
Guillermo
Earnest
Lucas
Benny
Noel
Spencer
Rodolfo
Myron
Edmund
Garrett
Salvatore
Cedric
Lowell
Gregg
Sherman
Wilson
Devin
Sylvester
Kim
Roosevelt
Israel
Jermaine
Forrest
Wilbert
Leland
Simon
Guadalupe
Clark
Irving
Carroll
Bryant
Owen
Rufus
Woodrow
Sammy
Kristopher
Mack
Levi
Marcos
Gustavo
Jake
Lionel
Marty
Taylor
Ellis
Dallas
Gilberto
Clint
Nicolas
Laurence
Ismael
Orville
Drew
Jody
Ervin
Dewey
Al
Wilfred
Josh
Hugo
Ignacio
Caleb
Tomas
Sheldon
Erick
Frankie
Stewart
Doyle
Darrel
Rogelio
Terence
Santiago
Alonzo
Elias
Bert
Elbert
Ramiro
Conrad
Pat
Noah
Grady
Phil
Cornelius
Lamar
Rolando
Clay
Percy
Dexter
Bradford
Merle
Darin
Amos
Terrell
Moses
Irvin
Saul
Roman
Darnell
Randal
Tommie
Timmy
Darrin
Winston
Brendan
Toby
Van
Abel
Dominick
Boyd
Courtney
Jan
Emilio
Elijah
Cary
Domingo
Santos
Aubrey
Emmett
Marlon
Emanuel
Jerald
Edmond
Emil
Dewayne
Will
Otto
Teddy
Reynaldo
Bret
Morgan
Jess
Trent
Humberto
Emmanuel
Stephan
Louie
Vicente
Lamont
Stacy
Garland
Miles
Micah
Efrain
Billie
Logan
Heath
Rodger
Harley
Demetrius
Ethan
Eldon
Rocky
Pierre
Junior
Freddy
Eli
Bryce
Antoine
Robbie
Kendall
Royce
Sterling
Mickey
Chase
Grover
Elton
Cleveland
Dylan
Chuck
Damian
Reuben
Stan
August
Leonardo
Jasper
Russel
Erwin
Benito
Hans
Monte
Blaine
Ernie
Curt
Quentin
Agustin
Murray
Jamal
Devon
Adolfo
Harrison
Tyson
Burton
Brady
Elliott
Wilfredo
Bart
Jarrod
Vance
Denis
Damien
Joaquin
Harlan
Desmond
Elliot
Darwin
Ashley
Gregorio
Buddy
Xavier
Kermit
Roscoe
Esteban
Anton
Solomon
Scotty
Norbert
Elvin
Williams
Nolan
Carey
Rod
Quinton
Hal
Brain
Rob
Elwood
Kendrick
Darius
Moises
Son
Marlin
Fidel
Thaddeus
Cliff
Marcel
Ali
Jackson
Raphael
Bryon
Armand
Alvaro
Jeffry
Dane
Joesph
Thurman
Ned
Sammie
Rusty
Michel
Monty
Rory
Fabian
Reggie
Mason
Graham
Kris
Isaiah
Vaughn
Gus
Avery
Loyd
Diego
Alexis
Adolph
Norris
Millard
Rocco
Gonzalo
Derick
Rodrigo
Gerry
Stacey
Carmen
Wiley
Rigoberto
Alphonso
Ty
Shelby
Rickie
Noe
Vern
Bobbie
Reed
Jefferson
Elvis
Bernardo
Mauricio
Hiram
Donovan
Basil
Riley
Ollie
Nickolas
Maynard
Scot
Vince
Quincy
Eddy
Sebastian
Federico
Ulysses
Heriberto
Donnell
Cole
Denny
Davis
Gavin
Emery
Ward
Romeo
Jayson
Dion
Dante
Clement
Coy
Odell
Maxwell
Jarvis
Bruno
Issac
Mary
Dudley
Brock
Sanford
Colby
Carmelo
Barney
Nestor
Hollis
Stefan
Donny
Art
Linwood
Beau
Weldon
Galen
Isidro
Truman
Delmar
Johnathon
Silas
Frederic
Dick
Kirby
Irwin
Cruz
Merlin
Merrill
Charley
Marcelino
Lane
Harris
Cleo
Carlo
Trenton
Kurtis
Hunter
Aurelio
Winfred
Vito
Collin
Denver
Carter
Leonel
Emory
Pasquale
Mohammad
Mariano
Danial
Blair
Landon
Dirk
Branden
Adan
Numbers
Clair
Buford
German
Bernie
Wilmer
Joan
Emerson
Zachery
Fletcher
Jacques
Errol
Dalton
Monroe
Josue
Dominique
Edwardo
Booker
Wilford
Sonny
Shelton
Carson
Theron
Raymundo
Daren
Tristan
Houston
Robby
Lincoln
Jame
Genaro
Gale
Bennett
Octavio
Cornell
Laverne
Hung
Arron
Antony
Herschel
Alva
Giovanni
Garth
Cyrus
Cyril
Ronny
Stevie
Lon
Freeman
Erin
Duncan
Kennith
Carmine
Augustine
Young
Erich
Chadwick
Wilburn
Russ
Reid
Myles
Anderson
Morton
Jonas
Forest
Mitchel
Mervin
Zane
Rich
Jamel
Lazaro
Alphonse
Randell
Major
Johnie
Jarrett
Brooks
Ariel
Abdul
Dusty
Luciano
Lindsey
Tracey
Seymour
Scottie
Eugenio
Mohammed
Sandy
Valentin
Chance
Arnulfo
Lucien
Ferdinand
Thad
Ezra
Sydney
Aldo
Rubin
Royal
Mitch
Earle
Abe
Wyatt
Marquis
Lanny
Kareem
Jamar
Boris
Isiah
Emile
Elmo
Aron
Leopoldo
Everette
Josef
Gail
Eloy
Dorian
Rodrick
Reinaldo
Lucio
Jerrod
Weston
Hershel
Barton
Parker
Lemuel
Lavern
Burt
Jules
Gil
Eliseo
Ahmad
Nigel
Efren
Antwan
Alden
Margarito
Coleman
Refugio
Dino
Osvaldo
Les
Deandre
Normand
Kieth
Ivory
Andrea
Trey
Norberto
Napoleon
Jerold
Fritz
Rosendo
Milford
Sang
Deon
Christoper
Alfonzo
Lyman
Josiah
Brant
Wilton
Rico
Jamaal
Dewitt
Carol
Brenton
Yong
Olin
Foster
Faustino
Claudio
Judson
Gino
Edgardo
Berry
Alec
Tanner
Jarred
Donn
Trinidad
Tad
Shirley
Prince
Porfirio
Odis
Maria
Lenard
Chauncey
Chang
Tod
Mel
Marcelo
Kory
Augustus
Keven
Hilario
Bud
Sal
Rosario
Orval
Mauro
Dannie
Zachariah
Olen
Anibal
Milo
Jed
Frances
Thanh
Dillon
Amado
Newton
Connie
Lenny
Tory
Richie
Lupe
Horacio
Brice
Mohamed
Delmer
Dario
Reyes
Dee
Mac
Jonah
Jerrold
Robt
Hank
Sung
Rupert
Rolland
Kenton
Damion
Chi
Antone
Waldo
Fredric
Bradly
Quinn
Kip
Burl
Walker
Tyree
Jefferey
Ahmed
Willy
Stanford
Oren
Noble
Moshe
Mikel
Enoch
Brendon
Quintin
Jamison
Florencio
Darrick
Tobias
Minh
Hassan
Giuseppe
Demarcus
Cletus
Tyrell
Lyndon
Keenan
Werner
Theo
Geraldo
Lou
Columbus
Chet
Bertram
Markus
Huey
Hilton
Dwain
Donte
Tyron
Omer
Isaias
Hipolito
Fermin
Chung
Adalberto
Valentine
Jamey
Bo
Barrett
Whitney
Teodoro
Mckinley
Maximo
Garfield
Sol
Raleigh
Lawerence
Abram
Rashad
King
Emmitt
Daron
Chong
Samual
Paris
Otha
Miquel
Lacy
Eusebio
Dong
Domenic
Darron
Buster
Antonia
Wilber
Renato
Jc
Hoyt
Haywood
Ezekiel
Chas
Florentino
Elroy
Clemente
Arden
Neville
Kelley
Edison
Deshawn
Carrol
Shayne
Nathanial
Jordon
Danilo
Claud
Val
Sherwood
Raymon
Rayford
Cristobal
Ambrose
Titus
Hyman
Felton
Ezequiel
Erasmo
Stanton
Lonny
Len
Ike
Milan
Lino
Jarod
Herb
Andreas
Walton
Rhett
Palmer
Jude
Douglass
Cordell
Oswaldo
Ellsworth
Virgilio
Toney
Nathanael
Del
Britt
Benedict
Mose
Hong
Leigh
Johnson
Isreal
Gayle
Garret
Fausto
Asa
Arlen
Zack
Warner
Modesto
Francesco
Manual
Jae
Gaylord
Gaston
Filiberto
Deangelo
Michale
Granville
Wes
Malik
Zackary
Tuan
Nicky
Eldridge
Cristopher
Cortez
Antione
Malcom
Long
Korey
Jospeh
Colton
Waylon
Von
Hosea
Shad
Santo
Rudolf
Rolf
Rey
Renaldo
Marcellus
Lucius
Lesley
Kristofer
Boyce
Benton
Man
Kasey
Jewell
Hayden
Harland
Arnoldo
Rueben
Leandro
Kraig
Jerrell
Jeromy
Hobert
Cedrick
Arlie
Winford
Wally
Patricia
Luigi
Keneth
Jacinto
Graig
Franklyn
Edmundo
Sid
Porter
Leif
Lauren
Jeramy
Elisha
Buck
Willian
Vincenzo
Shon
Michal
Lynwood
Lindsay
Jewel
Jere
Hai
Elden
Dorsey
Darell
Broderick
Alonso
Emily
Madison
Emma
Olivia
Hannah
Abigail
Isabella
Samantha
Elizabeth
Ashley
Alexis
Sarah
Sophia
Alyssa
Grace
Ava
Taylor
Brianna
Lauren
Chloe
Natalie
Kayla
Jessica
Anna
Victoria
Mia
Hailey
Sydney
Jasmine
Julia
Morgan
Destiny
Rachel
Ella
Kaitlyn
Megan
Katherine
Savannah
Jennifer
Alexandra
Allison
Haley
Maria
Kaylee
Lily
Makayla
Brooke
Mackenzie
Nicole
Addison
Stephanie
Lillian
Andrea
Zoe
Faith
Kimberly
Madeline
Alexa
Katelyn
Gabriella
Gabrielle
Trinity
Amanda
Kylie
Mary
Paige
Riley
Jenna
Leah
Sara
Rebecca
Michelle
Sofia
Vanessa
Jordan
Angelina
Caroline
Avery
Audrey
Evelyn
Maya
Claire
Autumn
Jocelyn
Ariana
Nevaeh
Arianna
Jada
Bailey
Brooklyn
Aaliyah
Amber
Isabel
Danielle
Mariah
Melanie
Sierra
Erin
Molly
Amelia
Isabelle
Madelyn
Melissa
Jacqueline
Marissa
Shelby
Angela
Leslie
Katie
Jade
Catherine
Diana
Aubrey
Mya
Amy
Briana
Sophie
Gabriela
Breanna
Gianna
Kennedy
Gracie
Peyton
Adriana
Christina
Courtney
Daniela
Kathryn
Lydia
Valeria
Layla
Alexandria
Natalia
Angel
Laura
Charlotte
Margaret
Cheyenne
Mikayla
Miranda
Naomi
Kelsey
Payton
Ana
Alicia
Jillian
Daisy
Mckenzie
Ashlyn
Caitlin
Sabrina
Summer
Ruby
Rylee
Valerie
Skylar
Lindsey
Kelly
Genesis
Zoey
Eva
Sadie
Alexia
Cassidy
Kylee
Kendall
Jordyn
Kate
Jayla
Karen
Tiffany
Cassandra
Juliana
Reagan
Caitlyn
Giselle
Serenity
Alondra
Lucy
Bianca
Kiara
Crystal
Erica
Angelica
Hope
Chelsea
Alana
Liliana
Brittany
Camila
Makenzie
Veronica
Lilly
Abby
Jazmin
Adrianna
Karina
Delaney
Ellie
Jasmin
Maggie
Julianna
Bella
Erika
Carly
Jamie
Mckenna
Ariel
Karla
Kyla
Mariana
Elena
Nadia
Kyra
Alejandra
Esmeralda
Bethany
Aliyah
Amaya
Cynthia
Monica
Vivian
Elise
Camryn
Keira
Laila
Brenda
Mallory
Kendra
Meghan
Makenna
Jayden
Heather
Haylee
Hayley
Jazmine
Josephine
Reese
Fatima
Hanna
Rebekah
Kara
Alison
Macy
Tessa
Annabelle
Michaela
Savanna
Allyson
Lizbeth
Joanna
Nina
Desiree
Clara
Kristen
Diamond
Guadalupe
Julie
Shannon
Selena
Dakota
Alaina
Lindsay
Carmen
Piper
Katelynn
Kira
Ciara
Cecilia
Cameron
Heaven
Aniyah
Kailey
Stella
Camille
Kayleigh
Kaitlin
Holly
Allie
Brooklynn
April
Alivia
Esther
Claudia
Asia
Miriam
Eleanor
Tatiana
Carolina
Nancy
Nora
Callie
Anastasia
Melody
Sienna
Eliana
Kamryn
Madeleine
Josie
Serena
Cadence
Celeste
Julissa
Hayden
Ashlynn
Jaden
Eden
Paris
Skyler
Alayna
Heidi
Jayda
Aniya
Kathleen
Raven
Britney
Sandra
Izabella
Cindy
Leila
Paola
Bridget
Daniella
Violet
Natasha
Kaylie
Alina
Eliza
Priscilla
Wendy
Shayla
Georgia
Kristina
Katrina
Rose
Aurora
Alissa
Kirsten
Patricia
Nayeli
Ivy
Leilani
Emely
Jadyn
Rachael
Casey
Ruth
Denise
Lila
Brenna
London
Marley
Lexi
Yesenia
Meredith
Helen
Imani
Emilee
Annie
Annika
Fiona
Madalyn
Tori
Christine
Kassandra
Ashlee
Anahi
Lauryn
Sasha
Iris
Scarlett
Nia
Kiana
Tara
Kiera
Talia
Mercedes
Yasmin
Sidney
Logan
Rylie
Angie
Cierra
Tatum
Ryleigh
Dulce
Alice
Genevieve
Harley
Malia
Joselyn
Kiley
Lucia
Phoebe
Kyleigh
Rosa
Dana
Bryanna
Brittney
Marisol
Kassidy
Anne
Lola
Marisa
Cora
Madisyn
Brynn
Itzel
Delilah
Clarissa
Marina
Valentina
Perla
Lesly
Hailee
Baylee
Maddison
Lacey
Kaylin
Hallie
Sage
Gloria
Madyson
Harmony
Whitney
Alexus
Linda
Jane
Halle
Elisabeth
Lisa
Francesca
Viviana
Noelle
Cristina
Fernanda
Madilyn
Deanna
Shania
Khloe
Anya
Raquel
Tiana
Tabitha
Krystal
Ximena
Johanna
Janelle
Teresa
Carolyn
Virginia
Skye
Jenny
Jaelyn
Janiya
Amari
Kaitlynn
Estrella
Brielle
Macie
Paulina
Jaqueline
Presley
Sarai
Taryn
Ashleigh
Ashanti
Nyla
Kaelyn
Aubree
Dominique
Elaina
Alyson
Kaydence
Teagan
Ainsley
Raegan
India
Emilia
Nataly
Kaleigh
Ayanna
Addyson
Tamia
Emerson
Tania
Alanna
Carla
Athena
Miracle
Kristin
Marie
Destinee
Regan
Lena
Haleigh
Cara
Cheyanne
Martha
Alisha
Willow
America
Alessandra
Amya
Madelynn
Jaiden
Lyla
Samara
Hazel
Ryan
Miley
Joy
Abbigail
Aileen
Justice
Lilian
Renee
Kali
Lana
Emilie
Adeline
Jimena
Mckayla
Jessie
Penelope
Harper
Kiersten
Maritza
Ayla
Anika
Kailyn
Carley
Mikaela
Carissa
Monique
Jazlyn
Ellen
Janet
Gillian
Juliet
Haylie
Gisselle
Precious
Sylvia
Melina
Kadence
Anaya
Lexie
Elisa
Marilyn
Isabela
Bailee
Janiyah
Marlene
Simone
Melany
Gina
Pamela
Yasmine
Danica
Deja
Lillie
Kasey
Tia
Kierra
Susan
Larissa
Elle
Lilliana
Kailee
Laney
Angelique
Daphne
Liberty
Tamara
Irene
Lia
Karissa
Katlyn
Sharon
Kenya
Isis
Maia
Jacquelyn
Nathalie
Helena
Carlie
Hadley
Abbey
Krista
Kenzie
Sonia
Aspen
Jaida
Meagan
Dayana
Macey
Eve
Ashton
Dayanara
Arielle
Tiara
Kimora
Charity
Luna
Araceli
Zoie
Janessa
Mayra
Juliette
Janae
Cassie
Luz
Abbie
Skyla
Amira
Kaley
Lyric
Reyna
Felicity
Theresa
Litzy
Barbara
Cali
Gwendolyn
Regina
Judith
Alma
Noemi
Kennedi
Kaya
Danna
Lorena
Norah
Quinn
Haven
Karlee
Clare
Kelsie
Yadira
Brisa
Arely
Zaria
Jolie
Cristal
Ann
Amara
Julianne
Tyler
Deborah
Lea
Maci
Kaylynn
Shyanne
Brandy
Kaila
Carlee
Amani
Kaylyn
Aleah
Parker
Paula
Dylan
Aria
Elaine
Ally
Aubrie
Lesley
Adrienne
Tianna
Edith
Annabella
Aimee
Stacy
Mariam
Maeve
Jazmyn
Rhiannon
Jaylin
Brandi
Ingrid
Yazmin
Mara
Tess
Marlee
Savanah
Kaia
Kayden
Celia
Jaclyn
Jaylynn
Rowan
Frances
Tanya
Mollie
Aisha
Natalee
Rosemary
Alena
Myah
Ansley
Colleen
Tatyana
Aiyana
Thalia
Annalise
Shaniya
Sydnee
Amiyah
Corinne
Saniya
Hana
Aryanna
Leanna
Esperanza
Eileen
Liana
Jaidyn
Justine
Chasity
Aliya
Greta
Gia
Chelsey
Aylin
Catalina
Giovanna
Abril
Damaris
Maliyah
Mariela
Tyra
Elyse
Monserrat
Kayley
Ayana
Karlie
Sherlyn
Keely
Carina
Cecelia
Micah
Danika
Taliyah
Aracely
Emmalee
Yareli
Lizeth
Hailie
Hunter
Chaya
Emery
Alisa
Jamya
Iliana
Patience
Leticia
Caylee
Salma
Marianna
Jakayla
Stephany
Jewel
Laurel
Jaliyah
Karli
Rubi
Madalynn
Yoselin
Kaliyah
Kendal
Laci
Giana
Toni
Journey
Jaycee
Breana
Maribel
Lilah
Joyce
Amiya
Joslyn
Elsa
Paisley
Rihanna
Destiney
Carrie
Evangeline
Taniya
Evelin
Cayla
Ada
Shayna
Nichole
Mattie
Annette
Kianna
Ryann
Tina
Abigayle
Princess
Tayler
Jacey
Lara
Desirae
Zariah
Lucille
Jaelynn
Blanca
Camilla
Kaiya
Lainey
Jaylene
Antonia
Kallie
Donna
Moriah
Sanaa
Frida
Bria
Felicia
Rebeca
Annabel
Shaylee
Micaela
Shyann
Arabella
Essence
Aliza
Aleena
Miah
Karly
Gretchen
Saige
Ashly
Destini
Paloma
Shea
Yvette
Rayna
Halie
Brylee
Nya
Meadow
Kathy
Devin
Kenna
Saniyah
Kinsley
Sariah
Campbell
Trista
Anabelle
Siena
Makena
Raina
Candace
Maleah
Adelaide
Lorelei
Ebony
Armani
Maura
Aryana
Kinley
Alia
Amina
Katharine
Nicolette
Mila
Isabell
Gracelyn
Kayli
Dalia
Yuliana
Stacey
Nyah
Sheila
Libby
Montana
Sandy
Margarita
Cherish
Susana
Keyla
Jayleen
Angeline
Kaylah
Jenifer
Christian
Celine
Magdalena
Karley
Chanel
Kaylen
Nikki
Elliana
Janice
Ciera
Phoenix
Addisyn
Jaylee
Noelia
Sarahi
Belen
Devyn
Jaylyn
Abagail
Myla
Jalyn
Nyasia
Abigale
Calista
Shirley
Alize
Xiomara
Carol
Reina
Zion
Katarina
Charlie
Nathaly
Charlize
Dorothy
Hillary
Selina
Kenia
Lizette
Johana
Amelie
Natalya
Shakira
Joana
Iyana
Yaritza
Elissa
Belinda
Kamila
Mireya
Alysa
Katelin
Ericka
Rhianna
Makaila
Jasmyn
Kya
Akira
Savana
Madisen
Lilyana
Scarlet
Arlene
Areli
Tierra
Mira
Madilynn
Graciela
Shyla
Chana
Sally
Kelli
Robin
Elsie
Ireland
Carson
Mina
Kourtney
Roselyn
Braelyn
Jazlynn
Kacie
Zara
Miya
Estefania
Beatriz
Adelyn
Rocio
Londyn
Beatrice
Kasandra
Christiana
Kinsey
Lina
Carli
Sydni
Jackeline
Galilea
Janiah
Lilia
Berenice
Sky
Candice
Melinda
Brianne
Jailyn
Jalynn
Anita
Selah
Unique
Devon
Fabiola
Maryam
Averie
Hayleigh
Myra
Tracy
Cailyn
Taniyah
Reilly
Joelle
Dahlia
Amaris
Ali
Lilianna
Anissa
Elyssa
Caleigh
Lyndsey
Leyla
Dania
Diane
Casandra
Dasia
Iyanna
Jana
Sarina
Shreya
Silvia
Alani
Lexus
Sydnie
Darlene
Briley
Audrina
Mckinley
Denisse
Anjali
Samira
Robyn
Delia
Riya
Deasia
Lacy
Jaylen
Adalyn
Tatianna
Bryana
Ashtyn
Celina
Jazmyne
Nathalia
Kalyn
Citlali
Roxana
Taya
Anabel
Jayde
Alexandrea
Livia
Jocelynn
Maryjane
Lacie
Amirah
Sonya
Valery
Anais
Mariyah
Lucero
Mandy
Christy
Jaime
Luisa
Yamilet
Allyssa
Pearl
Jaylah
Vanesa
Gemma
Keila
Marin
Katy
Drew
Maren
Cloe
Yahaira
Finley
Azaria
Christa
Adyson
Yolanda
Loren
Charlee
Marlen
Kacey
Heidy
Alexys
Rita
Bridgette
Luciana
Kellie
Roxanne
Estefani
Kaci
Joselin
Estefany
Jacklyn
Rachelle
Alex
Jaquelin
Kylah
Dianna
Karis
Noor
Asha
Treasure
Gwyneth
Mylee
Flor
Kelsi
Leia
Carleigh
Alannah
Rayne
Averi
Yessenia
Rory
Keeley
Emelia
Marian
Giuliana
Shiloh
Janie
Bonnie
Astrid
Caitlynn
Addie
Bree
Lourdes
Rhea
Winter
Adison
Brook
Trisha
Kristine
Yvonne
Yaretzi
Dallas
Eryn
Breonna
Tayla
Juana
Ariella
Katerina
Malaysia
Priscila
Nylah
Kyndall
Shawna
Kori
Anabella
Aliana
Sheyla
Milagros
Norma
Tristan
Lidia
Karma
Amalia
Malaya
Katia
Bryn
Reece
Kayleen
Adamaris
Gabriel
Jolene
Emani
Karsyn
Darby
Juanita
Reanna
Rianna
Milan
Keara
Melisa
Brionna
Jeanette
Marcella
Nadine
Audra
Lillianna
Abrianna
Maegan
Diya
Isla
Chyna
Evie
Kaela
Sade
Elianna
Joseline
Kaycee
Alaysia
Alyvia
Neha
Jordin
Lori
Anisa
Izabelle
Lisbeth
Rivka
Noel
Harlee
Rosalinda
Constance
Alycia
Ivana
Emmy
Raelynn''' | data = 'James\nJohn\nRobert\nMichael\nWilliam\nDavid\nRichard\nCharles\nJoseph\nThomas\nChristopher\nDaniel\nPaul\nMark\nDonald\nGeorge\nKenneth\nSteven\nEdward\nBrian\nRonald\nAnthony\nKevin\nJason\nMatthew\nGary\nTimothy\nJose\nLarry\nJeffrey\nFrank\nScott\nEric\nStephen\nAndrew\nRaymond\nGregory\nJoshua\nJerry\nDennis\nWalter\nPatrick\nPeter\nHarold\nDouglas\nHenry\nCarl\nArthur\nRyan\nRoger\nJoe\nJuan\nJack\nAlbert\nJonathan\nJustin\nTerry\nGerald\nKeith\nSamuel\nWillie\nRalph\nLawrence\nNicholas\nRoy\nBenjamin\nBruce\nBrandon\nAdam\nHarry\nFred\nWayne\nBilly\nSteve\nLouis\nJeremy\nAaron\nRandy\nHoward\nEugene\nCarlos\nRussell\nBobby\nVictor\nMartin\nErnest\nPhillip\nTodd\nJesse\nCraig\nAlan\nShawn\nClarence\nSean\nPhilip\nChris\nJohnny\nEarl\nJimmy\nAntonio\nDanny\nBryan\nTony\nLuis\nMike\nStanley\nLeonard\nNathan\nDale\nManuel\nRodney\nCurtis\nNorman\nAllen\nMarvin\nVincent\nGlenn\nJeffery\nTravis\nJeff\nChad\nJacob\nLee\nMelvin\nAlfred\nKyle\nFrancis\nBradley\nJesus\nHerbert\nFrederick\nRay\nJoel\nEdwin\nDon\nEddie\nRicky\nTroy\nRandall\nBarry\nAlexander\nBernard\nMario\nLeroy\nFrancisco\nMarcus\nMicheal\nTheodore\nClifford\nMiguel\nOscar\nJay\nJim\nTom\nCalvin\nAlex\nJon\nRonnie\nBill\nLloyd\nTommy\nLeon\nDerek\nWarren\nDarrell\nJerome\nFloyd\nLeo\nAlvin\nTim\nWesley\nGordon\nDean\nGreg\nJorge\nDustin\nPedro\nDerrick\nDan\nLewis\nZachary\nCorey\nHerman\nMaurice\nVernon\nRoberto\nClyde\nGlen\nHector\nShane\nRicardo\nSam\nRick\nLester\nBrent\nRamon\nCharlie\nTyler\nGilbert\nGene\nMarc\nReginald\nRuben\nBrett\nAngel\nNathaniel\nRafael\nLeslie\nEdgar\nMilton\nRaul\nBen\nChester\nCecil\nDuane\nFranklin\nAndre\nElmer\nBrad\nGabriel\nRon\nMitchell\nRoland\nArnold\nHarvey\nJared\nAdrian\nKarl\nCory\nClaude\nErik\nDarryl\nJamie\nNeil\nJessie\nChristian\nJavier\nFernando\nClinton\nTed\nMathew\nTyrone\nDarren\nLonnie\nLance\nCody\nJulio\nKelly\nKurt\nAllan\nNelson\nGuy\nClayton\nHugh\nMax\nDwayne\nDwight\nArmando\nFelix\nJimmie\nEverett\nJordan\nIan\nWallace\nKen\nBob\nJaime\nCasey\nAlfredo\nAlberto\nDave\nIvan\nJohnnie\nSidney\nByron\nJulian\nIsaac\nMorris\nClifton\nWillard\nDaryl\nRoss\nVirgil\nAndy\nMarshall\nSalvador\nPerry\nKirk\nSergio\nMarion\nTracy\nSeth\nKent\nTerrance\nRene\nEduardo\nTerrence\nEnrique\nFreddie\nWade\nAustin\nStuart\nFredrick\nArturo\nAlejandro\nJackie\nJoey\nNick\nLuther\nWendell\nJeremiah\nEvan\nJulius\nDana\nDonnie\nOtis\nShannon\nTrevor\nOliver\nLuke\nHomer\nGerard\nDoug\nKenny\nHubert\nAngelo\nShaun\nLyle\nMatt\nLynn\nAlfonso\nOrlando\nRex\nCarlton\nErnesto\nCameron\nNeal\nPablo\nLorenzo\nOmar\nWilbur\nBlake\nGrant\nHorace\nRoderick\nKerry\nAbraham\nWillis\nRickey\nJean\nIra\nAndres\nCesar\nJohnathan\nMalcolm\nRudolph\nDamon\nKelvin\nRudy\nPreston\nAlton\nArchie\nMarco\nWm\nPete\nRandolph\nGarry\nGeoffrey\nJonathon\nFelipe\nBennie\nGerardo\nEd\nDominic\nRobin\nLoren\nDelbert\nColin\nGuillermo\nEarnest\nLucas\nBenny\nNoel\nSpencer\nRodolfo\nMyron\nEdmund\nGarrett\nSalvatore\nCedric\nLowell\nGregg\nSherman\nWilson\nDevin\nSylvester\nKim\nRoosevelt\nIsrael\nJermaine\nForrest\nWilbert\nLeland\nSimon\nGuadalupe\nClark\nIrving\nCarroll\nBryant\nOwen\nRufus\nWoodrow\nSammy\nKristopher\nMack\nLevi\nMarcos\nGustavo\nJake\nLionel\nMarty\nTaylor\nEllis\nDallas\nGilberto\nClint\nNicolas\nLaurence\nIsmael\nOrville\nDrew\nJody\nErvin\nDewey\nAl\nWilfred\nJosh\nHugo\nIgnacio\nCaleb\nTomas\nSheldon\nErick\nFrankie\nStewart\nDoyle\nDarrel\nRogelio\nTerence\nSantiago\nAlonzo\nElias\nBert\nElbert\nRamiro\nConrad\nPat\nNoah\nGrady\nPhil\nCornelius\nLamar\nRolando\nClay\nPercy\nDexter\nBradford\nMerle\nDarin\nAmos\nTerrell\nMoses\nIrvin\nSaul\nRoman\nDarnell\nRandal\nTommie\nTimmy\nDarrin\nWinston\nBrendan\nToby\nVan\nAbel\nDominick\nBoyd\nCourtney\nJan\nEmilio\nElijah\nCary\nDomingo\nSantos\nAubrey\nEmmett\nMarlon\nEmanuel\nJerald\nEdmond\nEmil\nDewayne\nWill\nOtto\nTeddy\nReynaldo\nBret\nMorgan\nJess\nTrent\nHumberto\nEmmanuel\nStephan\nLouie\nVicente\nLamont\nStacy\nGarland\nMiles\nMicah\nEfrain\nBillie\nLogan\nHeath\nRodger\nHarley\nDemetrius\nEthan\nEldon\nRocky\nPierre\nJunior\nFreddy\nEli\nBryce\nAntoine\nRobbie\nKendall\nRoyce\nSterling\nMickey\nChase\nGrover\nElton\nCleveland\nDylan\nChuck\nDamian\nReuben\nStan\nAugust\nLeonardo\nJasper\nRussel\nErwin\nBenito\nHans\nMonte\nBlaine\nErnie\nCurt\nQuentin\nAgustin\nMurray\nJamal\nDevon\nAdolfo\nHarrison\nTyson\nBurton\nBrady\nElliott\nWilfredo\nBart\nJarrod\nVance\nDenis\nDamien\nJoaquin\nHarlan\nDesmond\nElliot\nDarwin\nAshley\nGregorio\nBuddy\nXavier\nKermit\nRoscoe\nEsteban\nAnton\nSolomon\nScotty\nNorbert\nElvin\nWilliams\nNolan\nCarey\nRod\nQuinton\nHal\nBrain\nRob\nElwood\nKendrick\nDarius\nMoises\nSon\nMarlin\nFidel\nThaddeus\nCliff\nMarcel\nAli\nJackson\nRaphael\nBryon\nArmand\nAlvaro\nJeffry\nDane\nJoesph\nThurman\nNed\nSammie\nRusty\nMichel\nMonty\nRory\nFabian\nReggie\nMason\nGraham\nKris\nIsaiah\nVaughn\nGus\nAvery\nLoyd\nDiego\nAlexis\nAdolph\nNorris\nMillard\nRocco\nGonzalo\nDerick\nRodrigo\nGerry\nStacey\nCarmen\nWiley\nRigoberto\nAlphonso\nTy\nShelby\nRickie\nNoe\nVern\nBobbie\nReed\nJefferson\nElvis\nBernardo\nMauricio\nHiram\nDonovan\nBasil\nRiley\nOllie\nNickolas\nMaynard\nScot\nVince\nQuincy\nEddy\nSebastian\nFederico\nUlysses\nHeriberto\nDonnell\nCole\nDenny\nDavis\nGavin\nEmery\nWard\nRomeo\nJayson\nDion\nDante\nClement\nCoy\nOdell\nMaxwell\nJarvis\nBruno\nIssac\nMary\nDudley\nBrock\nSanford\nColby\nCarmelo\nBarney\nNestor\nHollis\nStefan\nDonny\nArt\nLinwood\nBeau\nWeldon\nGalen\nIsidro\nTruman\nDelmar\nJohnathon\nSilas\nFrederic\nDick\nKirby\nIrwin\nCruz\nMerlin\nMerrill\nCharley\nMarcelino\nLane\nHarris\nCleo\nCarlo\nTrenton\nKurtis\nHunter\nAurelio\nWinfred\nVito\nCollin\nDenver\nCarter\nLeonel\nEmory\nPasquale\nMohammad\nMariano\nDanial\nBlair\nLandon\nDirk\nBranden\nAdan\nNumbers\nClair\nBuford\nGerman\nBernie\nWilmer\nJoan\nEmerson\nZachery\nFletcher\nJacques\nErrol\nDalton\nMonroe\nJosue\nDominique\nEdwardo\nBooker\nWilford\nSonny\nShelton\nCarson\nTheron\nRaymundo\nDaren\nTristan\nHouston\nRobby\nLincoln\nJame\nGenaro\nGale\nBennett\nOctavio\nCornell\nLaverne\nHung\nArron\nAntony\nHerschel\nAlva\nGiovanni\nGarth\nCyrus\nCyril\nRonny\nStevie\nLon\nFreeman\nErin\nDuncan\nKennith\nCarmine\nAugustine\nYoung\nErich\nChadwick\nWilburn\nRuss\nReid\nMyles\nAnderson\nMorton\nJonas\nForest\nMitchel\nMervin\nZane\nRich\nJamel\nLazaro\nAlphonse\nRandell\nMajor\nJohnie\nJarrett\nBrooks\nAriel\nAbdul\nDusty\nLuciano\nLindsey\nTracey\nSeymour\nScottie\nEugenio\nMohammed\nSandy\nValentin\nChance\nArnulfo\nLucien\nFerdinand\nThad\nEzra\nSydney\nAldo\nRubin\nRoyal\nMitch\nEarle\nAbe\nWyatt\nMarquis\nLanny\nKareem\nJamar\nBoris\nIsiah\nEmile\nElmo\nAron\nLeopoldo\nEverette\nJosef\nGail\nEloy\nDorian\nRodrick\nReinaldo\nLucio\nJerrod\nWeston\nHershel\nBarton\nParker\nLemuel\nLavern\nBurt\nJules\nGil\nEliseo\nAhmad\nNigel\nEfren\nAntwan\nAlden\nMargarito\nColeman\nRefugio\nDino\nOsvaldo\nLes\nDeandre\nNormand\nKieth\nIvory\nAndrea\nTrey\nNorberto\nNapoleon\nJerold\nFritz\nRosendo\nMilford\nSang\nDeon\nChristoper\nAlfonzo\nLyman\nJosiah\nBrant\nWilton\nRico\nJamaal\nDewitt\nCarol\nBrenton\nYong\nOlin\nFoster\nFaustino\nClaudio\nJudson\nGino\nEdgardo\nBerry\nAlec\nTanner\nJarred\nDonn\nTrinidad\nTad\nShirley\nPrince\nPorfirio\nOdis\nMaria\nLenard\nChauncey\nChang\nTod\nMel\nMarcelo\nKory\nAugustus\nKeven\nHilario\nBud\nSal\nRosario\nOrval\nMauro\nDannie\nZachariah\nOlen\nAnibal\nMilo\nJed\nFrances\nThanh\nDillon\nAmado\nNewton\nConnie\nLenny\nTory\nRichie\nLupe\nHoracio\nBrice\nMohamed\nDelmer\nDario\nReyes\nDee\nMac\nJonah\nJerrold\nRobt\nHank\nSung\nRupert\nRolland\nKenton\nDamion\nChi\nAntone\nWaldo\nFredric\nBradly\nQuinn\nKip\nBurl\nWalker\nTyree\nJefferey\nAhmed\nWilly\nStanford\nOren\nNoble\nMoshe\nMikel\nEnoch\nBrendon\nQuintin\nJamison\nFlorencio\nDarrick\nTobias\nMinh\nHassan\nGiuseppe\nDemarcus\nCletus\nTyrell\nLyndon\nKeenan\nWerner\nTheo\nGeraldo\nLou\nColumbus\nChet\nBertram\nMarkus\nHuey\nHilton\nDwain\nDonte\nTyron\nOmer\nIsaias\nHipolito\nFermin\nChung\nAdalberto\nValentine\nJamey\nBo\nBarrett\nWhitney\nTeodoro\nMckinley\nMaximo\nGarfield\nSol\nRaleigh\nLawerence\nAbram\nRashad\nKing\nEmmitt\nDaron\nChong\nSamual\nParis\nOtha\nMiquel\nLacy\nEusebio\nDong\nDomenic\nDarron\nBuster\nAntonia\nWilber\nRenato\nJc\nHoyt\nHaywood\nEzekiel\nChas\nFlorentino\nElroy\nClemente\nArden\nNeville\nKelley\nEdison\nDeshawn\nCarrol\nShayne\nNathanial\nJordon\nDanilo\nClaud\nVal\nSherwood\nRaymon\nRayford\nCristobal\nAmbrose\nTitus\nHyman\nFelton\nEzequiel\nErasmo\nStanton\nLonny\nLen\nIke\nMilan\nLino\nJarod\nHerb\nAndreas\nWalton\nRhett\nPalmer\nJude\nDouglass\nCordell\nOswaldo\nEllsworth\nVirgilio\nToney\nNathanael\nDel\nBritt\nBenedict\nMose\nHong\nLeigh\nJohnson\nIsreal\nGayle\nGarret\nFausto\nAsa\nArlen\nZack\nWarner\nModesto\nFrancesco\nManual\nJae\nGaylord\nGaston\nFiliberto\nDeangelo\nMichale\nGranville\nWes\nMalik\nZackary\nTuan\nNicky\nEldridge\nCristopher\nCortez\nAntione\nMalcom\nLong\nKorey\nJospeh\nColton\nWaylon\nVon\nHosea\nShad\nSanto\nRudolf\nRolf\nRey\nRenaldo\nMarcellus\nLucius\nLesley\nKristofer\nBoyce\nBenton\nMan\nKasey\nJewell\nHayden\nHarland\nArnoldo\nRueben\nLeandro\nKraig\nJerrell\nJeromy\nHobert\nCedrick\nArlie\nWinford\nWally\nPatricia\nLuigi\nKeneth\nJacinto\nGraig\nFranklyn\nEdmundo\nSid\nPorter\nLeif\nLauren\nJeramy\nElisha\nBuck\nWillian\nVincenzo\nShon\nMichal\nLynwood\nLindsay\nJewel\nJere\nHai\nElden\nDorsey\nDarell\nBroderick\nAlonso\nEmily\nMadison\nEmma\nOlivia\nHannah\nAbigail\nIsabella\nSamantha\nElizabeth\nAshley\nAlexis\nSarah\nSophia\nAlyssa\nGrace\nAva\nTaylor\nBrianna\nLauren\nChloe\nNatalie\nKayla\nJessica\nAnna\nVictoria\nMia\nHailey\nSydney\nJasmine\nJulia\nMorgan\nDestiny\nRachel\nElla\nKaitlyn\nMegan\nKatherine\nSavannah\nJennifer\nAlexandra\nAllison\nHaley\nMaria\nKaylee\nLily\nMakayla\nBrooke\nMackenzie\nNicole\nAddison\nStephanie\nLillian\nAndrea\nZoe\nFaith\nKimberly\nMadeline\nAlexa\nKatelyn\nGabriella\nGabrielle\nTrinity\nAmanda\nKylie\nMary\nPaige\nRiley\nJenna\nLeah\nSara\nRebecca\nMichelle\nSofia\nVanessa\nJordan\nAngelina\nCaroline\nAvery\nAudrey\nEvelyn\nMaya\nClaire\nAutumn\nJocelyn\nAriana\nNevaeh\nArianna\nJada\nBailey\nBrooklyn\nAaliyah\nAmber\nIsabel\nDanielle\nMariah\nMelanie\nSierra\nErin\nMolly\nAmelia\nIsabelle\nMadelyn\nMelissa\nJacqueline\nMarissa\nShelby\nAngela\nLeslie\nKatie\nJade\nCatherine\nDiana\nAubrey\nMya\nAmy\nBriana\nSophie\nGabriela\nBreanna\nGianna\nKennedy\nGracie\nPeyton\nAdriana\nChristina\nCourtney\nDaniela\nKathryn\nLydia\nValeria\nLayla\nAlexandria\nNatalia\nAngel\nLaura\nCharlotte\nMargaret\nCheyenne\nMikayla\nMiranda\nNaomi\nKelsey\nPayton\nAna\nAlicia\nJillian\nDaisy\nMckenzie\nAshlyn\nCaitlin\nSabrina\nSummer\nRuby\nRylee\nValerie\nSkylar\nLindsey\nKelly\nGenesis\nZoey\nEva\nSadie\nAlexia\nCassidy\nKylee\nKendall\nJordyn\nKate\nJayla\nKaren\nTiffany\nCassandra\nJuliana\nReagan\nCaitlyn\nGiselle\nSerenity\nAlondra\nLucy\nBianca\nKiara\nCrystal\nErica\nAngelica\nHope\nChelsea\nAlana\nLiliana\nBrittany\nCamila\nMakenzie\nVeronica\nLilly\nAbby\nJazmin\nAdrianna\nKarina\nDelaney\nEllie\nJasmin\nMaggie\nJulianna\nBella\nErika\nCarly\nJamie\nMckenna\nAriel\nKarla\nKyla\nMariana\nElena\nNadia\nKyra\nAlejandra\nEsmeralda\nBethany\nAliyah\nAmaya\nCynthia\nMonica\nVivian\nElise\nCamryn\nKeira\nLaila\nBrenda\nMallory\nKendra\nMeghan\nMakenna\nJayden\nHeather\nHaylee\nHayley\nJazmine\nJosephine\nReese\nFatima\nHanna\nRebekah\nKara\nAlison\nMacy\nTessa\nAnnabelle\nMichaela\nSavanna\nAllyson\nLizbeth\nJoanna\nNina\nDesiree\nClara\nKristen\nDiamond\nGuadalupe\nJulie\nShannon\nSelena\nDakota\nAlaina\nLindsay\nCarmen\nPiper\nKatelynn\nKira\nCiara\nCecilia\nCameron\nHeaven\nAniyah\nKailey\nStella\nCamille\nKayleigh\nKaitlin\nHolly\nAllie\nBrooklynn\nApril\nAlivia\nEsther\nClaudia\nAsia\nMiriam\nEleanor\nTatiana\nCarolina\nNancy\nNora\nCallie\nAnastasia\nMelody\nSienna\nEliana\nKamryn\nMadeleine\nJosie\nSerena\nCadence\nCeleste\nJulissa\nHayden\nAshlynn\nJaden\nEden\nParis\nSkyler\nAlayna\nHeidi\nJayda\nAniya\nKathleen\nRaven\nBritney\nSandra\nIzabella\nCindy\nLeila\nPaola\nBridget\nDaniella\nViolet\nNatasha\nKaylie\nAlina\nEliza\nPriscilla\nWendy\nShayla\nGeorgia\nKristina\nKatrina\nRose\nAurora\nAlissa\nKirsten\nPatricia\nNayeli\nIvy\nLeilani\nEmely\nJadyn\nRachael\nCasey\nRuth\nDenise\nLila\nBrenna\nLondon\nMarley\nLexi\nYesenia\nMeredith\nHelen\nImani\nEmilee\nAnnie\nAnnika\nFiona\nMadalyn\nTori\nChristine\nKassandra\nAshlee\nAnahi\nLauryn\nSasha\nIris\nScarlett\nNia\nKiana\nTara\nKiera\nTalia\nMercedes\nYasmin\nSidney\nLogan\nRylie\nAngie\nCierra\nTatum\nRyleigh\nDulce\nAlice\nGenevieve\nHarley\nMalia\nJoselyn\nKiley\nLucia\nPhoebe\nKyleigh\nRosa\nDana\nBryanna\nBrittney\nMarisol\nKassidy\nAnne\nLola\nMarisa\nCora\nMadisyn\nBrynn\nItzel\nDelilah\nClarissa\nMarina\nValentina\nPerla\nLesly\nHailee\nBaylee\nMaddison\nLacey\nKaylin\nHallie\nSage\nGloria\nMadyson\nHarmony\nWhitney\nAlexus\nLinda\nJane\nHalle\nElisabeth\nLisa\nFrancesca\nViviana\nNoelle\nCristina\nFernanda\nMadilyn\nDeanna\nShania\nKhloe\nAnya\nRaquel\nTiana\nTabitha\nKrystal\nXimena\nJohanna\nJanelle\nTeresa\nCarolyn\nVirginia\nSkye\nJenny\nJaelyn\nJaniya\nAmari\nKaitlynn\nEstrella\nBrielle\nMacie\nPaulina\nJaqueline\nPresley\nSarai\nTaryn\nAshleigh\nAshanti\nNyla\nKaelyn\nAubree\nDominique\nElaina\nAlyson\nKaydence\nTeagan\nAinsley\nRaegan\nIndia\nEmilia\nNataly\nKaleigh\nAyanna\nAddyson\nTamia\nEmerson\nTania\nAlanna\nCarla\nAthena\nMiracle\nKristin\nMarie\nDestinee\nRegan\nLena\nHaleigh\nCara\nCheyanne\nMartha\nAlisha\nWillow\nAmerica\nAlessandra\nAmya\nMadelynn\nJaiden\nLyla\nSamara\nHazel\nRyan\nMiley\nJoy\nAbbigail\nAileen\nJustice\nLilian\nRenee\nKali\nLana\nEmilie\nAdeline\nJimena\nMckayla\nJessie\nPenelope\nHarper\nKiersten\nMaritza\nAyla\nAnika\nKailyn\nCarley\nMikaela\nCarissa\nMonique\nJazlyn\nEllen\nJanet\nGillian\nJuliet\nHaylie\nGisselle\nPrecious\nSylvia\nMelina\nKadence\nAnaya\nLexie\nElisa\nMarilyn\nIsabela\nBailee\nJaniyah\nMarlene\nSimone\nMelany\nGina\nPamela\nYasmine\nDanica\nDeja\nLillie\nKasey\nTia\nKierra\nSusan\nLarissa\nElle\nLilliana\nKailee\nLaney\nAngelique\nDaphne\nLiberty\nTamara\nIrene\nLia\nKarissa\nKatlyn\nSharon\nKenya\nIsis\nMaia\nJacquelyn\nNathalie\nHelena\nCarlie\nHadley\nAbbey\nKrista\nKenzie\nSonia\nAspen\nJaida\nMeagan\nDayana\nMacey\nEve\nAshton\nDayanara\nArielle\nTiara\nKimora\nCharity\nLuna\nAraceli\nZoie\nJanessa\nMayra\nJuliette\nJanae\nCassie\nLuz\nAbbie\nSkyla\nAmira\nKaley\nLyric\nReyna\nFelicity\nTheresa\nLitzy\nBarbara\nCali\nGwendolyn\nRegina\nJudith\nAlma\nNoemi\nKennedi\nKaya\nDanna\nLorena\nNorah\nQuinn\nHaven\nKarlee\nClare\nKelsie\nYadira\nBrisa\nArely\nZaria\nJolie\nCristal\nAnn\nAmara\nJulianne\nTyler\nDeborah\nLea\nMaci\nKaylynn\nShyanne\nBrandy\nKaila\nCarlee\nAmani\nKaylyn\nAleah\nParker\nPaula\nDylan\nAria\nElaine\nAlly\nAubrie\nLesley\nAdrienne\nTianna\nEdith\nAnnabella\nAimee\nStacy\nMariam\nMaeve\nJazmyn\nRhiannon\nJaylin\nBrandi\nIngrid\nYazmin\nMara\nTess\nMarlee\nSavanah\nKaia\nKayden\nCelia\nJaclyn\nJaylynn\nRowan\nFrances\nTanya\nMollie\nAisha\nNatalee\nRosemary\nAlena\nMyah\nAnsley\nColleen\nTatyana\nAiyana\nThalia\nAnnalise\nShaniya\nSydnee\nAmiyah\nCorinne\nSaniya\nHana\nAryanna\nLeanna\nEsperanza\nEileen\nLiana\nJaidyn\nJustine\nChasity\nAliya\nGreta\nGia\nChelsey\nAylin\nCatalina\nGiovanna\nAbril\nDamaris\nMaliyah\nMariela\nTyra\nElyse\nMonserrat\nKayley\nAyana\nKarlie\nSherlyn\nKeely\nCarina\nCecelia\nMicah\nDanika\nTaliyah\nAracely\nEmmalee\nYareli\nLizeth\nHailie\nHunter\nChaya\nEmery\nAlisa\nJamya\nIliana\nPatience\nLeticia\nCaylee\nSalma\nMarianna\nJakayla\nStephany\nJewel\nLaurel\nJaliyah\nKarli\nRubi\nMadalynn\nYoselin\nKaliyah\nKendal\nLaci\nGiana\nToni\nJourney\nJaycee\nBreana\nMaribel\nLilah\nJoyce\nAmiya\nJoslyn\nElsa\nPaisley\nRihanna\nDestiney\nCarrie\nEvangeline\nTaniya\nEvelin\nCayla\nAda\nShayna\nNichole\nMattie\nAnnette\nKianna\nRyann\nTina\nAbigayle\nPrincess\nTayler\nJacey\nLara\nDesirae\nZariah\nLucille\nJaelynn\nBlanca\nCamilla\nKaiya\nLainey\nJaylene\nAntonia\nKallie\nDonna\nMoriah\nSanaa\nFrida\nBria\nFelicia\nRebeca\nAnnabel\nShaylee\nMicaela\nShyann\nArabella\nEssence\nAliza\nAleena\nMiah\nKarly\nGretchen\nSaige\nAshly\nDestini\nPaloma\nShea\nYvette\nRayna\nHalie\nBrylee\nNya\nMeadow\nKathy\nDevin\nKenna\nSaniyah\nKinsley\nSariah\nCampbell\nTrista\nAnabelle\nSiena\nMakena\nRaina\nCandace\nMaleah\nAdelaide\nLorelei\nEbony\nArmani\nMaura\nAryana\nKinley\nAlia\nAmina\nKatharine\nNicolette\nMila\nIsabell\nGracelyn\nKayli\nDalia\nYuliana\nStacey\nNyah\nSheila\nLibby\nMontana\nSandy\nMargarita\nCherish\nSusana\nKeyla\nJayleen\nAngeline\nKaylah\nJenifer\nChristian\nCeline\nMagdalena\nKarley\nChanel\nKaylen\nNikki\nElliana\nJanice\nCiera\nPhoenix\nAddisyn\nJaylee\nNoelia\nSarahi\nBelen\nDevyn\nJaylyn\nAbagail\nMyla\nJalyn\nNyasia\nAbigale\nCalista\nShirley\nAlize\nXiomara\nCarol\nReina\nZion\nKatarina\nCharlie\nNathaly\nCharlize\nDorothy\nHillary\nSelina\nKenia\nLizette\nJohana\nAmelie\nNatalya\nShakira\nJoana\nIyana\nYaritza\nElissa\nBelinda\nKamila\nMireya\nAlysa\nKatelin\nEricka\nRhianna\nMakaila\nJasmyn\nKya\nAkira\nSavana\nMadisen\nLilyana\nScarlet\nArlene\nAreli\nTierra\nMira\nMadilynn\nGraciela\nShyla\nChana\nSally\nKelli\nRobin\nElsie\nIreland\nCarson\nMina\nKourtney\nRoselyn\nBraelyn\nJazlynn\nKacie\nZara\nMiya\nEstefania\nBeatriz\nAdelyn\nRocio\nLondyn\nBeatrice\nKasandra\nChristiana\nKinsey\nLina\nCarli\nSydni\nJackeline\nGalilea\nJaniah\nLilia\nBerenice\nSky\nCandice\nMelinda\nBrianne\nJailyn\nJalynn\nAnita\nSelah\nUnique\nDevon\nFabiola\nMaryam\nAverie\nHayleigh\nMyra\nTracy\nCailyn\nTaniyah\nReilly\nJoelle\nDahlia\nAmaris\nAli\nLilianna\nAnissa\nElyssa\nCaleigh\nLyndsey\nLeyla\nDania\nDiane\nCasandra\nDasia\nIyanna\nJana\nSarina\nShreya\nSilvia\nAlani\nLexus\nSydnie\nDarlene\nBriley\nAudrina\nMckinley\nDenisse\nAnjali\nSamira\nRobyn\nDelia\nRiya\nDeasia\nLacy\nJaylen\nAdalyn\nTatianna\nBryana\nAshtyn\nCelina\nJazmyne\nNathalia\nKalyn\nCitlali\nRoxana\nTaya\nAnabel\nJayde\nAlexandrea\nLivia\nJocelynn\nMaryjane\nLacie\nAmirah\nSonya\nValery\nAnais\nMariyah\nLucero\nMandy\nChristy\nJaime\nLuisa\nYamilet\nAllyssa\nPearl\nJaylah\nVanesa\nGemma\nKeila\nMarin\nKaty\nDrew\nMaren\nCloe\nYahaira\nFinley\nAzaria\nChrista\nAdyson\nYolanda\nLoren\nCharlee\nMarlen\nKacey\nHeidy\nAlexys\nRita\nBridgette\nLuciana\nKellie\nRoxanne\nEstefani\nKaci\nJoselin\nEstefany\nJacklyn\nRachelle\nAlex\nJaquelin\nKylah\nDianna\nKaris\nNoor\nAsha\nTreasure\nGwyneth\nMylee\nFlor\nKelsi\nLeia\nCarleigh\nAlannah\nRayne\nAveri\nYessenia\nRory\nKeeley\nEmelia\nMarian\nGiuliana\nShiloh\nJanie\nBonnie\nAstrid\nCaitlynn\nAddie\nBree\nLourdes\nRhea\nWinter\nAdison\nBrook\nTrisha\nKristine\nYvonne\nYaretzi\nDallas\nEryn\nBreonna\nTayla\nJuana\nAriella\nKaterina\nMalaysia\nPriscila\nNylah\nKyndall\nShawna\nKori\nAnabella\nAliana\nSheyla\nMilagros\nNorma\nTristan\nLidia\nKarma\nAmalia\nMalaya\nKatia\nBryn\nReece\nKayleen\nAdamaris\nGabriel\nJolene\nEmani\nKarsyn\nDarby\nJuanita\nReanna\nRianna\nMilan\nKeara\nMelisa\nBrionna\nJeanette\nMarcella\nNadine\nAudra\nLillianna\nAbrianna\nMaegan\nDiya\nIsla\nChyna\nEvie\nKaela\nSade\nElianna\nJoseline\nKaycee\nAlaysia\nAlyvia\nNeha\nJordin\nLori\nAnisa\nIzabelle\nLisbeth\nRivka\nNoel\nHarlee\nRosalinda\nConstance\nAlycia\nIvana\nEmmy\nRaelynn' |
n = int(input())
grid = []
for i in range(n):
grid.append([int(x) for x in input().split(' ')])
def valid(g):
for y in range(n):
for x in range(n):
if (x+1 < n):
if not (g[y][x] < g[y][x+1]):
return False
if (y+1 < n):
if not (g[y][x] < g[y+1][x]):
return False
return True
while True:
if not valid(grid):
grid = [list(arr) for arr in zip(*grid[::-1])]
else:
break
for flower in grid:
print(' '.join([str(k) for k in flower]))
| n = int(input())
grid = []
for i in range(n):
grid.append([int(x) for x in input().split(' ')])
def valid(g):
for y in range(n):
for x in range(n):
if x + 1 < n:
if not g[y][x] < g[y][x + 1]:
return False
if y + 1 < n:
if not g[y][x] < g[y + 1][x]:
return False
return True
while True:
if not valid(grid):
grid = [list(arr) for arr in zip(*grid[::-1])]
else:
break
for flower in grid:
print(' '.join([str(k) for k in flower])) |
# https://atcoder.jp/contests/math-and-algorithm/tasks/typical90_n
n = int(input())
aa = list(sorted(map(int, input().split())))
bb = list(sorted(map(int, input().split())))
print(sum([abs(aa[i] - bb[i]) for i in range(n)])) | n = int(input())
aa = list(sorted(map(int, input().split())))
bb = list(sorted(map(int, input().split())))
print(sum([abs(aa[i] - bb[i]) for i in range(n)])) |
class RegistObject(object):
def __init__(self,object_name,scope=None,params=None):
self.object_name=object_name
self.scope=scope
self.params=params
class RegistObjectName(object):
def __init__(self,object_name,scope=None):
self.object_name=object_name
self.scope=scope
class Content(object):
def __init__(self,type,value,element_number,line=0,column=0):
self.type=type
self.value=value
self.element_number=element_number
self.line=line
self.column=column | class Registobject(object):
def __init__(self, object_name, scope=None, params=None):
self.object_name = object_name
self.scope = scope
self.params = params
class Registobjectname(object):
def __init__(self, object_name, scope=None):
self.object_name = object_name
self.scope = scope
class Content(object):
def __init__(self, type, value, element_number, line=0, column=0):
self.type = type
self.value = value
self.element_number = element_number
self.line = line
self.column = column |
# LEER
panchofile = open('panchofile.txt', 'w')
print(panchofile)
# r = panchofile.readlines()
# panchofile.write("\nVerso 1")
panchofile.close()
| panchofile = open('panchofile.txt', 'w')
print(panchofile)
panchofile.close() |
"""Constants for readme."""
# Base component constants
DOMAIN = "readme"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.2.1"
REQUIRED_FILES = [
"translations/en.json",
"const.py",
"config_flow.py",
"default.j2",
"manifest.json",
"services.yaml",
]
ISSUE_URL = "https://github.com/custom-components/readme/issues"
| """Constants for readme."""
domain = 'readme'
domain_data = f'{DOMAIN}_data'
version = '0.2.1'
required_files = ['translations/en.json', 'const.py', 'config_flow.py', 'default.j2', 'manifest.json', 'services.yaml']
issue_url = 'https://github.com/custom-components/readme/issues' |
class Foo:
@staticmethod
def bar(x):
"""bar() can be called without instantiating from Foo"""
print(x, "on class")
def nbar(self, x):
"""nbar() can be used on an instance of Foo"""
print(x, "on", self)
Foo.bar("class bar")
# Foo.nbar("class nbar")
# Foo.nbar(Foo, "class nbar")
foo = Foo()
foo.bar("instance bar")
foo.nbar("instance nbar") | class Foo:
@staticmethod
def bar(x):
"""bar() can be called without instantiating from Foo"""
print(x, 'on class')
def nbar(self, x):
"""nbar() can be used on an instance of Foo"""
print(x, 'on', self)
Foo.bar('class bar')
foo = foo()
foo.bar('instance bar')
foo.nbar('instance nbar') |
"""Double linked list class defined."""
class DoublylinkedList:
def __init__(self):
self.head = None
self.tail = None
def set_head_to(self, node):
if self.head == node:
return
elif self.head is None:
self.head = node
self.tail = node
elif self.head == self.tail:
self.tail.prev = node
self.head = node
self.head.next = self.tail
else:
if self.tail == node:
self.remove_tail()
node.remove_bindings()
self.head.prev = node
node.next = self.head
self.head = node
def remove_tail(self):
if self.tail is None:
return
if self.tail == self.head:
self.tail = None
self.head = None
return
self.tail = self.tail.prev
self.next = None
| """Double linked list class defined."""
class Doublylinkedlist:
def __init__(self):
self.head = None
self.tail = None
def set_head_to(self, node):
if self.head == node:
return
elif self.head is None:
self.head = node
self.tail = node
elif self.head == self.tail:
self.tail.prev = node
self.head = node
self.head.next = self.tail
else:
if self.tail == node:
self.remove_tail()
node.remove_bindings()
self.head.prev = node
node.next = self.head
self.head = node
def remove_tail(self):
if self.tail is None:
return
if self.tail == self.head:
self.tail = None
self.head = None
return
self.tail = self.tail.prev
self.next = None |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@author: jayzhen
@license: Apache Licence
@version: v1.0
@contact: jayzhen_testing@163.com
@site: http://blog.csdn.net/u013948858
@file: __init__.py.py
@time: 2017/10/27 22:50
"""
| """
@author: jayzhen
@license: Apache Licence
@version: v1.0
@contact: jayzhen_testing@163.com
@site: http://blog.csdn.net/u013948858
@file: __init__.py.py
@time: 2017/10/27 22:50
""" |
class State:
def __init__(self, words_following_dict, name, type_dict):
self.words_following_dict = words_following_dict # Dictionary of words which lead to new states
self.name = name # name of the state
self.type_dict = type_dict #dict of type "State_name" : State to avoid circular problem
def __str__(self):
return "[State: " + self.name + "]"
def __eq__(self, other):
return str(self) == str(other)
def get_next_state(self, word_read):
for word in self.words_following_dict:
if word_read == word:
return self.type_dict[self.words_following_dict[word]]
return None
| class State:
def __init__(self, words_following_dict, name, type_dict):
self.words_following_dict = words_following_dict
self.name = name
self.type_dict = type_dict
def __str__(self):
return '[State: ' + self.name + ']'
def __eq__(self, other):
return str(self) == str(other)
def get_next_state(self, word_read):
for word in self.words_following_dict:
if word_read == word:
return self.type_dict[self.words_following_dict[word]]
return None |
####################################################################################
# Larabot Discord Bot
# MIT License
# Copyright (c) 2017 Devitgg
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
####################################################################################
####################### Documentation ######################
# Coming Later
############################################################
def token():
token = 'insert here'
return token
def googleKey():
this = 'insert here'
return this
def modAuthority(message):
approvedRoles = ['insert here']
for role in message.server.roles:
for approved in approvedRoles:
if approved == role.name:
return True
def adminAuthority(message):
approvedRoles = ['insert here']
for role in message.server.roles:
for approved in approvedRoles:
if approved == role.name:
return True
def roleChannel():
this = 'role_request'
return this
def searchCommand():
this = 'oogle>'
return this
def googleResultCount():
this = 5
return this
def anonCommand():
this = 'anon>'
return this
def anonChannel():
this = 'dev_confessions'
return this
def helpCommand():
this = 'help>'
return this
def codeCommand():
this = '>'
return this
def addRoleCommand():
this = 'add>'
return this
def removeRoleCommand():
this = 'remove>'
return this
def kickCommand():
this = 'kick>'
return this
def banCommand():
this = 'ban>'
return this
def plusRepCommand():
this = 'rep>'
return this
def viewRepCommand():
this = 'view>'
return this
def roleInfoCommand():
this = 'roles>'
return this
def clearCommand():
this = 'clear>'
return this
| def token():
token = 'insert here'
return token
def google_key():
this = 'insert here'
return this
def mod_authority(message):
approved_roles = ['insert here']
for role in message.server.roles:
for approved in approvedRoles:
if approved == role.name:
return True
def admin_authority(message):
approved_roles = ['insert here']
for role in message.server.roles:
for approved in approvedRoles:
if approved == role.name:
return True
def role_channel():
this = 'role_request'
return this
def search_command():
this = 'oogle>'
return this
def google_result_count():
this = 5
return this
def anon_command():
this = 'anon>'
return this
def anon_channel():
this = 'dev_confessions'
return this
def help_command():
this = 'help>'
return this
def code_command():
this = '>'
return this
def add_role_command():
this = 'add>'
return this
def remove_role_command():
this = 'remove>'
return this
def kick_command():
this = 'kick>'
return this
def ban_command():
this = 'ban>'
return this
def plus_rep_command():
this = 'rep>'
return this
def view_rep_command():
this = 'view>'
return this
def role_info_command():
this = 'roles>'
return this
def clear_command():
this = 'clear>'
return this |
class Solution(object):
def longestValidParentheses(self, s):
"""
:type s: str
:rtype: int
"""
k = [0]
c = 0
ans = 0
for i in range(len(s)):
if s[i] == '(':
c += 1
else:
c -= 1
k.append(c)
p = []
for i in range(len(k))[::-1]:
if not len(p):
p.append([k[i], i])
else:
if k[i] > p[len(p) - 1][0]:
p.append([k[i], i])
elif k[i] < p[len(p) - 1][0]:
while len(p) and k[i] < p[len(p) - 1][0]:
p.pop()
if not len(p) or k[i] > p[len(p) - 1][0]:
p.append([k[i], i])
if len(p) and k[i] == p[len(p) - 1][0]:
if p[len(p) - 1][1] - i > ans:
ans = p[len(p) - 1][1] - i
return ans
| class Solution(object):
def longest_valid_parentheses(self, s):
"""
:type s: str
:rtype: int
"""
k = [0]
c = 0
ans = 0
for i in range(len(s)):
if s[i] == '(':
c += 1
else:
c -= 1
k.append(c)
p = []
for i in range(len(k))[::-1]:
if not len(p):
p.append([k[i], i])
elif k[i] > p[len(p) - 1][0]:
p.append([k[i], i])
elif k[i] < p[len(p) - 1][0]:
while len(p) and k[i] < p[len(p) - 1][0]:
p.pop()
if not len(p) or k[i] > p[len(p) - 1][0]:
p.append([k[i], i])
if len(p) and k[i] == p[len(p) - 1][0]:
if p[len(p) - 1][1] - i > ans:
ans = p[len(p) - 1][1] - i
return ans |
employee_one = int(input())
employee_two = int(input())
employee_three = int(input())
people_count = int(input())
all_employees = employee_one + employee_two + employee_three # this many per hour
people_answered = 0
hours_needed =0
while people_answered < people_count:
hours_needed += 1
if hours_needed % 4 == 0:
people_answered += 0
else:
people_answered += all_employees
print('Time needed: {}h.'.format(hours_needed)) | employee_one = int(input())
employee_two = int(input())
employee_three = int(input())
people_count = int(input())
all_employees = employee_one + employee_two + employee_three
people_answered = 0
hours_needed = 0
while people_answered < people_count:
hours_needed += 1
if hours_needed % 4 == 0:
people_answered += 0
else:
people_answered += all_employees
print('Time needed: {}h.'.format(hours_needed)) |
def loadyaml(path):
'''
Read the config file with yaml
:param path: the config file path
:return: bidict
'''
doc = []
if os.path.exists(path):
with codecs.open(path, 'r') as yf:
doc = yaml.safe_load(yf)
return doc
| def loadyaml(path):
"""
Read the config file with yaml
:param path: the config file path
:return: bidict
"""
doc = []
if os.path.exists(path):
with codecs.open(path, 'r') as yf:
doc = yaml.safe_load(yf)
return doc |
n = 0
for i in range(1,6):
n = n + 1
print(n)
print('\n')
n = 0
for i in range(1,11):
n = n + 1
print(n)
print('\n')
n = 0
for i in range(0,6):
n = n+i**2
print(n)
print('\n')
n = 0
for i in range(0,6):
n = n+i**3
print(n)
print('\n')
n = 0
for i in range(0,6):
n = n + (i - 1)**2
print(n)
print('\n')
n = 1
for i in range(0,6):
n = i*(n-1)/2
print(n)
print('\n') | n = 0
for i in range(1, 6):
n = n + 1
print(n)
print('\n')
n = 0
for i in range(1, 11):
n = n + 1
print(n)
print('\n')
n = 0
for i in range(0, 6):
n = n + i ** 2
print(n)
print('\n')
n = 0
for i in range(0, 6):
n = n + i ** 3
print(n)
print('\n')
n = 0
for i in range(0, 6):
n = n + (i - 1) ** 2
print(n)
print('\n')
n = 1
for i in range(0, 6):
n = i * (n - 1) / 2
print(n)
print('\n') |
#
# PySNMP MIB module MY-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MY-TC
# Produced by pysmi-0.3.4 at Wed May 1 14:16:14 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")
ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
myModules, = mibBuilder.importSymbols("MY-SMI", "myModules")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Bits, Unsigned32, IpAddress, ModuleIdentity, Counter32, ObjectIdentity, Integer32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, TimeTicks, Gauge32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Unsigned32", "IpAddress", "ModuleIdentity", "Counter32", "ObjectIdentity", "Integer32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "TimeTicks", "Gauge32", "iso")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
myTextualConventions = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 10, 97, 4, 1))
myTextualConventions.setRevisions(('2002-03-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: myTextualConventions.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts: myTextualConventions.setLastUpdated('200203200000Z')
if mibBuilder.loadTexts: myTextualConventions.setOrganization('D-Link Crop.')
if mibBuilder.loadTexts: myTextualConventions.setContactInfo(' http://support.dlink.com')
if mibBuilder.loadTexts: myTextualConventions.setDescription('This module defines textual conventions used throughout my enterprise mibs.')
class IfIndex(TextualConvention, Integer32):
description = 'This textual convention is an extension of the interface index convention. Interface include physical port and aggreate port and switch virtual interface and loopBack interface,etc.'
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 2147483647)
class MyTrapType(TextualConvention, Integer32):
description = 'Private trap(event) type of my switch. '
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27))
namedValues = NamedValues(("coldMy", 1), ("warmMy", 2), ("linkDown", 3), ("linkUp", 4), ("authenFailure", 5), ("newRoot", 6), ("topoChange", 7), ("hardChangeDetected", 8), ("portSecurityViolate", 9), ("stormAlarm", 10), ("macNotification", 11), ("vrrpNewMaster", 12), ("vrrpAuthFailure", 13), ("powerStateChange", 14), ("fanStateChange", 15), ("ospf", 16), ("pim", 17), ("igmp", 18), ("dvmrp", 19), ("entity", 20), ("cluster", 21), ("temperatureWarning", 22), ("sysGuard", 23), ("bgp", 24), ("lineDetect", 25), ("bgpReachMaxPrefix", 26), ("hardwareNotSupport", 27))
class ConfigStatus(TextualConvention, Integer32):
description = "Represents the operational status of an table entry. valid(1) - Indicates this entry's status is valid and active. invalid(2) - Indicates this entry's status is invalid. It is decided by implementatio whether entry is delete"
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("valid", 1), ("invalid", 2))
class MemberMap(TextualConvention, OctetString):
description = 'Each octet indicate a Logic port, and each octect can have their content means. The lenth of octet string will change along with change of product.'
status = 'current'
mibBuilder.exportSymbols("MY-TC", PYSNMP_MODULE_ID=myTextualConventions, MemberMap=MemberMap, ConfigStatus=ConfigStatus, MyTrapType=MyTrapType, IfIndex=IfIndex, myTextualConventions=myTextualConventions)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint')
(my_modules,) = mibBuilder.importSymbols('MY-SMI', 'myModules')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(bits, unsigned32, ip_address, module_identity, counter32, object_identity, integer32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, notification_type, time_ticks, gauge32, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Unsigned32', 'IpAddress', 'ModuleIdentity', 'Counter32', 'ObjectIdentity', 'Integer32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'NotificationType', 'TimeTicks', 'Gauge32', 'iso')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
my_textual_conventions = module_identity((1, 3, 6, 1, 4, 1, 171, 10, 97, 4, 1))
myTextualConventions.setRevisions(('2002-03-20 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
myTextualConventions.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts:
myTextualConventions.setLastUpdated('200203200000Z')
if mibBuilder.loadTexts:
myTextualConventions.setOrganization('D-Link Crop.')
if mibBuilder.loadTexts:
myTextualConventions.setContactInfo(' http://support.dlink.com')
if mibBuilder.loadTexts:
myTextualConventions.setDescription('This module defines textual conventions used throughout my enterprise mibs.')
class Ifindex(TextualConvention, Integer32):
description = 'This textual convention is an extension of the interface index convention. Interface include physical port and aggreate port and switch virtual interface and loopBack interface,etc.'
status = 'current'
display_hint = 'd'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(1, 2147483647)
class Mytraptype(TextualConvention, Integer32):
description = 'Private trap(event) type of my switch. '
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27))
named_values = named_values(('coldMy', 1), ('warmMy', 2), ('linkDown', 3), ('linkUp', 4), ('authenFailure', 5), ('newRoot', 6), ('topoChange', 7), ('hardChangeDetected', 8), ('portSecurityViolate', 9), ('stormAlarm', 10), ('macNotification', 11), ('vrrpNewMaster', 12), ('vrrpAuthFailure', 13), ('powerStateChange', 14), ('fanStateChange', 15), ('ospf', 16), ('pim', 17), ('igmp', 18), ('dvmrp', 19), ('entity', 20), ('cluster', 21), ('temperatureWarning', 22), ('sysGuard', 23), ('bgp', 24), ('lineDetect', 25), ('bgpReachMaxPrefix', 26), ('hardwareNotSupport', 27))
class Configstatus(TextualConvention, Integer32):
description = "Represents the operational status of an table entry. valid(1) - Indicates this entry's status is valid and active. invalid(2) - Indicates this entry's status is invalid. It is decided by implementatio whether entry is delete"
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('valid', 1), ('invalid', 2))
class Membermap(TextualConvention, OctetString):
description = 'Each octet indicate a Logic port, and each octect can have their content means. The lenth of octet string will change along with change of product.'
status = 'current'
mibBuilder.exportSymbols('MY-TC', PYSNMP_MODULE_ID=myTextualConventions, MemberMap=MemberMap, ConfigStatus=ConfigStatus, MyTrapType=MyTrapType, IfIndex=IfIndex, myTextualConventions=myTextualConventions) |
class Organism:
alive = True
class Animal(Organism):
def eat(self):
print("This animal is eating!")
class Dog(Animal):
def bark(self):
print("This dog is barking!")
dog = Dog()
print(dog.alive)
dog.eat()
dog.bark()
| class Organism:
alive = True
class Animal(Organism):
def eat(self):
print('This animal is eating!')
class Dog(Animal):
def bark(self):
print('This dog is barking!')
dog = dog()
print(dog.alive)
dog.eat()
dog.bark() |
def test_firstname_lastname_address(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.firstname == contact_from_edit_page.firstname
assert contact_from_home_page.lastname == contact_from_edit_page.lastname
assert contact_from_home_page.address == contact_from_edit_page.address | def test_firstname_lastname_address(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.firstname == contact_from_edit_page.firstname
assert contact_from_home_page.lastname == contact_from_edit_page.lastname
assert contact_from_home_page.address == contact_from_edit_page.address |
def multiples ():
y = list (range(1,21))
for x in y:
if x % 2 == 0:
print(x)
multiples() | def multiples():
y = list(range(1, 21))
for x in y:
if x % 2 == 0:
print(x)
multiples() |
n=str(input("Enter the string"))
le=len(n)
count=0
for i in range(le-1):
for j in range(le):
if n[j]==n[i]:
count=count+1
else:
continue
print("%s count is :%d"%(n[i],count))
count=0
| n = str(input('Enter the string'))
le = len(n)
count = 0
for i in range(le - 1):
for j in range(le):
if n[j] == n[i]:
count = count + 1
else:
continue
print('%s count is :%d' % (n[i], count))
count = 0 |
statusT = """
VAULT: {}
KEY: {}
PROJECT: {}
ENV: {}
AWS/profile? {}
AWS/key? {}
AWS/secret? {}"""
helpT = """
1. Run setup
2. Check that AWS environment variables for profile OR key+secret are set
"""
| status_t = '\nVAULT: {}\nKEY: {}\nPROJECT: {} \nENV: {}\nAWS/profile? {}\nAWS/key? {}\nAWS/secret? {}'
help_t = '\n1. Run setup\n2. Check that AWS environment variables for profile OR key+secret are set\n' |
# Databricks notebook source
# MAGIC %md
# MAGIC References:<br>
# MAGIC https://docs.azuredatabricks.net/user-guide/secrets/secrets.html<br>
# MAGIC https://docs.azuredatabricks.net/spark/latest/data-sources/azure/azure-storage.html<br>
# MAGIC https://docs.azuredatabricks.net/user-guide/dbfs-databricks-file-system.html<br>
# MAGIC
# MAGIC Notes:
# MAGIC DBFS commands are very specific. Some hard-coding/specific formats -required-.
# MAGIC
# MAGIC Prefer Azure Key Vault for secret storage.<br>
# MAGIC Create Azure Key Vault, store secret there. Then create ADB secret scope.<br>
# MAGIC Then use secret scope and storage acct info to mount storage acct/container to DBFS mount point.
# COMMAND ----------
storageAcctName = "pxbrixsa"
containerName = "hack"
secretScopeName = "pzbrixscope"
secretName = "pzbrixsakey"
mountPoint = "/mnt/" + containerName
# COMMAND ----------
# Explicit version works but hard-codes container and storage account names - have not been able to get this to work with variables and string concat
dbutils.fs.mount(
source = "wasbs://hack@sa.blob.core.windows.net",
mount_point = mountPoint,
extra_configs = {"fs.azure.account.key.pzbrixsa.blob.core.windows.net":dbutils.secrets.get(scope = secretScopeName, key = secretName)}
)
# COMMAND ----------
# This (or a version of the above using variables) does not work. Gets java.lang.IllegalArgumentException due to invalid mount source. ??
dbutils.fs.mount(
"wasbs://{cn}@{san}.blob.core.windows.net"
.format(
cn=containerName,
san=storageAcctName),
"/mnt/{mn}".format(mn=mountPoint)
)
# COMMAND ----------
# ls in the newly mounted mount point / in the mounted container
display(dbutils.fs.ls("/mnt/" + containerName))
# COMMAND ----------
# Unmount the storage mount point
dbutils.fs.unmount("/mnt/" + containerName)
# COMMAND ----------
# Refresh mounts on other clusters than the one that ran DBFS commands
dbutils.fs.refreshMounts()
# COMMAND ----------
display(dbutils.fs.ls("/mnt"))
# COMMAND ----------
| storage_acct_name = 'pxbrixsa'
container_name = 'hack'
secret_scope_name = 'pzbrixscope'
secret_name = 'pzbrixsakey'
mount_point = '/mnt/' + containerName
dbutils.fs.mount(source='wasbs://hack@sa.blob.core.windows.net', mount_point=mountPoint, extra_configs={'fs.azure.account.key.pzbrixsa.blob.core.windows.net': dbutils.secrets.get(scope=secretScopeName, key=secretName)})
dbutils.fs.mount('wasbs://{cn}@{san}.blob.core.windows.net'.format(cn=containerName, san=storageAcctName), '/mnt/{mn}'.format(mn=mountPoint))
display(dbutils.fs.ls('/mnt/' + containerName))
dbutils.fs.unmount('/mnt/' + containerName)
dbutils.fs.refreshMounts()
display(dbutils.fs.ls('/mnt')) |
#!/usr/bin/env python3
"""module: syllable_filter
author: R Steiner
license: MIT, copyright (c) 2016 R Steiner
Contains class SyllableFilter.
"""
class SyllableFilter:
"""This script takes a list of words and returns only those with the
specified number of syllables. Syllables will be counted heuristically,
as the number of vowels.
Methods:
__init__ -- constructor for a SyllableFilter object.
count_syllables -- returns the number of syllables (vowels) in a word.
filter_words -- returns a list of the words from the corpus with the desired
number of syllables.
"""
def __init__(self, **kwargs):
"""Constructor for the SyllableFilter class.
Keyword arguments:
corpus -- The path to the file containing the words in the corpus. The
file should have one word per line. (default:
"../databases/iphod/IPhOD2_Words_phono_only.txt")
vowels -- Either a list of the characters used as vowels in the corpus,
or the path to a file containing these, with one vowel per line.
(default: "../databases/iphod/cmu_vowels.txt")
sep -- A string to use as the delimiter for separating phonemes in the
words in the corpus. It can be an empty string (""), which will break
the words into individual characters. (default: ".")
"""
corpus = kwargs.get("corpus",
"../databases/iphod/iphod_words_phono_only.txt")
vowels = kwargs.get("vowels", "../databases/iphod/cmu_vowels.txt")
self.sep = kwargs.get("sep", ".")
# Read the corpus file line-by-line, and create a list from the lines.
with open(corpus, 'r') as corpusfile:
self.corpus = [word[:-1] for word in corpusfile]
# If user provided a string for "vowels", assume it is a file path and
# read it. Create a list of the lines in the file.
if type(vowels) == str:
with open(vowels, 'r') as vowelfile:
self.vowels = [vowel[:-1] for vowel in vowelfile]
# If they did not provide a string, check to make sure they provided a
# list (of vowels) instead. If they did not, raise an error.
else:
assert(type(vowels) == list)
self.vowels = vowels
def count_syllables(self, word):
"""Returns the number of syllables (vowels) in a word.
Arguments:
word -- the word to be analyzed
"""
counter = 0
phonemes = word.split(self.sep)
for phoneme in phonemes:
counter += 1 if phoneme in self.vowels else 0
return counter
def filter_words(self, nsyll):
"""Returns a list of the words with the desired number of syllables.
Arguments:
nsyll -- an integer or list of integers containing the number of
syllables desired.
"""
nsyll = [nsyll] if type(nsyll) == int else nsyll
self.match = list(filter(lambda w: self.count_syllables(w) in nsyll,
self.corpus))
if __name__ == "__main__":
my_filter = SyllableFilter()
my_filter.filter_words(1)
with open("../databases/iphod/iphod_words_monosyllabic_phono_only.txt",
"w") as f:
f.write("\n".join(my_filter.match))
| """module: syllable_filter
author: R Steiner
license: MIT, copyright (c) 2016 R Steiner
Contains class SyllableFilter.
"""
class Syllablefilter:
"""This script takes a list of words and returns only those with the
specified number of syllables. Syllables will be counted heuristically,
as the number of vowels.
Methods:
__init__ -- constructor for a SyllableFilter object.
count_syllables -- returns the number of syllables (vowels) in a word.
filter_words -- returns a list of the words from the corpus with the desired
number of syllables.
"""
def __init__(self, **kwargs):
"""Constructor for the SyllableFilter class.
Keyword arguments:
corpus -- The path to the file containing the words in the corpus. The
file should have one word per line. (default:
"../databases/iphod/IPhOD2_Words_phono_only.txt")
vowels -- Either a list of the characters used as vowels in the corpus,
or the path to a file containing these, with one vowel per line.
(default: "../databases/iphod/cmu_vowels.txt")
sep -- A string to use as the delimiter for separating phonemes in the
words in the corpus. It can be an empty string (""), which will break
the words into individual characters. (default: ".")
"""
corpus = kwargs.get('corpus', '../databases/iphod/iphod_words_phono_only.txt')
vowels = kwargs.get('vowels', '../databases/iphod/cmu_vowels.txt')
self.sep = kwargs.get('sep', '.')
with open(corpus, 'r') as corpusfile:
self.corpus = [word[:-1] for word in corpusfile]
if type(vowels) == str:
with open(vowels, 'r') as vowelfile:
self.vowels = [vowel[:-1] for vowel in vowelfile]
else:
assert type(vowels) == list
self.vowels = vowels
def count_syllables(self, word):
"""Returns the number of syllables (vowels) in a word.
Arguments:
word -- the word to be analyzed
"""
counter = 0
phonemes = word.split(self.sep)
for phoneme in phonemes:
counter += 1 if phoneme in self.vowels else 0
return counter
def filter_words(self, nsyll):
"""Returns a list of the words with the desired number of syllables.
Arguments:
nsyll -- an integer or list of integers containing the number of
syllables desired.
"""
nsyll = [nsyll] if type(nsyll) == int else nsyll
self.match = list(filter(lambda w: self.count_syllables(w) in nsyll, self.corpus))
if __name__ == '__main__':
my_filter = syllable_filter()
my_filter.filter_words(1)
with open('../databases/iphod/iphod_words_monosyllabic_phono_only.txt', 'w') as f:
f.write('\n'.join(my_filter.match)) |
# -*- coding: utf-8 -*-
class ConnectorException(Exception):
pass
class UnsupportedDriver(ConnectorException):
def __init__(self, driver):
message = 'Driver "%s" is not supported' % driver
super(UnsupportedDriver, self).__init__(message)
| class Connectorexception(Exception):
pass
class Unsupporteddriver(ConnectorException):
def __init__(self, driver):
message = 'Driver "%s" is not supported' % driver
super(UnsupportedDriver, self).__init__(message) |
"""
Useful annotators
"""
def auto_str(cls):
"""
Add implementation of __str__ and __repr__ functions to a class
"""
def __str__(self):
return type(self).__name__ + '{' + ','.join(f'{k}={str(v)}' for k, v, in vars(self).items()) + '}'
def __repr__(self):
return type(self).__qualname__ + '{' + ','.join(f'{k}={repr(v)}' for k, v, in vars(self).items()) + '}'
cls.__str__ = __str__
cls.__repr__ = __repr__
return cls
def singleton(cls):
"""
Add get_instance method
"""
cls._instance = None
def get_instance():
if cls._instance is None:
cls._instance = cls()
return cls._instance
cls.get_instance = get_instance
return cls
| """
Useful annotators
"""
def auto_str(cls):
"""
Add implementation of __str__ and __repr__ functions to a class
"""
def __str__(self):
return type(self).__name__ + '{' + ','.join((f'{k}={str(v)}' for (k, v) in vars(self).items())) + '}'
def __repr__(self):
return type(self).__qualname__ + '{' + ','.join((f'{k}={repr(v)}' for (k, v) in vars(self).items())) + '}'
cls.__str__ = __str__
cls.__repr__ = __repr__
return cls
def singleton(cls):
"""
Add get_instance method
"""
cls._instance = None
def get_instance():
if cls._instance is None:
cls._instance = cls()
return cls._instance
cls.get_instance = get_instance
return cls |
# added but not implemented. Not convinced its needed yet,
"""
from fabric.api import local
myapp = "DictionaryOfNewZealandEnglish"
def prepare_deployment(branch_name):
local('python manage.py test ' + myapp)
local('git add -p && git commit')
local('git checkout master && git merge ' + branch_name)
from fabric.api import lcd
def deploy():
with lcd('/path/to/my/prod/area/'):
local('git pull /my/path/to/dev/area/')
local('python manage.py migrate ' + myapp)
local('python manage.py test ' + myapp)
local('/my/command/to/restart/webserver')
"""
| """
from fabric.api import local
myapp = "DictionaryOfNewZealandEnglish"
def prepare_deployment(branch_name):
local('python manage.py test ' + myapp)
local('git add -p && git commit')
local('git checkout master && git merge ' + branch_name)
from fabric.api import lcd
def deploy():
with lcd('/path/to/my/prod/area/'):
local('git pull /my/path/to/dev/area/')
local('python manage.py migrate ' + myapp)
local('python manage.py test ' + myapp)
local('/my/command/to/restart/webserver')
""" |
class TransactCounterSingleton(object):
def __new__(cls):
if not hasattr(cls, 'instance'):
cls.instance = super(TransactCounterSingleton, cls).__new__(cls)
cls.instance.count = 0
return cls.instance
@staticmethod
def get_id():
result = TransactCounterSingleton().count
TransactCounterSingleton().count += 1
return result
class Transact:
def __init__(self, move_moment, current_block):
self.create_moment = move_moment
self.move_moment = move_moment
self._id = TransactCounterSingleton.get_id()
self.current_block = current_block
self.blocked = False
@property
def id(self):
return self._id
def __str__(self):
return "{},{},{},{}".format(self.id, round(self.move_moment, 1), type(self.current_block).__name__[:3],
type(self.current_block.get_next_block(self)).__name__[:3])
| class Transactcountersingleton(object):
def __new__(cls):
if not hasattr(cls, 'instance'):
cls.instance = super(TransactCounterSingleton, cls).__new__(cls)
cls.instance.count = 0
return cls.instance
@staticmethod
def get_id():
result = transact_counter_singleton().count
transact_counter_singleton().count += 1
return result
class Transact:
def __init__(self, move_moment, current_block):
self.create_moment = move_moment
self.move_moment = move_moment
self._id = TransactCounterSingleton.get_id()
self.current_block = current_block
self.blocked = False
@property
def id(self):
return self._id
def __str__(self):
return '{},{},{},{}'.format(self.id, round(self.move_moment, 1), type(self.current_block).__name__[:3], type(self.current_block.get_next_block(self)).__name__[:3]) |
"""Constants for the Integration - Riemann sum integral integration."""
DOMAIN = "integration"
CONF_ROUND_DIGITS = "round"
CONF_SOURCE_SENSOR = "source"
CONF_UNIT_OF_MEASUREMENT = "unit"
CONF_UNIT_PREFIX = "unit_prefix"
CONF_UNIT_TIME = "unit_time"
METHOD_TRAPEZOIDAL = "trapezoidal"
METHOD_LEFT = "left"
METHOD_RIGHT = "right"
INTEGRATION_METHODS = [METHOD_TRAPEZOIDAL, METHOD_LEFT, METHOD_RIGHT]
| """Constants for the Integration - Riemann sum integral integration."""
domain = 'integration'
conf_round_digits = 'round'
conf_source_sensor = 'source'
conf_unit_of_measurement = 'unit'
conf_unit_prefix = 'unit_prefix'
conf_unit_time = 'unit_time'
method_trapezoidal = 'trapezoidal'
method_left = 'left'
method_right = 'right'
integration_methods = [METHOD_TRAPEZOIDAL, METHOD_LEFT, METHOD_RIGHT] |
BOT_NAME = 'GroeneScrapy'
SPIDER_MODULES = ['GroeneScrapy.spiders']
NEWSPIDER_MODULE = 'GroeneScrapy.spiders'
LOG_LEVEL = 'ERROR'
GROENE_USERNAME = 'Enter your e-mail address here'
GROENE_PASSWORD = 'Enter your password here'
GROENE_PDF_PATH = 'GroenePDF'
| bot_name = 'GroeneScrapy'
spider_modules = ['GroeneScrapy.spiders']
newspider_module = 'GroeneScrapy.spiders'
log_level = 'ERROR'
groene_username = 'Enter your e-mail address here'
groene_password = 'Enter your password here'
groene_pdf_path = 'GroenePDF' |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Show that a list comprehension is just a 'for loop,' where you save the
output to a variable.
"""
# A 'for loop'
for x in range(0, 13):
print(x)
# The same loop, as a 'list comprehension'
[x for x in range(0, 13)]
# To save the output of the loop, we would do this:
example_list_from_for_loop = [] # Create a blank list.
for x in range(0, 13):
example_list_from_for_loop.append(x) # Add x to the end of the list.
# Alternatively, we can save the output of the 'list comprehension' format
# directly:
example_list_from_list_comprehension_loop = [x for x in range(0, 13)]
| """Show that a list comprehension is just a 'for loop,' where you save the
output to a variable.
"""
for x in range(0, 13):
print(x)
[x for x in range(0, 13)]
example_list_from_for_loop = []
for x in range(0, 13):
example_list_from_for_loop.append(x)
example_list_from_list_comprehension_loop = [x for x in range(0, 13)] |
#!/usr/bin/env python3
def blocks(height, time):
offset = 2 * height - 2
return time * height if time % offset == 0 else 0
if __name__ == '__main__':
lines = [line.split(': ') for line in open('input').read().split('\n')]
heights = {int(pos): int(height) for pos, height in lines}
print(sum(map(lambda col: blocks(heights[col], col), heights)))
delay = 0
while True:
if sum(map(lambda col: blocks(heights[col], col+delay), heights)) == 0:
print(delay)
break
else:
delay += 1 | def blocks(height, time):
offset = 2 * height - 2
return time * height if time % offset == 0 else 0
if __name__ == '__main__':
lines = [line.split(': ') for line in open('input').read().split('\n')]
heights = {int(pos): int(height) for (pos, height) in lines}
print(sum(map(lambda col: blocks(heights[col], col), heights)))
delay = 0
while True:
if sum(map(lambda col: blocks(heights[col], col + delay), heights)) == 0:
print(delay)
break
else:
delay += 1 |
class Event:
circle_event = False
@property
def x(self):
return 0
@property
def y(self):
return 0
def __lt__(self, other):
if self.y == other.y and self.x == other.x:
return self.circle_event and not other.circle_event
if self.y == other.y:
return self.x < other.x
# Switch y axis
return self.y > other.y
def __eq__(self, other):
if other is None:
return None
return self.y == other.y and self.x == other.x
def __ne__(self, other):
return not self.__eq__(other)
| class Event:
circle_event = False
@property
def x(self):
return 0
@property
def y(self):
return 0
def __lt__(self, other):
if self.y == other.y and self.x == other.x:
return self.circle_event and (not other.circle_event)
if self.y == other.y:
return self.x < other.x
return self.y > other.y
def __eq__(self, other):
if other is None:
return None
return self.y == other.y and self.x == other.x
def __ne__(self, other):
return not self.__eq__(other) |
####DEFINE COLOR SWITCH
def code_to_class_string(argument):
switcher = {
'n02691156': "airplane",
'n02419796': "antelope",
'n02131653': "bear",
'n02834778': "bicycle",
'n01503061': "bird",
'n02924116': "bus",
'n02958343': "car",
'n02402425': "cattle",
'n02084071': "dog",
'n02121808': "domestic_cat",
'n02503517': "elephant",
'n02118333': "fox",
'n02510455': "giant_panda",
'n02342885': "hamster",
'n02374451': "horse",
'n02129165': "lion",
'n01674464': "lizard",
'n02484322': "monkey",
'n03790512': "motorcycle",
'n02324045': "rabbit",
'n02509815': "red_panda",
'n02411705': "sheep",
'n01726692': "snake",
'n02355227': "squirrel",
'n02129604': "tiger",
'n04468005': "train",
'n01662784': "turtle",
'n04530566': "watercraft",
'n02062744': "whale",
'n02391049': "zebra" }
return switcher.get(argument, "nothing")
def code_to_code_chall(argument):
switcher = {
'n02691156': 1,
'n02419796': 2,
'n02131653': 3,
'n02834778': 4,
'n01503061': 5,
'n02924116': 6,
'n02958343': 7,
'n02402425': 8,
'n02084071': 9,
'n02121808': 10,
'n02503517': 11,
'n02118333': 12,
'n02510455': 13,
'n02342885': 14,
'n02374451': 15,
'n02129165': 16,
'n01674464': 17,
'n02484322': 18,
'n03790512': 19,
'n02324045': 20,
'n02509815': 21,
'n02411705': 22,
'n01726692': 23,
'n02355227': 24,
'n02129604': 25,
'n04468005': 26,
'n01662784': 27,
'n04530566': 28,
'n02062744': 29,
'n02391049': 30 }
return switcher.get(argument, "nothing")
def class_string_to_comp_code(argument):
switcher = {
'airplane': 1,
'antelope': 2,
'bear': 3,
'bicycle': 4,
'bird': 5,
'bus': 6,
'car': 7,
'cattle': 8,
'dog': 9,
'domestic_cat': 10,
'elephant': 11,
'fox': 12,
'giant_panda': 13,
'hamster': 14,
'horse': 15,
'lion': 16,
'lizard': 17,
'monkey': 18,
'motorcycle': 19,
'rabbit': 20,
'red_panda': 21,
'sheep': 22,
'snake': 23,
'squirrel': 24,
'tiger': 25,
'train': 26,
'turtle': 27,
'watercraft': 28,
'whale': 29,
'zebra': 30
}
return switcher.get(argument, None)
def code_comp_to_class(argument):
switcher = {
1:'airplane',
2:'antelope',
3:'bear',
4:'bicycle',
5:'bird',
6:'bus',
7:'car',
8:'cattle',
9:'dog',
10:'domestic_cat',
11:'elephant',
12:'fox',
13:'giant_panda',
14:'hamster',
15:'horse',
16:'lion',
17:'lizard',
18:'monkey',
19:'motorcycle',
20:'rabbit',
21:'red_panda',
22:'sheep',
23:'snake',
24:'squirrel',
25:'tiger',
26:'train',
27:'turtle',
28:'watercraft',
29:'whale',
30:'zebra' }
return switcher.get(argument, "nothing")
### Color Switching
def name_string_to_color(argument):
switcher = {
'airplane': 'black' ,
'antelope': 'white',
'bear': 'red',
'bicycle': 'lime' ,
'bird': 'blue',
'bus': 'yellow',
'car': 'cyan',
'cattle': 'magenta',
'dog': 'silver',
'domestic_cat': 'gray' ,
'elephant':'maroon' ,
'fox':'olive' ,
'giant_panda':'green' ,
'hamster':'purple' ,
'horse':'teal' ,
'lion':'navy' ,
'lizard':'pale violet red' ,
'monkey':'deep pink' ,
'motorcycle':'aqua marine' ,
'rabbit':'powder blue' ,
'red_panda':'spring green' ,
'sheep':'sea green' ,
'snake':'forest green' ,
'squirrel':'orange red' ,
'tiger':'dark orange' ,
'train':'orange' ,
'turtle':'dark golden rod' ,
'watercraft':'golden rod' ,
'whale':'dark red' ,
'zebra':'light coral' }
return switcher.get(argument, "nothing")
def code_to_color(argument):
switcher = {
1:(0,0,0),
2:(255,255,255),
3:(255,0,0),
4:(0,255,0),
5:(0,0,255),
6:(255,255,0),
7:(0,255,255),
8:(255,0,255),
9:(192,192,192),
10:(128,128,128),
11:(128,0,0),
12:(128,128,0),
13:(0,128,0),
14:(128,0,128),
15:(0,128,128),
16:(0,0,128),
17:(219,112,147),
18:(255,20,147),
19:(127,255,212),
20:(176,224,230),
21:(0,255,127),
22:(46,139,87),
23:(34,139,34),
24:(255,69,0),
25:(255,140,0),
26:(255,165,0),
27:(184,134,11),
28:(218,165,32),
29:(139,0,0),
30:(240,128,128)
}
return switcher.get(argument,(0,0,0) )
def label_to_color(argument):
switcher = {
'n02691156':(0,0,0),
'n02419796':(255,255,255),
'n02131653':(255,0,0),
'n02834778':(0,255,0),
'n01503061':(0,0,255),
'n02924116':(255,255,0),
'n02958343':(0,255,255),
'n02402425':(255,0,255),
'n02084071':(192,192,192),
'n02121808':(128,128,128),
'n02503517':(128,0,0),
'n02118333':(128,128,0),
'n02510455':(0,128,0),
'n02342885':(128,0,128),
'n02374451':(0,128,128),
'n02129165':(0,0,128),
'n01674464':(219,112,147),
'n02484322':(255,20,147),
'n03790512':(127,255,212),
'n02324045':(176,224,230),
'n02509815':(0,255,127),
'n02411705':(46,139,87),
'n01726692':(34,139,34),
'n02355227':(255,69,0),
'n02129604':(255,140,0),
'n04468005':(255,165,0),
'n01662784':(184,134,11),
'n04530566':(218,165,32),
'n02062744':(139,0,0),
'n02391049':(240,128,128)
}
return switcher.get(argument,(0,0,0) )
####### COLOR LEGEND #######
# Black #000000 (0,0,0)
# White #FFFFFF (255,255,255)
# Red #FF0000 (255,0,0)
# Lime #00FF00 (0,255,0)
# Blue #0000FF (0,0,255)
# Yellow #FFFF00 (255,255,0)
# Cyan / Aqua #00FFFF (0,255,255)
# Magenta / Fuchsia #FF00FF (255,0,255)
# Silver #C0C0C0 (192,192,192)
# Gray #808080 (128,128,128)
# Maroon #800000 (128,0,0)
# Olive #808000 (128,128,0)
# Green #008000 (0,128,0)
# Purple #800080 (128,0,128)
# Teal #008080 (0,128,128)
# Navy #000080 (0,0,128)
# pale violet red #DB7093 (219,112,147)
# deep pink #FF1493 (255,20,147)
# aqua marine #7FFFD4 (127,255,212)
# powder blue #B0E0E6 (176,224,230)
# spring green #00FF7F (0,255,127)
# sea green #2E8B57 (46,139,87)
# forest green #228B22 (34,139,34)
# lime #00FF00 (0,255,0)
# orange red #FF4500 (255,69,0)
# dark orange #FF8C00 (255,140,0)
# orange #FFA500 (255,165,0)
# dark golden rod #B8860B (184,134,11)
# golden rod #DAA520 (218,165,32)
# dark red #8B0000 (139,0,0)
# light coral #F08080 (240,128,128)
class Classes_List(object):
class_name_string_list= ['airplane','antelope','bear','bicycle','bird','bus','car','cattle','dog','domestic_cat','elephant','fox','giant_panda','hamster','horse','lion','lizard','monkey','motorcycle','rabbit','red_panda','sheep','snake','squirrel','tiger','train','turtle','watercraft','whale','zebra']
class_code_string_list= ['n02691156','n02419796','n02131653','n02834778','n01503061','n02924116','n02958343','n02402425','n02084071','n02121808','n02503517','n02118333','n02510455','n02342885','n02374451','n02129165','n01674464','n02484322','n03790512','n02324045','n02509815','n02411705','n01726692','n02355227','n02129604','n04468005','n01662784','n04530566','n02062744','n02391049']
colors_string_list=['black' ,'white','red','lime' ,'blue','yellow','cyan', 'magenta','silver', 'gray' ,'maroon' ,'olive' ,'green' ,'purple' ,'teal' ,'navy' ,'pale violet red' ,'deep pink' ,'aqua marine' ,'powder blue' ,'spring green' ,'sea green' ,'forest green' ,'orange red' ,'dark orange' ,'orange' ,'dark golden rod' ,'golden rod' ,'dark red' ,'light coral' ]
colors_code_list=[(0,0,0),(255,255,255),(255,0,0),(0,255,0),(0,0,255),(255,255,0),(0,255,255),(255,0,255),(192,192,192),(128,128,128),(128,0,0),(128,128,0),(0,128,0),(128,0,128),(0,128,128),(0,0,128),(219,112,147),(255,20,147),(127,255,212),(176,224,230),(0,255,127),(46,139,87),(34,139,34),(255,69,0),(255,140,0),(255,165,0),(184,134,11),(218,165,32),(139,0,0),(240,128,128)]
| def code_to_class_string(argument):
switcher = {'n02691156': 'airplane', 'n02419796': 'antelope', 'n02131653': 'bear', 'n02834778': 'bicycle', 'n01503061': 'bird', 'n02924116': 'bus', 'n02958343': 'car', 'n02402425': 'cattle', 'n02084071': 'dog', 'n02121808': 'domestic_cat', 'n02503517': 'elephant', 'n02118333': 'fox', 'n02510455': 'giant_panda', 'n02342885': 'hamster', 'n02374451': 'horse', 'n02129165': 'lion', 'n01674464': 'lizard', 'n02484322': 'monkey', 'n03790512': 'motorcycle', 'n02324045': 'rabbit', 'n02509815': 'red_panda', 'n02411705': 'sheep', 'n01726692': 'snake', 'n02355227': 'squirrel', 'n02129604': 'tiger', 'n04468005': 'train', 'n01662784': 'turtle', 'n04530566': 'watercraft', 'n02062744': 'whale', 'n02391049': 'zebra'}
return switcher.get(argument, 'nothing')
def code_to_code_chall(argument):
switcher = {'n02691156': 1, 'n02419796': 2, 'n02131653': 3, 'n02834778': 4, 'n01503061': 5, 'n02924116': 6, 'n02958343': 7, 'n02402425': 8, 'n02084071': 9, 'n02121808': 10, 'n02503517': 11, 'n02118333': 12, 'n02510455': 13, 'n02342885': 14, 'n02374451': 15, 'n02129165': 16, 'n01674464': 17, 'n02484322': 18, 'n03790512': 19, 'n02324045': 20, 'n02509815': 21, 'n02411705': 22, 'n01726692': 23, 'n02355227': 24, 'n02129604': 25, 'n04468005': 26, 'n01662784': 27, 'n04530566': 28, 'n02062744': 29, 'n02391049': 30}
return switcher.get(argument, 'nothing')
def class_string_to_comp_code(argument):
switcher = {'airplane': 1, 'antelope': 2, 'bear': 3, 'bicycle': 4, 'bird': 5, 'bus': 6, 'car': 7, 'cattle': 8, 'dog': 9, 'domestic_cat': 10, 'elephant': 11, 'fox': 12, 'giant_panda': 13, 'hamster': 14, 'horse': 15, 'lion': 16, 'lizard': 17, 'monkey': 18, 'motorcycle': 19, 'rabbit': 20, 'red_panda': 21, 'sheep': 22, 'snake': 23, 'squirrel': 24, 'tiger': 25, 'train': 26, 'turtle': 27, 'watercraft': 28, 'whale': 29, 'zebra': 30}
return switcher.get(argument, None)
def code_comp_to_class(argument):
switcher = {1: 'airplane', 2: 'antelope', 3: 'bear', 4: 'bicycle', 5: 'bird', 6: 'bus', 7: 'car', 8: 'cattle', 9: 'dog', 10: 'domestic_cat', 11: 'elephant', 12: 'fox', 13: 'giant_panda', 14: 'hamster', 15: 'horse', 16: 'lion', 17: 'lizard', 18: 'monkey', 19: 'motorcycle', 20: 'rabbit', 21: 'red_panda', 22: 'sheep', 23: 'snake', 24: 'squirrel', 25: 'tiger', 26: 'train', 27: 'turtle', 28: 'watercraft', 29: 'whale', 30: 'zebra'}
return switcher.get(argument, 'nothing')
def name_string_to_color(argument):
switcher = {'airplane': 'black', 'antelope': 'white', 'bear': 'red', 'bicycle': 'lime', 'bird': 'blue', 'bus': 'yellow', 'car': 'cyan', 'cattle': 'magenta', 'dog': 'silver', 'domestic_cat': 'gray', 'elephant': 'maroon', 'fox': 'olive', 'giant_panda': 'green', 'hamster': 'purple', 'horse': 'teal', 'lion': 'navy', 'lizard': 'pale violet red', 'monkey': 'deep pink', 'motorcycle': 'aqua marine', 'rabbit': 'powder blue', 'red_panda': 'spring green', 'sheep': 'sea green', 'snake': 'forest green', 'squirrel': 'orange red', 'tiger': 'dark orange', 'train': 'orange', 'turtle': 'dark golden rod', 'watercraft': 'golden rod', 'whale': 'dark red', 'zebra': 'light coral'}
return switcher.get(argument, 'nothing')
def code_to_color(argument):
switcher = {1: (0, 0, 0), 2: (255, 255, 255), 3: (255, 0, 0), 4: (0, 255, 0), 5: (0, 0, 255), 6: (255, 255, 0), 7: (0, 255, 255), 8: (255, 0, 255), 9: (192, 192, 192), 10: (128, 128, 128), 11: (128, 0, 0), 12: (128, 128, 0), 13: (0, 128, 0), 14: (128, 0, 128), 15: (0, 128, 128), 16: (0, 0, 128), 17: (219, 112, 147), 18: (255, 20, 147), 19: (127, 255, 212), 20: (176, 224, 230), 21: (0, 255, 127), 22: (46, 139, 87), 23: (34, 139, 34), 24: (255, 69, 0), 25: (255, 140, 0), 26: (255, 165, 0), 27: (184, 134, 11), 28: (218, 165, 32), 29: (139, 0, 0), 30: (240, 128, 128)}
return switcher.get(argument, (0, 0, 0))
def label_to_color(argument):
switcher = {'n02691156': (0, 0, 0), 'n02419796': (255, 255, 255), 'n02131653': (255, 0, 0), 'n02834778': (0, 255, 0), 'n01503061': (0, 0, 255), 'n02924116': (255, 255, 0), 'n02958343': (0, 255, 255), 'n02402425': (255, 0, 255), 'n02084071': (192, 192, 192), 'n02121808': (128, 128, 128), 'n02503517': (128, 0, 0), 'n02118333': (128, 128, 0), 'n02510455': (0, 128, 0), 'n02342885': (128, 0, 128), 'n02374451': (0, 128, 128), 'n02129165': (0, 0, 128), 'n01674464': (219, 112, 147), 'n02484322': (255, 20, 147), 'n03790512': (127, 255, 212), 'n02324045': (176, 224, 230), 'n02509815': (0, 255, 127), 'n02411705': (46, 139, 87), 'n01726692': (34, 139, 34), 'n02355227': (255, 69, 0), 'n02129604': (255, 140, 0), 'n04468005': (255, 165, 0), 'n01662784': (184, 134, 11), 'n04530566': (218, 165, 32), 'n02062744': (139, 0, 0), 'n02391049': (240, 128, 128)}
return switcher.get(argument, (0, 0, 0))
class Classes_List(object):
class_name_string_list = ['airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', 'hamster', 'horse', 'lion', 'lizard', 'monkey', 'motorcycle', 'rabbit', 'red_panda', 'sheep', 'snake', 'squirrel', 'tiger', 'train', 'turtle', 'watercraft', 'whale', 'zebra']
class_code_string_list = ['n02691156', 'n02419796', 'n02131653', 'n02834778', 'n01503061', 'n02924116', 'n02958343', 'n02402425', 'n02084071', 'n02121808', 'n02503517', 'n02118333', 'n02510455', 'n02342885', 'n02374451', 'n02129165', 'n01674464', 'n02484322', 'n03790512', 'n02324045', 'n02509815', 'n02411705', 'n01726692', 'n02355227', 'n02129604', 'n04468005', 'n01662784', 'n04530566', 'n02062744', 'n02391049']
colors_string_list = ['black', 'white', 'red', 'lime', 'blue', 'yellow', 'cyan', 'magenta', 'silver', 'gray', 'maroon', 'olive', 'green', 'purple', 'teal', 'navy', 'pale violet red', 'deep pink', 'aqua marine', 'powder blue', 'spring green', 'sea green', 'forest green', 'orange red', 'dark orange', 'orange', 'dark golden rod', 'golden rod', 'dark red', 'light coral']
colors_code_list = [(0, 0, 0), (255, 255, 255), (255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0), (0, 255, 255), (255, 0, 255), (192, 192, 192), (128, 128, 128), (128, 0, 0), (128, 128, 0), (0, 128, 0), (128, 0, 128), (0, 128, 128), (0, 0, 128), (219, 112, 147), (255, 20, 147), (127, 255, 212), (176, 224, 230), (0, 255, 127), (46, 139, 87), (34, 139, 34), (255, 69, 0), (255, 140, 0), (255, 165, 0), (184, 134, 11), (218, 165, 32), (139, 0, 0), (240, 128, 128)] |
class Grid:
def __init__(self, matrix=None):
if (matrix):
self.matrix = matrix
else:
self.matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
def __str__(self):
return str(str(self.matrix[0][0]) + str(self.matrix[1][0]) + str(self.matrix[2][0]) + "\n" +
str(self.matrix[0][1]) + str(self.matrix[1][1]) + str(self.matrix[2][1]) + "\n" +
str(self.matrix[0][2]) + str(self.matrix[1][2]) + str(self.matrix[2][2])
)
def get_pos(self, x, y):
return self.matrix[x][y]
def set_pos(self, x, y, number):
self.matrix[x][y] = number
def blocksums(self):
return (
self.matrix[0][0] + self.matrix[1][0] +
self.matrix[0][1] + self.matrix[1][1],
self.matrix[1][0] + self.matrix[2][0] +
self.matrix[1][1] + self.matrix[2][1],
self.matrix[0][1] + self.matrix[1][1] +
self.matrix[0][2] + self.matrix[1][2],
self.matrix[1][1] + self.matrix[2][1] +
self.matrix[1][2] + self.matrix[2][2]
)
def count(self, number):
count = 0
for x in range(0, 3):
for y in range(0, 3):
if(self.matrix[x][y] == number):
count += 1
return count
grids = []
for a in range(0, 2):
for b in range(0, 2):
for c in range(0, 2):
for d in range(0, 2):
for e in range(0, 2):
for f in range(0, 2):
for g in range(0, 2):
for h in range(0, 2):
for i in range(0, 2):
grids.append(
Grid([[a, b, c], [d, e, f], [g, h, i]]))
print("Blocksums are 3")
for grid in grids:
if grid.blocksums() == (3, 3, 3, 3) and grid.count(1) == 5 and grid.count(0) == 4:
print(grid)
print("Blocksums are 2")
for grid in grids:
if grid.blocksums() == (2, 2, 2, 2) and grid.count(1) == 5 and grid.count(0) == 4:
print(grid)
| class Grid:
def __init__(self, matrix=None):
if matrix:
self.matrix = matrix
else:
self.matrix = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
def __str__(self):
return str(str(self.matrix[0][0]) + str(self.matrix[1][0]) + str(self.matrix[2][0]) + '\n' + str(self.matrix[0][1]) + str(self.matrix[1][1]) + str(self.matrix[2][1]) + '\n' + str(self.matrix[0][2]) + str(self.matrix[1][2]) + str(self.matrix[2][2]))
def get_pos(self, x, y):
return self.matrix[x][y]
def set_pos(self, x, y, number):
self.matrix[x][y] = number
def blocksums(self):
return (self.matrix[0][0] + self.matrix[1][0] + self.matrix[0][1] + self.matrix[1][1], self.matrix[1][0] + self.matrix[2][0] + self.matrix[1][1] + self.matrix[2][1], self.matrix[0][1] + self.matrix[1][1] + self.matrix[0][2] + self.matrix[1][2], self.matrix[1][1] + self.matrix[2][1] + self.matrix[1][2] + self.matrix[2][2])
def count(self, number):
count = 0
for x in range(0, 3):
for y in range(0, 3):
if self.matrix[x][y] == number:
count += 1
return count
grids = []
for a in range(0, 2):
for b in range(0, 2):
for c in range(0, 2):
for d in range(0, 2):
for e in range(0, 2):
for f in range(0, 2):
for g in range(0, 2):
for h in range(0, 2):
for i in range(0, 2):
grids.append(grid([[a, b, c], [d, e, f], [g, h, i]]))
print('Blocksums are 3')
for grid in grids:
if grid.blocksums() == (3, 3, 3, 3) and grid.count(1) == 5 and (grid.count(0) == 4):
print(grid)
print('Blocksums are 2')
for grid in grids:
if grid.blocksums() == (2, 2, 2, 2) and grid.count(1) == 5 and (grid.count(0) == 4):
print(grid) |
class HttpCodes(dict):
http_100 = (100, 'Continue')
http_101 = (101, 'Switching Protocols')
http_102 = (102, 'Processing (WebDAV)')
http_200 = (200, 'OK')
http_201 = (201, 'Created')
http_202 = (202, 'Accepted')
http_203 = (203, 'Non-Authoritative Information')
http_204 = (204, 'No Content')
http_205 = (205, 'Reset Content')
http_206 = (206, 'Partial Content')
http_207 = (207, 'Multi-Status (WebDAV)')
http_208 = (208, 'Already Reported (WebDAV)')
http_226 = (226, 'IM Used')
http_300 = (300, 'Multiple Choices')
http_301 = (301, 'Moved Permanently')
http_302 = (302, 'Found')
http_303 = (303, 'See Other')
http_304 = (304, 'Not Modified')
http_305 = (305, 'Use Proxy')
http_306 = (306, '(Unused)')
http_307 = (307, 'Temporary Redirect')
http_308 = (308, 'Permanent Redirect (experimental)')
http_400 = (400, 'Bad Request')
http_401 = (401, 'Unauthorized')
http_402 = (402, 'Payment Required')
http_403 = (403, 'Forbidden')
http_404 = (404, 'Not Found')
http_405 = (405, 'Method Not Allowed')
http_406 = (406, 'Not Acceptable')
http_407 = (407, 'Proxy Authentication Required')
http_408 = (408, 'Request Timeout')
http_409 = (409, 'Conflict')
http_410 = (410, 'Gone')
http_411 = (411, 'Length Required')
http_412 = (412, 'Precondition Failed')
http_413 = (413, 'Request Entity Too Large')
http_414 = (414, 'Request-URI Too Long')
http_415 = (415, 'Unsupported Media Type')
http_416 = (416, 'Requested Range Not Satisfiable')
http_417 = (417, 'Expectation Failed')
http_418 = (418, 'I\'m a teapot (RFC 2324)')
http_420 = (420, 'Enhance Your Calm (Twitter)')
http_422 = (422, 'Unprocessable Entity (WebDAV)')
http_423 = (423, 'Locked (WebDAV)')
http_424 = (424, 'Failed Dependency (WebDAV)')
http_425 = (425, 'Reserved for WebDAV')
http_426 = (426, 'Upgrade Required')
http_428 = (428, 'Precondition Required')
http_429 = (429, 'Too Many Requests')
http_431 = (431, 'Request Header Fields Too Large')
http_444 = (444, 'No Response (Nginx)')
http_449 = (449, 'Retry With (Microsoft)')
http_450 = (450, 'Blocked by Windows Parental Controls (Microsoft)')
http_451 = (451, 'Unavailable For Legal Reasons')
http_499 = (499, 'Client Closed Request (Nginx)')
http_500 = (500, 'Internal Server Error')
http_501 = (501, 'Not Implemented')
http_502 = (502, 'Bad Gateway')
http_503 = (503, 'Service Unavailable')
http_504 = (504, 'Gateway Timeout')
http_505 = (505, 'HTTP Version Not Supported')
http_506 = (506, 'Variant Also Negotiates (Experimental)')
http_507 = (507, 'Insufficient Storage (WebDAV)')
http_508 = (508, 'Loop Detected (WebDAV)')
http_509 = (509, 'Bandwidth Limit Exceeded (Apache)')
http_510 = (510, 'Not Extended')
http_511 = (511, 'Network Authentication Required')
class ECodes(dict):
success = (0, 'ok')
fail = (1, 'fail')
addr_not_found = (404, 'Address your visit does not exist')
token_auth_success = (0, 'Token authentication is successful')
login_timeout = (10001, 'Login timed out, please log in again')
illegal_token = (10002, 'Illegal token')
invalid_token_secret = (10003, 'Invalid token secret')
token_expired = (10004, 'Token has expired')
token_auth_fail = (10006, 'Token authentication failure')
| class Httpcodes(dict):
http_100 = (100, 'Continue')
http_101 = (101, 'Switching Protocols')
http_102 = (102, 'Processing (WebDAV)')
http_200 = (200, 'OK')
http_201 = (201, 'Created')
http_202 = (202, 'Accepted')
http_203 = (203, 'Non-Authoritative Information')
http_204 = (204, 'No Content')
http_205 = (205, 'Reset Content')
http_206 = (206, 'Partial Content')
http_207 = (207, 'Multi-Status (WebDAV)')
http_208 = (208, 'Already Reported (WebDAV)')
http_226 = (226, 'IM Used')
http_300 = (300, 'Multiple Choices')
http_301 = (301, 'Moved Permanently')
http_302 = (302, 'Found')
http_303 = (303, 'See Other')
http_304 = (304, 'Not Modified')
http_305 = (305, 'Use Proxy')
http_306 = (306, '(Unused)')
http_307 = (307, 'Temporary Redirect')
http_308 = (308, 'Permanent Redirect (experimental)')
http_400 = (400, 'Bad Request')
http_401 = (401, 'Unauthorized')
http_402 = (402, 'Payment Required')
http_403 = (403, 'Forbidden')
http_404 = (404, 'Not Found')
http_405 = (405, 'Method Not Allowed')
http_406 = (406, 'Not Acceptable')
http_407 = (407, 'Proxy Authentication Required')
http_408 = (408, 'Request Timeout')
http_409 = (409, 'Conflict')
http_410 = (410, 'Gone')
http_411 = (411, 'Length Required')
http_412 = (412, 'Precondition Failed')
http_413 = (413, 'Request Entity Too Large')
http_414 = (414, 'Request-URI Too Long')
http_415 = (415, 'Unsupported Media Type')
http_416 = (416, 'Requested Range Not Satisfiable')
http_417 = (417, 'Expectation Failed')
http_418 = (418, "I'm a teapot (RFC 2324)")
http_420 = (420, 'Enhance Your Calm (Twitter)')
http_422 = (422, 'Unprocessable Entity (WebDAV)')
http_423 = (423, 'Locked (WebDAV)')
http_424 = (424, 'Failed Dependency (WebDAV)')
http_425 = (425, 'Reserved for WebDAV')
http_426 = (426, 'Upgrade Required')
http_428 = (428, 'Precondition Required')
http_429 = (429, 'Too Many Requests')
http_431 = (431, 'Request Header Fields Too Large')
http_444 = (444, 'No Response (Nginx)')
http_449 = (449, 'Retry With (Microsoft)')
http_450 = (450, 'Blocked by Windows Parental Controls (Microsoft)')
http_451 = (451, 'Unavailable For Legal Reasons')
http_499 = (499, 'Client Closed Request (Nginx)')
http_500 = (500, 'Internal Server Error')
http_501 = (501, 'Not Implemented')
http_502 = (502, 'Bad Gateway')
http_503 = (503, 'Service Unavailable')
http_504 = (504, 'Gateway Timeout')
http_505 = (505, 'HTTP Version Not Supported')
http_506 = (506, 'Variant Also Negotiates (Experimental)')
http_507 = (507, 'Insufficient Storage (WebDAV)')
http_508 = (508, 'Loop Detected (WebDAV)')
http_509 = (509, 'Bandwidth Limit Exceeded (Apache)')
http_510 = (510, 'Not Extended')
http_511 = (511, 'Network Authentication Required')
class Ecodes(dict):
success = (0, 'ok')
fail = (1, 'fail')
addr_not_found = (404, 'Address your visit does not exist')
token_auth_success = (0, 'Token authentication is successful')
login_timeout = (10001, 'Login timed out, please log in again')
illegal_token = (10002, 'Illegal token')
invalid_token_secret = (10003, 'Invalid token secret')
token_expired = (10004, 'Token has expired')
token_auth_fail = (10006, 'Token authentication failure') |
#!/usr/bin/env python
# -*-coding: utf-8 -*-
#config.py
#Dave Landay
#LAST UPDATED: 01-01-2020
DEBUG = True
SQLALCHEMY_DATABASE_URI = '<PATH_TO_DATABASE.DB>'
SECRET_KEY = '<SOME_SECRET_KEY>'
| debug = True
sqlalchemy_database_uri = '<PATH_TO_DATABASE.DB>'
secret_key = '<SOME_SECRET_KEY>' |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"ShuffleBlock": "00_core.ipynb",
"OprtType": "00_core.ipynb",
"conv_unit": "00_core.ipynb",
"conv": "00_core.ipynb",
"relu_conv_bn": "00_core.ipynb",
"conv_bn_relu": "00_core.ipynb",
"bn_relu_conv": "00_core.ipynb",
"relu_conv": "00_core.ipynb",
"conv_bn": "00_core.ipynb",
"relu_conv_bn_shuffle": "00_core.ipynb",
"pack_relu_conv_bn": "00_core.ipynb",
"pack_bn_relu_conv": "00_core.ipynb",
"pack_relu_conv_bn_shuffle": "00_core.ipynb",
"resnet_basicblock": "00_core.ipynb",
"resnet_bottleneck": "00_core.ipynb",
"preresnet_basicblock": "00_core.ipynb",
"preresnet_bottleneck": "00_core.ipynb",
"xception": "00_core.ipynb",
"mbconv2": "00_core.ipynb",
"mbconv": "00_core.ipynb",
"resnet_stem": "00_core.ipynb",
"resnet_stem_deep": "00_core.ipynb",
"IdentityMappingMaxPool": "00_core.ipynb",
"IdentityMappingAvgPool": "00_core.ipynb",
"IdentityMappingConv": "00_core.ipynb",
"IdentityMapping": "00_core.ipynb",
"Classifier": "00_core.ipynb",
"ClassifierBNReLU": "00_core.ipynb",
"init_cnn": "00_core.ipynb",
"num_params": "00_core.ipynb",
"assert_cfg": "01_config.ipynb",
"cfg": "01_config.ipynb",
"resnet_dag": "02_graph.ipynb",
"NodeOP": "03_network.ipynb",
"NetworkOP": "03_network.ipynb",
"get_pred": "04_resnetx.ipynb",
"layer_diff": "04_resnetx.ipynb",
"ResNetX": "04_resnetx.ipynb",
"resnet_local_to_pretrained": "04_resnetx.ipynb",
"resnetx": "04_resnetx.ipynb",
"get_num_nodes": "05_automl.ipynb",
"FoldBlock": "07_foldnet.ipynb",
"ExpandBlock": "08_lookbacknet.ipynb",
"FoldNet": "07_foldnet.ipynb",
"num_units": "07_foldnet.ipynb",
"cal_num_params": "07_foldnet.ipynb",
"LookbackBlock": "08_lookbacknet.ipynb",
"LookbackNet": "08_lookbacknet.ipynb"}
modules = ["core.py",
"config.py",
"graph.py",
"network.py",
"resnetx.py",
"automl.py",
"foldnet.py",
"lookbacknet.py"]
doc_url = "https://keepsimpler.github.io/wong/"
git_url = "https://github.com/keepsimpler/wong/tree/master/"
def custom_doc_links(name): return None | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'ShuffleBlock': '00_core.ipynb', 'OprtType': '00_core.ipynb', 'conv_unit': '00_core.ipynb', 'conv': '00_core.ipynb', 'relu_conv_bn': '00_core.ipynb', 'conv_bn_relu': '00_core.ipynb', 'bn_relu_conv': '00_core.ipynb', 'relu_conv': '00_core.ipynb', 'conv_bn': '00_core.ipynb', 'relu_conv_bn_shuffle': '00_core.ipynb', 'pack_relu_conv_bn': '00_core.ipynb', 'pack_bn_relu_conv': '00_core.ipynb', 'pack_relu_conv_bn_shuffle': '00_core.ipynb', 'resnet_basicblock': '00_core.ipynb', 'resnet_bottleneck': '00_core.ipynb', 'preresnet_basicblock': '00_core.ipynb', 'preresnet_bottleneck': '00_core.ipynb', 'xception': '00_core.ipynb', 'mbconv2': '00_core.ipynb', 'mbconv': '00_core.ipynb', 'resnet_stem': '00_core.ipynb', 'resnet_stem_deep': '00_core.ipynb', 'IdentityMappingMaxPool': '00_core.ipynb', 'IdentityMappingAvgPool': '00_core.ipynb', 'IdentityMappingConv': '00_core.ipynb', 'IdentityMapping': '00_core.ipynb', 'Classifier': '00_core.ipynb', 'ClassifierBNReLU': '00_core.ipynb', 'init_cnn': '00_core.ipynb', 'num_params': '00_core.ipynb', 'assert_cfg': '01_config.ipynb', 'cfg': '01_config.ipynb', 'resnet_dag': '02_graph.ipynb', 'NodeOP': '03_network.ipynb', 'NetworkOP': '03_network.ipynb', 'get_pred': '04_resnetx.ipynb', 'layer_diff': '04_resnetx.ipynb', 'ResNetX': '04_resnetx.ipynb', 'resnet_local_to_pretrained': '04_resnetx.ipynb', 'resnetx': '04_resnetx.ipynb', 'get_num_nodes': '05_automl.ipynb', 'FoldBlock': '07_foldnet.ipynb', 'ExpandBlock': '08_lookbacknet.ipynb', 'FoldNet': '07_foldnet.ipynb', 'num_units': '07_foldnet.ipynb', 'cal_num_params': '07_foldnet.ipynb', 'LookbackBlock': '08_lookbacknet.ipynb', 'LookbackNet': '08_lookbacknet.ipynb'}
modules = ['core.py', 'config.py', 'graph.py', 'network.py', 'resnetx.py', 'automl.py', 'foldnet.py', 'lookbacknet.py']
doc_url = 'https://keepsimpler.github.io/wong/'
git_url = 'https://github.com/keepsimpler/wong/tree/master/'
def custom_doc_links(name):
return None |
# Open input, and split each line into list of 0 or 1 integers
with open('./input', encoding='utf8') as file:
vent_lines = [[[int(val) for val in endpoint.split(',')]
for endpoint in line.split(' -> ')] for line in file]
dims = [0, 0]
for line in vent_lines:
for val in line:
dims[0] = max(dims[0], val[0]+1)
dims[1] = max(dims[1], val[1]+1)
points = [[0] * dims[1] for _ in range(dims[0])]
for line in vent_lines:
col_step = 1 if line[0][0] <= line[1][0] else -1
row_step = 1 if line[0][1] <= line[1][1] else -1
cols = range(line[0][0], line[1][0]+col_step, col_step)
rows = range(line[0][1], line[1][1]+row_step, row_step)
if line[0][1] == line[1][1]:
for col in cols:
points[line[0][1]][col] += 1
elif line[0][0] == line[1][0]:
for row in rows:
points[row][line[0][0]] += 1
else:
steps = zip(cols, rows)
for step in list(steps):
points[step[1]][step[0]] += 1
count = 0
for row in points:
for col in row:
if col > 1:
count += 1
print(count)
| with open('./input', encoding='utf8') as file:
vent_lines = [[[int(val) for val in endpoint.split(',')] for endpoint in line.split(' -> ')] for line in file]
dims = [0, 0]
for line in vent_lines:
for val in line:
dims[0] = max(dims[0], val[0] + 1)
dims[1] = max(dims[1], val[1] + 1)
points = [[0] * dims[1] for _ in range(dims[0])]
for line in vent_lines:
col_step = 1 if line[0][0] <= line[1][0] else -1
row_step = 1 if line[0][1] <= line[1][1] else -1
cols = range(line[0][0], line[1][0] + col_step, col_step)
rows = range(line[0][1], line[1][1] + row_step, row_step)
if line[0][1] == line[1][1]:
for col in cols:
points[line[0][1]][col] += 1
elif line[0][0] == line[1][0]:
for row in rows:
points[row][line[0][0]] += 1
else:
steps = zip(cols, rows)
for step in list(steps):
points[step[1]][step[0]] += 1
count = 0
for row in points:
for col in row:
if col > 1:
count += 1
print(count) |
""" https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga67493776e3ad1a3df63883829375201f
void cv::morphologyEx ( InputArray src,
OutputArray dst,
int op,
InputArray kernel,
Point anchor = Point(-1,-1),
int iterations = 1,
int borderType = BORDER_CONSTANT,
const Scalar & borderValue = morphologyDefaultBorderValue()
)
Python:
dst = cv.morphologyEx( src, op, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]] )
#include <opencv2/imgproc.hpp>
Performs advanced morphological transformations.
The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations.
Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.
Parameters
src Source image. The number of channels can be arbitrary. The depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
dst Destination image of the same size and type as source image.
op Type of a morphological operation, see MorphTypes
kernel Structuring element. It can be created using getStructuringElement.
anchor Anchor position with the kernel. Negative values mean that the anchor is at the kernel center.
iterations Number of times erosion and dilation are applied.
borderType Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.
borderValue Border value in case of a constant border. The default value has a special meaning.
"""
| """ https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga67493776e3ad1a3df63883829375201f
void cv::morphologyEx ( InputArray src,
OutputArray dst,
int op,
InputArray kernel,
Point anchor = Point(-1,-1),
int iterations = 1,
int borderType = BORDER_CONSTANT,
const Scalar & borderValue = morphologyDefaultBorderValue()
)
Python:
dst = cv.morphologyEx( src, op, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]] )
#include <opencv2/imgproc.hpp>
Performs advanced morphological transformations.
The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations.
Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.
Parameters
src Source image. The number of channels can be arbitrary. The depth should be one of CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
dst Destination image of the same size and type as source image.
op Type of a morphological operation, see MorphTypes
kernel Structuring element. It can be created using getStructuringElement.
anchor Anchor position with the kernel. Negative values mean that the anchor is at the kernel center.
iterations Number of times erosion and dilation are applied.
borderType Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported.
borderValue Border value in case of a constant border. The default value has a special meaning.
""" |
'''https://leetcode.com/problems/plus-one/'''
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
digits.reverse()
ans = []
c = 1
for d in digits:
t = d+c
if t>9:
t = t-10
c=1
else:
c=0
ans.append(t)
if c:
ans.append(1)
return reversed(ans)
| """https://leetcode.com/problems/plus-one/"""
class Solution:
def plus_one(self, digits: List[int]) -> List[int]:
digits.reverse()
ans = []
c = 1
for d in digits:
t = d + c
if t > 9:
t = t - 10
c = 1
else:
c = 0
ans.append(t)
if c:
ans.append(1)
return reversed(ans) |
"""
Pattern:
Enter the number of rows: 5
EEEEE
DDDD
CCC
BB
A
"""
print('Alphabet Pattern: ')
number_rows=int(input('Enter number of rows: '))
for row in range(1,number_rows+1):
print(' '*(row-1),str(chr(65+(number_rows-row))+'')*(number_rows+1-row)) | """
Pattern:
Enter the number of rows: 5
EEEEE
DDDD
CCC
BB
A
"""
print('Alphabet Pattern: ')
number_rows = int(input('Enter number of rows: '))
for row in range(1, number_rows + 1):
print(' ' * (row - 1), str(chr(65 + (number_rows - row)) + '') * (number_rows + 1 - row)) |
class Action():
"""
``Action`` own the code intended for modify synergies objects.
"""
_listen = None
"""The ``Event`` class to listen."""
_depend = []
"""List of ``Action`` who need to be executed before this."""
@classmethod
def get_listened_class(cls):
"""
:return: The listened ``Event`` class.
:rtype: synergine.synergy.Event.Event
"""
return cls._listen
@classmethod
def get_dependencies(cls):
"""
:return: List of ``Action`` who need to be executed before this.
:rtype: list (of ``Action``)
"""
return cls._depend
def __init__(self, object_id, parameters):
self._object_id = object_id
self._parameters = parameters
def get_object_id(self):
"""
:return: The concerned synergy object id
:rtype: int
"""
return self._object_id
@classmethod
def cycle_pre_run(cls, context, synergy_manager):
"""
This class method will be executed each cycle, one time by action class.
Useful fo apply some tricks before this synergies objects action.
:param context:
:param synergy_manager:
:return:
"""
pass
def run(self, obj, context, synergy_manager):
"""
The execution code of ``Action`` have to be write in ``run`` method.
:param obj: The synergy concerned object
:param context: The Context
:param synergy_manager: SynergyObjectManager
:return:
"""
raise NotImplementedError | class Action:
"""
``Action`` own the code intended for modify synergies objects.
"""
_listen = None
'The ``Event`` class to listen.'
_depend = []
'List of ``Action`` who need to be executed before this.'
@classmethod
def get_listened_class(cls):
"""
:return: The listened ``Event`` class.
:rtype: synergine.synergy.Event.Event
"""
return cls._listen
@classmethod
def get_dependencies(cls):
"""
:return: List of ``Action`` who need to be executed before this.
:rtype: list (of ``Action``)
"""
return cls._depend
def __init__(self, object_id, parameters):
self._object_id = object_id
self._parameters = parameters
def get_object_id(self):
"""
:return: The concerned synergy object id
:rtype: int
"""
return self._object_id
@classmethod
def cycle_pre_run(cls, context, synergy_manager):
"""
This class method will be executed each cycle, one time by action class.
Useful fo apply some tricks before this synergies objects action.
:param context:
:param synergy_manager:
:return:
"""
pass
def run(self, obj, context, synergy_manager):
"""
The execution code of ``Action`` have to be write in ``run`` method.
:param obj: The synergy concerned object
:param context: The Context
:param synergy_manager: SynergyObjectManager
:return:
"""
raise NotImplementedError |
x = 5
print(5)
print(x)
print('x')
message = 'Hello World!'
print(message)
message = 'Goodbye cruel world...'
print(message) | x = 5
print(5)
print(x)
print('x')
message = 'Hello World!'
print(message)
message = 'Goodbye cruel world...'
print(message) |
'''
dummy recommender
'''
def recommend_random(movies, k=10):
"""
Dummy recommender that recommends a list of random movies. Ignores the actual query.
"""
return movies['title'].sample(k).to_list()
| """
dummy recommender
"""
def recommend_random(movies, k=10):
"""
Dummy recommender that recommends a list of random movies. Ignores the actual query.
"""
return movies['title'].sample(k).to_list() |
class Dobradura:
def get_dobrar(self, numero_dobradura):
self.numero_dobradura = 1
if type(numero_dobradura) == int and numero_dobradura > 0:
for i in range(0,numero_dobradura):
self.numero_dobradura = 2**numero_dobradura
return self.numero_dobradura
else:
return False
| class Dobradura:
def get_dobrar(self, numero_dobradura):
self.numero_dobradura = 1
if type(numero_dobradura) == int and numero_dobradura > 0:
for i in range(0, numero_dobradura):
self.numero_dobradura = 2 ** numero_dobradura
return self.numero_dobradura
else:
return False |
"""
Wrapper
"""
class Trainer(object):
def __init__(self, cfg, model, dataloader_dict, logger):
self.cfg = cfg
self.modes = self.cfg.MODES
self.model = model
self.dataloader_dict = dataloader_dict
self.logger = logger
self.current_epoch = cfg.RESUME_EPOCH_ID if cfg.RESUME else 1
self.batch_count = 0
def do_epoch(self):
# for multi phase of one epoch
for mode in self.modes:
if mode in self.dataloader_dict.keys():
# start this phase, pass forward all samples in data-set
self.batch_count = 0
batch_total_num = len(self.dataloader_dict[mode])
for batch in iter(self.dataloader_dict[mode]):
self.batch_count += 1
if mode == 'train':
batch = self.model.train_batch(batch) # actual training line
else:
batch = self.model.vali_batch(batch) # actual validation/test line
batch = self.wrap_batchwise_log(batch, batch_total_num, mode=mode, )
self.logger.log(batch)
self.current_epoch += 1
self.adjust_learning_rate(optimizer=self.model.optimizer, epoch=self.current_epoch,
lr_decay_rate=self.cfg.OPTI_DECAY_RATE,
lr_decay_epoch=self.cfg.OPTI_DECAY_INTERVAL, min_lr=self.cfg.OPTI_DECAY_MIN)
if self.current_epoch == self.cfg.EPOCH_TOTAL + 1: # if the last epoch
self.logger.end_log()
return self.current_epoch
def wrap_batchwise_log(self, batch, batch_total, mode='train'):
try:
assert 'meta-info' in batch.keys() # Valid batch must have a key called meta-info
except:
raise ValueError("A valid batch passing to logger must contain a member called 'meta-info'!")
wrapped = dict()
# add logger head
wrapped['batch-id'] = self.batch_count
wrapped['batch-total'] = batch_total
wrapped['epoch-id'] = self.current_epoch
wrapped['phase'] = mode.lower()
# add parser
wrapped['parser'] = self.model.output_info_dict
# add save method
wrapped['save-method'] = self.model.save_model
# add meta info
wrapped['meta-info'] = batch['meta-info']
# main data #################################################
wrapped['data'] = batch
return wrapped
@staticmethod
def adjust_learning_rate(optimizer, epoch, lr_decay_rate, lr_decay_epoch, min_lr=1e-5):
if ((epoch + 1) % lr_decay_epoch) != 0:
return
for param_group in optimizer.param_groups:
# print(param_group)
lr_before = param_group['lr']
param_group['lr'] = param_group['lr'] * lr_decay_rate
param_group['lr'] = max(param_group['lr'], min_lr)
print('changing learning rate {:5f} to {:.5f}'.format(lr_before, max(param_group['lr'], min_lr)))
@staticmethod
def reset_learning_rate(optimizer, lr):
for param_group in optimizer.param_groups:
# print(param_group)
lr_before = param_group['lr']
param_group['lr'] = lr
print('changing learning rate {:5f} to {:.5f}'.format(lr_before, lr))
| """
Wrapper
"""
class Trainer(object):
def __init__(self, cfg, model, dataloader_dict, logger):
self.cfg = cfg
self.modes = self.cfg.MODES
self.model = model
self.dataloader_dict = dataloader_dict
self.logger = logger
self.current_epoch = cfg.RESUME_EPOCH_ID if cfg.RESUME else 1
self.batch_count = 0
def do_epoch(self):
for mode in self.modes:
if mode in self.dataloader_dict.keys():
self.batch_count = 0
batch_total_num = len(self.dataloader_dict[mode])
for batch in iter(self.dataloader_dict[mode]):
self.batch_count += 1
if mode == 'train':
batch = self.model.train_batch(batch)
else:
batch = self.model.vali_batch(batch)
batch = self.wrap_batchwise_log(batch, batch_total_num, mode=mode)
self.logger.log(batch)
self.current_epoch += 1
self.adjust_learning_rate(optimizer=self.model.optimizer, epoch=self.current_epoch, lr_decay_rate=self.cfg.OPTI_DECAY_RATE, lr_decay_epoch=self.cfg.OPTI_DECAY_INTERVAL, min_lr=self.cfg.OPTI_DECAY_MIN)
if self.current_epoch == self.cfg.EPOCH_TOTAL + 1:
self.logger.end_log()
return self.current_epoch
def wrap_batchwise_log(self, batch, batch_total, mode='train'):
try:
assert 'meta-info' in batch.keys()
except:
raise value_error("A valid batch passing to logger must contain a member called 'meta-info'!")
wrapped = dict()
wrapped['batch-id'] = self.batch_count
wrapped['batch-total'] = batch_total
wrapped['epoch-id'] = self.current_epoch
wrapped['phase'] = mode.lower()
wrapped['parser'] = self.model.output_info_dict
wrapped['save-method'] = self.model.save_model
wrapped['meta-info'] = batch['meta-info']
wrapped['data'] = batch
return wrapped
@staticmethod
def adjust_learning_rate(optimizer, epoch, lr_decay_rate, lr_decay_epoch, min_lr=1e-05):
if (epoch + 1) % lr_decay_epoch != 0:
return
for param_group in optimizer.param_groups:
lr_before = param_group['lr']
param_group['lr'] = param_group['lr'] * lr_decay_rate
param_group['lr'] = max(param_group['lr'], min_lr)
print('changing learning rate {:5f} to {:.5f}'.format(lr_before, max(param_group['lr'], min_lr)))
@staticmethod
def reset_learning_rate(optimizer, lr):
for param_group in optimizer.param_groups:
lr_before = param_group['lr']
param_group['lr'] = lr
print('changing learning rate {:5f} to {:.5f}'.format(lr_before, lr)) |
def normal_old_school_method(a,b,tmp):
tmp = a
a = b
b = tmp
return a,b
def pythonic_swap(a,b):
a,b = b,a
return a,b
if __name__ == '__main__':
a,b = 10,25
tmp = 0
print('Original [Before Swap Values]:\t',a,b)
print('Old School Method:',normal_old_school_method(a,b,tmp))
print('Pythonic Method:',pythonic_swap(a,b)) | def normal_old_school_method(a, b, tmp):
tmp = a
a = b
b = tmp
return (a, b)
def pythonic_swap(a, b):
(a, b) = (b, a)
return (a, b)
if __name__ == '__main__':
(a, b) = (10, 25)
tmp = 0
print('Original [Before Swap Values]:\t', a, b)
print('Old School Method:', normal_old_school_method(a, b, tmp))
print('Pythonic Method:', pythonic_swap(a, b)) |
class Vehicle:
def __init__(self, max_speed, mileage):
self.max_speed = max_speed
self.mileage = mileage
modelS = Vehicle(200,20)
print(modelS.max_speed, modelS.mileage) | class Vehicle:
def __init__(self, max_speed, mileage):
self.max_speed = max_speed
self.mileage = mileage
model_s = vehicle(200, 20)
print(modelS.max_speed, modelS.mileage) |
class Solution(object):
def calPoints(self, ops):
"""
:type ops: List[str]
:rtype: int
"""
listvalue = []
last1 = 0
last2 = 0
sum = 0
for i in range(len(ops)):
if (ops[i] == '+'):
sum = listvalue[len(listvalue)-1] + listvalue[len(listvalue)-2] + sum
listvalue.append(listvalue[len(listvalue)-1] + listvalue[len(listvalue)-2])
else:
if (ops[i] == 'C'):
sum = sum - listvalue[len(listvalue)-1]
listvalue.pop()
else:
if (ops[i] == 'D'):
sum = 2 * listvalue[len(listvalue)-1] + sum
listvalue.append(listvalue[len(listvalue)-1]*2)
else:
sum = sum + int(ops[i])
listvalue.append(int(ops[i]))
return sum
| class Solution(object):
def cal_points(self, ops):
"""
:type ops: List[str]
:rtype: int
"""
listvalue = []
last1 = 0
last2 = 0
sum = 0
for i in range(len(ops)):
if ops[i] == '+':
sum = listvalue[len(listvalue) - 1] + listvalue[len(listvalue) - 2] + sum
listvalue.append(listvalue[len(listvalue) - 1] + listvalue[len(listvalue) - 2])
elif ops[i] == 'C':
sum = sum - listvalue[len(listvalue) - 1]
listvalue.pop()
elif ops[i] == 'D':
sum = 2 * listvalue[len(listvalue) - 1] + sum
listvalue.append(listvalue[len(listvalue) - 1] * 2)
else:
sum = sum + int(ops[i])
listvalue.append(int(ops[i]))
return sum |
"""
A Python CLI for Atlas-Checks tools
"""
__version__ = '1.0'
| """
A Python CLI for Atlas-Checks tools
"""
__version__ = '1.0' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.