content stringlengths 7 1.05M |
|---|
preço = float(input('Qual é o preço do produto? R$'))
novo = preço - (preço * 5 / 100)
print('O produto que custava R${:.2f} agora na promoção com desconto de 5% irá custar R${:.2f}'.format(preço,novo))
|
# 🚨 Don't change the code below 👇
year = int(input("Which year do you want to check? "))
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
leapyear = True
else:
leapyear = False
else:
leapyear = False
leapyear = True
else:
leapyear = False
if leapyear == True:
print("Leap year.")
else:
print("Not leap year.")
|
def decorator_maker():
print("Я создаю декораторы! Я буду вызван только раз: когда ты попросишь "
"меня создать декоратор.")
def my_decorator(func):
print("Я - декоратор! Я буду вызван только раз: в момент декорирования функции.")
def wrapped():
print ("Я - обёртка вокруг декорируемой функции. Я буду вызвана")
return func()
print("Я возвращаю обёрнутую функцию.")
return wrapped
print("Я возвращаю декоратор.")
return my_decorator |
# Extra Exercise 005
"""Make a program that calculates the area of a square, then show double this area to the user."""
square_base = float(input("Insert the base value: "))
square_height = float(input("Insert the height value: "))
square_area = square_base * square_height
print(
f"The square area is {square_area} area units, and its double is {square_area * 2} area units"
)
|
# The following method includes .format() methd to write in a csv file. Otherwise .join() method can be used on ',' when all the elements are string
# and there is no extra comma in between a chunk of string. Follow the code below:
olympians = [("John Aalberg", 31, "Cross Country Skiing"),
("Minna Maarit Aalto", 30, "Sailing"),
("Win Valdemar Aaltonen", 54, "Art Competitions"),
("Wakako Abe", 18, "Cycling")]
outfile = open("reduced_olympics.csv", "w")
# output the header row
outfile.write('Name,Age,Sport')
outfile.write('\n')
# output each of the rows:
for olympian in olympians:
row_string = '{},{},{}'.format(olympian[0], olympian[1], olympian[2])
### .join() method:
# row_string = ','.join(olympian[0], str(olympian[1]), olympian[2])
### concatenation method:
#row_string = olympian[0] + ',' + olympian[1] + ',' + olympian[2]
outfile.write(row_string)
outfile.write('\n')
outfile.close()
### OUTPUT ###
# Name,Age,Sport
# John Aalberg,31,Cross Country Skiing
# Minna Maarit Aalto,30,Sailing
# Win Valdemar Aaltonen,54,Art Competitions
# Wakako Abe,18,Cycling
####################_______________________________##########################
# Now, if there remains any other delimiter in any of the elements of olympians list, then we need to consider each element independently within
# whole block of outfile and row_string. That can be accomplished by this format '" ", " ", " "'. See the following block of code and the OUTPUT for
# clarification.
olympians = [("John Aalberg", 31, "Cross Country Skiing, 15KM"),
("Minna Maarit Aalto", 30, "Sailing"),
("Win Valdemar Aaltonen", 54, "Art Competitions"),
("Wakako Abe", 18, "Cycling")]
outfile = open("reduced_olympics2.csv", "w")
# output the header row
outfile.write('"Name","Age","Sport"')
outfile.write('\n')
# output each of the rows:
for olympian in olympians:
row_string = '"{}", "{}", "{}"'.format(olympian[0], olympian[1], olympian[2])
outfile.write(row_string)
outfile.write('\n')
outfile.close()
### OUTPUT ###
# "Name","Age","Sport"
# "John Aalberg", "31", "Cross Country Skiing, 15KM"
# "Minna Maarit Aalto", "30", "Sailing"
# "Win Valdemar Aaltonen", "54", "Art Competitions"
# "Wakako Abe", "18", "Cycling"
|
#2) Refaça o exercício da questão anterior, imprimindo os retângulos sem preenchimento,
#de forma que os caracteres que não estiverem na borda do retângulo sejam espaços.
largura = int(input("Coloque a largura: "))
print("")
altura = int(input("Coloque a altura: "))
print("")
caractere = "#"
def retângulo(largura, altura, caractere):
linhacompleta = caractere * largura
if largura > 2:
linhavazia = caractere + (" " * (largura - 2)) + caractere
else:
linhavazia = linhacompleta
if altura >= 1:
print(linhacompleta)
for i in range(altura - 2):
print(linhavazia)
if altura >= 2:
print(linhacompleta)
retângulo(largura, altura, caractere) |
# Copyright 2016 - Wipro Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" List of SQL queries"""
INSERT_INTO_DASHBOARD = \
"INSERT INTO DASHBOARD VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
IS_DASHBOARD_PRESENT = \
"SELECT ID FROM dashboards WHERE NAME LIKE %s"
INSERT_INTO_DASHBOARDS = \
"INSERT INTO dashboards VALUES (%s,%s,%s,%s,%s,%s,%s,%s)"
GET_OPENSTACK_TOKEN = \
"SELECT TOKEN FROM OPENSTACK_TOKEN WHERE ID='one'"
UPDATE_TOKEN = \
"UPDATE OPENSTACK_TOKEN SET TOKEN = %s WHERE ID='one'"
GET_METRICS = \
"SELECT METRICS_NAME, METRICS_HELP FROM METRICS WHERE METRICS_UNIT_SUBTYPE LIKE %s"
INSERT_INTO_EXPORTER = "INSERT INTO MEXPORTER VALUES (%s, %s)"
UPDATE_DASHBOARD = \
"UPDATE DASHBOARD SET NAMES_LIST=%s, METRICS_LIST=%s, SEARCH_STRING=%s, SEARCH_TYPE=%s, DATE_UPDATED=%s WHERE NAME=%s"
DELETE_DASHBOARD = \
"DELETE FROM DASHBOARD WHERE NAME=%s"
DELETE_FROM_DASHBOARDS= \
"DELETE FROM dashboards WHERE NAME=%s"
LIST_DASHBOARD =\
"SELECT NAME, NAMES_LIST, SEARCH_TYPE, SEARCH_STRING, METRICS_LIST , DASHBOARD_URL, EXCLUDE FROM DASHBOARD"
LIST_EXPORTER=\
"SELECT EXPORTER_NAME, EXPORTER_ID FROM MEXPORTER"
INSERT_INTO_METRICS = "INSERT INTO METRICS VALUES (%s, %s, %s, %s, %s)"
|
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TODO: Helper functions for Trex traffic generators.
"""
def th_hello():
print("Hello from Trex helpers.")
|
tables = [
"title.principals.csv",
"title.akas.csv",
"title.ratings.csv",
"title.basics.csv",
"name.basics.csv"
]
data_cardinality = {
"3GB":{
"title.principals": 36499704,
"title.akas": 19344171,
"title.ratings": 993821,
"title.basics": 6326545,
"name.basics": 9711022
}
}
database_meta = {
"title.principals": {
"schema": "(String, Int, String, String, String, String)",
"fields": ['titleId', 'ordering', 'nconst', 'category', 'job', 'characters'],
"date_fields": [],
"filter_fields": ["category"],
"join_fields": {
"titleId": {
"title.akas": "titleId",
"title.ratings": "titleId",
"title.basics": "titleId",
},
"nconst": {
"name.basics":"nconst"
}
},
"groupby_fields": ["category", "nconst", "titleId"]
},
"title.akas": {
"schema": "(String, Int, String, String, String, String, String, String)",
"fields": ['titleId', 'ordering', 'title', 'region', 'language', 'types', 'attributes', 'isOriginalTitle'],
"date_fields": [],
"filter_fields": ["region", "types", "isOriginalTitle"],
"join_fields": {
"titleId": {
"title.principals": "titleId",
"title.ratings": "titleId",
"title.basics": "titleId",
}
},
"groupby_fields": ["region",
"types",
"isOriginalTitle"
]
},
"title.ratings": {
"schema": "(String, Float, Int)",
"fields": ['titleId', 'averageRating', 'numVotes'],
"date_fields": [],
"filter_fields": ["averageRating", "numVotes"],
"join_fields": {
"titleId": {
"title.principals": "titleId",
"title.akas": "titleId",
"title.basics": "titleId",
}
},
"groupby_fields": []
},
"title.basics": {
"schema": "(String, String, String, String, Int, Int, Int, Int, String)",
"fields": ['titleId', 'titleType', 'primaryTitle', 'originalTitle', 'isAdult',
'startYear', 'endYear', 'runtimeMinutes', 'genres'],
"date_fields": [],
"filter_fields": ["titleType", "isAdult", "startYear"],
"join_fields": {
"titleId": {
"title.principals": "titleId",
"title.akas": "titleId",
"title.ratings": "titleId"
}
},
"groupby_fields": ["isAdult", "titleType"]
},
"name.basics": {
"schema": "(String, String, Int, Int, String, String)",
"fields": ['nconst', 'primaryName', 'birthYear', 'deathYear', 'primaryProfession', 'knownForTitles'],
"date_fields": [],
"filter_fields": ["birthYear", "deathYear", "primaryProfession"],
"join_fields": {
"nconst": {
"title.principals": "nconst"
}
},
"groupby_fields": ["primaryProfession"]
}
}
|
list1 = []
input_str1 = input("Please input a word: ")
str1 = input_str1.lower()
list1 = list(str1)
for item in list1:
if item == 'a' or item == 'e' or item == 'i' or item == 'o' or item == 'u':
while True:
try:
list1.remove(item)
except:
break
output = ''.join(list1).capitalize()
print(output) |
def reverse_words(s):
return ' '.join(s.split(' ')[::-1])
# Best Practices
def reverseWords(str):
return " ".join(str.split(" ")[::-1]) |
def get_setup_cfg_file(params):
"""Get a ``setup.cfg`` file.
Args:
params (dict): Parameters for this project.
Returns:
tuple: Relative file path and string content of file.
"""
bdist_wheel_universal = int(params.get("bdist_wheel_universal", 1))
return "setup.cfg", _SETUP_CFG.format(bdist_wheel_universal)
_SETUP_CFG = """[bdist_wheel]
universal={0}
[aliases]
test=pytest
"""
def get_setup_py(params):
"""Get the ``setup.py`` file
Args:
params (dict): Parameters for this project.
Returns:
tuple: Relative file path and string content of file.
"""
one_file_package = params.get('one_file_package', False)
if one_file_package:
return 'setup.py', _SETUP_PY_ONE_FILE.format(**params)
else:
return 'setup.py', _SETUP_PY_ONE_FILE.format(**params)
_SETUP_PY_ONE_FILE = """#!/usr/bin/env python
# -*- coding: utf-8 -*-
\"\"\"
Setup file for {project}
=============================
Created: {now}
\"\"\"
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import re
from codecs import open
from setuptools import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
sys.exit()
with open('{project}.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
def read(f):
return open(f, encoding='utf-8').read()
setup(
name='{project}',
version=version,
author='{fullname}',
author_email='{email}',
description='',
long_description=read('README.rst'),
license={license},
url='https://{git_host}/{username}/{project}',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
],
keywords=[],
py_modules=['{project}'],
test_suite="tests",
zip_safe=False,
include_package_data=True,
install_requires=read('requirements.txt').strip().splitlines(),
setup_requires=['pytest-runner', ],
tests_require=['pytest', ],
package_data={},
dependency_links=[],
ext_modules=[],
entry_points={},
)
"""
_SETUP_PY = """#!/usr/bin/env python
# -*- coding: utf-8 -*-
\"\"\"
Setup file for {project}
=============================
Created: {now}
\"\"\"
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import re
from codecs import open
from setuptools import setup, find_packages
with open('{0}/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
def read(f):
return open(f, encoding='utf-8').read()
setup(
name='{project}',
version=version,
author='{fullname}',
author_email='{email}',
description='',
long_description=read('README.rst'),
license={license},
url='https://{git_host}/{username}/{project}',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
],
keywords=[],
packages=find_packages(exclude=['tests', 'docs', 'examples']),
include_package_data=True,
install_requires=read('requirements.txt').strip().splitlines(),
setup_requires=['pytest-runner', ],
tests_require=['pytest', ],
package_data={},
dependency_links=[],
ext_modules=[],
entry_points={},
)
"""
|
# encoding: utf-8
START_SERVERS = u'Start DNS Server'
STOP_SERVERS = u'Stop DNS Server'
|
# Problem 7 100001st Prime
primes = []
number = 1000000
for x in range(2, number+1):
isPrime = True
for y in range(2, int(x**0.5)+1):
if x%y ==0:
isPrime = False
break
if isPrime:
primes.append(x)
if len(primes) == 10001:
print(primes[-1])
break
|
# Annette Chun
# amc4sq
# 02/22/16
# helper.py
__author__ = 'Annette Chun'
def greeting(msg):
print(msg)
|
# -*- coding: utf-8 -*-
# Jamdict-web - Japanese Reading Assistant
# This code is a part of jamdict-web library: https://github.com/neocl/jamdict-web
# :copyright: (c) 2021 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.
__author__ = "Le Tuan Anh"
__email__ = "tuananh.ke@gmail.com"
__copyright__ = "Copyright (c) 2021, Le Tuan Anh"
__credits__ = []
__license__ = "MIT License"
__description__ = "Free and open-source Japanese Reading Assistant with morphological analyser, Japanese-English dictionary, Kanji dictionary, and Japanese Names dictionary"
__url__ = "https://github.com/neocl/jamdict-web"
__maintainer__ = "Le Tuan Anh"
__version_major__ = "1.0"
__version__ = "{}b1".format(__version_major__)
__status__ = "4 - Beta"
__version_long__ = "{} - {}".format(__version_major__, __status__)
|
"""
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
>>> # extract 100 LDA topics, using default parameters
>>> lda = LdaModel(corpus=mm, id2word=id2word,
... num_topics=100, distributed=distribution_required)
Intermediate output
.. code-block::
>>> # extract 100 LDA topics, using default parameters
>>> ldb = LdbModel(corpus=mm, id2word=id2word, num_topics=100, distributed=True)
Final output
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
"""
|
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
>>> sln = Solution()
>>> sln.reverseWords("the sky is blue")
'blue is sky the'
>>> sln.reverseWords(" ")
''
"""
return " ".join(filter(lambda x: x != '', reversed(s.split(" "))))
|
alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
def cipher(text,key):
new_text = ""
for index,letter in enumerate(text):
offset = key[index%len(key)]
try:
position = alphabet.index(letter.upper())
new_position = (position+offset)%len(alphabet)
new_text+=alphabet[new_position]
except:
new_text+=letter
return new_text
def invert_key(key):
return [0-x for x in key]
def decipher(text,key):
key = invert_key(key)
return cipher(text,key)
def key_word_to_list(key):
return [alphabet.index(x.upper()) for x in key]
option = 1
while 1 <= option <= 2:
print("Caesar Cipher:\n1) Cipher\n2) Decipher\nOther) Exit")
option = int(input())
if option == 1:
text = input("Text to cipher:\n").strip()
key = input("Key: ").strip(); key = key_word_to_list(key) if key.isalpha() else [int(key)]
ciphered_text = cipher(text,key)
print(ciphered_text)
input("Press Enter to continue:")
elif option == 2:
text = input("Text to decipher:\n").strip()
key = input("Key: ").strip(); key = key_word_to_list(key);
deciphered_text = decipher(text,key)
print(deciphered_text)
input("Press Enter to continue:")
|
#crie um programa que tenha uma tupla única com nomes de produtos e seus respectivos preços, na sequência.
#no final, mostre uma listagem de preços organizado os dados em forma tabular.
print('=' * 40)
print(f'{"~ LISTAGEM DE PREÇOS ~":^40}') #titulo
print('=' * 40)
listagem = ('Lápis', 1.75,
'Borracha', 2,
'Caderno', 15.90,
'Estojo', 25,
'Tranferidor', 4.20,
'Compasso', 9.99,
'Mochila', 120.32,
'Canetas', 22.30,
'Livro', 34.90) #tupla com os itens e preço
for pos in range(0, len(listagem)): #reprticao para cada posicao de 0 ate o tamanho da tupla
if pos % 2 == 0: #se a posicao tiver indice par (é preço)
print(f'{listagem[pos]:.<30}', end='') #print formatado com a posicao alinhada com 30 pontos a esquerda
elif pos % 2 == 1: #se a posicao tiver indice impar (é nome do item)
print(f'R${listagem[pos]:>7.2f}') #print formaado alinhando o nome do item a direita
print('=' * 40)
|
amber99_dict = {
'NHE': [
(
'N<0>([H]<1>)([H]<2>)',
{
0: ('N' , 'N' , -0.4630, 1.8240),
1: ('HN1' , 'H' , 0.2315, 0.6000),
2: ('HN2' , 'H' , 0.2315, 0.6000),
},
),
],
'NME': [
(
'N<0>([H]<1>)[C@]<2>([H]<3>)([H]<4>)[H]<5>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CH3' , 'CT' , -0.1490, 1.9080),
3: ('HH31', 'HC' , 0.0976, 1.3870),
4: ('HH32', 'HC' , 0.0976, 1.3870),
5: ('HH33', 'HC' , 0.0976, 1.3870),
},
),
],
'ACE': [
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([H]<4>)[H]<5>',
{
0: ('C' , 'C' , 0.5972, 1.9080),
1: ('O' , 'O' , -0.5679, 1.6612),
2: ('CH3' , 'CT' , -0.3662, 1.9080),
3: ('HH31', 'HC' , 0.1123, 1.4870),
4: ('HH32', 'HC' , 0.1123, 1.4870),
5: ('HH33', 'HC' , 0.1123, 1.4870),
},
),
],
'ALA': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@]<4>([H]<5>)([H]<6>)[H]<7>)C<8>=O<9>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , 0.0337, 1.9080),
3: ('HA' , 'H1' , 0.0823, 1.3870),
4: ('CB' , 'CT' , -0.1825, 1.9080),
5: ('HB3' , 'HC' , 0.0603, 1.4870),
6: ('HB2' , 'HC' , 0.0603, 1.4870),
7: ('HB1' , 'HC' , 0.0603, 1.4870),
8: ('C' , 'C' , 0.5973, 1.9080),
9: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@]<4>([H]<5>)([H]<6>)[H]<7>)[N@+]<8>([H]<9>)([H]<10>)[H]<11>',
{
0: ('C' , 'C' , 0.6163, 1.9080),
1: ('O' , 'O' , -0.5722, 1.6612),
2: ('CA' , 'CT' , 0.0962, 1.9080),
3: ('HA' , 'HP' , 0.0889, 1.1000),
4: ('CB' , 'CT' , -0.0597, 1.9080),
5: ('HB3' , 'HC' , 0.0300, 1.4870),
6: ('HB2' , 'HC' , 0.0300, 1.4870),
7: ('HB1' , 'HC' , 0.0300, 1.4870),
8: ('N' , 'N3' , 0.1414, 1.8240),
9: ('H3' , 'H' , 0.1997, 0.6000),
10: ('H2' , 'H' , 0.1997, 0.6000),
11: ('H1' , 'H' , 0.1997, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@]<4>([H]<5>)([H]<6>)[H]<7>)C<8>([O-]<9>)=O<10>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.1747, 1.9080),
3: ('HA' , 'H1' , 0.1067, 1.3870),
4: ('CB' , 'CT' , -0.2093, 1.9080),
5: ('HB3' , 'HC' , 0.0764, 1.4870),
6: ('HB2' , 'HC' , 0.0764, 1.4870),
7: ('HB1' , 'HC' , 0.0764, 1.4870),
8: ('C' , 'C' , 0.7731, 1.9080),
9: ('OXT' , 'O2' , -0.8055, 1.6612),
10: ('O' , 'O2' , -0.8055, 1.6612),
},
),
],
'ARG': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)N<13>([H]<14>)C<15>(N<16>([H]<17>)[H]<18>)=[N+]<19>([H]<20>)[H]<21>)C<22>=O<23>',
{
0: ('N' , 'N' , -0.3479, 1.8240),
1: ('H' , 'H' , 0.2747, 0.6000),
2: ('CA' , 'CT' , -0.2637, 1.9080),
3: ('HA' , 'H1' , 0.1560, 1.3870),
4: ('CB' , 'CT' , -0.0007, 1.9080),
5: ('HB3' , 'HC' , 0.0327, 1.4870),
6: ('HB2' , 'HC' , 0.0327, 1.4870),
7: ('CG' , 'CT' , 0.0390, 1.9080),
8: ('HG3' , 'HC' , 0.0285, 1.4870),
9: ('HG2' , 'HC' , 0.0285, 1.4870),
10: ('CD' , 'CT' , 0.0486, 1.9080),
11: ('HD3' , 'H1' , 0.0687, 1.3870),
12: ('HD2' , 'H1' , 0.0687, 1.3870),
13: ('NE' , 'N2' , -0.5295, 1.8240),
14: ('HE' , 'H' , 0.3456, 0.6000),
15: ('CZ' , 'CA' , 0.8076, 1.9080),
16: ('NH2' , 'N2' , -0.8627, 1.8240),
17: ('HH22', 'H' , 0.4478, 0.6000),
18: ('HH21', 'H' , 0.4478, 0.6000),
19: ('NH1' , 'N2' , -0.8627, 1.8240),
20: ('HH12', 'H' , 0.4478, 0.6000),
21: ('HH11', 'H' , 0.4478, 0.6000),
22: ('C' , 'C' , 0.7341, 1.9080),
23: ('O' , 'O' , -0.5894, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)N<13>([H]<14>)C<15>(N<16>([H]<17>)[H]<18>)=[N+]<19>([H]<20>)[H]<21>)[N@+]<22>([H]<23>)([H]<24>)[H]<25>',
{
0: ('C' , 'C' , 0.7214, 1.9080),
1: ('O' , 'O' , -0.6013, 1.6612),
2: ('CA' , 'CT' , -0.0223, 1.9080),
3: ('HA' , 'HP' , 0.1242, 1.1000),
4: ('CB' , 'CT' , 0.0118, 1.9080),
5: ('HB3' , 'HC' , 0.0226, 1.4870),
6: ('HB2' , 'HC' , 0.0226, 1.4870),
7: ('CG' , 'CT' , 0.0236, 1.9080),
8: ('HG3' , 'HC' , 0.0309, 1.4870),
9: ('HG2' , 'HC' , 0.0309, 1.4870),
10: ('CD' , 'CT' , 0.0935, 1.9080),
11: ('HD3' , 'H1' , 0.0527, 1.3870),
12: ('HD2' , 'H1' , 0.0527, 1.3870),
13: ('NE' , 'N2' , -0.5650, 1.8240),
14: ('HE' , 'H' , 0.3592, 0.6000),
15: ('CZ' , 'CA' , 0.8281, 1.9080),
16: ('NH2' , 'N2' , -0.8693, 1.8240),
17: ('HH22', 'H' , 0.4494, 0.6000),
18: ('HH21', 'H' , 0.4494, 0.6000),
19: ('NH1' , 'N2' , -0.8693, 1.8240),
20: ('HH12', 'H' , 0.4494, 0.6000),
21: ('HH11', 'H' , 0.4494, 0.6000),
22: ('N' , 'N3' , 0.1305, 1.8240),
23: ('H3' , 'H' , 0.2083, 0.6000),
24: ('H2' , 'H' , 0.2083, 0.6000),
25: ('H1' , 'H' , 0.2083, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)N<13>([H]<14>)C<15>(N<16>([H]<17>)[H]<18>)=[N+]<19>([H]<20>)[H]<21>)C<22>([O-]<23>)=O<24>',
{
0: ('N' , 'N' , -0.3481, 1.8240),
1: ('H' , 'H' , 0.2764, 0.6000),
2: ('CA' , 'CT' , -0.3068, 1.9080),
3: ('HA' , 'H1' , 0.1447, 1.3870),
4: ('CB' , 'CT' , -0.0374, 1.9080),
5: ('HB3' , 'HC' , 0.0371, 1.4870),
6: ('HB2' , 'HC' , 0.0371, 1.4870),
7: ('CG' , 'CT' , 0.0744, 1.9080),
8: ('HG3' , 'HC' , 0.0185, 1.4870),
9: ('HG2' , 'HC' , 0.0185, 1.4870),
10: ('CD' , 'CT' , 0.1114, 1.9080),
11: ('HD3' , 'H1' , 0.0468, 1.3870),
12: ('HD2' , 'H1' , 0.0468, 1.3870),
13: ('NE' , 'N2' , -0.5564, 1.8240),
14: ('HE' , 'H' , 0.3479, 0.6000),
15: ('CZ' , 'CA' , 0.8368, 1.9080),
16: ('NH2' , 'N2' , -0.8737, 1.8240),
17: ('HH22', 'H' , 0.4493, 0.6000),
18: ('HH21', 'H' , 0.4493, 0.6000),
19: ('NH1' , 'N2' , -0.8737, 1.8240),
20: ('HH12', 'H' , 0.4493, 0.6000),
21: ('HH11', 'H' , 0.4493, 0.6000),
22: ('C' , 'C' , 0.8557, 1.9080),
23: ('OXT' , 'O2' , -0.8266, 1.6612),
24: ('O' , 'O2' , -0.8266, 1.6612),
},
),
],
'ASP': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>([O-]<8>)=O<9>)C<10>=O<11>',
{
0: ('N' , 'N' , -0.5163, 1.8240),
1: ('H' , 'H' , 0.2936, 0.6000),
2: ('CA' , 'CT' , 0.0381, 1.9080),
3: ('HA' , 'H1' , 0.0880, 1.3870),
4: ('CB' , 'CT' , -0.0303, 1.9080),
5: ('HB3' , 'HC' , -0.0122, 1.4870),
6: ('HB2' , 'HC' , -0.0122, 1.4870),
7: ('CG' , 'C' , 0.7994, 1.9080),
8: ('OD2' , 'O2' , -0.8014, 1.6612),
9: ('OD1' , 'O2' , -0.8014, 1.6612),
10: ('C' , 'C' , 0.5366, 1.9080),
11: ('O' , 'O' , -0.5819, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>([O-]<8>)=O<9>)[N@+]<10>([H]<11>)([H]<12>)[H]<13>',
{
0: ('C' , 'C' , 0.5621, 1.9080),
1: ('O' , 'O' , -0.5889, 1.6612),
2: ('CA' , 'CT' , 0.0292, 1.9080),
3: ('HA' , 'HP' , 0.1141, 1.1000),
4: ('CB' , 'CT' , -0.0235, 1.9080),
5: ('HB3' , 'HC' , -0.0169, 1.4870),
6: ('HB2' , 'HC' , -0.0169, 1.4870),
7: ('CG' , 'C' , 0.8194, 1.9080),
8: ('OD2' , 'O2' , -0.8084, 1.6612),
9: ('OD1' , 'O2' , -0.8084, 1.6612),
10: ('N' , 'N3' , 0.0782, 1.8240),
11: ('H3' , 'H' , 0.2200, 0.6000),
12: ('H2' , 'H' , 0.2200, 0.6000),
13: ('H1' , 'H' , 0.2200, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>([O-]<8>)=O<9>)C<10>([O-]<11>)=O<12>',
{
0: ('N' , 'N' , -0.5192, 1.8240),
1: ('H' , 'H' , 0.3055, 0.6000),
2: ('CA' , 'CT' , -0.1817, 1.9080),
3: ('HA' , 'H1' , 0.1046, 1.3870),
4: ('CB' , 'CT' , -0.0677, 1.9080),
5: ('HB3' , 'HC' , -0.0212, 1.4870),
6: ('HB2' , 'HC' , -0.0212, 1.4870),
7: ('CG' , 'C' , 0.8851, 1.9080),
8: ('OD2' , 'O2' , -0.8162, 1.6612),
9: ('OD1' , 'O2' , -0.8162, 1.6612),
10: ('C' , 'C' , 0.7256, 1.9080),
11: ('OXT' , 'O2' , -0.7887, 1.6612),
12: ('O' , 'O2' , -0.7887, 1.6612),
},
),
],
'ASN': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>(=O<8>)N<9>([H]<10>)[H]<11>)C<12>=O<13>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , 0.0143, 1.9080),
3: ('HA' , 'H1' , 0.1048, 1.3870),
4: ('CB' , 'CT' , -0.2041, 1.9080),
5: ('HB3' , 'HC' , 0.0797, 1.4870),
6: ('HB2' , 'HC' , 0.0797, 1.4870),
7: ('CG' , 'C' , 0.7130, 1.9080),
8: ('OD1' , 'O' , -0.5931, 1.6612),
9: ('ND2' , 'N' , -0.9191, 1.8240),
10: ('HD22', 'H' , 0.4196, 0.6000),
11: ('HD21', 'H' , 0.4196, 0.6000),
12: ('C' , 'C' , 0.5973, 1.9080),
13: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>(=O<8>)N<9>([H]<10>)[H]<11>)[N@+]<12>([H]<13>)([H]<14>)[H]<15>',
{
0: ('C' , 'C' , 0.6163, 1.9080),
1: ('O' , 'O' , -0.5722, 1.6612),
2: ('CA' , 'CT' , 0.0368, 1.9080),
3: ('HA' , 'HP' , 0.1231, 1.1000),
4: ('CB' , 'CT' , -0.0283, 1.9080),
5: ('HB3' , 'HC' , 0.0515, 1.4870),
6: ('HB2' , 'HC' , 0.0515, 1.4870),
7: ('CG' , 'C' , 0.5833, 1.9080),
8: ('OD1' , 'O' , -0.5744, 1.6612),
9: ('ND2' , 'N' , -0.8634, 1.8240),
10: ('HD22', 'H' , 0.4097, 0.6000),
11: ('HD21', 'H' , 0.4097, 0.6000),
12: ('N' , 'N3' , 0.1801, 1.8240),
13: ('H3' , 'H' , 0.1921, 0.6000),
14: ('H2' , 'H' , 0.1921, 0.6000),
15: ('H1' , 'H' , 0.1921, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>(=O<8>)N<9>([H]<10>)[H]<11>)C<12>([O-]<13>)=O<14>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2080, 1.9080),
3: ('HA' , 'H1' , 0.1358, 1.3870),
4: ('CB' , 'CT' , -0.2299, 1.9080),
5: ('HB3' , 'HC' , 0.1023, 1.4870),
6: ('HB2' , 'HC' , 0.1023, 1.4870),
7: ('CG' , 'C' , 0.7153, 1.9080),
8: ('OD1' , 'O' , -0.6010, 1.6612),
9: ('ND2' , 'N' , -0.9084, 1.8240),
10: ('HD22', 'H' , 0.4150, 0.6000),
11: ('HD21', 'H' , 0.4150, 0.6000),
12: ('C' , 'C' , 0.8050, 1.9080),
13: ('OXT' , 'O2' , -0.8147, 1.6612),
14: ('O' , 'O2' , -0.8147, 1.6612),
},
),
],
'CYS': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>[H]<8>)C<9>=O<10>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , 0.0213, 1.9080),
3: ('HA' , 'H1' , 0.1124, 1.3870),
4: ('CB' , 'CT' , -0.1231, 1.9080),
5: ('HB3' , 'H1' , 0.1112, 1.3870),
6: ('HB2' , 'H1' , 0.1112, 1.3870),
7: ('SG' , 'SH' , -0.3119, 2.0000),
8: ('HG' , 'HS' , 0.1933, 0.6000),
9: ('C' , 'C' , 0.5973, 1.9080),
10: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>[H]<8>)[N@+]<9>([H]<10>)([H]<11>)[H]<12>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0927, 1.9080),
3: ('HA' , 'HP' , 0.1411, 1.1000),
4: ('CB' , 'CT' , -0.1195, 1.9080),
5: ('HB3' , 'H1' , 0.1188, 1.3870),
6: ('HB2' , 'H1' , 0.1188, 1.3870),
7: ('SG' , 'SH' , -0.3298, 2.0000),
8: ('HG' , 'HS' , 0.1975, 0.6000),
9: ('N' , 'N3' , 0.1325, 1.8240),
10: ('H3' , 'H' , 0.2023, 0.6000),
11: ('H2' , 'H' , 0.2023, 0.6000),
12: ('H1' , 'H' , 0.2023, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>[H]<8>)C<9>([O-]<10>)=O<11>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.1635, 1.9080),
3: ('HA' , 'H1' , 0.1396, 1.3870),
4: ('CB' , 'CT' , -0.1996, 1.9080),
5: ('HB3' , 'H1' , 0.1437, 1.3870),
6: ('HB2' , 'H1' , 0.1437, 1.3870),
7: ('SG' , 'SH' , -0.3102, 2.0000),
8: ('HG' , 'HS' , 0.2068, 0.6000),
9: ('C' , 'C' , 0.7497, 1.9080),
10: ('OXT' , 'O2' , -0.7981, 1.6612),
11: ('O' , 'O2' , -0.7981, 1.6612),
},
),
( # disulfide bonded
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>S<7>)C<9>=O<10>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , 0.0429, 1.9080),
3: ('HA' , 'H1' , 0.0766, 1.3870),
4: ('CB' , 'CT' , -0.0790, 1.9080),
5: ('HB3' , 'H1' , 0.0910, 1.3870),
6: ('HB2' , 'H1' , 0.0910, 1.3870),
7: ('SG' , 'S' , -0.1081, 2.0000),
9: ('C' , 'C' , 0.5973, 1.9080),
10: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>S<7>)[N@+]<9>([H]<10>)([H]<11>)[H]<12>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.1055, 1.9080),
3: ('HA' , 'HP' , 0.0922, 1.1000),
4: ('CB' , 'CT' , -0.0277, 1.9080),
5: ('HB3' , 'H1' , 0.0680, 1.3870),
6: ('HB2' , 'H1' , 0.0680, 1.3870),
7: ('SG' , 'S' , -0.0984, 2.0000),
9: ('N' , 'N3' , 0.2069, 1.8240),
10: ('H3' , 'H' , 0.1815, 0.6000),
11: ('H2' , 'H' , 0.1815, 0.6000),
12: ('H1' , 'H' , 0.1815, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>S<7>)C<9>([O-]<10>)=O<11>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.1318, 1.9080),
3: ('HA' , 'H1' , 0.0938, 1.3870),
4: ('CB' , 'CT' , -0.1934, 1.9080),
5: ('HB3' , 'H1' , 0.1228, 1.3870),
6: ('HB2' , 'H1' , 0.1228, 1.3870),
7: ('SG' , 'S' , -0.0529, 2.0000),
9: ('C' , 'C' , 0.7618, 1.9080),
10: ('OXT' , 'O2' , -0.8041, 1.6612),
11: ('O' , 'O2' , -0.8041, 1.6612),
},
),
],
'CYX': [
( # disulfide bonded
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>S<7>)C<9>=O<10>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , 0.0429, 1.9080),
3: ('HA' , 'H1' , 0.0766, 1.3870),
4: ('CB' , 'CT' , -0.0790, 1.9080),
5: ('HB3' , 'H1' , 0.0910, 1.3870),
6: ('HB2' , 'H1' , 0.0910, 1.3870),
7: ('SG' , 'S' , -0.1081, 2.0000),
9: ('C' , 'C' , 0.5973, 1.9080),
10: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>S<7>)[N@+]<9>([H]<10>)([H]<11>)[H]<12>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.1055, 1.9080),
3: ('HA' , 'HP' , 0.0922, 1.1000),
4: ('CB' , 'CT' , -0.0277, 1.9080),
5: ('HB3' , 'H1' , 0.0680, 1.3870),
6: ('HB2' , 'H1' , 0.0680, 1.3870),
7: ('SG' , 'S' , -0.0984, 2.0000),
9: ('N' , 'N3' , 0.2069, 1.8240),
10: ('H3' , 'H' , 0.1815, 0.6000),
11: ('H2' , 'H' , 0.1815, 0.6000),
12: ('H1' , 'H' , 0.1815, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)S<7>S<7>)C<9>([O-]<10>)=O<11>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.1318, 1.9080),
3: ('HA' , 'H1' , 0.0938, 1.3870),
4: ('CB' , 'CT' , -0.1934, 1.9080),
5: ('HB3' , 'H1' , 0.1228, 1.3870),
6: ('HB2' , 'H1' , 0.1228, 1.3870),
7: ('SG' , 'S' , -0.0529, 2.0000),
9: ('C' , 'C' , 0.7618, 1.9080),
10: ('OXT' , 'O2' , -0.8041, 1.6612),
11: ('O' , 'O2' , -0.8041, 1.6612),
},
),
],
'GLN': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)C<10>(=O<11>)N<12>([H]<13>)[H]<14>)C<15>=O<16>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0031, 1.9080),
3: ('HA' , 'H1' , 0.0850, 1.3870),
4: ('CB' , 'CT' , -0.0036, 1.9080),
5: ('HB3' , 'HC' , 0.0171, 1.4870),
6: ('HB2' , 'HC' , 0.0171, 1.4870),
7: ('CG' , 'CT' , -0.0645, 1.9080),
8: ('HG3' , 'HC' , 0.0352, 1.4870),
9: ('HG2' , 'HC' , 0.0352, 1.4870),
10: ('CD' , 'C' , 0.6951, 1.9080),
11: ('OE1' , 'O' , -0.6086, 1.6612),
12: ('NE2' , 'N' , -0.9407, 1.8240),
13: ('HE22', 'H' , 0.4251, 0.6000),
14: ('HE21', 'H' , 0.4251, 0.6000),
15: ('C' , 'C' , 0.5973, 1.9080),
16: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)C<10>(=O<11>)N<12>([H]<13>)[H]<14>)[N@+]<15>([H]<16>)([H]<17>)[H]<18>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0536, 1.9080),
3: ('HA' , 'HP' , 0.1015, 1.1000),
4: ('CB' , 'CT' , 0.0651, 1.9080),
5: ('HB3' , 'HC' , 0.0050, 1.4870),
6: ('HB2' , 'HC' , 0.0050, 1.4870),
7: ('CG' , 'CT' , -0.0903, 1.9080),
8: ('HG3' , 'HC' , 0.0331, 1.4870),
9: ('HG2' , 'HC' , 0.0331, 1.4870),
10: ('CD' , 'C' , 0.7354, 1.9080),
11: ('OE1' , 'O' , -0.6133, 1.6612),
12: ('NE2' , 'N' , -1.0031, 1.8240),
13: ('HE22', 'H' , 0.4429, 0.6000),
14: ('HE21', 'H' , 0.4429, 0.6000),
15: ('N' , 'N3' , 0.1493, 1.8240),
16: ('H3' , 'H' , 0.1996, 0.6000),
17: ('H2' , 'H' , 0.1996, 0.6000),
18: ('H1' , 'H' , 0.1996, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)C<10>(=O<11>)N<12>([H]<13>)[H]<14>)C<15>([O-]<16>)=O<17>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2248, 1.9080),
3: ('HA' , 'H1' , 0.1232, 1.3870),
4: ('CB' , 'CT' , -0.0664, 1.9080),
5: ('HB3' , 'HC' , 0.0452, 1.4870),
6: ('HB2' , 'HC' , 0.0452, 1.4870),
7: ('CG' , 'CT' , -0.0210, 1.9080),
8: ('HG3' , 'HC' , 0.0203, 1.4870),
9: ('HG2' , 'HC' , 0.0203, 1.4870),
10: ('CD' , 'C' , 0.7093, 1.9080),
11: ('OE1' , 'O' , -0.6098, 1.6612),
12: ('NE2' , 'N' , -0.9574, 1.8240),
13: ('HE22', 'H' , 0.4304, 0.6000),
14: ('HE21', 'H' , 0.4304, 0.6000),
15: ('C' , 'C' , 0.7775, 1.9080),
16: ('OXT' , 'O2' , -0.8042, 1.6612),
17: ('O' , 'O2' , -0.8042, 1.6612),
},
),
],
'GLU': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)C<10>([O-]<11>)=O<12>)C<13>=O<14>',
{
0: ('N' , 'N' , -0.5163, 1.8240),
1: ('H' , 'H' , 0.2936, 0.6000),
2: ('CA' , 'CT' , 0.0397, 1.9080),
3: ('HA' , 'H1' , 0.1105, 1.3870),
4: ('CB' , 'CT' , 0.0560, 1.9080),
5: ('HB3' , 'HC' , -0.0173, 1.4870),
6: ('HB2' , 'HC' , -0.0173, 1.4870),
7: ('CG' , 'CT' , 0.0136, 1.9080),
8: ('HG3' , 'HC' , -0.0425, 1.4870),
9: ('HG2' , 'HC' , -0.0425, 1.4870),
10: ('CD' , 'C' , 0.8054, 1.9080),
11: ('OE2' , 'O2' , -0.8188, 1.6612),
12: ('OE1' , 'O2' , -0.8188, 1.6612),
13: ('C' , 'C' , 0.5366, 1.9080),
14: ('O' , 'O' , -0.5819, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)C<10>([O-]<11>)=O<12>)[N@+]<13>([H]<14>)([H]<15>)[H]<16>',
{
0: ('C' , 'C' , 0.5621, 1.9080),
1: ('O' , 'O' , -0.5889, 1.6612),
2: ('CA' , 'CT' , 0.0588, 1.9080),
3: ('HA' , 'HP' , 0.1202, 1.1000),
4: ('CB' , 'CT' , 0.0909, 1.9080),
5: ('HB3' , 'HC' , -0.0232, 1.4870),
6: ('HB2' , 'HC' , -0.0232, 1.4870),
7: ('CG' , 'CT' , -0.0236, 1.9080),
8: ('HG3' , 'HC' , -0.0315, 1.4870),
9: ('HG2' , 'HC' , -0.0315, 1.4870),
10: ('CD' , 'C' , 0.8087, 1.9080),
11: ('OE2' , 'O2' , -0.8189, 1.6612),
12: ('OE1' , 'O2' , -0.8189, 1.6612),
13: ('N' , 'N3' , 0.0017, 1.8240),
14: ('H3' , 'H' , 0.2391, 0.6000),
15: ('H2' , 'H' , 0.2391, 0.6000),
16: ('H1' , 'H' , 0.2391, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)C<10>([O-]<11>)=O<12>)C<13>([O-]<14>)=O<15>',
{
0: ('N' , 'N' , -0.5192, 1.8240),
1: ('H' , 'H' , 0.3055, 0.6000),
2: ('CA' , 'CT' , -0.2059, 1.9080),
3: ('HA' , 'H1' , 0.1399, 1.3870),
4: ('CB' , 'CT' , 0.0071, 1.9080),
5: ('HB3' , 'HC' , -0.0078, 1.4870),
6: ('HB2' , 'HC' , -0.0078, 1.4870),
7: ('CG' , 'CT' , 0.0675, 1.9080),
8: ('HG3' , 'HC' , -0.0548, 1.4870),
9: ('HG2' , 'HC' , -0.0548, 1.4870),
10: ('CD' , 'C' , 0.8183, 1.9080),
11: ('OE2' , 'O2' , -0.8220, 1.6612),
12: ('OE1' , 'O2' , -0.8220, 1.6612),
13: ('C' , 'C' , 0.7420, 1.9080),
14: ('OXT' , 'O2' , -0.7930, 1.6612),
15: ('O' , 'O2' , -0.7930, 1.6612),
},
),
],
'GLY': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([H]<4>)C<5>=O<6>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0252, 1.9080),
3: ('HA' , 'H1' , 0.0698, 1.3870),
4: ('HA3' , 'H1' , 0.0698, 1.3870),
5: ('C' , 'C' , 0.5973, 1.9080),
6: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([H]<4>)[N@+]<5>([H]<6>)([H]<7>)[H]<8>',
{
0: ('C' , 'C' , 0.6163, 1.9080),
1: ('O' , 'O' , -0.5722, 1.6612),
2: ('CA' , 'CT' , -0.0100, 1.9080),
3: ('HA' , 'H1' , 0.0895, 1.1000),
4: ('HA3' , 'H1' , 0.0895, 1.1000),
5: ('N' , 'N' , 0.2943, 1.8240),
6: ('H2' , 'H' , 0.1642, 0.6000),
7: ('H1' , 'H' , 0.1642, 0.6000),
8: ('H3' , 'H' , 0.1642, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([H]<4>)C<5>([O-]<6>)=O<7>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2493, 1.9080),
3: ('HA' , 'H1' , 0.1056, 1.3870),
4: ('HA3' , 'H1' , 0.1056, 1.3870),
5: ('C' , 'C' , 0.7231, 1.9080),
6: ('OXT' , 'O2' , -0.7855, 1.6612),
7: ('O' , 'O' , -0.7855, 1.6612),
},
),
],
'HIS': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1N<8>=C<9>([H]<10>)N<11>([H]<12>)C<13>=1[H]<14>)C<15>=O<16>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0581, 1.9080),
3: ('HA' , 'H1' , 0.1360, 1.3870),
4: ('CB' , 'CT' , -0.0074, 1.9080),
5: ('HB3' , 'HC' , 0.0367, 1.4870),
6: ('HB2' , 'HC' , 0.0367, 1.4870),
7: ('CG' , 'CC' , 0.1868, 1.9080),
8: ('ND1' , 'NB' , -0.5432, 1.8240),
9: ('CE1' , 'CR' , 0.1635, 1.9080),
10: ('HE1' , 'H5' , 0.1435, 1.3590),
11: ('NE2' , 'NA' , -0.2795, 1.8240),
12: ('HE2' , 'H' , 0.3339, 0.6000),
13: ('CD2' , 'CW' , -0.2207, 1.9080),
14: ('HD2' , 'H4' , 0.1862, 1.4090),
15: ('C' , 'C' , 0.5973, 1.9080),
16: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1N<8>=C<9>([H]<10>)N<11>([H]<12>)C<13>=1[H]<14>)[N@+]<15>([H]<16>)([H]<17>)[H]<18>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0236, 1.9080),
3: ('HA' , 'HP' , 0.1380, 1.1000),
4: ('CB' , 'CT' , 0.0489, 1.9080),
5: ('HB3' , 'HC' , 0.0223, 1.4870),
6: ('HB2' , 'HC' , 0.0223, 1.4870),
7: ('CG' , 'CC' , 0.1740, 1.9080),
8: ('ND1' , 'NB' , -0.5579, 1.8240),
9: ('CE1' , 'CR' , 0.1804, 1.9080),
10: ('HE1' , 'H5' , 0.1397, 1.3590),
11: ('NE2' , 'NA' , -0.2781, 1.8240),
12: ('HE2' , 'H' , 0.3324, 0.6000),
13: ('CD2' , 'CW' , -0.2349, 1.9080),
14: ('HD2' , 'H4' , 0.1963, 1.4090),
15: ('N' , 'N3' , 0.1472, 1.8240),
16: ('H3' , 'H' , 0.2016, 0.6000),
17: ('H2' , 'H' , 0.2016, 0.6000),
18: ('H1' , 'H' , 0.2016, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1N<8>=C<9>([H]<10>)N<11>([H]<12>)C<13>=1[H]<14>)C<15>([O-]<16>)=O<17>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2699, 1.9080),
3: ('HA' , 'H1' , 0.1650, 1.3870),
4: ('CB' , 'CT' , -0.1068, 1.9080),
5: ('HB3' , 'HC' , 0.0620, 1.4870),
6: ('HB2' , 'HC' , 0.0620, 1.4870),
7: ('CG' , 'CC' , 0.2724, 1.9080),
8: ('ND1' , 'NB' , -0.5517, 1.8240),
9: ('CE1' , 'CR' , 0.1558, 1.9080),
10: ('HE1' , 'H5' , 0.1448, 1.3590),
11: ('NE2' , 'NA' , -0.2670, 1.8240),
12: ('HE2' , 'H' , 0.3319, 0.6000),
13: ('CD2' , 'CW' , -0.2588, 1.9080),
14: ('HD2' , 'H4' , 0.1957, 1.4090),
15: ('C' , 'C' , 0.7916, 1.9080),
16: ('OXT' , 'O2' , -0.8065, 1.6612),
17: ('O' , 'O2' , -0.8065, 1.6612),
},
),
],
'HIP': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1[N+]<8>([H]<9>)=C<10>([H]<11>)N<12>([H]<13>)C<14>=1[H]<15>)C<16>=O<17>',
{
0: ('N' , 'N' , -0.3479, 1.8240),
1: ('H' , 'H' , 0.2747, 0.6000),
2: ('CA' , 'CT' , -0.1354, 1.9080),
3: ('HA' , 'H1' , 0.1212, 1.3870),
4: ('CB' , 'CT' , -0.0414, 1.9080),
5: ('HB3' , 'HC' , 0.0810, 1.4870),
6: ('HB2' , 'HC' , 0.0810, 1.4870),
7: ('CG' , 'CC' , -0.0012, 1.9080),
8: ('ND1' , 'NA' , -0.1513, 1.8240),
9: ('HD1' , 'H' , 0.3866, 0.6000),
10: ('CE1' , 'CR' , -0.0170, 1.9080),
11: ('HE1' , 'H5' , 0.2681, 1.3590),
12: ('NE2' , 'NA' , -0.1718, 1.8240),
13: ('HE2' , 'H' , 0.3911, 0.6000),
14: ('CD2' , 'CW' , -0.1141, 1.9080),
15: ('HD2' , 'H4' , 0.2317, 1.4090),
16: ('C' , 'C' , 0.7341, 1.9080),
17: ('O' , 'O' , -0.5894, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1[N+]<8>([H]<9>)=C<10>([H]<11>)N<12>([H]<13>)C<14>=1[H]<15>)[N@+]<16>([H]<17>)([H]<18>)[H]<19>',
{
0: ('C' , 'C' , 0.7214, 1.9080),
1: ('O' , 'O' , -0.6013, 1.6612),
2: ('CA' , 'CT' , 0.0581, 1.9080),
3: ('HA' , 'HP' , 0.1047, 1.1000),
4: ('CB' , 'CT' , 0.0484, 1.9080),
5: ('HB3' , 'HC' , 0.0531, 1.4870),
6: ('HB2' , 'HC' , 0.0531, 1.4870),
7: ('CG' , 'CC' , -0.0236, 1.9080),
8: ('ND1' , 'NA' , -0.1510, 1.8240),
9: ('HD1' , 'H' , 0.3821, 0.6000),
10: ('CE1' , 'CR' , -0.0011, 1.9080),
11: ('HE1' , 'H5' , 0.2645, 1.3590),
12: ('NE2' , 'NA' , -0.1739, 1.8240),
13: ('HE2' , 'H' , 0.3921, 0.6000),
14: ('CD2' , 'CW' , -0.1433, 1.9080),
15: ('HD2' , 'H4' , 0.2495, 1.4090),
16: ('N' , 'N3' , 0.2560, 1.8240),
17: ('H3' , 'H' , 0.1704, 0.6000),
18: ('H2' , 'H' , 0.1704, 0.6000),
19: ('H1' , 'H' , 0.1704, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1[N+]<8>([H]<9>)=C<10>([H]<11>)N<12>([H]<13>)C<14>=1[H]<15>)C<16>([O-]<17>)=O<18>',
{
0: ('N' , 'N' , -0.3481, 1.8240),
1: ('H' , 'H' , 0.2764, 0.6000),
2: ('CA' , 'CT' , -0.1445, 1.9080),
3: ('HA' , 'H1' , 0.1115, 1.3870),
4: ('CB' , 'CT' , -0.0800, 1.9080),
5: ('HB3' , 'HC' , 0.0868, 1.4870),
6: ('HB2' , 'HC' , 0.0868, 1.4870),
7: ('CG' , 'CC' , 0.0298, 1.9080),
8: ('ND1' , 'NA' , -0.1501, 1.8240),
9: ('HD1' , 'H' , 0.3883, 0.6000),
10: ('CE1' , 'CR' , -0.0251, 1.9080),
11: ('HE1' , 'H5' , 0.2694, 1.3590),
12: ('NE2' , 'NA' , -0.1683, 1.8240),
13: ('HE2' , 'H' , 0.3913, 0.6000),
14: ('CD2' , 'CW' , -0.1256, 1.9080),
15: ('HD2' , 'H4' , 0.2336, 1.4090),
16: ('C' , 'C' , 0.8032, 1.9080),
17: ('OXT' , 'O2' , -0.8177, 1.6612),
18: ('O' , 'O2' , -0.8177, 1.6612),
},
),
],
'HID': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1N<8>([H]<9>)C<10>([H]<11>)=N<12>C<13>=1[H]<14>)C<15>=O<16>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , 0.0188, 1.9080),
3: ('HA' , 'H1' , 0.0881, 1.3870),
4: ('CB' , 'CT' , -0.0462, 1.9080),
5: ('HB3' , 'HC' , 0.0402, 1.4870),
6: ('HB2' , 'HC' , 0.0402, 1.4870),
7: ('CG' , 'CC' , -0.0266, 1.9080),
8: ('ND1' , 'NA' , -0.3811, 1.8240),
9: ('HD1' , 'H' , 0.3649, 0.6000),
10: ('CE1' , 'CR' , 0.2057, 1.9080),
11: ('HE1' , 'H5' , 0.1392, 1.3590),
12: ('NE2' , 'NB' , -0.5727, 1.8240),
13: ('CD2' , 'CV' , 0.1292, 1.9080),
14: ('HD2' , 'H4' , 0.1147, 1.4090),
15: ('C' , 'C' , 0.5973, 1.9080),
16: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1N<8>([H]<9>)C<10>([H]<11>)=N<12>C<13>=1[H]<14>)[N@+]<15>([H]<16>)([H]<17>)[H]<18>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0964, 1.9080),
3: ('HA' , 'HP' , 0.0958, 1.1000),
4: ('CB' , 'CT' , 0.0259, 1.9080),
5: ('HB3' , 'HC' , 0.0209, 1.4870),
6: ('HB2' , 'HC' , 0.0209, 1.4870),
7: ('CG' , 'CC' , -0.0399, 1.9080),
8: ('ND1' , 'NA' , -0.3819, 1.8240),
9: ('HD1' , 'H' , 0.3632, 0.6000),
10: ('CE1' , 'CR' , 0.2127, 1.9080),
11: ('HE1' , 'H5' , 0.1385, 1.3590),
12: ('NE2' , 'NB' , -0.5711, 1.8240),
13: ('CD2' , 'CV' , 0.1046, 1.9080),
14: ('HD2' , 'H4' , 0.1299, 1.4090),
15: ('N' , 'N3' , 0.1542, 1.8240),
16: ('H3' , 'H' , 0.1963, 0.6000),
17: ('H2' , 'H' , 0.1963, 0.6000),
18: ('H1' , 'H' , 0.1963, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1N<8>([H]<9>)C<10>([H]<11>)=N<12>C<13>=1[H]<14>)C<15>([O-]<16>)=O<17>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.1739, 1.9080),
3: ('HA' , 'H1' , 0.1100, 1.3870),
4: ('CB' , 'CT' , -0.1046, 1.9080),
5: ('HB3' , 'HC' , 0.0565, 1.4870),
6: ('HB2' , 'HC' , 0.0565, 1.4870),
7: ('CG' , 'CC' , 0.0293, 1.9080),
8: ('ND1' , 'NA' , -0.3892, 1.8240),
9: ('HD1' , 'H' , 0.3755, 0.6000),
10: ('CE1' , 'CR' , 0.1925, 1.9080),
11: ('HE1' , 'H5' , 0.1418, 1.3590),
12: ('NE2' , 'NB' , -0.5629, 1.8240),
13: ('CD2' , 'CV' , 0.1001, 1.9080),
14: ('HD2' , 'H4' , 0.1241, 1.4090),
15: ('C' , 'C' , 0.7615, 1.9080),
16: ('OXT' , 'O2' , -0.8016, 1.6612),
17: ('O' , 'O2' , -0.8016, 1.6612),
},
),
],
'ILE': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([C@]<6>([H]<7>)([H]<8>)[H]<9>)[C@@]<10>([H]<11>)([H]<12>)[C@]<13>([H]<14>)([H]<15>)[H]<16>)C<17>=O<18>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0597, 1.9080),
3: ('HA' , 'H1' , 0.0869, 1.3870),
4: ('CB' , 'CT' , 0.1303, 1.9080),
5: ('HB' , 'HC' , 0.0187, 1.4870),
6: ('CG2' , 'CT' , -0.3204, 1.9080),
7: ('HG23', 'HC' , 0.0882, 1.4870),
8: ('HG22', 'HC' , 0.0882, 1.4870),
9: ('HG21', 'HC' , 0.0882, 1.4870),
10: ('CG1' , 'CT' , -0.0430, 1.9080),
11: ('HG13', 'HC' , 0.0236, 1.4870),
12: ('HG12', 'HC' , 0.0236, 1.4870),
13: ('CD1' , 'CT' , -0.0660, 1.9080),
14: ('HD13', 'HC' , 0.0186, 1.4870),
15: ('HD12', 'HC' , 0.0186, 1.4870),
16: ('HD11', 'HC' , 0.0186, 1.4870),
17: ('C' , 'C' , 0.5973, 1.9080),
18: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([C@]<6>([H]<7>)([H]<8>)[H]<9>)[C@@]<10>([H]<11>)([H]<12>)[C@]<13>([H]<14>)([H]<15>)[H]<16>)[N@+]<17>([H]<18>)([H]<19>)[H]<20>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0257, 1.9080),
3: ('HA' , 'HP' , 0.1031, 1.1000),
4: ('CB' , 'CT' , 0.1885, 1.9080),
5: ('HB' , 'HC' , 0.0213, 1.4870),
6: ('CG2' , 'CT' , -0.3720, 1.9080),
7: ('HG23', 'HC' , 0.0947, 1.4870),
8: ('HG22', 'HC' , 0.0947, 1.4870),
9: ('HG21', 'HC' , 0.0947, 1.4870),
10: ('CG1' , 'CT' , -0.0387, 1.9080),
11: ('HG13', 'HC' , 0.0201, 1.4870),
12: ('HG12', 'HC' , 0.0201, 1.4870),
13: ('CD1' , 'CT' , -0.0908, 1.9080),
14: ('HD13', 'HC' , 0.0226, 1.4870),
15: ('HD12', 'HC' , 0.0226, 1.4870),
16: ('HD11', 'HC' , 0.0226, 1.4870),
17: ('N' , 'N3' , 0.0311, 1.8240),
18: ('H3' , 'H' , 0.2329, 0.6000),
19: ('H2' , 'H' , 0.2329, 0.6000),
20: ('H1' , 'H' , 0.2329, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([C@]<6>([H]<7>)([H]<8>)[H]<9>)[C@@]<10>([H]<11>)([H]<12>)[C@]<13>([H]<14>)([H]<15>)[H]<16>)C<17>([O-]<18>)=O<19>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.3100, 1.9080),
3: ('HA' , 'H1' , 0.1375, 1.3870),
4: ('CB' , 'CT' , 0.0363, 1.9080),
5: ('HB' , 'HC' , 0.0766, 1.4870),
6: ('CG2' , 'CT' , -0.3498, 1.9080),
7: ('HG23', 'HC' , 0.1021, 1.4870),
8: ('HG22', 'HC' , 0.1021, 1.4870),
9: ('HG21', 'HC' , 0.1021, 1.4870),
10: ('CG1' , 'CT' , -0.0323, 1.9080),
11: ('HG13', 'HC' , 0.0321, 1.4870),
12: ('HG12', 'HC' , 0.0321, 1.4870),
13: ('CD1' , 'CT' , -0.0699, 1.9080),
14: ('HD13', 'HC' , 0.0196, 1.4870),
15: ('HD12', 'HC' , 0.0196, 1.4870),
16: ('HD11', 'HC' , 0.0196, 1.4870),
17: ('C' , 'C' , 0.8343, 1.9080),
18: ('OXT' , 'O2' , -0.8190, 1.6612),
19: ('O' , 'O2' , -0.8190, 1.6612),
},
),
],
'LEU': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@]<7>([H]<8>)([C@]<9>([H]<10>)([H]<11>)[H]<12>)[C@]<13>([H]<14>)([H]<15>)[H]<16>)C<17>=O<18>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0518, 1.9080),
3: ('HA' , 'H1' , 0.0922, 1.3870),
4: ('CB' , 'CT' , -0.1102, 1.9080),
5: ('HB3' , 'HC' , 0.0457, 1.4870),
6: ('HB2' , 'HC' , 0.0457, 1.4870),
7: ('CG' , 'CT' , 0.3531, 1.9080),
8: ('HG' , 'HC' , -0.0361, 1.4870),
9: ('CD2' , 'CT' , -0.4121, 1.9080),
10: ('HD23', 'HC' , 0.1000, 1.4870),
11: ('HD22', 'HC' , 0.1000, 1.4870),
12: ('HD21', 'HC' , 0.1000, 1.4870),
13: ('CD1' , 'CT' , -0.4121, 1.9080),
14: ('HD13', 'HC' , 0.1000, 1.4870),
15: ('HD12', 'HC' , 0.1000, 1.4870),
16: ('HD11', 'HC' , 0.1000, 1.4870),
17: ('C' , 'C' , 0.5973, 1.9080),
18: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@]<7>([H]<8>)([C@]<9>([H]<10>)([H]<11>)[H]<12>)[C@]<13>([H]<14>)([H]<15>)[H]<16>)[N@+]<17>([H]<18>)([H]<19>)[H]<20>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0104, 1.9080),
3: ('HA' , 'HP' , 0.1053, 1.1000),
4: ('CB' , 'CT' , -0.0244, 1.9080),
5: ('HB3' , 'HC' , 0.0256, 1.4870),
6: ('HB2' , 'HC' , 0.0256, 1.4870),
7: ('CG' , 'CT' , 0.3421, 1.9080),
8: ('HG' , 'HC' , -0.0380, 1.4870),
9: ('CD2' , 'CT' , -0.4104, 1.9080),
10: ('HD23', 'HC' , 0.0980, 1.4870),
11: ('HD22', 'HC' , 0.0980, 1.4870),
12: ('HD21', 'HC' , 0.0980, 1.4870),
13: ('CD1' , 'CT' , -0.4106, 1.9080),
14: ('HD13', 'HC' , 0.0980, 1.4870),
15: ('HD12', 'HC' , 0.0980, 1.4870),
16: ('HD11', 'HC' , 0.0980, 1.4870),
17: ('N' , 'N3' , 0.1010, 1.8240),
18: ('H3' , 'H' , 0.2148, 0.6000),
19: ('H2' , 'H' , 0.2148, 0.6000),
20: ('H1' , 'H' , 0.2148, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@]<7>([H]<8>)([C@]<9>([H]<10>)([H]<11>)[H]<12>)[C@]<13>([H]<14>)([H]<15>)[H]<16>)C<17>([O-]<18>)=O<19>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2847, 1.9080),
3: ('HA' , 'H1' , 0.1346, 1.3870),
4: ('CB' , 'CT' , -0.2469, 1.9080),
5: ('HB3' , 'HC' , 0.0974, 1.4870),
6: ('HB2' , 'HC' , 0.0974, 1.4870),
7: ('CG' , 'CT' , 0.3706, 1.9080),
8: ('HG' , 'HC' , -0.0374, 1.4870),
9: ('CD2' , 'CT' , -0.4163, 1.9080),
10: ('HD23', 'HC' , 0.1038, 1.4870),
11: ('HD22', 'HC' , 0.1038, 1.4870),
12: ('HD21', 'HC' , 0.1038, 1.4870),
13: ('CD1' , 'CT' , -0.4163, 1.9080),
14: ('HD13', 'HC' , 0.1038, 1.4870),
15: ('HD12', 'HC' , 0.1038, 1.4870),
16: ('HD11', 'HC' , 0.1038, 1.4870),
17: ('C' , 'C' , 0.8326, 1.9080),
18: ('OXT' , 'O2' , -0.8199, 1.6612),
19: ('O' , 'O2' , -0.8199, 1.6612),
},
),
],
'LYS': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)[C@@]<13>([H]<14>)([H]<15>)[N@+]<16>([H]<17>)([H]<18>)[H]<19>)C<20>=O<21>',
{
0: ('N' , 'N' , -0.3479, 1.8240),
1: ('H' , 'H' , 0.2747, 0.6000),
2: ('CA' , 'CT' , -0.2400, 1.9080),
3: ('HA' , 'H1' , 0.1426, 1.3870),
4: ('CB' , 'CT' , -0.0094, 1.9080),
5: ('HB3' , 'HC' , 0.0362, 1.4870),
6: ('HB2' , 'HC' , 0.0362, 1.4870),
7: ('CG' , 'CT' , 0.0187, 1.9080),
8: ('HG3' , 'HC' , 0.0103, 1.4870),
9: ('HG2' , 'HC' , 0.0103, 1.4870),
10: ('CD' , 'CT' , -0.0479, 1.9080),
11: ('HD3' , 'HC' , 0.0621, 1.4870),
12: ('HD2' , 'HC' , 0.0621, 1.4870),
13: ('CE' , 'CT' , -0.0143, 1.9080),
14: ('HE3' , 'HP' , 0.1135, 1.1000),
15: ('HE2' , 'HP' , 0.1135, 1.1000),
16: ('NZ' , 'N3' , -0.3854, 1.8240),
17: ('HZ2' , 'H' , 0.3400, 0.6000),
18: ('HZ1' , 'H' , 0.3400, 0.6000),
19: ('HZ3' , 'H' , 0.3400, 0.6000),
20: ('C' , 'C' , 0.7341, 1.9080),
21: ('O' , 'O' , -0.5894, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)[C@@]<13>([H]<14>)([H]<15>)[N@+]<16>([H]<17>)([H]<18>)[H]<19>)[N@+]<20>([H]<21>)([H]<22>)[H]<23>',
{
0: ('C' , 'C' , 0.7214, 1.9080),
1: ('O' , 'O' , -0.6013, 1.6612),
2: ('CA' , 'CT' , -0.0015, 1.9080),
3: ('HA' , 'HP' , 0.1180, 1.1000),
4: ('CB' , 'CT' , 0.0212, 1.9080),
5: ('HB3' , 'HC' , 0.0283, 1.4870),
6: ('HB2' , 'HC' , 0.0283, 1.4870),
7: ('CG' , 'CT' , -0.0048, 1.9080),
8: ('HG3' , 'HC' , 0.0121, 1.4870),
9: ('HG2' , 'HC' , 0.0121, 1.4870),
10: ('CD' , 'CT' , -0.0608, 1.9080),
11: ('HD3' , 'HC' , 0.0633, 1.4870),
12: ('HD2' , 'HC' , 0.0633, 1.4870),
13: ('CE' , 'CT' , -0.0181, 1.9080),
14: ('HE3' , 'HP' , 0.1171, 1.1000),
15: ('HE2' , 'HP' , 0.1171, 1.1000),
16: ('NZ' , 'N3' , -0.3764, 1.8240),
17: ('HZ2' , 'H' , 0.3382, 0.6000),
18: ('HZ1' , 'H' , 0.3382, 0.6000),
19: ('HZ3' , 'H' , 0.3382, 0.6000),
20: ('N' , 'N3' , 0.0966, 1.8240),
21: ('H3' , 'H' , 0.2165, 0.6000),
22: ('H2' , 'H' , 0.2165, 0.6000),
23: ('H1' , 'H' , 0.2165, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)[C@@]<13>([H]<14>)([H]<15>)[N@+]<16>([H]<17>)([H]<18>)[H]<19>)C<20>([O-]<21>)=O<22>',
{
0: ('N' , 'N' , -0.3481, 1.8240),
1: ('H' , 'H' , 0.2764, 0.6000),
2: ('CA' , 'CT' , -0.2903, 1.9080),
3: ('HA' , 'H1' , 0.1438, 1.3870),
4: ('CB' , 'CT' , -0.0538, 1.9080),
5: ('HB3' , 'HC' , 0.0482, 1.4870),
6: ('HB2' , 'HC' , 0.0482, 1.4870),
7: ('CG' , 'CT' , 0.0227, 1.9080),
8: ('HG3' , 'HC' , 0.0134, 1.4870),
9: ('HG2' , 'HC' , 0.0134, 1.4870),
10: ('CD' , 'CT' , -0.0392, 1.9080),
11: ('HD3' , 'HC' , 0.0611, 1.4870),
12: ('HD2' , 'HC' , 0.0611, 1.4870),
13: ('CE' , 'CT' , -0.0176, 1.9080),
14: ('HE3' , 'HP' , 0.1121, 1.1000),
15: ('HE2' , 'HP' , 0.1121, 1.1000),
16: ('NZ' , 'N3' , -0.3741, 1.8240),
17: ('HZ2' , 'H' , 0.3374, 0.6000),
18: ('HZ1' , 'H' , 0.3374, 0.6000),
19: ('HZ3' , 'H' , 0.3374, 0.6000),
20: ('C' , 'C' , 0.8488, 1.9080),
21: ('OXT' , 'O2' , -0.8252, 1.6612),
22: ('O' , 'O2' , -0.8252, 1.6612),
},
),
],
'MET': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)S<10>[C@]<11>([H]<12>)([H]<13>)[H]<14>)C<15>=O<16>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0237, 1.9080),
3: ('HA' , 'H1' , 0.0880, 1.3870),
4: ('CB' , 'CT' , 0.0342, 1.9080),
5: ('HB3' , 'HC' , 0.0241, 1.4870),
6: ('HB2' , 'HC' , 0.0241, 1.4870),
7: ('CG' , 'CT' , 0.0018, 1.9080),
8: ('HG3' , 'H1' , 0.0440, 1.3870),
9: ('HG2' , 'H1' , 0.0440, 1.3870),
10: ('SD' , 'S' , -0.2737, 2.0000),
11: ('CE' , 'CT' , -0.0536, 1.9080),
12: ('HE3' , 'H1' , 0.0684, 1.3870),
13: ('HE2' , 'H1' , 0.0684, 1.3870),
14: ('HE1' , 'H1' , 0.0684, 1.3870),
15: ('C' , 'C' , 0.5973, 1.9080),
16: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)S<10>[C@]<11>([H]<12>)([H]<13>)[H]<14>)[N@+]<15>([H]<16>)([H]<17>)[H]<18>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0221, 1.9080),
3: ('HA' , 'HP' , 0.1116, 1.1000),
4: ('CB' , 'CT' , 0.0865, 1.9080),
5: ('HB3' , 'HC' , 0.0125, 1.4870),
6: ('HB2' , 'HC' , 0.0125, 1.4870),
7: ('CG' , 'CT' , 0.0334, 1.9080),
8: ('HG3' , 'H1' , 0.0292, 1.3870),
9: ('HG2' , 'H1' , 0.0292, 1.3870),
10: ('SD' , 'S' , -0.2774, 2.0000),
11: ('CE' , 'CT' , -0.0341, 1.9080),
12: ('HE3' , 'H1' , 0.0597, 1.3870),
13: ('HE2' , 'H1' , 0.0597, 1.3870),
14: ('HE1' , 'H1' , 0.0597, 1.3870),
15: ('N' , 'N3' , 0.1592, 1.8240),
16: ('H3' , 'H' , 0.1984, 0.6000),
17: ('H2' , 'H' , 0.1984, 0.6000),
18: ('H1' , 'H' , 0.1984, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)S<10>[C@]<11>([H]<12>)([H]<13>)[H]<14>)C<15>([O-]<16>)=O<17>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2597, 1.9080),
3: ('HA' , 'H1' , 0.1277, 1.3870),
4: ('CB' , 'CT' , -0.0236, 1.9080),
5: ('HB3' , 'HC' , 0.0480, 1.4870),
6: ('HB2' , 'HC' , 0.0480, 1.4870),
7: ('CG' , 'CT' , 0.0492, 1.9080),
8: ('HG3' , 'H1' , 0.0317, 1.3870),
9: ('HG2' , 'H1' , 0.0317, 1.3870),
10: ('SD' , 'S' , -0.2692, 2.0000),
11: ('CE' , 'CT' , -0.0376, 1.9080),
12: ('HE3' , 'H1' , 0.0625, 1.3870),
13: ('HE2' , 'H1' , 0.0625, 1.3870),
14: ('HE1' , 'H1' , 0.0625, 1.3870),
15: ('C' , 'C' , 0.8013, 1.9080),
16: ('OXT' , 'O2' , -0.8105, 1.6612),
17: ('O' , 'O2' , -0.8105, 1.6612),
},
),
],
'PHE': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1C<8>([H]<9>)=C<10>([H]<11>)C<12>([H]<13>)=C<14>([H]<15>)C<16>=1[H]<17>)C<18>=O<19>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0024, 1.9080),
3: ('HA' , 'H1' , 0.0978, 1.3870),
4: ('CB' , 'CT' , -0.0343, 1.9080),
5: ('HB3' , 'HC' , 0.0295, 1.4870),
6: ('HB2' , 'HC' , 0.0295, 1.4870),
7: ('CG' , 'CA' , 0.0118, 1.9080),
8: ('CD2' , 'CA' , -0.1256, 1.9080),
9: ('HD2' , 'HA' , 0.1330, 1.4590),
10: ('CE2' , 'CA' , -0.1704, 1.9080),
11: ('HE2' , 'HA' , 0.1430, 1.4590),
12: ('CZ' , 'CA' , -0.1072, 1.9080),
13: ('HZ' , 'HA' , 0.1297, 1.4590),
14: ('CE1' , 'CA' , -0.1704, 1.9080),
15: ('HE1' , 'HA' , 0.1430, 1.4590),
16: ('CD1' , 'CA' , -0.1256, 1.9080),
17: ('HD1' , 'HA' , 0.1330, 1.4590),
18: ('C' , 'C' , 0.5973, 1.9080),
19: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1C<8>([H]<9>)=C<10>([H]<11>)C<12>([H]<13>)=C<14>([H]<15>)C<16>=1[H]<17>)[N@+]<18>([H]<19>)([H]<20>)[H]<21>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0733, 1.9080),
3: ('HA' , 'HP' , 0.1041, 1.1000),
4: ('CB' , 'CT' , 0.0330, 1.9080),
5: ('HB3' , 'HC' , 0.0104, 1.4870),
6: ('HB2' , 'HC' , 0.0104, 1.4870),
7: ('CG' , 'CA' , 0.0031, 1.9080),
8: ('CD2' , 'CA' , -0.1391, 1.9080),
9: ('HD2' , 'HA' , 0.1374, 1.4590),
10: ('CE2' , 'CA' , -0.1603, 1.9080),
11: ('HE2' , 'HA' , 0.1433, 1.4590),
12: ('CZ' , 'CA' , -0.1208, 1.9080),
13: ('HZ' , 'HA' , 0.1329, 1.4590),
14: ('CE1' , 'CA' , -0.1602, 1.9080),
15: ('HE1' , 'HA' , 0.1433, 1.4590),
16: ('CD1' , 'CA' , -0.1392, 1.9080),
17: ('HD1' , 'HA' , 0.1374, 1.4590),
18: ('N' , 'N3' , 0.1737, 1.8240),
19: ('H3' , 'H' , 0.1921, 0.6000),
20: ('H2' , 'H' , 0.1921, 0.6000),
21: ('H1' , 'H' , 0.1921, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1C<8>([H]<9>)=C<10>([H]<11>)C<12>([H]<13>)=C<14>([H]<15>)C<16>=1[H]<17>)C<18>([O-]<19>)=O<20>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.1825, 1.9080),
3: ('HA' , 'H1' , 0.1098, 1.3870),
4: ('CB' , 'CT' , -0.0959, 1.9080),
5: ('HB3' , 'HC' , 0.0443, 1.4870),
6: ('HB2' , 'HC' , 0.0443, 1.4870),
7: ('CG' , 'CA' , 0.0552, 1.9080),
8: ('CD2' , 'CA' , -0.1300, 1.9080),
9: ('HD2' , 'HA' , 0.1408, 1.4590),
10: ('CE2' , 'CA' , -0.1847, 1.9080),
11: ('HE2' , 'HA' , 0.1461, 1.4590),
12: ('CZ' , 'CA' , -0.0944, 1.9080),
13: ('HZ' , 'HA' , 0.1280, 1.4590),
14: ('CE1' , 'CA' , -0.1847, 1.9080),
15: ('HE1' , 'HA' , 0.1461, 1.4590),
16: ('CD1' , 'CA' , -0.1300, 1.9080),
17: ('HD1' , 'HA' , 0.1408, 1.4590),
18: ('C' , 'C' , 0.7660, 1.9080),
19: ('OXT' , 'O2' , -0.8026, 1.6612),
20: ('O' , 'O2' , -0.8026, 1.6612),
},
),
],
'PRO': [
(
'N<0>1[C@]<1>([H]<2>)([H]<3>)[C@]<4>([H]<5>)([H]<6>)[C@]<7>([H]<8>)([H]<9>)[C@@]<10>1([H]<11>)C<12>=O<13>',
{
0: ('N' , 'N' , -0.2548, 1.8240),
1: ('CD' , 'CT' , 0.0192, 1.9080),
2: ('HD3' , 'H1' , 0.0391, 1.3870),
3: ('HD2' , 'H1' , 0.0391, 1.3870),
4: ('CG' , 'CT' , 0.0189, 1.9080),
5: ('HG3' , 'HC' , 0.0213, 1.4870),
6: ('HG2' , 'HC' , 0.0213, 1.4870),
7: ('CB' , 'CT' , -0.0070, 1.9080),
8: ('HB3' , 'HC' , 0.0253, 1.4870),
9: ('HB2' , 'HC' , 0.0253, 1.4870),
10: ('CA' , 'CT' , -0.0266, 1.9080),
11: ('HA' , 'H1' , 0.0641, 1.3870),
12: ('C' , 'C' , 0.5896, 1.9080),
13: ('O' , 'O' , -0.5748, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>1([H]<3>)[C@@]<4>([H]<5>)([H]<6>)[C@@]<7>([H]<8>)([H]<9>)[C@@]<10>([H]<11>)([H]<12>)[N@@+]<13>1([H]<14>)[H]<15>',
{
0: ('C' , 'C' , 0.5260, 1.9080),
1: ('O' , 'O' , -0.5000, 1.6612),
2: ('CA' , 'CT' , 0.1000, 1.9080),
3: ('HA' , 'HP' , 0.1000, 1.1000),
4: ('CB' , 'CT' , -0.1150, 1.9080),
5: ('HB3' , 'HC' , 0.1000, 1.4870),
6: ('HB2' , 'HC' , 0.1000, 1.4870),
7: ('CG' , 'CT' , -0.1210, 1.9080),
8: ('HG3' , 'HC' , 0.1000, 1.4870),
9: ('HG2' , 'HC' , 0.1000, 1.4870),
10: ('CD' , 'CT' , -0.0120, 1.9080),
11: ('HD3' , 'H1' , 0.1000, 1.1000),
12: ('HD2' , 'H1' , 0.1000, 1.1000),
13: ('N' , 'N3' , -0.2020, 1.8240),
14: ('H3' , 'H' , 0.3120, 0.6000),
15: ('H2' , 'H' , 0.3120, 0.6000),
},
),
(
'N<0>1[C@]<1>([H]<2>)([H]<3>)[C@]<4>([H]<5>)([H]<6>)[C@]<7>([H]<8>)([H]<9>)[C@@]<10>1([H]<11>)C<12>([O-]<13>)=O<14>',
{
0: ('N' , 'N' , -0.2802, 1.8240),
1: ('CD' , 'CT' , 0.0434, 1.9080),
2: ('HD3' , 'H1' , 0.0331, 1.3870),
3: ('HD2' , 'H1' , 0.0331, 1.3870),
4: ('CG' , 'CT' , 0.0466, 1.9080),
5: ('HG3' , 'HC' , 0.0172, 1.4870),
6: ('HG2' , 'HC' , 0.0172, 1.4870),
7: ('CB' , 'CT' , -0.0543, 1.9080),
8: ('HB3' , 'HC' , 0.0381, 1.4870),
9: ('HB2' , 'HC' , 0.0381, 1.4870),
10: ('CA' , 'CT' , -0.1336, 1.9080),
11: ('HA' , 'H1' , 0.0776, 1.3870),
12: ('C' , 'C' , 0.6631, 1.9080),
13: ('OXT' , 'O2' , -0.7697, 1.6612),
14: ('O' , 'O2' , -0.7697, 1.6612),
},
),
],
'SER': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)O<7>[H]<8>)C<9>=O<10>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0249, 1.9080),
3: ('HA' , 'H1' , 0.0843, 1.3870),
4: ('CB' , 'CT' , 0.2117, 1.9080),
5: ('HB3' , 'H1' , 0.0352, 1.3870),
6: ('HB2' , 'H1' , 0.0352, 1.3870),
7: ('OG' , 'OH' , -0.6546, 1.7210),
8: ('HG' , 'HO' , 0.4275, 0.0000),
9: ('C' , 'C' , 0.5973, 1.9080),
10: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)O<7>[H]<8>)[N@+]<9>([H]<10>)([H]<11>)[H]<12>',
{
0: ('C' , 'C' , 0.6163, 1.9080),
1: ('O' , 'O' , -0.5722, 1.6612),
2: ('CA' , 'CT' , 0.0567, 1.9080),
3: ('HA' , 'HP' , 0.0782, 1.1000),
4: ('CB' , 'CT' , 0.2596, 1.9080),
5: ('HB3' , 'H1' , 0.0273, 1.3870),
6: ('HB2' , 'H1' , 0.0273, 1.3870),
7: ('OG' , 'OH' , -0.6714, 1.7210),
8: ('HG' , 'HO' , 0.4239, 0.0000),
9: ('N' , 'N3' , 0.1849, 1.8240),
10: ('H3' , 'H' , 0.1898, 0.6000),
11: ('H2' , 'H' , 0.1898, 0.6000),
12: ('H1' , 'H' , 0.1898, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)O<7>[H]<8>)C<9>([O-]<10>)=O<11>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2722, 1.9080),
3: ('HA' , 'H1' , 0.1304, 1.3870),
4: ('CB' , 'CT' , 0.1123, 1.9080),
5: ('HB3' , 'H1' , 0.0813, 1.3870),
6: ('HB2' , 'H1' , 0.0813, 1.3870),
7: ('OG' , 'OH' , -0.6514, 1.7210),
8: ('HG' , 'HO' , 0.4474, 0.0000),
9: ('C' , 'C' , 0.8113, 1.9080),
10: ('OXT' , 'O2' , -0.8132, 1.6612),
11: ('O' , 'O2' , -0.8132, 1.6612),
},
),
],
'THR': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@]<4>([H]<5>)(O<6>[H]<7>)[C@]<8>([H]<9>)([H]<10>)[H]<11>)C<12>=O<13>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0389, 1.9080),
3: ('HA' , 'H1' , 0.1007, 1.3870),
4: ('CB' , 'CT' , 0.3654, 1.9080),
5: ('HB' , 'H1' , 0.0043, 1.3870),
6: ('OG1' , 'OH' , -0.6761, 1.7210),
7: ('HG1' , 'HO' , 0.4102, 0.0000),
8: ('CG2' , 'CT' , -0.2438, 1.9080),
9: ('HG23', 'HC' , 0.0642, 1.4870),
10: ('HG22', 'HC' , 0.0642, 1.4870),
11: ('HG21', 'HC' , 0.0642, 1.4870),
12: ('C' , 'C' , 0.5973, 1.9080),
13: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@]<4>([H]<5>)(O<6>[H]<7>)[C@]<8>([H]<9>)([H]<10>)[H]<11>)[N@+]<12>([H]<13>)([H]<14>)[H]<15>',
{
0: ('C' , 'C' , 0.6163, 1.9080),
1: ('O' , 'O' , -0.5722, 1.6612),
2: ('CA' , 'CT' , 0.0034, 1.9080),
3: ('HA' , 'HP' , 0.1087, 1.1000),
4: ('CB' , 'CT' , 0.4514, 1.9080),
5: ('HB' , 'H1' , -0.0323, 1.3870),
6: ('OG1' , 'OH' , -0.6764, 1.7210),
7: ('HG1' , 'HO' , 0.4070, 0.0000),
8: ('CG2' , 'CT' , -0.2554, 1.9080),
9: ('HG23', 'HC' , 0.0627, 1.4870),
10: ('HG22', 'HC' , 0.0627, 1.4870),
11: ('HG21', 'HC' , 0.0627, 1.4870),
12: ('N' , 'N3' , 0.1812, 1.8240),
13: ('H3' , 'H' , 0.1934, 0.6000),
14: ('H2' , 'H' , 0.1934, 0.6000),
15: ('H1' , 'H' , 0.1934, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@]<4>([H]<5>)(O<6>[H]<7>)[C@]<8>([H]<9>)([H]<10>)[H]<11>)C<12>([O-]<13>)=O<14>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2420, 1.9080),
3: ('HA' , 'H1' , 0.1207, 1.3870),
4: ('CB' , 'CT' , 0.3025, 1.9080),
5: ('HB' , 'H1' , 0.0078, 1.3870),
6: ('OG1' , 'OH' , -0.6496, 1.7210),
7: ('HG1' , 'HO' , 0.4119, 0.0000),
8: ('CG2' , 'CT' , -0.1853, 1.9080),
9: ('HG23', 'HC' , 0.0586, 1.4870),
10: ('HG22', 'HC' , 0.0586, 1.4870),
11: ('HG21', 'HC' , 0.0586, 1.4870),
12: ('C' , 'C' , 0.7810, 1.9080),
13: ('OXT' , 'O2' , -0.8044, 1.6612),
14: ('O' , 'O2' , -0.8044, 1.6612),
},
),
],
'TRP': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>1=C<8>([H]<9>)N<10>([H]<11>)C<12>=2C<13>([H]<14>)=C<15>([H]<16>)C<17>([H]<18>)=C<19>([H]<20>)C<21>1=2)C<22>=O<23>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0275, 1.9080),
3: ('HA' , 'H1' , 0.1123, 1.3870),
4: ('CB' , 'CT' , -0.0050, 1.9080),
5: ('HB3' , 'HC' , 0.0339, 1.4870),
6: ('HB2' , 'HC' , 0.0339, 1.4870),
7: ('CG' , 'C*' , -0.1415, 1.9080),
8: ('CD1' , 'CW' , -0.1638, 1.9080),
9: ('HD1' , 'H4' , 0.2062, 1.4090),
10: ('NE1' , 'NA' , -0.3418, 1.8240),
11: ('HE1' , 'H' , 0.3412, 0.6000),
12: ('CE2' , 'CN' , 0.1380, 1.9080),
13: ('CZ2' , 'CA' , -0.2601, 1.9080),
14: ('HZ2' , 'HA' , 0.1572, 1.4590),
15: ('CH2' , 'CA' , -0.1134, 1.9080),
16: ('HH2' , 'HA' , 0.1417, 1.4590),
17: ('CZ3' , 'CA' , -0.1972, 1.9080),
18: ('HZ3' , 'HA' , 0.1447, 1.4590),
19: ('CE3' , 'CA' , -0.2387, 1.9080),
20: ('HE3' , 'HA' , 0.1700, 1.4590),
21: ('CD2' , 'CB' , 0.1243, 1.9080),
22: ('C' , 'C' , 0.5973, 1.9080),
23: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>1=C<8>([H]<9>)N<10>([H]<11>)C<12>=2C<13>([H]<14>)=C<15>([H]<16>)C<17>([H]<18>)=C<19>([H]<20>)C<21>1=2)[N@+]<22>([H]<23>)([H]<24>)[H]<25>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0421, 1.9080),
3: ('HA' , 'HP' , 0.1162, 1.1000),
4: ('CB' , 'CT' , 0.0543, 1.9080),
5: ('HB3' , 'HC' , 0.0222, 1.4870),
6: ('HB2' , 'HC' , 0.0222, 1.4870),
7: ('CG' , 'C*' , -0.1654, 1.9080),
8: ('CD1' , 'CW' , -0.1788, 1.9080),
9: ('HD1' , 'H4' , 0.2195, 1.4090),
10: ('NE1' , 'NA' , -0.3444, 1.8240),
11: ('HE1' , 'H' , 0.3412, 0.6000),
12: ('CE2' , 'CN' , 0.1575, 1.9080),
13: ('CZ2' , 'CA' , -0.2710, 1.9080),
14: ('HZ2' , 'HA' , 0.1589, 1.4590),
15: ('CH2' , 'CA' , -0.1080, 1.9080),
16: ('HH2' , 'HA' , 0.1411, 1.4590),
17: ('CZ3' , 'CA' , -0.2034, 1.9080),
18: ('HZ3' , 'HA' , 0.1458, 1.4590),
19: ('CE3' , 'CA' , -0.2265, 1.9080),
20: ('HE3' , 'HA' , 0.1646, 1.4590),
21: ('CD2' , 'CB' , 0.1132, 1.9080),
22: ('N' , 'N3' , 0.1913, 1.8240),
23: ('H3' , 'H' , 0.1888, 0.6000),
24: ('H2' , 'H' , 0.1888, 0.6000),
25: ('H1' , 'H' , 0.1888, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>1=C<8>([H]<9>)N<10>([H]<11>)C<12>=2C<13>([H]<14>)=C<15>([H]<16>)C<17>([H]<18>)=C<19>([H]<20>)C<21>1=2)C<22>([O-]<23>)=O<24>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2084, 1.9080),
3: ('HA' , 'H1' , 0.1272, 1.3870),
4: ('CB' , 'CT' , -0.0742, 1.9080),
5: ('HB3' , 'HC' , 0.0497, 1.4870),
6: ('HB2' , 'HC' , 0.0497, 1.4870),
7: ('CG' , 'C*' , -0.0796, 1.9080),
8: ('CD1' , 'CW' , -0.1808, 1.9080),
9: ('HD1' , 'H4' , 0.2043, 1.4090),
10: ('NE1' , 'NA' , -0.3316, 1.8240),
11: ('HE1' , 'H' , 0.3413, 0.6000),
12: ('CE2' , 'CN' , 0.1222, 1.9080),
13: ('CZ2' , 'CA' , -0.2594, 1.9080),
14: ('HZ2' , 'HA' , 0.1567, 1.4590),
15: ('CH2' , 'CA' , -0.1020, 1.9080),
16: ('HH2' , 'HA' , 0.1401, 1.4590),
17: ('CZ3' , 'CA' , -0.2287, 1.9080),
18: ('HZ3' , 'HA' , 0.1507, 1.4590),
19: ('CE3' , 'CA' , -0.1837, 1.9080),
20: ('HE3' , 'HA' , 0.1491, 1.4590),
21: ('CD2' , 'CB' , 0.1078, 1.9080),
22: ('C' , 'C' , 0.7658, 1.9080),
23: ('OXT' , 'O2' , -0.8011, 1.6612),
24: ('O' , 'O2' , -0.8011, 1.6612),
},
),
],
'TYR': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1C<8>([H]<9>)=C<10>([H]<11>)C<12>(O<13>[H]<14>)=C<15>([H]<16>)C<17>=1[H]<18>)C<19>=O<20>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0014, 1.9080),
3: ('HA' , 'H1' , 0.0876, 1.3870),
4: ('CB' , 'CT' , -0.0152, 1.9080),
5: ('HB3' , 'HC' , 0.0295, 1.4870),
6: ('HB2' , 'HC' , 0.0295, 1.4870),
7: ('CG' , 'CA' , -0.0011, 1.9080),
8: ('CD2' , 'CA' , -0.1906, 1.9080),
9: ('HD2' , 'HA' , 0.1699, 1.4590),
10: ('CE2' , 'CA' , -0.2341, 1.9080),
11: ('HE2' , 'HA' , 0.1656, 1.4590),
12: ('CZ' , 'CA' , 0.3226, 1.9080),
13: ('OH' , 'OH' , -0.5579, 1.7210),
14: ('HH' , 'HO' , 0.3992, 0.0000),
15: ('CE1' , 'CA' , -0.2341, 1.9080),
16: ('HE1' , 'HA' , 0.1656, 1.4590),
17: ('CD1' , 'CA' , -0.1906, 1.9080),
18: ('HD1' , 'HA' , 0.1699, 1.4590),
19: ('C' , 'C' , 0.5973, 1.9080),
20: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1C<8>([H]<9>)=C<10>([H]<11>)C<12>(O<13>[H]<14>)=C<15>([H]<16>)C<17>=1[H]<18>)[N@+]<19>([H]<20>)([H]<21>)[H]<22>',
{
0: ('C' , 'C' , 0.6123, 1.9080),
1: ('O' , 'O' , -0.5713, 1.6612),
2: ('CA' , 'CT' , 0.0570, 1.9080),
3: ('HA' , 'H1' , 0.0983, 1.1000),
4: ('CB' , 'CT' , 0.0659, 1.9080),
5: ('HB3' , 'HC' , 0.0102, 1.4870),
6: ('HB2' , 'HC' , 0.0102, 1.4870),
7: ('CG' , 'CA' , -0.0205, 1.9080),
8: ('CD2' , 'CA' , -0.2002, 1.9080),
9: ('HD2' , 'HA' , 0.1720, 1.4590),
10: ('CE2' , 'CA' , -0.2239, 1.9080),
11: ('HE2' , 'HA' , 0.1650, 1.4590),
12: ('CZ' , 'CA' , 0.3139, 1.9080),
13: ('OH' , 'OH' , -0.5578, 1.7210),
14: ('HH' , 'HO' , 0.4001, 0.0000),
15: ('CE1' , 'CA' , -0.2239, 1.9080),
16: ('HE1' , 'HA' , 0.1650, 1.4590),
17: ('CD1' , 'CA' , -0.2002, 1.9080),
18: ('HD1' , 'HA' , 0.1720, 1.4590),
19: ('N' , 'N' , 0.1940, 1.8240),
20: ('H3' , 'H' , 0.1873, 0.6000),
21: ('H2' , 'H' , 0.1873, 0.6000),
22: ('H1' , 'H' , 0.1873, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@@]<4>([H]<5>)([H]<6>)C<7>=1C<8>([H]<9>)=C<10>([H]<11>)C<12>(O<13>[H]<14>)=C<15>([H]<16>)C<17>=1[H]<18>)C<19>([O-]<20>)=O<21>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.2015, 1.9080),
3: ('HA' , 'H1' , 0.1092, 1.3870),
4: ('CB' , 'CT' , -0.0752, 1.9080),
5: ('HB3' , 'HC' , 0.0490, 1.4870),
6: ('HB2' , 'HC' , 0.0490, 1.4870),
7: ('CG' , 'CA' , 0.0243, 1.9080),
8: ('CD2' , 'CA' , -0.1922, 1.9080),
9: ('HD2' , 'HA' , 0.1780, 1.4590),
10: ('CE2' , 'CA' , -0.2458, 1.9080),
11: ('HE2' , 'HA' , 0.1673, 1.4590),
12: ('CZ' , 'CA' , 0.3395, 1.9080),
13: ('OH' , 'OH' , -0.5643, 1.7210),
14: ('HH' , 'HO' , 0.4017, 0.0000),
15: ('CE1' , 'CA' , -0.2458, 1.9080),
16: ('HE1' , 'HA' , 0.1673, 1.4590),
17: ('CD1' , 'CA' , -0.1922, 1.9080),
18: ('HD1' , 'HA' , 0.1780, 1.4590),
19: ('C' , 'C' , 0.7817, 1.9080),
20: ('OXT' , 'O2' , -0.8070, 1.6612),
21: ('O' , 'O' , -0.8070, 1.6612),
},
),
],
'VAL': [
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@]<4>([H]<5>)([C@]<6>([H]<7>)([H]<8>)[H]<9>)[C@]<10>([H]<11>)([H]<12>)[H]<13>)C<14>=O<15>',
{
0: ('N' , 'N' , -0.4157, 1.8240),
1: ('H' , 'H' , 0.2719, 0.6000),
2: ('CA' , 'CT' , -0.0875, 1.9080),
3: ('HA' , 'H1' , 0.0969, 1.3870),
4: ('CB' , 'CT' , 0.2985, 1.9080),
5: ('HB' , 'HC' , -0.0297, 1.4870),
6: ('CG2' , 'CT' , -0.3192, 1.9080),
7: ('HG23', 'HC' , 0.0791, 1.4870),
8: ('HG22', 'HC' , 0.0791, 1.4870),
9: ('HG21', 'HC' , 0.0791, 1.4870),
10: ('CG1' , 'CT' , -0.3192, 1.9080),
11: ('HG13', 'HC' , 0.0791, 1.4870),
12: ('HG12', 'HC' , 0.0791, 1.4870),
13: ('HG11', 'HC' , 0.0791, 1.4870),
14: ('C' , 'C' , 0.5973, 1.9080),
15: ('O' , 'O' , -0.5679, 1.6612),
},
),
(
'C<0>(=O<1>)[C@]<2>([H]<3>)([C@]<4>([H]<5>)([C@]<6>([H]<7>)([H]<8>)[H]<9>)[C@]<10>([H]<11>)([H]<12>)[H]<13>)[N@+]<14>([H]<15>)([H]<16>)[H]<17>',
{
0: ('C' , 'C' , 0.6163, 1.9080),
1: ('O' , 'O' , -0.5722, 1.6612),
2: ('CA' , 'CT' , -0.0054, 1.9080),
3: ('HA' , 'HP' , 0.1093, 1.1000),
4: ('CB' , 'CT' , 0.3196, 1.9080),
5: ('HB' , 'HC' , -0.0221, 1.4870),
6: ('CG2' , 'CT' , -0.3129, 1.9080),
7: ('HG23', 'HC' , 0.0735, 1.4870),
8: ('HG22', 'HC' , 0.0735, 1.4870),
9: ('HG21', 'HC' , 0.0735, 1.4870),
10: ('CG1' , 'CT' , -0.3129, 1.9080),
11: ('HG13', 'HC' , 0.0735, 1.4870),
12: ('HG12', 'HC' , 0.0735, 1.4870),
13: ('HG11', 'HC' , 0.0735, 1.4870),
14: ('N' , 'N3' , 0.0577, 1.8240),
15: ('H3' , 'H' , 0.2272, 0.6000),
16: ('H2' , 'H' , 0.2272, 0.6000),
17: ('H1' , 'H' , 0.2272, 0.6000),
},
),
(
'N<0>([H]<1>)[C@@]<2>([H]<3>)([C@]<4>([H]<5>)([C@]<6>([H]<7>)([H]<8>)[H]<9>)[C@]<10>([H]<11>)([H]<12>)[H]<13>)C<14>([O-]<15>)=O<16>',
{
0: ('N' , 'N' , -0.3821, 1.8240),
1: ('H' , 'H' , 0.2681, 0.6000),
2: ('CA' , 'CT' , -0.3438, 1.9080),
3: ('HA' , 'H1' , 0.1438, 1.3870),
4: ('CB' , 'CT' , 0.1940, 1.9080),
5: ('HB' , 'HC' , 0.0308, 1.4870),
6: ('CG2' , 'CT' , -0.3064, 1.9080),
7: ('HG23', 'HC' , 0.0836, 1.4870),
8: ('HG22', 'HC' , 0.0836, 1.4870),
9: ('HG21', 'HC' , 0.0836, 1.4870),
10: ('CG1' , 'CT' , -0.3064, 1.9080),
11: ('HG13', 'HC' , 0.0836, 1.4870),
12: ('HG12', 'HC' , 0.0836, 1.4870),
13: ('HG11', 'HC' , 0.0836, 1.4870),
14: ('C' , 'C' , 0.8350, 1.9080),
15: ('OXT' , 'O2' , -0.8173, 1.6612),
16: ('O' , 'O2' , -0.8173, 1.6612),
},
),
],
'WAT': [
(
'O<0>([H]<1>)[H]<2>',
{
0: ('O' , 'OW' , -0.8340, 1.6612),
1: ('H1' , 'HW' , 0.4170, 0.0000),
2: ('H2' , 'HW' , 0.4170, 0.0000),
},
),
],
'HOH': [
(
'O<0>([H]<1>)[H]<2>',
{
0: ('O' , 'OW' , -0.8340, 1.6612),
1: ('H1' , 'HW' , 0.4170, 0.0000),
2: ('H2' , 'HW' , 0.4170, 0.0000),
},
),
],
'TIP': [
(
'O<0>([H]<1>)[H]<2>',
{
0: ('O' , 'OW' , -0.8340, 1.6612),
1: ('H1' , 'HW' , 0.4170, 0.0000),
2: ('H2' , 'HW' , 0.4170, 0.0000),
},
),
],
}
# also want commong residues like PTyr, PSer,
# missing neutrals GLUH/GLUN,GLH, ASPH/ASH/ASPN, LYSN, ARGN
for alias in (
( 'HIE', 'HIS'), # default HIS is HISE
( 'HISE', 'HIS'),
( 'HISD', 'HID'),
( 'HISP', 'HIP'),
( 'GLUM', 'GLU'), # default -1
( 'ASPM', 'ASP'), # default -1
( 'LYSP', 'LYS'), # default +1
( 'ARGP', 'ARG'), # default +1
):
amber99_dict[alias[0]] = amber99_dict[alias[1]]
|
s=[]
for x in range(6):
s.append(input())
a=[]
sizes=[]
for x in s:
a.append(x.split())
row=[]
sum1=[]
w=[]
for k in range(4):
for z in range(4):
e=[]
for x in range(3):
e.append(a[x+k][z])
e.append(a[x+k][z+1])
e.append(a[x+k][z+2])
w.append(e)
sums=[]
for x in range(16):
c=0
for y in range(9):
if y!=3 and y!=5:
c+=int(w[x][y])
sums.append(c)
max1=-63
for x in sums:
if x>max1:
max1=x
print(max1)
|
"""Exercício Python 104: Crie um programa que tenha a função leiaInt(),
que vai funcionar de forma semelhante ‘a função input() do Python,
só que fazendo a validação para aceitar apenas um valor numérico.
Ex: n = leiaInt(‘Digite um n: ‘)"""
def leiaint(msg):
ok = False
valor = 0
while True:
n = str(input(msg))
if n.isnumeric():
valor = int(n)
ok = True
else:
print('\33[0;31mERRO! Digite apenas números!\33[m')
if ok:
break
return valor
n = leiaint('Digite um numero: ')
print(f'Você Digitou {n}') |
# TODO: Add some sort of benchmarks
array_of_numbers = [4, 6, 1, 0]
def merge(right, left, output=list()):
"""
This function merges two sorted lists.
:param right:
:param left:
:param output:
:return:
"""
if not right and not left:
return output
if left:
left_min = min(left)
else:
left_min = min(right) + 1
if right:
right_min = min(right)
else:
right_min = left_min + 1
if left_min > right_min:
right.remove(right_min)
output.append(right_min)
elif right_min > left_min:
left.remove(left_min)
output.append(left_min)
elif right_min == left_min:
right.remove(right_min)
left.remove(left_min)
output.append(left_min)
output.append(right_min)
return merge(right, left, output)
def merge_sort(array_of_numbers):
"""
This should split the array into single numbers and then recombine
the list into a single sorted list in a recursive way.
:param array_of_numbers:
:return:
"""
length = len(array_of_numbers)
split = int(length/2)
if length <= 1:
return array_of_numbers
left = merge_sort(array_of_numbers[:split])
right = merge_sort(array_of_numbers[split:])
return merge(right, left, output=[])
if __name__ == '__main__':
sorted_ = merge_sort(array_of_numbers)
print(sorted_)
|
def g(x):
return x**2
def gp(x):
return 2*x
def gpp(x):
return 2
def h(x):
return 0.5*(x[0]**2 + x[1]**2)
def H(X,Y):
return 0.5*(X**2 + Y**2)
|
# -*- encoding: utf-8 -*-
__all__ = [
'validate_page',
]
def validate_page(text: str) -> bool:
result = True
preps = [
text == '{"error":"Not Found"}',
"<title>Группы Google</title>" in text,
'<title>Git and Mercurial code management for teams</title>' in text,
"- Google Project Hosting" in text,
]
if any(preps):
result = False
return result
|
class Solution:
def reverseParentheses(self, s: str) -> str:
stack = ['']
for c in s:
if c == '(':
stack.append('')
elif c == ')':
add = stack.pop()[::-1]
stack[-1] += add
else:
stack[-1] += c
return stack.pop() |
"""
Created on Jul 11, 2016
@author: ramseylab
"""
REGULAR_CHR_ID = set([str(x) for x in range(1, 23)] + ["X", "Y"]) # range(1,23) = 1,2,...,22
REGULAR_CHR = {("chr" + str(x)) for x in REGULAR_CHR_ID}
HOMO_SAPIENS_MITO_SEQ = "chrM"
HAPLOTYPE_CHR = {
"chr6_apd_hap1",
"chr6_cox_hap2",
"chr6_dbb_hap3",
"chr6_mann_hap4",
"chr6_mcf_hap5",
"chr6_qbl_hap6",
"chr6_ssto_hap7",
"chr4_ctg9_hap1",
"chr17_ctg5_hap1"
}
CONTIG_LOCALIZED_SUFFIX = "random"
CONTIG_UNKNOWN_PREFIX = "chrUn"
# Assembly Statistics for GRCh38.p7
# Release date: March 21, 2016
# See http://www.ncbi.nlm.nih.gov/projects/genome/assembly/grc/human/data/
CHR_LENGTH = {
'chr1': 248956422,
'chr2': 243199373,
'chr3': 198295559,
'chr4': 190214555,
'chr5': 181538259,
'chr6': 170805979,
'chr7': 159345973,
'chr8': 145138636,
'chr9': 138394717,
'chr10': 133797422,
'chr11': 135086622,
'chr12': 133275309,
'chr13': 114364328,
'chr14': 107043718,
'chr15': 101991189,
'chr16': 90338345,
'chr17': 83257441,
'chr18': 80373285,
'chr19': 58617616,
'chr20': 64444167,
'chr21': 46709983,
'chr22': 50818468,
'chrX': 156040895,
'chrY': 57227415
}
def remove_dup_on_chrY(snp_dfm, verbose=True):
"""
It is known that each of "rs700442", "rs5989681" and "rs4446909" has 2 entries in
snp146, hg19 of UCSC Genome Browser, one on chrX and the other chrY.
Remove the one on chrY as suggested by Steve:
> I would just use the ChrX entry, for this SNP.
> My reasoning: we very likely don't have haplotype data for chrY.
"""
is_dup = snp_dfm.duplicated(subset="name", keep=False)
on_chrY = (snp_dfm.loc[:, "chrom"] == "chrY")
if verbose and is_dup.any():
print("remove_dup_on_chrY: duplication detected: \r\n%s" % snp_dfm.loc[is_dup, :])
snp_dfm = snp_dfm.drop(snp_dfm[is_dup & on_chrY].index)
still_dup = snp_dfm.duplicated(subset="name", keep=False)
assert not still_dup.any(), "remove_dup_on_chrY: still duplicated after removal: \r\n%s" % snp_dfm.loc[still_dup, :]
return snp_dfm
|
intro_list= [
"Hi there, sir looking forward to see you",
"Greetings sir, welcome back",
"Hey There, what took you so long,i was waiting for you",
"How’s everything going sir? ",
"Good to see you sir, you look amazeing today",
"Great to see you. i hope you are having a nice day sir",
"Nice to see you sir ",
"where have you been sir?",
"Nice to see you again sir",
"How are you holding up?",
"Sir it’s been a while!",
"This may be recorded for training purpose",
"At least, we meet for the first time for the last time!",
"It’s a Pleasure to Meet You sir",
"How are you feeling today sir?",
"Welcome back sir",
"Hi, mister! What is going on?",
"Hello-hello! Who’s there? It’s me sofia talking",
"Knock knock…who is there? It’s me, sofia!",
"What’s up with you, old soul? Wanna chat?",
"Welcome to the club, boss!",
"Hey mister, how do you do?",
"Hey Einstein, still cracking the old theory?",
"What’s smokin’? Tell me everything!",
"Hey sir! What’s the latest buzz in your world?",
]
morning_data=[
"Let the morning dewdrops that wash away the burdens of yesterday. May god sprinkle much of these on you today! Good morning!",
"Enjoy life – now! Good morning",
"Give your day meaning by setting a goal. Then, work towards achieving that goal. Wishing you a very good morning!",
"Wishing you a day full of sunny smiles and happy thoughts. Good morning!",
"This is not just another day. It is yet another chance to make your dreams come true. Get up and get started. Good morning!",
"You cannot change yesterday, you cannot predict tomorrow. Today is the only gift you have. That is why we call it the “present”. Have a good day!",
"The chirping birds, the morning bells, the clear blue skies, new things to tell. Morning is here! Have a wonderful one!",
"Sunshine is the best medicine. Here’s to a fresh start on this gorgeous new day!",
"Seize the day with all your might, as you awaken from a peaceful night. Take on life’s challenges with a confident heart, for each day is a brand new start. Good morning!",
"May this day bring new opportunities and successes for you. Good morning!",
"Happy thoughts are the only cure for a sleepy morning…I feel the happiest when I think about you. Happy morning!",
"Yesterday is miles away, and today is a new today. With new goals to meet, let’s rise and jump to our feet. Good Morning!",
"It’s a new day! Add in the positive thoughts, subtract out the negative energy. Make it all equal to one fantastic day!",
"It’s a brand new morning! The day is a blank canvas yet to be painted with the colors of life. Seize the day! Good morning!",
"You are the secret ingredient to my happy day. Rise and shine, cutie!",
"A little hello and lots of love to start your day. Have a beautiful morning and an amazing day ahead. ",
"Growing old with you is my dream destination, Glorifying morning to my living world!",
"You are my shining light. Now, it’s time to wake up and show the world your magic!",
"Just the thought of you brightens up my morning. Good morning!",
"Just like how a beautiful morning is incomplete without its orange hue, my morning is incomplete without texting you. Good morning!",
" Good morning, sir. Here is my morning tip: you need no makeup. You will be messing with perfection. Love you!",
"If it were up to me to rearrange the alphabets, I would keep U & I together. Good Morning!",
"Begin this day with a cup full of positive thoughts, a spoonful of energy, and a jar full of love. Have a beautiful day. Good morning!",
"You know that moment when you wake up in the morning rejuvenated and full of energy? Yeah, me neither.",
"I could totally be a morning person. Only if mornings happened at noon. Good morning!",
"Have you seen my reason for waking up in the morning? Oh, there you are!",
"I believe there should be a better way to start each day – instead of waking up every morning",
"As the day begins, remember that I am your friend…you’re welcome!",
"Someday, you will be a morning person! But, not today. Go back to sleep!"
]
afternoon_data =[
"Have a good afternoon and a great day! sir",
"I am always thinking about you. Have a great afternoon sir",
"You are as bright as the afternoon sun",
"The afternoon is when the day starts to slow down. Enjoy yourself!",
"Enjoy this time of day and the blessings that it brings. ",
"Here’s a wish for a fun afternoon and the gentle breeze that comes with it",
"Half of the day is over; have a marvelous afternoon and enjoy the rest of the day! ",
"Good morning, afternoon, evening, and night. The day is more complete with you.",
"May this afternoon bring you delightful surprises.",
"Wishing you a happy day and a fabulous afternoon!",
"May this beautiful afternoon fill your heart with happiness!",
"I can only wish you all the best all day long.",
"Today, there will be a beautiful sunset after you have a good afternoon!",
"I would like to wish you a good afternoon and an even better evening ",
"May your afternoon be filled with light, love, and happiness.",
"Leave me a smile just warm enough to spend a million golden afternoons in."
"Under certain circumstances there are few hours in life more agreeable than the hour dedicated to the ceremony known as afternoon tea",
"Be bright like the afternoon sun and let everyone who sees you feel inspired by all the great things you do. You have one life here on earth. Make it count in whatever way you can.",
"You could get a simple idea one afternoon that could completely change your life. Great innovators just needed one idea to change everything. Keep striving and you will reach success. ",
"I’m never any good in the morning. It is only after four in the afternoon that I get going"
]
evening_data = [
"Good evening! I hope you had a good and productive day.",
"No matter how bad your day has been, the beauty of the setting sun will make everything serene. Good evening.",
"May the setting sun take down all your sufferings with it and make you hopeful for a new day. Good evening!",
"It doesn’t matter how hectic your day was, you can’t help admiring the beauty of this evening. I hope you are having a good time right now! Good evening!",
"Whether your day was good or bad, it has come to an end. Good evening and good luck for tomorrow.",
"Evening is a good time to look back at your day and think about all the things that you have done. Enjoy your evening with positive thoughts.",
"Happiness can’t be behind sorrow, It is your choice to make a better tomorrow, Enjoy this beautiful day with a lovely smile, Good evening!",
"Evenings are your chance to forget the mistakes you made during the day, so for the sweetest of dreams, you can have the way. Good evening!",
"Evening is a good time to look back at the day and think about all the good things you have done. I wish you an evening so full of satisfaction and inspiration",
"Good evening my friend, take a sip of your coffee and forget the troubles of the day.",
"It’s a perfect time to get rid of your worries and make yourself prepared for what’s coming tomorrow. Make this evening the beginning of a wonderful journey.",
"The sun sets every evening with a promise to rise up once again at every dawn. Evenings are so full of hope and inspiration. Wishing you a very wonderful evening!",
"Look at the sunset and then smile, Look at the horizon and smile, Enjoy this beautiful evening today, And have a nice time, Good evening to you!",
"I hope you are having a refreshing evening as I am having here thinking of you. Good evening, sir",
"Sometimes the best thing you can do is not think no wonder, not imagine and not obsess. Just breathe and have faith that everything will work out for the best. Good evening!",
"Evening is the time for peace, Where there is no tension to cease, On this evening, I want to wish you, That you have a good evening!",
"I know today was hard for you but I also know that tomorrow will come with new hopes and aspirations. Good evening sir, keep fighting.",
"You don’t need beautiful weather to enjoy this evening. What you need is to kill a lot of mosquitoes so I can relax and have my coffee in peace! Good evening!",
"Evening is special Not because it is the coolest time of the day, But, it lets you reflect on your day and forget your yesterday, Good evening!",
"Evenings are always full of motivations and a new chance to look forward to the good times. So, never waste it sir. Have a warm evening.",
"The evening’s the best part of the day. You’ve done your day’s work. Now you can put your feet up and enjoy it",
"Come in the evening, or come in the morning; Come when you’re looked for, or come without warning",
"Stop stressing about your sore day and enjoy the cool breeze of the fascinating evening. Eat lots of good food and cherish your evening well. Have a great time, sir",
"Follow the rhythm of your heart, Heart takes you to the destination, Where your goodness dwells, Have a happy evening",
"",
]
voice_error = [
"Sorry, I didn’t understand. Could you say that again, please? ",
"Sorry, I didn’t catch that. Could you repeat a little louder, please? ",
"I don’t know that word, could you please tell me what it means?",
"I can’t hear you very well. Could you speak up, please? ",
"Sorry, English is not my first language. Would you mind repeating that once more?",
"Sorry, my English is not that great. Would you mind speaking more slowly?",
"Sorry, I’m afraid I don’t follow you.",
"Excuse me, could you repeat once more",
"I’m sorry, I don’t understand. Could you say it again?",
"I’m sorry, I didn’t catch that. Would you mind speaking more slowly?",
"I’m confused. Could you tell me again?",
"I’m sorry, I didn’t understand. Could you repeat a little louder, please?",
"I didn’t hear you. Please could you tell me again?",
"I can’t make head nor tail of what you’re saying. can you please tell me more spacific",
"Sorry i did not hear your voice properly. can you please repeat it again ",
]
voice_NO = [
"Sounds great, but I can’t commit.",
"It’s not feasible for me to take this on",
"Let me think about it and I’ll get back to you",
"I’ve got too much on my plate right now",
"Bandwidth is low, so I won’t be able to make it work",
"I’m not taking on new things",
"Another time might work",
"I’m not sure I’m the best for it",
"I don’t think I’m the right person for that",
"I wish I could make it work",
"No thanks, I won’t be able to make it",
"Apologies, but I can’t make it",
"I’d love to — but can’t.",
] |
def print_numeric_list(number_list):
print('------------------ START LIST ------------------')
for number in number_list:
print('{} -> {}'.format(number_list.index(number), number))
print('------------------ END LIST ------------------')
numberList = [1]
print_numeric_list(numberList)
numberList.append(34)
print_numeric_list(numberList)
|
class Solution:
def multiply(self, num1: str, num2: str) -> str:
s = [0] * (len(num1) + len(num2))
for i in reversed(range(len(num1))):
for j in reversed(range(len(num2))):
mult = int(num1[i]) * int(num2[j])
summ = mult + s[i + j + 1]
s[i + j] += summ // 10
s[i + j + 1] = summ % 10
for i, c in enumerate(s):
if c != 0:
break
return ''.join(map(str, s[i:]))
|
# -*- coding: utf-8 -*-
"""
Author: Michael Markus Ackermann
================================
Metadata strings
"""
# For air class
temp_md = ("Enverioment temperature", "Should be Celsius degrees [°C]")
hum_md = ("Relative humidity", "Should be in as percentage [%]")
atm_md = ("Atmospheric pressure", "Should be in Pascals [Pa]")
kappa_md = ("Kappa", "Constant")
air_c_md = ("Gas constant for air", "Should be in [J/K/kg]")
water_c_md = ("Gas constant for water steam", "Should be in [J/K/kg]")
# For material class
air_md = ("Air object", "Pyaborp.Air instance")
thick_md = ("Material thickness", "Should be in [m]")
poro_md = ("Material porosity", "Should be between 0 an 1")
tortu_md = ("Material tortuosity", "Material tortuosity")
flow_md = ("Static flow resistivity", "Should be in [Ns/(m^4)]")
th_l_md = ("Thermal length", "Thermal characteristic length [m]")
vs_l_md = ("Viscosity length", "Viscous characteristic length [m]")
th_p_md = ("Thermal permeability", "Static thermal permeability [m^2]")
shape_md = ("Shape", "The shape of the must be a 'circle', 'square', \
'equilateral triangular' or 'retangular'")
freq_md = ("Frequencies", "Should be an array of frequencies")
|
ANSI_TKL = [
{'Key': 'Key.esc', 'Pos': [0, 0], 'Size': [1, 1], },
{'Key': "SPACER", 'Pos': [0, 1], 'Size': [1, 1], }, # Spacer
{'Key': 'Key.f1', 'Pos': [0, 2], 'Size': [1, 1], },
{'Key': 'Key.f2', 'Pos': [0, 3], 'Size': [1, 1], },
{'Key': 'Key.f3', 'Pos': [0, 4], 'Size': [1, 1], },
{'Key': 'Key.f4', 'Pos': [0, 5], 'Size': [1, 1], },
{'Key': "SPACER", 'Pos': [0, 6], 'Size': [1, 0.5], }, # Spacer
{'Key': 'Key.f5', 'Pos': [0, 6.5], 'Size': [1, 1], },
{'Key': 'Key.f6', 'Pos': [0, 7.5], 'Size': [1, 1], },
{'Key': 'Key.f7', 'Pos': [0, 8.5], 'Size': [1, 1], },
{'Key': 'Key.f8', 'Pos': [0, 9.5], 'Size': [1, 1], },
{'Key': "SPACER", 'Pos': [0, 10.5], 'Size': [1, 0.5], }, # Spacer
{'Key': 'Key.f9', 'Pos': [0, 11], 'Size': [1, 1], },
{'Key': 'Key.f10', 'Pos': [0, 12], 'Size': [1, 1], },
{'Key': 'Key.f11', 'Pos': [0, 13], 'Size': [1, 1], },
{'Key': 'Key.f12', 'Pos': [0, 14], 'Size': [1, 1], },
{'Key': "SPACER", 'Pos': [0, 15], 'Size': [1, 0.25], }, # Spacer
{'Key': 'Key.print_screen', 'Pos': [0, 15.25], 'Size': [1, 1], },
{'Key': 'Key.scroll_lock', 'Pos': [0, 16.25], 'Size': [1, 1], },
{'Key': 'Key.pause', 'Pos': [0, 17.25], 'Size': [1, 1], },
{'Key': "SPACER", 'Pos': [1, 0], 'Size': [0.5, 18.25]},
{'Key': '`', 'Pos': [2, 0], 'Shift': '~', 'Size': [1, 1], },
{'Key': '1', 'Pos': [2, 1], 'Shift': '!', 'Size': [1, 1], },
{'Key': '2', 'Pos': [2, 2], 'Shift': '@', 'Size': [1, 1], },
{'Key': '3', 'Pos': [2, 3], 'Shift': '#', 'Size': [1, 1], },
{'Key': '4', 'Pos': [2, 4], 'Shift': '$', 'Size': [1, 1], },
{'Key': '5', 'Pos': [2, 5], 'Shift': '%', 'Size': [1, 1], },
{'Key': '6', 'Pos': [2, 6], 'Shift': '^', 'Size': [1, 1], },
{'Key': '7', 'Pos': [2, 7], 'Shift': '&', 'Size': [1, 1], },
{'Key': '8', 'Pos': [2, 8], 'Shift': '*', 'Size': [1, 1], },
{'Key': '9', 'Pos': [2, 9], 'Shift': '(', 'Size': [1, 1], },
{'Key': '0', 'Pos': [2, 10], 'Shift': ')', 'Size': [1, 1], },
{'Key': '-', 'Pos': [2, 11], 'Shift': '_', 'Size': [1, 1], },
{'Key': '=', 'Pos': [2, 12], 'Shift': '+', 'Size': [1, 1], },
{'Key': 'Key.backspace', 'Pos': [2, 13], 'Size': [1, 2], },
{'Key': "SPACER", 'Pos': [2, 15], 'Size': [1, 0.25], }, # Spacer
{'Key': 'Key.insert', 'Pos': [2, 15.25], 'Size': [1, 1], },
{'Key': 'Key.home', 'Pos': [2, 16.25], 'Size': [1, 1], },
{'Key': 'Key.page_up', 'Pos': [2, 17.25], 'Size': [1, 1], },
{'Key': 'Key.tab', 'Pos': [3, 0], 'Size': [1, 1.5], },
{'Key': 'q', 'Pos': [3, 1.5], 'Shift': 'Q', 'Size': [1, 1], },
{'Key': 'w', 'Pos': [3, 2.5], 'Shift': 'W', 'Size': [1, 1], },
{'Key': 'e', 'Pos': [3, 3.5], 'Shift': 'E', 'Size': [1, 1], },
{'Key': 'r', 'Pos': [3, 4.5], 'Shift': 'R', 'Size': [1, 1], },
{'Key': 't', 'Pos': [3, 5.5], 'Shift': 'T', 'Size': [1, 1], },
{'Key': 'y', 'Pos': [3, 6.5], 'Shift': 'Y', 'Size': [1, 1], },
{'Key': 'u', 'Pos': [3, 7.5], 'Shift': 'U', 'Size': [1, 1], },
{'Key': 'i', 'Pos': [3, 8.5], 'Shift': 'I', 'Size': [1, 1], },
{'Key': 'o', 'Pos': [3, 9.5], 'Shift': 'O', 'Size': [1, 1], },
{'Key': 'p', 'Pos': [3, 10.5], 'Shift': 'P', 'Size': [1, 1], },
{'Key': '[', 'Pos': [3, 11.5], 'Shift': '{', 'Size': [1, 1], },
{'Key': ']', 'Pos': [3, 12.5], 'Shift': '}', 'Size': [1, 1], },
{'Key': '\\', 'Pos': [3, 13.5], 'Shift': '|', 'Size': [1, 1.5], },
{'Key': "SPACER", 'Pos': [3, 15], 'Size': [1, 0.25], }, # Spacer
{'Key': 'Key.delete', 'Pos': [3, 15.25], 'Size': [1, 1], },
{'Key': 'Key.end', 'Pos': [3, 16.25], 'Size': [1, 1], },
{'Key': 'Key.page_down', 'Pos': [3, 17.25], 'Size': [1, 1], },
{'Key': 'Key.caps_lock', 'Pos': [4, 0], 'Size': [1, 1.75], },
{'Key': 'a', 'Pos': [4, 1.75], 'Shift': 'A', 'Size': [1, 1], },
{'Key': 's', 'Pos': [4, 2.75], 'Shift': 'S', 'Size': [1, 1], },
{'Key': 'd', 'Pos': [4, 3.75], 'Shift': 'D', 'Size': [1, 1], },
{'Key': 'f', 'Pos': [4, 4.75], 'Shift': 'F', 'Size': [1, 1], },
{'Key': 'g', 'Pos': [4, 5.75], 'Shift': 'G', 'Size': [1, 1], },
{'Key': 'h', 'Pos': [4, 6.75], 'Shift': 'H', 'Size': [1, 1], },
{'Key': 'j', 'Pos': [4, 7.75], 'Shift': 'J', 'Size': [1, 1], },
{'Key': 'k', 'Pos': [4, 8.75], 'Shift': 'K', 'Size': [1, 1], },
{'Key': 'l', 'Pos': [4, 9.75], 'Shift': 'L', 'Size': [1, 1], },
{'Key': ';', 'Pos': [4, 10.75], 'Shift': ':', 'Size': [1, 1], },
{'Key': "'", 'Pos': [4, 11.75], 'Shift': '"', 'Size': [1, 1], },
{'Key': 'Key.enter', 'Pos': [4, 12.75], 'Size': [1, 2.25], },
{'Key': 'Key.shift', 'Pos': [5, 0], 'Size': [1, 2.25], },
{'Key': 'z', 'Pos': [5, 2.25], 'Shift': 'Z', 'Size': [1, 1], },
{'Key': 'x', 'Pos': [5, 3.25], 'Shift': 'X', 'Size': [1, 1], },
{'Key': 'c', 'Pos': [5, 4.25], 'Shift': 'C', 'Size': [1, 1], },
{'Key': 'v', 'Pos': [5, 5.25], 'Shift': 'V', 'Size': [1, 1], },
{'Key': 'b', 'Pos': [5, 6.25], 'Shift': 'B', 'Size': [1, 1], },
{'Key': 'n', 'Pos': [5, 7.25], 'Shift': 'N', 'Size': [1, 1], },
{'Key': 'm', 'Pos': [5, 8.25], 'Shift': 'M', 'Size': [1, 1], },
{'Key': ',', 'Pos': [5, 9.25], 'Shift': '<', 'Size': [1, 1], },
{'Key': '.', 'Pos': [5, 10.25], 'Shift': '>', 'Size': [1, 1], },
{'Key': '/', 'Pos': [5, 11.25], 'Shift': '?', 'Size': [1, 1], },
{'Key': 'Key.shift_r', 'Pos': [5, 12.25], 'Size': [1, 2.75], },
{'Key': "SPACER", 'Pos': [5, 15], 'Size': [1, 1.25], }, # Spacer
{'Key': 'Key.up', 'Pos': [5, 16.25], 'Size': [1, 1], },
{'Key': 'Key.ctrl_l', 'Pos': [6, 0], 'Size': [1, 1.25], },
{'Key': 'Key.cmd', 'Pos': [6, 1.25], 'Size': [1, 1.25], },
{'Key': 'Key.alt_l', 'Pos': [6, 2.5], 'Size': [1, 1.25], },
{'Key': 'Key.space', 'Pos': [6, 3.75], 'Size': [1, 6.25], },
{'Key': 'Key.alt_gr', 'Pos': [6, 10], 'Size': [1, 1.25], },
{'Key': 'Key.cmd_r', 'Pos': [6, 11.25], 'Size': [1, 1.25], },
{'Key': "SPACER", 'Pos': [6, 12.5], 'Size': [1, 1.25], }, # Spacer (Menu Key doesn't show?)
{'Key': 'Key.ctrl_r', 'Pos': [6, 13.75], 'Size': [1, 1.25], },
{'Key': "SPACER", 'Pos': [6, 15.75], 'Size': [1, 0.25], }, # Spacer
{'Key': 'Key.left', 'Pos': [6, 15.25], 'Size': [1, 1], },
{'Key': 'Key.down', 'Pos': [6, 16.25], 'Size': [1, 1], },
{'Key': 'Key.right', 'Pos': [6, 17.25], 'Size': [1, 1], },
]
|
"""
Simulation of Buffon's Coin Problem.
"""
def predict_prob(diameter=1.0, gap_width=1.0):
"""
Predicts the probability that the coin will hit
the grid.
"""
d = diameter
D = gap_width
if d >= D:
return 1.0
else:
return (
1.0 -
(D - d) ** 2 /
D ** 2
)
|
# V0
# V1
# https://blog.csdn.net/qq_32424059/article/details/86998300
class MyCircularQueue(object):
def __init__(self, k):
"""
Initialize your data structure here. Set the size of the queue to be k.
:type k: int
"""
self.queue = [""] * k
self.max_length = k
self.start = -1
self.end = -1
def enQueue(self, value):
"""
Insert an element into the circular queue. Return true if the operation is successful.
:type value: int
:rtype: bool
"""
if not self.isFull():
if self.start == -1:
self.start = 0
self.end = (self.end + 1) % self.max_length
self.queue[self.end] = value
return True
else:
return False
def deQueue(self):
"""
Delete an element from the circular queue. Return true if the operation is successful.
:rtype: bool
"""
if not self.isEmpty():
if self.start == self.end: # the last element
self.start, self.end = -1, -1
# self.end = -1
else:
self.start = (self.start + 1) % self.max_length
return True
else:
return False
def Front(self):
"""
Get the front item from the queue.
:rtype: int
"""
return -1 if self.isEmpty() else self.queue[self.start]
def Rear(self):
"""
Get the last item from the queue.
:rtype: int
"""
return -1 if self.isEmpty() else self.queue[self.end]
def isEmpty(self):
"""
Checks whether the circular queue is empty or not.
:rtype: bool
"""
return self.start == -1 and self.end == -1
def isFull(self):
"""
Checks whether the circular queue is full or not.
:rtype: bool
"""
return (self.end + 1) % self.max_length == self.start
# V1'
# https://blog.csdn.net/fuxuemingzhu/article/details/81027583
class MyCircularQueue(object):
def __init__(self, k):
"""
Initialize your data structure here. Set the size of the queue to be k.
:type k: int
"""
self.queue = []
self.size = k
self.front = 0
self.rear = 0
def enQueue(self, value):
"""
Insert an element into the circular queue. Return true if the operation is successful.
:type value: int
:rtype: bool
"""
if self.rear - self.front < self.size:
self.queue.append(value)
self.rear += 1
return True
else:
return False
def deQueue(self):
"""
Delete an element from the circular queue. Return true if the operation is successful.
:rtype: bool
"""
if self.rear - self.front > 0:
self.front += 1
return True
else:
return False
def Front(self):
"""
Get the front item from the queue.
:rtype: int
"""
if self.isEmpty():
return -1
else:
return self.queue[self.front]
def Rear(self):
"""
Get the last item from the queue.
:rtype: int
"""
if self.isEmpty():
return -1
else:
return self.queue[self.rear - 1]
def isEmpty(self):
"""
Checks whether the circular queue is empty or not.
:rtype: bool
"""
return self.front == self.rear
def isFull(self):
"""
Checks whether the circular queue is full or not.
:rtype: bool
"""
return self.rear - self.front == self.size
# Your MyCircularQueue object will be instantiated and called as such:
# obj = MyCircularQueue(k)
# param_1 = obj.enQueue(value)
# param_2 = obj.deQueue()
# param_3 = obj.Front()
# param_4 = obj.Rear()
# param_5 = obj.isEmpty()
# param_6 = obj.isFull()
# V1''
# https://blog.csdn.net/fuxuemingzhu/article/details/81027583
class MyCircularQueue(object):
def __init__(self, k):
"""
Initialize your data structure here. Set the size of the queue to be k.
:type k: int
"""
self.queue = []
self.size = k
self.rear = 0
def enQueue(self, value):
"""
Insert an element into the circular queue. Return true if the operation is successful.
:type value: int
:rtype: bool
"""
if not self.isFull():
self.queue.append(value)
self.rear += 1
return True
else:
return False
def deQueue(self):
"""
Delete an element from the circular queue. Return true if the operation is successful.
:rtype: bool
"""
if not self.isEmpty():
self.queue.pop(0)
self.rear -= 1
return True
else:
return False
def Front(self):
"""
Get the front item from the queue.
:rtype: int
"""
if self.isEmpty():
return -1
else:
return self.queue[0]
def Rear(self):
"""
Get the last item from the queue.
:rtype: int
"""
if self.isEmpty():
return -1
else:
return self.queue[self.rear - 1]
def isEmpty(self):
"""
Checks whether the circular queue is empty or not.
:rtype: bool
"""
return 0 == self.rear
def isFull(self):
"""
Checks whether the circular queue is full or not.
:rtype: bool
"""
return self.rear == self.size
# Your MyCircularQueue object will be instantiated and called as such:
# obj = MyCircularQueue(k)
# param_1 = obj.enQueue(value)
# param_2 = obj.deQueue()
# param_3 = obj.Front()
# param_4 = obj.Rear()
# param_5 = obj.isEmpty()
# param_6 = obj.isFull()
# V1'''
# https://blog.csdn.net/fuxuemingzhu/article/details/81027583
class MyCircularQueue(object):
def __init__(self, k):
"""
Initialize your data structure here. Set the size of the queue to be k.
:type k: int
"""
self.queue = []
self.size = k
def enQueue(self, value):
"""
Insert an element into the circular queue. Return true if the operation is successful.
:type value: int
:rtype: bool
"""
if not self.isFull():
self.queue.append(value)
return True
else:
return False
def deQueue(self):
"""
Delete an element from the circular queue. Return true if the operation is successful.
:rtype: bool
"""
if not self.isEmpty():
self.queue.pop(0)
return True
else:
return False
def Front(self):
"""
Get the front item from the queue.
:rtype: int
"""
if self.isEmpty():
return -1
else:
return self.queue[0]
def Rear(self):
"""
Get the last item from the queue.
:rtype: int
"""
if self.isEmpty():
return -1
else:
return self.queue[-1]
def isEmpty(self):
"""
Checks whether the circular queue is empty or not.
:rtype: bool
"""
return 0 == len(self.queue)
def isFull(self):
"""
Checks whether the circular queue is full or not.
:rtype: bool
"""
return len(self.queue) == self.size
# V2
|
class DummyLogger:
def debug (self, *arg):
pass
def info (self, *arg):
pass
def error (self, *arg):
pass
def critical (self, *arg):
pass
|
_base_ = [
'../_base_/models/gma/gma_p-only.py',
'../_base_/datasets/flyingchairs_raft_368x496.py',
'../_base_/default_runtime.py'
]
optimizer = dict(
type='AdamW',
lr=0.00025,
betas=(0.9, 0.999),
eps=1e-08,
weight_decay=0.0001,
amsgrad=False)
optimizer_config = dict(grad_clip=dict(max_norm=1.))
lr_config = dict(
policy='OneCycle',
max_lr=0.00025,
total_steps=120100,
pct_start=0.05,
anneal_strategy='linear')
runner = dict(type='IterBasedRunner', max_iters=120000)
checkpoint_config = dict(by_epoch=False, interval=10000)
evaluation = dict(interval=10000, metric='EPE')
|
class Median:
def findMedianSortedArrays(self, nums1, nums2):
new=sorted(nums1+nums2)
x=len(new)
if x%2==1:
return new[int(x/2)]
elif x%2==0:
return (new[int(x/2)]+new[int(x/2)-1])/2
if __name__=="__main__":
a=[1,2]
b=[3]
c=[1,283,4577,609]
d=[98732,4739,21]
print(Median().findMedianSortedArrays(a,b))
print(Median().findMedianSortedArrays(c,d)) |
"""
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
https://leetcode.com/problems/palindrome-number/
"""
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
str_x = str(x)
return str_x == str_x[::-1]
test_cases = [121, -121, 10]
results = [True, False, False]
if __name__ == "__main__":
app = Solution()
for test_case, correct_result in zip(test_cases, results):
assert (
app.isPalindrome(test_case) == correct_result
), f"My result: {app.isPalindrome(test_case)}, correct result: {correct_result}"
|
class TreeNode:
__slots__ = ['left', 'right']
def __init__(self, value: int):
self.value = value
|
class Cbox:
"""Class to hold ciphertext and implement helper functions"""
def __init__(self, keylength, ciphertext):
self.MAX_KEYLENGTH = 16
self.set_keylength(keylength)
if ciphertext is not None:
self.set_ctext(ciphertext)
if not self.sanity_check():
raise ValueError("invalid ciphertext or keylength")
def get_keylength(self):
return self._keylength
def set_keylength(self,value):
self._keylength = int(value)
key = []
for i in range(0, int(value)):
key.append(0)
self.set_key(key)
def get_ctext(self):
return self._ctext
def set_ctext(self, value):
self._ctext = value
def get_clist(self):
retval = []
numbytes = 2
ctext = self.get_ctext()
for i in range(0,len(ctext),numbytes):
retval.append(int(ctext[i:i+numbytes], 16))
return retval
def get_cipherstreams_vigenere(self):
retval = []
clist = self.get_clist()
keylength = self.get_keylength()
items = len(clist) // keylength
remain = len(clist) % keylength
for keyindex in range(0, keylength):
sublist = []
for cursor in range(0, items):
item = clist[keyindex + cursor * keylength]
sublist.append(item)
if remain > keyindex:
item = clist[keyindex + (cursor + 1) * keylength]
sublist.append(item)
retval.append(sublist)
return retval
def get_key(self):
return self._key
def set_key(self, value):
if len(value) == self.get_keylength():
self._key = value
else:
raise ValueError("invalid keylength")
def decrypt(self):
clist = self.get_clist()
numitems = len(clist)
keylength = self.get_keylength()
key = self.get_key()
retval = []
for cursor in range(0, numitems):
cbyte = clist[cursor]
keycursor = cursor % keylength
pbyte = cbyte ^ key[keycursor]
retval.append(pbyte)
return retval
def sanity_check(self):
#check length of ctext - should be even number and > 0
length = len(self._ctext)
if length > 0:
retval = True
else:
retval = False
if (length % 2) == 0:
retval = retval & True
else:
retval = retval & False
# check that ctext only contains 0 - 9, A - F
whitelist = "ABCDEF0123456789"
if all(c in whitelist for c in self._ctext):
retval = retval & True
else:
retval = retval & False
# check keylength
if self._keylength > 0 and self._keylength < self.MAX_KEYLENGTH:
retval = retval & True
else:
retval = retval & False
return retval
|
def is_palindrome(x):
l = len(a)
for i in range(int((l-l%2)/2)):
if a[i] == a[l-i-1]:
continue
else:
print(x," is not palindrome")
return False
return True
a= input("Please enter the palindrome digit \n")
if is_palindrome(a):
l = len(a)
if int(a)!=9:
a = list(a)
for i in range(int((l-l%2)/2),l):
if a[i] is not '9':
a[i] = str(int(a[i])+1)
if i != l-i-1:
a[l-i-1]=a[i]
break
else:
if i == l-1:
a[i] ='1'
a[l-i-1] ='1'
a.insert(2,'0')
continue
a[i] = '0'
if i != l-i-1:
a[l-i-1]=a[i]
else:
a = '11'
print("".join(a)) |
#
# PySNMP MIB module CISCO-TRUSTSEC-TC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TRUSTSEC-TC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:57:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Gauge32, MibIdentifier, Integer32, IpAddress, iso, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Counter64, Unsigned32, Counter32, NotificationType, TimeTicks, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "MibIdentifier", "Integer32", "IpAddress", "iso", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Counter64", "Unsigned32", "Counter32", "NotificationType", "TimeTicks", "Bits")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
ciscoCtsTcMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 694))
ciscoCtsTcMIB.setRevisions(('2013-06-06 00:00', '2012-01-30 00:00', '2009-05-14 00:00',))
if mibBuilder.loadTexts: ciscoCtsTcMIB.setLastUpdated('201306060000Z')
if mibBuilder.loadTexts: ciscoCtsTcMIB.setOrganization('Cisco Systems, Inc.')
class CtsSecurityGroupTag(TextualConvention, Unsigned32):
status = 'current'
subtypeSpec = Unsigned32.subtypeSpec + ValueRangeConstraint(0, 65535)
class CtsAclName(TextualConvention, OctetString):
status = 'current'
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 255)
class CtsAclNameOrEmpty(TextualConvention, OctetString):
status = 'current'
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)
class CtsAclList(TextualConvention, OctetString):
status = 'current'
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 255)
class CtsAclListOrEmpty(TextualConvention, OctetString):
status = 'current'
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)
class CtsPolicyName(TextualConvention, OctetString):
status = 'current'
displayHint = '255a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)
class CtsPasswordEncryptionType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("other", 1), ("none", 2), ("clearText", 3), ("typeSix", 4), ("typeSeven", 5))
class CtsPassword(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 256)
class CtsGenerationId(TextualConvention, OctetString):
status = 'current'
displayHint = '128a'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 128)
class CtsAcsAuthorityIdentity(TextualConvention, OctetString):
status = 'current'
displayHint = '1x'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 64)
class CtsCredentialRecordType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("simpleSecret", 1), ("pac", 2))
class CtsSgaclMonitorMode(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("on", 1), ("off", 2))
class CtsSxpConnectionStatus(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("other", 1), ("off", 2), ("on", 3), ("pendingOn", 4), ("deleteHoldDown", 5))
mibBuilder.exportSymbols("CISCO-TRUSTSEC-TC-MIB", PYSNMP_MODULE_ID=ciscoCtsTcMIB, CtsAclListOrEmpty=CtsAclListOrEmpty, CtsPolicyName=CtsPolicyName, CtsSxpConnectionStatus=CtsSxpConnectionStatus, CtsPassword=CtsPassword, CtsAclList=CtsAclList, CtsAclNameOrEmpty=CtsAclNameOrEmpty, ciscoCtsTcMIB=ciscoCtsTcMIB, CtsPasswordEncryptionType=CtsPasswordEncryptionType, CtsAclName=CtsAclName, CtsGenerationId=CtsGenerationId, CtsAcsAuthorityIdentity=CtsAcsAuthorityIdentity, CtsCredentialRecordType=CtsCredentialRecordType, CtsSgaclMonitorMode=CtsSgaclMonitorMode, CtsSecurityGroupTag=CtsSecurityGroupTag)
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2013-04-22 16:15:32
class RoomManager(object):
def __init__(self):
self.rooms = {}
def new(self, meta):
if meta['hash'] in self.rooms:
if self.rooms[meta['hash']].sha1_array == meta['sha1_array']:
return self.rooms[meta['hash']]
else:
return None
else:
self.rooms[meta['hash']] = Room(meta['hash'], meta)
return self.rooms[meta['hash']]
def delete(self, roomid):
if roomid in self.rooms:
del self.rooms[roomid]
def get(self, roomid):
return self.rooms.get(roomid)
def keys(self):
return self.rooms.keys()
class Room(object):
def __init__(self, id, meta):
for each in ('hash', 'sha1_array', 'filename', 'piece_size', 'block_size', 'size', 'type'):
setattr(self, each, meta[each])
self.id = id
self.meta = meta
self.title = self.filename
self.peers = {}
def join(self, peerid, ws):
self.peers[peerid] = Peer(peerid, ws)
return self.peers[peerid]
def leave(self, peerid):
if peerid in self.peers:
del self.peers[peerid]
def get(self, peerid):
return self.peers.get(peerid)
def peer_list(self):
result = {}
for each in self.peers.itervalues():
result[each.peerid] = {
'bitmap': each.bitmap,
}
return result
class Peer(object):
def __init__(self, peerid, ws):
self.ws = ws
self.peerid = peerid
self.bitmap = ''
|
class Solution:
def replaceWords(self, dict, sentence):
"""
:type dict: List[str]
:type sentence: str
:rtype: str
"""
rootSet = set(dict)
words = sentence.split()
for i in range(len(words)):
for j in range(min(len(words[i]), 100)):
if words[i][:j+1] in rootSet:
words[i] = words[i][:j+1]
return " ".join(words) |
"""
Copyright 2018 Inmanta
Contact: code@inmanta.com
License: Apache 2.0
"""
def test_dryrun(project):
basemodel = """
import testmodule
r = testmodule::Resource(agent="a", name="IT", key="k", value="write")
"""
project.compile(basemodel)
changes = project.dryrun_resource("testmodule::Resource")
assert changes == {"value": {'current': 'read', 'desired': 'write'}} |
with open("td9_graph_lworld.txt", "r") as f :
lines = f.readlines()
links =[]
for line in lines :
spl = line.strip("\n\r ").split(",")
if len(spl) == 2 :
l = { "source":spl[0],"target":spl[1],"type":"-"}
links.append(l)
l = { "source":spl[1],"target":spl[0],"type":"-"}
links.append(l)
with open("td9_graph_lworld.js", "w") as f :
f.write ("var links = [\n")
for l in links :
f.write("{")
f.write( ",".join ( [ "{0}:'{1}'".format (k,v) for k,v in l.items() ] ) )
f.write("},\n")
f.write("\n];\n")
|
def func(b=None, a=None):
pass
func(a=1)
|
# -*- coding: utf-8 -*-
class DiscordException(Exception):
"""Base exception class for discord.py
Ideally speaking, this could be caught to handle any exceptions thrown from this library.
"""
pass
class NoMoreItems(DiscordException):
"""Exception that is thrown when an async iteration operation has no more
items."""
pass
class ClientException(DiscordException):
"""Exception that's thrown when an operation in the :class:`Client` fails.
These are usually for exceptions that happened due to user input.
"""
pass
class InvalidData(ClientException):
"""Exception that's raised when the library encounters unknown
or invalid data from Discord.
"""
pass
class InvalidArgument(ClientException):
"""Exception that's thrown when an argument to a function
is invalid some way (e.g. wrong value or wrong type).
This could be considered the analogous of ``ValueError`` and
``TypeError`` except inherited from :exc:`ClientException` and thus
:exc:`DiscordException`.
"""
pass
class LoginFailure(ClientException):
"""Exception that's thrown when the :meth:`Client.login` function
fails to log you in from improper credentials or some other misc.
failure.
"""
pass
class ConnectionClosed(ClientException):
"""Exception that's thrown when the gateway connection is
closed for reasons that could not be handled internally.
Attributes
-----------
code: :class:`int`
The close code of the websocket.
reason: :class:`str`
The reason provided for the closure.
shard_id: Optional[:class:`int`]
The shard ID that got closed if applicable.
"""
def __init__(self, socket, *, shard_id, code=None):
# This exception is just the same exception except
# reconfigured to subclass ClientException for users
self.code = code or socket.close_code
# aiohttp doesn't seem to consistently provide close reason
self.reason = ''
self.shard_id = shard_id
super().__init__('Shard ID %s WebSocket closed with %s' % (self.shard_id, self.code))
class PrivilegedIntentsRequired(ClientException):
"""Exception that's thrown when the gateway is requesting privileged intents
but they're not ticked in the developer page yet.
Go to https://discord.com/developers/applications/ and enable the intents
that are required. Currently these are as follows:
- :attr:`Intents.members`
- :attr:`Intents.presences`
Attributes
-----------
shard_id: Optional[:class:`int`]
The shard ID that got closed if applicable.
"""
def __init__(self, shard_id):
self.shard_id = shard_id
msg = 'Shard ID %s is requesting privileged intents that have not been explicitly enabled in the ' \
'developer portal. It is recommended to go to https://discord.com/developers/applications/ ' \
'and explicitly enable the privileged intents within your application\'s page. If this is not ' \
'possible, then consider disabling the privileged intents instead.'
super().__init__(msg % shard_id)
|
# Header used to check if it's an UPX file
UPX_STRING = b"UPX!"
# Header used to find the config offset ([ss] after unxor)
CONFIG_HEADER = b"\x15\x15\x29\xD2"
# Size of every element in the config space
CONFIG_SIZE = 428
SIGNATURE1_SIZE = 96
SIGNATURE2_SIZE = 96
CONFIG_VERSION_SIZE = 4
CONFIG_TOTAL_SIZE = CONFIG_SIZE + \
SIGNATURE1_SIZE + \
SIGNATURE2_SIZE + \
CONFIG_VERSION_SIZE
# Hardcoded XOR key used to encrypt the config
XOR_KEY = b"\x4E\x66\x5A\x8F\x80\xC8\xAC\x23\x8D\xAC\x47\x06\xD5\x4F\x6F\x7E"
# The first signature public key used to authenticate the encrypted config
SIGNATURE1_KEY = "\x02\xc0\xa1\x43\x78\x53\xbe\x3c\xc4\xc8\x0a\x29\xe9\x58" \
"\xbf\xc6\xa7\x1b\x7e\xab\x72\x15\x1d\x64\x64\x98\x95\xc4" \
"\x6a\x48\xc3\x2d\x6c\x39\x82\x1d\x7e\x25\xf3\x80\x44\xf7" \
"\x2d\x10\x6b\xcb\x2f\x09\xc6"
# The second signature public key used to authenticate the decrypted config
SIGNATURE2_KEY = "\x02\xd5\xd5\xe7\x41\xee\xdc\xc8\x10\x6d\x2f\x48\x0d\x04" \
"\x12\x21\x27\x39\xc7\x45\x0d\x2a\xd1\x40\x72\x01\xd1\x8b" \
"\xcd\xc4\x16\x65\x76\x57\xc1\x9d\xe9\xbb\x05\x0d\x3b\xcf" \
"\x6e\x70\x79\x60\xf1\xea\xef"
# All tags that can be present in a Mozi config
CONFIG_TAGS = {
"ss": "Bot role",
"ssx": "enable/disable tag [ss]",
"cpu": "CPU architecture",
"cpux": "enable/disable tag [cpu]",
"nd": "new DHT node",
"hp": "DHT node hash prefix",
"atk": "DDoS attack type",
"ver": "Value in V section in DHT protcol",
"sv": "Update config",
"ud": "Update bot",
"dr": "Download and execute payload from the specified URL",
"rn": "Execute specified command",
"dip": "ip:port to download Mozi bot",
"idp": "report bot",
"count": "URL that used to report bot"
}
# List of the bootstrap nodes hardcoded in Mozi
BOOTSTRAP_NODES = [
("router.bittorrent.com", 6881),
("dht.transmissionbt.com", 6881),
("router.utorrent.com", 6881),
("bttracker.debian.org", 6881),
("212.129.33.59", 6881),
("82.221.103.244", 6881),
("130.239.18.159", 6881),
("87.98.162.88", 6881),
]
# ELK Settings to import Mozi configurations
ELK_HOSTS = "https://admin:admin@opendistro-opendistro-es-client-service " \
".monitoring.svc.cluster.local:9200"
ELK_SSL = True
ELK_INDEX = "mozitools"
ELK_BULK_SIZE = 100
# Number of node to remember. Nodes in cache aren't queried.
NODES_CACHE_SIZE = 10000
|
PremiumPaymentGateway = {
'id': 1,
'status_code': 200,
'payment_gateway': 'PremiumPaymentGateway'
}
ExpensivePaymentGateway = {
'id': 2,
'status_code': 200,
'payment_gateway': 'ExpensivePaymentGateway'
}
CheapPaymentGateway = {
'id': 3,
'status_code': 200,
'payment_gateway': 'CheapPaymentGateway'
}
def process_by_cheap_payment_gatway(amount):
'''
assume it will return message, status code
If the amount to be paid is less than £20, use CheapPaymentGateway.
'''
if CheapPaymentGateway['status_code'] == 200:
return {
'status_code': CheapPaymentGateway['status_code'],
'payment_gateway':CheapPaymentGateway['payment_gateway']
}
return {
'status_code': 400
}
def process_by_expensive_gateway(amount):
'''
assume it will return message, status code
If the amount to be paid is £21-500, use ExpensivePaymentGateway if available.
Otherwise, retry only once with CheapPaymentGateway.
'''
if ExpensivePaymentGateway['status_code'] == 200:
return {
'status_code': ExpensivePaymentGateway['status_code'],
'payment_gateway':ExpensivePaymentGateway['payment_gateway']
}
else:
if CheapPaymentGateway['status_code'] == 200:
return {
'status_code': CheapPaymentGateway['status_code'],
'payment_gateway':CheapPaymentGateway['payment_gateway']
}
return {
'status_code': 400
}
def process_by_premium_gateway(amount):
'''
assume it will return message, status code
If the amount is > £500, try only PremiumPaymentGateway and retry up to 3 times
in case payment does not get processed.
'''
if PremiumPaymentGateway['status_code'] == 200:
return {
'status_code': PremiumPaymentGateway['status_code'],
'payment_gateway':PremiumPaymentGateway['payment_gateway']
}
else:
for i in range(0,3):
if PremiumPaymentGateway['status_code'] == 200:
return {
'status_code': PremiumPaymentGateway['status_code'],
'payment_gateway':PremiumPaymentGateway['payment_gateway']
}
return {
'status_code': 400
}
def process_payment(amount):
if amount <= 20:
response = process_by_cheap_payment_gatway(amount)
elif amount > 20 and amount <= 500:
response = process_by_expensive_gateway(amount)
else:
response = process_by_premium_gateway(amount)
return response |
#lists
li = [45,54,56,'dtr',True,54.76]
mytuple = (34,34,34,23,45,56,2,32,56,24)
'''
#index
print(li[4])
#negative indexing
print(li[-1])
print(li[2])
#slicing
print(li[2:5])
print(li[3:])
print(li[:])
print(li[:4])
'''
# integers
#mutability, immutability
a = 10
print(a)
print(id(a))
a = 23
print(a)
print(id(a))
|
name_list = ["鈴木", "佐藤", "山田"]
position = ["部長", "課長", "係長"]
# 配列の要素番号を指定して値を呼び出してみよう!
print(name_list[0] + position[0])
print(name_list[1] + position[1])
print(name_list[2] + position[2])
|
# The Python versions of list comprehensions found in Graham Hutton's
# "Programming Haskell" book, chapter 5.
[ x**2 for x in range(1,6) ]
[ (x,y) for x in range(1,4) for y in range(4,6) ]
[ (x,y) for x in range(1,4) for y in range(x,4) ]
concat = lambda xss: [ x for xs in xss for x in xs ]
firsts = lambda ps: [ x for (x,_) in ps ]
length = lambda xs: sum(1 for _ in xs)
factors = lambda n: [ x for x in range(1,n+1) if n % x == 0 ]
prime = lambda n: factors(n) == [1, n]
primes = lambda n: [ x for x in range(2, n+1) if prime(x) ]
find = lambda k, t: [ v for (k1,v) in t if k == k1 ]
pairs = lambda xs: zip(xs, xs[1:])
is_sorted = lambda xs: all(x <= y for (x,y) in pairs(xs))
positions = lambda x, xs: [ i for (x1,i) in zip(xs, range(len(xs))) if x == x1 ]
lowers = lambda xs: len([ x for x in xs if x.islower() ])
count = lambda x, xs: len([ x1 for x1 in xs if x == x1])
|
# Shift cipher
# Used with the shift and ceasar option of ciphers
def encrypt(message, shift):
shift = int(shift)
result = ""
for i in range(len(message)):
char = message[i]
if(char.isupper()):
result += chr((ord(char)+ shift-65) % 26 + 65)
elif(char.islower()):
result += chr((ord(char) + shift-97) % 26 + 97)
else:
result += char
return result
def decrypt(message, shift):
shift = int(shift)
result = ""
for i in range(len(message)):
char = message[i]
if(char.isupper()):
result += chr((ord(char) - shift-65) % 26 + 65)
elif(char.islower()):
result += chr((ord(char) - shift-97) % 26 + 97)
else:
result += char
return result |
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def say_hi(self):
print('Hello, my name is', self.name)
person = Person('Sun Jinbo', 20)
print(person)
person.say_hi()
class Robot:
poplulation = 0
def __init__(self, name):
self.name = name
print("(Initializing {})".format(self.name))
Robot.poplulation += 1
def die(self):
print("({} is died!)".format(self.name))
Robot.poplulation -= 1
if (Robot.poplulation == 0):
print("({} was the last one.)".format(self.name))
else:
print("There are still {:d} robots working.".format(Robot.poplulation))
def say_hi(self):
print("Greetings, my masters call me {}.".format(self.name))
@classmethod
def hom_many_robots(cls):
print("We have {:d} robots.".format(cls.poplulation))
droid1 = Robot("R2-D2")
droid1.say_hi()
Robot.hom_many_robots()
droid2 = Robot("C1-3P")
droid2.say_hi()
Robot.hom_many_robots()
droid1.die()
droid2.die()
Robot.hom_many_robots()
class Teacher(Person):
def __init__(self, name, age, salary):
Person.__init__(self, name, age)
self.salary = salary
def tell(self):
print('Salary: {:d}'.format(self.salary))
teacher = Teacher('Tom', 29, 15000)
teacher.say_hi()
teacher.tell()
|
#encoding:utf-8
subreddit = 'TikTok_Tits'
t_channel = '@r_TikTok_Tits'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
"""
@function:
the implement of Merge Sort
"""
def Merge(A,B):
i = 0
j = 0
result = []
for k in range(len(A)+len(B)):
if i < len(A) and j < len(B):
if A[i] < B[j]:
result.append(A[i])
i += 1
elif B[j] < A[i]:
result.append(B[j])
j += 1
else:
result.append(A[i])
result.append(B[j])
i += 1
j += 1
elif i == len(A):
result.append(B[j])
j += 1
elif j == len(B):
result.append(A[i])
i += 1
return result
def Sort(array):
if len(array) == 1:
return array
left = array[:int(len(array)/2)]
right = array[int(len(array)/2):]
result_left = Sort(left)
result_right = Sort(right)
result = Merge(result_left,result_right)
return result
array = [5,4,1,8,7,2,6,3]
print("test1:",Sort(array))
array = [5,4,1,9,8,7,2,6,3]
print("test2:",Sort(array))
|
class Foreign:
def __init__(self,nombreConstraint:str,columnas:list,nombreTablaReferencia:str, columnasOtraTabla:list):
self.nombreConstraint = nombreConstraint
self.columnas = columnas
self.nombreTabla = nombreTablaReferencia
self.columnasrefer = columnasOtraTabla
|
"""
总结 - 函数参数
实际参数:与形参进行对应
位置实参:根据顺序
函数名(数据1,数据2)
序列实参:拆
函数名(*序列)
关键字实参:根据名字
函数名(形参名=数据1,形参名=数据2)
字典实参:拆
函数名(**字典)
形式参数:限制实参
位置形参:必填
def 函数名(形参名1,形参名2)
默认形参:可选
def 函数名(形参名=数据1,形参名=数据2)
星号元组形参:合
def 函数名(*args)
双星号字典形参:合
def 函数名(**kwargs)
命名关键字形参:必须是关键字实参
def 函数名(*args,形参名)
def 函数名(*,形参名)
"""
|
def longest_equal_subarray2(A):
longest = cnt = 0
n = len(A)
for i in range(n):
for j in range(i, n):
cnt += 1 if A[j] else -1
if cnt == 0:
longest = max(longest, j - i + 1)
return longest
def longest_equal_subarray(nums):
d = {0: -1}
sm = ans = 0
for i, x in enumerate(nums):
sm += 1 if x else -1
if sm in d:
ans = max(ans, i - d[sm])
else:
d[sm] = i
return ans
print(longest_equal_subarray([1,0,1,1,0,0,0,0,1])) |
input = """
"""
output = """
{-p(1), number(1), number(2), p(2)}
"""
|
class Settings_lvl1():
"""
A class to sotre all setting for alien Invasion."""
def __init__(self):
#Initialize the game's settings.
self.screen_widht = 800
self.screen_height = 600
self.bg_color = (230,230,230)
# Character Settings
self.assasin_speed_factor = 0.3
|
#!/usr/bin/python
class GrabzItCookie:
def __init__(self, name, value, domain, path, httponly, expires, type):
self.Name = name
self.Value = value
self.Domain = domain
self.Path = path
self.HttpOnly = httponly
self.Expires = expires
self.Type = type |
# Hash Table; Stack
# Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.
# For example, given the list of temperatures T = [73, 74, 75, 71, 69, 72, 76, 73], your output should be [1, 1, 4, 2, 1, 1, 0, 0].
# Note: The length of temperatures will be in the range [1, 30000]. Each temperature will be an integer in the range [30, 100].
class Solution:
def dailyTemperatures(self, T: List[int]) -> List[int]:
ans = [0] * len(T)
stack = []
for i in range(len(T) - 1, -1, -1):
while stack and T[i] >= T[stack[-1]]:
stack.pop()
if stack:
ans[i] = stack[-1] - i
stack.append(i)
return ans |
# -*- coding: utf-8 -*-
class A:
i = 5
def getI(self):
print ("self.i: ", self.i)
one = A()
one.getI() |
#!/usr/bin/env python3
# https://abc099.contest.atcoder.jp/tasks/abc099_a
n = int(input())
if n < 1000: print('ABC')
else: print('ABD')
|
if __name__ == "__main__":
xt101_radio = xt101('COM9', 247)
xt101_radio.send_message(0x1234, [1,2,4,5])
print("Mac:", xt101_radio.get_mac_address())
time.sleep(0.75)
print("Sink:", xt101_radio.get_sink_address())
time.sleep(0.75)
print("Firmware:", xt101_radio.get_firmware_version())
time.sleep(0.75)
print("Region:", xt101_radio.get_region())
time.sleep(0.75)
print("Mode:", xt101_radio.get_mode())
time.sleep(0.75)
print("Node ID:", xt101_radio.get_node_short_id())
time.sleep(0.75)
print(xt101_radio.get_debug_regs())
time.sleep(0.75)
app_key = [0x1234, 0x2345, 0x3456, 0x4567, 0x5678, 0x6789, 0x789A, 0x89AB]
net_key = [0x1234, 0x2345, 0x3456, 0x4567, 0x5678, 0x6789, 0x789A, 0x89AB]
print("App key:", xt101_radio.set_aes_key(app_key, 'A'))
time.sleep(1)
print("Net key:", xt101_radio.set_aes_key(net_key, 'N'))
time.sleep(1)
print("Set as sink", xt101_radio.set_sink())
time.sleep(0.75)
old_val = xt101_radio.get_net_id()
time.sleep(0.75)
xt101_radio.set_net_id(0x55)
time.sleep(0.75)
new_val = xt101_radio.get_net_id()
print("Net id:", old_val, new_val)
time.sleep(0.75)
old_val = xt101_radio.get_tx_power()
time.sleep(0.75)
xt101_radio.set_tx_power(13)
time.sleep(0.75)
new_val = xt101_radio.get_tx_power()
print("Tx power:", old_val, new_val)
old_val = xt101_radio.get_sf()
time.sleep(0.75)
xt101_radio.set_sf(8)
time.sleep(0.75)
new_val = xt101_radio.get_sf()
print("SF:", old_val, new_val)
old_val = xt101_radio.get_target_rssi()
time.sleep(0.75)
xt101_radio.set_target_rssi(81)
time.sleep(0.75)
new_val = xt101_radio.get_target_rssi()
print("RSSI:", old_val, new_val)
|
# Exercise 1
i = 0
while i < 5:
print(f'This is lap {i}')
i += 1
# Exercise 2
keep_printing = True
while keep_printing:
v = input("Write Something:")
if v == "quit":
print("Bye bye!")
keep_printing = False
else:
print(v)
# Exercise 3
number = int(input("Give a number:"))
sum1 = 0
for i in range(0, number):
sum1 += i
print(f"The sum was: {sum1}")
# Exercise 4
keep = True
print("Calculator")
num1 = int(input("Give the first number:"))
num2 = int(input("Give the second number:"))
while keep:
print("""(1) + \n(2) - \n(3) *\n(4) /\n(5) Change numbers\n(6) Quit""")
print(f'Current numbers:{num1} {num2}')
s_num = int(input("Please select something (1-6):"))
if s_num == 6:
print("Thank you")
keep = False
elif s_num == 5:
num1 = int(input("Give the first number:"))
num2 = int(input("Give the second number:"))
if s_num == 1:
result = num1 + num2
print(f'The result is {result}')
elif s_num == 2:
result = num1 - num2
print(f'The result is {result}')
elif s_num == 3:
result = num1 * num2
print(f'The result is {result}')
elif s_num == 4:
result = num1 / num2
print(f'The result is {result}')
else:
if s_num == 1:
result = num1 + num2
print(f'The result is {result}')
elif s_num == 2:
result = num1 - num2
print(f'The result is {result}')
elif s_num == 3:
result = num1 * num2
print(f'The result is {result}')
elif s_num == 4:
result = num1 / num2
print(f'The result is {result}')
|
for i in range(1,999):
params = dict(
pin=i
)
resp=requests.get(url=url,params=params)
data = resp.json()
if(data["accept"] == "Yesss"):
print(i, resp.json()) |
class ConsoleBot:
def __init__(self, system):
self.system = system
def start(self, input_utt):
# 辞書型 inputにユーザIDを設定
input = {'utt': None, 'sessionId': "myid"}
# システムからの最初の発話をinitial_messageから取得し,送信
return self.system.initial_message(input)
def message(self, input_utt):
# 辞書型 inputにユーザからの発話とユーザIDを設定
input = {'utt': input_utt, 'sessionId': "myid"}
# replyメソッドによりinputから発話を生成
system_output = self.system.reply(input)
# 発話を送信
return system_output
def run(self):
while True:
input_utt = input("YOU:>")
if "/start" in input_utt:
sys_out = self.start(input_utt)
else:
sys_out = self.message(input_utt)
print("SYS:" + sys_out["utt"])
if sys_out["end"]:
break |
# SPDX-License-Identifier: Apache-2.0
# @version 1.0.0
rules = {
"sol": {"shebang": False, "comment": ["///", "/*", "//"],},
"rs": {"shebang": False, "comment": ["//", "/*"],},
"py": {"shebang": True, "comment": ["#"],},
}
|
""" Select contains functions for getting keys from values, values from keys, and regex helpers for selecting a value from a list. """
class Select():
# Initialisation.
def __init__(self, d):
self.dict = d
# Gets the key from a value in a select.
def get_key(self, v):
for k,val in self.dict.iteritems():
if v == val:
return k
return ""
# Gets the value from a key in a select.
def get_value(self, k):
if k in self.dict.keys():
return self.dict[k]
return ""
def first_choice(self):
return sorted(self.dict.keys())[0]
def choices(self):
return '(' + ','.join(sorted(self.dict.keys())) + ')'
def reg_choices(self):
return '^(' + '|'.join(self.dict.keys()) + ')$'.encode('string_escape'); |
class Solution:
def reverseVowels(self, s: str) -> str:
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
new_s = [c for c in s]
l, r = 0, len(s) - 1
while l < r:
if s[l] not in vowels:
l += 1
continue
if s[r] not in vowels:
r -= 1
continue
new_s[l], new_s[r] = new_s[r], new_s[l]
l, r = l + 1, r - 1
return ''.join(new_s)
class FinalSolution:
def reverseVowels(self, s: str) -> str:
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
s = [c for c in s]
l, r = 0, len(s) - 1
while l < r:
if s[l] not in vowels:
l += 1
if s[r] not in vowels:
r -= 1
if s[l] in vowels and s[r] in vowels:
s[l], s[r] = s[r], s[l]
l, r = l + 1, r - 1
return ''.join(s)
if __name__ == '__main__':
s = 'hello'
expected = 'holle'
a = FinalSolution().reverseVowels(s)
print(a)
print(a == expected)
|
#palíndromo: Palavra ou frase que pode ser lida de traz pra frente idependente de espaços na frase.
#Ex: "A base do teto desaba" == "abased otet od esab A"
frase = input('Digite uma frase:').strip().upper()
frase_quebrada = frase.split()
frase_juntada = ''.join(frase_quebrada)
quantidade_de_caracteres = len(frase_juntada)
ultima_posicao = quantidade_de_caracteres - 1
frase_invertida = ''
for c in range(ultima_posicao, - 1, - 1):
frase_invertida = frase_invertida + frase_juntada[c]
if frase_invertida == frase_juntada:
print('Essa frase é um Palíndromo!')
else:
print('Essa frase "NÃO" é um Palíndromo!')
'''
Minha busca para a solução desse problema não foi linear, isso porque ao
escrever o código fiz várias modificações. Os espaços da direita e esquerda foram
faclmente removidos pela funcionalidade strip, mas os espaços entre a frase não. Então precisei
remover. Consegui isso utilizando a funcionalidade split que teve a função de renomear
o possicionammento a partir de cada espaço. logo após precisei juntar toda a frase, e por isso
utilizei o ''.join. que ealizado desta forma agora tenho a cantagem de caracter mas sem contar
os espaços. Daí com a funcionalidade Len pude obter a quatidade daquilo que eu precisava (fiz este
processo porque quando eu escrevia a frase, mesmo sendo um palindromo, o sistema não reconhecia).
Criei essa variavel "ultima_posicao" para que meu sistema pudesse comparar as palavras do final
para o começo.
O for c in range(ultima_posicao, - 1, - 1): criei foi pelo raciocinio que:
o programa verificaria a frase do final ao começo do final ao passo decrescente de -1.
Por exemplo:
CASA DE MADAME MADELON - NOLEDAM EMADAM ED ASAC
OU
A BASE DO TETO DESABA - ABASED OTET OD ESAB A
A variavel frase_invertida = '' foi criada para realizar o processo de concatenação. Além
disso o que foi feito foi reconstruir a frase de tras para frente, letra por letra e
salvar as letras de trás para frente para o sistema comparar:
ex: A BASE DO TETO DESABA
A BASE DO TETO DESABA - ABASEDOTETODESABA
ABASEDOTETODESABA (17 caracteres)
ABASEDOTETODESABA (ultima posição é 16)
ABASEDOTETODESABA >>> Analisando de tras pra frente
frase_invertida = '' + ABASEDOTETODESABA == 'ABASEDOTETODESABA'
Por fim a Condição de Se ABASEDOTETODESABA é igual a 'ABASEDOTETODESABA'
'''
|
class Optimizer:
def step(self, model):
raise NotImplementedError
class GD(Optimizer):
def __init__(self, lr=0.001):
self.lr = lr
def step(self, model):
for layer, name, param, grad in model.params_and_grads():
layer.params[name] = param - self.lr*grad
|
##########################################################################
#
# Processor specific code
# CPU = "Z80"
# Description = "Zilog 8-bit microprocessor."
# DataWidth = 8 # 8-bit data
# AddressWidth = 16 # 16-bit addresses
# Maximum length of an instruction (for formatting purposes)
maxLength = 4
# Leadin bytes for multibyte instructions
leadInBytes = [0xcb, 0xdd, 0xed, 0xfd]
# Addressing mode table
# List of addressing modes and corresponding format strings for operands.
addressModeTable = {
"implied" : "",
"0" : "0",
"0,a" : "0,a",
"0,b" : "0,b",
"0,c" : "0,c",
"0,d" : "0,d",
"0,e" : "0,e",
"0,h" : "0,h",
"0,indhl" : "0,(hl)",
"0,l" : "0,l",
"00" : "$00",
"08" : "$08",
"1" : "1",
"1,a" : "1,a",
"1,b" : "1,b",
"1,c" : "1,c",
"1,d" : "1,d",
"1,e" : "1,e",
"1,h" : "1,h",
"1,indhl" : "1,(hl)",
"1,l" : "1,l",
"10" : "$10",
"18" : "$18",
"2" : "2",
"2,a" : "2,a",
"2,b" : "2,b",
"2,c" : "2,c",
"2,d" : "2,d",
"2,e" : "2,e",
"2,h" : "2,h",
"2,indhl" : "2,(hl)",
"2,l" : "2,l",
"20" : "$20",
"28" : "$28",
"3,a" : "3,a",
"3,b" : "3,b",
"3,c" : "3,c",
"3,d" : "3,d",
"3,e" : "3,e",
"3,h" : "3,h",
"3,indhl" : "3,(hl)",
"3,l" : "3,l",
"30" : "$30",
"38" : "$38",
"4,a" : "4,a",
"4,b" : "4,b",
"4,c" : "4,c",
"4,d" : "4,d",
"4,e" : "4,e",
"4,h" : "4,h",
"4,indhl" : "4,(hl)",
"4,l" : "4,l",
"5,a" : "5,a",
"5,b" : "5,b",
"5,c" : "5,c",
"5,d" : "5,d",
"5,e" : "5,e",
"5,h" : "5,h",
"5,indhl" : "5,(hl)",
"5,l" : "5,l",
"6,a" : "6,a",
"6,b" : "6,b",
"6,c" : "6,c",
"6,d" : "6,d",
"6,e" : "6,e",
"6,h" : "6,h",
"6,indhl" : "6,(hl)",
"6,l" : "6,l",
"7,a" : "7,a",
"7,b" : "7,b",
"7,c" : "7,c",
"7,d" : "7,d",
"7,e" : "7,e",
"7,h" : "7,h",
"7,indhl" : "7,(hl)",
"7,l" : "7,l",
"a" : "a",
"a,a" : "a,a",
"a,b" : "a,b",
"a,c" : "a,c",
"a,d" : "a,d",
"a,e" : "a,e",
"a,h" : "a,h",
"a,i" : "a,i",
"a,indbc" : "a,(bc)",
"a,indc" : "a,(c)",
"a,indde" : "a,(de)",
"a,indhl" : "a,(hl)",
"a,indix+d" : "a,(ix+${0:02X})",
"a,indiy+d" : "a,(iy+${0:02X})",
"a,indn" : "a,(${0:02X})",
"a,indnn" : "a,(${1:02X}{0:02X})",
"a,l" : "a,l",
"a,n" : "a,${0:02X}",
"a,r" : "a,r",
"af" : "af",
"af,af'" : "af,af'",
"b" : "b",
"b,a" : "b,a",
"b,b" : "b,b",
"b,c" : "b,c",
"b,d" : "b,d",
"b,e" : "b,e",
"b,h" : "b,h",
"b,indc" : "b,(c)",
"b,indhl" : "b,(hl)",
"b,indix+d" : "b,(ix+${0:02X})",
"b,indiy+d" : "b,(iy+${0:02X})",
"b,l" : "b,l",
"b,n" : "b,${0:02X}",
"bc" : "bc",
"bc,indaa" : "bc,(${1:02X}{0:02X})",
"bc,nn" : "bc,${1:02X}{0:02X}",
"c" : "c",
"c,a" : "c,a",
"c,b" : "c,b",
"c,c" : "c,c",
"c,d" : "c,d",
"c,e" : "c,e",
"c,h" : "c,h",
"c,indc" : "c,(c)",
"c,indhl" : "c,(hl)",
"c,indix+d" : "c,(ix+${0:02X})",
"c,indiy+d" : "c,(iy+${0:02X})",
"c,l" : "c,l",
"c,n" : "c,${0:02X}",
"c,pcr" : "c,${0:04X}",
"c,nn" : "c,${1:02X}{0:02X}",
"d" : "d",
"d,a" : "d,a",
"d,b" : "d,b",
"d,c" : "d,c",
"d,d" : "d,d",
"d,e" : "d,e",
"d,h" : "d,h",
"d,indc" : "d,(c)",
"d,indhl" : "d,(hl)",
"d,indix+d" : "d,(ix+${0:02X})",
"d,indiy+d" : "d,(iy+${0:02X})",
"d,l" : "d,l",
"d,n" : "d,${0:02X}",
"de" : "de",
"de,hl" : "de,hl",
"de,indaa" : "de,(${1:02X}{0:02X})",
"de,nn" : "de,${1:02X}{0:02X}",
"e" : "e",
"e,a" : "e,a",
"e,b" : "e,b",
"e,c" : "e,c",
"e,d" : "e,d",
"e,e" : "e,e",
"e,h" : "e,h",
"e,indc" : "e,(c)",
"e,indhl" : "e,(hl)",
"e,indix+d" : "e,(ix+${0:02X})",
"e,indiy+d" : "e,(iy+${0:02X})",
"e,l" : "e,l",
"e,n" : "e,${0:02X}",
"h" : "h",
"h,a" : "h,a",
"h,b" : "h,b",
"h,c" : "h,c",
"h,d" : "h,d",
"h,e" : "h,e",
"h,h" : "h,h",
"h,indc" : "h,(c)",
"h,indhl" : "h,(hl)",
"h,indix+d" : "h,(ix+${0:02X})",
"h,indiy+d" : "h,(iy+${0:02X})",
"h,l" : "h,l",
"h,n" : "h,${0:02X}",
"hl" : "hl",
"hl,bc" : "hl,bc",
"hl,de" : "hl,de",
"hl,hl" : "hl,hl",
"hl,indnn" : "hl,(${1:02X}{0:02X})",
"hl,nn" : "hl,${1:02X}{0:02X}",
"hl,sp" : "hl,sp",
"i,a" : "i,a",
"indaa,bc" : "(${1:02X}{0:02X}),bc",
"indaa,de" : "(${1:02X}{0:02X}),de",
"indaa,ix" : "(${1:02X}{0:02X}),ix",
"indaa,iy" : "(${1:02X}{0:02X}),iy",
"indaa,sp" : "(${1:02X}{0:02X}),sp",
"indbc,a" : "(bc),a",
"indc,a" : "(c),a",
"indc,b" : "(c),b",
"indc,c" : "(c),c",
"indc,d" : "(c),d",
"indc,e" : "(c),e",
"indc,h" : "(c),h",
"indc,l" : "(c),l",
"indde,a" : "(de),a",
"indhl" : "(hl)",
"indhl,a" : "(hl),a",
"indhl,b" : "(hl),b",
"indhl,c" : "(hl),c",
"indhl,d" : "(hl),d",
"indhl,e" : "(hl),e",
"indhl,h" : "(hl),h",
"indhl,l" : "(hl),l",
"indhl,n" : "(hl),${0:02X}",
"indix+d" : "(ix+${0:02X})",
"indix+d,a" : "(ix+${0:02X}),a",
"indiy+d,a" : "(iy+${0:02X}),a",
"indix+d,b" : "(ix+${0:02X}),b",
"indix+d,c" : "(ix+${0:02X}),c",
"indix+d,d" : "(ix+${0:02X}),d",
"indix+d,e" : "(ix+${0:02X}),e",
"indix+d,h" : "(ix+${0:02X}),h",
"indix+d,l" : "(ix+${0:02X}),l",
"indix+d,n" : "(ix+${0:02X}),${1:02X}",
"indiy+d" : "(iy+${0:02X})",
"indiy+d,b" : "(iy+${0:02X}),b",
"indiy+d,c" : "(iy+${0:02X}),c",
"indiy+d,d" : "(iy+${0:02X}),d",
"indiy+d,e" : "(iy+${0:02X}),e",
"indiy+d,h" : "(iy+${0:02X}),h",
"indiy+d,l" : "(iy+${0:02X}),l",
"indiy+d,n" : "(iy+${0:02X}),${1:02X}",
"indn,a" : "(${0:02X}),a",
"indnn,a" : "(${1:02X}{0:02X}),a",
"indnn,hl" : "(${1:02X}{0:02X}),hl",
"indsp,hl" : "(sp),hl",
"ix" : "ix",
"ix,aa" : "ix,${1:02X}{0:02X}",
"ix,bc" : "ix,bc",
"ix,de" : "ix,de",
"ix,indaa" : "ix,(${1:02X}{0:02X})",
"ix,ix" : "ix,ix",
"ix,sp" : "ix,sp",
"iy" : "iy",
"iy,aa" : "iy,${1:02X}{0:02X}",
"iy,bc" : "iy,bc",
"iy,bc" : "iy,bc",
"iy,de" : "iy,de",
"iy,indaa" : "iy,(${1:02X}{0:02X})",
"iy,indaa" : "iy,(${1:02X}{0:02X})",
"iy,iy" : "iy,iy",
"iy,sp" : "iy,sp",
"l" : "l",
"l,a" : "l,a",
"l,b" : "l,b",
"l,c" : "l,c",
"l,d" : "l,d",
"l,e" : "l,e",
"l,h" : "l,h",
"l,indc" : "l,(c)",
"l,indhl" : "l,(hl)",
"l,indix+d" : "l,(ix+${0:02X})",
"l,indiy+d" : "l,(iy+${0:02X})",
"l,l" : "l,l",
"l,n" : "l,${0:02X}",
"m" : "m",
"m,nn" : "m,${1:02X}{0:02X}",
"n" : "${0:02X}",
"n,pcr" : "${0:04X}",
"n,indix+d" : "n,(ix+${0:02X})",
"n,indiy+d" : "n,(iy+${0:02X})",
"nc" : "nc",
"nc,pcr" : "nc,${0:04X}",
"nc,nn" : "nc,${1:02X}{0:02X}",
"nn" : "${1:02X}{0:02X}",
"nz" : "nz",
"nz,pcr" : "nz,${0:04X}",
"nz,nn" : "nz,${1:02X}{0:02X}",
"p" : "p",
"p,nn" : "p,${1:02X}{0:02X}",
"pcr" : "${0:04X}",
"pe" : "pe",
"pe,nn" : "pe,${1:02X}{0:02X}",
"po" : "po",
"po,nn" : "po,${1:02X}{0:02X}",
"r,a" : "r,a",
"sp" : "sp",
"sp,hl" : "sp,hl",
"sp,indaa" : "sp,(${1:02X}{0:02X})",
"sp,nn" : "sp,${1:02X}{0:02X}",
"z" : "z",
"z,pcr" : "z,${0:04X}",
"z,nn" : "z,${1:02X}{0:02X}",
}
# Op Code Table
# Key is numeric opcode (possibly multiple bytes)
# Value is a list:
# # bytes
# mnemonic
# addressing mode
# flags (e.g. pcr)
opcodeTable = {
0x00 : [ 1, "nop", "implied" ],
0x01 : [ 3, "ld", "bc,nn" ],
0x02 : [ 1, "ld", "indbc,a" ],
0x03 : [ 1, "inc", "bc" ],
0x04 : [ 1, "inc", "b" ],
0x05 : [ 1, "dec", "b" ],
0x06 : [ 2, "ld", "b,n" ],
0x07 : [ 1, "rlca", "implied" ],
0x08 : [ 1, "ex", "af,af'" ],
0x09 : [ 1, "add", "hl,bc" ],
0x0a : [ 1, "ld", "a,indbc" ],
0x0b : [ 1, "dec", "bc" ],
0x0c : [ 1, "inc", "c" ],
0x0d : [ 1, "dec", "c" ],
0x0e : [ 2, "ld", "c,n" ],
0x0f : [ 1, "rrca", "implied" ],
0x10 : [ 2, "djnz", "pcr", pcr ],
0x11 : [ 3, "ld", "de,nn" ],
0x12 : [ 1, "ld", "indde,a" ],
0x13 : [ 1, "inc", "de" ],
0x14 : [ 1, "inc", "d" ],
0x15 : [ 1, "dec", "d" ],
0x16 : [ 2, "ld", "d,n" ],
0x17 : [ 1, "rla", "implied" ],
0x18 : [ 2, "jr", "pcr", pcr ],
0x19 : [ 1, "add", "hl,de" ],
0x1a : [ 1, "ld", "a,indde" ],
0x1b : [ 1, "dec", "de" ],
0x1c : [ 1, "inc", "e" ],
0x1d : [ 1, "dec", "e" ],
0x1e : [ 2, "ld", "e,n" ],
0x1f : [ 1, "rra", "implied" ],
0x20 : [ 2, "jr", "nz,pcr", pcr ],
0x21 : [ 3, "ld", "hl,nn" ],
0x22 : [ 3, "ld", "indnn,hl" ],
0x23 : [ 1, "inc", "hl" ],
0x24 : [ 1, "inc", "h" ],
0x25 : [ 1, "dec", "h" ],
0x26 : [ 2, "ld", "h,n" ],
0x27 : [ 1, "daa", "implied" ],
0x28 : [ 2, "jr", "z,pcr", pcr ],
0x29 : [ 1, "add", "hl,hl" ],
0x2a : [ 3, "ld", "hl,indnn" ],
0x2b : [ 1, "dec", "hl" ],
0x2c : [ 1, "inc", "l" ],
0x2d : [ 1, "dec", "l" ],
0x2e : [ 2, "ld", "l,n" ],
0x2f : [ 1, "cpl", "implied" ],
0x30 : [ 2, "jr", "nc,pcr", pcr ],
0x31 : [ 3, "ld", "sp,nn" ],
0x32 : [ 3, "ld", "indnn,a" ],
0x33 : [ 1, "inc", "sp" ],
0x34 : [ 1, "inc", "indhl" ],
0x35 : [ 1, "dec", "indhl" ],
0x36 : [ 2, "ld", "indhl,n" ],
0x37 : [ 1, "scf", "implied" ],
0x38 : [ 2, "jr", "c,pcr", pcr ],
0x39 : [ 1, "add", "hl,sp" ],
0x3a : [ 3, "ld", "a,indnn" ],
0x3b : [ 1, "dec", "sp" ],
0x3c : [ 1, "inc", "a" ],
0x3d : [ 1, "dec", "a" ],
0x3e : [ 2, "ld", "a,n" ],
0x3f : [ 1, "ccf", "implied" ],
0x40 : [ 1, "ld", "b,b" ],
0x41 : [ 1, "ld", "b,c" ],
0x42 : [ 1, "ld", "b,d" ],
0x43 : [ 1, "ld", "b,e" ],
0x44 : [ 1, "ld", "b,h" ],
0x45 : [ 1, "ld", "b,l" ],
0x46 : [ 1, "ld", "b,indhl" ],
0x47 : [ 1, "ld", "b,a" ],
0x48 : [ 1, "ld", "c,b" ],
0x49 : [ 1, "ld", "c,c" ],
0x4a : [ 1, "ld", "c,d" ],
0x4b : [ 1, "ld", "c,e" ],
0x4c : [ 1, "ld", "c,h" ],
0x4d : [ 1, "ld", "c,l" ],
0x4e : [ 1, "ld", "c,indhl" ],
0x4f : [ 1, "ld", "c,a" ],
0x50 : [ 1, "ld", "d,b" ],
0x51 : [ 1, "ld", "d,c" ],
0x52 : [ 1, "ld", "d,d" ],
0x53 : [ 1, "ld", "d,e" ],
0x54 : [ 1, "ld", "d,h" ],
0x55 : [ 1, "ld", "d,l" ],
0x56 : [ 1, "ld", "d,indhl" ],
0x57 : [ 1, "ld", "d,a" ],
0x58 : [ 1, "ld", "e,b" ],
0x59 : [ 1, "ld", "e,c" ],
0x5a : [ 1, "ld", "e,d" ],
0x5b : [ 1, "ld", "e,e" ],
0x5c : [ 1, "ld", "e,h" ],
0x5d : [ 1, "ld", "e,l" ],
0x5e : [ 1, "ld", "e,indhl" ],
0x5f : [ 1, "ld", "e,a" ],
0x60 : [ 1, "ld", "h,b" ],
0x61 : [ 1, "ld", "h,c" ],
0x62 : [ 1, "ld", "h,d" ],
0x63 : [ 1, "ld", "h,e" ],
0x64 : [ 1, "ld", "h,h" ],
0x65 : [ 1, "ld", "h,l" ],
0x66 : [ 1, "ld", "h,indhl" ],
0x67 : [ 1, "ld", "h,a" ],
0x68 : [ 1, "ld", "l,b" ],
0x69 : [ 1, "ld", "l,c" ],
0x6a : [ 1, "ld", "l,d" ],
0x6b : [ 1, "ld", "l,e" ],
0x6c : [ 1, "ld", "l,h" ],
0x6d : [ 1, "ld", "l,l" ],
0x6e : [ 1, "ld", "l,indhl" ],
0x6f : [ 1, "ld", "l,a" ],
0x70 : [ 1, "ld", "indhl,b" ],
0x71 : [ 1, "ld", "indhl,c" ],
0x72 : [ 1, "ld", "indhl,d" ],
0x73 : [ 1, "ld", "indhl,e" ],
0x74 : [ 1, "ld", "indhl,h" ],
0x75 : [ 1, "ld", "indhl,l" ],
0x76 : [ 1, "halt", "implied" ],
0x77 : [ 1, "ld", "indhl,a" ],
0x78 : [ 1, "ld", "a,b" ],
0x79 : [ 1, "ld", "a,c" ],
0x7a : [ 1, "ld", "a,d" ],
0x7b : [ 1, "ld", "a,e" ],
0x7c : [ 1, "ld", "a,h" ],
0x7d : [ 1, "ld", "a,l" ],
0x7e : [ 1, "ld", "a,indhl" ],
0x7f : [ 1, "ld", "a,a" ],
0x80 : [ 1, "add", "a,b" ],
0x81 : [ 1, "add", "a,c" ],
0x82 : [ 1, "add", "a,d" ],
0x83 : [ 1, "add", "a,e" ],
0x84 : [ 1, "add", "a,h" ],
0x85 : [ 1, "add", "a,l" ],
0x86 : [ 1, "add", "a,indhl" ],
0x87 : [ 1, "add", "a,a" ],
0x88 : [ 1, "adc", "a,b" ],
0x89 : [ 1, "adc", "a,c" ],
0x8a : [ 1, "adc", "a,d" ],
0x8b : [ 1, "adc", "a,e" ],
0x8c : [ 1, "adc", "a,h" ],
0x8d : [ 1, "adc", "a,l" ],
0x8e : [ 1, "adc", "a,indhl" ],
0x8f : [ 1, "adc", "a,a" ],
0x90 : [ 1, "sub", "b" ],
0x91 : [ 1, "sub", "c" ],
0x92 : [ 1, "sub", "d" ],
0x93 : [ 1, "sub", "e" ],
0x94 : [ 1, "sub", "h" ],
0x95 : [ 1, "sub", "l" ],
0x96 : [ 1, "sub", "indhl" ],
0x97 : [ 1, "sub", "a" ],
0x98 : [ 1, "sbc", "a,b" ],
0x99 : [ 1, "sbc", "a,c" ],
0x9a : [ 1, "sbc", "a,d" ],
0x9b : [ 1, "sbc", "a,e" ],
0x9c : [ 1, "sbc", "a,h" ],
0x9d : [ 1, "sbc", "a,l" ],
0x9e : [ 1, "sbc", "a,indhl" ],
0x9f : [ 1, "sbc", "a,a" ],
0xa0 : [ 1, "and", "b" ],
0xa1 : [ 1, "and", "c" ],
0xa2 : [ 1, "and", "d" ],
0xa3 : [ 1, "and", "e" ],
0xa4 : [ 1, "and", "h" ],
0xa5 : [ 1, "and", "l" ],
0xa6 : [ 1, "and", "indhl" ],
0xa7 : [ 1, "and", "a" ],
0xa8 : [ 1, "xor", "b" ],
0xa9 : [ 1, "xor", "c" ],
0xaa : [ 1, "xor", "d" ],
0xab : [ 1, "xor", "e" ],
0xac : [ 1, "xor", "h" ],
0xad : [ 1, "xor", "l" ],
0xae : [ 1, "xor", "indhl" ],
0xaf : [ 1, "xor", "a" ],
0xb0 : [ 1, "or", "b" ],
0xb1 : [ 1, "or", "c" ],
0xb2 : [ 1, "or", "d" ],
0xb3 : [ 1, "or", "e" ],
0xb4 : [ 1, "or", "h" ],
0xb5 : [ 1, "or", "l" ],
0xb6 : [ 1, "or", "indhl" ],
0xb7 : [ 1, "or", "a" ],
0xb8 : [ 1, "cp", "b" ],
0xb9 : [ 1, "cp", "c" ],
0xba : [ 1, "cp", "d" ],
0xbb : [ 1, "cp", "e" ],
0xbc : [ 1, "cp", "h" ],
0xbd : [ 1, "cp", "l" ],
0xbe : [ 1, "cp", "indhl" ],
0xbf : [ 1, "cp", "a" ],
0xc0 : [ 1, "ret", "nz" ],
0xc1 : [ 1, "pop", "bc" ],
0xc2 : [ 3, "jp", "nz,nn" ],
0xc3 : [ 3, "jp", "nn" ],
0xc4 : [ 3, "call","nz,nn" ],
0xc5 : [ 1, "push","bc" ],
0xc6 : [ 2, "add", "a,n" ],
0xc7 : [ 1, "rst", "00" ],
0xc8 : [ 1, "ret", "z" ],
0xc9 : [ 1, "ret", "implied" ],
0xca : [ 3, "jp", "z,nn" ],
0xcc : [ 3, "call","z,nn" ],
0xcd : [ 3, "call", "nn" ],
0xce : [ 2, "adc", "a,n" ],
0xcf : [ 1, "rst", "08" ],
0xd0 : [ 1, "ret", "nc" ],
0xd1 : [ 1, "pop", "de" ],
0xd2 : [ 3, "jp", "nc,nn" ],
0xd3 : [ 2, "out", "indn,a" ],
0xd4 : [ 3, "call", "nc,nn" ],
0xd5 : [ 1, "push", "de" ],
0xd6 : [ 2, "sub", "n" ],
0xd7 : [ 1, "rst", "10" ],
0xd8 : [ 1, "ret", "c" ],
0xd9 : [ 1, "exx", "implied" ],
0xda : [ 3, "jp", "c,nn" ],
0xdb : [ 2, "in", "a,indn" ],
0xdc : [ 3, "call", "c,nn" ],
0xde : [ 2, "sbc", "a,n" ],
0xdf : [ 1, "rst", "18" ],
0xe0 : [ 1, "ret", "po" ],
0xe1 : [ 1, "pop", "hl" ],
0xe2 : [ 3, "jp", "po,nn" ],
0xe3 : [ 1, "ex", "indsp,hl" ],
0xe4 : [ 3, "call", "po,nn" ],
0xe5 : [ 1, "push", "hl" ],
0xe6 : [ 2, "and", "n" ],
0xe7 : [ 1, "rst", "20" ],
0xe8 : [ 1, "ret", "pe" ],
0xe9 : [ 1, "jp", "indhl" ],
0xea : [ 3, "jp", "pe,nn" ],
0xeb : [ 1, "ex", "de,hl" ],
0xec : [ 3, "call", "pe,nn" ],
0xee : [ 2, "xor", "n" ],
0xef : [ 1, "rst", "28" ],
0xf0 : [ 1, "ret", "p" ],
0xf1 : [ 1, "pop", "af" ],
0xf2 : [ 3, "jp", "p,nn" ],
0xf3 : [ 1, "di", "implied" ],
0xf4 : [ 3, "call", "p,nn" ],
0xf5 : [ 1, "push", "af" ],
0xf6 : [ 2, "or", "n" ],
0xf7 : [ 1, "rst", "30" ],
0xf8 : [ 1, "ret", "m" ],
0xf9 : [ 1, "ld", "sp,hl" ],
0xfa : [ 3, "jp", "m,nn" ],
0xfb : [ 1, "ei", "implied" ],
0xfc : [ 3, "call", "m,nn" ],
0xfe : [ 2, "cp", "n" ],
0xff : [ 1, "rst", "38" ],
# Multibyte instructions
0xcb00 : [ 2, "rlc", "b" ],
0xcb01 : [ 2, "rlc", "c" ],
0xcb02 : [ 2, "rlc", "d" ],
0xcb03 : [ 2, "rlc", "e" ],
0xcb04 : [ 2, "rlc", "h" ],
0xcb05 : [ 2, "rlc", "l" ],
0xcb06 : [ 2, "rlc", "indhl" ],
0xcb07 : [ 2, "rlc", "a" ],
0xcb08 : [ 2, "rrc", "b" ],
0xcb09 : [ 2, "rrc", "c" ],
0xcb0a : [ 2, "rrc", "d" ],
0xcb0b : [ 2, "rrc", "e" ],
0xcb0c : [ 2, "rrc", "h" ],
0xcb0d : [ 2, "rrc", "l" ],
0xcb0e : [ 2, "rrc", "indhl" ],
0xcb0f : [ 2, "rrc", "a" ],
0xcb10 : [ 2, "rl", "b" ],
0xcb11 : [ 2, "rl", "c" ],
0xcb12 : [ 2, "rl", "d" ],
0xcb13 : [ 2, "rl", "e" ],
0xcb14 : [ 2, "rl", "h" ],
0xcb15 : [ 2, "rl", "l" ],
0xcb16 : [ 2, "rl", "indhl" ],
0xcb17 : [ 2, "rl", "a" ],
0xcb18 : [ 2, "rr", "b" ],
0xcb19 : [ 2, "rr", "c" ],
0xcb1a : [ 2, "rr", "d" ],
0xcb1b : [ 2, "rr", "e" ],
0xcb1c : [ 2, "rr", "h" ],
0xcb1d : [ 2, "rr", "l" ],
0xcb1e : [ 2, "rr", "indhl" ],
0xcb1f : [ 2, "rr", "a" ],
0xcb20 : [ 2, "sla", "b" ],
0xcb21 : [ 2, "sla", "c" ],
0xcb22 : [ 2, "sla", "d" ],
0xcb23 : [ 2, "sla", "e" ],
0xcb24 : [ 2, "sla", "h" ],
0xcb25 : [ 2, "sla", "l" ],
0xcb26 : [ 2, "sla", "indhl" ],
0xcb27 : [ 2, "sla", "a" ],
0xcb28 : [ 2, "sra", "b" ],
0xcb29 : [ 2, "sra", "c" ],
0xcb2a : [ 2, "sra", "d" ],
0xcb2b : [ 2, "sra", "e" ],
0xcb2c : [ 2, "sra", "h" ],
0xcb2d : [ 2, "sra", "l" ],
0xcb2e : [ 2, "sra", "indhl" ],
0xcb2f : [ 2, "sra", "a" ],
0xcb38 : [ 2, "srl", "b" ],
0xcb39 : [ 2, "srl", "c" ],
0xcb3a : [ 2, "srl", "d" ],
0xcb3b : [ 2, "srl", "e" ],
0xcb3c : [ 2, "srl", "h" ],
0xcb3d : [ 2, "srl", "l" ],
0xcb3e : [ 2, "srl", "indhl" ],
0xcb3f : [ 2, "srl", "a" ],
0xcb40 : [ 2, "bit", "0,b" ],
0xcb41 : [ 2, "bit", "0,c" ],
0xcb42 : [ 2, "bit", "0,d" ],
0xcb43 : [ 2, "bit", "0,e" ],
0xcb44 : [ 2, "bit", "0,h" ],
0xcb45 : [ 2, "bit", "0,l" ],
0xcb46 : [ 2, "bit", "0,indhl" ],
0xcb47 : [ 2, "bit", "0,a" ],
0xcb48 : [ 2, "bit", "1,b" ],
0xcb49 : [ 2, "bit", "1,c" ],
0xcb4a : [ 2, "bit", "1,d" ],
0xcb4b : [ 2, "bit", "1,e" ],
0xcb4c : [ 2, "bit", "1,h" ],
0xcb4d : [ 2, "bit", "1,l" ],
0xcb4e : [ 2, "bit", "1,indhl" ],
0xcb4f : [ 2, "bit", "1,a" ],
0xcb50 : [ 2, "bit", "2,b" ],
0xcb51 : [ 2, "bit", "2,c" ],
0xcb52 : [ 2, "bit", "2,d" ],
0xcb53 : [ 2, "bit", "2,e" ],
0xcb54 : [ 2, "bit", "2,h" ],
0xcb55 : [ 2, "bit", "2,l" ],
0xcb56 : [ 2, "bit", "2,indhl" ],
0xcb57 : [ 2, "bit", "2,a" ],
0xcb58 : [ 2, "bit", "3,b" ],
0xcb59 : [ 2, "bit", "3,c" ],
0xcb5a : [ 2, "bit", "3,d" ],
0xcb5b : [ 2, "bit", "3,e" ],
0xcb5c : [ 2, "bit", "3,h" ],
0xcb5d : [ 2, "bit", "3,l" ],
0xcb5e : [ 2, "bit", "3,indhl" ],
0xcb5f : [ 2, "bit", "3,a" ],
0xcb60 : [ 2, "bit", "4,b" ],
0xcb61 : [ 2, "bit", "4,c" ],
0xcb62 : [ 2, "bit", "4,d" ],
0xcb63 : [ 2, "bit", "4,e" ],
0xcb64 : [ 2, "bit", "4,h" ],
0xcb65 : [ 2, "bit", "4,l" ],
0xcb66 : [ 2, "bit", "4,indhl" ],
0xcb67 : [ 2, "bit", "4,a" ],
0xcb68 : [ 2, "bit", "5,b" ],
0xcb69 : [ 2, "bit", "5,c" ],
0xcb6a : [ 2, "bit", "5,d" ],
0xcb6b : [ 2, "bit", "5,e" ],
0xcb6c : [ 2, "bit", "5,h" ],
0xcb6d : [ 2, "bit", "5,l" ],
0xcb6e : [ 2, "bit", "5,indhl" ],
0xcb6f : [ 2, "bit", "5,a" ],
0xcb70 : [ 2, "bit", "6,b" ],
0xcb71 : [ 2, "bit", "6,c" ],
0xcb72 : [ 2, "bit", "6,d" ],
0xcb73 : [ 2, "bit", "6,e" ],
0xcb74 : [ 2, "bit", "6,h" ],
0xcb75 : [ 2, "bit", "6,l" ],
0xcb76 : [ 2, "bit", "6,indhl" ],
0xcb77 : [ 2, "bit", "6,a" ],
0xcb78 : [ 2, "bit", "7,b" ],
0xcb79 : [ 2, "bit", "7,c" ],
0xcb7a : [ 2, "bit", "7,d" ],
0xcb7b : [ 2, "bit", "7,e" ],
0xcb7c : [ 2, "bit", "7,h" ],
0xcb7d : [ 2, "bit", "7,l" ],
0xcb7e : [ 2, "bit", "7,indhl" ],
0xcb7f : [ 2, "bit", "7,a" ],
0xcb80 : [ 2, "res", "0,b" ],
0xcb81 : [ 2, "res", "0,c" ],
0xcb82 : [ 2, "res", "0,d" ],
0xcb83 : [ 2, "res", "0,e" ],
0xcb84 : [ 2, "res", "0,h" ],
0xcb85 : [ 2, "res", "0,l" ],
0xcb86 : [ 2, "res", "0,indhl" ],
0xcb87 : [ 2, "res", "0,a" ],
0xcb88 : [ 2, "res", "1,b" ],
0xcb89 : [ 2, "res", "1,c" ],
0xcb8a : [ 2, "res", "1,d" ],
0xcb8b : [ 2, "res", "1,e" ],
0xcb8c : [ 2, "res", "1,h" ],
0xcb8d : [ 2, "res", "1,l" ],
0xcb8e : [ 2, "res", "1,indhl" ],
0xcb8f : [ 2, "res", "1,a" ],
0xcb90 : [ 2, "res", "2,b" ],
0xcb91 : [ 2, "res", "2,c" ],
0xcb92 : [ 2, "res", "2,d" ],
0xcb93 : [ 2, "res", "2,e" ],
0xcb94 : [ 2, "res", "2,h" ],
0xcb95 : [ 2, "res", "2,l" ],
0xcb96 : [ 2, "res", "2,indhl" ],
0xcb97 : [ 2, "res", "2,a" ],
0xcb98 : [ 2, "res", "3,b" ],
0xcb99 : [ 2, "res", "3,c" ],
0xcb9a : [ 2, "res", "3,d" ],
0xcb9b : [ 2, "res", "3,e" ],
0xcb9c : [ 2, "res", "3,h" ],
0xcb9d : [ 2, "res", "3,l" ],
0xcb9e : [ 2, "res", "3,indhl" ],
0xcb9f : [ 2, "res", "3,a" ],
0xcba0 : [ 2, "res", "4,b" ],
0xcba1 : [ 2, "res", "4,c" ],
0xcba2 : [ 2, "res", "4,d" ],
0xcba3 : [ 2, "res", "4,e" ],
0xcba4 : [ 2, "res", "4,h" ],
0xcba5 : [ 2, "res", "4,l" ],
0xcba6 : [ 2, "res", "4,indhl" ],
0xcba7 : [ 2, "res", "4,a" ],
0xcba8 : [ 2, "res", "5,b" ],
0xcba9 : [ 2, "res", "5,c" ],
0xcbaa : [ 2, "res", "5,d" ],
0xcbab : [ 2, "res", "5,e" ],
0xcbac : [ 2, "res", "5,h" ],
0xcbad : [ 2, "res", "5,l" ],
0xcbae : [ 2, "res", "5,indhl" ],
0xcbaf : [ 2, "res", "5,a" ],
0xcbb0 : [ 2, "res", "6,b" ],
0xcbb1 : [ 2, "res", "6,c" ],
0xcbb2 : [ 2, "res", "6,d" ],
0xcbb3 : [ 2, "res", "6,e" ],
0xcbb4 : [ 2, "res", "6,h" ],
0xcbb5 : [ 2, "res", "6,l" ],
0xcbb6 : [ 2, "res", "6,indhl" ],
0xcbb7 : [ 2, "res", "6,a" ],
0xcbb8 : [ 2, "res", "7,b" ],
0xcbb9 : [ 2, "res", "7,c" ],
0xcbba : [ 2, "res", "7,d" ],
0xcbbb : [ 2, "res", "7,e" ],
0xcbbc : [ 2, "res", "7,h" ],
0xcbbd : [ 2, "res", "7,l" ],
0xcbbe : [ 2, "res", "7,indhl" ],
0xcbbf : [ 2, "res", "7,a" ],
0xcbc0 : [ 2, "set", "0,b" ],
0xcbc1 : [ 2, "set", "0,c" ],
0xcbc2 : [ 2, "set", "0,d" ],
0xcbc3 : [ 2, "set", "0,e" ],
0xcbc4 : [ 2, "set", "0,h" ],
0xcbc5 : [ 2, "set", "0,l" ],
0xcbc6 : [ 2, "set", "0,indhl" ],
0xcbc7 : [ 2, "set", "0,a" ],
0xcbc8 : [ 2, "set", "1,b" ],
0xcbc9 : [ 2, "set", "1,c" ],
0xcbca : [ 2, "set", "1,d" ],
0xcbcb : [ 2, "set", "1,e" ],
0xcbcc : [ 2, "set", "1,h" ],
0xcbcd : [ 2, "set", "1,l" ],
0xcbce : [ 2, "set", "1,indhl" ],
0xcbcf : [ 2, "set", "1,a" ],
0xcbd0 : [ 2, "set", "2,b" ],
0xcbd1 : [ 2, "set", "2,c" ],
0xcbd2 : [ 2, "set", "2,d" ],
0xcbd3 : [ 2, "set", "2,e" ],
0xcbd4 : [ 2, "set", "2,h" ],
0xcbd5 : [ 2, "set", "2,l" ],
0xcbd6 : [ 2, "set", "2,indhl" ],
0xcbd7 : [ 2, "set", "2,a" ],
0xcbd8 : [ 2, "set", "3,b" ],
0xcbd9 : [ 2, "set", "3,c" ],
0xcbda : [ 2, "set", "3,d" ],
0xcbdb : [ 2, "set", "3,e" ],
0xcbdc : [ 2, "set", "3,h" ],
0xcbdd : [ 2, "set", "3,l" ],
0xcbde : [ 2, "set", "3,indhl" ],
0xcbdf : [ 2, "set", "3,a" ],
0xcbe0 : [ 2, "set", "4,b" ],
0xcbe1 : [ 2, "set", "4,c" ],
0xcbe2 : [ 2, "set", "4,d" ],
0xcbe3 : [ 2, "set", "4,e" ],
0xcbe4 : [ 2, "set", "4,h" ],
0xcbe5 : [ 2, "set", "4,l" ],
0xcbe6 : [ 2, "set", "4,indhl" ],
0xcbe7 : [ 2, "set", "4,a" ],
0xcbe8 : [ 2, "set", "5,b" ],
0xcbe9 : [ 2, "set", "5,c" ],
0xcbea : [ 2, "set", "5,d" ],
0xcbeb : [ 2, "set", "5,e" ],
0xcbec : [ 2, "set", "5,h" ],
0xcbed : [ 2, "set", "5,l" ],
0xcbee : [ 2, "set", "5,indhl" ],
0xcbef : [ 2, "set", "5,a" ],
0xcbf0 : [ 2, "set", "6,b" ],
0xcbf1 : [ 2, "set", "6,c" ],
0xcbf2 : [ 2, "set", "6,d" ],
0xcbf3 : [ 2, "set", "6,e" ],
0xcbf4 : [ 2, "set", "6,h" ],
0xcbf5 : [ 2, "set", "6,l" ],
0xcbf6 : [ 2, "set", "6,indhl" ],
0xcbf7 : [ 2, "set", "6,a" ],
0xcbf8 : [ 2, "set", "7,b" ],
0xcbf9 : [ 2, "set", "7,c" ],
0xcbfa : [ 2, "set", "7,d" ],
0xcbfb : [ 2, "set", "7,e" ],
0xcbfc : [ 2, "set", "7,h" ],
0xcbfd : [ 2, "set", "7,l" ],
0xcbfe : [ 2, "set", "7,indhl" ],
0xcbff : [ 2, "set", "7,a" ],
0xdd09 : [ 2, "add", "ix,bc" ],
0xdd19 : [ 2, "add", "ix,de" ],
0xdd21 : [ 4, "ld", "ix,aa" ],
0xdd22 : [ 4, "ld", "indaa,ix" ],
0xdd23 : [ 2, "inc", "ix" ],
0xdd29 : [ 2, "add", "ix,ix" ],
0xdd2a : [ 4, "ld", "ix,indaa" ],
0xdd2b : [ 2, "dec", "ix" ],
0xdd34 : [ 3, "inc", "indix+d" ],
0xdd35 : [ 3, "dec", "indix+d" ],
0xdd36 : [ 4, "ld", "indix+d,n" ],
0xdd39 : [ 2, "add", "ix,sp" ],
0xdd46 : [ 3, "ld", "b,indix+d" ],
0xdd4e : [ 3, "ld", "c,indix+d" ],
0xdd56 : [ 3, "ld", "d,indix+d" ],
0xdd5e : [ 3, "ld", "e,indix+d" ],
0xdd66 : [ 3, "ld", "h,indix+d" ],
0xdd6e : [ 3, "ld", "l,indix+d" ],
0xdd70 : [ 3, "ld", "indix+d,b" ],
0xdd71 : [ 3, "ld", "indix+d,c" ],
0xdd72 : [ 3, "ld", "indix+d,d" ],
0xdd73 : [ 3, "ld", "indix+d,e" ],
0xdd74 : [ 3, "ld", "indix+d,h" ],
0xdd75 : [ 3, "ld", "indix+d,l" ],
0xdd77 : [ 3, "ld", "indix+d,a" ],
0xdd7e : [ 3, "ld", "a,indix+d" ],
0xdd86 : [ 3, "add", "a,indix+d" ],
0xdd8e : [ 3, "adc", "a,indix+d" ],
0xdd96 : [ 3, "sub", "indix+d" ],
0xdd9e : [ 3, "sbc", "a,indix+d" ],
0xdda6 : [ 3, "and", "indix+d" ],
0xddae : [ 3, "xor", "indix+d" ],
0xddb6 : [ 3, "or", "indix+d" ],
0xddbe : [ 3, "cp", "indix+d" ],
0xdd8e : [3, "adc", "indix+d" ],
0xed40 : [ 2, "in", "b,indc" ],
0xed41 : [ 2, "out", "indc,b" ],
0xed42 : [ 2, "sbc", "hl,bc" ],
0xed43 : [ 4, "ld", "indaa,bc" ],
0xed44 : [ 2, "neg", "implied" ],
0xed45 : [ 2, "retn", "implied" ],
0xed46 : [ 2, "im", "0" ],
0xed47 : [ 2, "ld", "i,a" ],
0xed48 : [ 2, "in", "c,indc" ],
0xed49 : [ 2, "out", "indc,c" ],
0xed4a : [ 2, "adc", "hl,bc" ],
0xed4b : [ 4, "ld", "bc,indaa" ],
0xed4d : [ 2, "reti", "implied" ],
0xed4f : [ 2, "ld", "r,a" ],
0xed50 : [ 2, "in", "d,indc" ],
0xed51 : [ 2, "out", "indc,d" ],
0xed52 : [ 2, "sbc", "hl,de" ],
0xed53 : [ 4, "ld", "indaa,de" ],
0xed56 : [ 2, "im", "1" ],
0xed57 : [ 2, "ld", "a,i" ],
0xed58 : [ 2, "in", "e,indc" ],
0xed59 : [ 2, "out", "indc,e" ],
0xed5a : [ 2, "adc", "hl,de" ],
0xed5b : [ 4, "ld", "de,indaa" ],
0xed5e : [ 2, "im", "2" ],
0xed5f : [ 2, "ld", "a,r" ],
0xed60 : [ 2, "in", "h,indc" ],
0xed61 : [ 2, "out", "indc,h" ],
0xed62 : [ 2, "sbc", "hl,hl" ],
0xed67 : [ 2, "rrd", "implied" ],
0xed68 : [ 2, "in", "l,indc" ],
0xed69 : [ 2, "out", "indc,l" ],
0xed6a : [ 2, "adc", "hl,hl" ],
0xed6f : [ 2, "rld", "implied" ],
0xed72 : [ 2, "sbc", "hl,sp" ],
0xed73 : [ 4, "ld", "indaa,sp" ],
0xed76 : [ 2, "in", "a,indc" ],
0xed79 : [ 2, "out", "indc,a" ],
0xed7a : [ 2, "adc", "hl,sp" ],
0xed7b : [ 4, "ld", "sp,indaa" ],
0xeda0 : [ 2, "ldi", "implied" ],
0xeda1 : [ 2, "cpi", "implied" ],
0xeda2 : [ 2, "ini", "implied" ],
0xeda3 : [ 2, "outi", "implied" ],
0xeda8 : [ 2, "ldd", "implied" ],
0xeda9 : [ 2, "cpd", "implied" ],
0xedaa : [ 2, "ind", "implied" ],
0xedab : [ 2, "outd", "implied" ],
0xedb0 : [ 2, "ldir", "implied" ],
0xedb1 : [ 2, "cpir", "implied" ],
0xedb2 : [ 2, "inir", "implied" ],
0xedb3 : [ 2, "otir", "implied" ],
0xedb8 : [ 2, "lddr", "implied" ],
0xedb9 : [ 2, "cpdr", "implied" ],
0xedba : [ 2, "indr", "implied" ],
0xedbb : [ 2, "otdr", "implied" ],
0xfd09 : [ 2, "add", "iy,bc" ],
0xfd19 : [ 2, "add", "iy,de" ],
0xfd21 : [ 4, "ld", "iy,aa" ],
0xfd22 : [ 4, "ld", "indaa,iy" ],
0xfd23 : [ 2, "inc", "iy" ],
0xfd29 : [ 2, "add", "iy,iy" ],
0xfd2a : [ 4, "ld", "iy,indaa" ],
0xfd2b : [ 2, "dec", "iy" ],
0xfd34 : [ 3, "inc", "indiy+d" ],
0xfd35 : [ 3, "dec", "indiy+d" ],
0xfd36 : [ 4, "ld", "indiy+d,n" ],
0xfd39 : [ 2, "add", "iy,sp" ],
0xfd46 : [ 3, "ld", "b,indiy+d" ],
0xfd4e : [ 3, "ld", "c,indiy+d" ],
0xfd56 : [ 3, "ld", "d,indiy+d" ],
0xfd5e : [ 3, "ld", "e,indiy+d" ],
0xfd66 : [ 3, "ld", "h,indiy+d" ],
0xfd6e : [ 3, "ld", "l,indiy+d" ],
0xfd70 : [ 3, "ld", "indiy+d,b" ],
0xfd71 : [ 3, "ld", "indiy+d,c" ],
0xfd72 : [ 3, "ld", "indiy+d,d" ],
0xfd73 : [ 3, "ld", "indiy+d,e" ],
0xfd74 : [ 3, "ld", "indiy+d,h" ],
0xfd75 : [ 3, "ld", "indiy+d,l" ],
0xfd77 : [ 3, "ld", "indiy+d,a" ],
0xfd7e : [ 3, "ld", "a,indiy+d" ],
0xfd86 : [ 3, "add", "a,indiy+d" ],
0xfd8e : [ 3, "adc", "a,indiy+d" ],
0xfd96 : [ 3, "sub", "indiy+d" ],
0xfd9e : [ 3, "sbc", "a,indiy+d" ],
0xfda6 : [ 3, "and", "indiy+d" ],
0xfdae : [ 3, "xor", "indiy+d" ],
0xfdb6 : [ 3, "or", "indiy+d" ],
0xfdbe : [ 3, "cp", "indiy+d" ],
# Placeholder 2-byte leadins for the 4-byte ix/iy bit instructions fully
# defined below. The z80bit flag triggers a special case in the disassembler
# to look up the 4 byte instruction.
0xddcb : [ 4, "ixbit", "implied", z80bit ],
0xfdcb : [ 4, "iybit", "implied", z80bit ],
}
def extra_opcodes(addr_table, op_table):
# Create all the 0xddcb and 0xfdcb addressing modes. The modes look like [0-7],(i[xy]+*)[,[abcdehl]]?
for index in ['x', 'y']:
for bit in range(8):
k = "%d,indi%s+d" % (bit, index)
v = "%d,(i%s+${0:02X})" % (bit, index)
addr_table[k] = v
for reg in ['a', 'b', 'c', 'd', 'e', 'h', 'l']:
k = "%d,indi%s+d,%s" % (bit, index, reg)
v = "%d,(i%s+${0:02X}),%s" % (bit, index, reg)
addr_table[k] = v
# Create all the 0xddcb and 0xfdcb opcodes. These are all 4 byte opcodes
# where the 3rd byte is a -128 - +127 offset. For the purposes of using
# this table, the 3rd byte will be marked as zero and the disassembler will
# have to insert the real 3rd byte the check of the z80bit special case
for first_byte, x_or_y in [(0xdd, 'x'), (0xfd, 'y')]:
# groups of 8, expand to full 256
mnemonics_8 = ['rlc', 'rrc', 'rl', 'rr', 'sla', 'sra', 'sll', 'sr1'] + ['bit'] * 8 + ['res'] * 8 + ['set'] * 8
mnemonics = [m for mnemonic in mnemonics_8 for m in [mnemonic]*8]
# create all 256 addressing modes, in groups of 64
addrmodes = ['indi%s+d' + a for a in [',b', ',c', ',d', ',e', ',h', ',l', '', ',a']] * 8 + [f % d for d in range(8) for f in ['%d,indi%%s+d'] * 8] + [f % d for d in range(8) for f in ['%d,indi%%s+d' + a for a in [',b', ',c', ',d', ',e', ',h', ',l', '', ',a']]] * 2
for fourth_byte, (instruction, addrmode) in enumerate(zip(mnemonics, addrmodes)):
opcode = (first_byte << 24) + (0xcb << 16) + fourth_byte
op_table[opcode] = [ 4, instruction, addrmode % x_or_y, z80bit ]
extra_opcodes(addressModeTable, opcodeTable)
del extra_opcodes
# End of processor specific code
##########################################################################
|
def min_platforms(arrival, departure):
arrival.sort()
departure.sort()
platform_count = 1
output = 1
i = 1
j = 0
while i < len(arrival) and j < len(arrival):
if arrival[i] < departure[j]:
platform_count += 1
i += 1
if platform_count > output:
output = platform_count
else:
platform_count -= 1
j += 1
return output |
# -*- coding: utf-8 -*-
"""
Created on Mon May 30 18:27:14 2022
@author: Martin Johnson
"""
|
# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
def someFunctionThatReturnsDeletedValueViaAttributeLookup():
class C:
def __getattr__(self, attr_name):
nonlocal a
del a
c = C()
a = 1
c.something
return a
try:
someFunctionThatReturnsDeletedValueViaAttributeLookup()
except UnboundLocalError:
print("OK, object attribute look-up correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaAttributeSetting():
class C:
def __setattr__(self, attr_name, value):
nonlocal a
del a
c = C()
a = 1
c.something = 1
return a
try:
someFunctionThatReturnsDeletedValueViaAttributeSetting()
except UnboundLocalError:
print("OK, object attribute setting correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaAttributeDel():
class C:
def __delattr__(self, attr_name):
nonlocal a
del a
return True
c = C()
a = 1
del c.something
return a
try:
someFunctionThatReturnsDeletedValueViaAttributeDel()
except UnboundLocalError:
print("OK, object attribute del correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaItemLookup():
class C:
def __getitem__(self, attr_name):
nonlocal a
del a
c = C()
a = 1
c[2]
return a
try:
someFunctionThatReturnsDeletedValueViaItemLookup()
except UnboundLocalError:
print("OK, object subscript look-up correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaItemSetting():
class C:
def __setitem__(self, attr_name, value):
nonlocal a
del a
c = C()
a = 1
c[2] = 3
return a
try:
someFunctionThatReturnsDeletedValueViaItemSetting()
except UnboundLocalError:
print("OK, object subscript setting correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaItemDel():
class C:
def __delitem__(self, attr_name):
nonlocal a
del a
c = C()
a = 1
del c[2]
return a
try:
someFunctionThatReturnsDeletedValueViaItemDel()
except UnboundLocalError:
print("OK, object subscript del correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaCall():
class C:
def __call__(self):
nonlocal a
del a
c = C()
a = 1
c()
return a
try:
someFunctionThatReturnsDeletedValueViaCall()
except UnboundLocalError:
print("OK, object call correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaAdd():
class C:
def __add__(self, other):
nonlocal a
del a
c = C()
a = 1
c += 1
return a
try:
someFunctionThatReturnsDeletedValueViaAdd()
except UnboundLocalError:
print("OK, object add correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaSub():
class C:
def __add__(self, other):
nonlocal a
del a
c = C()
a = 1
c += 1
return a
try:
someFunctionThatReturnsDeletedValueViaSub()
except UnboundLocalError:
print("OK, object sub correctly deleted an item.")
else:
print("Ouch.!")
# TODO: There is a whole lot more operations to cover.
def someFunctionThatReturnsDeletedValueViaNot():
class C:
def __bool__(self):
nonlocal a
del a
return False
c = C()
a = 1
not c
return a
try:
someFunctionThatReturnsDeletedValueViaNot()
except UnboundLocalError:
print("OK, object not correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaRepr():
class C:
def __repr__(self):
nonlocal a
del a
return "<some_repr>"
c = C()
a = 1
repr(c)
return a
try:
someFunctionThatReturnsDeletedValueViaRepr()
except UnboundLocalError:
print("OK, object repr correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaStr():
class C:
def __str__(self):
nonlocal a
del a
return "<some_repr>"
c = C()
a = 1
str(c)
return a
try:
someFunctionThatReturnsDeletedValueViaStr()
except UnboundLocalError:
print("OK, object str correctly deleted an item.")
else:
print("Ouch.!")
def someFunctionThatReturnsDeletedValueViaCompare():
class C:
def __lt__(self, other):
nonlocal a
del a
return "<some_repr>"
c = C()
a = 1
c < None
return a
try:
someFunctionThatReturnsDeletedValueViaCompare()
except UnboundLocalError:
print("OK, object compare correctly deleted an item.")
else:
print("Ouch.!")
# TODO: The "del" operation may surrect a variable value by "__del__".
# TODO: There must be way more than these.
|
class Solution:
def XXX(self, n: int) -> int:
nums=[]
nums.append(1)
nums.append(2)
if n>2:
for i in range(2,n,1):
nums.append( nums[-1] + nums[-2] )
return nums[n-1]
|
def foo():
def bar():
def baz():
pass
# baz 1
# baz 2
# baz 3
# bar
# foo
|
# Write a function on_all that applies a function to every element of a list.
# Use it to print the first twenty perfect squares.
# The perfect squares can be found by multiplying each natural number with itself.
# The first few perfect squares are 1*1= 1, 2*2=4, 3*3=9, 4*4=16.
# Twelve for example is not a perfect square because there is no natural number m so that m*m=12.
# (This question is tricky if your programming language makes it difficult to pass functions as arguments.)
def check_so_hoan_hao(a):
for i in range(int(a) + 1):
if (i * i == a):
return a
def nhap(n, a):
for i in range(n):
x = int(input("nhap phan tu thu " + str(i + 1) + ": "))
a.append(x)
def tim_so_hoan_hao(a):
print("so hoan hao trong list:", end=" ")
for i in a:
if (check_so_hoan_hao(i) == i):
print(i, end=" ")
my_list = []
n = int(input("nhap so phan tu: "))
nhap(n, my_list)
print("my_list = ", my_list)
tim_so_hoan_hao(my_list)
|
class Node:
def __init__(self,value, next=None):
self.value = value
self.next = next
self.read = 0
class Queue:
def __init__(self, front=None, rear=None):
self.front = front
self.rear = rear
def enqueue(self, value):
node = Node(value)
if not self.front:
self.front = node
self.rear = self.front
else:
self.rear.next = node
self.rear = node
def dequeue(self):
if not self.front:
return
else:
temp = self.front.value
self.front = self.front.next
return temp
class Edge:
def __init__(self,end, weight=0):
self.end = end
self.weight = weight
class Graph:
def __init__(self):
self._adjacency_list = {}
def add_vertex(self,value):
vertex = Node(value)
self._adjacency_list[vertex] = []
return vertex
def add_edge(self, start, end, weight=0):
if not start in self._adjacency_list:
raise Exception('start vertex not in graph')
if not end in self._adjacency_list:
raise Exception('end vertex not in graph')
edge = Edge(end, weight)
self._adjacency_list[start].append(edge)
def breadth_first_traversal(self,start):
output = ""
queue = Queue()
start.read = 1
queue.enqueue(start)
while queue.front:
current = queue.dequeue()
output += f"{current.value}"
for edge in self._adjacency_list[current]:
if not edge.end.read:
edge.end.read = 1
queue.enqueue(edge.end)
return output
|
class parser_base(object):
def __init__(self, file_body, **kwargs):
#
self.body = file_body
# Include any optional key word arguments that were provided in
# the instance dictionary
self.__dict__.update(kwargs)
# Initialize the dictionary that will receive parsed items
self.parsed = {}
# Override this in parser subclasses to implement parsers for different form types.
def _parsing_work_function(self):
# Get all the real work done here and in other internal functions
# For example, set a test entry in the self.parsed dictionary
# self.parsed['test'] = 'pass'
pass
def parse(self):
# Call one or more internal functions that will populate the
# self.parsed dictionary
self._parsing_work_function()
# Return the dictionary of parsed items.
return self.parsed |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def lowestCommonAncestor(root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
result = root
while True :
if p.val < result.val and q.val < result.val :
result = result.left
elif p.val > result.val and q.val > result.val :
result = result.right
else :
return result
if __name__ == "__main__" :
node = TreeNode(3)
node.left = TreeNode(5)
node.right = TreeNode(1)
node.left.left = TreeNode(6)
node.left.right = TreeNode(2)
node.left.right.left = TreeNode(7)
node.left.right.right = TreeNode(4)
node.right.left = TreeNode(0)
node.right.right = TreeNode(8)
p = TreeNode(5)
q = TreeNode(1)
result = lowestCommonAncestor(node,p,q)
print(result.val) |
if __name__ == '__main__':
a = int(input())
b = int(input())
int_result = int(a/b)
float_result = a/b
print(int_result)
print(float_result) |
n1 = int(input("Digite um número inteiro: "))
n2 = int(input("Digite um número inteiro: "))
n3 = int(input("Digite um número inteiro: "))
n4 = int(input("Digite um número inteiro: "))
n5 = int(input("Digite um número inteiro: "))
lista = [n1, n2, n3, n4, n5]
print("A soma dos números da lista é: ", sum(lista)) |
#!/usr/bin/python
# egyptian opentype generator data
qcontrols = ['vj','hj','ts','bs','te','be','om','ss','se','cb','ce','cre','cfb','cfe','hwtb','hwte','hwttb','hwtte','hwtbb','hwtbe','hwtfb','hwtfe','dottedcircle','O33aEL','O33aER','O33aEB']
featurename = {
'abvs' : {'prefix':'ab','name':'Above-base Substitutions','type':'GSUB'},
'blws' : {'prefix':'bl','name':'Below-base Substitutions','type':'GSUB'},
'haln' : {'prefix':'ha','name':'Halant Forms','type':'GSUB'},
'mark' : {'prefix':'ma','name':'Mark Positioning','type':'GPOS'},
'mkmk' : {'prefix':'mk','name':'Mark to Mark Positioning','type':'GPOS'},
'pres' : {'prefix':'pr','name':'Pre-base Substitutions','type':'GSUB'},
'psts' : {'prefix':'ps','name':'Post-base Substitutions','type':'GSUB'},
'rlig' : {'prefix':'rl','name':'Required Ligatures','type':'GSUB'},
'rtlm' : {'prefix':'rt','name':'Right-to-left mirrored forms','type':'GSUB'},
'vrt2' : {'prefix':'vr','name':'Vertical Alternates and Rotation','type':'GSUB'}
}
groupdata = {
'bases_all' : ['quadratBases','quadratCartouches','quadratFortifieds','quadratCartouchesV','quadratFortifiedsV'],
'cartoucheendsL' : ['csL','creL','ceL','hwtsL','hwteL','hwttsL','hwtteL','hwtbsL','hwtbeL','cfsL', 'cfeL','hfsL','hfeL','O33aEL'],
'cartoucheendsR' : ['csR','creR','ceR','hwtsR','hwteR','hwttsR','hwtteR','hwtbsR','hwtbeR','cfsR', 'cfeR','hfsR','hfeR','O33aER'],
'cartoucheendsV' : ['csT','creB','ceB','hwtsT','hwteB','hwttsT','hwtteB','hwtbsT','hwtbeB','cfsT', 'cfeB','hfsT','hfeB','O33aEB'],
'characters_all' : ['GB1'],
# 'cobras' : ['F20','I1','I10','I11','I31','M10','V22','V23','V23a'],
'colCounter' : ['hj2B','hj1B','hj0B','h0'],
'colspacers0' : ['c0s4p0','c0s3p0','c0s2p0','c0s1p5','c0s1p0','c0s0p5','c0s0p66','c0s0p33','c0s0p25'],
'colspacers0R' : ['c0s4p0R','c0s3p0R','c0s2p0R','c0s1p5R','c0s1p0R','c0s0p5R','c0s0p66R','c0s0p33R','c0s0p25R'],
'colspacers1' : ['c1s3p0','c1s2p0','c1s1p0','c1s0p5','c1s0p33'],
'colspacers1R' : ['c1s3p0R','c1s2p0R','c1s1p0R','c1s0p5R','c1s0p33R'],
'colspacers2' : ['c2s1p0'],
'colspacers2R' : ['c2s1p0R'],
'color_all' : [],
'controls_a' : ['controls_joiners','ss','se'],
'controls_b' : ['hj1A','vj1A','hj0A','vj0A','hj2A','vj2A','corners0a','corners1a','om0A','om1A'],
'controls_ng': ['Qi','Qf','m0','cleanup','ins1l0','ins1','et00','dda','mn5','mn4','mn3','mn2','mn1','ub','it00','it00a'], #controls not grouped for injection
'controls_joiners' : ['hj','vj','ts','te','bs','be','om'],
'cornerglyphs' : [],
'corners' : ['ts','te','bs','be'],
'corners0a' : ['its0A','ibs0A','ite0A','ibe0A','om0A'],
'corners0b' : ['its0B','ibs0B','ite0B','ibe0B','om0B'],
'corners0bNotOM' : ['its0B','ibs0B','ite0B','ibe0B'],
'corners1a' : ['its1A','ibs1A','ite1A','ibe1A','om1A'],
'corners1b' : ['its1B','ibs1B','ite1B','ibe1B','om1B'],
'corners1bNotOM' : ['its1B','ibs1B','ite1B','ibe1B'],
'counters_h' : ['ch0','ch1','ch2','ch3','ch4','ch5','ch6','ch7','ch8','ch9','ch10','ch11','ch12','ch13','ch14','ch15','ch16','ch17','ch18','ch19','ch20','ch21','ch22','ch23','ch24','ch25','ch26','ch27','ch28','ch29','ch30','ch31','ch32','ch33','ch34','ch35','ch36','chb'],
'counters_v' : ['cv0','cv1','cv2','cv3','cv4','cv5','cv6','cv7','cv8','cv9','cv10','cv11','cv12','cv13','cv14','cv15','cv16','cv17','cv18','cv19','cv20','cv21','cv22','cv23','cv24','cv25','cv26','cv27','cv28','cv29','cv30','cv31','cv32','cv33','cv34','cv35','cv36','cvb'],
'deltas' : ['dv1','dv2','dv3','dv4','dv5','dv6','dv7','dv8','dv9','dv10','dv11','dv12','dv13','dv14','dv15','dv16','dv17','dv18','dv19','dv20','dv21','dv22','dv23','dv24','dv25','dv26','dv27','dv28','dv29','dv30'],
'deltas_sp' : ['ds5','ds4','ds3','ds2','ds1'],
'deltas_cells' : ['dCells','en_all'],
'deltas_spacers' : ['spacers_deltarows','cs0','rs0'],
'deltas_all' : ['dd1','dv0','deltas','th6','th5','th4','th3','th2'],
'dCells' : ['dc0','dc1','dc2','dc3','dc4','dc5'],
'eh_all' : ['eh1','eh2','eh3','eh4','eh5','eh6','eh7','eh8'],
'en_all' : ['en1','en2','en3','en4','en5','en6','enb'],
'et_all' : ['et11','et12','et13','et14','et15','et16','et21','et22','et23','et24','et25','et26','et31','et32','et33','et34','et35','et36','et41','et42','et43','et44','et45','et46','et51','et52','et53','et54','et55','et56','et61','et62','et63','et64','et65','et66','et71','et72','et73','et74','et75','et76','et81','et82','et83','et84','et85','et86'],
'ev_all' : ['ev1','ev2','ev3','ev4','ev5','ev6'],
'expansionheights' : ['xv1','xv2','xv3','xv4','xv5'],
'expansion_lvl0' : ['rowplus','expansionheights','r0eA'],
'expansion_lvl1' : ['rowplus','expansionheights','r1eA'],
'expansion_lvl2' : ['rowplus','expansionheights','r2eA'],
'glyphs_all' : ['placeholder'],
'groupCounters' : ['grp0','grp1','grp2'],
'horizontals2' : ['eh_all','h1','h2','h3','h4','h5','h6','h7','h8'],
'insertionmarkers': ['ima','imb','im0'],
'insertionsizes1' : [ 'it11','it12','it13','it14','it15','it16','it21','it22','it23','it24','it25','it26','it31','it32','it33','it34','it35','it36','it41','it42','it43','it44','it45','it46','it51','it52','it53','it54','it55','it56','it61','it62','it63','it64','it65','it66'],
'insertionsizes1R' : [ 'it11R' ,'it12R' ,'it13R' ,'it14R' ,'it15R' ,'it16R' ,'it21R' ,'it22R' ,'it23R' ,'it24R' ,'it25R' ,'it26R' ,'it31R' ,'it32R' ,'it33R' ,'it34R' ,'it35R' ,'it36R' ,'it41R' ,'it42R' ,'it43R' ,'it44R' ,'it45R' ,'it46R' ,'it51R' ,'it52R' ,'it53R' ,'it54R' ,'it55R' ,'it56R' ,'it61R' ,'it62R' ,'it63R' ,'it64R' ,'it65R' ,'it66R'],
'insertionsizes2' : [ 'it211' ,'it212' ,'it213' ,'it214' ,'it215' ,'it216' ,'it221' ,'it222' ,'it223' ,'it224' ,'it225' ,'it226' ,'it231' ,'it232' ,'it233' ,'it234' ,'it235' ,'it236' ,'it241' ,'it242' ,'it243' ,'it244' ,'it245' ,'it246' ,'it251' ,'it252' ,'it253' ,'it254' ,'it255' ,'it256' ,'it261' ,'it262' ,'it263' ,'it264' ,'it265' ,'it266'],
'insertionsizes2R' : [ 'it211R','it212R','it213R','it214R','it215R','it216R','it221R','it222R','it223R','it224R','it225R','it226R','it231R','it232R','it233R','it234R','it235R','it236R','it241R','it242R','it243R','it244R','it245R','it246R','it251R','it252R','it253R','it254R','it255R','it256R','it261R','it262R','it263R','it264R','it265R','it266R'],
'insertions' : ['insertionmarkers','insertionsizes1a'],
'minsizes' : [ 'mt11','mt12','mt13','mt14','mt15','mt16','mt21','mt22','mt23','mt24','mt25','mt26','mt31','mt32','mt33','mt34','mt35','mt36','mt41','mt42','mt43','mt44','mt45','mt46','mt51','mt52','mt53','mt54','mt55','mt56','mt61','mt62','mt63','mt64','mt65','mt66', 'su'],
'mirror_all' : [],
'multicorners1' : ['shapes_ts','shapes_bs','shapes_te','shapes_be','it00','cornerglyphs','c0eA'],
'multicorners2' : ['shapes_ts2','shapes_bs2','shapes_te2','shapes_be2','it00','cornerglyphs','c1eA'],
'normalize' : ['dn1','dn2','dn3','dn4','dn5','hn1','hn2','hn3','hn4','hn5'],
'parens' : ['parens_h','parens_v','corners0a','corners1a','om0A'],
'parensub' : ['parens_h','parens_v','corners0a','corners1a','om0A','su'],
'parens_h' : ['c0bA','c0eA','c1bA','c1eA','c2bA','c2eA'],
'parens_v' : ['r0bA','r0eA','r1bA','r1eA','r2bA','r2eA'],
'quadratBases' : ['QB1','QB2','QB3','QB4','QB5','QB6','QB7','QB8'],
'quadratCartouches' : ['QC1','QC2','QC3','QC4','QC5','QC6','QC7','QC8'],
'quadratCartouchesV' : ['QC1V','QC2V','QC3V','QC4V','QC5V','QC6V','QC7V','QC8V'],
'quadratFortifieds' : ['QF1','QF2','QF3','QF4','QF5','QF6','QF7','QF8'],
'quadratFortifiedsV' : ['QF1V','QF2V','QF3V','QF4V','QF5V','QF6V','QF7V','QF8V'],
'rowCounter' : ['vj0B','vj1B','vj2B','v0'],
'rowmaxes' : ['rm1','rm2','rm3','rm4','rm5','rm6','rm7','rm8','rc0','minsizes'],
'rowplus' : ['rp1','rp2','rp3','rp4','rp5'],
'rowspacers0' : ['r0s4p0','r0s3p0','r0s2p0','r0s1p5','r0s1p0','r0s0p5','r0s0p66','r0s0p33','r0s0p25'],
'rowspacers0R' : ['r0s4p0R','r0s3p0R','r0s2p0R','r0s1p5R','r0s1p0R','r0s0p5R','r0s0p66R','r0s0p33R','r0s0p25R'],
'rowspacers1' : ['r1s4p0','r1s3p0','r1s2p0','r1s1p0','r1s0p5','r1s0p33'],
'rowspacers1R' : ['r1s4p0R','r1s3p0R','r1s2p0R','r1s1p0R','r1s0p5R','r1s0p33R'],
'rowspacers2' : ['r2s1p0'],
'rowspacers2R' : ['r2s1p0R'],
'shapes_0' : ['o86','o85','o84','o83','o82','o81','o76','o75','o74','o73','o72','o71','o66','o65','o64','o63','o62','o61','o56','o55','o54','o53','o52','o51','o46','o45','o44','o43','o42','o41','o36','o35','o34','o33','o32','o31','o26','o25','o24','o23','o22','o21','o16','o15','o14','o13','o12','o11'],
'shapes_1' : ['s66','s65','s64','s63','s62','s61','s56','s55','s54','s53','s52','s51','s46','s45','s44','s43','s42','s41','s36','s35','s34','s33','s32','s31','s26','s25','s24','s23','s22','s21','s16','s15','s14','s13','s12','s11'],
'shapes_2' : ['i66','i65','i64','i63','i62','i61','i56','i55','i54','i53','i52','i51','i46','i45','i44','i43','i42','i41','i36','i35','i34','i33','i32','i31','i26','i25','i24','i23','i22','i21','i16','i15','i14','i13','i12','i11'],
'shapeinsertions0' : ['shapes_0','ih0','iv0','shapes_ts','shapes_bs','shapes_te','shapes_be','shapes_om'],
'shapeinsertions1' : ['shapes_1','shapes_ts2','shapes_bs2','shapes_te2','shapes_be2','shapes_om2'], # ih0 and iv0 not included. . .
'insertionsizes' : ['ih1','ih2','ih3','ih4','ih5','ih6','iv2','iv3','iv4','iv5','iv6'],
'shapes_insert0_POS' : ['o66','o65','o64','o63','o62','o56','o55','o54','o53','o52','o46','o45','o44','o43','o42','o36','o35','o34','o33','o32','o26','o25','o24','o23','o22'],
'shapes_ts' : ['ts66','ts65','ts64','ts63','ts62','ts56','ts55','ts54','ts53','ts52','ts46','ts45','ts44','ts43','ts42','ts36','ts35','ts34','ts33','ts32','ts26','ts25','ts24','ts23','ts22'],
'shapes_bs' : ['bs66','bs65','bs64','bs63','bs62','bs56','bs55','bs54','bs53','bs52','bs46','bs45','bs44','bs43','bs42','bs36','bs35','bs34','bs33','bs32','bs26','bs25','bs24','bs23','bs22'],
'shapes_te' : ['te66','te65','te64','te63','te62','te56','te55','te54','te53','te52','te46','te45','te44','te43','te42','te36','te35','te34','te33','te32','te26','te25','te24','te23','te22'],
'shapes_be' : ['be66','be65','be64','be63','be62','be56','be55','be54','be53','be52','be46','be45','be44','be43','be42','be36','be35','be34','be33','be32','be26','be25','be24','be23','be22'],
'shapes_om' : ['om66','om65','om64','om63','om62','om61','om56','om55','om54','om53','om52','om51','om46','om45','om44','om43','om42','om41','om36','om35','om34','om33','om32','om31','om26','om25','om24','om23','om22','om21','om16','om15','om14','om13','om12','om11'],
'shapes_ts2' : ['ts266','ts265','ts264','ts263','ts262','ts256','ts255','ts254','ts253','ts252','ts246','ts245','ts244','ts243','ts242','ts236','ts235','ts234','ts233','ts232','ts226','ts225','ts224','ts223','ts222'],
'shapes_bs2' : ['bs266','bs265','bs264','bs263','bs262','bs256','bs255','bs254','bs253','bs252','bs246','bs245','bs244','bs243','bs242','bs236','bs235','bs234','bs233','bs232','bs226','bs225','bs224','bs223','bs222'],
'shapes_te2' : ['te266','te265','te264','te263','te262','te256','te255','te254','te253','te252','te246','te245','te244','te243','te242','te236','te235','te234','te233','te232','te226','te225','te224','te223','te222'],
'shapes_be2' : ['be266','be265','be264','be263','be262','be256','be255','be254','be253','be252','be246','be245','be244','be243','be242','be236','be235','be234','be233','be232','be226','be225','be224','be223','be222'],
'shapes_om2' : ['om266','om265','om264','om263','om262','om261','om256','om255','om254','om253','om252','om251','om246','om245','om244','om243','om242','om241','om236','om235','om234','om233','om232','om231','om226','om225','om224','om223','om222','om221','om216','om215','om214','om213','om212','om211'],
'shapes_corners_1' : ['shapes_ts','shapes_bs','shapes_te','shapes_be'],
'shapes_cornersom_1' : ['shapes_ts','shapes_bs','shapes_te','shapes_be','shapes_om'],
'shapes_corners_2' : ['shapes_ts2','shapes_bs2','shapes_te2','shapes_be2'],
'shapes_cornersom_2' : ['shapes_ts2','shapes_bs2','shapes_te2','shapes_be2','shapes_om2'],
# Unbalanced shapes are used in corner insertions and need to be split so they can be reversed for RTL in mkmk
'shapes_u' : ['es66','es65','es64','es63','es62','es61','es56','es55','es54','es53','es52','es51','es46','es45','es44','es43','es42','es41','es36','es35','es34','es33','es32','es31','es26','es25','es24','es23','es22','es21','es16','es15','es14','es13','es12','es11'],
'shapes_ls' : ['ls66','ls65','ls64','ls63','ls62','ls61','ls56','ls55','ls54','ls53','ls52','ls51','ls46','ls45','ls44','ls43','ls42','ls41','ls36','ls35','ls34','ls33','ls32','ls31','ls26','ls25','ls24','ls23','ls22','ls21','ls16','ls15','ls14','ls13','ls12','ls11'],
'shapewidths' : ['sh0','sh1','sh2','sh3','sh4','sh5','sh6','sh7','sh8'],
'shapeheights' : ['sv0','sv1','sv2','sv3','sv4','sv5','sv6'],
'spacers_cols0' : ['cs0','c0s1p0','c0s0p5','c0s0p66','c0s0p33','c0s0p25'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_cols1' : ['cs0','c1s1p0','c1s0p5','cs0','c1s0p33','cs0'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_cols2' : ['cs0','c2s1p0','cs0','cs0','cs0','cs0'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_deltas' : ['ds0','ds1p0','ds0p5','ds0p66','ds0p33','ds0p25'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_rows0' : ['rs0','r0s4p0','r0s3p0','r0s2p0','r0s1p5','r0s1p0','r0s0p5','r0s0p66','r0s0p33','r0s0p25'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_rows1' : ['rs0','r1s4p0','r1s3p0','r1s2p0','rs0','r1s1p0','r1s0p5','rs0','r1s0p33','rs0'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_rows2' : ['rs0','rs0','rs0','rs0','rs0','r2s1p0','rs0','rs0','rs0','rs0'], # ORDER OF THESE ITEMS IS IMPORTANT
'spacers_deltarows': ['ds0','ds4p0','ds3p0','ds2p0','ds1p5','ds1p0','ds0p5','ds0p66','ds0p33','ds0p25'], # ORDER OF THESE ITEMS IS IMPORTANT
'stems0-h' : ['c0h1', 'c0h2', 'c0h3', 'c0h4', 'c0h5', 'c0h6', 'c0h7', 'c0h8', 'colspacers0', 'r0eB'],
'stems0-hR' : ['c0h1R','c0h2R','c0h3R','c0h4R','c0h5R','c0h6R','c0h7R','c0h8R','colspacers0R','r0eBR'],
'stems0-v' : ['r0v1', 'r0v2', 'r0v3', 'r0v4', 'r0v5', 'r0v6', 'rowspacers0'],
'stems0-vR' : ['r0v1R','r0v2R','r0v3R','r0v4R','r0v5R','r0v6R','rowspacers0R'],
'stems1-h' : ['c1h1', 'c1h2', 'c1h3', 'c1h4', 'c1h5', 'c1h6', 'colspacers1','r1eB'],
'stems1-hR' : ['c1h1R','c1h2R','c1h3R','c1h4R','c1h5R','c1h6R','colspacers1R','r1eBR'],
'stems1-v' : ['r1v1', 'r1v2', 'r1v3', 'r1v4', 'r1v5', 'r1v6', 'rowspacers1','insertionsizes1','r1sep'],
'stems1-vx' : ['r1v1', 'r1v2', 'r1v3', 'r1v4', 'r1v5', 'r1v6', 'rowspacers1','insertionsizes1','r1sep','c0eA','shapes_corners_1'], #NEED R VERSION
'stems1-vR' : ['r1v1R','r1v2R','r1v3R','r1v4R','r1v5R','r1v6R','rowspacers1R','insertionsizes1R','r1sepR'],
'stems2-h' : ['c2h1', 'c2h2', 'c2h3', 'c2h4', 'c2h5', 'c2h6', 'colspacers2', 'r2eB'],
'stems2-hR' : ['c2h1R','c2h2R','c2h3R','c2h4R','c2h5R','c2h6R','colspacers2R','r2eBR'],
'stems2-v' : ['r2v1', 'r2v2', 'r2v3', 'r2v4', 'r2v5', 'r2v6', 'r2vb','rowspacers2','insertionsizes2','r2sep'],
'stems2-vx' : ['r2v1', 'r2v2', 'r2v3', 'r2v4', 'r2v5', 'r2v6', 'r2vb','rowspacers2','insertionsizes2','r2sep','c0eA','shapes_corners_2'], #NEED R VERSION
'stems2-vR' : ['r2v1R','r2v2R','r2v3R','r2v4R','r2v5R','r2v6R','r2vbR','rowspacers2R','insertionsizes2R','r2sepR'],
'stems_12' : ['stems1-h','stems1-v','stems2-h','stems2-v','ub'],
'targets' : ['t86','t85','t84','t83','t82','t81','t76','t75','t74','t73','t72','t71','t66','t65','t64','t63','t62','t61','t56','t55','t54','t53','t52','t51','t46','t45','t44','t43','t42','t41','t36','t35','t34','t33','t32','t31','t26','t25','t24','t23','t22','t21','t16','t15','t14','t13','t12','t11'], #Not in use
'targetwidth' : ['trg1','trg2','trg3','trg4','trg5','trg6'],
'verticals2' : ['v1','v2','v3','v4','v5','v6','deltas_sp'],
'vss' : ['VS1','VS2','VS3'],
'genericbases' : ['dottedcircle']
}
basetypes = ['dottedcircle','QB1','QB2','QB3','QB4','QB5','QB6','QB7','QB8',
'QC1','QC2','QC3','QC4','QC5','QC6','QC7','QC8',
'QF1','QF2','QF3','QF4','QF5','QF6','QF7','QF8',
'QC1V','QC2V','QC3V','QC4V','QC5V','QC6V','QC7V','QC8V',
'QF1V','QF2V','QF3V','QF4V','QF5V','QF6V','QF7V','QF8V',
'csL','creL','ceL','hwtsL','hwteL','hwttsL','hwtteL','hwtbsL','hwtbeL','cfsL', 'cfeL','hfsL','hfeL','O33aEL',
'csR','creR','ceR','hwtsR','hwteR','hwttsR','hwtteR','hwtbsR','hwtbeR','cfsR', 'cfeR','hfsR','hfeR','O33aER',
'csT','creB','ceB','hwtsT','hwteB','hwttsT','hwtteB','hwtbsT','hwtbeB','cfsT', 'cfeB','hfsT','hfeB','O33aEB',
'Qf','Qi','vjV','hjV','tsV','bsV','teV','beV','omV','ssV','seV'
]
internalmirrors = {
'C2':'C2c','C2c':'C2','C2a':'C2b','C2b':'C2a','C12':'C13','C13':'C12','C14':'C15','C15':'C14',
'D54':'D55','D55':'D54','F46':'F47','F46a':'F47a','F47':'F46','F47a':'F46a','F48':'F49',
'F49':'F48','L6':'L6a','L6a':'L6','O5':'O5a','O5a':'O5','O50a':'O50b','O50b':'O50a',
'U6a':'U6b','U6b':'U6a','V31':'V31a','V31a':'V31','Y3':'Y4','Y4':'Y3','J7':'J7a','J7a':'J7'
}
mirroring = {
'A1','A2','A3','A4','A5','A5a','A6','A6a','A6b','A7','A8','A9','A10','A11',
'A12','A13','A14','A14a','A15','A16','A17','A17a','A18','A19','A20','A21','A22',
'A23','A24','A25','A26','A27','A28','A29','A30','A31','A32','A32a','A33','A34',
'A35','A36','A37','A38','A39','A40','A40a','A41','A42','A42a','A43','A43a',
'A44','A45','A45a','A46','A47','A48','A49','A50','A51','A52','A53','A54','A55',
'A56','A57','A58','A59','A60','A61','A62','A63','A64','A65','A66','A67','A68',
'A69','A70','B1','B2','B3','B4','B5','B5a','B6','B7','B8','B9','C1','C3','C4',
'C5','C6','C7','C8','C9','C10','C10a','C11','C16','C17','C18','C19','C20','C21',
'C22','C23','C24','D1','D3',
'D4','D5','D6','D7','D8','D8a','D9','D10','D11','D13','D14','D15','D16','D17',
'D18','D19','D20','D26','D29','D30','D31','D33','D34','D34a','D36','D37','D38',
'D39','D40','D41','D42','D43','D44','D45','D46','D46a','D47','D48','D48a','D49',
'D50','D50a','D50b','D50c','D50d','D50e','D50f','D50g','D50h','D50i','D51',
'D52','D52a','D53','D54a','D56','D57','D58','D59','D60','D61','D62','D63','D64',
'D65','D66','E1','E2','E3','E4','E5','E6','E7','E8','E8a','E9','E9a','E10',
'E11','E12','E13','E14','E15','E16','E16a','E17','E17a','E18','E19','E20',
'E20a','E21','E22','E23','E24','E25','E26','E27','E28','E28a','E29','E30','E31',
'E32','E33','E34','E34a','E36','E37','E38','F1','F1a','F2','F3','F4','F5','F6',
'F7','F8','F9','F10','F11','F12','F14','F15','F16','F17','F18','F19','F20',
'F21','F21a','F22','F23','F24','F25','F26','F27','F29','F30','F32','F33','F37',
'F37a','F38','F38a','F39','F40','F42','F44','F50','F51','F51a','F51b','F51C',
'F52','F53','G1','G2','G3','G4','G5','G6','G6a','G7','G7a','G7b','G8','G9',
'G10','G11','G11a','G12','G13','G14','G15','G16','G17','G18','G19','G20','G20a',
'G21','G22','G23','G24','G25','G26','G26a','G27','G28','G29','G30','G31','G32',
'G33','G34','G35','G36','G36a','G37','G37a','G38','G39','G40','G41','G42','G43',
'G43a','G44','G45','G45a','G46','G47','G48','G49','G50','G51','G52','G53','G54',
'H1','H2','H3','H4','H5','H6','H6a','H7','H8','I1','I2','I3','I4','I5','I5a',
'I6','I7','I8','I9','I9a','I10','I10a','I11','I11a','I12','I13','I14','I15',
'K1','K2','K3','K4','K5','K6','K7','K8','L1','L2','L2a','L3','L4','L5','M1a',
'M1b','M2','M3','M3a','M4','M5','M6','M7','M9','M10','M10a','M11','M12','M12a',
'M12b','M12c','M12d','M12e','M12f','M12g','M12h','M14','M17','M17a','M18','M19',
'M20','M21','M22','M22a','M23','M24','M25','M26','M27','M28','M29','M30','M33',
'M33a','M33B','M36','M37','M38','M40','M40a','M41','M43','N2','N3','N6','N13',
'N20','N21','N22','N23','N29','N32','N34','N34a','N37a','N39','N40','NL1','NL2',
'NL3','NL4','NL5','NL5a','NL6','NL7','NL8','NL9','NL10','NL11','NL12','NL13',
'NL14','NL15','NL16','NL17','NL17a','NL18','NL19','NL20','NU1','NU2','NU3',
'NU4','NU5','NU6','NU7','NU8','NU9','NU10','NU10a','NU11','NU11a','NU12','NU13',
'NU14','NU15','NU16','NU17','NU18','NU18a','NU19','NU20','NU21','NU22','NU22a',
'O3','O4','O6','O7','O8','O9','O10','O10a','O10B','O10C','O11','O12','O13',
'O14','O15','O16','O17','O18','O19','O19a','O20','O29','O30','O30a','O33a',
'O35','O37','O38','O40','O42','O44','O45','O46','O47','O51','P1','P1a','P2',
'P3','P3a','P5','P7','P9','P10','P11','Q1','Q2','Q7','R1','R2','R3','R5','R6',
'R7','R8','R9','R10','R10a','R12','R13','R14','R15','R16','R17','R18','R19',
'R25','R27','R29','S1','S2','S2a','S3','S4','S5','S6','S6a','S7','S8','S9',
'S10','S13','S14a','S14b','S18','S19','S26','S28','S29','S30','S31','S32','S33',
'S37','S38','S39','S40','S41','S44','S45','S46','T1','T2','T4','T5','T6','T7',
'T7a','T11','T12','T13','T14','T15','T16','T16a','T17','T18','T19','T20','T21',
'T24','T25','T26','T27','T29','T30','T31','T32','T32a','T33','T33a','T34','T35',
'T36','U1','U2','U3','U4','U5','U6','U7','U8','U9','U10','U11','U12','U13',
'U14','U15','U16','U17','U18','U19','U20','U21','U24','U25','U29a','U30','U31',
'U32','U32a','U33','U35','U37','U38','U39','U40','V1','V1a','V1b','V1c','V1d',
'V1e','V1f','V1g','V1h','V1i','V2','V2a','V3','V4','V10','V11','V11a','V11B',
'V11C','V12','V12a','V12B','V13','V14','V15','V21','V22','V23','V23a','V25',
'V28a','V29a','V33','V34','V35','V36','V37','V37a','V40','V40a','W9','W9a',
'W10a','W14a','W15','W16','W17a','W20','W25','X5','X6a','X7','Y1a','Y7','Z4',
'Z5','Z5a','Z6','Z7','Z9','Z10','Z12','Z14','Z16d','Z16f','J2','J3',
'J4','J7b','J10','J11','J13','J14','J15','J16','J17','J18','J22','J26','J28',
'J29','J31','J32'
} |
# # Exercício 3.8 Escreva um programa que leia um valor em metros e o exiba convertido em milímetros.
metros = float(input('digite um valor em metros '))
centimetros = metros*100
print ("a conversão dos metros em centimetros resultou em %4.2f centimetros" % (centimetros))
#podemos fazer varios tipos de conversores usando a mesma técnica, não está no livro,
# no entanto o código abaixo é um conversor de minutos em segundos
# minutos = float(input('digite o tempo em minutos e segundos sem o zero ' ))
# segundos = minutos * 60
# print ("a conversão dos minutos em segundos resultou em %4.2f segundos" % (segundos)) |
# success try: 49551052 , 17 мар 2021, 15:09:45. 51ms 3.95Mb
def binary_search(array, required, from_index: int, to_index: int) -> int:
"""
Just one more version of binary search in sorted array
@param from_index: Index to search from
@param to_index: Index to search to
@return: Index of required element. -1 if not found
"""
if array[from_index] == required:
return from_index
if from_index == to_index:
return -1
middle_index = (from_index + to_index) // 2
if array[middle_index] == required:
return middle_index
if required < array[middle_index]:
return binary_search(array, required, from_index, middle_index)
return binary_search(array, required, middle_index + 1, to_index)
def find_in_partially_sorted_array(array, required):
def _find_broken_index(from_index, to_index):
if to_index - from_index <= 1:
return to_index if array[to_index] < array[from_index] else from_index
middle_index = (from_index + to_index) // 2
if arr[middle_index] > arr[from_index]:
# left half of array increases, not break in it
# trying to find broken index in right half
return _find_broken_index(middle_index, to_index)
return _find_broken_index(from_index, middle_index)
if len(array) == 0:
return -1
broken_index = _find_broken_index(0, len(array) - 1)
if broken_index == 0:
return binary_search(array, required, 0, len(array) - 1)
if array[0] <= required <= array[broken_index - 1]:
return binary_search(array, required, 0, broken_index - 1)
return binary_search(array, required, broken_index, len(array) - 1)
if __name__ == '__main__':
with open('input.txt') as file:
file.readline()
required = int(file.readline())
arr = [int(x) for x in file.readline().split()]
print(find_in_partially_sorted_array(arr, required))
|
"""
This problem was asked by Google.
Given a string, return the first recurring character in it,
or null if there is no recurring character.
For example, given the string "acbbac", return "b".
Given the string "abcdef", return null.
"""
def first_recurring_char(string):
char_to_freq_map = {}
for char in string:
if char not in char_to_freq_map:
char_to_freq_map[char] = 0
char_to_freq_map[char] +=1
if char_to_freq_map[char] > 1:
return char
return None
if __name__ == '__main__':
print(first_recurring_char("acbbac"))
print(first_recurring_char("abcdef")) |
y = 1
x = 0
while y <= 5:
x += 1
x = 0
while False:
x += 1
x = 0
while x == 2:
x += 1
x = 0
while 2 <= 2:
x += 1
x = 0
while True:
x += 1 |
class Solution:
def findDuplicate(self, nums: list) -> int:
slow = nums[nums[0]]
fast = nums[nums[nums[0]]]
while fast != slow:
slow = nums[slow]
fast = nums[nums[fast]]
start = nums[0]
while start != slow:
slow = nums[slow]
start = nums[start]
return start
if __name__ == "__main__":
solu = Solution()
print(solu.findDuplicate([1, 3, 4, 2, 2])) |
def test():
return True
|
#!/usr/bin/env python
def extract_arguments(call):
# Replace any leftover multiple whitespaces with single whitespaces
call = ' '.join(call.split())
# Extract arguments part of call
args_start = call.find('(')
args_end = call.rfind(')')
args_str = (call[args_start+1:args_end]).strip()
args_str_formatted = ''
# Remove whitespaces from parts of the argument list that are inside brackets
# and add missing whitespaces after the comma of each variable in the call
open_brackets = 0
for i in xrange(len(args_str)):
# First check if we are inside or outside of a bracketed area
if args_str[i] == '(':
open_brackets += 1
elif args_str[i] == ')':
if open_brackets < 1:
raise Exception('Error parsing {0}, found closing bracket w/o matching opening bracket'.format(call))
open_brackets -= 1
# Remove whitespaces inside bracketed areas
if open_brackets > 0 and args_str[i] == ' ':
continue
args_str_formatted += args_str[i]
# Add missing whitespace after comma between arguments
if open_brackets == 0 and i<len(args_str)-1 and args_str_formatted[-1] == ',' and not args_str[i+1] == ' ':
args_str_formatted += ' '
# Split argument list
args = [x for x in args_str_formatted.split(', ')]
return args
def parse_subroutine_call(file, subroutine):
parse = False
calls = []
with open(file) as f:
contents = []
for line in f.readlines():
line = line.strip()
# Skip comments and empty lines
if line.startswith('!') or line == '':
continue
# Replace tabs with single whitespaces
line = line.replace('\t', ' ')
# Replace multiple whitespaces with one whitespace
line = ' '.join(line.split())
# Remove inline comments
if '!' in line:
line = line[:line.find('!')].strip()
contents.append(line)
for line in contents:
#print subroutine + ' : "' + line + '"'
if 'call {0}'.format(subroutine) in line.lower():
#DH* case sensitive? if 'call {0}'.format(subroutine) in line:
parse = True
call = line.replace('&', ' ')
count_opening_brackets = line.count('(')
count_closing_brackets = line.count(')')
# Entire call on one line
if count_opening_brackets > 0 and count_closing_brackets == count_opening_brackets:
parse = False
arguments = extract_arguments(call)
calls.append(arguments)
elif parse:
call += line.replace('&', ' ')
count_opening_brackets += line.count('(')
count_closing_brackets += line.count(')')
# Call over multiple lines
if (count_closing_brackets == count_opening_brackets) and (count_closing_brackets>0):
parse = False
arguments = extract_arguments(call)
calls.append(arguments)
#print "file, subroutine, calls:", file, subroutine, calls, [len(arguments) for arguments in calls]
return calls
|
# The API: int read4(char *buf) reads 4 characters at a time from a file.
# The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the file.
# By using the read4 API, implement the function int read(char *buf, int n) that reads n characters from the file.
# Note:
# The read function will only be called once for each test case.
# The read4 API is already defined for you.
# @param buf, a list of characters
# @return an integer
# def read4(buf):
class Solution(object):
def read(self, buf, n):
"""
:type buf: Destination buffer (List[str])
:type n: Maximum number of characters to read (int)
:rtype: The number of characters read (int)
"""
read_bytes = 0
buffer = [''] * 4
for i in range(n / 4 + 1):
size = read4(buffer)
if size:
buf[read_bytes:read_bytes+size] = buffer
read_bytes += size
else:
break
return min(read_bytes, n)
|
# Remove White Spaces from a string
userInput = input("Enter a String: ")
lists = userInput.split()
newValue = ""
for i in lists:
newValue += str(i)
print(newValue)
|
def extractPockysbookshelfCom(item):
'''
Parser for 'pockysbookshelf.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('I Tamed a Tyrant and Ran Away', 'I Tamed a Tyrant and Ran Away', 'translated'),
('If I Happened to Tame my Brother Well', 'If I Happened to Tame my Brother Well', 'translated'),
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', 'oel'),
]
for tagname, name, tl_type in tagmap:
if tagname in item['tags']:
return buildReleaseMessageWithType(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
if item['tags'] == [] or item['tags'] == ['novels']:
titlemap = [
('I Tamed a Tyrant and Ran Away: Chapter ', 'I Tamed a Tyrant and Ran Away', 'translated'),
('Methods to Save the Villain who was Abandoned by the Heroine: Chapter ', 'Methods to Save the Villain who was Abandoned by the Heroine', 'translated'),
('First of All, Let’s Hide My Younger Brother: Chapter ', 'First of All, Let’s Hide My Younger Brother', 'translated'),
('The End of this Fairy Tale is One Hell of a Drama: Chapter ', 'The End of this Fairy Tale is One Hell of a Drama', 'translated'),
('If I Happened to Tame my Brother Well', 'If I Happened to Tame my Brother Well', 'translated'),
('Tensei Shoujo no Rirekisho', 'Tensei Shoujo no Rirekisho', 'translated'),
('Master of Dungeon', 'Master of Dungeon', 'oel'),
]
for titlecomponent, name, tl_type in titlemap:
if titlecomponent.lower() in item['title'].lower():
return buildReleaseMessageWithType(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
return False |
map = {
"U": (-3, []),
"D": (+3, []),
"L": (-1, [4, 7]),
"R": (+1, [3, 6]),
}
def aoc(data):
button = 5
code = ""
for line in data.split("\n"):
for step in line:
new = button + map[step][0]
if 0 < new <= 9 and not button in map[step][1]:
button = new
code += str(button)
return code
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.