content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
Check that connecting from a non-local IP will result in an AddressBindingError
"""
#pragma repy
localip = getmyip()
localport = 12345
remoteport = 80
timeout = 0.00001
try:
remoteip = gethostbyname('www.google.com')
except NetworkAddressError:
log("Name lookup failed for www.google.com",'\n')
exitall()
try:
# I presume the timeout will happen before the connection
openconnection(remoteip, remoteport, localip,localport, timeout)
except TimeoutError:
pass
else:
log("Did not have a TimeoutError when connecting to google in",timeout,"seconds",'\n')
| """
Check that connecting from a non-local IP will result in an AddressBindingError
"""
localip = getmyip()
localport = 12345
remoteport = 80
timeout = 1e-05
try:
remoteip = gethostbyname('www.google.com')
except NetworkAddressError:
log('Name lookup failed for www.google.com', '\n')
exitall()
try:
openconnection(remoteip, remoteport, localip, localport, timeout)
except TimeoutError:
pass
else:
log('Did not have a TimeoutError when connecting to google in', timeout, 'seconds', '\n') |
#file = open('sample.txt','r')
#contents = file.read()
#file.close()
#print(contents)
with open('file_example.txt', 'r') as file:
contents = file.read()
print(contents)
| with open('file_example.txt', 'r') as file:
contents = file.read()
print(contents) |
#!/usr/bin/env python3
"""CrooHtmlReportTracks
Author:
Jin Lee (leepc12@gmail.com) at ENCODE-DCC
"""
class CrooHtmlReportTracks(object):
HEAD = """
<link rel="stylesheet" type="text/css" href=\
"http://epigenomegateway.wustl.edu/legacy/style.css" />
<script type="text/javascript" src="http://epigenomegateway.wustl.edu/\
legacy/js/base.js"></script>
<script type="text/javascript" src="http://epigenomegateway.wustl.edu/\
legacy/js/personality.js"></script>
<script type="text/javascript" src="http://epigenomegateway.wustl.edu/\
legacy/js/embed.js"></script>
"""
BODY = """
"""
def __init__(self, html_root=None):
self._html_root = html_root
def get_html_head_str(self):
return CrooHtmlReportTracks.HEAD
def get_html_body_str(self):
html = CrooHtmlReportTracks.BODY
return html
| """CrooHtmlReportTracks
Author:
Jin Lee (leepc12@gmail.com) at ENCODE-DCC
"""
class Croohtmlreporttracks(object):
head = '\n <link rel="stylesheet" type="text/css" href="http://epigenomegateway.wustl.edu/legacy/style.css" />\n <script type="text/javascript" src="http://epigenomegateway.wustl.edu/legacy/js/base.js"></script>\n <script type="text/javascript" src="http://epigenomegateway.wustl.edu/legacy/js/personality.js"></script>\n <script type="text/javascript" src="http://epigenomegateway.wustl.edu/legacy/js/embed.js"></script>\n '
body = '\n '
def __init__(self, html_root=None):
self._html_root = html_root
def get_html_head_str(self):
return CrooHtmlReportTracks.HEAD
def get_html_body_str(self):
html = CrooHtmlReportTracks.BODY
return html |
def buildPalindrome(st):
for i in range(len(st)):
sub = st[i : len(st)]
if sub[::-1] == sub:
missing = st[0:i]
return st + missing[::-1]
return st
| def build_palindrome(st):
for i in range(len(st)):
sub = st[i:len(st)]
if sub[::-1] == sub:
missing = st[0:i]
return st + missing[::-1]
return st |
n, k = map(int, input().split())
count = 0
for _ in range(n):
a = int(input())
if a%k == 0:
count +=1
print(count) | (n, k) = map(int, input().split())
count = 0
for _ in range(n):
a = int(input())
if a % k == 0:
count += 1
print(count) |
# Programa em q o usuario possa adicionar valores numericos em uma lista, Caso o numero ja exista ele nao sera adicionado
# no final serao exibidos todos os valores unicos em ordem crescente
lista = []
resp = ''
old = 0
while True:
old = int(input('Digite um valor: '))
if old in lista:
print('Valor repetido, nao vou adicionar...')
else:
lista.append(old)
print('Valor adicionado com sucesso...')
resp = input('Deseja continuar? [S/N] ').strip().upper()[0]
while resp not in 'SsNn':
print('Digite uma opcao valida!')
resp = input('Deseja continuar? [S/N] ').strip().upper()[0]
if resp in 'Nn':
break
print('-='*20)
print(f'Voce digitou os valores {sorted(lista)}')
| lista = []
resp = ''
old = 0
while True:
old = int(input('Digite um valor: '))
if old in lista:
print('Valor repetido, nao vou adicionar...')
else:
lista.append(old)
print('Valor adicionado com sucesso...')
resp = input('Deseja continuar? [S/N] ').strip().upper()[0]
while resp not in 'SsNn':
print('Digite uma opcao valida!')
resp = input('Deseja continuar? [S/N] ').strip().upper()[0]
if resp in 'Nn':
break
print('-=' * 20)
print(f'Voce digitou os valores {sorted(lista)}') |
male = [
'AKIO',
'AKIRA',
'AOI',
'ARATA',
'ASUKA',
'AYUMU',
'DAICHI',
'DAIKI',
'DAISUKE',
'GORO',
'GOROU',
'HACHIRO',
'HACHIROU',
'HARU',
'HARUKA',
'HARUKI',
'HARUTO',
'HAYATE',
'HAYATO',
'HIBIKI',
'HIDEAKI',
'HIDEKI',
'HIDEYOSHI',
'HIKARI',
'HIKARU',
'HINATA',
'HIRAKU',
'HIROKI',
'HIROSHI',
'HIROTO',
'ICHIRO',
'ICHIROU',
'ISAMU',
'ITSUKI',
'JIRO',
'JIROU',
'JUN',
"JUN'ICHI",
'JURO',
'JUROU',
'JUUROU',
'KAEDE',
'KAITO',
'KAORU',
'KATASHI',
'KATSU',
'KATSUO',
'KATSURO',
'KATSUROU',
'KAZUKI',
'KAZUO',
'KEN',
"KEN'ICHI",
'KENJI',
'KENSHIN',
'KENTA',
'KICHIRO',
'KICHIROU',
'KIYOSHI',
'KOHAKU',
'KOUKI',
'KOUTA',
'KURO',
'KUROU',
'KYO',
'KYOU',
'MAKOTO',
'MASAMI',
'MASARU',
'MICHI',
'MINATO',
'MINORU',
'NAOKI',
'NAOMI',
'NOBORU',
'NOBU',
'NOBURU',
'NOBUYUKI',
'NORI',
'OSAMU',
'REN',
'RIKU',
'RIKUTO',
'RIN',
'ROKURO',
'ROKUROU',
'RYO',
'RYOICHI',
'RYOTA',
'RYOU',
'RYOUICHI',
'RYOUTA',
'RYUU',
'RYUUNOSUKE',
'SABURO',
'SABUROU',
'SHICHIRO',
'SHICHIROU',
'SHIN',
"SHIN'ICHI",
'SHINOBU',
'SHIORI',
'SHIRO',
'SHIROU',
'SHO',
'SHOTA',
'SHOU',
'SHOUHEI',
'SHOUTA',
'SHUN',
'SORA',
'SOTA',
'SOUMA',
'SOUTA',
'SUSUMU',
'TAICHI',
'TAIKI',
'TAKAHIRO',
'TAKARA',
'TAKASHI',
'TAKEHIKO',
'TAKESHI',
'TAKUMA',
'TAKUMI',
'TAKUYA',
'TARO',
'TAROU',
'TOMOMI',
'TSUBASA',
'YAMATO',
'YASU',
'YORI',
'YOSHI',
'YOSHIRO',
'YOSHIROU',
'YOUTA',
'YUKI',
'YUU',
'YUUDAI',
'YUUKI',
'YUUMA',
'YUUTA',
'YUUTO'
]
female = [
'AI',
'AIKO',
'AIMI',
'AINA',
'AIRI',
'AKANE',
'AKARI',
'AKEMI',
'AKI',
'AKIKO',
'AKIRA',
'AMI',
'AOI',
'ASUKA',
'ATSUKO',
'AYA',
'AYAKA',
'AYAKO',
'AYAME',
'AYANE',
'AYANO',
'CHIHIRO',
'CHIKA',
'CHIKAKO',
'CHINATSU',
'CHIYO',
'CHIYOKO',
'CHO',
'CHOU',
'CHOUKO',
'EMI',
'ETSUKO',
'FUYUKO',
'HANA',
'HANAE',
'HANAKO',
'HARU',
'HARUKA',
'HARUKO',
'HARUNA',
'HIBIKI',
'HIKARI',
'HIKARU',
'HINA',
'HINATA',
'HIROKO',
'HITOMI',
'HONOKA',
'HOSHI',
'HOSHIKO',
'HOTARU',
'IZUMI',
'JUN',
'JUNKO',
'KAEDE',
'KANON',
'KAORI',
'KAORU',
'KAREN',
'KASUMI',
'KAZUE',
'KAZUKO',
'KEIKO',
'KIKU',
'KIMIKO',
'KIYOKO',
'KOHAKU',
'KOHARU',
'KOKORO',
'KOTONE',
'KUMIKO',
'KYO',
'KYOU',
'MAI',
'MAKOTO',
'MAMI',
'MANAMI',
'MAO',
'MARI',
'MARIKO',
'MASAMI',
'MASUYO',
'MAYU',
'MEGUMI',
'MEI',
'MICHI',
'MICHIKO',
'MIDORI',
'MIHO',
'MIKA',
'MIKI',
'MIKU',
'MINAKO',
'MINATO',
'MINORU',
'MIO',
'MISAKI',
'MITSUKO',
'MIU',
'MIYAKO',
'MIYU',
'MIZUKI',
'MOE',
'MOMOKA',
'MOMOKO',
'MORIKO',
'NANA',
'NANAKO',
'NANAMI',
'NAOKO',
'NAOMI',
'NATSUKI',
'NATSUKO',
'NATSUMI',
'NOA',
'NORIKO',
'RAN',
'REI',
'REINA',
'REN',
'RIKO',
'RIN',
'RINA',
'RIO',
'SACHIKO',
'SAKI',
'SAKIKO',
'SAKURA',
'SAKURAKO',
'SATOMI',
'SAYAKA',
'SAYURI',
'SETSUKO',
'SHINJU',
'SHINOBU',
'SHIORI',
'SHIZUKA',
'SHUN',
'SORA',
'SUMIKO',
'SUZU',
'SUZUME',
'TAKAKO',
'TAKARA',
'TAMIKO',
'TOMIKO',
'TOMOKO',
'TOMOMI',
'TSUBAKI',
'TSUBAME',
'TSUBASA',
'TSUKIKO',
'UME',
'UMEKO',
'WAKANA',
'YASU',
'YOKO',
'YOSHI',
'YOSHIKO',
'YOUKO',
'YUA',
'YUI',
'YUINA',
'YUKI',
'YUKIKO',
'YUKO',
'YUMI',
'YUMIKO',
'YURI',
'YUU',
'YUUKA',
'YUUKI',
'YUUKO',
'YUUNA',
'YUZUKI'
]
last = [
'Saiu',
'Susuki',
'Tanaka',
'Kakahashi',
'Okamura',
'Ito',
'Inoue',
'Marina',
'Ohayashi',
'Kaiu',
'Ishii',
'Kichida',
'Ooshita',
'Ishida',
'Yaguchi',
'Masamoto',
'Iue',
'Kimura',
'Saitou',
'Atsumi',
'Isao',
'Abu',
'Ouno',
'Nakashima',
'Iyo',
'Aoki',
'Iketa',
'Hashinomoto',
'Okata',
'Yamasa',
'Sanka',
'Okawa',
'Touda',
'Aeda',
'Sasegawa',
'Gatou',
'Etou',
'Kontou',
'Takeuchi',
'Samurakami',
'Arai',
'Saito',
'Karumera',
'Nakano',
'Outa',
'Shiraishi',
'Eriane',
'Fuabio',
'Torori',
'Nakakawa',
'Miura',
'Okahon',
'Kanako',
'Arekusu',
'Uirane',
'Sakai',
'Eririn',
'Uchiyama',
'Ishita',
'Morita',
'Kazuko',
'Kouda',
'Enzan',
'Ageta',
'Kizakipara',
'Kawano',
'Uida',
'Shida',
'Miyamoto',
'Katsutoshi',
'Anzou',
'Mashita',
'Oshima',
'Imai',
'Tanikuchi',
'Miyagiki',
'Kawamura',
'Saita',
'Murata',
'Kouki',
'Kudau',
'Ootsuka',
'Kan',
'Kubota',
'Sukiyama',
'Sakurai',
'Oba',
'Hijimoto',
'Oyama',
'Oohira',
'Matsui',
'Nokuchi',
'Agano',
'Kanbara',
'Taketa',
'Sano',
'Nagai',
'Imura',
'Kitabayashi',
'Matsuo',
'Kishimoto',
'Kioroshi',
'Ichika',
'Abe',
'Sukimoto',
'Kikuji',
'Kokawa',
'Ounishi',
'Kouno',
'Kikawa',
'Shikuda',
'Iiwasaki',
'Misuno',
'Kawakuchi',
'Omatsuzaki',
'Arurete',
'Kitamura',
'Sannai',
'Kikuike',
'Iita',
'Uemori',
'Osawa',
'Hamata',
'Agari',
'Uchida',
'Kanno',
'Ada',
'Hayashi',
'Tsuchiya',
'Kawasaki',
'Ikazaki',
'Akiyama',
'Nameda',
'Iwata',
'Kano',
'Isa',
'Kurarise',
'Shidzu',
'Itou',
'Nakasai',
'Tagichi',
'Asano',
'Hotta',
'Sanchuu',
'Oushima',
'Toiguchi',
'Honta',
'Ashimura',
'Kaore',
'Yano',
'Oohashi',
'Umaba',
'Morihon',
'Matsushita',
'Hoshino',
'Araki',
'Oike',
'Kichioka',
'Kaai',
'Ookuho',
'Osaki',
'Uemura',
'Nota',
'Matsuura',
'Oota',
'Oogai',
'Naitou',
'Kumakai',
'Miyata',
'Hirai',
'Okura',
'Kurida',
'Eita',
'Nishiyama',
'Ota',
'Amano',
'Soukawa',
'Kurinohara',
'Kasai',
'Shouson',
'Ousawa',
'Ori',
'Oishi',
'Tsumozuki',
'Tanahe',
'Ishizaki',
'Kakuyama',
'Oizumi',
'Yokuta',
'Imoto',
'Sakakuchi',
'Ogihara',
'Sekikuchi',
'Serujio',
'Onishi',
'Eshinu',
'Sutou',
'Fukui',
'Koga',
'Honma'
]
| male = ['AKIO', 'AKIRA', 'AOI', 'ARATA', 'ASUKA', 'AYUMU', 'DAICHI', 'DAIKI', 'DAISUKE', 'GORO', 'GOROU', 'HACHIRO', 'HACHIROU', 'HARU', 'HARUKA', 'HARUKI', 'HARUTO', 'HAYATE', 'HAYATO', 'HIBIKI', 'HIDEAKI', 'HIDEKI', 'HIDEYOSHI', 'HIKARI', 'HIKARU', 'HINATA', 'HIRAKU', 'HIROKI', 'HIROSHI', 'HIROTO', 'ICHIRO', 'ICHIROU', 'ISAMU', 'ITSUKI', 'JIRO', 'JIROU', 'JUN', "JUN'ICHI", 'JURO', 'JUROU', 'JUUROU', 'KAEDE', 'KAITO', 'KAORU', 'KATASHI', 'KATSU', 'KATSUO', 'KATSURO', 'KATSUROU', 'KAZUKI', 'KAZUO', 'KEN', "KEN'ICHI", 'KENJI', 'KENSHIN', 'KENTA', 'KICHIRO', 'KICHIROU', 'KIYOSHI', 'KOHAKU', 'KOUKI', 'KOUTA', 'KURO', 'KUROU', 'KYO', 'KYOU', 'MAKOTO', 'MASAMI', 'MASARU', 'MICHI', 'MINATO', 'MINORU', 'NAOKI', 'NAOMI', 'NOBORU', 'NOBU', 'NOBURU', 'NOBUYUKI', 'NORI', 'OSAMU', 'REN', 'RIKU', 'RIKUTO', 'RIN', 'ROKURO', 'ROKUROU', 'RYO', 'RYOICHI', 'RYOTA', 'RYOU', 'RYOUICHI', 'RYOUTA', 'RYUU', 'RYUUNOSUKE', 'SABURO', 'SABUROU', 'SHICHIRO', 'SHICHIROU', 'SHIN', "SHIN'ICHI", 'SHINOBU', 'SHIORI', 'SHIRO', 'SHIROU', 'SHO', 'SHOTA', 'SHOU', 'SHOUHEI', 'SHOUTA', 'SHUN', 'SORA', 'SOTA', 'SOUMA', 'SOUTA', 'SUSUMU', 'TAICHI', 'TAIKI', 'TAKAHIRO', 'TAKARA', 'TAKASHI', 'TAKEHIKO', 'TAKESHI', 'TAKUMA', 'TAKUMI', 'TAKUYA', 'TARO', 'TAROU', 'TOMOMI', 'TSUBASA', 'YAMATO', 'YASU', 'YORI', 'YOSHI', 'YOSHIRO', 'YOSHIROU', 'YOUTA', 'YUKI', 'YUU', 'YUUDAI', 'YUUKI', 'YUUMA', 'YUUTA', 'YUUTO']
female = ['AI', 'AIKO', 'AIMI', 'AINA', 'AIRI', 'AKANE', 'AKARI', 'AKEMI', 'AKI', 'AKIKO', 'AKIRA', 'AMI', 'AOI', 'ASUKA', 'ATSUKO', 'AYA', 'AYAKA', 'AYAKO', 'AYAME', 'AYANE', 'AYANO', 'CHIHIRO', 'CHIKA', 'CHIKAKO', 'CHINATSU', 'CHIYO', 'CHIYOKO', 'CHO', 'CHOU', 'CHOUKO', 'EMI', 'ETSUKO', 'FUYUKO', 'HANA', 'HANAE', 'HANAKO', 'HARU', 'HARUKA', 'HARUKO', 'HARUNA', 'HIBIKI', 'HIKARI', 'HIKARU', 'HINA', 'HINATA', 'HIROKO', 'HITOMI', 'HONOKA', 'HOSHI', 'HOSHIKO', 'HOTARU', 'IZUMI', 'JUN', 'JUNKO', 'KAEDE', 'KANON', 'KAORI', 'KAORU', 'KAREN', 'KASUMI', 'KAZUE', 'KAZUKO', 'KEIKO', 'KIKU', 'KIMIKO', 'KIYOKO', 'KOHAKU', 'KOHARU', 'KOKORO', 'KOTONE', 'KUMIKO', 'KYO', 'KYOU', 'MAI', 'MAKOTO', 'MAMI', 'MANAMI', 'MAO', 'MARI', 'MARIKO', 'MASAMI', 'MASUYO', 'MAYU', 'MEGUMI', 'MEI', 'MICHI', 'MICHIKO', 'MIDORI', 'MIHO', 'MIKA', 'MIKI', 'MIKU', 'MINAKO', 'MINATO', 'MINORU', 'MIO', 'MISAKI', 'MITSUKO', 'MIU', 'MIYAKO', 'MIYU', 'MIZUKI', 'MOE', 'MOMOKA', 'MOMOKO', 'MORIKO', 'NANA', 'NANAKO', 'NANAMI', 'NAOKO', 'NAOMI', 'NATSUKI', 'NATSUKO', 'NATSUMI', 'NOA', 'NORIKO', 'RAN', 'REI', 'REINA', 'REN', 'RIKO', 'RIN', 'RINA', 'RIO', 'SACHIKO', 'SAKI', 'SAKIKO', 'SAKURA', 'SAKURAKO', 'SATOMI', 'SAYAKA', 'SAYURI', 'SETSUKO', 'SHINJU', 'SHINOBU', 'SHIORI', 'SHIZUKA', 'SHUN', 'SORA', 'SUMIKO', 'SUZU', 'SUZUME', 'TAKAKO', 'TAKARA', 'TAMIKO', 'TOMIKO', 'TOMOKO', 'TOMOMI', 'TSUBAKI', 'TSUBAME', 'TSUBASA', 'TSUKIKO', 'UME', 'UMEKO', 'WAKANA', 'YASU', 'YOKO', 'YOSHI', 'YOSHIKO', 'YOUKO', 'YUA', 'YUI', 'YUINA', 'YUKI', 'YUKIKO', 'YUKO', 'YUMI', 'YUMIKO', 'YURI', 'YUU', 'YUUKA', 'YUUKI', 'YUUKO', 'YUUNA', 'YUZUKI']
last = ['Saiu', 'Susuki', 'Tanaka', 'Kakahashi', 'Okamura', 'Ito', 'Inoue', 'Marina', 'Ohayashi', 'Kaiu', 'Ishii', 'Kichida', 'Ooshita', 'Ishida', 'Yaguchi', 'Masamoto', 'Iue', 'Kimura', 'Saitou', 'Atsumi', 'Isao', 'Abu', 'Ouno', 'Nakashima', 'Iyo', 'Aoki', 'Iketa', 'Hashinomoto', 'Okata', 'Yamasa', 'Sanka', 'Okawa', 'Touda', 'Aeda', 'Sasegawa', 'Gatou', 'Etou', 'Kontou', 'Takeuchi', 'Samurakami', 'Arai', 'Saito', 'Karumera', 'Nakano', 'Outa', 'Shiraishi', 'Eriane', 'Fuabio', 'Torori', 'Nakakawa', 'Miura', 'Okahon', 'Kanako', 'Arekusu', 'Uirane', 'Sakai', 'Eririn', 'Uchiyama', 'Ishita', 'Morita', 'Kazuko', 'Kouda', 'Enzan', 'Ageta', 'Kizakipara', 'Kawano', 'Uida', 'Shida', 'Miyamoto', 'Katsutoshi', 'Anzou', 'Mashita', 'Oshima', 'Imai', 'Tanikuchi', 'Miyagiki', 'Kawamura', 'Saita', 'Murata', 'Kouki', 'Kudau', 'Ootsuka', 'Kan', 'Kubota', 'Sukiyama', 'Sakurai', 'Oba', 'Hijimoto', 'Oyama', 'Oohira', 'Matsui', 'Nokuchi', 'Agano', 'Kanbara', 'Taketa', 'Sano', 'Nagai', 'Imura', 'Kitabayashi', 'Matsuo', 'Kishimoto', 'Kioroshi', 'Ichika', 'Abe', 'Sukimoto', 'Kikuji', 'Kokawa', 'Ounishi', 'Kouno', 'Kikawa', 'Shikuda', 'Iiwasaki', 'Misuno', 'Kawakuchi', 'Omatsuzaki', 'Arurete', 'Kitamura', 'Sannai', 'Kikuike', 'Iita', 'Uemori', 'Osawa', 'Hamata', 'Agari', 'Uchida', 'Kanno', 'Ada', 'Hayashi', 'Tsuchiya', 'Kawasaki', 'Ikazaki', 'Akiyama', 'Nameda', 'Iwata', 'Kano', 'Isa', 'Kurarise', 'Shidzu', 'Itou', 'Nakasai', 'Tagichi', 'Asano', 'Hotta', 'Sanchuu', 'Oushima', 'Toiguchi', 'Honta', 'Ashimura', 'Kaore', 'Yano', 'Oohashi', 'Umaba', 'Morihon', 'Matsushita', 'Hoshino', 'Araki', 'Oike', 'Kichioka', 'Kaai', 'Ookuho', 'Osaki', 'Uemura', 'Nota', 'Matsuura', 'Oota', 'Oogai', 'Naitou', 'Kumakai', 'Miyata', 'Hirai', 'Okura', 'Kurida', 'Eita', 'Nishiyama', 'Ota', 'Amano', 'Soukawa', 'Kurinohara', 'Kasai', 'Shouson', 'Ousawa', 'Ori', 'Oishi', 'Tsumozuki', 'Tanahe', 'Ishizaki', 'Kakuyama', 'Oizumi', 'Yokuta', 'Imoto', 'Sakakuchi', 'Ogihara', 'Sekikuchi', 'Serujio', 'Onishi', 'Eshinu', 'Sutou', 'Fukui', 'Koga', 'Honma'] |
class Scale:
def __init__(self, tonic):
if tonic in ["F", "Bb", "Eb", "Ab", "Db", "Gb", "d", "g", "c", "f", "bb", "eb", ]:
notes = ["A", "Bb", "B", "C", "Db", "D",
"Eb", "E", "F", "Gb", "G", "Ab", ]
else:
notes = ["A", "A#", "B", "C", "C#", "D",
"D#", "E", "F", "F#", "G", "G#", ]
i = notes.index(tonic.capitalize())
self.notes = notes[i:] + notes[:i]
def chromatic(self):
return self.notes
def interval(self, intervals):
i = 0
ret = []
for step in intervals:
ret.append(self.notes[i])
if step == 'm':
i += 1
elif step == 'M':
i += 2
elif step == 'A':
i += 3
return ret
| class Scale:
def __init__(self, tonic):
if tonic in ['F', 'Bb', 'Eb', 'Ab', 'Db', 'Gb', 'd', 'g', 'c', 'f', 'bb', 'eb']:
notes = ['A', 'Bb', 'B', 'C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab']
else:
notes = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#']
i = notes.index(tonic.capitalize())
self.notes = notes[i:] + notes[:i]
def chromatic(self):
return self.notes
def interval(self, intervals):
i = 0
ret = []
for step in intervals:
ret.append(self.notes[i])
if step == 'm':
i += 1
elif step == 'M':
i += 2
elif step == 'A':
i += 3
return ret |
# binStrToBytes : Converts a binary string to an array of bytes.
# @param bin : The binary string to be converted to byte array.
# @return : The byte array representation of the provided binary string.
def binStrToBytes(bin):
if (not isinstance(bin, str)):
raise TypeError("Unexpected type, expected 'str'")
# Remove whitespace from key and get size
bin = bin.replace(" ", "")
size = len(bin)
# Check length of the key
if (size % 8 != 0):
raise Exception("Invalid length, cannot convert to byte array")
# Convert the binary key string to byte array
return bytes([int(bin[i:i+8], 2) for i in range(0, size, 8)])
| def bin_str_to_bytes(bin):
if not isinstance(bin, str):
raise type_error("Unexpected type, expected 'str'")
bin = bin.replace(' ', '')
size = len(bin)
if size % 8 != 0:
raise exception('Invalid length, cannot convert to byte array')
return bytes([int(bin[i:i + 8], 2) for i in range(0, size, 8)]) |
# Hidden Street - Ardentmill :: 910001000
# Gere :: Master of Smithing :: 9031003
MINING_SKILL = 92010000
SMITHING_CRAFT_SKILL = 92020000
ACCESSORY_CRAFT_SKILL = 92030000
ALCHEMY_CRAFT_SKILL = 92040000
FEE = [5000, 15000, 25000, 40000, 60000, 85000, 115000, 150000, 190000, 235000]
if not sm.hasSkill(SMITHING_CRAFT_SKILL):
selection = sm.sendSay("I am #bGere#k, master Blacksmith. What do you want?\r\n#L0#Hear an explanation about #b#eSmithing#n.#l\r\n#L1#Learn #eSmithing#n.#k#l")
if selection == 0:
sm.sendNext("Smithing is the art of forging the minerals and gems you get from Mining into durable armor and punishing weapons. I'll show you how to shape these raw materials into equipment you've never seen before.")
elif selection == 1:
if not sm.hasSkill(MINING_SKILL):
sm.sendSayOkay("How do you plan to learn Smithing if you don't even know the Mining Profession? Seek out #bCole#k, learn what he has to teach. Then maybe you will be ready.")
sm.dispose()
if sm.hasSkill(ACCESSORY_CRAFT_SKILL) or sm.hasSkill(ALCHEMY_CRAFT_SKILL):
sm.sendNext("Well now, it seems you've already learned Accessory Crafting or Alchemy. Your reach is exceeding your grasp, isn't it? If you really want to learn it, forget one of the other Professions.")
sm.dispose()
learn = sm.sendAskYesNo("You want to learn #bSmithing#k? Show me how earnest you are by coughing up some dough!\r\nIt's #b 5,000 Mesos#k... Are you really ready to do this?\r\n")
if learn:
if sm.getMesos() < 5000:
sm.sendNext("If you can't even gather #b5000 Mesos#k, how can you hope to become a Blacksmith?")
sm.dispose()
sm.giveMesos(-5000)
sm.giveSkill(SMITHING_CRAFT_SKILL, 0x1000000, 13)
sm.playSound("profession/levelup")
sm.sendNext("To be honest, I didn't think you could learn Smithing. Well, you've only learned the most basic skill level. If you can manage to increase your Mastery, I can teach you more.")
else:
sm.sendNext("It's good to be cautious. Come back after you've thought it through.")
else:
selection = sm.sendSay("I am #bGere#k, master Blacksmith. What do you want?\r\n#L2##bRaise #eSmithing#n level.#l\r\n#L3#Unlearn Smithing.#k#l")
if selection == 2:
if sm.isAbleToLevelUpMakingSkill(SMITHING_CRAFT_SKILL):
levelup = sm.sendAskYesNo("Looks like you're ready to level up your Smithing. I'll take #b" + str(FEE[sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)]) + " Mesos#k as tuition. Ready to learn?")
if levelup:
if sm.getMesos() < FEE[sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)]:
sm.sendNext("You don't have enough mesos.")
sm.dispose()
sm.giveMesos(-FEE[sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)])
sm.makingSkillLevelUp(SMITHING_CRAFT_SKILL)
sm.sendNext("Your Smithing skill is now Lv. " + str(sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)) +".")
else:
sm.sendNext("Sure, take some time to think it over. I'll be here.")
sm.dispose()
else:
sm.sendNext("You're not ready to level up your Profession. Come back when you've increased your Mastery.")
elif selection == 3:
unlearn = sm.sendAskYesNo("You will forget everything I've taught you about Smithing. Everything you've worked towards, gone. Do you really want to do this?")
if unlearn:
sm.removeSkill(SMITHING_CRAFT_SKILL)
# set quest value 11495, "0"
# start quest 3263
# complete quest 3263
# remove quest 3263
sm.sendNext("Very well. You are no longer a Blacksmith.")
else:
sm.sendSayOkay("For once, you say something sensible.") | mining_skill = 92010000
smithing_craft_skill = 92020000
accessory_craft_skill = 92030000
alchemy_craft_skill = 92040000
fee = [5000, 15000, 25000, 40000, 60000, 85000, 115000, 150000, 190000, 235000]
if not sm.hasSkill(SMITHING_CRAFT_SKILL):
selection = sm.sendSay('I am #bGere#k, master Blacksmith. What do you want?\r\n#L0#Hear an explanation about #b#eSmithing#n.#l\r\n#L1#Learn #eSmithing#n.#k#l')
if selection == 0:
sm.sendNext("Smithing is the art of forging the minerals and gems you get from Mining into durable armor and punishing weapons. I'll show you how to shape these raw materials into equipment you've never seen before.")
elif selection == 1:
if not sm.hasSkill(MINING_SKILL):
sm.sendSayOkay("How do you plan to learn Smithing if you don't even know the Mining Profession? Seek out #bCole#k, learn what he has to teach. Then maybe you will be ready.")
sm.dispose()
if sm.hasSkill(ACCESSORY_CRAFT_SKILL) or sm.hasSkill(ALCHEMY_CRAFT_SKILL):
sm.sendNext("Well now, it seems you've already learned Accessory Crafting or Alchemy. Your reach is exceeding your grasp, isn't it? If you really want to learn it, forget one of the other Professions.")
sm.dispose()
learn = sm.sendAskYesNo("You want to learn #bSmithing#k? Show me how earnest you are by coughing up some dough!\r\nIt's #b 5,000 Mesos#k... Are you really ready to do this?\r\n")
if learn:
if sm.getMesos() < 5000:
sm.sendNext("If you can't even gather #b5000 Mesos#k, how can you hope to become a Blacksmith?")
sm.dispose()
sm.giveMesos(-5000)
sm.giveSkill(SMITHING_CRAFT_SKILL, 16777216, 13)
sm.playSound('profession/levelup')
sm.sendNext("To be honest, I didn't think you could learn Smithing. Well, you've only learned the most basic skill level. If you can manage to increase your Mastery, I can teach you more.")
else:
sm.sendNext("It's good to be cautious. Come back after you've thought it through.")
else:
selection = sm.sendSay('I am #bGere#k, master Blacksmith. What do you want?\r\n#L2##bRaise #eSmithing#n level.#l\r\n#L3#Unlearn Smithing.#k#l')
if selection == 2:
if sm.isAbleToLevelUpMakingSkill(SMITHING_CRAFT_SKILL):
levelup = sm.sendAskYesNo("Looks like you're ready to level up your Smithing. I'll take #b" + str(FEE[sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)]) + ' Mesos#k as tuition. Ready to learn?')
if levelup:
if sm.getMesos() < FEE[sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)]:
sm.sendNext("You don't have enough mesos.")
sm.dispose()
sm.giveMesos(-FEE[sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)])
sm.makingSkillLevelUp(SMITHING_CRAFT_SKILL)
sm.sendNext('Your Smithing skill is now Lv. ' + str(sm.getMakingSkillLevel(SMITHING_CRAFT_SKILL)) + '.')
else:
sm.sendNext("Sure, take some time to think it over. I'll be here.")
sm.dispose()
else:
sm.sendNext("You're not ready to level up your Profession. Come back when you've increased your Mastery.")
elif selection == 3:
unlearn = sm.sendAskYesNo("You will forget everything I've taught you about Smithing. Everything you've worked towards, gone. Do you really want to do this?")
if unlearn:
sm.removeSkill(SMITHING_CRAFT_SKILL)
sm.sendNext('Very well. You are no longer a Blacksmith.')
else:
sm.sendSayOkay('For once, you say something sensible.') |
''' Dataset 1
# This cases have displaced or incorrect annotation files
# Some maybe be corrected using the map below
skipCase = ['LUNG1-034',
'LUNG1-040',
'LUNG1-044',
'LUNG1-068',
'LUNG1-083',
'LUNG1-084',
'LUNG1-094',
'LUNG1-096',
'LUNG1-176' ]
# corrections applied by using np.roll on the 3D mask along the y-axis(0) and x-axis(1)
# format = (dy,dx), None implies correction requires more than simple translation
corrections = {
'LUNG1-034': (165, 0),
'LUNG1-040': (190, 0),
'LUNG1-044': (166, 0),
'LUNG1-068': None,
'LUNG1-083': (293, 0),
'LUNG1-084': (314, 0),
'LUNG1-094': (328, 0),
'LUNG1-096': (318, 0),
'LUNG1-176': None
}
# Manufactuers of CT Scanners used for different cases
SIEMENS = ['LUNG1-013', 'LUNG1-098', 'LUNG1-099', 'LUNG1-094', 'LUNG1-096', 'LUNG1-097', 'LUNG1-090', 'LUNG1-092', 'LUNG1-093', 'LUNG1-065', 'LUNG1-072', 'LUNG1-073', 'LUNG1-071', 'LUNG1-077', 'LUNG1-075', 'LUNG1-079', 'LUNG1-048',
'LUNG1-051', 'LUNG1-056', 'LUNG1-102', 'LUNG1-103', 'LUNG1-100', 'LUNG1-104', 'LUNG1-105', 'LUNG1-029', 'LUNG1-032', 'LUNG1-001', 'LUNG1-004', 'LUNG1-083', 'LUNG1-082', 'LUNG1-080', 'LUNG1-086', 'LUNG1-084']
CMS = ['LUNG1-014', 'LUNG1-015', 'LUNG1-016', 'LUNG1-017', 'LUNG1-010', 'LUNG1-011', 'LUNG1-012', 'LUNG1-018', 'LUNG1-019', 'LUNG1-095', 'LUNG1-091', 'LUNG1-061', 'LUNG1-060', 'LUNG1-063', 'LUNG1-062', 'LUNG1-064', 'LUNG1-066', 'LUNG1-069', 'LUNG1-068', 'LUNG1-070', 'LUNG1-076', 'LUNG1-074', 'LUNG1-078', 'LUNG1-047', 'LUNG1-046', 'LUNG1-045', 'LUNG1-044', 'LUNG1-043', 'LUNG1-042', 'LUNG1-041', 'LUNG1-040', 'LUNG1-049', 'LUNG1-059',
'LUNG1-052', 'LUNG1-053', 'LUNG1-054', 'LUNG1-055', 'LUNG1-057', 'LUNG1-101', 'LUNG1-028', 'LUNG1-025', 'LUNG1-024', 'LUNG1-027', 'LUNG1-026', 'LUNG1-021', 'LUNG1-020', 'LUNG1-023', 'LUNG1-022', 'LUNG1-038', 'LUNG1-039', 'LUNG1-037', 'LUNG1-034', 'LUNG1-035', 'LUNG1-033', 'LUNG1-030', 'LUNG1-031', 'LUNG1-003', 'LUNG1-002', 'LUNG1-006', 'LUNG1-005', 'LUNG1-009', 'LUNG1-008', 'LUNG1-089', 'LUNG1-088', 'LUNG1-081', 'LUNG1-087', 'LUNG1-085']
'''
''' Dataset 3 '''
# This cases have displaced or incorrect annotation files
# Some maybe be corrected using the map below
skipCase = ['LUNG1-212','LUNG1-043','LUNG1-045','LUNG1-139' ]
# corrections applied by using np.roll on the 3D mask along the y-axis(0) and x-axis(1)
# format = (dy,dx), None implies correction requires more than simple translation
corrections = {
'LUNG1-212' : None,
'LUNG1-043' : None,
'LUNG1-045' : None,
'LUNG1-139': None,
}
# Manufacturers of CT Scanners
# Train
SIEMENS = ['LUNG1-278', 'LUNG1-148', 'LUNG1-237', 'LUNG1-134', 'LUNG1-258', 'LUNG1-259', 'LUNG1-256', 'LUNG1-257', 'LUNG1-255', 'LUNG1-252', 'LUNG1-253', 'LUNG1-317', 'LUNG1-147', 'LUNG1-144', 'LUNG1-145', 'LUNG1-098', 'LUNG1-099', 'LUNG1-141', 'LUNG1-095', 'LUNG1-096', 'LUNG1-097', 'LUNG1-090', 'LUNG1-091', 'LUNG1-092', 'LUNG1-318', 'LUNG1-308', 'LUNG1-309', 'LUNG1-261', 'LUNG1-260', 'LUNG1-129', 'LUNG1-263', 'LUNG1-262', 'LUNG1-178', 'LUNG1-267', 'LUNG1-266', 'LUNG1-264', 'LUNG1-173', 'LUNG1-172', 'LUNG1-171', 'LUNG1-268', 'LUNG1-177', 'LUNG1-176', 'LUNG1-307', 'LUNG1-065', 'LUNG1-069', 'LUNG1-269', 'LUNG1-289', 'LUNG1-288', 'LUNG1-170', 'LUNG1-321', 'LUNG1-281', 'LUNG1-280', 'LUNG1-283', 'LUNG1-282', 'LUNG1-285', 'LUNG1-284', 'LUNG1-287', 'LUNG1-286', 'LUNG1-306', 'LUNG1-274', 'LUNG1-275', 'LUNG1-276', 'LUNG1-277', 'LUNG1-168', 'LUNG1-272', 'LUNG1-273', 'LUNG1-164', 'LUNG1-165', 'LUNG1-166', 'LUNG1-167', 'LUNG1-160', 'LUNG1-161', 'LUNG1-162', 'LUNG1-163', 'LUNG1-072', 'LUNG1-071', 'LUNG1-077', 'LUNG1-074', 'LUNG1-075', 'LUNG1-093', 'LUNG1-079', 'LUNG1-298', 'LUNG1-299', 'LUNG1-139', 'LUNG1-183', 'LUNG1-292', 'LUNG1-293', 'LUNG1-290', 'LUNG1-291', 'LUNG1-296', 'LUNG1-297', 'LUNG1-294', 'LUNG1-295', 'LUNG1-191', 'LUNG1-190', 'LUNG1-193', 'LUNG1-192', 'LUNG1-194', 'LUNG1-197', 'LUNG1-196',
'LUNG1-199', 'LUNG1-313', 'LUNG1-205', 'LUNG1-207', 'LUNG1-111', 'LUNG1-110', 'LUNG1-113', 'LUNG1-112', 'LUNG1-115', 'LUNG1-114', 'LUNG1-117', 'LUNG1-053', 'LUNG1-300', 'LUNG1-146', 'LUNG1-180', 'LUNG1-181', 'LUNG1-315', 'LUNG1-057', 'LUNG1-212', 'LUNG1-213', 'LUNG1-108', 'LUNG1-211', 'LUNG1-216', 'LUNG1-217', 'LUNG1-214', 'LUNG1-215', 'LUNG1-102', 'LUNG1-142', 'LUNG1-100', 'LUNG1-107', 'LUNG1-104', 'LUNG1-105', 'LUNG1-311', 'LUNG1-132', 'LUNG1-310', 'LUNG1-151', 'LUNG1-131', 'LUNG1-103', 'LUNG1-218', 'LUNG1-219', 'LUNG1-227', 'LUNG1-226', 'LUNG1-225', 'LUNG1-224', 'LUNG1-223', 'LUNG1-222', 'LUNG1-221', 'LUNG1-220', 'LUNG1-136', 'LUNG1-133', 'LUNG1-229', 'LUNG1-130', 'LUNG1-304', 'LUNG1-244', 'LUNG1-143', 'LUNG1-119', 'LUNG1-118', 'LUNG1-084', 'LUNG1-231', 'LUNG1-232', 'LUNG1-233', 'LUNG1-234', 'LUNG1-235', 'LUNG1-236', 'LUNG1-305', 'LUNG1-120', 'LUNG1-121', 'LUNG1-122', 'LUNG1-123', 'LUNG1-125', 'LUNG1-126', 'LUNG1-127', 'LUNG1-109', 'LUNG1-138', 'LUNG1-239', 'LUNG1-208', 'LUNG1-270', 'LUNG1-303', 'LUNG1-271', 'LUNG1-320', 'LUNG1-080', 'LUNG1-249', 'LUNG1-248', 'LUNG1-245', 'LUNG1-247', 'LUNG1-246', 'LUNG1-241', 'LUNG1-240', 'LUNG1-243', 'LUNG1-242', 'LUNG1-154', 'LUNG1-157', 'LUNG1-156', 'LUNG1-326', 'LUNG1-150', 'LUNG1-152', 'LUNG1-082', 'LUNG1-048', 'LUNG1-085', 'LUNG1-210']
CMS = ['LUNG1-140', 'LUNG1-094', 'LUNG1-179', 'LUNG1-175', 'LUNG1-061', 'LUNG1-060', 'LUNG1-063', 'LUNG1-062', 'LUNG1-064', 'LUNG1-066', 'LUNG1-068', 'LUNG1-174', 'LUNG1-169', 'LUNG1-073', 'LUNG1-070', 'LUNG1-076', 'LUNG1-078', 'LUNG1-087', 'LUNG1-195', 'LUNG1-198', 'LUNG1-086', 'LUNG1-201', 'LUNG1-046', 'LUNG1-203', 'LUNG1-044', 'LUNG1-204', 'LUNG1-206', 'LUNG1-116', 'LUNG1-055', 'LUNG1-182',
'LUNG1-186', 'LUNG1-187', 'LUNG1-184', 'LUNG1-185', 'LUNG1-051', 'LUNG1-052', 'LUNG1-189', 'LUNG1-054', 'LUNG1-056', 'LUNG1-101', 'LUNG1-106', 'LUNG1-049', 'LUNG1-137', 'LUNG1-149', 'LUNG1-059', 'LUNG1-228', 'LUNG1-047', 'LUNG1-089', 'LUNG1-124', 'LUNG1-043', 'LUNG1-088', 'LUNG1-188', 'LUNG1-209', 'LUNG1-045', 'LUNG1-155', 'LUNG1-153', 'LUNG1-083', 'LUNG1-081', 'LUNG1-159', 'LUNG1-158']
# Val
| """ Dataset 1
# This cases have displaced or incorrect annotation files
# Some maybe be corrected using the map below
skipCase = ['LUNG1-034',
'LUNG1-040',
'LUNG1-044',
'LUNG1-068',
'LUNG1-083',
'LUNG1-084',
'LUNG1-094',
'LUNG1-096',
'LUNG1-176' ]
# corrections applied by using np.roll on the 3D mask along the y-axis(0) and x-axis(1)
# format = (dy,dx), None implies correction requires more than simple translation
corrections = {
'LUNG1-034': (165, 0),
'LUNG1-040': (190, 0),
'LUNG1-044': (166, 0),
'LUNG1-068': None,
'LUNG1-083': (293, 0),
'LUNG1-084': (314, 0),
'LUNG1-094': (328, 0),
'LUNG1-096': (318, 0),
'LUNG1-176': None
}
# Manufactuers of CT Scanners used for different cases
SIEMENS = ['LUNG1-013', 'LUNG1-098', 'LUNG1-099', 'LUNG1-094', 'LUNG1-096', 'LUNG1-097', 'LUNG1-090', 'LUNG1-092', 'LUNG1-093', 'LUNG1-065', 'LUNG1-072', 'LUNG1-073', 'LUNG1-071', 'LUNG1-077', 'LUNG1-075', 'LUNG1-079', 'LUNG1-048',
'LUNG1-051', 'LUNG1-056', 'LUNG1-102', 'LUNG1-103', 'LUNG1-100', 'LUNG1-104', 'LUNG1-105', 'LUNG1-029', 'LUNG1-032', 'LUNG1-001', 'LUNG1-004', 'LUNG1-083', 'LUNG1-082', 'LUNG1-080', 'LUNG1-086', 'LUNG1-084']
CMS = ['LUNG1-014', 'LUNG1-015', 'LUNG1-016', 'LUNG1-017', 'LUNG1-010', 'LUNG1-011', 'LUNG1-012', 'LUNG1-018', 'LUNG1-019', 'LUNG1-095', 'LUNG1-091', 'LUNG1-061', 'LUNG1-060', 'LUNG1-063', 'LUNG1-062', 'LUNG1-064', 'LUNG1-066', 'LUNG1-069', 'LUNG1-068', 'LUNG1-070', 'LUNG1-076', 'LUNG1-074', 'LUNG1-078', 'LUNG1-047', 'LUNG1-046', 'LUNG1-045', 'LUNG1-044', 'LUNG1-043', 'LUNG1-042', 'LUNG1-041', 'LUNG1-040', 'LUNG1-049', 'LUNG1-059',
'LUNG1-052', 'LUNG1-053', 'LUNG1-054', 'LUNG1-055', 'LUNG1-057', 'LUNG1-101', 'LUNG1-028', 'LUNG1-025', 'LUNG1-024', 'LUNG1-027', 'LUNG1-026', 'LUNG1-021', 'LUNG1-020', 'LUNG1-023', 'LUNG1-022', 'LUNG1-038', 'LUNG1-039', 'LUNG1-037', 'LUNG1-034', 'LUNG1-035', 'LUNG1-033', 'LUNG1-030', 'LUNG1-031', 'LUNG1-003', 'LUNG1-002', 'LUNG1-006', 'LUNG1-005', 'LUNG1-009', 'LUNG1-008', 'LUNG1-089', 'LUNG1-088', 'LUNG1-081', 'LUNG1-087', 'LUNG1-085']
"""
' Dataset 3 '
skip_case = ['LUNG1-212', 'LUNG1-043', 'LUNG1-045', 'LUNG1-139']
corrections = {'LUNG1-212': None, 'LUNG1-043': None, 'LUNG1-045': None, 'LUNG1-139': None}
siemens = ['LUNG1-278', 'LUNG1-148', 'LUNG1-237', 'LUNG1-134', 'LUNG1-258', 'LUNG1-259', 'LUNG1-256', 'LUNG1-257', 'LUNG1-255', 'LUNG1-252', 'LUNG1-253', 'LUNG1-317', 'LUNG1-147', 'LUNG1-144', 'LUNG1-145', 'LUNG1-098', 'LUNG1-099', 'LUNG1-141', 'LUNG1-095', 'LUNG1-096', 'LUNG1-097', 'LUNG1-090', 'LUNG1-091', 'LUNG1-092', 'LUNG1-318', 'LUNG1-308', 'LUNG1-309', 'LUNG1-261', 'LUNG1-260', 'LUNG1-129', 'LUNG1-263', 'LUNG1-262', 'LUNG1-178', 'LUNG1-267', 'LUNG1-266', 'LUNG1-264', 'LUNG1-173', 'LUNG1-172', 'LUNG1-171', 'LUNG1-268', 'LUNG1-177', 'LUNG1-176', 'LUNG1-307', 'LUNG1-065', 'LUNG1-069', 'LUNG1-269', 'LUNG1-289', 'LUNG1-288', 'LUNG1-170', 'LUNG1-321', 'LUNG1-281', 'LUNG1-280', 'LUNG1-283', 'LUNG1-282', 'LUNG1-285', 'LUNG1-284', 'LUNG1-287', 'LUNG1-286', 'LUNG1-306', 'LUNG1-274', 'LUNG1-275', 'LUNG1-276', 'LUNG1-277', 'LUNG1-168', 'LUNG1-272', 'LUNG1-273', 'LUNG1-164', 'LUNG1-165', 'LUNG1-166', 'LUNG1-167', 'LUNG1-160', 'LUNG1-161', 'LUNG1-162', 'LUNG1-163', 'LUNG1-072', 'LUNG1-071', 'LUNG1-077', 'LUNG1-074', 'LUNG1-075', 'LUNG1-093', 'LUNG1-079', 'LUNG1-298', 'LUNG1-299', 'LUNG1-139', 'LUNG1-183', 'LUNG1-292', 'LUNG1-293', 'LUNG1-290', 'LUNG1-291', 'LUNG1-296', 'LUNG1-297', 'LUNG1-294', 'LUNG1-295', 'LUNG1-191', 'LUNG1-190', 'LUNG1-193', 'LUNG1-192', 'LUNG1-194', 'LUNG1-197', 'LUNG1-196', 'LUNG1-199', 'LUNG1-313', 'LUNG1-205', 'LUNG1-207', 'LUNG1-111', 'LUNG1-110', 'LUNG1-113', 'LUNG1-112', 'LUNG1-115', 'LUNG1-114', 'LUNG1-117', 'LUNG1-053', 'LUNG1-300', 'LUNG1-146', 'LUNG1-180', 'LUNG1-181', 'LUNG1-315', 'LUNG1-057', 'LUNG1-212', 'LUNG1-213', 'LUNG1-108', 'LUNG1-211', 'LUNG1-216', 'LUNG1-217', 'LUNG1-214', 'LUNG1-215', 'LUNG1-102', 'LUNG1-142', 'LUNG1-100', 'LUNG1-107', 'LUNG1-104', 'LUNG1-105', 'LUNG1-311', 'LUNG1-132', 'LUNG1-310', 'LUNG1-151', 'LUNG1-131', 'LUNG1-103', 'LUNG1-218', 'LUNG1-219', 'LUNG1-227', 'LUNG1-226', 'LUNG1-225', 'LUNG1-224', 'LUNG1-223', 'LUNG1-222', 'LUNG1-221', 'LUNG1-220', 'LUNG1-136', 'LUNG1-133', 'LUNG1-229', 'LUNG1-130', 'LUNG1-304', 'LUNG1-244', 'LUNG1-143', 'LUNG1-119', 'LUNG1-118', 'LUNG1-084', 'LUNG1-231', 'LUNG1-232', 'LUNG1-233', 'LUNG1-234', 'LUNG1-235', 'LUNG1-236', 'LUNG1-305', 'LUNG1-120', 'LUNG1-121', 'LUNG1-122', 'LUNG1-123', 'LUNG1-125', 'LUNG1-126', 'LUNG1-127', 'LUNG1-109', 'LUNG1-138', 'LUNG1-239', 'LUNG1-208', 'LUNG1-270', 'LUNG1-303', 'LUNG1-271', 'LUNG1-320', 'LUNG1-080', 'LUNG1-249', 'LUNG1-248', 'LUNG1-245', 'LUNG1-247', 'LUNG1-246', 'LUNG1-241', 'LUNG1-240', 'LUNG1-243', 'LUNG1-242', 'LUNG1-154', 'LUNG1-157', 'LUNG1-156', 'LUNG1-326', 'LUNG1-150', 'LUNG1-152', 'LUNG1-082', 'LUNG1-048', 'LUNG1-085', 'LUNG1-210']
cms = ['LUNG1-140', 'LUNG1-094', 'LUNG1-179', 'LUNG1-175', 'LUNG1-061', 'LUNG1-060', 'LUNG1-063', 'LUNG1-062', 'LUNG1-064', 'LUNG1-066', 'LUNG1-068', 'LUNG1-174', 'LUNG1-169', 'LUNG1-073', 'LUNG1-070', 'LUNG1-076', 'LUNG1-078', 'LUNG1-087', 'LUNG1-195', 'LUNG1-198', 'LUNG1-086', 'LUNG1-201', 'LUNG1-046', 'LUNG1-203', 'LUNG1-044', 'LUNG1-204', 'LUNG1-206', 'LUNG1-116', 'LUNG1-055', 'LUNG1-182', 'LUNG1-186', 'LUNG1-187', 'LUNG1-184', 'LUNG1-185', 'LUNG1-051', 'LUNG1-052', 'LUNG1-189', 'LUNG1-054', 'LUNG1-056', 'LUNG1-101', 'LUNG1-106', 'LUNG1-049', 'LUNG1-137', 'LUNG1-149', 'LUNG1-059', 'LUNG1-228', 'LUNG1-047', 'LUNG1-089', 'LUNG1-124', 'LUNG1-043', 'LUNG1-088', 'LUNG1-188', 'LUNG1-209', 'LUNG1-045', 'LUNG1-155', 'LUNG1-153', 'LUNG1-083', 'LUNG1-081', 'LUNG1-159', 'LUNG1-158'] |
(5)(3)
l = [a, 21, l]
l(3)
a(20, 21, *n, b=m)
| 5(3)
l = [a, 21, l]
l(3)
a(20, 21, *n, b=m) |
ages = [5, 12, 17, 18, 24, 32]
def myFunc(x):
if x < 18:
return False
else:
return True
adults = filter(myFunc, ages)
for x in adults:
print(x) | ages = [5, 12, 17, 18, 24, 32]
def my_func(x):
if x < 18:
return False
else:
return True
adults = filter(myFunc, ages)
for x in adults:
print(x) |
def fraction(a, b):
try:
return "%.1f" % (float(a) / float(b))
except (ValueError, ZeroDivisionError):
return "ERR"
| def fraction(a, b):
try:
return '%.1f' % (float(a) / float(b))
except (ValueError, ZeroDivisionError):
return 'ERR' |
# M-1
x1 = 12
y1 = 5
z1 = x1*y1
print(z1)
# M-2
eggs = 12
unit_price = 5
total_price = eggs*unit_price
print(total_price)
# M-3
a12345 = 12
b12345 = 5
c12345 = a12345*b12345
print(c12345)
| x1 = 12
y1 = 5
z1 = x1 * y1
print(z1)
eggs = 12
unit_price = 5
total_price = eggs * unit_price
print(total_price)
a12345 = 12
b12345 = 5
c12345 = a12345 * b12345
print(c12345) |
# SAVE PATIENTS
n = int(input())
strength = list(map(int, input().split()))
patient = list(map(int, input().split()))
strength.sort()
patient.sort()
for i in range(n):
if strength[i]<patient[i]:
print("No")
break
else:
print("Yes")
| n = int(input())
strength = list(map(int, input().split()))
patient = list(map(int, input().split()))
strength.sort()
patient.sort()
for i in range(n):
if strength[i] < patient[i]:
print('No')
break
else:
print('Yes') |
# 06 Magic Methods
# https://rszalski.github.io/magicmethods/
# Magiv Methods are called automaticly by Python interpreter, depending on how we use our object and class
class Point:
point_color = "Red"
@classmethod
def zero(cls):
return cls(0, 0, 0)
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __str__(self): # This method is returning our point as a string
return f"{self.x}, {self.y}, {self.z}"
def draw(self):
print(f"Point coordinates ({self.x}, {self.y}, {self.z})")
point_1 = Point(100, 200, 10)
print(point_1) | class Point:
point_color = 'Red'
@classmethod
def zero(cls):
return cls(0, 0, 0)
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __str__(self):
return f'{self.x}, {self.y}, {self.z}'
def draw(self):
print(f'Point coordinates ({self.x}, {self.y}, {self.z})')
point_1 = point(100, 200, 10)
print(point_1) |
# Implement Rand10() Using Rand7()
'''
Given the API rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer in the range 1 to 10. You can only call the API rand7 and you shouldn't call any other API. Please don't use the system's Math.random().
Notice that Each test case has one argument n, the number of times that your implemented function rand10 will be called while testing.
Follow up:
What is the expected value for the number of calls to rand7() function?
Could you minimize the number of calls to rand7()?
Example 1:
Input: n = 1
Output: [2]
Example 2:
Input: n = 2
Output: [2,8]
Example 3:
Input: n = 3
Output: [3,8,10]
Constraints:
1 <= n <= 105
'''
# The rand7() API is already defined for you.
# def rand7():
# @return a random integer in the range 1 to 7
class Solution:
def rand10(self):
"""
:rtype: int
"""
while True:
row = 7*(rand7()-1)
col = rand7()
curr = row+col
if curr<=40:
return 1+(curr-1)%10
| """
Given the API rand7 which generates a uniform random integer in the range 1 to 7, write a function rand10 which generates a uniform random integer in the range 1 to 10. You can only call the API rand7 and you shouldn't call any other API. Please don't use the system's Math.random().
Notice that Each test case has one argument n, the number of times that your implemented function rand10 will be called while testing.
Follow up:
What is the expected value for the number of calls to rand7() function?
Could you minimize the number of calls to rand7()?
Example 1:
Input: n = 1
Output: [2]
Example 2:
Input: n = 2
Output: [2,8]
Example 3:
Input: n = 3
Output: [3,8,10]
Constraints:
1 <= n <= 105
"""
class Solution:
def rand10(self):
"""
:rtype: int
"""
while True:
row = 7 * (rand7() - 1)
col = rand7()
curr = row + col
if curr <= 40:
return 1 + (curr - 1) % 10 |
def BST_nearest_val(data, val):
"""Nearest Value in a Binary Seach Tree."""
nearest = abs(val - data.root.val)
hour = data.root.val
def _walk(node=None):
nonlocal nearest, hour
if node is None:
return
if node.left is not None:
_walk(node.left)
# this conditional is only needed if you wanted to return the larger of 2 equidistant data points
if abs(val - node.val) == nearest:
if node.val > hour:
hour = node.val
if abs(val - node.val) < nearest:
nearest = abs(val - node.val)
hour = node.val
if node.right is not None:
_walk(node.right)
_walk(data.root)
return hour
| def bst_nearest_val(data, val):
"""Nearest Value in a Binary Seach Tree."""
nearest = abs(val - data.root.val)
hour = data.root.val
def _walk(node=None):
nonlocal nearest, hour
if node is None:
return
if node.left is not None:
_walk(node.left)
if abs(val - node.val) == nearest:
if node.val > hour:
hour = node.val
if abs(val - node.val) < nearest:
nearest = abs(val - node.val)
hour = node.val
if node.right is not None:
_walk(node.right)
_walk(data.root)
return hour |
#EP:1
"""
import math
r = eval(raw_input('Please enter the length from the center to a vertex: '))
s = 2 * r * math.sin(math.pi/5)
area = 5 * s * s / (4*math.tan(math.pi/5))
print('The area of the pentagon is: {:.2f}'.format(area)) """
#EP:2
"""
import math
x1,y1 = eval(raw_input('Please enter point 1 (latitude and longitude) in degrees: '))
x2,y2 = eval(raw_input('Please enter point 2 (latitude and longitude) in degrees: '))
d = 6371.01 * (math.acos(math.radians(math.sin(x1)*math.sin(x2)+math.cos(x1)*math.cos(x2)*math.cos(y1-y2))))
print('The distance between the two points is: {} km'.format(d))
"""
#EP:3
"""
import math
s = eval(raw_input('Please enter the side: '))
area = (5*s*s)/4/(math.tan(math.pi/5))
print('The area of the pentagon is: {}'.format(area)) """
#EP:4
"""
import math
n = eval(raw_input('Please enter the number of sides: '))
s = eval(raw_input('Please enter the side: '))
area = n*s*s/(4*(math.tan(math.pi/n)))
print('The area of the polygon is: {}'.format(area)) """
#EP:5
"""
num = eval(raw_input('Please enter an ASCII code (0~127): '))
print('The character is: {}'.format(chr(num))) """
#EP:6
"""
name = raw_input('Please enter employee is name: ')
num = eval(raw_input('Please enter number of hours worked in a week: '))
rate = eval(raw_input('Please enter hourly pay rate: '))
fed = eval(raw_input('Please enter federal tax withholding rate: '))
state = eval(raw_input('Please enter state tax withholding rate: '))
gr = rate * num
fe = gr * fed
st = gr * state
total = fe + st
net = gr - total
print('Employee Name: {}'.format(name))
print('Hours Worked: {}'.format(num))
print('Pay Rate: ${}'.format(rate))
print('Gross Pay: ${}'.format(gr))
print('Deductions\n Federal Withholding (20.0%): ${}\n State Withholding (9.0%): ${:.2f}\n Total Deduction: %{:.2f}'.format(fe,st,total))
print('Net Pay: ${:.2f}'.format(net)) """
#EP:7
"""
num = eval(raw_input('Please enter an integer: ')
q = num // 1000
b = (num%1000)//100
s = (num%100)//10
g = num%10
sum = g*1000 + s*100 + b*10 + q
print('The reversed number is: {}'.format(sum))
"""
#EP:8
"""
res = ''
for i in "2443048363@qq.com":
res = res + chr(ord(i) + 1)
print(res) """
#EP:1
"""
import math
a,b,c = eval(raw_input('Please enter a, b and c: '))
s = b*b - 4*a*c
if s>0:
r1 = (-b + math.sqrt(s)) / (2*a)
r2 = (-b - math.sqrt(s)) / (2*a)
print('The roots are {:.6f} and {:.5f}'.format(r1,r2))
elif s==0:
r1 = r2 = (-b + math.sqrt(s)) / (2*a)
print('The root is {:.0f}'.format(r1))
else:
print('The equation has no real roots') """
#EP:2
"""
import random
num1 = random.randint(0,100)
num2 = random.randint(0,100)
sum = eval(raw_input('Please enter sun: '))
if sum==num1+num2:
print('True')
else:
print('False') """
#EP:3
"""
week = eval(raw_input('Please enter today is day: '))
day = eval(raw_input('Please enter the number of days elapsed since today: '))
f = (week+day)%7
if f==0:
print('Today is {} and the future day is {}'.format(week,f))
if f==1:
print('Today is {} and the future day is {}'.format(week,f))
if f==2:
print('Today is {} and the future day is {}'.format(week,f))
if f==3:
print('Today is {} and the future day is {}'.format(week,f))
if f==4:
print('Today is {} and the future day is {}'.format(week,f))
if f==5:
print('Today is {} and the future day is {}'.format(week,f))
if f==6:
print('Today is {} and the future day is {}'.format(week,f))
"""
#EP:4
"""
a,b,c = eval(raw_input('Please enter a, b and c: '))
max1=max(a,b,c)
min1=min(a,b,c)
z=a+b+c-max1-min1
print('The number are: {} {} {}'.format(min1,z,max1))
"""
#EP:5
"""
wight1,num1 = eval(raw_input('Please enter wight and price for package 1: '))
wight2,num2 = eval(raw_input('Please enter wight and price for package 2: '))
Package1 = num1/wight1
Package2 = num2/wight2
if Package1<Package2:
print('Package 1 has the better price')
if Package1>Package2:
print('Package 2 has the better price')
"""
#EP:6
"""
m,y = eval(raw_input('Please enter month and year: '))
if m==2:
if (y%4==0 or y%100!=0)and y%4==0:
n=29
else:
n=28
else:
if m==4 and m==6 and m==9 and m==11:
n=30
else:
n=31
print('{} day and {} month have {} day'.format(y,m,n))
"""
#EP:7
"""
import random
num = eval(raw_input('positive(1), negative(0): '))
com = random.randint(0,1)
if num==com:
print(True)
else:
print(False) """
#EP:8
"""
import random
num = eval(raw_input('scissor(0), rock(1), paper(2): '))
com = random.randint(0,2)
if num==com:
print('draw')
elif (num==0 and com==2) or (num==1 and com==0)or (num==2 and com==1):
print('win')
else:
print('lose')
"""
#EP:10
"""
import random
pai = ['A','2','3','4','5','6','7','8','9','10','J','Q','K']
hua = ['mh','ht','fk','heit']
p =random.choice(pai)
h = random.choice(hua)
print('The card you picked is {} of {}'.format(p,h))
"""
#EP:11
"""
num = eval(raw_input('Please enter a three-digit integer: '))
b = num//100
g = num%10
if b==g:
print('{} is a palindrome'.format(num))
if b!=g:
print('{} is not a palindrome'.format(num)) """
#EP:12
"""
a,b,c = eval(raw_input('Please enter edges: '))
if a+b<=c and a+c<=b and b+c<=a:
print('This is illegal')
else:
print('The perimeter is: {}'.format(a+b+c))
"""
| """
import math
r = eval(raw_input('Please enter the length from the center to a vertex: '))
s = 2 * r * math.sin(math.pi/5)
area = 5 * s * s / (4*math.tan(math.pi/5))
print('The area of the pentagon is: {:.2f}'.format(area)) """
"\nimport math\nx1,y1 = eval(raw_input('Please enter point 1 (latitude and longitude) in degrees: '))\nx2,y2 = eval(raw_input('Please enter point 2 (latitude and longitude) in degrees: '))\nd = 6371.01 * (math.acos(math.radians(math.sin(x1)*math.sin(x2)+math.cos(x1)*math.cos(x2)*math.cos(y1-y2))))\nprint('The distance between the two points is: {} km'.format(d)) \n"
"\nimport math\ns = eval(raw_input('Please enter the side: '))\narea = (5*s*s)/4/(math.tan(math.pi/5))\nprint('The area of the pentagon is: {}'.format(area)) "
"\nimport math\nn = eval(raw_input('Please enter the number of sides: '))\ns = eval(raw_input('Please enter the side: '))\narea = n*s*s/(4*(math.tan(math.pi/n)))\nprint('The area of the polygon is: {}'.format(area)) "
"\nnum = eval(raw_input('Please enter an ASCII code (0~127): '))\nprint('The character is: {}'.format(chr(num))) "
"\nname = raw_input('Please enter employee is name: ')\nnum = eval(raw_input('Please enter number of hours worked in a week: '))\nrate = eval(raw_input('Please enter hourly pay rate: '))\nfed = eval(raw_input('Please enter federal tax withholding rate: '))\nstate = eval(raw_input('Please enter state tax withholding rate: '))\ngr = rate * num\nfe = gr * fed\nst = gr * state\ntotal = fe + st\nnet = gr - total\nprint('Employee Name: {}'.format(name))\nprint('Hours Worked: {}'.format(num))\nprint('Pay Rate: ${}'.format(rate))\nprint('Gross Pay: ${}'.format(gr))\nprint('Deductions\n Federal Withholding (20.0%): ${}\n State Withholding (9.0%): ${:.2f}\n Total Deduction: %{:.2f}'.format(fe,st,total))\nprint('Net Pay: ${:.2f}'.format(net)) "
"\nnum = eval(raw_input('Please enter an integer: ')\nq = num // 1000\nb = (num%1000)//100\ns = (num%100)//10\ng = num%10\nsum = g*1000 + s*100 + b*10 + q\nprint('The reversed number is: {}'.format(sum))\n"
'\nres = \'\'\nfor i in "2443048363@qq.com":\n res = res + chr(ord(i) + 1)\nprint(res) '
"\nimport math\na,b,c = eval(raw_input('Please enter a, b and c: '))\ns = b*b - 4*a*c\nif s>0:\n r1 = (-b + math.sqrt(s)) / (2*a)\n r2 = (-b - math.sqrt(s)) / (2*a)\n print('The roots are {:.6f} and {:.5f}'.format(r1,r2))\nelif s==0: \n r1 = r2 = (-b + math.sqrt(s)) / (2*a)\n print('The root is {:.0f}'.format(r1))\nelse:\n print('The equation has no real roots') "
"\nimport random\nnum1 = random.randint(0,100)\nnum2 = random.randint(0,100)\nsum = eval(raw_input('Please enter sun: '))\nif sum==num1+num2:\n print('True')\nelse:\n print('False') "
"\nweek = eval(raw_input('Please enter today is day: '))\nday = eval(raw_input('Please enter the number of days elapsed since today: '))\nf = (week+day)%7\nif f==0:\n print('Today is {} and the future day is {}'.format(week,f))\nif f==1:\n print('Today is {} and the future day is {}'.format(week,f))\nif f==2:\n print('Today is {} and the future day is {}'.format(week,f))\nif f==3:\n print('Today is {} and the future day is {}'.format(week,f))\nif f==4:\n print('Today is {} and the future day is {}'.format(week,f))\nif f==5:\n print('Today is {} and the future day is {}'.format(week,f))\nif f==6:\n print('Today is {} and the future day is {}'.format(week,f))\n"
"\na,b,c = eval(raw_input('Please enter a, b and c: '))\nmax1=max(a,b,c)\nmin1=min(a,b,c)\nz=a+b+c-max1-min1\nprint('The number are: {} {} {}'.format(min1,z,max1))\n"
"\nwight1,num1 = eval(raw_input('Please enter wight and price for package 1: '))\nwight2,num2 = eval(raw_input('Please enter wight and price for package 2: '))\nPackage1 = num1/wight1\nPackage2 = num2/wight2\nif Package1<Package2:\n print('Package 1 has the better price') \nif Package1>Package2:\n print('Package 2 has the better price') \n"
"\nm,y = eval(raw_input('Please enter month and year: '))\nif m==2:\n if (y%4==0 or y%100!=0)and y%4==0:\n n=29\n else:\n n=28\nelse:\n if m==4 and m==6 and m==9 and m==11:\n n=30\n else:\n n=31\nprint('{} day and {} month have {} day'.format(y,m,n))\n"
"\nimport random\nnum = eval(raw_input('positive(1), negative(0): '))\ncom = random.randint(0,1)\nif num==com:\n print(True)\nelse:\n print(False) "
"\nimport random\nnum = eval(raw_input('scissor(0), rock(1), paper(2): '))\ncom = random.randint(0,2)\nif num==com:\n print('draw')\nelif (num==0 and com==2) or (num==1 and com==0)or (num==2 and com==1):\n print('win')\nelse:\n print('lose') \n"
"\nimport random\npai = ['A','2','3','4','5','6','7','8','9','10','J','Q','K']\nhua = ['mh','ht','fk','heit']\np =random.choice(pai)\nh = random.choice(hua)\nprint('The card you picked is {} of {}'.format(p,h))\n"
"\nnum = eval(raw_input('Please enter a three-digit integer: '))\nb = num//100\ng = num%10\nif b==g:\n print('{} is a palindrome'.format(num))\nif b!=g:\n print('{} is not a palindrome'.format(num)) "
"\na,b,c = eval(raw_input('Please enter edges: '))\nif a+b<=c and a+c<=b and b+c<=a:\n print('This is illegal')\nelse:\n print('The perimeter is: {}'.format(a+b+c))\n" |
# Python vs. C++ Example 4
# Rachel J. Morris, 2013 - RachelJMorris@gmail.com, Moosader.com, github.com/Moosader
# MIT License
# Generally, these shouldn't be stored in separate lists; we would create
# a class to store name & age, but we will do this in a later example.
lstStudentNames = []
lstStudentAges = []
doneWithProgram = False
while ( not doneWithProgram ):
print( "\n" )
print( "What would you like to do?" )
print( "1. Add another student" )
print( "2. End" )
choice = input( "? " )
while ( int(choice) != 1 and int(choice) != 2 ):
choice = input( "Invalid choice, try again: " )
if ( int(choice) == 2 ):
doneWithProgram = True
else:
print( "Add new student:" )
name = input( "Name? " )
age = input( "Age? " )
while ( int(age) < 0 or int(age) > 120 ):
print( "Invalid age, must be between 0 and 120 years old" )
age = input( "Age?" )
# Add new student to list
lstStudentNames.append( name )
lstStudentAges.append( age )
# while ( not doneWithProgram ):
# Program over - Display students
print( "\n\nYour students:" )
for i in range( 0, len( lstStudentNames ) ):
print( lstStudentNames[i] + "\t\tAge: " + lstStudentAges[i] )
| lst_student_names = []
lst_student_ages = []
done_with_program = False
while not doneWithProgram:
print('\n')
print('What would you like to do?')
print('1. Add another student')
print('2. End')
choice = input('? ')
while int(choice) != 1 and int(choice) != 2:
choice = input('Invalid choice, try again: ')
if int(choice) == 2:
done_with_program = True
else:
print('Add new student:')
name = input('Name? ')
age = input('Age? ')
while int(age) < 0 or int(age) > 120:
print('Invalid age, must be between 0 and 120 years old')
age = input('Age?')
lstStudentNames.append(name)
lstStudentAges.append(age)
print('\n\nYour students:')
for i in range(0, len(lstStudentNames)):
print(lstStudentNames[i] + '\t\tAge: ' + lstStudentAges[i]) |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def sumNumbers(self, root):
if not root:
return 0
queue = []
values = []
self.dfs(root, queue, values)
return sum(values)
def dfs(self, root, queue, values):
queue.append(root)
if not root.left and not root.right:
val = 0
n = len(queue)
for i in range(n):
node = queue[n-i-1]
val += node.val*10**i
values.append(val)
else:
if root.left:
self.dfs(root.left, queue, values)
if root.right:
self.dfs(root.right, queue, values)
queue.pop()
| class Solution:
def sum_numbers(self, root):
if not root:
return 0
queue = []
values = []
self.dfs(root, queue, values)
return sum(values)
def dfs(self, root, queue, values):
queue.append(root)
if not root.left and (not root.right):
val = 0
n = len(queue)
for i in range(n):
node = queue[n - i - 1]
val += node.val * 10 ** i
values.append(val)
else:
if root.left:
self.dfs(root.left, queue, values)
if root.right:
self.dfs(root.right, queue, values)
queue.pop() |
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
# Simple test on a grid texture
command = testshade("-t 1 -groupname Beatles -layer Cake test")
command += testshade("-t 1 -g 2 2 -groupname Beatles -layer Cake test_v_name")
| command = testshade('-t 1 -groupname Beatles -layer Cake test')
command += testshade('-t 1 -g 2 2 -groupname Beatles -layer Cake test_v_name') |
"""The holiest cli template system
tmplr provides modules for working with tmplr templates, called Temples. Most
Temples are represented by actual files on disk, so a convenience function is
provided to create a Temple from a path. Programmatic access is also provided.
Modules:
temple -- provides the Temple class and helper functions
Temple-file format
------------------
A Temple file consists of two parts:
1. header
2. content
The header provides metadata specific to tmplr, and will be omitted when the
template is rendered into output.
The content is text, containing special template sequences which will be
substituted by render arguments upon output.
Header format
=============
The first line of the header must consist of the same character repeated
thrice. We call this the "comment character" because, if you use a character
considered a comment for the normal file content, editors will not choke on
Temple headers.
The next lines consist of metadata and all follow this format:
{comment character} key : value
A value ends once the line is terminated by a newline character.
After the metadata is the last line of the header--it is a carbon copy of the
first line of the header.
Anything after the second sequence of 3 comment characters is considered
content and read literally.
Temple metadata
===============
The supported key-value pairs are:
- output
The output directive can be a path (with ~ expansions), optionally
containing the sequence {fname}. If the rendered template is written,
it will be written to this path, with {fname} substituted for a
filename by the engine (see tmplr.temple.Temple.write).
If output is instead the string 'stdout', the rendered template will be
printed to standard out.
- help
The help directive provides a short description of the template
- delim
The delim directive decides the special sequences that require render
arguments.
Any text of delim followed by name, or delim{name}, will be replaced by
the render argument name (see tmplr.temple.Temple.render).
Take care to choose a delim value that will not appear in the template
except for in these escape sequences.
Unsupported values will be ignored, but not cause a parsing error.
*** Example ***
###
# output : /tmp/tmplr-test-example-{fname}
# help : tmux config script
# delim : %%
###
#! /bin/sh
content...
%%var
%%{func_name}
%%var
...etc.
*** End Example ***
In this example, the comment character is '#' because the file is a shell
script. %%var will be replaced in both places (since %% is the delim) by the
var argument to render. Similarly %%{func_name} will be replaced the func_name
argument to render.
If fname is passed as, e.g., templar, the result will be written to
/tmp/tmplr-test-example-templar.
"""
__version__ = "0.4.0"
| """The holiest cli template system
tmplr provides modules for working with tmplr templates, called Temples. Most
Temples are represented by actual files on disk, so a convenience function is
provided to create a Temple from a path. Programmatic access is also provided.
Modules:
temple -- provides the Temple class and helper functions
Temple-file format
------------------
A Temple file consists of two parts:
1. header
2. content
The header provides metadata specific to tmplr, and will be omitted when the
template is rendered into output.
The content is text, containing special template sequences which will be
substituted by render arguments upon output.
Header format
=============
The first line of the header must consist of the same character repeated
thrice. We call this the "comment character" because, if you use a character
considered a comment for the normal file content, editors will not choke on
Temple headers.
The next lines consist of metadata and all follow this format:
{comment character} key : value
A value ends once the line is terminated by a newline character.
After the metadata is the last line of the header--it is a carbon copy of the
first line of the header.
Anything after the second sequence of 3 comment characters is considered
content and read literally.
Temple metadata
===============
The supported key-value pairs are:
- output
The output directive can be a path (with ~ expansions), optionally
containing the sequence {fname}. If the rendered template is written,
it will be written to this path, with {fname} substituted for a
filename by the engine (see tmplr.temple.Temple.write).
If output is instead the string 'stdout', the rendered template will be
printed to standard out.
- help
The help directive provides a short description of the template
- delim
The delim directive decides the special sequences that require render
arguments.
Any text of delim followed by name, or delim{name}, will be replaced by
the render argument name (see tmplr.temple.Temple.render).
Take care to choose a delim value that will not appear in the template
except for in these escape sequences.
Unsupported values will be ignored, but not cause a parsing error.
*** Example ***
###
# output : /tmp/tmplr-test-example-{fname}
# help : tmux config script
# delim : %%
###
#! /bin/sh
content...
%%var
%%{func_name}
%%var
...etc.
*** End Example ***
In this example, the comment character is '#' because the file is a shell
script. %%var will be replaced in both places (since %% is the delim) by the
var argument to render. Similarly %%{func_name} will be replaced the func_name
argument to render.
If fname is passed as, e.g., templar, the result will be written to
/tmp/tmplr-test-example-templar.
"""
__version__ = '0.4.0' |
#!/usr/bin/env python
"""
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with cortical.io GmbH.
******************************************************************************/
"""
class Metric(object):
def __init__(self, cosineSimilarity=None, jaccardDistance=None, overlappingAll=None, overlappingLeftRight=None, overlappingRightLeft=None, sizeLeft=None, sizeRight=None, weightedScoring=None, euclideanDistance=None):
#Get Cosine-Similarity.
self.cosineSimilarity = cosineSimilarity # float
#Get Jaccard-Distance.
self.jaccardDistance = jaccardDistance # float
#Get Overlapping-All.
self.overlappingAll = overlappingAll # int
#Get Overlapping-Left-Right.
self.overlappingLeftRight = overlappingLeftRight # float
#Get Overlapping-Right-Left.
self.overlappingRightLeft = overlappingRightLeft # float
#Get Size-left.
self.sizeLeft = sizeLeft # int
#Get Size-Right.
self.sizeRight = sizeRight # int
#Get the Weighted-Scoring.
self.weightedScoring = weightedScoring # float
#Get Euclidean-Distance.
self.euclideanDistance = euclideanDistance # float
| """
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with cortical.io GmbH.
******************************************************************************/
"""
class Metric(object):
def __init__(self, cosineSimilarity=None, jaccardDistance=None, overlappingAll=None, overlappingLeftRight=None, overlappingRightLeft=None, sizeLeft=None, sizeRight=None, weightedScoring=None, euclideanDistance=None):
self.cosineSimilarity = cosineSimilarity
self.jaccardDistance = jaccardDistance
self.overlappingAll = overlappingAll
self.overlappingLeftRight = overlappingLeftRight
self.overlappingRightLeft = overlappingRightLeft
self.sizeLeft = sizeLeft
self.sizeRight = sizeRight
self.weightedScoring = weightedScoring
self.euclideanDistance = euclideanDistance |
######################################
# general weight sampling
######################################
def gaussPertubation(weight,weightStt,offsetStd=0.0,out=None,n=1):
"""" very stupid sampling"""
pass
######################################
# general weight sampling
###################################### | def gauss_pertubation(weight, weightStt, offsetStd=0.0, out=None, n=1):
"""" very stupid sampling"""
pass |
table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
flag = [ord("X") for i in range(0x64)]
flag[0] = ord(table[0x1c])
flag[1] = ord(table[0x36])
flag[2] = ord(table[(0x1c + 0x36) >> 2])
flag[10] = flag[2]
flag[3] = 0x6a
flag[4] = flag[0] + 1
for p in [0xc, 0x16, 0x18]:
flag[p] = flag[4] - 1
flag[6] = flag[3] - 0x20
flag[11] = 0x2f + 1
flag[1 + 0x22] = flag[11] + 9
flag[0x17] = 1 + 0x2f
flag[8] = flag[0] - 1
flag[0x1b] = flag[4] + 2
flag[0x1f] = flag[4] + 2
flag[9] = flag[0x1b] + 7
flag[0x19] = flag[0x1b] + 7
for p in [0xd, 0x11, 0x15]:
flag[p] = flag[1] + 1
flag[7] = 0x70
flag[0xf] = flag[7] + 3
flag[0xe] = flag[0xf] + 1
flag[0x13] = 0x7a
flag[0x22] = flag[0] - 0x21
flag[0x1a] = 1 + 0x30
flag[0x10] = flag[9] - 0x20
flag[0x1c] = flag[0x10]
flag[0x12] = flag[7] - 0x1e
flag[0x1e] = flag[0x12]
flag[0x20] = flag[4]
#for p in [5, 0x14, 0x1d, 0xc4]:
# print(flag[p])
print(''.join(list(map(chr, flag))))
| table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
flag = [ord('X') for i in range(100)]
flag[0] = ord(table[28])
flag[1] = ord(table[54])
flag[2] = ord(table[28 + 54 >> 2])
flag[10] = flag[2]
flag[3] = 106
flag[4] = flag[0] + 1
for p in [12, 22, 24]:
flag[p] = flag[4] - 1
flag[6] = flag[3] - 32
flag[11] = 47 + 1
flag[1 + 34] = flag[11] + 9
flag[23] = 1 + 47
flag[8] = flag[0] - 1
flag[27] = flag[4] + 2
flag[31] = flag[4] + 2
flag[9] = flag[27] + 7
flag[25] = flag[27] + 7
for p in [13, 17, 21]:
flag[p] = flag[1] + 1
flag[7] = 112
flag[15] = flag[7] + 3
flag[14] = flag[15] + 1
flag[19] = 122
flag[34] = flag[0] - 33
flag[26] = 1 + 48
flag[16] = flag[9] - 32
flag[28] = flag[16]
flag[18] = flag[7] - 30
flag[30] = flag[18]
flag[32] = flag[4]
print(''.join(list(map(chr, flag)))) |
class Configuration:
DB = 'aiohttpdemo_polls'
USER = 'aiohttpdemo_user'
PASS = 'aiohttpdemo_pass'
HOST = 'localhost'
PORT = '5432'
| class Configuration:
db = 'aiohttpdemo_polls'
user = 'aiohttpdemo_user'
pass = 'aiohttpdemo_pass'
host = 'localhost'
port = '5432' |
class Provider(object):
base_url = None
def __init__(self, url: str) -> None:
self.base_url = url
def watch(self):
pass | class Provider(object):
base_url = None
def __init__(self, url: str) -> None:
self.base_url = url
def watch(self):
pass |
#
# PySNMP MIB module XYLAN-BASE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLAN-BASE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:44:24 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, TimeTicks, Integer32, enterprises, Counter32, Counter64, NotificationType, iso, ObjectIdentity, MibIdentifier, ModuleIdentity, Unsigned32, Bits, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "TimeTicks", "Integer32", "enterprises", "Counter32", "Counter64", "NotificationType", "iso", "ObjectIdentity", "MibIdentifier", "ModuleIdentity", "Unsigned32", "Bits", "Gauge32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
xylan = MibIdentifier((1, 3, 6, 1, 4, 1, 800))
xylanMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 1))
xylanArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2))
xylanProduct = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3))
xylanMib = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 1, 1))
xylanChassis = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 1))
xylanVlanArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 2))
xylanVportArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 3))
xylanAtmArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 4))
xylanTrapArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 5))
xylanIpxArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 6))
xylanWsmArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 7))
xylanFrArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 8))
xylanCsmArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 9))
xylanVapArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 10))
xylanPportArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 11))
xylanFwArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 12))
xylanIpArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 13))
xylanIpmsArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 14))
xylanAVLArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 15))
xylanBackupArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 16))
xylanPppArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 17))
xylanHealthArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 18))
xylanTsmArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 19))
xylanXIPArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 20))
xylanAscCArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 21))
xylanFltArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 22))
xylanSonetArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 23))
xylanSrtbArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 24))
xylanM013Arch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 25))
xylanVsmArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 26))
xylanNtpArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 27))
xylanOamArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 28))
xylanHrexArch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 2, 31))
xylanHardware = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1))
xylanSwitchDevice = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1))
omniswitch5 = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 1))
omniswitch9 = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 2))
pizzaSwitch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 3))
microSwitch = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 4))
omnicell5 = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 5))
omnicell9 = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 6))
pizzaPort = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 7))
omniStack1024 = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 8))
omniStack6024 = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 9))
xylanSoftware = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 2))
xylanPnni = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 1))
xylanGated = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 2))
xylanMrouted = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 3))
xylanNHRP = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 4))
xylanPolicy = MibIdentifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 5))
atmForum = MibIdentifier((1, 3, 6, 1, 4, 1, 353))
atmForumNetworkManagement = MibIdentifier((1, 3, 6, 1, 4, 1, 353, 5))
atmfLanEmulation = MibIdentifier((1, 3, 6, 1, 4, 1, 353, 5, 3))
atmfPnni = MibIdentifier((1, 3, 6, 1, 4, 1, 353, 5, 4))
atmfMpoa = MibIdentifier((1, 3, 6, 1, 4, 1, 353, 5, 8))
mpoaMIB = MibIdentifier((1, 3, 6, 1, 4, 1, 353, 5, 8, 1))
mpoaMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 353, 5, 8, 1, 1))
mibBuilder.exportSymbols("XYLAN-BASE-MIB", xylanFltArch=xylanFltArch, xylanM013Arch=xylanM013Arch, xylanPppArch=xylanPppArch, xylanWsmArch=xylanWsmArch, xylanCsmArch=xylanCsmArch, mpoaMIB=mpoaMIB, xylanFrArch=xylanFrArch, omniStack1024=omniStack1024, pizzaPort=pizzaPort, xylanNtpArch=xylanNtpArch, xylanVapArch=xylanVapArch, xylanAscCArch=xylanAscCArch, xylanSonetArch=xylanSonetArch, xylanIpxArch=xylanIpxArch, microSwitch=microSwitch, xylanVportArch=xylanVportArch, atmfLanEmulation=atmfLanEmulation, xylanIpmsArch=xylanIpmsArch, xylanSwitchDevice=xylanSwitchDevice, atmfPnni=atmfPnni, xylanXIPArch=xylanXIPArch, xylanTsmArch=xylanTsmArch, atmForumNetworkManagement=atmForumNetworkManagement, xylanChassis=xylanChassis, xylanMrouted=xylanMrouted, omnicell5=omnicell5, mpoaMIBObjects=mpoaMIBObjects, xylanNHRP=xylanNHRP, xylan=xylan, xylanSrtbArch=xylanSrtbArch, xylanPportArch=xylanPportArch, xylanArch=xylanArch, xylanVlanArch=xylanVlanArch, xylanPolicy=xylanPolicy, omniStack6024=omniStack6024, xylanAtmArch=xylanAtmArch, xylanIpArch=xylanIpArch, atmfMpoa=atmfMpoa, xylanPnni=xylanPnni, xylanAVLArch=xylanAVLArch, xylanSoftware=xylanSoftware, xylanProduct=xylanProduct, xylanOamArch=xylanOamArch, xylanGated=xylanGated, omniswitch5=omniswitch5, atmForum=atmForum, xylanTrapArch=xylanTrapArch, xylanFwArch=xylanFwArch, xylanMib=xylanMib, omniswitch9=omniswitch9, xylanHardware=xylanHardware, pizzaSwitch=pizzaSwitch, xylanHrexArch=xylanHrexArch, xylanHealthArch=xylanHealthArch, xylanVsmArch=xylanVsmArch, omnicell9=omnicell9, xylanBackupArch=xylanBackupArch, xylanMgmt=xylanMgmt)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, time_ticks, integer32, enterprises, counter32, counter64, notification_type, iso, object_identity, mib_identifier, module_identity, unsigned32, bits, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'TimeTicks', 'Integer32', 'enterprises', 'Counter32', 'Counter64', 'NotificationType', 'iso', 'ObjectIdentity', 'MibIdentifier', 'ModuleIdentity', 'Unsigned32', 'Bits', 'Gauge32')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
xylan = mib_identifier((1, 3, 6, 1, 4, 1, 800))
xylan_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 800, 1))
xylan_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2))
xylan_product = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3))
xylan_mib = mib_identifier((1, 3, 6, 1, 4, 1, 800, 1, 1))
xylan_chassis = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 1))
xylan_vlan_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 2))
xylan_vport_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 3))
xylan_atm_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 4))
xylan_trap_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 5))
xylan_ipx_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 6))
xylan_wsm_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 7))
xylan_fr_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 8))
xylan_csm_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 9))
xylan_vap_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 10))
xylan_pport_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 11))
xylan_fw_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 12))
xylan_ip_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 13))
xylan_ipms_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 14))
xylan_avl_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 15))
xylan_backup_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 16))
xylan_ppp_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 17))
xylan_health_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 18))
xylan_tsm_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 19))
xylan_xip_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 20))
xylan_asc_c_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 21))
xylan_flt_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 22))
xylan_sonet_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 23))
xylan_srtb_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 24))
xylan_m013_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 25))
xylan_vsm_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 26))
xylan_ntp_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 27))
xylan_oam_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 28))
xylan_hrex_arch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 2, 31))
xylan_hardware = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1))
xylan_switch_device = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1))
omniswitch5 = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 1))
omniswitch9 = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 2))
pizza_switch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 3))
micro_switch = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 4))
omnicell5 = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 5))
omnicell9 = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 6))
pizza_port = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 7))
omni_stack1024 = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 8))
omni_stack6024 = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 1, 1, 9))
xylan_software = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 2))
xylan_pnni = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 1))
xylan_gated = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 2))
xylan_mrouted = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 3))
xylan_nhrp = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 4))
xylan_policy = mib_identifier((1, 3, 6, 1, 4, 1, 800, 3, 2, 5))
atm_forum = mib_identifier((1, 3, 6, 1, 4, 1, 353))
atm_forum_network_management = mib_identifier((1, 3, 6, 1, 4, 1, 353, 5))
atmf_lan_emulation = mib_identifier((1, 3, 6, 1, 4, 1, 353, 5, 3))
atmf_pnni = mib_identifier((1, 3, 6, 1, 4, 1, 353, 5, 4))
atmf_mpoa = mib_identifier((1, 3, 6, 1, 4, 1, 353, 5, 8))
mpoa_mib = mib_identifier((1, 3, 6, 1, 4, 1, 353, 5, 8, 1))
mpoa_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 353, 5, 8, 1, 1))
mibBuilder.exportSymbols('XYLAN-BASE-MIB', xylanFltArch=xylanFltArch, xylanM013Arch=xylanM013Arch, xylanPppArch=xylanPppArch, xylanWsmArch=xylanWsmArch, xylanCsmArch=xylanCsmArch, mpoaMIB=mpoaMIB, xylanFrArch=xylanFrArch, omniStack1024=omniStack1024, pizzaPort=pizzaPort, xylanNtpArch=xylanNtpArch, xylanVapArch=xylanVapArch, xylanAscCArch=xylanAscCArch, xylanSonetArch=xylanSonetArch, xylanIpxArch=xylanIpxArch, microSwitch=microSwitch, xylanVportArch=xylanVportArch, atmfLanEmulation=atmfLanEmulation, xylanIpmsArch=xylanIpmsArch, xylanSwitchDevice=xylanSwitchDevice, atmfPnni=atmfPnni, xylanXIPArch=xylanXIPArch, xylanTsmArch=xylanTsmArch, atmForumNetworkManagement=atmForumNetworkManagement, xylanChassis=xylanChassis, xylanMrouted=xylanMrouted, omnicell5=omnicell5, mpoaMIBObjects=mpoaMIBObjects, xylanNHRP=xylanNHRP, xylan=xylan, xylanSrtbArch=xylanSrtbArch, xylanPportArch=xylanPportArch, xylanArch=xylanArch, xylanVlanArch=xylanVlanArch, xylanPolicy=xylanPolicy, omniStack6024=omniStack6024, xylanAtmArch=xylanAtmArch, xylanIpArch=xylanIpArch, atmfMpoa=atmfMpoa, xylanPnni=xylanPnni, xylanAVLArch=xylanAVLArch, xylanSoftware=xylanSoftware, xylanProduct=xylanProduct, xylanOamArch=xylanOamArch, xylanGated=xylanGated, omniswitch5=omniswitch5, atmForum=atmForum, xylanTrapArch=xylanTrapArch, xylanFwArch=xylanFwArch, xylanMib=xylanMib, omniswitch9=omniswitch9, xylanHardware=xylanHardware, pizzaSwitch=pizzaSwitch, xylanHrexArch=xylanHrexArch, xylanHealthArch=xylanHealthArch, xylanVsmArch=xylanVsmArch, omnicell9=omnicell9, xylanBackupArch=xylanBackupArch, xylanMgmt=xylanMgmt) |
pares, impares, positivos, negativos = 0, 0, 0, 0
for i in range(5):
num = int(input())
if num % 2 == 0:
pares += 1
else:
impares += 1
if num > 0:
positivos += 1
elif num < 0:
negativos += 1
print('{} valor(es) par(es)'.format(pares))
print('{} valor(es) impar(es)'.format(impares))
print('{} valor(es) positivo(s)'.format(positivos))
print('{} valor(es) negativo(s)'.format(negativos))
| (pares, impares, positivos, negativos) = (0, 0, 0, 0)
for i in range(5):
num = int(input())
if num % 2 == 0:
pares += 1
else:
impares += 1
if num > 0:
positivos += 1
elif num < 0:
negativos += 1
print('{} valor(es) par(es)'.format(pares))
print('{} valor(es) impar(es)'.format(impares))
print('{} valor(es) positivo(s)'.format(positivos))
print('{} valor(es) negativo(s)'.format(negativos)) |
arquivo = open('argv.py', 'r')
for line in arquivo:
print(line.rstrip())
| arquivo = open('argv.py', 'r')
for line in arquivo:
print(line.rstrip()) |
class D(object):
pass
class E(object):
pass
class F(object):
pass
class B(E, D):
pass
class C(D, F):
pass
class A(B, C):
pass
| class D(object):
pass
class E(object):
pass
class F(object):
pass
class B(E, D):
pass
class C(D, F):
pass
class A(B, C):
pass |
def null(X):
null_list = X.isnull().sum()
return null_list
| def null(X):
null_list = X.isnull().sum()
return null_list |
def findDecision(obj): #obj[0]: Driving_to, obj[1]: Passanger, obj[2]: Weather, obj[3]: Temperature, obj[4]: Time, obj[5]: Coupon, obj[6]: Coupon_validity, obj[7]: Gender, obj[8]: Age, obj[9]: Maritalstatus, obj[10]: Children, obj[11]: Education, obj[12]: Occupation, obj[13]: Income, obj[14]: Bar, obj[15]: Coffeehouse, obj[16]: Carryaway, obj[17]: Restaurantlessthan20, obj[18]: Restaurant20to50, obj[19]: Direction_same, obj[20]: Distance
# {"feature": "Income", "instances": 113, "metric_value": 0.9904, "depth": 1}
if obj[13]<=6:
# {"feature": "Coupon", "instances": 97, "metric_value": 0.9999, "depth": 2}
if obj[5]>0:
# {"feature": "Distance", "instances": 81, "metric_value": 0.9911, "depth": 3}
if obj[20]<=2:
# {"feature": "Coffeehouse", "instances": 74, "metric_value": 0.974, "depth": 4}
if obj[15]<=2.0:
# {"feature": "Maritalstatus", "instances": 58, "metric_value": 0.9966, "depth": 5}
if obj[9]<=2:
# {"feature": "Passanger", "instances": 54, "metric_value": 1.0, "depth": 6}
if obj[1]>0:
# {"feature": "Bar", "instances": 51, "metric_value": 0.9975, "depth": 7}
if obj[14]>-1.0:
# {"feature": "Children", "instances": 49, "metric_value": 0.9925, "depth": 8}
if obj[10]<=0:
# {"feature": "Restaurant20to50", "instances": 32, "metric_value": 0.9972, "depth": 9}
if obj[18]>0.0:
# {"feature": "Age", "instances": 24, "metric_value": 0.9544, "depth": 10}
if obj[8]<=4:
# {"feature": "Gender", "instances": 20, "metric_value": 0.9928, "depth": 11}
if obj[7]<=0:
# {"feature": "Occupation", "instances": 11, "metric_value": 0.9457, "depth": 12}
if obj[12]>5:
# {"feature": "Driving_to", "instances": 6, "metric_value": 0.9183, "depth": 13}
if obj[0]<=1:
# {"feature": "Coupon_validity", "instances": 5, "metric_value": 0.7219, "depth": 14}
if obj[6]<=0:
return 'True'
elif obj[6]>0:
# {"feature": "Temperature", "instances": 2, "metric_value": 1.0, "depth": 15}
if obj[3]<=55:
return 'False'
elif obj[3]>55:
return 'True'
else: return 'True'
else: return 'False'
elif obj[0]>1:
return 'False'
else: return 'False'
elif obj[12]<=5:
return 'False'
else: return 'False'
elif obj[7]>0:
# {"feature": "Direction_same", "instances": 9, "metric_value": 0.7642, "depth": 12}
if obj[19]<=0:
return 'True'
elif obj[19]>0:
return 'False'
else: return 'False'
else: return 'True'
elif obj[8]>4:
return 'True'
else: return 'True'
elif obj[18]<=0.0:
# {"feature": "Occupation", "instances": 8, "metric_value": 0.8113, "depth": 10}
if obj[12]<=2:
# {"feature": "Temperature", "instances": 4, "metric_value": 1.0, "depth": 11}
if obj[3]>55:
# {"feature": "Time", "instances": 3, "metric_value": 0.9183, "depth": 12}
if obj[4]<=0:
# {"feature": "Coupon_validity", "instances": 2, "metric_value": 1.0, "depth": 13}
if obj[6]<=0:
return 'False'
elif obj[6]>0:
return 'True'
else: return 'True'
elif obj[4]>0:
return 'False'
else: return 'False'
elif obj[3]<=55:
return 'True'
else: return 'True'
elif obj[12]>2:
return 'False'
else: return 'False'
else: return 'False'
elif obj[10]>0:
# {"feature": "Driving_to", "instances": 17, "metric_value": 0.874, "depth": 9}
if obj[0]<=0:
# {"feature": "Coupon_validity", "instances": 12, "metric_value": 0.9799, "depth": 10}
if obj[6]>0:
# {"feature": "Occupation", "instances": 10, "metric_value": 0.8813, "depth": 11}
if obj[12]<=9:
return 'False'
elif obj[12]>9:
# {"feature": "Age", "instances": 5, "metric_value": 0.971, "depth": 12}
if obj[8]<=2:
# {"feature": "Temperature", "instances": 3, "metric_value": 0.9183, "depth": 13}
if obj[3]>55:
# {"feature": "Gender", "instances": 2, "metric_value": 1.0, "depth": 14}
if obj[7]>0:
return 'True'
elif obj[7]<=0:
return 'False'
else: return 'False'
elif obj[3]<=55:
return 'False'
else: return 'False'
elif obj[8]>2:
return 'True'
else: return 'True'
else: return 'True'
elif obj[6]<=0:
return 'True'
else: return 'True'
elif obj[0]>0:
return 'False'
else: return 'False'
else: return 'False'
elif obj[14]<=-1.0:
return 'True'
else: return 'True'
elif obj[1]<=0:
return 'True'
else: return 'True'
elif obj[9]>2:
return 'True'
else: return 'True'
elif obj[15]>2.0:
# {"feature": "Gender", "instances": 16, "metric_value": 0.6962, "depth": 5}
if obj[7]<=0:
return 'True'
elif obj[7]>0:
# {"feature": "Time", "instances": 6, "metric_value": 1.0, "depth": 6}
if obj[4]<=2:
return 'True'
elif obj[4]>2:
return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
elif obj[20]>2:
# {"feature": "Age", "instances": 7, "metric_value": 0.5917, "depth": 4}
if obj[8]>0:
return 'False'
elif obj[8]<=0:
return 'True'
else: return 'True'
else: return 'False'
elif obj[5]<=0:
# {"feature": "Bar", "instances": 16, "metric_value": 0.8113, "depth": 3}
if obj[14]<=0.0:
return 'False'
elif obj[14]>0.0:
# {"feature": "Weather", "instances": 8, "metric_value": 1.0, "depth": 4}
if obj[2]<=0:
# {"feature": "Age", "instances": 5, "metric_value": 0.7219, "depth": 5}
if obj[8]<=4:
return 'False'
elif obj[8]>4:
return 'True'
else: return 'True'
elif obj[2]>0:
return 'True'
else: return 'True'
else: return 'True'
else: return 'False'
elif obj[13]>6:
# {"feature": "Children", "instances": 16, "metric_value": 0.5436, "depth": 2}
if obj[10]<=0:
return 'True'
elif obj[10]>0:
# {"feature": "Weather", "instances": 4, "metric_value": 1.0, "depth": 3}
if obj[2]>0:
return 'False'
elif obj[2]<=0:
return 'True'
else: return 'True'
else: return 'False'
else: return 'True'
| def find_decision(obj):
if obj[13] <= 6:
if obj[5] > 0:
if obj[20] <= 2:
if obj[15] <= 2.0:
if obj[9] <= 2:
if obj[1] > 0:
if obj[14] > -1.0:
if obj[10] <= 0:
if obj[18] > 0.0:
if obj[8] <= 4:
if obj[7] <= 0:
if obj[12] > 5:
if obj[0] <= 1:
if obj[6] <= 0:
return 'True'
elif obj[6] > 0:
if obj[3] <= 55:
return 'False'
elif obj[3] > 55:
return 'True'
else:
return 'True'
else:
return 'False'
elif obj[0] > 1:
return 'False'
else:
return 'False'
elif obj[12] <= 5:
return 'False'
else:
return 'False'
elif obj[7] > 0:
if obj[19] <= 0:
return 'True'
elif obj[19] > 0:
return 'False'
else:
return 'False'
else:
return 'True'
elif obj[8] > 4:
return 'True'
else:
return 'True'
elif obj[18] <= 0.0:
if obj[12] <= 2:
if obj[3] > 55:
if obj[4] <= 0:
if obj[6] <= 0:
return 'False'
elif obj[6] > 0:
return 'True'
else:
return 'True'
elif obj[4] > 0:
return 'False'
else:
return 'False'
elif obj[3] <= 55:
return 'True'
else:
return 'True'
elif obj[12] > 2:
return 'False'
else:
return 'False'
else:
return 'False'
elif obj[10] > 0:
if obj[0] <= 0:
if obj[6] > 0:
if obj[12] <= 9:
return 'False'
elif obj[12] > 9:
if obj[8] <= 2:
if obj[3] > 55:
if obj[7] > 0:
return 'True'
elif obj[7] <= 0:
return 'False'
else:
return 'False'
elif obj[3] <= 55:
return 'False'
else:
return 'False'
elif obj[8] > 2:
return 'True'
else:
return 'True'
else:
return 'True'
elif obj[6] <= 0:
return 'True'
else:
return 'True'
elif obj[0] > 0:
return 'False'
else:
return 'False'
else:
return 'False'
elif obj[14] <= -1.0:
return 'True'
else:
return 'True'
elif obj[1] <= 0:
return 'True'
else:
return 'True'
elif obj[9] > 2:
return 'True'
else:
return 'True'
elif obj[15] > 2.0:
if obj[7] <= 0:
return 'True'
elif obj[7] > 0:
if obj[4] <= 2:
return 'True'
elif obj[4] > 2:
return 'False'
else:
return 'False'
else:
return 'True'
else:
return 'True'
elif obj[20] > 2:
if obj[8] > 0:
return 'False'
elif obj[8] <= 0:
return 'True'
else:
return 'True'
else:
return 'False'
elif obj[5] <= 0:
if obj[14] <= 0.0:
return 'False'
elif obj[14] > 0.0:
if obj[2] <= 0:
if obj[8] <= 4:
return 'False'
elif obj[8] > 4:
return 'True'
else:
return 'True'
elif obj[2] > 0:
return 'True'
else:
return 'True'
else:
return 'True'
else:
return 'False'
elif obj[13] > 6:
if obj[10] <= 0:
return 'True'
elif obj[10] > 0:
if obj[2] > 0:
return 'False'
elif obj[2] <= 0:
return 'True'
else:
return 'True'
else:
return 'False'
else:
return 'True' |
class Question(object):
def __init__(self, id, title, text):
self._id = id
self._title = title
self._text = text
self._answers = []
self._chosen_answer = None
@property
def id(self):
return self._id
@id.setter
def id(self, id):
self._id = id
@property
def title(self):
return self._title
@title.setter
def title(self, title):
self._title = title
@property
def text(self):
return self._text
@text.setter
def text(self, text):
self._text = text
@property
def answers(self):
return self._answers
@answers.setter
def answers(self, answers):
self._answers = answers
@property
def chosen_answer(self):
return self._chosen_answer
@chosen_answer.setter
def chosen_answer(self, chosen_answer):
self._chosen_answer = chosen_answer
| class Question(object):
def __init__(self, id, title, text):
self._id = id
self._title = title
self._text = text
self._answers = []
self._chosen_answer = None
@property
def id(self):
return self._id
@id.setter
def id(self, id):
self._id = id
@property
def title(self):
return self._title
@title.setter
def title(self, title):
self._title = title
@property
def text(self):
return self._text
@text.setter
def text(self, text):
self._text = text
@property
def answers(self):
return self._answers
@answers.setter
def answers(self, answers):
self._answers = answers
@property
def chosen_answer(self):
return self._chosen_answer
@chosen_answer.setter
def chosen_answer(self, chosen_answer):
self._chosen_answer = chosen_answer |
class MinStack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.data=[]
self.minData=[] # to store the min
def push(self, x):
"""
to add a number to the stack, and add min to minData
:type x: int
:rtype: None
"""
if x==None: # push empty element, do nothing
return None
if self.data==[]: # now the stack is empty, we need to push it in both two lists
self.data.append(x)
self.minData.append(x)
else:
self.data.append(x)
temp = self.minData.pop()
self.minData.append(temp)
if temp>x:
self.minData.append(x)
else:
self.minData.append(temp)
# print(self.minData)
return None
def pop(self):
"""
to delete the toppest number in the stack
:rtype: None
"""
if self.data==[]: # empty stack cannot pop anything
return None
else:
data = self.data.pop()
m = self.minData.pop()
return None
def top(self):
"""
to show the toppest number in the stack, but not delete it
:rtype: int
"""
if self.data==[]:
return None
else:
temp = self.data.pop()
self.data.append(temp)
return temp
def min(self):
"""
to return the min number in the stack, but not delete it
:rtype: int
"""
if self.data==[]:
return None
else:
m = self.minData.pop()
self.minData.append(m)
return m
# Your MinStack object will be instantiated and called as such:
# obj = MinStack()
# obj.push(x)
# obj.pop()
# param_3 = obj.top()
# param_4 = obj.min()
| class Minstack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.data = []
self.minData = []
def push(self, x):
"""
to add a number to the stack, and add min to minData
:type x: int
:rtype: None
"""
if x == None:
return None
if self.data == []:
self.data.append(x)
self.minData.append(x)
else:
self.data.append(x)
temp = self.minData.pop()
self.minData.append(temp)
if temp > x:
self.minData.append(x)
else:
self.minData.append(temp)
return None
def pop(self):
"""
to delete the toppest number in the stack
:rtype: None
"""
if self.data == []:
return None
else:
data = self.data.pop()
m = self.minData.pop()
return None
def top(self):
"""
to show the toppest number in the stack, but not delete it
:rtype: int
"""
if self.data == []:
return None
else:
temp = self.data.pop()
self.data.append(temp)
return temp
def min(self):
"""
to return the min number in the stack, but not delete it
:rtype: int
"""
if self.data == []:
return None
else:
m = self.minData.pop()
self.minData.append(m)
return m |
# -*- coding: utf-8 -*-
name = 'usdview'
version = '18.11'
requires = [
'pyside-1.2',
'usd-18.11'
]
def commands():
env.DEFAULT_USD.set('{root}/bin/DefaultUSD.usda')
| name = 'usdview'
version = '18.11'
requires = ['pyside-1.2', 'usd-18.11']
def commands():
env.DEFAULT_USD.set('{root}/bin/DefaultUSD.usda') |
# 7. Write a program that asks the user to enter a word and determines whether the word is a
# palindrome or not. A palindrome is a word that reads the same backwards as forwards.
s = input('Enter a string: ')
new_string = s[::-1] # a negative step reverses the string
if s == new_string:
print('It is a palindrome.')
else:
print('It is not a palindrome.')
| s = input('Enter a string: ')
new_string = s[::-1]
if s == new_string:
print('It is a palindrome.')
else:
print('It is not a palindrome.') |
# example of raise usage
try:
raise IndexError('spam') # storage arguments
except IndexError:
print('propagating')
raise # reusage of exception
"""
propagating
Traceback (most recent call last):
File "propagation_of_exception.py", line 4, in <module>
raise IndexError('spam') # storage arguments
IndexError: spam
""" | try:
raise index_error('spam')
except IndexError:
print('propagating')
raise
'\npropagating\nTraceback (most recent call last):\nFile "propagation_of_exception.py", line 4, in <module>\nraise IndexError(\'spam\') # storage arguments\nIndexError: spam\n' |
moveSet1 = 'R1009,D117,L888,D799,L611,U766,L832,U859,L892,D79,R645,U191,L681,D787,R447,D429,L988,U536,L486,D832,R221,D619,R268,D545,L706,U234,L528,D453,R493,D24,L688,U658,L74,D281,R910,D849,L5,U16,R935,D399,L417,U609,R22,D782,L432,D83,L357,D982,L902,U294,L338,U102,R342,D621,R106,U979,L238,U158,R930,D948,L700,D808,R445,U897,R980,U227,L466,D416,R244,U396,R576,U157,R548,U795,R709,U550,R137,U212,L977,U786,L423,D792,R391,D974,R390,U771,R270,D409,L917,D9,R412,D699,L170,D276,L912,U710,R814,U656,R4,D800,R596,U970,L194,U315,L845,D490,L303,U514,L675,D737,L880,D86,L253,D525,R861,D5,R424,D113,L764,D900,R485,D421,R125,U684,R53,U96,L871,U260,R456,U378,L448,D450,L903,D482,R750,U961,R264,D501,R605,D367,R550,U642,R228,U164,L343,U868,R595,D318,R452,U845,L571,D281,R49,D889,L481,U963,R182,U358,R454,U267,L790,D252,R455,D188,L73,U256,L835,D816,R503,U895,L259,U418,R642,U818,L187,U355,R772,U466,R21,U91,R707,D349,L200,U305,R931,D982,L334,D416,L247,D935,L326,U449,L398,D914,R602,U10,R762,D944,L639,D141,L457,U579,L198,U527,R750,U167,R816,D753,R850,D281,L712,D583,L172,D254,L544,D456,R966,U839,R673,D479,R730,D912,R992,D969,R766,U205,R477,D719,R172,D735,R998,D687,R698,D407,R172,U945,R199,U348,L256,D876,R580,U770,L483,D437,R353,D214,R619,U541,R234,D962,R842,U639,R520,D354,L279,D15,R42,U138,L321,D376,L628,D893,L670,D574,L339,U298,L321,D120,L370,U408,L333,D353,L263,D79,R535,D487,R113,D638,R623,D59,L508,D866,R315,U166,L534,U927,L401,D626,L19,D994,L778,D317,L936,U207,L768,U948,R452,U165,R864,D283,L874'
moveSet2 = 'L995,D93,L293,U447,L793,D605,R497,D155,L542,D570,R113,D779,L510,U367,L71,D980,R237,U290,L983,U49,R745,U182,L922,D174,L189,D629,R315,D203,R533,U72,L981,D848,L616,U654,R445,D864,R526,D668,L678,U378,L740,D840,L202,D429,R136,D998,L116,D554,L893,U759,R617,U942,R999,U582,L220,U447,R895,D13,R217,U743,L865,U950,R91,D381,R662,D518,L798,D637,L213,D93,L231,D185,R704,U581,L268,U773,R405,U862,R796,U73,L891,U553,L952,U450,R778,D868,R329,D669,L182,U378,L933,D83,R574,U807,R785,D278,R139,D362,R8,U546,R651,U241,L462,D309,L261,D307,L85,U701,L913,U271,R814,U723,L777,D256,R417,U814,L461,U652,R198,D747,R914,U520,R806,U956,L771,D229,R984,U685,R663,D812,R650,U214,R839,U574,L10,U66,R644,D371,L917,D819,L73,D236,R277,U611,R390,U723,L129,D496,L552,D451,R584,U105,L805,U165,R179,D372,L405,D702,R14,U332,L893,D419,R342,D146,R907,D672,L316,U257,L903,U919,L942,U771,R879,U624,L280,U150,L320,U220,R590,D242,R744,U291,R562,U418,L898,U66,L564,U495,R837,D555,L739,D780,R409,D122,L426,D857,R937,D600,R428,D592,R727,U917,R256,D680,L422,U630,L14,U240,R617,D664,L961,D554,L302,U925,L376,D187,L700,D31,L762,U397,L554,D217,R679,D683,R680,D572,R54,D164,L940,D523,R140,U52,L506,D638,R331,D415,R389,D884,R410,D62,R691,U665,R889,U864,L663,D690,R487,U811,L190,U780,L758,U267,R155,D344,L133,D137,R93,D229,L729,U878,L889,D603,R288,U890,R251,U531,L249,D995,R863,D257,R655,D311,R874,U356,L833,U151,L741,U246,R694,D899,L48,U915,L900,U757,L861,U402,R971,U537,R460,D844,R54,U956,L151,U74,R892,U248,R677,D881,R99,D931,R427'
def move_calculator(move_string: str):
move_set = move_string.split(",")
x_pos = 0
y_pos = 0
move_list = []
for move in move_set:
for step in range(0, int(move[1:])):
if move[0] == 'U':
y_pos += 1
elif move[0] == 'D':
y_pos -= 1
elif move[0] == 'L':
x_pos -= 1
elif move[0] == 'R':
x_pos += 1
move_list.append([x_pos, y_pos])
return move_list
def x_reference(move_list1: list, move_list2: list):
intersections = []
for move in move_list2:
if move in move_list1:
intersections.append(move)
return intersections
move_output1 = move_calculator(moveSet1)
move_output2 = move_calculator(moveSet1)
intersections = x_reference(move_output1, move_output2)
lowest_distance = 10000000000000000000000000000000000000000000000000000
for intersect in intersections:
final_x = 0
final_y = 0
if intersect[0] < 0:
final_x = intersect[0] * -1
else:
final_x = intersect[0]
if intersect[1] < 0:
final_y = intersect[1] * -1
else:
final_y = intersect[1]
if (final_x + final_y) < lowest_distance:
lowest_distance = final_x + final_y
print(lowest_distance)
| move_set1 = 'R1009,D117,L888,D799,L611,U766,L832,U859,L892,D79,R645,U191,L681,D787,R447,D429,L988,U536,L486,D832,R221,D619,R268,D545,L706,U234,L528,D453,R493,D24,L688,U658,L74,D281,R910,D849,L5,U16,R935,D399,L417,U609,R22,D782,L432,D83,L357,D982,L902,U294,L338,U102,R342,D621,R106,U979,L238,U158,R930,D948,L700,D808,R445,U897,R980,U227,L466,D416,R244,U396,R576,U157,R548,U795,R709,U550,R137,U212,L977,U786,L423,D792,R391,D974,R390,U771,R270,D409,L917,D9,R412,D699,L170,D276,L912,U710,R814,U656,R4,D800,R596,U970,L194,U315,L845,D490,L303,U514,L675,D737,L880,D86,L253,D525,R861,D5,R424,D113,L764,D900,R485,D421,R125,U684,R53,U96,L871,U260,R456,U378,L448,D450,L903,D482,R750,U961,R264,D501,R605,D367,R550,U642,R228,U164,L343,U868,R595,D318,R452,U845,L571,D281,R49,D889,L481,U963,R182,U358,R454,U267,L790,D252,R455,D188,L73,U256,L835,D816,R503,U895,L259,U418,R642,U818,L187,U355,R772,U466,R21,U91,R707,D349,L200,U305,R931,D982,L334,D416,L247,D935,L326,U449,L398,D914,R602,U10,R762,D944,L639,D141,L457,U579,L198,U527,R750,U167,R816,D753,R850,D281,L712,D583,L172,D254,L544,D456,R966,U839,R673,D479,R730,D912,R992,D969,R766,U205,R477,D719,R172,D735,R998,D687,R698,D407,R172,U945,R199,U348,L256,D876,R580,U770,L483,D437,R353,D214,R619,U541,R234,D962,R842,U639,R520,D354,L279,D15,R42,U138,L321,D376,L628,D893,L670,D574,L339,U298,L321,D120,L370,U408,L333,D353,L263,D79,R535,D487,R113,D638,R623,D59,L508,D866,R315,U166,L534,U927,L401,D626,L19,D994,L778,D317,L936,U207,L768,U948,R452,U165,R864,D283,L874'
move_set2 = 'L995,D93,L293,U447,L793,D605,R497,D155,L542,D570,R113,D779,L510,U367,L71,D980,R237,U290,L983,U49,R745,U182,L922,D174,L189,D629,R315,D203,R533,U72,L981,D848,L616,U654,R445,D864,R526,D668,L678,U378,L740,D840,L202,D429,R136,D998,L116,D554,L893,U759,R617,U942,R999,U582,L220,U447,R895,D13,R217,U743,L865,U950,R91,D381,R662,D518,L798,D637,L213,D93,L231,D185,R704,U581,L268,U773,R405,U862,R796,U73,L891,U553,L952,U450,R778,D868,R329,D669,L182,U378,L933,D83,R574,U807,R785,D278,R139,D362,R8,U546,R651,U241,L462,D309,L261,D307,L85,U701,L913,U271,R814,U723,L777,D256,R417,U814,L461,U652,R198,D747,R914,U520,R806,U956,L771,D229,R984,U685,R663,D812,R650,U214,R839,U574,L10,U66,R644,D371,L917,D819,L73,D236,R277,U611,R390,U723,L129,D496,L552,D451,R584,U105,L805,U165,R179,D372,L405,D702,R14,U332,L893,D419,R342,D146,R907,D672,L316,U257,L903,U919,L942,U771,R879,U624,L280,U150,L320,U220,R590,D242,R744,U291,R562,U418,L898,U66,L564,U495,R837,D555,L739,D780,R409,D122,L426,D857,R937,D600,R428,D592,R727,U917,R256,D680,L422,U630,L14,U240,R617,D664,L961,D554,L302,U925,L376,D187,L700,D31,L762,U397,L554,D217,R679,D683,R680,D572,R54,D164,L940,D523,R140,U52,L506,D638,R331,D415,R389,D884,R410,D62,R691,U665,R889,U864,L663,D690,R487,U811,L190,U780,L758,U267,R155,D344,L133,D137,R93,D229,L729,U878,L889,D603,R288,U890,R251,U531,L249,D995,R863,D257,R655,D311,R874,U356,L833,U151,L741,U246,R694,D899,L48,U915,L900,U757,L861,U402,R971,U537,R460,D844,R54,U956,L151,U74,R892,U248,R677,D881,R99,D931,R427'
def move_calculator(move_string: str):
move_set = move_string.split(',')
x_pos = 0
y_pos = 0
move_list = []
for move in move_set:
for step in range(0, int(move[1:])):
if move[0] == 'U':
y_pos += 1
elif move[0] == 'D':
y_pos -= 1
elif move[0] == 'L':
x_pos -= 1
elif move[0] == 'R':
x_pos += 1
move_list.append([x_pos, y_pos])
return move_list
def x_reference(move_list1: list, move_list2: list):
intersections = []
for move in move_list2:
if move in move_list1:
intersections.append(move)
return intersections
move_output1 = move_calculator(moveSet1)
move_output2 = move_calculator(moveSet1)
intersections = x_reference(move_output1, move_output2)
lowest_distance = 10000000000000000000000000000000000000000000000000000
for intersect in intersections:
final_x = 0
final_y = 0
if intersect[0] < 0:
final_x = intersect[0] * -1
else:
final_x = intersect[0]
if intersect[1] < 0:
final_y = intersect[1] * -1
else:
final_y = intersect[1]
if final_x + final_y < lowest_distance:
lowest_distance = final_x + final_y
print(lowest_distance) |
##
##
##
def exec(conexao):
cursor = conexao.cursor()
print("RULE 16 - Inicializando",end=' ')
update = " UPDATE principal SET "
update = update + " r25 = \"50\", "
update = update + " r31 = \"50\" "
update = update + " WHERE 1=1 "
update = update + " AND r1 = \"C170\" "
update = update + " AND r3 = \"99999999\" "
cursor.execute(update)
conexao.commit()
print('-',end=' ')
print("Finalizado") | def exec(conexao):
cursor = conexao.cursor()
print('RULE 16 - Inicializando', end=' ')
update = ' UPDATE principal SET '
update = update + ' r25 = "50", '
update = update + ' r31 = "50" '
update = update + ' WHERE 1=1 '
update = update + ' AND r1 = "C170" '
update = update + ' AND r3 = "99999999" '
cursor.execute(update)
conexao.commit()
print('-', end=' ')
print('Finalizado') |
#!/usr/bin/env python
# Import modules
# Read settings file
settings_file = open('./odin_fix_settings.txt')
input_file = settings_file.readline().rstrip()
output_file = settings_file.readline().rstrip()
parsed_file = open(output_file,'w')
parsed_file.write('Date\tTime\tDust\tRH\tTemp\tBatt\n')
with open(input_file,'r') as datafile:
for line in datafile:
has_headers = (line[0]=="D")
if has_headers: continue
c_vec = line.split('\t')
if len(c_vec)!=6: continue
parsed_file.write(line.rstrip() + '\n')
parsed_file.close()
datafile.close() | settings_file = open('./odin_fix_settings.txt')
input_file = settings_file.readline().rstrip()
output_file = settings_file.readline().rstrip()
parsed_file = open(output_file, 'w')
parsed_file.write('Date\tTime\tDust\tRH\tTemp\tBatt\n')
with open(input_file, 'r') as datafile:
for line in datafile:
has_headers = line[0] == 'D'
if has_headers:
continue
c_vec = line.split('\t')
if len(c_vec) != 6:
continue
parsed_file.write(line.rstrip() + '\n')
parsed_file.close()
datafile.close() |
class Solution(object):
def grayCode(self, n):
"""
:type n: int
:rtype: List[int]
"""
res = [0,1]
if n == 1:
return res
elif n == 0:
return [0]
order = 1
while order<n:
count = len(res)
while count!=0:
res.append(res[count-1]+2**order)
count = count -1
order = order + 1
return res
| class Solution(object):
def gray_code(self, n):
"""
:type n: int
:rtype: List[int]
"""
res = [0, 1]
if n == 1:
return res
elif n == 0:
return [0]
order = 1
while order < n:
count = len(res)
while count != 0:
res.append(res[count - 1] + 2 ** order)
count = count - 1
order = order + 1
return res |
t = int(input())
for ___ in range(t):
length = int(input())
a = [int(k) for k in input().split(' ')]
max_boost = 0
summm = 0
for k in range(length):
if k%2 == 0:
summm += a[k]
for l in range(length-1):
if l%2 == 0:
vygoda = 0
sum_nech, sum_ch = 0, 0+a[l]
for r in range(l+1, length):
if r%2 == 1:
sum_nech += a[r]
vygoda = sum_nech - sum_ch
if vygoda > max_boost:
max_boost = vygoda
else:
sum_ch += a[r]
else:
vygoda = 0
sum_nech, sum_ch = 0+a[l], 0
for r in range(l+1, length):
if r%2 == 0:
sum_ch += a[r]
vygoda = sum_nech - sum_ch
if vygoda > max_boost:
max_boost = vygoda
else:
sum_nech += a[r]
print(summm + max_boost) | t = int(input())
for ___ in range(t):
length = int(input())
a = [int(k) for k in input().split(' ')]
max_boost = 0
summm = 0
for k in range(length):
if k % 2 == 0:
summm += a[k]
for l in range(length - 1):
if l % 2 == 0:
vygoda = 0
(sum_nech, sum_ch) = (0, 0 + a[l])
for r in range(l + 1, length):
if r % 2 == 1:
sum_nech += a[r]
vygoda = sum_nech - sum_ch
if vygoda > max_boost:
max_boost = vygoda
else:
sum_ch += a[r]
else:
vygoda = 0
(sum_nech, sum_ch) = (0 + a[l], 0)
for r in range(l + 1, length):
if r % 2 == 0:
sum_ch += a[r]
vygoda = sum_nech - sum_ch
if vygoda > max_boost:
max_boost = vygoda
else:
sum_nech += a[r]
print(summm + max_boost) |
class Solution:
def __init__(self) :
self.store = {
0 : [],
1 : ["()"]
}
def AllParenthesis(self,n):
if n in self.store :
return self.store[n]
ans = set()
for i in range(n) :
if i == 0 :
for comb in self.AllParenthesis(n-1) :
ans.add('(' + comb + ')')
else :
for comb1 in self.AllParenthesis(i) :
for comb2 in self.AllParenthesis(n-i) :
ans.add(comb1 + comb2)
ans.add(comb2 + comb1)
ans = list(ans)
ans.sort()
self.store[n] = ans
return ans
if __name__=="__main__":
t=int(input())
for i in range(0,t):
n=int(input())
ob=Solution()
result=ob.AllParenthesis(n)
result.sort()
for i in range(0,len(result)):
print(result[i])
| class Solution:
def __init__(self):
self.store = {0: [], 1: ['()']}
def all_parenthesis(self, n):
if n in self.store:
return self.store[n]
ans = set()
for i in range(n):
if i == 0:
for comb in self.AllParenthesis(n - 1):
ans.add('(' + comb + ')')
else:
for comb1 in self.AllParenthesis(i):
for comb2 in self.AllParenthesis(n - i):
ans.add(comb1 + comb2)
ans.add(comb2 + comb1)
ans = list(ans)
ans.sort()
self.store[n] = ans
return ans
if __name__ == '__main__':
t = int(input())
for i in range(0, t):
n = int(input())
ob = solution()
result = ob.AllParenthesis(n)
result.sort()
for i in range(0, len(result)):
print(result[i]) |
"""
004
Ask the user to enter
two numbers. Add
them together and
display the answer as
The total is
[answer].
"""
number1 = float(input("Enter two numbers plz :"))
number2 = float (input())
sum = number1 + number2
print("The total is \n",sum) | """
004
Ask the user to enter
two numbers. Add
them together and
display the answer as
The total is
[answer].
"""
number1 = float(input('Enter two numbers plz :'))
number2 = float(input())
sum = number1 + number2
print('The total is \n', sum) |
"""
In a town, there are N people labelled from 1 to N. There is a
rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody
Everybody (except for the town judge) trusts the town judge
There is exactly one person that satisfies properties 1 and 2
You are given trust, an array of pairs trust[i] = [a, b]
representing that the person labelled a trusts the person
labelled b.
If the town judge exists and can be identified, return the label
of the town judge. Otherwise, return -1.
Example 1:
Input: N = 2, trust = [[1,2]]
Output: 2
Example 2:
Input: N = 3, trust = [[1,3],[2,3]]
Output: 3
Example 3:
Input: N = 3, trust = [[1,3],[2,3],[3,1]]
Output: -1
Example 4:
Input: N = 3, trust = [[1,2],[2,3]]
Output: -1
Example 5:
Input: N = 4, trust = [[1,3],[1,4],[2,3],[2,4],[4,3]]
Output: 3
Note:
1 <= N <= 1000
trust.length <= 10000
trust[i] are all different
trust[i][0] != trust[i][1]
1 <= trust[i][0], trust[i][1] <= N
"""
class Solution:
def findJudge(self, N, trust):
"""direct modelling a graph"""
vertex = set(range(1, N + 1))
edge_out = []
edge_in = []
for vo, vi in trust:
edge_out.append(vo)
edge_in.append(vi)
edge_zero_outdegree = vertex.difference(edge_out)
if len(edge_zero_outdegree) == 1:
town_judge = edge_zero_outdegree.pop()
else:
return -1
if edge_in.count(town_judge) == N - 1:
return town_judge
else:
return -1
def findJudge2(self, N, trust):
"""calculate deg_diff = in_deg - out_dig"""
deg_diff = [0] * N
for vertex_out, vertex_in in trust:
deg_diff[vertex_out - 1] -= 1
deg_diff[vertex_in - 1] += 1
for i in range(N):
if deg_diff[i] == N - 1:
return i + 1
return -1
def findJudge3(self, N, trust):
"""calculate indegree firstly by adjacency matrix"""
non_judge = {}
adj_mat = [[] for _ in range(N + 1)]
# [[]] * (N + 1) is wrong because []s comes from
# the same reference, list.append() will change all.
for edge_0, edge_1 in trust:
non_judge[edge_0] = 0
adj_mat[edge_1].append(edge_0)
for i in range(1, N + 1):
if (len(adj_mat[i]) == N - 1) and (i not in non_judge):
return i
return -1
| """
In a town, there are N people labelled from 1 to N. There is a
rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody
Everybody (except for the town judge) trusts the town judge
There is exactly one person that satisfies properties 1 and 2
You are given trust, an array of pairs trust[i] = [a, b]
representing that the person labelled a trusts the person
labelled b.
If the town judge exists and can be identified, return the label
of the town judge. Otherwise, return -1.
Example 1:
Input: N = 2, trust = [[1,2]]
Output: 2
Example 2:
Input: N = 3, trust = [[1,3],[2,3]]
Output: 3
Example 3:
Input: N = 3, trust = [[1,3],[2,3],[3,1]]
Output: -1
Example 4:
Input: N = 3, trust = [[1,2],[2,3]]
Output: -1
Example 5:
Input: N = 4, trust = [[1,3],[1,4],[2,3],[2,4],[4,3]]
Output: 3
Note:
1 <= N <= 1000
trust.length <= 10000
trust[i] are all different
trust[i][0] != trust[i][1]
1 <= trust[i][0], trust[i][1] <= N
"""
class Solution:
def find_judge(self, N, trust):
"""direct modelling a graph"""
vertex = set(range(1, N + 1))
edge_out = []
edge_in = []
for (vo, vi) in trust:
edge_out.append(vo)
edge_in.append(vi)
edge_zero_outdegree = vertex.difference(edge_out)
if len(edge_zero_outdegree) == 1:
town_judge = edge_zero_outdegree.pop()
else:
return -1
if edge_in.count(town_judge) == N - 1:
return town_judge
else:
return -1
def find_judge2(self, N, trust):
"""calculate deg_diff = in_deg - out_dig"""
deg_diff = [0] * N
for (vertex_out, vertex_in) in trust:
deg_diff[vertex_out - 1] -= 1
deg_diff[vertex_in - 1] += 1
for i in range(N):
if deg_diff[i] == N - 1:
return i + 1
return -1
def find_judge3(self, N, trust):
"""calculate indegree firstly by adjacency matrix"""
non_judge = {}
adj_mat = [[] for _ in range(N + 1)]
for (edge_0, edge_1) in trust:
non_judge[edge_0] = 0
adj_mat[edge_1].append(edge_0)
for i in range(1, N + 1):
if len(adj_mat[i]) == N - 1 and i not in non_judge:
return i
return -1 |
####################################################
# Problem 4, chapter 1, Bioinformatics VI finding
# mutations.
# Multiple pattern matching, using suffix tree,
# and Longest Repeat Problem
# Input: ATATCGTTTTATCGTT
# Output: TATCGTT
# ---------------------------------------------
#
# Use the suffix tree, which has noted mutliple symbols
# per node already. Traverse the Tree, look for fully
# duplicated paths, from root down to end of the edge.
#
####################################################
# Node object that contains tree information
# Class static counter gives each node a unique id
# Class static value also can keep longest Branch
# Each node, when duplicated, increments a counter
# so it defaults to one in the constructor
# Position is the nodes position from the start of Text
# fromRoot is chars position in that specific path
# or the number of loops since the start
# Aside from constructor, a member function find_child
# looks thru list of children for match or returns 0
####################################################
class TrieNode(object):
# Function to initialize the node
Node_counter=0
LongestB=0
def __init__(self, char: str, pnode, charp: str, pos=0,pPath=0):
self.char=char
self.pnode=pnode
self.parent=charp
self.children = []
self.word_finished=False
self.counter=1
self.position=pos
self.path=pPath
self.id=TrieNode.Node_counter
TrieNode.Node_counter+=1
def find_child(self,asymbol):
for i in self.children:
if i.char==asymbol:
return i
return 0
def show_children(self):
aList=[]
for i in self.children:
aList.append(i.char)
return aList
##################################################
# Simply reverse the list and only print chars
# of nodes
##################################################
def printNodeList(nodeList):
nodeList.reverse()
for j in nodeList:
print(j.char,end="")
print()
#----------------------------------------------------------------
# Utility to print a Tree of sorts, other node info as needed
# Ex. Start->End:Value Position
# Note roots value char is a *, and its parent is itself
# Prints in dept first using a stack, add children as
# encountered by each parent node to the stack
#----------------------------------------------------------------
def printNodeDepthWise(root):
if root is None:
return
# get started with just the root
stack=[]
stack.insert(0,root) # in front, a stack
while(len(stack) > 0):
n=len(stack)
while (n > 0):
p=stack.pop(0) # take off the front
str="{} {}->{}"
print(str.format(p.id,p.char,p.show_children()))
#print(str.format(p.parent,p.id,p.char,p.path,p.position))
#print(p.word_finished)
#print(str.format(p.parent,p.id,p.char))
for index, value in enumerate(p.children):
stack.insert(0,value) # stack them all on the front
n -=1
print("------")
print("============")
#----------------------------------------------------------------
# Utility to print a Tree of sorts, other node info as needed
# Ex. Start->End:Value Position
# Note roots value char is a *, and its parent is itself
# Prints in breadth first using a queue, add children as
# encountered by each parent node to the queue
#----------------------------------------------------------------
def printNodeLevelWise(root):
if root is None:
return
queue=[]
queue.append(root)
while(len(queue) > 0):
n=len(queue)
while (n > 0):
p = queue[0]
queue.pop(0)
#fullstr="{}->{}:{} {} {} {}"
str="{}>{}"
if p.char !='?':
#fish
print(str.format(p.char,p.show_children()))
for index, value in enumerate(p.children):
queue.append(value)
n -=1
###################################################################
# Tree walk looking for edges defined by:
# $ to backtrack through
# or multi-child node to backtrack trough to parent multichild node
# or single child node?
#
# self.position=pos distance from the root, distinguish duplicate
# self.path=pPath string or path number
# self.id=TrieNode.Node_counter unique node number
# self.pnode parents node, full object`
# self.parent char in parent
###################################################################
def edgeLabels(root):
if root is None:
return
queue=[]
queue.append(root)
while(len(queue) > 0):
n=len(queue)
while (n > 0):
#p = queue[0]
p=queue.pop(0)
if p.char !='*':
#fish
#print(str.format(p.char,p.id,p.position,p.path))
if p.char=='$':
dinks=backTrack(p)
printNodeList(dinks)
elif len(p.children) >=2:
#print(p.char)
dinks=backTrack2(p)
printNodeList(dinks)
for index, value in enumerate(p.children):
queue.append(value)
n -=1
def backTrack(aNode):
##### given a node, backtrack all single child nodes
##### creating a list to return
##### stop when a multi child node is encountered
##### which will possibly include root
#####
# lizard
rList=[]
x=len(aNode.children)
while (len(aNode.children) <= 1):
#print("backtracking...")
rList.append(aNode)
aNode=aNode.pnode
return rList
def backTrack2(aNode):
##### given a node, backtrack all single child nodes
##### creating a list to return
##### stop when a multi child node is encountered
##### which will possibly include root
#####
## Differs here from backtrack in that the start node is
## not concidered
rList=[]
rList.append(aNode)
# move up to the parent of this node, pnode
aNode=aNode.pnode
x=len(aNode.children)
while (len(aNode.children) <= 1):
#print("backtracking...")
rList.append(aNode)
# move up the tree
aNode=aNode.pnode
return rList
#----------------------------------------------------------------
# Utility to read a file, change name, header, etc accordingly
# Called from main, at start of program, edit open for file name
# typically returns a list
# typically uses a counter to get past first lines of meta info
#----------------------------------------------------------------
def readFile():
""" include any needed header processing or stripping
"""
#f=open("ex4s.dat","r")
#f=open("ex4.dat","r")
f=open("test.dat","r")
#f=open("cs.dat","r")
j=[]
for l in f:
l=l.strip()
j.append(l)
return j
##################################################################
#
# Using a suffix of Text, see if it makes it to the end
# Called by
# symbol is char from Text
# vchar is char from a child of the object Node, init first child
# vNode is the whole object itself, init pts to root
##################################################################
def PrefixTrieMatching(Text,Trie):
symbol=Text[0]
vchar=Trie.children[0].char
vNode=Trie
i=1 # Text position marker
lText=len(Text)
while True:
# check if its a leaf. Could also check for children but this flag should be set
# if so your done
if vNode.word_finished==True:
#print("Done Found a terminal character")
#this leg of the Trie has parsed. Maybe print the id of the start node of text
return True
# check all children for vNodes.char matches symbol. Progress down both child and Text
nextVnode=vNode.find_child(symbol) # only one child will match, 0 if none
if nextVnode !=0:
#print("Found match ",symbol," follow node/Text)
vNode=nextVnode
symbol=Text[i]
if i < lText-1:
i+=1
else:
#print("No matches found")
return False
##############################################
# Driver to look at each char in Text and follow it down the Trie as far as possible
# The first letter of Text need to find the first gen of the Trie and try to match all the way to the end
# If it does, the starting point is returned, if it doesn't a flag responds that it is not found
# The start position is stored in a list that is finally printed out at the end
##############################################
def TrieMatching(Text, Trie):
cntr=0
paths=[]
while len(Text) > 1: # Text will get shorter each loop as it progresses
position=PrefixTrieMatching(Text,Trie) # returns either the start position if successful other wise...
#print("back from PrefixTrieMatcing, move down text")
if position:
#print("Bingo, found one ",cntr)
paths.append(cntr)
#printList(paths)
cntr+=1
Text=Text[1:]
return paths
#--------------------------------------------
# Utility to print any list with one space between elements
#--------------------------------------------
def printList(aList):
str="{}"
# print(str.format(root.id,x.id,x.char))
for j in aList:
print(str.format(j),end="")
##############################################
# Add to SuffixTrie builder to include position
# and path counters. fromRoot id marks each node
# and shows the symbols location on Text
# While position shows which full path it
# belongs to.
##############################################
def ModifiedSuffixTrieConstruction(Text):
#create the root by constructing the root node, parent of itself
root=TrieNode('*','0','0')
textPos=0
path=0
LCSS=[] # longest common substring
# loop thru the Text, moving forward one char each time
# add the line to root, creatine an edge for that string
# the add routine will re use starting characters of each suffix as much as it can
# when each successive suffix differs, it branches off at that point
# add is the key routine that notes where prefixes overlap and suffixes split off
while len(Text) >= 1: # Text will get shorter each loop as it progresses
#print(Text)
preFix=add(root,Text,textPos,path)
if len(preFix) > len(LCSS):
LCSS=preFix
Text=Text[1:]
textPos+=1
path+=1
return root, LCSS
####################################################
# A key function that adds successive chars to the
# Trie. Looks for matches from the start, then
# branches new paths when string differs
# Assigns new ids and position from the start
# This identifies same chars in different positions
# ---------------------------------------------------
# called by
# def ModifiedSuffixTrieConstruction(Text):
# return root
####################################################
def add(root, word: str, pos,aPath):
node=root
preFixPath=[]
for char in word:
found_in_child=False
# search for the char
for child in node.children:
if child.char==char:
#found it
child.counter+=1
#point the node to the child
#continue down this path
node=child
found_in_child=True
preFixPath.append(child.char)
break
# we did not find it so add a new child
if not found_in_child:
new_node=TrieNode(char,node,node.id,pos,aPath)
node.children.append(new_node)
# now pont the node to the new children
node=new_node
pos+=1
# everything finished, mark it as the end of the word
node.word_finished = True
return preFixPath
##############################################
##############################################
# Main Program
##############################################
##############################################
if __name__ == "__main__":
#open and read the file, returning one string, as element 0 of a list, with a $ on the end
# This string is the genome, that will be put in a trie where the top part of the tree is shared prefixes, but called a suffix tree
rawline=readFile()
#change a list of one string to a list of chars: line
stri=rawline[0]
line=[]
for x in stri:
line.append(x)
line.append('$')
Trie, LCS=ModifiedSuffixTrieConstruction(line)
printList(LCS)
#edgeLabels(Trie)
| class Trienode(object):
node_counter = 0
longest_b = 0
def __init__(self, char: str, pnode, charp: str, pos=0, pPath=0):
self.char = char
self.pnode = pnode
self.parent = charp
self.children = []
self.word_finished = False
self.counter = 1
self.position = pos
self.path = pPath
self.id = TrieNode.Node_counter
TrieNode.Node_counter += 1
def find_child(self, asymbol):
for i in self.children:
if i.char == asymbol:
return i
return 0
def show_children(self):
a_list = []
for i in self.children:
aList.append(i.char)
return aList
def print_node_list(nodeList):
nodeList.reverse()
for j in nodeList:
print(j.char, end='')
print()
def print_node_depth_wise(root):
if root is None:
return
stack = []
stack.insert(0, root)
while len(stack) > 0:
n = len(stack)
while n > 0:
p = stack.pop(0)
str = '{} {}->{}'
print(str.format(p.id, p.char, p.show_children()))
for (index, value) in enumerate(p.children):
stack.insert(0, value)
n -= 1
print('------')
print('============')
def print_node_level_wise(root):
if root is None:
return
queue = []
queue.append(root)
while len(queue) > 0:
n = len(queue)
while n > 0:
p = queue[0]
queue.pop(0)
str = '{}>{}'
if p.char != '?':
print(str.format(p.char, p.show_children()))
for (index, value) in enumerate(p.children):
queue.append(value)
n -= 1
def edge_labels(root):
if root is None:
return
queue = []
queue.append(root)
while len(queue) > 0:
n = len(queue)
while n > 0:
p = queue.pop(0)
if p.char != '*':
if p.char == '$':
dinks = back_track(p)
print_node_list(dinks)
elif len(p.children) >= 2:
dinks = back_track2(p)
print_node_list(dinks)
for (index, value) in enumerate(p.children):
queue.append(value)
n -= 1
def back_track(aNode):
r_list = []
x = len(aNode.children)
while len(aNode.children) <= 1:
rList.append(aNode)
a_node = aNode.pnode
return rList
def back_track2(aNode):
r_list = []
rList.append(aNode)
a_node = aNode.pnode
x = len(aNode.children)
while len(aNode.children) <= 1:
rList.append(aNode)
a_node = aNode.pnode
return rList
def read_file():
""" include any needed header processing or stripping
"""
f = open('test.dat', 'r')
j = []
for l in f:
l = l.strip()
j.append(l)
return j
def prefix_trie_matching(Text, Trie):
symbol = Text[0]
vchar = Trie.children[0].char
v_node = Trie
i = 1
l_text = len(Text)
while True:
if vNode.word_finished == True:
return True
next_vnode = vNode.find_child(symbol)
if nextVnode != 0:
v_node = nextVnode
symbol = Text[i]
if i < lText - 1:
i += 1
else:
return False
def trie_matching(Text, Trie):
cntr = 0
paths = []
while len(Text) > 1:
position = prefix_trie_matching(Text, Trie)
if position:
paths.append(cntr)
cntr += 1
text = Text[1:]
return paths
def print_list(aList):
str = '{}'
for j in aList:
print(str.format(j), end='')
def modified_suffix_trie_construction(Text):
root = trie_node('*', '0', '0')
text_pos = 0
path = 0
lcss = []
while len(Text) >= 1:
pre_fix = add(root, Text, textPos, path)
if len(preFix) > len(LCSS):
lcss = preFix
text = Text[1:]
text_pos += 1
path += 1
return (root, LCSS)
def add(root, word: str, pos, aPath):
node = root
pre_fix_path = []
for char in word:
found_in_child = False
for child in node.children:
if child.char == char:
child.counter += 1
node = child
found_in_child = True
preFixPath.append(child.char)
break
if not found_in_child:
new_node = trie_node(char, node, node.id, pos, aPath)
node.children.append(new_node)
node = new_node
pos += 1
node.word_finished = True
return preFixPath
if __name__ == '__main__':
rawline = read_file()
stri = rawline[0]
line = []
for x in stri:
line.append(x)
line.append('$')
(trie, lcs) = modified_suffix_trie_construction(line)
print_list(LCS) |
def translate(value, leftMin, leftMax, rightMin, rightMax):
leftSpan = leftMax - leftMin
rightSpan = rightMax - rightMin
valueScaled = float(value - leftMin) / float(leftSpan)
result = rightMin + (valueScaled * rightSpan)
return result
def reversed_iterator(iter):
return reversed(list(iter))
| def translate(value, leftMin, leftMax, rightMin, rightMax):
left_span = leftMax - leftMin
right_span = rightMax - rightMin
value_scaled = float(value - leftMin) / float(leftSpan)
result = rightMin + valueScaled * rightSpan
return result
def reversed_iterator(iter):
return reversed(list(iter)) |
t = int(input())
def find_max_level(n: int):
sums = [1]
i = 1
while max(sums) < n:
sums.append(2 * sums[i - 1] + 1)
i += 1
return i
def create_binomial_matrix(level: int):
mat = [[1 if j == i or j == 0 else 0 for j in range(0,level)] for i in range(0,level)]
for i in range(0,len(mat)):
for j in range(0, len(mat[i])):
if j < i and j != 0:
mat[i][j] = mat[i-1][j-1] + mat[i-1][j]
return mat
for _ in range(1, t + 1):
n = int(input())
level = find_max_level(n)
triangle = create_binomial_matrix(level)
positions = [(1,1)]
| t = int(input())
def find_max_level(n: int):
sums = [1]
i = 1
while max(sums) < n:
sums.append(2 * sums[i - 1] + 1)
i += 1
return i
def create_binomial_matrix(level: int):
mat = [[1 if j == i or j == 0 else 0 for j in range(0, level)] for i in range(0, level)]
for i in range(0, len(mat)):
for j in range(0, len(mat[i])):
if j < i and j != 0:
mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j]
return mat
for _ in range(1, t + 1):
n = int(input())
level = find_max_level(n)
triangle = create_binomial_matrix(level)
positions = [(1, 1)] |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Check with 'pylint' command to code rating.
'''
A very simple script.
'''
def func():
'''
A simple function
'''
first = 1
second = 2
print(first)
print(second)
func()
| """
A very simple script.
"""
def func():
"""
A simple function
"""
first = 1
second = 2
print(first)
print(second)
func() |
_CLASH_ERR = "Cannot have more than one '{}' stanza (Clashing files: {})"
_VALID_ERR = "The data in the '{}' stanza from '{}' failed validation rules."
class MetaloaderError(RuntimeError):
pass
class ExclusiveStanzaClashError(MetaloaderError):
def __init__(self, key, clashing_files):
error_message = _CLASH_ERR.format(key, clashing_files)
super().__init__(error_message)
class StanzaValidationError(MetaloaderError):
def __init__(self, key, filename):
error_message = _VALID_ERR.format(key, filename)
super().__init__(error_message)
| _clash_err = "Cannot have more than one '{}' stanza (Clashing files: {})"
_valid_err = "The data in the '{}' stanza from '{}' failed validation rules."
class Metaloadererror(RuntimeError):
pass
class Exclusivestanzaclasherror(MetaloaderError):
def __init__(self, key, clashing_files):
error_message = _CLASH_ERR.format(key, clashing_files)
super().__init__(error_message)
class Stanzavalidationerror(MetaloaderError):
def __init__(self, key, filename):
error_message = _VALID_ERR.format(key, filename)
super().__init__(error_message) |
class Solution:
def defangIPaddr(self, address: str) -> str:
# replace
return address.replace('.', '[.]')
# def defangIPaddr(self, address: str) -> str:
# # split and join
# return '[.]'.join(address.split('.'))
# def defangIPaddr(self, address: str) -> str:
# # replace
# return re.sub('\.', '[.]', address)
# def defangIPaddr(self, address: str) -> str:
# return ''.join('[.]' if c == '.' else c for c in address)
| class Solution:
def defang_i_paddr(self, address: str) -> str:
return address.replace('.', '[.]') |
def somadig(n):
if n == 0:
return 0
else:
return (n % 10) + somadig(n // 10)
print(somadig(120))
#https://pt.stackoverflow.com/q/349093/101
| def somadig(n):
if n == 0:
return 0
else:
return n % 10 + somadig(n // 10)
print(somadig(120)) |
class Node:
def __init__(self, data):
self.data = data
self.next_node = None
class LinkedList:
def __init__(self):
self.head = None
self.size = 0
def insert_at_start(self, data):
new_node = Node(data)
self.size += 1
if not self.head:
self.head = new_node
else:
new_node.next_node = self.head
self.head = new_node
def insert_at_end(self, data):
new_node = Node(data)
self.size += 1
actual_node = self.head
while actual_node.next_node is not None:
actual_node = actual_node.next_node
actual_node.next_node = new_node
def traverse(self):
actual_node = self.head
while actual_node is not None:
print(actual_node.data, end=' ')
actual_node = actual_node.next_node
def remove(self, data):
if self.head is None:
return
actual_node = self.head
previous_node = None
while actual_node.data != data:
if not actual_node.next_node:
print(f'Value {data} not found.')
return
previous_node = actual_node
actual_node = actual_node.next_node
self.size -= 1
if previous_node:
previous_node.next_node = actual_node.next_node
else:
self.head = actual_node.next_node
def size_of(self):
return self.size
linked_list = LinkedList()
print(linked_list.size_of() == 0)
linked_list.insert_at_start(10)
linked_list.insert_at_start(13)
linked_list.insert_at_end(15)
linked_list.insert_at_end(27)
print(linked_list.head.data == 13)
print(linked_list.size_of() == 4)
linked_list.remove(100)
print(linked_list.size_of() == 4)
linked_list.remove(10)
print(linked_list.head.data == 13)
print(linked_list.size_of() == 3)
linked_list.remove(13)
print(linked_list.head.data == 15)
print(linked_list.size_of() == 2)
linked_list.remove(27)
print(linked_list.head.data == 15)
print(linked_list.size_of() == 1)
linked_list.remove(15)
print(linked_list.head is None)
print(linked_list.size_of() == 0)
| class Node:
def __init__(self, data):
self.data = data
self.next_node = None
class Linkedlist:
def __init__(self):
self.head = None
self.size = 0
def insert_at_start(self, data):
new_node = node(data)
self.size += 1
if not self.head:
self.head = new_node
else:
new_node.next_node = self.head
self.head = new_node
def insert_at_end(self, data):
new_node = node(data)
self.size += 1
actual_node = self.head
while actual_node.next_node is not None:
actual_node = actual_node.next_node
actual_node.next_node = new_node
def traverse(self):
actual_node = self.head
while actual_node is not None:
print(actual_node.data, end=' ')
actual_node = actual_node.next_node
def remove(self, data):
if self.head is None:
return
actual_node = self.head
previous_node = None
while actual_node.data != data:
if not actual_node.next_node:
print(f'Value {data} not found.')
return
previous_node = actual_node
actual_node = actual_node.next_node
self.size -= 1
if previous_node:
previous_node.next_node = actual_node.next_node
else:
self.head = actual_node.next_node
def size_of(self):
return self.size
linked_list = linked_list()
print(linked_list.size_of() == 0)
linked_list.insert_at_start(10)
linked_list.insert_at_start(13)
linked_list.insert_at_end(15)
linked_list.insert_at_end(27)
print(linked_list.head.data == 13)
print(linked_list.size_of() == 4)
linked_list.remove(100)
print(linked_list.size_of() == 4)
linked_list.remove(10)
print(linked_list.head.data == 13)
print(linked_list.size_of() == 3)
linked_list.remove(13)
print(linked_list.head.data == 15)
print(linked_list.size_of() == 2)
linked_list.remove(27)
print(linked_list.head.data == 15)
print(linked_list.size_of() == 1)
linked_list.remove(15)
print(linked_list.head is None)
print(linked_list.size_of() == 0) |
"""
This script is to be run on Tropo
"""
def wait_for_signal():
while True:
event = say("http://www.phono.com/audio/holdmusic.mp3 http://www.phono.com/audio/holdmusic.mp3") #, {onSignal: make_call_handler})
if event.name == 'signal':
yield event.value
else:
break
def make_call(number):
log('***************************************')
log('making call to:')
log(number)
say('Connecting. At the end of the call, press star and stay on the line, so we can automatically connect to the next person on your list')
log('***************************************')
log('dialing')
transfer_params = {
'allowSignals': '',
'answerOnMedia': True,
'callerID': '+1 603-413-2927',
'terminator': '*',
}
transfer_event = transfer(number, transfer_params)
log('********************************')
log('transfer event')
log(transfer_event)
log('transfer event.__dict__')
log(transfer_event.__dict__)
log(transfer_event.connectedDuration)
log("transfer_event.value")
val = getattr(transfer_event, 'value', None)
log(val)
log("transfer_event.value.__dict__")
log(val.__dict__)
call = getattr(transfer_event, 'value', None)
if not getattr(call, 'answeredTime'):
return say('We seem to be having trouble connecting to that number. Please press wrong info, then connect to the next voter')
else:
return say('Great. Submit your responses for this call, then press the "place call" button to dial the next person on your list')
log('***************************************')
log('starting call')
call('+1' + number, {'callerID': '+1 603-413-2927'})
event = say('Welcome to the MayDay call tool! Press the "start calling" button to begin dialing')
if event.name == 'signal':
# signal sent before wait began
make_call(event.value)
for number in wait_for_signal():
log('passing off to make_call()')
event = make_call(number)
while event.name == 'signal':
# signal sent before wait began
event = make_call(event.value)
log('exiting')
# name == 'choice'; value == None
log('***************************************')
log('not calling')
say("Sorry you're having trouble. Please press the call me again button when you're ready to start")
| """
This script is to be run on Tropo
"""
def wait_for_signal():
while True:
event = say('http://www.phono.com/audio/holdmusic.mp3 http://www.phono.com/audio/holdmusic.mp3')
if event.name == 'signal':
yield event.value
else:
break
def make_call(number):
log('***************************************')
log('making call to:')
log(number)
say('Connecting. At the end of the call, press star and stay on the line, so we can automatically connect to the next person on your list')
log('***************************************')
log('dialing')
transfer_params = {'allowSignals': '', 'answerOnMedia': True, 'callerID': '+1 603-413-2927', 'terminator': '*'}
transfer_event = transfer(number, transfer_params)
log('********************************')
log('transfer event')
log(transfer_event)
log('transfer event.__dict__')
log(transfer_event.__dict__)
log(transfer_event.connectedDuration)
log('transfer_event.value')
val = getattr(transfer_event, 'value', None)
log(val)
log('transfer_event.value.__dict__')
log(val.__dict__)
call = getattr(transfer_event, 'value', None)
if not getattr(call, 'answeredTime'):
return say('We seem to be having trouble connecting to that number. Please press wrong info, then connect to the next voter')
else:
return say('Great. Submit your responses for this call, then press the "place call" button to dial the next person on your list')
log('***************************************')
log('starting call')
call('+1' + number, {'callerID': '+1 603-413-2927'})
event = say('Welcome to the MayDay call tool! Press the "start calling" button to begin dialing')
if event.name == 'signal':
make_call(event.value)
for number in wait_for_signal():
log('passing off to make_call()')
event = make_call(number)
while event.name == 'signal':
event = make_call(event.value)
log('exiting')
log('***************************************')
log('not calling')
say("Sorry you're having trouble. Please press the call me again button when you're ready to start") |
# You are given the head of a linked list and two integers, i and j.
# You have to retain the first i nodes and then delete the next j nodes.
# Continue doing so until the end of the linked list.
# Example:
# linked-list = 1 2 3 4 5 6 7 8 9 10 11 12
# i = 2
# j = 3
# Output = 1 2 6 7 11 12
# LinkedList Node class for your reference
class Node:
def __init__(self, data):
self.data = data
self.next = None
def skip_i_delete_j(head, i, j):
"""
:param: head - head of linked list
:param: i - first `i` nodes that are to be skipped
:param: j - next `j` nodes that are to be deleted
return - return the updated head of the linked list
"""
if i == 0:
return None
if head is None or j < 0 or i < 0:
return head
newHead = head
currentNode = head
prevNode = head
while currentNode.next:
for iCounter in range(i, 0, -1):
if currentNode.next == None:
return newHead
prevNode = currentNode
currentNode = currentNode.next
for jCounter in range(j, 0, -1):
currentNode = prevNode
if currentNode.next.next == None:
currentNode.next = None
return newHead
currentNode.next = currentNode.next.next
currentNode = currentNode.next
return newHead
# helper functions for testing purpose
def create_linked_list(arr):
if len(arr)==0:
return None
head = Node(arr[0])
tail = head
for data in arr[1:]:
tail.next = Node(data)
tail = tail.next
return head
def print_linked_list(head):
while head:
print(head.data, end=' ')
head = head.next
print()
def test_function(test_case):
head = test_case[0]
i = test_case[1]
j = test_case[2]
solution = test_case[3]
temp = skip_i_delete_j(head, i, j)
print("New Linked List:")
print_linked_list(temp)
index = 0
try:
while temp is not None:
if temp.data != solution[index]:
print("Fail")
return
index += 1
temp = temp.next
print("Pass")
except Exception as e:
print("Fail")
# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
# # arr = [1, 2, 3, 4, 5, 6, 7]
# i = 2
# j = 2
# head = create_linked_list(arr)
# print_linked_list(skip_i_delete_j(head, i, j))
# solution = [1, 2, 5, 6, 9, 10]
# test_case = [head, i, j, solution]
# test_function(test_case)
# print_linked_list(test_case)
# arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
# i = 2
# j = 3
# head = create_linked_list(arr)
# print_linked_list(skip_i_delete_j(head, i, j))
# solution = [1, 2, 6, 7, 11, 12]
# test_case = [head, i, j, solution]
# test_function(test_case)
# # print_linked_list(test_case)
arr = [1, 2, 3, 4, 5]
i = 2
j = 4
head = create_linked_list(arr)
print_linked_list(skip_i_delete_j(head, i, j))
# solution = [1, 2]
# test_case = [head, i, j, solution]
# test_function(test_case)
# print_linked_list(test_case) | class Node:
def __init__(self, data):
self.data = data
self.next = None
def skip_i_delete_j(head, i, j):
"""
:param: head - head of linked list
:param: i - first `i` nodes that are to be skipped
:param: j - next `j` nodes that are to be deleted
return - return the updated head of the linked list
"""
if i == 0:
return None
if head is None or j < 0 or i < 0:
return head
new_head = head
current_node = head
prev_node = head
while currentNode.next:
for i_counter in range(i, 0, -1):
if currentNode.next == None:
return newHead
prev_node = currentNode
current_node = currentNode.next
for j_counter in range(j, 0, -1):
current_node = prevNode
if currentNode.next.next == None:
currentNode.next = None
return newHead
currentNode.next = currentNode.next.next
current_node = currentNode.next
return newHead
def create_linked_list(arr):
if len(arr) == 0:
return None
head = node(arr[0])
tail = head
for data in arr[1:]:
tail.next = node(data)
tail = tail.next
return head
def print_linked_list(head):
while head:
print(head.data, end=' ')
head = head.next
print()
def test_function(test_case):
head = test_case[0]
i = test_case[1]
j = test_case[2]
solution = test_case[3]
temp = skip_i_delete_j(head, i, j)
print('New Linked List:')
print_linked_list(temp)
index = 0
try:
while temp is not None:
if temp.data != solution[index]:
print('Fail')
return
index += 1
temp = temp.next
print('Pass')
except Exception as e:
print('Fail')
arr = [1, 2, 3, 4, 5]
i = 2
j = 4
head = create_linked_list(arr)
print_linked_list(skip_i_delete_j(head, i, j)) |
"""
https://leetcode.com/problems/palindrome-number/
Return True if a number is a palindrome
121 -> True
-121 -> False 121-
10 -> False 01
Bonus: Could you solve it without converting the int to a string?
I think I'll try converting the int into a list by using modulus.
Then make 2 pointers left and right to compare items.
"""
class Solution:
def isPalindrome(self, x: int) -> bool:
if x < 0:
return False
x_list = []
while x > 0:
curr_digit = x % 10
x_list.append(curr_digit)
x //= 10
left = 0
right = len(x_list) - 1
while left < right:
if x_list[left] != x_list[right]:
return False
left += 1
right -= 1
return True
# This version compares the 2 sublists that result, instead of using 2 pointers.
def isPalindrome2(self, x: int) -> bool:
if x < 0:
return False
x_list = []
while x > 0:
curr_digit = x % 10
x_list.append(curr_digit)
x //= 10
if len(x_list) % 2 == 0:
return x_list[:len(x_list)//2] == list(reversed(x_list[len(x_list)//2:]))
else:
return x_list[:len(x_list)//2] == list(reversed(x_list[(len(x_list)//2)+1:]))
s = Solution()
print(s.isPalindrome2(121))
print(s.isPalindrome2(-121))
print(s.isPalindrome2(1221))
print(s.isPalindrome2(1231))
print(s.isPalindrome2(12321))
| """
https://leetcode.com/problems/palindrome-number/
Return True if a number is a palindrome
121 -> True
-121 -> False 121-
10 -> False 01
Bonus: Could you solve it without converting the int to a string?
I think I'll try converting the int into a list by using modulus.
Then make 2 pointers left and right to compare items.
"""
class Solution:
def is_palindrome(self, x: int) -> bool:
if x < 0:
return False
x_list = []
while x > 0:
curr_digit = x % 10
x_list.append(curr_digit)
x //= 10
left = 0
right = len(x_list) - 1
while left < right:
if x_list[left] != x_list[right]:
return False
left += 1
right -= 1
return True
def is_palindrome2(self, x: int) -> bool:
if x < 0:
return False
x_list = []
while x > 0:
curr_digit = x % 10
x_list.append(curr_digit)
x //= 10
if len(x_list) % 2 == 0:
return x_list[:len(x_list) // 2] == list(reversed(x_list[len(x_list) // 2:]))
else:
return x_list[:len(x_list) // 2] == list(reversed(x_list[len(x_list) // 2 + 1:]))
s = solution()
print(s.isPalindrome2(121))
print(s.isPalindrome2(-121))
print(s.isPalindrome2(1221))
print(s.isPalindrome2(1231))
print(s.isPalindrome2(12321)) |
# jmespath/_lrtable.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = '\xb4\x1bXD\x01\x03z\xbb\x19\xfc\rk\xd7x\x00\xa3'
_lr_action_items = {'STAR':([0,2,11,23,26,28,29,32,36,39,44,45,46,47,48,49,50,55,63,],[1,14,1,1,51,1,57,1,1,1,-16,-17,1,-18,-19,-14,-15,1,1,]),'LPAREN':([10,],[23,]),'NUMBER':([2,26,],[15,15,]),'LBRACKET':([0,1,2,3,4,5,7,8,9,10,11,12,13,14,17,18,23,25,27,28,29,30,31,32,33,35,36,37,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,57,58,59,61,62,63,64,65,],[2,-3,2,-34,-23,-33,-8,-22,-24,-21,2,-20,26,-3,-11,26,2,26,-7,2,55,-9,-10,2,-26,-25,2,-36,2,26,-12,-16,-17,2,-18,-19,-14,-15,26,-1,-2,2,-6,-5,-4,26,26,-35,2,26,26,]),'DOT':([1,3,4,5,7,8,9,10,12,13,14,17,18,25,27,30,31,33,35,37,42,43,52,53,54,56,57,58,59,61,62,64,65,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,29,-3,-11,29,29,-7,-9,-10,-26,-25,-36,29,-12,29,-1,-2,-6,-5,-4,29,29,-35,29,29,]),'RBRACE':([1,3,4,5,7,8,9,10,12,17,20,22,27,30,31,33,35,37,43,52,53,54,56,57,58,60,61,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,35,-28,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-27,-29,-35,]),'RPAREN':([1,3,4,5,7,8,9,10,12,17,23,27,30,31,33,35,37,38,40,41,42,43,52,53,54,56,57,58,62,64,66,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,37,-7,-9,-10,-26,-25,-36,62,-40,-38,-39,-12,-32,-1,-2,-6,-5,-4,-35,-41,-37,]),'NE':([1,3,4,5,7,8,9,10,12,17,25,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,48,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'LT':([1,3,4,5,7,8,9,10,12,17,25,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,49,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'COLON':([8,19,21,],[-22,-21,36,]),'COMMA':([1,3,4,5,7,8,9,10,12,14,16,17,18,20,22,27,30,31,33,35,37,38,40,41,42,43,52,53,54,56,57,58,59,60,61,62,64,66,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-3,32,-11,-31,34,-28,-7,-9,-10,-26,-25,-36,63,-40,-38,-39,-12,-32,-1,-2,-6,-5,-4,-30,-27,-29,-35,-41,-37,]),'$end':([1,3,4,5,7,8,9,10,12,13,17,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,0,-11,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'GT':([1,3,4,5,7,8,9,10,12,17,25,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,44,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'GTE':([1,3,4,5,7,8,9,10,12,17,25,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,45,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'EXPREF':([23,63,],[39,39,]),'CURRENT':([23,63,],[40,40,]),'LITERAL':([0,2,11,23,28,32,36,39,44,45,46,47,48,49,50,55,63,],[5,5,5,5,5,5,5,5,-16,-17,5,-18,-19,-14,-15,5,5,]),'LBRACE':([0,2,11,23,28,29,32,36,39,44,45,46,47,48,49,50,55,63,],[6,6,6,6,6,6,6,6,6,-16,-17,6,-18,-19,-14,-15,6,6,]),'LTE':([1,3,4,5,7,8,9,10,12,17,25,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,50,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'EQ':([1,3,4,5,7,8,9,10,12,17,25,27,30,31,33,35,37,43,52,53,54,56,57,58,62,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,-11,47,-7,-9,-10,-26,-25,-36,-12,-32,-1,-2,-6,-5,-4,-35,]),'QUOTED_IDENTIFIER':([0,2,6,11,23,28,29,32,34,36,39,44,45,46,47,48,49,50,55,63,],[8,8,8,8,8,8,8,8,8,8,8,-16,-17,8,-18,-19,-14,-15,8,8,]),'UNQUOTED_IDENTIFIER':([0,2,6,11,23,28,29,32,34,36,39,44,45,46,47,48,49,50,55,63,],[10,10,19,10,10,10,10,10,19,10,10,-16,-17,10,-18,-19,-14,-15,10,10,]),'FILTER':([0,1,2,3,4,5,7,8,9,10,11,12,13,14,17,18,23,25,27,28,30,31,32,33,35,36,37,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,57,58,59,61,62,63,64,65,],[11,-3,11,-34,-23,-33,-8,-22,-24,-21,11,-20,11,-3,-11,11,11,11,-7,11,-9,-10,11,-26,-25,11,-36,11,11,-12,-16,-17,11,-18,-19,-14,-15,-32,-1,-2,11,-6,-5,-4,11,11,-35,11,11,11,]),'RBRACKET':([1,2,3,4,5,7,8,9,10,12,14,15,16,17,18,24,26,27,30,31,33,35,37,43,51,52,53,54,56,57,58,59,62,65,],[-3,17,-34,-23,-33,-8,-22,-24,-21,-20,30,31,33,-11,-31,43,17,-7,-9,-10,-26,-25,-36,-12,30,-32,-1,-2,-6,-5,-4,-30,-35,-13,]),'OR':([1,3,4,5,7,8,9,10,12,13,14,17,18,25,27,30,31,33,35,37,42,43,52,53,54,56,57,58,59,61,62,64,65,],[-3,-34,-23,-33,-8,-22,-24,-21,-20,28,-3,-11,28,28,-7,-9,-10,-26,-25,-36,28,-12,-32,-1,-2,-6,-5,-4,28,28,-35,28,28,]),}
_lr_action = { }
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = { }
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'filter-expression':([11,],[24,]),'function-args':([23,],[38,]),'multi-select-list':([0,2,11,23,28,29,32,36,39,46,55,63,],[9,9,9,9,9,53,9,9,9,9,9,9,]),'comparator':([25,],[46,]),'multi-select-hash':([0,2,11,23,28,29,32,36,39,46,55,63,],[4,4,4,4,4,54,4,4,4,4,4,4,]),'keyval-expr':([6,34,],[22,60,]),'bracket-spec':([0,2,11,13,18,23,25,28,32,36,39,42,46,52,55,59,61,63,64,65,],[7,7,7,27,27,7,27,7,7,7,7,27,7,27,7,27,27,7,27,27,]),'function-arg':([23,63,],[41,66,]),'function-expression':([0,2,11,23,28,29,32,36,39,46,55,63,],[3,3,3,3,3,56,3,3,3,3,3,3,]),'expressions':([2,55,],[16,16,]),'identifier':([0,2,6,11,23,28,29,32,34,36,39,46,55,63,],[12,12,21,12,12,12,58,12,21,12,12,12,12,12,]),'expression':([0,2,11,23,28,32,36,39,46,55,63,],[13,18,25,42,52,59,61,64,65,18,42,]),'keyval-exprs':([6,],[20,]),}
_lr_goto = { }
for _k, _v in _lr_goto_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_goto: _lr_goto[_x] = { }
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> expression","S'",1,None,None,None),
('expression -> expression DOT multi-select-list','expression',3,'p_jmespath_subexpression','jmespath/parser.py',84),
('expression -> expression DOT multi-select-hash','expression',3,'p_jmespath_subexpression','jmespath/parser.py',85),
('expression -> STAR','expression',1,'p_jmespath_subexpression','jmespath/parser.py',86),
('expression -> expression DOT identifier','expression',3,'p_jmespath_subexpression_identifier','jmespath/parser.py',96),
('expression -> expression DOT STAR','expression',3,'p_jmespath_subexpression_wildcard','jmespath/parser.py',101),
('expression -> expression DOT function-expression','expression',3,'p_jmespath_subexpression_function','jmespath/parser.py',106),
('expression -> expression bracket-spec','expression',2,'p_jmespath_index','jmespath/parser.py',111),
('expression -> bracket-spec','expression',1,'p_jmespath_index','jmespath/parser.py',112),
('bracket-spec -> LBRACKET STAR RBRACKET','bracket-spec',3,'p_jmespath_bracket_specifier','jmespath/parser.py',123),
('bracket-spec -> LBRACKET NUMBER RBRACKET','bracket-spec',3,'p_jmespath_bracket_specifier','jmespath/parser.py',124),
('bracket-spec -> LBRACKET RBRACKET','bracket-spec',2,'p_jmespath_bracket_specifier','jmespath/parser.py',125),
('bracket-spec -> FILTER filter-expression RBRACKET','bracket-spec',3,'p_jmespath_bracket_specifier_filter','jmespath/parser.py',135),
('filter-expression -> expression comparator expression','filter-expression',3,'p_jmespath_filter_expression','jmespath/parser.py',140),
('comparator -> LT','comparator',1,'p_jmespath_comparator','jmespath/parser.py',148),
('comparator -> LTE','comparator',1,'p_jmespath_comparator','jmespath/parser.py',149),
('comparator -> GT','comparator',1,'p_jmespath_comparator','jmespath/parser.py',150),
('comparator -> GTE','comparator',1,'p_jmespath_comparator','jmespath/parser.py',151),
('comparator -> EQ','comparator',1,'p_jmespath_comparator','jmespath/parser.py',152),
('comparator -> NE','comparator',1,'p_jmespath_comparator','jmespath/parser.py',153),
('expression -> identifier','expression',1,'p_jmespath_identifier_expr','jmespath/parser.py',166),
('identifier -> UNQUOTED_IDENTIFIER','identifier',1,'p_jmespath_identifier','jmespath/parser.py',170),
('identifier -> QUOTED_IDENTIFIER','identifier',1,'p_jmespath_identifier','jmespath/parser.py',171),
('expression -> multi-select-hash','expression',1,'p_jmespath_multiselect_expressions','jmespath/parser.py',176),
('expression -> multi-select-list','expression',1,'p_jmespath_multiselect_expressions','jmespath/parser.py',177),
('multi-select-hash -> LBRACE keyval-exprs RBRACE','multi-select-hash',3,'p_jmespath_multiselect','jmespath/parser.py',182),
('multi-select-list -> LBRACKET expressions RBRACKET','multi-select-list',3,'p_jmespath_multiselect_list','jmespath/parser.py',187),
('keyval-exprs -> keyval-exprs COMMA keyval-expr','keyval-exprs',3,'p_jmespath_keyval_exprs','jmespath/parser.py',192),
('keyval-exprs -> keyval-expr','keyval-exprs',1,'p_jmespath_keyval_exprs','jmespath/parser.py',193),
('keyval-expr -> identifier COLON expression','keyval-expr',3,'p_jmespath_keyval_expr','jmespath/parser.py',202),
('expressions -> expressions COMMA expression','expressions',3,'p_jmespath_multiple_expressions','jmespath/parser.py',207),
('expressions -> expression','expressions',1,'p_jmespath_multiple_expressions','jmespath/parser.py',208),
('expression -> expression OR expression','expression',3,'p_jmespath_or_expression','jmespath/parser.py',217),
('expression -> LITERAL','expression',1,'p_jmespath_literal_expression','jmespath/parser.py',221),
('expression -> function-expression','expression',1,'p_jmespath_function','jmespath/parser.py',225),
('function-expression -> UNQUOTED_IDENTIFIER LPAREN function-args RPAREN','function-expression',4,'p_jmespath_function_expression','jmespath/parser.py',229),
('function-expression -> UNQUOTED_IDENTIFIER LPAREN RPAREN','function-expression',3,'p_jmespath_function_expression','jmespath/parser.py',230),
('function-args -> function-args COMMA function-arg','function-args',3,'p_jmespath_function_args','jmespath/parser.py',245),
('function-args -> function-arg','function-args',1,'p_jmespath_function_args','jmespath/parser.py',246),
('function-arg -> expression','function-arg',1,'p_jmespath_function_arg','jmespath/parser.py',255),
('function-arg -> CURRENT','function-arg',1,'p_jmespath_function_arg','jmespath/parser.py',256),
('function-arg -> EXPREF expression','function-arg',2,'p_jmespath_function_arg','jmespath/parser.py',257),
]
| _tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = '´\x1bXD\x01\x03z»\x19ü\rk×x\x00£'
_lr_action_items = {'STAR': ([0, 2, 11, 23, 26, 28, 29, 32, 36, 39, 44, 45, 46, 47, 48, 49, 50, 55, 63], [1, 14, 1, 1, 51, 1, 57, 1, 1, 1, -16, -17, 1, -18, -19, -14, -15, 1, 1]), 'LPAREN': ([10], [23]), 'NUMBER': ([2, 26], [15, 15]), 'LBRACKET': ([0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 23, 25, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 39, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65], [2, -3, 2, -34, -23, -33, -8, -22, -24, -21, 2, -20, 26, -3, -11, 26, 2, 26, -7, 2, 55, -9, -10, 2, -26, -25, 2, -36, 2, 26, -12, -16, -17, 2, -18, -19, -14, -15, 26, -1, -2, 2, -6, -5, -4, 26, 26, -35, 2, 26, 26]), 'DOT': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 17, 18, 25, 27, 30, 31, 33, 35, 37, 42, 43, 52, 53, 54, 56, 57, 58, 59, 61, 62, 64, 65], [-3, -34, -23, -33, -8, -22, -24, -21, -20, 29, -3, -11, 29, 29, -7, -9, -10, -26, -25, -36, 29, -12, 29, -1, -2, -6, -5, -4, 29, 29, -35, 29, 29]), 'RBRACE': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 20, 22, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 60, 61, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 35, -28, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -27, -29, -35]), 'RPAREN': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 23, 27, 30, 31, 33, 35, 37, 38, 40, 41, 42, 43, 52, 53, 54, 56, 57, 58, 62, 64, 66], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 37, -7, -9, -10, -26, -25, -36, 62, -40, -38, -39, -12, -32, -1, -2, -6, -5, -4, -35, -41, -37]), 'NE': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 25, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 48, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'LT': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 25, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 49, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'COLON': ([8, 19, 21], [-22, -21, 36]), 'COMMA': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 14, 16, 17, 18, 20, 22, 27, 30, 31, 33, 35, 37, 38, 40, 41, 42, 43, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 64, 66], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -3, 32, -11, -31, 34, -28, -7, -9, -10, -26, -25, -36, 63, -40, -38, -39, -12, -32, -1, -2, -6, -5, -4, -30, -27, -29, -35, -41, -37]), '$end': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 17, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, 0, -11, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'GT': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 25, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 44, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'GTE': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 25, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 45, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'EXPREF': ([23, 63], [39, 39]), 'CURRENT': ([23, 63], [40, 40]), 'LITERAL': ([0, 2, 11, 23, 28, 32, 36, 39, 44, 45, 46, 47, 48, 49, 50, 55, 63], [5, 5, 5, 5, 5, 5, 5, 5, -16, -17, 5, -18, -19, -14, -15, 5, 5]), 'LBRACE': ([0, 2, 11, 23, 28, 29, 32, 36, 39, 44, 45, 46, 47, 48, 49, 50, 55, 63], [6, 6, 6, 6, 6, 6, 6, 6, 6, -16, -17, 6, -18, -19, -14, -15, 6, 6]), 'LTE': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 25, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 50, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'EQ': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 17, 25, 27, 30, 31, 33, 35, 37, 43, 52, 53, 54, 56, 57, 58, 62], [-3, -34, -23, -33, -8, -22, -24, -21, -20, -11, 47, -7, -9, -10, -26, -25, -36, -12, -32, -1, -2, -6, -5, -4, -35]), 'QUOTED_IDENTIFIER': ([0, 2, 6, 11, 23, 28, 29, 32, 34, 36, 39, 44, 45, 46, 47, 48, 49, 50, 55, 63], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, -16, -17, 8, -18, -19, -14, -15, 8, 8]), 'UNQUOTED_IDENTIFIER': ([0, 2, 6, 11, 23, 28, 29, 32, 34, 36, 39, 44, 45, 46, 47, 48, 49, 50, 55, 63], [10, 10, 19, 10, 10, 10, 10, 10, 19, 10, 10, -16, -17, 10, -18, -19, -14, -15, 10, 10]), 'FILTER': ([0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 23, 25, 27, 28, 30, 31, 32, 33, 35, 36, 37, 39, 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65], [11, -3, 11, -34, -23, -33, -8, -22, -24, -21, 11, -20, 11, -3, -11, 11, 11, 11, -7, 11, -9, -10, 11, -26, -25, 11, -36, 11, 11, -12, -16, -17, 11, -18, -19, -14, -15, -32, -1, -2, 11, -6, -5, -4, 11, 11, -35, 11, 11, 11]), 'RBRACKET': ([1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 24, 26, 27, 30, 31, 33, 35, 37, 43, 51, 52, 53, 54, 56, 57, 58, 59, 62, 65], [-3, 17, -34, -23, -33, -8, -22, -24, -21, -20, 30, 31, 33, -11, -31, 43, 17, -7, -9, -10, -26, -25, -36, -12, 30, -32, -1, -2, -6, -5, -4, -30, -35, -13]), 'OR': ([1, 3, 4, 5, 7, 8, 9, 10, 12, 13, 14, 17, 18, 25, 27, 30, 31, 33, 35, 37, 42, 43, 52, 53, 54, 56, 57, 58, 59, 61, 62, 64, 65], [-3, -34, -23, -33, -8, -22, -24, -21, -20, 28, -3, -11, 28, 28, -7, -9, -10, -26, -25, -36, 28, -12, -32, -1, -2, -6, -5, -4, 28, 28, -35, 28, 28])}
_lr_action = {}
for (_k, _v) in _lr_action_items.items():
for (_x, _y) in zip(_v[0], _v[1]):
if not _x in _lr_action:
_lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'filter-expression': ([11], [24]), 'function-args': ([23], [38]), 'multi-select-list': ([0, 2, 11, 23, 28, 29, 32, 36, 39, 46, 55, 63], [9, 9, 9, 9, 9, 53, 9, 9, 9, 9, 9, 9]), 'comparator': ([25], [46]), 'multi-select-hash': ([0, 2, 11, 23, 28, 29, 32, 36, 39, 46, 55, 63], [4, 4, 4, 4, 4, 54, 4, 4, 4, 4, 4, 4]), 'keyval-expr': ([6, 34], [22, 60]), 'bracket-spec': ([0, 2, 11, 13, 18, 23, 25, 28, 32, 36, 39, 42, 46, 52, 55, 59, 61, 63, 64, 65], [7, 7, 7, 27, 27, 7, 27, 7, 7, 7, 7, 27, 7, 27, 7, 27, 27, 7, 27, 27]), 'function-arg': ([23, 63], [41, 66]), 'function-expression': ([0, 2, 11, 23, 28, 29, 32, 36, 39, 46, 55, 63], [3, 3, 3, 3, 3, 56, 3, 3, 3, 3, 3, 3]), 'expressions': ([2, 55], [16, 16]), 'identifier': ([0, 2, 6, 11, 23, 28, 29, 32, 34, 36, 39, 46, 55, 63], [12, 12, 21, 12, 12, 12, 58, 12, 21, 12, 12, 12, 12, 12]), 'expression': ([0, 2, 11, 23, 28, 32, 36, 39, 46, 55, 63], [13, 18, 25, 42, 52, 59, 61, 64, 65, 18, 42]), 'keyval-exprs': ([6], [20])}
_lr_goto = {}
for (_k, _v) in _lr_goto_items.items():
for (_x, _y) in zip(_v[0], _v[1]):
if not _x in _lr_goto:
_lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [("S' -> expression", "S'", 1, None, None, None), ('expression -> expression DOT multi-select-list', 'expression', 3, 'p_jmespath_subexpression', 'jmespath/parser.py', 84), ('expression -> expression DOT multi-select-hash', 'expression', 3, 'p_jmespath_subexpression', 'jmespath/parser.py', 85), ('expression -> STAR', 'expression', 1, 'p_jmespath_subexpression', 'jmespath/parser.py', 86), ('expression -> expression DOT identifier', 'expression', 3, 'p_jmespath_subexpression_identifier', 'jmespath/parser.py', 96), ('expression -> expression DOT STAR', 'expression', 3, 'p_jmespath_subexpression_wildcard', 'jmespath/parser.py', 101), ('expression -> expression DOT function-expression', 'expression', 3, 'p_jmespath_subexpression_function', 'jmespath/parser.py', 106), ('expression -> expression bracket-spec', 'expression', 2, 'p_jmespath_index', 'jmespath/parser.py', 111), ('expression -> bracket-spec', 'expression', 1, 'p_jmespath_index', 'jmespath/parser.py', 112), ('bracket-spec -> LBRACKET STAR RBRACKET', 'bracket-spec', 3, 'p_jmespath_bracket_specifier', 'jmespath/parser.py', 123), ('bracket-spec -> LBRACKET NUMBER RBRACKET', 'bracket-spec', 3, 'p_jmespath_bracket_specifier', 'jmespath/parser.py', 124), ('bracket-spec -> LBRACKET RBRACKET', 'bracket-spec', 2, 'p_jmespath_bracket_specifier', 'jmespath/parser.py', 125), ('bracket-spec -> FILTER filter-expression RBRACKET', 'bracket-spec', 3, 'p_jmespath_bracket_specifier_filter', 'jmespath/parser.py', 135), ('filter-expression -> expression comparator expression', 'filter-expression', 3, 'p_jmespath_filter_expression', 'jmespath/parser.py', 140), ('comparator -> LT', 'comparator', 1, 'p_jmespath_comparator', 'jmespath/parser.py', 148), ('comparator -> LTE', 'comparator', 1, 'p_jmespath_comparator', 'jmespath/parser.py', 149), ('comparator -> GT', 'comparator', 1, 'p_jmespath_comparator', 'jmespath/parser.py', 150), ('comparator -> GTE', 'comparator', 1, 'p_jmespath_comparator', 'jmespath/parser.py', 151), ('comparator -> EQ', 'comparator', 1, 'p_jmespath_comparator', 'jmespath/parser.py', 152), ('comparator -> NE', 'comparator', 1, 'p_jmespath_comparator', 'jmespath/parser.py', 153), ('expression -> identifier', 'expression', 1, 'p_jmespath_identifier_expr', 'jmespath/parser.py', 166), ('identifier -> UNQUOTED_IDENTIFIER', 'identifier', 1, 'p_jmespath_identifier', 'jmespath/parser.py', 170), ('identifier -> QUOTED_IDENTIFIER', 'identifier', 1, 'p_jmespath_identifier', 'jmespath/parser.py', 171), ('expression -> multi-select-hash', 'expression', 1, 'p_jmespath_multiselect_expressions', 'jmespath/parser.py', 176), ('expression -> multi-select-list', 'expression', 1, 'p_jmespath_multiselect_expressions', 'jmespath/parser.py', 177), ('multi-select-hash -> LBRACE keyval-exprs RBRACE', 'multi-select-hash', 3, 'p_jmespath_multiselect', 'jmespath/parser.py', 182), ('multi-select-list -> LBRACKET expressions RBRACKET', 'multi-select-list', 3, 'p_jmespath_multiselect_list', 'jmespath/parser.py', 187), ('keyval-exprs -> keyval-exprs COMMA keyval-expr', 'keyval-exprs', 3, 'p_jmespath_keyval_exprs', 'jmespath/parser.py', 192), ('keyval-exprs -> keyval-expr', 'keyval-exprs', 1, 'p_jmespath_keyval_exprs', 'jmespath/parser.py', 193), ('keyval-expr -> identifier COLON expression', 'keyval-expr', 3, 'p_jmespath_keyval_expr', 'jmespath/parser.py', 202), ('expressions -> expressions COMMA expression', 'expressions', 3, 'p_jmespath_multiple_expressions', 'jmespath/parser.py', 207), ('expressions -> expression', 'expressions', 1, 'p_jmespath_multiple_expressions', 'jmespath/parser.py', 208), ('expression -> expression OR expression', 'expression', 3, 'p_jmespath_or_expression', 'jmespath/parser.py', 217), ('expression -> LITERAL', 'expression', 1, 'p_jmespath_literal_expression', 'jmespath/parser.py', 221), ('expression -> function-expression', 'expression', 1, 'p_jmespath_function', 'jmespath/parser.py', 225), ('function-expression -> UNQUOTED_IDENTIFIER LPAREN function-args RPAREN', 'function-expression', 4, 'p_jmespath_function_expression', 'jmespath/parser.py', 229), ('function-expression -> UNQUOTED_IDENTIFIER LPAREN RPAREN', 'function-expression', 3, 'p_jmespath_function_expression', 'jmespath/parser.py', 230), ('function-args -> function-args COMMA function-arg', 'function-args', 3, 'p_jmespath_function_args', 'jmespath/parser.py', 245), ('function-args -> function-arg', 'function-args', 1, 'p_jmespath_function_args', 'jmespath/parser.py', 246), ('function-arg -> expression', 'function-arg', 1, 'p_jmespath_function_arg', 'jmespath/parser.py', 255), ('function-arg -> CURRENT', 'function-arg', 1, 'p_jmespath_function_arg', 'jmespath/parser.py', 256), ('function-arg -> EXPREF expression', 'function-arg', 2, 'p_jmespath_function_arg', 'jmespath/parser.py', 257)] |
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
load("@python3//:defs.bzl", "interpreter")
def _bitstreams_repo_impl(rctx):
rctx.execute(
[
rctx.path(rctx.attr.python_interpreter),
rctx.attr._cache_manager,
"--build-file=BUILD.bazel",
"--bucket-url={}".format(rctx.attr.bucket_url),
"--cache={}".format(rctx.attr.cache),
"--refresh-time={}".format(rctx.attr.refresh_time),
],
quiet = False,
)
# The bitstream repo is evaluated on every invocation of bazel.
# Once the cache is initialized, a typical invocation will find the latest
# cached bitstream and configure it for use as a test artifact.
#
# The `refresh_time` sets the interval at which the cache manager will
# check for new bitstreams.
#
# By default, the cache manager will configure the latest available bitstream
# as the default bitstream. It will refresh every 18 hours.
#
# The behavior of the cache manager can be constrolled via the BITSTREAM
# environment variable. The environment variable can be any command line
# arguments accepted by the cache manager script.
#
# For example, to force a refresh of the cache:
# BITSTREAM=--refresh bazel build @bitstreams//...
#
# To use an exact bitstream in a test:
# BITSTREAM=3732655dbd225b5c1ae94a79b54cc9dc8cd8e391 bazel test <label>
#
# You can use any valid git commit identifier to select a bitstream:
# BITSTREAM=HEAD~1 bazel test <label>
#
# If you ask for a bitstream that does not exist in the GCP bucket, the
# next oldest bitstream will be chosen.
bitstreams_repo = repository_rule(
implementation = _bitstreams_repo_impl,
attrs = {
"bucket_url": attr.string(
doc = "Location of the GCP bitstream bucket.",
default = "https://storage.googleapis.com/opentitan-bitstreams/",
),
"cache": attr.string(
doc = "Location of bitstreams cache.",
default = "~/.cache/opentitan-bitstreams",
),
"refresh_time": attr.int(
doc = "How often to check for new bitstreams (seconds).",
default = 18 * 3600, # Refresh every 18h
),
"python_interpreter": attr.label(
default = interpreter,
allow_single_file = True,
doc = "Python interpreter to use.",
),
"_cache_manager": attr.label(
default = Label("//rules/scripts:bitstreams_workspace.py"),
allow_files = True,
),
},
environ = ["BITSTREAM"],
local = True,
)
| load('@python3//:defs.bzl', 'interpreter')
def _bitstreams_repo_impl(rctx):
rctx.execute([rctx.path(rctx.attr.python_interpreter), rctx.attr._cache_manager, '--build-file=BUILD.bazel', '--bucket-url={}'.format(rctx.attr.bucket_url), '--cache={}'.format(rctx.attr.cache), '--refresh-time={}'.format(rctx.attr.refresh_time)], quiet=False)
bitstreams_repo = repository_rule(implementation=_bitstreams_repo_impl, attrs={'bucket_url': attr.string(doc='Location of the GCP bitstream bucket.', default='https://storage.googleapis.com/opentitan-bitstreams/'), 'cache': attr.string(doc='Location of bitstreams cache.', default='~/.cache/opentitan-bitstreams'), 'refresh_time': attr.int(doc='How often to check for new bitstreams (seconds).', default=18 * 3600), 'python_interpreter': attr.label(default=interpreter, allow_single_file=True, doc='Python interpreter to use.'), '_cache_manager': attr.label(default=label('//rules/scripts:bitstreams_workspace.py'), allow_files=True)}, environ=['BITSTREAM'], local=True) |
# Reading data from file
f = open("student.txt", mode="r")
data1 = f.read(2)
data2 = f.read(2)
print(data1)
print(data2)
f.close()
print("complete!!!") | f = open('student.txt', mode='r')
data1 = f.read(2)
data2 = f.read(2)
print(data1)
print(data2)
f.close()
print('complete!!!') |
#!/usr/bin/env python
#--------- Javascript escaping code lifted from Django (BSD)
_base_js_escapes = (
('\\', r'\u005C'),
('\'', r'\u0027'),
('"', r'\u0022'),
('>', r'\u003E'),
('<', r'\u003C'),
('&', r'\u0026'),
('=', r'\u003D'),
('-', r'\u002D'),
(';', r'\u003B'),
(u'\u2028', r'\u2028'),
(u'\u2029', r'\u2029')
)
# Escape every ASCII character with a value less than 32.
_js_escapes = (_base_js_escapes +
tuple([('%c' % z, '\\u%04X' % z) for z in range(32)]))
def escapejs(value):
"""Hex encodes characters for use in JavaScript strings."""
for bad, good in _js_escapes:
value = value.replace(bad, good)
return value
#-------- End filching
| _base_js_escapes = (('\\', '\\u005C'), ("'", '\\u0027'), ('"', '\\u0022'), ('>', '\\u003E'), ('<', '\\u003C'), ('&', '\\u0026'), ('=', '\\u003D'), ('-', '\\u002D'), (';', '\\u003B'), (u'\u2028', '\\u2028'), (u'\u2029', '\\u2029'))
_js_escapes = _base_js_escapes + tuple([('%c' % z, '\\u%04X' % z) for z in range(32)])
def escapejs(value):
"""Hex encodes characters for use in JavaScript strings."""
for (bad, good) in _js_escapes:
value = value.replace(bad, good)
return value |
class Solution(object):
def removeDuplicates(self, nums):
ht = {}
insert = 0
for num in nums:
if num in ht:
ht[num] += 1
else:
ht[num] = 1
if ht[num] > 2:
continue
else:
nums[insert] = num
insert += 1
return insert
| class Solution(object):
def remove_duplicates(self, nums):
ht = {}
insert = 0
for num in nums:
if num in ht:
ht[num] += 1
else:
ht[num] = 1
if ht[num] > 2:
continue
else:
nums[insert] = num
insert += 1
return insert |
"""
cl-sii Python lib
=================
"""
__version__ = '0.15.0'
| """
cl-sii Python lib
=================
"""
__version__ = '0.15.0' |
def module2_1():
a = 2**0.5
print('%.6f' % (a))
def module2_2():
top = 10
bottom = 20
height = 8
area = (top+bottom)*height/2
print('Area of a Trapezoid:%.1f' % area)
def module2_3():
prime_number = [1]
for i in range(2,1001):
prime_flag = True
for prime in prime_number:
if prime != 1:
if i%prime == 0:
prime_flag = False
if prime_flag == True:
prime_number.append(i)
print(prime_number) | def module2_1():
a = 2 ** 0.5
print('%.6f' % a)
def module2_2():
top = 10
bottom = 20
height = 8
area = (top + bottom) * height / 2
print('Area of a Trapezoid:%.1f' % area)
def module2_3():
prime_number = [1]
for i in range(2, 1001):
prime_flag = True
for prime in prime_number:
if prime != 1:
if i % prime == 0:
prime_flag = False
if prime_flag == True:
prime_number.append(i)
print(prime_number) |
# list of file paths to ignore when decrypting
# any files that start with these names will not be dumped
nodecrypt = [
"data\\BehaviourCreator",
"data\\DirectXRedist",
"data\\RecommendedBuilds",
"data\\ReplayEncoder",
"data\\Replays",
"data\\Rofl",
"data\\Shaders",
"data\\Sound\\Music",
"data\\VCRedist",
"data\\Video",
"data\\AwesomenautsIcon.bmp",
] | nodecrypt = ['data\\BehaviourCreator', 'data\\DirectXRedist', 'data\\RecommendedBuilds', 'data\\ReplayEncoder', 'data\\Replays', 'data\\Rofl', 'data\\Shaders', 'data\\Sound\\Music', 'data\\VCRedist', 'data\\Video', 'data\\AwesomenautsIcon.bmp'] |
class CheckersBoard:
both = "B"
empty = " "
player_1 = "X"
player_2 = "O"
#
def __init__(self):
"""
Contains properties of CheckersBoard including dimensions, player
piece types, and board
"""
self.dimension = 10
self.player_1 = "X"
self.player_2 = "O"
self.player_1_king = "KX"
self.player_2_king = "KO"
self.empty = " "
self.both = "B"
self.turn = self.player_1
self.board = [[],[],[],[],[],[],[],[],[],[]]
# initiate the game board with all of player_1 and player_2 pieces
# add player 1 pieces to player 1 side of the board
for i in range(4):
for j in range(10):
# add player 1 peices to each row i on alternating spaces
if(i%2 == 0 and j%2 != 0):
self.board[i].append(self.player_1)
elif(i%2 == 0 and j%2 == 0):
self.board[i].append(self.empty)
if(i%2 != 0 and j%2 == 0):
self.board[i].append(self.player_1)
elif(i%2 != 0 and j%2 != 0):
self.board[i].append(self.empty)
# add player 2 pieces to player 2 side of the board
for k in range(6,10):
for p in range(10):
# add player 2 peices to each row k on alternating spaces
if(k%2 == 0 and p%2 != 0):
self.board[k].append(self.player_2)
elif(k%2 == 0 and p%2 == 0):
self.board[k].append(self.empty)
if(k%2 != 0 and p%2 == 0):
self.board[k].append(self.player_2)
elif(k%2 != 0 and p%2 != 0):
self.board[k].append(self.empty)
# fill the remaining rows with empty spaces
for m in range(4,6):
for p in range(10):
self.board[m].append(self.empty)
def __str__(self):
'''
Return the string representation of the game board
'''
current_board = ''
# loop through positions on the board adding the value at each
# position to the string representation
for row in self.board:
current_board += "|"
for position in row:
current_board += str(position)
current_board += "|"
current_board += "\n"
return current_board
def other_player(self, player):
"""
Return the other player
"""
if(player == self.player_1):
return self.player_2
if(player == self.player_2):
return self.player_1
if(player == self.player_1_king):
return self.player_2
if(player == self.player_2_king):
return self.player_1
return self.empty
def get(self, row, col):
"""
Return the value at the position row, col on the
game board. Return -1 if coordinates are invalid.
"""
if(self.valid_coordinate(row, col) == True):
return self.board[row][col]
return -1
def valid_coordinate(self, row, col):
"""
Ruturn true iff row, col is a valid coordinate
"""
if(0 <= row and row <= self.dimension - 1):
if(0 <= col and col <= self.dimension - 1):
return True
return False
def jump(self, row, col, drow, dcol):
'''
Modify the board if piece at row, col can make a move in
drow, dcol
Return True if modification is made, otherwise return False
'''
moves_available = 0
piece = self.get(row, col)
if abs(drow + dcol) == 1:
return False
if(piece == self.empty):
return False
# check if piece has move and modify the board if it does
if(not self.has_move(row, col, drow, dcol)):
return False
else:
if(self.get(row + drow, col + dcol) == self.empty):
piece = self.get(row, col)
self.board[row][col] = self.empty
self.board[row + drow][col + dcol] = piece
self.king_piece(row + drow, col + dcol)
self.turn = self.other_player(piece)
return True
else:
piece = self.get(row, col)
self.board[row][col] = self.empty
self.board[row + drow][col + dcol] = self.empty
self.board[row + 2*drow][col + 2*dcol] = piece
self.king_piece(row + 2*drow, col + 2*dcol)
# change turn to other players turn if player has no more moves if its a regular piece
if(piece == self.player_1 or piece == self.player_2):
# for each direction check if player can take over the opponents piece
if(self.has_move(row + 2*drow, col + 2*dcol, drow, dcol) == True):
if(self.get(row + 2*drow, col + 2*dcol) == self.other_player(piece)):
moves_available += 1
if(self.has_move(row + 2*drow, col + 2*dcol, drow, (-1)*dcol) == True):
if(self.get(row + 2*drow + drow, col + 2*dcol + (-1)*dcol) == self.other_player(piece)):
moves_available += 1
# change turn to other players turn if player has no more moves if its a king piece
elif piece != self.empty:
if(self.has_move(row + 2*drow, col + 2*dcol, drow, dcol) == True):
if(self.get(row + 2*drow + drow, col + 2*dcol + dcol) == self.other_player(piece)):
moves_available += 1
if(self.has_move(row + 2*drow, col + 2*dcol, drow, (-1)*dcol) == True):
if(self.get(row + 2*drow + drow, col + 2*dcol + (-1)*dcol) == self.other_player(piece)):
moves_available += 1
if(self.has_move(row + 2*drow, col + 2*dcol, (-1)*drow, dcol) == True):
if(self.get(row + 2*drow + (-1)*drow, col + 2*dcol + dcol) == self.other_player(piece)):
moves_available += 1
if(self.has_move(row + 2*drow, col + 2*dcol, (-1)*drow, (-1)*dcol) == True):
if(self.get(row + 2*drow + (-1)*drow, col + 2*dcol + (-1)*dcol) == self.other_player(piece)):
moves_available += 1
if(moves_available == 0):
self.turn = self.other_player(piece)
return True
def has_move(self, row, col, drow, dcol):
"""
Return True if piece at position row, col has a
move in direction drow, dcol
"""
# check if row and col are valid coordinates
if(self.valid_coordinate(row, col) == False):
return False
# check if row, col has piece on it
if(self.get(row, col) == self.empty):
return False
else:
piece = self.get(row, col)
player_other = self.other_player(piece)
player = self.other_player(player_other)
# check if it is player's turn
if(player != self.turn):
return False
# check if direction drow, dcol are valid
if(-1 != drow and drow != 1 and -1 != dcol and dcol != 1):
return False
# check if directions are valid for regular pieces
if(piece == self.player_1):
if(drow != 1 and (dcol != -1 or dcol != 1)):
return False
if(piece == self.player_2):
if(drow != -1 and (dcol != -1 or dcol != 1)):
return False
# check if player has a valid move in direction drow, dcol
if(self.get(row + drow, col + dcol) == player_other):
if(self.get(row + 2*drow, col + 2*dcol) == self.empty):
return True
elif(self.get(row + drow, col + dcol) == self.empty):
return True
else:
return False
def has_overtake(self, row, col, drow, dcol):
"""
Return True if piece at row col has a move in direction drow dcol
only if it can take an opponents piece
"""
piece = self.get(row, col)
other_piece = self.other_player(piece)
if(self.has_move(row, col, drow, dcol) == True):
if(self.get(row + drow, col + dcol) == other_piece):
if(self.get(row + 2*drow, col + 2*dcol) == self.empty):
return True
else:
return False
def who_has_move(self):
p1 = 0
p2 = 0
for row in range(10):
for col in range(10):
for drow in range(-1, 2):
for dcol in range(-1,2):
# if self.has_move(row, col, drow, dcol, self.player_1):
if self.has_move(row, col, drow, dcol):
p1 +=1
# elif self.has_move(row, col, drow, dcol, self.player_2):
elif self.has_move(row, col, drow, dcol):
p2 +=1
if p1 == 0 and p2 == 0:
return CheckersBoard.empty
elif p1 > 0 and p2 > 0:
return CheckersBoard.both
elif p1 == 0 and p2 > 0:
return self.player_2
else:
return self.player_1
def get_count(self, player):
"""
Return the number of pieces that player has left on
the board
"""
count = 0
# cycle through all the positions on the board, and keep
# track of how many of player's pieces are on the board
for row in self.board:
for position in row:
if(position == player):
count+=1
return count
def king_piece(self, row, col):
"""
If a piece is on the opposite last row change it to a king piece
Return true if piece is changed to king
"""
if(self.valid_coordinate(row, col) == False):
return False
piece = self.get(row, col)
# if player 1 piece is at last row on opposite side of board, king it
if(piece == self.player_1):
if(row == 9):
self.board[row][col] = self.player_1_king
return True
# if player 2 piece is at last row on opposite side of board, king it
if(piece == self.player_2):
if(row == 0):
self.board[row][col] = self.player_2_king
return True
return False | class Checkersboard:
both = 'B'
empty = ' '
player_1 = 'X'
player_2 = 'O'
def __init__(self):
"""
Contains properties of CheckersBoard including dimensions, player
piece types, and board
"""
self.dimension = 10
self.player_1 = 'X'
self.player_2 = 'O'
self.player_1_king = 'KX'
self.player_2_king = 'KO'
self.empty = ' '
self.both = 'B'
self.turn = self.player_1
self.board = [[], [], [], [], [], [], [], [], [], []]
for i in range(4):
for j in range(10):
if i % 2 == 0 and j % 2 != 0:
self.board[i].append(self.player_1)
elif i % 2 == 0 and j % 2 == 0:
self.board[i].append(self.empty)
if i % 2 != 0 and j % 2 == 0:
self.board[i].append(self.player_1)
elif i % 2 != 0 and j % 2 != 0:
self.board[i].append(self.empty)
for k in range(6, 10):
for p in range(10):
if k % 2 == 0 and p % 2 != 0:
self.board[k].append(self.player_2)
elif k % 2 == 0 and p % 2 == 0:
self.board[k].append(self.empty)
if k % 2 != 0 and p % 2 == 0:
self.board[k].append(self.player_2)
elif k % 2 != 0 and p % 2 != 0:
self.board[k].append(self.empty)
for m in range(4, 6):
for p in range(10):
self.board[m].append(self.empty)
def __str__(self):
"""
Return the string representation of the game board
"""
current_board = ''
for row in self.board:
current_board += '|'
for position in row:
current_board += str(position)
current_board += '|'
current_board += '\n'
return current_board
def other_player(self, player):
"""
Return the other player
"""
if player == self.player_1:
return self.player_2
if player == self.player_2:
return self.player_1
if player == self.player_1_king:
return self.player_2
if player == self.player_2_king:
return self.player_1
return self.empty
def get(self, row, col):
"""
Return the value at the position row, col on the
game board. Return -1 if coordinates are invalid.
"""
if self.valid_coordinate(row, col) == True:
return self.board[row][col]
return -1
def valid_coordinate(self, row, col):
"""
Ruturn true iff row, col is a valid coordinate
"""
if 0 <= row and row <= self.dimension - 1:
if 0 <= col and col <= self.dimension - 1:
return True
return False
def jump(self, row, col, drow, dcol):
"""
Modify the board if piece at row, col can make a move in
drow, dcol
Return True if modification is made, otherwise return False
"""
moves_available = 0
piece = self.get(row, col)
if abs(drow + dcol) == 1:
return False
if piece == self.empty:
return False
if not self.has_move(row, col, drow, dcol):
return False
elif self.get(row + drow, col + dcol) == self.empty:
piece = self.get(row, col)
self.board[row][col] = self.empty
self.board[row + drow][col + dcol] = piece
self.king_piece(row + drow, col + dcol)
self.turn = self.other_player(piece)
return True
else:
piece = self.get(row, col)
self.board[row][col] = self.empty
self.board[row + drow][col + dcol] = self.empty
self.board[row + 2 * drow][col + 2 * dcol] = piece
self.king_piece(row + 2 * drow, col + 2 * dcol)
if piece == self.player_1 or piece == self.player_2:
if self.has_move(row + 2 * drow, col + 2 * dcol, drow, dcol) == True:
if self.get(row + 2 * drow, col + 2 * dcol) == self.other_player(piece):
moves_available += 1
if self.has_move(row + 2 * drow, col + 2 * dcol, drow, -1 * dcol) == True:
if self.get(row + 2 * drow + drow, col + 2 * dcol + -1 * dcol) == self.other_player(piece):
moves_available += 1
elif piece != self.empty:
if self.has_move(row + 2 * drow, col + 2 * dcol, drow, dcol) == True:
if self.get(row + 2 * drow + drow, col + 2 * dcol + dcol) == self.other_player(piece):
moves_available += 1
if self.has_move(row + 2 * drow, col + 2 * dcol, drow, -1 * dcol) == True:
if self.get(row + 2 * drow + drow, col + 2 * dcol + -1 * dcol) == self.other_player(piece):
moves_available += 1
if self.has_move(row + 2 * drow, col + 2 * dcol, -1 * drow, dcol) == True:
if self.get(row + 2 * drow + -1 * drow, col + 2 * dcol + dcol) == self.other_player(piece):
moves_available += 1
if self.has_move(row + 2 * drow, col + 2 * dcol, -1 * drow, -1 * dcol) == True:
if self.get(row + 2 * drow + -1 * drow, col + 2 * dcol + -1 * dcol) == self.other_player(piece):
moves_available += 1
if moves_available == 0:
self.turn = self.other_player(piece)
return True
def has_move(self, row, col, drow, dcol):
"""
Return True if piece at position row, col has a
move in direction drow, dcol
"""
if self.valid_coordinate(row, col) == False:
return False
if self.get(row, col) == self.empty:
return False
else:
piece = self.get(row, col)
player_other = self.other_player(piece)
player = self.other_player(player_other)
if player != self.turn:
return False
if -1 != drow and drow != 1 and (-1 != dcol) and (dcol != 1):
return False
if piece == self.player_1:
if drow != 1 and (dcol != -1 or dcol != 1):
return False
if piece == self.player_2:
if drow != -1 and (dcol != -1 or dcol != 1):
return False
if self.get(row + drow, col + dcol) == player_other:
if self.get(row + 2 * drow, col + 2 * dcol) == self.empty:
return True
elif self.get(row + drow, col + dcol) == self.empty:
return True
else:
return False
def has_overtake(self, row, col, drow, dcol):
"""
Return True if piece at row col has a move in direction drow dcol
only if it can take an opponents piece
"""
piece = self.get(row, col)
other_piece = self.other_player(piece)
if self.has_move(row, col, drow, dcol) == True:
if self.get(row + drow, col + dcol) == other_piece:
if self.get(row + 2 * drow, col + 2 * dcol) == self.empty:
return True
else:
return False
def who_has_move(self):
p1 = 0
p2 = 0
for row in range(10):
for col in range(10):
for drow in range(-1, 2):
for dcol in range(-1, 2):
if self.has_move(row, col, drow, dcol):
p1 += 1
elif self.has_move(row, col, drow, dcol):
p2 += 1
if p1 == 0 and p2 == 0:
return CheckersBoard.empty
elif p1 > 0 and p2 > 0:
return CheckersBoard.both
elif p1 == 0 and p2 > 0:
return self.player_2
else:
return self.player_1
def get_count(self, player):
"""
Return the number of pieces that player has left on
the board
"""
count = 0
for row in self.board:
for position in row:
if position == player:
count += 1
return count
def king_piece(self, row, col):
"""
If a piece is on the opposite last row change it to a king piece
Return true if piece is changed to king
"""
if self.valid_coordinate(row, col) == False:
return False
piece = self.get(row, col)
if piece == self.player_1:
if row == 9:
self.board[row][col] = self.player_1_king
return True
if piece == self.player_2:
if row == 0:
self.board[row][col] = self.player_2_king
return True
return False |
def feet2inches(feet):
return feet * 12
def inches2feet(inches):
feet = inches / 12.0
remainder_inches = feet % 12.0
return feet, remainder_inches
def inches2meters(inches):
return inches * 39.37007874
def meters2inches(meters):
return meters / 0.0254
def meters2feet(meters):
inches = meters2inches(meters)
feet, remainder_inches = inches2feet(inches)
return feet, remainder_inches
| def feet2inches(feet):
return feet * 12
def inches2feet(inches):
feet = inches / 12.0
remainder_inches = feet % 12.0
return (feet, remainder_inches)
def inches2meters(inches):
return inches * 39.37007874
def meters2inches(meters):
return meters / 0.0254
def meters2feet(meters):
inches = meters2inches(meters)
(feet, remainder_inches) = inches2feet(inches)
return (feet, remainder_inches) |
#file --pair--
# Jakub Grobelny
# 2018
class pair:
def __init__(self, first, second):
self.first = first
self.second = second
def get(self, which):
if which == 0:
return self.first
elif which == 1:
return self.second
else:
raise Exception("Pair access violation!") | class Pair:
def __init__(self, first, second):
self.first = first
self.second = second
def get(self, which):
if which == 0:
return self.first
elif which == 1:
return self.second
else:
raise exception('Pair access violation!') |
# WAP to show the use of for loop
cities = ['new york city', 'mountain view', 'chicago', 'los angeles']
for city in cities: #city is the iteration variable, cities is the iterable being looped over
print(city)
print("Done!")
| cities = ['new york city', 'mountain view', 'chicago', 'los angeles']
for city in cities:
print(city)
print('Done!') |
nombre = None
edad = None
apellido = None
def nombre_completo():
return nombre + ' ' + apellido
def cumplir_anios():
global edad
edad += 1
| nombre = None
edad = None
apellido = None
def nombre_completo():
return nombre + ' ' + apellido
def cumplir_anios():
global edad
edad += 1 |
#!/usr/bin/python
"""
==============================================================================
Author: Tao Li (taoli@ucsd.edu)
Date: Jul 10, 2015
Question: 234-Palindrome-Linked-List
Link: https://leetcode.com/problems/palindrome-linked-list/
==============================================================================
Given a singly linked list, determine if it is a palindrome.
Follow up:
Could you do it in O(n) time and O(1) space?
==============================================================================
Method: find middle point, then reverse the rest linked list. Finally traverse
the two parts at the same time.
Time Complexity: O(n)
Space Complexity: O(1)
==============================================================================
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param {ListNode} head
# @return {boolean}
def isPalindrome(self, head):
if not head: return True
p1 = p2 = head
while p2 and p2.next:
p1 = p1.next
p2 = p2.next.next
last = None
while p1:
tmp = p1.next
p1.next = last
last = p1
p1 = tmp
while head and last:
if head.val != last.val: return False
head = head.next
last = last.next
return True
| """
==============================================================================
Author: Tao Li (taoli@ucsd.edu)
Date: Jul 10, 2015
Question: 234-Palindrome-Linked-List
Link: https://leetcode.com/problems/palindrome-linked-list/
==============================================================================
Given a singly linked list, determine if it is a palindrome.
Follow up:
Could you do it in O(n) time and O(1) space?
==============================================================================
Method: find middle point, then reverse the rest linked list. Finally traverse
the two parts at the same time.
Time Complexity: O(n)
Space Complexity: O(1)
==============================================================================
"""
class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def is_palindrome(self, head):
if not head:
return True
p1 = p2 = head
while p2 and p2.next:
p1 = p1.next
p2 = p2.next.next
last = None
while p1:
tmp = p1.next
p1.next = last
last = p1
p1 = tmp
while head and last:
if head.val != last.val:
return False
head = head.next
last = last.next
return True |
class Solution:
def maxIncreaseKeepingSkyline(self, grid: List[List[int]]) -> int:
n = len(grid)
row_high = [0]*n
col_high = [0]*n
for i in range(n):
row_high[i] = max(grid[i])
col_high[i] = 0
for j in range(n):
col_high[i] = max(col_high[i], grid[j][i])
increase = 0
for i in range(n):
for j in range(n):
increase += min(row_high[i], col_high[j]) - grid[i][j]
return increase
| class Solution:
def max_increase_keeping_skyline(self, grid: List[List[int]]) -> int:
n = len(grid)
row_high = [0] * n
col_high = [0] * n
for i in range(n):
row_high[i] = max(grid[i])
col_high[i] = 0
for j in range(n):
col_high[i] = max(col_high[i], grid[j][i])
increase = 0
for i in range(n):
for j in range(n):
increase += min(row_high[i], col_high[j]) - grid[i][j]
return increase |
"""
PASSENGERS
"""
numPassengers = 3290
passenger_arriving = (
(2, 5, 7, 5, 3, 0, 6, 10, 6, 8, 1, 0), # 0
(2, 8, 4, 3, 2, 0, 8, 6, 5, 5, 4, 0), # 1
(5, 10, 6, 4, 3, 0, 2, 10, 7, 4, 2, 0), # 2
(2, 7, 3, 1, 2, 0, 6, 7, 3, 5, 3, 0), # 3
(5, 6, 4, 5, 1, 0, 5, 7, 5, 6, 0, 0), # 4
(3, 6, 6, 6, 1, 0, 11, 4, 7, 6, 1, 0), # 5
(9, 11, 2, 3, 0, 0, 5, 10, 10, 7, 3, 0), # 6
(8, 11, 9, 3, 1, 0, 5, 8, 4, 5, 0, 0), # 7
(2, 9, 8, 5, 4, 0, 2, 7, 3, 3, 2, 0), # 8
(0, 5, 14, 6, 1, 0, 6, 10, 9, 4, 4, 0), # 9
(4, 8, 9, 2, 2, 0, 8, 8, 7, 7, 3, 0), # 10
(4, 11, 6, 6, 2, 0, 6, 3, 8, 2, 2, 0), # 11
(5, 7, 9, 3, 0, 0, 6, 5, 2, 6, 1, 0), # 12
(8, 5, 6, 5, 0, 0, 7, 18, 6, 5, 3, 0), # 13
(3, 10, 11, 5, 1, 0, 13, 5, 1, 1, 2, 0), # 14
(5, 9, 10, 4, 5, 0, 11, 7, 6, 8, 1, 0), # 15
(5, 9, 4, 5, 3, 0, 4, 8, 5, 4, 1, 0), # 16
(4, 15, 7, 4, 3, 0, 8, 6, 6, 9, 4, 0), # 17
(6, 17, 5, 5, 3, 0, 7, 12, 5, 5, 2, 0), # 18
(4, 10, 7, 5, 3, 0, 8, 9, 8, 5, 3, 0), # 19
(7, 4, 10, 2, 2, 0, 9, 9, 7, 2, 3, 0), # 20
(8, 2, 8, 6, 2, 0, 10, 7, 7, 7, 1, 0), # 21
(1, 11, 8, 4, 2, 0, 8, 13, 10, 7, 0, 0), # 22
(2, 10, 6, 2, 2, 0, 8, 9, 5, 5, 1, 0), # 23
(4, 8, 4, 6, 5, 0, 7, 6, 7, 7, 0, 0), # 24
(2, 5, 10, 1, 2, 0, 9, 14, 6, 5, 1, 0), # 25
(5, 17, 8, 1, 2, 0, 3, 12, 10, 2, 2, 0), # 26
(3, 12, 5, 8, 1, 0, 5, 11, 5, 2, 1, 0), # 27
(2, 7, 6, 6, 1, 0, 4, 6, 5, 3, 1, 0), # 28
(5, 10, 1, 4, 1, 0, 5, 8, 9, 5, 3, 0), # 29
(4, 7, 9, 5, 3, 0, 10, 15, 8, 5, 3, 0), # 30
(5, 9, 7, 4, 3, 0, 7, 11, 6, 5, 2, 0), # 31
(5, 9, 13, 4, 3, 0, 8, 12, 4, 3, 6, 0), # 32
(3, 8, 12, 4, 0, 0, 3, 11, 6, 9, 3, 0), # 33
(4, 5, 10, 7, 4, 0, 5, 8, 6, 3, 4, 0), # 34
(2, 14, 10, 4, 2, 0, 4, 3, 8, 5, 1, 0), # 35
(3, 8, 4, 10, 3, 0, 8, 13, 7, 9, 3, 0), # 36
(3, 3, 8, 2, 1, 0, 6, 10, 13, 4, 2, 0), # 37
(1, 13, 8, 5, 3, 0, 8, 10, 6, 5, 3, 0), # 38
(11, 10, 8, 3, 2, 0, 7, 10, 6, 5, 0, 0), # 39
(3, 11, 4, 7, 2, 0, 4, 6, 5, 4, 2, 0), # 40
(5, 8, 6, 4, 2, 0, 3, 15, 4, 10, 3, 0), # 41
(3, 5, 10, 1, 4, 0, 6, 10, 8, 6, 1, 0), # 42
(7, 4, 5, 1, 3, 0, 4, 6, 1, 2, 2, 0), # 43
(5, 9, 12, 3, 5, 0, 3, 11, 5, 5, 2, 0), # 44
(4, 8, 6, 1, 0, 0, 8, 6, 5, 5, 3, 0), # 45
(3, 8, 7, 6, 3, 0, 11, 9, 6, 4, 3, 0), # 46
(7, 7, 4, 9, 2, 0, 5, 8, 3, 10, 1, 0), # 47
(2, 16, 9, 4, 0, 0, 6, 10, 6, 5, 2, 0), # 48
(6, 9, 7, 3, 1, 0, 11, 12, 6, 9, 7, 0), # 49
(5, 8, 9, 3, 5, 0, 6, 11, 3, 4, 1, 0), # 50
(4, 10, 6, 5, 4, 0, 8, 7, 9, 6, 2, 0), # 51
(8, 10, 7, 0, 2, 0, 2, 13, 9, 5, 3, 0), # 52
(6, 15, 6, 4, 2, 0, 1, 7, 3, 5, 2, 0), # 53
(5, 10, 8, 4, 1, 0, 6, 18, 11, 4, 1, 0), # 54
(6, 5, 11, 4, 4, 0, 2, 9, 3, 5, 2, 0), # 55
(3, 13, 8, 2, 2, 0, 3, 7, 11, 7, 1, 0), # 56
(5, 9, 6, 3, 2, 0, 6, 10, 6, 6, 4, 0), # 57
(6, 8, 8, 2, 0, 0, 5, 10, 6, 3, 2, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), # 0
(3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), # 1
(3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), # 2
(3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), # 3
(3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), # 4
(3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), # 5
(3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), # 6
(3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), # 7
(3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), # 8
(4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), # 9
(4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), # 10
(4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), # 11
(4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), # 12
(4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), # 13
(4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), # 14
(4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), # 15
(4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), # 16
(4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), # 17
(4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), # 18
(4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), # 19
(4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), # 20
(4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), # 21
(4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), # 22
(4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), # 23
(4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), # 24
(4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), # 25
(4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), # 26
(4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), # 27
(4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), # 28
(4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), # 29
(4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), # 30
(4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), # 31
(4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), # 32
(4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), # 33
(4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), # 34
(4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), # 35
(4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), # 36
(4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), # 37
(4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), # 38
(4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), # 39
(4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), # 40
(4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), # 41
(4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), # 42
(4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), # 43
(4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), # 44
(4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), # 45
(4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), # 46
(4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), # 47
(4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), # 48
(4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), # 49
(4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), # 50
(4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), # 51
(4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), # 52
(4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), # 53
(4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), # 54
(4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), # 55
(4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), # 56
(4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), # 57
(4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(2, 5, 7, 5, 3, 0, 6, 10, 6, 8, 1, 0), # 0
(4, 13, 11, 8, 5, 0, 14, 16, 11, 13, 5, 0), # 1
(9, 23, 17, 12, 8, 0, 16, 26, 18, 17, 7, 0), # 2
(11, 30, 20, 13, 10, 0, 22, 33, 21, 22, 10, 0), # 3
(16, 36, 24, 18, 11, 0, 27, 40, 26, 28, 10, 0), # 4
(19, 42, 30, 24, 12, 0, 38, 44, 33, 34, 11, 0), # 5
(28, 53, 32, 27, 12, 0, 43, 54, 43, 41, 14, 0), # 6
(36, 64, 41, 30, 13, 0, 48, 62, 47, 46, 14, 0), # 7
(38, 73, 49, 35, 17, 0, 50, 69, 50, 49, 16, 0), # 8
(38, 78, 63, 41, 18, 0, 56, 79, 59, 53, 20, 0), # 9
(42, 86, 72, 43, 20, 0, 64, 87, 66, 60, 23, 0), # 10
(46, 97, 78, 49, 22, 0, 70, 90, 74, 62, 25, 0), # 11
(51, 104, 87, 52, 22, 0, 76, 95, 76, 68, 26, 0), # 12
(59, 109, 93, 57, 22, 0, 83, 113, 82, 73, 29, 0), # 13
(62, 119, 104, 62, 23, 0, 96, 118, 83, 74, 31, 0), # 14
(67, 128, 114, 66, 28, 0, 107, 125, 89, 82, 32, 0), # 15
(72, 137, 118, 71, 31, 0, 111, 133, 94, 86, 33, 0), # 16
(76, 152, 125, 75, 34, 0, 119, 139, 100, 95, 37, 0), # 17
(82, 169, 130, 80, 37, 0, 126, 151, 105, 100, 39, 0), # 18
(86, 179, 137, 85, 40, 0, 134, 160, 113, 105, 42, 0), # 19
(93, 183, 147, 87, 42, 0, 143, 169, 120, 107, 45, 0), # 20
(101, 185, 155, 93, 44, 0, 153, 176, 127, 114, 46, 0), # 21
(102, 196, 163, 97, 46, 0, 161, 189, 137, 121, 46, 0), # 22
(104, 206, 169, 99, 48, 0, 169, 198, 142, 126, 47, 0), # 23
(108, 214, 173, 105, 53, 0, 176, 204, 149, 133, 47, 0), # 24
(110, 219, 183, 106, 55, 0, 185, 218, 155, 138, 48, 0), # 25
(115, 236, 191, 107, 57, 0, 188, 230, 165, 140, 50, 0), # 26
(118, 248, 196, 115, 58, 0, 193, 241, 170, 142, 51, 0), # 27
(120, 255, 202, 121, 59, 0, 197, 247, 175, 145, 52, 0), # 28
(125, 265, 203, 125, 60, 0, 202, 255, 184, 150, 55, 0), # 29
(129, 272, 212, 130, 63, 0, 212, 270, 192, 155, 58, 0), # 30
(134, 281, 219, 134, 66, 0, 219, 281, 198, 160, 60, 0), # 31
(139, 290, 232, 138, 69, 0, 227, 293, 202, 163, 66, 0), # 32
(142, 298, 244, 142, 69, 0, 230, 304, 208, 172, 69, 0), # 33
(146, 303, 254, 149, 73, 0, 235, 312, 214, 175, 73, 0), # 34
(148, 317, 264, 153, 75, 0, 239, 315, 222, 180, 74, 0), # 35
(151, 325, 268, 163, 78, 0, 247, 328, 229, 189, 77, 0), # 36
(154, 328, 276, 165, 79, 0, 253, 338, 242, 193, 79, 0), # 37
(155, 341, 284, 170, 82, 0, 261, 348, 248, 198, 82, 0), # 38
(166, 351, 292, 173, 84, 0, 268, 358, 254, 203, 82, 0), # 39
(169, 362, 296, 180, 86, 0, 272, 364, 259, 207, 84, 0), # 40
(174, 370, 302, 184, 88, 0, 275, 379, 263, 217, 87, 0), # 41
(177, 375, 312, 185, 92, 0, 281, 389, 271, 223, 88, 0), # 42
(184, 379, 317, 186, 95, 0, 285, 395, 272, 225, 90, 0), # 43
(189, 388, 329, 189, 100, 0, 288, 406, 277, 230, 92, 0), # 44
(193, 396, 335, 190, 100, 0, 296, 412, 282, 235, 95, 0), # 45
(196, 404, 342, 196, 103, 0, 307, 421, 288, 239, 98, 0), # 46
(203, 411, 346, 205, 105, 0, 312, 429, 291, 249, 99, 0), # 47
(205, 427, 355, 209, 105, 0, 318, 439, 297, 254, 101, 0), # 48
(211, 436, 362, 212, 106, 0, 329, 451, 303, 263, 108, 0), # 49
(216, 444, 371, 215, 111, 0, 335, 462, 306, 267, 109, 0), # 50
(220, 454, 377, 220, 115, 0, 343, 469, 315, 273, 111, 0), # 51
(228, 464, 384, 220, 117, 0, 345, 482, 324, 278, 114, 0), # 52
(234, 479, 390, 224, 119, 0, 346, 489, 327, 283, 116, 0), # 53
(239, 489, 398, 228, 120, 0, 352, 507, 338, 287, 117, 0), # 54
(245, 494, 409, 232, 124, 0, 354, 516, 341, 292, 119, 0), # 55
(248, 507, 417, 234, 126, 0, 357, 523, 352, 299, 120, 0), # 56
(253, 516, 423, 237, 128, 0, 363, 533, 358, 305, 124, 0), # 57
(259, 524, 431, 239, 128, 0, 368, 543, 364, 308, 126, 0), # 58
(259, 524, 431, 239, 128, 0, 368, 543, 364, 308, 126, 0), # 59
)
passenger_arriving_rate = (
(3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), # 0
(3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), # 1
(3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), # 2
(3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), # 3
(3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), # 4
(3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), # 5
(3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), # 6
(3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), # 7
(3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), # 8
(4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), # 9
(4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), # 10
(4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), # 11
(4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), # 12
(4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), # 13
(4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), # 14
(4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), # 15
(4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), # 16
(4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), # 17
(4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), # 18
(4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), # 19
(4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), # 20
(4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), # 21
(4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), # 22
(4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), # 23
(4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), # 24
(4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), # 25
(4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), # 26
(4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), # 27
(4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), # 28
(4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), # 29
(4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), # 30
(4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), # 31
(4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), # 32
(4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), # 33
(4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), # 34
(4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), # 35
(4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), # 36
(4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), # 37
(4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), # 38
(4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), # 39
(4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), # 40
(4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), # 41
(4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), # 42
(4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), # 43
(4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), # 44
(4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), # 45
(4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), # 46
(4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), # 47
(4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), # 48
(4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), # 49
(4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), # 50
(4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), # 51
(4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), # 52
(4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), # 53
(4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), # 54
(4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), # 55
(4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), # 56
(4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), # 57
(4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
8, # 1
)
| """
PASSENGERS
"""
num_passengers = 3290
passenger_arriving = ((2, 5, 7, 5, 3, 0, 6, 10, 6, 8, 1, 0), (2, 8, 4, 3, 2, 0, 8, 6, 5, 5, 4, 0), (5, 10, 6, 4, 3, 0, 2, 10, 7, 4, 2, 0), (2, 7, 3, 1, 2, 0, 6, 7, 3, 5, 3, 0), (5, 6, 4, 5, 1, 0, 5, 7, 5, 6, 0, 0), (3, 6, 6, 6, 1, 0, 11, 4, 7, 6, 1, 0), (9, 11, 2, 3, 0, 0, 5, 10, 10, 7, 3, 0), (8, 11, 9, 3, 1, 0, 5, 8, 4, 5, 0, 0), (2, 9, 8, 5, 4, 0, 2, 7, 3, 3, 2, 0), (0, 5, 14, 6, 1, 0, 6, 10, 9, 4, 4, 0), (4, 8, 9, 2, 2, 0, 8, 8, 7, 7, 3, 0), (4, 11, 6, 6, 2, 0, 6, 3, 8, 2, 2, 0), (5, 7, 9, 3, 0, 0, 6, 5, 2, 6, 1, 0), (8, 5, 6, 5, 0, 0, 7, 18, 6, 5, 3, 0), (3, 10, 11, 5, 1, 0, 13, 5, 1, 1, 2, 0), (5, 9, 10, 4, 5, 0, 11, 7, 6, 8, 1, 0), (5, 9, 4, 5, 3, 0, 4, 8, 5, 4, 1, 0), (4, 15, 7, 4, 3, 0, 8, 6, 6, 9, 4, 0), (6, 17, 5, 5, 3, 0, 7, 12, 5, 5, 2, 0), (4, 10, 7, 5, 3, 0, 8, 9, 8, 5, 3, 0), (7, 4, 10, 2, 2, 0, 9, 9, 7, 2, 3, 0), (8, 2, 8, 6, 2, 0, 10, 7, 7, 7, 1, 0), (1, 11, 8, 4, 2, 0, 8, 13, 10, 7, 0, 0), (2, 10, 6, 2, 2, 0, 8, 9, 5, 5, 1, 0), (4, 8, 4, 6, 5, 0, 7, 6, 7, 7, 0, 0), (2, 5, 10, 1, 2, 0, 9, 14, 6, 5, 1, 0), (5, 17, 8, 1, 2, 0, 3, 12, 10, 2, 2, 0), (3, 12, 5, 8, 1, 0, 5, 11, 5, 2, 1, 0), (2, 7, 6, 6, 1, 0, 4, 6, 5, 3, 1, 0), (5, 10, 1, 4, 1, 0, 5, 8, 9, 5, 3, 0), (4, 7, 9, 5, 3, 0, 10, 15, 8, 5, 3, 0), (5, 9, 7, 4, 3, 0, 7, 11, 6, 5, 2, 0), (5, 9, 13, 4, 3, 0, 8, 12, 4, 3, 6, 0), (3, 8, 12, 4, 0, 0, 3, 11, 6, 9, 3, 0), (4, 5, 10, 7, 4, 0, 5, 8, 6, 3, 4, 0), (2, 14, 10, 4, 2, 0, 4, 3, 8, 5, 1, 0), (3, 8, 4, 10, 3, 0, 8, 13, 7, 9, 3, 0), (3, 3, 8, 2, 1, 0, 6, 10, 13, 4, 2, 0), (1, 13, 8, 5, 3, 0, 8, 10, 6, 5, 3, 0), (11, 10, 8, 3, 2, 0, 7, 10, 6, 5, 0, 0), (3, 11, 4, 7, 2, 0, 4, 6, 5, 4, 2, 0), (5, 8, 6, 4, 2, 0, 3, 15, 4, 10, 3, 0), (3, 5, 10, 1, 4, 0, 6, 10, 8, 6, 1, 0), (7, 4, 5, 1, 3, 0, 4, 6, 1, 2, 2, 0), (5, 9, 12, 3, 5, 0, 3, 11, 5, 5, 2, 0), (4, 8, 6, 1, 0, 0, 8, 6, 5, 5, 3, 0), (3, 8, 7, 6, 3, 0, 11, 9, 6, 4, 3, 0), (7, 7, 4, 9, 2, 0, 5, 8, 3, 10, 1, 0), (2, 16, 9, 4, 0, 0, 6, 10, 6, 5, 2, 0), (6, 9, 7, 3, 1, 0, 11, 12, 6, 9, 7, 0), (5, 8, 9, 3, 5, 0, 6, 11, 3, 4, 1, 0), (4, 10, 6, 5, 4, 0, 8, 7, 9, 6, 2, 0), (8, 10, 7, 0, 2, 0, 2, 13, 9, 5, 3, 0), (6, 15, 6, 4, 2, 0, 1, 7, 3, 5, 2, 0), (5, 10, 8, 4, 1, 0, 6, 18, 11, 4, 1, 0), (6, 5, 11, 4, 4, 0, 2, 9, 3, 5, 2, 0), (3, 13, 8, 2, 2, 0, 3, 7, 11, 7, 1, 0), (5, 9, 6, 3, 2, 0, 6, 10, 6, 6, 4, 0), (6, 8, 8, 2, 0, 0, 5, 10, 6, 3, 2, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
station_arriving_intensity = ((3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), (3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), (3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), (3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), (3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), (3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), (3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), (3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), (3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), (4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), (4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), (4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), (4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), (4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), (4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), (4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), (4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), (4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), (4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), (4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), (4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), (4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), (4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), (4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), (4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), (4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), (4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), (4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), (4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), (4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), (4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), (4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), (4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), (4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), (4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), (4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), (4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), (4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), (4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), (4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), (4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), (4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), (4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), (4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), (4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), (4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), (4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), (4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), (4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), (4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), (4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), (4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), (4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), (4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), (4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), (4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), (4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), (4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), (4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
passenger_arriving_acc = ((2, 5, 7, 5, 3, 0, 6, 10, 6, 8, 1, 0), (4, 13, 11, 8, 5, 0, 14, 16, 11, 13, 5, 0), (9, 23, 17, 12, 8, 0, 16, 26, 18, 17, 7, 0), (11, 30, 20, 13, 10, 0, 22, 33, 21, 22, 10, 0), (16, 36, 24, 18, 11, 0, 27, 40, 26, 28, 10, 0), (19, 42, 30, 24, 12, 0, 38, 44, 33, 34, 11, 0), (28, 53, 32, 27, 12, 0, 43, 54, 43, 41, 14, 0), (36, 64, 41, 30, 13, 0, 48, 62, 47, 46, 14, 0), (38, 73, 49, 35, 17, 0, 50, 69, 50, 49, 16, 0), (38, 78, 63, 41, 18, 0, 56, 79, 59, 53, 20, 0), (42, 86, 72, 43, 20, 0, 64, 87, 66, 60, 23, 0), (46, 97, 78, 49, 22, 0, 70, 90, 74, 62, 25, 0), (51, 104, 87, 52, 22, 0, 76, 95, 76, 68, 26, 0), (59, 109, 93, 57, 22, 0, 83, 113, 82, 73, 29, 0), (62, 119, 104, 62, 23, 0, 96, 118, 83, 74, 31, 0), (67, 128, 114, 66, 28, 0, 107, 125, 89, 82, 32, 0), (72, 137, 118, 71, 31, 0, 111, 133, 94, 86, 33, 0), (76, 152, 125, 75, 34, 0, 119, 139, 100, 95, 37, 0), (82, 169, 130, 80, 37, 0, 126, 151, 105, 100, 39, 0), (86, 179, 137, 85, 40, 0, 134, 160, 113, 105, 42, 0), (93, 183, 147, 87, 42, 0, 143, 169, 120, 107, 45, 0), (101, 185, 155, 93, 44, 0, 153, 176, 127, 114, 46, 0), (102, 196, 163, 97, 46, 0, 161, 189, 137, 121, 46, 0), (104, 206, 169, 99, 48, 0, 169, 198, 142, 126, 47, 0), (108, 214, 173, 105, 53, 0, 176, 204, 149, 133, 47, 0), (110, 219, 183, 106, 55, 0, 185, 218, 155, 138, 48, 0), (115, 236, 191, 107, 57, 0, 188, 230, 165, 140, 50, 0), (118, 248, 196, 115, 58, 0, 193, 241, 170, 142, 51, 0), (120, 255, 202, 121, 59, 0, 197, 247, 175, 145, 52, 0), (125, 265, 203, 125, 60, 0, 202, 255, 184, 150, 55, 0), (129, 272, 212, 130, 63, 0, 212, 270, 192, 155, 58, 0), (134, 281, 219, 134, 66, 0, 219, 281, 198, 160, 60, 0), (139, 290, 232, 138, 69, 0, 227, 293, 202, 163, 66, 0), (142, 298, 244, 142, 69, 0, 230, 304, 208, 172, 69, 0), (146, 303, 254, 149, 73, 0, 235, 312, 214, 175, 73, 0), (148, 317, 264, 153, 75, 0, 239, 315, 222, 180, 74, 0), (151, 325, 268, 163, 78, 0, 247, 328, 229, 189, 77, 0), (154, 328, 276, 165, 79, 0, 253, 338, 242, 193, 79, 0), (155, 341, 284, 170, 82, 0, 261, 348, 248, 198, 82, 0), (166, 351, 292, 173, 84, 0, 268, 358, 254, 203, 82, 0), (169, 362, 296, 180, 86, 0, 272, 364, 259, 207, 84, 0), (174, 370, 302, 184, 88, 0, 275, 379, 263, 217, 87, 0), (177, 375, 312, 185, 92, 0, 281, 389, 271, 223, 88, 0), (184, 379, 317, 186, 95, 0, 285, 395, 272, 225, 90, 0), (189, 388, 329, 189, 100, 0, 288, 406, 277, 230, 92, 0), (193, 396, 335, 190, 100, 0, 296, 412, 282, 235, 95, 0), (196, 404, 342, 196, 103, 0, 307, 421, 288, 239, 98, 0), (203, 411, 346, 205, 105, 0, 312, 429, 291, 249, 99, 0), (205, 427, 355, 209, 105, 0, 318, 439, 297, 254, 101, 0), (211, 436, 362, 212, 106, 0, 329, 451, 303, 263, 108, 0), (216, 444, 371, 215, 111, 0, 335, 462, 306, 267, 109, 0), (220, 454, 377, 220, 115, 0, 343, 469, 315, 273, 111, 0), (228, 464, 384, 220, 117, 0, 345, 482, 324, 278, 114, 0), (234, 479, 390, 224, 119, 0, 346, 489, 327, 283, 116, 0), (239, 489, 398, 228, 120, 0, 352, 507, 338, 287, 117, 0), (245, 494, 409, 232, 124, 0, 354, 516, 341, 292, 119, 0), (248, 507, 417, 234, 126, 0, 357, 523, 352, 299, 120, 0), (253, 516, 423, 237, 128, 0, 363, 533, 358, 305, 124, 0), (259, 524, 431, 239, 128, 0, 368, 543, 364, 308, 126, 0), (259, 524, 431, 239, 128, 0, 368, 543, 364, 308, 126, 0))
passenger_arriving_rate = ((3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), (3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), (3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), (3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), (3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), (3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), (3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), (3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), (3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), (4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), (4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), (4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), (4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), (4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), (4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), (4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), (4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), (4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), (4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), (4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), (4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), (4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), (4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), (4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), (4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), (4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), (4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), (4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), (4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), (4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), (4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), (4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), (4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), (4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), (4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), (4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), (4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), (4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), (4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), (4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), (4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), (4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), (4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), (4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), (4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), (4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), (4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), (4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), (4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), (4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), (4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), (4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), (4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), (4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), (4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), (4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), (4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), (4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), (4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))
passenger_allighting_rate = ((0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1))
'\nparameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html\n'
entropy = 258194110137029475889902652135037600173
child_seed_index = (1, 8) |
# coding:utf-8
"""
@author:weiwei
@time:2018.01.30
@version:0.1
"""
| """
@author:weiwei
@time:2018.01.30
@version:0.1
""" |
#!/usr/bin/env python3
# Write a program that computes the running sum from 1..n
# Also, have it compute the factorial of n while you're at it
# No, you may not use math.factorial()
# Use the same loop for both calculations
# your code goes here
n = 5
runsum = 0
runmult = 1
for i in range(1, n+1):
runsum += i
runmult *= i
print(n, runsum, runmult)
"""
#expected output
python3 11sumfac.py
5 15 120
"""
| n = 5
runsum = 0
runmult = 1
for i in range(1, n + 1):
runsum += i
runmult *= i
print(n, runsum, runmult)
'\n#expected output\npython3 11sumfac.py\n5 15 120\n' |
def obfuscated_id(x):
y = x
z = y
return z
a = 42
b = obfuscated_id(a)
| def obfuscated_id(x):
y = x
z = y
return z
a = 42
b = obfuscated_id(a) |
"""
Author : Drew Heasman
Date(last updated) : 05 June 2021
Description : Code used for geological calcuations.
"""
| """
Author : Drew Heasman
Date(last updated) : 05 June 2021
Description : Code used for geological calcuations.
""" |
# noinspection PyUnusedLocal
# friend_name = unicode string
def hello(friend_name):
'''
:param Int1: Integer between 0 and 100 inclusive
:param Int2: Integer between 0 and 100 inclusive
:return: Sum of Int1 and Int2
>>> hello ('Bob') --> 'Hello Bob'
>>> sumR1 ('Alice') --> 'Hello Alice'
'''
msg ='Hello, '
screamer ='!'
return msg+friend_name+screamer
'''raise NotImplementedError()'''
| def hello(friend_name):
"""
:param Int1: Integer between 0 and 100 inclusive
:param Int2: Integer between 0 and 100 inclusive
:return: Sum of Int1 and Int2
>>> hello ('Bob') --> 'Hello Bob'
>>> sumR1 ('Alice') --> 'Hello Alice'
"""
msg = 'Hello, '
screamer = '!'
return msg + friend_name + screamer
'raise NotImplementedError()' |
# const
N_INPUTS = 2
N_OUTPUTS = 1
# supported values: 1000, 2000, 4000, 8000, 16000
BATCH_SIZE = 1000
# variables
N_LAYERS = 3
MAX_ITER = 1000
SEED = 41
N_UNITS = []
for i in range(N_LAYERS):
N_UNITS.append(16)
| n_inputs = 2
n_outputs = 1
batch_size = 1000
n_layers = 3
max_iter = 1000
seed = 41
n_units = []
for i in range(N_LAYERS):
N_UNITS.append(16) |
# Irupe Canet
# Check if one number divides another
p = 8
m = 2
if (p % m) == 0:
print(p, "divided by", m, "leaves a reminder of zero.")
print("I'll run too if the condition is True.")
else:
print(p, "divided by", m, "does not leaves a reminder of zero.")
print("I'll run no matter what.")
| p = 8
m = 2
if p % m == 0:
print(p, 'divided by', m, 'leaves a reminder of zero.')
print("I'll run too if the condition is True.")
else:
print(p, 'divided by', m, 'does not leaves a reminder of zero.')
print("I'll run no matter what.") |
# This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it
secrets = {
'ssid' : 'home_network',
'password' : 'ssid_password',
'timezone' : "America/New_York", # http://worldtimeapi.org/timezones
'github_token' : 'fawfj23rakjnfawiefa',
'hackaday_token' : 'h4xx0rs3kret',
}
| secrets = {'ssid': 'home_network', 'password': 'ssid_password', 'timezone': 'America/New_York', 'github_token': 'fawfj23rakjnfawiefa', 'hackaday_token': 'h4xx0rs3kret'} |
"""
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: disable=load
def proxy_wasm_cpp_host_fetch_remote_crates():
"""This function defines a collection of repos and should be called in a WORKSPACE file"""
maybe(
http_archive,
name = "proxy_wasm_cpp_host__addr2line__0_14_1",
url = "https://crates.io/api/v1/crates/addr2line/0.14.1/download",
type = "tar.gz",
sha256 = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7",
strip_prefix = "addr2line-0.14.1",
build_file = Label("//bazel/cargo/remote:BUILD.addr2line-0.14.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__adler__1_0_2",
url = "https://crates.io/api/v1/crates/adler/1.0.2/download",
type = "tar.gz",
sha256 = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe",
strip_prefix = "adler-1.0.2",
build_file = Label("//bazel/cargo/remote:BUILD.adler-1.0.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__aho_corasick__0_7_15",
url = "https://crates.io/api/v1/crates/aho-corasick/0.7.15/download",
type = "tar.gz",
sha256 = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5",
strip_prefix = "aho-corasick-0.7.15",
build_file = Label("//bazel/cargo/remote:BUILD.aho-corasick-0.7.15.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__anyhow__1_0_40",
url = "https://crates.io/api/v1/crates/anyhow/1.0.40/download",
type = "tar.gz",
sha256 = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b",
strip_prefix = "anyhow-1.0.40",
build_file = Label("//bazel/cargo/remote:BUILD.anyhow-1.0.40.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__atty__0_2_14",
url = "https://crates.io/api/v1/crates/atty/0.2.14/download",
type = "tar.gz",
sha256 = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8",
strip_prefix = "atty-0.2.14",
build_file = Label("//bazel/cargo/remote:BUILD.atty-0.2.14.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__autocfg__1_0_1",
url = "https://crates.io/api/v1/crates/autocfg/1.0.1/download",
type = "tar.gz",
sha256 = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a",
strip_prefix = "autocfg-1.0.1",
build_file = Label("//bazel/cargo/remote:BUILD.autocfg-1.0.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__backtrace__0_3_56",
url = "https://crates.io/api/v1/crates/backtrace/0.3.56/download",
type = "tar.gz",
sha256 = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc",
strip_prefix = "backtrace-0.3.56",
build_file = Label("//bazel/cargo/remote:BUILD.backtrace-0.3.56.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__bincode__1_3_2",
url = "https://crates.io/api/v1/crates/bincode/1.3.2/download",
type = "tar.gz",
sha256 = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772",
strip_prefix = "bincode-1.3.2",
build_file = Label("//bazel/cargo/remote:BUILD.bincode-1.3.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__bitflags__1_2_1",
url = "https://crates.io/api/v1/crates/bitflags/1.2.1/download",
type = "tar.gz",
sha256 = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693",
strip_prefix = "bitflags-1.2.1",
build_file = Label("//bazel/cargo/remote:BUILD.bitflags-1.2.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__byteorder__1_3_4",
url = "https://crates.io/api/v1/crates/byteorder/1.3.4/download",
type = "tar.gz",
sha256 = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de",
strip_prefix = "byteorder-1.3.4",
build_file = Label("//bazel/cargo/remote:BUILD.byteorder-1.3.4.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cc__1_0_67",
url = "https://crates.io/api/v1/crates/cc/1.0.67/download",
type = "tar.gz",
sha256 = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd",
strip_prefix = "cc-1.0.67",
build_file = Label("//bazel/cargo/remote:BUILD.cc-1.0.67.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cfg_if__1_0_0",
url = "https://crates.io/api/v1/crates/cfg-if/1.0.0/download",
type = "tar.gz",
sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd",
strip_prefix = "cfg-if-1.0.0",
build_file = Label("//bazel/cargo/remote:BUILD.cfg-if-1.0.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cpp_demangle__0_3_2",
url = "https://crates.io/api/v1/crates/cpp_demangle/0.3.2/download",
type = "tar.gz",
sha256 = "44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390",
strip_prefix = "cpp_demangle-0.3.2",
build_file = Label("//bazel/cargo/remote:BUILD.cpp_demangle-0.3.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_bforest__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-bforest/0.73.0/download",
type = "tar.gz",
sha256 = "07f641ec9146b7d7498d78cd832007d66ca44a9b61f23474d1fb78e5a3701e99",
strip_prefix = "cranelift-bforest-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-bforest-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_codegen__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-codegen/0.73.0/download",
type = "tar.gz",
sha256 = "fd1f2c0cd4ac12c954116ab2e26e40df0d51db322a855b5664fa208bc32d6686",
strip_prefix = "cranelift-codegen-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-codegen-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_codegen_meta__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-codegen-meta/0.73.0/download",
type = "tar.gz",
sha256 = "105e11b2f0ff7ac81f80dd05ec938ce529a75e36f3d598360d806bb5bfa75e5a",
strip_prefix = "cranelift-codegen-meta-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-codegen-meta-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_codegen_shared__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-codegen-shared/0.73.0/download",
type = "tar.gz",
sha256 = "51e5eba2c1858d50abf023be4d88bd0450cb12d4ec2ba3ffac56353e6d09caf2",
strip_prefix = "cranelift-codegen-shared-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-codegen-shared-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_entity__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-entity/0.73.0/download",
type = "tar.gz",
sha256 = "79fa6fdd77a8d317763cd21668d3e72b96e09ac8a974326c6149f7de5aafa8ed",
strip_prefix = "cranelift-entity-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-entity-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_frontend__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-frontend/0.73.0/download",
type = "tar.gz",
sha256 = "ae11da9ca99f987c29e3eb39ebe10e9b879ecca30f3aeaee13db5e8e02b80fb6",
strip_prefix = "cranelift-frontend-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-frontend-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_native__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-native/0.73.0/download",
type = "tar.gz",
sha256 = "100ca4810058e23a5c4dcaedfa25289d1853f4a899d0960265aa7c54a4789351",
strip_prefix = "cranelift-native-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-native-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__cranelift_wasm__0_73_0",
url = "https://crates.io/api/v1/crates/cranelift-wasm/0.73.0/download",
type = "tar.gz",
sha256 = "607826643d74cf2cc36973ebffd1790a11d1781e14e3f95cf5529942b2168a67",
strip_prefix = "cranelift-wasm-0.73.0",
build_file = Label("//bazel/cargo/remote:BUILD.cranelift-wasm-0.73.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__crc32fast__1_2_1",
url = "https://crates.io/api/v1/crates/crc32fast/1.2.1/download",
type = "tar.gz",
sha256 = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a",
strip_prefix = "crc32fast-1.2.1",
build_file = Label("//bazel/cargo/remote:BUILD.crc32fast-1.2.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__either__1_6_1",
url = "https://crates.io/api/v1/crates/either/1.6.1/download",
type = "tar.gz",
sha256 = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457",
strip_prefix = "either-1.6.1",
build_file = Label("//bazel/cargo/remote:BUILD.either-1.6.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__env_logger__0_8_3",
url = "https://crates.io/api/v1/crates/env_logger/0.8.3/download",
type = "tar.gz",
sha256 = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f",
strip_prefix = "env_logger-0.8.3",
build_file = Label("//bazel/cargo/remote:BUILD.env_logger-0.8.3.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__fallible_iterator__0_2_0",
url = "https://crates.io/api/v1/crates/fallible-iterator/0.2.0/download",
type = "tar.gz",
sha256 = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7",
strip_prefix = "fallible-iterator-0.2.0",
build_file = Label("//bazel/cargo/remote:BUILD.fallible-iterator-0.2.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__getrandom__0_2_2",
url = "https://crates.io/api/v1/crates/getrandom/0.2.2/download",
type = "tar.gz",
sha256 = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8",
strip_prefix = "getrandom-0.2.2",
build_file = Label("//bazel/cargo/remote:BUILD.getrandom-0.2.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__gimli__0_23_0",
url = "https://crates.io/api/v1/crates/gimli/0.23.0/download",
type = "tar.gz",
sha256 = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce",
strip_prefix = "gimli-0.23.0",
build_file = Label("//bazel/cargo/remote:BUILD.gimli-0.23.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__glob__0_3_0",
url = "https://crates.io/api/v1/crates/glob/0.3.0/download",
type = "tar.gz",
sha256 = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574",
strip_prefix = "glob-0.3.0",
build_file = Label("//bazel/cargo/remote:BUILD.glob-0.3.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__hashbrown__0_9_1",
url = "https://crates.io/api/v1/crates/hashbrown/0.9.1/download",
type = "tar.gz",
sha256 = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04",
strip_prefix = "hashbrown-0.9.1",
build_file = Label("//bazel/cargo/remote:BUILD.hashbrown-0.9.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__hermit_abi__0_1_18",
url = "https://crates.io/api/v1/crates/hermit-abi/0.1.18/download",
type = "tar.gz",
sha256 = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c",
strip_prefix = "hermit-abi-0.1.18",
build_file = Label("//bazel/cargo/remote:BUILD.hermit-abi-0.1.18.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__humantime__2_1_0",
url = "https://crates.io/api/v1/crates/humantime/2.1.0/download",
type = "tar.gz",
sha256 = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4",
strip_prefix = "humantime-2.1.0",
build_file = Label("//bazel/cargo/remote:BUILD.humantime-2.1.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__indexmap__1_6_2",
url = "https://crates.io/api/v1/crates/indexmap/1.6.2/download",
type = "tar.gz",
sha256 = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3",
strip_prefix = "indexmap-1.6.2",
build_file = Label("//bazel/cargo/remote:BUILD.indexmap-1.6.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__itertools__0_10_0",
url = "https://crates.io/api/v1/crates/itertools/0.10.0/download",
type = "tar.gz",
sha256 = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319",
strip_prefix = "itertools-0.10.0",
build_file = Label("//bazel/cargo/remote:BUILD.itertools-0.10.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__lazy_static__1_4_0",
url = "https://crates.io/api/v1/crates/lazy_static/1.4.0/download",
type = "tar.gz",
sha256 = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646",
strip_prefix = "lazy_static-1.4.0",
build_file = Label("//bazel/cargo/remote:BUILD.lazy_static-1.4.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__libc__0_2_93",
url = "https://crates.io/api/v1/crates/libc/0.2.93/download",
type = "tar.gz",
sha256 = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41",
strip_prefix = "libc-0.2.93",
build_file = Label("//bazel/cargo/remote:BUILD.libc-0.2.93.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__log__0_4_14",
url = "https://crates.io/api/v1/crates/log/0.4.14/download",
type = "tar.gz",
sha256 = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710",
strip_prefix = "log-0.4.14",
build_file = Label("//bazel/cargo/remote:BUILD.log-0.4.14.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__mach__0_3_2",
url = "https://crates.io/api/v1/crates/mach/0.3.2/download",
type = "tar.gz",
sha256 = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa",
strip_prefix = "mach-0.3.2",
build_file = Label("//bazel/cargo/remote:BUILD.mach-0.3.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__memchr__2_3_4",
url = "https://crates.io/api/v1/crates/memchr/2.3.4/download",
type = "tar.gz",
sha256 = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525",
strip_prefix = "memchr-2.3.4",
build_file = Label("//bazel/cargo/remote:BUILD.memchr-2.3.4.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__memoffset__0_6_3",
url = "https://crates.io/api/v1/crates/memoffset/0.6.3/download",
type = "tar.gz",
sha256 = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d",
strip_prefix = "memoffset-0.6.3",
build_file = Label("//bazel/cargo/remote:BUILD.memoffset-0.6.3.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__miniz_oxide__0_4_4",
url = "https://crates.io/api/v1/crates/miniz_oxide/0.4.4/download",
type = "tar.gz",
sha256 = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b",
strip_prefix = "miniz_oxide-0.4.4",
build_file = Label("//bazel/cargo/remote:BUILD.miniz_oxide-0.4.4.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__more_asserts__0_2_1",
url = "https://crates.io/api/v1/crates/more-asserts/0.2.1/download",
type = "tar.gz",
sha256 = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238",
strip_prefix = "more-asserts-0.2.1",
build_file = Label("//bazel/cargo/remote:BUILD.more-asserts-0.2.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__object__0_23_0",
url = "https://crates.io/api/v1/crates/object/0.23.0/download",
type = "tar.gz",
sha256 = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4",
strip_prefix = "object-0.23.0",
build_file = Label("//bazel/cargo/remote:BUILD.object-0.23.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__once_cell__1_7_2",
url = "https://crates.io/api/v1/crates/once_cell/1.7.2/download",
type = "tar.gz",
sha256 = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3",
strip_prefix = "once_cell-1.7.2",
build_file = Label("//bazel/cargo/remote:BUILD.once_cell-1.7.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__paste__1_0_5",
url = "https://crates.io/api/v1/crates/paste/1.0.5/download",
type = "tar.gz",
sha256 = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58",
strip_prefix = "paste-1.0.5",
build_file = Label("//bazel/cargo/remote:BUILD.paste-1.0.5.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__ppv_lite86__0_2_10",
url = "https://crates.io/api/v1/crates/ppv-lite86/0.2.10/download",
type = "tar.gz",
sha256 = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857",
strip_prefix = "ppv-lite86-0.2.10",
build_file = Label("//bazel/cargo/remote:BUILD.ppv-lite86-0.2.10.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__proc_macro2__1_0_26",
url = "https://crates.io/api/v1/crates/proc-macro2/1.0.26/download",
type = "tar.gz",
sha256 = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec",
strip_prefix = "proc-macro2-1.0.26",
build_file = Label("//bazel/cargo/remote:BUILD.proc-macro2-1.0.26.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__psm__0_1_12",
url = "https://crates.io/api/v1/crates/psm/0.1.12/download",
type = "tar.gz",
sha256 = "3abf49e5417290756acfd26501536358560c4a5cc4a0934d390939acb3e7083a",
strip_prefix = "psm-0.1.12",
build_file = Label("//bazel/cargo/remote:BUILD.psm-0.1.12.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__quote__1_0_9",
url = "https://crates.io/api/v1/crates/quote/1.0.9/download",
type = "tar.gz",
sha256 = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7",
strip_prefix = "quote-1.0.9",
build_file = Label("//bazel/cargo/remote:BUILD.quote-1.0.9.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__rand__0_8_3",
url = "https://crates.io/api/v1/crates/rand/0.8.3/download",
type = "tar.gz",
sha256 = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e",
strip_prefix = "rand-0.8.3",
build_file = Label("//bazel/cargo/remote:BUILD.rand-0.8.3.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__rand_chacha__0_3_0",
url = "https://crates.io/api/v1/crates/rand_chacha/0.3.0/download",
type = "tar.gz",
sha256 = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d",
strip_prefix = "rand_chacha-0.3.0",
build_file = Label("//bazel/cargo/remote:BUILD.rand_chacha-0.3.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__rand_core__0_6_2",
url = "https://crates.io/api/v1/crates/rand_core/0.6.2/download",
type = "tar.gz",
sha256 = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7",
strip_prefix = "rand_core-0.6.2",
build_file = Label("//bazel/cargo/remote:BUILD.rand_core-0.6.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__rand_hc__0_3_0",
url = "https://crates.io/api/v1/crates/rand_hc/0.3.0/download",
type = "tar.gz",
sha256 = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73",
strip_prefix = "rand_hc-0.3.0",
build_file = Label("//bazel/cargo/remote:BUILD.rand_hc-0.3.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__regalloc__0_0_31",
url = "https://crates.io/api/v1/crates/regalloc/0.0.31/download",
type = "tar.gz",
sha256 = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5",
strip_prefix = "regalloc-0.0.31",
build_file = Label("//bazel/cargo/remote:BUILD.regalloc-0.0.31.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__regex__1_4_5",
url = "https://crates.io/api/v1/crates/regex/1.4.5/download",
type = "tar.gz",
sha256 = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19",
strip_prefix = "regex-1.4.5",
build_file = Label("//bazel/cargo/remote:BUILD.regex-1.4.5.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__regex_syntax__0_6_23",
url = "https://crates.io/api/v1/crates/regex-syntax/0.6.23/download",
type = "tar.gz",
sha256 = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548",
strip_prefix = "regex-syntax-0.6.23",
build_file = Label("//bazel/cargo/remote:BUILD.regex-syntax-0.6.23.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__region__2_2_0",
url = "https://crates.io/api/v1/crates/region/2.2.0/download",
type = "tar.gz",
sha256 = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0",
strip_prefix = "region-2.2.0",
build_file = Label("//bazel/cargo/remote:BUILD.region-2.2.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__rustc_demangle__0_1_18",
url = "https://crates.io/api/v1/crates/rustc-demangle/0.1.18/download",
type = "tar.gz",
sha256 = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232",
strip_prefix = "rustc-demangle-0.1.18",
build_file = Label("//bazel/cargo/remote:BUILD.rustc-demangle-0.1.18.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__rustc_hash__1_1_0",
url = "https://crates.io/api/v1/crates/rustc-hash/1.1.0/download",
type = "tar.gz",
sha256 = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2",
strip_prefix = "rustc-hash-1.1.0",
build_file = Label("//bazel/cargo/remote:BUILD.rustc-hash-1.1.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__serde__1_0_125",
url = "https://crates.io/api/v1/crates/serde/1.0.125/download",
type = "tar.gz",
sha256 = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171",
strip_prefix = "serde-1.0.125",
build_file = Label("//bazel/cargo/remote:BUILD.serde-1.0.125.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__serde_derive__1_0_125",
url = "https://crates.io/api/v1/crates/serde_derive/1.0.125/download",
type = "tar.gz",
sha256 = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d",
strip_prefix = "serde_derive-1.0.125",
build_file = Label("//bazel/cargo/remote:BUILD.serde_derive-1.0.125.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__smallvec__1_6_1",
url = "https://crates.io/api/v1/crates/smallvec/1.6.1/download",
type = "tar.gz",
sha256 = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e",
strip_prefix = "smallvec-1.6.1",
build_file = Label("//bazel/cargo/remote:BUILD.smallvec-1.6.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__stable_deref_trait__1_2_0",
url = "https://crates.io/api/v1/crates/stable_deref_trait/1.2.0/download",
type = "tar.gz",
sha256 = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3",
strip_prefix = "stable_deref_trait-1.2.0",
build_file = Label("//bazel/cargo/remote:BUILD.stable_deref_trait-1.2.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__syn__1_0_68",
url = "https://crates.io/api/v1/crates/syn/1.0.68/download",
type = "tar.gz",
sha256 = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87",
strip_prefix = "syn-1.0.68",
build_file = Label("//bazel/cargo/remote:BUILD.syn-1.0.68.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__target_lexicon__0_12_0",
url = "https://crates.io/api/v1/crates/target-lexicon/0.12.0/download",
type = "tar.gz",
sha256 = "64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834",
strip_prefix = "target-lexicon-0.12.0",
build_file = Label("//bazel/cargo/remote:BUILD.target-lexicon-0.12.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__termcolor__1_1_2",
url = "https://crates.io/api/v1/crates/termcolor/1.1.2/download",
type = "tar.gz",
sha256 = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4",
strip_prefix = "termcolor-1.1.2",
build_file = Label("//bazel/cargo/remote:BUILD.termcolor-1.1.2.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__thiserror__1_0_24",
url = "https://crates.io/api/v1/crates/thiserror/1.0.24/download",
type = "tar.gz",
sha256 = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e",
strip_prefix = "thiserror-1.0.24",
build_file = Label("//bazel/cargo/remote:BUILD.thiserror-1.0.24.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__thiserror_impl__1_0_24",
url = "https://crates.io/api/v1/crates/thiserror-impl/1.0.24/download",
type = "tar.gz",
sha256 = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0",
strip_prefix = "thiserror-impl-1.0.24",
build_file = Label("//bazel/cargo/remote:BUILD.thiserror-impl-1.0.24.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__unicode_xid__0_2_1",
url = "https://crates.io/api/v1/crates/unicode-xid/0.2.1/download",
type = "tar.gz",
sha256 = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564",
strip_prefix = "unicode-xid-0.2.1",
build_file = Label("//bazel/cargo/remote:BUILD.unicode-xid-0.2.1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasi__0_10_2_wasi_snapshot_preview1",
url = "https://crates.io/api/v1/crates/wasi/0.10.2+wasi-snapshot-preview1/download",
type = "tar.gz",
sha256 = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6",
strip_prefix = "wasi-0.10.2+wasi-snapshot-preview1",
build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmparser__0_77_0",
url = "https://crates.io/api/v1/crates/wasmparser/0.77.0/download",
type = "tar.gz",
sha256 = "b35c86d22e720a07d954ebbed772d01180501afe7d03d464f413bb5f8914a8d6",
strip_prefix = "wasmparser-0.77.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmparser-0.77.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime/0.26.0/download",
type = "tar.gz",
sha256 = "4da03115f8ad36e50edeb6640f4ba27ed7e9a6f05c2f98f728c762966f7054c6",
strip_prefix = "wasmtime-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-0.26.0.bazel"),
)
maybe(
new_git_repository,
name = "proxy_wasm_cpp_host__wasmtime_c_api_macros__0_19_0",
remote = "https://github.com/bytecodealliance/wasmtime",
commit = "6b77786a6e758e91da9484a1c80b6fa5f88e1b3d",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-c-api-macros-0.19.0.bazel"),
init_submodules = True,
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_cranelift__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-cranelift/0.26.0/download",
type = "tar.gz",
sha256 = "b73c47553954eab22f432a7a60bcd695eb46508c2088cb0aa1cfd060538db3b6",
strip_prefix = "wasmtime-cranelift-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-cranelift-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_debug__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-debug/0.26.0/download",
type = "tar.gz",
sha256 = "5241e603c262b2ee0dfb5b2245ad539d0a99f0589909fbffc91d2a8035f2d20a",
strip_prefix = "wasmtime-debug-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-debug-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_environ__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-environ/0.26.0/download",
type = "tar.gz",
sha256 = "fb8d356abc04754f5936b9377441a4a202f6bba7ad997d2cd66acb3908bc85a3",
strip_prefix = "wasmtime-environ-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-environ-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_jit__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-jit/0.26.0/download",
type = "tar.gz",
sha256 = "81b066a3290a903c5beb7d765b3e82e00cd4f8ac0475297f91330fbe8e16bb17",
strip_prefix = "wasmtime-jit-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-jit-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_obj__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-obj/0.26.0/download",
type = "tar.gz",
sha256 = "bd9d5c6c8924ea1fb2372d26c0546a8c5aab94001d5ddedaa36fd7b090c04de2",
strip_prefix = "wasmtime-obj-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-obj-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_profiling__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-profiling/0.26.0/download",
type = "tar.gz",
sha256 = "44760e80dd5f53e9af6c976120f9f1d35908ee0c646a3144083f0a57b7123ba7",
strip_prefix = "wasmtime-profiling-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-profiling-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__wasmtime_runtime__0_26_0",
url = "https://crates.io/api/v1/crates/wasmtime-runtime/0.26.0/download",
type = "tar.gz",
sha256 = "9701c6412897ba3a10fb4e17c4ec29723ed33d6feaaaeaf59f53799107ce7351",
strip_prefix = "wasmtime-runtime-0.26.0",
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-runtime-0.26.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__winapi__0_3_9",
url = "https://crates.io/api/v1/crates/winapi/0.3.9/download",
type = "tar.gz",
sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419",
strip_prefix = "winapi-0.3.9",
build_file = Label("//bazel/cargo/remote:BUILD.winapi-0.3.9.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__winapi_i686_pc_windows_gnu__0_4_0",
url = "https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download",
type = "tar.gz",
sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6",
strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0",
build_file = Label("//bazel/cargo/remote:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__winapi_util__0_1_5",
url = "https://crates.io/api/v1/crates/winapi-util/0.1.5/download",
type = "tar.gz",
sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178",
strip_prefix = "winapi-util-0.1.5",
build_file = Label("//bazel/cargo/remote:BUILD.winapi-util-0.1.5.bazel"),
)
maybe(
http_archive,
name = "proxy_wasm_cpp_host__winapi_x86_64_pc_windows_gnu__0_4_0",
url = "https://crates.io/api/v1/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download",
type = "tar.gz",
sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f",
strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0",
build_file = Label("//bazel/cargo/remote:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel"),
)
| """
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'new_git_repository')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def proxy_wasm_cpp_host_fetch_remote_crates():
"""This function defines a collection of repos and should be called in a WORKSPACE file"""
maybe(http_archive, name='proxy_wasm_cpp_host__addr2line__0_14_1', url='https://crates.io/api/v1/crates/addr2line/0.14.1/download', type='tar.gz', sha256='a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7', strip_prefix='addr2line-0.14.1', build_file=label('//bazel/cargo/remote:BUILD.addr2line-0.14.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__adler__1_0_2', url='https://crates.io/api/v1/crates/adler/1.0.2/download', type='tar.gz', sha256='f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe', strip_prefix='adler-1.0.2', build_file=label('//bazel/cargo/remote:BUILD.adler-1.0.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__aho_corasick__0_7_15', url='https://crates.io/api/v1/crates/aho-corasick/0.7.15/download', type='tar.gz', sha256='7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5', strip_prefix='aho-corasick-0.7.15', build_file=label('//bazel/cargo/remote:BUILD.aho-corasick-0.7.15.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__anyhow__1_0_40', url='https://crates.io/api/v1/crates/anyhow/1.0.40/download', type='tar.gz', sha256='28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b', strip_prefix='anyhow-1.0.40', build_file=label('//bazel/cargo/remote:BUILD.anyhow-1.0.40.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__atty__0_2_14', url='https://crates.io/api/v1/crates/atty/0.2.14/download', type='tar.gz', sha256='d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8', strip_prefix='atty-0.2.14', build_file=label('//bazel/cargo/remote:BUILD.atty-0.2.14.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__autocfg__1_0_1', url='https://crates.io/api/v1/crates/autocfg/1.0.1/download', type='tar.gz', sha256='cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a', strip_prefix='autocfg-1.0.1', build_file=label('//bazel/cargo/remote:BUILD.autocfg-1.0.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__backtrace__0_3_56', url='https://crates.io/api/v1/crates/backtrace/0.3.56/download', type='tar.gz', sha256='9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc', strip_prefix='backtrace-0.3.56', build_file=label('//bazel/cargo/remote:BUILD.backtrace-0.3.56.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__bincode__1_3_2', url='https://crates.io/api/v1/crates/bincode/1.3.2/download', type='tar.gz', sha256='d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772', strip_prefix='bincode-1.3.2', build_file=label('//bazel/cargo/remote:BUILD.bincode-1.3.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__bitflags__1_2_1', url='https://crates.io/api/v1/crates/bitflags/1.2.1/download', type='tar.gz', sha256='cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693', strip_prefix='bitflags-1.2.1', build_file=label('//bazel/cargo/remote:BUILD.bitflags-1.2.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__byteorder__1_3_4', url='https://crates.io/api/v1/crates/byteorder/1.3.4/download', type='tar.gz', sha256='08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de', strip_prefix='byteorder-1.3.4', build_file=label('//bazel/cargo/remote:BUILD.byteorder-1.3.4.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cc__1_0_67', url='https://crates.io/api/v1/crates/cc/1.0.67/download', type='tar.gz', sha256='e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd', strip_prefix='cc-1.0.67', build_file=label('//bazel/cargo/remote:BUILD.cc-1.0.67.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cfg_if__1_0_0', url='https://crates.io/api/v1/crates/cfg-if/1.0.0/download', type='tar.gz', sha256='baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd', strip_prefix='cfg-if-1.0.0', build_file=label('//bazel/cargo/remote:BUILD.cfg-if-1.0.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cpp_demangle__0_3_2', url='https://crates.io/api/v1/crates/cpp_demangle/0.3.2/download', type='tar.gz', sha256='44919ecaf6f99e8e737bc239408931c9a01e9a6c74814fee8242dd2506b65390', strip_prefix='cpp_demangle-0.3.2', build_file=label('//bazel/cargo/remote:BUILD.cpp_demangle-0.3.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_bforest__0_73_0', url='https://crates.io/api/v1/crates/cranelift-bforest/0.73.0/download', type='tar.gz', sha256='07f641ec9146b7d7498d78cd832007d66ca44a9b61f23474d1fb78e5a3701e99', strip_prefix='cranelift-bforest-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-bforest-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_codegen__0_73_0', url='https://crates.io/api/v1/crates/cranelift-codegen/0.73.0/download', type='tar.gz', sha256='fd1f2c0cd4ac12c954116ab2e26e40df0d51db322a855b5664fa208bc32d6686', strip_prefix='cranelift-codegen-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-codegen-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_codegen_meta__0_73_0', url='https://crates.io/api/v1/crates/cranelift-codegen-meta/0.73.0/download', type='tar.gz', sha256='105e11b2f0ff7ac81f80dd05ec938ce529a75e36f3d598360d806bb5bfa75e5a', strip_prefix='cranelift-codegen-meta-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-codegen-meta-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_codegen_shared__0_73_0', url='https://crates.io/api/v1/crates/cranelift-codegen-shared/0.73.0/download', type='tar.gz', sha256='51e5eba2c1858d50abf023be4d88bd0450cb12d4ec2ba3ffac56353e6d09caf2', strip_prefix='cranelift-codegen-shared-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-codegen-shared-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_entity__0_73_0', url='https://crates.io/api/v1/crates/cranelift-entity/0.73.0/download', type='tar.gz', sha256='79fa6fdd77a8d317763cd21668d3e72b96e09ac8a974326c6149f7de5aafa8ed', strip_prefix='cranelift-entity-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-entity-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_frontend__0_73_0', url='https://crates.io/api/v1/crates/cranelift-frontend/0.73.0/download', type='tar.gz', sha256='ae11da9ca99f987c29e3eb39ebe10e9b879ecca30f3aeaee13db5e8e02b80fb6', strip_prefix='cranelift-frontend-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-frontend-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_native__0_73_0', url='https://crates.io/api/v1/crates/cranelift-native/0.73.0/download', type='tar.gz', sha256='100ca4810058e23a5c4dcaedfa25289d1853f4a899d0960265aa7c54a4789351', strip_prefix='cranelift-native-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-native-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__cranelift_wasm__0_73_0', url='https://crates.io/api/v1/crates/cranelift-wasm/0.73.0/download', type='tar.gz', sha256='607826643d74cf2cc36973ebffd1790a11d1781e14e3f95cf5529942b2168a67', strip_prefix='cranelift-wasm-0.73.0', build_file=label('//bazel/cargo/remote:BUILD.cranelift-wasm-0.73.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__crc32fast__1_2_1', url='https://crates.io/api/v1/crates/crc32fast/1.2.1/download', type='tar.gz', sha256='81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a', strip_prefix='crc32fast-1.2.1', build_file=label('//bazel/cargo/remote:BUILD.crc32fast-1.2.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__either__1_6_1', url='https://crates.io/api/v1/crates/either/1.6.1/download', type='tar.gz', sha256='e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457', strip_prefix='either-1.6.1', build_file=label('//bazel/cargo/remote:BUILD.either-1.6.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__env_logger__0_8_3', url='https://crates.io/api/v1/crates/env_logger/0.8.3/download', type='tar.gz', sha256='17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f', strip_prefix='env_logger-0.8.3', build_file=label('//bazel/cargo/remote:BUILD.env_logger-0.8.3.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__fallible_iterator__0_2_0', url='https://crates.io/api/v1/crates/fallible-iterator/0.2.0/download', type='tar.gz', sha256='4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7', strip_prefix='fallible-iterator-0.2.0', build_file=label('//bazel/cargo/remote:BUILD.fallible-iterator-0.2.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__getrandom__0_2_2', url='https://crates.io/api/v1/crates/getrandom/0.2.2/download', type='tar.gz', sha256='c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8', strip_prefix='getrandom-0.2.2', build_file=label('//bazel/cargo/remote:BUILD.getrandom-0.2.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__gimli__0_23_0', url='https://crates.io/api/v1/crates/gimli/0.23.0/download', type='tar.gz', sha256='f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce', strip_prefix='gimli-0.23.0', build_file=label('//bazel/cargo/remote:BUILD.gimli-0.23.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__glob__0_3_0', url='https://crates.io/api/v1/crates/glob/0.3.0/download', type='tar.gz', sha256='9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574', strip_prefix='glob-0.3.0', build_file=label('//bazel/cargo/remote:BUILD.glob-0.3.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__hashbrown__0_9_1', url='https://crates.io/api/v1/crates/hashbrown/0.9.1/download', type='tar.gz', sha256='d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04', strip_prefix='hashbrown-0.9.1', build_file=label('//bazel/cargo/remote:BUILD.hashbrown-0.9.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__hermit_abi__0_1_18', url='https://crates.io/api/v1/crates/hermit-abi/0.1.18/download', type='tar.gz', sha256='322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c', strip_prefix='hermit-abi-0.1.18', build_file=label('//bazel/cargo/remote:BUILD.hermit-abi-0.1.18.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__humantime__2_1_0', url='https://crates.io/api/v1/crates/humantime/2.1.0/download', type='tar.gz', sha256='9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4', strip_prefix='humantime-2.1.0', build_file=label('//bazel/cargo/remote:BUILD.humantime-2.1.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__indexmap__1_6_2', url='https://crates.io/api/v1/crates/indexmap/1.6.2/download', type='tar.gz', sha256='824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3', strip_prefix='indexmap-1.6.2', build_file=label('//bazel/cargo/remote:BUILD.indexmap-1.6.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__itertools__0_10_0', url='https://crates.io/api/v1/crates/itertools/0.10.0/download', type='tar.gz', sha256='37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319', strip_prefix='itertools-0.10.0', build_file=label('//bazel/cargo/remote:BUILD.itertools-0.10.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__lazy_static__1_4_0', url='https://crates.io/api/v1/crates/lazy_static/1.4.0/download', type='tar.gz', sha256='e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646', strip_prefix='lazy_static-1.4.0', build_file=label('//bazel/cargo/remote:BUILD.lazy_static-1.4.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__libc__0_2_93', url='https://crates.io/api/v1/crates/libc/0.2.93/download', type='tar.gz', sha256='9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41', strip_prefix='libc-0.2.93', build_file=label('//bazel/cargo/remote:BUILD.libc-0.2.93.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__log__0_4_14', url='https://crates.io/api/v1/crates/log/0.4.14/download', type='tar.gz', sha256='51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710', strip_prefix='log-0.4.14', build_file=label('//bazel/cargo/remote:BUILD.log-0.4.14.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__mach__0_3_2', url='https://crates.io/api/v1/crates/mach/0.3.2/download', type='tar.gz', sha256='b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa', strip_prefix='mach-0.3.2', build_file=label('//bazel/cargo/remote:BUILD.mach-0.3.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__memchr__2_3_4', url='https://crates.io/api/v1/crates/memchr/2.3.4/download', type='tar.gz', sha256='0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525', strip_prefix='memchr-2.3.4', build_file=label('//bazel/cargo/remote:BUILD.memchr-2.3.4.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__memoffset__0_6_3', url='https://crates.io/api/v1/crates/memoffset/0.6.3/download', type='tar.gz', sha256='f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d', strip_prefix='memoffset-0.6.3', build_file=label('//bazel/cargo/remote:BUILD.memoffset-0.6.3.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__miniz_oxide__0_4_4', url='https://crates.io/api/v1/crates/miniz_oxide/0.4.4/download', type='tar.gz', sha256='a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b', strip_prefix='miniz_oxide-0.4.4', build_file=label('//bazel/cargo/remote:BUILD.miniz_oxide-0.4.4.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__more_asserts__0_2_1', url='https://crates.io/api/v1/crates/more-asserts/0.2.1/download', type='tar.gz', sha256='0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238', strip_prefix='more-asserts-0.2.1', build_file=label('//bazel/cargo/remote:BUILD.more-asserts-0.2.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__object__0_23_0', url='https://crates.io/api/v1/crates/object/0.23.0/download', type='tar.gz', sha256='a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4', strip_prefix='object-0.23.0', build_file=label('//bazel/cargo/remote:BUILD.object-0.23.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__once_cell__1_7_2', url='https://crates.io/api/v1/crates/once_cell/1.7.2/download', type='tar.gz', sha256='af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3', strip_prefix='once_cell-1.7.2', build_file=label('//bazel/cargo/remote:BUILD.once_cell-1.7.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__paste__1_0_5', url='https://crates.io/api/v1/crates/paste/1.0.5/download', type='tar.gz', sha256='acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58', strip_prefix='paste-1.0.5', build_file=label('//bazel/cargo/remote:BUILD.paste-1.0.5.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__ppv_lite86__0_2_10', url='https://crates.io/api/v1/crates/ppv-lite86/0.2.10/download', type='tar.gz', sha256='ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857', strip_prefix='ppv-lite86-0.2.10', build_file=label('//bazel/cargo/remote:BUILD.ppv-lite86-0.2.10.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__proc_macro2__1_0_26', url='https://crates.io/api/v1/crates/proc-macro2/1.0.26/download', type='tar.gz', sha256='a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec', strip_prefix='proc-macro2-1.0.26', build_file=label('//bazel/cargo/remote:BUILD.proc-macro2-1.0.26.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__psm__0_1_12', url='https://crates.io/api/v1/crates/psm/0.1.12/download', type='tar.gz', sha256='3abf49e5417290756acfd26501536358560c4a5cc4a0934d390939acb3e7083a', strip_prefix='psm-0.1.12', build_file=label('//bazel/cargo/remote:BUILD.psm-0.1.12.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__quote__1_0_9', url='https://crates.io/api/v1/crates/quote/1.0.9/download', type='tar.gz', sha256='c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7', strip_prefix='quote-1.0.9', build_file=label('//bazel/cargo/remote:BUILD.quote-1.0.9.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__rand__0_8_3', url='https://crates.io/api/v1/crates/rand/0.8.3/download', type='tar.gz', sha256='0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e', strip_prefix='rand-0.8.3', build_file=label('//bazel/cargo/remote:BUILD.rand-0.8.3.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__rand_chacha__0_3_0', url='https://crates.io/api/v1/crates/rand_chacha/0.3.0/download', type='tar.gz', sha256='e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d', strip_prefix='rand_chacha-0.3.0', build_file=label('//bazel/cargo/remote:BUILD.rand_chacha-0.3.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__rand_core__0_6_2', url='https://crates.io/api/v1/crates/rand_core/0.6.2/download', type='tar.gz', sha256='34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7', strip_prefix='rand_core-0.6.2', build_file=label('//bazel/cargo/remote:BUILD.rand_core-0.6.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__rand_hc__0_3_0', url='https://crates.io/api/v1/crates/rand_hc/0.3.0/download', type='tar.gz', sha256='3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73', strip_prefix='rand_hc-0.3.0', build_file=label('//bazel/cargo/remote:BUILD.rand_hc-0.3.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__regalloc__0_0_31', url='https://crates.io/api/v1/crates/regalloc/0.0.31/download', type='tar.gz', sha256='571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5', strip_prefix='regalloc-0.0.31', build_file=label('//bazel/cargo/remote:BUILD.regalloc-0.0.31.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__regex__1_4_5', url='https://crates.io/api/v1/crates/regex/1.4.5/download', type='tar.gz', sha256='957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19', strip_prefix='regex-1.4.5', build_file=label('//bazel/cargo/remote:BUILD.regex-1.4.5.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__regex_syntax__0_6_23', url='https://crates.io/api/v1/crates/regex-syntax/0.6.23/download', type='tar.gz', sha256='24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548', strip_prefix='regex-syntax-0.6.23', build_file=label('//bazel/cargo/remote:BUILD.regex-syntax-0.6.23.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__region__2_2_0', url='https://crates.io/api/v1/crates/region/2.2.0/download', type='tar.gz', sha256='877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0', strip_prefix='region-2.2.0', build_file=label('//bazel/cargo/remote:BUILD.region-2.2.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__rustc_demangle__0_1_18', url='https://crates.io/api/v1/crates/rustc-demangle/0.1.18/download', type='tar.gz', sha256='6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232', strip_prefix='rustc-demangle-0.1.18', build_file=label('//bazel/cargo/remote:BUILD.rustc-demangle-0.1.18.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__rustc_hash__1_1_0', url='https://crates.io/api/v1/crates/rustc-hash/1.1.0/download', type='tar.gz', sha256='08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2', strip_prefix='rustc-hash-1.1.0', build_file=label('//bazel/cargo/remote:BUILD.rustc-hash-1.1.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__serde__1_0_125', url='https://crates.io/api/v1/crates/serde/1.0.125/download', type='tar.gz', sha256='558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171', strip_prefix='serde-1.0.125', build_file=label('//bazel/cargo/remote:BUILD.serde-1.0.125.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__serde_derive__1_0_125', url='https://crates.io/api/v1/crates/serde_derive/1.0.125/download', type='tar.gz', sha256='b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d', strip_prefix='serde_derive-1.0.125', build_file=label('//bazel/cargo/remote:BUILD.serde_derive-1.0.125.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__smallvec__1_6_1', url='https://crates.io/api/v1/crates/smallvec/1.6.1/download', type='tar.gz', sha256='fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e', strip_prefix='smallvec-1.6.1', build_file=label('//bazel/cargo/remote:BUILD.smallvec-1.6.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__stable_deref_trait__1_2_0', url='https://crates.io/api/v1/crates/stable_deref_trait/1.2.0/download', type='tar.gz', sha256='a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3', strip_prefix='stable_deref_trait-1.2.0', build_file=label('//bazel/cargo/remote:BUILD.stable_deref_trait-1.2.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__syn__1_0_68', url='https://crates.io/api/v1/crates/syn/1.0.68/download', type='tar.gz', sha256='3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87', strip_prefix='syn-1.0.68', build_file=label('//bazel/cargo/remote:BUILD.syn-1.0.68.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__target_lexicon__0_12_0', url='https://crates.io/api/v1/crates/target-lexicon/0.12.0/download', type='tar.gz', sha256='64ae3b39281e4b14b8123bdbaddd472b7dfe215e444181f2f9d2443c2444f834', strip_prefix='target-lexicon-0.12.0', build_file=label('//bazel/cargo/remote:BUILD.target-lexicon-0.12.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__termcolor__1_1_2', url='https://crates.io/api/v1/crates/termcolor/1.1.2/download', type='tar.gz', sha256='2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4', strip_prefix='termcolor-1.1.2', build_file=label('//bazel/cargo/remote:BUILD.termcolor-1.1.2.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__thiserror__1_0_24', url='https://crates.io/api/v1/crates/thiserror/1.0.24/download', type='tar.gz', sha256='e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e', strip_prefix='thiserror-1.0.24', build_file=label('//bazel/cargo/remote:BUILD.thiserror-1.0.24.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__thiserror_impl__1_0_24', url='https://crates.io/api/v1/crates/thiserror-impl/1.0.24/download', type='tar.gz', sha256='7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0', strip_prefix='thiserror-impl-1.0.24', build_file=label('//bazel/cargo/remote:BUILD.thiserror-impl-1.0.24.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__unicode_xid__0_2_1', url='https://crates.io/api/v1/crates/unicode-xid/0.2.1/download', type='tar.gz', sha256='f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564', strip_prefix='unicode-xid-0.2.1', build_file=label('//bazel/cargo/remote:BUILD.unicode-xid-0.2.1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasi__0_10_2_wasi_snapshot_preview1', url='https://crates.io/api/v1/crates/wasi/0.10.2+wasi-snapshot-preview1/download', type='tar.gz', sha256='fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6', strip_prefix='wasi-0.10.2+wasi-snapshot-preview1', build_file=label('//bazel/cargo/remote:BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmparser__0_77_0', url='https://crates.io/api/v1/crates/wasmparser/0.77.0/download', type='tar.gz', sha256='b35c86d22e720a07d954ebbed772d01180501afe7d03d464f413bb5f8914a8d6', strip_prefix='wasmparser-0.77.0', build_file=label('//bazel/cargo/remote:BUILD.wasmparser-0.77.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime__0_26_0', url='https://crates.io/api/v1/crates/wasmtime/0.26.0/download', type='tar.gz', sha256='4da03115f8ad36e50edeb6640f4ba27ed7e9a6f05c2f98f728c762966f7054c6', strip_prefix='wasmtime-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-0.26.0.bazel'))
maybe(new_git_repository, name='proxy_wasm_cpp_host__wasmtime_c_api_macros__0_19_0', remote='https://github.com/bytecodealliance/wasmtime', commit='6b77786a6e758e91da9484a1c80b6fa5f88e1b3d', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-c-api-macros-0.19.0.bazel'), init_submodules=True)
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_cranelift__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-cranelift/0.26.0/download', type='tar.gz', sha256='b73c47553954eab22f432a7a60bcd695eb46508c2088cb0aa1cfd060538db3b6', strip_prefix='wasmtime-cranelift-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-cranelift-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_debug__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-debug/0.26.0/download', type='tar.gz', sha256='5241e603c262b2ee0dfb5b2245ad539d0a99f0589909fbffc91d2a8035f2d20a', strip_prefix='wasmtime-debug-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-debug-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_environ__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-environ/0.26.0/download', type='tar.gz', sha256='fb8d356abc04754f5936b9377441a4a202f6bba7ad997d2cd66acb3908bc85a3', strip_prefix='wasmtime-environ-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-environ-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_jit__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-jit/0.26.0/download', type='tar.gz', sha256='81b066a3290a903c5beb7d765b3e82e00cd4f8ac0475297f91330fbe8e16bb17', strip_prefix='wasmtime-jit-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-jit-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_obj__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-obj/0.26.0/download', type='tar.gz', sha256='bd9d5c6c8924ea1fb2372d26c0546a8c5aab94001d5ddedaa36fd7b090c04de2', strip_prefix='wasmtime-obj-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-obj-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_profiling__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-profiling/0.26.0/download', type='tar.gz', sha256='44760e80dd5f53e9af6c976120f9f1d35908ee0c646a3144083f0a57b7123ba7', strip_prefix='wasmtime-profiling-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-profiling-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__wasmtime_runtime__0_26_0', url='https://crates.io/api/v1/crates/wasmtime-runtime/0.26.0/download', type='tar.gz', sha256='9701c6412897ba3a10fb4e17c4ec29723ed33d6feaaaeaf59f53799107ce7351', strip_prefix='wasmtime-runtime-0.26.0', build_file=label('//bazel/cargo/remote:BUILD.wasmtime-runtime-0.26.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__winapi__0_3_9', url='https://crates.io/api/v1/crates/winapi/0.3.9/download', type='tar.gz', sha256='5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419', strip_prefix='winapi-0.3.9', build_file=label('//bazel/cargo/remote:BUILD.winapi-0.3.9.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__winapi_i686_pc_windows_gnu__0_4_0', url='https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download', type='tar.gz', sha256='ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6', strip_prefix='winapi-i686-pc-windows-gnu-0.4.0', build_file=label('//bazel/cargo/remote:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__winapi_util__0_1_5', url='https://crates.io/api/v1/crates/winapi-util/0.1.5/download', type='tar.gz', sha256='70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178', strip_prefix='winapi-util-0.1.5', build_file=label('//bazel/cargo/remote:BUILD.winapi-util-0.1.5.bazel'))
maybe(http_archive, name='proxy_wasm_cpp_host__winapi_x86_64_pc_windows_gnu__0_4_0', url='https://crates.io/api/v1/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download', type='tar.gz', sha256='712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f', strip_prefix='winapi-x86_64-pc-windows-gnu-0.4.0', build_file=label('//bazel/cargo/remote:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel')) |
width = int(input())
lenght = int(input())
count = width * lenght
while count > 0:
line = input()
if line == "STOP":
break
else:
new_pieces = int(line)
count = count - new_pieces
if count > 0:
print(f"{count} pieces are left.")
else:
print(f"No more cake left! You need {abs(count)} pieces more.")
| width = int(input())
lenght = int(input())
count = width * lenght
while count > 0:
line = input()
if line == 'STOP':
break
else:
new_pieces = int(line)
count = count - new_pieces
if count > 0:
print(f'{count} pieces are left.')
else:
print(f'No more cake left! You need {abs(count)} pieces more.') |
"""Summary."""
class Key:
"""Summary."""
def __init__(self, key_str: str):
"""Summary.
Args:
key_str (str): Description
"""
self._key = key_str
def __str__(self) -> str:
"""Summary.
Returns:
str: Description
"""
return self._key
| """Summary."""
class Key:
"""Summary."""
def __init__(self, key_str: str):
"""Summary.
Args:
key_str (str): Description
"""
self._key = key_str
def __str__(self) -> str:
"""Summary.
Returns:
str: Description
"""
return self._key |
# Program to find GCD of the digits of a number
# Recursive function to return gcd of a and b
def gcd(a, b):
return a if (b == 0) else gcd(b, a % b)
def digitGCD(n):
ans = 0
while n > 0:
ans = gcd(n % 10, ans)
# If at any point GCD is 1, return
if gcd == 1:
return 1
n = n // 10
return ans
n = int(input("Enter a number: "))
print("GCD of the digits of n is", digitGCD(n))
| def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def digit_gcd(n):
ans = 0
while n > 0:
ans = gcd(n % 10, ans)
if gcd == 1:
return 1
n = n // 10
return ans
n = int(input('Enter a number: '))
print('GCD of the digits of n is', digit_gcd(n)) |
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
dic = collections.defaultdict(list)
for s in strs : dic["".join(sorted(s))].append(s)
return list(dic.values())
| class Solution:
def group_anagrams(self, strs: List[str]) -> List[List[str]]:
dic = collections.defaultdict(list)
for s in strs:
dic[''.join(sorted(s))].append(s)
return list(dic.values()) |
#!/usr/bin/env python
wc_arr = [0 for x in range(0, 14000/8)]
def _iswordchar(ch):
return (not (
ch <= 33
or ch == ord(';') or ch == ord('-') or ch == ord('"') or ch == ord('\'')
or (ch >= 35 and ch <= 38)
or (ch >= 40 and ch <= 44)
or (ch >= 46 and ch <= 47)
or ch == 58
or (ch >= 60 and ch <= 63)
or (ch >= 91 and ch <= 94)
or ch == 96
or ch == 124
or (ch >= 126 and ch <= 169 and ch not in [131,138,140,142,154,156,158,159])
or (ch >= 171 and ch <= 177)
or ch == 180
or (ch >= 182 and ch <= 184)
or ch == 187
or ch == 191
or ch == 215
or ch == 247
or (ch >= 697 and ch <= 698)
or (ch >= 706 and ch <= 719)
or (ch >= 722 and ch <= 735)
or (ch >= 741 and ch <= 749)
or (ch >= 884 and ch <= 885)
or ch == 894
or (ch >= 900 and ch <= 901)
or ch == 903
or ch == 1154
or (ch >= 1160 and ch <= 1161)
or (ch >= 1370 and ch <= 1375)
or (ch >= 1417 and ch <= 1418)
or ch == 1470
or ch == 1472
or ch == 1475
or (ch >= 1523 and ch <= 1524)
or ch == 1548
or ch == 1563
or ch == 1567
or (ch >= 1642 and ch <= 1645)
or ch == 1748
or (ch >= 1757 and ch <= 1758)
or ch == 1769
or (ch >= 1789 and ch <= 1790)
or (ch >= 1792 and ch <= 1805)
or ch == 1807
or (ch >= 2404 and ch <= 2405)
or ch == 2416
or (ch >= 2546 and ch <= 2547)
or ch == 2554
or ch == 2928
or ch == 3572
or ch == 3647
or ch == 3663
or (ch >= 3674 and ch <= 3675)
or (ch >= 3841 and ch <= 3863)
or (ch >= 3866 and ch <= 3871)
or ch == 3892
or ch == 3894
or ch == 3896
or (ch >= 3898 and ch <= 3901)
or ch == 3973
or (ch >= 4030 and ch <= 4037)
or (ch >= 4039 and ch <= 4044)
or ch == 4047
or (ch >= 4170 and ch <= 4175)
or ch == 4347
or (ch >= 4961 and ch <= 4968)
or (ch >= 5741 and ch <= 5742)
or ch == 5760
or (ch >= 5787 and ch <= 5788)
or (ch >= 5867 and ch <= 5869)
or (ch >= 6100 and ch <= 6108)
or (ch >= 6144 and ch <= 6158)
or ch == 8125
or (ch >= 8127 and ch <= 8129)
or (ch >= 8141 and ch <= 8143)
or (ch >= 8157 and ch <= 8159)
or (ch >= 8173 and ch <= 8175)
or (ch >= 8189 and ch <= 8190)
or (ch >= 8192 and ch <= 8262)
or (ch >= 8264 and ch <= 8269)
or (ch >= 8298 and ch <= 8303)
or (ch >= 8314 and ch <= 8318)
or (ch >= 8330 and ch <= 8334)
or (ch >= 8352 and ch <= 8367)
or (ch >= 8413 and ch <= 8416)
or (ch >= 8418 and ch <= 8419)
or (ch >= 8448 and ch <= 8449)
or (ch >= 8451 and ch <= 8454)
or (ch >= 8456 and ch <= 8457)
or ch == 8468
or (ch >= 8470 and ch <= 8472)
or (ch >= 8478 and ch <= 8483)
or ch == 8485
or ch == 8487
or ch == 8489
or ch == 8494
or ch == 8498
or ch == 8506
or (ch >= 8592 and ch <= 8691)
or (ch >= 8704 and ch <= 8945)
or (ch >= 8960 and ch <= 9083)
or (ch >= 9085 and ch <= 9114)
or (ch >= 9216 and ch <= 9254)
or (ch >= 9280 and ch <= 9290)
or (ch >= 9372 and ch <= 9449)
or (ch >= 9472 and ch <= 9621)
or (ch >= 9632 and ch <= 9719)
or (ch >= 9728 and ch <= 9747)
or (ch >= 9753 and ch <= 9841)
or (ch >= 9985 and ch <= 9988)
or (ch >= 9990 and ch <= 9993)
or (ch >= 9996 and ch <= 10023)
or (ch >= 10025 and ch <= 10059)
or ch == 10061
or (ch >= 10063 and ch <= 10066)
or ch == 10070
or (ch >= 10072 and ch <= 10078)
or (ch >= 10081 and ch <= 10087)
or ch == 10132
or (ch >= 10136 and ch <= 10159)
or (ch >= 10161 and ch <= 10174)
or (ch >= 10240 and ch <= 10495)
or (ch >= 11904 and ch <= 11929)
or (ch >= 11931 and ch <= 12019)
or (ch >= 12032 and ch <= 12245)
or (ch >= 12272 and ch <= 12283)
or (ch >= 12288 and ch <= 12292)
or (ch >= 12296 and ch <= 12320)
or ch == 12336
or (ch >= 12342 and ch <= 12343)
or (ch >= 12350 and ch <= 12351)
or (ch >= 12443 and ch <= 12444)
or ch == 12539
or (ch >= 12688 and ch <= 12689)
or (ch >= 12694 and ch <= 12703)
or (ch >= 12800 and ch <= 12828)
or (ch >= 12842 and ch <= 12867)
or (ch >= 12896 and ch <= 12923)
or ch == 12927
or (ch >= 12938 and ch <= 12976)
or (ch >= 12992 and ch <= 13003)
or (ch >= 13008 and ch <= 13054)
or (ch >= 13056 and ch <= 13174)
or (ch >= 13179 and ch <= 13277)
or (ch >= 13280 and ch <= 13310)
))
for b in range(0,len(wc_arr)):
for bit in range(0,8):
if _iswordchar(b*8 + bit):
wc_arr[b] |= 1 << bit
f = open("iswordchar.inc", "wt")
print >>f, "static const unsigned char _iswordchar_table[%s] = {" % len(wc_arr)
for i in range(0, len(wc_arr)):
if i>0 and i % 16 == 0:
print >>f
f.write("0x%x" % wc_arr[i])
if i+1 < len(wc_arr):
f.write(",")
print >>f, "};"
print >>f, "static inline bool iswordchar(int ch)"
print >>f, "{"
print >>f, " if (ch == SednaConvertJob::closetag_code || ch == SednaConvertJob::opentag_code)"
print >>f, " return false;"
print >>f, " if (ch >= %s)" % (len(wc_arr)*8)
print >>f, " return true;"
print >>f, " return ((_iswordchar_table[ch >> 3] & (1 << (ch & 7))) != 0);"
print >>f, "}"
f.close()
| wc_arr = [0 for x in range(0, 14000 / 8)]
def _iswordchar(ch):
return not (ch <= 33 or ch == ord(';') or ch == ord('-') or (ch == ord('"')) or (ch == ord("'")) or (ch >= 35 and ch <= 38) or (ch >= 40 and ch <= 44) or (ch >= 46 and ch <= 47) or (ch == 58) or (ch >= 60 and ch <= 63) or (ch >= 91 and ch <= 94) or (ch == 96) or (ch == 124) or (ch >= 126 and ch <= 169 and (ch not in [131, 138, 140, 142, 154, 156, 158, 159])) or (ch >= 171 and ch <= 177) or (ch == 180) or (ch >= 182 and ch <= 184) or (ch == 187) or (ch == 191) or (ch == 215) or (ch == 247) or (ch >= 697 and ch <= 698) or (ch >= 706 and ch <= 719) or (ch >= 722 and ch <= 735) or (ch >= 741 and ch <= 749) or (ch >= 884 and ch <= 885) or (ch == 894) or (ch >= 900 and ch <= 901) or (ch == 903) or (ch == 1154) or (ch >= 1160 and ch <= 1161) or (ch >= 1370 and ch <= 1375) or (ch >= 1417 and ch <= 1418) or (ch == 1470) or (ch == 1472) or (ch == 1475) or (ch >= 1523 and ch <= 1524) or (ch == 1548) or (ch == 1563) or (ch == 1567) or (ch >= 1642 and ch <= 1645) or (ch == 1748) or (ch >= 1757 and ch <= 1758) or (ch == 1769) or (ch >= 1789 and ch <= 1790) or (ch >= 1792 and ch <= 1805) or (ch == 1807) or (ch >= 2404 and ch <= 2405) or (ch == 2416) or (ch >= 2546 and ch <= 2547) or (ch == 2554) or (ch == 2928) or (ch == 3572) or (ch == 3647) or (ch == 3663) or (ch >= 3674 and ch <= 3675) or (ch >= 3841 and ch <= 3863) or (ch >= 3866 and ch <= 3871) or (ch == 3892) or (ch == 3894) or (ch == 3896) or (ch >= 3898 and ch <= 3901) or (ch == 3973) or (ch >= 4030 and ch <= 4037) or (ch >= 4039 and ch <= 4044) or (ch == 4047) or (ch >= 4170 and ch <= 4175) or (ch == 4347) or (ch >= 4961 and ch <= 4968) or (ch >= 5741 and ch <= 5742) or (ch == 5760) or (ch >= 5787 and ch <= 5788) or (ch >= 5867 and ch <= 5869) or (ch >= 6100 and ch <= 6108) or (ch >= 6144 and ch <= 6158) or (ch == 8125) or (ch >= 8127 and ch <= 8129) or (ch >= 8141 and ch <= 8143) or (ch >= 8157 and ch <= 8159) or (ch >= 8173 and ch <= 8175) or (ch >= 8189 and ch <= 8190) or (ch >= 8192 and ch <= 8262) or (ch >= 8264 and ch <= 8269) or (ch >= 8298 and ch <= 8303) or (ch >= 8314 and ch <= 8318) or (ch >= 8330 and ch <= 8334) or (ch >= 8352 and ch <= 8367) or (ch >= 8413 and ch <= 8416) or (ch >= 8418 and ch <= 8419) or (ch >= 8448 and ch <= 8449) or (ch >= 8451 and ch <= 8454) or (ch >= 8456 and ch <= 8457) or (ch == 8468) or (ch >= 8470 and ch <= 8472) or (ch >= 8478 and ch <= 8483) or (ch == 8485) or (ch == 8487) or (ch == 8489) or (ch == 8494) or (ch == 8498) or (ch == 8506) or (ch >= 8592 and ch <= 8691) or (ch >= 8704 and ch <= 8945) or (ch >= 8960 and ch <= 9083) or (ch >= 9085 and ch <= 9114) or (ch >= 9216 and ch <= 9254) or (ch >= 9280 and ch <= 9290) or (ch >= 9372 and ch <= 9449) or (ch >= 9472 and ch <= 9621) or (ch >= 9632 and ch <= 9719) or (ch >= 9728 and ch <= 9747) or (ch >= 9753 and ch <= 9841) or (ch >= 9985 and ch <= 9988) or (ch >= 9990 and ch <= 9993) or (ch >= 9996 and ch <= 10023) or (ch >= 10025 and ch <= 10059) or (ch == 10061) or (ch >= 10063 and ch <= 10066) or (ch == 10070) or (ch >= 10072 and ch <= 10078) or (ch >= 10081 and ch <= 10087) or (ch == 10132) or (ch >= 10136 and ch <= 10159) or (ch >= 10161 and ch <= 10174) or (ch >= 10240 and ch <= 10495) or (ch >= 11904 and ch <= 11929) or (ch >= 11931 and ch <= 12019) or (ch >= 12032 and ch <= 12245) or (ch >= 12272 and ch <= 12283) or (ch >= 12288 and ch <= 12292) or (ch >= 12296 and ch <= 12320) or (ch == 12336) or (ch >= 12342 and ch <= 12343) or (ch >= 12350 and ch <= 12351) or (ch >= 12443 and ch <= 12444) or (ch == 12539) or (ch >= 12688 and ch <= 12689) or (ch >= 12694 and ch <= 12703) or (ch >= 12800 and ch <= 12828) or (ch >= 12842 and ch <= 12867) or (ch >= 12896 and ch <= 12923) or (ch == 12927) or (ch >= 12938 and ch <= 12976) or (ch >= 12992 and ch <= 13003) or (ch >= 13008 and ch <= 13054) or (ch >= 13056 and ch <= 13174) or (ch >= 13179 and ch <= 13277) or (ch >= 13280 and ch <= 13310))
for b in range(0, len(wc_arr)):
for bit in range(0, 8):
if _iswordchar(b * 8 + bit):
wc_arr[b] |= 1 << bit
f = open('iswordchar.inc', 'wt')
(print >> f, 'static const unsigned char _iswordchar_table[%s] = {' % len(wc_arr))
for i in range(0, len(wc_arr)):
if i > 0 and i % 16 == 0:
print >> f
f.write('0x%x' % wc_arr[i])
if i + 1 < len(wc_arr):
f.write(',')
(print >> f, '};')
(print >> f, 'static inline bool iswordchar(int ch)')
(print >> f, '{')
(print >> f, ' if (ch == SednaConvertJob::closetag_code || ch == SednaConvertJob::opentag_code)')
(print >> f, ' return false;')
(print >> f, ' if (ch >= %s)' % (len(wc_arr) * 8))
(print >> f, ' return true;')
(print >> f, ' return ((_iswordchar_table[ch >> 3] & (1 << (ch & 7))) != 0);')
(print >> f, '}')
f.close() |
# The main module for the plugin.
# Note: In ALL plugins there must be a python file called [name-of-plugin].py in a folder called [name-of-plugin]!
def init(page, config):
# This code runs when the generate command is called.
print("Example plugin initialized!")
def site(page):
# This code run whenever a new DarsSite is created.
print("Site created.")
# Doing something with the given site (printing the title)
print("Site title: " + page.title)
def closesite(page):
# This code runs just before the user stops editing the site.
print("Site closed: " + page.title)
| def init(page, config):
print('Example plugin initialized!')
def site(page):
print('Site created.')
print('Site title: ' + page.title)
def closesite(page):
print('Site closed: ' + page.title) |
def belongs_to_file(word, filename):
with open(filename) as f:
l = f.readlines()
for w in l:
if w.strip() == word:
return True
return False
print(belongs_to_file("renard", "words.txt"))
print(belongs_to_file("abbots", "words.txt"))
| def belongs_to_file(word, filename):
with open(filename) as f:
l = f.readlines()
for w in l:
if w.strip() == word:
return True
return False
print(belongs_to_file('renard', 'words.txt'))
print(belongs_to_file('abbots', 'words.txt')) |
class LampTextureSlot:
color_factor = None
object = None
shadow_factor = None
texture_coords = None
use_map_color = None
use_map_shadow = None
| class Lamptextureslot:
color_factor = None
object = None
shadow_factor = None
texture_coords = None
use_map_color = None
use_map_shadow = None |
'''
Created on Feb 24, 2018
@author: danie
'''
| """
Created on Feb 24, 2018
@author: danie
""" |
# Task 05. Faro Shuffle
def faro_shuffle(arr_input):
left_half = deck[:len(arr_input) // 2]
right_half = deck[len(arr_input) // 2:]
new_list = []
for ind in range(len(left_half)):
new_list.append(right_half[ind])
new_list.append(left_half[ind])
return new_list
deck = input().split()
count = int(input())
first = [deck.pop(0)]
last = [deck.pop(len(deck)-1)]
for i in range(1, count+1):
tmp = faro_shuffle(deck)
deck = tmp
print(first+deck+last)
| def faro_shuffle(arr_input):
left_half = deck[:len(arr_input) // 2]
right_half = deck[len(arr_input) // 2:]
new_list = []
for ind in range(len(left_half)):
new_list.append(right_half[ind])
new_list.append(left_half[ind])
return new_list
deck = input().split()
count = int(input())
first = [deck.pop(0)]
last = [deck.pop(len(deck) - 1)]
for i in range(1, count + 1):
tmp = faro_shuffle(deck)
deck = tmp
print(first + deck + last) |
class AccountInfo(object):
_LABELS = ('section',
'organization',
'account-group-code',
'account-code',
'account-group-name',
'account-name',
'amount')
def __init__(self):
self.section = None
self.organization = None
self.account_group_code = None
self.account_code = None
self.account_group_name = None
self.account_name = None
self.amount = None
def equal(self, other):
return self.equal_except_for_amount(other) \
and self.account_amount == other.account_amount
def equal_except_for_amount(self, other):
return self.section == other.section \
and self.organization == other.organization \
and self.account_group_code == other.account_group_code \
and self.account_code == other.account_code \
and self.account_group_name == other.account_group_name \
and self.account_name == other.account_name
def get_category_code(self):
# '95011212999' -> '95'
if self.account_code is None:
return None
return self.account_code[0:2]
def overwrite_by_valid_slots(self, child):
if self._valid_slot(child.section):
self.section = child.section
if self._valid_slot(child.organization):
self.organization = child.organization
if self._valid_slot(child.account_group_code):
self.account_group_code = child.account_group_code
if self._valid_slot(child.account_code):
self.account_code = child.account_code
if self._valid_slot(child.account_group_name):
self.account_group_name = child.account_group_name
if self._valid_slot(child.account_name):
self.account_name = child.account_name
if self._valid_slot(child.amount):
self.amount = child.amount
def print(self):
print('section: %s' % self.section)
print('organization: %s' % self.organization)
print('account-group-code: %s' % self.account_group_code)
print('account-code: %s' % self.account_code)
print('account-group-name: %s' % self.account_group_name)
print('account-name: %s' % self.account_name)
print('amount: %s' % self.amount)
print('valid: %s' % self.valid_info())
def refill_to_empty_slots(self, label):
if self._empty_slot(self.section) and self._valid_slot(label.section):
self.section = label.section
if self._empty_slot(self.organization) and self._valid_slot(label.organization):
self.organization = label.organization
if self._empty_slot(self.account_group_code) and self._valid_slot(label.account_group_code):
self.account_group_code = label.account_group_code
if self._empty_slot(self.account_code) and self._valid_slot(label.account_code):
self.account_code = label.account_code
if self._empty_slot(self.account_group_name) and self._valid_slot(label.account_group_name):
self.account_group_name = label.account_group_name
if self._empty_slot(self.account_name) and self._valid_slot(label.account_name):
self.account_name = label.account_name
if self._empty_slot(self.amount) and self._valid_slot(label.amount):
self.amount = label.amount
def valid_info(self):
return self.account_code != None and len(self.account_code) > 0 \
and self.amount != None and type(self.amount) is int \
and self.account_name != None and len(self.account_name) > 0
def _empty_slot(self, slot):
return slot == None or slot == ''
def _valid_slot(self, slot):
return slot != None and slot != ''
| class Accountinfo(object):
_labels = ('section', 'organization', 'account-group-code', 'account-code', 'account-group-name', 'account-name', 'amount')
def __init__(self):
self.section = None
self.organization = None
self.account_group_code = None
self.account_code = None
self.account_group_name = None
self.account_name = None
self.amount = None
def equal(self, other):
return self.equal_except_for_amount(other) and self.account_amount == other.account_amount
def equal_except_for_amount(self, other):
return self.section == other.section and self.organization == other.organization and (self.account_group_code == other.account_group_code) and (self.account_code == other.account_code) and (self.account_group_name == other.account_group_name) and (self.account_name == other.account_name)
def get_category_code(self):
if self.account_code is None:
return None
return self.account_code[0:2]
def overwrite_by_valid_slots(self, child):
if self._valid_slot(child.section):
self.section = child.section
if self._valid_slot(child.organization):
self.organization = child.organization
if self._valid_slot(child.account_group_code):
self.account_group_code = child.account_group_code
if self._valid_slot(child.account_code):
self.account_code = child.account_code
if self._valid_slot(child.account_group_name):
self.account_group_name = child.account_group_name
if self._valid_slot(child.account_name):
self.account_name = child.account_name
if self._valid_slot(child.amount):
self.amount = child.amount
def print(self):
print('section: %s' % self.section)
print('organization: %s' % self.organization)
print('account-group-code: %s' % self.account_group_code)
print('account-code: %s' % self.account_code)
print('account-group-name: %s' % self.account_group_name)
print('account-name: %s' % self.account_name)
print('amount: %s' % self.amount)
print('valid: %s' % self.valid_info())
def refill_to_empty_slots(self, label):
if self._empty_slot(self.section) and self._valid_slot(label.section):
self.section = label.section
if self._empty_slot(self.organization) and self._valid_slot(label.organization):
self.organization = label.organization
if self._empty_slot(self.account_group_code) and self._valid_slot(label.account_group_code):
self.account_group_code = label.account_group_code
if self._empty_slot(self.account_code) and self._valid_slot(label.account_code):
self.account_code = label.account_code
if self._empty_slot(self.account_group_name) and self._valid_slot(label.account_group_name):
self.account_group_name = label.account_group_name
if self._empty_slot(self.account_name) and self._valid_slot(label.account_name):
self.account_name = label.account_name
if self._empty_slot(self.amount) and self._valid_slot(label.amount):
self.amount = label.amount
def valid_info(self):
return self.account_code != None and len(self.account_code) > 0 and (self.amount != None) and (type(self.amount) is int) and (self.account_name != None) and (len(self.account_name) > 0)
def _empty_slot(self, slot):
return slot == None or slot == ''
def _valid_slot(self, slot):
return slot != None and slot != '' |
class WitEmulator(object):
def __init__(self):
self.name='wit'
def normalise_request_json(self,data):
_data = {}
_data["text"]=data['q'][0]
return _data
def normalise_response_json(self,data):
print('plain response {0}'.format(data))
return [
{
"_text": data["text"],
"confidence": None,
"intent": data["intent"],
"entities" : {key:{"confidence":None,"type":"value","value":val} for key,val in data["entities"].items()}
}
]
| class Witemulator(object):
def __init__(self):
self.name = 'wit'
def normalise_request_json(self, data):
_data = {}
_data['text'] = data['q'][0]
return _data
def normalise_response_json(self, data):
print('plain response {0}'.format(data))
return [{'_text': data['text'], 'confidence': None, 'intent': data['intent'], 'entities': {key: {'confidence': None, 'type': 'value', 'value': val} for (key, val) in data['entities'].items()}}] |
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def bgcd(a, b):
if b == 0:
return a
if a == 0:
return b
if a & 1:
if b & 1:
return bgcd((a - b) >> 1, b)
else:
return bgcd(a, b >> 1)
else:
if b & 1:
return bgcd(a >> 1, b)
else:
return bgcd(a >> 1, b >> 1) << 1
n, m = [int(x) for x in raw_input().split(" ")]
result = 0
for i in range(1, n + 1):
for j in range(1, m + 1):
result += bgcd(i, j)
| def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def bgcd(a, b):
if b == 0:
return a
if a == 0:
return b
if a & 1:
if b & 1:
return bgcd(a - b >> 1, b)
else:
return bgcd(a, b >> 1)
elif b & 1:
return bgcd(a >> 1, b)
else:
return bgcd(a >> 1, b >> 1) << 1
(n, m) = [int(x) for x in raw_input().split(' ')]
result = 0
for i in range(1, n + 1):
for j in range(1, m + 1):
result += bgcd(i, j) |
# Copyright 2013-2021 Aerospike, Inc.
#
# 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.
class LookupDict:
LOOKUP_MODE = 0
PREFIX_MODE = 1
SUFFIX_MODE = 2
def __init__(self, mode=None):
self._kv = {}
if mode == None:
mode = self.LOOKUP_MODE
self.mode = mode
def __setitem__(self, key, value):
return self.add(key, value)
def __getitem__(self, key):
return self.get(key)
def __delitem__(self, key):
self.remove(key)
def __str__(self):
return str(self._kv)
def __len__(self):
return len(self._kv)
def __contains__(self, k):
try:
self.get_key(k)
return True
except Exception:
return False
def _filter(self, k, keys):
return [key for key in keys if k in key]
def _get_prefix(self, key, min_prefix_len=1):
# There should only be one key found
keys = self._get_key_by_filter(key, self._prefix_filter)
if len(keys) > 1:
raise KeyError("Unable to get prefix for an ambiguous key: '%s'" % (key))
if min_prefix_len == 0:
return ""
# Filter these keys
keys = self._kv.keys()
key = list(key)
prefix = ""
while len(keys) > 1:
prefix += key.pop(0)
keys = self._prefix_filter(prefix, keys)
if len(prefix) >= min_prefix_len:
return prefix
try:
k = keys[0]
if len(k) <= min_prefix_len:
return k
return k[:min_prefix_len]
except Exception:
return prefix
def _prefix_filter(self, prefix, keys):
return [key for key in keys if key.startswith(prefix)]
def _get_suffix(self, key, min_suffix_len=1):
# There should only be one key found
keys = self._get_key_by_filter(key, self._suffix_filter)
if len(keys) > 1:
raise KeyError("Unable to get suffix for an ambiguous key: '%s'" % (key))
if min_suffix_len == 0:
return ""
# Filter these keys
keys = self._kv.keys()
key = list(key)
suffix = ""
while len(keys) > 1:
suffix = key.pop() + suffix
keys = self._suffix_filter(suffix, keys)
if len(suffix) >= min_suffix_len:
return suffix
try:
k = keys[0]
if len(k) <= min_suffix_len:
return k
return k[len(k) - min_suffix_len :]
except Exception:
return suffix
def _suffix_filter(self, suffix, keys):
return [key for key in keys if key.endswith(suffix)]
def _get_key_by_filter(self, k, f):
keys = f(k, self.keys())
if len(keys) == 0:
raise KeyError("Unable to find keys with '%s'" % (k))
return keys
def add(self, key, data):
self._kv[key] = data
def get_key(self, k):
if self.mode == self.PREFIX_MODE:
return self._get_key_by_filter(k, self._prefix_filter)
if self.mode == self.SUFFIX_MODE:
return self._get_key_by_filter(k, self._suffix_filter)
return self._get_key_by_filter(k, self._filter)
def keys(self):
return list(self._kv.keys())
def get(self, k):
keys = self.get_key(k)
return [self._kv[key] for key in keys]
def remove(self, k):
keys = self.get_key(k)
if len(keys) > 1:
raise KeyError("Prefix may not be ambiguous for removal: %s" % (k))
value = self._kv[keys[0]]
del self._kv[keys[0]]
return value
def get_shortname(self, key, min_prefix_len=1, min_suffix_len=1):
if self.mode == self.PREFIX_MODE:
return self._get_prefix(key, min_prefix_len=min_prefix_len)
if self.mode == self.SUFFIX_MODE:
return self._get_suffix(key, min_suffix_len=min_suffix_len)
# There should only be one key found
keys = self.get_key(key)
if len(keys) > 1:
raise KeyError("Unable to get shortname for an ambiguous key: '%s'" % (key))
if min_prefix_len + min_suffix_len >= len(key):
return key
short_format = "%s...%s"
p = self._get_prefix(key, min_prefix_len=min_prefix_len)
s = self._get_suffix(key, min_suffix_len=min_suffix_len)
shortname = short_format % (p, s)
if len(shortname) >= len(key):
return key
return shortname
class PrefixDict(LookupDict):
def __init__(self):
super(PrefixDict, self).__init__(self.PREFIX_MODE)
def get_prefix(self, key):
return self.get_shortname(key)
| class Lookupdict:
lookup_mode = 0
prefix_mode = 1
suffix_mode = 2
def __init__(self, mode=None):
self._kv = {}
if mode == None:
mode = self.LOOKUP_MODE
self.mode = mode
def __setitem__(self, key, value):
return self.add(key, value)
def __getitem__(self, key):
return self.get(key)
def __delitem__(self, key):
self.remove(key)
def __str__(self):
return str(self._kv)
def __len__(self):
return len(self._kv)
def __contains__(self, k):
try:
self.get_key(k)
return True
except Exception:
return False
def _filter(self, k, keys):
return [key for key in keys if k in key]
def _get_prefix(self, key, min_prefix_len=1):
keys = self._get_key_by_filter(key, self._prefix_filter)
if len(keys) > 1:
raise key_error("Unable to get prefix for an ambiguous key: '%s'" % key)
if min_prefix_len == 0:
return ''
keys = self._kv.keys()
key = list(key)
prefix = ''
while len(keys) > 1:
prefix += key.pop(0)
keys = self._prefix_filter(prefix, keys)
if len(prefix) >= min_prefix_len:
return prefix
try:
k = keys[0]
if len(k) <= min_prefix_len:
return k
return k[:min_prefix_len]
except Exception:
return prefix
def _prefix_filter(self, prefix, keys):
return [key for key in keys if key.startswith(prefix)]
def _get_suffix(self, key, min_suffix_len=1):
keys = self._get_key_by_filter(key, self._suffix_filter)
if len(keys) > 1:
raise key_error("Unable to get suffix for an ambiguous key: '%s'" % key)
if min_suffix_len == 0:
return ''
keys = self._kv.keys()
key = list(key)
suffix = ''
while len(keys) > 1:
suffix = key.pop() + suffix
keys = self._suffix_filter(suffix, keys)
if len(suffix) >= min_suffix_len:
return suffix
try:
k = keys[0]
if len(k) <= min_suffix_len:
return k
return k[len(k) - min_suffix_len:]
except Exception:
return suffix
def _suffix_filter(self, suffix, keys):
return [key for key in keys if key.endswith(suffix)]
def _get_key_by_filter(self, k, f):
keys = f(k, self.keys())
if len(keys) == 0:
raise key_error("Unable to find keys with '%s'" % k)
return keys
def add(self, key, data):
self._kv[key] = data
def get_key(self, k):
if self.mode == self.PREFIX_MODE:
return self._get_key_by_filter(k, self._prefix_filter)
if self.mode == self.SUFFIX_MODE:
return self._get_key_by_filter(k, self._suffix_filter)
return self._get_key_by_filter(k, self._filter)
def keys(self):
return list(self._kv.keys())
def get(self, k):
keys = self.get_key(k)
return [self._kv[key] for key in keys]
def remove(self, k):
keys = self.get_key(k)
if len(keys) > 1:
raise key_error('Prefix may not be ambiguous for removal: %s' % k)
value = self._kv[keys[0]]
del self._kv[keys[0]]
return value
def get_shortname(self, key, min_prefix_len=1, min_suffix_len=1):
if self.mode == self.PREFIX_MODE:
return self._get_prefix(key, min_prefix_len=min_prefix_len)
if self.mode == self.SUFFIX_MODE:
return self._get_suffix(key, min_suffix_len=min_suffix_len)
keys = self.get_key(key)
if len(keys) > 1:
raise key_error("Unable to get shortname for an ambiguous key: '%s'" % key)
if min_prefix_len + min_suffix_len >= len(key):
return key
short_format = '%s...%s'
p = self._get_prefix(key, min_prefix_len=min_prefix_len)
s = self._get_suffix(key, min_suffix_len=min_suffix_len)
shortname = short_format % (p, s)
if len(shortname) >= len(key):
return key
return shortname
class Prefixdict(LookupDict):
def __init__(self):
super(PrefixDict, self).__init__(self.PREFIX_MODE)
def get_prefix(self, key):
return self.get_shortname(key) |
'''
Doc Header
'''
def test_this1():
assert 1 == 1, "This should never fail"
| """
Doc Header
"""
def test_this1():
assert 1 == 1, 'This should never fail' |
name = 'stackdandelion'
aliases = ['stackdandelions', 'fixdandelionstacking']
fix_dandelion_stacking_fixed = False
async def run(message):
'Fixes dandelion stacking.'
global fix_dandelion_stacking_fixed
if not fix_dandelion_stacking_fixed:
await message.send('Dandelion stacking has been fixed.')
else:
await message.send('Dandelion stacking is now broken again.')
fix_dandelion_stacking_fixed = not fix_dandelion_stacking_fixed
| name = 'stackdandelion'
aliases = ['stackdandelions', 'fixdandelionstacking']
fix_dandelion_stacking_fixed = False
async def run(message):
"""Fixes dandelion stacking."""
global fix_dandelion_stacking_fixed
if not fix_dandelion_stacking_fixed:
await message.send('Dandelion stacking has been fixed.')
else:
await message.send('Dandelion stacking is now broken again.')
fix_dandelion_stacking_fixed = not fix_dandelion_stacking_fixed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.