content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
__author__ = "Brett Fitzpatrick"
__version__ = "0.1"
__license__ = "MIT"
__status__ = "Development"
| __author__ = 'Brett Fitzpatrick'
__version__ = '0.1'
__license__ = 'MIT'
__status__ = 'Development' |
_base_ = './hv_pointpillars_fpn_nus.py'
# model settings (based on nuScenes model settings)
# Voxel size for voxel encoder
# Usually voxel size is changed consistently with the point cloud range
# If point cloud range is modified, do remember to change all related
# keys in the config.
model = dict(
pts_voxel_layer=dict(
max_num_points=20,
point_cloud_range=[-100, -100, -5, 100, 100, 3],
max_voxels=(60000, 60000)),
pts_voxel_encoder=dict(
feat_channels=[64], point_cloud_range=[-100, -100, -5, 100, 100, 3]),
pts_middle_encoder=dict(output_shape=[800, 800]),
pts_bbox_head=dict(
num_classes=9,
anchor_generator=dict(
ranges=[[-100, -100, -1.8, 100, 100, -1.8]], custom_values=[]),
bbox_coder=dict(type='DeltaXYZWLHRBBoxCoder', code_size=7)))
# model training settings (based on nuScenes model settings)
train_cfg = dict(pts=dict(code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]))
| _base_ = './hv_pointpillars_fpn_nus.py'
model = dict(pts_voxel_layer=dict(max_num_points=20, point_cloud_range=[-100, -100, -5, 100, 100, 3], max_voxels=(60000, 60000)), pts_voxel_encoder=dict(feat_channels=[64], point_cloud_range=[-100, -100, -5, 100, 100, 3]), pts_middle_encoder=dict(output_shape=[800, 800]), pts_bbox_head=dict(num_classes=9, anchor_generator=dict(ranges=[[-100, -100, -1.8, 100, 100, -1.8]], custom_values=[]), bbox_coder=dict(type='DeltaXYZWLHRBBoxCoder', code_size=7)))
train_cfg = dict(pts=dict(code_weight=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])) |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../build/win_precompile.gypi',
],
'targets': [
{
'target_name': 'check_sdk_patch',
'type': 'none',
'variables': {
'check_sdk_script': 'util/check_sdk_patch.py',
'output_path': '<(INTERMEDIATE_DIR)/check_sdk_patch',
},
'actions': [
{
'action_name': 'check_sdk_patch_action',
'inputs': [
'<(check_sdk_script)',
],
'outputs': [
# This keeps the ninja build happy and provides a slightly helpful
# error messge if the sdk is missing.
'<(output_path)'
],
'action': ['python',
'<(check_sdk_script)',
'<(windows_sdk_path)',
'<(output_path)',
],
},
],
},
{
'target_name': 'win8_util',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
],
'sources': [
'util/win8_util.cc',
'util/win8_util.h',
],
},
{
'target_name': 'test_support_win8',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'test_registrar_constants',
],
'sources': [
'test/metro_registration_helper.cc',
'test/metro_registration_helper.h',
'test/open_with_dialog_async.cc',
'test/open_with_dialog_async.h',
'test/open_with_dialog_controller.cc',
'test/open_with_dialog_controller.h',
'test/ui_automation_client.cc',
'test/ui_automation_client.h',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [ 4267, ],
},
{
'target_name': 'test_registrar_constants',
'type': 'static_library',
'include_dirs': [
'..',
],
'sources': [
'test/test_registrar_constants.cc',
'test/test_registrar_constants.h',
],
},
],
}
| {'variables': {'chromium_code': 1}, 'includes': ['../build/win_precompile.gypi'], 'targets': [{'target_name': 'check_sdk_patch', 'type': 'none', 'variables': {'check_sdk_script': 'util/check_sdk_patch.py', 'output_path': '<(INTERMEDIATE_DIR)/check_sdk_patch'}, 'actions': [{'action_name': 'check_sdk_patch_action', 'inputs': ['<(check_sdk_script)'], 'outputs': ['<(output_path)'], 'action': ['python', '<(check_sdk_script)', '<(windows_sdk_path)', '<(output_path)']}]}, {'target_name': 'win8_util', 'type': 'static_library', 'dependencies': ['../base/base.gyp:base'], 'sources': ['util/win8_util.cc', 'util/win8_util.h']}, {'target_name': 'test_support_win8', 'type': 'static_library', 'dependencies': ['../base/base.gyp:base', 'test_registrar_constants'], 'sources': ['test/metro_registration_helper.cc', 'test/metro_registration_helper.h', 'test/open_with_dialog_async.cc', 'test/open_with_dialog_async.h', 'test/open_with_dialog_controller.cc', 'test/open_with_dialog_controller.h', 'test/ui_automation_client.cc', 'test/ui_automation_client.h'], 'msvs_disabled_warnings': [4267]}, {'target_name': 'test_registrar_constants', 'type': 'static_library', 'include_dirs': ['..'], 'sources': ['test/test_registrar_constants.cc', 'test/test_registrar_constants.h']}]} |
class Solution:
def maxSlidingWindow(self, nums, k):
deq, n, ans = deque([0]), len(nums), []
for i in range (n):
while deq and deq[0] <= i - k:
deq.popleft()
while deq and nums[i] >= nums[deq[-1]] :
deq.pop()
deq.append(i)
ans.append(nums[deq[0]])
return ans[k-1:]
| class Solution:
def max_sliding_window(self, nums, k):
(deq, n, ans) = (deque([0]), len(nums), [])
for i in range(n):
while deq and deq[0] <= i - k:
deq.popleft()
while deq and nums[i] >= nums[deq[-1]]:
deq.pop()
deq.append(i)
ans.append(nums[deq[0]])
return ans[k - 1:] |
TEXT_BLACK = "\033[0;30;40m"
TEXT_RED = "\033[1;31;40m"
TEXT_GREEN = "\033[1;32;40m"
TEXT_YELLOW = "\033[1;33;40m"
TEXT_WHITE = "\033[1;37;40m"
TEXT_BLUE = "\033[1;34;40m"
TEXT_RESET = "\033[0;0m"
def get_color(ctype):
if ctype == 'yellow':
color = TEXT_YELLOW
elif ctype == 'green':
color = TEXT_GREEN
elif ctype == 'white':
color = TEXT_WHITE
elif ctype == 'black':
color = TEXT_BLACK
elif ctype == 'blue':
color = TEXT_BLUE
elif ctype == 'red':
color = TEXT_RED
return color
def print_emph(msg):
bar = "# # # # # # # # # # # # # # # # # # # #"
print("{}{}".format(TEXT_WHITE, bar))
print("# {}".format(msg))
print("{}{}".format(bar, TEXT_RESET))
pass
def print_highlight(msg, ctype='yellow'):
color = get_color(ctype)
print("{}{}{}".format(color, msg, TEXT_RESET))
def test():
print("\033[0;37;40m Normal text\n")
print("\033[2;37;40m Underlined text\033[0;37;40m \n")
print("\033[1;37;40m Bright Colour\033[0;37;40m \n")
print("\033[3;37;40m Negative Colour\033[0;37;40m \n")
print("\033[5;37;40m Negative Colour\033[0;37;40m\n")
print("\033[1;37;40m \033[2;37:40m TextColour BlackBackground TextColour GreyBackground WhiteText ColouredBackground\033[0;37;40m\n")
print("\033[1;30;40m Dark Gray \033[0m 1;30;40m \033[0;30;47m Black \033[0m 0;30;47m \033[0;37;41m Black \033[0m 0;37;41m")
print("\033[1;31;40m Bright Red \033[0m 1;31;40m \033[0;31;47m Red \033[0m 0;31;47m \033[0;37;42m Black \033[0m 0;37;42m")
print("\033[1;32;40m Bright Green \033[0m 1;32;40m \033[0;32;47m Green \033[0m 0;32;47m \033[0;37;43m Black \033[0m 0;37;43m")
print("\033[1;33;40m Yellow \033[0m 1;33;40m \033[0;33;47m Brown \033[0m 0;33;47m \033[0;37;44m Black \033[0m 0;37;44m")
print("\033[1;34;40m Bright Blue \033[0m 1;34;40m \033[0;34;47m Blue \033[0m 0;34;47m \033[0;37;45m Black \033[0m 0;37;45m")
print("\033[1;35;40m Bright Magenta \033[0m 1;35;40m \033[0;35;47m Magenta \033[0m 0;35;47m \033[0;37;46m Black \033[0m 0;37;46m")
print("\033[1;36;40m Bright Cyan \033[0m 1;36;40m \033[0;36;47m Cyan \033[0m 0;36;47m \033[0;37;47m Black \033[0m 0;37;47m")
print("\033[1;37;40m White \033[0m 1;37;40m \033[0;37;40m Light Grey \033[0m 0;37;40m \033[0;37;48m Black \033[0m 0;37;48m")
| text_black = '\x1b[0;30;40m'
text_red = '\x1b[1;31;40m'
text_green = '\x1b[1;32;40m'
text_yellow = '\x1b[1;33;40m'
text_white = '\x1b[1;37;40m'
text_blue = '\x1b[1;34;40m'
text_reset = '\x1b[0;0m'
def get_color(ctype):
if ctype == 'yellow':
color = TEXT_YELLOW
elif ctype == 'green':
color = TEXT_GREEN
elif ctype == 'white':
color = TEXT_WHITE
elif ctype == 'black':
color = TEXT_BLACK
elif ctype == 'blue':
color = TEXT_BLUE
elif ctype == 'red':
color = TEXT_RED
return color
def print_emph(msg):
bar = '# # # # # # # # # # # # # # # # # # # #'
print('{}{}'.format(TEXT_WHITE, bar))
print('# {}'.format(msg))
print('{}{}'.format(bar, TEXT_RESET))
pass
def print_highlight(msg, ctype='yellow'):
color = get_color(ctype)
print('{}{}{}'.format(color, msg, TEXT_RESET))
def test():
print('\x1b[0;37;40m Normal text\n')
print('\x1b[2;37;40m Underlined text\x1b[0;37;40m \n')
print('\x1b[1;37;40m Bright Colour\x1b[0;37;40m \n')
print('\x1b[3;37;40m Negative Colour\x1b[0;37;40m \n')
print('\x1b[5;37;40m Negative Colour\x1b[0;37;40m\n')
print('\x1b[1;37;40m \x1b[2;37:40m TextColour BlackBackground TextColour GreyBackground WhiteText ColouredBackground\x1b[0;37;40m\n')
print('\x1b[1;30;40m Dark Gray \x1b[0m 1;30;40m \x1b[0;30;47m Black \x1b[0m 0;30;47m \x1b[0;37;41m Black \x1b[0m 0;37;41m')
print('\x1b[1;31;40m Bright Red \x1b[0m 1;31;40m \x1b[0;31;47m Red \x1b[0m 0;31;47m \x1b[0;37;42m Black \x1b[0m 0;37;42m')
print('\x1b[1;32;40m Bright Green \x1b[0m 1;32;40m \x1b[0;32;47m Green \x1b[0m 0;32;47m \x1b[0;37;43m Black \x1b[0m 0;37;43m')
print('\x1b[1;33;40m Yellow \x1b[0m 1;33;40m \x1b[0;33;47m Brown \x1b[0m 0;33;47m \x1b[0;37;44m Black \x1b[0m 0;37;44m')
print('\x1b[1;34;40m Bright Blue \x1b[0m 1;34;40m \x1b[0;34;47m Blue \x1b[0m 0;34;47m \x1b[0;37;45m Black \x1b[0m 0;37;45m')
print('\x1b[1;35;40m Bright Magenta \x1b[0m 1;35;40m \x1b[0;35;47m Magenta \x1b[0m 0;35;47m \x1b[0;37;46m Black \x1b[0m 0;37;46m')
print('\x1b[1;36;40m Bright Cyan \x1b[0m 1;36;40m \x1b[0;36;47m Cyan \x1b[0m 0;36;47m \x1b[0;37;47m Black \x1b[0m 0;37;47m')
print('\x1b[1;37;40m White \x1b[0m 1;37;40m \x1b[0;37;40m Light Grey \x1b[0m 0;37;40m \x1b[0;37;48m Black \x1b[0m 0;37;48m') |
#Escreva um programa que leia uma string e imprima quantas vezes cada caractere aparece nessa string
string = input('Digite uma string: ')
count = {}
for i in string:
count[i] = count.get(i,0) + 1
for chave, valor in count.items():
print(f'{chave}: {valor}x')
print() | string = input('Digite uma string: ')
count = {}
for i in string:
count[i] = count.get(i, 0) + 1
for (chave, valor) in count.items():
print(f'{chave}: {valor}x')
print() |
mitreid_config = {
"dbname": "example_db",
"user": "example_user",
"host": "example_address",
"password": "secret"
}
proxystats_config = {
"dbname": "example_db",
"user": "example_user",
"host": "example_address",
"password": "secret"
} | mitreid_config = {'dbname': 'example_db', 'user': 'example_user', 'host': 'example_address', 'password': 'secret'}
proxystats_config = {'dbname': 'example_db', 'user': 'example_user', 'host': 'example_address', 'password': 'secret'} |
print("Hello World")
a =5
b = 6
sum = a+b
print(sum)
print(sum -11)
| print('Hello World')
a = 5
b = 6
sum = a + b
print(sum)
print(sum - 11) |
# Welcome back, How did you do on your first quiz? If you got most of the
# questions right, great job. If not, no worries it's all part of elarning. We'll be here
# to help you check that you've really got your head around these concepts with
# regular quizzes like this. If you ever find a question tricky, go back and review the
# videos and then try the quiz again. You want to feel super comfortable with what
# you've learned before jumping into the next lesson. Remember, take your time. I
# will be here whenever you're ready to move on. Okay. Feeling good? Great. Let us
# dive in. In this course, we will use the Python programming language to
# demonstrate basic programming concepts and how to apply them to writing
# scripts. We have mentioned that there are a bunch of programming languages
# out there. So why pick Python? Well, we chose Python for a few reasons. First off,
# programming in Python usually feels similar to using a human language. This is
# because Python makes it easy to express what we want to do with syntax that's
# easy to read and write. Check out this example. There is a lot to unpack here so
# don't worry if you don't understand it right away, we'll get into the nitty-gritty
# details later in the course. But even if you've never seen a line of code before,
# you might be able to guess what this code does. It defines a list with names of
# friends and then creates a greeting for each name in the list. Now it is your turn
# to make friends with Python. Try it out and see what happens. Throughout this
# course, you will execute Python code using your web browser. We'll start with
# some small coding exercises using code blocks just like the one you
# experimented with. Later on as you develop your skills, you'll work on larger
# more complex coding exercises using other tools. Getting good at something
# Takes a whole lot of practice every example we share in this course on your
# own. If you do not have Python installed on your machine, no worries, you can
# still practice using an online Python interpreter. Check out the next reading for
# links to the most popular Python interpreters available online. Now I am sure you
# are wondering what the heck is a Python interpreter. In programming, an
# interpreter is the program that reads and executes code. Remember how we said
# a computer program is like a recipe with step-by-step instructions? Well, if your
# recipe is written in Python, the Python interpreter is the program that reads what
# is in the recipe and translates it into instructions for your computer to follow.
# Eventually, you'll want to install Python on your computer so you can run it locally
# and experiment with it as much as you like. We'll guide you through how to
# install Python in the upcoming course but you don't have to have it installed to
# get your first taste of Python. You can practice with the quizzes we provide and
# with the online interpreters and code pads that we'll give you links to in the next
# reading. We'll provide a whole bunch of exercises but feel free to come
# up with your own and share them in the discussion forums. Feel free to get
# creative. This is your change to show off your new skills.
friends = ['Taylor', 'Alex', 'Pat', 'Eli']
for friend in friends:
print("Hi " + friend)
| friends = ['Taylor', 'Alex', 'Pat', 'Eli']
for friend in friends:
print('Hi ' + friend) |
class Shirt:
title = None
color = None
def setTitle(self, title):
self.title = title
def setColor(self, color):
self.color = color
def getTitle(self):
return self.title
def getColor(self):
return self.color
def calculatePrice(self):
return len(self.title) * len(self.color)
def printSpecifications(self):
print("Shirt title:", self.title)
print("Shirt color:", self.color)
print("Shirt price:", self.calculatePrice())
class NikeShirt(Shirt):
title = "Nike"
def __init__(self):
super().__init__()
def calculatePrice(self):
return super().calculatePrice() * 10
class AdidasShirt(Shirt):
title = "Adidas"
def __init__(self):
super().__init__()
def calculatePrice(self):
return super().calculatePrice() * 8
class EcoShirt(Shirt):
title = "Eco (100% cotton)"
def __init__(self):
super().__init__()
def calculatePrice(self):
return super().calculatePrice() * 5
class ShirtFactory:
def getShirt(self, shirtName):
if "nike" in shirtName.lower():
return NikeShirt()
elif "adidas" in shirtName.lower():
return AdidasShirt()
elif "eco" in shirtName.lower():
return EcoShirt()
else:
print("Warning: Unecpected Shirt name", shirtName)
shirt = Shirt()
shirt.setTitle(shirtName)
return shirt
if __name__ == "__main__":
factory = ShirtFactory()
shirtName = input("Enter shirt name: ")
shirtColor = input("Enter shirt color: ")
shirt = factory.getShirt(shirtName)
shirt.setColor(shirtColor)
shirt.printSpecifications()
| class Shirt:
title = None
color = None
def set_title(self, title):
self.title = title
def set_color(self, color):
self.color = color
def get_title(self):
return self.title
def get_color(self):
return self.color
def calculate_price(self):
return len(self.title) * len(self.color)
def print_specifications(self):
print('Shirt title:', self.title)
print('Shirt color:', self.color)
print('Shirt price:', self.calculatePrice())
class Nikeshirt(Shirt):
title = 'Nike'
def __init__(self):
super().__init__()
def calculate_price(self):
return super().calculatePrice() * 10
class Adidasshirt(Shirt):
title = 'Adidas'
def __init__(self):
super().__init__()
def calculate_price(self):
return super().calculatePrice() * 8
class Ecoshirt(Shirt):
title = 'Eco (100% cotton)'
def __init__(self):
super().__init__()
def calculate_price(self):
return super().calculatePrice() * 5
class Shirtfactory:
def get_shirt(self, shirtName):
if 'nike' in shirtName.lower():
return nike_shirt()
elif 'adidas' in shirtName.lower():
return adidas_shirt()
elif 'eco' in shirtName.lower():
return eco_shirt()
else:
print('Warning: Unecpected Shirt name', shirtName)
shirt = shirt()
shirt.setTitle(shirtName)
return shirt
if __name__ == '__main__':
factory = shirt_factory()
shirt_name = input('Enter shirt name: ')
shirt_color = input('Enter shirt color: ')
shirt = factory.getShirt(shirtName)
shirt.setColor(shirtColor)
shirt.printSpecifications() |
# Python3 program to solve N Queen Problem using backtracking
# N = Number of Queens to be placed (in this case, N = 4)
global N
N = 4
# a function to print the board with the solution
def printSolution(board):
for i in range(N):
for j in range(N):
print (board[i][j], end = " ")
print()
# A function to check if a Queen can be placed on board[row][col].
def isSafe(board, row, col):
# Check this row on left side
for i in range(col):
if board[row][i] == 1:
return False
# Check upper diagonal on left side
for i, j in zip(range(row, -1, -1),
range(col, -1, -1)):
if board[i][j] == 1:
return False
# Check lower diagonal on left side
for i, j in zip(range(row, N, 1),
range(col, -1, -1)):
if board[i][j] == 1:
return False
return True
def solveNQUtil(board, col):
# base case: If all Queens are placed then return true
if col >= N:
return True
# Consider this column and try placing this Queen in all rows one by one
for i in range(N):
if isSafe(board, i, col):
# Place this Queen in board[i][col]
board[i][col] = 1
# recur to place rest of the Queens
if solveNQUtil(board, col + 1) == True:
return True
# If placing Queen in board[i][col] doesn't lead to a solution, then remove Queen from board[i][col]
board[i][col] = 0
# if the Queen can not be placed in any row in this column col then return false
return False
# This function solves the N Queen problem using Backtracking.
# It returns false if Queens cannot be placed, otherwise return true.
def solveNQ():
board = [ [0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0] ]
if solveNQUtil(board, 0) == False:
print ("Solution does not exist")
return False
printSolution(board)
return True
# Driver Code
solveNQ()
# Output (with N = 4) -
# 0 0 1 0
# 1 0 0 0
# 0 0 0 1
# 0 1 0 0
# Time Complexity = O(n^n), where N is the number of Queens.
| global N
n = 4
def print_solution(board):
for i in range(N):
for j in range(N):
print(board[i][j], end=' ')
print()
def is_safe(board, row, col):
for i in range(col):
if board[row][i] == 1:
return False
for (i, j) in zip(range(row, -1, -1), range(col, -1, -1)):
if board[i][j] == 1:
return False
for (i, j) in zip(range(row, N, 1), range(col, -1, -1)):
if board[i][j] == 1:
return False
return True
def solve_nq_util(board, col):
if col >= N:
return True
for i in range(N):
if is_safe(board, i, col):
board[i][col] = 1
if solve_nq_util(board, col + 1) == True:
return True
board[i][col] = 0
return False
def solve_nq():
board = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
if solve_nq_util(board, 0) == False:
print('Solution does not exist')
return False
print_solution(board)
return True
solve_nq() |
update_user_permissions_response = {
'user': 'enterprise_search',
'permissions': ['permission2']
}
| update_user_permissions_response = {'user': 'enterprise_search', 'permissions': ['permission2']} |
# CPU: 0.05 s
n = int(input())
if n % 2 == 0:
print((n // 2 + 1) ** 2)
else:
print((n // 2 + 1) * (n // 2 + 2))
| n = int(input())
if n % 2 == 0:
print((n // 2 + 1) ** 2)
else:
print((n // 2 + 1) * (n // 2 + 2)) |
li= list(map(int,input().split(" ")))
a=li[0]
b=li[1]
c=li[2]
d=li[3]
flag=0
if(a==(b+c+d)):
flag=1
elif(b==(a+c+d)):
flag=1
elif(c==(a+b+d)):
flag=1
elif(d == (a+b+c)):
flag=1
elif((a+b) == (c+d)):
flag=1
elif((a+c) == (b+d)):
flag=1
elif((a+d) == (b+c)):
flag=1
if(flag ==1):
print("Yes")
else:
print("No") | li = list(map(int, input().split(' ')))
a = li[0]
b = li[1]
c = li[2]
d = li[3]
flag = 0
if a == b + c + d:
flag = 1
elif b == a + c + d:
flag = 1
elif c == a + b + d:
flag = 1
elif d == a + b + c:
flag = 1
elif a + b == c + d:
flag = 1
elif a + c == b + d:
flag = 1
elif a + d == b + c:
flag = 1
if flag == 1:
print('Yes')
else:
print('No') |
# Generated by [Toolkit-Py](https://github.com/fujiawei-dev/toolkit-py) Generator
# Created at 2022-02-06 10:58:35.566935, Version 0.2.9
__version__ = '0.0.5'
| __version__ = '0.0.5' |
def get_expenses_from_input(input_location):
f = open(input_location, 'r')
expenses = f.read().split('\n')
f.close()
expenses_list_number = []
for expense in expenses:
expenses_list_number.append(int(expense))
expenses_list_number.sort()
return expenses_list_number
def get_three_expenses_which_sum_2020(expenses):
counter = 0
for i,_ in enumerate(expenses):
for j,__ in enumerate(expenses):
for k,___ in enumerate(expenses):
counter += 1
if(expenses[i] + expenses[j] + expenses[k] > 2020):
break
if(expenses[i] + expenses[j] + expenses[k] == 2020):
print(f"Number of comparisons: {counter}")
return (expenses[i], expenses[j], expenses[k])
return "Error"
expenses = get_expenses_from_input('../input.txt')
value1, value2, value3 = get_three_expenses_which_sum_2020(expenses)
print(f"value1={value1}, value2={value2}, value3={value3}")
result = value1 * value2 * value3
print(f"value1 x value2 x value3 = {result}") | def get_expenses_from_input(input_location):
f = open(input_location, 'r')
expenses = f.read().split('\n')
f.close()
expenses_list_number = []
for expense in expenses:
expenses_list_number.append(int(expense))
expenses_list_number.sort()
return expenses_list_number
def get_three_expenses_which_sum_2020(expenses):
counter = 0
for (i, _) in enumerate(expenses):
for (j, __) in enumerate(expenses):
for (k, ___) in enumerate(expenses):
counter += 1
if expenses[i] + expenses[j] + expenses[k] > 2020:
break
if expenses[i] + expenses[j] + expenses[k] == 2020:
print(f'Number of comparisons: {counter}')
return (expenses[i], expenses[j], expenses[k])
return 'Error'
expenses = get_expenses_from_input('../input.txt')
(value1, value2, value3) = get_three_expenses_which_sum_2020(expenses)
print(f'value1={value1}, value2={value2}, value3={value3}')
result = value1 * value2 * value3
print(f'value1 x value2 x value3 = {result}') |
#!/usr/bin/python
class LSRConfig:
# Downstream on demand, unsolicited downstream, or default
# Label distribution protocol
# Label retention mode
LABEL_RETENTION = False
# re-use labels at peers (aka "per interface" scope)
# only applicable for peers that come into different local interfaces
PER_INTERFACE_LABEL_SCOPE = False
# ordered vs. independent LSP control
| class Lsrconfig:
label_retention = False
per_interface_label_scope = False |
# data for single play
num_rows = 23
num_columns = 10
block_size = 60
screen_width = block_size * 40
screen_length = block_size * 22
field_width = block_size * 10
field_length = block_size * 20
field_x = block_size * 7
field_y = block_size * 1
hold_ratio = 0.8
hold_block_size = block_size * hold_ratio
hold_width = hold_block_size * 5
hold_length = hold_block_size * 5
hold_x = block_size * 1
hold_y = block_size * 8
hold_text_x = block_size * 1
hold_text_y = block_size * 7
score_width = block_size * 5
score_length = block_size * 1
score_x = block_size * 1
score_y = block_size * 17
score_text_x = block_size * 1
score_text_y = block_size * 16
nexts_ratio = 0.7
nexts_block_size = block_size * nexts_ratio
nexts_width = nexts_block_size * 5
nexts_length = nexts_block_size * 5
nexts_text_x = field_x + field_width + block_size * 2
nexts_text_y = block_size * 1
nexts_x = [field_x + field_width + block_size * 2] * 5
nexts_y = [nexts_text_y + block_size + i * (nexts_length + 10) for i in range(5)]
op_field_x = nexts_x[0] + nexts_width + 80
op_field_y = field_y
op_field_width = field_width
op_field_length = field_length
fire_x = field_x + field_width + 30
fire_y = field_y
fire_width = block_size
fire_length = field_length
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
COLOR_BG = (43, 43, 43)
COLOR_I = (38, 203, 226)
COLOR_J = (0, 0, 200)
COLOR_L = (221, 109, 23)
COLOR_O = (243, 250, 0)
COLOR_S = (114, 238, 0)
COLOR_T = (140, 3, 140)
COLOR_Z = (250, 0, 0)
# color for fires
COLOR_F = (65, 85, 86)
COLORS = [COLOR_BG, COLOR_I, COLOR_J, COLOR_L, COLOR_O, COLOR_S, COLOR_T, COLOR_Z, COLOR_F]
# data for main menu
# title should be the center of the screen
title_name = 'Tetris'
title_size = [800, 300]
title_from_top = 100
title_center = [screen_width / 2, title_from_top + title_size[1] / 2]
title_x = title_center[0] - title_size[0] / 2
title_y = title_from_top
options_margin = 80 # margin between options
# single play option layout data
sp_size = [800, 160]
sp_center = [
screen_width / 2,
title_y + title_size[1] + options_margin + sp_size[1] / 2
]
sp_x = sp_center[0] - sp_size[0] / 2
sp_y = sp_center[1] - sp_size[1] / 2
sp_color = (38, 17, 115)
#online play option layout data
op_size = [800, 160]
op_center = [
screen_width / 2,
sp_y + sp_size[1] + options_margin + op_size[1] / 2
]
op_x = op_center[0] - op_size[0] / 2
op_y = op_center[1] - op_size[1] / 2
op_color = (100, 0, 0)
# challenge AI option layout data
ca_size = [800, 160]
ca_center = [
screen_width / 2,
op_y + op_size[1] + options_margin + ca_size[1] / 2
]
ca_x = ca_center[0] - ca_size[0] / 2
ca_y = ca_center[1] - ca_size[1] / 2
ca_color = (0, 102, 0)
# p: pause layout while playing
pause_option_x = 50
pause_option_y = 50
pause_option_size = [300, 50]
# pause layout
# pause background
pause_size = [800, 400]
pause_center = [screen_width / 2, screen_length /2]
pause_x = pause_center[0] - pause_size[0] / 2
pause_y = pause_center[1] - pause_size[1] / 2
pause_color = (0, 0, 150)
# pause resume button
pause_resume_from_top = 30
pause_resume_size = [600, 150]
pause_resume_center = [pause_center[0], pause_y + pause_resume_from_top + pause_resume_size[1] / 2]
pause_resume_x = pause_resume_center[0] - pause_resume_size[0] / 2
pause_resume_y = pause_y + pause_resume_from_top
# pause back-to-menu button
pause_to_menu_from_bottom = 30
pause_to_menu_size = [600, 150]
pause_to_menu_center = [pause_center[0], pause_y + pause_size[1] - pause_to_menu_from_bottom - pause_to_menu_size[1] / 2]
pause_to_menu_x = pause_to_menu_center[0] - pause_to_menu_size[0] / 2
pause_to_menu_y = pause_to_menu_center[1] - pause_to_menu_size[1] / 2 | num_rows = 23
num_columns = 10
block_size = 60
screen_width = block_size * 40
screen_length = block_size * 22
field_width = block_size * 10
field_length = block_size * 20
field_x = block_size * 7
field_y = block_size * 1
hold_ratio = 0.8
hold_block_size = block_size * hold_ratio
hold_width = hold_block_size * 5
hold_length = hold_block_size * 5
hold_x = block_size * 1
hold_y = block_size * 8
hold_text_x = block_size * 1
hold_text_y = block_size * 7
score_width = block_size * 5
score_length = block_size * 1
score_x = block_size * 1
score_y = block_size * 17
score_text_x = block_size * 1
score_text_y = block_size * 16
nexts_ratio = 0.7
nexts_block_size = block_size * nexts_ratio
nexts_width = nexts_block_size * 5
nexts_length = nexts_block_size * 5
nexts_text_x = field_x + field_width + block_size * 2
nexts_text_y = block_size * 1
nexts_x = [field_x + field_width + block_size * 2] * 5
nexts_y = [nexts_text_y + block_size + i * (nexts_length + 10) for i in range(5)]
op_field_x = nexts_x[0] + nexts_width + 80
op_field_y = field_y
op_field_width = field_width
op_field_length = field_length
fire_x = field_x + field_width + 30
fire_y = field_y
fire_width = block_size
fire_length = field_length
black = (0, 0, 0)
white = (255, 255, 255)
color_bg = (43, 43, 43)
color_i = (38, 203, 226)
color_j = (0, 0, 200)
color_l = (221, 109, 23)
color_o = (243, 250, 0)
color_s = (114, 238, 0)
color_t = (140, 3, 140)
color_z = (250, 0, 0)
color_f = (65, 85, 86)
colors = [COLOR_BG, COLOR_I, COLOR_J, COLOR_L, COLOR_O, COLOR_S, COLOR_T, COLOR_Z, COLOR_F]
title_name = 'Tetris'
title_size = [800, 300]
title_from_top = 100
title_center = [screen_width / 2, title_from_top + title_size[1] / 2]
title_x = title_center[0] - title_size[0] / 2
title_y = title_from_top
options_margin = 80
sp_size = [800, 160]
sp_center = [screen_width / 2, title_y + title_size[1] + options_margin + sp_size[1] / 2]
sp_x = sp_center[0] - sp_size[0] / 2
sp_y = sp_center[1] - sp_size[1] / 2
sp_color = (38, 17, 115)
op_size = [800, 160]
op_center = [screen_width / 2, sp_y + sp_size[1] + options_margin + op_size[1] / 2]
op_x = op_center[0] - op_size[0] / 2
op_y = op_center[1] - op_size[1] / 2
op_color = (100, 0, 0)
ca_size = [800, 160]
ca_center = [screen_width / 2, op_y + op_size[1] + options_margin + ca_size[1] / 2]
ca_x = ca_center[0] - ca_size[0] / 2
ca_y = ca_center[1] - ca_size[1] / 2
ca_color = (0, 102, 0)
pause_option_x = 50
pause_option_y = 50
pause_option_size = [300, 50]
pause_size = [800, 400]
pause_center = [screen_width / 2, screen_length / 2]
pause_x = pause_center[0] - pause_size[0] / 2
pause_y = pause_center[1] - pause_size[1] / 2
pause_color = (0, 0, 150)
pause_resume_from_top = 30
pause_resume_size = [600, 150]
pause_resume_center = [pause_center[0], pause_y + pause_resume_from_top + pause_resume_size[1] / 2]
pause_resume_x = pause_resume_center[0] - pause_resume_size[0] / 2
pause_resume_y = pause_y + pause_resume_from_top
pause_to_menu_from_bottom = 30
pause_to_menu_size = [600, 150]
pause_to_menu_center = [pause_center[0], pause_y + pause_size[1] - pause_to_menu_from_bottom - pause_to_menu_size[1] / 2]
pause_to_menu_x = pause_to_menu_center[0] - pause_to_menu_size[0] / 2
pause_to_menu_y = pause_to_menu_center[1] - pause_to_menu_size[1] / 2 |
# This file will be patched by setup.py
# The __version__ should be set to the branch name
# Leave __baseline__ set to unknown to enable setting commit-hash
# (e.g. "develop" or "1.2.x")
# You MUST use double quotes (so " and not ')
__version__ = "3.2.0-develop"
__baseline__ = "unknown"
| __version__ = '3.2.0-develop'
__baseline__ = 'unknown' |
def hideUnits(units):
for i in range(len(units)):
hero.command(units[i], "move", {x: 34, y: 10 + i * 12})
peasants = hero.findFriends()
types = peasants[0].buildOrder.split(",")
for i in range(len(peasants)):
hero.command(peasants[i], "buildXY", types[i], 16, 10 + i * 12)
while True:
if hero.findNearestEnemy():
hideUnits(peasants)
break
while True:
enemy = hero.findNearestEnemy()
if enemy and hero.distanceTo(enemy) < 45:
hero.attack(enemy)
| def hide_units(units):
for i in range(len(units)):
hero.command(units[i], 'move', {x: 34, y: 10 + i * 12})
peasants = hero.findFriends()
types = peasants[0].buildOrder.split(',')
for i in range(len(peasants)):
hero.command(peasants[i], 'buildXY', types[i], 16, 10 + i * 12)
while True:
if hero.findNearestEnemy():
hide_units(peasants)
break
while True:
enemy = hero.findNearestEnemy()
if enemy and hero.distanceTo(enemy) < 45:
hero.attack(enemy) |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
unique = set(nums)
ans = []
for i in range(1, len(nums) + 1):
if not i in unique:
ans.append(i)
return ans | class Solution:
def find_disappeared_numbers(self, nums: List[int]) -> List[int]:
unique = set(nums)
ans = []
for i in range(1, len(nums) + 1):
if not i in unique:
ans.append(i)
return ans |
# https://www.codingame.com/training/easy/the-dart-101
TARGET_SCORE = 101
def simulate(shoots):
rounds, throws, misses, score = 1, 0, 0, 0
prev_round_score = 0
prev_shot = ''
for shot in shoots.split():
throws += 1
if 'X' in shot:
misses += 1
score -= 20
if prev_shot == 'X': score -= 10
if misses == 3: score = 0
if throws == 3:
throws = 0
rounds += 1
misses = 0
prev_shot = ''
prev_round_score = score
else:
prev_shot = shot
else:
if '*' in shot:
a, b = map(int, shot.split('*'))
points = a * b
else:
points = int(shot)
if score + points == TARGET_SCORE:
return rounds
elif score + points > TARGET_SCORE:
throws = 3
score = prev_round_score
else:
score += points
if throws == 3:
throws = 0
rounds += 1
misses = 0
prev_shot = ''
prev_round_score = score
else:
prev_shot = shot
return -1
def solution():
num_players = int(input())
player_names = [input() for _ in range(num_players)]
shortest_rounds = float('inf')
winner = ''
for i in range(num_players):
shoots = input()
rounds = simulate(shoots)
if rounds != -1 and rounds < shortest_rounds:
shortest_rounds = rounds
winner = player_names[i]
print(winner)
solution()
| target_score = 101
def simulate(shoots):
(rounds, throws, misses, score) = (1, 0, 0, 0)
prev_round_score = 0
prev_shot = ''
for shot in shoots.split():
throws += 1
if 'X' in shot:
misses += 1
score -= 20
if prev_shot == 'X':
score -= 10
if misses == 3:
score = 0
if throws == 3:
throws = 0
rounds += 1
misses = 0
prev_shot = ''
prev_round_score = score
else:
prev_shot = shot
else:
if '*' in shot:
(a, b) = map(int, shot.split('*'))
points = a * b
else:
points = int(shot)
if score + points == TARGET_SCORE:
return rounds
elif score + points > TARGET_SCORE:
throws = 3
score = prev_round_score
else:
score += points
if throws == 3:
throws = 0
rounds += 1
misses = 0
prev_shot = ''
prev_round_score = score
else:
prev_shot = shot
return -1
def solution():
num_players = int(input())
player_names = [input() for _ in range(num_players)]
shortest_rounds = float('inf')
winner = ''
for i in range(num_players):
shoots = input()
rounds = simulate(shoots)
if rounds != -1 and rounds < shortest_rounds:
shortest_rounds = rounds
winner = player_names[i]
print(winner)
solution() |
file = open("sentencesINA.txt","r")
file_lines = file.readlines()
file.close()
good_sentences = set([])
sentences = set([])
count = 0
big_sen_count = 0
good_sen_count = 0
good_value_count = 0
error = 0
for line in file_lines:
first_split = line.find("|| (('")
sentence = line[0:first_split]
split = line[first_split+3:].split("||")
label = split[0]
type = split[1]
website = split[2]
first = label.find("'")
second = label.find("'",first+1)
language = label[first:second+1]
first = label.find("[")
second = label.find("]")
value = label[first+1:second]
try:
if len(sentence) <= 500:
big_sen_count = big_sen_count + 1
if float(value) >= 0.9:
good_value_count = good_value_count + 1
if float(value) >= 0.9 and len(sentence) <= 400:
good_sen_count = good_sen_count + 1
if float(value) >= 0.9 and len(sentence) <= 400:
if sentence not in sentences:
good_sentences.add(line)
sentences.add(sentence)
else:
count = count + 1
else:
count = count + 1
except:
print(line)
error = error + 1
print("Sentences deleated:", count)
print("Unique Sentences:", len(good_sentences))
print("Small Sentences:", big_sen_count)
print("Value Sentences:", good_value_count)
print("Good Sentences:", good_sen_count)
print("Error:", error)
file = open("INAGoodSentences.txt","w")
file.writelines(good_sentences)
| file = open('sentencesINA.txt', 'r')
file_lines = file.readlines()
file.close()
good_sentences = set([])
sentences = set([])
count = 0
big_sen_count = 0
good_sen_count = 0
good_value_count = 0
error = 0
for line in file_lines:
first_split = line.find("|| (('")
sentence = line[0:first_split]
split = line[first_split + 3:].split('||')
label = split[0]
type = split[1]
website = split[2]
first = label.find("'")
second = label.find("'", first + 1)
language = label[first:second + 1]
first = label.find('[')
second = label.find(']')
value = label[first + 1:second]
try:
if len(sentence) <= 500:
big_sen_count = big_sen_count + 1
if float(value) >= 0.9:
good_value_count = good_value_count + 1
if float(value) >= 0.9 and len(sentence) <= 400:
good_sen_count = good_sen_count + 1
if float(value) >= 0.9 and len(sentence) <= 400:
if sentence not in sentences:
good_sentences.add(line)
sentences.add(sentence)
else:
count = count + 1
else:
count = count + 1
except:
print(line)
error = error + 1
print('Sentences deleated:', count)
print('Unique Sentences:', len(good_sentences))
print('Small Sentences:', big_sen_count)
print('Value Sentences:', good_value_count)
print('Good Sentences:', good_sen_count)
print('Error:', error)
file = open('INAGoodSentences.txt', 'w')
file.writelines(good_sentences) |
# Neat trick to make simple namespaces:
# http://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python
class Namespace(dict):
def __init__(self, *args, **kwargs):
super(Namespace, self).__init__(*args, **kwargs)
self.__dict__ = self
| class Namespace(dict):
def __init__(self, *args, **kwargs):
super(Namespace, self).__init__(*args, **kwargs)
self.__dict__ = self |
class boyce(object):
def bmMatch(self, pattern):
#algoritma didapatkan dari slide pa munir
last=[]
last = self.buildLast(pattern)
n = len(self.text)
m = len(pattern)
i = m-1
if (i > n-1):
return -1 #kalo ga ketemu file bersangkutan
j = m-1;
if (pattern[j] == self.text[i]):
if (j == 0):
return i # match
else: # looking-glass technique
i-=1
j-=1
else: # character jump technique
lo = last[ord(self.text[i])]
i = i + m - min(j, 1+lo)
j = m - 1
while (i <= n-1):
if (pattern[j] == self.text[i]):
if (j == 0):
return i # match
else: # looking-glass technique
i-=1
j-=1
else: # character jump technique
lo = last[ord(self.text[i])]
i = i + m - min(j, 1+lo)
j = m - 1
return -1 # no match
def buildLast(self,pattern):
last = [-1 for i in range(128)]
for i in range(len(pattern)):
last[ord(pattern[i])] = i
return last
def convertText(self,name_file):
with open(name_file) as f:
lines=f.read().lower()
line=lines.split("\n")
self.text=""
for row in line:
self.text+=row | class Boyce(object):
def bm_match(self, pattern):
last = []
last = self.buildLast(pattern)
n = len(self.text)
m = len(pattern)
i = m - 1
if i > n - 1:
return -1
j = m - 1
if pattern[j] == self.text[i]:
if j == 0:
return i
else:
i -= 1
j -= 1
else:
lo = last[ord(self.text[i])]
i = i + m - min(j, 1 + lo)
j = m - 1
while i <= n - 1:
if pattern[j] == self.text[i]:
if j == 0:
return i
else:
i -= 1
j -= 1
else:
lo = last[ord(self.text[i])]
i = i + m - min(j, 1 + lo)
j = m - 1
return -1
def build_last(self, pattern):
last = [-1 for i in range(128)]
for i in range(len(pattern)):
last[ord(pattern[i])] = i
return last
def convert_text(self, name_file):
with open(name_file) as f:
lines = f.read().lower()
line = lines.split('\n')
self.text = ''
for row in line:
self.text += row |
def whataboutstarwars():
i01.disableRobotRandom(30)
# PlayNeopixelAnimation("Ironman", 255, 255, 255, 1)
sleep(3)
# StopNeopixelAnimation()
i01.disableRobotRandom(30)
x = (random.randint(1, 3))
if x == 1:
fullspeed()
i01.moveHead(130,149,87,80,100)
AudioPlayer.playFile(RuningFolder+'/system/sounds/R2D2.mp3')
#i01.mouth.speak("R2D2")
sleep(1)
i01.moveHead(155,31,87,80,100)
sleep(1)
i01.moveHead(130,31,87,80,100)
sleep(1)
i01.moveHead(90,90,87,80,100)
sleep(0.5)
i01.moveHead(90,90,87,80,0)
sleep(1)
relax()
if x == 2:
fullspeed()
#i01.mouth.speak("Hello sir, I am C3po unicyborg relations")
AudioPlayer.playFile(RuningFolder+'/system/sounds/Hello sir, I am C3po unicyborg relations.mp3')
i01.moveHead(138,80)
i01.moveArm("left",79,42,23,41)
i01.moveArm("right",71,40,14,39)
i01.moveHand("left",180,180,180,180,180,47)
i01.moveHand("right",99,130,152,154,145,180)
i01.moveTorso(90,90,90)
sleep(1)
i01.moveHead(116,80)
i01.moveArm("left",85,93,42,16)
i01.moveArm("right",87,93,37,18)
i01.moveHand("left",124,82,65,81,41,143)
i01.moveHand("right",59,53,89,61,36,21)
i01.moveTorso(90,90,90)
sleep(1)
relax()
if x == 3:
i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 1.0)
i01.setHandSpeed("right", 1.0, 0.85, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 0.90, 1.0, 1.0, 1.0)
i01.setHeadSpeed(1.0, 0.90)
i01.setTorsoSpeed(1.0, 1.0, 1.0)
i01.moveHead(80,86)
i01.moveArm("left",5,94,30,10)
i01.moveArm("right",7,74,50,10)
i01.moveHand("left",180,180,180,180,180,90)
i01.moveHand("right",180,2,175,160,165,180)
i01.moveTorso(90,90,90)
#i01.mouth.speak("mmmmmmh, from the dark side you are")
AudioPlayer.playFile(RuningFolder+'/system/sounds/mmmmmmh, from the dark side you are.mp3')
sleep(4.5)
relax()
| def whataboutstarwars():
i01.disableRobotRandom(30)
sleep(3)
i01.disableRobotRandom(30)
x = random.randint(1, 3)
if x == 1:
fullspeed()
i01.moveHead(130, 149, 87, 80, 100)
AudioPlayer.playFile(RuningFolder + '/system/sounds/R2D2.mp3')
sleep(1)
i01.moveHead(155, 31, 87, 80, 100)
sleep(1)
i01.moveHead(130, 31, 87, 80, 100)
sleep(1)
i01.moveHead(90, 90, 87, 80, 100)
sleep(0.5)
i01.moveHead(90, 90, 87, 80, 0)
sleep(1)
relax()
if x == 2:
fullspeed()
AudioPlayer.playFile(RuningFolder + '/system/sounds/Hello sir, I am C3po unicyborg relations.mp3')
i01.moveHead(138, 80)
i01.moveArm('left', 79, 42, 23, 41)
i01.moveArm('right', 71, 40, 14, 39)
i01.moveHand('left', 180, 180, 180, 180, 180, 47)
i01.moveHand('right', 99, 130, 152, 154, 145, 180)
i01.moveTorso(90, 90, 90)
sleep(1)
i01.moveHead(116, 80)
i01.moveArm('left', 85, 93, 42, 16)
i01.moveArm('right', 87, 93, 37, 18)
i01.moveHand('left', 124, 82, 65, 81, 41, 143)
i01.moveHand('right', 59, 53, 89, 61, 36, 21)
i01.moveTorso(90, 90, 90)
sleep(1)
relax()
if x == 3:
i01.setHandSpeed('left', 0.85, 0.85, 0.85, 0.85, 0.85, 1.0)
i01.setHandSpeed('right', 1.0, 0.85, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('left', 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('right', 0.9, 1.0, 1.0, 1.0)
i01.setHeadSpeed(1.0, 0.9)
i01.setTorsoSpeed(1.0, 1.0, 1.0)
i01.moveHead(80, 86)
i01.moveArm('left', 5, 94, 30, 10)
i01.moveArm('right', 7, 74, 50, 10)
i01.moveHand('left', 180, 180, 180, 180, 180, 90)
i01.moveHand('right', 180, 2, 175, 160, 165, 180)
i01.moveTorso(90, 90, 90)
AudioPlayer.playFile(RuningFolder + '/system/sounds/mmmmmmh, from the dark side you are.mp3')
sleep(4.5)
relax() |
# BGR
Blue = (255, 0, 0)
Green = (0, 255, 0)
Red = (0, 0, 255)
Black = (0, 0, 0)
White = (255, 255, 255)
| blue = (255, 0, 0)
green = (0, 255, 0)
red = (0, 0, 255)
black = (0, 0, 0)
white = (255, 255, 255) |
# #08 Anomalous Counter!
# @DSAghicha (Darshaan Aghicha)
def counter_value(timer: int) -> int:
if timer == 0:
return 0
counter_dial: int = 0
prev_dial: int = 0
cycle_dial: int = 0
counter = 0
while timer > counter_dial:
counter += 1
prev_dial = counter_dial
counter_dial = counter_dial + 3 * (2 ** cycle_dial)
cycle_dial += 1
return 3 * (2 ** (cycle_dial - 1)) - (timer - prev_dial) + 1
def main() -> None:
try:
time: int = int(input("Enter time: "))
value: int = counter_value(time)
print(f"Counter value = {value}")
except ValueError:
print("I expected a number!!\n\n")
main()
if __name__ == "__main__":
main()
| def counter_value(timer: int) -> int:
if timer == 0:
return 0
counter_dial: int = 0
prev_dial: int = 0
cycle_dial: int = 0
counter = 0
while timer > counter_dial:
counter += 1
prev_dial = counter_dial
counter_dial = counter_dial + 3 * 2 ** cycle_dial
cycle_dial += 1
return 3 * 2 ** (cycle_dial - 1) - (timer - prev_dial) + 1
def main() -> None:
try:
time: int = int(input('Enter time: '))
value: int = counter_value(time)
print(f'Counter value = {value}')
except ValueError:
print('I expected a number!!\n\n')
main()
if __name__ == '__main__':
main() |
__version__ = '0.1.3'
__title__ = 'dadjokes-cli'
__description__ = 'Dad Jokes on your Terminal'
__author__ = 'sangarshanan'
__author_email__= 'sangarshanan1998@gmail.com'
__url__ = 'https://github.com/Sangarshanan/dadjokes-cli' | __version__ = '0.1.3'
__title__ = 'dadjokes-cli'
__description__ = 'Dad Jokes on your Terminal'
__author__ = 'sangarshanan'
__author_email__ = 'sangarshanan1998@gmail.com'
__url__ = 'https://github.com/Sangarshanan/dadjokes-cli' |
# -*- coding: utf-8 -*-
class Header(object):
def __init__(self, name):
if (isinstance(name, Header)):
name = name.normalized
name = name.strip()
self.normalized = name.lower()
def __hash__(self):
return hash(self.normalized)
def __eq__(self, right):
assert isinstance(right, Header), 'Invalid Comparison'
return self.normalized == right.normalized
def __str__(self):
return self.normalized
ACCEPT = Header('a')
CONTENT_ENCODING = Header('e')
CONTENT_LENGTH = Header('l')
CONTENT_RANGE = Header('n')
CONTENT_TYPE = Header('c')
FROM = Header('f')
FROM_EX = Header('g')
FROM_RIGHTS = Header('h')
REFER_TO = Header('r')
REPLY_TO = Header('p')
SEQUENCE = Header('q')
STREAM = Header('m')
SUBJECT = Header('s')
TIMESTAMP = Header('z')
TO = Header('t')
TRACE = Header('i')
TRANSFER_ENCODING = Header('x')
VIA = Header('v')
COMPACT_HEADERS = dict([(Header(key), value) for key, value in list({
'Accept': ACCEPT,
'Content-Encoding': CONTENT_ENCODING,
'Content-Length': CONTENT_LENGTH,
'Content-Range': CONTENT_RANGE,
'Content-Type': CONTENT_TYPE,
'From': FROM,
'X-From-Game': FROM_EX,
'X-From-Rights': FROM_RIGHTS,
'Refer-To': REFER_TO,
'Reply-To': REPLY_TO,
'X-Sequence': SEQUENCE,
'Stream': STREAM,
'Subject': SUBJECT,
'Timestamp': TIMESTAMP,
'To': TO,
'X-Trace-ID': TRACE,
'Transfer-Encoding': TRANSFER_ENCODING,
'Via': VIA
}.items())])
MULTI_HEADERS = frozenset([Header(name) for name in [
ACCEPT, 'Accept-Charset', 'Accept-Encoding', 'Accept-Language', 'Accept-Ranges', 'Allow', 'Cache-Control',
'Connection', CONTENT_ENCODING, 'Content-Language', 'Expect', 'If-Match', 'If-None-Match', 'Pragma',
'Proxy-Authenticate', 'Set-Cookie', 'TE', 'Trailer', TRANSFER_ENCODING, 'Upgrade', 'User-Agent', 'Vary', VIA,
'Warning', 'WWW-Authenticate', 'X-Forwarded-For'
]])
| class Header(object):
def __init__(self, name):
if isinstance(name, Header):
name = name.normalized
name = name.strip()
self.normalized = name.lower()
def __hash__(self):
return hash(self.normalized)
def __eq__(self, right):
assert isinstance(right, Header), 'Invalid Comparison'
return self.normalized == right.normalized
def __str__(self):
return self.normalized
accept = header('a')
content_encoding = header('e')
content_length = header('l')
content_range = header('n')
content_type = header('c')
from = header('f')
from_ex = header('g')
from_rights = header('h')
refer_to = header('r')
reply_to = header('p')
sequence = header('q')
stream = header('m')
subject = header('s')
timestamp = header('z')
to = header('t')
trace = header('i')
transfer_encoding = header('x')
via = header('v')
compact_headers = dict([(header(key), value) for (key, value) in list({'Accept': ACCEPT, 'Content-Encoding': CONTENT_ENCODING, 'Content-Length': CONTENT_LENGTH, 'Content-Range': CONTENT_RANGE, 'Content-Type': CONTENT_TYPE, 'From': FROM, 'X-From-Game': FROM_EX, 'X-From-Rights': FROM_RIGHTS, 'Refer-To': REFER_TO, 'Reply-To': REPLY_TO, 'X-Sequence': SEQUENCE, 'Stream': STREAM, 'Subject': SUBJECT, 'Timestamp': TIMESTAMP, 'To': TO, 'X-Trace-ID': TRACE, 'Transfer-Encoding': TRANSFER_ENCODING, 'Via': VIA}.items())])
multi_headers = frozenset([header(name) for name in [ACCEPT, 'Accept-Charset', 'Accept-Encoding', 'Accept-Language', 'Accept-Ranges', 'Allow', 'Cache-Control', 'Connection', CONTENT_ENCODING, 'Content-Language', 'Expect', 'If-Match', 'If-None-Match', 'Pragma', 'Proxy-Authenticate', 'Set-Cookie', 'TE', 'Trailer', TRANSFER_ENCODING, 'Upgrade', 'User-Agent', 'Vary', VIA, 'Warning', 'WWW-Authenticate', 'X-Forwarded-For']]) |
class Solution:
def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool:
if not pushed and not popped:
return True
if len(pushed) != len(popped):
return False
popIdx = 0
count = 0
stack = []
for i in range(len(pushed)):
stack.append(pushed[i])
while len(stack) > 0 and stack[-1] == popped[popIdx]:
stack.pop()
popIdx += 1
return len(stack) == 0
| class Solution:
def validate_stack_sequences(self, pushed: List[int], popped: List[int]) -> bool:
if not pushed and (not popped):
return True
if len(pushed) != len(popped):
return False
pop_idx = 0
count = 0
stack = []
for i in range(len(pushed)):
stack.append(pushed[i])
while len(stack) > 0 and stack[-1] == popped[popIdx]:
stack.pop()
pop_idx += 1
return len(stack) == 0 |
unsorted_list = [("w",23), (9,1), ("543",99), ("sena",18)]
print(sorted(unsorted_list, key=lambda x: x[1]))
list = [43, 743, 342, 8874, 49]
print(sorted(list, reverse=True)) | unsorted_list = [('w', 23), (9, 1), ('543', 99), ('sena', 18)]
print(sorted(unsorted_list, key=lambda x: x[1]))
list = [43, 743, 342, 8874, 49]
print(sorted(list, reverse=True)) |
# This is a handy reverses the endianess of a given binary string in HEX
input = "020000000001017c037e163f8dfee4632a8cf6c87187d3cb61224e6dae8f4b0ed0fae3a38008570000000017160014c5729e3aaacb6a160fa79949a8d7f1e5cd1fbc51feffffff0288102c040000000017a914ed649576ad657747835d116611981c90113c074387005a62020000000017a914e62a29e7d756eb30c453ae022f315619fe8ddfbb8702483045022100b40db3a574a7254d60f8e64335d9bab60ff986ad7fe1c0ad06dcfc4ba896e16002201bbf15e25b0334817baa34fd02ebe90c94af2d65226c9302a60a96e8357c0da50121034f889691dacb4b7152f42f566095a8c2cec6482d2fc0a16f87f59691e7e37824df000000"
def test():
assert reverse("") == ""
assert reverse("F") == "F"
assert reverse("FF") == "FF"
assert reverse("00FF") == "FF00"
assert reverse("AA00FF") == "FF00AA"
assert reverse("AB01EF") == "EF01AB"
assert reverse("b50cc069d6a3e33e3ff84a5c41d9d3febe7c770fdcc96b2c3ff60abe184f1963") == "63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5"
def reverse(input):
res = "".join(reversed([input[i:i+2] for i in range(0, len(input), 2)]))
return res
if __name__ == "__main__":
test()
print(reverse(input))
| input = '020000000001017c037e163f8dfee4632a8cf6c87187d3cb61224e6dae8f4b0ed0fae3a38008570000000017160014c5729e3aaacb6a160fa79949a8d7f1e5cd1fbc51feffffff0288102c040000000017a914ed649576ad657747835d116611981c90113c074387005a62020000000017a914e62a29e7d756eb30c453ae022f315619fe8ddfbb8702483045022100b40db3a574a7254d60f8e64335d9bab60ff986ad7fe1c0ad06dcfc4ba896e16002201bbf15e25b0334817baa34fd02ebe90c94af2d65226c9302a60a96e8357c0da50121034f889691dacb4b7152f42f566095a8c2cec6482d2fc0a16f87f59691e7e37824df000000'
def test():
assert reverse('') == ''
assert reverse('F') == 'F'
assert reverse('FF') == 'FF'
assert reverse('00FF') == 'FF00'
assert reverse('AA00FF') == 'FF00AA'
assert reverse('AB01EF') == 'EF01AB'
assert reverse('b50cc069d6a3e33e3ff84a5c41d9d3febe7c770fdcc96b2c3ff60abe184f1963') == '63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5'
def reverse(input):
res = ''.join(reversed([input[i:i + 2] for i in range(0, len(input), 2)]))
return res
if __name__ == '__main__':
test()
print(reverse(input)) |
# startswith
# endswith
inp = "ajay kumar"
out = inp.startswith("aj")
print(out)
out = inp.startswith("jay")
print(out)
# inp1 = "print('a')"
inp1 = "# isdecimal -> given a string, check if it is decimal"
out = inp1.startswith("#")
print(out) | inp = 'ajay kumar'
out = inp.startswith('aj')
print(out)
out = inp.startswith('jay')
print(out)
inp1 = '# isdecimal -> given a string, check if it is decimal'
out = inp1.startswith('#')
print(out) |
for _ in range(int(input())):
a,b,c=map(int,input().split())
ans=a+c-b-b
ans=abs(ans)
c1=ans%3
c2=ans%(-3)
c2=abs(c2)
if c1<c2:
print(c1)
else:
print(c2) | for _ in range(int(input())):
(a, b, c) = map(int, input().split())
ans = a + c - b - b
ans = abs(ans)
c1 = ans % 3
c2 = ans % -3
c2 = abs(c2)
if c1 < c2:
print(c1)
else:
print(c2) |
# Author: Mujib Ansari
# Date: Jan 23, 2021
# Problem Statement: WAP to check given number is palindorome or not
def check_palindorme(num):
temp = num
reverse = 0
while temp > 0:
lastDigit = temp % 10
reverse = (reverse * 10) + lastDigit
temp = temp // 10
return "Yes" if num == reverse else "No"
n = int(input("Enter a number : "))
print("Entered number : ", n)
print("Is palindrome or not : ", check_palindorme(n))
| def check_palindorme(num):
temp = num
reverse = 0
while temp > 0:
last_digit = temp % 10
reverse = reverse * 10 + lastDigit
temp = temp // 10
return 'Yes' if num == reverse else 'No'
n = int(input('Enter a number : '))
print('Entered number : ', n)
print('Is palindrome or not : ', check_palindorme(n)) |
#
# PySNMP MIB module CXCFG-IP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXCFG-IP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:16:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint")
cxCfgIp, Alias, cxIcmp, cxCfgIpSap = mibBuilder.importSymbols("CXProduct-SMI", "cxCfgIp", "Alias", "cxIcmp", "cxCfgIpSap")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
TimeTicks, Gauge32, ObjectIdentity, iso, Integer32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, IpAddress, NotificationType, Counter64, Counter32, ModuleIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Gauge32", "ObjectIdentity", "iso", "Integer32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "IpAddress", "NotificationType", "Counter64", "Counter32", "ModuleIdentity", "Unsigned32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
cxCfgIpAddrTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1), )
if mibBuilder.loadTexts: cxCfgIpAddrTable.setStatus('mandatory')
cxCfgIpAddrEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1), ).setIndexNames((0, "CXCFG-IP-MIB", "cxCfgIpAdEntAddr"))
if mibBuilder.loadTexts: cxCfgIpAddrEntry.setStatus('mandatory')
cxCfgIpAdEntAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 1), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpAdEntAddr.setStatus('mandatory')
cxCfgIpAdEntIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntIfIndex.setStatus('mandatory')
cxCfgIpAdEntNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntNetMask.setStatus('mandatory')
cxCfgIpAdEntBcastAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntBcastAddr.setStatus('mandatory')
cxCfgIpAdEntSubnetworkSAPAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 5), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntSubnetworkSAPAlias.setStatus('mandatory')
cxCfgIpAdEntRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntRowStatus.setStatus('mandatory')
cxCfgIpAdEntState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("on", 1), ("off", 2), ("onether", 3), ("ontoken", 4))).clone('on')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntState.setStatus('mandatory')
cxCfgIpAdEntPeerAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 8), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntPeerAddr.setStatus('mandatory')
cxCfgIpAdEntRtProto = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("rip", 2), ("ospf", 3))).clone('rip')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntRtProto.setStatus('mandatory')
cxCfgIpAdEntMtu = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(64, 4096)).clone(1600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntMtu.setStatus('mandatory')
cxCfgIpAdEntReplyToRARP = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntReplyToRARP.setStatus('mandatory')
cxCfgIpAdEntSRSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpAdEntSRSupport.setStatus('mandatory')
cxCfgIpPingTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1), )
if mibBuilder.loadTexts: cxCfgIpPingTable.setStatus('mandatory')
cxCfgIpPingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1), ).setIndexNames((0, "CXCFG-IP-MIB", "cxCfgIpPingDestAddr"))
if mibBuilder.loadTexts: cxCfgIpPingEntry.setStatus('mandatory')
cxCfgIpPingIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingIndex.setStatus('mandatory')
cxCfgIpPingDestAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingDestAddr.setStatus('mandatory')
cxCfgIpPingGapsInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1000)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingGapsInMs.setStatus('mandatory')
cxCfgIpPingNbOfPings = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4000000)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingNbOfPings.setStatus('mandatory')
cxCfgIpPingDataSize = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 300)).clone(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingDataSize.setStatus('mandatory')
cxCfgIpPingRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingRowStatus.setStatus('mandatory')
cxCfgIpPingTriggerSend = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ipIdle", 1), ("ipSend", 2))).clone('ipIdle')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpPingTriggerSend.setStatus('mandatory')
cxCfgIpPingNbTx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingNbTx.setStatus('mandatory')
cxCfgIpPingNbReplyRx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingNbReplyRx.setStatus('mandatory')
cxCfgIpPingNbErrorRx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingNbErrorRx.setStatus('mandatory')
cxCfgIpPingLastSeqNumRx = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingLastSeqNumRx.setStatus('mandatory')
cxCfgIpPingLastRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingLastRoundTripInMs.setStatus('mandatory')
cxCfgIpPingAvgRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingAvgRoundTripInMs.setStatus('mandatory')
cxCfgIpPingMinRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingMinRoundTripInMs.setStatus('mandatory')
cxCfgIpPingMaxRoundTripInMs = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingMaxRoundTripInMs.setStatus('mandatory')
cxCfgIpPingLastNumHopsTraveled = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpPingLastNumHopsTraveled.setStatus('mandatory')
cxCfgIpRIP = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgIpRIP.setStatus('mandatory')
cxCfgRIPII = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cxCfgRIPII.setStatus('mandatory')
cxCfgIpMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cxCfgIpMibLevel.setStatus('mandatory')
mibBuilder.exportSymbols("CXCFG-IP-MIB", cxCfgIpPingDestAddr=cxCfgIpPingDestAddr, cxCfgIpPingTriggerSend=cxCfgIpPingTriggerSend, cxCfgIpPingLastSeqNumRx=cxCfgIpPingLastSeqNumRx, cxCfgIpPingAvgRoundTripInMs=cxCfgIpPingAvgRoundTripInMs, cxCfgIpAdEntRtProto=cxCfgIpAdEntRtProto, cxCfgIpAdEntNetMask=cxCfgIpAdEntNetMask, cxCfgIpPingNbTx=cxCfgIpPingNbTx, cxCfgIpAdEntMtu=cxCfgIpAdEntMtu, cxCfgIpPingIndex=cxCfgIpPingIndex, cxCfgIpAdEntReplyToRARP=cxCfgIpAdEntReplyToRARP, cxCfgIpAdEntBcastAddr=cxCfgIpAdEntBcastAddr, cxCfgIpPingNbOfPings=cxCfgIpPingNbOfPings, cxCfgIpPingMinRoundTripInMs=cxCfgIpPingMinRoundTripInMs, cxCfgIpPingLastNumHopsTraveled=cxCfgIpPingLastNumHopsTraveled, cxCfgIpPingMaxRoundTripInMs=cxCfgIpPingMaxRoundTripInMs, cxCfgIpAdEntSRSupport=cxCfgIpAdEntSRSupport, cxCfgIpPingLastRoundTripInMs=cxCfgIpPingLastRoundTripInMs, cxCfgRIPII=cxCfgRIPII, cxCfgIpAdEntSubnetworkSAPAlias=cxCfgIpAdEntSubnetworkSAPAlias, cxCfgIpAdEntRowStatus=cxCfgIpAdEntRowStatus, cxCfgIpMibLevel=cxCfgIpMibLevel, cxCfgIpPingTable=cxCfgIpPingTable, cxCfgIpAddrEntry=cxCfgIpAddrEntry, cxCfgIpPingNbReplyRx=cxCfgIpPingNbReplyRx, cxCfgIpAdEntIfIndex=cxCfgIpAdEntIfIndex, cxCfgIpAdEntState=cxCfgIpAdEntState, cxCfgIpAddrTable=cxCfgIpAddrTable, cxCfgIpPingDataSize=cxCfgIpPingDataSize, cxCfgIpPingRowStatus=cxCfgIpPingRowStatus, cxCfgIpPingGapsInMs=cxCfgIpPingGapsInMs, cxCfgIpRIP=cxCfgIpRIP, cxCfgIpPingNbErrorRx=cxCfgIpPingNbErrorRx, cxCfgIpAdEntPeerAddr=cxCfgIpAdEntPeerAddr, cxCfgIpAdEntAddr=cxCfgIpAdEntAddr, cxCfgIpPingEntry=cxCfgIpPingEntry)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint')
(cx_cfg_ip, alias, cx_icmp, cx_cfg_ip_sap) = mibBuilder.importSymbols('CXProduct-SMI', 'cxCfgIp', 'Alias', 'cxIcmp', 'cxCfgIpSap')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(time_ticks, gauge32, object_identity, iso, integer32, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, ip_address, notification_type, counter64, counter32, module_identity, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'Gauge32', 'ObjectIdentity', 'iso', 'Integer32', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'IpAddress', 'NotificationType', 'Counter64', 'Counter32', 'ModuleIdentity', 'Unsigned32')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
cx_cfg_ip_addr_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1))
if mibBuilder.loadTexts:
cxCfgIpAddrTable.setStatus('mandatory')
cx_cfg_ip_addr_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1)).setIndexNames((0, 'CXCFG-IP-MIB', 'cxCfgIpAdEntAddr'))
if mibBuilder.loadTexts:
cxCfgIpAddrEntry.setStatus('mandatory')
cx_cfg_ip_ad_ent_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 1), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpAdEntAddr.setStatus('mandatory')
cx_cfg_ip_ad_ent_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntIfIndex.setStatus('mandatory')
cx_cfg_ip_ad_ent_net_mask = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 3), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntNetMask.setStatus('mandatory')
cx_cfg_ip_ad_ent_bcast_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 4), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntBcastAddr.setStatus('mandatory')
cx_cfg_ip_ad_ent_subnetwork_sap_alias = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 5), alias()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntSubnetworkSAPAlias.setStatus('mandatory')
cx_cfg_ip_ad_ent_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('invalid', 1), ('valid', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntRowStatus.setStatus('mandatory')
cx_cfg_ip_ad_ent_state = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('on', 1), ('off', 2), ('onether', 3), ('ontoken', 4))).clone('on')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntState.setStatus('mandatory')
cx_cfg_ip_ad_ent_peer_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 8), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntPeerAddr.setStatus('mandatory')
cx_cfg_ip_ad_ent_rt_proto = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('rip', 2), ('ospf', 3))).clone('rip')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntRtProto.setStatus('mandatory')
cx_cfg_ip_ad_ent_mtu = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(64, 4096)).clone(1600)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntMtu.setStatus('mandatory')
cx_cfg_ip_ad_ent_reply_to_rarp = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntReplyToRARP.setStatus('mandatory')
cx_cfg_ip_ad_ent_sr_support = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 15, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpAdEntSRSupport.setStatus('mandatory')
cx_cfg_ip_ping_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1))
if mibBuilder.loadTexts:
cxCfgIpPingTable.setStatus('mandatory')
cx_cfg_ip_ping_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1)).setIndexNames((0, 'CXCFG-IP-MIB', 'cxCfgIpPingDestAddr'))
if mibBuilder.loadTexts:
cxCfgIpPingEntry.setStatus('mandatory')
cx_cfg_ip_ping_index = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 32))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingIndex.setStatus('mandatory')
cx_cfg_ip_ping_dest_addr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 2), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingDestAddr.setStatus('mandatory')
cx_cfg_ip_ping_gaps_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 1000)).clone(10)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingGapsInMs.setStatus('mandatory')
cx_cfg_ip_ping_nb_of_pings = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 4000000)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingNbOfPings.setStatus('mandatory')
cx_cfg_ip_ping_data_size = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 300)).clone(64)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingDataSize.setStatus('mandatory')
cx_cfg_ip_ping_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('invalid', 1), ('valid', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingRowStatus.setStatus('mandatory')
cx_cfg_ip_ping_trigger_send = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ipIdle', 1), ('ipSend', 2))).clone('ipIdle')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpPingTriggerSend.setStatus('mandatory')
cx_cfg_ip_ping_nb_tx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingNbTx.setStatus('mandatory')
cx_cfg_ip_ping_nb_reply_rx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 21), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingNbReplyRx.setStatus('mandatory')
cx_cfg_ip_ping_nb_error_rx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 22), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingNbErrorRx.setStatus('mandatory')
cx_cfg_ip_ping_last_seq_num_rx = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 23), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingLastSeqNumRx.setStatus('mandatory')
cx_cfg_ip_ping_last_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 24), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingLastRoundTripInMs.setStatus('mandatory')
cx_cfg_ip_ping_avg_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 25), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingAvgRoundTripInMs.setStatus('mandatory')
cx_cfg_ip_ping_min_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 26), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingMinRoundTripInMs.setStatus('mandatory')
cx_cfg_ip_ping_max_round_trip_in_ms = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 27), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingMaxRoundTripInMs.setStatus('mandatory')
cx_cfg_ip_ping_last_num_hops_traveled = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 11, 1, 1, 28), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpPingLastNumHopsTraveled.setStatus('mandatory')
cx_cfg_ip_rip = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('off', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgIpRIP.setStatus('mandatory')
cx_cfg_ripii = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('on', 1), ('off', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
cxCfgRIPII.setStatus('mandatory')
cx_cfg_ip_mib_level = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 16, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
cxCfgIpMibLevel.setStatus('mandatory')
mibBuilder.exportSymbols('CXCFG-IP-MIB', cxCfgIpPingDestAddr=cxCfgIpPingDestAddr, cxCfgIpPingTriggerSend=cxCfgIpPingTriggerSend, cxCfgIpPingLastSeqNumRx=cxCfgIpPingLastSeqNumRx, cxCfgIpPingAvgRoundTripInMs=cxCfgIpPingAvgRoundTripInMs, cxCfgIpAdEntRtProto=cxCfgIpAdEntRtProto, cxCfgIpAdEntNetMask=cxCfgIpAdEntNetMask, cxCfgIpPingNbTx=cxCfgIpPingNbTx, cxCfgIpAdEntMtu=cxCfgIpAdEntMtu, cxCfgIpPingIndex=cxCfgIpPingIndex, cxCfgIpAdEntReplyToRARP=cxCfgIpAdEntReplyToRARP, cxCfgIpAdEntBcastAddr=cxCfgIpAdEntBcastAddr, cxCfgIpPingNbOfPings=cxCfgIpPingNbOfPings, cxCfgIpPingMinRoundTripInMs=cxCfgIpPingMinRoundTripInMs, cxCfgIpPingLastNumHopsTraveled=cxCfgIpPingLastNumHopsTraveled, cxCfgIpPingMaxRoundTripInMs=cxCfgIpPingMaxRoundTripInMs, cxCfgIpAdEntSRSupport=cxCfgIpAdEntSRSupport, cxCfgIpPingLastRoundTripInMs=cxCfgIpPingLastRoundTripInMs, cxCfgRIPII=cxCfgRIPII, cxCfgIpAdEntSubnetworkSAPAlias=cxCfgIpAdEntSubnetworkSAPAlias, cxCfgIpAdEntRowStatus=cxCfgIpAdEntRowStatus, cxCfgIpMibLevel=cxCfgIpMibLevel, cxCfgIpPingTable=cxCfgIpPingTable, cxCfgIpAddrEntry=cxCfgIpAddrEntry, cxCfgIpPingNbReplyRx=cxCfgIpPingNbReplyRx, cxCfgIpAdEntIfIndex=cxCfgIpAdEntIfIndex, cxCfgIpAdEntState=cxCfgIpAdEntState, cxCfgIpAddrTable=cxCfgIpAddrTable, cxCfgIpPingDataSize=cxCfgIpPingDataSize, cxCfgIpPingRowStatus=cxCfgIpPingRowStatus, cxCfgIpPingGapsInMs=cxCfgIpPingGapsInMs, cxCfgIpRIP=cxCfgIpRIP, cxCfgIpPingNbErrorRx=cxCfgIpPingNbErrorRx, cxCfgIpAdEntPeerAddr=cxCfgIpAdEntPeerAddr, cxCfgIpAdEntAddr=cxCfgIpAdEntAddr, cxCfgIpPingEntry=cxCfgIpPingEntry) |
class AttackGroup:
def __init__(self, botai, own, targets, iter):
self.botai = botai
self.own = own
self.targets = targets
self.iteration = iter
@property
def done(self):
return len(self.own) == 0 or len(self.targets) == 0
def actions(self, iter):
actions = []
target_units = self.botai.known_enemy_units.tags_in(self.targets)
if target_units.exists:
target = target_units.first
for unit in self.botai.units.tags_in(self.own):
actions.append(unit.attack(target))
else:
self.targets = set() #lost targets
return actions
def clear_tag(self, tag):
if tag in self.own:
self.own.remove(tag)
elif tag in self.targets:
self.targets.remove(tag)
| class Attackgroup:
def __init__(self, botai, own, targets, iter):
self.botai = botai
self.own = own
self.targets = targets
self.iteration = iter
@property
def done(self):
return len(self.own) == 0 or len(self.targets) == 0
def actions(self, iter):
actions = []
target_units = self.botai.known_enemy_units.tags_in(self.targets)
if target_units.exists:
target = target_units.first
for unit in self.botai.units.tags_in(self.own):
actions.append(unit.attack(target))
else:
self.targets = set()
return actions
def clear_tag(self, tag):
if tag in self.own:
self.own.remove(tag)
elif tag in self.targets:
self.targets.remove(tag) |
class Rocket:
def calc_fuel_weight(self, weight):
weight = int(weight)
return int(weight / 3) - 2
def calc_fuel_weight_recursive(self, weight):
weight = int(weight)
# This time with recursion for fuel weight
total = self.calc_fuel_weight(weight)
fuelweight = self.calc_fuel_weight(total)
while fuelweight > 0:
total = total + fuelweight
fuelweight = self.calc_fuel_weight(fuelweight)
return total
| class Rocket:
def calc_fuel_weight(self, weight):
weight = int(weight)
return int(weight / 3) - 2
def calc_fuel_weight_recursive(self, weight):
weight = int(weight)
total = self.calc_fuel_weight(weight)
fuelweight = self.calc_fuel_weight(total)
while fuelweight > 0:
total = total + fuelweight
fuelweight = self.calc_fuel_weight(fuelweight)
return total |
def captial(string):
strs = string.title()
return strs
n = input()
n = captial(n)
print(n)
| def captial(string):
strs = string.title()
return strs
n = input()
n = captial(n)
print(n) |
'''
Copyright (c) 2012-2021 Roel Derickx, Paul Norman <penorman@mac.com>,
Sebastiaan Couwenberg <sebastic@xs4all.nl>, The University of Vermont
<andrew.guertin@uvm.edu>, github contributors
Released under the MIT license, as given in the file LICENSE, which must
accompany any distribution of this code.
'''
__author__ = "Roel Derickx"
__program__ = "ogr2osm"
__version__ = "1.1.1"
__license__ = "MIT License"
| """
Copyright (c) 2012-2021 Roel Derickx, Paul Norman <penorman@mac.com>,
Sebastiaan Couwenberg <sebastic@xs4all.nl>, The University of Vermont
<andrew.guertin@uvm.edu>, github contributors
Released under the MIT license, as given in the file LICENSE, which must
accompany any distribution of this code.
"""
__author__ = 'Roel Derickx'
__program__ = 'ogr2osm'
__version__ = '1.1.1'
__license__ = 'MIT License' |
streams_dict = {}
def session_established(session):
# When a WebTransport session is established, a bidirectional stream is
# created by the server, which is used to echo back stream data from the
# client.
session.create_bidirectional_stream()
def stream_data_received(session,
stream_id: int,
data: bytes,
stream_ended: bool):
# If a stream is unidirectional, create a new unidirectional stream and echo
# back the data on that stream.
if session.stream_is_unidirectional(stream_id):
if (session.session_id, stream_id) not in streams_dict.keys():
new_stream_id = session.create_unidirectional_stream()
streams_dict[(session.session_id, stream_id)] = new_stream_id
session.send_stream_data(streams_dict[(session.session_id, stream_id)],
data,
end_stream=stream_ended)
if (stream_ended):
del streams_dict[(session.session_id, stream_id)]
return
# Otherwise (e.g. if the stream is bidirectional), echo back the data on the
# same stream.
session.send_stream_data(stream_id, data, end_stream=stream_ended)
def datagram_received(session, data: bytes):
session.send_datagram(data)
| streams_dict = {}
def session_established(session):
session.create_bidirectional_stream()
def stream_data_received(session, stream_id: int, data: bytes, stream_ended: bool):
if session.stream_is_unidirectional(stream_id):
if (session.session_id, stream_id) not in streams_dict.keys():
new_stream_id = session.create_unidirectional_stream()
streams_dict[session.session_id, stream_id] = new_stream_id
session.send_stream_data(streams_dict[session.session_id, stream_id], data, end_stream=stream_ended)
if stream_ended:
del streams_dict[session.session_id, stream_id]
return
session.send_stream_data(stream_id, data, end_stream=stream_ended)
def datagram_received(session, data: bytes):
session.send_datagram(data) |
n = int(input())
c = int(input())
numbers = []
for i in range(n):
numbers.append(int(input()))
if sum(numbers) < c:
print("IMPOSSIBLE")
else:
while sum(numbers) > c:
numbers[numbers.index(max(numbers))] -= 1
for number in sorted(numbers):
print(number)
| n = int(input())
c = int(input())
numbers = []
for i in range(n):
numbers.append(int(input()))
if sum(numbers) < c:
print('IMPOSSIBLE')
else:
while sum(numbers) > c:
numbers[numbers.index(max(numbers))] -= 1
for number in sorted(numbers):
print(number) |
def change(age,*som):
print(age)
for i in som:
print(i)
return
change(12,'name','year','mon','address')
change('a1','b1')
change('a2','b2',11) | def change(age, *som):
print(age)
for i in som:
print(i)
return
change(12, 'name', 'year', 'mon', 'address')
change('a1', 'b1')
change('a2', 'b2', 11) |
FreeMono18pt7bBitmaps = [
0x27, 0x77, 0x77, 0x77, 0x77, 0x22, 0x22, 0x20, 0x00, 0x6F, 0xF6, 0xF1,
0xFE, 0x3F, 0xC7, 0xF8, 0xFF, 0x1E, 0xC3, 0x98, 0x33, 0x06, 0x60, 0xCC,
0x18, 0x04, 0x20, 0x10, 0x80, 0x42, 0x01, 0x08, 0x04, 0x20, 0x10, 0x80,
0x42, 0x01, 0x10, 0x04, 0x41, 0xFF, 0xF0, 0x44, 0x02, 0x10, 0x08, 0x40,
0x21, 0x0F, 0xFF, 0xC2, 0x10, 0x08, 0x40, 0x21, 0x00, 0x84, 0x02, 0x10,
0x08, 0x40, 0x23, 0x00, 0x88, 0x02, 0x20, 0x02, 0x00, 0x10, 0x00, 0x80,
0x1F, 0xA3, 0x07, 0x10, 0x09, 0x00, 0x48, 0x00, 0x40, 0x03, 0x00, 0x0C,
0x00, 0x3C, 0x00, 0x1E, 0x00, 0x18, 0x00, 0x20, 0x01, 0x80, 0x0C, 0x00,
0x70, 0x05, 0xE0, 0xC9, 0xF8, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00,
0x10, 0x00, 0x1E, 0x00, 0x42, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
0x10, 0x08, 0x40, 0x0F, 0x00, 0x00, 0x1E, 0x01, 0xF0, 0x1F, 0x01, 0xE0,
0x0E, 0x00, 0x00, 0x3C, 0x00, 0x86, 0x02, 0x06, 0x04, 0x04, 0x08, 0x08,
0x10, 0x30, 0x10, 0xC0, 0x1E, 0x00, 0x0F, 0xC1, 0x00, 0x20, 0x02, 0x00,
0x20, 0x02, 0x00, 0x10, 0x01, 0x00, 0x08, 0x03, 0xC0, 0x6C, 0x3C, 0x62,
0x82, 0x68, 0x34, 0x81, 0xCC, 0x08, 0x61, 0xC3, 0xE7, 0xFF, 0xFF, 0xF6,
0x66, 0x66, 0x08, 0xC4, 0x62, 0x31, 0x8C, 0xC6, 0x31, 0x8C, 0x63, 0x18,
0xC3, 0x18, 0xC2, 0x18, 0xC3, 0x18, 0x86, 0x10, 0xC2, 0x18, 0xC6, 0x10,
0xC6, 0x31, 0x8C, 0x63, 0x18, 0x8C, 0x62, 0x31, 0x98, 0x80, 0x02, 0x00,
0x10, 0x00, 0x80, 0x04, 0x0C, 0x21, 0x9D, 0x70, 0x1C, 0x00, 0xA0, 0x0D,
0x80, 0xC6, 0x04, 0x10, 0x40, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00,
0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0xFF, 0xFE, 0x02,
0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
0x01, 0x00, 0x3E, 0x78, 0xF3, 0xC7, 0x8E, 0x18, 0x70, 0xC1, 0x80, 0xFF,
0xFE, 0x77, 0xFF, 0xF7, 0x00, 0x00, 0x08, 0x00, 0xC0, 0x04, 0x00, 0x60,
0x02, 0x00, 0x30, 0x01, 0x00, 0x18, 0x00, 0x80, 0x0C, 0x00, 0x40, 0x02,
0x00, 0x20, 0x01, 0x00, 0x10, 0x00, 0x80, 0x08, 0x00, 0x40, 0x04, 0x00,
0x20, 0x02, 0x00, 0x10, 0x01, 0x00, 0x08, 0x00, 0x80, 0x04, 0x00, 0x00,
0x0F, 0x81, 0x82, 0x08, 0x08, 0x80, 0x24, 0x01, 0x60, 0x0E, 0x00, 0x30,
0x01, 0x80, 0x0C, 0x00, 0x60, 0x03, 0x00, 0x18, 0x00, 0xC0, 0x06, 0x00,
0x30, 0x03, 0x40, 0x12, 0x00, 0x88, 0x08, 0x60, 0xC0, 0xF8, 0x00, 0x06,
0x00, 0x70, 0x06, 0x80, 0x64, 0x06, 0x20, 0x31, 0x00, 0x08, 0x00, 0x40,
0x02, 0x00, 0x10, 0x00, 0x80, 0x04, 0x00, 0x20, 0x01, 0x00, 0x08, 0x00,
0x40, 0x02, 0x00, 0x10, 0x00, 0x80, 0x04, 0x0F, 0xFF, 0x80, 0x0F, 0x80,
0xC3, 0x08, 0x04, 0x80, 0x24, 0x00, 0x80, 0x04, 0x00, 0x20, 0x02, 0x00,
0x10, 0x01, 0x00, 0x10, 0x01, 0x80, 0x18, 0x01, 0x80, 0x18, 0x01, 0x80,
0x18, 0x01, 0x80, 0x58, 0x03, 0x80, 0x1F, 0xFF, 0x80, 0x0F, 0xC0, 0xC0,
0x86, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x04, 0x00,
0x20, 0x0F, 0x00, 0x06, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x40,
0x01, 0x00, 0x04, 0x00, 0x2C, 0x01, 0x9C, 0x0C, 0x0F, 0xC0, 0x01, 0xC0,
0x14, 0x02, 0x40, 0x64, 0x04, 0x40, 0xC4, 0x08, 0x41, 0x84, 0x10, 0x42,
0x04, 0x20, 0x44, 0x04, 0x40, 0x48, 0x04, 0xFF, 0xF0, 0x04, 0x00, 0x40,
0x04, 0x00, 0x40, 0x04, 0x07, 0xF0, 0x3F, 0xF0, 0x80, 0x02, 0x00, 0x08,
0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x0B, 0xF0, 0x30, 0x30, 0x00, 0x60,
0x00, 0x80, 0x01, 0x00, 0x04, 0x00, 0x10, 0x00, 0x40, 0x01, 0x00, 0x0E,
0x00, 0x2C, 0x01, 0x0C, 0x18, 0x0F, 0xC0, 0x01, 0xF0, 0x60, 0x18, 0x03,
0x00, 0x20, 0x04, 0x00, 0x40, 0x0C, 0x00, 0x80, 0x08, 0xF8, 0x98, 0x4A,
0x02, 0xE0, 0x3C, 0x01, 0x80, 0x14, 0x01, 0x40, 0x14, 0x03, 0x20, 0x21,
0x0C, 0x0F, 0x80, 0xFF, 0xF8, 0x01, 0x80, 0x18, 0x03, 0x00, 0x20, 0x02,
0x00, 0x20, 0x04, 0x00, 0x40, 0x04, 0x00, 0xC0, 0x08, 0x00, 0x80, 0x18,
0x01, 0x00, 0x10, 0x01, 0x00, 0x30, 0x02, 0x00, 0x20, 0x02, 0x00, 0x0F,
0x81, 0x83, 0x10, 0x05, 0x80, 0x38, 0x00, 0xC0, 0x06, 0x00, 0x30, 0x03,
0x40, 0x11, 0x83, 0x07, 0xF0, 0x60, 0xC4, 0x01, 0x60, 0x0E, 0x00, 0x30,
0x01, 0x80, 0x0E, 0x00, 0xD0, 0x04, 0x60, 0xC1, 0xFC, 0x00, 0x1F, 0x03,
0x08, 0x40, 0x4C, 0x02, 0x80, 0x28, 0x02, 0x80, 0x18, 0x03, 0xC0, 0x74,
0x05, 0x21, 0x91, 0xF1, 0x00, 0x10, 0x03, 0x00, 0x20, 0x02, 0x00, 0x40,
0x0C, 0x01, 0x80, 0x60, 0xF8, 0x00, 0x77, 0xFF, 0xF7, 0x00, 0x00, 0x00,
0x1D, 0xFF, 0xFD, 0xC0, 0x1C, 0x7C, 0xF9, 0xF1, 0xC0, 0x00, 0x00, 0x00,
0x00, 0xF1, 0xE3, 0x8F, 0x1C, 0x38, 0xE1, 0xC3, 0x06, 0x00, 0x00, 0x06,
0x00, 0x18, 0x00, 0xE0, 0x07, 0x00, 0x38, 0x01, 0xC0, 0x06, 0x00, 0x38,
0x00, 0xE0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x18, 0x00, 0x1C, 0x00, 0x0E,
0x00, 0x07, 0x00, 0x03, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0xFF, 0xFC, 0xC0, 0x00, 0xC0, 0x00, 0xE0, 0x00, 0x70,
0x00, 0x38, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x70,
0x03, 0x80, 0x0C, 0x00, 0x70, 0x03, 0x80, 0x1C, 0x00, 0x60, 0x00, 0x3F,
0x8E, 0x0C, 0x80, 0x28, 0x01, 0x80, 0x10, 0x01, 0x00, 0x10, 0x02, 0x00,
0xC0, 0x38, 0x06, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E,
0x01, 0xF0, 0x1F, 0x00, 0xE0, 0x0F, 0x01, 0x86, 0x08, 0x08, 0x80, 0x24,
0x01, 0x40, 0x0A, 0x00, 0x50, 0x1E, 0x83, 0x14, 0x20, 0xA2, 0x05, 0x10,
0x28, 0x81, 0x46, 0x0A, 0x18, 0x50, 0x3F, 0x80, 0x04, 0x00, 0x10, 0x00,
0x80, 0x02, 0x00, 0x18, 0x18, 0x3F, 0x00, 0x1F, 0xF0, 0x00, 0x06, 0x80,
0x00, 0x34, 0x00, 0x01, 0x30, 0x00, 0x18, 0x80, 0x00, 0x86, 0x00, 0x04,
0x30, 0x00, 0x60, 0x80, 0x02, 0x06, 0x00, 0x10, 0x10, 0x01, 0x80, 0x80,
0x08, 0x06, 0x00, 0x7F, 0xF0, 0x06, 0x00, 0x80, 0x20, 0x06, 0x01, 0x00,
0x10, 0x18, 0x00, 0xC0, 0x80, 0x06, 0x04, 0x00, 0x11, 0xFC, 0x0F, 0xF0,
0xFF, 0xF8, 0x04, 0x01, 0x01, 0x00, 0x20, 0x40, 0x04, 0x10, 0x01, 0x04,
0x00, 0x41, 0x00, 0x10, 0x40, 0x08, 0x10, 0x0C, 0x07, 0xFF, 0x01, 0x00,
0x70, 0x40, 0x06, 0x10, 0x00, 0x84, 0x00, 0x11, 0x00, 0x04, 0x40, 0x01,
0x10, 0x00, 0x44, 0x00, 0x21, 0x00, 0x33, 0xFF, 0xF8, 0x03, 0xF1, 0x06,
0x0E, 0x8C, 0x01, 0xC4, 0x00, 0x64, 0x00, 0x12, 0x00, 0x0A, 0x00, 0x01,
0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00,
0x04, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x20, 0x01, 0x88, 0x01, 0x83,
0x03, 0x80, 0x7E, 0x00, 0xFF, 0xE0, 0x20, 0x18, 0x20, 0x0C, 0x20, 0x04,
0x20, 0x02, 0x20, 0x02, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01,
0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x01, 0x20, 0x02, 0x20, 0x02,
0x20, 0x04, 0x20, 0x0C, 0x20, 0x18, 0xFF, 0xE0, 0xFF, 0xFF, 0x08, 0x00,
0x84, 0x00, 0x42, 0x00, 0x21, 0x00, 0x10, 0x80, 0x00, 0x40, 0x00, 0x20,
0x40, 0x10, 0x20, 0x0F, 0xF0, 0x04, 0x08, 0x02, 0x04, 0x01, 0x00, 0x00,
0x80, 0x00, 0x40, 0x02, 0x20, 0x01, 0x10, 0x00, 0x88, 0x00, 0x44, 0x00,
0x3F, 0xFF, 0xF0, 0xFF, 0xFF, 0x88, 0x00, 0x44, 0x00, 0x22, 0x00, 0x11,
0x00, 0x08, 0x80, 0x00, 0x40, 0x00, 0x20, 0x40, 0x10, 0x20, 0x0F, 0xF0,
0x04, 0x08, 0x02, 0x04, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20,
0x00, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x1F, 0xF8, 0x00, 0x03, 0xF9,
0x06, 0x07, 0x84, 0x00, 0xC4, 0x00, 0x24, 0x00, 0x12, 0x00, 0x02, 0x00,
0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x0F, 0xF8,
0x00, 0x14, 0x00, 0x09, 0x00, 0x04, 0x80, 0x02, 0x20, 0x01, 0x18, 0x00,
0x83, 0x01, 0xC0, 0x7F, 0x00, 0xFC, 0x3F, 0x20, 0x04, 0x20, 0x04, 0x20,
0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x3F,
0xFC, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20,
0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0xFC, 0x3F, 0xFF, 0xF8, 0x10,
0x00, 0x80, 0x04, 0x00, 0x20, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02, 0x00,
0x10, 0x00, 0x80, 0x04, 0x00, 0x20, 0x01, 0x00, 0x08, 0x00, 0x40, 0x02,
0x00, 0x10, 0x00, 0x81, 0xFF, 0xF0, 0x03, 0xFF, 0x80, 0x04, 0x00, 0x02,
0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00,
0x08, 0x00, 0x04, 0x00, 0x02, 0x10, 0x01, 0x08, 0x00, 0x84, 0x00, 0x42,
0x00, 0x21, 0x00, 0x10, 0x80, 0x10, 0x20, 0x18, 0x0C, 0x18, 0x01, 0xF0,
0x00, 0xFF, 0x1F, 0x84, 0x01, 0x81, 0x00, 0xC0, 0x40, 0x60, 0x10, 0x30,
0x04, 0x18, 0x01, 0x0C, 0x00, 0x46, 0x00, 0x13, 0x00, 0x05, 0xF0, 0x01,
0xC6, 0x00, 0x60, 0xC0, 0x10, 0x18, 0x04, 0x06, 0x01, 0x00, 0xC0, 0x40,
0x30, 0x10, 0x04, 0x04, 0x01, 0x81, 0x00, 0x23, 0xFC, 0x0F, 0xFF, 0x80,
0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04,
0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01, 0x00,
0x42, 0x00, 0x84, 0x01, 0x08, 0x02, 0x10, 0x04, 0x20, 0x0F, 0xFF, 0xF0,
0xF0, 0x01, 0xE7, 0x00, 0x70, 0xA0, 0x0A, 0x16, 0x03, 0x42, 0x40, 0x48,
0x4C, 0x19, 0x08, 0x82, 0x21, 0x10, 0x44, 0x23, 0x18, 0x84, 0x22, 0x10,
0x86, 0xC2, 0x10, 0x50, 0x42, 0x0E, 0x08, 0x41, 0xC1, 0x08, 0x00, 0x21,
0x00, 0x04, 0x20, 0x00, 0x84, 0x00, 0x10, 0x80, 0x02, 0x7F, 0x03, 0xF0,
0xF8, 0x1F, 0xC6, 0x00, 0x41, 0xC0, 0x10, 0x50, 0x04, 0x12, 0x01, 0x04,
0xC0, 0x41, 0x10, 0x10, 0x46, 0x04, 0x10, 0x81, 0x04, 0x10, 0x41, 0x04,
0x10, 0x40, 0x84, 0x10, 0x31, 0x04, 0x04, 0x41, 0x01, 0x90, 0x40, 0x24,
0x10, 0x05, 0x04, 0x01, 0xC1, 0x00, 0x31, 0xFC, 0x0C, 0x03, 0xE0, 0x06,
0x0C, 0x04, 0x01, 0x04, 0x00, 0x46, 0x00, 0x32, 0x00, 0x0B, 0x00, 0x05,
0x00, 0x01, 0x80, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00,
0x0E, 0x00, 0x0D, 0x00, 0x04, 0xC0, 0x06, 0x20, 0x02, 0x08, 0x02, 0x03,
0x06, 0x00, 0x7C, 0x00, 0xFF, 0xF0, 0x10, 0x0C, 0x10, 0x02, 0x10, 0x03,
0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x03, 0x10, 0x06, 0x10, 0x0C,
0x1F, 0xF0, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xFF, 0xC0, 0x03, 0xE0, 0x06, 0x0C,
0x04, 0x01, 0x04, 0x00, 0x46, 0x00, 0x32, 0x00, 0x0B, 0x00, 0x07, 0x00,
0x01, 0x80, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0E,
0x00, 0x0D, 0x00, 0x04, 0xC0, 0x06, 0x20, 0x02, 0x08, 0x02, 0x03, 0x06,
0x00, 0xFC, 0x00, 0x30, 0x00, 0x30, 0x00, 0x7F, 0xC6, 0x38, 0x1E, 0xFF,
0xF0, 0x02, 0x01, 0x80, 0x40, 0x08, 0x08, 0x01, 0x81, 0x00, 0x10, 0x20,
0x02, 0x04, 0x00, 0x40, 0x80, 0x18, 0x10, 0x06, 0x02, 0x03, 0x80, 0x7F,
0xC0, 0x08, 0x18, 0x01, 0x01, 0x80, 0x20, 0x18, 0x04, 0x01, 0x80, 0x80,
0x10, 0x10, 0x03, 0x02, 0x00, 0x20, 0x40, 0x06, 0x7F, 0x80, 0x70, 0x0F,
0xC8, 0x61, 0xE2, 0x01, 0x90, 0x02, 0x40, 0x09, 0x00, 0x04, 0x00, 0x08,
0x00, 0x38, 0x00, 0x3E, 0x00, 0x0F, 0x00, 0x06, 0x00, 0x0C, 0x00, 0x18,
0x00, 0x60, 0x01, 0x80, 0x0F, 0x00, 0x2B, 0x03, 0x23, 0xF0, 0xFF, 0xFF,
0x02, 0x06, 0x04, 0x0C, 0x08, 0x18, 0x10, 0x20, 0x20, 0x00, 0x40, 0x00,
0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20,
0x00, 0x40, 0x00, 0x80, 0x01, 0x00, 0x02, 0x00, 0x04, 0x01, 0xFF, 0xC0,
0xFC, 0x1F, 0x90, 0x01, 0x08, 0x00, 0x84, 0x00, 0x42, 0x00, 0x21, 0x00,
0x10, 0x80, 0x08, 0x40, 0x04, 0x20, 0x02, 0x10, 0x01, 0x08, 0x00, 0x84,
0x00, 0x42, 0x00, 0x21, 0x00, 0x10, 0x80, 0x08, 0x40, 0x04, 0x10, 0x04,
0x0C, 0x06, 0x03, 0x06, 0x00, 0x7C, 0x00, 0xFE, 0x03, 0xF8, 0x80, 0x02,
0x04, 0x00, 0x10, 0x30, 0x01, 0x80, 0x80, 0x08, 0x06, 0x00, 0xC0, 0x30,
0x06, 0x00, 0x80, 0x20, 0x06, 0x03, 0x00, 0x30, 0x10, 0x00, 0x80, 0x80,
0x06, 0x0C, 0x00, 0x10, 0x40, 0x00, 0x86, 0x00, 0x06, 0x20, 0x00, 0x11,
0x00, 0x00, 0xD8, 0x00, 0x06, 0x80, 0x00, 0x1C, 0x00, 0x00, 0xE0, 0x00,
0xFC, 0x0F, 0xE8, 0x00, 0x19, 0x00, 0x03, 0x10, 0x00, 0x62, 0x00, 0x08,
0x41, 0x81, 0x08, 0x28, 0x21, 0x05, 0x04, 0x21, 0xA0, 0x84, 0x36, 0x30,
0x84, 0x46, 0x08, 0x88, 0xC1, 0x31, 0x18, 0x24, 0x12, 0x04, 0x82, 0x40,
0xB0, 0x48, 0x14, 0x09, 0x02, 0x80, 0xA0, 0x30, 0x1C, 0x06, 0x03, 0x80,
0x7E, 0x0F, 0xC2, 0x00, 0x60, 0x60, 0x0C, 0x06, 0x03, 0x00, 0x60, 0xC0,
0x0C, 0x10, 0x00, 0xC6, 0x00, 0x0D, 0x80, 0x00, 0xA0, 0x00, 0x1C, 0x00,
0x03, 0x80, 0x00, 0xD8, 0x00, 0x11, 0x00, 0x06, 0x30, 0x01, 0x83, 0x00,
0x60, 0x30, 0x08, 0x06, 0x03, 0x00, 0x60, 0xC0, 0x06, 0x7F, 0x07, 0xF0,
0xFC, 0x1F, 0x98, 0x03, 0x04, 0x01, 0x03, 0x01, 0x80, 0xC1, 0x80, 0x20,
0x80, 0x18, 0xC0, 0x04, 0x40, 0x03, 0x60, 0x00, 0xE0, 0x00, 0x20, 0x00,
0x10, 0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80,
0x00, 0x40, 0x00, 0x20, 0x03, 0xFF, 0x80, 0xFF, 0xF4, 0x00, 0xA0, 0x09,
0x00, 0x48, 0x04, 0x40, 0x40, 0x02, 0x00, 0x20, 0x02, 0x00, 0x10, 0x01,
0x00, 0x10, 0x00, 0x80, 0x08, 0x04, 0x80, 0x24, 0x01, 0x40, 0x0C, 0x00,
0x60, 0x03, 0xFF, 0xF0, 0xFC, 0x21, 0x08, 0x42, 0x10, 0x84, 0x21, 0x08,
0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0xF8, 0x80, 0x02, 0x00, 0x10,
0x00, 0xC0, 0x02, 0x00, 0x18, 0x00, 0x40, 0x03, 0x00, 0x08, 0x00, 0x40,
0x01, 0x00, 0x08, 0x00, 0x20, 0x01, 0x00, 0x04, 0x00, 0x20, 0x00, 0x80,
0x04, 0x00, 0x10, 0x00, 0x80, 0x02, 0x00, 0x10, 0x00, 0x40, 0x02, 0x00,
0x08, 0x00, 0x40, 0xF8, 0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0x84,
0x21, 0x08, 0x42, 0x10, 0x84, 0x21, 0xF8, 0x02, 0x00, 0x38, 0x03, 0x60,
0x11, 0x01, 0x8C, 0x18, 0x31, 0x80, 0xD8, 0x03, 0x80, 0x08, 0xFF, 0xFF,
0xF8, 0xC1, 0x83, 0x06, 0x0C, 0x0F, 0xC0, 0x70, 0x30, 0x00, 0x10, 0x00,
0x08, 0x00, 0x08, 0x00, 0x08, 0x0F, 0xF8, 0x30, 0x08, 0x40, 0x08, 0x80,
0x08, 0x80, 0x08, 0x80, 0x08, 0x80, 0x38, 0x60, 0xE8, 0x3F, 0x8F, 0xF0,
0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x04, 0x00,
0x01, 0x0F, 0x80, 0x4C, 0x18, 0x14, 0x01, 0x06, 0x00, 0x21, 0x80, 0x08,
0x40, 0x01, 0x10, 0x00, 0x44, 0x00, 0x11, 0x00, 0x04, 0x40, 0x01, 0x18,
0x00, 0x86, 0x00, 0x21, 0xC0, 0x10, 0x5C, 0x18, 0xF1, 0xF8, 0x00, 0x07,
0xE4, 0x30, 0x78, 0x80, 0x32, 0x00, 0x24, 0x00, 0x50, 0x00, 0x20, 0x00,
0x40, 0x00, 0x80, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0x12, 0x00, 0xC3,
0x07, 0x01, 0xF8, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00,
0x08, 0x00, 0x02, 0x00, 0x00, 0x80, 0x7C, 0x20, 0x60, 0xC8, 0x20, 0x0A,
0x10, 0x01, 0x84, 0x00, 0x62, 0x00, 0x08, 0x80, 0x02, 0x20, 0x00, 0x88,
0x00, 0x22, 0x00, 0x08, 0xC0, 0x06, 0x10, 0x01, 0x82, 0x00, 0xE0, 0x60,
0xE8, 0x0F, 0xE3, 0xC0, 0x07, 0xE0, 0x1C, 0x18, 0x30, 0x0C, 0x60, 0x06,
0x40, 0x03, 0xC0, 0x03, 0xC0, 0x01, 0xFF, 0xFF, 0xC0, 0x00, 0xC0, 0x00,
0x40, 0x00, 0x60, 0x00, 0x30, 0x03, 0x0C, 0x0E, 0x03, 0xF0, 0x03, 0xFC,
0x18, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x0F, 0xFF, 0x82, 0x00,
0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80,
0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0xFF, 0xF0, 0x0F,
0xC7, 0x9C, 0x3A, 0x18, 0x07, 0x08, 0x01, 0x8C, 0x00, 0xC4, 0x00, 0x22,
0x00, 0x11, 0x00, 0x08, 0x80, 0x04, 0x40, 0x02, 0x10, 0x03, 0x08, 0x01,
0x82, 0x01, 0x40, 0xC3, 0x20, 0x3F, 0x10, 0x00, 0x08, 0x00, 0x04, 0x00,
0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7F, 0x00, 0xF0, 0x00,
0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x47,
0xC0, 0x2C, 0x18, 0x1C, 0x04, 0x0C, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41,
0x00, 0x20, 0x80, 0x10, 0x40, 0x08, 0x20, 0x04, 0x10, 0x02, 0x08, 0x01,
0x04, 0x00, 0x82, 0x00, 0x47, 0xC0, 0xF8, 0x06, 0x00, 0x18, 0x00, 0x60,
0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x02, 0x00, 0x08,
0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02,
0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x03, 0xFF, 0xF0, 0x03, 0x00,
0xC0, 0x30, 0x0C, 0x00, 0x00, 0x00, 0x03, 0xFF, 0x00, 0x40, 0x10, 0x04,
0x01, 0x00, 0x40, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x04, 0x01, 0x00,
0x40, 0x10, 0x04, 0x01, 0x00, 0x40, 0x10, 0x08, 0x06, 0xFE, 0x00, 0xF0,
0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10,
0xFE, 0x10, 0x30, 0x10, 0xE0, 0x11, 0xC0, 0x13, 0x00, 0x16, 0x00, 0x1E,
0x00, 0x1B, 0x00, 0x11, 0x80, 0x10, 0xC0, 0x10, 0x60, 0x10, 0x30, 0x10,
0x18, 0x10, 0x1C, 0xF0, 0x3F, 0x7E, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80,
0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20,
0x00, 0x80, 0x02, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, 0x02, 0x00, 0x08,
0x00, 0x20, 0x00, 0x80, 0xFF, 0xFC, 0xEF, 0x9E, 0x07, 0x1E, 0x20, 0xC1,
0x82, 0x10, 0x20, 0x42, 0x04, 0x08, 0x40, 0x81, 0x08, 0x10, 0x21, 0x02,
0x04, 0x20, 0x40, 0x84, 0x08, 0x10, 0x81, 0x02, 0x10, 0x20, 0x42, 0x04,
0x08, 0x40, 0x81, 0x3E, 0x1C, 0x38, 0x71, 0xF0, 0x0B, 0x06, 0x07, 0x01,
0x03, 0x00, 0x41, 0x00, 0x20, 0x80, 0x10, 0x40, 0x08, 0x20, 0x04, 0x10,
0x02, 0x08, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00, 0x20, 0x80, 0x13,
0xF0, 0x3E, 0x07, 0xC0, 0x30, 0x60, 0x80, 0x22, 0x00, 0x24, 0x00, 0x50,
0x00, 0x60, 0x00, 0xC0, 0x01, 0x80, 0x03, 0x00, 0x05, 0x00, 0x12, 0x00,
0x22, 0x00, 0x83, 0x06, 0x01, 0xF0, 0x00, 0xF1, 0xFC, 0x05, 0xC1, 0x81,
0xC0, 0x10, 0x60, 0x02, 0x18, 0x00, 0xC4, 0x00, 0x11, 0x00, 0x04, 0x40,
0x01, 0x10, 0x00, 0x44, 0x00, 0x11, 0x80, 0x08, 0x60, 0x02, 0x14, 0x01,
0x04, 0xC1, 0x81, 0x0F, 0x80, 0x40, 0x00, 0x10, 0x00, 0x04, 0x00, 0x01,
0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x3F, 0xC0, 0x00, 0x0F, 0xE3, 0xC6,
0x0E, 0x86, 0x00, 0xE1, 0x00, 0x18, 0xC0, 0x06, 0x20, 0x00, 0x88, 0x00,
0x22, 0x00, 0x08, 0x80, 0x02, 0x20, 0x00, 0x84, 0x00, 0x61, 0x00, 0x18,
0x20, 0x0A, 0x06, 0x0C, 0x80, 0x7C, 0x20, 0x00, 0x08, 0x00, 0x02, 0x00,
0x00, 0x80, 0x00, 0x20, 0x00, 0x08, 0x00, 0x02, 0x00, 0x0F, 0xF0, 0xF8,
0x7C, 0x11, 0x8C, 0x2C, 0x00, 0x70, 0x00, 0xC0, 0x01, 0x00, 0x02, 0x00,
0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x01,
0x00, 0x3F, 0xFC, 0x00, 0x0F, 0xD1, 0x83, 0x98, 0x04, 0x80, 0x24, 0x00,
0x30, 0x00, 0xF0, 0x00, 0xFC, 0x00, 0x30, 0x00, 0xE0, 0x03, 0x00, 0x1C,
0x01, 0xF0, 0x1A, 0x7F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
0x00, 0x08, 0x00, 0xFF, 0xFC, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08,
0x00, 0x08, 0x00, 0x08, 0x01, 0x06, 0x0F, 0x03, 0xF8, 0xF0, 0x3E, 0x08,
0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00, 0x20, 0x80, 0x10, 0x40, 0x08,
0x20, 0x04, 0x10, 0x02, 0x08, 0x01, 0x04, 0x00, 0x82, 0x00, 0x41, 0x00,
0xE0, 0x41, 0xD0, 0x1F, 0x8E, 0xFE, 0x0F, 0xE2, 0x00, 0x20, 0x60, 0x0C,
0x0C, 0x01, 0x80, 0x80, 0x20, 0x18, 0x0C, 0x01, 0x01, 0x00, 0x30, 0x60,
0x02, 0x08, 0x00, 0x41, 0x00, 0x0C, 0x60, 0x00, 0x88, 0x00, 0x19, 0x00,
0x01, 0x40, 0x00, 0x38, 0x00, 0xFC, 0x07, 0xE4, 0x00, 0x10, 0x80, 0x02,
0x18, 0x20, 0xC3, 0x0E, 0x18, 0x21, 0x42, 0x04, 0x28, 0x40, 0x8D, 0x88,
0x19, 0x93, 0x03, 0x22, 0x60, 0x2C, 0x68, 0x05, 0x85, 0x00, 0xA0, 0xA0,
0x1C, 0x1C, 0x01, 0x81, 0x80, 0x7C, 0x1F, 0x18, 0x03, 0x06, 0x03, 0x01,
0x83, 0x00, 0x63, 0x00, 0x1B, 0x00, 0x07, 0x00, 0x03, 0x80, 0x03, 0x60,
0x03, 0x18, 0x03, 0x06, 0x03, 0x01, 0x83, 0x00, 0x61, 0x00, 0x33, 0xF0,
0x7E, 0xFC, 0x1F, 0x90, 0x01, 0x8C, 0x00, 0x86, 0x00, 0xC1, 0x80, 0x40,
0xC0, 0x60, 0x20, 0x20, 0x18, 0x30, 0x04, 0x10, 0x03, 0x08, 0x00, 0x8C,
0x00, 0x64, 0x00, 0x16, 0x00, 0x0E, 0x00, 0x07, 0x00, 0x01, 0x00, 0x01,
0x80, 0x00, 0x80, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x20, 0x07, 0xFE, 0x00,
0xFF, 0xF4, 0x01, 0x20, 0x09, 0x00, 0x80, 0x08, 0x00, 0x80, 0x08, 0x00,
0xC0, 0x04, 0x00, 0x40, 0x04, 0x00, 0x40, 0x14, 0x00, 0xA0, 0x07, 0xFF,
0xE0, 0x07, 0x0C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x30, 0xC0, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x0C, 0x07, 0xFF, 0xFF, 0xFF, 0x80, 0xE0, 0x30, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x07, 0x0C, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x30, 0xE0, 0x1C, 0x00, 0x44, 0x0D, 0x84,
0x36, 0x04, 0x40, 0x07, 0x00 ]
FreeMono18pt7bGlyphs = [
[ 0, 0, 0, 21, 0, 1 ], # 0x20 ' '
[ 0, 4, 22, 21, 8, -21 ], # 0x21 '!'
[ 11, 11, 10, 21, 5, -20 ], # 0x22 '"'
[ 25, 14, 24, 21, 3, -21 ], # 0x23 '#'
[ 67, 13, 26, 21, 4, -22 ], # 0x24 '$'
[ 110, 15, 21, 21, 3, -20 ], # 0x25 '%'
[ 150, 12, 18, 21, 4, -17 ], # 0x26 '&'
[ 177, 4, 10, 21, 8, -20 ], # 0x27 '''
[ 182, 5, 25, 21, 10, -20 ], # 0x28 '('
[ 198, 5, 25, 21, 6, -20 ], # 0x29 ')'
[ 214, 13, 12, 21, 4, -20 ], # 0x2A '#'
[ 234, 15, 17, 21, 3, -17 ], # 0x2B '+'
[ 266, 7, 10, 21, 5, -4 ], # 0x2C ','
[ 275, 15, 1, 21, 3, -9 ], # 0x2D '-'
[ 277, 5, 5, 21, 8, -4 ], # 0x2E '.'
[ 281, 13, 26, 21, 4, -22 ], # 0x2F '/'
[ 324, 13, 21, 21, 4, -20 ], # 0x30 '0'
[ 359, 13, 21, 21, 4, -20 ], # 0x31 '1'
[ 394, 13, 21, 21, 3, -20 ], # 0x32 '2'
[ 429, 14, 21, 21, 3, -20 ], # 0x33 '3'
[ 466, 12, 21, 21, 4, -20 ], # 0x34 '4'
[ 498, 14, 21, 21, 3, -20 ], # 0x35 '5'
[ 535, 12, 21, 21, 5, -20 ], # 0x36 '6'
[ 567, 12, 21, 21, 4, -20 ], # 0x37 '7'
[ 599, 13, 21, 21, 4, -20 ], # 0x38 '8'
[ 634, 12, 21, 21, 5, -20 ], # 0x39 '9'
[ 666, 5, 15, 21, 8, -14 ], # 0x3A ':'
[ 676, 7, 20, 21, 5, -14 ], # 0x3B ''
[ 694, 15, 16, 21, 3, -17 ], # 0x3C '<'
[ 724, 17, 6, 21, 2, -12 ], # 0x3D '='
[ 737, 15, 16, 21, 3, -17 ], # 0x3E '>'
[ 767, 12, 20, 21, 5, -19 ], # 0x3F '?'
[ 797, 13, 23, 21, 4, -20 ], # 0x40 '@'
[ 835, 21, 20, 21, 0, -19 ], # 0x41 'A'
[ 888, 18, 20, 21, 1, -19 ], # 0x42 'B'
[ 933, 17, 20, 21, 2, -19 ], # 0x43 'C'
[ 976, 16, 20, 21, 2, -19 ], # 0x44 'D'
[ 1016, 17, 20, 21, 1, -19 ], # 0x45 'E'
[ 1059, 17, 20, 21, 1, -19 ], # 0x46 'F'
[ 1102, 17, 20, 21, 2, -19 ], # 0x47 'G'
[ 1145, 16, 20, 21, 2, -19 ], # 0x48 'H'
[ 1185, 13, 20, 21, 4, -19 ], # 0x49 'I'
[ 1218, 17, 20, 21, 3, -19 ], # 0x4A 'J'
[ 1261, 18, 20, 21, 1, -19 ], # 0x4B 'K'
[ 1306, 15, 20, 21, 3, -19 ], # 0x4C 'L'
[ 1344, 19, 20, 21, 1, -19 ], # 0x4D 'M'
[ 1392, 18, 20, 21, 1, -19 ], # 0x4E 'N'
[ 1437, 17, 20, 21, 2, -19 ], # 0x4F 'O'
[ 1480, 16, 20, 21, 1, -19 ], # 0x50 'P'
[ 1520, 17, 24, 21, 2, -19 ], # 0x51 'Q'
[ 1571, 19, 20, 21, 1, -19 ], # 0x52 'R'
[ 1619, 14, 20, 21, 3, -19 ], # 0x53 'S'
[ 1654, 15, 20, 21, 3, -19 ], # 0x54 'T'
[ 1692, 17, 20, 21, 2, -19 ], # 0x55 'U'
[ 1735, 21, 20, 21, 0, -19 ], # 0x56 'V'
[ 1788, 19, 20, 21, 1, -19 ], # 0x57 'W'
[ 1836, 19, 20, 21, 1, -19 ], # 0x58 'X'
[ 1884, 17, 20, 21, 2, -19 ], # 0x59 'Y'
[ 1927, 13, 20, 21, 4, -19 ], # 0x5A 'Z'
[ 1960, 5, 25, 21, 10, -20 ], # 0x5B '['
[ 1976, 13, 26, 21, 4, -22 ], # 0x5C '\'
[ 2019, 5, 25, 21, 6, -20 ], # 0x5D ']'
[ 2035, 13, 9, 21, 4, -20 ], # 0x5E '^'
[ 2050, 21, 1, 21, 0, 4 ], # 0x5F '_'
[ 2053, 6, 5, 21, 5, -21 ], # 0x60 '`'
[ 2057, 16, 15, 21, 3, -14 ], # 0x61 'a'
[ 2087, 18, 21, 21, 1, -20 ], # 0x62 'b'
[ 2135, 15, 15, 21, 3, -14 ], # 0x63 'c'
[ 2164, 18, 21, 21, 2, -20 ], # 0x64 'd'
[ 2212, 16, 15, 21, 2, -14 ], # 0x65 'e'
[ 2242, 14, 21, 21, 4, -20 ], # 0x66 'f'
[ 2279, 17, 22, 21, 2, -14 ], # 0x67 'g'
[ 2326, 17, 21, 21, 1, -20 ], # 0x68 'h'
[ 2371, 14, 22, 21, 4, -21 ], # 0x69 'i'
[ 2410, 10, 29, 21, 5, -21 ], # 0x6A 'j'
[ 2447, 16, 21, 21, 2, -20 ], # 0x6B 'k'
[ 2489, 14, 21, 21, 4, -20 ], # 0x6C 'l'
[ 2526, 19, 15, 21, 1, -14 ], # 0x6D 'm'
[ 2562, 17, 15, 21, 1, -14 ], # 0x6E 'n'
[ 2594, 15, 15, 21, 3, -14 ], # 0x6F 'o'
[ 2623, 18, 22, 21, 1, -14 ], # 0x70 'p'
[ 2673, 18, 22, 21, 2, -14 ], # 0x71 'q'
[ 2723, 15, 15, 21, 3, -14 ], # 0x72 'r'
[ 2752, 13, 15, 21, 4, -14 ], # 0x73 's'
[ 2777, 16, 20, 21, 1, -19 ], # 0x74 't'
[ 2817, 17, 15, 21, 1, -14 ], # 0x75 'u'
[ 2849, 19, 15, 21, 1, -14 ], # 0x76 'v'
[ 2885, 19, 15, 21, 1, -14 ], # 0x77 'w'
[ 2921, 17, 15, 21, 2, -14 ], # 0x78 'x'
[ 2953, 17, 22, 21, 2, -14 ], # 0x79 'y'
[ 3000, 13, 15, 21, 4, -14 ], # 0x7A 'z'
[ 3025, 8, 25, 21, 6, -20 ], # 0x7B '['
[ 3050, 1, 25, 21, 10, -20 ], # 0x7C '|'
[ 3054, 8, 25, 21, 7, -20 ], # 0x7D ']'
[ 3079, 15, 5, 21, 3, -11 ] ] # 0x7E '~'
FreeMono18pt7b = [
FreeMono18pt7bBitmaps,
FreeMono18pt7bGlyphs,
0x20, 0x7E, 35 ]
# Approx. 3761 bytes
| free_mono18pt7b_bitmaps = [39, 119, 119, 119, 119, 34, 34, 32, 0, 111, 246, 241, 254, 63, 199, 248, 255, 30, 195, 152, 51, 6, 96, 204, 24, 4, 32, 16, 128, 66, 1, 8, 4, 32, 16, 128, 66, 1, 16, 4, 65, 255, 240, 68, 2, 16, 8, 64, 33, 15, 255, 194, 16, 8, 64, 33, 0, 132, 2, 16, 8, 64, 35, 0, 136, 2, 32, 2, 0, 16, 0, 128, 31, 163, 7, 16, 9, 0, 72, 0, 64, 3, 0, 12, 0, 60, 0, 30, 0, 24, 0, 32, 1, 128, 12, 0, 112, 5, 224, 201, 248, 1, 0, 8, 0, 64, 2, 0, 16, 0, 30, 0, 66, 1, 2, 2, 4, 4, 8, 8, 16, 8, 64, 15, 0, 0, 30, 1, 240, 31, 1, 224, 14, 0, 0, 60, 0, 134, 2, 6, 4, 4, 8, 8, 16, 48, 16, 192, 30, 0, 15, 193, 0, 32, 2, 0, 32, 2, 0, 16, 1, 0, 8, 3, 192, 108, 60, 98, 130, 104, 52, 129, 204, 8, 97, 195, 231, 255, 255, 246, 102, 102, 8, 196, 98, 49, 140, 198, 49, 140, 99, 24, 195, 24, 194, 24, 195, 24, 134, 16, 194, 24, 198, 16, 198, 49, 140, 99, 24, 140, 98, 49, 152, 128, 2, 0, 16, 0, 128, 4, 12, 33, 157, 112, 28, 0, 160, 13, 128, 198, 4, 16, 64, 128, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 255, 254, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 62, 120, 243, 199, 142, 24, 112, 193, 128, 255, 254, 119, 255, 247, 0, 0, 8, 0, 192, 4, 0, 96, 2, 0, 48, 1, 0, 24, 0, 128, 12, 0, 64, 2, 0, 32, 1, 0, 16, 0, 128, 8, 0, 64, 4, 0, 32, 2, 0, 16, 1, 0, 8, 0, 128, 4, 0, 0, 15, 129, 130, 8, 8, 128, 36, 1, 96, 14, 0, 48, 1, 128, 12, 0, 96, 3, 0, 24, 0, 192, 6, 0, 48, 3, 64, 18, 0, 136, 8, 96, 192, 248, 0, 6, 0, 112, 6, 128, 100, 6, 32, 49, 0, 8, 0, 64, 2, 0, 16, 0, 128, 4, 0, 32, 1, 0, 8, 0, 64, 2, 0, 16, 0, 128, 4, 15, 255, 128, 15, 128, 195, 8, 4, 128, 36, 0, 128, 4, 0, 32, 2, 0, 16, 1, 0, 16, 1, 128, 24, 1, 128, 24, 1, 128, 24, 1, 128, 88, 3, 128, 31, 255, 128, 15, 192, 192, 134, 1, 0, 2, 0, 8, 0, 32, 0, 128, 4, 0, 32, 15, 0, 6, 0, 4, 0, 8, 0, 16, 0, 64, 1, 0, 4, 0, 44, 1, 156, 12, 15, 192, 1, 192, 20, 2, 64, 100, 4, 64, 196, 8, 65, 132, 16, 66, 4, 32, 68, 4, 64, 72, 4, 255, 240, 4, 0, 64, 4, 0, 64, 4, 7, 240, 63, 240, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 11, 240, 48, 48, 0, 96, 0, 128, 1, 0, 4, 0, 16, 0, 64, 1, 0, 14, 0, 44, 1, 12, 24, 15, 192, 1, 240, 96, 24, 3, 0, 32, 4, 0, 64, 12, 0, 128, 8, 248, 152, 74, 2, 224, 60, 1, 128, 20, 1, 64, 20, 3, 32, 33, 12, 15, 128, 255, 248, 1, 128, 24, 3, 0, 32, 2, 0, 32, 4, 0, 64, 4, 0, 192, 8, 0, 128, 24, 1, 0, 16, 1, 0, 48, 2, 0, 32, 2, 0, 15, 129, 131, 16, 5, 128, 56, 0, 192, 6, 0, 48, 3, 64, 17, 131, 7, 240, 96, 196, 1, 96, 14, 0, 48, 1, 128, 14, 0, 208, 4, 96, 193, 252, 0, 31, 3, 8, 64, 76, 2, 128, 40, 2, 128, 24, 3, 192, 116, 5, 33, 145, 241, 0, 16, 3, 0, 32, 2, 0, 64, 12, 1, 128, 96, 248, 0, 119, 255, 247, 0, 0, 0, 29, 255, 253, 192, 28, 124, 249, 241, 192, 0, 0, 0, 0, 241, 227, 143, 28, 56, 225, 195, 6, 0, 0, 6, 0, 24, 0, 224, 7, 0, 56, 1, 192, 6, 0, 56, 0, 224, 0, 112, 0, 56, 0, 24, 0, 28, 0, 14, 0, 7, 0, 3, 255, 255, 128, 0, 0, 0, 0, 0, 0, 0, 7, 255, 252, 192, 0, 192, 0, 224, 0, 112, 0, 56, 0, 28, 0, 12, 0, 14, 0, 14, 0, 112, 3, 128, 12, 0, 112, 3, 128, 28, 0, 96, 0, 63, 142, 12, 128, 40, 1, 128, 16, 1, 0, 16, 2, 0, 192, 56, 6, 0, 64, 4, 0, 0, 0, 0, 0, 14, 1, 240, 31, 0, 224, 15, 1, 134, 8, 8, 128, 36, 1, 64, 10, 0, 80, 30, 131, 20, 32, 162, 5, 16, 40, 129, 70, 10, 24, 80, 63, 128, 4, 0, 16, 0, 128, 2, 0, 24, 24, 63, 0, 31, 240, 0, 6, 128, 0, 52, 0, 1, 48, 0, 24, 128, 0, 134, 0, 4, 48, 0, 96, 128, 2, 6, 0, 16, 16, 1, 128, 128, 8, 6, 0, 127, 240, 6, 0, 128, 32, 6, 1, 0, 16, 24, 0, 192, 128, 6, 4, 0, 17, 252, 15, 240, 255, 248, 4, 1, 1, 0, 32, 64, 4, 16, 1, 4, 0, 65, 0, 16, 64, 8, 16, 12, 7, 255, 1, 0, 112, 64, 6, 16, 0, 132, 0, 17, 0, 4, 64, 1, 16, 0, 68, 0, 33, 0, 51, 255, 248, 3, 241, 6, 14, 140, 1, 196, 0, 100, 0, 18, 0, 10, 0, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 0, 8, 0, 4, 0, 1, 0, 0, 128, 0, 32, 1, 136, 1, 131, 3, 128, 126, 0, 255, 224, 32, 24, 32, 12, 32, 4, 32, 2, 32, 2, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 2, 32, 2, 32, 4, 32, 12, 32, 24, 255, 224, 255, 255, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 0, 64, 0, 32, 64, 16, 32, 15, 240, 4, 8, 2, 4, 1, 0, 0, 128, 0, 64, 2, 32, 1, 16, 0, 136, 0, 68, 0, 63, 255, 240, 255, 255, 136, 0, 68, 0, 34, 0, 17, 0, 8, 128, 0, 64, 0, 32, 64, 16, 32, 15, 240, 4, 8, 2, 4, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 0, 8, 0, 4, 0, 31, 248, 0, 3, 249, 6, 7, 132, 0, 196, 0, 36, 0, 18, 0, 2, 0, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 15, 248, 0, 20, 0, 9, 0, 4, 128, 2, 32, 1, 24, 0, 131, 1, 192, 127, 0, 252, 63, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 63, 252, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 32, 4, 252, 63, 255, 248, 16, 0, 128, 4, 0, 32, 1, 0, 8, 0, 64, 2, 0, 16, 0, 128, 4, 0, 32, 1, 0, 8, 0, 64, 2, 0, 16, 0, 129, 255, 240, 3, 255, 128, 4, 0, 2, 0, 1, 0, 0, 128, 0, 64, 0, 32, 0, 16, 0, 8, 0, 4, 0, 2, 16, 1, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 16, 32, 24, 12, 24, 1, 240, 0, 255, 31, 132, 1, 129, 0, 192, 64, 96, 16, 48, 4, 24, 1, 12, 0, 70, 0, 19, 0, 5, 240, 1, 198, 0, 96, 192, 16, 24, 4, 6, 1, 0, 192, 64, 48, 16, 4, 4, 1, 129, 0, 35, 252, 15, 255, 128, 16, 0, 32, 0, 64, 0, 128, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 66, 0, 132, 1, 8, 2, 16, 4, 32, 15, 255, 240, 240, 1, 231, 0, 112, 160, 10, 22, 3, 66, 64, 72, 76, 25, 8, 130, 33, 16, 68, 35, 24, 132, 34, 16, 134, 194, 16, 80, 66, 14, 8, 65, 193, 8, 0, 33, 0, 4, 32, 0, 132, 0, 16, 128, 2, 127, 3, 240, 248, 31, 198, 0, 65, 192, 16, 80, 4, 18, 1, 4, 192, 65, 16, 16, 70, 4, 16, 129, 4, 16, 65, 4, 16, 64, 132, 16, 49, 4, 4, 65, 1, 144, 64, 36, 16, 5, 4, 1, 193, 0, 49, 252, 12, 3, 224, 6, 12, 4, 1, 4, 0, 70, 0, 50, 0, 11, 0, 5, 0, 1, 128, 0, 192, 0, 96, 0, 48, 0, 24, 0, 14, 0, 13, 0, 4, 192, 6, 32, 2, 8, 2, 3, 6, 0, 124, 0, 255, 240, 16, 12, 16, 2, 16, 3, 16, 1, 16, 1, 16, 1, 16, 3, 16, 6, 16, 12, 31, 240, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 255, 192, 3, 224, 6, 12, 4, 1, 4, 0, 70, 0, 50, 0, 11, 0, 7, 0, 1, 128, 0, 192, 0, 96, 0, 48, 0, 24, 0, 14, 0, 13, 0, 4, 192, 6, 32, 2, 8, 2, 3, 6, 0, 252, 0, 48, 0, 48, 0, 127, 198, 56, 30, 255, 240, 2, 1, 128, 64, 8, 8, 1, 129, 0, 16, 32, 2, 4, 0, 64, 128, 24, 16, 6, 2, 3, 128, 127, 192, 8, 24, 1, 1, 128, 32, 24, 4, 1, 128, 128, 16, 16, 3, 2, 0, 32, 64, 6, 127, 128, 112, 15, 200, 97, 226, 1, 144, 2, 64, 9, 0, 4, 0, 8, 0, 56, 0, 62, 0, 15, 0, 6, 0, 12, 0, 24, 0, 96, 1, 128, 15, 0, 43, 3, 35, 240, 255, 255, 2, 6, 4, 12, 8, 24, 16, 32, 32, 0, 64, 0, 128, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 2, 0, 4, 1, 255, 192, 252, 31, 144, 1, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 8, 64, 4, 32, 2, 16, 1, 8, 0, 132, 0, 66, 0, 33, 0, 16, 128, 8, 64, 4, 16, 4, 12, 6, 3, 6, 0, 124, 0, 254, 3, 248, 128, 2, 4, 0, 16, 48, 1, 128, 128, 8, 6, 0, 192, 48, 6, 0, 128, 32, 6, 3, 0, 48, 16, 0, 128, 128, 6, 12, 0, 16, 64, 0, 134, 0, 6, 32, 0, 17, 0, 0, 216, 0, 6, 128, 0, 28, 0, 0, 224, 0, 252, 15, 232, 0, 25, 0, 3, 16, 0, 98, 0, 8, 65, 129, 8, 40, 33, 5, 4, 33, 160, 132, 54, 48, 132, 70, 8, 136, 193, 49, 24, 36, 18, 4, 130, 64, 176, 72, 20, 9, 2, 128, 160, 48, 28, 6, 3, 128, 126, 15, 194, 0, 96, 96, 12, 6, 3, 0, 96, 192, 12, 16, 0, 198, 0, 13, 128, 0, 160, 0, 28, 0, 3, 128, 0, 216, 0, 17, 0, 6, 48, 1, 131, 0, 96, 48, 8, 6, 3, 0, 96, 192, 6, 127, 7, 240, 252, 31, 152, 3, 4, 1, 3, 1, 128, 193, 128, 32, 128, 24, 192, 4, 64, 3, 96, 0, 224, 0, 32, 0, 16, 0, 8, 0, 4, 0, 2, 0, 1, 0, 0, 128, 0, 64, 0, 32, 3, 255, 128, 255, 244, 0, 160, 9, 0, 72, 4, 64, 64, 2, 0, 32, 2, 0, 16, 1, 0, 16, 0, 128, 8, 4, 128, 36, 1, 64, 12, 0, 96, 3, 255, 240, 252, 33, 8, 66, 16, 132, 33, 8, 66, 16, 132, 33, 8, 66, 16, 248, 128, 2, 0, 16, 0, 192, 2, 0, 24, 0, 64, 3, 0, 8, 0, 64, 1, 0, 8, 0, 32, 1, 0, 4, 0, 32, 0, 128, 4, 0, 16, 0, 128, 2, 0, 16, 0, 64, 2, 0, 8, 0, 64, 248, 66, 16, 132, 33, 8, 66, 16, 132, 33, 8, 66, 16, 132, 33, 248, 2, 0, 56, 3, 96, 17, 1, 140, 24, 49, 128, 216, 3, 128, 8, 255, 255, 248, 193, 131, 6, 12, 15, 192, 112, 48, 0, 16, 0, 8, 0, 8, 0, 8, 15, 248, 48, 8, 64, 8, 128, 8, 128, 8, 128, 8, 128, 56, 96, 232, 63, 143, 240, 0, 4, 0, 1, 0, 0, 64, 0, 16, 0, 4, 0, 1, 15, 128, 76, 24, 20, 1, 6, 0, 33, 128, 8, 64, 1, 16, 0, 68, 0, 17, 0, 4, 64, 1, 24, 0, 134, 0, 33, 192, 16, 92, 24, 241, 248, 0, 7, 228, 48, 120, 128, 50, 0, 36, 0, 80, 0, 32, 0, 64, 0, 128, 1, 0, 3, 0, 2, 0, 18, 0, 195, 7, 1, 248, 0, 0, 30, 0, 0, 128, 0, 32, 0, 8, 0, 2, 0, 0, 128, 124, 32, 96, 200, 32, 10, 16, 1, 132, 0, 98, 0, 8, 128, 2, 32, 0, 136, 0, 34, 0, 8, 192, 6, 16, 1, 130, 0, 224, 96, 232, 15, 227, 192, 7, 224, 28, 24, 48, 12, 96, 6, 64, 3, 192, 3, 192, 1, 255, 255, 192, 0, 192, 0, 64, 0, 96, 0, 48, 3, 12, 14, 3, 240, 3, 252, 24, 0, 128, 2, 0, 8, 0, 32, 15, 255, 130, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 255, 240, 15, 199, 156, 58, 24, 7, 8, 1, 140, 0, 196, 0, 34, 0, 17, 0, 8, 128, 4, 64, 2, 16, 3, 8, 1, 130, 1, 64, 195, 32, 63, 16, 0, 8, 0, 4, 0, 2, 0, 1, 0, 1, 0, 1, 0, 127, 0, 240, 0, 8, 0, 4, 0, 2, 0, 1, 0, 0, 128, 0, 71, 192, 44, 24, 28, 4, 12, 1, 4, 0, 130, 0, 65, 0, 32, 128, 16, 64, 8, 32, 4, 16, 2, 8, 1, 4, 0, 130, 0, 71, 192, 248, 6, 0, 24, 0, 96, 1, 128, 0, 0, 0, 0, 0, 31, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 3, 255, 240, 3, 0, 192, 48, 12, 0, 0, 0, 3, 255, 0, 64, 16, 4, 1, 0, 64, 16, 4, 1, 0, 64, 16, 4, 1, 0, 64, 16, 4, 1, 0, 64, 16, 8, 6, 254, 0, 240, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 254, 16, 48, 16, 224, 17, 192, 19, 0, 22, 0, 30, 0, 27, 0, 17, 128, 16, 192, 16, 96, 16, 48, 16, 24, 16, 28, 240, 63, 126, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 2, 0, 8, 0, 32, 0, 128, 255, 252, 239, 158, 7, 30, 32, 193, 130, 16, 32, 66, 4, 8, 64, 129, 8, 16, 33, 2, 4, 32, 64, 132, 8, 16, 129, 2, 16, 32, 66, 4, 8, 64, 129, 62, 28, 56, 113, 240, 11, 6, 7, 1, 3, 0, 65, 0, 32, 128, 16, 64, 8, 32, 4, 16, 2, 8, 1, 4, 0, 130, 0, 65, 0, 32, 128, 19, 240, 62, 7, 192, 48, 96, 128, 34, 0, 36, 0, 80, 0, 96, 0, 192, 1, 128, 3, 0, 5, 0, 18, 0, 34, 0, 131, 6, 1, 240, 0, 241, 252, 5, 193, 129, 192, 16, 96, 2, 24, 0, 196, 0, 17, 0, 4, 64, 1, 16, 0, 68, 0, 17, 128, 8, 96, 2, 20, 1, 4, 193, 129, 15, 128, 64, 0, 16, 0, 4, 0, 1, 0, 0, 64, 0, 16, 0, 63, 192, 0, 15, 227, 198, 14, 134, 0, 225, 0, 24, 192, 6, 32, 0, 136, 0, 34, 0, 8, 128, 2, 32, 0, 132, 0, 97, 0, 24, 32, 10, 6, 12, 128, 124, 32, 0, 8, 0, 2, 0, 0, 128, 0, 32, 0, 8, 0, 2, 0, 15, 240, 248, 124, 17, 140, 44, 0, 112, 0, 192, 1, 0, 2, 0, 4, 0, 8, 0, 16, 0, 32, 0, 64, 0, 128, 1, 0, 63, 252, 0, 15, 209, 131, 152, 4, 128, 36, 0, 48, 0, 240, 0, 252, 0, 48, 0, 224, 3, 0, 28, 1, 240, 26, 127, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 255, 252, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 0, 8, 1, 6, 15, 3, 248, 240, 62, 8, 1, 4, 0, 130, 0, 65, 0, 32, 128, 16, 64, 8, 32, 4, 16, 2, 8, 1, 4, 0, 130, 0, 65, 0, 224, 65, 208, 31, 142, 254, 15, 226, 0, 32, 96, 12, 12, 1, 128, 128, 32, 24, 12, 1, 1, 0, 48, 96, 2, 8, 0, 65, 0, 12, 96, 0, 136, 0, 25, 0, 1, 64, 0, 56, 0, 252, 7, 228, 0, 16, 128, 2, 24, 32, 195, 14, 24, 33, 66, 4, 40, 64, 141, 136, 25, 147, 3, 34, 96, 44, 104, 5, 133, 0, 160, 160, 28, 28, 1, 129, 128, 124, 31, 24, 3, 6, 3, 1, 131, 0, 99, 0, 27, 0, 7, 0, 3, 128, 3, 96, 3, 24, 3, 6, 3, 1, 131, 0, 97, 0, 51, 240, 126, 252, 31, 144, 1, 140, 0, 134, 0, 193, 128, 64, 192, 96, 32, 32, 24, 48, 4, 16, 3, 8, 0, 140, 0, 100, 0, 22, 0, 14, 0, 7, 0, 1, 0, 1, 128, 0, 128, 0, 192, 0, 96, 0, 32, 7, 254, 0, 255, 244, 1, 32, 9, 0, 128, 8, 0, 128, 8, 0, 192, 4, 0, 64, 4, 0, 64, 20, 0, 160, 7, 255, 224, 7, 12, 8, 8, 8, 8, 8, 8, 8, 8, 8, 48, 192, 48, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 7, 255, 255, 255, 128, 224, 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8, 7, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 48, 224, 28, 0, 68, 13, 132, 54, 4, 64, 7, 0]
free_mono18pt7b_glyphs = [[0, 0, 0, 21, 0, 1], [0, 4, 22, 21, 8, -21], [11, 11, 10, 21, 5, -20], [25, 14, 24, 21, 3, -21], [67, 13, 26, 21, 4, -22], [110, 15, 21, 21, 3, -20], [150, 12, 18, 21, 4, -17], [177, 4, 10, 21, 8, -20], [182, 5, 25, 21, 10, -20], [198, 5, 25, 21, 6, -20], [214, 13, 12, 21, 4, -20], [234, 15, 17, 21, 3, -17], [266, 7, 10, 21, 5, -4], [275, 15, 1, 21, 3, -9], [277, 5, 5, 21, 8, -4], [281, 13, 26, 21, 4, -22], [324, 13, 21, 21, 4, -20], [359, 13, 21, 21, 4, -20], [394, 13, 21, 21, 3, -20], [429, 14, 21, 21, 3, -20], [466, 12, 21, 21, 4, -20], [498, 14, 21, 21, 3, -20], [535, 12, 21, 21, 5, -20], [567, 12, 21, 21, 4, -20], [599, 13, 21, 21, 4, -20], [634, 12, 21, 21, 5, -20], [666, 5, 15, 21, 8, -14], [676, 7, 20, 21, 5, -14], [694, 15, 16, 21, 3, -17], [724, 17, 6, 21, 2, -12], [737, 15, 16, 21, 3, -17], [767, 12, 20, 21, 5, -19], [797, 13, 23, 21, 4, -20], [835, 21, 20, 21, 0, -19], [888, 18, 20, 21, 1, -19], [933, 17, 20, 21, 2, -19], [976, 16, 20, 21, 2, -19], [1016, 17, 20, 21, 1, -19], [1059, 17, 20, 21, 1, -19], [1102, 17, 20, 21, 2, -19], [1145, 16, 20, 21, 2, -19], [1185, 13, 20, 21, 4, -19], [1218, 17, 20, 21, 3, -19], [1261, 18, 20, 21, 1, -19], [1306, 15, 20, 21, 3, -19], [1344, 19, 20, 21, 1, -19], [1392, 18, 20, 21, 1, -19], [1437, 17, 20, 21, 2, -19], [1480, 16, 20, 21, 1, -19], [1520, 17, 24, 21, 2, -19], [1571, 19, 20, 21, 1, -19], [1619, 14, 20, 21, 3, -19], [1654, 15, 20, 21, 3, -19], [1692, 17, 20, 21, 2, -19], [1735, 21, 20, 21, 0, -19], [1788, 19, 20, 21, 1, -19], [1836, 19, 20, 21, 1, -19], [1884, 17, 20, 21, 2, -19], [1927, 13, 20, 21, 4, -19], [1960, 5, 25, 21, 10, -20], [1976, 13, 26, 21, 4, -22], [2019, 5, 25, 21, 6, -20], [2035, 13, 9, 21, 4, -20], [2050, 21, 1, 21, 0, 4], [2053, 6, 5, 21, 5, -21], [2057, 16, 15, 21, 3, -14], [2087, 18, 21, 21, 1, -20], [2135, 15, 15, 21, 3, -14], [2164, 18, 21, 21, 2, -20], [2212, 16, 15, 21, 2, -14], [2242, 14, 21, 21, 4, -20], [2279, 17, 22, 21, 2, -14], [2326, 17, 21, 21, 1, -20], [2371, 14, 22, 21, 4, -21], [2410, 10, 29, 21, 5, -21], [2447, 16, 21, 21, 2, -20], [2489, 14, 21, 21, 4, -20], [2526, 19, 15, 21, 1, -14], [2562, 17, 15, 21, 1, -14], [2594, 15, 15, 21, 3, -14], [2623, 18, 22, 21, 1, -14], [2673, 18, 22, 21, 2, -14], [2723, 15, 15, 21, 3, -14], [2752, 13, 15, 21, 4, -14], [2777, 16, 20, 21, 1, -19], [2817, 17, 15, 21, 1, -14], [2849, 19, 15, 21, 1, -14], [2885, 19, 15, 21, 1, -14], [2921, 17, 15, 21, 2, -14], [2953, 17, 22, 21, 2, -14], [3000, 13, 15, 21, 4, -14], [3025, 8, 25, 21, 6, -20], [3050, 1, 25, 21, 10, -20], [3054, 8, 25, 21, 7, -20], [3079, 15, 5, 21, 3, -11]]
free_mono18pt7b = [FreeMono18pt7bBitmaps, FreeMono18pt7bGlyphs, 32, 126, 35] |
def intervalIntersection(A, B):
aIndex = 0
bIndex = 0
toReturn = []
arg1 = A[aIndex]
arg2 = B[bIndex]
flag = True
def compareArrs(aArr, bArr):
signifyInd = ""
zipComp = zip(aArr, bArr)
compList = list(zipComp)
lowIntSec = max(compList[0])
highIntSec = min(compList[1])
if aArr[0] > bArr[1]:
signifyInd = "B"
intersection = "NO INTERSECTION"
elif bArr[0] > aArr[1]:
signifyInd = "A"
intersection = "NO INTERSECTION"
else:
if aArr[1] == highIntSec:
signifyInd = "A"
elif bArr[1] == highIntSec:
signifyInd = "B"
intersection = [lowIntSec, highIntSec]
return [intersection, signifyInd]
while flag:
arg1 = A[aIndex]
arg2 = B[bIndex]
flag = False
result = compareArrs(arg1, arg2)
print(result)
if result[0] == "NO INTERSECTION":
pass
else:
toReturn.append(result[0])
if result[1] == "A":
if aIndex == len(A)-1:
print(toReturn)
return toReturn
else:
aIndex += 1
print("aIndex", aIndex)
flag = True
elif result[1] == "B":
if bIndex == len(B)-1:
print(toReturn)
return toReturn
else:
bIndex += 1
print("bIndex", bIndex)
flag = True
return toReturn
A = [[0, 2], [5, 10], [13, 23], [24, 25]]
B = [[1, 5], [8, 12], [15, 24], [25, 26]]
intervalIntersection(A, B)
| def interval_intersection(A, B):
a_index = 0
b_index = 0
to_return = []
arg1 = A[aIndex]
arg2 = B[bIndex]
flag = True
def compare_arrs(aArr, bArr):
signify_ind = ''
zip_comp = zip(aArr, bArr)
comp_list = list(zipComp)
low_int_sec = max(compList[0])
high_int_sec = min(compList[1])
if aArr[0] > bArr[1]:
signify_ind = 'B'
intersection = 'NO INTERSECTION'
elif bArr[0] > aArr[1]:
signify_ind = 'A'
intersection = 'NO INTERSECTION'
else:
if aArr[1] == highIntSec:
signify_ind = 'A'
elif bArr[1] == highIntSec:
signify_ind = 'B'
intersection = [lowIntSec, highIntSec]
return [intersection, signifyInd]
while flag:
arg1 = A[aIndex]
arg2 = B[bIndex]
flag = False
result = compare_arrs(arg1, arg2)
print(result)
if result[0] == 'NO INTERSECTION':
pass
else:
toReturn.append(result[0])
if result[1] == 'A':
if aIndex == len(A) - 1:
print(toReturn)
return toReturn
else:
a_index += 1
print('aIndex', aIndex)
flag = True
elif result[1] == 'B':
if bIndex == len(B) - 1:
print(toReturn)
return toReturn
else:
b_index += 1
print('bIndex', bIndex)
flag = True
return toReturn
a = [[0, 2], [5, 10], [13, 23], [24, 25]]
b = [[1, 5], [8, 12], [15, 24], [25, 26]]
interval_intersection(A, B) |
def test_no_metrics(run):
tracking = run.tracking
metrics = run.dict.pop("metrics")
tracking.on_epoch_end(run)
run.set(metrics=metrics)
| def test_no_metrics(run):
tracking = run.tracking
metrics = run.dict.pop('metrics')
tracking.on_epoch_end(run)
run.set(metrics=metrics) |
# -*- coding: utf-8 -*-
VERSION_MAJOR = 0
VERSION_MINOR = 0
VERSION_MICRO = 4
VERSION = (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO)
VERSION_STR = '.'.join(map(str, VERSION))
| version_major = 0
version_minor = 0
version_micro = 4
version = (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO)
version_str = '.'.join(map(str, VERSION)) |
#!/usr/bin/env python3
def fibs():
fib1, fib2 = 1, 1
while True:
yield fib1
fib1, fib2 = fib2, fib1 + fib2
print(next(i for (i, f) in enumerate(fibs(), 1) if len(str(f)) == 1000))
| def fibs():
(fib1, fib2) = (1, 1)
while True:
yield fib1
(fib1, fib2) = (fib2, fib1 + fib2)
print(next((i for (i, f) in enumerate(fibs(), 1) if len(str(f)) == 1000))) |
#-*-coding: utf-8 -*-
'''
Base cache Adapter object.
'''
class BaseAdapter(object):
db = None
def __init__(self, timeout = -1):
self.timeout = timeout
def get(self, key):
raise NotImplementedError()
def set(self, key, value):
raise NotImplementedError()
def remove(self, key):
raise NotImplementedError()
def flush(self):
raise NotImplementedError() | """
Base cache Adapter object.
"""
class Baseadapter(object):
db = None
def __init__(self, timeout=-1):
self.timeout = timeout
def get(self, key):
raise not_implemented_error()
def set(self, key, value):
raise not_implemented_error()
def remove(self, key):
raise not_implemented_error()
def flush(self):
raise not_implemented_error() |
def repeated_word(string):
# separate the string
string = string.split(' ')
separated_string = []
for word in string:
if word not in separated_string:
separated_string.append(word)
for word in range(0, len(separated_string)):
print(separated_string[word], 'appears', string.count(separated_string[word]))
def main():
string = "mercedes mercedes mexico orange spoon orange gary gary"
repeated_word(string)
if __name__ == "__main__":
main()
| def repeated_word(string):
string = string.split(' ')
separated_string = []
for word in string:
if word not in separated_string:
separated_string.append(word)
for word in range(0, len(separated_string)):
print(separated_string[word], 'appears', string.count(separated_string[word]))
def main():
string = 'mercedes mercedes mexico orange spoon orange gary gary'
repeated_word(string)
if __name__ == '__main__':
main() |
#Algorythm: Quicksort (sometimes called partition-exchange sort)
#Description: In this file we are using the Hoare partition scheme,
#you can seen other implementation in the other quicksort files
#Source link: I saw the algorithm explanation on https://en.wikipedia.org/wiki/Quicksort
#Use: It is used to sort, it is a comparison sort
#Developer: Tony Hoare
#Mathematical analysis: It takes O(n log n) comparisons to sort n items, in worst cases it takes O(n^2)
#Name: swapValues
#Description: This function is used to swap the values of two indexs in an array
#Arguments: 3; array is the array where the values are,
# x is an index to swap value
# y is the other index to swap values
#Return: Nothing
#Example: swapValues(sampleArray,0,1)
def swapValues(array,x,y):
#I created this temporal var to avoid call len(array) several times
len_arr=len(array)
#Tese conditions are done to avoid out of array exceptions
if len_arr>0 and x<len_arr and x>=0 and y>=0 and y<len_arr and x!=y:
#Just used this for debugging purposes
#print("Swap "+str(array[x])+" and "+str(array[y]))
temp_var=array[y]
array[y]=array[x]
array[x]=temp_var
#Name: partition
#Description: Used to create a partition and order it, swapping values
#Arguments: 3; array is the array where the values are,
# min_index is the minimum index of the partition
# max_index is the maximum index of the partition
#Return: 1, an integer which is an index
#Example: ret_value = partition(sampleArray,0,20)
def partition(array,min_index,max_index):
pivot_value = array[min_index]
i = min_index - 1
j = max_index + 1
while True:
#Since Python doesn't have a 'do'...'while' loop,
#we emulate it with something like this
i = i + 1
while array[i] < pivot_value:
i = i +1
j = j - 1
while array[j] > pivot_value:
j = j -1
if i >= j:
return j
swapValues(array,i,j)
#Name: quicksort
#Description: The algorithm itself, basically it is the Python implementation
#of the Hoare partition scheme of Quicksort algorithm
#Arguments: 3; array is the array where the values are,
# min_index is the minimum index of the array (or the min
# index we want to sort)
# max_index is the maximum index of the array (or the max
# index we want to sort)
#Return: Nothing
#Example: quicksort(sampleArray,0,len(sampleArray)-1) (it will sort the entire
#sampleArray
def quicksort(array,min_index,max_index):
if min_index < max_index:
p=partition(array,min_index,max_index)
quicksort(array,min_index,p)
quicksort(array,p+1,max_index)
#This is just for testing if everything works
arr=[2,7,3,1]
print("Unsorted array:")
print(arr)
quicksort(arr,0,len(arr)-1)
print("Sorted array:")
print(arr)
| def swap_values(array, x, y):
len_arr = len(array)
if len_arr > 0 and x < len_arr and (x >= 0) and (y >= 0) and (y < len_arr) and (x != y):
temp_var = array[y]
array[y] = array[x]
array[x] = temp_var
def partition(array, min_index, max_index):
pivot_value = array[min_index]
i = min_index - 1
j = max_index + 1
while True:
i = i + 1
while array[i] < pivot_value:
i = i + 1
j = j - 1
while array[j] > pivot_value:
j = j - 1
if i >= j:
return j
swap_values(array, i, j)
def quicksort(array, min_index, max_index):
if min_index < max_index:
p = partition(array, min_index, max_index)
quicksort(array, min_index, p)
quicksort(array, p + 1, max_index)
arr = [2, 7, 3, 1]
print('Unsorted array:')
print(arr)
quicksort(arr, 0, len(arr) - 1)
print('Sorted array:')
print(arr) |
def admin_helper(admin) -> dict:
return {
"id": str(admin['_id']),
"fullname": admin['fullname'],
"email": admin['email'],
}
def state_count_helper(state_count) -> dict:
return {
"id": str(state_count['_id']),
"date": state_count['date'],
"state": state_count["state"],
"ad_count": state_count["ad_count"],
"avg_age": state_count["avg_age"],
"email_count": state_count["email_count"],
"phone_count": state_count["phone_count"]
}
def city_count_helper(city_count) -> dict:
return {
"id": str(city_count['_id']),
"date": city_count['date'],
"city": city_count["city"],
"ad_count": city_count["ad_count"],
"avg_age": city_count["avg_age"],
"email_count": city_count["email_count"],
"phone_count": city_count["phone_count"]
} | def admin_helper(admin) -> dict:
return {'id': str(admin['_id']), 'fullname': admin['fullname'], 'email': admin['email']}
def state_count_helper(state_count) -> dict:
return {'id': str(state_count['_id']), 'date': state_count['date'], 'state': state_count['state'], 'ad_count': state_count['ad_count'], 'avg_age': state_count['avg_age'], 'email_count': state_count['email_count'], 'phone_count': state_count['phone_count']}
def city_count_helper(city_count) -> dict:
return {'id': str(city_count['_id']), 'date': city_count['date'], 'city': city_count['city'], 'ad_count': city_count['ad_count'], 'avg_age': city_count['avg_age'], 'email_count': city_count['email_count'], 'phone_count': city_count['phone_count']} |
def get_strings(city):
city = city.lower().replace(" ", "")
ans = [""] * 26
order = ""
for i in city:
if i not in order:
order += i
for i in city:
ans[ord(i) - 97] += "*"
return ",".join([i + ":" + ans[ord(i) - 97] for i in order])
print(get_strings("Chicago")) | def get_strings(city):
city = city.lower().replace(' ', '')
ans = [''] * 26
order = ''
for i in city:
if i not in order:
order += i
for i in city:
ans[ord(i) - 97] += '*'
return ','.join([i + ':' + ans[ord(i) - 97] for i in order])
print(get_strings('Chicago')) |
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
answer = 0
for i in range(1, n):
if a*(x[i]-x[i-1]) < b:
answer += a*(x[i]-x[i-1])
else:
answer += b
print(answer) | (n, a, b) = map(int, input().split())
x = list(map(int, input().split()))
answer = 0
for i in range(1, n):
if a * (x[i] - x[i - 1]) < b:
answer += a * (x[i] - x[i - 1])
else:
answer += b
print(answer) |
# address of mongoDB
MONGO_SERVER = 'mongodb://192.168.1.234:27017/'
# MONGO_SERVER = 'mongodb://mongodb.test:27017/'
SCHEDULER_DB = "scheduler"
JOB_COLLECTION = "jobs"
REGISTRY_URL = "registry.zilliz.com/milvus/milvus"
IDC_NAS_URL = "//172.16.70.249/test"
DEFAULT_IMAGE = "milvusdb/milvus:latest"
SERVER_HOST_DEFAULT = "127.0.0.1"
SERVER_PORT_DEFAULT = 19530
# milvus version, should be changed by manual
SERVER_VERSION = "2.0.0-RC7"
DEFUALT_DEPLOY_MODE = "single"
HELM_NAMESPACE = "milvus"
BRANCH = "master"
DEFAULT_CPUS = 48
# path of NAS mount
RAW_DATA_DIR = "/test/milvus/raw_data/"
# nars log
LOG_PATH = "/test/milvus/benchmark/logs/{}/".format(BRANCH)
# Three deployment methods currently supported
DEFAULT_DEPLOY_MODE = "single"
SINGLE_DEPLOY_MODE = "single"
CLUSTER_DEPLOY_MODE = "cluster"
CLUSTER_3RD_DEPLOY_MODE = "cluster_3rd"
NAMESPACE = "milvus"
CHAOS_NAMESPACE = "chaos-testing"
DEFAULT_API_VERSION = 'chaos-mesh.org/v1alpha1'
DEFAULT_GROUP = 'chaos-mesh.org'
DEFAULT_VERSION = 'v1alpha1'
# minio config
MINIO_HOST = "milvus-test-minio.qa-milvus.svc.cluster.local"
MINIO_PORT = 9000
MINIO_ACCESS_KEY = "minioadmin"
MINIO_SECRET_KEY = "minioadmin"
MINIO_BUCKET_NAME = "test" | mongo_server = 'mongodb://192.168.1.234:27017/'
scheduler_db = 'scheduler'
job_collection = 'jobs'
registry_url = 'registry.zilliz.com/milvus/milvus'
idc_nas_url = '//172.16.70.249/test'
default_image = 'milvusdb/milvus:latest'
server_host_default = '127.0.0.1'
server_port_default = 19530
server_version = '2.0.0-RC7'
defualt_deploy_mode = 'single'
helm_namespace = 'milvus'
branch = 'master'
default_cpus = 48
raw_data_dir = '/test/milvus/raw_data/'
log_path = '/test/milvus/benchmark/logs/{}/'.format(BRANCH)
default_deploy_mode = 'single'
single_deploy_mode = 'single'
cluster_deploy_mode = 'cluster'
cluster_3_rd_deploy_mode = 'cluster_3rd'
namespace = 'milvus'
chaos_namespace = 'chaos-testing'
default_api_version = 'chaos-mesh.org/v1alpha1'
default_group = 'chaos-mesh.org'
default_version = 'v1alpha1'
minio_host = 'milvus-test-minio.qa-milvus.svc.cluster.local'
minio_port = 9000
minio_access_key = 'minioadmin'
minio_secret_key = 'minioadmin'
minio_bucket_name = 'test' |
src = Split('''
tls_test.c
''')
component = aos_component('tls_test', src)
component.add_comp_deps('security/mbedtls') | src = split('\n tls_test.c\n')
component = aos_component('tls_test', src)
component.add_comp_deps('security/mbedtls') |
NC_READ_REQUEST = 0
NC_READ_REPLY = 1
NC_HOT_READ_REQUEST = 2
NC_WRITE_REQUEST = 4
NC_WRITE_REPLY = 5
NC_UPDATE_REQUEST = 8
NC_UPDATE_REPLY = 9
| nc_read_request = 0
nc_read_reply = 1
nc_hot_read_request = 2
nc_write_request = 4
nc_write_reply = 5
nc_update_request = 8
nc_update_reply = 9 |
with open('input.txt') as f:
input = f.readline()
input = input.strip().split('-')
input_min = int(input[0])
input_max = int(input[1])
def pwd_to_digits(pwd):
digits = []
pwd_str = str(pwd)
while len(pwd_str) > 0:
digits.append(int(pwd_str[0]))
pwd_str = pwd_str[1:]
return digits
def pwd_is_valid(pwd):
digits = pwd_to_digits(pwd)
prev_digit = -1
has_double = False
has_decrease = False
for next_digit in digits:
if next_digit == prev_digit: has_double = True
if next_digit < prev_digit: has_decrease = True
prev_digit = next_digit
return has_double and not has_decrease
def new_pwd_is_valid(pwd):
digits = pwd_to_digits(pwd)
digits.append(-1)
prev_digit = -1
group_len = 1
saw_double = False
print("%d" % pwd)
for next_digit in digits:
if next_digit == prev_digit:
group_len += 1
else:
if group_len == 2: saw_double = True
group_len = 1
prev_digit = next_digit
print(" %d: %d" % (next_digit, group_len))
return saw_double
pwds = []
for i in range(input_min, input_max+1):
if pwd_is_valid(i): pwds.append(i)
print("count == %d" % len(pwds))
new_pwds = []
for pwd in pwds:
if new_pwd_is_valid(pwd): new_pwds.append(pwd)
print("new_count == %d" % len(new_pwds)) | with open('input.txt') as f:
input = f.readline()
input = input.strip().split('-')
input_min = int(input[0])
input_max = int(input[1])
def pwd_to_digits(pwd):
digits = []
pwd_str = str(pwd)
while len(pwd_str) > 0:
digits.append(int(pwd_str[0]))
pwd_str = pwd_str[1:]
return digits
def pwd_is_valid(pwd):
digits = pwd_to_digits(pwd)
prev_digit = -1
has_double = False
has_decrease = False
for next_digit in digits:
if next_digit == prev_digit:
has_double = True
if next_digit < prev_digit:
has_decrease = True
prev_digit = next_digit
return has_double and (not has_decrease)
def new_pwd_is_valid(pwd):
digits = pwd_to_digits(pwd)
digits.append(-1)
prev_digit = -1
group_len = 1
saw_double = False
print('%d' % pwd)
for next_digit in digits:
if next_digit == prev_digit:
group_len += 1
else:
if group_len == 2:
saw_double = True
group_len = 1
prev_digit = next_digit
print(' %d: %d' % (next_digit, group_len))
return saw_double
pwds = []
for i in range(input_min, input_max + 1):
if pwd_is_valid(i):
pwds.append(i)
print('count == %d' % len(pwds))
new_pwds = []
for pwd in pwds:
if new_pwd_is_valid(pwd):
new_pwds.append(pwd)
print('new_count == %d' % len(new_pwds)) |
class DrawflowNodeBase:
def __init__(self):
self.nodename = "basenode"
self.nodetitle = "Basenode"
self.nodeinputs = list()
self.nodeoutputs = list()
self.nodeicon = ""
self.nodehtml = "<b>DO NOT USE THE BASE NODE!!!</b>"
def name(self, name):
self.nodename = name
def title(self, title):
self.nodetitle = title
def input(self, varname, type):
self.nodeinputs.append((varname, type))
def output(self, varname, type):
self.nodeoutputs.append((varname, type))
def icon(self, html):
self.nodeicon = html
def html(self, html):
self.nodehtml = html
def getAsTuple(self):
return (self.nodetitle, len(self.nodeinputs), len(self.nodeoutputs), self.nodeicon, self.nodename, self.nodehtml)
| class Drawflownodebase:
def __init__(self):
self.nodename = 'basenode'
self.nodetitle = 'Basenode'
self.nodeinputs = list()
self.nodeoutputs = list()
self.nodeicon = ''
self.nodehtml = '<b>DO NOT USE THE BASE NODE!!!</b>'
def name(self, name):
self.nodename = name
def title(self, title):
self.nodetitle = title
def input(self, varname, type):
self.nodeinputs.append((varname, type))
def output(self, varname, type):
self.nodeoutputs.append((varname, type))
def icon(self, html):
self.nodeicon = html
def html(self, html):
self.nodehtml = html
def get_as_tuple(self):
return (self.nodetitle, len(self.nodeinputs), len(self.nodeoutputs), self.nodeicon, self.nodename, self.nodehtml) |
f = open("Files/Test.txt", mode="rt",encoding="utf-8")
g = open("Files/fil1.txt", mode="rt",encoding="utf-8")
h = open("Files/wasteland.txt", mode="rt",encoding="utf-8")
# return type of read() method is str
# To read specific number of character we have to pass the characters as arguments
# print(f.read(25))
# To read the whole file we have to keep the argument of read() method empty
print("Content in Test1.txt:\n",f.read())
print()
print("Content in fil1.txt:\n",g.read())
print()
print("Content in wasteland.txt:\n",h.read()) | f = open('Files/Test.txt', mode='rt', encoding='utf-8')
g = open('Files/fil1.txt', mode='rt', encoding='utf-8')
h = open('Files/wasteland.txt', mode='rt', encoding='utf-8')
print('Content in Test1.txt:\n', f.read())
print()
print('Content in fil1.txt:\n', g.read())
print()
print('Content in wasteland.txt:\n', h.read()) |
class Solution:
def decompressRLElist(self, nums: List[int]) -> List[int]:
ret = []
i = 0
while i < len(nums):
j = 0
while j < nums[i]:
ret.append(nums[i+1])
j += 1
i += 2
return ret
| class Solution:
def decompress_rl_elist(self, nums: List[int]) -> List[int]:
ret = []
i = 0
while i < len(nums):
j = 0
while j < nums[i]:
ret.append(nums[i + 1])
j += 1
i += 2
return ret |
# Given an array of numbers, find all the
# pairs of numbers which sum upto `k`
def find_pairs(num_array, k):
pairs_array = []
for num in num_array:
if (k - num) in num_array:
pairs_array.append((num, (k - num)))
return pairs_array
result = find_pairs([0, 14, 0, 4, 7, 8, 3, 5, 7], 11)
print(result)
| def find_pairs(num_array, k):
pairs_array = []
for num in num_array:
if k - num in num_array:
pairs_array.append((num, k - num))
return pairs_array
result = find_pairs([0, 14, 0, 4, 7, 8, 3, 5, 7], 11)
print(result) |
class Solution:
def champagneTower(self, poured: int, query_row: int, query_glass: int) -> float:
filled = [[0.0] * (query_row + 2) for _ in range (query_row+2)]
filled[0][0] = poured
for row in range(query_row + 1):
for col in range(query_row + 1):
if (filled[row][col] > 1.0):
overfill = filled[row][col] - 1.0
filled[row + 1][col] += overfill / 2.0
filled[row + 1][col +1] += overfill /2.0
# if needs to be here because we are not removing overfill from glasses that are overflowing, the maximum they can hold is 1
return filled[query_row][query_glass] if filled[query_row][query_glass] <= 1 else 1 | class Solution:
def champagne_tower(self, poured: int, query_row: int, query_glass: int) -> float:
filled = [[0.0] * (query_row + 2) for _ in range(query_row + 2)]
filled[0][0] = poured
for row in range(query_row + 1):
for col in range(query_row + 1):
if filled[row][col] > 1.0:
overfill = filled[row][col] - 1.0
filled[row + 1][col] += overfill / 2.0
filled[row + 1][col + 1] += overfill / 2.0
return filled[query_row][query_glass] if filled[query_row][query_glass] <= 1 else 1 |
class Headers:
X_VOL_TENANT = "x-vol-tenant";
X_VOL_SITE = "x-vol-site";
X_VOL_CATALOG = "x-vol-catalog";
X_VOL_MASTER_CATALOG = "x-vol-master-catalog";
X_VOL_SITE_DOMAIN = "x-vol-site-domain";
X_VOL_TENANT_DOMAIN = "x-vol-tenant-domain";
X_VOL_CORRELATION = "x-vol-correlation";
X_VOL_HMAC_SHA256 = "x-vol-hmac-sha256";
X_VOL_APP_CLAIMS = "x-vol-app-claims";
X_VOL_USER_CLAIMS = "x-vol-user-claims";
X_VOL_LOCALE = "x-vol-locale";
X_VOL_CURRENCY = "x-vol-currency";
X_VOL_VERSION = "x-vol-version";
X_VOL_DATAVIEW_MODE = "x-vol-dataview-mode";
DATE = "Date";
CONTENT_TYPE = "Content-type";
ETAG = "ETag"; | class Headers:
x_vol_tenant = 'x-vol-tenant'
x_vol_site = 'x-vol-site'
x_vol_catalog = 'x-vol-catalog'
x_vol_master_catalog = 'x-vol-master-catalog'
x_vol_site_domain = 'x-vol-site-domain'
x_vol_tenant_domain = 'x-vol-tenant-domain'
x_vol_correlation = 'x-vol-correlation'
x_vol_hmac_sha256 = 'x-vol-hmac-sha256'
x_vol_app_claims = 'x-vol-app-claims'
x_vol_user_claims = 'x-vol-user-claims'
x_vol_locale = 'x-vol-locale'
x_vol_currency = 'x-vol-currency'
x_vol_version = 'x-vol-version'
x_vol_dataview_mode = 'x-vol-dataview-mode'
date = 'Date'
content_type = 'Content-type'
etag = 'ETag' |
'''
Exercise 2:
Write a function save_list2file(sentences, filename) that takes two
parameters, where sentences is a list of string, and filename is a string representing the
name of the file where the content of sentences must be saved. Each element of the list
sentences should be written on its own line in the file filename.
'''
def save_list2file(sentences, filename):
with open(filename,'w') as x:
for y in sentences:
print(y, file=x)
save_list2file(['yikes','lolxd'],'ayy') | """
Exercise 2:
Write a function save_list2file(sentences, filename) that takes two
parameters, where sentences is a list of string, and filename is a string representing the
name of the file where the content of sentences must be saved. Each element of the list
sentences should be written on its own line in the file filename.
"""
def save_list2file(sentences, filename):
with open(filename, 'w') as x:
for y in sentences:
print(y, file=x)
save_list2file(['yikes', 'lolxd'], 'ayy') |
class Solution:
def uniquePathsWithObstacles(self, grid: List[List[int]]) -> int:
if grid[0][0] == 1: return 0
m = len(grid)
n = len(grid[0])
grid[0][0] = 1
for i in range(1, m):
if grid[i][0] == 0:
grid[i][0] = grid[i - 1][0]
else:
grid[i][0] = 0
for i in range(1, n):
if grid[0][i] == 0:
grid[0][i] = grid[0][i - 1]
else:
grid[0][i] = 0
for i in range(1, m):
for j in range(1, n):
if grid[i][j] == 0:
grid[i][j] = grid[i - 1][j] + grid[i][j - 1]
else:
grid[i][j] = 0
return grid[m - 1][n - 1]
| class Solution:
def unique_paths_with_obstacles(self, grid: List[List[int]]) -> int:
if grid[0][0] == 1:
return 0
m = len(grid)
n = len(grid[0])
grid[0][0] = 1
for i in range(1, m):
if grid[i][0] == 0:
grid[i][0] = grid[i - 1][0]
else:
grid[i][0] = 0
for i in range(1, n):
if grid[0][i] == 0:
grid[0][i] = grid[0][i - 1]
else:
grid[0][i] = 0
for i in range(1, m):
for j in range(1, n):
if grid[i][j] == 0:
grid[i][j] = grid[i - 1][j] + grid[i][j - 1]
else:
grid[i][j] = 0
return grid[m - 1][n - 1] |
def categorical_cross_entropy(y_pred, y):
x = np.multiply(y, np.log(y_pred))
loss = x.sum()
return loss
| def categorical_cross_entropy(y_pred, y):
x = np.multiply(y, np.log(y_pred))
loss = x.sum()
return loss |
largest = None
smallest = None
while True:
num = input("Enter a number: ")
if num == "done":
break
try:
inp=float(num)
except:
print("Invalid input")
if smallest is None:
smallest=inp
elif inp < smallest:
smallest=inp
elif inp>largest:
largest=inp
continue
print("Maximum", largest)
print("Minimum", smallest)
| largest = None
smallest = None
while True:
num = input('Enter a number: ')
if num == 'done':
break
try:
inp = float(num)
except:
print('Invalid input')
if smallest is None:
smallest = inp
elif inp < smallest:
smallest = inp
elif inp > largest:
largest = inp
continue
print('Maximum', largest)
print('Minimum', smallest) |
class Solution:
def numTilePossibilities(self, tiles: str) -> int:
def dfs(counterMap):
currentSum = 0
for char in counterMap:
if counterMap[char] > 0:
currentSum += 1
counterMap[char] -= 1
currentSum += dfs(counterMap)
counterMap[char] += 1
return currentSum
return dfs(Counter(tiles)) | class Solution:
def num_tile_possibilities(self, tiles: str) -> int:
def dfs(counterMap):
current_sum = 0
for char in counterMap:
if counterMap[char] > 0:
current_sum += 1
counterMap[char] -= 1
current_sum += dfs(counterMap)
counterMap[char] += 1
return currentSum
return dfs(counter(tiles)) |
user1 = {
"user": {
"username": "akram",
"email": "akram.mukasa@andela.com",
"password": "Akram@100555"
}
}
login1 = {"user": {"email": "akram.mukasa@andela.com", "password": "Akram@100555"}}
| user1 = {'user': {'username': 'akram', 'email': 'akram.mukasa@andela.com', 'password': 'Akram@100555'}}
login1 = {'user': {'email': 'akram.mukasa@andela.com', 'password': 'Akram@100555'}} |
class Image:
def __init__(self, name):
self.name = name
def register(self):
raise NotImplementedError
def getImg(self):
raise NotImplementedError
| class Image:
def __init__(self, name):
self.name = name
def register(self):
raise NotImplementedError
def get_img(self):
raise NotImplementedError |
expected_output = {
"five_sec_cpu_total": 13,
"five_min_cpu": 15,
"one_min_cpu": 23,
"five_sec_cpu_interrupts": 0,
}
| expected_output = {'five_sec_cpu_total': 13, 'five_min_cpu': 15, 'one_min_cpu': 23, 'five_sec_cpu_interrupts': 0} |
alg.aggregation (
[ "c_custkey", "c_name", "c_acctbal", "c_phone", "n_name", "c_address", "c_comment" ],
[ ( Reduction.SUM, "rev", "revenue" ) ],
alg.map (
"rev",
scal.MulExpr (
scal.AttrExpr ( "l_extendedprice" ),
scal.SubExpr (
scal.ConstExpr ( "1.0f", Type.FLOAT ),
scal.AttrExpr ( "l_discount" )
)
),
alg.join (
( "l_orderkey", "o_orderkey" ),
alg.join (
( "c_nationkey", "n_nationkey" ),
alg.scan ( "nation" ),
alg.join (
( "o_custkey", "c_custkey" ),
alg.selection (
scal.AndExpr (
scal.LargerEqualExpr (
scal.AttrExpr ( "o_orderdate" ),
scal.ConstExpr ( "19931001", Type.DATE )
),
scal.SmallerExpr (
scal.AttrExpr ( "o_orderdate" ),
scal.ConstExpr ( "19940101", Type.DATE )
)
),
alg.scan ( "orders" )
),
alg.scan ( "customer" )
)
),
alg.selection (
scal.EqualsExpr (
scal.AttrExpr ( "l_returnflag" ),
scal.ConstExpr ( "R", Type.CHAR )
),
alg.scan ( "lineitem" )
)
)
)
)
| alg.aggregation(['c_custkey', 'c_name', 'c_acctbal', 'c_phone', 'n_name', 'c_address', 'c_comment'], [(Reduction.SUM, 'rev', 'revenue')], alg.map('rev', scal.MulExpr(scal.AttrExpr('l_extendedprice'), scal.SubExpr(scal.ConstExpr('1.0f', Type.FLOAT), scal.AttrExpr('l_discount'))), alg.join(('l_orderkey', 'o_orderkey'), alg.join(('c_nationkey', 'n_nationkey'), alg.scan('nation'), alg.join(('o_custkey', 'c_custkey'), alg.selection(scal.AndExpr(scal.LargerEqualExpr(scal.AttrExpr('o_orderdate'), scal.ConstExpr('19931001', Type.DATE)), scal.SmallerExpr(scal.AttrExpr('o_orderdate'), scal.ConstExpr('19940101', Type.DATE))), alg.scan('orders')), alg.scan('customer'))), alg.selection(scal.EqualsExpr(scal.AttrExpr('l_returnflag'), scal.ConstExpr('R', Type.CHAR)), alg.scan('lineitem'))))) |
class TracardiException(Exception):
pass
class StorageException(TracardiException):
pass
class ExpiredException(TracardiException):
pass
class UnauthorizedException(TracardiException):
pass
| class Tracardiexception(Exception):
pass
class Storageexception(TracardiException):
pass
class Expiredexception(TracardiException):
pass
class Unauthorizedexception(TracardiException):
pass |
def precedence(op):
if op == '^':
return 3
if op == '+' or op == '-':
return 1
if op == '*' or op == '/':
return 2
return 0
def applyOp(a, b, op):
if op == '^': return a ** b
if op == '+': return a + b
if op == '-': return a - b
if op == '*': return a * b
if op == '/': return a // b
def evaluate(tokens, x_set):
values = [[] for _ in range(len(x_set))]
ops = []
i = 0
while i < len(tokens):
if tokens[i] == ' ':
i += 1
continue
elif tokens[i] == '(':
ops.append(tokens[i])
elif tokens[i] in 'xX' :
for index, x in enumerate(x_set):
values[index].append(x)
elif tokens[i].isdigit():
val = 0
while (i < len(tokens) and
tokens[i].isdigit()):
val = (val * 10) + int(tokens[i])
i += 1
i -= 1
for index, x in enumerate(x_set):
values[index].append(val)
elif tokens[i] == ')':
while len(ops) != 0 and ops[-1] != '(':
op = ops.pop()
for index, x in enumerate(values):
val2 = x.pop()
val1 = x.pop()
x.append(applyOp(val1, val2, op))
ops.pop()
else:
while (len(ops) != 0 and
precedence(ops[-1]) >= precedence(tokens[i])):
op = ops.pop()
for index, x in enumerate(values):
val2 = x.pop()
val1 = x.pop()
x.append(applyOp(val1, val2, op))
ops.append(tokens[i])
i += 1
while len(ops) != 0:
op = ops.pop()
for index, x in enumerate(values):
val2 = x.pop()
val1 = x.pop()
x.append(applyOp(val1, val2, op))
values = [value.pop() for value in values]
global one_one
if len(list(set(values))) != len(values):
one_one = False
return values
set1 =[int(x) for x in input('Enter comma separated domain: ').split(',')]
set2 =[int(x) for x in input('Enter comma separated codomain: ').split(',')]
expression = input('(+,-,*,/,^) Enter expression in terms of x: ')
one_one = True
try:
results = evaluate(expression, set1)
if set(results) == set(set2):
print('ONTO')
else:
print('NOT ONTO')
if one_one:
print('ONE-ONE')
else:
print('NOT ONE-ONE')
except:
print('Invalid expression') | def precedence(op):
if op == '^':
return 3
if op == '+' or op == '-':
return 1
if op == '*' or op == '/':
return 2
return 0
def apply_op(a, b, op):
if op == '^':
return a ** b
if op == '+':
return a + b
if op == '-':
return a - b
if op == '*':
return a * b
if op == '/':
return a // b
def evaluate(tokens, x_set):
values = [[] for _ in range(len(x_set))]
ops = []
i = 0
while i < len(tokens):
if tokens[i] == ' ':
i += 1
continue
elif tokens[i] == '(':
ops.append(tokens[i])
elif tokens[i] in 'xX':
for (index, x) in enumerate(x_set):
values[index].append(x)
elif tokens[i].isdigit():
val = 0
while i < len(tokens) and tokens[i].isdigit():
val = val * 10 + int(tokens[i])
i += 1
i -= 1
for (index, x) in enumerate(x_set):
values[index].append(val)
elif tokens[i] == ')':
while len(ops) != 0 and ops[-1] != '(':
op = ops.pop()
for (index, x) in enumerate(values):
val2 = x.pop()
val1 = x.pop()
x.append(apply_op(val1, val2, op))
ops.pop()
else:
while len(ops) != 0 and precedence(ops[-1]) >= precedence(tokens[i]):
op = ops.pop()
for (index, x) in enumerate(values):
val2 = x.pop()
val1 = x.pop()
x.append(apply_op(val1, val2, op))
ops.append(tokens[i])
i += 1
while len(ops) != 0:
op = ops.pop()
for (index, x) in enumerate(values):
val2 = x.pop()
val1 = x.pop()
x.append(apply_op(val1, val2, op))
values = [value.pop() for value in values]
global one_one
if len(list(set(values))) != len(values):
one_one = False
return values
set1 = [int(x) for x in input('Enter comma separated domain: ').split(',')]
set2 = [int(x) for x in input('Enter comma separated codomain: ').split(',')]
expression = input('(+,-,*,/,^) Enter expression in terms of x: ')
one_one = True
try:
results = evaluate(expression, set1)
if set(results) == set(set2):
print('ONTO')
else:
print('NOT ONTO')
if one_one:
print('ONE-ONE')
else:
print('NOT ONE-ONE')
except:
print('Invalid expression') |
class ControlSys():
def __init__(self, fig, imdis, vol_tran, vol_fron, vol_sagi, ax_tran, ax_fron, ax_sagi):
self.fig =fig
self.imdis = imdis
self.vol_tran = vol_tran
self.vol_fron = vol_fron
self.vol_sagi = vol_sagi
self.ax_tran = ax_tran
self.ax_fron = ax_fron
self.ax_sagi = ax_sagi
self.scroll_tran = None
self.scroll_fron = None
self.scroll_sagi = None
self.lx_tran = ax_tran.axhline(color='b', linewidth=0.8)
self.ly_tran = ax_tran.axvline(color='b', linewidth=0.8)
self.lx_fron = ax_fron.axhline(color='b', linewidth=0.8)
self.ly_fron = ax_fron.axvline(color='b', linewidth=0.8)
self.lx_sagi = ax_sagi.axhline(color='b', linewidth=0.8)
self.ly_sagi = ax_sagi.axvline(color='b', linewidth=0.8)
self.txt_tran = ax_tran.text(0, -10, '', color='b')
self.txt_fron = ax_fron.text(0, -10, '', color='b')
self.txt_sagi = ax_sagi.text(0, -10, '', color='b')
self.fig.canvas.mpl_connect('button_press_event', self.button_press_events)
def button_press_events(self, event):
if self.ax_tran.in_axes(event):
self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_tran))
self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.ydata)))
self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata)))
# self.scroll_tran = self.fig.canvas.mpl_connect('scroll_event', self.transverse_scroll)
# self.fig.canvas.mpl_disconnect(self.scroll_fron)
# self.fig.canvas.mpl_disconnect(self.scroll_sagi)
elif self.ax_fron.in_axes(event):
self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_fron))
self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata)))
self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata)))
# self.scroll_fron = self.fig.canvas.mpl_connect('scroll_event', self.frontal_scroll)
# self.fig.canvas.mpl_disconnect(self.scroll_tran)
# self.fig.canvas.mpl_disconnect(self.scroll_sagi)
elif self.ax_sagi.in_axes(event):
self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_sagi))
self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata)))
self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.xdata)))
# self.scroll_sagi = self.fig.canvas.mpl_connect('scroll_event', self.sagittal_scroll)
# self.fig.canvas.mpl_disconnect(self.scroll_tran)
# self.fig.canvas.mpl_disconnect(self.scroll_fron)
def transverse_view(self, index):
self.ax_tran.index = index
self.imdis.update_transverse_display(self.ax_tran.index)
self.fig.canvas.draw_idle()
def frontal_view(self, index):
self.ax_fron.index = index
self.imdis.update_frontal_display(self.ax_fron.index)
self.fig.canvas.draw_idle()
def sagittal_view(self, index):
self.ax_sagi.index = index
self.imdis.update_sagittal_display(self.ax_sagi.index)
self.fig.canvas.draw_idle()
def add_cursor(self, event, ax):
if ax is self.ax_tran:
x, y, z = event.xdata, event.ydata, self.ax_tran.index
coord_tran = [x, y, z]
coord_fron = [x, z, y]
coord_sagi = [y, z, x]
self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran)
self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron)
self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi)
if ax is self.ax_fron:
x, y, z = event.xdata, event.ydata, self.ax_fron.index
coord_fron = [x, y, z]
coord_tran = [x, z, y]
coord_sagi = [z, y, x]
self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran)
self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron)
self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi)
if ax is self.ax_sagi:
x, y, z = event.xdata, event.ydata, self.ax_sagi.index
coord_sagi = [x, y, z]
coord_tran = [z, x, y]
coord_fron = [z, y, x]
self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran)
self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron)
self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi)
def plot_cursor(self, coord, lx, ly, txt):
x, y, z = coord[0], coord[1], coord[2]
lx.set_ydata(y)
ly.set_xdata(x)
txt.set_text('x=%1d y=%1d z=%1d' % (x, y, z))
self.fig.canvas.draw_idle()
def transverse_scroll(self, event):
if event.button == 'down':
self.ax_tran.index -= 1
if event.button == 'up':
self.ax_tran.index += 1
self.imdis.update_transverse_display(self.ax_tran.index)
self.fig.canvas.draw_idle()
def frontal_scroll(self, event):
if event.button == 'down':
self.ax_fron.index -= 1
if event.button == 'up':
self.ax_fron.index += 1
self.imdis.update_frontal_display(self.ax_fron.index)
self.fig.canvas.draw_idle()
def sagittal_scroll(self, event):
if event.button == 'down':
self.ax_sagi.index -= 1
if event.button == 'up':
self.ax_sagi.index += 1
self.imdis.update_sagittal_display(self.ax_sagi.index)
self.fig.canvas.draw_idle()
| class Controlsys:
def __init__(self, fig, imdis, vol_tran, vol_fron, vol_sagi, ax_tran, ax_fron, ax_sagi):
self.fig = fig
self.imdis = imdis
self.vol_tran = vol_tran
self.vol_fron = vol_fron
self.vol_sagi = vol_sagi
self.ax_tran = ax_tran
self.ax_fron = ax_fron
self.ax_sagi = ax_sagi
self.scroll_tran = None
self.scroll_fron = None
self.scroll_sagi = None
self.lx_tran = ax_tran.axhline(color='b', linewidth=0.8)
self.ly_tran = ax_tran.axvline(color='b', linewidth=0.8)
self.lx_fron = ax_fron.axhline(color='b', linewidth=0.8)
self.ly_fron = ax_fron.axvline(color='b', linewidth=0.8)
self.lx_sagi = ax_sagi.axhline(color='b', linewidth=0.8)
self.ly_sagi = ax_sagi.axvline(color='b', linewidth=0.8)
self.txt_tran = ax_tran.text(0, -10, '', color='b')
self.txt_fron = ax_fron.text(0, -10, '', color='b')
self.txt_sagi = ax_sagi.text(0, -10, '', color='b')
self.fig.canvas.mpl_connect('button_press_event', self.button_press_events)
def button_press_events(self, event):
if self.ax_tran.in_axes(event):
self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_tran))
self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.ydata)))
self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata)))
elif self.ax_fron.in_axes(event):
self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_fron))
self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata)))
self.fig.canvas.mpl_connect('button_press_event', self.sagittal_view(int(event.xdata)))
elif self.ax_sagi.in_axes(event):
self.fig.canvas.mpl_connect('button_press_event', self.add_cursor(event, self.ax_sagi))
self.fig.canvas.mpl_connect('button_press_event', self.transverse_view(int(event.ydata)))
self.fig.canvas.mpl_connect('button_press_event', self.frontal_view(int(event.xdata)))
def transverse_view(self, index):
self.ax_tran.index = index
self.imdis.update_transverse_display(self.ax_tran.index)
self.fig.canvas.draw_idle()
def frontal_view(self, index):
self.ax_fron.index = index
self.imdis.update_frontal_display(self.ax_fron.index)
self.fig.canvas.draw_idle()
def sagittal_view(self, index):
self.ax_sagi.index = index
self.imdis.update_sagittal_display(self.ax_sagi.index)
self.fig.canvas.draw_idle()
def add_cursor(self, event, ax):
if ax is self.ax_tran:
(x, y, z) = (event.xdata, event.ydata, self.ax_tran.index)
coord_tran = [x, y, z]
coord_fron = [x, z, y]
coord_sagi = [y, z, x]
self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran)
self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron)
self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi)
if ax is self.ax_fron:
(x, y, z) = (event.xdata, event.ydata, self.ax_fron.index)
coord_fron = [x, y, z]
coord_tran = [x, z, y]
coord_sagi = [z, y, x]
self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran)
self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron)
self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi)
if ax is self.ax_sagi:
(x, y, z) = (event.xdata, event.ydata, self.ax_sagi.index)
coord_sagi = [x, y, z]
coord_tran = [z, x, y]
coord_fron = [z, y, x]
self.plot_cursor(coord_tran, self.lx_tran, self.ly_tran, self.txt_tran)
self.plot_cursor(coord_fron, self.lx_fron, self.ly_fron, self.txt_fron)
self.plot_cursor(coord_sagi, self.lx_sagi, self.ly_sagi, self.txt_sagi)
def plot_cursor(self, coord, lx, ly, txt):
(x, y, z) = (coord[0], coord[1], coord[2])
lx.set_ydata(y)
ly.set_xdata(x)
txt.set_text('x=%1d y=%1d z=%1d' % (x, y, z))
self.fig.canvas.draw_idle()
def transverse_scroll(self, event):
if event.button == 'down':
self.ax_tran.index -= 1
if event.button == 'up':
self.ax_tran.index += 1
self.imdis.update_transverse_display(self.ax_tran.index)
self.fig.canvas.draw_idle()
def frontal_scroll(self, event):
if event.button == 'down':
self.ax_fron.index -= 1
if event.button == 'up':
self.ax_fron.index += 1
self.imdis.update_frontal_display(self.ax_fron.index)
self.fig.canvas.draw_idle()
def sagittal_scroll(self, event):
if event.button == 'down':
self.ax_sagi.index -= 1
if event.button == 'up':
self.ax_sagi.index += 1
self.imdis.update_sagittal_display(self.ax_sagi.index)
self.fig.canvas.draw_idle() |
s = input()
words = ["dream", "dreamer", "erase", "eraser"]
words = sorted(words, reverse=True)
print()
for word in words:
if word in s:
s = s.replace(word, "")
if not s:
ans = "YES"
else:
ans = "NO"
print(ans)
| s = input()
words = ['dream', 'dreamer', 'erase', 'eraser']
words = sorted(words, reverse=True)
print()
for word in words:
if word in s:
s = s.replace(word, '')
if not s:
ans = 'YES'
else:
ans = 'NO'
print(ans) |
def read_safeguard_sql(cluster_descr, host_type):
for schemas_descr in cluster_descr.schemas_list:
if schemas_descr.schemas_type != host_type:
continue
safeguard_descr = schemas_descr.safeguard
if safeguard_descr is None:
continue
yield from safeguard_descr.read_sql()
# vi:ts=4:sw=4:et
| def read_safeguard_sql(cluster_descr, host_type):
for schemas_descr in cluster_descr.schemas_list:
if schemas_descr.schemas_type != host_type:
continue
safeguard_descr = schemas_descr.safeguard
if safeguard_descr is None:
continue
yield from safeguard_descr.read_sql() |
def name_printer(user_name):
print("Your name is", user_name)
name = input("Please enter your name: ")
name_printer(name)
| def name_printer(user_name):
print('Your name is', user_name)
name = input('Please enter your name: ')
name_printer(name) |
# <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_millilitres(value):
return value * 4546.091879
def to_litres(value):
return value * 4.546091879
def to_kilolitres(value):
return value * 0.0045460918799
def to_teaspoons(value):
return value * 768.0
def to_tablespoons(value):
return value * 256.0
def to_quarts(value):
return value * 4.0
def to_pints(value):
return value * 8.0
def to_fluid_ounces(value):
return value * 160.0
def to_u_s_teaspoons(value):
return value / 0.00108421072977394606
def to_u_s_tablespoons(value):
return value / 0.003252632189321838592
def to_u_s_quarts(value):
return value / 0.20816846011659767808
def to_u_s_pints(value):
return value / 0.10408423005829883904
def to_u_s_gallons(value):
return value / 0.83267384046639071232
def to_u_s_fluid_ounces(value):
return value / 0.006505264378643677184
def to_u_s_cups(value):
return value / 0.052042115029149417472
| def to_millilitres(value):
return value * 4546.091879
def to_litres(value):
return value * 4.546091879
def to_kilolitres(value):
return value * 0.0045460918799
def to_teaspoons(value):
return value * 768.0
def to_tablespoons(value):
return value * 256.0
def to_quarts(value):
return value * 4.0
def to_pints(value):
return value * 8.0
def to_fluid_ounces(value):
return value * 160.0
def to_u_s_teaspoons(value):
return value / 0.001084210729773946
def to_u_s_tablespoons(value):
return value / 0.0032526321893218387
def to_u_s_quarts(value):
return value / 0.20816846011659768
def to_u_s_pints(value):
return value / 0.10408423005829884
def to_u_s_gallons(value):
return value / 0.8326738404663907
def to_u_s_fluid_ounces(value):
return value / 0.006505264378643677
def to_u_s_cups(value):
return value / 0.05204211502914942 |
# -*- coding: utf-8 -*-
'''
Service support for Solaris 10 and 11, should work with other systems
that use SMF also. (e.g. SmartOS)
'''
__func_alias__ = {
'reload_': 'reload'
}
def __virtual__():
'''
Only work on systems which default to SMF
'''
# Don't let this work on Solaris 9 since SMF doesn't exist on it.
enable = set((
'Solaris',
'SmartOS',
))
if __grains__['os'] in enable:
if __grains__['os'] == 'Solaris' and __grains__['kernelrelease'] == "5.9":
return False
return 'service'
return False
def get_enabled():
'''
Return the enabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled
'''
ret = set()
cmd = 'svcs -H -o SVC,STATE -s SVC'
lines = __salt__['cmd.run'](cmd).splitlines()
for line in lines:
comps = line.split()
if not comps:
continue
if 'online' in line:
ret.add(comps[0])
return sorted(ret)
def get_disabled():
'''
Return the disabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled
'''
ret = set()
cmd = 'svcs -aH -o SVC,STATE -s SVC'
lines = __salt__['cmd.run'](cmd).splitlines()
for line in lines:
comps = line.split()
if not comps:
continue
if not 'online' in line and not 'legacy_run' in line:
ret.add(comps[0])
return sorted(ret)
def available(name):
'''
Return if the specified service is available
CLI Example:
.. code-block:: bash
salt '*' service.available
'''
return name in get_all()
def get_all():
'''
Return all installed services
CLI Example:
.. code-block:: bash
salt '*' service.get_all
'''
ret = set()
cmd = 'svcs -aH -o SVC,STATE -s SVC'
lines = __salt__['cmd.run'](cmd).splitlines()
for line in lines:
comps = line.split()
if not comps:
continue
ret.add(comps[0])
return sorted(ret)
def start(name):
'''
Start the specified service
CLI Example:
.. code-block:: bash
salt '*' service.start <service name>
'''
cmd = '/usr/sbin/svcadm enable -t {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def stop(name):
'''
Stop the specified service
CLI Example:
.. code-block:: bash
salt '*' service.stop <service name>
'''
cmd = '/usr/sbin/svcadm disable -t {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def restart(name):
'''
Restart the named service
CLI Example:
.. code-block:: bash
salt '*' service.restart <service name>
'''
cmd = '/usr/sbin/svcadm restart {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def reload_(name):
'''
Reload the named service
CLI Example:
.. code-block:: bash
salt '*' service.reload <service name>
'''
cmd = '/usr/sbin/svcadm refresh {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def status(name, sig=None):
'''
Return the status for a service, returns a bool whether the service is
running.
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
'''
cmd = '/usr/bin/svcs -H -o STATE {0}'.format(name)
line = __salt__['cmd.run'](cmd)
if line == 'online':
return True
else:
return False
def enable(name, **kwargs):
'''
Enable the named service to start at boot
CLI Example:
.. code-block:: bash
salt '*' service.enable <service name>
'''
cmd = '/usr/sbin/svcadm enable {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def disable(name, **kwargs):
'''
Disable the named service to start at boot
CLI Example:
.. code-block:: bash
salt '*' service.disable <service name>
'''
cmd = '/usr/sbin/svcadm disable {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def enabled(name):
'''
Check to see if the named service is enabled to start on boot
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
'''
return name in get_enabled()
def disabled(name):
'''
Check to see if the named service is disabled to start on boot
CLI Example:
.. code-block:: bash
salt '*' service.disabled <service name>
'''
return name in get_disabled()
| """
Service support for Solaris 10 and 11, should work with other systems
that use SMF also. (e.g. SmartOS)
"""
__func_alias__ = {'reload_': 'reload'}
def __virtual__():
"""
Only work on systems which default to SMF
"""
enable = set(('Solaris', 'SmartOS'))
if __grains__['os'] in enable:
if __grains__['os'] == 'Solaris' and __grains__['kernelrelease'] == '5.9':
return False
return 'service'
return False
def get_enabled():
"""
Return the enabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_enabled
"""
ret = set()
cmd = 'svcs -H -o SVC,STATE -s SVC'
lines = __salt__['cmd.run'](cmd).splitlines()
for line in lines:
comps = line.split()
if not comps:
continue
if 'online' in line:
ret.add(comps[0])
return sorted(ret)
def get_disabled():
"""
Return the disabled services
CLI Example:
.. code-block:: bash
salt '*' service.get_disabled
"""
ret = set()
cmd = 'svcs -aH -o SVC,STATE -s SVC'
lines = __salt__['cmd.run'](cmd).splitlines()
for line in lines:
comps = line.split()
if not comps:
continue
if not 'online' in line and (not 'legacy_run' in line):
ret.add(comps[0])
return sorted(ret)
def available(name):
"""
Return if the specified service is available
CLI Example:
.. code-block:: bash
salt '*' service.available
"""
return name in get_all()
def get_all():
"""
Return all installed services
CLI Example:
.. code-block:: bash
salt '*' service.get_all
"""
ret = set()
cmd = 'svcs -aH -o SVC,STATE -s SVC'
lines = __salt__['cmd.run'](cmd).splitlines()
for line in lines:
comps = line.split()
if not comps:
continue
ret.add(comps[0])
return sorted(ret)
def start(name):
"""
Start the specified service
CLI Example:
.. code-block:: bash
salt '*' service.start <service name>
"""
cmd = '/usr/sbin/svcadm enable -t {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def stop(name):
"""
Stop the specified service
CLI Example:
.. code-block:: bash
salt '*' service.stop <service name>
"""
cmd = '/usr/sbin/svcadm disable -t {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def restart(name):
"""
Restart the named service
CLI Example:
.. code-block:: bash
salt '*' service.restart <service name>
"""
cmd = '/usr/sbin/svcadm restart {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def reload_(name):
"""
Reload the named service
CLI Example:
.. code-block:: bash
salt '*' service.reload <service name>
"""
cmd = '/usr/sbin/svcadm refresh {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def status(name, sig=None):
"""
Return the status for a service, returns a bool whether the service is
running.
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
"""
cmd = '/usr/bin/svcs -H -o STATE {0}'.format(name)
line = __salt__['cmd.run'](cmd)
if line == 'online':
return True
else:
return False
def enable(name, **kwargs):
"""
Enable the named service to start at boot
CLI Example:
.. code-block:: bash
salt '*' service.enable <service name>
"""
cmd = '/usr/sbin/svcadm enable {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def disable(name, **kwargs):
"""
Disable the named service to start at boot
CLI Example:
.. code-block:: bash
salt '*' service.disable <service name>
"""
cmd = '/usr/sbin/svcadm disable {0}'.format(name)
return not __salt__['cmd.retcode'](cmd)
def enabled(name):
"""
Check to see if the named service is enabled to start on boot
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
"""
return name in get_enabled()
def disabled(name):
"""
Check to see if the named service is disabled to start on boot
CLI Example:
.. code-block:: bash
salt '*' service.disabled <service name>
"""
return name in get_disabled() |
n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
inx = a.intersection(b)
unx = a.union(b)
x = unx.difference(inx)
for i in sorted(x):
print(i)
| n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
inx = a.intersection(b)
unx = a.union(b)
x = unx.difference(inx)
for i in sorted(x):
print(i) |
class Simulation:
def __init__(self, x, v, box, potentials, integrator):
self.x = x
self.v = v
self.box = box
self.potentials = potentials
self.integrator = integrator
| class Simulation:
def __init__(self, x, v, box, potentials, integrator):
self.x = x
self.v = v
self.box = box
self.potentials = potentials
self.integrator = integrator |
# Hola 3 -> HolaHolaHola
def repeticiones(n):#Funcion envolvente
def repetidor(string):#funcion anidada
assert type(string) == str, "Solo se pueden utilizar strings" #afirmamos que el valor ingresado es un entero, de lo contrario envia el mensaje de error
return(string*n)# llama a scope superior
return repetidor #regresa la funcion anidada
def run():
repetir5 = repeticiones(5)
print(repetir5("Hola"))
repetir10 = repeticiones(10)
print(repetir5("Chris"))
if __name__ == '__main__':
run() | def repeticiones(n):
def repetidor(string):
assert type(string) == str, 'Solo se pueden utilizar strings'
return string * n
return repetidor
def run():
repetir5 = repeticiones(5)
print(repetir5('Hola'))
repetir10 = repeticiones(10)
print(repetir5('Chris'))
if __name__ == '__main__':
run() |
DATASET = "forest-2"
CLASSES = 2
FEATURES = 54
NN_SIZE = 256
DIFFICULTY = 10000
| dataset = 'forest-2'
classes = 2
features = 54
nn_size = 256
difficulty = 10000 |
class ImportError(Exception):
pass
class CatalogueImportError(Exception):
pass
| class Importerror(Exception):
pass
class Catalogueimporterror(Exception):
pass |
class Solution:
def numberToWords(self, num: int) -> str:
LESS_THAN_20 = ["", "One", "Two", "Three", "Four", "Five", "Six",
"Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve",
"Thirteen", "Fourteen", "Fifteen", "Sixteen",
"Seventeen", "Eighteen", "Nineteen"]
TENS = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty",
"Seventy", "Eighty", "Ninety"]
THOUSANDS = ["", "Thousand", "Million", "Billion"]
def helper(num):
if num == 0:
return ''
elif num < 20:
return LESS_THAN_20[num] + ' '
elif num < 100:
return TENS[num // 10] + ' ' + helper(num % 10)
return LESS_THAN_20[num // 100] + ' Hundred ' + helper(num % 100)
if num == 0:
return 'Zero'
res = ''
i = 0
while num:
if num % 1000:
res = helper(num % 1000) + THOUSANDS[i] + ' ' + res
i += 1
num //= 1000
return res.strip()
| class Solution:
def number_to_words(self, num: int) -> str:
less_than_20 = ['', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen']
tens = ['', 'Ten', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety']
thousands = ['', 'Thousand', 'Million', 'Billion']
def helper(num):
if num == 0:
return ''
elif num < 20:
return LESS_THAN_20[num] + ' '
elif num < 100:
return TENS[num // 10] + ' ' + helper(num % 10)
return LESS_THAN_20[num // 100] + ' Hundred ' + helper(num % 100)
if num == 0:
return 'Zero'
res = ''
i = 0
while num:
if num % 1000:
res = helper(num % 1000) + THOUSANDS[i] + ' ' + res
i += 1
num //= 1000
return res.strip() |
a = int(input())
b = int(input())
if(a > b):
print(True)
else:
print(False)
| a = int(input())
b = int(input())
if a > b:
print(True)
else:
print(False) |
class X: pass
class Y: pass
class Z: pass
class A(X, Y): pass
class B(Y, Z): pass
class M(B, A, Z): pass
# Output:
# [<class '__main__.M'>, <class '__main__.B'>,
# <class '__main__.A'>, <class '__main__.X'>,
# <class '__main__.Y'>, <class '__main__.Z'>,
# <class 'object'>]
print(M.mro()) | class X:
pass
class Y:
pass
class Z:
pass
class A(X, Y):
pass
class B(Y, Z):
pass
class M(B, A, Z):
pass
print(M.mro()) |
#Its a simple Rock paper scissor game
print('...Rock...')
print('...Paper...')
print('...Scissor...')
x = input('Enter Player 1 Choice ')
print('No Cheating\n\n' * 20)
y = input('Enter Play 2 Choice ')
if x == 'paper' and y == 'rock':
print('Player 1 won')
elif x == 'rock' and y == 'paper':
print('Player 2 wins')
elif x == 'scissor' and y == 'paper':
print('Player 1 wins')
elif x == 'paper' and y == 'scissor':
print('Player 2 wins ')
elif x == 'rock' and y == 'scissor':
print('Player 1 wins')
elif x == 'scissor' and y == 'rock':
print('Player 2 wins ')
else:
print('Something else went wrong') | print('...Rock...')
print('...Paper...')
print('...Scissor...')
x = input('Enter Player 1 Choice ')
print('No Cheating\n\n' * 20)
y = input('Enter Play 2 Choice ')
if x == 'paper' and y == 'rock':
print('Player 1 won')
elif x == 'rock' and y == 'paper':
print('Player 2 wins')
elif x == 'scissor' and y == 'paper':
print('Player 1 wins')
elif x == 'paper' and y == 'scissor':
print('Player 2 wins ')
elif x == 'rock' and y == 'scissor':
print('Player 1 wins')
elif x == 'scissor' and y == 'rock':
print('Player 2 wins ')
else:
print('Something else went wrong') |
# Program 70 : Function to print binary number using recursion
def convertToBinary(n):
if n > 1:
convertToBinary(n//2)
print(n % 2,end = '')
# decimal number
dec = int(input("Enter Decimal Number : "))
convertToBinary(dec)
print()
| def convert_to_binary(n):
if n > 1:
convert_to_binary(n // 2)
print(n % 2, end='')
dec = int(input('Enter Decimal Number : '))
convert_to_binary(dec)
print() |
buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb')
for item in buffet:
print(item, end=" ")
print()
buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb')
for item in buffet:
print(item, end=" ")
| buffet = ('beef', 'chicken', 'fish', 'pork', 'lamb')
for item in buffet:
print(item, end=' ')
print()
buffet = ('wagyu', 'chicken', 'fish', 'squid', 'lamb')
for item in buffet:
print(item, end=' ') |
'''
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].
Example 2:
Input: nums = [3,2,4], target = 6
Output: [1,2]
Example 3:
Input: nums = [3,3], target = 6
Output: [0,1]
Constraints:
2 <= nums.length <= 104
-109 <= nums[i] <= 109
-109 <= target <= 109
Only one valid answer exists.
'''
class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
for num in nums:
if (target - num) in nums:
return [nums.index(num), nums.index(target - num)]
else:
continue
| """
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Example 1:
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].
Example 2:
Input: nums = [3,2,4], target = 6
Output: [1,2]
Example 3:
Input: nums = [3,3], target = 6
Output: [0,1]
Constraints:
2 <= nums.length <= 104
-109 <= nums[i] <= 109
-109 <= target <= 109
Only one valid answer exists.
"""
class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
for num in nums:
if target - num in nums:
return [nums.index(num), nums.index(target - num)]
else:
continue |
SQLALCHEMY_DATABASE_URI = \
'postgres+psycopg2://postgres:postgres@172.16.100.140/tdt2018'
# 'postgres+psycopg2://postgres:postgres@localhost/tdt2018'
SECRET_KEY = '\x88D\xf09\x91\x07\x98\x89\x87\x96\xa0A\xc68\xf9\xecJ:U\x17\xc5V\xbe\x8b\xef\xd7\xd8\xd3\xe6\x98*4'
| sqlalchemy_database_uri = 'postgres+psycopg2://postgres:postgres@172.16.100.140/tdt2018'
secret_key = '\x88Dð9\x91\x07\x98\x89\x87\x96\xa0AÆ8ùìJ:U\x17ÅV¾\x8bïרӿ\x98*4' |
word_to_find = "box"
def get_puzzle():
o = []
with open("puzzle.txt","r") as file:
x = file.readlines()
for i in x:
o.append(i.split(",")[:-1])
return o
def chunks(lst, n):
f = []
for i in range(0, len(lst), n):
f.append(lst[i:i + n])
return f
def find_letters_in_list(lst,word):
c_in = 0
Out_ = []
for e,i in enumerate(lst):
try:
if i == word[c_in]:
c_in += 1
Out_.append(e)
else:
pass
except IndexError:
pass
return(Out_)
def transpose(l1, l2):
for i in range(len(l1[0])):
row =[]
for item in l1:
row.append(item[i])
l2.append(row)
return l2
def solve():
Rows = []
C = []
Column = []
alr_found = 0
puzzle = get_puzzle()
for rows in puzzle:
for letters in rows:
Rows.append(letters)
for X in range(len(puzzle)-1):
C.append(str([i[X] for i in puzzle]))
for i in C:
b_c = i.replace("[","").replace("]","").replace("'","").replace(" ","")
for i in b_c:
if i == ",":
pass
else:
Column.append(i)
rev_rows = Rows[::-1]
rev_columns = Column[::-1]
#solving it
col = 0
Chunk_column = chunks(Column,len(word_to_find)+len(word_to_find))
Out = Chunk_column
Chunk_column_rev = chunks(Column,len(word_to_find)+len(word_to_find))[::-1]
Out2 = Chunk_column_rev
if word_to_find in "".join(Column).lower():
for i in Chunk_column:
if word_to_find in "".join(i).lower():
l_index = find_letters_in_list(Chunk_column[col],word_to_find.upper())
for o in l_index:
Out[col][o] = "("+str(Out[col][o])+")"
else:
col += 1
elif word_to_find in "".join(rev_columns).lower():
for i in Chunk_column_rev:
if word_to_find[::-1] in "".join(i).lower():
l_index = find_letters_in_list(Chunk_column[col][::-1],word_to_find.upper())
for o in l_index:
Out[col][o+1] = "("+str(Out[col][o+1])+")"
else:
col += 1
#give output
x = []
transpose(Out,x)
return x
def user_friendly_data():
print("output from algorithm:")
for i in solve():
print(" ".join(i))
user_friendly_data() | word_to_find = 'box'
def get_puzzle():
o = []
with open('puzzle.txt', 'r') as file:
x = file.readlines()
for i in x:
o.append(i.split(',')[:-1])
return o
def chunks(lst, n):
f = []
for i in range(0, len(lst), n):
f.append(lst[i:i + n])
return f
def find_letters_in_list(lst, word):
c_in = 0
out_ = []
for (e, i) in enumerate(lst):
try:
if i == word[c_in]:
c_in += 1
Out_.append(e)
else:
pass
except IndexError:
pass
return Out_
def transpose(l1, l2):
for i in range(len(l1[0])):
row = []
for item in l1:
row.append(item[i])
l2.append(row)
return l2
def solve():
rows = []
c = []
column = []
alr_found = 0
puzzle = get_puzzle()
for rows in puzzle:
for letters in rows:
Rows.append(letters)
for x in range(len(puzzle) - 1):
C.append(str([i[X] for i in puzzle]))
for i in C:
b_c = i.replace('[', '').replace(']', '').replace("'", '').replace(' ', '')
for i in b_c:
if i == ',':
pass
else:
Column.append(i)
rev_rows = Rows[::-1]
rev_columns = Column[::-1]
col = 0
chunk_column = chunks(Column, len(word_to_find) + len(word_to_find))
out = Chunk_column
chunk_column_rev = chunks(Column, len(word_to_find) + len(word_to_find))[::-1]
out2 = Chunk_column_rev
if word_to_find in ''.join(Column).lower():
for i in Chunk_column:
if word_to_find in ''.join(i).lower():
l_index = find_letters_in_list(Chunk_column[col], word_to_find.upper())
for o in l_index:
Out[col][o] = '(' + str(Out[col][o]) + ')'
else:
col += 1
elif word_to_find in ''.join(rev_columns).lower():
for i in Chunk_column_rev:
if word_to_find[::-1] in ''.join(i).lower():
l_index = find_letters_in_list(Chunk_column[col][::-1], word_to_find.upper())
for o in l_index:
Out[col][o + 1] = '(' + str(Out[col][o + 1]) + ')'
else:
col += 1
x = []
transpose(Out, x)
return x
def user_friendly_data():
print('output from algorithm:')
for i in solve():
print(' '.join(i))
user_friendly_data() |
dataset_paths = {
# Face Datasets (In the paper: FFHQ - train, CelebAHQ - test)
'ffhq': '',
'celeba_test': '',
# Cars Dataset (In the paper: Stanford cars)
'cars_train': '',
'cars_test': '',
# Horse Dataset (In the paper: LSUN Horse)
'horse_train': '',
'horse_test': '',
# Church Dataset (In the paper: LSUN Church)
'church_train': '',
'church_test': '',
# Cats Dataset (In the paper: LSUN Cat)
'cats_train': '',
'cats_test': ''
}
model_paths = {
'stylegan_ffhq': 'pretrained_models/stylegan2-ffhq-config-f.pt',
'ir_se50': 'pretrained_models/model_ir_se50.pth',
'shape_predictor': 'pretrained_models/shape_predictor_68_face_landmarks.dat',
'moco': 'pretrained_models/moco_v2_800ep_pretrain.pth'
}
| dataset_paths = {'ffhq': '', 'celeba_test': '', 'cars_train': '', 'cars_test': '', 'horse_train': '', 'horse_test': '', 'church_train': '', 'church_test': '', 'cats_train': '', 'cats_test': ''}
model_paths = {'stylegan_ffhq': 'pretrained_models/stylegan2-ffhq-config-f.pt', 'ir_se50': 'pretrained_models/model_ir_se50.pth', 'shape_predictor': 'pretrained_models/shape_predictor_68_face_landmarks.dat', 'moco': 'pretrained_models/moco_v2_800ep_pretrain.pth'} |
class Stop():
def __init__(self, name):
self.name = name
self.schedule = {}
self.previous_stop = dict()
self.next_stop = dict()
self.neighbords = [self.previous_stop, self.next_stop]
self.left_stop = None
self.right_stop = None
def set_schedule(self, line, schedule):
self.schedule[line] = schedule
def set_next_stop(self, line, next_stop):
self.next_stop[line] = next_stop
def set_previous_stop(self, line, previous_stop):
self.previous_stop[line] = previous_stop
def set_left_stop(self, left_stop):
self.left_stop = left_stop
def set_right_stop(self, right_stop):
self.right_stop = right_stop
| class Stop:
def __init__(self, name):
self.name = name
self.schedule = {}
self.previous_stop = dict()
self.next_stop = dict()
self.neighbords = [self.previous_stop, self.next_stop]
self.left_stop = None
self.right_stop = None
def set_schedule(self, line, schedule):
self.schedule[line] = schedule
def set_next_stop(self, line, next_stop):
self.next_stop[line] = next_stop
def set_previous_stop(self, line, previous_stop):
self.previous_stop[line] = previous_stop
def set_left_stop(self, left_stop):
self.left_stop = left_stop
def set_right_stop(self, right_stop):
self.right_stop = right_stop |
def sum_of_two_numbers(number_1, number_2):
return number_1 + number_2
#print(sum(5,6))
if __name__ == '____':
a, b= map(int, input().split())
print(sum(a, b))
| def sum_of_two_numbers(number_1, number_2):
return number_1 + number_2
if __name__ == '____':
(a, b) = map(int, input().split())
print(sum(a, b)) |
#from DebugLogger00110 import DebugLogger00100
#import fbxsdk as fbx
#from fbxsdk import *
#import fbx as fbxsdk
#from fbx import *
# -*- coding: utf-8 -*-
#from fbx import *
#import DebugLogger00100
#import DebugLogger00100
#import WriteReadTrans_Z_00310
#import GetKeyCurve00110
#===================class Node=========================
#import FbxCommon
#===================class Node=========================
print("fbx_____.py") | print('fbx_____.py') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.