content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#! /usr/bin/env python
model0.initialize()
model1.initialize()
time = model0.get_current_time()
end_time = model0.get_end_time()
while time < end_time:
has_converged = False
while has_converged is False:
state1 = model1.get_value("some_state_variable")
model0.set_value("some_state_variable", state1)
model0.solve()
state0 = model0.get_value("boundary_flows")
model1.set_value("boundary_flows", state0)
model1.solve()
has_converged = check_convergence(model0, model1, convergence_criteria)
model1.update()
model0.update()
time = model0.get_current_time()
| model0.initialize()
model1.initialize()
time = model0.get_current_time()
end_time = model0.get_end_time()
while time < end_time:
has_converged = False
while has_converged is False:
state1 = model1.get_value('some_state_variable')
model0.set_value('some_state_variable', state1)
model0.solve()
state0 = model0.get_value('boundary_flows')
model1.set_value('boundary_flows', state0)
model1.solve()
has_converged = check_convergence(model0, model1, convergence_criteria)
model1.update()
model0.update()
time = model0.get_current_time() |
class LinkedListNode:
def __init__(self, data):
self.data = data
self.next = None
class Stack:
def __init__(self):
self.num_elements = 0
self.head = None
def push(self, data):
new_node = LinkedListNode(data)
if self.head is None:
self.head = new_node
else:
new_node.next = self.head
self.head = new_node
self.num_elements += 1
def pop(self):
if self.is_empty():
return None
temp = self.head.data
self.head = self.head.next
self.num_elements -= 1
return temp
def top(self):
if self.head is None:
return None
return self.head.data
def size(self):
return self.num_elements
def is_empty(self):
return self.num_elements == 0
def evaluate_post_fix(input_list):
stack = Stack()
for element in input_list:
if element == '*':
second = stack.pop()
first = stack.pop()
output = first * second
stack.push(output)
elif element == '/':
second = stack.pop()
first = stack.pop()
output = int(first / second)
stack.push(output)
elif element == '+':
second = stack.pop()
first = stack.pop()
output = first + second
stack.push(output)
elif element == '-':
second = stack.pop()
first = stack.pop()
output = first - second
stack.push(output)
else:
stack.push(int(element))
return stack.pop()
def test_function(test_case):
output = evaluate_post_fix(test_case[0])
print(output)
if output == test_case[1]:
print("Pass")
else:
print("Fail")
test_case_1 = [["3", "1", "+", "4", "*"], 16]
test_function(test_case_1)
test_case_2 = [["4", "13", "5", "/", "+"], 6]
test_function(test_case_2)
test_case_3 = [["10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"], 22]
test_function(test_case_3) | class Linkedlistnode:
def __init__(self, data):
self.data = data
self.next = None
class Stack:
def __init__(self):
self.num_elements = 0
self.head = None
def push(self, data):
new_node = linked_list_node(data)
if self.head is None:
self.head = new_node
else:
new_node.next = self.head
self.head = new_node
self.num_elements += 1
def pop(self):
if self.is_empty():
return None
temp = self.head.data
self.head = self.head.next
self.num_elements -= 1
return temp
def top(self):
if self.head is None:
return None
return self.head.data
def size(self):
return self.num_elements
def is_empty(self):
return self.num_elements == 0
def evaluate_post_fix(input_list):
stack = stack()
for element in input_list:
if element == '*':
second = stack.pop()
first = stack.pop()
output = first * second
stack.push(output)
elif element == '/':
second = stack.pop()
first = stack.pop()
output = int(first / second)
stack.push(output)
elif element == '+':
second = stack.pop()
first = stack.pop()
output = first + second
stack.push(output)
elif element == '-':
second = stack.pop()
first = stack.pop()
output = first - second
stack.push(output)
else:
stack.push(int(element))
return stack.pop()
def test_function(test_case):
output = evaluate_post_fix(test_case[0])
print(output)
if output == test_case[1]:
print('Pass')
else:
print('Fail')
test_case_1 = [['3', '1', '+', '4', '*'], 16]
test_function(test_case_1)
test_case_2 = [['4', '13', '5', '/', '+'], 6]
test_function(test_case_2)
test_case_3 = [['10', '6', '9', '3', '+', '-11', '*', '/', '*', '17', '+', '5', '+'], 22]
test_function(test_case_3) |
# Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
# Example 1:
# Input: "Hello"
# Output: "hello"
# Example 2:
# Input: "here"
# Output: "here"
# Example 3:
# Input: "LOVELY"
# Output: "lovely"
class Solution:
def toLowerCase(self, str: str) -> str:
for i in range (0, len(str)):
asc = ord(str[i])
if 65 <= asc <= 90:
str = str[:i] + chr(asc + 32) + str[i + 1 :]
return str | class Solution:
def to_lower_case(self, str: str) -> str:
for i in range(0, len(str)):
asc = ord(str[i])
if 65 <= asc <= 90:
str = str[:i] + chr(asc + 32) + str[i + 1:]
return str |
"""
Project Euler Problem 6: Sum square difference
"""
# Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum
MAXINT = 100
sumsq = 0
sqsum = (MAXINT*(MAXINT+1)//2)**2
# Calculate the sum of squares
for i in range(1,MAXINT+1):
sumsq += i**2
print(sqsum-sumsq)
| """
Project Euler Problem 6: Sum square difference
"""
maxint = 100
sumsq = 0
sqsum = (MAXINT * (MAXINT + 1) // 2) ** 2
for i in range(1, MAXINT + 1):
sumsq += i ** 2
print(sqsum - sumsq) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Helper methods used in notebooks
"""
def _dataframe_highlight_4d_no_altitude_dim(x, bg_color='#ffcccc'):
#copy df to new - original data are not changed
df = x.copy()
#set by condition
m1 = df['Dim'] == 4
m2 = 'altitude' not in df['Dim names']
mask = m1 * m2
df.loc[mask, :] = 'background-color: {}'.format(bg_color)
df.loc[~mask,:] = 'background-color: ""'
return df | """
Helper methods used in notebooks
"""
def _dataframe_highlight_4d_no_altitude_dim(x, bg_color='#ffcccc'):
df = x.copy()
m1 = df['Dim'] == 4
m2 = 'altitude' not in df['Dim names']
mask = m1 * m2
df.loc[mask, :] = 'background-color: {}'.format(bg_color)
df.loc[~mask, :] = 'background-color: ""'
return df |
class Graph(object):
def __init__(self,*args,**kwargs):
self.node_neighbors = {} # Define vertex and adjacent vertex set as dictionary structure
self.visited = {} # Define the visited vertex set as a dictionary structure
def add_nodes(self,nodelist):
for node in nodelist:
self.add_node(node)
def add_node(self,node):
if not node in self.nodes():
self.node_neighbors[node] = []
def add_edge(self,edge):
u,v = edge
if(v not in self.node_neighbors[u]) and ( u not in self.node_neighbors[v]): # Here you can add your own side pointing to yourself
self.node_neighbors[u].append(v)
if(u!=v):
self.node_neighbors[v].append(u)
def nodes(self):
return self.node_neighbors.keys()
def breadth_first_search(self,root=None): # Breadth first requires the queue structure
queue = []
order = []
def bfs():
while len(queue)> 0:
node = queue.pop(0)
self.visited[node] = True
self.node_neighbors[node].sort()
for n in self.node_neighbors[node]:
if (not n in self.visited) and (not n in queue):
queue.append(n)
order.append(n)
if root:
queue.append(root)
order.append(root)
bfs()
for node in self.nodes():
if not node in self.visited:
queue.append(node)
order.append(node)
bfs()
# print(order)
return order
def bfs(graph, S, D):
queue = [(S, [S])]
while queue:
(vertex, path) = queue.pop(0)
for next in graph[vertex] - set(path):
if next == D:
yield path + [next]
else:
queue.append((next, path + [next]))
def shortest(graph, S, D):
try:
return next(bfs(graph, S, D))
except StopIteration:
return None
if __name__ == '__main__':
g = Graph()
n = int(input())
g.add_nodes([i+1 for i in range( n )])
for i in range( n - 1 ):
g.add_edge(tuple(input().split()))
print(g.node_neighbors)
# print(shortest(g, '1', '5')) | class Graph(object):
def __init__(self, *args, **kwargs):
self.node_neighbors = {}
self.visited = {}
def add_nodes(self, nodelist):
for node in nodelist:
self.add_node(node)
def add_node(self, node):
if not node in self.nodes():
self.node_neighbors[node] = []
def add_edge(self, edge):
(u, v) = edge
if v not in self.node_neighbors[u] and u not in self.node_neighbors[v]:
self.node_neighbors[u].append(v)
if u != v:
self.node_neighbors[v].append(u)
def nodes(self):
return self.node_neighbors.keys()
def breadth_first_search(self, root=None):
queue = []
order = []
def bfs():
while len(queue) > 0:
node = queue.pop(0)
self.visited[node] = True
self.node_neighbors[node].sort()
for n in self.node_neighbors[node]:
if not n in self.visited and (not n in queue):
queue.append(n)
order.append(n)
if root:
queue.append(root)
order.append(root)
bfs()
for node in self.nodes():
if not node in self.visited:
queue.append(node)
order.append(node)
bfs()
return order
def bfs(graph, S, D):
queue = [(S, [S])]
while queue:
(vertex, path) = queue.pop(0)
for next in graph[vertex] - set(path):
if next == D:
yield (path + [next])
else:
queue.append((next, path + [next]))
def shortest(graph, S, D):
try:
return next(bfs(graph, S, D))
except StopIteration:
return None
if __name__ == '__main__':
g = graph()
n = int(input())
g.add_nodes([i + 1 for i in range(n)])
for i in range(n - 1):
g.add_edge(tuple(input().split()))
print(g.node_neighbors) |
"""Write a function that returns the largest element in a list."""
def largest_element(a):
return max(a)
mylist = [1, 4, 5, 100, 2, 1, -1, -7]
max = largest_element(mylist)
print("The largest value is ", max)
| """Write a function that returns the largest element in a list."""
def largest_element(a):
return max(a)
mylist = [1, 4, 5, 100, 2, 1, -1, -7]
max = largest_element(mylist)
print('The largest value is ', max) |
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
{
'includes': [
'common_settings.gypi',
],
'targets': [
# Auto test - command line test for all platforms
{
'target_name': 'voe_auto_test',
'type': 'executable',
'dependencies': [
'voice_engine/main/source/voice_engine_core.gyp:voice_engine_core',
'system_wrappers/source/system_wrappers.gyp:system_wrappers',
],
'include_dirs': [
'voice_engine/main/test/auto_test',
],
'sources': [
'voice_engine/main/test/auto_test/voe_cpu_test.cc',
'voice_engine/main/test/auto_test/voe_cpu_test.h',
'voice_engine/main/test/auto_test/voe_extended_test.cc',
'voice_engine/main/test/auto_test/voe_extended_test.h',
'voice_engine/main/test/auto_test/voe_standard_test.cc',
'voice_engine/main/test/auto_test/voe_standard_test.h',
'voice_engine/main/test/auto_test/voe_stress_test.cc',
'voice_engine/main/test/auto_test/voe_stress_test.h',
'voice_engine/main/test/auto_test/voe_test_defines.h',
'voice_engine/main/test/auto_test/voe_test_interface.h',
'voice_engine/main/test/auto_test/voe_unit_test.cc',
'voice_engine/main/test/auto_test/voe_unit_test.h',
],
'conditions': [
['OS=="linux" or OS=="mac"', {
'actions': [
{
'action_name': 'copy audio file',
'inputs': [
'voice_engine/main/test/auto_test/audio_long16.pcm',
],
'outputs': [
'/tmp/audio_long16.pcm',
],
'action': [
'/bin/sh', '-c',
'cp -f voice_engine/main/test/auto_test/audio_* /tmp/;'\
'cp -f voice_engine/main/test/auto_test/audio_short16.pcm /tmp/;',
],
},
],
}],
['OS=="win"', {
'dependencies': [
'voice_engine.gyp:voe_ui_win_test',
],
}],
['OS=="win"', {
'actions': [
{
'action_name': 'copy audio file',
'inputs': [
'voice_engine/main/test/auto_test/audio_long16.pcm',
],
'outputs': [
'/tmp/audio_long16.pcm',
],
'action': [
'cmd', '/c',
'xcopy /Y /R .\\voice_engine\\main\\test\\auto_test\\audio_* \\tmp',
],
},
{
'action_name': 'copy audio audio_short16.pcm',
'inputs': [
'voice_engine/main/test/auto_test/audio_short16.pcm',
],
'outputs': [
'/tmp/audio_short16.pcm',
],
'action': [
'cmd', '/c',
'xcopy /Y /R .\\voice_engine\\main\\test\\auto_test\\audio_short16.pcm \\tmp',
],
},
],
}],
],
},
{
# command line test that should work on linux/mac/win
'target_name': 'voe_cmd_test',
'type': 'executable',
'dependencies': [
'voice_engine/main/source/voice_engine_core.gyp:voice_engine_core',
'system_wrappers/source/system_wrappers.gyp:system_wrappers',
],
'sources': [
'voice_engine/main/test/cmd_test/voe_cmd_test.cc',
],
},
],
'conditions': [
['OS=="win"', {
'targets': [
# WinTest - GUI test for Windows
{
'target_name': 'voe_ui_win_test',
'type': 'executable',
'dependencies': [
'voice_engine/main/source/voice_engine_core.gyp:voice_engine_core',
'system_wrappers/source/system_wrappers.gyp:system_wrappers',
],
'include_dirs': [
'voice_engine/main/test/win_test',
],
'sources': [
'voice_engine/main/test/win_test/Resource.h',
'voice_engine/main/test/win_test/WinTest.cpp',
'voice_engine/main/test/win_test/WinTest.h',
'voice_engine/main/test/win_test/WinTest.rc',
'voice_engine/main/test/win_test/WinTestDlg.cpp',
'voice_engine/main/test/win_test/WinTestDlg.h',
'voice_engine/main/test/win_test/res/WinTest.ico',
'voice_engine/main/test/win_test/res/WinTest.rc2',
'voice_engine/main/test/win_test/stdafx.cpp',
'voice_engine/main/test/win_test/stdafx.h',
],
'actions': [
{
'action_name': 'copy audio file',
'inputs': [
'voice_engine/main/test/win_test/audio_tiny11.wav',
],
'outputs': [
'/tmp/audio_tiny11.wav',
],
'action': [
'cmd', '/c',
'xcopy /Y /R .\\voice_engine\\main\\test\\win_test\\audio_* \\tmp',
],
},
{
'action_name': 'copy audio audio_short16.pcm',
'inputs': [
'voice_engine/main/test/win_test/audio_short16.pcm',
],
'outputs': [
'/tmp/audio_short16.pcm',
],
'action': [
'cmd', '/c',
'xcopy /Y /R .\\voice_engine\\main\\test\\win_test\\audio_short16.pcm \\tmp',
],
},
{
'action_name': 'copy audio_long16noise.pcm',
'inputs': [
'voice_engine/main/test/win_test/audio_long16noise.pcm',
],
'outputs': [
'/tmp/audio_long16noise.pcm',
],
'action': [
'cmd', '/c',
'xcopy /Y /R .\\voice_engine\\main\\test\\win_test\\audio_long16noise.pcm \\tmp',
],
},
],
'configurations': {
'Common_Base': {
'msvs_configuration_attributes': {
'conditions': [
['component=="shared_library"', {
'UseOfMFC': '2', # Shared DLL
},{
'UseOfMFC': '1', # Static
}],
],
},
},
},
'msvs_settings': {
'VCLinkerTool': {
'SubSystem': '2', # Windows
},
},
},
],
}],
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
| {'includes': ['common_settings.gypi'], 'targets': [{'target_name': 'voe_auto_test', 'type': 'executable', 'dependencies': ['voice_engine/main/source/voice_engine_core.gyp:voice_engine_core', 'system_wrappers/source/system_wrappers.gyp:system_wrappers'], 'include_dirs': ['voice_engine/main/test/auto_test'], 'sources': ['voice_engine/main/test/auto_test/voe_cpu_test.cc', 'voice_engine/main/test/auto_test/voe_cpu_test.h', 'voice_engine/main/test/auto_test/voe_extended_test.cc', 'voice_engine/main/test/auto_test/voe_extended_test.h', 'voice_engine/main/test/auto_test/voe_standard_test.cc', 'voice_engine/main/test/auto_test/voe_standard_test.h', 'voice_engine/main/test/auto_test/voe_stress_test.cc', 'voice_engine/main/test/auto_test/voe_stress_test.h', 'voice_engine/main/test/auto_test/voe_test_defines.h', 'voice_engine/main/test/auto_test/voe_test_interface.h', 'voice_engine/main/test/auto_test/voe_unit_test.cc', 'voice_engine/main/test/auto_test/voe_unit_test.h'], 'conditions': [['OS=="linux" or OS=="mac"', {'actions': [{'action_name': 'copy audio file', 'inputs': ['voice_engine/main/test/auto_test/audio_long16.pcm'], 'outputs': ['/tmp/audio_long16.pcm'], 'action': ['/bin/sh', '-c', 'cp -f voice_engine/main/test/auto_test/audio_* /tmp/;cp -f voice_engine/main/test/auto_test/audio_short16.pcm /tmp/;']}]}], ['OS=="win"', {'dependencies': ['voice_engine.gyp:voe_ui_win_test']}], ['OS=="win"', {'actions': [{'action_name': 'copy audio file', 'inputs': ['voice_engine/main/test/auto_test/audio_long16.pcm'], 'outputs': ['/tmp/audio_long16.pcm'], 'action': ['cmd', '/c', 'xcopy /Y /R .\\voice_engine\\main\\test\\auto_test\\audio_* \\tmp']}, {'action_name': 'copy audio audio_short16.pcm', 'inputs': ['voice_engine/main/test/auto_test/audio_short16.pcm'], 'outputs': ['/tmp/audio_short16.pcm'], 'action': ['cmd', '/c', 'xcopy /Y /R .\\voice_engine\\main\\test\\auto_test\\audio_short16.pcm \\tmp']}]}]]}, {'target_name': 'voe_cmd_test', 'type': 'executable', 'dependencies': ['voice_engine/main/source/voice_engine_core.gyp:voice_engine_core', 'system_wrappers/source/system_wrappers.gyp:system_wrappers'], 'sources': ['voice_engine/main/test/cmd_test/voe_cmd_test.cc']}], 'conditions': [['OS=="win"', {'targets': [{'target_name': 'voe_ui_win_test', 'type': 'executable', 'dependencies': ['voice_engine/main/source/voice_engine_core.gyp:voice_engine_core', 'system_wrappers/source/system_wrappers.gyp:system_wrappers'], 'include_dirs': ['voice_engine/main/test/win_test'], 'sources': ['voice_engine/main/test/win_test/Resource.h', 'voice_engine/main/test/win_test/WinTest.cpp', 'voice_engine/main/test/win_test/WinTest.h', 'voice_engine/main/test/win_test/WinTest.rc', 'voice_engine/main/test/win_test/WinTestDlg.cpp', 'voice_engine/main/test/win_test/WinTestDlg.h', 'voice_engine/main/test/win_test/res/WinTest.ico', 'voice_engine/main/test/win_test/res/WinTest.rc2', 'voice_engine/main/test/win_test/stdafx.cpp', 'voice_engine/main/test/win_test/stdafx.h'], 'actions': [{'action_name': 'copy audio file', 'inputs': ['voice_engine/main/test/win_test/audio_tiny11.wav'], 'outputs': ['/tmp/audio_tiny11.wav'], 'action': ['cmd', '/c', 'xcopy /Y /R .\\voice_engine\\main\\test\\win_test\\audio_* \\tmp']}, {'action_name': 'copy audio audio_short16.pcm', 'inputs': ['voice_engine/main/test/win_test/audio_short16.pcm'], 'outputs': ['/tmp/audio_short16.pcm'], 'action': ['cmd', '/c', 'xcopy /Y /R .\\voice_engine\\main\\test\\win_test\\audio_short16.pcm \\tmp']}, {'action_name': 'copy audio_long16noise.pcm', 'inputs': ['voice_engine/main/test/win_test/audio_long16noise.pcm'], 'outputs': ['/tmp/audio_long16noise.pcm'], 'action': ['cmd', '/c', 'xcopy /Y /R .\\voice_engine\\main\\test\\win_test\\audio_long16noise.pcm \\tmp']}], 'configurations': {'Common_Base': {'msvs_configuration_attributes': {'conditions': [['component=="shared_library"', {'UseOfMFC': '2'}, {'UseOfMFC': '1'}]]}}}, 'msvs_settings': {'VCLinkerTool': {'SubSystem': '2'}}}]}]]} |
sample_rate=16000 #Provided in the paper
n_mels = 80
frame_rate = 80 #Provided in the paper
frame_length = 0.05
hop_length = int(sample_rate/frame_rate)
win_length = int(sample_rate*frame_length)
scaling_factor = 4
min_db_level = -100
bce_weights = 7
embed_dims = 512
hidden_dims = 256
heads = 4
forward_expansion = 4
num_layers = 4
dropout = 0.15
max_len = 1024
pad_idx = 0
Metadata = 'input/LJSpeech-1.1/metadata.csv'
Audio_file_path = 'input/LJSpeech-1.1/wavs/'
Model_Path = 'model/model.bin'
checkpoint = 'model/checkpoint.bin'
Batch_Size = 2
Epochs = 40
LR = 3e-4
warmup_steps = 0.2 | sample_rate = 16000
n_mels = 80
frame_rate = 80
frame_length = 0.05
hop_length = int(sample_rate / frame_rate)
win_length = int(sample_rate * frame_length)
scaling_factor = 4
min_db_level = -100
bce_weights = 7
embed_dims = 512
hidden_dims = 256
heads = 4
forward_expansion = 4
num_layers = 4
dropout = 0.15
max_len = 1024
pad_idx = 0
metadata = 'input/LJSpeech-1.1/metadata.csv'
audio_file_path = 'input/LJSpeech-1.1/wavs/'
model__path = 'model/model.bin'
checkpoint = 'model/checkpoint.bin'
batch__size = 2
epochs = 40
lr = 0.0003
warmup_steps = 0.2 |
# Classes are blueprints that make instances of a class
# emp_1 = Employee()
# emp_2 = Employee()
# These two things become independant objects or 'instances'
"""
emp_1.first = 'Corey'
emp_1.last = 'Schafer'
emp_1.email = 'Corey.Schafer@company.com'
emp_1.pay = 50000
emp_2.first = 'Corey'
emp_2.last = 'Schafer'
emp_2.email = 'Corey.Schafer@company.com'
emp_2.pay = 50000
"""
# these are the same details for different instances
# and can be performed with a class
class Employee:
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + '@company.com'
def fullname(self):
return('{} {}'.format(self.first, self.last))
emp_1 = Employee('Corey', 'Schafer', 50000)
emp_2 = Employee('Test', 'Employee', 60000)
print(Employee.fullname(emp_1)) | """
emp_1.first = 'Corey'
emp_1.last = 'Schafer'
emp_1.email = 'Corey.Schafer@company.com'
emp_1.pay = 50000
emp_2.first = 'Corey'
emp_2.last = 'Schafer'
emp_2.email = 'Corey.Schafer@company.com'
emp_2.pay = 50000
"""
class Employee:
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + '@company.com'
def fullname(self):
return '{} {}'.format(self.first, self.last)
emp_1 = employee('Corey', 'Schafer', 50000)
emp_2 = employee('Test', 'Employee', 60000)
print(Employee.fullname(emp_1)) |
class node:
def __init__(self, x):
self.value = x
self.next = None
class LinkedList:
def __init__(self, y):
self.head = node(y)
| class Node:
def __init__(self, x):
self.value = x
self.next = None
class Linkedlist:
def __init__(self, y):
self.head = node(y) |
class Message(object):
def __init__(self, args, kwargs=None, start_timestamp=None):
'''
The Nomad Message type which is passed around clients.
:param args: list of args for the next operator
:type args: list
:param kwargs: dict of kwargs for the next operator
:type kwargs: dict
'''
# if not isinstance(args, list):
# args = [args]
self.args = args
if kwargs is None:
self.kwargs = {}
else:
self.kwargs = kwargs
self.start_timestamp = start_timestamp
def get_args(self):
return self.args
def __str__(self):
return str(self.args) + "_" + str(self.start_timestamp) | class Message(object):
def __init__(self, args, kwargs=None, start_timestamp=None):
"""
The Nomad Message type which is passed around clients.
:param args: list of args for the next operator
:type args: list
:param kwargs: dict of kwargs for the next operator
:type kwargs: dict
"""
self.args = args
if kwargs is None:
self.kwargs = {}
else:
self.kwargs = kwargs
self.start_timestamp = start_timestamp
def get_args(self):
return self.args
def __str__(self):
return str(self.args) + '_' + str(self.start_timestamp) |
def subwaysFilter(dimension):
def _filter(poi):
if poi["id"] == "subways/" + dimension:
return poi
return _filter
| def subways_filter(dimension):
def _filter(poi):
if poi['id'] == 'subways/' + dimension:
return poi
return _filter |
'''
TOTAL PATHS FROM (0, 0) to (m, n)
The task is to calculate total possible moves we can make to reach
(m, n) in a matrix, starting from origin, given that we can only take
1 step towards right or up in a single move.
'''
def totalPaths(m, n):
total = []
for i in range(0, m):
temp = []
for j in range(0, n):
temp.append(0)
total.append(temp)
for i in range(0, max(m, n)):
if i < m:
total[i][0] = 1
if i < n:
total[0][i] = 1
for i in range(1, m):
for j in range(1, n):
total[i][j] = total[i - 1][j] + total[i][j - 1]
return total[m-1][n-1]
m = int(input())
n = int(input())
print("The total paths are", totalPaths(m, n))
'''
INPUT :
n = 6
m = 5
OUTPUT :
The total paths are 126
'''
| """
TOTAL PATHS FROM (0, 0) to (m, n)
The task is to calculate total possible moves we can make to reach
(m, n) in a matrix, starting from origin, given that we can only take
1 step towards right or up in a single move.
"""
def total_paths(m, n):
total = []
for i in range(0, m):
temp = []
for j in range(0, n):
temp.append(0)
total.append(temp)
for i in range(0, max(m, n)):
if i < m:
total[i][0] = 1
if i < n:
total[0][i] = 1
for i in range(1, m):
for j in range(1, n):
total[i][j] = total[i - 1][j] + total[i][j - 1]
return total[m - 1][n - 1]
m = int(input())
n = int(input())
print('The total paths are', total_paths(m, n))
'\nINPUT :\nn = 6\nm = 5\nOUTPUT :\nThe total paths are 126\n' |
def combo_breaker_part1(data: str) -> int:
key1, key2 = tuple(map(int, data.splitlines(keepends=False)))
subject = 7
found = False
loop_size = None
loop_count = 1
while not found:
loop_count += 1
subject = transform(subject)
if subject == key2:
loop_size = loop_count
found = True
working = 1
for n in range(loop_size):
working = transform(working, key1)
return working
def transform(key: int, subject: int = 7) -> int:
return (key * subject) % 20201227
# def combo_breaker_part2(data: str) -> int:
# pass
if __name__ == '__main__':
test_text = """5764801
17807724"""
assert combo_breaker_part1(test_text) == 14897079
# assert combo_breaker_part2(test_text) == 0
with open('input.txt') as in_file:
in_text = in_file.read()
part1 = combo_breaker_part1(in_text)
print(f'Part1: {part1}')
# part2 = combo_breaker_part2(in_text)
# print(f'Part2: {part2}')
# Part1: 448851
| def combo_breaker_part1(data: str) -> int:
(key1, key2) = tuple(map(int, data.splitlines(keepends=False)))
subject = 7
found = False
loop_size = None
loop_count = 1
while not found:
loop_count += 1
subject = transform(subject)
if subject == key2:
loop_size = loop_count
found = True
working = 1
for n in range(loop_size):
working = transform(working, key1)
return working
def transform(key: int, subject: int=7) -> int:
return key * subject % 20201227
if __name__ == '__main__':
test_text = '5764801\n17807724'
assert combo_breaker_part1(test_text) == 14897079
with open('input.txt') as in_file:
in_text = in_file.read()
part1 = combo_breaker_part1(in_text)
print(f'Part1: {part1}') |
with open("mystery.png", "rb") as f:
buf1 = f.read()[-0x10:]
with open("mystery2.png", "rb") as f:
buf2 = f.read()[-2:]
with open("mystery3.png", "rb") as f:
buf3 = f.read()[-8:]
flag = [0 for i in range(0x1a)]
flag[1] = buf3[0]
flag[0] = buf2[0] - ((0x2a + (0x2a >> 7)) >> 1)
flag[2] = buf3[1]
flag[4] = buf1[0]
flag[5] = buf3[2]
for i in range(4):
flag[6 + i] = buf1[1 + i]
flag[3] = buf2[1] - 4
for i in range(5):
flag[0x0a + i] = buf3[3 + i]
for i in range(0xf, 0x1a):
flag[i] = buf1[1 + 4 + i - 0xf]
for c in flag:
print(chr(c), end="")
| with open('mystery.png', 'rb') as f:
buf1 = f.read()[-16:]
with open('mystery2.png', 'rb') as f:
buf2 = f.read()[-2:]
with open('mystery3.png', 'rb') as f:
buf3 = f.read()[-8:]
flag = [0 for i in range(26)]
flag[1] = buf3[0]
flag[0] = buf2[0] - (42 + (42 >> 7) >> 1)
flag[2] = buf3[1]
flag[4] = buf1[0]
flag[5] = buf3[2]
for i in range(4):
flag[6 + i] = buf1[1 + i]
flag[3] = buf2[1] - 4
for i in range(5):
flag[10 + i] = buf3[3 + i]
for i in range(15, 26):
flag[i] = buf1[1 + 4 + i - 15]
for c in flag:
print(chr(c), end='') |
# Input exmaple and variable value assignment
print('Yo nerd, waddup?')
print('Tell me your name:')
myName = input() # Assigns whatever you type to the myName variable
print('Nice to meet you, ' + myName + '!') # Print text with a variable name
print('Your name consists of this many characters: ')
print(len(myName)) # len() counts the characters in the myName variable
print('Now then, tell me your age in years: ')
myAge = input()
# A stupid dad-joke to show how arithmetic works.
# Note the int() - This makes sure you can calculate a value
# The calculation takes place inside a str()
# - since we are trying to print a string, it should be a str()
print("Well, " + myName + "... You will be " + str(int(myAge) + 1) + " in a year.." )
| print('Yo nerd, waddup?')
print('Tell me your name:')
my_name = input()
print('Nice to meet you, ' + myName + '!')
print('Your name consists of this many characters: ')
print(len(myName))
print('Now then, tell me your age in years: ')
my_age = input()
print('Well, ' + myName + '... You will be ' + str(int(myAge) + 1) + ' in a year..') |
class Solution:
def isRectangleCover(self, rectangles: List[List[int]]) -> bool:
points={}
for r in rectangles:
vs=[tuple(r[:2]), (r[2],r[1]), tuple(r[2:]), (r[0],r[3])]
for i in range(len(vs)):
v=vs[i]
if v not in points:
points[v]=[False]*4
if points[v][i]:
return False
points[v][i]=True
singleDirection=0
for k,v in points.items():
quadrant=sum(x for x in v if x==True)
if quadrant==1:
singleDirection+=1
elif quadrant==2 and v[0]==v[2]:
return False
elif quadrant==3:
return False
if singleDirection==4:
return True
return False | class Solution:
def is_rectangle_cover(self, rectangles: List[List[int]]) -> bool:
points = {}
for r in rectangles:
vs = [tuple(r[:2]), (r[2], r[1]), tuple(r[2:]), (r[0], r[3])]
for i in range(len(vs)):
v = vs[i]
if v not in points:
points[v] = [False] * 4
if points[v][i]:
return False
points[v][i] = True
single_direction = 0
for (k, v) in points.items():
quadrant = sum((x for x in v if x == True))
if quadrant == 1:
single_direction += 1
elif quadrant == 2 and v[0] == v[2]:
return False
elif quadrant == 3:
return False
if singleDirection == 4:
return True
return False |
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums = sorted(nums1 + nums2)
n = len(nums)
middle = n // 2
if n % 2 == 0:
return (nums[middle - 1] + nums[middle]) / 2.0
else:
return nums[middle]
| class Solution(object):
def find_median_sorted_arrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
nums = sorted(nums1 + nums2)
n = len(nums)
middle = n // 2
if n % 2 == 0:
return (nums[middle - 1] + nums[middle]) / 2.0
else:
return nums[middle] |
def complement(num):
"""
Find the non-zero padded binary compelement.
"""
if not num:
return 1
i = 1
while i <= num:
num ^= i
i = i << 1
return num
| def complement(num):
"""
Find the non-zero padded binary compelement.
"""
if not num:
return 1
i = 1
while i <= num:
num ^= i
i = i << 1
return num |
aUser = input("Please enter the first integer: ")
bUser = input("Please enter the second integer: ")
cUser = input("Please enter the third integer: ")
# Compare Inputs
def compareInput(aUser, bUser, cUser):
aUser = integerCheck(aUser)
bUser = integerCheck(bUser)
cUser = integerCheck(cUser)
if aUser >= bUser and bUser >= cUser:
inputSorted = str(cUser) + " " + str(bUser) + " " + str(aUser)
elif aUser >= cUser and cUser >= bUser:
inputSorted = str(bUser) + " " + str(cUser) + " " + str(aUser)
elif bUser >= aUser and aUser >= cUser:
inputSorted = str(cUser) + " " + str(aUser) + " " + str(bUser)
elif bUser >= cUser and cUser >= aUser:
inputSorted = str(aUser) + " " + str(cUser) + " " + str(bUser)
elif cUser >= bUser and bUser >= aUser:
inputSorted = str(aUser) + " " + str(bUser) + " " + str(cUser)
elif cUser >= aUser and aUser >= bUser:
inputSorted = str(bUser) + " " + str(aUser) + " " + str(cUser)
return inputSorted
# Error Check
def integerCheck(value):
try:
return int(value)
except Exception:
print("Please input a valid Integer!")
quit()
def printResults(inputSorted):
print("Input three integer numbers in ascending order:\n" + inputSorted)
inputSorted = compareInput(aUser, bUser, cUser)
printResults(inputSorted)
| a_user = input('Please enter the first integer: ')
b_user = input('Please enter the second integer: ')
c_user = input('Please enter the third integer: ')
def compare_input(aUser, bUser, cUser):
a_user = integer_check(aUser)
b_user = integer_check(bUser)
c_user = integer_check(cUser)
if aUser >= bUser and bUser >= cUser:
input_sorted = str(cUser) + ' ' + str(bUser) + ' ' + str(aUser)
elif aUser >= cUser and cUser >= bUser:
input_sorted = str(bUser) + ' ' + str(cUser) + ' ' + str(aUser)
elif bUser >= aUser and aUser >= cUser:
input_sorted = str(cUser) + ' ' + str(aUser) + ' ' + str(bUser)
elif bUser >= cUser and cUser >= aUser:
input_sorted = str(aUser) + ' ' + str(cUser) + ' ' + str(bUser)
elif cUser >= bUser and bUser >= aUser:
input_sorted = str(aUser) + ' ' + str(bUser) + ' ' + str(cUser)
elif cUser >= aUser and aUser >= bUser:
input_sorted = str(bUser) + ' ' + str(aUser) + ' ' + str(cUser)
return inputSorted
def integer_check(value):
try:
return int(value)
except Exception:
print('Please input a valid Integer!')
quit()
def print_results(inputSorted):
print('Input three integer numbers in ascending order:\n' + inputSorted)
input_sorted = compare_input(aUser, bUser, cUser)
print_results(inputSorted) |
"""
File that contains exceptions for molecules that need
to have different multiplicity/spin or symmetry configurations
than the defaults set by Gaussian or other Quantum Chemistry programs
Ex: CH2 radical, O2, OH radical
"""
# species
# 320320000000000000001 = O2
# 140260020000000000001 = CH2
# 170170000000000000002 = OH
# 320000000000000000001 = S
def get_spin(chemid, spin): # spin as defined in molpro = 2S
if chemid == '320320000000000000001':
spin = 2
elif chemid == '140260020000000000001':
spin = 2
elif chemid == '170170000000000000002':
spin == 2
else:
spin = spin
return spin
def get_multiplicity(chemid, mult): # 2S+1
if chemid == '320320000000000000001':
mult = 3
elif chemid == '140260020000000000001':
mult = 3
elif chemid == '170170000000000000002':
mult = 3
else:
mult = mult
return mult
def get_symm(chemid, symm): # molpro symm defined by point group
if chemid == '320320000000000000001':
symm = 1 # used Ag state, label = 1 for molpro
elif chemid == '140260020000000000001':
symm = 2 # B1 state, C2V symmetry, label = 2 for molpro
elif chemid == '170170000000000000002':
symm = 2 # 2Pi state ~ using B state = 2 for molpro
else:
symm = symm
return symm
| """
File that contains exceptions for molecules that need
to have different multiplicity/spin or symmetry configurations
than the defaults set by Gaussian or other Quantum Chemistry programs
Ex: CH2 radical, O2, OH radical
"""
def get_spin(chemid, spin):
if chemid == '320320000000000000001':
spin = 2
elif chemid == '140260020000000000001':
spin = 2
elif chemid == '170170000000000000002':
spin == 2
else:
spin = spin
return spin
def get_multiplicity(chemid, mult):
if chemid == '320320000000000000001':
mult = 3
elif chemid == '140260020000000000001':
mult = 3
elif chemid == '170170000000000000002':
mult = 3
else:
mult = mult
return mult
def get_symm(chemid, symm):
if chemid == '320320000000000000001':
symm = 1
elif chemid == '140260020000000000001':
symm = 2
elif chemid == '170170000000000000002':
symm = 2
else:
symm = symm
return symm |
class MgraphConnectoSiteMixin:
def get_root_site(self):
return self.get('/sites/root')
def get_site(self, site_id):
return self.get(f'/sites/{site_id}')
def get_site_drive(self, site_id):
return self.get(f'/sites/{site_id}/drive')
def get_site_drives(self, site_id):
res = self.get(f'/sites/{site_id}/drives')
if 'value' in res:
return res['value']
return []
def search_sites(self, site_name):
res = self.get(f'/sites?search={site_name}')
if 'value' in res:
return res['value']
return []
def get_subsites(self, site_id):
return self.get(f'/sites/{site_id}/sites')
def walk_sites(self, site=None): # FIXME make this a generator
if site is None:
site = self.get_root_site()
self.sites = {}
self.sites[site['id']] = site
subsites = self.get_subsites(site['id'])
# jdump(subsites, caller=__file__)
if 'value' in subsites:
for subsite in subsites['value']:
self.sites[subsite['id']] = subsite
self.walk_sites(site=subsite)
return self.sites
| class Mgraphconnectositemixin:
def get_root_site(self):
return self.get('/sites/root')
def get_site(self, site_id):
return self.get(f'/sites/{site_id}')
def get_site_drive(self, site_id):
return self.get(f'/sites/{site_id}/drive')
def get_site_drives(self, site_id):
res = self.get(f'/sites/{site_id}/drives')
if 'value' in res:
return res['value']
return []
def search_sites(self, site_name):
res = self.get(f'/sites?search={site_name}')
if 'value' in res:
return res['value']
return []
def get_subsites(self, site_id):
return self.get(f'/sites/{site_id}/sites')
def walk_sites(self, site=None):
if site is None:
site = self.get_root_site()
self.sites = {}
self.sites[site['id']] = site
subsites = self.get_subsites(site['id'])
if 'value' in subsites:
for subsite in subsites['value']:
self.sites[subsite['id']] = subsite
self.walk_sites(site=subsite)
return self.sites |
game = {
'columns': 8,
'rows': 8,
'fps': 30,
'countdown': 5,
'interval': 800,
'score_increment': 1,
'level_increment': 8,
'interval_increment': 50
}
| game = {'columns': 8, 'rows': 8, 'fps': 30, 'countdown': 5, 'interval': 800, 'score_increment': 1, 'level_increment': 8, 'interval_increment': 50} |
'''
Given an integer array nums, in which exactly two elements
appear only once and all the other elements appear exactly
twice. Find the two elements that appear only once. You can
return the answer in any order.
Follow up: Your algorithm should run in linear runtime
complexity. Could you implement it using only constant
space complexity?
Example:
Input: nums = [1,2,1,3,2,5]
Output: [3,5]
Explanation: [5, 3] is also a valid answer.
Example:
Input: nums = [-1,0]
Output: [-1,0]
Example:
Input: nums = [0,1]
Output: [1,0]
Constraints:
- 2 <= nums.length <= 3 * 10^4
- -2^31 <= nums[i] <= 2^31 - 1
- Each integer in nums will appear twice, only two
integers will appear once.
'''
#Difficulty: Medium
#32 / 32 test cases passed.
#Runtime: 56 ms
#Memory Usage: 16.2 MB
#Runtime: 56 ms, faster than 82.01% of Python3 online submissions for Single Number III.
#Memory Usage: 16.2 MB, less than 21.37% of Python3 online submissions for Single Number III.
class Solution:
def singleNumber(self, nums: List[int]) -> List[int]:
single = set()
for num in nums:
if num not in single:
single.add(num)
else:
single.remove(num)
return single
| """
Given an integer array nums, in which exactly two elements
appear only once and all the other elements appear exactly
twice. Find the two elements that appear only once. You can
return the answer in any order.
Follow up: Your algorithm should run in linear runtime
complexity. Could you implement it using only constant
space complexity?
Example:
Input: nums = [1,2,1,3,2,5]
Output: [3,5]
Explanation: [5, 3] is also a valid answer.
Example:
Input: nums = [-1,0]
Output: [-1,0]
Example:
Input: nums = [0,1]
Output: [1,0]
Constraints:
- 2 <= nums.length <= 3 * 10^4
- -2^31 <= nums[i] <= 2^31 - 1
- Each integer in nums will appear twice, only two
integers will appear once.
"""
class Solution:
def single_number(self, nums: List[int]) -> List[int]:
single = set()
for num in nums:
if num not in single:
single.add(num)
else:
single.remove(num)
return single |
# Write a method to replace all spaces in a string s with '%20'.
# You my assume that the string has sufficient space at the end to hold
# the additional characters, and that you are given the "true"
# length of the string.
# Naive Solution (In this case the less beautiful solution)
# Runtime O(n)
def naiveURLify(s):
outputString = ""
for character in s:
if character == " ":
outputString += "%20"
else:
outputString += character
return outputString
# Efficient
# Runtime O(n)
def efficientUrlify(s):
return s.replace(" ", "%20")
inputString = "Hello world! How are we doing?"
print(naiveURLify(inputString))
print(efficientUrlify(inputString))
| def naive_ur_lify(s):
output_string = ''
for character in s:
if character == ' ':
output_string += '%20'
else:
output_string += character
return outputString
def efficient_urlify(s):
return s.replace(' ', '%20')
input_string = 'Hello world! How are we doing?'
print(naive_ur_lify(inputString))
print(efficient_urlify(inputString)) |
StampManifestProvider = provider(fields = ["stamp_enabled"])
def _impl(ctx):
return StampManifestProvider(stamp_enabled = ctx.build_setting_value)
stamp_manifest = rule(
implementation = _impl,
build_setting = config.bool(flag = True),
)
| stamp_manifest_provider = provider(fields=['stamp_enabled'])
def _impl(ctx):
return stamp_manifest_provider(stamp_enabled=ctx.build_setting_value)
stamp_manifest = rule(implementation=_impl, build_setting=config.bool(flag=True)) |
#first line opening when chat starts
def chat_opening():
"""Prints an opening line and checks if user returns proper response to determine if the chatbot should be started."""
msg = input("Would you like to learn about how animals migrate throughout and across the world? [Y/N]\nINPUT: ")
msg = msg.lower()
possible_replies = ['yes', 'y', 'sure', 'okay', 'yeah']
for reply in possible_replies:
if msg == reply:
return True
return False
#main menu that includes only animal categories
def print_menu():
"""Prints main categories of animals"""
animal_menu = {'1': 'Fish', '2': 'Birds', '3': 'Mammals', '4': 'Insects', '5': 'Exit'}
print('Learn about Animal Migration Patterns!!\nChoose a category...')
for key in animal_menu:
print(key + ". " + animal_menu[key])
def menu_choice():
"""Checks what category user wants and sets a variable equal to a list of animals for that specific category.
Returns True if user selects an animal category and continues asking if something other than numbers isn't inputted"""
loop = chat_opening()
if loop == False:
return [None, None, False]
while loop:
print_menu()
choice = input('INPUT: ')
#choice needs to equate to a string because input takes string and not int
if choice == '1':
fish.print_intro()
animal = 'fish'
animal_set = fish_set
return [animal, animal_set, True]
break
elif choice == '2':
bird.print_intro()
animal = 'bird'
animal_set = bird_set
return [animal, animal_set, True]
break
elif choice == '3':
mammal.print_intro()
animal = 'mammal'
animal_set = mammal_set
return [animal, animal_set, True]
break
elif choice == '4':
insect.print_intro()
animal = 'insect'
animal_set = insect_set
return [animal, animal_set, True]
break
elif choice == '5':
print('Exiting. Thanks for visiting!')
return [None, None, False]
break
else:
print('Invalid selection. Enter any new key to continue: ')
#secondary menu once animal category is chosen
def category_menu(animal, animal_set):
"""Prints the secondary menu and returns the number for the specific animal chosen so that instance can be indexed."""
print_category_menu(animal, animal_set)
animal_number = input()
animal_number = remove_punctuation(animal_number)
return animal_number
#specific secondary menu function which takes in the list of animals for the respective category
def print_category_menu(animal, animal_set):
"""General function to print secondary menu which takes in the animal list returned in menu_choice"""
print('Which specific ' + animal + ' would you like learn about?\n')
counter = 1
for each in animal_set:
counter = str(counter)
print(counter + ". " + each.name)
counter = int(counter) + 1
| def chat_opening():
"""Prints an opening line and checks if user returns proper response to determine if the chatbot should be started."""
msg = input('Would you like to learn about how animals migrate throughout and across the world? [Y/N]\nINPUT: ')
msg = msg.lower()
possible_replies = ['yes', 'y', 'sure', 'okay', 'yeah']
for reply in possible_replies:
if msg == reply:
return True
return False
def print_menu():
"""Prints main categories of animals"""
animal_menu = {'1': 'Fish', '2': 'Birds', '3': 'Mammals', '4': 'Insects', '5': 'Exit'}
print('Learn about Animal Migration Patterns!!\nChoose a category...')
for key in animal_menu:
print(key + '. ' + animal_menu[key])
def menu_choice():
"""Checks what category user wants and sets a variable equal to a list of animals for that specific category.
Returns True if user selects an animal category and continues asking if something other than numbers isn't inputted"""
loop = chat_opening()
if loop == False:
return [None, None, False]
while loop:
print_menu()
choice = input('INPUT: ')
if choice == '1':
fish.print_intro()
animal = 'fish'
animal_set = fish_set
return [animal, animal_set, True]
break
elif choice == '2':
bird.print_intro()
animal = 'bird'
animal_set = bird_set
return [animal, animal_set, True]
break
elif choice == '3':
mammal.print_intro()
animal = 'mammal'
animal_set = mammal_set
return [animal, animal_set, True]
break
elif choice == '4':
insect.print_intro()
animal = 'insect'
animal_set = insect_set
return [animal, animal_set, True]
break
elif choice == '5':
print('Exiting. Thanks for visiting!')
return [None, None, False]
break
else:
print('Invalid selection. Enter any new key to continue: ')
def category_menu(animal, animal_set):
"""Prints the secondary menu and returns the number for the specific animal chosen so that instance can be indexed."""
print_category_menu(animal, animal_set)
animal_number = input()
animal_number = remove_punctuation(animal_number)
return animal_number
def print_category_menu(animal, animal_set):
"""General function to print secondary menu which takes in the animal list returned in menu_choice"""
print('Which specific ' + animal + ' would you like learn about?\n')
counter = 1
for each in animal_set:
counter = str(counter)
print(counter + '. ' + each.name)
counter = int(counter) + 1 |
class Solution:
"""
@param x: a double
@return: the square root of x
"""
def sqrt(self, x):
# write your code here
start = 1
end = x
if x < 1:
start = x
end = 1
while (end - start > 1e-10):
mid = start + (end - start) / 2
if (mid * mid < x):
start = mid
elif (mid * mid > x):
end = mid
else:
break
return start | class Solution:
"""
@param x: a double
@return: the square root of x
"""
def sqrt(self, x):
start = 1
end = x
if x < 1:
start = x
end = 1
while end - start > 1e-10:
mid = start + (end - start) / 2
if mid * mid < x:
start = mid
elif mid * mid > x:
end = mid
else:
break
return start |
# -*- coding: utf-8 -*-
# ------------- Comparaciones -------------
print (7 < 5) # Falso
print (7 > 5) # Verdadero
print ((11 * 3) + 2 == 36 - 1) # Verdadero
print ((11 * 3) + 2 >= 36) # Falso
print ("curso" != "CuRsO") # Verdadero
print (5 and 4) #Operacion en binario
print (5 or 4)
print (not(4 > 3))
print (True)
print (False)
| print(7 < 5)
print(7 > 5)
print(11 * 3 + 2 == 36 - 1)
print(11 * 3 + 2 >= 36)
print('curso' != 'CuRsO')
print(5 and 4)
print(5 or 4)
print(not 4 > 3)
print(True)
print(False) |
# -*- coding: utf-8 -*-
# Hpo terms represents data from the hpo web
hpo_term = dict(
_id = str, # Same as hpo_id
hpo_id = str, # Required
aliases = list, # List of aliases
description = str,
genes = list, # List with integers that are hgnc_ids
)
# Disease terms represent diseases collected from omim, orphanet and decipher.
# Collected from OMIM
disease_term = dict(
_id = str, # Same as disease_id
disease_id = str, # required, like OMIM:600233
disase_nr = int, # The disease nr
description = str, # required
source = str, # required
genes = list, # List with integers that are hgnc_ids
)
# phenotype_term is a special object to hold information on case level
# This one might be deprecated when we skip mongoengine
phenotype_term = dict(
phenotype_id = str, # Can be omim_id hpo_id
feature = str,
disease_models = list, # list of strings
)
| hpo_term = dict(_id=str, hpo_id=str, aliases=list, description=str, genes=list)
disease_term = dict(_id=str, disease_id=str, disase_nr=int, description=str, source=str, genes=list)
phenotype_term = dict(phenotype_id=str, feature=str, disease_models=list) |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-instance-attributes
class OCEnv(OpenShiftCLI):
''' Class to wrap the oc command line tools '''
container_path = {"pod": "spec.containers[0].env",
"dc": "spec.template.spec.containers[0].env",
"rc": "spec.template.spec.containers[0].env",
}
# pylint allows 5. we need 6
# pylint: disable=too-many-arguments
def __init__(self,
namespace,
kind,
env_vars,
resource_name=None,
kubeconfig='/etc/origin/master/admin.kubeconfig',
verbose=False):
''' Constructor for OpenshiftOC '''
super(OCEnv, self).__init__(namespace, kubeconfig=kubeconfig, verbose=verbose)
self.kind = kind
self.name = resource_name
self.env_vars = env_vars
self._resource = None
@property
def resource(self):
''' property function for resource var'''
if not self._resource:
self.get()
return self._resource
@resource.setter
def resource(self, data):
''' setter function for resource var'''
self._resource = data
def key_value_exists(self, key, value):
''' return whether a key, value pair exists '''
return self.resource.exists_env_value(key, value)
def key_exists(self, key):
''' return whether a key exists '''
return self.resource.exists_env_key(key)
def get(self):
'''return environment variables '''
result = self._get(self.kind, self.name)
if result['returncode'] == 0:
if self.kind == 'dc':
self.resource = DeploymentConfig(content=result['results'][0])
result['results'] = self.resource.get(OCEnv.container_path[self.kind]) or []
return result
def delete(self):
''' delete environment variables '''
if self.resource.delete_env_var(self.env_vars.keys()):
return self._replace_content(self.kind, self.name, self.resource.yaml_dict)
return {'returncode': 0, 'changed': False}
def put(self):
'''place env vars into dc '''
for update_key, update_value in self.env_vars.items():
self.resource.update_env_var(update_key, update_value)
return self._replace_content(self.kind, self.name, self.resource.yaml_dict)
# pylint: disable=too-many-return-statements
@staticmethod
def run_ansible(params, check_mode):
'''run the oc_env module'''
ocenv = OCEnv(params['namespace'],
params['kind'],
params['env_vars'],
resource_name=params['name'],
kubeconfig=params['kubeconfig'],
verbose=params['debug'])
state = params['state']
api_rval = ocenv.get()
#####
# Get
#####
if state == 'list':
return {'changed': False, 'results': api_rval['results'], 'state': "list"}
########
# Delete
########
if state == 'absent':
for key in params.get('env_vars', {}).keys():
if ocenv.resource.exists_env_key(key):
if check_mode:
return {'changed': False,
'msg': 'CHECK_MODE: Would have performed a delete.'}
api_rval = ocenv.delete()
return {'changed': True, 'state': 'absent'}
return {'changed': False, 'state': 'absent'}
if state == 'present':
########
# Create
########
for key, value in params.get('env_vars', {}).items():
if not ocenv.key_value_exists(key, value):
if check_mode:
return {'changed': False,
'msg': 'CHECK_MODE: Would have performed a create.'}
# Create it here
api_rval = ocenv.put()
if api_rval['returncode'] != 0:
return {'failed': True, 'msg': api_rval}
# return the created object
api_rval = ocenv.get()
if api_rval['returncode'] != 0:
return {'failed': True, 'msg': api_rval}
return {'changed': True, 'results': api_rval['results'], 'state': 'present'}
return {'changed': False, 'results': api_rval['results'], 'state': 'present'}
return {'failed': True,
'changed': False,
'msg': 'Unknown state passed. %s' % state}
| class Ocenv(OpenShiftCLI):
""" Class to wrap the oc command line tools """
container_path = {'pod': 'spec.containers[0].env', 'dc': 'spec.template.spec.containers[0].env', 'rc': 'spec.template.spec.containers[0].env'}
def __init__(self, namespace, kind, env_vars, resource_name=None, kubeconfig='/etc/origin/master/admin.kubeconfig', verbose=False):
""" Constructor for OpenshiftOC """
super(OCEnv, self).__init__(namespace, kubeconfig=kubeconfig, verbose=verbose)
self.kind = kind
self.name = resource_name
self.env_vars = env_vars
self._resource = None
@property
def resource(self):
""" property function for resource var"""
if not self._resource:
self.get()
return self._resource
@resource.setter
def resource(self, data):
""" setter function for resource var"""
self._resource = data
def key_value_exists(self, key, value):
""" return whether a key, value pair exists """
return self.resource.exists_env_value(key, value)
def key_exists(self, key):
""" return whether a key exists """
return self.resource.exists_env_key(key)
def get(self):
"""return environment variables """
result = self._get(self.kind, self.name)
if result['returncode'] == 0:
if self.kind == 'dc':
self.resource = deployment_config(content=result['results'][0])
result['results'] = self.resource.get(OCEnv.container_path[self.kind]) or []
return result
def delete(self):
""" delete environment variables """
if self.resource.delete_env_var(self.env_vars.keys()):
return self._replace_content(self.kind, self.name, self.resource.yaml_dict)
return {'returncode': 0, 'changed': False}
def put(self):
"""place env vars into dc """
for (update_key, update_value) in self.env_vars.items():
self.resource.update_env_var(update_key, update_value)
return self._replace_content(self.kind, self.name, self.resource.yaml_dict)
@staticmethod
def run_ansible(params, check_mode):
"""run the oc_env module"""
ocenv = oc_env(params['namespace'], params['kind'], params['env_vars'], resource_name=params['name'], kubeconfig=params['kubeconfig'], verbose=params['debug'])
state = params['state']
api_rval = ocenv.get()
if state == 'list':
return {'changed': False, 'results': api_rval['results'], 'state': 'list'}
if state == 'absent':
for key in params.get('env_vars', {}).keys():
if ocenv.resource.exists_env_key(key):
if check_mode:
return {'changed': False, 'msg': 'CHECK_MODE: Would have performed a delete.'}
api_rval = ocenv.delete()
return {'changed': True, 'state': 'absent'}
return {'changed': False, 'state': 'absent'}
if state == 'present':
for (key, value) in params.get('env_vars', {}).items():
if not ocenv.key_value_exists(key, value):
if check_mode:
return {'changed': False, 'msg': 'CHECK_MODE: Would have performed a create.'}
api_rval = ocenv.put()
if api_rval['returncode'] != 0:
return {'failed': True, 'msg': api_rval}
api_rval = ocenv.get()
if api_rval['returncode'] != 0:
return {'failed': True, 'msg': api_rval}
return {'changed': True, 'results': api_rval['results'], 'state': 'present'}
return {'changed': False, 'results': api_rval['results'], 'state': 'present'}
return {'failed': True, 'changed': False, 'msg': 'Unknown state passed. %s' % state} |
class node:
def __init__(self,key):
self.left = None
self.right = None
self.val = key
def PreOrder(root):
if root:
print(root.val, end = " ")
PreOrder(root.left)
PreOrder(root.right)
root = node(1)
root.left = node(2)
root.right = node(3)
root.left.left = node(4)
root.left.right = node(5)
root.right.left = node(6)
root.right.right = node(7)
print("Pre Order traversal of tree is", end = " ")
PreOrder(root)
''' Output
Pre Order traversal of tree is 1 2 4 5 3 6 7
'''
| class Node:
def __init__(self, key):
self.left = None
self.right = None
self.val = key
def pre_order(root):
if root:
print(root.val, end=' ')
pre_order(root.left)
pre_order(root.right)
root = node(1)
root.left = node(2)
root.right = node(3)
root.left.left = node(4)
root.left.right = node(5)
root.right.left = node(6)
root.right.right = node(7)
print('Pre Order traversal of tree is', end=' ')
pre_order(root)
' Output\n\nPre Order traversal of tree is 1 2 4 5 3 6 7\n\n' |
# O(N) time, N -> no. of people in the orgChart
# O(d) time, d -> depth of the OrgChart/orgTree
def getLowestCommonManager(topManager, reportOne, reportTwo):
# Write your code here.
return getOrgInfo(topManager, reportOne, reportTwo).lowestCommonManager
def getOrgInfo(manager, reportOne, reportTwo):
numberImpReports = 0
for directReport in manager.directReports:
print(manager.name, directReport.name)
orgInfo = getOrgInfo(directReport, reportOne, reportTwo)
if orgInfo.lowestCommonManager is not None: # if this is our lowestCommonManager, then we return
return orgInfo
numberImpReports += orgInfo.numberImpReports # if we, as a manager, have any of the direct reports, then we increase the count since we have it
if manager == reportOne or manager == reportTwo: # it is possible that the manager was one of the imp reports
numberImpReports+=1
lowestCommonManager = manager if numberImpReports == 2 else None
return OrgInfo(lowestCommonManager, numberImpReports) # pass this count to its parent/manager
class OrgInfo:
def __init__(self, lowestCommonManager, numberImpReports):
self.lowestCommonManager = lowestCommonManager
self.numberImpReports = numberImpReports
# This is an input class. Do not edit.
class OrgChart:
def __init__(self, name):
self.name = name
self.directReports = []
| def get_lowest_common_manager(topManager, reportOne, reportTwo):
return get_org_info(topManager, reportOne, reportTwo).lowestCommonManager
def get_org_info(manager, reportOne, reportTwo):
number_imp_reports = 0
for direct_report in manager.directReports:
print(manager.name, directReport.name)
org_info = get_org_info(directReport, reportOne, reportTwo)
if orgInfo.lowestCommonManager is not None:
return orgInfo
number_imp_reports += orgInfo.numberImpReports
if manager == reportOne or manager == reportTwo:
number_imp_reports += 1
lowest_common_manager = manager if numberImpReports == 2 else None
return org_info(lowestCommonManager, numberImpReports)
class Orginfo:
def __init__(self, lowestCommonManager, numberImpReports):
self.lowestCommonManager = lowestCommonManager
self.numberImpReports = numberImpReports
class Orgchart:
def __init__(self, name):
self.name = name
self.directReports = [] |
def method1(ll: list, n: int) -> int:
s = set()
ans = 0
for ele in ll:
s.add(ele)
for i in range(n):
if (ll[i] - 1) not in s:
j = ll[i]
while j in s:
j += 1
ans = max(ans, j - ll[i])
return ans
if __name__ == "__main__":
"""
from timeit import timeit
n = 7
ll = [1, 9, 3, 10, 4, 20, 2]
print(timeit(lambda: method1(ll, n), number=10000)) # 0.021972083995933644
"""
| def method1(ll: list, n: int) -> int:
s = set()
ans = 0
for ele in ll:
s.add(ele)
for i in range(n):
if ll[i] - 1 not in s:
j = ll[i]
while j in s:
j += 1
ans = max(ans, j - ll[i])
return ans
if __name__ == '__main__':
'\n from timeit import timeit\n n = 7\n ll = [1, 9, 3, 10, 4, 20, 2]\n print(timeit(lambda: method1(ll, n), number=10000)) # 0.021972083995933644\n ' |
class Endpoint:
RESOURCE_MANAGEMENT = "https://management.azure.com"
RESOURCE_LOG_API = "https://api.loganalytics.io"
GET_AUTH_TOKEN = "https://login.microsoftonline.com/{}/oauth2/token" # nosec
GET_SHARED_KEY = (
RESOURCE_MANAGEMENT
+ "/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}/sharedKeys?api-version={}"
)
GET_WORKSPACE_ID = (
RESOURCE_MANAGEMENT
+ "/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}?api-version={}"
)
SEND_LOG_DATA = "https://{}.ods.opinsights.azure.com/api/logs?api-version={}"
GET_LOG_DATA = RESOURCE_LOG_API + "/{}/workspaces/{}/query"
| class Endpoint:
resource_management = 'https://management.azure.com'
resource_log_api = 'https://api.loganalytics.io'
get_auth_token = 'https://login.microsoftonline.com/{}/oauth2/token'
get_shared_key = RESOURCE_MANAGEMENT + '/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}/sharedKeys?api-version={}'
get_workspace_id = RESOURCE_MANAGEMENT + '/subscriptions/{}/resourcegroups/{}/providers/Microsoft.OperationalInsights/workspaces/{}?api-version={}'
send_log_data = 'https://{}.ods.opinsights.azure.com/api/logs?api-version={}'
get_log_data = RESOURCE_LOG_API + '/{}/workspaces/{}/query' |
class ContactHelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.app.wd
self.app.open_home_page()
def open_add_contact(self):
wd = self.app.wd
# open add contact page
wd.find_element_by_link_text("add new").click()
def create_new_contact(self, add_contact):
wd = self.app.wd
self.open_add_contact()
# fill up new contact form
wd.find_element_by_name("firstname").click()
wd.find_element_by_name("firstname").clear()
wd.find_element_by_name("firstname").send_keys(add_contact.name)
wd.find_element_by_name("middlename").click()
wd.find_element_by_name("middlename").clear()
wd.find_element_by_name("middlename").send_keys("O")
wd.find_element_by_name("lastname").click()
wd.find_element_by_name("lastname").clear()
wd.find_element_by_name("lastname").send_keys(add_contact.lastname)
wd.find_element_by_name("nickname").click()
wd.find_element_by_name("nickname").clear()
wd.find_element_by_name("nickname").send_keys("Alex")
wd.find_element_by_name("title").click()
wd.find_element_by_name("title").clear()
wd.find_element_by_name("title").send_keys("mr")
wd.find_element_by_name("company").click()
wd.find_element_by_name("company").clear()
wd.find_element_by_name("company").send_keys("GS")
wd.find_element_by_name("address").click()
wd.find_element_by_name("address").clear()
wd.find_element_by_name("address").send_keys(add_contact.address)
wd.find_element_by_name("home").click()
wd.find_element_by_name("home").clear()
wd.find_element_by_name("home").send_keys("98347974824")
wd.find_element_by_name("mobile").click()
wd.find_element_by_name("mobile").clear()
wd.find_element_by_name("mobile").send_keys("3498374328")
wd.find_element_by_name("work").click()
wd.find_element_by_name("work").clear()
wd.find_element_by_name("work").send_keys("23649873289")
wd.find_element_by_name("fax").click()
wd.find_element_by_name("fax").clear()
wd.find_element_by_name("fax").send_keys("3487932874832")
wd.find_element_by_name("email").click()
wd.find_element_by_name("email").clear()
wd.find_element_by_name("email").send_keys("alex@mail.ru")
wd.find_element_by_name("email2").click()
wd.find_element_by_name("email2").clear()
wd.find_element_by_name("email2").send_keys("alex1@mail.ru")
wd.find_element_by_name("email3").click()
wd.find_element_by_name("email3").clear()
wd.find_element_by_name("email3").send_keys("alex3@mail.ru")
wd.find_element_by_name("homepage").click()
wd.find_element_by_name("homepage").clear()
wd.find_element_by_name("homepage").send_keys("alex1.site.com")
wd.find_element_by_name("bday").click()
#Select(wd.find_element_by_name("bday")).select_by_visible_text("15")
#wd.find_element_by_xpath("//option[@value='15']").click()
#wd.find_element_by_name("bmonth").click()
#Select(wd.find_element_by_name("bmonth")).select_by_visible_text("June")
#wd.find_element_by_xpath("//option[@value='June']").click()
#wd.find_element_by_name("byear").click()
#wd.find_element_by_name("byear").clear()
#wd.find_element_by_name("byear").send_keys("1969")
#wd.find_element_by_name("aday").click()
#Select(wd.find_element_by_name("aday")).select_by_visible_text("10")
#wd.find_element_by_xpath("(//option[@value='10'])[2]").click()
#wd.find_element_by_name("amonth").click()
#Select(wd.find_element_by_name("amonth")).select_by_visible_text("November")
#wd.find_element_by_xpath("(//option[@value='November'])[2]").click()
wd.find_element_by_name("ayear").click()
wd.find_element_by_name("ayear").clear()
wd.find_element_by_name("ayear").send_keys("1970")
wd.find_element_by_name("address2").click()
wd.find_element_by_name("address2").clear()
wd.find_element_by_name("address2").send_keys("12 road")
wd.find_element_by_name("notes").click()
wd.find_element_by_name("notes").clear()
wd.find_element_by_name("notes").send_keys("notes 123")
# submit contact creation
wd.find_element_by_xpath("(//input[@name='submit'])[2]").click()
def delete_first_contact(self):
wd = self.app.wd
self.open_home_page()
# select first contact
wd.find_element_by_name("selected[]").click()
# submit deletion
#wd.find_element_by_name("Delete").click()
wd.find_element_by_xpath("//input[@value='Delete']").click()
wd.switch_to_alert().accept()
self.return_to_home_page()
def return_to_home_page(self):
wd = self.app.wd
wd.find_element_by_link_text("groups").click() | class Contacthelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.app.wd
self.app.open_home_page()
def open_add_contact(self):
wd = self.app.wd
wd.find_element_by_link_text('add new').click()
def create_new_contact(self, add_contact):
wd = self.app.wd
self.open_add_contact()
wd.find_element_by_name('firstname').click()
wd.find_element_by_name('firstname').clear()
wd.find_element_by_name('firstname').send_keys(add_contact.name)
wd.find_element_by_name('middlename').click()
wd.find_element_by_name('middlename').clear()
wd.find_element_by_name('middlename').send_keys('O')
wd.find_element_by_name('lastname').click()
wd.find_element_by_name('lastname').clear()
wd.find_element_by_name('lastname').send_keys(add_contact.lastname)
wd.find_element_by_name('nickname').click()
wd.find_element_by_name('nickname').clear()
wd.find_element_by_name('nickname').send_keys('Alex')
wd.find_element_by_name('title').click()
wd.find_element_by_name('title').clear()
wd.find_element_by_name('title').send_keys('mr')
wd.find_element_by_name('company').click()
wd.find_element_by_name('company').clear()
wd.find_element_by_name('company').send_keys('GS')
wd.find_element_by_name('address').click()
wd.find_element_by_name('address').clear()
wd.find_element_by_name('address').send_keys(add_contact.address)
wd.find_element_by_name('home').click()
wd.find_element_by_name('home').clear()
wd.find_element_by_name('home').send_keys('98347974824')
wd.find_element_by_name('mobile').click()
wd.find_element_by_name('mobile').clear()
wd.find_element_by_name('mobile').send_keys('3498374328')
wd.find_element_by_name('work').click()
wd.find_element_by_name('work').clear()
wd.find_element_by_name('work').send_keys('23649873289')
wd.find_element_by_name('fax').click()
wd.find_element_by_name('fax').clear()
wd.find_element_by_name('fax').send_keys('3487932874832')
wd.find_element_by_name('email').click()
wd.find_element_by_name('email').clear()
wd.find_element_by_name('email').send_keys('alex@mail.ru')
wd.find_element_by_name('email2').click()
wd.find_element_by_name('email2').clear()
wd.find_element_by_name('email2').send_keys('alex1@mail.ru')
wd.find_element_by_name('email3').click()
wd.find_element_by_name('email3').clear()
wd.find_element_by_name('email3').send_keys('alex3@mail.ru')
wd.find_element_by_name('homepage').click()
wd.find_element_by_name('homepage').clear()
wd.find_element_by_name('homepage').send_keys('alex1.site.com')
wd.find_element_by_name('bday').click()
wd.find_element_by_name('ayear').click()
wd.find_element_by_name('ayear').clear()
wd.find_element_by_name('ayear').send_keys('1970')
wd.find_element_by_name('address2').click()
wd.find_element_by_name('address2').clear()
wd.find_element_by_name('address2').send_keys('12 road')
wd.find_element_by_name('notes').click()
wd.find_element_by_name('notes').clear()
wd.find_element_by_name('notes').send_keys('notes 123')
wd.find_element_by_xpath("(//input[@name='submit'])[2]").click()
def delete_first_contact(self):
wd = self.app.wd
self.open_home_page()
wd.find_element_by_name('selected[]').click()
wd.find_element_by_xpath("//input[@value='Delete']").click()
wd.switch_to_alert().accept()
self.return_to_home_page()
def return_to_home_page(self):
wd = self.app.wd
wd.find_element_by_link_text('groups').click() |
"""
categories: Types,list
description: List delete with step != 1 not implemented
cause: Unknown
workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
del l[0:4:2]
print(l)
| """
categories: Types,list
description: List delete with step != 1 not implemented
cause: Unknown
workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
del l[0:4:2]
print(l) |
def makeString():
fo = open(r"C:\Users\Owner\Tales-of-Destiny-DC\dictionary\kanji.txt",
"r", encoding="utf8")
Lines = fo.readlines()
for line in Lines:
print(createString(line[0:4], line[6]))
def createString(one, two):
return """ elif(Hex[i] + Hex[i+1] + \" \" + Hex[i+3] + Hex[i+4] == \"""" + one[0:2] + " " + one[2:] + """\"):
List.append(\"""" + two + """\")"""
makeString()
| def make_string():
fo = open('C:\\Users\\Owner\\Tales-of-Destiny-DC\\dictionary\\kanji.txt', 'r', encoding='utf8')
lines = fo.readlines()
for line in Lines:
print(create_string(line[0:4], line[6]))
def create_string(one, two):
return ' elif(Hex[i] + Hex[i+1] + " " + Hex[i+3] + Hex[i+4] == "' + one[0:2] + ' ' + one[2:] + '"):\n List.append("' + two + '")'
make_string() |
# -*- coding: utf-8 -*-
"""
shellstreaming.scheduler.master_sched_firstnode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis: Schedules all jobs to first worker in list (for testing purpose)
"""
def calc_job_placement(job_graph, worker_hosts, prev_jobs_placement):
next_jobs_placement = prev_jobs_placement.copy()
for job_id in job_graph.nodes_iter():
# start not started & finished job
if not prev_jobs_placement.is_started(job_id) and not prev_jobs_placement.is_finished(job_id):
# fixed job
fixed_workers = prev_jobs_placement.fixed_to(job_id)
if fixed_workers is not None:
map(lambda w: next_jobs_placement.assign(job_id, w), fixed_workers)
continue
# normal job
next_jobs_placement.assign(job_id, worker_hosts[0])
return next_jobs_placement
| """
shellstreaming.scheduler.master_sched_firstnode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis: Schedules all jobs to first worker in list (for testing purpose)
"""
def calc_job_placement(job_graph, worker_hosts, prev_jobs_placement):
next_jobs_placement = prev_jobs_placement.copy()
for job_id in job_graph.nodes_iter():
if not prev_jobs_placement.is_started(job_id) and (not prev_jobs_placement.is_finished(job_id)):
fixed_workers = prev_jobs_placement.fixed_to(job_id)
if fixed_workers is not None:
map(lambda w: next_jobs_placement.assign(job_id, w), fixed_workers)
continue
next_jobs_placement.assign(job_id, worker_hosts[0])
return next_jobs_placement |
""" This is helper file to print out strings in different colours
"""
def style(value, styling):
return styling + value + '\033[0m'
def green(value):
return style(value, '\033[92m')
def blue(value):
return style(value, '\033[94m')
def yellow(value):
return style(value, '\033[93m')
def red(value):
return style(value, '\033[91m')
def pink(value):
return style(value, '\033[95m')
def bold(value):
return style(value, '\033[1m')
def underline(value):
return style(value, '\033[4m')
| """ This is helper file to print out strings in different colours
"""
def style(value, styling):
return styling + value + '\x1b[0m'
def green(value):
return style(value, '\x1b[92m')
def blue(value):
return style(value, '\x1b[94m')
def yellow(value):
return style(value, '\x1b[93m')
def red(value):
return style(value, '\x1b[91m')
def pink(value):
return style(value, '\x1b[95m')
def bold(value):
return style(value, '\x1b[1m')
def underline(value):
return style(value, '\x1b[4m') |
#*******************************************************************************
#
# Sentence pattern definitions
#
#*******************************************************************************
sentencePatterns = [
[
'nMass is the driver of nMass.',
'nMass is the nTheXOf of nMass, and of us.',
'You and I are nPersonPlural of the nCosmos.',
'We exist as fixedNP.',
'We viPerson, we viPerson, we are reborn.',
'Nothing is impossible.',
'This life is nothing short of a ing nOf of adj nMass.',
'Consciousness consists of fixedNP of quantum energy. "Quantum" means a ing of the adj.',
'The goal of fixedNP is to plant the seeds of nMass rather than nMassBad.',
'nMass is a constant.',
'By ing, we viPerson.',
'The nCosmos is adjWith fixedNP.',
'To vTraverse the nPath is to become one with it.',
'Today, science tells us that the essence of nature is nMass.',
'nMass requires exploration.'
],
[
'We can no longer afford to live with nMassBad.',
'Without nMass, one cannot viPerson.',
'Only a nPerson of the nCosmos may vtMass this nOf of nMass.',
'You must take a stand against nMassBad.',
'Yes, it is possible to vtDestroy the things that can vtDestroy us, but not without nMass on our side.',
'nMassBad is the antithesis of nMass.',
'You may be ruled by nMassBad without realizing it. Do not let it vtDestroy the nTheXOf of your nPath.',
'The complexity of the present time seems to demand a ing of our nOurPlural if we are going to survive.',
'nMassBad is born in the gap where nMass has been excluded.',
'Where there is nMassBad, nMass cannot thrive.'
],
[
'Soon there will be a ing of nMass the likes of which the nCosmos has never seen.',
'It is time to take nMass to the next level.',
'Imagine a ing of what could be.',
'Eons from now, we nPersonPlural will viPerson like never before as we are ppPerson by the nCosmos.',
'It is a sign of things to come.',
'The future will be a adj ing of nMass.',
'This nPath never ends.',
'We must learn how to lead adj lives in the face of nMassBad.',
'We must vtPerson ourselves and vtPerson others.',
'The nOf of nMass is now happening worldwide.',
'We are being called to explore the nCosmos itself as an interface between nMass and nMass.',
'It is in ing that we are ppPerson.',
'The nCosmos is approaching a tipping point.',
'nameOfGod will vOpenUp adj nMass.'
],
[
'Although you may not realize it, you are adj.',
'nPerson, look within and vtPerson yourself.',
'Have you found your nPath?',
'How should you navigate this adj nCosmos?',
'It can be difficult to know where to begin.',
'If you have never experienced this nOf fixedAdvP, it can be difficult to viPerson.',
'The nCosmos is calling to you via fixedNP. Can you hear it?'
],
[
'Throughout history, humans have been interacting with the nCosmos via fixedNP.',
'Reality has always been adjWith nPersonPlural whose nOurPlural are ppThingPrep nMass.',
'Our conversations with other nPersonPlural have led to a ing of adjPrefix adj consciousness.',
'Humankind has nothing to lose.',
'We are in the midst of a adj ing of nMass that will vOpenUp the nCosmos itself.',
'Who are we? Where on the great nPath will we be ppPerson?',
'We are at a crossroads of nMass and nMassBad.'
],
[
'Through nSubject, our nOurPlural are ppThingPrep nMass.',
'nSubject may be the solution to what\'s holding you back from a adjBig nOf of nMass.',
'You will soon be ppPerson by a power deep within yourself - a power that is adj, adj.',
'As you viPerson, you will enter into infinite nMass that transcends understanding.',
'This is the vision behind our 100% adjProduct, adjProduct nProduct.',
'With our adjProduct nProduct, nBenefits is only the beginning.'
]
]
| sentence_patterns = [['nMass is the driver of nMass.', 'nMass is the nTheXOf of nMass, and of us.', 'You and I are nPersonPlural of the nCosmos.', 'We exist as fixedNP.', 'We viPerson, we viPerson, we are reborn.', 'Nothing is impossible.', 'This life is nothing short of a ing nOf of adj nMass.', 'Consciousness consists of fixedNP of quantum energy. "Quantum" means a ing of the adj.', 'The goal of fixedNP is to plant the seeds of nMass rather than nMassBad.', 'nMass is a constant.', 'By ing, we viPerson.', 'The nCosmos is adjWith fixedNP.', 'To vTraverse the nPath is to become one with it.', 'Today, science tells us that the essence of nature is nMass.', 'nMass requires exploration.'], ['We can no longer afford to live with nMassBad.', 'Without nMass, one cannot viPerson.', 'Only a nPerson of the nCosmos may vtMass this nOf of nMass.', 'You must take a stand against nMassBad.', 'Yes, it is possible to vtDestroy the things that can vtDestroy us, but not without nMass on our side.', 'nMassBad is the antithesis of nMass.', 'You may be ruled by nMassBad without realizing it. Do not let it vtDestroy the nTheXOf of your nPath.', 'The complexity of the present time seems to demand a ing of our nOurPlural if we are going to survive.', 'nMassBad is born in the gap where nMass has been excluded.', 'Where there is nMassBad, nMass cannot thrive.'], ['Soon there will be a ing of nMass the likes of which the nCosmos has never seen.', 'It is time to take nMass to the next level.', 'Imagine a ing of what could be.', 'Eons from now, we nPersonPlural will viPerson like never before as we are ppPerson by the nCosmos.', 'It is a sign of things to come.', 'The future will be a adj ing of nMass.', 'This nPath never ends.', 'We must learn how to lead adj lives in the face of nMassBad.', 'We must vtPerson ourselves and vtPerson others.', 'The nOf of nMass is now happening worldwide.', 'We are being called to explore the nCosmos itself as an interface between nMass and nMass.', 'It is in ing that we are ppPerson.', 'The nCosmos is approaching a tipping point.', 'nameOfGod will vOpenUp adj nMass.'], ['Although you may not realize it, you are adj.', 'nPerson, look within and vtPerson yourself.', 'Have you found your nPath?', 'How should you navigate this adj nCosmos?', 'It can be difficult to know where to begin.', 'If you have never experienced this nOf fixedAdvP, it can be difficult to viPerson.', 'The nCosmos is calling to you via fixedNP. Can you hear it?'], ['Throughout history, humans have been interacting with the nCosmos via fixedNP.', 'Reality has always been adjWith nPersonPlural whose nOurPlural are ppThingPrep nMass.', 'Our conversations with other nPersonPlural have led to a ing of adjPrefix adj consciousness.', 'Humankind has nothing to lose.', 'We are in the midst of a adj ing of nMass that will vOpenUp the nCosmos itself.', 'Who are we? Where on the great nPath will we be ppPerson?', 'We are at a crossroads of nMass and nMassBad.'], ['Through nSubject, our nOurPlural are ppThingPrep nMass.', "nSubject may be the solution to what's holding you back from a adjBig nOf of nMass.", 'You will soon be ppPerson by a power deep within yourself - a power that is adj, adj.', 'As you viPerson, you will enter into infinite nMass that transcends understanding.', 'This is the vision behind our 100% adjProduct, adjProduct nProduct.', 'With our adjProduct nProduct, nBenefits is only the beginning.']] |
'''
URL: https://leetcode.com/problems/count-largest-group/
Difficulty: Easy
Description: Count Largest Group
Given an integer n. Each number from 1 to n is grouped according to the sum of its digits.
Return how many groups have the largest size.
Example 1:
Input: n = 13
Output: 4
Explanation: There are 9 groups in total, they are grouped according sum of its digits of numbers from 1 to 13:
[1,10], [2,11], [3,12], [4,13], [5], [6], [7], [8], [9]. There are 4 groups with largest size.
Example 2:
Input: n = 2
Output: 2
Explanation: There are 2 groups [1], [2] of size 1.
Example 3:
Input: n = 15
Output: 6
Example 4:
Input: n = 24
Output: 5
Constraints:
1 <= n <= 10^4
'''
class Solution:
def sumOfDigits(self, n):
sum = 0
while n > 0:
sum += n % 10
n = n // 10
return sum
def countLargestGroup(self, n):
counts = {}
for i in range(1, n+1):
# sum of the digits of n
sum = self.sumOfDigits(i)
if sum in counts:
counts[sum].append(i)
else:
# if sum is not in dict
# store in format
# key: sum
# value: [ All the elements that sum to that size ]
counts[sum] = [i]
largestGroupSize = -float('inf')
largestGroupCount = 0
for group in counts.values():
size = len(group)
if size > largestGroupSize:
largestGroupSize = size
largestGroupCount = 1
elif size == largestGroupSize:
largestGroupCount += 1
return largestGroupCount
| """
URL: https://leetcode.com/problems/count-largest-group/
Difficulty: Easy
Description: Count Largest Group
Given an integer n. Each number from 1 to n is grouped according to the sum of its digits.
Return how many groups have the largest size.
Example 1:
Input: n = 13
Output: 4
Explanation: There are 9 groups in total, they are grouped according sum of its digits of numbers from 1 to 13:
[1,10], [2,11], [3,12], [4,13], [5], [6], [7], [8], [9]. There are 4 groups with largest size.
Example 2:
Input: n = 2
Output: 2
Explanation: There are 2 groups [1], [2] of size 1.
Example 3:
Input: n = 15
Output: 6
Example 4:
Input: n = 24
Output: 5
Constraints:
1 <= n <= 10^4
"""
class Solution:
def sum_of_digits(self, n):
sum = 0
while n > 0:
sum += n % 10
n = n // 10
return sum
def count_largest_group(self, n):
counts = {}
for i in range(1, n + 1):
sum = self.sumOfDigits(i)
if sum in counts:
counts[sum].append(i)
else:
counts[sum] = [i]
largest_group_size = -float('inf')
largest_group_count = 0
for group in counts.values():
size = len(group)
if size > largestGroupSize:
largest_group_size = size
largest_group_count = 1
elif size == largestGroupSize:
largest_group_count += 1
return largestGroupCount |
def BuscarCaja(p,q):
global L
mitad=(p+q)//2
if q==p+1 or q==p:
if L[p]==1: return p
else: return q
elif 1 in L[mitad:q+1]:
return BuscarCaja(mitad,q)
else:
return BuscarCaja(p,mitad-1)
L=[0,0,0,0,1,0]
print("Indice: "+str(BuscarCaja(0,len(L)-1)))
L=[0,1,0,0,0,0,0,0,0]
print("Indice: "+str(BuscarCaja(0,len(L)-1)))
| def buscar_caja(p, q):
global L
mitad = (p + q) // 2
if q == p + 1 or q == p:
if L[p] == 1:
return p
else:
return q
elif 1 in L[mitad:q + 1]:
return buscar_caja(mitad, q)
else:
return buscar_caja(p, mitad - 1)
l = [0, 0, 0, 0, 1, 0]
print('Indice: ' + str(buscar_caja(0, len(L) - 1)))
l = [0, 1, 0, 0, 0, 0, 0, 0, 0]
print('Indice: ' + str(buscar_caja(0, len(L) - 1))) |
# 32. Longest Valid Parentheses
# ttungl@gmail.com
# Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
# For "(()", the longest valid parentheses substring is "()", which has length = 2.
# Another example is ")()())", where the longest valid parentheses substring is "()()", which has length = 4.
class Solution(object):
def longestValidParentheses(self, s):
"""
:type s: str
:rtype: int
"""
# sol 1:
# using stack
# runtime: 65ms
res, lst, stack = 0, -1, []
for i in range(len(s)):
if s[i] == '(':
if lst >= 0: # last time matching ")".
stack.append(lst)
lst = -1
else: # at first or last index, not matching ")"
stack.append(i)
else: # ")"
if stack:
stk = stack.pop()
if i - stk + 1 > res:
res = i - stk + 1
lst = stk
else:
lst = -1 # unmatched ")".
return res
# sol 2
# DP-1
# runtime: 66ms
dp = [0] * len(s)
res = lcount = 0
for i in range(len(s)):
if s[i] == '(':
lcount += 1 # left count
elif lcount > 0:
dp[i] = dp[i - 1] + 2 # pair
dp[i] += (dp[i - dp[i]] if i >= dp[i] else 0)
res = max(res, dp[i])
lcount -= 1
return res
| class Solution(object):
def longest_valid_parentheses(self, s):
"""
:type s: str
:rtype: int
"""
(res, lst, stack) = (0, -1, [])
for i in range(len(s)):
if s[i] == '(':
if lst >= 0:
stack.append(lst)
lst = -1
else:
stack.append(i)
elif stack:
stk = stack.pop()
if i - stk + 1 > res:
res = i - stk + 1
lst = stk
else:
lst = -1
return res
dp = [0] * len(s)
res = lcount = 0
for i in range(len(s)):
if s[i] == '(':
lcount += 1
elif lcount > 0:
dp[i] = dp[i - 1] + 2
dp[i] += dp[i - dp[i]] if i >= dp[i] else 0
res = max(res, dp[i])
lcount -= 1
return res |
class TimeoutError(Exception):
"""Error raised when .result() on a future doesn't return within time."""
class EventLoopNotInitialized(Exception):
"""Event loop not initialized."""
class RequestBodyNotBytes(Exception):
"""Request body must be bytes."""
| class Timeouterror(Exception):
"""Error raised when .result() on a future doesn't return within time."""
class Eventloopnotinitialized(Exception):
"""Event loop not initialized."""
class Requestbodynotbytes(Exception):
"""Request body must be bytes.""" |
#!/usr/bin/env python3
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if(len(nums) == 1):
if(target > nums[0]):
return 1
elif(target < nums[0]):
return 0
else:
return 0
# Split the array in half
halfLength = len(nums)//2
arrOne = nums[0:halfLength]
arrTwo = nums[halfLength:]
print("Target = {}".format(target))
print("Orig = {}".format(nums))
print("Array one = {}".format(arrOne))
print("Array two = {}".format(arrTwo))
first = self.searchInsert(arrOne, target)
second = self.searchInsert(arrTwo, target)
result = first + second
return result
def test(self):
arr = [1,2,3,4]
target = 5
k = self.searchInsert(arr, target)
print(k)
arr = [1,3,5,7,9]
target = 2
k = self.searchInsert(arr, target)
print(k)
arr = [1,4,9,16,25,36]
target = 10
k = self.searchInsert(arr, target)
print(k)
s = Solution()
s.test()
| class Solution(object):
def search_insert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if len(nums) == 1:
if target > nums[0]:
return 1
elif target < nums[0]:
return 0
else:
return 0
half_length = len(nums) // 2
arr_one = nums[0:halfLength]
arr_two = nums[halfLength:]
print('Target = {}'.format(target))
print('Orig = {}'.format(nums))
print('Array one = {}'.format(arrOne))
print('Array two = {}'.format(arrTwo))
first = self.searchInsert(arrOne, target)
second = self.searchInsert(arrTwo, target)
result = first + second
return result
def test(self):
arr = [1, 2, 3, 4]
target = 5
k = self.searchInsert(arr, target)
print(k)
arr = [1, 3, 5, 7, 9]
target = 2
k = self.searchInsert(arr, target)
print(k)
arr = [1, 4, 9, 16, 25, 36]
target = 10
k = self.searchInsert(arr, target)
print(k)
s = solution()
s.test() |
"""
Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
vm_basic_info = {
'MachineId':'',
'MachineName':'',
'PrimaryIPAddress':'',
'PublicIPAddress':'',
'IpAddressListSemiColonDelimited':'',
'TotalDiskAllocatedGiB':0,
'TotalDiskUsedGiB':0,
'MachineTypeLabel':'',
'AllocatedProcessorCoreCount':0,
'MemoryGiB':0,
'HostingLocation':'',
'OsType':'',
'OsPublisher':'',
'OsName':'',
'OsVersion':'',
'MachineStatus':'',
'ProvisioningState':'',
'CreateDate':'',
'IsPhysical':0,
'Source':'AWS'
}
vm_tag = {
'MachineId':'',
'Key':'',
'Value':''
}
vm_disk = {
'MachineId':'',
'DiskLabel':'',
'SizeInGib':'',
'UsedInGib':'',
'StorageTypeLabel':''
}
vm_perf = {
'MachineId':'',
'TimeStamp':'',
'CpuUtilizationPercentage':'',
'AvailableMemoryBytes':'',
'DiskReadOperationsPerSec':'',
'DiskWriteOperationsPerSec':'',
'NetworkBytesPerSecSent':'',
'NetworkBytesPerSecReceived':''
} | """
Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
vm_basic_info = {'MachineId': '', 'MachineName': '', 'PrimaryIPAddress': '', 'PublicIPAddress': '', 'IpAddressListSemiColonDelimited': '', 'TotalDiskAllocatedGiB': 0, 'TotalDiskUsedGiB': 0, 'MachineTypeLabel': '', 'AllocatedProcessorCoreCount': 0, 'MemoryGiB': 0, 'HostingLocation': '', 'OsType': '', 'OsPublisher': '', 'OsName': '', 'OsVersion': '', 'MachineStatus': '', 'ProvisioningState': '', 'CreateDate': '', 'IsPhysical': 0, 'Source': 'AWS'}
vm_tag = {'MachineId': '', 'Key': '', 'Value': ''}
vm_disk = {'MachineId': '', 'DiskLabel': '', 'SizeInGib': '', 'UsedInGib': '', 'StorageTypeLabel': ''}
vm_perf = {'MachineId': '', 'TimeStamp': '', 'CpuUtilizationPercentage': '', 'AvailableMemoryBytes': '', 'DiskReadOperationsPerSec': '', 'DiskWriteOperationsPerSec': '', 'NetworkBytesPerSecSent': '', 'NetworkBytesPerSecReceived': ''} |
def main(request, response):
cookie = request.cookies.first(b"COOKIE_NAME", None)
response_headers = [(b"Content-Type", b"text/javascript"),
(b"Access-Control-Allow-Credentials", b"true")]
origin = request.headers.get(b"Origin", None)
if origin:
response_headers.append((b"Access-Control-Allow-Origin", origin))
cookie_value = b'';
if cookie:
cookie_value = cookie.value;
return (200, response_headers,
b"export const cookie = '"+cookie_value+b"';")
| def main(request, response):
cookie = request.cookies.first(b'COOKIE_NAME', None)
response_headers = [(b'Content-Type', b'text/javascript'), (b'Access-Control-Allow-Credentials', b'true')]
origin = request.headers.get(b'Origin', None)
if origin:
response_headers.append((b'Access-Control-Allow-Origin', origin))
cookie_value = b''
if cookie:
cookie_value = cookie.value
return (200, response_headers, b"export const cookie = '" + cookie_value + b"';") |
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_c_float_v_floatarray.tif test_spline_c_float_v_floatarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_c_float_u_floatarray.tif test_spline_c_float_u_floatarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_c_float_c_floatarray.tif test_spline_c_float_c_floatarray")
outputs.append ("spline_c_float_v_floatarray.tif")
outputs.append ("spline_c_float_u_floatarray.tif")
outputs.append ("spline_c_float_c_floatarray.tif")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_u_float_v_floatarray.tif test_spline_u_float_v_floatarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_u_float_u_floatarray.tif test_spline_u_float_u_floatarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_u_float_c_floatarray.tif test_spline_u_float_c_floatarray")
outputs.append ("spline_u_float_v_floatarray.tif")
outputs.append ("spline_u_float_u_floatarray.tif")
outputs.append ("spline_u_float_c_floatarray.tif")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_v_float_v_floatarray.tif test_spline_v_float_v_floatarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_v_float_u_floatarray.tif test_spline_v_float_u_floatarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Fout spline_v_float_c_floatarray.tif test_spline_v_float_c_floatarray")
outputs.append ("spline_v_float_v_floatarray.tif")
outputs.append ("spline_v_float_u_floatarray.tif")
outputs.append ("spline_v_float_c_floatarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_c_float_v_floatarray.tif test_deriv_spline_c_float_v_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_c_float_u_floatarray.tif test_deriv_spline_c_float_u_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_c_float_c_floatarray.tif test_deriv_spline_c_float_c_floatarray")
outputs.append ("deriv_spline_c_float_v_floatarray.tif")
outputs.append ("deriv_spline_c_float_u_floatarray.tif")
outputs.append ("deriv_spline_c_float_c_floatarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_u_float_v_floatarray.tif test_deriv_spline_u_float_v_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_u_float_u_floatarray.tif test_deriv_spline_u_float_u_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_u_float_c_floatarray.tif test_deriv_spline_u_float_c_floatarray")
outputs.append ("deriv_spline_u_float_v_floatarray.tif")
outputs.append ("deriv_spline_u_float_u_floatarray.tif")
outputs.append ("deriv_spline_u_float_c_floatarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_v_float_v_floatarray.tif test_deriv_spline_v_float_v_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_v_float_u_floatarray.tif test_deriv_spline_v_float_u_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_v_float_c_floatarray.tif test_deriv_spline_v_float_c_floatarray")
outputs.append ("deriv_spline_v_float_v_floatarray.tif")
outputs.append ("deriv_spline_v_float_u_floatarray.tif")
outputs.append ("deriv_spline_v_float_c_floatarray.tif")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_c_float_v_colorarray.tif test_spline_c_float_v_colorarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_c_float_u_colorarray.tif test_spline_c_float_u_colorarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_c_float_c_colorarray.tif test_spline_c_float_c_colorarray")
outputs.append ("spline_c_float_v_colorarray.tif")
outputs.append ("spline_c_float_u_colorarray.tif")
outputs.append ("spline_c_float_c_colorarray.tif")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_u_float_v_colorarray.tif test_spline_u_float_v_colorarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_u_float_u_colorarray.tif test_spline_u_float_u_colorarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_u_float_c_colorarray.tif test_spline_u_float_c_colorarray")
outputs.append ("spline_u_float_v_colorarray.tif")
outputs.append ("spline_u_float_u_colorarray.tif")
outputs.append ("spline_u_float_c_colorarray.tif")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_v_float_v_colorarray.tif test_spline_v_float_v_colorarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_v_float_u_colorarray.tif test_spline_v_float_u_colorarray")
command += testshade("-t 1 -g 64 64 -od uint8 -o Cout spline_v_float_c_colorarray.tif test_spline_v_float_c_colorarray")
outputs.append ("spline_v_float_v_colorarray.tif")
outputs.append ("spline_v_float_u_colorarray.tif")
outputs.append ("spline_v_float_c_colorarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_v_colorarray.tif -o DxOut deriv_spline_c_float_v_colorarrayDx.tif -o DyOut deriv_spline_c_float_v_colorarrayDy.tif test_deriv_spline_c_float_v_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_u_colorarray.tif -o DxOut deriv_spline_c_float_u_colorarrayDx.tif -o DyOut deriv_spline_c_float_u_colorarrayDy.tif test_deriv_spline_c_float_u_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_c_colorarray.tif -o DxOut deriv_spline_c_float_c_colorarrayDx.tif -o DyOut deriv_spline_c_float_c_colorarrayDy.tif test_deriv_spline_c_float_c_colorarray")
outputs.append ("deriv_spline_c_float_v_colorarray.tif")
outputs.append ("deriv_spline_c_float_v_colorarrayDx.tif")
outputs.append ("deriv_spline_c_float_v_colorarrayDy.tif")
outputs.append ("deriv_spline_c_float_u_colorarray.tif")
outputs.append ("deriv_spline_c_float_u_colorarrayDx.tif")
outputs.append ("deriv_spline_c_float_u_colorarrayDy.tif")
outputs.append ("deriv_spline_c_float_c_colorarray.tif")
outputs.append ("deriv_spline_c_float_c_colorarrayDx.tif")
outputs.append ("deriv_spline_c_float_c_colorarrayDy.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_v_colorarray.tif -o DxOut deriv_spline_u_float_v_colorarrayDx.tif -o DyOut deriv_spline_u_float_v_colorarrayDy.tif test_deriv_spline_u_float_v_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_u_colorarray.tif -o DxOut deriv_spline_u_float_u_colorarrayDx.tif -o DyOut deriv_spline_u_float_u_colorarrayDy.tif test_deriv_spline_u_float_u_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_c_colorarray.tif -o DxOut deriv_spline_u_float_c_colorarrayDx.tif -o DyOut deriv_spline_u_float_c_colorarrayDy.tif test_deriv_spline_u_float_c_colorarray")
outputs.append ("deriv_spline_u_float_v_colorarray.tif")
outputs.append ("deriv_spline_u_float_v_colorarrayDx.tif")
outputs.append ("deriv_spline_u_float_v_colorarrayDy.tif")
outputs.append ("deriv_spline_u_float_u_colorarray.tif")
outputs.append ("deriv_spline_u_float_u_colorarrayDx.tif")
outputs.append ("deriv_spline_u_float_u_colorarrayDy.tif")
outputs.append ("deriv_spline_u_float_c_colorarray.tif")
outputs.append ("deriv_spline_u_float_c_colorarrayDx.tif")
outputs.append ("deriv_spline_u_float_c_colorarrayDy.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_v_colorarray.tif -o DxOut deriv_spline_v_float_v_colorarrayDx.tif -o DyOut deriv_spline_v_float_v_colorarrayDy.tif test_deriv_spline_v_float_v_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_u_colorarray.tif -o DxOut deriv_spline_v_float_u_colorarrayDx.tif -o DyOut deriv_spline_v_float_u_colorarrayDy.tif test_deriv_spline_v_float_u_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_c_colorarray.tif -o DxOut deriv_spline_v_float_c_colorarrayDx.tif -o DyOut deriv_spline_v_float_c_colorarrayDy.tif test_deriv_spline_v_float_c_colorarray")
outputs.append ("deriv_spline_v_float_v_colorarray.tif")
outputs.append ("deriv_spline_v_float_v_colorarrayDx.tif")
outputs.append ("deriv_spline_v_float_v_colorarrayDy.tif")
outputs.append ("deriv_spline_v_float_u_colorarray.tif")
outputs.append ("deriv_spline_v_float_u_colorarrayDx.tif")
outputs.append ("deriv_spline_v_float_u_colorarrayDy.tif")
outputs.append ("deriv_spline_v_float_c_colorarray.tif")
outputs.append ("deriv_spline_v_float_c_colorarrayDx.tif")
outputs.append ("deriv_spline_v_float_c_colorarrayDy.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_vNoDeriv_float_v_colorarray.tif -o DxOut deriv_spline_vNoDeriv_float_v_colorarrayDx.tif -o DyOut deriv_spline_vNoDeriv_float_v_colorarrayDy.tif test_deriv_spline_vNoDeriv_float_v_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_vNoDeriv_float_u_colorarray.tif -o DxOut deriv_spline_vNoDeriv_float_u_colorarrayDx.tif -o DyOut deriv_spline_vNoDeriv_float_u_colorarrayDy.tif test_deriv_spline_vNoDeriv_float_u_colorarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_vNoDeriv_float_c_colorarray.tif -o DxOut deriv_spline_vNoDeriv_float_c_colorarrayDx.tif -o DyOut deriv_spline_vNoDeriv_float_c_colorarrayDy.tif test_deriv_spline_vNoDeriv_float_c_colorarray")
outputs.append ("deriv_spline_vNoDeriv_float_v_colorarray.tif")
outputs.append ("deriv_spline_vNoDeriv_float_v_colorarrayDx.tif")
outputs.append ("deriv_spline_vNoDeriv_float_v_colorarrayDy.tif")
outputs.append ("deriv_spline_vNoDeriv_float_u_colorarray.tif")
outputs.append ("deriv_spline_vNoDeriv_float_u_colorarrayDx.tif")
outputs.append ("deriv_spline_vNoDeriv_float_u_colorarrayDy.tif")
outputs.append ("deriv_spline_vNoDeriv_float_c_colorarray.tif")
outputs.append ("deriv_spline_vNoDeriv_float_c_colorarrayDx.tif")
outputs.append ("deriv_spline_vNoDeriv_float_c_colorarrayDy.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_vNoDeriv_colorarray.tif -o DxOut deriv_spline_v_float_vNoDeriv_colorarrayDx.tif -o DyOut deriv_spline_v_float_vNoDeriv_colorarrayDy.tif test_deriv_spline_v_float_vNoDeriv_colorarray")
outputs.append ("deriv_spline_v_float_vNoDeriv_colorarray.tif")
outputs.append ("deriv_spline_v_float_vNoDeriv_colorarrayDx.tif")
outputs.append ("deriv_spline_v_float_vNoDeriv_colorarrayDy.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_vNoDeriv_colorarray.tif -o DxOut deriv_spline_u_float_vNoDeriv_colorarrayDx.tif -o DyOut deriv_spline_u_float_vNoDeriv_colorarrayDy.tif test_deriv_spline_u_float_vNoDeriv_colorarray")
outputs.append ("deriv_spline_u_float_vNoDeriv_colorarray.tif")
outputs.append ("deriv_spline_u_float_vNoDeriv_colorarrayDx.tif")
outputs.append ("deriv_spline_u_float_vNoDeriv_colorarrayDy.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_vNoDeriv_colorarray.tif -o DxOut deriv_spline_c_float_vNoDeriv_colorarrayDx.tif -o DyOut deriv_spline_c_float_vNoDeriv_colorarrayDy.tif test_deriv_spline_c_float_vNoDeriv_colorarray")
outputs.append ("deriv_spline_c_float_vNoDeriv_colorarray.tif")
outputs.append ("deriv_spline_c_float_vNoDeriv_colorarrayDx.tif")
outputs.append ("deriv_spline_c_float_vNoDeriv_colorarrayDy.tif")
# expect a few LSB failures
failthresh = 0.008
failpercent = 3
| command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_c_float_v_floatarray.tif test_spline_c_float_v_floatarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_c_float_u_floatarray.tif test_spline_c_float_u_floatarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_c_float_c_floatarray.tif test_spline_c_float_c_floatarray')
outputs.append('spline_c_float_v_floatarray.tif')
outputs.append('spline_c_float_u_floatarray.tif')
outputs.append('spline_c_float_c_floatarray.tif')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_u_float_v_floatarray.tif test_spline_u_float_v_floatarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_u_float_u_floatarray.tif test_spline_u_float_u_floatarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_u_float_c_floatarray.tif test_spline_u_float_c_floatarray')
outputs.append('spline_u_float_v_floatarray.tif')
outputs.append('spline_u_float_u_floatarray.tif')
outputs.append('spline_u_float_c_floatarray.tif')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_v_float_v_floatarray.tif test_spline_v_float_v_floatarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_v_float_u_floatarray.tif test_spline_v_float_u_floatarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Fout spline_v_float_c_floatarray.tif test_spline_v_float_c_floatarray')
outputs.append('spline_v_float_v_floatarray.tif')
outputs.append('spline_v_float_u_floatarray.tif')
outputs.append('spline_v_float_c_floatarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_c_float_v_floatarray.tif test_deriv_spline_c_float_v_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_c_float_u_floatarray.tif test_deriv_spline_c_float_u_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_c_float_c_floatarray.tif test_deriv_spline_c_float_c_floatarray')
outputs.append('deriv_spline_c_float_v_floatarray.tif')
outputs.append('deriv_spline_c_float_u_floatarray.tif')
outputs.append('deriv_spline_c_float_c_floatarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_u_float_v_floatarray.tif test_deriv_spline_u_float_v_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_u_float_u_floatarray.tif test_deriv_spline_u_float_u_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_u_float_c_floatarray.tif test_deriv_spline_u_float_c_floatarray')
outputs.append('deriv_spline_u_float_v_floatarray.tif')
outputs.append('deriv_spline_u_float_u_floatarray.tif')
outputs.append('deriv_spline_u_float_c_floatarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_v_float_v_floatarray.tif test_deriv_spline_v_float_v_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_v_float_u_floatarray.tif test_deriv_spline_v_float_u_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValDxDyOut deriv_spline_v_float_c_floatarray.tif test_deriv_spline_v_float_c_floatarray')
outputs.append('deriv_spline_v_float_v_floatarray.tif')
outputs.append('deriv_spline_v_float_u_floatarray.tif')
outputs.append('deriv_spline_v_float_c_floatarray.tif')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_c_float_v_colorarray.tif test_spline_c_float_v_colorarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_c_float_u_colorarray.tif test_spline_c_float_u_colorarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_c_float_c_colorarray.tif test_spline_c_float_c_colorarray')
outputs.append('spline_c_float_v_colorarray.tif')
outputs.append('spline_c_float_u_colorarray.tif')
outputs.append('spline_c_float_c_colorarray.tif')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_u_float_v_colorarray.tif test_spline_u_float_v_colorarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_u_float_u_colorarray.tif test_spline_u_float_u_colorarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_u_float_c_colorarray.tif test_spline_u_float_c_colorarray')
outputs.append('spline_u_float_v_colorarray.tif')
outputs.append('spline_u_float_u_colorarray.tif')
outputs.append('spline_u_float_c_colorarray.tif')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_v_float_v_colorarray.tif test_spline_v_float_v_colorarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_v_float_u_colorarray.tif test_spline_v_float_u_colorarray')
command += testshade('-t 1 -g 64 64 -od uint8 -o Cout spline_v_float_c_colorarray.tif test_spline_v_float_c_colorarray')
outputs.append('spline_v_float_v_colorarray.tif')
outputs.append('spline_v_float_u_colorarray.tif')
outputs.append('spline_v_float_c_colorarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_v_colorarray.tif -o DxOut deriv_spline_c_float_v_colorarrayDx.tif -o DyOut deriv_spline_c_float_v_colorarrayDy.tif test_deriv_spline_c_float_v_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_u_colorarray.tif -o DxOut deriv_spline_c_float_u_colorarrayDx.tif -o DyOut deriv_spline_c_float_u_colorarrayDy.tif test_deriv_spline_c_float_u_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_c_colorarray.tif -o DxOut deriv_spline_c_float_c_colorarrayDx.tif -o DyOut deriv_spline_c_float_c_colorarrayDy.tif test_deriv_spline_c_float_c_colorarray')
outputs.append('deriv_spline_c_float_v_colorarray.tif')
outputs.append('deriv_spline_c_float_v_colorarrayDx.tif')
outputs.append('deriv_spline_c_float_v_colorarrayDy.tif')
outputs.append('deriv_spline_c_float_u_colorarray.tif')
outputs.append('deriv_spline_c_float_u_colorarrayDx.tif')
outputs.append('deriv_spline_c_float_u_colorarrayDy.tif')
outputs.append('deriv_spline_c_float_c_colorarray.tif')
outputs.append('deriv_spline_c_float_c_colorarrayDx.tif')
outputs.append('deriv_spline_c_float_c_colorarrayDy.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_v_colorarray.tif -o DxOut deriv_spline_u_float_v_colorarrayDx.tif -o DyOut deriv_spline_u_float_v_colorarrayDy.tif test_deriv_spline_u_float_v_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_u_colorarray.tif -o DxOut deriv_spline_u_float_u_colorarrayDx.tif -o DyOut deriv_spline_u_float_u_colorarrayDy.tif test_deriv_spline_u_float_u_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_c_colorarray.tif -o DxOut deriv_spline_u_float_c_colorarrayDx.tif -o DyOut deriv_spline_u_float_c_colorarrayDy.tif test_deriv_spline_u_float_c_colorarray')
outputs.append('deriv_spline_u_float_v_colorarray.tif')
outputs.append('deriv_spline_u_float_v_colorarrayDx.tif')
outputs.append('deriv_spline_u_float_v_colorarrayDy.tif')
outputs.append('deriv_spline_u_float_u_colorarray.tif')
outputs.append('deriv_spline_u_float_u_colorarrayDx.tif')
outputs.append('deriv_spline_u_float_u_colorarrayDy.tif')
outputs.append('deriv_spline_u_float_c_colorarray.tif')
outputs.append('deriv_spline_u_float_c_colorarrayDx.tif')
outputs.append('deriv_spline_u_float_c_colorarrayDy.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_v_colorarray.tif -o DxOut deriv_spline_v_float_v_colorarrayDx.tif -o DyOut deriv_spline_v_float_v_colorarrayDy.tif test_deriv_spline_v_float_v_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_u_colorarray.tif -o DxOut deriv_spline_v_float_u_colorarrayDx.tif -o DyOut deriv_spline_v_float_u_colorarrayDy.tif test_deriv_spline_v_float_u_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_c_colorarray.tif -o DxOut deriv_spline_v_float_c_colorarrayDx.tif -o DyOut deriv_spline_v_float_c_colorarrayDy.tif test_deriv_spline_v_float_c_colorarray')
outputs.append('deriv_spline_v_float_v_colorarray.tif')
outputs.append('deriv_spline_v_float_v_colorarrayDx.tif')
outputs.append('deriv_spline_v_float_v_colorarrayDy.tif')
outputs.append('deriv_spline_v_float_u_colorarray.tif')
outputs.append('deriv_spline_v_float_u_colorarrayDx.tif')
outputs.append('deriv_spline_v_float_u_colorarrayDy.tif')
outputs.append('deriv_spline_v_float_c_colorarray.tif')
outputs.append('deriv_spline_v_float_c_colorarrayDx.tif')
outputs.append('deriv_spline_v_float_c_colorarrayDy.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_vNoDeriv_float_v_colorarray.tif -o DxOut deriv_spline_vNoDeriv_float_v_colorarrayDx.tif -o DyOut deriv_spline_vNoDeriv_float_v_colorarrayDy.tif test_deriv_spline_vNoDeriv_float_v_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_vNoDeriv_float_u_colorarray.tif -o DxOut deriv_spline_vNoDeriv_float_u_colorarrayDx.tif -o DyOut deriv_spline_vNoDeriv_float_u_colorarrayDy.tif test_deriv_spline_vNoDeriv_float_u_colorarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_vNoDeriv_float_c_colorarray.tif -o DxOut deriv_spline_vNoDeriv_float_c_colorarrayDx.tif -o DyOut deriv_spline_vNoDeriv_float_c_colorarrayDy.tif test_deriv_spline_vNoDeriv_float_c_colorarray')
outputs.append('deriv_spline_vNoDeriv_float_v_colorarray.tif')
outputs.append('deriv_spline_vNoDeriv_float_v_colorarrayDx.tif')
outputs.append('deriv_spline_vNoDeriv_float_v_colorarrayDy.tif')
outputs.append('deriv_spline_vNoDeriv_float_u_colorarray.tif')
outputs.append('deriv_spline_vNoDeriv_float_u_colorarrayDx.tif')
outputs.append('deriv_spline_vNoDeriv_float_u_colorarrayDy.tif')
outputs.append('deriv_spline_vNoDeriv_float_c_colorarray.tif')
outputs.append('deriv_spline_vNoDeriv_float_c_colorarrayDx.tif')
outputs.append('deriv_spline_vNoDeriv_float_c_colorarrayDy.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_v_float_vNoDeriv_colorarray.tif -o DxOut deriv_spline_v_float_vNoDeriv_colorarrayDx.tif -o DyOut deriv_spline_v_float_vNoDeriv_colorarrayDy.tif test_deriv_spline_v_float_vNoDeriv_colorarray')
outputs.append('deriv_spline_v_float_vNoDeriv_colorarray.tif')
outputs.append('deriv_spline_v_float_vNoDeriv_colorarrayDx.tif')
outputs.append('deriv_spline_v_float_vNoDeriv_colorarrayDy.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_u_float_vNoDeriv_colorarray.tif -o DxOut deriv_spline_u_float_vNoDeriv_colorarrayDx.tif -o DyOut deriv_spline_u_float_vNoDeriv_colorarrayDy.tif test_deriv_spline_u_float_vNoDeriv_colorarray')
outputs.append('deriv_spline_u_float_vNoDeriv_colorarray.tif')
outputs.append('deriv_spline_u_float_vNoDeriv_colorarrayDx.tif')
outputs.append('deriv_spline_u_float_vNoDeriv_colorarrayDy.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 -od uint8 -o ValOut deriv_spline_c_float_vNoDeriv_colorarray.tif -o DxOut deriv_spline_c_float_vNoDeriv_colorarrayDx.tif -o DyOut deriv_spline_c_float_vNoDeriv_colorarrayDy.tif test_deriv_spline_c_float_vNoDeriv_colorarray')
outputs.append('deriv_spline_c_float_vNoDeriv_colorarray.tif')
outputs.append('deriv_spline_c_float_vNoDeriv_colorarrayDx.tif')
outputs.append('deriv_spline_c_float_vNoDeriv_colorarrayDy.tif')
failthresh = 0.008
failpercent = 3 |
# coding: utf-8
n, r, avg = [int(i) for i in input().split()]
li = []
for i in range(n):
tmp = [int(i) for i in input().split()]
li.append([tmp[1],tmp[0]])
li.sort(reverse=True)
dis = avg*n-sum([i[1] for i in li])
ans = 0
while dis > 0:
exam = li.pop()
if dis <= r-exam[1]:
ans += exam[0]*dis
dis = 0
else:
ans += exam[0]*(r-exam[1])
dis -= r-exam[1]
print(ans)
| (n, r, avg) = [int(i) for i in input().split()]
li = []
for i in range(n):
tmp = [int(i) for i in input().split()]
li.append([tmp[1], tmp[0]])
li.sort(reverse=True)
dis = avg * n - sum([i[1] for i in li])
ans = 0
while dis > 0:
exam = li.pop()
if dis <= r - exam[1]:
ans += exam[0] * dis
dis = 0
else:
ans += exam[0] * (r - exam[1])
dis -= r - exam[1]
print(ans) |
#elif basic
a = 10
if(a < 1):
print('benar')
elif(a > 1):
print('salah')
elif(a == 1):
print('input salah')
else:
print('input salah')
| a = 10
if a < 1:
print('benar')
elif a > 1:
print('salah')
elif a == 1:
print('input salah')
else:
print('input salah') |
class Solution:
def createTargetArray(self, nums, index):
target = []
for n, i in zip(nums, index):
target.insert(i, n)
return target
| class Solution:
def create_target_array(self, nums, index):
target = []
for (n, i) in zip(nums, index):
target.insert(i, n)
return target |
"""
2. Add Two Numbers
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
"""
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
carry = 0
cur = dummy = ListNode(0)
while l1 or l2 or carry:
if l1:
carry += l1.val
l1 = l1.next
if l2:
carry += l2.val
l2 = l2.next
cur.next = ListNode(carry%10)
carry = carry // 10
cur = cur.next
return dummy.next | """
2. Add Two Numbers
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
"""
class Solution:
def add_two_numbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
carry = 0
cur = dummy = list_node(0)
while l1 or l2 or carry:
if l1:
carry += l1.val
l1 = l1.next
if l2:
carry += l2.val
l2 = l2.next
cur.next = list_node(carry % 10)
carry = carry // 10
cur = cur.next
return dummy.next |
cmd = []
with open('input.txt', 'r') as f:
cmd = list(map(lambda l: l.strip().split(' '), f.readlines()))
horizon_pos = 0
deep = 0
aim = 0
for c in cmd:
if c[0] == 'forward':
val = int(c[1])
horizon_pos += val
deep += aim * val
elif c[0] == 'down':
aim += int(c[1])
elif c[0] == 'up':
aim -= int(c[1])
print(horizon_pos*deep) | cmd = []
with open('input.txt', 'r') as f:
cmd = list(map(lambda l: l.strip().split(' '), f.readlines()))
horizon_pos = 0
deep = 0
aim = 0
for c in cmd:
if c[0] == 'forward':
val = int(c[1])
horizon_pos += val
deep += aim * val
elif c[0] == 'down':
aim += int(c[1])
elif c[0] == 'up':
aim -= int(c[1])
print(horizon_pos * deep) |
class ChildObject:
def __init__(self, sumo_client, meta_data):
self.sumo = sumo_client
self.__blob = None
self.__png = None
source = meta_data["_source"]
fields = meta_data["fields"]
self.tag_name = fields["tag_name"][0]
self.sumo_id = meta_data["_id"]
self.name = source["data"]["name"]
self.iteration_id = source["fmu"]["iteration"]["id"]
self.relative_path = source["file"]["relative_path"]
self.meta_data = source
self.object_type = source["class"]
if "realization" in source["fmu"]:
self.realization_id = source["fmu"]["realization"]["id"]
else:
self.realization_id = None
if "aggregation" in source["fmu"]:
self.aggregation = source["fmu"]["aggregation"]["operation"]
else:
self.aggregation = None
@property
def blob(self):
if self.__blob is None:
self.__blob = self.__get_blob()
return self.__blob
def __get_blob(self):
blob = self.sumo.get(f"/objects('{self.sumo_id}')/blob")
return blob
@property
def png(self):
if self.__png is None:
self.__png = self.__get_png()
return self.__png
def __get_png(self):
png = self.sumo.get(f"/objects('{self.sumo_id}')/blob", encoder="png")
return png | class Childobject:
def __init__(self, sumo_client, meta_data):
self.sumo = sumo_client
self.__blob = None
self.__png = None
source = meta_data['_source']
fields = meta_data['fields']
self.tag_name = fields['tag_name'][0]
self.sumo_id = meta_data['_id']
self.name = source['data']['name']
self.iteration_id = source['fmu']['iteration']['id']
self.relative_path = source['file']['relative_path']
self.meta_data = source
self.object_type = source['class']
if 'realization' in source['fmu']:
self.realization_id = source['fmu']['realization']['id']
else:
self.realization_id = None
if 'aggregation' in source['fmu']:
self.aggregation = source['fmu']['aggregation']['operation']
else:
self.aggregation = None
@property
def blob(self):
if self.__blob is None:
self.__blob = self.__get_blob()
return self.__blob
def __get_blob(self):
blob = self.sumo.get(f"/objects('{self.sumo_id}')/blob")
return blob
@property
def png(self):
if self.__png is None:
self.__png = self.__get_png()
return self.__png
def __get_png(self):
png = self.sumo.get(f"/objects('{self.sumo_id}')/blob", encoder='png')
return png |
confusables = {
u'\u2460': '1',
u'\u2780': '1',
u'\U0001D7D0': '2',
u'\U0001D7DA': '2',
u'\U0001D7E4': '2',
u'\U0001D7EE': '2',
u'\U0001D7F8': '2',
u'\uA75A': '2',
u'\u01A7': '2',
u'\u03E8': '2',
u'\uA644': '2',
u'\u14BF': '2',
u'\uA6EF': '2',
u'\u2461': '2',
u'\u2781': '2',
u'\u01BB': '2',
u'\U0001F103': '2.',
u'\u2489': '2.',
u'\U0001D206': '3',
u'\U0001D7D1': '3',
u'\U0001D7DB': '3',
u'\U0001D7E5': '3',
u'\U0001D7EF': '3',
u'\U0001D7F9': '3',
u'\U00016F3B': '3',
u'\U000118CA': '3',
u'\uA7AB': '3',
u'\u021C': '3',
u'\u01B7': '3',
u'\uA76A': '3',
u'\u2CCC': '3',
u'\u0417': '3',
u'\u04E0': '3',
u'\u0AE9': '3',
u'\u2462': '3',
u'\u0498': '3',
u'\U0001F104': '3.',
u'\u248A': '3.',
u'\U0001D7D2': '4',
u'\U0001D7DC': '4',
u'\U0001D7E6': '4',
u'\U0001D7F0': '4',
u'\U0001D7FA': '4',
u'\U000118AF': '4',
u'\u13CE': '4',
u'\u2463': '4',
u'\u2783': '4',
u'\u1530': '4',
u'\U0001F105': '4.',
u'\u248B': '4.',
u'\U0001D7D3': '5',
u'\U0001D7DD': '5',
u'\U0001D7E7': '5',
u'\U0001D7F1': '5',
u'\U0001D7FB': '5',
u'\U000118BB': '5',
u'\u01BC': '5',
u'\u2464': '5',
u'\u2784': '5',
u'\U0001F106': '5.',
u'\u248C': '5.',
u'\U0001D7D4': '6',
u'\U0001D7DE': '6',
u'\U0001D7E8': '6',
u'\U0001D7F2': '6',
u'\U0001D7FC': '6',
u'\U000118D5': '6',
u'\u2CD2': '6',
u'\u0431': '6',
u'\u13EE': '6',
u'\u2465': '6',
u'\u2785': '6',
u'\U0001F107': '6.',
u'\u248D': '6.',
u'\U0001D212': '7',
u'\U0001D7D5': '7',
u'\U0001D7DF': '7',
u'\U0001D7E9': '7',
u'\U0001D7F3': '7',
u'\U0001D7FD': '7',
u'\U000104D2': '7',
u'\U000118C6': '7',
u'\u2466': '7',
u'\u2786': '7',
u'\U0001F108': '7.',
u'\u248E': '7.',
u'\U0001E8CB': '8',
u'\U0001D7D6': '8',
u'\U0001D7E0': '8',
u'\U0001D7EA': '8',
u'\U0001D7F4': '8',
u'\U0001D7FE': '8',
u'\U0001031A': '8',
u'\u0B03': '8',
u'\u09EA': '8',
u'\u0A6A': '8',
u'\u0223': '8',
u'\u0222': '8',
u'\u2467': '8',
u'\u2787': '8',
u'\U0001F109': '8.',
u'\u248F': '8.',
u'\U0001D7D7': '9',
u'\U0001D7E1': '9',
u'\U0001D7E4': '9',
u'\U0001D7EB': '9',
u'\U0001D7F5': '9',
u'\U0001D7FF': '9',
u'\U000118CC': '9',
u'\U000118AC': '9',
u'\U000118D6': '9',
u'\u0A67': '9',
u'\u0B68': '9',
u'\u09ED': '9',
u'\u0D6D': '9',
u'\uA76E': '9',
u'\u2CCA': '9',
u'\u0967': '9',
u'\u06F9': '9',
u'\u2468': '9',
u'\u2788': '9',
u'\U0001F10A': '9.',
u'\u2490': '9.',
u'\U0001D41A': 'a',
u'\U0001D44E': 'a',
u'\U0001D482': 'a',
u'\U0001D4B6': 'a',
u'\U0001D4EA': 'a',
u'\U0001D51E': 'a',
u'\U0001D552': 'a',
u'\U0001D586': 'a',
u'\U0001D5BA': 'a',
u'\U0001D5EE': 'a',
u'\U0001D622': 'a',
u'\U0001D656': 'a',
u'\U0001D68A': 'a',
u'\U0001D6C2': 'a',
u'\U0001D6FC': 'a',
u'\U0001D736': 'a',
u'\U0001D770': 'a',
u'\U0001D7AA': 'a',
u'\U0001D400': 'a',
u'\U0001D434': 'a',
u'\U0001D468': 'a',
u'\U0001D49C': 'a',
u'\U0001D4D0': 'a',
u'\U0001D504': 'a',
u'\U0001D538': 'a',
u'\U0001D56C': 'a',
u'\U0001D5A0': 'a',
u'\U0001D5D4': 'a',
u'\U0001D608': 'a',
u'\U0001D63C': 'a',
u'\U0001D670': 'a',
u'\U0001D6A8': 'a',
u'\U0001D6E2': 'a',
u'\U0001D71C': 'a',
u'\U0001D756': 'a',
u'\U0001D790': 'a',
u'\u237A': 'a',
u'\uFF41': 'a',
u'\u0251': 'a',
u'\u03B1': 'a',
u'\u0430': 'a',
u'\u2DF6': 'a',
u'\uFF21': 'a',
u'\u0391': 'a',
u'\u0410': 'a',
u'\u13AA': 'a',
u'\u15C5': 'a',
u'\uA4EE': 'a',
u'\u2376': 'a',
u'\u01CE': 'a',
u'\u0103': 'a',
u'\u01CD': 'a',
u'\u0102': 'a',
u'\u0227': 'a',
u'\u00E5': 'a',
u'\u0226': 'a',
u'\u00C5': 'a',
u'\u1E9A': 'a',
u'\u1EA3': 'a',
u'\uAB7A': 'a',
u'\u1D00': 'a',
u'\uA733': 'aa',
u'\uA732': 'aa',
u'\u00E6': 'ae',
u'\u04D5': 'ae',
u'\u00C6': 'ae',
u'\u04D4': 'ae',
u'\uA735': 'ao',
u'\uA734': 'ao',
u'\U0001F707': 'ar',
u'\uA737': 'au',
u'\uA736': 'au',
u'\uA738': 'av',
u'\uA739': 'av',
u'\uA73A': 'av',
u'\uA73B': 'av',
u'\uA73D': 'ay',
u'\uA73C': 'ay',
u'\U0001D41B': 'b',
u'\U0001D44F': 'b',
u'\U0001D483': 'b',
u'\U0001D4B7': 'b',
u'\U0001D4EB': 'b',
u'\U0001D51F': 'b',
u'\U0001D553': 'b',
u'\U0001D587': 'b',
u'\U0001D5BB': 'b',
u'\U0001D5EF': 'b',
u'\U0001D623': 'b',
u'\U0001D657': 'b',
u'\U0001D68B': 'b',
u'\U0001D401': 'b',
u'\U0001D435': 'b',
u'\U0001D469': 'b',
u'\U0001D4D1': 'b',
u'\U0001D505': 'b',
u'\U0001D539': 'b',
u'\U0001D56D': 'b',
u'\U0001D5A1': 'b',
u'\U0001D5D5': 'b',
u'\U0001D609': 'b',
u'\U0001D63D': 'b',
u'\U0001D671': 'b',
u'\U0001D6A9': 'b',
u'\U0001D6E3': 'b',
u'\U0001D71D': 'b',
u'\U0001D757': 'b',
u'\U0001D791': 'b',
u'\U00010282': 'b',
u'\U000102A1': 'b',
u'\U00010301': 'b',
u'\U0001D6C3': 'b',
u'\U0001D6FD': 'b',
u'\U0001D737': 'b',
u'\U0001D771': 'b',
u'\U0001D7AB': 'b',
u'\u0184': 'b',
u'\u042C': 'b',
u'\u13CF': 'b',
u'\u15AF': 'b',
u'\uFF22': 'b',
u'\u212C': 'b',
u'\uA7B4': 'b',
u'\u0392': 'b',
u'\u0412': 'b',
u'\u13F4': 'b',
u'\u15F7': 'b',
u'\uA4D0': 'b',
u'\u0253': 'b',
u'\u0183': 'b',
u'\u0182': 'b',
u'\u0411': 'b',
u'\u0180': 'b',
u'\u048D': 'b',
u'\u048C': 'b',
u'\u0463': 'b',
u'\u0462': 'b',
u'\u0432': 'b',
u'\u13FC': 'b',
u'\u0299': 'b',
u'\uA7B5': 'b',
u'\u03B2': 'b',
u'\u03D0': 'b',
u'\u13F0': 'b',
u'\u00DF': 'b',
u'\u042B': 'bl',
u'\U0001D41C': 'c',
u'\U0001D450': 'c',
u'\U0001D484': 'c',
u'\U0001D4B8': 'c',
u'\U0001D4EC': 'c',
u'\U0001D520': 'c',
u'\U0001D554': 'c',
u'\U0001D588': 'c',
u'\U0001D5BC': 'c',
u'\U0001D5F0': 'c',
u'\U0001D624': 'c',
u'\U0001D658': 'c',
u'\U0001D68C': 'c',
u'\U0001043D': 'c',
u'\U0001F74C': 'c',
u'\U000118F2': 'c',
u'\U000118E9': 'c',
u'\U0001D402': 'c',
u'\U0001D436': 'c',
u'\U0001D46A': 'c',
u'\U0001D49E': 'c',
u'\U0001D4D2': 'c',
u'\U0001D56E': 'c',
u'\U0001D5A2': 'c',
u'\U0001D5D6': 'c',
u'\U0001D60A': 'c',
u'\U0001D63E': 'c',
u'\U0001D672': 'c',
u'\U000102A2': 'c',
u'\U00010302': 'c',
u'\U00010415': 'c',
u'\U0001051C': 'c',
u'\uFF43': 'c',
u'\u217D': 'c',
u'\u1D04': 'c',
u'\u03F2': 'c',
u'\u2CA5': 'c',
u'\u0441': 'c',
u'\uABAF': 'c',
u'\u2DED': 'c',
u'\uFF23': 'c',
u'\u216D': 'c',
u'\u2102': 'c',
u'\u212D': 'c',
u'\u03F9': 'c',
u'\u2CA4': 'c',
u'\u0421': 'c',
u'\u13DF': 'c',
u'\uA4DA': 'c',
u'\u00A2': 'c',
u'\u023C': 'c',
u'\u20A1': 'c',
u'\u00E7': 'c',
u'\u04AB': 'c',
u'\u00C7': 'c',
u'\u04AA': 'c',
u'\u0187': 'c',
u'\U0001D41D': 'd',
u'\U0001D451': 'd',
u'\U0001D485': 'd',
u'\U0001D4B9': 'd',
u'\U0001D4ED': 'd',
u'\U0001D521': 'd',
u'\U0001D555': 'd',
u'\U0001D589': 'd',
u'\U0001D5BD': 'd',
u'\U0001D5F1': 'd',
u'\U0001D625': 'd',
u'\U0001D659': 'd',
u'\U0001D68D': 'd',
u'\U0001D403': 'd',
u'\U0001D437': 'd',
u'\U0001D46B': 'd',
u'\U0001D49F': 'd',
u'\U0001D4D3': 'd',
u'\U0001D507': 'd',
u'\U0001D53B': 'd',
u'\U0001D56F': 'd',
u'\U0001D5A3': 'd',
u'\U0001D5D7': 'd',
u'\U0001D60B': 'd',
u'\U0001D63F': 'd',
u'\U0001D673': 'd',
u'\u217E': 'd',
u'\u2146': 'd',
u'\u0501': 'd',
u'\u13E7': 'd',
u'\u146F': 'd',
u'\uA4D2': 'd',
u'\u216E': 'd',
u'\u2145': 'd',
u'\u13A0': 'd',
u'\u15DE': 'd',
u'\u15EA': 'd',
u'\uA4D3': 'd',
u'\u0257': 'd',
u'\u0256': 'd',
u'\u018C': 'd',
u'\u0111': 'd',
u'\u0110': 'd',
u'\u00D0': 'd',
u'\u0189': 'd',
u'\u20AB': 'd',
u'\u147B': 'd',
u'\u1487': 'd',
u'\u0257': 'd',
u'\u0256': 'd',
u'\u018C': 'd',
u'\u0111': 'd',
u'\u0110': 'd',
u'\u00D0': 'd',
u'\u0189': 'd',
u'\u20AB': 'd',
u'\u147B': 'd',
u'\u1487': 'd',
u'\uAB70': 'd',
u'\U0001D41E': 'e',
u'\U0001D452': 'e',
u'\U0001D486': 'e',
u'\U0001D4EE': 'e',
u'\U0001D522': 'e',
u'\U0001D556': 'e',
u'\U0001D58A': 'e',
u'\U0001D5BE': 'e',
u'\U0001D5F2': 'e',
u'\U0001D626': 'e',
u'\U0001D65A': 'e',
u'\U0001D68E': 'e',
u'\U0001D404': 'e',
u'\U0001D438': 'e',
u'\U0001D46C': 'e',
u'\U0001D4D4': 'e',
u'\U0001D508': 'e',
u'\U0001D53C': 'e',
u'\U0001D570': 'e',
u'\U0001D5A4': 'e',
u'\U0001D5D8': 'e',
u'\U0001D60C': 'e',
u'\U0001D640': 'e',
u'\U0001D674': 'e',
u'\U0001D6AC': 'e',
u'\U0001D6E6': 'e',
u'\U0001D720': 'e',
u'\U0001D75A': 'e',
u'\U0001D794': 'e',
u'\U000118A6': 'e',
u'\U000118AE': 'e',
u'\U00010286': 'e',
u'\U0001D221': 'e',
u'\u212E': 'e',
u'\uFF45': 'e',
u'\u212F': 'e',
u'\u2147': 'e',
u'\uAB32': 'e',
u'\u0435': 'e',
u'\u04BD': 'e',
u'\u2DF7': 'e',
u'\u22FF': 'e',
u'\uFF25': 'e',
u'\u2130': 'e',
u'\u0395': 'e',
u'\u0415': 'e',
u'\u2D39': 'e',
u'\u13AC': 'e',
u'\uA4F0': 'e',
u'\u011B': 'e',
u'\u011A': 'e',
u'\u0247': 'e',
u'\u0246': 'e',
u'\u04BF': 'e',
u'\uAB7C': 'e',
u'\u1D07': 'e',
u'\u0259': 'e',
u'\u01DD': 'e',
u'\u04D9': 'e',
u'\u2107': 'e',
u'\u0510': 'e',
u'\u13CB': 'e',
u'\U0001D41F': 'f',
u'\U0001D453': 'f',
u'\U0001D487': 'f',
u'\U0001D4BB': 'f',
u'\U0001D4EF': 'f',
u'\U0001D523': 'f',
u'\U0001D557': 'f',
u'\U0001D58B': 'f',
u'\U0001D5BF': 'f',
u'\U0001D5F3': 'f',
u'\U0001D627': 'f',
u'\U0001D65B': 'f',
u'\U0001D68F': 'f',
u'\U0001D213': 'f',
u'\U0001D405': 'f',
u'\U0001D439': 'f',
u'\U0001D46D': 'f',
u'\U0001D4D5': 'f',
u'\U0001D509': 'f',
u'\U0001D53D': 'f',
u'\U0001D571': 'f',
u'\U0001D5A5': 'f',
u'\U0001D5D9': 'f',
u'\U0001D60D': 'f',
u'\U0001D641': 'f',
u'\U0001D675': 'f',
u'\U0001D7CA': 'f',
u'\U000118C2': 'f',
u'\U000118A2': 'f',
u'\U00010287': 'f',
u'\U000102A5': 'f',
u'\U00010525': 'f',
u'\uAB35': 'f',
u'\uA799': 'f',
u'\u017F': 'f',
u'\u1E9D': 'f',
u'\u0584': 'f',
u'\u2131': 'f',
u'\uA798': 'f',
u'\u03DC': 'f',
u'\u15B4': 'f',
u'\uA4DD': 'f',
u'\u0192': 'f',
u'\u0191': 'f',
u'\u1D6E': 'f',
u'\uFB00': 'ff',
u'\uFB03': 'ffi',
u'\uFB04': 'ffl',
u'\uFB01': 'fi',
u'\uFB02': 'fl',
u'\u02A9': 'fn',
u'\U0001D420': 'g',
u'\U0001D454': 'g',
u'\U0001D488': 'g',
u'\U0001D4F0': 'g',
u'\U0001D524': 'g',
u'\U0001D558': 'g',
u'\U0001D58C': 'g',
u'\U0001D5C0': 'g',
u'\U0001D5F4': 'g',
u'\U0001D628': 'g',
u'\U0001D65C': 'g',
u'\U0001D690': 'g',
u'\U0001D406': 'g',
u'\U0001D43A': 'g',
u'\U0001D46E': 'g',
u'\U0001D4A2': 'g',
u'\U0001D4D6': 'g',
u'\U0001D50A': 'g',
u'\U0001D53E': 'g',
u'\U0001D572': 'g',
u'\U0001D5A6': 'g',
u'\U0001D5DA': 'g',
u'\U0001D60E': 'g',
u'\U0001D642': 'g',
u'\U0001D676': 'g',
u'\uFF47': 'g',
u'\u210A': 'g',
u'\u0261': 'g',
u'\u1D83': 'g',
u'\u018D': 'g',
u'\u0581': 'g',
u'\u050C': 'g',
u'\u13C0': 'g',
u'\u13F3': 'g',
u'\uA4D6': 'g',
u'\u1DA2': 'g',
u'\u1D4D': 'g',
u'\u0260': 'g',
u'\u01E7': 'g',
u'\u011F': 'g',
u'\u01E6': 'g',
u'\u011E': 'g',
u'\u01F5': 'g',
u'\u0123': 'g',
u'\u01E5': 'g',
u'\u01E4': 'g',
u'\u0193': 'g',
u'\u050D': 'g',
u'\uAB90': 'g',
u'\u13FB': 'g',
u'\U0001D421': 'h',
u'\U0001D489': 'h',
u'\U0001D4BD': 'h',
u'\U0001D4F1': 'h',
u'\U0001D525': 'h',
u'\U0001D559': 'h',
u'\U0001D58D': 'h',
u'\U0001D5C1': 'h',
u'\U0001D5F5': 'h',
u'\U0001D629': 'h',
u'\U0001D65D': 'h',
u'\U0001D691': 'h',
u'\U0001D407': 'h',
u'\U0001D43B': 'h',
u'\U0001D46F': 'h',
u'\U0001D4D7': 'h',
u'\U0001D573': 'h',
u'\U0001D5A7': 'h',
u'\U0001D5DB': 'h',
u'\U0001D60F': 'h',
u'\U0001D643': 'h',
u'\U0001D677': 'h',
u'\U0001D6AE': 'h',
u'\U0001D6E8': 'h',
u'\U0001D722': 'h',
u'\U0001D75C': 'h',
u'\U0001D796': 'h',
u'\U000102CF': 'h',
u'\U00010199': 'h',
u'\uFF48': 'h',
u'\u210E': 'h',
u'\u04BB': 'h',
u'\u0570': 'h',
u'\u13C2': 'h',
u'\uFF28': 'h',
u'\u210B': 'h',
u'\u210C': 'h',
u'\u210D': 'h',
u'\u0397': 'h',
u'\u2C8E': 'h',
u'\u041D': 'h',
u'\u13BB': 'h',
u'\u157C': 'h',
u'\uA4E7': 'h',
u'\u1D78': 'h',
u'\u1D34': 'h',
u'\u0266': 'h',
u'\uA695': 'h',
u'\u13F2': 'h',
u'\u2C67': 'h',
u'\u04A2': 'h',
u'\u0127': 'h',
u'\u210F': 'h',
u'\u045B': 'h',
u'\u0126': 'h',
u'\u04C9': 'h',
u'\u04C7': 'h',
u'\u043D': 'h',
u'\u029C': 'h',
u'\uAB8B': 'h',
u'\u04A3': 'h',
u'\u04CA': 'h',
u'\u04C8': 'h',
u'\U0001D422': 'i',
u'\U0001D456': 'i',
u'\U0001D48A': 'i',
u'\U0001D4BE': 'i',
u'\U0001D4F2': 'i',
u'\U0001D526': 'i',
u'\U0001D55A': 'i',
u'\U0001D58E': 'i',
u'\U0001D5C2': 'i',
u'\U0001D5F6': 'i',
u'\U0001D62A': 'i',
u'\U0001D65E': 'i',
u'\U0001D692': 'i',
u'\U0001D6A4': 'i',
u'\U0001D6CA': 'i',
u'\U0001D704': 'i',
u'\U0001D73E': 'i',
u'\U0001D778': 'i',
u'\U0001D7B2': 'i',
u'\U000118C3': 'i',
u'\u02DB': 'i',
u'\u2373': 'i',
u'\uFF49': 'i',
u'\u2170': 'i',
u'\u2139': 'i',
u'\u2148': 'i',
u'\u0131': 'i',
u'\u026A': 'i',
u'\u0269': 'i',
u'\u03B9': 'i',
u'\u1FBE': 'i',
u'\u037A': 'i',
u'\u0456': 'i',
u'\uA647': 'i',
u'\u04CF': 'i',
u'\uAB75': 'i',
u'\u13A5': 'i',
u'\u24DB': 'i',
u'\u2378': 'i',
u'\u01D0': 'i',
u'\u01CF': 'i',
u'\u0268': 'i',
u'\u1D7B': 'i',
u'\u1D7C': 'i',
u'\u2171': 'ii',
u'\u2172': 'iii',
u'\u0133': 'ij',
u'\u2173': 'iv',
u'\u2178': 'ix',
u'\U0001D423': 'j',
u'\U0001D457': 'j',
u'\U0001D48B': 'j',
u'\U0001D4BF': 'j',
u'\U0001D4F3': 'j',
u'\U0001D527': 'j',
u'\U0001D55B': 'j',
u'\U0001D58F': 'j',
u'\U0001D5C3': 'j',
u'\U0001D5F7': 'j',
u'\U0001D62B': 'j',
u'\U0001D65F': 'j',
u'\U0001D693': 'j',
u'\U0001D409': 'j',
u'\U0001D43D': 'j',
u'\U0001D471': 'j',
u'\U0001D4A5': 'j',
u'\U0001D4D9': 'j',
u'\U0001D50D': 'j',
u'\U0001D541': 'j',
u'\U0001D575': 'j',
u'\U0001D5A9': 'j',
u'\U0001D5DD': 'j',
u'\U0001D611': 'j',
u'\U0001D645': 'j',
u'\U0001D679': 'j',
u'\U0001D6A5': 'j',
u'\uFF4A': 'j',
u'\u2149': 'j',
u'\u03F3': 'j',
u'\u0458': 'j',
u'\uFF2A': 'j',
u'\uA7B2': 'j',
u'\u037F': 'j',
u'\u0408': 'j',
u'\u13AB': 'j',
u'\u148D': 'j',
u'\uA4D9': 'j',
u'\u0249': 'j',
u'\u0248': 'j',
u'\u1499': 'j',
u'\u0575': 'j',
u'\uAB7B': 'j',
u'\u1D0A': 'j',
u'\U0001D424': 'k',
u'\U0001D458': 'k',
u'\U0001D48C': 'k',
u'\U0001D4C0': 'k',
u'\U0001D4F4': 'k',
u'\U0001D528': 'k',
u'\U0001D55C': 'k',
u'\U0001D590': 'k',
u'\U0001D5C4': 'k',
u'\U0001D5F8': 'k',
u'\U0001D62C': 'k',
u'\U0001D660': 'k',
u'\U0001D694': 'k',
u'\U0001D40A': 'k',
u'\U0001D43E': 'k',
u'\U0001D472': 'k',
u'\U0001D4A6': 'k',
u'\U0001D4DA': 'k',
u'\U0001D50E': 'k',
u'\U0001D542': 'k',
u'\U0001D576': 'k',
u'\U0001D5AA': 'k',
u'\U0001D5DE': 'k',
u'\U0001D612': 'k',
u'\U0001D646': 'k',
u'\U0001D67A': 'k',
u'\U0001D6B1': 'k',
u'\U0001D6EB': 'k',
u'\U0001D725': 'k',
u'\U0001D75F': 'k',
u'\U0001D799': 'k',
u'\U0001D6CB': 'k',
u'\U0001D6DE': 'k',
u'\U0001D705': 'k',
u'\U0001D718': 'k',
u'\U0001D73F': 'k',
u'\U0001D752': 'k',
u'\U0001D779': 'k',
u'\U0001D78C': 'k',
u'\U0001D7B3': 'k',
u'\U0001D7C6': 'k',
u'\u212A': 'k',
u'\uFF2B': 'k',
u'\u039A': 'k',
u'\u2C94': 'k',
u'\u041A': 'k',
u'\u13E6': 'k',
u'\u16D5': 'k',
u'\uA4D7': 'k',
u'\u0199': 'k',
u'\u2C69': 'k',
u'\u049A': 'k',
u'\u20AD': 'k',
u'\uA740': 'k',
u'\u049E': 'k',
u'\u0198': 'k',
u'\u1D0B': 'k',
u'\u0138': 'k',
u'\u03BA': 'k',
u'\u03F0': 'k',
u'\u2C95': 'k',
u'\u043A': 'k',
u'\uABB6': 'k',
u'\u049B': 'k',
u'\u049F': 'k',
u'\U00010320': 'l',
u'\U0001E8C7': 'l',
u'\U0001D7CF': 'l',
u'\U0001D7D9': 'l',
u'\U0001D7E3': 'l',
u'\U0001D7ED': 'l',
u'\U0001D7F7': 'l',
u'\U0001D408': 'l',
u'\U0001D43C': 'l',
u'\U0001D470': 'l',
u'\U0001D4D8': 'l',
u'\U0001D540': 'l',
u'\U0001D574': 'l',
u'\U0001D5A8': 'l',
u'\U0001D5DC': 'l',
u'\U0001D610': 'l',
u'\U0001D644': 'l',
u'\U0001D678': 'l',
u'\U0001D425': 'l',
u'\U0001D459': 'l',
u'\U0001D48D': 'l',
u'\U0001D4C1': 'l',
u'\U0001D4F5': 'l',
u'\U0001D529': 'l',
u'\U0001D55D': 'l',
u'\U0001D591': 'l',
u'\U0001D5C5': 'l',
u'\U0001D5F9': 'l',
u'\U0001D62D': 'l',
u'\U0001D661': 'l',
u'\U0001D695': 'l',
u'\U0001D6B0': 'l',
u'\U0001D6EA': 'l',
u'\U0001D724': 'l',
u'\U0001D75E': 'l',
u'\U0001D798': 'l',
u'\U0001EE00': 'l',
u'\U0001EE80': 'l',
u'\U00016F28': 'l',
u'\U0001028A': 'l',
u'\U00010309': 'l',
u'\U0001D22A': 'l',
u'\U0001D40B': 'l',
u'\U0001D43F': 'l',
u'\U0001D473': 'l',
u'\U0001D4DB': 'l',
u'\U0001D50F': 'l',
u'\U0001D543': 'l',
u'\U0001D577': 'l',
u'\U0001D5AB': 'l',
u'\U0001D5DF': 'l',
u'\U0001D613': 'l',
u'\U0001D647': 'l',
u'\U0001D67B': 'l',
u'\U00016F16': 'l',
u'\U000118A3': 'l',
u'\U000118B2': 'l',
u'\U0001041B': 'l',
u'\U00010526': 'l',
u'\U00010443': 'l',
u'\u05C0': 'l',
u'\u007C': 'l',
u'\u2223': 'l',
u'\u23FD': 'l',
u'\uFFE8': 'l',
u'\u0031': 'l',
u'\u0661': 'l',
u'\u06F1': 'l',
u'\u0049': 'l',
u'\uFF29': 'l',
u'\u2160': 'l',
u'\u2110': 'l',
u'\u2111': 'l',
u'\u0196': 'l',
u'\uFF4C': 'l',
u'\u217C': 'l',
u'\u2113': 'l',
u'\u01C0': 'l',
u'\u0399': 'l',
u'\u2C92': 'l',
u'\u0406': 'l',
u'\u04C0': 'l',
u'\u05D5': 'l',
u'\u05DF': 'l',
u'\u0627': 'l',
u'\uFE8E': 'l',
u'\uFE8D': 'l',
u'\u07CA': 'l',
u'\u2D4F': 'l',
u'\u16C1': 'l',
u'\uA4F2': 'l',
u'\u216C': 'l',
u'\u2112': 'l',
u'\u2CD0': 'l',
u'\u13DE': 'l',
u'\u14AA': 'l',
u'\uA4E1': 'l',
u'\uFD3C': 'l',
u'\uFD3D': 'l',
u'\u0142': 'l',
u'\u0141': 'l',
u'\u026D': 'l',
u'\u0197': 'l',
u'\u019A': 'l',
u'\u026B': 'l',
u'\u0625': 'l',
u'\uFE88': 'l',
u'\uFE87': 'l',
u'\u0673': 'l',
u'\u0140': 'l',
u'\u013F': 'l',
u'\u14B7': 'l',
u'\u0623': 'l',
u'\uFE84': 'l',
u'\uFE83': 'l',
u'\u0672': 'l',
u'\u0675': 'l',
u'\u2CD1': 'l',
u'\uABAE': 'l',
u'\U0001F102': 'l.',
u'\u2488': 'l.',
u'\u01C9': 'lj',
u'\u0132': 'lj',
u'\u01C8': 'lj',
u'\u01C7': 'lj',
u'\u2016': 'll',
u'\u2225': 'll',
u'\u2161': 'll',
u'\u01C1': 'll',
u'\u05F0': 'll',
u'\u2162': 'lll',
u'\u02AA': 'ls',
u'\u20B6': 'lt',
u'\u2163': 'lv',
u'\u2168': 'lx',
u'\u02AB': 'lz',
u'\U0001D40C': 'm',
u'\U0001D440': 'm',
u'\U0001D474': 'm',
u'\U0001D4DC': 'm',
u'\U0001D510': 'm',
u'\U0001D544': 'm',
u'\U0001D578': 'm',
u'\U0001D5AC': 'm',
u'\U0001D5E0': 'm',
u'\U0001D614': 'm',
u'\U0001D648': 'm',
u'\U0001D67C': 'm',
u'\U0001D6B3': 'm',
u'\U0001D6ED': 'm',
u'\U0001D727': 'm',
u'\U0001D761': 'm',
u'\U0001D79B': 'm',
u'\U000102B0': 'm',
u'\U00010311': 'm',
u'\uFF2D': 'm',
u'\u216F': 'm',
u'\u2133': 'm',
u'\u039C': 'm',
u'\u03FA': 'm',
u'\u2C98': 'm',
u'\u041C': 'm',
u'\u13B7': 'm',
u'\u15F0': 'm',
u'\u16D6': 'm',
u'\uA4DF': 'm',
u'\u04CD': 'm',
u'\u2DE8': 'm',
u'\u1DDF': 'm',
u'\u1E43': 'm',
u'\U0001F76B': 'mb',
u'\U0001D427': 'n',
u'\U0001D45B': 'n',
u'\U0001D48F': 'n',
u'\U0001D4C3': 'n',
u'\U0001D4F7': 'n',
u'\U0001D52B': 'n',
u'\U0001D55F': 'n',
u'\U0001D593': 'n',
u'\U0001D5C7': 'n',
u'\U0001D5FB': 'n',
u'\U0001D62F': 'n',
u'\U0001D663': 'n',
u'\U0001D697': 'n',
u'\U0001D40D': 'n',
u'\U0001D441': 'n',
u'\U0001D475': 'n',
u'\U0001D4A9': 'n',
u'\U0001D4DD': 'n',
u'\U0001D511': 'n',
u'\U0001D579': 'n',
u'\U0001D5AD': 'n',
u'\U0001D5E1': 'n',
u'\U0001D615': 'n',
u'\U0001D649': 'n',
u'\U0001D67D': 'n',
u'\U0001D6B4': 'n',
u'\U0001D6EE': 'n',
u'\U0001D728': 'n',
u'\U0001D762': 'n',
u'\U0001D79C': 'n',
u'\U00010513': 'n',
u'\U0001018E': 'n',
u'\U0001D6C8': 'n',
u'\U0001D702': 'n',
u'\U0001D73C': 'n',
u'\U0001D776': 'n',
u'\U0001D7B0': 'n',
u'\U0001044D': 'n',
u'\u0578': 'n',
u'\u057C': 'n',
u'\uFF2E': 'n',
u'\u2115': 'n',
u'\u039D': 'n',
u'\u2C9A': 'n',
u'\uA4E0': 'n',
u'\u0273': 'n',
u'\u019E': 'n',
u'\u03B7': 'n',
u'\u019D': 'n',
u'\u1D70': 'n',
u'\u0146': 'n',
u'\u0272': 'n',
u'\u01CC': 'nj',
u'\u01CB': 'nj',
u'\u01CA': 'nj',
u'\u2116': 'no',
u'\U0001D428': 'o',
u'\U0001D45C': 'o',
u'\U0001D490': 'o',
u'\U0001D4F8': 'o',
u'\U0001D52C': 'o',
u'\U0001D560': 'o',
u'\U0001D594': 'o',
u'\U0001D5C8': 'o',
u'\U0001D5FC': 'o',
u'\U0001D630': 'o',
u'\U0001D664': 'o',
u'\U0001D698': 'o',
u'\U0001D6D0': 'o',
u'\U0001D70A': 'o',
u'\U0001D744': 'o',
u'\U0001D77E': 'o',
u'\U0001D7B8': 'o',
u'\U0001D6D4': 'o',
u'\U0001D70E': 'o',
u'\U0001D748': 'o',
u'\U0001D782': 'o',
u'\U0001D7BC': 'o',
u'\U0001EE24': 'o',
u'\U0001EE64': 'o',
u'\U0001EE84': 'o',
u'\U000104EA': 'o',
u'\U000118C8': 'o',
u'\U000118D7': 'o',
u'\U0001042C': 'o',
u'\U000114D0': 'o',
u'\U000118E0': 'o',
u'\U0001D7CE': 'o',
u'\U0001D7D8': 'o',
u'\U0001D7E2': 'o',
u'\U0001D7EC': 'o',
u'\U0001D7F6': 'o',
u'\U0001D40E': 'o',
u'\U0001D442': 'o',
u'\U0001D476': 'o',
u'\U0001D4AA': 'o',
u'\U0001D4DE': 'o',
u'\U0001D512': 'o',
u'\U0001D546': 'o',
u'\U0001D57A': 'o',
u'\U0001D5AE': 'o',
u'\U0001D5E2': 'o',
u'\U0001D616': 'o',
u'\U0001D64A': 'o',
u'\U0001D67E': 'o',
u'\U0001D6B6': 'o',
u'\U0001D6F0': 'o',
u'\U0001D72A': 'o',
u'\U0001D764': 'o',
u'\U0001D79E': 'o',
u'\U000104C2': 'o',
u'\U000118B5': 'o',
u'\U00010292': 'o',
u'\U000102AB': 'o',
u'\U00010404': 'o',
u'\U00010516': 'o',
u'\U0001D21A': 'o',
u'\U0001F714': 'o',
u'\U0001D6C9': 'o',
u'\U0001D6DD': 'o',
u'\U0001D703': 'o',
u'\U0001D717': 'o',
u'\U0001D73D': 'o',
u'\U0001D751': 'o',
u'\U0001D777': 'o',
u'\U0001D78B': 'o',
u'\U0001D7B1': 'o',
u'\U0001D7C5': 'o',
u'\U0001D6AF': 'o',
u'\U0001D6B9': 'o',
u'\U0001D6E9': 'o',
u'\U0001D6F3': 'o',
u'\U0001D723': 'o',
u'\U0001D72D': 'o',
u'\U0001D75D': 'o',
u'\U0001D767': 'o',
u'\U0001D797': 'o',
u'\U0001D7A1': 'o',
u'\U0001F101': 'o',
u'\U0001F100': 'o',
u'\u0C02': 'o',
u'\u0C82': 'o',
u'\u0D02': 'o',
u'\u0D82': 'o',
u'\u0966': 'o',
u'\u0A66': 'o',
u'\u0AE6': 'o',
u'\u0BE6': 'o',
u'\u0C66': 'o',
u'\u0CE6': 'o',
u'\u0D66': 'o',
u'\u0E50': 'o',
u'\u0ED0': 'o',
u'\u1040': 'o',
u'\u0665': 'o',
u'\u06F5': 'o',
u'\uFF4F': 'o',
u'\u2134': 'o',
u'\u1D0F': 'o',
u'\u1D11': 'o',
u'\uAB3D': 'o',
u'\u03BF': 'o',
u'\u03C3': 'o',
u'\u2C9F': 'o',
u'\u043E': 'o',
u'\u10FF': 'o',
u'\u0585': 'o',
u'\u05E1': 'o',
u'\u0647': 'o',
u'\uFEEB': 'o',
u'\uFEEC': 'o',
u'\uFEEA': 'o',
u'\uFEE9': 'o',
u'\u06BE': 'o',
u'\uFBAC': 'o',
u'\uFBAD': 'o',
u'\uFBAB': 'o',
u'\uFBAA': 'o',
u'\u06C1': 'o',
u'\uFBA8': 'o',
u'\uFBA9': 'o',
u'\uFBA7': 'o',
u'\uFBA6': 'o',
u'\u06D5': 'o',
u'\u0D20': 'o',
u'\u101D': 'o',
u'\u07C0': 'o',
u'\u09E6': 'o',
u'\u0B66': 'o',
u'\u3007': 'o',
u'\uFF2F': 'o',
u'\u039F': 'o',
u'\u2C9E': 'o',
u'\u041E': 'o',
u'\u0555': 'o',
u'\u2D54': 'o',
u'\u12D0': 'o',
u'\u0B20': 'o',
u'\uA4F3': 'o',
u'\u2070': 'o',
u'\u00BA': 'o',
u'\u1D52': 'o',
u'\u01D2': 'o',
u'\u014F': 'o',
u'\u01D1': 'o',
u'\u014E': 'o',
u'\u06FF': 'o',
u'\u00F8': 'o',
u'\uAB3E': 'o',
u'\u00D8': 'o',
u'\u2D41': 'o',
u'\u01FE': 'o',
u'\u0275': 'o',
u'\uA74B': 'o',
u'\u04E9': 'o',
u'\u0473': 'o',
u'\uAB8E': 'o',
u'\uABBB': 'o',
u'\u2296': 'o',
u'\u229D': 'o',
u'\u236C': 'o',
u'\u019F': 'o',
u'\uA74A': 'o',
u'\u03B8': 'o',
u'\u03D1': 'o',
u'\u0398': 'o',
u'\u03F4': 'o',
u'\u04E8': 'o',
u'\u0472': 'o',
u'\u2D31': 'o',
u'\u13BE': 'o',
u'\u13EB': 'o',
u'\uAB74': 'o',
u'\uFCD9': 'o',
u'\u01A1': 'o',
u'\u01A0': 'o',
u'\u13A4': 'o',
u'\U0001F101': 'o.',
u'\U0001F100': 'o.',
u'\u0153': 'oe',
u'\u0152': 'oe',
u'\u0276': 'oe',
u'\u221E': 'oo',
u'\uA74F': 'oo',
u'\uA699': 'oo',
u'\uA74E': 'oo',
u'\uA698': 'oo',
u'\u1010': 'oo',
u'\U0001D429': 'p',
u'\U0001D45D': 'p',
u'\U0001D491': 'p',
u'\U0001D4C5': 'p',
u'\U0001D4F9': 'p',
u'\U0001D52D': 'p',
u'\U0001D561': 'p',
u'\U0001D595': 'p',
u'\U0001D5C9': 'p',
u'\U0001D5FD': 'p',
u'\U0001D631': 'p',
u'\U0001D665': 'p',
u'\U0001D699': 'p',
u'\U0001D6D2': 'p',
u'\U0001D6E0': 'p',
u'\U0001D70C': 'p',
u'\U0001D71A': 'p',
u'\U0001D746': 'p',
u'\U0001D754': 'p',
u'\U0001D780': 'p',
u'\U0001D78E': 'p',
u'\U0001D7BA': 'p',
u'\U0001D7C8': 'p',
u'\U0001D40F': 'p',
u'\U0001D443': 'p',
u'\U0001D477': 'p',
u'\U0001D4AB': 'p',
u'\U0001D4DF': 'p',
u'\U0001D513': 'p',
u'\U0001D57B': 'p',
u'\U0001D5AF': 'p',
u'\U0001D5E3': 'p',
u'\U0001D617': 'p',
u'\U0001D64B': 'p',
u'\U0001D67F': 'p',
u'\U0001D6B8': 'p',
u'\U0001D6F2': 'p',
u'\U0001D72C': 'p',
u'\U0001D766': 'p',
u'\U0001D7A0': 'p',
u'\U00010295': 'p',
u'\u2374': 'p',
u'\uFF50': 'p',
u'\u03C1': 'p',
u'\u03F1': 'p',
u'\u2CA3': 'p',
u'\u0440': 'p',
u'\uFF30': 'p',
u'\u2119': 'p',
u'\u03A1': 'p',
u'\u2CA2': 'p',
u'\u0420': 'p',
u'\u13E2': 'p',
u'\u146D': 'p',
u'\uA4D1': 'p',
u'\u01A5': 'p',
u'\u1D7D': 'p',
u'\u1477': 'p',
u'\u1486': 'p',
u'\u1D29': 'p',
u'\uABB2': 'p',
u'\U0001D42A': 'q',
u'\U0001D45E': 'q',
u'\U0001D492': 'q',
u'\U0001D4C6': 'q',
u'\U0001D4FA': 'q',
u'\U0001D52E': 'q',
u'\U0001D562': 'q',
u'\U0001D596': 'q',
u'\U0001D5CA': 'q',
u'\U0001D5FE': 'q',
u'\U0001D632': 'q',
u'\U0001D666': 'q',
u'\U0001D69A': 'q',
u'\U0001D410': 'q',
u'\U0001D444': 'q',
u'\U0001D478': 'q',
u'\U0001D4AC': 'q',
u'\U0001D4E0': 'q',
u'\U0001D514': 'q',
u'\U0001D57C': 'q',
u'\U0001D5B0': 'q',
u'\U0001D5E4': 'q',
u'\U0001D618': 'q',
u'\U0001D64C': 'q',
u'\U0001D680': 'q',
u'\u051B': 'q',
u'\u0563': 'q',
u'\u0566': 'q',
u'\u211A': 'q',
u'\u2D55': 'q',
u'\u02A0': 'q',
u'\u1D90': 'q',
u'\u024B': 'q',
u'\U0001D42B': 'r',
u'\U0001D45F': 'r',
u'\U0001D493': 'r',
u'\U0001D4C7': 'r',
u'\U0001D4FB': 'r',
u'\U0001D52F': 'r',
u'\U0001D563': 'r',
u'\U0001D597': 'r',
u'\U0001D5CB': 'r',
u'\U0001D5FF': 'r',
u'\U0001D633': 'r',
u'\U0001D667': 'r',
u'\U0001D69B': 'r',
u'\U0001D216': 'r',
u'\U0001D411': 'r',
u'\U0001D445': 'r',
u'\U0001D479': 'r',
u'\U0001D4E1': 'r',
u'\U0001D57D': 'r',
u'\U0001D5B1': 'r',
u'\U0001D5E5': 'r',
u'\U0001D619': 'r',
u'\U0001D64D': 'r',
u'\U0001D681': 'r',
u'\U000104B4': 'r',
u'\uAB47': 'r',
u'\uAB48': 'r',
u'\u1D26': 'r',
u'\u2C85': 'r',
u'\u0433': 'r',
u'\uAB81': 'r',
u'\u211B': 'r',
u'\u211C': 'r',
u'\u211D': 'r',
u'\u01A6': 'r',
u'\u13A1': 'r',
u'\u13D2': 'r',
u'\u1587': 'r',
u'\uA4E3': 'r',
u'\u027D': 'r',
u'\u027C': 'r',
u'\u024D': 'r',
u'\u0493': 'r',
u'\u1D72': 'r',
u'\u0491': 'r',
u'\uAB71': 'r',
u'\u0280': 'r',
u'\uABA2': 'r',
u'\u1D73': 'r',
u'\U000118E3': 'rn',
u'\U0001D426': 'rn',
u'\U0001D45A': 'rn',
u'\U0001D48E': 'rn',
u'\U0001D4C2': 'rn',
u'\U0001D4F6': 'rn',
u'\U0001D52A': 'rn',
u'\U0001D55E': 'rn',
u'\U0001D592': 'rn',
u'\U0001D5C6': 'rn',
u'\U0001D5FA': 'rn',
u'\U0001D62E': 'rn',
u'\U0001D662': 'rn',
u'\U0001D696': 'rn',
u'\U00011700': 'rn',
u'\u217F': 'rn',
u'\u20A5': 'rn',
u'\u0271': 'rn',
u'\u1D6F': 'rn',
u'\U0001D42C': 's',
u'\U0001D460': 's',
u'\U0001D494': 's',
u'\U0001D4C8': 's',
u'\U0001D4FC': 's',
u'\U0001D530': 's',
u'\U0001D564': 's',
u'\U0001D598': 's',
u'\U0001D5CC': 's',
u'\U0001D600': 's',
u'\U0001D634': 's',
u'\U0001D668': 's',
u'\U0001D69C': 's',
u'\U000118C1': 's',
u'\U00010448': 's',
u'\U0001D412': 's',
u'\U0001D446': 's',
u'\U0001D47A': 's',
u'\U0001D4AE': 's',
u'\U0001D4E2': 's',
u'\U0001D516': 's',
u'\U0001D54A': 's',
u'\U0001D57E': 's',
u'\U0001D5B2': 's',
u'\U0001D5E6': 's',
u'\U0001D61A': 's',
u'\U0001D64E': 's',
u'\U0001D682': 's',
u'\U00016F3A': 's',
u'\U00010296': 's',
u'\U00010420': 's',
u'\uFF53': 's',
u'\uA731': 's',
u'\u01BD': 's',
u'\u0455': 's',
u'\uABAA': 's',
u'\uFF33': 's',
u'\u0405': 's',
u'\u054F': 's',
u'\u13D5': 's',
u'\u13DA': 's',
u'\uA4E2': 's',
u'\u0282': 's',
u'\u1D74': 's',
u'\U0001F75C': 'sss',
u'\uFB06': 'st',
u'\U0001D42D': 't',
u'\U0001D461': 't',
u'\U0001D495': 't',
u'\U0001D4C9': 't',
u'\U0001D4FD': 't',
u'\U0001D531': 't',
u'\U0001D565': 't',
u'\U0001D599': 't',
u'\U0001D5CD': 't',
u'\U0001D601': 't',
u'\U0001D635': 't',
u'\U0001D669': 't',
u'\U0001D69D': 't',
u'\U0001F768': 't',
u'\U0001D413': 't',
u'\U0001D447': 't',
u'\U0001D47B': 't',
u'\U0001D4AF': 't',
u'\U0001D4E3': 't',
u'\U0001D517': 't',
u'\U0001D54B': 't',
u'\U0001D57F': 't',
u'\U0001D5B3': 't',
u'\U0001D5E7': 't',
u'\U0001D61B': 't',
u'\U0001D64F': 't',
u'\U0001D683': 't',
u'\U0001D6BB': 't',
u'\U0001D6F5': 't',
u'\U0001D72F': 't',
u'\U0001D769': 't',
u'\U0001D7A3': 't',
u'\U00016F0A': 't',
u'\U000118BC': 't',
u'\U00010297': 't',
u'\U000102B1': 't',
u'\U00010315': 't',
u'\U0001D6D5': 't',
u'\U0001D70F': 't',
u'\U0001D749': 't',
u'\U0001D783': 't',
u'\U0001D7BD': 't',
u'\u22A4': 't',
u'\u27D9': 't',
u'\uFF34': 't',
u'\u03A4': 't',
u'\u2CA6': 't',
u'\u0422': 't',
u'\u13A2': 't',
u'\uA4D4': 't',
u'\u2361': 't',
u'\u023E': 't',
u'\u021A': 't',
u'\u0162': 't',
u'\u01AE': 't',
u'\u04AC': 't',
u'\u20AE': 't',
u'\u0167': 't',
u'\u0166': 't',
u'\u1D75': 't',
u'\U0001D42E': 'u',
u'\U0001D462': 'u',
u'\U0001D496': 'u',
u'\U0001D4CA': 'u',
u'\U0001D4FE': 'u',
u'\U0001D532': 'u',
u'\U0001D566': 'u',
u'\U0001D59A': 'u',
u'\U0001D5CE': 'u',
u'\U0001D602': 'u',
u'\U0001D636': 'u',
u'\U0001D66A': 'u',
u'\U0001D69E': 'u',
u'\U0001D6D6': 'u',
u'\U0001D710': 'u',
u'\U0001D74A': 'u',
u'\U0001D784': 'u',
u'\U0001D7BE': 'u',
u'\U000104F6': 'u',
u'\U000118D8': 'u',
u'\U0001D414': 'u',
u'\U0001D448': 'u',
u'\U0001D47C': 'u',
u'\U0001D4B0': 'u',
u'\U0001D4E4': 'u',
u'\U0001D518': 'u',
u'\U0001D54C': 'u',
u'\U0001D580': 'u',
u'\U0001D5B4': 'u',
u'\U0001D5E8': 'u',
u'\U0001D61C': 'u',
u'\U0001D650': 'u',
u'\U0001D684': 'u',
u'\U000104CE': 'u',
u'\U00016F42': 'u',
u'\U000118B8': 'u',
u'\uA79F': 'u',
u'\u1D1C': 'u',
u'\uAB4E': 'u',
u'\uAB52': 'u',
u'\u028B': 'u',
u'\u03C5': 'u',
u'\u057D': 'u',
u'\u222A': 'u',
u'\u22C3': 'u',
u'\u054D': 'u',
u'\u1200': 'u',
u'\u144C': 'u',
u'\uA4F4': 'u',
u'\u01D4': 'u',
u'\u01D3': 'u',
u'\u1D7E': 'u',
u'\uAB9C': 'u',
u'\u0244': 'u',
u'\u13CC': 'u',
u'\u1458': 'u',
u'\u1467': 'u',
u'\u2127': 'u',
u'\u162E': 'u',
u'\u1634': 'u',
u'\u01B1': 'u',
u'\u1D7F': 'u',
u'\u1D6B': 'ue',
u'\uAB63': 'uo',
u'\U0001D42F': 'v',
u'\U0001D463': 'v',
u'\U0001D497': 'v',
u'\U0001D4CB': 'v',
u'\U0001D4FF': 'v',
u'\U0001D533': 'v',
u'\U0001D567': 'v',
u'\U0001D59B': 'v',
u'\U0001D5CF': 'v',
u'\U0001D603': 'v',
u'\U0001D637': 'v',
u'\U0001D66B': 'v',
u'\U0001D69F': 'v',
u'\U0001D6CE': 'v',
u'\U0001D708': 'v',
u'\U0001D742': 'v',
u'\U0001D77C': 'v',
u'\U0001D7B6': 'v',
u'\U00011706': 'v',
u'\U000118C0': 'v',
u'\U0001D20D': 'v',
u'\U0001D415': 'v',
u'\U0001D449': 'v',
u'\U0001D47D': 'v',
u'\U0001D4B1': 'v',
u'\U0001D4E5': 'v',
u'\U0001D519': 'v',
u'\U0001D54D': 'v',
u'\U0001D581': 'v',
u'\U0001D5B5': 'v',
u'\U0001D5E9': 'v',
u'\U0001D61D': 'v',
u'\U0001D651': 'v',
u'\U0001D685': 'v',
u'\U00016F08': 'v',
u'\U000118A0': 'v',
u'\U0001051D': 'v',
u'\U00010197': 'v',
u'\U0001F708': 'v',
u'\u2228': 'v',
u'\u22C1': 'v',
u'\uFF56': 'v',
u'\u2174': 'v',
u'\u1D20': 'v',
u'\u03BD': 'v',
u'\u0475': 'v',
u'\u05D8': 'v',
u'\uABA9': 'v',
u'\u0667': 'v',
u'\u06F7': 'v',
u'\u2164': 'v',
u'\u0474': 'v',
u'\u2D38': 'v',
u'\u13D9': 'v',
u'\u142F': 'v',
u'\uA6DF': 'v',
u'\uA4E6': 'v',
u'\u143B': 'v',
u'\U0001F76C': 'vb',
u'\u2175': 'vi',
u'\u2176': 'vii',
u'\u2177': 'viii',
u'\u2165': 'vl',
u'\u2166': 'vll',
u'\u2167': 'vlll',
u'\U0001D430': 'w',
u'\U0001D464': 'w',
u'\U0001D498': 'w',
u'\U0001D4CC': 'w',
u'\U0001D500': 'w',
u'\U0001D534': 'w',
u'\U0001D568': 'w',
u'\U0001D59C': 'w',
u'\U0001D5D0': 'w',
u'\U0001D604': 'w',
u'\U0001D638': 'w',
u'\U0001D66C': 'w',
u'\U0001D6A0': 'w',
u'\U0001170A': 'w',
u'\U0001170E': 'w',
u'\U0001170F': 'w',
u'\U000118EF': 'w',
u'\U000118E6': 'w',
u'\U0001D416': 'w',
u'\U0001D44A': 'w',
u'\U0001D47E': 'w',
u'\U0001D4B2': 'w',
u'\U0001D4E6': 'w',
u'\U0001D51A': 'w',
u'\U0001D54E': 'w',
u'\U0001D582': 'w',
u'\U0001D5B6': 'w',
u'\U0001D5EA': 'w',
u'\U0001D61E': 'w',
u'\U0001D652': 'w',
u'\U0001D686': 'w',
u'\U000114C5': 'w',
u'\u026F': 'w',
u'\u1D21': 'w',
u'\u0461': 'w',
u'\u051D': 'w',
u'\u0561': 'w',
u'\uAB83': 'w',
u'\u051C': 'w',
u'\u13B3': 'w',
u'\u13D4': 'w',
u'\uA4EA': 'w',
u'\u047D': 'w',
u'\u20A9': 'w',
u'\uA761': 'w',
u'\U0001D431': 'x',
u'\U0001D465': 'x',
u'\U0001D499': 'x',
u'\U0001D4CD': 'x',
u'\U0001D501': 'x',
u'\U0001D535': 'x',
u'\U0001D569': 'x',
u'\U0001D59D': 'x',
u'\U0001D5D1': 'x',
u'\U0001D605': 'x',
u'\U0001D639': 'x',
u'\U0001D66D': 'x',
u'\U0001D6A1': 'x',
u'\U00010322': 'x',
u'\U000118EC': 'x',
u'\U0001D417': 'x',
u'\U0001D44B': 'x',
u'\U0001D47F': 'x',
u'\U0001D4B3': 'x',
u'\U0001D4E7': 'x',
u'\U0001D51B': 'x',
u'\U0001D54F': 'x',
u'\U0001D583': 'x',
u'\U0001D5B7': 'x',
u'\U0001D5EB': 'x',
u'\U0001D61F': 'x',
u'\U0001D653': 'x',
u'\U0001D687': 'x',
u'\U0001D6BE': 'x',
u'\U0001D6F8': 'x',
u'\U0001D732': 'x',
u'\U0001D76C': 'x',
u'\U0001D7A6': 'x',
u'\U00010290': 'x',
u'\U000102B4': 'x',
u'\U00010317': 'x',
u'\U00010527': 'x',
u'\U00010196': 'x',
u'\u166E': 'x',
u'\u00D7': 'x',
u'\u292B': 'x',
u'\u292C': 'x',
u'\u2A2F': 'x',
u'\uFF58': 'x',
u'\u2179': 'x',
u'\u0445': 'x',
u'\u1541': 'x',
u'\u157D': 'x',
u'\u2DEF': 'x',
u'\u036F': 'x',
u'\u166D': 'x',
u'\u2573': 'x',
u'\uFF38': 'x',
u'\u2169': 'x',
u'\uA7B3': 'x',
u'\u03A7': 'x',
u'\u2CAC': 'x',
u'\u0425': 'x',
u'\u2D5D': 'x',
u'\u16B7': 'x',
u'\uA4EB': 'x',
u'\u2A30': 'x',
u'\u04B2': 'x',
u'\u217A': 'xi',
u'\u217B': 'xii',
u'\u216A': 'xl',
u'\u216B': 'xll',
u'\U0001D432': 'y',
u'\U0001D466': 'y',
u'\U0001D49A': 'y',
u'\U0001D4CE': 'y',
u'\U0001D502': 'y',
u'\U0001D536': 'y',
u'\U0001D56A': 'y',
u'\U0001D59E': 'y',
u'\U0001D5D2': 'y',
u'\U0001D606': 'y',
u'\U0001D63A': 'y',
u'\U0001D66E': 'y',
u'\U0001D6A2': 'y',
u'\U0001D6C4': 'y',
u'\U0001D6FE': 'y',
u'\U0001D738': 'y',
u'\U0001D772': 'y',
u'\U0001D7AC': 'y',
u'\U000118DC': 'y',
u'\U0001D418': 'y',
u'\U0001D44C': 'y',
u'\U0001D480': 'y',
u'\U0001D4B4': 'y',
u'\U0001D4E8': 'y',
u'\U0001D51C': 'y',
u'\U0001D550': 'y',
u'\U0001D584': 'y',
u'\U0001D5B8': 'y',
u'\U0001D5EC': 'y',
u'\U0001D620': 'y',
u'\U0001D654': 'y',
u'\U0001D688': 'y',
u'\U0001D6BC': 'y',
u'\U0001D6F6': 'y',
u'\U0001D730': 'y',
u'\U0001D76A': 'y',
u'\U0001D7A4': 'y',
u'\U00016F43': 'y',
u'\U000118A4': 'y',
u'\U000102B2': 'y',
u'\u0263': 'y',
u'\u1D8C': 'y',
u'\uFF59': 'y',
u'\u028F': 'y',
u'\u1EFF': 'y',
u'\uAB5A': 'y',
u'\u03B3': 'y',
u'\u213D': 'y',
u'\u0443': 'y',
u'\u04AF': 'y',
u'\u10E7': 'y',
u'\uFF39': 'y',
u'\u03A5': 'y',
u'\u03D2': 'y',
u'\u2CA8': 'y',
u'\u0423': 'y',
u'\u04AE': 'y',
u'\u13A9': 'y',
u'\u13BD': 'y',
u'\uA4EC': 'y',
u'\u01B4': 'y',
u'\u024F': 'y',
u'\u04B1': 'y',
u'\u00A5': 'y',
u'\u024E': 'y',
u'\u04B0': 'y',
u'\U0001D433': 'z',
u'\U0001D467': 'z',
u'\U0001D49B': 'z',
u'\U0001D4CF': 'z',
u'\U0001D503': 'z',
u'\U0001D537': 'z',
u'\U0001D56B': 'z',
u'\U0001D59F': 'z',
u'\U0001D5D3': 'z',
u'\U0001D607': 'z',
u'\U0001D63B': 'z',
u'\U0001D66F': 'z',
u'\U0001D6A3': 'z',
u'\U000118C4': 'z',
u'\U000102F5': 'z',
u'\U000118E5': 'z',
u'\U0001D419': 'z',
u'\U0001D44D': 'z',
u'\U0001D481': 'z',
u'\U0001D4B5': 'z',
u'\U0001D4E9': 'z',
u'\U0001D585': 'z',
u'\U0001D5B9': 'z',
u'\U0001D5ED': 'z',
u'\U0001D621': 'z',
u'\U0001D655': 'z',
u'\U0001D689': 'z',
u'\U0001D6AD': 'z',
u'\U0001D6E7': 'z',
u'\U0001D721': 'z',
u'\U0001D75B': 'z',
u'\U0001D795': 'z',
u'\U000118A9': 'z',
u'\u1D22': 'z',
u'\uAB93': 'z',
u'\uFF3A': 'z',
u'\u2124': 'z',
u'\u2128': 'z',
u'\u0396': 'z',
u'\u13C3': 'z',
u'\uA4DC': 'z',
u'\u0290': 'z',
u'\u01B6': 'z',
u'\u01B5': 'z',
u'\u0225': 'z',
u'\u0224': 'z',
u'\u1D76': 'z',
u'\u2010': '-',
u'\u2011': '-',
u'\u2012': '-',
u'\u2013': '-',
u'\uFE58': '-',
u'\u06D4': '-',
u'\u2043': '-',
u'\u02D7': '-',
u'\u2212': '-',
u'\u2796': '-',
u'\u2CBA': '-'
}
def unconfuse(domain):
if domain.startswith('xn--'):
domain = domain.encode('idna').decode('idna')
unconfused = ''
for i in range(len(domain)):
if domain[i] in confusables:
unconfused += confusables[domain[i]]
else:
unconfused += domain[i]
return unconfused
| confusables = {u'①': '1', u'➀': '1', u'𝟐': '2', u'𝟚': '2', u'𝟤': '2', u'𝟮': '2', u'𝟸': '2', u'Ꝛ': '2', u'Ƨ': '2', u'Ϩ': '2', u'Ꙅ': '2', u'ᒿ': '2', u'ꛯ': '2', u'②': '2', u'➁': '2', u'ƻ': '2', u'🄃': '2.', u'⒉': '2.', u'𝈆': '3', u'𝟑': '3', u'𝟛': '3', u'𝟥': '3', u'𝟯': '3', u'𝟹': '3', u'𖼻': '3', u'𑣊': '3', u'Ɜ': '3', u'Ȝ': '3', u'Ʒ': '3', u'Ꝫ': '3', u'Ⳍ': '3', u'З': '3', u'Ӡ': '3', u'૩': '3', u'③': '3', u'Ҙ': '3', u'🄄': '3.', u'⒊': '3.', u'𝟒': '4', u'𝟜': '4', u'𝟦': '4', u'𝟰': '4', u'𝟺': '4', u'𑢯': '4', u'Ꮞ': '4', u'④': '4', u'➃': '4', u'ᔰ': '4', u'🄅': '4.', u'⒋': '4.', u'𝟓': '5', u'𝟝': '5', u'𝟧': '5', u'𝟱': '5', u'𝟻': '5', u'𑢻': '5', u'Ƽ': '5', u'⑤': '5', u'➄': '5', u'🄆': '5.', u'⒌': '5.', u'𝟔': '6', u'𝟞': '6', u'𝟨': '6', u'𝟲': '6', u'𝟼': '6', u'𑣕': '6', u'Ⳓ': '6', u'б': '6', u'Ꮾ': '6', u'⑥': '6', u'➅': '6', u'🄇': '6.', u'⒍': '6.', u'𝈒': '7', u'𝟕': '7', u'𝟟': '7', u'𝟩': '7', u'𝟳': '7', u'𝟽': '7', u'𐓒': '7', u'𑣆': '7', u'⑦': '7', u'➆': '7', u'🄈': '7.', u'⒎': '7.', u'𞣋': '8', u'𝟖': '8', u'𝟠': '8', u'𝟪': '8', u'𝟴': '8', u'𝟾': '8', u'𐌚': '8', u'ଃ': '8', u'৪': '8', u'੪': '8', u'ȣ': '8', u'Ȣ': '8', u'⑧': '8', u'➇': '8', u'🄉': '8.', u'⒏': '8.', u'𝟗': '9', u'𝟡': '9', u'𝟤': '9', u'𝟫': '9', u'𝟵': '9', u'𝟿': '9', u'𑣌': '9', u'𑢬': '9', u'𑣖': '9', u'੧': '9', u'୨': '9', u'৭': '9', u'൭': '9', u'Ꝯ': '9', u'Ⳋ': '9', u'१': '9', u'۹': '9', u'⑨': '9', u'➈': '9', u'🄊': '9.', u'⒐': '9.', u'𝐚': 'a', u'𝑎': 'a', u'𝒂': 'a', u'𝒶': 'a', u'𝓪': 'a', u'𝔞': 'a', u'𝕒': 'a', u'𝖆': 'a', u'𝖺': 'a', u'𝗮': 'a', u'𝘢': 'a', u'𝙖': 'a', u'𝚊': 'a', u'𝛂': 'a', u'𝛼': 'a', u'𝜶': 'a', u'𝝰': 'a', u'𝞪': 'a', u'𝐀': 'a', u'𝐴': 'a', u'𝑨': 'a', u'𝒜': 'a', u'𝓐': 'a', u'𝔄': 'a', u'𝔸': 'a', u'𝕬': 'a', u'𝖠': 'a', u'𝗔': 'a', u'𝘈': 'a', u'𝘼': 'a', u'𝙰': 'a', u'𝚨': 'a', u'𝛢': 'a', u'𝜜': 'a', u'𝝖': 'a', u'𝞐': 'a', u'⍺': 'a', u'a': 'a', u'ɑ': 'a', u'α': 'a', u'а': 'a', u'ⷶ': 'a', u'A': 'a', u'Α': 'a', u'А': 'a', u'Ꭺ': 'a', u'ᗅ': 'a', u'ꓮ': 'a', u'⍶': 'a', u'ǎ': 'a', u'ă': 'a', u'Ǎ': 'a', u'Ă': 'a', u'ȧ': 'a', u'å': 'a', u'Ȧ': 'a', u'Å': 'a', u'ẚ': 'a', u'ả': 'a', u'ꭺ': 'a', u'ᴀ': 'a', u'ꜳ': 'aa', u'Ꜳ': 'aa', u'æ': 'ae', u'ӕ': 'ae', u'Æ': 'ae', u'Ӕ': 'ae', u'ꜵ': 'ao', u'Ꜵ': 'ao', u'🜇': 'ar', u'ꜷ': 'au', u'Ꜷ': 'au', u'Ꜹ': 'av', u'ꜹ': 'av', u'Ꜻ': 'av', u'ꜻ': 'av', u'ꜽ': 'ay', u'Ꜽ': 'ay', u'𝐛': 'b', u'𝑏': 'b', u'𝒃': 'b', u'𝒷': 'b', u'𝓫': 'b', u'𝔟': 'b', u'𝕓': 'b', u'𝖇': 'b', u'𝖻': 'b', u'𝗯': 'b', u'𝘣': 'b', u'𝙗': 'b', u'𝚋': 'b', u'𝐁': 'b', u'𝐵': 'b', u'𝑩': 'b', u'𝓑': 'b', u'𝔅': 'b', u'𝔹': 'b', u'𝕭': 'b', u'𝖡': 'b', u'𝗕': 'b', u'𝘉': 'b', u'𝘽': 'b', u'𝙱': 'b', u'𝚩': 'b', u'𝛣': 'b', u'𝜝': 'b', u'𝝗': 'b', u'𝞑': 'b', u'𐊂': 'b', u'𐊡': 'b', u'𐌁': 'b', u'𝛃': 'b', u'𝛽': 'b', u'𝜷': 'b', u'𝝱': 'b', u'𝞫': 'b', u'Ƅ': 'b', u'Ь': 'b', u'Ꮟ': 'b', u'ᖯ': 'b', u'B': 'b', u'ℬ': 'b', u'Ꞵ': 'b', u'Β': 'b', u'В': 'b', u'Ᏼ': 'b', u'ᗷ': 'b', u'ꓐ': 'b', u'ɓ': 'b', u'ƃ': 'b', u'Ƃ': 'b', u'Б': 'b', u'ƀ': 'b', u'ҍ': 'b', u'Ҍ': 'b', u'ѣ': 'b', u'Ѣ': 'b', u'в': 'b', u'ᏼ': 'b', u'ʙ': 'b', u'ꞵ': 'b', u'β': 'b', u'ϐ': 'b', u'Ᏸ': 'b', u'ß': 'b', u'Ы': 'bl', u'𝐜': 'c', u'𝑐': 'c', u'𝒄': 'c', u'𝒸': 'c', u'𝓬': 'c', u'𝔠': 'c', u'𝕔': 'c', u'𝖈': 'c', u'𝖼': 'c', u'𝗰': 'c', u'𝘤': 'c', u'𝙘': 'c', u'𝚌': 'c', u'𐐽': 'c', u'🝌': 'c', u'𑣲': 'c', u'𑣩': 'c', u'𝐂': 'c', u'𝐶': 'c', u'𝑪': 'c', u'𝒞': 'c', u'𝓒': 'c', u'𝕮': 'c', u'𝖢': 'c', u'𝗖': 'c', u'𝘊': 'c', u'𝘾': 'c', u'𝙲': 'c', u'𐊢': 'c', u'𐌂': 'c', u'𐐕': 'c', u'𐔜': 'c', u'c': 'c', u'ⅽ': 'c', u'ᴄ': 'c', u'ϲ': 'c', u'ⲥ': 'c', u'с': 'c', u'ꮯ': 'c', u'ⷭ': 'c', u'C': 'c', u'Ⅽ': 'c', u'ℂ': 'c', u'ℭ': 'c', u'Ϲ': 'c', u'Ⲥ': 'c', u'С': 'c', u'Ꮯ': 'c', u'ꓚ': 'c', u'¢': 'c', u'ȼ': 'c', u'₡': 'c', u'ç': 'c', u'ҫ': 'c', u'Ç': 'c', u'Ҫ': 'c', u'Ƈ': 'c', u'𝐝': 'd', u'𝑑': 'd', u'𝒅': 'd', u'𝒹': 'd', u'𝓭': 'd', u'𝔡': 'd', u'𝕕': 'd', u'𝖉': 'd', u'𝖽': 'd', u'𝗱': 'd', u'𝘥': 'd', u'𝙙': 'd', u'𝚍': 'd', u'𝐃': 'd', u'𝐷': 'd', u'𝑫': 'd', u'𝒟': 'd', u'𝓓': 'd', u'𝔇': 'd', u'𝔻': 'd', u'𝕯': 'd', u'𝖣': 'd', u'𝗗': 'd', u'𝘋': 'd', u'𝘿': 'd', u'𝙳': 'd', u'ⅾ': 'd', u'ⅆ': 'd', u'ԁ': 'd', u'Ꮷ': 'd', u'ᑯ': 'd', u'ꓒ': 'd', u'Ⅾ': 'd', u'ⅅ': 'd', u'Ꭰ': 'd', u'ᗞ': 'd', u'ᗪ': 'd', u'ꓓ': 'd', u'ɗ': 'd', u'ɖ': 'd', u'ƌ': 'd', u'đ': 'd', u'Đ': 'd', u'Ð': 'd', u'Ɖ': 'd', u'₫': 'd', u'ᑻ': 'd', u'ᒇ': 'd', u'ɗ': 'd', u'ɖ': 'd', u'ƌ': 'd', u'đ': 'd', u'Đ': 'd', u'Ð': 'd', u'Ɖ': 'd', u'₫': 'd', u'ᑻ': 'd', u'ᒇ': 'd', u'ꭰ': 'd', u'𝐞': 'e', u'𝑒': 'e', u'𝒆': 'e', u'𝓮': 'e', u'𝔢': 'e', u'𝕖': 'e', u'𝖊': 'e', u'𝖾': 'e', u'𝗲': 'e', u'𝘦': 'e', u'𝙚': 'e', u'𝚎': 'e', u'𝐄': 'e', u'𝐸': 'e', u'𝑬': 'e', u'𝓔': 'e', u'𝔈': 'e', u'𝔼': 'e', u'𝕰': 'e', u'𝖤': 'e', u'𝗘': 'e', u'𝘌': 'e', u'𝙀': 'e', u'𝙴': 'e', u'𝚬': 'e', u'𝛦': 'e', u'𝜠': 'e', u'𝝚': 'e', u'𝞔': 'e', u'𑢦': 'e', u'𑢮': 'e', u'𐊆': 'e', u'𝈡': 'e', u'℮': 'e', u'e': 'e', u'ℯ': 'e', u'ⅇ': 'e', u'ꬲ': 'e', u'е': 'e', u'ҽ': 'e', u'ⷷ': 'e', u'⋿': 'e', u'E': 'e', u'ℰ': 'e', u'Ε': 'e', u'Е': 'e', u'ⴹ': 'e', u'Ꭼ': 'e', u'ꓰ': 'e', u'ě': 'e', u'Ě': 'e', u'ɇ': 'e', u'Ɇ': 'e', u'ҿ': 'e', u'ꭼ': 'e', u'ᴇ': 'e', u'ə': 'e', u'ǝ': 'e', u'ә': 'e', u'ℇ': 'e', u'Ԑ': 'e', u'Ꮛ': 'e', u'𝐟': 'f', u'𝑓': 'f', u'𝒇': 'f', u'𝒻': 'f', u'𝓯': 'f', u'𝔣': 'f', u'𝕗': 'f', u'𝖋': 'f', u'𝖿': 'f', u'𝗳': 'f', u'𝘧': 'f', u'𝙛': 'f', u'𝚏': 'f', u'𝈓': 'f', u'𝐅': 'f', u'𝐹': 'f', u'𝑭': 'f', u'𝓕': 'f', u'𝔉': 'f', u'𝔽': 'f', u'𝕱': 'f', u'𝖥': 'f', u'𝗙': 'f', u'𝘍': 'f', u'𝙁': 'f', u'𝙵': 'f', u'𝟊': 'f', u'𑣂': 'f', u'𑢢': 'f', u'𐊇': 'f', u'𐊥': 'f', u'𐔥': 'f', u'ꬵ': 'f', u'ꞙ': 'f', u'ſ': 'f', u'ẝ': 'f', u'ք': 'f', u'ℱ': 'f', u'Ꞙ': 'f', u'Ϝ': 'f', u'ᖴ': 'f', u'ꓝ': 'f', u'ƒ': 'f', u'Ƒ': 'f', u'ᵮ': 'f', u'ff': 'ff', u'ffi': 'ffi', u'ffl': 'ffl', u'fi': 'fi', u'fl': 'fl', u'ʩ': 'fn', u'𝐠': 'g', u'𝑔': 'g', u'𝒈': 'g', u'𝓰': 'g', u'𝔤': 'g', u'𝕘': 'g', u'𝖌': 'g', u'𝗀': 'g', u'𝗴': 'g', u'𝘨': 'g', u'𝙜': 'g', u'𝚐': 'g', u'𝐆': 'g', u'𝐺': 'g', u'𝑮': 'g', u'𝒢': 'g', u'𝓖': 'g', u'𝔊': 'g', u'𝔾': 'g', u'𝕲': 'g', u'𝖦': 'g', u'𝗚': 'g', u'𝘎': 'g', u'𝙂': 'g', u'𝙶': 'g', u'g': 'g', u'ℊ': 'g', u'ɡ': 'g', u'ᶃ': 'g', u'ƍ': 'g', u'ց': 'g', u'Ԍ': 'g', u'Ꮐ': 'g', u'Ᏻ': 'g', u'ꓖ': 'g', u'ᶢ': 'g', u'ᵍ': 'g', u'ɠ': 'g', u'ǧ': 'g', u'ğ': 'g', u'Ǧ': 'g', u'Ğ': 'g', u'ǵ': 'g', u'ģ': 'g', u'ǥ': 'g', u'Ǥ': 'g', u'Ɠ': 'g', u'ԍ': 'g', u'ꮐ': 'g', u'ᏻ': 'g', u'𝐡': 'h', u'𝒉': 'h', u'𝒽': 'h', u'𝓱': 'h', u'𝔥': 'h', u'𝕙': 'h', u'𝖍': 'h', u'𝗁': 'h', u'𝗵': 'h', u'𝘩': 'h', u'𝙝': 'h', u'𝚑': 'h', u'𝐇': 'h', u'𝐻': 'h', u'𝑯': 'h', u'𝓗': 'h', u'𝕳': 'h', u'𝖧': 'h', u'𝗛': 'h', u'𝘏': 'h', u'𝙃': 'h', u'𝙷': 'h', u'𝚮': 'h', u'𝛨': 'h', u'𝜢': 'h', u'𝝜': 'h', u'𝞖': 'h', u'𐋏': 'h', u'𐆙': 'h', u'h': 'h', u'ℎ': 'h', u'һ': 'h', u'հ': 'h', u'Ꮒ': 'h', u'H': 'h', u'ℋ': 'h', u'ℌ': 'h', u'ℍ': 'h', u'Η': 'h', u'Ⲏ': 'h', u'Н': 'h', u'Ꮋ': 'h', u'ᕼ': 'h', u'ꓧ': 'h', u'ᵸ': 'h', u'ᴴ': 'h', u'ɦ': 'h', u'ꚕ': 'h', u'Ᏺ': 'h', u'Ⱨ': 'h', u'Ң': 'h', u'ħ': 'h', u'ℏ': 'h', u'ћ': 'h', u'Ħ': 'h', u'Ӊ': 'h', u'Ӈ': 'h', u'н': 'h', u'ʜ': 'h', u'ꮋ': 'h', u'ң': 'h', u'ӊ': 'h', u'ӈ': 'h', u'𝐢': 'i', u'𝑖': 'i', u'𝒊': 'i', u'𝒾': 'i', u'𝓲': 'i', u'𝔦': 'i', u'𝕚': 'i', u'𝖎': 'i', u'𝗂': 'i', u'𝗶': 'i', u'𝘪': 'i', u'𝙞': 'i', u'𝚒': 'i', u'𝚤': 'i', u'𝛊': 'i', u'𝜄': 'i', u'𝜾': 'i', u'𝝸': 'i', u'𝞲': 'i', u'𑣃': 'i', u'˛': 'i', u'⍳': 'i', u'i': 'i', u'ⅰ': 'i', u'ℹ': 'i', u'ⅈ': 'i', u'ı': 'i', u'ɪ': 'i', u'ɩ': 'i', u'ι': 'i', u'ι': 'i', u'ͺ': 'i', u'і': 'i', u'ꙇ': 'i', u'ӏ': 'i', u'ꭵ': 'i', u'Ꭵ': 'i', u'ⓛ': 'i', u'⍸': 'i', u'ǐ': 'i', u'Ǐ': 'i', u'ɨ': 'i', u'ᵻ': 'i', u'ᵼ': 'i', u'ⅱ': 'ii', u'ⅲ': 'iii', u'ij': 'ij', u'ⅳ': 'iv', u'ⅸ': 'ix', u'𝐣': 'j', u'𝑗': 'j', u'𝒋': 'j', u'𝒿': 'j', u'𝓳': 'j', u'𝔧': 'j', u'𝕛': 'j', u'𝖏': 'j', u'𝗃': 'j', u'𝗷': 'j', u'𝘫': 'j', u'𝙟': 'j', u'𝚓': 'j', u'𝐉': 'j', u'𝐽': 'j', u'𝑱': 'j', u'𝒥': 'j', u'𝓙': 'j', u'𝔍': 'j', u'𝕁': 'j', u'𝕵': 'j', u'𝖩': 'j', u'𝗝': 'j', u'𝘑': 'j', u'𝙅': 'j', u'𝙹': 'j', u'𝚥': 'j', u'j': 'j', u'ⅉ': 'j', u'ϳ': 'j', u'ј': 'j', u'J': 'j', u'Ʝ': 'j', u'Ϳ': 'j', u'Ј': 'j', u'Ꭻ': 'j', u'ᒍ': 'j', u'ꓙ': 'j', u'ɉ': 'j', u'Ɉ': 'j', u'ᒙ': 'j', u'յ': 'j', u'ꭻ': 'j', u'ᴊ': 'j', u'𝐤': 'k', u'𝑘': 'k', u'𝒌': 'k', u'𝓀': 'k', u'𝓴': 'k', u'𝔨': 'k', u'𝕜': 'k', u'𝖐': 'k', u'𝗄': 'k', u'𝗸': 'k', u'𝘬': 'k', u'𝙠': 'k', u'𝚔': 'k', u'𝐊': 'k', u'𝐾': 'k', u'𝑲': 'k', u'𝒦': 'k', u'𝓚': 'k', u'𝔎': 'k', u'𝕂': 'k', u'𝕶': 'k', u'𝖪': 'k', u'𝗞': 'k', u'𝘒': 'k', u'𝙆': 'k', u'𝙺': 'k', u'𝚱': 'k', u'𝛫': 'k', u'𝜥': 'k', u'𝝟': 'k', u'𝞙': 'k', u'𝛋': 'k', u'𝛞': 'k', u'𝜅': 'k', u'𝜘': 'k', u'𝜿': 'k', u'𝝒': 'k', u'𝝹': 'k', u'𝞌': 'k', u'𝞳': 'k', u'𝟆': 'k', u'K': 'k', u'K': 'k', u'Κ': 'k', u'Ⲕ': 'k', u'К': 'k', u'Ꮶ': 'k', u'ᛕ': 'k', u'ꓗ': 'k', u'ƙ': 'k', u'Ⱪ': 'k', u'Қ': 'k', u'₭': 'k', u'Ꝁ': 'k', u'Ҟ': 'k', u'Ƙ': 'k', u'ᴋ': 'k', u'ĸ': 'k', u'κ': 'k', u'ϰ': 'k', u'ⲕ': 'k', u'к': 'k', u'ꮶ': 'k', u'қ': 'k', u'ҟ': 'k', u'𐌠': 'l', u'𞣇': 'l', u'𝟏': 'l', u'𝟙': 'l', u'𝟣': 'l', u'𝟭': 'l', u'𝟷': 'l', u'𝐈': 'l', u'𝐼': 'l', u'𝑰': 'l', u'𝓘': 'l', u'𝕀': 'l', u'𝕴': 'l', u'𝖨': 'l', u'𝗜': 'l', u'𝘐': 'l', u'𝙄': 'l', u'𝙸': 'l', u'𝐥': 'l', u'𝑙': 'l', u'𝒍': 'l', u'𝓁': 'l', u'𝓵': 'l', u'𝔩': 'l', u'𝕝': 'l', u'𝖑': 'l', u'𝗅': 'l', u'𝗹': 'l', u'𝘭': 'l', u'𝙡': 'l', u'𝚕': 'l', u'𝚰': 'l', u'𝛪': 'l', u'𝜤': 'l', u'𝝞': 'l', u'𝞘': 'l', u'𞸀': 'l', u'𞺀': 'l', u'𖼨': 'l', u'𐊊': 'l', u'𐌉': 'l', u'𝈪': 'l', u'𝐋': 'l', u'𝐿': 'l', u'𝑳': 'l', u'𝓛': 'l', u'𝔏': 'l', u'𝕃': 'l', u'𝕷': 'l', u'𝖫': 'l', u'𝗟': 'l', u'𝘓': 'l', u'𝙇': 'l', u'𝙻': 'l', u'𖼖': 'l', u'𑢣': 'l', u'𑢲': 'l', u'𐐛': 'l', u'𐔦': 'l', u'𐑃': 'l', u'׀': 'l', u'|': 'l', u'∣': 'l', u'⏽': 'l', u'│': 'l', u'1': 'l', u'١': 'l', u'۱': 'l', u'I': 'l', u'I': 'l', u'Ⅰ': 'l', u'ℐ': 'l', u'ℑ': 'l', u'Ɩ': 'l', u'l': 'l', u'ⅼ': 'l', u'ℓ': 'l', u'ǀ': 'l', u'Ι': 'l', u'Ⲓ': 'l', u'І': 'l', u'Ӏ': 'l', u'ו': 'l', u'ן': 'l', u'ا': 'l', u'ﺎ': 'l', u'ﺍ': 'l', u'ߊ': 'l', u'ⵏ': 'l', u'ᛁ': 'l', u'ꓲ': 'l', u'Ⅼ': 'l', u'ℒ': 'l', u'Ⳑ': 'l', u'Ꮮ': 'l', u'ᒪ': 'l', u'ꓡ': 'l', u'ﴼ': 'l', u'ﴽ': 'l', u'ł': 'l', u'Ł': 'l', u'ɭ': 'l', u'Ɨ': 'l', u'ƚ': 'l', u'ɫ': 'l', u'إ': 'l', u'ﺈ': 'l', u'ﺇ': 'l', u'ٳ': 'l', u'ŀ': 'l', u'Ŀ': 'l', u'ᒷ': 'l', u'أ': 'l', u'ﺄ': 'l', u'ﺃ': 'l', u'ٲ': 'l', u'ٵ': 'l', u'ⳑ': 'l', u'ꮮ': 'l', u'🄂': 'l.', u'⒈': 'l.', u'lj': 'lj', u'IJ': 'lj', u'Lj': 'lj', u'LJ': 'lj', u'‖': 'll', u'∥': 'll', u'Ⅱ': 'll', u'ǁ': 'll', u'װ': 'll', u'Ⅲ': 'lll', u'ʪ': 'ls', u'₶': 'lt', u'Ⅳ': 'lv', u'Ⅸ': 'lx', u'ʫ': 'lz', u'𝐌': 'm', u'𝑀': 'm', u'𝑴': 'm', u'𝓜': 'm', u'𝔐': 'm', u'𝕄': 'm', u'𝕸': 'm', u'𝖬': 'm', u'𝗠': 'm', u'𝘔': 'm', u'𝙈': 'm', u'𝙼': 'm', u'𝚳': 'm', u'𝛭': 'm', u'𝜧': 'm', u'𝝡': 'm', u'𝞛': 'm', u'𐊰': 'm', u'𐌑': 'm', u'M': 'm', u'Ⅿ': 'm', u'ℳ': 'm', u'Μ': 'm', u'Ϻ': 'm', u'Ⲙ': 'm', u'М': 'm', u'Ꮇ': 'm', u'ᗰ': 'm', u'ᛖ': 'm', u'ꓟ': 'm', u'Ӎ': 'm', u'ⷨ': 'm', u'ᷟ': 'm', u'ṃ': 'm', u'🝫': 'mb', u'𝐧': 'n', u'𝑛': 'n', u'𝒏': 'n', u'𝓃': 'n', u'𝓷': 'n', u'𝔫': 'n', u'𝕟': 'n', u'𝖓': 'n', u'𝗇': 'n', u'𝗻': 'n', u'𝘯': 'n', u'𝙣': 'n', u'𝚗': 'n', u'𝐍': 'n', u'𝑁': 'n', u'𝑵': 'n', u'𝒩': 'n', u'𝓝': 'n', u'𝔑': 'n', u'𝕹': 'n', u'𝖭': 'n', u'𝗡': 'n', u'𝘕': 'n', u'𝙉': 'n', u'𝙽': 'n', u'𝚴': 'n', u'𝛮': 'n', u'𝜨': 'n', u'𝝢': 'n', u'𝞜': 'n', u'𐔓': 'n', u'𐆎': 'n', u'𝛈': 'n', u'𝜂': 'n', u'𝜼': 'n', u'𝝶': 'n', u'𝞰': 'n', u'𐑍': 'n', u'ո': 'n', u'ռ': 'n', u'N': 'n', u'ℕ': 'n', u'Ν': 'n', u'Ⲛ': 'n', u'ꓠ': 'n', u'ɳ': 'n', u'ƞ': 'n', u'η': 'n', u'Ɲ': 'n', u'ᵰ': 'n', u'ņ': 'n', u'ɲ': 'n', u'nj': 'nj', u'Nj': 'nj', u'NJ': 'nj', u'№': 'no', u'𝐨': 'o', u'𝑜': 'o', u'𝒐': 'o', u'𝓸': 'o', u'𝔬': 'o', u'𝕠': 'o', u'𝖔': 'o', u'𝗈': 'o', u'𝗼': 'o', u'𝘰': 'o', u'𝙤': 'o', u'𝚘': 'o', u'𝛐': 'o', u'𝜊': 'o', u'𝝄': 'o', u'𝝾': 'o', u'𝞸': 'o', u'𝛔': 'o', u'𝜎': 'o', u'𝝈': 'o', u'𝞂': 'o', u'𝞼': 'o', u'𞸤': 'o', u'𞹤': 'o', u'𞺄': 'o', u'𐓪': 'o', u'𑣈': 'o', u'𑣗': 'o', u'𐐬': 'o', u'𑓐': 'o', u'𑣠': 'o', u'𝟎': 'o', u'𝟘': 'o', u'𝟢': 'o', u'𝟬': 'o', u'𝟶': 'o', u'𝐎': 'o', u'𝑂': 'o', u'𝑶': 'o', u'𝒪': 'o', u'𝓞': 'o', u'𝔒': 'o', u'𝕆': 'o', u'𝕺': 'o', u'𝖮': 'o', u'𝗢': 'o', u'𝘖': 'o', u'𝙊': 'o', u'𝙾': 'o', u'𝚶': 'o', u'𝛰': 'o', u'𝜪': 'o', u'𝝤': 'o', u'𝞞': 'o', u'𐓂': 'o', u'𑢵': 'o', u'𐊒': 'o', u'𐊫': 'o', u'𐐄': 'o', u'𐔖': 'o', u'𝈚': 'o', u'🜔': 'o', u'𝛉': 'o', u'𝛝': 'o', u'𝜃': 'o', u'𝜗': 'o', u'𝜽': 'o', u'𝝑': 'o', u'𝝷': 'o', u'𝞋': 'o', u'𝞱': 'o', u'𝟅': 'o', u'𝚯': 'o', u'𝚹': 'o', u'𝛩': 'o', u'𝛳': 'o', u'𝜣': 'o', u'𝜭': 'o', u'𝝝': 'o', u'𝝧': 'o', u'𝞗': 'o', u'𝞡': 'o', u'🄁': 'o', u'🄀': 'o', u'ం': 'o', u'ಂ': 'o', u'ം': 'o', u'ං': 'o', u'०': 'o', u'੦': 'o', u'૦': 'o', u'௦': 'o', u'౦': 'o', u'೦': 'o', u'൦': 'o', u'๐': 'o', u'໐': 'o', u'၀': 'o', u'٥': 'o', u'۵': 'o', u'o': 'o', u'ℴ': 'o', u'ᴏ': 'o', u'ᴑ': 'o', u'ꬽ': 'o', u'ο': 'o', u'σ': 'o', u'ⲟ': 'o', u'о': 'o', u'ჿ': 'o', u'օ': 'o', u'ס': 'o', u'ه': 'o', u'ﻫ': 'o', u'ﻬ': 'o', u'ﻪ': 'o', u'ﻩ': 'o', u'ھ': 'o', u'ﮬ': 'o', u'ﮭ': 'o', u'ﮫ': 'o', u'ﮪ': 'o', u'ہ': 'o', u'ﮨ': 'o', u'ﮩ': 'o', u'ﮧ': 'o', u'ﮦ': 'o', u'ە': 'o', u'ഠ': 'o', u'ဝ': 'o', u'߀': 'o', u'০': 'o', u'୦': 'o', u'〇': 'o', u'O': 'o', u'Ο': 'o', u'Ⲟ': 'o', u'О': 'o', u'Օ': 'o', u'ⵔ': 'o', u'ዐ': 'o', u'ଠ': 'o', u'ꓳ': 'o', u'⁰': 'o', u'º': 'o', u'ᵒ': 'o', u'ǒ': 'o', u'ŏ': 'o', u'Ǒ': 'o', u'Ŏ': 'o', u'ۿ': 'o', u'ø': 'o', u'ꬾ': 'o', u'Ø': 'o', u'ⵁ': 'o', u'Ǿ': 'o', u'ɵ': 'o', u'ꝋ': 'o', u'ө': 'o', u'ѳ': 'o', u'ꮎ': 'o', u'ꮻ': 'o', u'⊖': 'o', u'⊝': 'o', u'⍬': 'o', u'Ɵ': 'o', u'Ꝋ': 'o', u'θ': 'o', u'ϑ': 'o', u'Θ': 'o', u'ϴ': 'o', u'Ө': 'o', u'Ѳ': 'o', u'ⴱ': 'o', u'Ꮎ': 'o', u'Ꮻ': 'o', u'ꭴ': 'o', u'ﳙ': 'o', u'ơ': 'o', u'Ơ': 'o', u'Ꭴ': 'o', u'🄁': 'o.', u'🄀': 'o.', u'œ': 'oe', u'Œ': 'oe', u'ɶ': 'oe', u'∞': 'oo', u'ꝏ': 'oo', u'ꚙ': 'oo', u'Ꝏ': 'oo', u'Ꚙ': 'oo', u'တ': 'oo', u'𝐩': 'p', u'𝑝': 'p', u'𝒑': 'p', u'𝓅': 'p', u'𝓹': 'p', u'𝔭': 'p', u'𝕡': 'p', u'𝖕': 'p', u'𝗉': 'p', u'𝗽': 'p', u'𝘱': 'p', u'𝙥': 'p', u'𝚙': 'p', u'𝛒': 'p', u'𝛠': 'p', u'𝜌': 'p', u'𝜚': 'p', u'𝝆': 'p', u'𝝔': 'p', u'𝞀': 'p', u'𝞎': 'p', u'𝞺': 'p', u'𝟈': 'p', u'𝐏': 'p', u'𝑃': 'p', u'𝑷': 'p', u'𝒫': 'p', u'𝓟': 'p', u'𝔓': 'p', u'𝕻': 'p', u'𝖯': 'p', u'𝗣': 'p', u'𝘗': 'p', u'𝙋': 'p', u'𝙿': 'p', u'𝚸': 'p', u'𝛲': 'p', u'𝜬': 'p', u'𝝦': 'p', u'𝞠': 'p', u'𐊕': 'p', u'⍴': 'p', u'p': 'p', u'ρ': 'p', u'ϱ': 'p', u'ⲣ': 'p', u'р': 'p', u'P': 'p', u'ℙ': 'p', u'Ρ': 'p', u'Ⲣ': 'p', u'Р': 'p', u'Ꮲ': 'p', u'ᑭ': 'p', u'ꓑ': 'p', u'ƥ': 'p', u'ᵽ': 'p', u'ᑷ': 'p', u'ᒆ': 'p', u'ᴩ': 'p', u'ꮲ': 'p', u'𝐪': 'q', u'𝑞': 'q', u'𝒒': 'q', u'𝓆': 'q', u'𝓺': 'q', u'𝔮': 'q', u'𝕢': 'q', u'𝖖': 'q', u'𝗊': 'q', u'𝗾': 'q', u'𝘲': 'q', u'𝙦': 'q', u'𝚚': 'q', u'𝐐': 'q', u'𝑄': 'q', u'𝑸': 'q', u'𝒬': 'q', u'𝓠': 'q', u'𝔔': 'q', u'𝕼': 'q', u'𝖰': 'q', u'𝗤': 'q', u'𝘘': 'q', u'𝙌': 'q', u'𝚀': 'q', u'ԛ': 'q', u'գ': 'q', u'զ': 'q', u'ℚ': 'q', u'ⵕ': 'q', u'ʠ': 'q', u'ᶐ': 'q', u'ɋ': 'q', u'𝐫': 'r', u'𝑟': 'r', u'𝒓': 'r', u'𝓇': 'r', u'𝓻': 'r', u'𝔯': 'r', u'𝕣': 'r', u'𝖗': 'r', u'𝗋': 'r', u'𝗿': 'r', u'𝘳': 'r', u'𝙧': 'r', u'𝚛': 'r', u'𝈖': 'r', u'𝐑': 'r', u'𝑅': 'r', u'𝑹': 'r', u'𝓡': 'r', u'𝕽': 'r', u'𝖱': 'r', u'𝗥': 'r', u'𝘙': 'r', u'𝙍': 'r', u'𝚁': 'r', u'𐒴': 'r', u'ꭇ': 'r', u'ꭈ': 'r', u'ᴦ': 'r', u'ⲅ': 'r', u'г': 'r', u'ꮁ': 'r', u'ℛ': 'r', u'ℜ': 'r', u'ℝ': 'r', u'Ʀ': 'r', u'Ꭱ': 'r', u'Ꮢ': 'r', u'ᖇ': 'r', u'ꓣ': 'r', u'ɽ': 'r', u'ɼ': 'r', u'ɍ': 'r', u'ғ': 'r', u'ᵲ': 'r', u'ґ': 'r', u'ꭱ': 'r', u'ʀ': 'r', u'ꮢ': 'r', u'ᵳ': 'r', u'𑣣': 'rn', u'𝐦': 'rn', u'𝑚': 'rn', u'𝒎': 'rn', u'𝓂': 'rn', u'𝓶': 'rn', u'𝔪': 'rn', u'𝕞': 'rn', u'𝖒': 'rn', u'𝗆': 'rn', u'𝗺': 'rn', u'𝘮': 'rn', u'𝙢': 'rn', u'𝚖': 'rn', u'𑜀': 'rn', u'ⅿ': 'rn', u'₥': 'rn', u'ɱ': 'rn', u'ᵯ': 'rn', u'𝐬': 's', u'𝑠': 's', u'𝒔': 's', u'𝓈': 's', u'𝓼': 's', u'𝔰': 's', u'𝕤': 's', u'𝖘': 's', u'𝗌': 's', u'𝘀': 's', u'𝘴': 's', u'𝙨': 's', u'𝚜': 's', u'𑣁': 's', u'𐑈': 's', u'𝐒': 's', u'𝑆': 's', u'𝑺': 's', u'𝒮': 's', u'𝓢': 's', u'𝔖': 's', u'𝕊': 's', u'𝕾': 's', u'𝖲': 's', u'𝗦': 's', u'𝘚': 's', u'𝙎': 's', u'𝚂': 's', u'𖼺': 's', u'𐊖': 's', u'𐐠': 's', u's': 's', u'ꜱ': 's', u'ƽ': 's', u'ѕ': 's', u'ꮪ': 's', u'S': 's', u'Ѕ': 's', u'Տ': 's', u'Ꮥ': 's', u'Ꮪ': 's', u'ꓢ': 's', u'ʂ': 's', u'ᵴ': 's', u'🝜': 'sss', u'st': 'st', u'𝐭': 't', u'𝑡': 't', u'𝒕': 't', u'𝓉': 't', u'𝓽': 't', u'𝔱': 't', u'𝕥': 't', u'𝖙': 't', u'𝗍': 't', u'𝘁': 't', u'𝘵': 't', u'𝙩': 't', u'𝚝': 't', u'🝨': 't', u'𝐓': 't', u'𝑇': 't', u'𝑻': 't', u'𝒯': 't', u'𝓣': 't', u'𝔗': 't', u'𝕋': 't', u'𝕿': 't', u'𝖳': 't', u'𝗧': 't', u'𝘛': 't', u'𝙏': 't', u'𝚃': 't', u'𝚻': 't', u'𝛵': 't', u'𝜯': 't', u'𝝩': 't', u'𝞣': 't', u'𖼊': 't', u'𑢼': 't', u'𐊗': 't', u'𐊱': 't', u'𐌕': 't', u'𝛕': 't', u'𝜏': 't', u'𝝉': 't', u'𝞃': 't', u'𝞽': 't', u'⊤': 't', u'⟙': 't', u'T': 't', u'Τ': 't', u'Ⲧ': 't', u'Т': 't', u'Ꭲ': 't', u'ꓔ': 't', u'⍡': 't', u'Ⱦ': 't', u'Ț': 't', u'Ţ': 't', u'Ʈ': 't', u'Ҭ': 't', u'₮': 't', u'ŧ': 't', u'Ŧ': 't', u'ᵵ': 't', u'𝐮': 'u', u'𝑢': 'u', u'𝒖': 'u', u'𝓊': 'u', u'𝓾': 'u', u'𝔲': 'u', u'𝕦': 'u', u'𝖚': 'u', u'𝗎': 'u', u'𝘂': 'u', u'𝘶': 'u', u'𝙪': 'u', u'𝚞': 'u', u'𝛖': 'u', u'𝜐': 'u', u'𝝊': 'u', u'𝞄': 'u', u'𝞾': 'u', u'𐓶': 'u', u'𑣘': 'u', u'𝐔': 'u', u'𝑈': 'u', u'𝑼': 'u', u'𝒰': 'u', u'𝓤': 'u', u'𝔘': 'u', u'𝕌': 'u', u'𝖀': 'u', u'𝖴': 'u', u'𝗨': 'u', u'𝘜': 'u', u'𝙐': 'u', u'𝚄': 'u', u'𐓎': 'u', u'𖽂': 'u', u'𑢸': 'u', u'ꞟ': 'u', u'ᴜ': 'u', u'ꭎ': 'u', u'ꭒ': 'u', u'ʋ': 'u', u'υ': 'u', u'ս': 'u', u'∪': 'u', u'⋃': 'u', u'Ս': 'u', u'ሀ': 'u', u'ᑌ': 'u', u'ꓴ': 'u', u'ǔ': 'u', u'Ǔ': 'u', u'ᵾ': 'u', u'ꮜ': 'u', u'Ʉ': 'u', u'Ꮜ': 'u', u'ᑘ': 'u', u'ᑧ': 'u', u'℧': 'u', u'ᘮ': 'u', u'ᘴ': 'u', u'Ʊ': 'u', u'ᵿ': 'u', u'ᵫ': 'ue', u'ꭣ': 'uo', u'𝐯': 'v', u'𝑣': 'v', u'𝒗': 'v', u'𝓋': 'v', u'𝓿': 'v', u'𝔳': 'v', u'𝕧': 'v', u'𝖛': 'v', u'𝗏': 'v', u'𝘃': 'v', u'𝘷': 'v', u'𝙫': 'v', u'𝚟': 'v', u'𝛎': 'v', u'𝜈': 'v', u'𝝂': 'v', u'𝝼': 'v', u'𝞶': 'v', u'𑜆': 'v', u'𑣀': 'v', u'𝈍': 'v', u'𝐕': 'v', u'𝑉': 'v', u'𝑽': 'v', u'𝒱': 'v', u'𝓥': 'v', u'𝔙': 'v', u'𝕍': 'v', u'𝖁': 'v', u'𝖵': 'v', u'𝗩': 'v', u'𝘝': 'v', u'𝙑': 'v', u'𝚅': 'v', u'𖼈': 'v', u'𑢠': 'v', u'𐔝': 'v', u'𐆗': 'v', u'🜈': 'v', u'∨': 'v', u'⋁': 'v', u'v': 'v', u'ⅴ': 'v', u'ᴠ': 'v', u'ν': 'v', u'ѵ': 'v', u'ט': 'v', u'ꮩ': 'v', u'٧': 'v', u'۷': 'v', u'Ⅴ': 'v', u'Ѵ': 'v', u'ⴸ': 'v', u'Ꮩ': 'v', u'ᐯ': 'v', u'ꛟ': 'v', u'ꓦ': 'v', u'ᐻ': 'v', u'🝬': 'vb', u'ⅵ': 'vi', u'ⅶ': 'vii', u'ⅷ': 'viii', u'Ⅵ': 'vl', u'Ⅶ': 'vll', u'Ⅷ': 'vlll', u'𝐰': 'w', u'𝑤': 'w', u'𝒘': 'w', u'𝓌': 'w', u'𝔀': 'w', u'𝔴': 'w', u'𝕨': 'w', u'𝖜': 'w', u'𝗐': 'w', u'𝘄': 'w', u'𝘸': 'w', u'𝙬': 'w', u'𝚠': 'w', u'𑜊': 'w', u'𑜎': 'w', u'𑜏': 'w', u'𑣯': 'w', u'𑣦': 'w', u'𝐖': 'w', u'𝑊': 'w', u'𝑾': 'w', u'𝒲': 'w', u'𝓦': 'w', u'𝔚': 'w', u'𝕎': 'w', u'𝖂': 'w', u'𝖶': 'w', u'𝗪': 'w', u'𝘞': 'w', u'𝙒': 'w', u'𝚆': 'w', u'𑓅': 'w', u'ɯ': 'w', u'ᴡ': 'w', u'ѡ': 'w', u'ԝ': 'w', u'ա': 'w', u'ꮃ': 'w', u'Ԝ': 'w', u'Ꮃ': 'w', u'Ꮤ': 'w', u'ꓪ': 'w', u'ѽ': 'w', u'₩': 'w', u'ꝡ': 'w', u'𝐱': 'x', u'𝑥': 'x', u'𝒙': 'x', u'𝓍': 'x', u'𝔁': 'x', u'𝔵': 'x', u'𝕩': 'x', u'𝖝': 'x', u'𝗑': 'x', u'𝘅': 'x', u'𝘹': 'x', u'𝙭': 'x', u'𝚡': 'x', u'𐌢': 'x', u'𑣬': 'x', u'𝐗': 'x', u'𝑋': 'x', u'𝑿': 'x', u'𝒳': 'x', u'𝓧': 'x', u'𝔛': 'x', u'𝕏': 'x', u'𝖃': 'x', u'𝖷': 'x', u'𝗫': 'x', u'𝘟': 'x', u'𝙓': 'x', u'𝚇': 'x', u'𝚾': 'x', u'𝛸': 'x', u'𝜲': 'x', u'𝝬': 'x', u'𝞦': 'x', u'𐊐': 'x', u'𐊴': 'x', u'𐌗': 'x', u'𐔧': 'x', u'𐆖': 'x', u'᙮': 'x', u'×': 'x', u'⤫': 'x', u'⤬': 'x', u'⨯': 'x', u'x': 'x', u'ⅹ': 'x', u'х': 'x', u'ᕁ': 'x', u'ᕽ': 'x', u'ⷯ': 'x', u'ͯ': 'x', u'᙭': 'x', u'╳': 'x', u'X': 'x', u'Ⅹ': 'x', u'Ꭓ': 'x', u'Χ': 'x', u'Ⲭ': 'x', u'Х': 'x', u'ⵝ': 'x', u'ᚷ': 'x', u'ꓫ': 'x', u'⨰': 'x', u'Ҳ': 'x', u'ⅺ': 'xi', u'ⅻ': 'xii', u'Ⅺ': 'xl', u'Ⅻ': 'xll', u'𝐲': 'y', u'𝑦': 'y', u'𝒚': 'y', u'𝓎': 'y', u'𝔂': 'y', u'𝔶': 'y', u'𝕪': 'y', u'𝖞': 'y', u'𝗒': 'y', u'𝘆': 'y', u'𝘺': 'y', u'𝙮': 'y', u'𝚢': 'y', u'𝛄': 'y', u'𝛾': 'y', u'𝜸': 'y', u'𝝲': 'y', u'𝞬': 'y', u'𑣜': 'y', u'𝐘': 'y', u'𝑌': 'y', u'𝒀': 'y', u'𝒴': 'y', u'𝓨': 'y', u'𝔜': 'y', u'𝕐': 'y', u'𝖄': 'y', u'𝖸': 'y', u'𝗬': 'y', u'𝘠': 'y', u'𝙔': 'y', u'𝚈': 'y', u'𝚼': 'y', u'𝛶': 'y', u'𝜰': 'y', u'𝝪': 'y', u'𝞤': 'y', u'𖽃': 'y', u'𑢤': 'y', u'𐊲': 'y', u'ɣ': 'y', u'ᶌ': 'y', u'y': 'y', u'ʏ': 'y', u'ỿ': 'y', u'ꭚ': 'y', u'γ': 'y', u'ℽ': 'y', u'у': 'y', u'ү': 'y', u'ყ': 'y', u'Y': 'y', u'Υ': 'y', u'ϒ': 'y', u'Ⲩ': 'y', u'У': 'y', u'Ү': 'y', u'Ꭹ': 'y', u'Ꮍ': 'y', u'ꓬ': 'y', u'ƴ': 'y', u'ɏ': 'y', u'ұ': 'y', u'¥': 'y', u'Ɏ': 'y', u'Ұ': 'y', u'𝐳': 'z', u'𝑧': 'z', u'𝒛': 'z', u'𝓏': 'z', u'𝔃': 'z', u'𝔷': 'z', u'𝕫': 'z', u'𝖟': 'z', u'𝗓': 'z', u'𝘇': 'z', u'𝘻': 'z', u'𝙯': 'z', u'𝚣': 'z', u'𑣄': 'z', u'𐋵': 'z', u'𑣥': 'z', u'𝐙': 'z', u'𝑍': 'z', u'𝒁': 'z', u'𝒵': 'z', u'𝓩': 'z', u'𝖅': 'z', u'𝖹': 'z', u'𝗭': 'z', u'𝘡': 'z', u'𝙕': 'z', u'𝚉': 'z', u'𝚭': 'z', u'𝛧': 'z', u'𝜡': 'z', u'𝝛': 'z', u'𝞕': 'z', u'𑢩': 'z', u'ᴢ': 'z', u'ꮓ': 'z', u'Z': 'z', u'ℤ': 'z', u'ℨ': 'z', u'Ζ': 'z', u'Ꮓ': 'z', u'ꓜ': 'z', u'ʐ': 'z', u'ƶ': 'z', u'Ƶ': 'z', u'ȥ': 'z', u'Ȥ': 'z', u'ᵶ': 'z', u'‐': '-', u'‑': '-', u'‒': '-', u'–': '-', u'﹘': '-', u'۔': '-', u'⁃': '-', u'˗': '-', u'−': '-', u'➖': '-', u'Ⲻ': '-'}
def unconfuse(domain):
if domain.startswith('xn--'):
domain = domain.encode('idna').decode('idna')
unconfused = ''
for i in range(len(domain)):
if domain[i] in confusables:
unconfused += confusables[domain[i]]
else:
unconfused += domain[i]
return unconfused |
'''
All tests for the Osscie Package
'''
def test_1():
'''
Sample Test
'''
assert True
| """
All tests for the Osscie Package
"""
def test_1():
"""
Sample Test
"""
assert True |
# built_ins.py
#
# https://www.educative.io/module/lesson/advanced-concepts-in-python/qZ4ZVVDN6kp
# map
"""
The map built-in also takes a function and an iterable and return an iterator that applies the function to each item in the iterable
"""
def doubler(x):
return x * 2
my_list = [1, 2, 3, 4, 5]
for item in map(doubler, my_list):
print(item)
| """
The map built-in also takes a function and an iterable and return an iterator that applies the function to each item in the iterable
"""
def doubler(x):
return x * 2
my_list = [1, 2, 3, 4, 5]
for item in map(doubler, my_list):
print(item) |
config = dict(
# Project settings
project_name='MoA_feature_selection',
batch_size=1024,
num_workers=4,
# Validation
n_folds=5,
# Preprocessing
outlier_removal=True, # TODO
# General training
# Ensemble of models
ensemble=[
dict(
# Model
type='Target',
# Feature selection
n_features=20,
n_cutoff=20, # number of instances required, otherwise set prediction to 0
model=dict(
model='MoaDenseNet',
n_hidden_layer=2,
dropout=0.5,
hidden_dim=32,
activation='prelu', # prelu, relu
normalization='batch',
# Training
batch_size=512,
num_workers=4,
n_epochs=25,
optimizer='adam',
learning_rate=0.001,
weight_decay=0.00001,
scheduler='OneCycleLR',
use_smart_init=True,
use_smote=False,
use_amp=False,
verbose=True,
# Augmentation
augmentations=[],
)
),
],
# Ensembling
ensemble_method='mean', # TODO
# Postprocessing
surety=True, # TODO
)
| config = dict(project_name='MoA_feature_selection', batch_size=1024, num_workers=4, n_folds=5, outlier_removal=True, ensemble=[dict(type='Target', n_features=20, n_cutoff=20, model=dict(model='MoaDenseNet', n_hidden_layer=2, dropout=0.5, hidden_dim=32, activation='prelu', normalization='batch', batch_size=512, num_workers=4, n_epochs=25, optimizer='adam', learning_rate=0.001, weight_decay=1e-05, scheduler='OneCycleLR', use_smart_init=True, use_smote=False, use_amp=False, verbose=True, augmentations=[]))], ensemble_method='mean', surety=True) |
class Par(object):
def __init__(self,tokens):
self.tokens=tokens
def parse(self):
self.count = 0
while self.count < len(self.tokens):
tokens_type = self.tokens[self.count][0]
tokens_value = self.tokens[self.count][1]
#print(tokens_type , tokens_value)
if tokens_type == 'VARIABLE' and tokens_value == 'var':
self.par_var_dec(self.tokens[self.count:len(self.tokens)])
ask = (self.assignmentOpp(self.tokens[self.count:len(self.tokens)]))
elif tokens_type == 'IDENTIFIRE' and tokens_value == 'showme':
self.showme(self.tokens[self.count:len(self.tokens)],ask)
elif tokens_type == 'INOUT' and tokens_value == '~':
self.add(self.tokens[self.count:len(self.tokens)],ask)
self.count += 1
def par_var_dec(self ,token_tip ):
token_chk = 0
for token in range(0,len(token_tip)+1):
tokens_type = token_tip[token_chk][0]
tokens_value = token_tip[token_chk][1]
il=[]
for i in range(1,len(token_tip)+1,4):
il.append(i)
ol=[]
for j in range(2,len(token_tip)+1,4):
ol.append(j)
vl=[]
for h in range(3,len(token_tip)+1,4):
vl.append(h)
cl=[]
for k in range(4,len(token_tip)+1,4):
cl.append(k)
if tokens_type == 'STATEMENT_END':
break
elif token in il:
if tokens_type == "IDENTIFIRE":
identifire = tokens_value
else :
print("Syntax ERROR : you must give a variable name after variable decliaration")
break
elif token in ol:#2 or token == 4 or token == 6 or token == 8:
if tokens_type == "OPARETOR":
tok =1
else :
print("Syntax ERROR :you miss the assignment operator after VARIABLE name")
break
elif token in vl:#== 3 or token == 5 or token == 7 or token == 9:
if tokens_type == 'STRING':
strg = tokens_value
elif tokens_type == 'INTEGER':
initalization =1
else :
print("Syntax ERROR : IT CAN BE A INTEGER, STRING OR IDEMTIFIRE I.E. variable")
break
elif token in cl:
if tokens_type == 'COMMA':
comma = tokens_value
elif tokens_type == "STATEMENT_END":
break
else :
print("Syntax ERROR : in this position you can used comma for multiple decliaration or u can used assignment operator for initalization")
break
token_chk = token_chk + 1
def showme(self,token_tip,toko):
if token_tip[1][0] == "INOUT" :
if token_tip[2][0] == "STRING":
print(token_tip[2][1])
elif token_tip[3][0]=="EMPTY":
print("Statement MISSING : you have to give '.' for debag")
else:
print("Syntax ERROR : you have to type string within parentisis or you have to give output operator")
token_chk = 1
for i in range(0 ,len(toko)):
tokens_id=toko[i][0]
tokens_val=toko[i][1]
if token_tip[1][0] == "INOUT" and token_tip[2][1] == tokens_id and token_tip[3][0] == 'STATEMENT_END':
print(tokens_val)
def assignmentOpp(self,token_tip):
toko = []
token_chk = 1
for i in range(0 ,len(toko)):
tokens_id=toko[i][0]
tokens_val=toko[i][1]
for token in range(0,len(token_tip)):
if token_tip[token][1]== '=':
#token_tip[token-1][1] = token_tip[token+1][1]
toko.append([token_tip[token-1][1],token_tip[token +1][1]])
return (toko)
def add(self,token_tip,toko):
print(toko)
if token_tip[0][0] == 'INOUT' and token_tip[1][0] == 'IDENTIFIRE' and token_tip[2][1] == "=" and token_tip[3][0] == toko[i][0] and token_tip[i+2][0] == toko[i+6][0] and token_tip[6][0] == "STATEMENT_END":
for i in range(0,len(toko)):
if toko[i][0] == token_tip[1][1]:
print(i)
#if token_tip[4][1] == "+":
#toko[token_tip[1][0]]
#return (tok)
| class Par(object):
def __init__(self, tokens):
self.tokens = tokens
def parse(self):
self.count = 0
while self.count < len(self.tokens):
tokens_type = self.tokens[self.count][0]
tokens_value = self.tokens[self.count][1]
if tokens_type == 'VARIABLE' and tokens_value == 'var':
self.par_var_dec(self.tokens[self.count:len(self.tokens)])
ask = self.assignmentOpp(self.tokens[self.count:len(self.tokens)])
elif tokens_type == 'IDENTIFIRE' and tokens_value == 'showme':
self.showme(self.tokens[self.count:len(self.tokens)], ask)
elif tokens_type == 'INOUT' and tokens_value == '~':
self.add(self.tokens[self.count:len(self.tokens)], ask)
self.count += 1
def par_var_dec(self, token_tip):
token_chk = 0
for token in range(0, len(token_tip) + 1):
tokens_type = token_tip[token_chk][0]
tokens_value = token_tip[token_chk][1]
il = []
for i in range(1, len(token_tip) + 1, 4):
il.append(i)
ol = []
for j in range(2, len(token_tip) + 1, 4):
ol.append(j)
vl = []
for h in range(3, len(token_tip) + 1, 4):
vl.append(h)
cl = []
for k in range(4, len(token_tip) + 1, 4):
cl.append(k)
if tokens_type == 'STATEMENT_END':
break
elif token in il:
if tokens_type == 'IDENTIFIRE':
identifire = tokens_value
else:
print('Syntax ERROR : you must give a variable name after variable decliaration')
break
elif token in ol:
if tokens_type == 'OPARETOR':
tok = 1
else:
print('Syntax ERROR :you miss the assignment operator after VARIABLE name')
break
elif token in vl:
if tokens_type == 'STRING':
strg = tokens_value
elif tokens_type == 'INTEGER':
initalization = 1
else:
print('Syntax ERROR : IT CAN BE A INTEGER, STRING OR IDEMTIFIRE I.E. variable')
break
elif token in cl:
if tokens_type == 'COMMA':
comma = tokens_value
elif tokens_type == 'STATEMENT_END':
break
else:
print('Syntax ERROR : in this position you can used comma for multiple decliaration or u can used assignment operator for initalization')
break
token_chk = token_chk + 1
def showme(self, token_tip, toko):
if token_tip[1][0] == 'INOUT':
if token_tip[2][0] == 'STRING':
print(token_tip[2][1])
elif token_tip[3][0] == 'EMPTY':
print("Statement MISSING : you have to give '.' for debag")
else:
print('Syntax ERROR : you have to type string within parentisis or you have to give output operator')
token_chk = 1
for i in range(0, len(toko)):
tokens_id = toko[i][0]
tokens_val = toko[i][1]
if token_tip[1][0] == 'INOUT' and token_tip[2][1] == tokens_id and (token_tip[3][0] == 'STATEMENT_END'):
print(tokens_val)
def assignment_opp(self, token_tip):
toko = []
token_chk = 1
for i in range(0, len(toko)):
tokens_id = toko[i][0]
tokens_val = toko[i][1]
for token in range(0, len(token_tip)):
if token_tip[token][1] == '=':
toko.append([token_tip[token - 1][1], token_tip[token + 1][1]])
return toko
def add(self, token_tip, toko):
print(toko)
if token_tip[0][0] == 'INOUT' and token_tip[1][0] == 'IDENTIFIRE' and (token_tip[2][1] == '=') and (token_tip[3][0] == toko[i][0]) and (token_tip[i + 2][0] == toko[i + 6][0]) and (token_tip[6][0] == 'STATEMENT_END'):
for i in range(0, len(toko)):
if toko[i][0] == token_tip[1][1]:
print(i) |
class ProgressBarStyle(Enum, IComparable, IFormattable, IConvertible):
"""
Specifies the style that a System.Windows.Forms.ProgressBar uses to indicate the progress of an operation.
enum ProgressBarStyle,values: Blocks (0),Continuous (1),Marquee (2)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
Blocks = None
Continuous = None
Marquee = None
value__ = None
| class Progressbarstyle(Enum, IComparable, IFormattable, IConvertible):
"""
Specifies the style that a System.Windows.Forms.ProgressBar uses to indicate the progress of an operation.
enum ProgressBarStyle,values: Blocks (0),Continuous (1),Marquee (2)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
blocks = None
continuous = None
marquee = None
value__ = None |
"""
UPPER VS LOWER: Write a Python function that accepts a string and calculates the number of upper case letters and lower case letters.
Sample String : 'Hello Mr. Rogers, how are you this fine Tuesday?'
Expected Output :
No. of Upper case characters : 4
No. of Lower case Characters : 33
HINT: Two string methods that might prove useful: .isupper() and .islower()
"""
def up_low(s):
upper_char = 0
lower_char = 0
for letter in s:
if letter.isupper():
upper_char += 1
if letter.islower():
lower_char += 1
else:
continue
print("No. of Upper case characters: {}".format(upper_char))
print("No. of Lower case characters: {}".format(lower_char))
| """
UPPER VS LOWER: Write a Python function that accepts a string and calculates the number of upper case letters and lower case letters.
Sample String : 'Hello Mr. Rogers, how are you this fine Tuesday?'
Expected Output :
No. of Upper case characters : 4
No. of Lower case Characters : 33
HINT: Two string methods that might prove useful: .isupper() and .islower()
"""
def up_low(s):
upper_char = 0
lower_char = 0
for letter in s:
if letter.isupper():
upper_char += 1
if letter.islower():
lower_char += 1
else:
continue
print('No. of Upper case characters: {}'.format(upper_char))
print('No. of Lower case characters: {}'.format(lower_char)) |
"""
@name: PyHouse/src/Modules/Families/__init__.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2015 by D. Brian Kimmel
@note: Created on May 17, 2013
@license: MIT License
@summary:
Various families of lighting systems.
insteon
upb
x-10
zigbee
z-wave
lutron
and others
To add a family named 'NewFamily', do the following:
* Add a package named 'New_Family'.
* Add the family name (Capitalized) to the list VALID_FAMILIES below.
* Add a module named <NewFamily>_device.py
* Add any other modules needed by the Device module.
<Newfamily>_xml
<NewFamily>_data
...
* A module to interface with the controller is recommended.
<NewFamily>_pim
There are a number of lighting 'Family' types handled here.
The Insteon family is now functional (2012).
The UPB family is work in progress
The X-10 family is mostly just a stub at present (2012)
When PyHouse is reading in the configuration for various devices, a call to family.ReadXml() is made to
add any family specific data for that device. The data for the device MUST include a 'DeviceFamily'
attribute that is already initialized with the family name.
Each family consists of four or more major areas:
Lights / Lighting Devices
Controllers - connected to the computer
Scenes - have one or more lights that are controlled together
Buttons - extra buttons with no light directly attached (key-pad-link)
Since these controllers also control things other than lights, there is also a device type defined.
Devices to control include Lights, Thermostat, Irrigation valves Pool Equipment etc.
"""
__version_info__ = (1, 6, 0)
__version__ = '.'.join(map(str, __version_info__))
VALID_FAMILIES = ['Null', 'Insteon', 'UPB', 'X10'] # Keep null first
VALID_DEVICE_TYPES = ['Light', 'Thermostat', 'Irrigation', 'Pool']
# ## END DBK
| """
@name: PyHouse/src/Modules/Families/__init__.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2015 by D. Brian Kimmel
@note: Created on May 17, 2013
@license: MIT License
@summary:
Various families of lighting systems.
insteon
upb
x-10
zigbee
z-wave
lutron
and others
To add a family named 'NewFamily', do the following:
* Add a package named 'New_Family'.
* Add the family name (Capitalized) to the list VALID_FAMILIES below.
* Add a module named <NewFamily>_device.py
* Add any other modules needed by the Device module.
<Newfamily>_xml
<NewFamily>_data
...
* A module to interface with the controller is recommended.
<NewFamily>_pim
There are a number of lighting 'Family' types handled here.
The Insteon family is now functional (2012).
The UPB family is work in progress
The X-10 family is mostly just a stub at present (2012)
When PyHouse is reading in the configuration for various devices, a call to family.ReadXml() is made to
add any family specific data for that device. The data for the device MUST include a 'DeviceFamily'
attribute that is already initialized with the family name.
Each family consists of four or more major areas:
Lights / Lighting Devices
Controllers - connected to the computer
Scenes - have one or more lights that are controlled together
Buttons - extra buttons with no light directly attached (key-pad-link)
Since these controllers also control things other than lights, there is also a device type defined.
Devices to control include Lights, Thermostat, Irrigation valves Pool Equipment etc.
"""
__version_info__ = (1, 6, 0)
__version__ = '.'.join(map(str, __version_info__))
valid_families = ['Null', 'Insteon', 'UPB', 'X10']
valid_device_types = ['Light', 'Thermostat', 'Irrigation', 'Pool'] |
input_str = """
cut -135
deal with increment 38
deal into new stack
deal with increment 29
cut 120
deal with increment 30
deal into new stack
cut -7198
deal into new stack
deal with increment 59
cut -8217
deal with increment 75
cut 4868
deal with increment 29
cut 4871
deal with increment 2
deal into new stack
deal with increment 54
cut 777
deal with increment 40
cut -8611
deal with increment 3
cut -5726
deal with increment 57
deal into new stack
deal with increment 41
deal into new stack
cut -5027
deal with increment 12
cut -5883
deal with increment 45
cut 9989
deal with increment 14
cut 6535
deal with increment 18
cut -5544
deal with increment 29
deal into new stack
deal with increment 64
deal into new stack
deal with increment 41
deal into new stack
deal with increment 6
cut 4752
deal with increment 8
deal into new stack
deal with increment 26
cut -6635
deal with increment 10
deal into new stack
cut -3830
deal with increment 48
deal into new stack
deal with increment 39
cut -4768
deal with increment 65
deal into new stack
cut -5417
deal with increment 15
cut -4647
deal into new stack
cut -3596
deal with increment 17
cut -3771
deal with increment 50
cut 1682
deal into new stack
deal with increment 20
deal into new stack
deal with increment 22
deal into new stack
deal with increment 3
cut 8780
deal with increment 52
cut 7478
deal with increment 9
cut -8313
deal into new stack
cut 742
deal with increment 19
cut 9982
deal into new stack
deal with increment 68
cut 9997
deal with increment 23
cut -240
deal with increment 54
cut -7643
deal into new stack
deal with increment 6
cut -3493
deal with increment 74
deal into new stack
deal with increment 75
deal into new stack
deal with increment 40
cut 596
deal with increment 6
cut -4957
deal into new stack"""
inlist = [f.strip() for f in input_str.split('\n') if f.strip()]
def cut(pile, n, dest):
if n > 0:
dest[0:-n] = pile[n:]
dest[-n:] = pile[0:n]
else:
dest[0:n] = pile[n:]
dest[n:] = pile[0:(len(pile)+n)]
return
def list_eq(l1, l2):
match = (len(l1) == len(l2)) and all(l1[i] == l2[i] for i in range(len(l1)))
if not match:
print("Mismatch:")
print(l1)
print(l2)
return match
def deal_increment(src, n, dest):
for i in range(len(src)):
dest[(i*n) % len(src)] = src[i]
def deal(src, dest):
n = len(src)
for i in range(n):
dest[n-i-1] = src[i]
def parse_input_and_do():
# avoid allocating ram for each transform by just having two lists and switching src and dest each time.
piles = [list(range(10007)), list(range(10007))]
for i, item in enumerate(inlist):
if i%2 == 0:
src, dest = piles[0], piles[1]
else:
src, dest = piles[1], piles[0]
print(item)
if i%10 == 0:
print(100*i/len(inlist), "% complete")
instr, num = item.split()[-2:]
if num == 'stack':
deal(src, dest)
elif instr == 'increment':
deal_increment(src, int(num), dest)
elif instr == 'cut':
cut(src, int(num), dest)
else:
print("wat:", item)
if len(inlist) % 2 == 1:
print(src.index(2019))
else:
print(dest.index(2019))
### tests
def test_cut():
src = list(range(4))
dest = list(range(4))
cut(src, 2, dest)
assert list_eq(dest, [2, 3, 0, 1])
cut(src, -2, dest)
assert list_eq(dest, [2, 3, 0, 1])
def test_deal_increment():
src = list(range(4))
dest = list(range(4))
deal_increment(src, 3, dest)
assert list_eq(dest, [0, 3, 2, 1])
def do_tests():
test_cut()
test_deal_increment()
print("tests passed")
if __name__ == '__main__':
do_tests()
parse_input_and_do() | input_str = '\ncut -135\ndeal with increment 38\ndeal into new stack\ndeal with increment 29\ncut 120\ndeal with increment 30\ndeal into new stack\ncut -7198\ndeal into new stack\ndeal with increment 59\ncut -8217\ndeal with increment 75\ncut 4868\ndeal with increment 29\ncut 4871\ndeal with increment 2\ndeal into new stack\ndeal with increment 54\ncut 777\ndeal with increment 40\ncut -8611\ndeal with increment 3\ncut -5726\ndeal with increment 57\ndeal into new stack\ndeal with increment 41\ndeal into new stack\ncut -5027\ndeal with increment 12\ncut -5883\ndeal with increment 45\ncut 9989\ndeal with increment 14\ncut 6535\ndeal with increment 18\ncut -5544\ndeal with increment 29\ndeal into new stack\ndeal with increment 64\ndeal into new stack\ndeal with increment 41\ndeal into new stack\ndeal with increment 6\ncut 4752\ndeal with increment 8\ndeal into new stack\ndeal with increment 26\ncut -6635\ndeal with increment 10\ndeal into new stack\ncut -3830\ndeal with increment 48\ndeal into new stack\ndeal with increment 39\ncut -4768\ndeal with increment 65\ndeal into new stack\ncut -5417\ndeal with increment 15\ncut -4647\ndeal into new stack\ncut -3596\ndeal with increment 17\ncut -3771\ndeal with increment 50\ncut 1682\ndeal into new stack\ndeal with increment 20\ndeal into new stack\ndeal with increment 22\ndeal into new stack\ndeal with increment 3\ncut 8780\ndeal with increment 52\ncut 7478\ndeal with increment 9\ncut -8313\ndeal into new stack\ncut 742\ndeal with increment 19\ncut 9982\ndeal into new stack\ndeal with increment 68\ncut 9997\ndeal with increment 23\ncut -240\ndeal with increment 54\ncut -7643\ndeal into new stack\ndeal with increment 6\ncut -3493\ndeal with increment 74\ndeal into new stack\ndeal with increment 75\ndeal into new stack\ndeal with increment 40\ncut 596\ndeal with increment 6\ncut -4957\ndeal into new stack'
inlist = [f.strip() for f in input_str.split('\n') if f.strip()]
def cut(pile, n, dest):
if n > 0:
dest[0:-n] = pile[n:]
dest[-n:] = pile[0:n]
else:
dest[0:n] = pile[n:]
dest[n:] = pile[0:len(pile) + n]
return
def list_eq(l1, l2):
match = len(l1) == len(l2) and all((l1[i] == l2[i] for i in range(len(l1))))
if not match:
print('Mismatch:')
print(l1)
print(l2)
return match
def deal_increment(src, n, dest):
for i in range(len(src)):
dest[i * n % len(src)] = src[i]
def deal(src, dest):
n = len(src)
for i in range(n):
dest[n - i - 1] = src[i]
def parse_input_and_do():
piles = [list(range(10007)), list(range(10007))]
for (i, item) in enumerate(inlist):
if i % 2 == 0:
(src, dest) = (piles[0], piles[1])
else:
(src, dest) = (piles[1], piles[0])
print(item)
if i % 10 == 0:
print(100 * i / len(inlist), '% complete')
(instr, num) = item.split()[-2:]
if num == 'stack':
deal(src, dest)
elif instr == 'increment':
deal_increment(src, int(num), dest)
elif instr == 'cut':
cut(src, int(num), dest)
else:
print('wat:', item)
if len(inlist) % 2 == 1:
print(src.index(2019))
else:
print(dest.index(2019))
def test_cut():
src = list(range(4))
dest = list(range(4))
cut(src, 2, dest)
assert list_eq(dest, [2, 3, 0, 1])
cut(src, -2, dest)
assert list_eq(dest, [2, 3, 0, 1])
def test_deal_increment():
src = list(range(4))
dest = list(range(4))
deal_increment(src, 3, dest)
assert list_eq(dest, [0, 3, 2, 1])
def do_tests():
test_cut()
test_deal_increment()
print('tests passed')
if __name__ == '__main__':
do_tests()
parse_input_and_do() |
print("Hello! Please answer a few questions:")
user_name = input("What is your name? ")
user_age = input("How old are you? ")
user_city = input("Where do you live? ")
print(f"""\nHello, {user_name.title()}!
Your age is {user_age},
You live in {user_city.title()}.""")
input()
| print('Hello! Please answer a few questions:')
user_name = input('What is your name? ')
user_age = input('How old are you? ')
user_city = input('Where do you live? ')
print(f'\nHello, {user_name.title()}!\nYour age is {user_age},\nYou live in {user_city.title()}.')
input() |
"""Baseball statistics calculation functions."""
def batting_average(at_bats, hits):
"""Calculates the batting average to 3 decimal places using number of at bats and hits."""
try:
return round(hits / at_bats, 3)
except ZeroDivisionError:
return round(0, 3) | """Baseball statistics calculation functions."""
def batting_average(at_bats, hits):
"""Calculates the batting average to 3 decimal places using number of at bats and hits."""
try:
return round(hits / at_bats, 3)
except ZeroDivisionError:
return round(0, 3) |
# Problem: https://docs.google.com/document/d/1tS-7_Z0VNpwO-8lgj6B3NWzIN9bHtQW7Pxqhy8U4HvQ/edit?usp=sharing
message = input()
rev = message[::-1]
for a, b in zip(message, rev):
print(a, b)
| message = input()
rev = message[::-1]
for (a, b) in zip(message, rev):
print(a, b) |
class ConfigFromJSON(object):
def __init__(self, filename):
self.json_file = filename
@property
def json_file(self):
print('set')
return self.__json_file
@json_file.setter
def json_file(self, value):
print('check')
if value is not 0:
raise ValueError("No !")
else:
print("OK")
self.__json_file = value
print('instance')
myA = ConfigFromJSON(0)
print('instance')
myA = ConfigFromJSON(0)
print(myA.json_file)
| class Configfromjson(object):
def __init__(self, filename):
self.json_file = filename
@property
def json_file(self):
print('set')
return self.__json_file
@json_file.setter
def json_file(self, value):
print('check')
if value is not 0:
raise value_error('No !')
else:
print('OK')
self.__json_file = value
print('instance')
my_a = config_from_json(0)
print('instance')
my_a = config_from_json(0)
print(myA.json_file) |
class _GetAttrAccumulator:
@staticmethod
def apply(gaa, target):
if not isinstance(gaa, _GetAttrAccumulator):
if isinstance(gaa, dict):
return {
_GetAttrAccumulator.apply(k, target): _GetAttrAccumulator.apply(v, target)
for k, v in gaa.items()
}
if isinstance(gaa, list):
return [_GetAttrAccumulator.apply(v, target) for v in gaa]
return gaa
result = target
for fn in gaa._gotten:
result = fn(target, result)
result = _GetAttrAccumulator.apply(result, target)
return result
def __init__(self, gotten=None, text=None):
if gotten is None:
gotten = []
self._gotten = gotten
self._text = "" if text is None else text
def __getitem__(self, item):
gotten = [
*self._gotten,
lambda t, o: o[item],
]
return _GetAttrAccumulator(gotten, "%s[%s]" % (self._text, item))
def __getattr__(self, name):
gotten = [
*self._gotten,
lambda t, o: getattr(o, name),
]
return _GetAttrAccumulator(gotten, "%s.%s" % (self._text, name))
def __call__(self, **kw):
gotten = [
*self._gotten,
lambda t, o: o(**{
k: _GetAttrAccumulator.apply(v, t)
for k, v in kw.items()
}),
]
return _GetAttrAccumulator(gotten, "%s(...)" % self._text)
def __str__(self):
return "_GetAttrAccumulator<%s>" % self._text
def _recursive_transform(o, fn):
# First, a shallow tranform.
o = fn(o)
# Now a recursive one, if needed.
if isinstance(o, dict):
return {
k: _recursive_transform(v, fn)
for k, v in o.items()
}
elif isinstance(o, list):
return [
_recursive_transform(e, fn)
for e in o
]
else:
return o
| class _Getattraccumulator:
@staticmethod
def apply(gaa, target):
if not isinstance(gaa, _GetAttrAccumulator):
if isinstance(gaa, dict):
return {_GetAttrAccumulator.apply(k, target): _GetAttrAccumulator.apply(v, target) for (k, v) in gaa.items()}
if isinstance(gaa, list):
return [_GetAttrAccumulator.apply(v, target) for v in gaa]
return gaa
result = target
for fn in gaa._gotten:
result = fn(target, result)
result = _GetAttrAccumulator.apply(result, target)
return result
def __init__(self, gotten=None, text=None):
if gotten is None:
gotten = []
self._gotten = gotten
self._text = '' if text is None else text
def __getitem__(self, item):
gotten = [*self._gotten, lambda t, o: o[item]]
return __get_attr_accumulator(gotten, '%s[%s]' % (self._text, item))
def __getattr__(self, name):
gotten = [*self._gotten, lambda t, o: getattr(o, name)]
return __get_attr_accumulator(gotten, '%s.%s' % (self._text, name))
def __call__(self, **kw):
gotten = [*self._gotten, lambda t, o: o(**{k: _GetAttrAccumulator.apply(v, t) for (k, v) in kw.items()})]
return __get_attr_accumulator(gotten, '%s(...)' % self._text)
def __str__(self):
return '_GetAttrAccumulator<%s>' % self._text
def _recursive_transform(o, fn):
o = fn(o)
if isinstance(o, dict):
return {k: _recursive_transform(v, fn) for (k, v) in o.items()}
elif isinstance(o, list):
return [_recursive_transform(e, fn) for e in o]
else:
return o |
# Smallest Difference Problem : Two arrays are given and you have to find the
# pair (i , j) such abs(i-j) is the smallest where i belongs to the first array and j belong to the second array respectively
def smallestDifference(arr1 : list, arr2 : list) :
arr1.sort();arr2.sort()
i = 0;j = 0
smallest = float("inf");current=float("inf")
smallestPair = list()
while i < len(arr1) and j < len(arr2) :
fnum = arr1[i];snum = arr2[j]
if fnum < snum :
current = snum - fnum
i += 1
elif snum < fnum :
current = snum - fnum
j += 1
else :
return [fnum, snum]
if current < smallest :
smallest = current
smallestPair.append((fnum, snum))
if __name__ == '__main__' :
print(smallestDifference([12,3,45,6], [2,4,3,5])) | def smallest_difference(arr1: list, arr2: list):
arr1.sort()
arr2.sort()
i = 0
j = 0
smallest = float('inf')
current = float('inf')
smallest_pair = list()
while i < len(arr1) and j < len(arr2):
fnum = arr1[i]
snum = arr2[j]
if fnum < snum:
current = snum - fnum
i += 1
elif snum < fnum:
current = snum - fnum
j += 1
else:
return [fnum, snum]
if current < smallest:
smallest = current
smallestPair.append((fnum, snum))
if __name__ == '__main__':
print(smallest_difference([12, 3, 45, 6], [2, 4, 3, 5])) |
class CasHelper:
def __init__(self, app):
self.app = app
def wrong_password(self, credentials):
wd = self.app.wd
#self.app.open_home_page()
wd.find_element_by_css_selector("input.form-control").click()
wd.find_element_by_css_selector("input.form-control").clear()
wd.find_element_by_css_selector("input.form-control").send_keys(credentials.login)
wd.find_element_by_css_selector("button.btn.btn-default").click()
wd.find_element_by_css_selector("input.form-control").click()
wd.find_element_by_css_selector("input.form-control").send_keys(credentials.password)
wd.find_element_by_xpath("//section[@id='section-left']/section[2]/div/div[1]").click()
wd.find_element_by_css_selector("button.btn.btn-default").click() | class Cashelper:
def __init__(self, app):
self.app = app
def wrong_password(self, credentials):
wd = self.app.wd
wd.find_element_by_css_selector('input.form-control').click()
wd.find_element_by_css_selector('input.form-control').clear()
wd.find_element_by_css_selector('input.form-control').send_keys(credentials.login)
wd.find_element_by_css_selector('button.btn.btn-default').click()
wd.find_element_by_css_selector('input.form-control').click()
wd.find_element_by_css_selector('input.form-control').send_keys(credentials.password)
wd.find_element_by_xpath("//section[@id='section-left']/section[2]/div/div[1]").click()
wd.find_element_by_css_selector('button.btn.btn-default').click() |
"""Nullutil: nullutil for Python."""
# Null Coalesce
# This means:
# lhs ?? rhs
def qq(lhs, rhs):
return lhs if lhs is not None else rhs
# Safty Access
# This means:
# instance?.member
# instance?.member(*params)
def q_(instance, member, params=None):
if instance is None:
return None
else:
m = getattr(instance, member)
if params is None:
return m
elif isinstance(params, dict):
return m(**params)
elif isinstance(params, list) or isinstance(params, tuple):
return m(*params)
else:
return m(params)
# This means:
# instance?[index]
def qL7(collection, index):
return collection[index] if collection is not None else None
# Safety Evalate (do Syntax)
# This means:
# params?.let{expression}
# do
# p0 <- params[0]
# p1 <- params[1]
# ...
# return expression(p0, p1, ...)
def q_let(params, expression):
if isinstance(params, dict):
for param in params.values():
if param is None:
return None
return expression(**params)
elif isinstance(params, list) or isinstance(params, tuple):
for param in params:
if param is None:
return None
return expression(*params)
else:
return expression(params) if params is not None else None
| """Nullutil: nullutil for Python."""
def qq(lhs, rhs):
return lhs if lhs is not None else rhs
def q_(instance, member, params=None):
if instance is None:
return None
else:
m = getattr(instance, member)
if params is None:
return m
elif isinstance(params, dict):
return m(**params)
elif isinstance(params, list) or isinstance(params, tuple):
return m(*params)
else:
return m(params)
def q_l7(collection, index):
return collection[index] if collection is not None else None
def q_let(params, expression):
if isinstance(params, dict):
for param in params.values():
if param is None:
return None
return expression(**params)
elif isinstance(params, list) or isinstance(params, tuple):
for param in params:
if param is None:
return None
return expression(*params)
else:
return expression(params) if params is not None else None |
# -*- coding: utf-8 -*-
# Authors: Y. Jia <ytjia.zju@gmail.com>
"""
Given a string S and a string T, find the minimum window in S which will contain all the
characters in T in complexity O(n).
https://leetcode.com/problems/minimum-window-substring/description/
"""
class Solution(object):
def minWindow(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
mw = ""
if not s or not t or len(s) == 0 or len(t) == 0:
return mw
t_char_cnt = len(t)
t_char_dict = dict()
for char in t:
if char in t_char_dict:
t_char_dict[char] += 1
else:
t_char_dict[char] = 1
w_b = 0
w_e = 0
while w_e < len(s):
if s[w_e] in t_char_dict:
t_char_dict[s[w_e]] -= 1
if t_char_dict[s[w_e]] >= 0:
t_char_cnt -= 1
w_e += 1
while t_char_cnt == 0:
if len(mw) == 0 or w_e - w_b < len(mw):
mw = s[w_b:w_e]
if s[w_b] in t_char_dict:
t_char_dict[s[w_b]] += 1
if t_char_dict[s[w_b]] > 0:
t_char_cnt += 1
w_b += 1
return mw
| """
Given a string S and a string T, find the minimum window in S which will contain all the
characters in T in complexity O(n).
https://leetcode.com/problems/minimum-window-substring/description/
"""
class Solution(object):
def min_window(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
mw = ''
if not s or not t or len(s) == 0 or (len(t) == 0):
return mw
t_char_cnt = len(t)
t_char_dict = dict()
for char in t:
if char in t_char_dict:
t_char_dict[char] += 1
else:
t_char_dict[char] = 1
w_b = 0
w_e = 0
while w_e < len(s):
if s[w_e] in t_char_dict:
t_char_dict[s[w_e]] -= 1
if t_char_dict[s[w_e]] >= 0:
t_char_cnt -= 1
w_e += 1
while t_char_cnt == 0:
if len(mw) == 0 or w_e - w_b < len(mw):
mw = s[w_b:w_e]
if s[w_b] in t_char_dict:
t_char_dict[s[w_b]] += 1
if t_char_dict[s[w_b]] > 0:
t_char_cnt += 1
w_b += 1
return mw |
class Articles:
"""
Article class defines Article objects
"""
def __init__(self,author,title,description,article_url,image_url,days,hours,minutes):
self.author = author
self.title = title
self.description = description
self.article_url = article_url
self.image_url = image_url
self.days = days
self.hours = hours
self.minutes = minutes
class Source:
"""
Source class to define news source Objects
"""
def __init__(self,id,name,description,url,category,language,country):
self.id = id
self.name = name
self.description = description
self.url = url
self.category = category
self.language = language
self.country = country
| class Articles:
"""
Article class defines Article objects
"""
def __init__(self, author, title, description, article_url, image_url, days, hours, minutes):
self.author = author
self.title = title
self.description = description
self.article_url = article_url
self.image_url = image_url
self.days = days
self.hours = hours
self.minutes = minutes
class Source:
"""
Source class to define news source Objects
"""
def __init__(self, id, name, description, url, category, language, country):
self.id = id
self.name = name
self.description = description
self.url = url
self.category = category
self.language = language
self.country = country |
class AnyArg(object):
"""AnyArg for wildcard mock assertions"""
def __eq__(self, b: any):
return True
| class Anyarg(object):
"""AnyArg for wildcard mock assertions"""
def __eq__(self, b: any):
return True |
""" This file was generated when mcuprog was built """
VERSION = '3.9.1.120'
COMMIT_ID = '84ffb61b46baa4fb20896deb0179d09fe3097b5c'
BUILD_DATE = '2021-08-23 18:16:12 +0700'
| """ This file was generated when mcuprog was built """
version = '3.9.1.120'
commit_id = '84ffb61b46baa4fb20896deb0179d09fe3097b5c'
build_date = '2021-08-23 18:16:12 +0700' |
'''
Created on 2017. 8. 16.
@author: jongyeob
'''
_tlm0x8D2_image_size = 2048
tlm0x08D2_struct = [('I','frame_number'),
('I','frame_position'),
('{}B'.format(_tlm0x8D2_image_size),'data')]
| """
Created on 2017. 8. 16.
@author: jongyeob
"""
_tlm0x8_d2_image_size = 2048
tlm0x08_d2_struct = [('I', 'frame_number'), ('I', 'frame_position'), ('{}B'.format(_tlm0x8D2_image_size), 'data')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
assert True; assert not False
assert True
assert not False
| assert True
assert not False
assert True
assert not False |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair and Paul Rougieux.
JRC biomass Project.
Unit D1 Bioeconomy.
"""
# Built-in modules #
# Third party modules #
###############################################################################
class Graphs(object):
def __getitem__(self, key):
return [i for i in self.instances if i.short_name == key][0]
def __iter__(self): return iter(self.instances)
def __len__(self): return len(self.instances)
def __init__(self):
self.instances = []
def __call__(self, *args, **kwargs):
return [i(*args, **kwargs) for i in self.instances]
###############################################################################
def load_graphs_from_module(parent, submodule):
"""
Sorry for the black magic. The result is an object whose attributes
are all the graphs found in submodule.py initialized with the
proper instance as only argument.
"""
# Get all graphs of a submodule #
graph_classes = [getattr(submodule, g) for g in submodule.__all__]
graph_instances = [g(parent) for g in graph_classes]
graph_names = [g.short_name for g in graph_instances]
# Create a container object #
graphs = Graphs()
# Set its attributes #
for name, instance in zip(graph_names, graph_instances):
setattr(graphs, name, instance)
graphs.instances.append(instance)
# Return result #
return graphs | """
Written by Lucas Sinclair and Paul Rougieux.
JRC biomass Project.
Unit D1 Bioeconomy.
"""
class Graphs(object):
def __getitem__(self, key):
return [i for i in self.instances if i.short_name == key][0]
def __iter__(self):
return iter(self.instances)
def __len__(self):
return len(self.instances)
def __init__(self):
self.instances = []
def __call__(self, *args, **kwargs):
return [i(*args, **kwargs) for i in self.instances]
def load_graphs_from_module(parent, submodule):
"""
Sorry for the black magic. The result is an object whose attributes
are all the graphs found in submodule.py initialized with the
proper instance as only argument.
"""
graph_classes = [getattr(submodule, g) for g in submodule.__all__]
graph_instances = [g(parent) for g in graph_classes]
graph_names = [g.short_name for g in graph_instances]
graphs = graphs()
for (name, instance) in zip(graph_names, graph_instances):
setattr(graphs, name, instance)
graphs.instances.append(instance)
return graphs |
#
# PySNMP MIB module SNMP-USM-DH-OBJECTS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMP-USM-DH-OBJECTS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:00:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
usmUserEntry, = mibBuilder.importSymbols("SNMP-USER-BASED-SM-MIB", "usmUserEntry")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Bits, ObjectIdentity, Counter64, MibIdentifier, ModuleIdentity, Gauge32, IpAddress, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, experimental, NotificationType, TimeTicks, Integer32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "ObjectIdentity", "Counter64", "MibIdentifier", "ModuleIdentity", "Gauge32", "IpAddress", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "experimental", "NotificationType", "TimeTicks", "Integer32", "Counter32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
snmpUsmDHObjectsMIB = ModuleIdentity((1, 3, 6, 1, 3, 101))
snmpUsmDHObjectsMIB.setRevisions(('2000-03-06 00:00',))
if mibBuilder.loadTexts: snmpUsmDHObjectsMIB.setLastUpdated('200003060000Z')
if mibBuilder.loadTexts: snmpUsmDHObjectsMIB.setOrganization('Excite@Home')
usmDHKeyObjects = MibIdentifier((1, 3, 6, 1, 3, 101, 1))
usmDHKeyConformance = MibIdentifier((1, 3, 6, 1, 3, 101, 2))
class DHKeyChange(TextualConvention, OctetString):
reference = '-- Diffie-Hellman Key-Agreement Standard, PKCS #3; RSA Laboratories, November 1993'
status = 'current'
usmDHPublicObjects = MibIdentifier((1, 3, 6, 1, 3, 101, 1, 1))
usmDHParameters = MibScalar((1, 3, 6, 1, 3, 101, 1, 1, 1), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: usmDHParameters.setStatus('current')
usmDHUserKeyTable = MibTable((1, 3, 6, 1, 3, 101, 1, 1, 2), )
if mibBuilder.loadTexts: usmDHUserKeyTable.setStatus('current')
usmDHUserKeyEntry = MibTableRow((1, 3, 6, 1, 3, 101, 1, 1, 2, 1), )
usmUserEntry.registerAugmentions(("SNMP-USM-DH-OBJECTS-MIB", "usmDHUserKeyEntry"))
usmDHUserKeyEntry.setIndexNames(*usmUserEntry.getIndexNames())
if mibBuilder.loadTexts: usmDHUserKeyEntry.setStatus('current')
usmDHUserAuthKeyChange = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 1), DHKeyChange()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usmDHUserAuthKeyChange.setStatus('current')
usmDHUserOwnAuthKeyChange = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 2), DHKeyChange()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usmDHUserOwnAuthKeyChange.setStatus('current')
usmDHUserPrivKeyChange = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 3), DHKeyChange()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usmDHUserPrivKeyChange.setStatus('current')
usmDHUserOwnPrivKeyChange = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 4), DHKeyChange()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: usmDHUserOwnPrivKeyChange.setStatus('current')
usmDHKickstartGroup = MibIdentifier((1, 3, 6, 1, 3, 101, 1, 2))
usmDHKickstartTable = MibTable((1, 3, 6, 1, 3, 101, 1, 2, 1), )
if mibBuilder.loadTexts: usmDHKickstartTable.setStatus('current')
usmDHKickstartEntry = MibTableRow((1, 3, 6, 1, 3, 101, 1, 2, 1, 1), ).setIndexNames((0, "SNMP-USM-DH-OBJECTS-MIB", "usmDHKickstartIndex"))
if mibBuilder.loadTexts: usmDHKickstartEntry.setStatus('current')
usmDHKickstartIndex = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)))
if mibBuilder.loadTexts: usmDHKickstartIndex.setStatus('current')
usmDHKickstartMyPublic = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usmDHKickstartMyPublic.setStatus('current')
usmDHKickstartMgrPublic = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 3), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usmDHKickstartMgrPublic.setStatus('current')
usmDHKickstartSecurityName = MibTableColumn((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 4), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: usmDHKickstartSecurityName.setStatus('current')
usmDHKeyMIBCompliances = MibIdentifier((1, 3, 6, 1, 3, 101, 2, 1))
usmDHKeyMIBGroups = MibIdentifier((1, 3, 6, 1, 3, 101, 2, 2))
usmDHKeyMIBCompliance = ModuleCompliance((1, 3, 6, 1, 3, 101, 2, 1, 1)).setObjects(("SNMP-USM-DH-OBJECTS-MIB", "usmDHKeyMIBBasicGroup"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHKeyParamGroup"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHKeyKickstartGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usmDHKeyMIBCompliance = usmDHKeyMIBCompliance.setStatus('current')
usmDHKeyMIBBasicGroup = ObjectGroup((1, 3, 6, 1, 3, 101, 2, 2, 1)).setObjects(("SNMP-USM-DH-OBJECTS-MIB", "usmDHUserAuthKeyChange"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHUserOwnAuthKeyChange"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHUserPrivKeyChange"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHUserOwnPrivKeyChange"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usmDHKeyMIBBasicGroup = usmDHKeyMIBBasicGroup.setStatus('current')
usmDHKeyParamGroup = ObjectGroup((1, 3, 6, 1, 3, 101, 2, 2, 2)).setObjects(("SNMP-USM-DH-OBJECTS-MIB", "usmDHParameters"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usmDHKeyParamGroup = usmDHKeyParamGroup.setStatus('current')
usmDHKeyKickstartGroup = ObjectGroup((1, 3, 6, 1, 3, 101, 2, 2, 3)).setObjects(("SNMP-USM-DH-OBJECTS-MIB", "usmDHKickstartMyPublic"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHKickstartMgrPublic"), ("SNMP-USM-DH-OBJECTS-MIB", "usmDHKickstartSecurityName"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usmDHKeyKickstartGroup = usmDHKeyKickstartGroup.setStatus('current')
mibBuilder.exportSymbols("SNMP-USM-DH-OBJECTS-MIB", usmDHUserOwnPrivKeyChange=usmDHUserOwnPrivKeyChange, usmDHKeyMIBCompliance=usmDHKeyMIBCompliance, snmpUsmDHObjectsMIB=snmpUsmDHObjectsMIB, usmDHKickstartEntry=usmDHKickstartEntry, usmDHUserPrivKeyChange=usmDHUserPrivKeyChange, usmDHKeyObjects=usmDHKeyObjects, usmDHKickstartIndex=usmDHKickstartIndex, usmDHKickstartMgrPublic=usmDHKickstartMgrPublic, usmDHKickstartMyPublic=usmDHKickstartMyPublic, PYSNMP_MODULE_ID=snmpUsmDHObjectsMIB, usmDHKickstartTable=usmDHKickstartTable, DHKeyChange=DHKeyChange, usmDHUserKeyTable=usmDHUserKeyTable, usmDHKeyMIBCompliances=usmDHKeyMIBCompliances, usmDHUserOwnAuthKeyChange=usmDHUserOwnAuthKeyChange, usmDHKeyMIBBasicGroup=usmDHKeyMIBBasicGroup, usmDHUserKeyEntry=usmDHUserKeyEntry, usmDHKeyKickstartGroup=usmDHKeyKickstartGroup, usmDHUserAuthKeyChange=usmDHUserAuthKeyChange, usmDHKickstartGroup=usmDHKickstartGroup, usmDHPublicObjects=usmDHPublicObjects, usmDHKeyConformance=usmDHKeyConformance, usmDHKickstartSecurityName=usmDHKickstartSecurityName, usmDHKeyMIBGroups=usmDHKeyMIBGroups, usmDHParameters=usmDHParameters, usmDHKeyParamGroup=usmDHKeyParamGroup)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(usm_user_entry,) = mibBuilder.importSymbols('SNMP-USER-BASED-SM-MIB', 'usmUserEntry')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(bits, object_identity, counter64, mib_identifier, module_identity, gauge32, ip_address, iso, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, experimental, notification_type, time_ticks, integer32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'ObjectIdentity', 'Counter64', 'MibIdentifier', 'ModuleIdentity', 'Gauge32', 'IpAddress', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'experimental', 'NotificationType', 'TimeTicks', 'Integer32', 'Counter32')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
snmp_usm_dh_objects_mib = module_identity((1, 3, 6, 1, 3, 101))
snmpUsmDHObjectsMIB.setRevisions(('2000-03-06 00:00',))
if mibBuilder.loadTexts:
snmpUsmDHObjectsMIB.setLastUpdated('200003060000Z')
if mibBuilder.loadTexts:
snmpUsmDHObjectsMIB.setOrganization('Excite@Home')
usm_dh_key_objects = mib_identifier((1, 3, 6, 1, 3, 101, 1))
usm_dh_key_conformance = mib_identifier((1, 3, 6, 1, 3, 101, 2))
class Dhkeychange(TextualConvention, OctetString):
reference = '-- Diffie-Hellman Key-Agreement Standard, PKCS #3; RSA Laboratories, November 1993'
status = 'current'
usm_dh_public_objects = mib_identifier((1, 3, 6, 1, 3, 101, 1, 1))
usm_dh_parameters = mib_scalar((1, 3, 6, 1, 3, 101, 1, 1, 1), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
usmDHParameters.setStatus('current')
usm_dh_user_key_table = mib_table((1, 3, 6, 1, 3, 101, 1, 1, 2))
if mibBuilder.loadTexts:
usmDHUserKeyTable.setStatus('current')
usm_dh_user_key_entry = mib_table_row((1, 3, 6, 1, 3, 101, 1, 1, 2, 1))
usmUserEntry.registerAugmentions(('SNMP-USM-DH-OBJECTS-MIB', 'usmDHUserKeyEntry'))
usmDHUserKeyEntry.setIndexNames(*usmUserEntry.getIndexNames())
if mibBuilder.loadTexts:
usmDHUserKeyEntry.setStatus('current')
usm_dh_user_auth_key_change = mib_table_column((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 1), dh_key_change()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usmDHUserAuthKeyChange.setStatus('current')
usm_dh_user_own_auth_key_change = mib_table_column((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 2), dh_key_change()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usmDHUserOwnAuthKeyChange.setStatus('current')
usm_dh_user_priv_key_change = mib_table_column((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 3), dh_key_change()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usmDHUserPrivKeyChange.setStatus('current')
usm_dh_user_own_priv_key_change = mib_table_column((1, 3, 6, 1, 3, 101, 1, 1, 2, 1, 4), dh_key_change()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
usmDHUserOwnPrivKeyChange.setStatus('current')
usm_dh_kickstart_group = mib_identifier((1, 3, 6, 1, 3, 101, 1, 2))
usm_dh_kickstart_table = mib_table((1, 3, 6, 1, 3, 101, 1, 2, 1))
if mibBuilder.loadTexts:
usmDHKickstartTable.setStatus('current')
usm_dh_kickstart_entry = mib_table_row((1, 3, 6, 1, 3, 101, 1, 2, 1, 1)).setIndexNames((0, 'SNMP-USM-DH-OBJECTS-MIB', 'usmDHKickstartIndex'))
if mibBuilder.loadTexts:
usmDHKickstartEntry.setStatus('current')
usm_dh_kickstart_index = mib_table_column((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)))
if mibBuilder.loadTexts:
usmDHKickstartIndex.setStatus('current')
usm_dh_kickstart_my_public = mib_table_column((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 2), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usmDHKickstartMyPublic.setStatus('current')
usm_dh_kickstart_mgr_public = mib_table_column((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 3), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usmDHKickstartMgrPublic.setStatus('current')
usm_dh_kickstart_security_name = mib_table_column((1, 3, 6, 1, 3, 101, 1, 2, 1, 1, 4), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
usmDHKickstartSecurityName.setStatus('current')
usm_dh_key_mib_compliances = mib_identifier((1, 3, 6, 1, 3, 101, 2, 1))
usm_dh_key_mib_groups = mib_identifier((1, 3, 6, 1, 3, 101, 2, 2))
usm_dh_key_mib_compliance = module_compliance((1, 3, 6, 1, 3, 101, 2, 1, 1)).setObjects(('SNMP-USM-DH-OBJECTS-MIB', 'usmDHKeyMIBBasicGroup'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHKeyParamGroup'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHKeyKickstartGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usm_dh_key_mib_compliance = usmDHKeyMIBCompliance.setStatus('current')
usm_dh_key_mib_basic_group = object_group((1, 3, 6, 1, 3, 101, 2, 2, 1)).setObjects(('SNMP-USM-DH-OBJECTS-MIB', 'usmDHUserAuthKeyChange'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHUserOwnAuthKeyChange'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHUserPrivKeyChange'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHUserOwnPrivKeyChange'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usm_dh_key_mib_basic_group = usmDHKeyMIBBasicGroup.setStatus('current')
usm_dh_key_param_group = object_group((1, 3, 6, 1, 3, 101, 2, 2, 2)).setObjects(('SNMP-USM-DH-OBJECTS-MIB', 'usmDHParameters'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usm_dh_key_param_group = usmDHKeyParamGroup.setStatus('current')
usm_dh_key_kickstart_group = object_group((1, 3, 6, 1, 3, 101, 2, 2, 3)).setObjects(('SNMP-USM-DH-OBJECTS-MIB', 'usmDHKickstartMyPublic'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHKickstartMgrPublic'), ('SNMP-USM-DH-OBJECTS-MIB', 'usmDHKickstartSecurityName'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
usm_dh_key_kickstart_group = usmDHKeyKickstartGroup.setStatus('current')
mibBuilder.exportSymbols('SNMP-USM-DH-OBJECTS-MIB', usmDHUserOwnPrivKeyChange=usmDHUserOwnPrivKeyChange, usmDHKeyMIBCompliance=usmDHKeyMIBCompliance, snmpUsmDHObjectsMIB=snmpUsmDHObjectsMIB, usmDHKickstartEntry=usmDHKickstartEntry, usmDHUserPrivKeyChange=usmDHUserPrivKeyChange, usmDHKeyObjects=usmDHKeyObjects, usmDHKickstartIndex=usmDHKickstartIndex, usmDHKickstartMgrPublic=usmDHKickstartMgrPublic, usmDHKickstartMyPublic=usmDHKickstartMyPublic, PYSNMP_MODULE_ID=snmpUsmDHObjectsMIB, usmDHKickstartTable=usmDHKickstartTable, DHKeyChange=DHKeyChange, usmDHUserKeyTable=usmDHUserKeyTable, usmDHKeyMIBCompliances=usmDHKeyMIBCompliances, usmDHUserOwnAuthKeyChange=usmDHUserOwnAuthKeyChange, usmDHKeyMIBBasicGroup=usmDHKeyMIBBasicGroup, usmDHUserKeyEntry=usmDHUserKeyEntry, usmDHKeyKickstartGroup=usmDHKeyKickstartGroup, usmDHUserAuthKeyChange=usmDHUserAuthKeyChange, usmDHKickstartGroup=usmDHKickstartGroup, usmDHPublicObjects=usmDHPublicObjects, usmDHKeyConformance=usmDHKeyConformance, usmDHKickstartSecurityName=usmDHKickstartSecurityName, usmDHKeyMIBGroups=usmDHKeyMIBGroups, usmDHParameters=usmDHParameters, usmDHKeyParamGroup=usmDHKeyParamGroup) |
# coding=utf-8
# Author: Jianghan LI
# Question: 072.Edit_Distance
# Complexity: O(N)
# Date: 2017-09-06 8:01 - 8:11, 0 wrong try
class Solution(object):
def minDistance(self, w1, w2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
m, n = len(w1) + 1, len(w2) + 1
d = [[0 for j in range(n)] for i in range(m)]
for i in range(m): d[i][0] = i
for j in range(n): d[0][j] = j
for i in range(1, m):
for j in range(1, n):
d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (w1[i - 1] != w2[j - 1]))
return d[m - 1][n - 1]
| class Solution(object):
def min_distance(self, w1, w2):
"""
:type word1: str
:type word2: str
:rtype: int
"""
(m, n) = (len(w1) + 1, len(w2) + 1)
d = [[0 for j in range(n)] for i in range(m)]
for i in range(m):
d[i][0] = i
for j in range(n):
d[0][j] = j
for i in range(1, m):
for j in range(1, n):
d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (w1[i - 1] != w2[j - 1]))
return d[m - 1][n - 1] |
# -*- coding: utf-8 -*-
__version__ = '0.1.0b1'
__description__ = """Simple AWS Route 53 DNS Updater.
Dynamically update a Route 53 DNS record to the current public IP of the
computer/network it is executed on. Records will only be modified if the
current value and public IP differ.
"""
| __version__ = '0.1.0b1'
__description__ = 'Simple AWS Route 53 DNS Updater.\nDynamically update a Route 53 DNS record to the current public IP of the \ncomputer/network it is executed on. Records will only be modified if the \ncurrent value and public IP differ.\n' |
def get_message_native_type(type):
dictionary = {
'uint8': 'uint8_t',
'uint16': 'uint16_t',
'uint32': 'uint32_t',
'uint64': 'uint64_t',
'int8': 'int8_t',
'int16': 'int16_t',
'int32': 'int32_t',
'int64': 'int64_t',
'buffer': 'iota::vector<uint8_t>',
'list': 'iota::vector<uint64_t>',
'string': 'iota::string'
}
return dictionary.get(type)
def get_message_default_initializer(type):
dictionary = {
'uint8': '{}',
'uint16': '{}',
'uint32': '{}',
'uint64': '{}',
'int8': '{}',
'int16': '{}',
'int32': '{}',
'int64': '{}',
'buffer': 'iota::create_vector<uint8_t>()',
'list': 'iota::create_vector<uint64_t>()',
'string': 'iota::create_string()'
}
return dictionary.get(type)
def generate_builder(file, message):
class_name = f"{message.name}_builder"
file.write(f"\tclass {class_name} {{\n")
file.write(f"\tpublic:\n")
file.write(f"\t\t{class_name}(): buf{{}} {{}}\n")
for field in message.items:
name = field.name
native_type = get_message_native_type(field.type)
index = field.index
file.write(f"\t\tvoid add_{name}({native_type} {name}) {{\n")
file.write(f"\t\t\tbuf.add<{native_type}>({index}, {name});\n")
file.write(f"\t\t}}\n")
file.write(f"\t\tuint8_t* serialize() {{\n")
file.write(f"\t\t\tbuf.serialize();\n")
file.write(f"\t\t\treturn buf.data();\n")
file.write(f"\t\t}}\n")
file.write(f"\t\tsize_t length() {{\n")
file.write(f"\t\t\treturn buf.length();\n")
file.write(f"\t\t}}\n")
file.write(f"\tprivate:\n")
file.write(f"\t\tiota::buffer_generator buf;\n")
file.write(f"\t}};\n\n")
def generate_parser(file, message):
class_name = f"{message.name}_parser"
file.write(f"\tclass {class_name} {{\n")
file.write(f"\tpublic:\n")
file.write(f"\t\t{class_name}(uint8_t* buf, size_t size) {{\n")
file.write(f"\t\t\tfor(size_t i = 0; i < size;){{\n")
file.write(f"\t\t\t\tiota::index_type index = buf[i];\n")
file.write(f"\t\t\t\ti++;\n")
file.write(f"\t\t\t\tswitch(index){{\n")
for field in message.items:
file.write(f"\t\t\t\t// {field.type}\n")
file.write(f"\t\t\t\tcase {field.index}: {{\n")
file.write(f"\t\t\t\t\tthis->_p_{field.name} = true;\n")
file.write(f"\t\t\t\t\ti += iota::parse_item<{get_message_native_type(field.type)}>(&buf[i], this->_m_{field.name});\n")
file.write(f"\t\t\t\t\tbreak;\n")
file.write(f"\t\t\t\t}}\n")
file.write(f"\t\t\t\t}}\n")
file.write(f"\t\t\t}}\n")
file.write(f"\t\t}}\n")
for field in message.items:
name = field.name
native_type = get_message_native_type(field.type)
file.write(f"\t\t{native_type}& get_{name}() {{\n")
file.write(f"\t\t\treturn this->_m_{field.name};\n")
file.write(f"\t\t}}\n")
file.write(f"\t\tbool has_{name}() {{\n")
file.write(f"\t\t\treturn this->_p_{field.name};\n")
file.write(f"\t\t}}\n")
file.write(f"\tprivate:\n")
for field in message.items:
name = field.name
native_type = get_message_native_type(field.type)
file.write(f"\t\t{native_type} _m_{name} = {get_message_default_initializer(field.type)}; bool _p_{name} = false;\n")
file.write(f"\t}};\n\n")
def get_enum_native_type(type):
dictionary = {
'uint8': 'uint8_t',
'uint16': 'uint16_t',
'uint32': 'uint32_t',
'uint64': 'uint64_t',
'int8': 'int8_t',
'int16': 'int16_t',
'int32': 'int32_t',
'int64': 'int64_t'
}
return dictionary.get(type)
def generate_enum(file, enum):
file.write(f"\tenum class {enum.name} : {get_enum_native_type(enum.item_type)} {{\n")
for entry in enum.items:
file.write(f"\t\t{entry.name} = {entry.value},\n")
file.write(f"\t}};\n\n")
def copy_file_contents(file1, file2):
for line in file1:
file2.write(line)
file2.write("\n\n")
def generate(subgenerator, output, items, module):
file = open(output, 'w')
file.write("#pragma once\n\n")
file.write("#include <stdint.h>\n")
file.write("#include <stddef.h>\n")
if not subgenerator:
subgenerator = 'std' # use std as default subgen
if subgenerator == 'std':
lib_file = open('lib/cpp/lib-std.hpp', 'r')
copy_file_contents(lib_file, file)
lib_file.close()
elif subgenerator == 'frigg':
lib_file = open('lib/cpp/lib-frigg.hpp', 'r')
copy_file_contents(lib_file, file)
lib_file.close()
elif subgenerator == 'sigma-kernel':
lib_file = open('lib/cpp/lib-sigma-kernel.hpp', 'r')
copy_file_contents(lib_file, file)
lib_file.close()
else:
print(f"cpp: Unknown subgenerator: {subgenerator}")
exit()
buffer_builder_file = open('lib/cpp/buffer_builder.hpp', 'r')
copy_file_contents(buffer_builder_file, file)
buffer_builder_file.close()
buffer_parser_file = open('lib/cpp/buffer_parser.hpp', 'r')
copy_file_contents(buffer_parser_file, file)
buffer_parser_file.close()
module_parts = module.split('.')
for part in module_parts:
file.write(f"namespace [[gnu::visibility(\"hidden\")]] {part} {{ ")
file.write("\n")
for item in items:
if(item.type == 'message'):
generate_builder(file, item)
generate_parser(file, item)
elif(item.type == 'enum'):
generate_enum(file, item)
else:
print(f"cpp: Unknown item type: {item.type}")
exit()
for part in module_parts:
file.write("} ")
file.close()
print("Generated C++ header") | def get_message_native_type(type):
dictionary = {'uint8': 'uint8_t', 'uint16': 'uint16_t', 'uint32': 'uint32_t', 'uint64': 'uint64_t', 'int8': 'int8_t', 'int16': 'int16_t', 'int32': 'int32_t', 'int64': 'int64_t', 'buffer': 'iota::vector<uint8_t>', 'list': 'iota::vector<uint64_t>', 'string': 'iota::string'}
return dictionary.get(type)
def get_message_default_initializer(type):
dictionary = {'uint8': '{}', 'uint16': '{}', 'uint32': '{}', 'uint64': '{}', 'int8': '{}', 'int16': '{}', 'int32': '{}', 'int64': '{}', 'buffer': 'iota::create_vector<uint8_t>()', 'list': 'iota::create_vector<uint64_t>()', 'string': 'iota::create_string()'}
return dictionary.get(type)
def generate_builder(file, message):
class_name = f'{message.name}_builder'
file.write(f'\tclass {class_name} {{\n')
file.write(f'\tpublic:\n')
file.write(f'\t\t{class_name}(): buf{{}} {{}}\n')
for field in message.items:
name = field.name
native_type = get_message_native_type(field.type)
index = field.index
file.write(f'\t\tvoid add_{name}({native_type} {name}) {{\n')
file.write(f'\t\t\tbuf.add<{native_type}>({index}, {name});\n')
file.write(f'\t\t}}\n')
file.write(f'\t\tuint8_t* serialize() {{\n')
file.write(f'\t\t\tbuf.serialize();\n')
file.write(f'\t\t\treturn buf.data();\n')
file.write(f'\t\t}}\n')
file.write(f'\t\tsize_t length() {{\n')
file.write(f'\t\t\treturn buf.length();\n')
file.write(f'\t\t}}\n')
file.write(f'\tprivate:\n')
file.write(f'\t\tiota::buffer_generator buf;\n')
file.write(f'\t}};\n\n')
def generate_parser(file, message):
class_name = f'{message.name}_parser'
file.write(f'\tclass {class_name} {{\n')
file.write(f'\tpublic:\n')
file.write(f'\t\t{class_name}(uint8_t* buf, size_t size) {{\n')
file.write(f'\t\t\tfor(size_t i = 0; i < size;){{\n')
file.write(f'\t\t\t\tiota::index_type index = buf[i];\n')
file.write(f'\t\t\t\ti++;\n')
file.write(f'\t\t\t\tswitch(index){{\n')
for field in message.items:
file.write(f'\t\t\t\t// {field.type}\n')
file.write(f'\t\t\t\tcase {field.index}: {{\n')
file.write(f'\t\t\t\t\tthis->_p_{field.name} = true;\n')
file.write(f'\t\t\t\t\ti += iota::parse_item<{get_message_native_type(field.type)}>(&buf[i], this->_m_{field.name});\n')
file.write(f'\t\t\t\t\tbreak;\n')
file.write(f'\t\t\t\t}}\n')
file.write(f'\t\t\t\t}}\n')
file.write(f'\t\t\t}}\n')
file.write(f'\t\t}}\n')
for field in message.items:
name = field.name
native_type = get_message_native_type(field.type)
file.write(f'\t\t{native_type}& get_{name}() {{\n')
file.write(f'\t\t\treturn this->_m_{field.name};\n')
file.write(f'\t\t}}\n')
file.write(f'\t\tbool has_{name}() {{\n')
file.write(f'\t\t\treturn this->_p_{field.name};\n')
file.write(f'\t\t}}\n')
file.write(f'\tprivate:\n')
for field in message.items:
name = field.name
native_type = get_message_native_type(field.type)
file.write(f'\t\t{native_type} _m_{name} = {get_message_default_initializer(field.type)}; bool _p_{name} = false;\n')
file.write(f'\t}};\n\n')
def get_enum_native_type(type):
dictionary = {'uint8': 'uint8_t', 'uint16': 'uint16_t', 'uint32': 'uint32_t', 'uint64': 'uint64_t', 'int8': 'int8_t', 'int16': 'int16_t', 'int32': 'int32_t', 'int64': 'int64_t'}
return dictionary.get(type)
def generate_enum(file, enum):
file.write(f'\tenum class {enum.name} : {get_enum_native_type(enum.item_type)} {{\n')
for entry in enum.items:
file.write(f'\t\t{entry.name} = {entry.value},\n')
file.write(f'\t}};\n\n')
def copy_file_contents(file1, file2):
for line in file1:
file2.write(line)
file2.write('\n\n')
def generate(subgenerator, output, items, module):
file = open(output, 'w')
file.write('#pragma once\n\n')
file.write('#include <stdint.h>\n')
file.write('#include <stddef.h>\n')
if not subgenerator:
subgenerator = 'std'
if subgenerator == 'std':
lib_file = open('lib/cpp/lib-std.hpp', 'r')
copy_file_contents(lib_file, file)
lib_file.close()
elif subgenerator == 'frigg':
lib_file = open('lib/cpp/lib-frigg.hpp', 'r')
copy_file_contents(lib_file, file)
lib_file.close()
elif subgenerator == 'sigma-kernel':
lib_file = open('lib/cpp/lib-sigma-kernel.hpp', 'r')
copy_file_contents(lib_file, file)
lib_file.close()
else:
print(f'cpp: Unknown subgenerator: {subgenerator}')
exit()
buffer_builder_file = open('lib/cpp/buffer_builder.hpp', 'r')
copy_file_contents(buffer_builder_file, file)
buffer_builder_file.close()
buffer_parser_file = open('lib/cpp/buffer_parser.hpp', 'r')
copy_file_contents(buffer_parser_file, file)
buffer_parser_file.close()
module_parts = module.split('.')
for part in module_parts:
file.write(f'namespace [[gnu::visibility("hidden")]] {part} {{ ')
file.write('\n')
for item in items:
if item.type == 'message':
generate_builder(file, item)
generate_parser(file, item)
elif item.type == 'enum':
generate_enum(file, item)
else:
print(f'cpp: Unknown item type: {item.type}')
exit()
for part in module_parts:
file.write('} ')
file.close()
print('Generated C++ header') |
'''
@author: l4zyc0d3r
People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt
'''
class Solution:
def triangleNumber(self, N: List[int]) -> int:
cou = 0
N.sort(reverse=True)
for k, x in enumerate(N):
j = k+1
i = len(N)-1
while j<i:
if N[i]+N[j]<=N[k]:
i-=1
else:
cou+=i-j
j+=1
return cou
| """
@author: l4zyc0d3r
People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt
"""
class Solution:
def triangle_number(self, N: List[int]) -> int:
cou = 0
N.sort(reverse=True)
for (k, x) in enumerate(N):
j = k + 1
i = len(N) - 1
while j < i:
if N[i] + N[j] <= N[k]:
i -= 1
else:
cou += i - j
j += 1
return cou |
"""
Manually selected famous paintings that can be optionally put in a test-set.
The MIT License (MIT)
Originally created at 6/23/20, for Python 3.x
Copyright (c) 2021 Panos Achlioptas (ai.stanford.edu/~optas) & Stanford Geometric Computing Lab
"""
masterpieces_for_test = [
'leonardo-da-vinci_mona-lisa',
'vincent-van-gogh_the-starry-night-1889(1)',
'vincent-van-gogh_the-starry-night-1888-1',
'vincent-van-gogh_the-starry-night-1889-1',
'vincent-van-gogh_the-starry-night-1888-2',
'vincent-van-gogh_the-starry-night-1888',
'johannes-vermeer_the-girl-with-a-pearl-earring',
'robert-silvers_girl-with-the-pearl-earring-2008',
'robert-silvers_guernica-photomosaic-mounted-on-aluminum',
'gustav-klimt_the-kiss-1908(1)',
'leonardo-da-vinci_the-lady-with-the-ermine-cecilia-gallerani-1496',
'vincent-van-gogh_cafe-terrace-on-the-place-du-forum-1888(1)',
'vincent-van-gogh_the-cafe-terrace-on-the-place-du-forum-arles-at-night-1888',
'vincent-van-gogh_cafe-terrace-place-du-forum-arles-1888(1)',
'eugene-delacroix_the-liberty-leading-the-people-1830',
'claude-monet_impression-sunrise',
'james-mcneill-whistler_arrangement-in-grey-and-black-no-1-portrait-of-the-artist-s-mother-1871'] | """
Manually selected famous paintings that can be optionally put in a test-set.
The MIT License (MIT)
Originally created at 6/23/20, for Python 3.x
Copyright (c) 2021 Panos Achlioptas (ai.stanford.edu/~optas) & Stanford Geometric Computing Lab
"""
masterpieces_for_test = ['leonardo-da-vinci_mona-lisa', 'vincent-van-gogh_the-starry-night-1889(1)', 'vincent-van-gogh_the-starry-night-1888-1', 'vincent-van-gogh_the-starry-night-1889-1', 'vincent-van-gogh_the-starry-night-1888-2', 'vincent-van-gogh_the-starry-night-1888', 'johannes-vermeer_the-girl-with-a-pearl-earring', 'robert-silvers_girl-with-the-pearl-earring-2008', 'robert-silvers_guernica-photomosaic-mounted-on-aluminum', 'gustav-klimt_the-kiss-1908(1)', 'leonardo-da-vinci_the-lady-with-the-ermine-cecilia-gallerani-1496', 'vincent-van-gogh_cafe-terrace-on-the-place-du-forum-1888(1)', 'vincent-van-gogh_the-cafe-terrace-on-the-place-du-forum-arles-at-night-1888', 'vincent-van-gogh_cafe-terrace-place-du-forum-arles-1888(1)', 'eugene-delacroix_the-liberty-leading-the-people-1830', 'claude-monet_impression-sunrise', 'james-mcneill-whistler_arrangement-in-grey-and-black-no-1-portrait-of-the-artist-s-mother-1871'] |
m = [("chethan", 20, 30), ("john", 40, 50)]
print(m[1])
file = open("writingintocsvfile.csv", "w")
file.write("Name, Age, Weight")
for n in range(len(m)):
file.write('\n')
for k in range(len(m[1])):
file.write(str(m[n][k]))
file.write(',')
file.close() | m = [('chethan', 20, 30), ('john', 40, 50)]
print(m[1])
file = open('writingintocsvfile.csv', 'w')
file.write('Name, Age, Weight')
for n in range(len(m)):
file.write('\n')
for k in range(len(m[1])):
file.write(str(m[n][k]))
file.write(',')
file.close() |
def add_numbers(num1 , num2):
return num1 + num2
def subtract_numbers(num1 , num2):
return num1 - num2
def multiply_numbers(num1 , num2):
return num1 * num2
def divide_numbers(num1 , num2):
return num1 / num2
| def add_numbers(num1, num2):
return num1 + num2
def subtract_numbers(num1, num2):
return num1 - num2
def multiply_numbers(num1, num2):
return num1 * num2
def divide_numbers(num1, num2):
return num1 / num2 |
def multiples_of_3_or_5(limit: int) -> int:
"""Computes the sum of all the multiples of 3 or 5 below the given limit,
using tail recursion.
:param limit: Limit of the values to sum (exclusive).
:return: Sum of all the multiples of 3 or 5 below the given limit.
"""
def loop(acc, num):
if num < 1:
return acc
if num % 3 == 0 or num % 5 == 0:
return loop(acc + num, num - 1)
return loop(acc, num - 1)
return loop(0, limit - 1)
solution = multiples_of_3_or_5
name = 'tail recursion if'
| def multiples_of_3_or_5(limit: int) -> int:
"""Computes the sum of all the multiples of 3 or 5 below the given limit,
using tail recursion.
:param limit: Limit of the values to sum (exclusive).
:return: Sum of all the multiples of 3 or 5 below the given limit.
"""
def loop(acc, num):
if num < 1:
return acc
if num % 3 == 0 or num % 5 == 0:
return loop(acc + num, num - 1)
return loop(acc, num - 1)
return loop(0, limit - 1)
solution = multiples_of_3_or_5
name = 'tail recursion if' |
"""
This file assembles a toolchain for a Mac M1 host using the Clang Compiler and glibc.
It downloads the necessary headers, executables, and pre-compiled static/shared libraries to
the external subfolder of the Bazel cache (the same place third party deps are downloaded with
http_archive or similar functions in WORKSPACE.bazel). These will be able to be used via our
custom c++ toolchain configuration (see //toolchain/clang_toolchain_config.bzl)
"""
def _download_mac_m1_toolchain(ctx):
# TODO(jmbetancourt)
pass
# https://bazel.build/rules/repository_rules
download_mac_m1_toolchain = repository_rule(
implementation = _download_mac_m1_toolchain,
attrs = {},
doc = "Downloads clang, and all supporting headers, executables, " +
"and shared libraries required to build Skia on a Mac M1 host",
)
| """
This file assembles a toolchain for a Mac M1 host using the Clang Compiler and glibc.
It downloads the necessary headers, executables, and pre-compiled static/shared libraries to
the external subfolder of the Bazel cache (the same place third party deps are downloaded with
http_archive or similar functions in WORKSPACE.bazel). These will be able to be used via our
custom c++ toolchain configuration (see //toolchain/clang_toolchain_config.bzl)
"""
def _download_mac_m1_toolchain(ctx):
pass
download_mac_m1_toolchain = repository_rule(implementation=_download_mac_m1_toolchain, attrs={}, doc='Downloads clang, and all supporting headers, executables, ' + 'and shared libraries required to build Skia on a Mac M1 host') |
class DefinitionGroups(object, IEnumerable[DefinitionGroup], IEnumerable, IDisposable):
""" A specialized set of definition groups that allows creation of new groups. """
def Contains(self, definitionGroup):
"""
Contains(self: DefinitionGroups,definitionGroup: DefinitionGroup) -> bool
Tests for the existence of a definition group within the collection.
definitionGroup: The definition group to look for.
Returns: True if the definition group was found,false otherwise.
"""
pass
def Create(self, name):
"""
Create(self: DefinitionGroups,name: str) -> DefinitionGroup
Create a new parameter definition group using the name provided.
name: The name of the group to be created.
Returns: If successful a reference to the new parameter group is returned,otherwise ll.
"""
pass
def Dispose(self):
""" Dispose(self: DefinitionGroups) """
pass
def GetEnumerator(self):
"""
GetEnumerator(self: DefinitionGroups) -> IEnumerator[DefinitionGroup]
Retrieves an enumerator to the collection.
Returns: The enumerator.
"""
pass
def __contains__(self, *args):
""" __contains__[DefinitionGroup](enumerable: IEnumerable[DefinitionGroup],value: DefinitionGroup) -> bool """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __getitem__(self, *args):
""" x.__getitem__(y) <==> x[y] """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __iter__(self, *args):
""" __iter__(self: IEnumerable) -> object """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
IsEmpty = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Identifies if the definition groups collection is empty.
Get: IsEmpty(self: DefinitionGroups) -> bool
"""
Size = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""The number of definition groups in the collection.
Get: Size(self: DefinitionGroups) -> int
"""
| class Definitiongroups(object, IEnumerable[DefinitionGroup], IEnumerable, IDisposable):
""" A specialized set of definition groups that allows creation of new groups. """
def contains(self, definitionGroup):
"""
Contains(self: DefinitionGroups,definitionGroup: DefinitionGroup) -> bool
Tests for the existence of a definition group within the collection.
definitionGroup: The definition group to look for.
Returns: True if the definition group was found,false otherwise.
"""
pass
def create(self, name):
"""
Create(self: DefinitionGroups,name: str) -> DefinitionGroup
Create a new parameter definition group using the name provided.
name: The name of the group to be created.
Returns: If successful a reference to the new parameter group is returned,otherwise ll.
"""
pass
def dispose(self):
""" Dispose(self: DefinitionGroups) """
pass
def get_enumerator(self):
"""
GetEnumerator(self: DefinitionGroups) -> IEnumerator[DefinitionGroup]
Retrieves an enumerator to the collection.
Returns: The enumerator.
"""
pass
def __contains__(self, *args):
""" __contains__[DefinitionGroup](enumerable: IEnumerable[DefinitionGroup],value: DefinitionGroup) -> bool """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __getitem__(self, *args):
""" x.__getitem__(y) <==> x[y] """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __iter__(self, *args):
""" __iter__(self: IEnumerable) -> object """
pass
def __repr__(self, *args):
""" __repr__(self: object) -> str """
pass
is_empty = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Identifies if the definition groups collection is empty.\n\n\n\nGet: IsEmpty(self: DefinitionGroups) -> bool\n\n\n\n'
size = property(lambda self: object(), lambda self, v: None, lambda self: None)
'The number of definition groups in the collection.\n\n\n\nGet: Size(self: DefinitionGroups) -> int\n\n\n\n' |
def solution():
data = open(r'inputs\day11.in').readlines()
print('Part 1 result: ' + str(part1(data)))
print('Part 2 result: ' + str(part2(data)))
def part1(data):
# 2d array of ints that represents the octopus' current value
octomap = []
for line in data:
octomap.append([int(x) for x in line.strip()])
adj = {
# up one row all 3 spots
(-1, 1),
(-1, 0),
(-1, -1),
# same row, left and right spots
(0, -1),
(0, 1),
# down 1 row, all 3 spots
(1, -1),
(1, 0),
(1, 1)
}
# track the number of flashes
flash_count = 0
rows = len(octomap)
cols = len(octomap[0])
# 100 steps for p1
for step in range(100):
# get the new octomap by adding 1 to each value
octomap = [[x + 1 for x in row] for row in octomap]
# our stack is a list which consists of a tuple of the row and column of each value that is greater than 9, a.k.a the spots a flash should occur at
stack = [(row, col) for row in range(rows) for col in range(cols) if octomap[row][col] > 9]
# while we have stuff in the stack
while stack:
# pop off the top value into our row and column variables
row, col = stack.pop()
# increment our flash count
flash_count += 1
# loop through the neighbors of the popped value
for dx, dy in adj:
if 0 <= row + dx < rows and 0 <= col + dy < cols:
# if its a valid neighbor, add 1 to it, and if it is now a 10, add it to the stack
octomap[row + dx][col + dy] += 1
if octomap[row + dx][col + dy] == 10:
stack.append((row + dx, col + dy))
# at the end of each step, set all values greater than 9 to 0, because they flashed that step
octomap = [[0 if x > 9 else x for x in row] for row in octomap]
return flash_count
def part2(data):
# 2d array of ints of the octopus' current value
octomap = []
for line in data:
octomap.append([int(x) for x in line.strip()])
adj = {
# up one row all 3 spots
(-1, 1),
(-1, 0),
(-1, -1),
# same row, left and right spots
(0, -1),
(0, 1),
# down 1 row, all 3 spots
(1, -1),
(1, 0),
(1, 1)
}
rows = len(octomap)
cols = len(octomap[0])
# similar setup to part 1, but now we track the number of steps outside the loop and use an infinite while loop, since we don't know when the synchronized flash will occur
step = 0
while True:
step += 1
octomap = [[x + 1 for x in row] for row in octomap]
stack = [(row, col) for row in range(rows) for col in range(cols) if octomap[row][col] > 9]
# count the number of flashes in the current step
step_flashes = 0
while stack:
row, col = stack.pop()
# each time we pop off the stack, we are doing a flash, so increment our flash count
step_flashes += 1
for dx, dy in adj:
if 0 <= row + dx < rows and 0 <= col + dy < cols:
octomap[row + dx][col + dy] += 1
if octomap[row + dx][col + dy] == 10:
stack.append((row + dx, col + dy))
octomap = [[0 if x > 9 else x for x in row] for row in octomap]
# if we have 100 flashes this step, then all of the octopi have flashed, because there is a 10x10 grid of octopi, and each octopus flashes at most once per step
if step_flashes == 100:
# so return the step we are on as they are synchronized here
return step
solution() | def solution():
data = open('inputs\\day11.in').readlines()
print('Part 1 result: ' + str(part1(data)))
print('Part 2 result: ' + str(part2(data)))
def part1(data):
octomap = []
for line in data:
octomap.append([int(x) for x in line.strip()])
adj = {(-1, 1), (-1, 0), (-1, -1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)}
flash_count = 0
rows = len(octomap)
cols = len(octomap[0])
for step in range(100):
octomap = [[x + 1 for x in row] for row in octomap]
stack = [(row, col) for row in range(rows) for col in range(cols) if octomap[row][col] > 9]
while stack:
(row, col) = stack.pop()
flash_count += 1
for (dx, dy) in adj:
if 0 <= row + dx < rows and 0 <= col + dy < cols:
octomap[row + dx][col + dy] += 1
if octomap[row + dx][col + dy] == 10:
stack.append((row + dx, col + dy))
octomap = [[0 if x > 9 else x for x in row] for row in octomap]
return flash_count
def part2(data):
octomap = []
for line in data:
octomap.append([int(x) for x in line.strip()])
adj = {(-1, 1), (-1, 0), (-1, -1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)}
rows = len(octomap)
cols = len(octomap[0])
step = 0
while True:
step += 1
octomap = [[x + 1 for x in row] for row in octomap]
stack = [(row, col) for row in range(rows) for col in range(cols) if octomap[row][col] > 9]
step_flashes = 0
while stack:
(row, col) = stack.pop()
step_flashes += 1
for (dx, dy) in adj:
if 0 <= row + dx < rows and 0 <= col + dy < cols:
octomap[row + dx][col + dy] += 1
if octomap[row + dx][col + dy] == 10:
stack.append((row + dx, col + dy))
octomap = [[0 if x > 9 else x for x in row] for row in octomap]
if step_flashes == 100:
return step
solution() |
{
"variables": {
"boost_lib": "<!(node -p \"process.env.BOOST_LIB || '../../deps/boost/stage/lib'\")",
"boost_dir": "<!(node -p \"process.env.BOOST_DIR || 'boost'\")",
"conditions": [
["target_arch=='x64'", {
"arch": "x64",
}],
["target_arch=='ia32'", {
"arch": "x32",
}],
],
},
"target_defaults": {
"libraries": [
"Shlwapi.lib",
"Version.lib",
"<(boost_lib)/libboost_atomic-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_atomic-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_chrono-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_chrono-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_context-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_context-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_coroutine-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_coroutine-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_date_time-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_date_time-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_filesystem-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_filesystem-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_locale-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_locale-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_log-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_log-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_log_setup-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_log_setup-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_regex-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_regex-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_system-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_system-vc141-mt-sgd-<(arch)-1_67.lib",
"<(boost_lib)/libboost_thread-vc141-mt-s-<(arch)-1_67.lib",
"<(boost_lib)/libboost_thread-vc141-mt-sgd-<(arch)-1_67.lib"
],
},
"targets": [
# build shared
{
"target_name": "shared",
"type": "static_library",
"dependencies": [
"./usvfs_deps.gyp:fmt",
"./usvfs_deps.gyp:spdlog"
],
"defines": [
"_WIN64",
"SPDLOG_NO_NAME",
"SPDLOG_NO_REGISTRY_MUTEX",
"NOMINMAX",
"_WINDOWS",
"NDEBUG",
"BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE"
],
"include_dirs": [
"usvfs/src/shared",
"usvfs/include",
"<(boost_dir)",
"usvfs/fmt",
"usvfs/spdlog/include/spdlog"
],
"sources": [
"usvfs/src/shared/addrtools.cpp",
"usvfs/src/shared/debug_monitor.cpp",
"usvfs/src/shared/directory_tree.cpp",
"usvfs/src/shared/exceptionex.cpp",
"usvfs/src/shared/loghelpers.cpp",
"usvfs/src/shared/ntdll_declarations.cpp",
"usvfs/src/shared/scopeguard.cpp",
"usvfs/src/shared/shmlogger.cpp",
"usvfs/src/shared/stringcast_win.cpp",
"usvfs/src/shared/stringutils.cpp",
"usvfs/src/shared/test_helpers.cpp",
"usvfs/src/shared/unicodestring.cpp",
"usvfs/src/shared/wildcard.cpp",
"usvfs/src/shared/winapi.cpp",
"usvfs/src/shared/windows_error.cpp"
],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_configuration_attributes": {
"CharacterSet": 1
},
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.16299.0"
}
}
},
# build thooklib
{
"target_name": "thooklib",
"type": "static_library",
"dependencies": [
"./usvfs_deps.gyp:asmjit",
"shared",
"./usvfs_deps.gyp:spdlog"
],
"defines": [
"_WIN64",
"ASMJIT_STATIC",
"SPDLOG_NO_NAME",
"SPDLOG_NO_REGISTRY_MUTEX",
"NOMINMAX",
"_WINDOWS",
"NDEBUG",
"BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE"
],
"include_dirs": [
"usvfs/src/thooklib",
"usvfs/src/shared",
"usvfs/src/tinjectlib",
"usvfs/src/usvfs_helper",
"usvfs/asmjit/src/asmjit",
"usvfs/udis86",
"usvfs/include",
"<(boost_dir)",
"usvfs/fmt",
"usvfs/spdlog/include/spdlog"
],
"sources": [
"usvfs/src/thooklib/hooklib.cpp",
"usvfs/src/thooklib/ttrampolinepool.cpp",
"usvfs/src/thooklib/udis86wrapper.cpp",
"usvfs/src/thooklib/utility.cpp"
],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_configuration_attributes": {
"CharacterSet": 1
},
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.16299.0"
}
}
},
# build tinjectlib
{
"target_name": "tinjectlib",
"type": "static_library",
"dependencies": [
"./usvfs_deps.gyp:asmjit",
"shared"
],
"defines": [
"_WIN64",
"ASMJIT_STATIC",
"SPDLOG_NO_NAME",
"SPDLOG_NO_REGISTRY_MUTEX",
"NOMINMAX",
"_WINDOWS",
"NDEBUG",
"BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE"
],
"include_dirs": [
"usvfs/src/tinjectlib",
"usvfs/src/shared",
"usvfs/src/thooklib",
"usvfs/src/usvfs_helper",
"usvfs/asmjit/src/asmjit",
"usvfs/udis86",
"usvfs/include",
"<(boost_dir)",
"usvfs/fmt",
"usvfs/spdlog/include/spdlog"
],
"sources": [
"usvfs/src/tinjectlib/injectlib.cpp"
],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_configuration_attributes": {
"CharacterSet": 1
},
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.16299.0"
}
}
},
# usvfs_helper
{
"target_name": "usvfs_helper",
"type": "static_library",
"dependencies": [
"shared",
"tinjectlib"
],
"defines": [
"BUILDING_USVFS_DLL",
"_WIN64",
"ASMJIT_STATIC",
"SPDLOG_NO_NAME",
"SPDLOG_NO_REGISTRY_MUTEX",
"NOMINMAX",
"_WINDOWS",
"NDEBUG",
"BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE"
],
"include_dirs": [
"usvfs/src/usvfs_helper",
"usvfs/src/shared",
"usvfs/src/thooklib",
"usvfs/src/tinjectlib",
"usvfs/asmjit/src/asmjit",
"usvfs/udis86",
"usvfs/include",
"<(boost_dir)",
"usvfs/fmt",
"usvfs/spdlog/include/spdlog"
],
"sources": [
"usvfs/src/usvfs_helper/inject.cpp"
],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_configuration_attributes": {
"CharacterSet": 1
},
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.16299.0"
}
}
},
# usvfs
{
"target_name": "usvfs",
"type": "shared_library",
"dependencies": [
"./usvfs_deps.gyp:asmjit",
"./usvfs_deps.gyp:fmt",
"shared",
"./usvfs_deps.gyp:spdlog",
"thooklib",
"tinjectlib",
"./usvfs_deps.gyp:udis86",
"usvfs_helper"
],
"defines": [
"BUILDING_USVFS_DLL",
"ASMJIT_STATIC",
"SPDLOG_NO_NAME",
"SPDLOG_NO_REGISTRY_MUTEX",
"NOMINMAX",
"_WINDOWS",
"NDEBUG",
"BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE"
],
"include_dirs": [
"usvfs/include",
"usvfs/src/usvfs_dll",
"usvfs/src/shared",
"usvfs/src/thooklib",
"usvfs/src/tinjectlib",
"usvfs/src/usvfs_helper",
"usvfs/asmjit/src/asmjit",
"usvfs/udis86",
"<(boost_dir)",
"usvfs/fmt",
"usvfs/spdlog/include/spdlog"
],
"sources": [
"usvfs/src/usvfs_dll/hookcallcontext.cpp",
"usvfs/src/usvfs_dll/hookcontext.cpp",
"usvfs/src/usvfs_dll/hookmanager.cpp",
"usvfs/src/usvfs_dll/hooks/kernel32.cpp",
"usvfs/src/usvfs_dll/hooks/ntdll.cpp",
"usvfs/src/usvfs_dll/redirectiontree.cpp",
"usvfs/src/usvfs_dll/semaphore.cpp",
"usvfs/src/usvfs_dll/stringcast_boost.cpp",
"usvfs/src/usvfs_dll/usvfs.cpp"
],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_configuration_attributes": {
"CharacterSet": 1
},
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.16299.0"
}
}
},
# usvfs_proxy
{
"target_name": "usvfs_proxy",
"type": "executable",
"dependencies": [
"./usvfs_deps.gyp:asmjit",
"shared",
"tinjectlib",
"usvfs",
"usvfs_helper"
],
"defines": [
"_WIN64",
"ASMJIT_STATIC",
"SPDLOG_NO_NAME",
"SPDLOG_NO_REGISTRY_MUTEX",
"NOMINMAX",
"_WINDOWS",
"NDEBUG",
"BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE"
],
"include_dirs": [
"usvfs/src/shared",
"usvfs/src/thooklib",
"usvfs/src/tinjectlib",
"usvfs/src/usvfs_helper",
"usvfs/asmjit/src/asmjit",
"usvfs/udis86",
"usvfs/include",
"<(boost_dir)",
"usvfs/fmt",
"usvfs/spdlog/include/spdlog"
],
"sources": [
"usvfs/src/usvfs_proxy/main.cpp"
],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_configuration_attributes": {
"CharacterSet": 1
},
"msbuild_toolset": "v141",
"msvs_windows_target_platform_version": "10.0.16299.0"
}
}
},
]
}
| {'variables': {'boost_lib': '<!(node -p "process.env.BOOST_LIB || \'../../deps/boost/stage/lib\'")', 'boost_dir': '<!(node -p "process.env.BOOST_DIR || \'boost\'")', 'conditions': [["target_arch=='x64'", {'arch': 'x64'}], ["target_arch=='ia32'", {'arch': 'x32'}]]}, 'target_defaults': {'libraries': ['Shlwapi.lib', 'Version.lib', '<(boost_lib)/libboost_atomic-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_atomic-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_chrono-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_chrono-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_context-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_context-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_coroutine-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_coroutine-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_date_time-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_date_time-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_filesystem-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_filesystem-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_locale-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_locale-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_log-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_log-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_log_setup-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_log_setup-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_regex-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_regex-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_system-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_system-vc141-mt-sgd-<(arch)-1_67.lib', '<(boost_lib)/libboost_thread-vc141-mt-s-<(arch)-1_67.lib', '<(boost_lib)/libboost_thread-vc141-mt-sgd-<(arch)-1_67.lib']}, 'targets': [{'target_name': 'shared', 'type': 'static_library', 'dependencies': ['./usvfs_deps.gyp:fmt', './usvfs_deps.gyp:spdlog'], 'defines': ['_WIN64', 'SPDLOG_NO_NAME', 'SPDLOG_NO_REGISTRY_MUTEX', 'NOMINMAX', '_WINDOWS', 'NDEBUG', 'BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE'], 'include_dirs': ['usvfs/src/shared', 'usvfs/include', '<(boost_dir)', 'usvfs/fmt', 'usvfs/spdlog/include/spdlog'], 'sources': ['usvfs/src/shared/addrtools.cpp', 'usvfs/src/shared/debug_monitor.cpp', 'usvfs/src/shared/directory_tree.cpp', 'usvfs/src/shared/exceptionex.cpp', 'usvfs/src/shared/loghelpers.cpp', 'usvfs/src/shared/ntdll_declarations.cpp', 'usvfs/src/shared/scopeguard.cpp', 'usvfs/src/shared/shmlogger.cpp', 'usvfs/src/shared/stringcast_win.cpp', 'usvfs/src/shared/stringutils.cpp', 'usvfs/src/shared/test_helpers.cpp', 'usvfs/src/shared/unicodestring.cpp', 'usvfs/src/shared/wildcard.cpp', 'usvfs/src/shared/winapi.cpp', 'usvfs/src/shared/windows_error.cpp'], 'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1, 'RuntimeTypeInfo': 'true'}}, 'msvs_configuration_attributes': {'CharacterSet': 1}, 'msbuild_toolset': 'v141', 'msvs_windows_target_platform_version': '10.0.16299.0'}}}, {'target_name': 'thooklib', 'type': 'static_library', 'dependencies': ['./usvfs_deps.gyp:asmjit', 'shared', './usvfs_deps.gyp:spdlog'], 'defines': ['_WIN64', 'ASMJIT_STATIC', 'SPDLOG_NO_NAME', 'SPDLOG_NO_REGISTRY_MUTEX', 'NOMINMAX', '_WINDOWS', 'NDEBUG', 'BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE'], 'include_dirs': ['usvfs/src/thooklib', 'usvfs/src/shared', 'usvfs/src/tinjectlib', 'usvfs/src/usvfs_helper', 'usvfs/asmjit/src/asmjit', 'usvfs/udis86', 'usvfs/include', '<(boost_dir)', 'usvfs/fmt', 'usvfs/spdlog/include/spdlog'], 'sources': ['usvfs/src/thooklib/hooklib.cpp', 'usvfs/src/thooklib/ttrampolinepool.cpp', 'usvfs/src/thooklib/udis86wrapper.cpp', 'usvfs/src/thooklib/utility.cpp'], 'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1, 'RuntimeTypeInfo': 'true'}}, 'msvs_configuration_attributes': {'CharacterSet': 1}, 'msbuild_toolset': 'v141', 'msvs_windows_target_platform_version': '10.0.16299.0'}}}, {'target_name': 'tinjectlib', 'type': 'static_library', 'dependencies': ['./usvfs_deps.gyp:asmjit', 'shared'], 'defines': ['_WIN64', 'ASMJIT_STATIC', 'SPDLOG_NO_NAME', 'SPDLOG_NO_REGISTRY_MUTEX', 'NOMINMAX', '_WINDOWS', 'NDEBUG', 'BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE'], 'include_dirs': ['usvfs/src/tinjectlib', 'usvfs/src/shared', 'usvfs/src/thooklib', 'usvfs/src/usvfs_helper', 'usvfs/asmjit/src/asmjit', 'usvfs/udis86', 'usvfs/include', '<(boost_dir)', 'usvfs/fmt', 'usvfs/spdlog/include/spdlog'], 'sources': ['usvfs/src/tinjectlib/injectlib.cpp'], 'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1, 'RuntimeTypeInfo': 'true'}}, 'msvs_configuration_attributes': {'CharacterSet': 1}, 'msbuild_toolset': 'v141', 'msvs_windows_target_platform_version': '10.0.16299.0'}}}, {'target_name': 'usvfs_helper', 'type': 'static_library', 'dependencies': ['shared', 'tinjectlib'], 'defines': ['BUILDING_USVFS_DLL', '_WIN64', 'ASMJIT_STATIC', 'SPDLOG_NO_NAME', 'SPDLOG_NO_REGISTRY_MUTEX', 'NOMINMAX', '_WINDOWS', 'NDEBUG', 'BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE'], 'include_dirs': ['usvfs/src/usvfs_helper', 'usvfs/src/shared', 'usvfs/src/thooklib', 'usvfs/src/tinjectlib', 'usvfs/asmjit/src/asmjit', 'usvfs/udis86', 'usvfs/include', '<(boost_dir)', 'usvfs/fmt', 'usvfs/spdlog/include/spdlog'], 'sources': ['usvfs/src/usvfs_helper/inject.cpp'], 'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1, 'RuntimeTypeInfo': 'true'}}, 'msvs_configuration_attributes': {'CharacterSet': 1}, 'msbuild_toolset': 'v141', 'msvs_windows_target_platform_version': '10.0.16299.0'}}}, {'target_name': 'usvfs', 'type': 'shared_library', 'dependencies': ['./usvfs_deps.gyp:asmjit', './usvfs_deps.gyp:fmt', 'shared', './usvfs_deps.gyp:spdlog', 'thooklib', 'tinjectlib', './usvfs_deps.gyp:udis86', 'usvfs_helper'], 'defines': ['BUILDING_USVFS_DLL', 'ASMJIT_STATIC', 'SPDLOG_NO_NAME', 'SPDLOG_NO_REGISTRY_MUTEX', 'NOMINMAX', '_WINDOWS', 'NDEBUG', 'BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE'], 'include_dirs': ['usvfs/include', 'usvfs/src/usvfs_dll', 'usvfs/src/shared', 'usvfs/src/thooklib', 'usvfs/src/tinjectlib', 'usvfs/src/usvfs_helper', 'usvfs/asmjit/src/asmjit', 'usvfs/udis86', '<(boost_dir)', 'usvfs/fmt', 'usvfs/spdlog/include/spdlog'], 'sources': ['usvfs/src/usvfs_dll/hookcallcontext.cpp', 'usvfs/src/usvfs_dll/hookcontext.cpp', 'usvfs/src/usvfs_dll/hookmanager.cpp', 'usvfs/src/usvfs_dll/hooks/kernel32.cpp', 'usvfs/src/usvfs_dll/hooks/ntdll.cpp', 'usvfs/src/usvfs_dll/redirectiontree.cpp', 'usvfs/src/usvfs_dll/semaphore.cpp', 'usvfs/src/usvfs_dll/stringcast_boost.cpp', 'usvfs/src/usvfs_dll/usvfs.cpp'], 'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1, 'RuntimeTypeInfo': 'true'}}, 'msvs_configuration_attributes': {'CharacterSet': 1}, 'msbuild_toolset': 'v141', 'msvs_windows_target_platform_version': '10.0.16299.0'}}}, {'target_name': 'usvfs_proxy', 'type': 'executable', 'dependencies': ['./usvfs_deps.gyp:asmjit', 'shared', 'tinjectlib', 'usvfs', 'usvfs_helper'], 'defines': ['_WIN64', 'ASMJIT_STATIC', 'SPDLOG_NO_NAME', 'SPDLOG_NO_REGISTRY_MUTEX', 'NOMINMAX', '_WINDOWS', 'NDEBUG', 'BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE'], 'include_dirs': ['usvfs/src/shared', 'usvfs/src/thooklib', 'usvfs/src/tinjectlib', 'usvfs/src/usvfs_helper', 'usvfs/asmjit/src/asmjit', 'usvfs/udis86', 'usvfs/include', '<(boost_dir)', 'usvfs/fmt', 'usvfs/spdlog/include/spdlog'], 'sources': ['usvfs/src/usvfs_proxy/main.cpp'], 'configurations': {'Release': {'msvs_settings': {'VCCLCompilerTool': {'ExceptionHandling': 1, 'RuntimeTypeInfo': 'true'}}, 'msvs_configuration_attributes': {'CharacterSet': 1}, 'msbuild_toolset': 'v141', 'msvs_windows_target_platform_version': '10.0.16299.0'}}}]} |
class Solution:
def solve(self, nums):
setNums = set(nums)
count = 0
for i in setNums:
if i + 1 in setNums:
count += nums.count(i)
return count
| class Solution:
def solve(self, nums):
set_nums = set(nums)
count = 0
for i in setNums:
if i + 1 in setNums:
count += nums.count(i)
return count |
# -*- coding: utf-8 -*-
"""
Created on 14 Apr 2020 15:08:45
@author: jiahuei
"""
| """
Created on 14 Apr 2020 15:08:45
@author: jiahuei
""" |
class Movie:
def __init__(self, name):
self.__name = name
@property
def name(self):
return self.__name
def __str__(self) -> str:
return self.__name
class Ticket:
def __init__(self, movie=None, location=None):
if movie is None:
movie = Movie('Avengers')
if location == None:
location = 'PVR Cinemas'
self.__movie = movie
self.__location = location
def __str__(self) -> str:
return f"movie = {self.__movie}, location = {self.__location}"
@property
def movie(self):
return self.__movie
@property
def location(self):
return self.__location
t1 = Ticket()
print(t1)
m1 = Movie('Justice League')
t2 = Ticket(movie=m1)
print(t2)
| class Movie:
def __init__(self, name):
self.__name = name
@property
def name(self):
return self.__name
def __str__(self) -> str:
return self.__name
class Ticket:
def __init__(self, movie=None, location=None):
if movie is None:
movie = movie('Avengers')
if location == None:
location = 'PVR Cinemas'
self.__movie = movie
self.__location = location
def __str__(self) -> str:
return f'movie = {self.__movie}, location = {self.__location}'
@property
def movie(self):
return self.__movie
@property
def location(self):
return self.__location
t1 = ticket()
print(t1)
m1 = movie('Justice League')
t2 = ticket(movie=m1)
print(t2) |
"""Experiments Module
========================
This module merge all the modules under the concept of experiment.
"""
| """Experiments Module
========================
This module merge all the modules under the concept of experiment.
""" |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 16 09:42:38 2019
@author: Giles
"""
# x = 5
# y = 12
#
# z = x + y
#
# print(z)
# 1x = 3
# new_variable = 9
# z = x - y
# a = 2.5
# b = 3.14159
# c = b * a**2
# #
# radius = 2.5
# pi = 3.14159
# area_of_circle = pi * radius**2
# phrase_1 = 'The cat sat on the mat!'
# phrase_2 = 'And so did the dog!'
# phrase_3 = phrase_1 + ' ' + phrase_2
# print(phrase_3)
user_input = int(input('How many apples do you have?\n >>> '))
# help()
# while = 5: | """
Created on Wed Oct 16 09:42:38 2019
@author: Giles
"""
user_input = int(input('How many apples do you have?\n >>> ')) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def _closest(lst, number):
"""Find the closest number in a list.
Arguments:
lst: List to look into.
number: Desired number.
"""
return lst[min(range(len(lst)), key=lambda i: abs(lst[i] - number))]
| def _closest(lst, number):
"""Find the closest number in a list.
Arguments:
lst: List to look into.
number: Desired number.
"""
return lst[min(range(len(lst)), key=lambda i: abs(lst[i] - number))] |
# -*- coding:utf-8 -*-
#https://leetcode.com/problems/substring-with-concatenation-of-all-words/description/
class Solution(object):
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
ret = []
if not words:
return ret
len_s, len_words, len_word = len(s), len(words), len(words[0])
dict_word = {}
for word in words:
dict_word[word] = dict_word.get(word, 0) + 1
for i in range(len_word):
begin, end = i, i
dict_curr = {}
while end + len_word <= len_s:
curr = s[end : end + len_word]
end += len_word
if curr not in dict_word:
begin = end
dict_curr = {}
else:
dict_curr[curr] = dict_curr.get(curr, 0) + 1
while dict_curr[curr] > dict_word[curr]:
dict_curr[s[begin : begin + len_word]] -= 1
begin += len_word
if begin + len_words * len_word == end:
ret.append(begin)
return ret
| class Solution(object):
def find_substring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
ret = []
if not words:
return ret
(len_s, len_words, len_word) = (len(s), len(words), len(words[0]))
dict_word = {}
for word in words:
dict_word[word] = dict_word.get(word, 0) + 1
for i in range(len_word):
(begin, end) = (i, i)
dict_curr = {}
while end + len_word <= len_s:
curr = s[end:end + len_word]
end += len_word
if curr not in dict_word:
begin = end
dict_curr = {}
else:
dict_curr[curr] = dict_curr.get(curr, 0) + 1
while dict_curr[curr] > dict_word[curr]:
dict_curr[s[begin:begin + len_word]] -= 1
begin += len_word
if begin + len_words * len_word == end:
ret.append(begin)
return ret |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.