content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def main():
n = int(input())
a = list(map(int,input().split()))
count2 = 0
count4 = 0
for e in a:
if e%2 == 0:
count2 += 1
if e%4 == 0:
count4 += 1
if n == 3 and count4:
print("Yes")
return
if count2 == n:
print("Yes")
return
if count4 >= n-count2:
print("Yes")
return
if n%2 and n//2 == count4:
print("Yes")
return
print("No")
if __name__ == "__main__":
main() | def main():
n = int(input())
a = list(map(int, input().split()))
count2 = 0
count4 = 0
for e in a:
if e % 2 == 0:
count2 += 1
if e % 4 == 0:
count4 += 1
if n == 3 and count4:
print('Yes')
return
if count2 == n:
print('Yes')
return
if count4 >= n - count2:
print('Yes')
return
if n % 2 and n // 2 == count4:
print('Yes')
return
print('No')
if __name__ == '__main__':
main() |
class Node:
def __init__(self, game, parent, action):
self.game = game
self.parent = parent
self.action = action
self.player = game.get_current_player()
self.score = game.get_score()
self.children = []
self.visits = 0
def is_leaf(self):
return not self.children
def add_child(self, node):
self.children.append(node) | class Node:
def __init__(self, game, parent, action):
self.game = game
self.parent = parent
self.action = action
self.player = game.get_current_player()
self.score = game.get_score()
self.children = []
self.visits = 0
def is_leaf(self):
return not self.children
def add_child(self, node):
self.children.append(node) |
def product(x, y):
ret = list()
for _x in x:
for _y in y:
ret.append((_x, _y))
return ret
print(product([1, 2, 3], ["a", "b"]))
| def product(x, y):
ret = list()
for _x in x:
for _y in y:
ret.append((_x, _y))
return ret
print(product([1, 2, 3], ['a', 'b'])) |
# configuration
class Config:
DEBUG = True
# db
SQLALCHEMY_DATABASE_URI = 'mysql://root:root@localhost/djangoapp'
SQLALCHEMY_TRACK_MODIFICATIONS = False
| class Config:
debug = True
sqlalchemy_database_uri = 'mysql://root:root@localhost/djangoapp'
sqlalchemy_track_modifications = False |
class VaultConfig(object):
def __init__(self):
self.method = None
self.address = None
self.username = None
self.namespace = None
self.studio = None
self.mount_point = None
self.connect = False
| class Vaultconfig(object):
def __init__(self):
self.method = None
self.address = None
self.username = None
self.namespace = None
self.studio = None
self.mount_point = None
self.connect = False |
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Garfield Lee Freeman (@shinmog)
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
'''
FACTS = r'''
notes:
- As this is a facts module, check mode is not supported.
options:
search_type:
description:
- How to interpret the value given for the primary param.
choices:
- exact
- substring
- regex
default: 'exact'
details:
description:
- Whether to retrieve full detailed results or not.
type: bool
default: false
'''
FACTS_WITHOUT_DETAILS = r'''
notes:
- As this is a facts module, check mode is not supported.
options:
search_type:
description:
- How to interpret the value given for the primary param.
choices:
- exact
- substring
- regex
default: 'exact'
'''
STATE = r'''
options:
state:
description:
- The state.
type: str
default: 'present'
choices:
- present
- absent
'''
| class Moduledocfragment(object):
documentation = '\n'
facts = "\nnotes:\n - As this is a facts module, check mode is not supported.\noptions:\n search_type:\n description:\n - How to interpret the value given for the primary param.\n choices:\n - exact\n - substring\n - regex\n default: 'exact'\n details:\n description:\n - Whether to retrieve full detailed results or not.\n type: bool\n default: false\n"
facts_without_details = "\nnotes:\n - As this is a facts module, check mode is not supported.\noptions:\n search_type:\n description:\n - How to interpret the value given for the primary param.\n choices:\n - exact\n - substring\n - regex\n default: 'exact'\n"
state = "\noptions:\n state:\n description:\n - The state.\n type: str\n default: 'present'\n choices:\n - present\n - absent\n" |
#!/usr/bin/env python3
class Canvas(object):
def __init__(self, width, height):
self.width = width
self.height = height
self._area = []
for _ in range(height):
self._area.append([c for c in ' ' * width])
def _inside_canvas(self, x, y):
return 0 < x <= self.width and 0 < y <= self.height
def draw_line(self, x1, y1, x2, y2, colour='x'):
if self._inside_canvas(x1, y1) and self._inside_canvas(x2, y2):
if x1 == x2: # vertical line
for i in range(y1 - 1, y2):
self._area[i][x1 - 1] = colour
elif y1 == y2: # horizontal line
for i in range(x1 - 1, x2):
self._area[y1 - 1][i] = colour
def draw_rectangle(self, x1, y1, x2, y2, colour='x'):
if self._inside_canvas(x1, y1) and self._inside_canvas(x2, y2):
self.draw_line(x1, y1, x1, y2, colour)
self.draw_line(x1, y1, x2, y1, colour)
self.draw_line(x2, y1, x2, y2, colour)
self.draw_line(x1, y2, x2, y2, colour)
def _change_fill_colour(self, x, y, new_colour, old_colour):
if self._inside_canvas(x, y):
if self._area[y - 1][x - 1] == old_colour:
self._area[y - 1][x - 1] = new_colour
# recursively apply colour on surrounding points
self._change_fill_colour(x, y + 1, new_colour, old_colour)
self._change_fill_colour(x + 1, y, new_colour, old_colour)
self._change_fill_colour(x, y - 1, new_colour, old_colour)
self._change_fill_colour(x - 1, y, new_colour, old_colour)
def bucket_fill(self, x, y, colour):
if colour and self._inside_canvas(x, y):
existing_colour = self._area[y - 1][x - 1]
if existing_colour != colour:
self._change_fill_colour(x, y, colour, existing_colour)
def __str__(self):
canvas_str = '-' * (self.width + 2) + '\n'
for line in self._area:
canvas_str += '|' + ''.join(line) + '|\n'
canvas_str += '-' * (self.width + 2)
return canvas_str
| class Canvas(object):
def __init__(self, width, height):
self.width = width
self.height = height
self._area = []
for _ in range(height):
self._area.append([c for c in ' ' * width])
def _inside_canvas(self, x, y):
return 0 < x <= self.width and 0 < y <= self.height
def draw_line(self, x1, y1, x2, y2, colour='x'):
if self._inside_canvas(x1, y1) and self._inside_canvas(x2, y2):
if x1 == x2:
for i in range(y1 - 1, y2):
self._area[i][x1 - 1] = colour
elif y1 == y2:
for i in range(x1 - 1, x2):
self._area[y1 - 1][i] = colour
def draw_rectangle(self, x1, y1, x2, y2, colour='x'):
if self._inside_canvas(x1, y1) and self._inside_canvas(x2, y2):
self.draw_line(x1, y1, x1, y2, colour)
self.draw_line(x1, y1, x2, y1, colour)
self.draw_line(x2, y1, x2, y2, colour)
self.draw_line(x1, y2, x2, y2, colour)
def _change_fill_colour(self, x, y, new_colour, old_colour):
if self._inside_canvas(x, y):
if self._area[y - 1][x - 1] == old_colour:
self._area[y - 1][x - 1] = new_colour
self._change_fill_colour(x, y + 1, new_colour, old_colour)
self._change_fill_colour(x + 1, y, new_colour, old_colour)
self._change_fill_colour(x, y - 1, new_colour, old_colour)
self._change_fill_colour(x - 1, y, new_colour, old_colour)
def bucket_fill(self, x, y, colour):
if colour and self._inside_canvas(x, y):
existing_colour = self._area[y - 1][x - 1]
if existing_colour != colour:
self._change_fill_colour(x, y, colour, existing_colour)
def __str__(self):
canvas_str = '-' * (self.width + 2) + '\n'
for line in self._area:
canvas_str += '|' + ''.join(line) + '|\n'
canvas_str += '-' * (self.width + 2)
return canvas_str |
'''
Praveen Manimaran
CIS 41A Spring 2020
Exercise A
'''
height = 2.9
width = 7.1
height = height// 2
width = width// 2
area = height*width
print("height: ",height)
print("width: ",width)
print("area: ",area) | """
Praveen Manimaran
CIS 41A Spring 2020
Exercise A
"""
height = 2.9
width = 7.1
height = height // 2
width = width // 2
area = height * width
print('height: ', height)
print('width: ', width)
print('area: ', area) |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
class Solution:
def longestPalindrome(self,s):
dp = [[False for _ in range(len(s))] for _ in range(len(s))]
l,r = 0,0
for head in range(len(s)-2,0,-1):
for tail in range(head,len(s)):
if s[head] == s[tail] and (tail-head < 3 or dp[head+1][tail-1]):
dp[head][tail] = True
if r-l < tail-head:
l,r=head,tail
return s[l:r+1]
a=Solution()
print(a.longestPalindrome("babad"))
| class Solution:
def longest_palindrome(self, s):
dp = [[False for _ in range(len(s))] for _ in range(len(s))]
(l, r) = (0, 0)
for head in range(len(s) - 2, 0, -1):
for tail in range(head, len(s)):
if s[head] == s[tail] and (tail - head < 3 or dp[head + 1][tail - 1]):
dp[head][tail] = True
if r - l < tail - head:
(l, r) = (head, tail)
return s[l:r + 1]
a = solution()
print(a.longestPalindrome('babad')) |
#!/usr/bin/env python3
def part1():
data = open('day8_input.txt').read().splitlines()
one = 2 # 2 segments light up to display 1
four = 4
seven = 3
eight = 7
output = [i.rpartition('|')[2].strip() for i in data]
counter = 0
for i in range(len(output)):
strings = output[i].split()
for string in strings:
length = len(string)
if length == one or length == four or length == seven or length == eight:
counter += 1
print(counter)
def part2():
data = open('day8_input.txt').read().splitlines()
input = [i.rpartition('|')[0].strip() for i in data]
output = [i.rpartition('|')[2].strip() for i in data]
#signals = ['cagedb', 'ab', 'gcdfa','fbcad', 'eafb','cdfbe', 'dab', 'acedgfb']
summation = 0
for i in range(len(input)):
signals = input[i].split()
display = output[i].split()
one = find1478(signals, 2)
four = find1478(signals, 4)
seven = find1478(signals, 3)
eight = find1478(signals, 7)
three = findDigit(signals, one, 5)
six = find6(signals, one, 6)
nine = findDigit(signals, four, 6)
zero = find0(signals, six, nine, 6)
five = find5(signals, nine, three, 5)
two = find2(signals, five, three, 5)
allDigits = [zero, one, two, three, four, five, six, seven, eight, nine]
number = ''
for j in display:
for i in range(len(allDigits)):
if (containsAll(j, allDigits[i])):
number += str(i)
summation += int(number)
print(summation)
# function to check if all characters in set are in str
def containsAll(str, set):
if(len(str) != len(set)):
return False
for c in set:
if c not in str:
return False
return True
def containsChars(str, set):
for c in set:
if c not in str:
return False
return True
#little helper functions to find all the digits
# helper to find 1,4,7,8
def find1478(signals, length):
for i in range(len(signals)):
string = signals[i]
if (len(string) == length):
return string
# helper to find 3, 5, 9
def findDigit(signals, digit, length):
for string in signals:
if (len(string) == length) and containsChars(string, digit):
return string
# helper to find 6
def find6(signals, one, length):
for string in signals:
# print(string)
if (len(string) == length and (not containsChars(string,one))):
return string
# helper to find 0
def find0(signals, six, nine, length):
for string in signals:
if ((len(string) == length) and (not string == six) and (not string ==nine)):
return string
# helper to find 5
def find5(signals, nine, three, length):
for string in signals:
if(len(string) == length) and string != three and containsChars(nine,string):
return string
# helper to find 2
def find2(signals, five, three, length):
for string in signals:
if((len(string) == length and string!= five and string!= three)):
return string
part1()
part2() | def part1():
data = open('day8_input.txt').read().splitlines()
one = 2
four = 4
seven = 3
eight = 7
output = [i.rpartition('|')[2].strip() for i in data]
counter = 0
for i in range(len(output)):
strings = output[i].split()
for string in strings:
length = len(string)
if length == one or length == four or length == seven or (length == eight):
counter += 1
print(counter)
def part2():
data = open('day8_input.txt').read().splitlines()
input = [i.rpartition('|')[0].strip() for i in data]
output = [i.rpartition('|')[2].strip() for i in data]
summation = 0
for i in range(len(input)):
signals = input[i].split()
display = output[i].split()
one = find1478(signals, 2)
four = find1478(signals, 4)
seven = find1478(signals, 3)
eight = find1478(signals, 7)
three = find_digit(signals, one, 5)
six = find6(signals, one, 6)
nine = find_digit(signals, four, 6)
zero = find0(signals, six, nine, 6)
five = find5(signals, nine, three, 5)
two = find2(signals, five, three, 5)
all_digits = [zero, one, two, three, four, five, six, seven, eight, nine]
number = ''
for j in display:
for i in range(len(allDigits)):
if contains_all(j, allDigits[i]):
number += str(i)
summation += int(number)
print(summation)
def contains_all(str, set):
if len(str) != len(set):
return False
for c in set:
if c not in str:
return False
return True
def contains_chars(str, set):
for c in set:
if c not in str:
return False
return True
def find1478(signals, length):
for i in range(len(signals)):
string = signals[i]
if len(string) == length:
return string
def find_digit(signals, digit, length):
for string in signals:
if len(string) == length and contains_chars(string, digit):
return string
def find6(signals, one, length):
for string in signals:
if len(string) == length and (not contains_chars(string, one)):
return string
def find0(signals, six, nine, length):
for string in signals:
if len(string) == length and (not string == six) and (not string == nine):
return string
def find5(signals, nine, three, length):
for string in signals:
if len(string) == length and string != three and contains_chars(nine, string):
return string
def find2(signals, five, three, length):
for string in signals:
if len(string) == length and string != five and (string != three):
return string
part1()
part2() |
valores = input().split()
x, y = valores
x = float(x)
y = float(y)
if(x == 0.0 and y == 0.0):
print('Origem')
if(x == 0.0 and y != 0.0):
print('Eixo Y')
if(x != 0.0 and y == 0.0):
print('Eixo X')
if(x > 0 and y > 0):
print('Q1')
if(x < 0 and y > 0):
print('Q2')
if(x < 0 and y < 0):
print('Q3')
if(x > 0 and y < 0):
print('Q4') | valores = input().split()
(x, y) = valores
x = float(x)
y = float(y)
if x == 0.0 and y == 0.0:
print('Origem')
if x == 0.0 and y != 0.0:
print('Eixo Y')
if x != 0.0 and y == 0.0:
print('Eixo X')
if x > 0 and y > 0:
print('Q1')
if x < 0 and y > 0:
print('Q2')
if x < 0 and y < 0:
print('Q3')
if x > 0 and y < 0:
print('Q4') |
#! python3
# Configuration file for cf-py-importer
globalSettings = {
# FQDN or IP address of the CyberFlood Controller. Do NOT prefix with https://
"cfControllerAddress": "your.cyberflood.controller",
"userName": "your@login",
"userPassword": "yourPassword"
}
| global_settings = {'cfControllerAddress': 'your.cyberflood.controller', 'userName': 'your@login', 'userPassword': 'yourPassword'} |
#OPCODE_Init = b"0"
OPCODE_ActivateLayer0 = b"1"
OPCODE_ActivateLayer1 = b"2"
OPCODE_ActivateLayer2 = b"3"
OPCODE_ActivateLayer3 = b"4"
OPCODE_NextAI = b"5"
OPCODE_NewTournament = b"6"
OPCODE_Exit = b"7" | opcode__activate_layer0 = b'1'
opcode__activate_layer1 = b'2'
opcode__activate_layer2 = b'3'
opcode__activate_layer3 = b'4'
opcode__next_ai = b'5'
opcode__new_tournament = b'6'
opcode__exit = b'7' |
greek_alp = {
"Alpha" : "Alp",
"Beta" : "Bet",
"Gamma" : "Gam",
"Delta" : "Del",
"Epsilon" : "Eps",
"Zeta" : "Zet",
"Eta" : "Eta",
"Theta" : "The",
"Iota" : "Iot",
"Kappa" : "Kap",
"Lambda" : "Lam",
"Mu" : "Mu ",
"Nu" : "Nu ",
"Xi" : "Xi ",
"Omicron" : "Omi",
"Pi" : "Pi ",
"Rho" : "Rho",
"Sigma" : "Sig",
"Tau" : "Tau",
"Upsilon" : "Ups",
"Phi" : "Phi",
"Chi" : "Chi",
"Psi" : "Psi",
"Omega" : "Ome",
}
greek_unicode = {
"Alp" : "\\u03b1",
"Bet" : "\\u03b2",
"Gam" : "\\u03b3",
"Del" : "\\u03b4",
"Eps" : "\\u03b5",
"Zet" : "\\u03b6",
"Eta" : "\\u03b7",
"The" : "\\u03b8",
"Iot" : "\\u03b9",
"Kap" : "\\u03ba",
"Lam" : "\\u03bb",
"Mu " : "\\u03bc",
"Nu " : "\\u03bd",
"Xi " : "\\u03be",
"Omi" : "\\u03bf",
"Pi " : "\\u03c0",
"Rho" : "\\u03c1",
"Sig" : "\\u03c3",
"Tau" : "\\u03c4",
"Ups" : "\\u03c5",
"Phi" : "\\u03c6",
"Chi" : "\\u03c7",
"Psi" : "\\u03c8",
"Ome" : "\\u03c9",
}
| greek_alp = {'Alpha': 'Alp', 'Beta': 'Bet', 'Gamma': 'Gam', 'Delta': 'Del', 'Epsilon': 'Eps', 'Zeta': 'Zet', 'Eta': 'Eta', 'Theta': 'The', 'Iota': 'Iot', 'Kappa': 'Kap', 'Lambda': 'Lam', 'Mu': 'Mu ', 'Nu': 'Nu ', 'Xi': 'Xi ', 'Omicron': 'Omi', 'Pi': 'Pi ', 'Rho': 'Rho', 'Sigma': 'Sig', 'Tau': 'Tau', 'Upsilon': 'Ups', 'Phi': 'Phi', 'Chi': 'Chi', 'Psi': 'Psi', 'Omega': 'Ome'}
greek_unicode = {'Alp': '\\u03b1', 'Bet': '\\u03b2', 'Gam': '\\u03b3', 'Del': '\\u03b4', 'Eps': '\\u03b5', 'Zet': '\\u03b6', 'Eta': '\\u03b7', 'The': '\\u03b8', 'Iot': '\\u03b9', 'Kap': '\\u03ba', 'Lam': '\\u03bb', 'Mu ': '\\u03bc', 'Nu ': '\\u03bd', 'Xi ': '\\u03be', 'Omi': '\\u03bf', 'Pi ': '\\u03c0', 'Rho': '\\u03c1', 'Sig': '\\u03c3', 'Tau': '\\u03c4', 'Ups': '\\u03c5', 'Phi': '\\u03c6', 'Chi': '\\u03c7', 'Psi': '\\u03c8', 'Ome': '\\u03c9'} |
data = ["React", "Angular", "Svelte", "Vue"]
# or
data = [
{"value": "React", "label": "React"},
{"value": "Angular", "label": "Angular"},
{"value": "Svelte", "label": "Svelte"},
{"value": "Vue", "label": "Vue"},
]
| data = ['React', 'Angular', 'Svelte', 'Vue']
data = [{'value': 'React', 'label': 'React'}, {'value': 'Angular', 'label': 'Angular'}, {'value': 'Svelte', 'label': 'Svelte'}, {'value': 'Vue', 'label': 'Vue'}] |
FONT = "Arial"
FONT_SIZE_TINY = 8
FONT_SIZE_SMALL = 11
FONT_SIZE_REGULAR = 14
FONT_SIZE_LARGE = 16
FONT_SIZE_EXTRA_LARGE = 20
FONT_WEIGHT_LIGHT = 100
FONT_WEIGHT_REGULAR = 600
FONT_WEIGHT_BOLD = 900
| font = 'Arial'
font_size_tiny = 8
font_size_small = 11
font_size_regular = 14
font_size_large = 16
font_size_extra_large = 20
font_weight_light = 100
font_weight_regular = 600
font_weight_bold = 900 |
person = ('Nana', 25, 'piza')
# unpack mikonim person ro
# chandta ro ba ham takhsis midim
name, age, food = person
print(name)
print(age)
print(food)
person2 = ["ali", 26, "eli"]
name, age, food = person2
print(name)
print(age)
print(food)
# dictionary order nadare o nmishe tekrari dasht
dic = {'banana', 'blueberry'}
dic.add("kiwi")
# add mikone
print(dic)
# farghe set o dictionary ine k set key o value
# nadare faghat data gheyre tekrari dare
# vali dictionary ha key o value daran
lis = [1, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 8, 6]
no_duplicate = set(lis)
print(no_duplicate)
library1 = {'harry', 'hungry', 'ali'}
library2 = {'harry', 'eli'}
print(library2.union(library1))
# union baes mishe 2ta set ro ba ham edgham konim
print(library2.intersection(library1))
# intersection un chizi k eshterak ro mide
print(library2.difference(library1))
# un chizi k tu lib2 bashe ama tu lib1 nabashe
print(library1.clear())
dictionary = {'ali': 20, 'eli': 25, 'elnaz': 10}
print(dictionary['ali'])
# faghat value hamun key ro print mikone
print(dictionary.get("amo"))
# get baes mishe age nabashe bede none be jaye error
contacts = {"amir": 921,
"abolfazt": ['0912', "akbar"]}
print(contacts)
# dic tu dic
contacts = {"amir": {'phone': 921, 'email': "aboli@g"},
"abolfazt": ['0912', "akbar"]}
print(contacts["amir"]["email"])
sen="i am going to be the best python coder " \
"and will have a great life with elham"
word_count={
"I":1,"elham":1,'python':1
}
word_count["elham"] = word_count["elham"]+1
print(contacts.items())
#hamasho mide
print(contacts.keys())
#key haro mide
print(contacts.values())
#value haro mide
print(word_count)
word_count.pop("I")
#ye ite ro az dictionary pop mikone
print(word_count)
word_count.popitem()
#akharin item pop mikone
print(word_count)
d= {(1,2):1,5:7}
print(d.keys())
| person = ('Nana', 25, 'piza')
(name, age, food) = person
print(name)
print(age)
print(food)
person2 = ['ali', 26, 'eli']
(name, age, food) = person2
print(name)
print(age)
print(food)
dic = {'banana', 'blueberry'}
dic.add('kiwi')
print(dic)
lis = [1, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 8, 6]
no_duplicate = set(lis)
print(no_duplicate)
library1 = {'harry', 'hungry', 'ali'}
library2 = {'harry', 'eli'}
print(library2.union(library1))
print(library2.intersection(library1))
print(library2.difference(library1))
print(library1.clear())
dictionary = {'ali': 20, 'eli': 25, 'elnaz': 10}
print(dictionary['ali'])
print(dictionary.get('amo'))
contacts = {'amir': 921, 'abolfazt': ['0912', 'akbar']}
print(contacts)
contacts = {'amir': {'phone': 921, 'email': 'aboli@g'}, 'abolfazt': ['0912', 'akbar']}
print(contacts['amir']['email'])
sen = 'i am going to be the best python coder and will have a great life with elham'
word_count = {'I': 1, 'elham': 1, 'python': 1}
word_count['elham'] = word_count['elham'] + 1
print(contacts.items())
print(contacts.keys())
print(contacts.values())
print(word_count)
word_count.pop('I')
print(word_count)
word_count.popitem()
print(word_count)
d = {(1, 2): 1, 5: 7}
print(d.keys()) |
# -*- coding: utf-8 -*-
def main():
n = int(input())
a_score, b_score = 0, 0
for i in range(n):
ai, bi = map(int, input().split())
if ai > bi:
a_score += ai + bi
elif ai < bi:
b_score += ai + bi
else:
a_score += ai
b_score += bi
print(a_score, b_score)
if __name__ == '__main__':
main()
| def main():
n = int(input())
(a_score, b_score) = (0, 0)
for i in range(n):
(ai, bi) = map(int, input().split())
if ai > bi:
a_score += ai + bi
elif ai < bi:
b_score += ai + bi
else:
a_score += ai
b_score += bi
print(a_score, b_score)
if __name__ == '__main__':
main() |
UPWARDS = 1
UPDOWN = -1
FARAWAY = 1.0e39
SKYBOX_DISTANCE = 1.0e6
| upwards = 1
updown = -1
faraway = 1e+39
skybox_distance = 1000000.0 |
class Solution:
def checkStraightLine(self, coordinates: [[int]]) -> bool:
(x1, y1), (x2, y2) = coordinates[:2]
for i in range(2, len(coordinates)):
x, y = coordinates[i]
if (y2 - y1) * (x1 - x) != (y1 - y) * (x2 - x1):
return False
return True
| class Solution:
def check_straight_line(self, coordinates: [[int]]) -> bool:
((x1, y1), (x2, y2)) = coordinates[:2]
for i in range(2, len(coordinates)):
(x, y) = coordinates[i]
if (y2 - y1) * (x1 - x) != (y1 - y) * (x2 - x1):
return False
return True |
#coding: utf-8
LEFT = 'left'
X = 'x'
RIGHT = 'right'
WIDTH = 'width'
MAX_WIDTH = 'max_width'
MIN_WIDTH = 'min_width'
INNER_WIDTH = 'inner_width'
CENTER = 'center'
TOP = 'top'
Y = 'y'
BOTTOM = 'bottom'
HEIGHT = 'height'
MAX_HEIGHT = 'max_height'
MIN_HEIGHT = 'min_height'
INNER_HEIGHT = 'inner_height'
MIDDLE = 'middle'
GRID_SIZE = 'grid_size'
HORIZONTAL = 'horizontal'
VERTICAL = 'vertical'
PORTRAIT = 'portrait'
LANDSCAPE = 'landscape'
SQUARE = 'square'
SIZE = 'size'
| left = 'left'
x = 'x'
right = 'right'
width = 'width'
max_width = 'max_width'
min_width = 'min_width'
inner_width = 'inner_width'
center = 'center'
top = 'top'
y = 'y'
bottom = 'bottom'
height = 'height'
max_height = 'max_height'
min_height = 'min_height'
inner_height = 'inner_height'
middle = 'middle'
grid_size = 'grid_size'
horizontal = 'horizontal'
vertical = 'vertical'
portrait = 'portrait'
landscape = 'landscape'
square = 'square'
size = 'size' |
class Solution:
def validPalindrome(self, s: str) -> bool:
l, r = 0, len(s) - 1
while l < r:
if s[l] != s[r]:
return self._validPalindrome(s, l + 1, r) or self._validPalindrome(s, l, r - 1)
l += 1
r -= 1
return True
def _validPalindrome(self, s, left, right):
while left < right:
if s[left] != s[right]:
return False
left += 1
right -= 1
return True
| class Solution:
def valid_palindrome(self, s: str) -> bool:
(l, r) = (0, len(s) - 1)
while l < r:
if s[l] != s[r]:
return self._validPalindrome(s, l + 1, r) or self._validPalindrome(s, l, r - 1)
l += 1
r -= 1
return True
def _valid_palindrome(self, s, left, right):
while left < right:
if s[left] != s[right]:
return False
left += 1
right -= 1
return True |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isValidBST(self, root: Optional[TreeNode]) -> bool:
ary = []
self.traverse(root, ary)
return self.is_valid(ary)
# inorder
def traverse(self, root, ary):
if root.left is not None:
self.traverse(root.left, ary)
ary.append(root.val)
if root.right is not None:
self.traverse(root.right, ary)
def is_valid(self, ary):
for i in range(1, len(ary)):
if ary[i-1] >= ary[i]:
return False
return True
| class Solution:
def is_valid_bst(self, root: Optional[TreeNode]) -> bool:
ary = []
self.traverse(root, ary)
return self.is_valid(ary)
def traverse(self, root, ary):
if root.left is not None:
self.traverse(root.left, ary)
ary.append(root.val)
if root.right is not None:
self.traverse(root.right, ary)
def is_valid(self, ary):
for i in range(1, len(ary)):
if ary[i - 1] >= ary[i]:
return False
return True |
def solution(N, P):
ans = []
for c in P:
ans.append('S' if c == 'E' else 'E')
return ''.join(ans)
def main():
T = int(input())
for t in range(T):
N, P = int(input()), input()
answer = solution(N, P)
print('Case #' + str(t+1) + ': ' + answer)
if __name__ == '__main__':
main()
| def solution(N, P):
ans = []
for c in P:
ans.append('S' if c == 'E' else 'E')
return ''.join(ans)
def main():
t = int(input())
for t in range(T):
(n, p) = (int(input()), input())
answer = solution(N, P)
print('Case #' + str(t + 1) + ': ' + answer)
if __name__ == '__main__':
main() |
# https://codeforces.com/problemset/problem/1220/A
n, s = int(input()), input()
ones = s.count('n')
zeros = (n-(ones*3))//4
print(f"{'1 '*ones}{'0 '*zeros}") | (n, s) = (int(input()), input())
ones = s.count('n')
zeros = (n - ones * 3) // 4
print(f"{'1 ' * ones}{'0 ' * zeros}") |
# Reverse Nodes in k-Group: https://leetcode.com/problems/reverse-nodes-in-k-group/
# Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
# k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of k then left-out nodes, in the end, should remain as it is.
# You may not alter the values in the list's nodes, only nodes themselves may be changed.
# So this problem seems like we need to put in a for loop counting up to k and then reverse from start to k
# I think that we can probably pass the sort to another function to keep this code ab it clean
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
count = 0
cur = head
# Check to see if k is smaller than the length of the list
while count < k and cur:
cur = cur.next
count += 1
if count == k:
# Reverse from head to k
reversedList = self.reverse(head, k)
# Recursively call down the stack
head.next = self.reverseKGroup(cur, k)
return reversedList
# Otherwise we just return the list as is
return head
return
def reverse(self, head, k):
prev = None
cur = head
while k:
# Keep track of the node after k
ourNext = cur.next
cur.next = prev
prev = cur
cur = ourNext
k -= 1
return prev
# So the above works, what happens is that we call recursively down the list swapping k elements at a time and if there is more
# we call the function itself if we loop through the list and we don't reach k we are at the end and we start returning the list
# The bonus is that we assign the reversed k and keep them on the stack as we come up which really simplifies the problem
# This runs in o(n) and o(n/k) as we visit each node and store the value of n/k on the stack until we reach n
# Can we do better? I think so I know that we can recursively call through the list so I think that if we approach this problem
# as we go across from 0 -> n checking for index % k we can find the point where we need to end the reverse from! Then all we
# need is to call our reverse function like we did above and we should be good.
def reverseKGroup(self, head: ListNode, k: int) -> ListNode:
cur = head
# We need to check for the node that we point to from as it can't always be none
lastTail = None
# The new head
result = None
while cur:
count = 0
cur = head
# Loop over the values like before
while count < k and cur:
cur = cur.next
count += 1
# If we need to reverse keep track of the reversed list
if count == k:
reversedList = self.reverse(head, k)
# If we reveresed the first k update the new head
if not result:
result = reversedList
# if we have a node that is pointing to our start
# we need to point it to the new head
if lastTail:
lastTail.next = reversedList
# we need to update head to the cur pointer (to mirror the recursion)
lastTail = head
head = cur
# Even if we have gone through if we haven't pointed the last node to the new head
# we need to do that agin
if lastTail:
lastTail.next = head
# return either new head or the old head depending if k is in the length of the linked list
return result if result else head
# So the iterative step is the same thing like I explained there is a little bit of extra to handle if you have a node
# before you start reveresing. The difference is that this will run in o(n) and o(1) space as we are changing the result
# as we go along
# Score Card
# Did I need hints? Yes
# Did you finish within 30 min? n 45
# Was the solution optimal? The initial solution I though of definitely wasn't but when I got to thinking I solved in optimal
# improving on the intial
# Were there any bugs? Nope
# 3 3 3 4 = 3.25
| class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverse_k_group(self, head: ListNode, k: int) -> ListNode:
count = 0
cur = head
while count < k and cur:
cur = cur.next
count += 1
if count == k:
reversed_list = self.reverse(head, k)
head.next = self.reverseKGroup(cur, k)
return reversedList
return head
return
def reverse(self, head, k):
prev = None
cur = head
while k:
our_next = cur.next
cur.next = prev
prev = cur
cur = ourNext
k -= 1
return prev
def reverse_k_group(self, head: ListNode, k: int) -> ListNode:
cur = head
last_tail = None
result = None
while cur:
count = 0
cur = head
while count < k and cur:
cur = cur.next
count += 1
if count == k:
reversed_list = self.reverse(head, k)
if not result:
result = reversedList
if lastTail:
lastTail.next = reversedList
last_tail = head
head = cur
if lastTail:
lastTail.next = head
return result if result else head |
class Solution:
def isAnagram(self, s: str, t: str) -> bool:
h = {}
for i in s:
h[i] = h.get(i, 0) + 1
for j in t:
if h.get(j, 0) == 0:
return False
else:
h[j] -= 1
for k in h:
if h[k] >= 1:
return False
return True | class Solution:
def is_anagram(self, s: str, t: str) -> bool:
h = {}
for i in s:
h[i] = h.get(i, 0) + 1
for j in t:
if h.get(j, 0) == 0:
return False
else:
h[j] -= 1
for k in h:
if h[k] >= 1:
return False
return True |
#!/usr/bin/env python
# descriptors from http://www.winning-homebrew.com/beer-flavor-descriptors.html
aroma_basic = [
'malty', 'grainy', 'sweet',
'corn', 'hay', 'straw',
'cracker', 'bicuity',
'caramel', 'toast', 'roast',
'coffee', 'espresso', 'burnt',
'alcohol', 'tobacco', 'gunpowder',
'leather', 'pine', 'grass',
'dank', 'piney', 'floral',
'perfume'
]
aroma_dark_fruit = [
'raisins', 'currant', 'plum',
'dates', 'prunes', 'figs',
'blackberry', 'blueberry'
]
aroma_light_fruit = [
'banana', 'pineapple', 'apricot',
'pear', 'apple', 'nectarine',
'peach', 'mango'
]
aroma_citrus = [
'lemon', 'lime', 'orange',
'tangerine', 'clementine',
'grapefruit', 'grapefruity', 'peel',
'zest', 'citrus', 'orangey',
]
aroma_other = [
'metallic', 'vinegar', 'copper',
'cidery', 'champagne', 'astringent',
'chlorine'
]
aroma_spices_yeast = [
'phenolic', 'pepper', 'clove', 'anise',
'licorice', 'smoke', 'bacon', 'fatty',
'nutty', 'butterscotch', 'vanilla',
'earthy', 'woody', 'horsey',
'bread', 'saddle', 'musty',
'barnyard', 'spice'
]
appearance_color = [
'honey', 'caramel', 'red',
'brown', 'rootbeer', 'amber',
'chestnut', 'dark', 'apricot',
'orange', 'black', 'burnt',
'auburn', 'garnet', 'ruby',
'copper', 'gold'
]
appearance_clarity = [
'brilliant', 'hazy', 'cloudy',
'turbid', 'opaque', 'clear',
'crystal', 'bright', 'dull',
'haze'
]
appearance_head = [
'persistent', 'rocky', 'large',
'fluffy', 'dissipating', 'lingering',
'white', 'offwhite', 'tan',
'frothy', 'delicate'
]
taste_basic = [
'roasted', 'bready', 'bitter',
'sweet', 'spicy', 'fruity',
'chocolate', 'caramel', 'toffee',
'coffee', 'malty', 'tart',
'subtle', 'woodsy', 'earthy',
'sulfur', 'sulfuric'
]
taste_intensity = [
'assertive', 'mild', 'bold',
'balanced', 'robust', 'intense',
'metallic', 'harsh', 'complex',
'delicate', 'refined', 'hearty'
]
taste_finish = [
'dry', 'fruity', 'sweet',
'alcoholic', 'warming', 'bitter',
'acidic', 'buttery', 'wet',
'quenching', 'lingering'
]
palate_mouthfeel = [
'smooth', 'silky', 'velvety',
'prickly', 'tingly', 'creamy',
'warming', 'viscous', 'hot',
'astringent', 'oily'
]
palate_carbonation = [
'spritzy', 'prickly', 'round',
'creamy', 'light', 'gassy',
'sharp', 'delicate'
]
palate_body = [
'full', 'heavy', 'dense',
'viscous', 'robust', 'medium',
'balanced', 'light', 'delicate',
'wispy'
]
# define larger groups
aroma = (
aroma_basic + aroma_dark_fruit + aroma_light_fruit +
aroma_citrus + aroma_other + aroma_spices_yeast
)
appearance = (
appearance_color + appearance_clarity + appearance_head
)
taste = (
taste_basic + taste_intensity + taste_finish
)
palate = (
palate_mouthfeel + palate_carbonation + palate_body
)
# define union of all descriptors
all_descriptors = list(set(
aroma + appearance + taste + palate
))
| aroma_basic = ['malty', 'grainy', 'sweet', 'corn', 'hay', 'straw', 'cracker', 'bicuity', 'caramel', 'toast', 'roast', 'coffee', 'espresso', 'burnt', 'alcohol', 'tobacco', 'gunpowder', 'leather', 'pine', 'grass', 'dank', 'piney', 'floral', 'perfume']
aroma_dark_fruit = ['raisins', 'currant', 'plum', 'dates', 'prunes', 'figs', 'blackberry', 'blueberry']
aroma_light_fruit = ['banana', 'pineapple', 'apricot', 'pear', 'apple', 'nectarine', 'peach', 'mango']
aroma_citrus = ['lemon', 'lime', 'orange', 'tangerine', 'clementine', 'grapefruit', 'grapefruity', 'peel', 'zest', 'citrus', 'orangey']
aroma_other = ['metallic', 'vinegar', 'copper', 'cidery', 'champagne', 'astringent', 'chlorine']
aroma_spices_yeast = ['phenolic', 'pepper', 'clove', 'anise', 'licorice', 'smoke', 'bacon', 'fatty', 'nutty', 'butterscotch', 'vanilla', 'earthy', 'woody', 'horsey', 'bread', 'saddle', 'musty', 'barnyard', 'spice']
appearance_color = ['honey', 'caramel', 'red', 'brown', 'rootbeer', 'amber', 'chestnut', 'dark', 'apricot', 'orange', 'black', 'burnt', 'auburn', 'garnet', 'ruby', 'copper', 'gold']
appearance_clarity = ['brilliant', 'hazy', 'cloudy', 'turbid', 'opaque', 'clear', 'crystal', 'bright', 'dull', 'haze']
appearance_head = ['persistent', 'rocky', 'large', 'fluffy', 'dissipating', 'lingering', 'white', 'offwhite', 'tan', 'frothy', 'delicate']
taste_basic = ['roasted', 'bready', 'bitter', 'sweet', 'spicy', 'fruity', 'chocolate', 'caramel', 'toffee', 'coffee', 'malty', 'tart', 'subtle', 'woodsy', 'earthy', 'sulfur', 'sulfuric']
taste_intensity = ['assertive', 'mild', 'bold', 'balanced', 'robust', 'intense', 'metallic', 'harsh', 'complex', 'delicate', 'refined', 'hearty']
taste_finish = ['dry', 'fruity', 'sweet', 'alcoholic', 'warming', 'bitter', 'acidic', 'buttery', 'wet', 'quenching', 'lingering']
palate_mouthfeel = ['smooth', 'silky', 'velvety', 'prickly', 'tingly', 'creamy', 'warming', 'viscous', 'hot', 'astringent', 'oily']
palate_carbonation = ['spritzy', 'prickly', 'round', 'creamy', 'light', 'gassy', 'sharp', 'delicate']
palate_body = ['full', 'heavy', 'dense', 'viscous', 'robust', 'medium', 'balanced', 'light', 'delicate', 'wispy']
aroma = aroma_basic + aroma_dark_fruit + aroma_light_fruit + aroma_citrus + aroma_other + aroma_spices_yeast
appearance = appearance_color + appearance_clarity + appearance_head
taste = taste_basic + taste_intensity + taste_finish
palate = palate_mouthfeel + palate_carbonation + palate_body
all_descriptors = list(set(aroma + appearance + taste + palate)) |
def get_fact(i):
if i==1:
return 1
else:
return i*get_fact(i-1)
t=int(input())
for i in range(t):
x=int(input())
print(get_fact(x)) | def get_fact(i):
if i == 1:
return 1
else:
return i * get_fact(i - 1)
t = int(input())
for i in range(t):
x = int(input())
print(get_fact(x)) |
# /Users/dvs/Dropbox/Code/graphql-py/graphql/parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.5'
_lr_method = 'LALR'
_lr_signature = 'CDC982EBD105CCA216971D7DA325FA06'
_lr_action_items = {'BRACE_L':([0,8,10,11,21,23,24,25,26,27,28,29,30,31,32,33,36,37,50,51,52,58,59,61,67,68,70,71,73,80,81,82,83,87,90,91,92,96,98,99,103,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,134,135,136,137,139,143,147,148,149,151,153,154,155,156,157,158,159,160,161,165,166,167,169,172,173,174,176,],[5,5,-18,-19,5,-76,-72,-73,-74,-75,-77,-78,-79,5,5,5,-56,-58,5,5,5,5,5,5,-57,-60,5,5,5,5,-55,-127,5,-65,-59,5,5,-61,126,5,5,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,126,-70,126,-107,-109,-115,162,-106,-108,-114,126,-90,-91,-92,-93,-94,-95,-96,-97,162,162,-111,-113,-120,-110,-112,-119,162,]),'FRAGMENT':([0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,60,62,63,66,67,68,69,70,71,72,73,74,75,76,77,79,84,85,86,90,92,93,94,95,96,97,98,100,101,102,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,133,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[9,9,9,-7,25,-8,-9,25,39,-18,-19,-6,9,-5,25,-22,-23,-24,-25,25,-41,39,-76,-72,-73,-74,-75,-77,-78,-79,-17,-56,-58,25,-49,-48,-50,-51,-52,-53,-54,-4,-20,-21,-37,-38,-39,-40,-80,25,-43,25,-13,-15,-16,25,-57,-60,25,-36,-35,-34,-33,-32,-31,25,-63,-42,-11,-12,-14,-59,-30,-29,-28,-27,-61,-62,121,-47,-10,25,-45,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,25,-100,-98,-99,-101,-102,-103,-104,-105,121,25,-46,25,-44,-70,121,-107,-109,25,-115,-117,121,-106,-108,-114,-116,121,-90,-91,-92,-93,-94,-95,-96,-97,121,25,-118,121,-111,-113,25,-120,-122,-110,-112,-119,-121,121,-123,]),'QUERY':([0,2,4,5,6,7,8,9,10,11,12,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,34,36,37,38,39,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,60,62,63,66,67,68,69,70,71,72,73,74,75,76,77,79,84,85,86,90,92,93,94,95,96,97,98,100,101,102,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,133,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[10,10,-7,26,-8,-9,26,42,-18,-19,-6,26,-22,-23,-24,-25,26,-41,42,-76,-72,-73,-74,-75,-77,-78,-79,-17,-56,-58,26,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,26,-43,26,-13,-15,-16,26,-57,-60,26,-36,-35,-34,-33,-32,-31,26,-63,-42,-11,-12,-14,-59,-30,-29,-28,-27,-61,-62,122,-47,-10,26,-45,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,26,-100,-98,-99,-101,-102,-103,-104,-105,122,26,-46,26,-44,-70,122,-107,-109,26,-115,-117,122,-106,-108,-114,-116,122,-90,-91,-92,-93,-94,-95,-96,-97,122,26,-118,122,-111,-113,26,-120,-122,-110,-112,-119,-121,122,-123,]),'MUTATION':([0,2,4,5,6,7,8,9,10,11,12,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,34,36,37,38,39,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,60,62,63,66,67,68,69,70,71,72,73,74,75,76,77,79,84,85,86,90,92,93,94,95,96,97,98,100,101,102,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,133,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[11,11,-7,27,-8,-9,27,43,-18,-19,-6,27,-22,-23,-24,-25,27,-41,43,-76,-72,-73,-74,-75,-77,-78,-79,-17,-56,-58,27,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,27,-43,27,-13,-15,-16,27,-57,-60,27,-36,-35,-34,-33,-32,-31,27,-63,-42,-11,-12,-14,-59,-30,-29,-28,-27,-61,-62,123,-47,-10,27,-45,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,27,-100,-98,-99,-101,-102,-103,-104,-105,123,27,-46,27,-44,-70,123,-107,-109,27,-115,-117,123,-106,-108,-114,-116,123,-90,-91,-92,-93,-94,-95,-96,-97,123,27,-118,123,-111,-113,27,-120,-122,-110,-112,-119,-121,123,-123,]),'$end':([1,2,3,4,6,7,12,13,14,34,47,48,60,62,63,84,85,86,101,104,133,],[0,-1,-2,-7,-8,-9,-6,-3,-5,-17,-4,-20,-13,-15,-16,-11,-12,-14,-10,-45,-44,]),'SPREAD':([5,15,16,17,18,19,21,23,24,25,26,27,28,29,30,36,37,39,41,42,43,44,45,46,48,49,50,51,52,53,56,67,68,70,71,72,73,74,75,79,90,92,93,94,95,96,100,105,127,],[22,22,-22,-23,-24,-25,-41,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-43,-57,-60,-36,-35,-34,-33,-32,-31,-42,-59,-30,-29,-28,-27,-61,-47,-26,-46,]),'NAME':([5,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,36,37,38,39,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,66,67,68,69,70,71,72,73,74,75,76,77,79,90,92,93,94,95,96,97,98,100,102,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[24,24,41,-18,-19,24,-22,-23,-24,-25,24,-41,41,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,24,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,24,-43,24,24,-57,-60,24,-36,-35,-34,-33,-32,-31,24,-63,-42,-59,-30,-29,-28,-27,-61,-62,120,-47,24,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,24,-100,-98,-99,-101,-102,-103,-104,-105,120,24,-46,24,-70,120,-107,-109,24,-115,-117,120,-106,-108,-114,-116,120,-90,-91,-92,-93,-94,-95,-96,-97,120,24,-118,120,-111,-113,24,-120,-122,-110,-112,-119,-121,120,-123,]),'ON':([5,8,10,11,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,66,67,68,69,70,71,72,73,74,75,76,77,79,90,92,93,94,95,96,97,98,100,102,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[23,23,-18,-19,23,-22,-23,-24,-25,23,-41,57,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,23,-49,69,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,23,-43,23,23,-57,-60,23,-36,-35,-34,-33,-32,-31,23,-63,-42,-59,-30,-29,-28,-27,-61,-62,124,-47,23,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,23,-100,-98,-99,-101,-102,-103,-104,-105,124,23,-46,23,-70,124,-107,-109,23,-115,-117,124,-106,-108,-114,-116,124,-90,-91,-92,-93,-94,-95,-96,-97,124,23,-118,124,-111,-113,23,-120,-122,-110,-112,-119,-121,124,-123,]),'TRUE':([5,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,36,37,38,39,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,66,67,68,69,70,71,72,73,74,75,76,77,79,90,92,93,94,95,96,97,98,100,102,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[28,28,44,-18,-19,28,-22,-23,-24,-25,28,-41,44,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,28,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,28,-43,28,28,-57,-60,28,-36,-35,-34,-33,-32,-31,28,-63,-42,-59,-30,-29,-28,-27,-61,-62,118,-47,28,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,28,-100,-98,-99,-101,-102,-103,-104,-105,118,28,-46,28,-70,118,-107,-109,28,-115,-117,118,-106,-108,-114,-116,118,-90,-91,-92,-93,-94,-95,-96,-97,118,28,-118,118,-111,-113,28,-120,-122,-110,-112,-119,-121,118,-123,]),'FALSE':([5,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,36,37,38,39,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,66,67,68,69,70,71,72,73,74,75,76,77,79,90,92,93,94,95,96,97,98,100,102,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[29,29,45,-18,-19,29,-22,-23,-24,-25,29,-41,45,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,29,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,29,-43,29,29,-57,-60,29,-36,-35,-34,-33,-32,-31,29,-63,-42,-59,-30,-29,-28,-27,-61,-62,119,-47,29,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,29,-100,-98,-99,-101,-102,-103,-104,-105,119,29,-46,29,-70,119,-107,-109,29,-115,-117,119,-106,-108,-114,-116,119,-90,-91,-92,-93,-94,-95,-96,-97,119,29,-118,119,-111,-113,29,-120,-122,-110,-112,-119,-121,119,-123,]),'NULL':([5,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,36,37,38,39,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,66,67,68,69,70,71,72,73,74,75,76,77,79,90,92,93,94,95,96,97,98,100,102,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,132,134,135,136,137,138,139,140,143,147,148,149,150,151,153,154,155,156,157,158,159,160,161,162,164,165,166,167,168,169,170,172,173,174,175,176,177,],[30,30,46,-18,-19,30,-22,-23,-24,-25,30,-41,46,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,30,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-80,30,-43,30,30,-57,-60,30,-36,-35,-34,-33,-32,-31,30,-63,-42,-59,-30,-29,-28,-27,-61,-62,117,-47,30,-26,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,30,-100,-98,-99,-101,-102,-103,-104,-105,117,30,-46,30,-70,117,-107,-109,30,-115,-117,117,-106,-108,-114,-116,117,-90,-91,-92,-93,-94,-95,-96,-97,117,30,-118,117,-111,-113,30,-120,-122,-110,-112,-119,-121,117,-123,]),'PAREN_L':([8,10,11,21,23,24,25,26,27,28,29,30,31,50,68,],[35,-18,-19,55,-76,-72,-73,-74,-75,-77,-78,-79,35,55,55,]),'AT':([8,10,11,21,23,24,25,26,27,28,29,30,31,32,36,37,39,41,42,43,44,45,46,50,51,56,58,67,68,70,80,81,82,87,90,91,96,],[38,-18,-19,38,-76,-72,-73,-74,-75,-77,-78,-79,38,38,38,-58,-49,-48,-50,-51,-52,-53,-54,38,38,38,38,-57,-60,38,38,-55,-127,-65,-59,38,-61,]),'BRACE_R':([15,16,17,18,19,21,23,24,25,26,27,28,29,30,36,37,39,41,42,43,44,45,46,48,49,50,51,52,53,56,67,68,70,71,72,73,74,75,79,90,92,93,94,95,96,100,105,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,126,127,134,136,138,139,140,147,149,150,153,154,155,156,157,158,159,160,162,164,166,168,169,170,172,174,175,177,],[48,-22,-23,-24,-25,-41,-76,-72,-73,-74,-75,-77,-78,-79,-56,-58,-49,-48,-50,-51,-52,-53,-54,-20,-21,-37,-38,-39,-40,-43,-57,-60,-36,-35,-34,-33,-32,-31,-42,-59,-30,-29,-28,-27,-61,-47,-26,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,139,-46,-70,-107,149,-115,-117,-106,-114,-116,-90,-91,-92,-93,-94,-95,-96,-97,169,-118,-111,174,-120,-122,-110,-119,-121,-123,]),'COLON':([21,23,24,25,26,27,28,29,30,78,89,141,171,],[54,-76,-72,-73,-74,-75,-77,-78,-79,98,102,151,176,]),'BANG':([23,24,25,26,27,28,29,30,82,129,130,163,],[-76,-72,-73,-74,-75,-77,-78,-79,-127,144,145,-128,]),'EQUALS':([23,24,25,26,27,28,29,30,82,128,129,130,131,144,145,163,],[-76,-72,-73,-74,-75,-77,-78,-79,-127,143,-124,-125,-126,-129,-130,-128,]),'PAREN_R':([23,24,25,26,27,28,29,30,64,65,76,77,82,88,97,106,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,128,129,130,131,134,136,139,142,144,145,147,149,152,153,154,155,156,157,158,159,160,163,166,169,172,174,],[-76,-72,-73,-74,-75,-77,-78,-79,87,-67,96,-63,-127,-66,-62,-64,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,-69,-124,-125,-126,-70,-107,-115,-68,-129,-130,-106,-114,-71,-90,-91,-92,-93,-94,-95,-96,-97,-128,-111,-120,-110,-119,]),'DOLLAR':([23,24,25,26,27,28,29,30,35,64,65,82,88,98,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,128,129,130,131,134,135,136,137,139,142,144,145,147,148,149,151,152,153,154,155,156,157,158,159,160,163,166,169,172,174,],[-76,-72,-73,-74,-75,-77,-78,-79,66,66,-67,-127,-66,116,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,116,-69,-124,-125,-126,-70,116,-107,-109,-115,-68,-129,-130,-106,-108,-114,116,-71,-90,-91,-92,-93,-94,-95,-96,-97,-128,-111,-120,-110,-119,]),'BRACKET_R':([23,24,25,26,27,28,29,30,82,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,129,130,131,134,135,136,137,139,144,145,146,147,148,149,153,154,155,156,157,158,159,160,161,163,165,166,167,169,172,173,174,],[-76,-72,-73,-74,-75,-77,-78,-79,-127,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,136,-124,-125,-126,-70,147,-107,-109,-115,-129,-130,163,-106,-108,-114,-90,-91,-92,-93,-94,-95,-96,-97,166,-128,172,-111,-113,-120,-110,-112,-119,]),'INT_VALUE':([23,24,25,26,27,28,29,30,98,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,134,135,136,137,139,143,147,148,149,151,153,154,155,156,157,158,159,160,161,165,166,167,169,172,173,174,176,],[-76,-72,-73,-74,-75,-77,-78,-79,108,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,108,-70,108,-107,-109,-115,153,-106,-108,-114,108,-90,-91,-92,-93,-94,-95,-96,-97,153,153,-111,-113,-120,-110,-112,-119,153,]),'FLOAT_VALUE':([23,24,25,26,27,28,29,30,98,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,134,135,136,137,139,143,147,148,149,151,153,154,155,156,157,158,159,160,161,165,166,167,169,172,173,174,176,],[-76,-72,-73,-74,-75,-77,-78,-79,109,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,109,-70,109,-107,-109,-115,154,-106,-108,-114,109,-90,-91,-92,-93,-94,-95,-96,-97,154,154,-111,-113,-120,-110,-112,-119,154,]),'STRING_VALUE':([23,24,25,26,27,28,29,30,98,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,134,135,136,137,139,143,147,148,149,151,153,154,155,156,157,158,159,160,161,165,166,167,169,172,173,174,176,],[-76,-72,-73,-74,-75,-77,-78,-79,110,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,110,-70,110,-107,-109,-115,155,-106,-108,-114,110,-90,-91,-92,-93,-94,-95,-96,-97,155,155,-111,-113,-120,-110,-112,-119,155,]),'BRACKET_L':([23,24,25,26,27,28,29,30,98,102,107,108,109,110,111,112,113,114,115,117,118,119,120,121,122,123,124,125,132,134,135,136,137,139,143,147,148,149,151,153,154,155,156,157,158,159,160,161,165,166,167,169,172,173,174,176,],[-76,-72,-73,-74,-75,-77,-78,-79,125,132,-81,-82,-83,-84,-85,-86,-87,-88,-89,-100,-98,-99,-101,-102,-103,-104,-105,125,132,-70,125,-107,-109,-115,161,-106,-108,-114,125,-90,-91,-92,-93,-94,-95,-96,-97,161,161,-111,-113,-120,-110,-112,-119,161,]),}
_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 = {'document':([0,],[1,]),'definition_list':([0,],[2,]),'selection_set':([0,8,21,31,32,33,50,51,52,58,59,61,70,71,73,80,83,91,92,99,103,],[3,34,53,60,62,63,72,74,75,84,85,86,93,94,95,100,101,104,105,127,133,]),'definition':([0,2,],[4,12,]),'operation_definition':([0,2,],[6,6,]),'fragment_definition':([0,2,3,13,],[7,7,14,47,]),'operation_type':([0,2,],[8,8,]),'fragment_list':([3,],[13,]),'selection_list':([5,],[15,]),'selection':([5,15,],[16,49,]),'field':([5,15,],[17,17,]),'fragment_spread':([5,15,],[18,18,]),'inline_fragment':([5,15,],[19,19,]),'alias':([5,15,],[20,20,]),'name':([5,8,15,20,38,55,57,66,69,76,102,116,126,132,138,162,168,],[21,31,21,50,68,78,82,89,82,78,82,134,141,82,141,171,171,]),'variable_definitions':([8,31,],[32,58,]),'directives':([8,21,31,32,50,51,56,58,70,80,91,],[33,52,59,61,71,73,79,83,92,99,103,]),'directive_list':([8,21,31,32,50,51,56,58,70,80,91,],[36,36,36,36,36,36,36,36,36,36,36,]),'directive':([8,21,31,32,36,50,51,56,58,70,80,91,],[37,37,37,37,67,37,37,37,37,37,37,37,]),'fragment_name':([9,22,],[40,56,]),'arguments':([21,50,68,],[51,70,90,]),'variable_definition_list':([35,],[64,]),'variable_definition':([35,64,],[65,88,]),'argument_list':([55,],[76,]),'argument':([55,76,],[77,97,]),'type_condition':([57,69,],[80,91,]),'named_type':([57,69,102,132,],[81,81,129,129,]),'value':([98,125,135,151,],[106,137,148,164,]),'variable':([98,125,135,151,],[107,107,107,107,]),'null_value':([98,125,135,143,151,161,165,176,],[111,111,111,156,111,156,156,156,]),'boolean_value':([98,125,135,143,151,161,165,176,],[112,112,112,157,112,157,157,157,]),'enum_value':([98,125,135,143,151,161,165,176,],[113,113,113,158,113,158,158,158,]),'list_value':([98,125,135,151,],[114,114,114,114,]),'object_value':([98,125,135,151,],[115,115,115,115,]),'type':([102,132,],[128,146,]),'list_type':([102,132,],[130,130,]),'non_null_type':([102,132,],[131,131,]),'value_list':([125,],[135,]),'object_field_list':([126,],[138,]),'object_field':([126,138,],[140,150,]),'default_value':([128,],[142,]),'const_value':([143,161,165,176,],[152,167,173,177,]),'const_list_value':([143,161,165,176,],[159,159,159,159,]),'const_object_value':([143,161,165,176,],[160,160,160,160,]),'const_value_list':([161,],[165,]),'const_object_field_list':([162,],[168,]),'const_object_field':([162,168,],[170,175,]),}
_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' -> document","S'",1,None,None,None),
('document -> definition_list','document',1,'p_document','parser.py',42),
('document -> selection_set','document',1,'p_document_shorthand','parser.py',48),
('document -> selection_set fragment_list','document',2,'p_document_shorthand_with_fragments','parser.py',54),
('fragment_list -> fragment_list fragment_definition','fragment_list',2,'p_fragment_list','parser.py',60),
('fragment_list -> fragment_definition','fragment_list',1,'p_fragment_list_single','parser.py',66),
('definition_list -> definition_list definition','definition_list',2,'p_definition_list','parser.py',72),
('definition_list -> definition','definition_list',1,'p_definition_list_single','parser.py',78),
('definition -> operation_definition','definition',1,'p_definition','parser.py',84),
('definition -> fragment_definition','definition',1,'p_definition','parser.py',85),
('operation_definition -> operation_type name variable_definitions directives selection_set','operation_definition',5,'p_operation_definition1','parser.py',97),
('operation_definition -> operation_type name variable_definitions selection_set','operation_definition',4,'p_operation_definition2','parser.py',108),
('operation_definition -> operation_type name directives selection_set','operation_definition',4,'p_operation_definition3','parser.py',118),
('operation_definition -> operation_type name selection_set','operation_definition',3,'p_operation_definition4','parser.py',128),
('operation_definition -> operation_type variable_definitions directives selection_set','operation_definition',4,'p_operation_definition5','parser.py',134),
('operation_definition -> operation_type variable_definitions selection_set','operation_definition',3,'p_operation_definition6','parser.py',144),
('operation_definition -> operation_type directives selection_set','operation_definition',3,'p_operation_definition7','parser.py',153),
('operation_definition -> operation_type selection_set','operation_definition',2,'p_operation_definition8','parser.py',162),
('operation_type -> QUERY','operation_type',1,'p_operation_type','parser.py',168),
('operation_type -> MUTATION','operation_type',1,'p_operation_type','parser.py',169),
('selection_set -> BRACE_L selection_list BRACE_R','selection_set',3,'p_selection_set','parser.py',175),
('selection_list -> selection_list selection','selection_list',2,'p_selection_list','parser.py',181),
('selection_list -> selection','selection_list',1,'p_selection_list_single','parser.py',187),
('selection -> field','selection',1,'p_selection','parser.py',193),
('selection -> fragment_spread','selection',1,'p_selection','parser.py',194),
('selection -> inline_fragment','selection',1,'p_selection','parser.py',195),
('field -> alias name arguments directives selection_set','field',5,'p_field_all','parser.py',201),
('field -> name arguments directives selection_set','field',4,'p_field_optional1_1','parser.py',208),
('field -> alias name directives selection_set','field',4,'p_field_optional1_2','parser.py',215),
('field -> alias name arguments selection_set','field',4,'p_field_optional1_3','parser.py',221),
('field -> alias name arguments directives','field',4,'p_field_optional1_4','parser.py',227),
('field -> name directives selection_set','field',3,'p_field_optional2_1','parser.py',233),
('field -> name arguments selection_set','field',3,'p_field_optional2_2','parser.py',239),
('field -> name arguments directives','field',3,'p_field_optional2_3','parser.py',245),
('field -> alias name selection_set','field',3,'p_field_optional2_4','parser.py',251),
('field -> alias name directives','field',3,'p_field_optional2_5','parser.py',257),
('field -> alias name arguments','field',3,'p_field_optional2_6','parser.py',263),
('field -> alias name','field',2,'p_field_optional3_1','parser.py',269),
('field -> name arguments','field',2,'p_field_optional3_2','parser.py',275),
('field -> name directives','field',2,'p_field_optional3_3','parser.py',281),
('field -> name selection_set','field',2,'p_field_optional3_4','parser.py',287),
('field -> name','field',1,'p_field_optional4','parser.py',293),
('fragment_spread -> SPREAD fragment_name directives','fragment_spread',3,'p_fragment_spread1','parser.py',299),
('fragment_spread -> SPREAD fragment_name','fragment_spread',2,'p_fragment_spread2','parser.py',305),
('fragment_definition -> FRAGMENT fragment_name ON type_condition directives selection_set','fragment_definition',6,'p_fragment_definition1','parser.py',311),
('fragment_definition -> FRAGMENT fragment_name ON type_condition selection_set','fragment_definition',5,'p_fragment_definition2','parser.py',318),
('inline_fragment -> SPREAD ON type_condition directives selection_set','inline_fragment',5,'p_inline_fragment1','parser.py',325),
('inline_fragment -> SPREAD ON type_condition selection_set','inline_fragment',4,'p_inline_fragment2','parser.py',332),
('fragment_name -> NAME','fragment_name',1,'p_fragment_name','parser.py',338),
('fragment_name -> FRAGMENT','fragment_name',1,'p_fragment_name','parser.py',339),
('fragment_name -> QUERY','fragment_name',1,'p_fragment_name','parser.py',340),
('fragment_name -> MUTATION','fragment_name',1,'p_fragment_name','parser.py',341),
('fragment_name -> TRUE','fragment_name',1,'p_fragment_name','parser.py',342),
('fragment_name -> FALSE','fragment_name',1,'p_fragment_name','parser.py',343),
('fragment_name -> NULL','fragment_name',1,'p_fragment_name','parser.py',344),
('type_condition -> named_type','type_condition',1,'p_type_condition','parser.py',350),
('directives -> directive_list','directives',1,'p_directives','parser.py',356),
('directive_list -> directive_list directive','directive_list',2,'p_directive_list','parser.py',362),
('directive_list -> directive','directive_list',1,'p_directive_list_single','parser.py',368),
('directive -> AT name arguments','directive',3,'p_directive','parser.py',374),
('directive -> AT name','directive',2,'p_directive','parser.py',375),
('arguments -> PAREN_L argument_list PAREN_R','arguments',3,'p_arguments','parser.py',382),
('argument_list -> argument_list argument','argument_list',2,'p_argument_list','parser.py',388),
('argument_list -> argument','argument_list',1,'p_argument_list_single','parser.py',394),
('argument -> name COLON value','argument',3,'p_argument','parser.py',400),
('variable_definitions -> PAREN_L variable_definition_list PAREN_R','variable_definitions',3,'p_variable_definitions','parser.py',406),
('variable_definition_list -> variable_definition_list variable_definition','variable_definition_list',2,'p_variable_definition_list','parser.py',412),
('variable_definition_list -> variable_definition','variable_definition_list',1,'p_variable_definition_list_single','parser.py',418),
('variable_definition -> DOLLAR name COLON type default_value','variable_definition',5,'p_variable_definition1','parser.py',424),
('variable_definition -> DOLLAR name COLON type','variable_definition',4,'p_variable_definition2','parser.py',430),
('variable -> DOLLAR name','variable',2,'p_variable','parser.py',436),
('default_value -> EQUALS const_value','default_value',2,'p_default_value','parser.py',442),
('name -> NAME','name',1,'p_name','parser.py',448),
('name -> FRAGMENT','name',1,'p_name','parser.py',449),
('name -> QUERY','name',1,'p_name','parser.py',450),
('name -> MUTATION','name',1,'p_name','parser.py',451),
('name -> ON','name',1,'p_name','parser.py',452),
('name -> TRUE','name',1,'p_name','parser.py',453),
('name -> FALSE','name',1,'p_name','parser.py',454),
('name -> NULL','name',1,'p_name','parser.py',455),
('alias -> name COLON','alias',2,'p_alias','parser.py',461),
('value -> variable','value',1,'p_value','parser.py',467),
('value -> INT_VALUE','value',1,'p_value','parser.py',468),
('value -> FLOAT_VALUE','value',1,'p_value','parser.py',469),
('value -> STRING_VALUE','value',1,'p_value','parser.py',470),
('value -> null_value','value',1,'p_value','parser.py',471),
('value -> boolean_value','value',1,'p_value','parser.py',472),
('value -> enum_value','value',1,'p_value','parser.py',473),
('value -> list_value','value',1,'p_value','parser.py',474),
('value -> object_value','value',1,'p_value','parser.py',475),
('const_value -> INT_VALUE','const_value',1,'p_const_value','parser.py',481),
('const_value -> FLOAT_VALUE','const_value',1,'p_const_value','parser.py',482),
('const_value -> STRING_VALUE','const_value',1,'p_const_value','parser.py',483),
('const_value -> null_value','const_value',1,'p_const_value','parser.py',484),
('const_value -> boolean_value','const_value',1,'p_const_value','parser.py',485),
('const_value -> enum_value','const_value',1,'p_const_value','parser.py',486),
('const_value -> const_list_value','const_value',1,'p_const_value','parser.py',487),
('const_value -> const_object_value','const_value',1,'p_const_value','parser.py',488),
('boolean_value -> TRUE','boolean_value',1,'p_boolean_value','parser.py',494),
('boolean_value -> FALSE','boolean_value',1,'p_boolean_value','parser.py',495),
('null_value -> NULL','null_value',1,'p_null_value','parser.py',501),
('enum_value -> NAME','enum_value',1,'p_enum_value','parser.py',507),
('enum_value -> FRAGMENT','enum_value',1,'p_enum_value','parser.py',508),
('enum_value -> QUERY','enum_value',1,'p_enum_value','parser.py',509),
('enum_value -> MUTATION','enum_value',1,'p_enum_value','parser.py',510),
('enum_value -> ON','enum_value',1,'p_enum_value','parser.py',511),
('list_value -> BRACKET_L value_list BRACKET_R','list_value',3,'p_list_value','parser.py',517),
('list_value -> BRACKET_L BRACKET_R','list_value',2,'p_list_value','parser.py',518),
('value_list -> value_list value','value_list',2,'p_value_list','parser.py',524),
('value_list -> value','value_list',1,'p_value_list_single','parser.py',530),
('const_list_value -> BRACKET_L const_value_list BRACKET_R','const_list_value',3,'p_const_list_value','parser.py',536),
('const_list_value -> BRACKET_L BRACKET_R','const_list_value',2,'p_const_list_value','parser.py',537),
('const_value_list -> const_value_list const_value','const_value_list',2,'p_const_value_list','parser.py',543),
('const_value_list -> const_value','const_value_list',1,'p_const_value_list_single','parser.py',549),
('object_value -> BRACE_L object_field_list BRACE_R','object_value',3,'p_object_value','parser.py',555),
('object_value -> BRACE_L BRACE_R','object_value',2,'p_object_value','parser.py',556),
('object_field_list -> object_field_list object_field','object_field_list',2,'p_object_field_list','parser.py',562),
('object_field_list -> object_field','object_field_list',1,'p_object_field_list_single','parser.py',570),
('object_field -> name COLON value','object_field',3,'p_object_field','parser.py',576),
('const_object_value -> BRACE_L const_object_field_list BRACE_R','const_object_value',3,'p_const_object_value','parser.py',582),
('const_object_value -> BRACE_L BRACE_R','const_object_value',2,'p_const_object_value','parser.py',583),
('const_object_field_list -> const_object_field_list const_object_field','const_object_field_list',2,'p_const_object_field_list','parser.py',589),
('const_object_field_list -> const_object_field','const_object_field_list',1,'p_const_object_field_list_single','parser.py',597),
('const_object_field -> name COLON const_value','const_object_field',3,'p_const_object_field','parser.py',603),
('type -> named_type','type',1,'p_type','parser.py',609),
('type -> list_type','type',1,'p_type','parser.py',610),
('type -> non_null_type','type',1,'p_type','parser.py',611),
('named_type -> name','named_type',1,'p_named_type','parser.py',617),
('list_type -> BRACKET_L type BRACKET_R','list_type',3,'p_list_type','parser.py',623),
('non_null_type -> named_type BANG','non_null_type',2,'p_non_null_type','parser.py',629),
('non_null_type -> list_type BANG','non_null_type',2,'p_non_null_type','parser.py',630),
]
| _tabversion = '3.5'
_lr_method = 'LALR'
_lr_signature = 'CDC982EBD105CCA216971D7DA325FA06'
_lr_action_items = {'BRACE_L': ([0, 8, 10, 11, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 36, 37, 50, 51, 52, 58, 59, 61, 67, 68, 70, 71, 73, 80, 81, 82, 83, 87, 90, 91, 92, 96, 98, 99, 103, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 134, 135, 136, 137, 139, 143, 147, 148, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 165, 166, 167, 169, 172, 173, 174, 176], [5, 5, -18, -19, 5, -76, -72, -73, -74, -75, -77, -78, -79, 5, 5, 5, -56, -58, 5, 5, 5, 5, 5, 5, -57, -60, 5, 5, 5, 5, -55, -127, 5, -65, -59, 5, 5, -61, 126, 5, 5, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 126, -70, 126, -107, -109, -115, 162, -106, -108, -114, 126, -90, -91, -92, -93, -94, -95, -96, -97, 162, 162, -111, -113, -120, -110, -112, -119, 162]), 'FRAGMENT': ([0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 84, 85, 86, 90, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 133, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [9, 9, 9, -7, 25, -8, -9, 25, 39, -18, -19, -6, 9, -5, 25, -22, -23, -24, -25, 25, -41, 39, -76, -72, -73, -74, -75, -77, -78, -79, -17, -56, -58, 25, -49, -48, -50, -51, -52, -53, -54, -4, -20, -21, -37, -38, -39, -40, -80, 25, -43, 25, -13, -15, -16, 25, -57, -60, 25, -36, -35, -34, -33, -32, -31, 25, -63, -42, -11, -12, -14, -59, -30, -29, -28, -27, -61, -62, 121, -47, -10, 25, -45, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 25, -100, -98, -99, -101, -102, -103, -104, -105, 121, 25, -46, 25, -44, -70, 121, -107, -109, 25, -115, -117, 121, -106, -108, -114, -116, 121, -90, -91, -92, -93, -94, -95, -96, -97, 121, 25, -118, 121, -111, -113, 25, -120, -122, -110, -112, -119, -121, 121, -123]), 'QUERY': ([0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 84, 85, 86, 90, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 133, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [10, 10, -7, 26, -8, -9, 26, 42, -18, -19, -6, 26, -22, -23, -24, -25, 26, -41, 42, -76, -72, -73, -74, -75, -77, -78, -79, -17, -56, -58, 26, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 26, -43, 26, -13, -15, -16, 26, -57, -60, 26, -36, -35, -34, -33, -32, -31, 26, -63, -42, -11, -12, -14, -59, -30, -29, -28, -27, -61, -62, 122, -47, -10, 26, -45, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 26, -100, -98, -99, -101, -102, -103, -104, -105, 122, 26, -46, 26, -44, -70, 122, -107, -109, 26, -115, -117, 122, -106, -108, -114, -116, 122, -90, -91, -92, -93, -94, -95, -96, -97, 122, 26, -118, 122, -111, -113, 26, -120, -122, -110, -112, -119, -121, 122, -123]), 'MUTATION': ([0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 62, 63, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 84, 85, 86, 90, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 133, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [11, 11, -7, 27, -8, -9, 27, 43, -18, -19, -6, 27, -22, -23, -24, -25, 27, -41, 43, -76, -72, -73, -74, -75, -77, -78, -79, -17, -56, -58, 27, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 27, -43, 27, -13, -15, -16, 27, -57, -60, 27, -36, -35, -34, -33, -32, -31, 27, -63, -42, -11, -12, -14, -59, -30, -29, -28, -27, -61, -62, 123, -47, -10, 27, -45, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 27, -100, -98, -99, -101, -102, -103, -104, -105, 123, 27, -46, 27, -44, -70, 123, -107, -109, 27, -115, -117, 123, -106, -108, -114, -116, 123, -90, -91, -92, -93, -94, -95, -96, -97, 123, 27, -118, 123, -111, -113, 27, -120, -122, -110, -112, -119, -121, 123, -123]), '$end': ([1, 2, 3, 4, 6, 7, 12, 13, 14, 34, 47, 48, 60, 62, 63, 84, 85, 86, 101, 104, 133], [0, -1, -2, -7, -8, -9, -6, -3, -5, -17, -4, -20, -13, -15, -16, -11, -12, -14, -10, -45, -44]), 'SPREAD': ([5, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 56, 67, 68, 70, 71, 72, 73, 74, 75, 79, 90, 92, 93, 94, 95, 96, 100, 105, 127], [22, 22, -22, -23, -24, -25, -41, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -43, -57, -60, -36, -35, -34, -33, -32, -31, -42, -59, -30, -29, -28, -27, -61, -47, -26, -46]), 'NAME': ([5, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 90, 92, 93, 94, 95, 96, 97, 98, 100, 102, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [24, 24, 41, -18, -19, 24, -22, -23, -24, -25, 24, -41, 41, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, 24, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 24, -43, 24, 24, -57, -60, 24, -36, -35, -34, -33, -32, -31, 24, -63, -42, -59, -30, -29, -28, -27, -61, -62, 120, -47, 24, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 24, -100, -98, -99, -101, -102, -103, -104, -105, 120, 24, -46, 24, -70, 120, -107, -109, 24, -115, -117, 120, -106, -108, -114, -116, 120, -90, -91, -92, -93, -94, -95, -96, -97, 120, 24, -118, 120, -111, -113, 24, -120, -122, -110, -112, -119, -121, 120, -123]), 'ON': ([5, 8, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 90, 92, 93, 94, 95, 96, 97, 98, 100, 102, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [23, 23, -18, -19, 23, -22, -23, -24, -25, 23, -41, 57, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, 23, -49, 69, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 23, -43, 23, 23, -57, -60, 23, -36, -35, -34, -33, -32, -31, 23, -63, -42, -59, -30, -29, -28, -27, -61, -62, 124, -47, 23, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 23, -100, -98, -99, -101, -102, -103, -104, -105, 124, 23, -46, 23, -70, 124, -107, -109, 23, -115, -117, 124, -106, -108, -114, -116, 124, -90, -91, -92, -93, -94, -95, -96, -97, 124, 23, -118, 124, -111, -113, 23, -120, -122, -110, -112, -119, -121, 124, -123]), 'TRUE': ([5, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 90, 92, 93, 94, 95, 96, 97, 98, 100, 102, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [28, 28, 44, -18, -19, 28, -22, -23, -24, -25, 28, -41, 44, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, 28, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 28, -43, 28, 28, -57, -60, 28, -36, -35, -34, -33, -32, -31, 28, -63, -42, -59, -30, -29, -28, -27, -61, -62, 118, -47, 28, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 28, -100, -98, -99, -101, -102, -103, -104, -105, 118, 28, -46, 28, -70, 118, -107, -109, 28, -115, -117, 118, -106, -108, -114, -116, 118, -90, -91, -92, -93, -94, -95, -96, -97, 118, 28, -118, 118, -111, -113, 28, -120, -122, -110, -112, -119, -121, 118, -123]), 'FALSE': ([5, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 90, 92, 93, 94, 95, 96, 97, 98, 100, 102, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [29, 29, 45, -18, -19, 29, -22, -23, -24, -25, 29, -41, 45, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, 29, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 29, -43, 29, 29, -57, -60, 29, -36, -35, -34, -33, -32, -31, 29, -63, -42, -59, -30, -29, -28, -27, -61, -62, 119, -47, 29, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 29, -100, -98, -99, -101, -102, -103, -104, -105, 119, 29, -46, 29, -70, 119, -107, -109, 29, -115, -117, 119, -106, -108, -114, -116, 119, -90, -91, -92, -93, -94, -95, -96, -97, 119, 29, -118, 119, -111, -113, 29, -120, -122, -110, -112, -119, -121, 119, -123]), 'NULL': ([5, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 90, 92, 93, 94, 95, 96, 97, 98, 100, 102, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 132, 134, 135, 136, 137, 138, 139, 140, 143, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 172, 173, 174, 175, 176, 177], [30, 30, 46, -18, -19, 30, -22, -23, -24, -25, 30, -41, 46, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, 30, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -80, 30, -43, 30, 30, -57, -60, 30, -36, -35, -34, -33, -32, -31, 30, -63, -42, -59, -30, -29, -28, -27, -61, -62, 117, -47, 30, -26, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, 30, -100, -98, -99, -101, -102, -103, -104, -105, 117, 30, -46, 30, -70, 117, -107, -109, 30, -115, -117, 117, -106, -108, -114, -116, 117, -90, -91, -92, -93, -94, -95, -96, -97, 117, 30, -118, 117, -111, -113, 30, -120, -122, -110, -112, -119, -121, 117, -123]), 'PAREN_L': ([8, 10, 11, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 50, 68], [35, -18, -19, 55, -76, -72, -73, -74, -75, -77, -78, -79, 35, 55, 55]), 'AT': ([8, 10, 11, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 36, 37, 39, 41, 42, 43, 44, 45, 46, 50, 51, 56, 58, 67, 68, 70, 80, 81, 82, 87, 90, 91, 96], [38, -18, -19, 38, -76, -72, -73, -74, -75, -77, -78, -79, 38, 38, 38, -58, -49, -48, -50, -51, -52, -53, -54, 38, 38, 38, 38, -57, -60, 38, 38, -55, -127, -65, -59, 38, -61]), 'BRACE_R': ([15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 36, 37, 39, 41, 42, 43, 44, 45, 46, 48, 49, 50, 51, 52, 53, 56, 67, 68, 70, 71, 72, 73, 74, 75, 79, 90, 92, 93, 94, 95, 96, 100, 105, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 126, 127, 134, 136, 138, 139, 140, 147, 149, 150, 153, 154, 155, 156, 157, 158, 159, 160, 162, 164, 166, 168, 169, 170, 172, 174, 175, 177], [48, -22, -23, -24, -25, -41, -76, -72, -73, -74, -75, -77, -78, -79, -56, -58, -49, -48, -50, -51, -52, -53, -54, -20, -21, -37, -38, -39, -40, -43, -57, -60, -36, -35, -34, -33, -32, -31, -42, -59, -30, -29, -28, -27, -61, -47, -26, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 139, -46, -70, -107, 149, -115, -117, -106, -114, -116, -90, -91, -92, -93, -94, -95, -96, -97, 169, -118, -111, 174, -120, -122, -110, -119, -121, -123]), 'COLON': ([21, 23, 24, 25, 26, 27, 28, 29, 30, 78, 89, 141, 171], [54, -76, -72, -73, -74, -75, -77, -78, -79, 98, 102, 151, 176]), 'BANG': ([23, 24, 25, 26, 27, 28, 29, 30, 82, 129, 130, 163], [-76, -72, -73, -74, -75, -77, -78, -79, -127, 144, 145, -128]), 'EQUALS': ([23, 24, 25, 26, 27, 28, 29, 30, 82, 128, 129, 130, 131, 144, 145, 163], [-76, -72, -73, -74, -75, -77, -78, -79, -127, 143, -124, -125, -126, -129, -130, -128]), 'PAREN_R': ([23, 24, 25, 26, 27, 28, 29, 30, 64, 65, 76, 77, 82, 88, 97, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 128, 129, 130, 131, 134, 136, 139, 142, 144, 145, 147, 149, 152, 153, 154, 155, 156, 157, 158, 159, 160, 163, 166, 169, 172, 174], [-76, -72, -73, -74, -75, -77, -78, -79, 87, -67, 96, -63, -127, -66, -62, -64, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, -69, -124, -125, -126, -70, -107, -115, -68, -129, -130, -106, -114, -71, -90, -91, -92, -93, -94, -95, -96, -97, -128, -111, -120, -110, -119]), 'DOLLAR': ([23, 24, 25, 26, 27, 28, 29, 30, 35, 64, 65, 82, 88, 98, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 128, 129, 130, 131, 134, 135, 136, 137, 139, 142, 144, 145, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 163, 166, 169, 172, 174], [-76, -72, -73, -74, -75, -77, -78, -79, 66, 66, -67, -127, -66, 116, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 116, -69, -124, -125, -126, -70, 116, -107, -109, -115, -68, -129, -130, -106, -108, -114, 116, -71, -90, -91, -92, -93, -94, -95, -96, -97, -128, -111, -120, -110, -119]), 'BRACKET_R': ([23, 24, 25, 26, 27, 28, 29, 30, 82, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 129, 130, 131, 134, 135, 136, 137, 139, 144, 145, 146, 147, 148, 149, 153, 154, 155, 156, 157, 158, 159, 160, 161, 163, 165, 166, 167, 169, 172, 173, 174], [-76, -72, -73, -74, -75, -77, -78, -79, -127, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 136, -124, -125, -126, -70, 147, -107, -109, -115, -129, -130, 163, -106, -108, -114, -90, -91, -92, -93, -94, -95, -96, -97, 166, -128, 172, -111, -113, -120, -110, -112, -119]), 'INT_VALUE': ([23, 24, 25, 26, 27, 28, 29, 30, 98, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 134, 135, 136, 137, 139, 143, 147, 148, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 165, 166, 167, 169, 172, 173, 174, 176], [-76, -72, -73, -74, -75, -77, -78, -79, 108, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 108, -70, 108, -107, -109, -115, 153, -106, -108, -114, 108, -90, -91, -92, -93, -94, -95, -96, -97, 153, 153, -111, -113, -120, -110, -112, -119, 153]), 'FLOAT_VALUE': ([23, 24, 25, 26, 27, 28, 29, 30, 98, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 134, 135, 136, 137, 139, 143, 147, 148, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 165, 166, 167, 169, 172, 173, 174, 176], [-76, -72, -73, -74, -75, -77, -78, -79, 109, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 109, -70, 109, -107, -109, -115, 154, -106, -108, -114, 109, -90, -91, -92, -93, -94, -95, -96, -97, 154, 154, -111, -113, -120, -110, -112, -119, 154]), 'STRING_VALUE': ([23, 24, 25, 26, 27, 28, 29, 30, 98, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 134, 135, 136, 137, 139, 143, 147, 148, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 165, 166, 167, 169, 172, 173, 174, 176], [-76, -72, -73, -74, -75, -77, -78, -79, 110, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 110, -70, 110, -107, -109, -115, 155, -106, -108, -114, 110, -90, -91, -92, -93, -94, -95, -96, -97, 155, 155, -111, -113, -120, -110, -112, -119, 155]), 'BRACKET_L': ([23, 24, 25, 26, 27, 28, 29, 30, 98, 102, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 132, 134, 135, 136, 137, 139, 143, 147, 148, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 165, 166, 167, 169, 172, 173, 174, 176], [-76, -72, -73, -74, -75, -77, -78, -79, 125, 132, -81, -82, -83, -84, -85, -86, -87, -88, -89, -100, -98, -99, -101, -102, -103, -104, -105, 125, 132, -70, 125, -107, -109, -115, 161, -106, -108, -114, 125, -90, -91, -92, -93, -94, -95, -96, -97, 161, 161, -111, -113, -120, -110, -112, -119, 161])}
_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 = {'document': ([0], [1]), 'definition_list': ([0], [2]), 'selection_set': ([0, 8, 21, 31, 32, 33, 50, 51, 52, 58, 59, 61, 70, 71, 73, 80, 83, 91, 92, 99, 103], [3, 34, 53, 60, 62, 63, 72, 74, 75, 84, 85, 86, 93, 94, 95, 100, 101, 104, 105, 127, 133]), 'definition': ([0, 2], [4, 12]), 'operation_definition': ([0, 2], [6, 6]), 'fragment_definition': ([0, 2, 3, 13], [7, 7, 14, 47]), 'operation_type': ([0, 2], [8, 8]), 'fragment_list': ([3], [13]), 'selection_list': ([5], [15]), 'selection': ([5, 15], [16, 49]), 'field': ([5, 15], [17, 17]), 'fragment_spread': ([5, 15], [18, 18]), 'inline_fragment': ([5, 15], [19, 19]), 'alias': ([5, 15], [20, 20]), 'name': ([5, 8, 15, 20, 38, 55, 57, 66, 69, 76, 102, 116, 126, 132, 138, 162, 168], [21, 31, 21, 50, 68, 78, 82, 89, 82, 78, 82, 134, 141, 82, 141, 171, 171]), 'variable_definitions': ([8, 31], [32, 58]), 'directives': ([8, 21, 31, 32, 50, 51, 56, 58, 70, 80, 91], [33, 52, 59, 61, 71, 73, 79, 83, 92, 99, 103]), 'directive_list': ([8, 21, 31, 32, 50, 51, 56, 58, 70, 80, 91], [36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36]), 'directive': ([8, 21, 31, 32, 36, 50, 51, 56, 58, 70, 80, 91], [37, 37, 37, 37, 67, 37, 37, 37, 37, 37, 37, 37]), 'fragment_name': ([9, 22], [40, 56]), 'arguments': ([21, 50, 68], [51, 70, 90]), 'variable_definition_list': ([35], [64]), 'variable_definition': ([35, 64], [65, 88]), 'argument_list': ([55], [76]), 'argument': ([55, 76], [77, 97]), 'type_condition': ([57, 69], [80, 91]), 'named_type': ([57, 69, 102, 132], [81, 81, 129, 129]), 'value': ([98, 125, 135, 151], [106, 137, 148, 164]), 'variable': ([98, 125, 135, 151], [107, 107, 107, 107]), 'null_value': ([98, 125, 135, 143, 151, 161, 165, 176], [111, 111, 111, 156, 111, 156, 156, 156]), 'boolean_value': ([98, 125, 135, 143, 151, 161, 165, 176], [112, 112, 112, 157, 112, 157, 157, 157]), 'enum_value': ([98, 125, 135, 143, 151, 161, 165, 176], [113, 113, 113, 158, 113, 158, 158, 158]), 'list_value': ([98, 125, 135, 151], [114, 114, 114, 114]), 'object_value': ([98, 125, 135, 151], [115, 115, 115, 115]), 'type': ([102, 132], [128, 146]), 'list_type': ([102, 132], [130, 130]), 'non_null_type': ([102, 132], [131, 131]), 'value_list': ([125], [135]), 'object_field_list': ([126], [138]), 'object_field': ([126, 138], [140, 150]), 'default_value': ([128], [142]), 'const_value': ([143, 161, 165, 176], [152, 167, 173, 177]), 'const_list_value': ([143, 161, 165, 176], [159, 159, 159, 159]), 'const_object_value': ([143, 161, 165, 176], [160, 160, 160, 160]), 'const_value_list': ([161], [165]), 'const_object_field_list': ([162], [168]), 'const_object_field': ([162, 168], [170, 175])}
_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' -> document", "S'", 1, None, None, None), ('document -> definition_list', 'document', 1, 'p_document', 'parser.py', 42), ('document -> selection_set', 'document', 1, 'p_document_shorthand', 'parser.py', 48), ('document -> selection_set fragment_list', 'document', 2, 'p_document_shorthand_with_fragments', 'parser.py', 54), ('fragment_list -> fragment_list fragment_definition', 'fragment_list', 2, 'p_fragment_list', 'parser.py', 60), ('fragment_list -> fragment_definition', 'fragment_list', 1, 'p_fragment_list_single', 'parser.py', 66), ('definition_list -> definition_list definition', 'definition_list', 2, 'p_definition_list', 'parser.py', 72), ('definition_list -> definition', 'definition_list', 1, 'p_definition_list_single', 'parser.py', 78), ('definition -> operation_definition', 'definition', 1, 'p_definition', 'parser.py', 84), ('definition -> fragment_definition', 'definition', 1, 'p_definition', 'parser.py', 85), ('operation_definition -> operation_type name variable_definitions directives selection_set', 'operation_definition', 5, 'p_operation_definition1', 'parser.py', 97), ('operation_definition -> operation_type name variable_definitions selection_set', 'operation_definition', 4, 'p_operation_definition2', 'parser.py', 108), ('operation_definition -> operation_type name directives selection_set', 'operation_definition', 4, 'p_operation_definition3', 'parser.py', 118), ('operation_definition -> operation_type name selection_set', 'operation_definition', 3, 'p_operation_definition4', 'parser.py', 128), ('operation_definition -> operation_type variable_definitions directives selection_set', 'operation_definition', 4, 'p_operation_definition5', 'parser.py', 134), ('operation_definition -> operation_type variable_definitions selection_set', 'operation_definition', 3, 'p_operation_definition6', 'parser.py', 144), ('operation_definition -> operation_type directives selection_set', 'operation_definition', 3, 'p_operation_definition7', 'parser.py', 153), ('operation_definition -> operation_type selection_set', 'operation_definition', 2, 'p_operation_definition8', 'parser.py', 162), ('operation_type -> QUERY', 'operation_type', 1, 'p_operation_type', 'parser.py', 168), ('operation_type -> MUTATION', 'operation_type', 1, 'p_operation_type', 'parser.py', 169), ('selection_set -> BRACE_L selection_list BRACE_R', 'selection_set', 3, 'p_selection_set', 'parser.py', 175), ('selection_list -> selection_list selection', 'selection_list', 2, 'p_selection_list', 'parser.py', 181), ('selection_list -> selection', 'selection_list', 1, 'p_selection_list_single', 'parser.py', 187), ('selection -> field', 'selection', 1, 'p_selection', 'parser.py', 193), ('selection -> fragment_spread', 'selection', 1, 'p_selection', 'parser.py', 194), ('selection -> inline_fragment', 'selection', 1, 'p_selection', 'parser.py', 195), ('field -> alias name arguments directives selection_set', 'field', 5, 'p_field_all', 'parser.py', 201), ('field -> name arguments directives selection_set', 'field', 4, 'p_field_optional1_1', 'parser.py', 208), ('field -> alias name directives selection_set', 'field', 4, 'p_field_optional1_2', 'parser.py', 215), ('field -> alias name arguments selection_set', 'field', 4, 'p_field_optional1_3', 'parser.py', 221), ('field -> alias name arguments directives', 'field', 4, 'p_field_optional1_4', 'parser.py', 227), ('field -> name directives selection_set', 'field', 3, 'p_field_optional2_1', 'parser.py', 233), ('field -> name arguments selection_set', 'field', 3, 'p_field_optional2_2', 'parser.py', 239), ('field -> name arguments directives', 'field', 3, 'p_field_optional2_3', 'parser.py', 245), ('field -> alias name selection_set', 'field', 3, 'p_field_optional2_4', 'parser.py', 251), ('field -> alias name directives', 'field', 3, 'p_field_optional2_5', 'parser.py', 257), ('field -> alias name arguments', 'field', 3, 'p_field_optional2_6', 'parser.py', 263), ('field -> alias name', 'field', 2, 'p_field_optional3_1', 'parser.py', 269), ('field -> name arguments', 'field', 2, 'p_field_optional3_2', 'parser.py', 275), ('field -> name directives', 'field', 2, 'p_field_optional3_3', 'parser.py', 281), ('field -> name selection_set', 'field', 2, 'p_field_optional3_4', 'parser.py', 287), ('field -> name', 'field', 1, 'p_field_optional4', 'parser.py', 293), ('fragment_spread -> SPREAD fragment_name directives', 'fragment_spread', 3, 'p_fragment_spread1', 'parser.py', 299), ('fragment_spread -> SPREAD fragment_name', 'fragment_spread', 2, 'p_fragment_spread2', 'parser.py', 305), ('fragment_definition -> FRAGMENT fragment_name ON type_condition directives selection_set', 'fragment_definition', 6, 'p_fragment_definition1', 'parser.py', 311), ('fragment_definition -> FRAGMENT fragment_name ON type_condition selection_set', 'fragment_definition', 5, 'p_fragment_definition2', 'parser.py', 318), ('inline_fragment -> SPREAD ON type_condition directives selection_set', 'inline_fragment', 5, 'p_inline_fragment1', 'parser.py', 325), ('inline_fragment -> SPREAD ON type_condition selection_set', 'inline_fragment', 4, 'p_inline_fragment2', 'parser.py', 332), ('fragment_name -> NAME', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 338), ('fragment_name -> FRAGMENT', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 339), ('fragment_name -> QUERY', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 340), ('fragment_name -> MUTATION', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 341), ('fragment_name -> TRUE', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 342), ('fragment_name -> FALSE', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 343), ('fragment_name -> NULL', 'fragment_name', 1, 'p_fragment_name', 'parser.py', 344), ('type_condition -> named_type', 'type_condition', 1, 'p_type_condition', 'parser.py', 350), ('directives -> directive_list', 'directives', 1, 'p_directives', 'parser.py', 356), ('directive_list -> directive_list directive', 'directive_list', 2, 'p_directive_list', 'parser.py', 362), ('directive_list -> directive', 'directive_list', 1, 'p_directive_list_single', 'parser.py', 368), ('directive -> AT name arguments', 'directive', 3, 'p_directive', 'parser.py', 374), ('directive -> AT name', 'directive', 2, 'p_directive', 'parser.py', 375), ('arguments -> PAREN_L argument_list PAREN_R', 'arguments', 3, 'p_arguments', 'parser.py', 382), ('argument_list -> argument_list argument', 'argument_list', 2, 'p_argument_list', 'parser.py', 388), ('argument_list -> argument', 'argument_list', 1, 'p_argument_list_single', 'parser.py', 394), ('argument -> name COLON value', 'argument', 3, 'p_argument', 'parser.py', 400), ('variable_definitions -> PAREN_L variable_definition_list PAREN_R', 'variable_definitions', 3, 'p_variable_definitions', 'parser.py', 406), ('variable_definition_list -> variable_definition_list variable_definition', 'variable_definition_list', 2, 'p_variable_definition_list', 'parser.py', 412), ('variable_definition_list -> variable_definition', 'variable_definition_list', 1, 'p_variable_definition_list_single', 'parser.py', 418), ('variable_definition -> DOLLAR name COLON type default_value', 'variable_definition', 5, 'p_variable_definition1', 'parser.py', 424), ('variable_definition -> DOLLAR name COLON type', 'variable_definition', 4, 'p_variable_definition2', 'parser.py', 430), ('variable -> DOLLAR name', 'variable', 2, 'p_variable', 'parser.py', 436), ('default_value -> EQUALS const_value', 'default_value', 2, 'p_default_value', 'parser.py', 442), ('name -> NAME', 'name', 1, 'p_name', 'parser.py', 448), ('name -> FRAGMENT', 'name', 1, 'p_name', 'parser.py', 449), ('name -> QUERY', 'name', 1, 'p_name', 'parser.py', 450), ('name -> MUTATION', 'name', 1, 'p_name', 'parser.py', 451), ('name -> ON', 'name', 1, 'p_name', 'parser.py', 452), ('name -> TRUE', 'name', 1, 'p_name', 'parser.py', 453), ('name -> FALSE', 'name', 1, 'p_name', 'parser.py', 454), ('name -> NULL', 'name', 1, 'p_name', 'parser.py', 455), ('alias -> name COLON', 'alias', 2, 'p_alias', 'parser.py', 461), ('value -> variable', 'value', 1, 'p_value', 'parser.py', 467), ('value -> INT_VALUE', 'value', 1, 'p_value', 'parser.py', 468), ('value -> FLOAT_VALUE', 'value', 1, 'p_value', 'parser.py', 469), ('value -> STRING_VALUE', 'value', 1, 'p_value', 'parser.py', 470), ('value -> null_value', 'value', 1, 'p_value', 'parser.py', 471), ('value -> boolean_value', 'value', 1, 'p_value', 'parser.py', 472), ('value -> enum_value', 'value', 1, 'p_value', 'parser.py', 473), ('value -> list_value', 'value', 1, 'p_value', 'parser.py', 474), ('value -> object_value', 'value', 1, 'p_value', 'parser.py', 475), ('const_value -> INT_VALUE', 'const_value', 1, 'p_const_value', 'parser.py', 481), ('const_value -> FLOAT_VALUE', 'const_value', 1, 'p_const_value', 'parser.py', 482), ('const_value -> STRING_VALUE', 'const_value', 1, 'p_const_value', 'parser.py', 483), ('const_value -> null_value', 'const_value', 1, 'p_const_value', 'parser.py', 484), ('const_value -> boolean_value', 'const_value', 1, 'p_const_value', 'parser.py', 485), ('const_value -> enum_value', 'const_value', 1, 'p_const_value', 'parser.py', 486), ('const_value -> const_list_value', 'const_value', 1, 'p_const_value', 'parser.py', 487), ('const_value -> const_object_value', 'const_value', 1, 'p_const_value', 'parser.py', 488), ('boolean_value -> TRUE', 'boolean_value', 1, 'p_boolean_value', 'parser.py', 494), ('boolean_value -> FALSE', 'boolean_value', 1, 'p_boolean_value', 'parser.py', 495), ('null_value -> NULL', 'null_value', 1, 'p_null_value', 'parser.py', 501), ('enum_value -> NAME', 'enum_value', 1, 'p_enum_value', 'parser.py', 507), ('enum_value -> FRAGMENT', 'enum_value', 1, 'p_enum_value', 'parser.py', 508), ('enum_value -> QUERY', 'enum_value', 1, 'p_enum_value', 'parser.py', 509), ('enum_value -> MUTATION', 'enum_value', 1, 'p_enum_value', 'parser.py', 510), ('enum_value -> ON', 'enum_value', 1, 'p_enum_value', 'parser.py', 511), ('list_value -> BRACKET_L value_list BRACKET_R', 'list_value', 3, 'p_list_value', 'parser.py', 517), ('list_value -> BRACKET_L BRACKET_R', 'list_value', 2, 'p_list_value', 'parser.py', 518), ('value_list -> value_list value', 'value_list', 2, 'p_value_list', 'parser.py', 524), ('value_list -> value', 'value_list', 1, 'p_value_list_single', 'parser.py', 530), ('const_list_value -> BRACKET_L const_value_list BRACKET_R', 'const_list_value', 3, 'p_const_list_value', 'parser.py', 536), ('const_list_value -> BRACKET_L BRACKET_R', 'const_list_value', 2, 'p_const_list_value', 'parser.py', 537), ('const_value_list -> const_value_list const_value', 'const_value_list', 2, 'p_const_value_list', 'parser.py', 543), ('const_value_list -> const_value', 'const_value_list', 1, 'p_const_value_list_single', 'parser.py', 549), ('object_value -> BRACE_L object_field_list BRACE_R', 'object_value', 3, 'p_object_value', 'parser.py', 555), ('object_value -> BRACE_L BRACE_R', 'object_value', 2, 'p_object_value', 'parser.py', 556), ('object_field_list -> object_field_list object_field', 'object_field_list', 2, 'p_object_field_list', 'parser.py', 562), ('object_field_list -> object_field', 'object_field_list', 1, 'p_object_field_list_single', 'parser.py', 570), ('object_field -> name COLON value', 'object_field', 3, 'p_object_field', 'parser.py', 576), ('const_object_value -> BRACE_L const_object_field_list BRACE_R', 'const_object_value', 3, 'p_const_object_value', 'parser.py', 582), ('const_object_value -> BRACE_L BRACE_R', 'const_object_value', 2, 'p_const_object_value', 'parser.py', 583), ('const_object_field_list -> const_object_field_list const_object_field', 'const_object_field_list', 2, 'p_const_object_field_list', 'parser.py', 589), ('const_object_field_list -> const_object_field', 'const_object_field_list', 1, 'p_const_object_field_list_single', 'parser.py', 597), ('const_object_field -> name COLON const_value', 'const_object_field', 3, 'p_const_object_field', 'parser.py', 603), ('type -> named_type', 'type', 1, 'p_type', 'parser.py', 609), ('type -> list_type', 'type', 1, 'p_type', 'parser.py', 610), ('type -> non_null_type', 'type', 1, 'p_type', 'parser.py', 611), ('named_type -> name', 'named_type', 1, 'p_named_type', 'parser.py', 617), ('list_type -> BRACKET_L type BRACKET_R', 'list_type', 3, 'p_list_type', 'parser.py', 623), ('non_null_type -> named_type BANG', 'non_null_type', 2, 'p_non_null_type', 'parser.py', 629), ('non_null_type -> list_type BANG', 'non_null_type', 2, 'p_non_null_type', 'parser.py', 630)] |
a = list(map(int, input().split()))
if sum(a) < 22:
print("win")
else:
print("bust")
| a = list(map(int, input().split()))
if sum(a) < 22:
print('win')
else:
print('bust') |
# for holding settings for use later
class IndividualSetting:
settingkey = ""
settingvalue = ""
| class Individualsetting:
settingkey = ''
settingvalue = '' |
#!/usr/bin/env python3
class Evaluate:
def __init__(self):
self.formula = []
self.result = ''
self.error = False
def eval(self, expression):
if (self.percent(expression)):
return self.result
if (self.sum(expression)):
return self.result
if (self.substract(expression)):
return self.result
if (self.multiply(expression)):
return self.result
if (self.divide(expression)):
return self.result
if (self.error):
return "Error"
return None
def percent(self, expression):
position = expression.find('%')
if position != -1:
number1 = expression[0:position]
try:
result = float(number1) / 100
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def sum(self, expression):
position = expression.find('+')
if position != -1:
if position == 0:
number1 = 0
else:
number1 = expression[0:position]
number2 = expression[position+1:len(expression)]
try:
result = float(number1) + float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def substract(self, expression):
position = expression.find('-')
if position != -1:
if position == 0:
number1 = 0
else:
number1 = expression[0:position]
number2 = expression[position+1:len(expression)]
try:
result = float(number1) - float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def multiply(self, expression):
position = expression.find('*')
if position != -1:
number1 = expression[0:position]
number2 = expression[position+1:len(expression)]
try:
result = float(number1) * float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def divide(self, expression):
position = expression.find('/')
if position != -1:
number1 = expression[0:position]
number2 = expression[position+1:len(expression)]
if number2 == '0':
self.error = True
return False
try:
result = float(number1) / float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def clear_result(self, result):
result = str(result)
if result[-2:] == '.0':
return result[:-2]
return result
| class Evaluate:
def __init__(self):
self.formula = []
self.result = ''
self.error = False
def eval(self, expression):
if self.percent(expression):
return self.result
if self.sum(expression):
return self.result
if self.substract(expression):
return self.result
if self.multiply(expression):
return self.result
if self.divide(expression):
return self.result
if self.error:
return 'Error'
return None
def percent(self, expression):
position = expression.find('%')
if position != -1:
number1 = expression[0:position]
try:
result = float(number1) / 100
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def sum(self, expression):
position = expression.find('+')
if position != -1:
if position == 0:
number1 = 0
else:
number1 = expression[0:position]
number2 = expression[position + 1:len(expression)]
try:
result = float(number1) + float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def substract(self, expression):
position = expression.find('-')
if position != -1:
if position == 0:
number1 = 0
else:
number1 = expression[0:position]
number2 = expression[position + 1:len(expression)]
try:
result = float(number1) - float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def multiply(self, expression):
position = expression.find('*')
if position != -1:
number1 = expression[0:position]
number2 = expression[position + 1:len(expression)]
try:
result = float(number1) * float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def divide(self, expression):
position = expression.find('/')
if position != -1:
number1 = expression[0:position]
number2 = expression[position + 1:len(expression)]
if number2 == '0':
self.error = True
return False
try:
result = float(number1) / float(number2)
self.result = self.clear_result(result)
except:
self.error = True
return False
return True
return False
def clear_result(self, result):
result = str(result)
if result[-2:] == '.0':
return result[:-2]
return result |
def covert(df, drop, rename, inflow_source):
print(df)
result = df.copy()
outflow = []
inflow = []
for _, row in df.iterrows():
if row.get(inflow_source) >= 0:
inflow.append(row.get(inflow_source))
outflow.append(0)
else:
inflow.append(0)
outflow.append(abs(row.get(inflow_source)))
result['Outflow'] = outflow
result['Inflow'] = inflow
result.drop(columns=drop, inplace=True)
result.rename(columns=rename, inplace=True)
print(result)
return result | def covert(df, drop, rename, inflow_source):
print(df)
result = df.copy()
outflow = []
inflow = []
for (_, row) in df.iterrows():
if row.get(inflow_source) >= 0:
inflow.append(row.get(inflow_source))
outflow.append(0)
else:
inflow.append(0)
outflow.append(abs(row.get(inflow_source)))
result['Outflow'] = outflow
result['Inflow'] = inflow
result.drop(columns=drop, inplace=True)
result.rename(columns=rename, inplace=True)
print(result)
return result |
#-*-python-*-
def guild_python_workspace():
native.new_http_archive(
name = "org_pyyaml",
build_file = "//third-party:pyyaml.BUILD",
urls = [
"https://pypi.python.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz",
],
strip_prefix = "PyYAML-3.12",
sha256 = "592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab",
)
native.new_http_archive(
name = "org_psutil",
build_file = "//third-party:psutil.BUILD",
urls = [
"https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz"
],
strip_prefix = "psutil-5.2.2",
sha256 = "44746540c0fab5b95401520d29eb9ffe84b3b4a235bd1d1971cbe36e1f38dd13",
)
native.new_http_archive(
name = "org_semantic_version",
build_file = "//third-party:semantic_version.BUILD",
urls = [
"https://pypi.python.org/packages/72/83/f76958017f3094b072d8e3a72d25c3ed65f754cc607fdb6a7b33d84ab1d5/semantic_version-2.6.0.tar.gz"
],
strip_prefix = "semantic_version-2.6.0",
sha256 = "2a4328680073e9b243667b201119772aefc5fc63ae32398d6afafff07c4f54c0",
)
native.new_http_archive(
name = "org_tqdm",
build_file = "//third-party:tqdm.BUILD",
urls = [
"https://pypi.python.org/packages/01/f7/2058bd94a903f445e8ff19c0af64b9456187acab41090ff2da21c7c7e193/tqdm-4.15.0.tar.gz"
],
strip_prefix = "tqdm-4.15.0",
sha256 = "6ec1dc74efacf2cda936b4a6cf4082ce224c76763bdec9f17e437c8cfcaa9953",
)
native.new_http_archive(
name = "org_click",
build_file = "//third-party:click.BUILD",
urls = [
"https://github.com/pallets/click/archive/752ff79d680fceb26d2a93f1eef376d90823ec47.zip",
],
strip_prefix = "click-752ff79d680fceb26d2a93f1eef376d90823ec47",
sha256 = "ecbdbd641b388b072b3b21d94622d7288df61a1e9643b978081d0ee173791c70",
)
| def guild_python_workspace():
native.new_http_archive(name='org_pyyaml', build_file='//third-party:pyyaml.BUILD', urls=['https://pypi.python.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz'], strip_prefix='PyYAML-3.12', sha256='592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab')
native.new_http_archive(name='org_psutil', build_file='//third-party:psutil.BUILD', urls=['https://pypi.python.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz'], strip_prefix='psutil-5.2.2', sha256='44746540c0fab5b95401520d29eb9ffe84b3b4a235bd1d1971cbe36e1f38dd13')
native.new_http_archive(name='org_semantic_version', build_file='//third-party:semantic_version.BUILD', urls=['https://pypi.python.org/packages/72/83/f76958017f3094b072d8e3a72d25c3ed65f754cc607fdb6a7b33d84ab1d5/semantic_version-2.6.0.tar.gz'], strip_prefix='semantic_version-2.6.0', sha256='2a4328680073e9b243667b201119772aefc5fc63ae32398d6afafff07c4f54c0')
native.new_http_archive(name='org_tqdm', build_file='//third-party:tqdm.BUILD', urls=['https://pypi.python.org/packages/01/f7/2058bd94a903f445e8ff19c0af64b9456187acab41090ff2da21c7c7e193/tqdm-4.15.0.tar.gz'], strip_prefix='tqdm-4.15.0', sha256='6ec1dc74efacf2cda936b4a6cf4082ce224c76763bdec9f17e437c8cfcaa9953')
native.new_http_archive(name='org_click', build_file='//third-party:click.BUILD', urls=['https://github.com/pallets/click/archive/752ff79d680fceb26d2a93f1eef376d90823ec47.zip'], strip_prefix='click-752ff79d680fceb26d2a93f1eef376d90823ec47', sha256='ecbdbd641b388b072b3b21d94622d7288df61a1e9643b978081d0ee173791c70') |
#
# PySNMP MIB module ENGENIUS-CLIENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENGENIUS-CLIENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:02:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
TimeTicks, IpAddress, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, iso, enterprises, Counter32, MibIdentifier, Integer32, ObjectIdentity, NotificationType, Counter64, Bits, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "IpAddress", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "iso", "enterprises", "Counter32", "MibIdentifier", "Integer32", "ObjectIdentity", "NotificationType", "Counter64", "Bits", "ModuleIdentity")
DisplayString, DateAndTime, TimeInterval, MacAddress, RowStatus, TextualConvention, TimeStamp, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "DateAndTime", "TimeInterval", "MacAddress", "RowStatus", "TextualConvention", "TimeStamp", "TruthValue")
engeniusmesh = ModuleIdentity((1, 3, 6, 1, 4, 1, 14125, 1))
engeniusmesh.setRevisions(('2007-05-02 10:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: engeniusmesh.setRevisionsDescriptions(('First Release for client purpose',))
if mibBuilder.loadTexts: engeniusmesh.setLastUpdated('200705021000Z')
if mibBuilder.loadTexts: engeniusmesh.setOrganization('Senao Networks, Inc')
if mibBuilder.loadTexts: engeniusmesh.setContactInfo('Senao Networks, Inc. No. 500, Fusing 3rd Rd, Hwa-Ya Technology Park Kuei-Shan Hsiang, Taoyuan County 333, Taiwan. Website: http://www.engeniustech.com/corporate/')
if mibBuilder.loadTexts: engeniusmesh.setDescription('MIB Definition used in the EnGenius Mesh Product Line: iso(1).org(3).dod(6).internet(1).private(4).enterprises(1). engenius(14125).engeniusmesh(1)')
engenius = MibIdentifier((1, 3, 6, 1, 4, 1, 14125))
nodeConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 14125, 1, 2))
nodeConfigurationSignallevel = MibIdentifier((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30))
signallevelTable = MibTable((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2), )
if mibBuilder.loadTexts: signallevelTable.setStatus('current')
if mibBuilder.loadTexts: signallevelTable.setDescription('This table contains the list of signal level between the node and its neighbour nodes.')
signallevelTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1), ).setIndexNames((0, "ENGENIUS-CLIENT-MIB", "signallevelTableIndex"))
if mibBuilder.loadTexts: signallevelTableEntry.setStatus('current')
if mibBuilder.loadTexts: signallevelTableEntry.setDescription('Represent the entry in the Signal Level table.')
signallevelTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 32)))
if mibBuilder.loadTexts: signallevelTableIndex.setStatus('current')
if mibBuilder.loadTexts: signallevelTableIndex.setDescription('Specify the index of the node Signal Level table.')
signallevelTableSource = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: signallevelTableSource.setStatus('current')
if mibBuilder.loadTexts: signallevelTableSource.setDescription("The source node's IP Address")
signallevelTableDestination = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 3), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: signallevelTableDestination.setStatus('current')
if mibBuilder.loadTexts: signallevelTableDestination.setDescription("The destination node's IP Address")
signallevelTableRssi = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: signallevelTableRssi.setStatus('current')
if mibBuilder.loadTexts: signallevelTableRssi.setDescription('The singal level between the source node and destination node in RSSI.')
signallevelExecute = MibScalar((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly")
if mibBuilder.loadTexts: signallevelExecute.setStatus('current')
if mibBuilder.loadTexts: signallevelExecute.setDescription('A command to execute the RSSI update')
clientInfoTable = MibTable((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3), )
if mibBuilder.loadTexts: clientInfoTable.setStatus('current')
if mibBuilder.loadTexts: clientInfoTable.setDescription('This table contains the list of clients info of the nodes.')
clientInfoTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1), ).setIndexNames((0, "ENGENIUS-CLIENT-MIB", "clientInfoTableIndex"))
if mibBuilder.loadTexts: clientInfoTableEntry.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableEntry.setDescription('Represent the entry in the Client Info table.')
clientInfoTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 64)))
if mibBuilder.loadTexts: clientInfoTableIndex.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableIndex.setDescription('Specify the index of the node Client Info table.')
clientInfoTableEssid = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: clientInfoTableEssid.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableEssid.setDescription('The ESSID of the AP')
clientInfoTableMac = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 3), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: clientInfoTableMac.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableMac.setDescription('The MAC Address of the client')
clientInfoTableChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: clientInfoTableChannel.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableChannel.setDescription('The channel of the Client')
clientInfoTableRate = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 5), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: clientInfoTableRate.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableRate.setDescription('The speed rate of the client in kbps')
clientInfoTableRssi = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 6), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: clientInfoTableRssi.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableRssi.setDescription('The singal level between the client and node in RSSI.')
clientInfoTableIdletime = MibTableColumn((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 7), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: clientInfoTableIdletime.setStatus('current')
if mibBuilder.loadTexts: clientInfoTableIdletime.setDescription('The idle timeout in second of the client.')
mibBuilder.exportSymbols("ENGENIUS-CLIENT-MIB", signallevelTableEntry=signallevelTableEntry, clientInfoTableMac=clientInfoTableMac, signallevelTableDestination=signallevelTableDestination, clientInfoTableEssid=clientInfoTableEssid, clientInfoTableEntry=clientInfoTableEntry, signallevelExecute=signallevelExecute, clientInfoTableRate=clientInfoTableRate, nodeConfigurationSignallevel=nodeConfigurationSignallevel, clientInfoTableIdletime=clientInfoTableIdletime, PYSNMP_MODULE_ID=engeniusmesh, nodeConfiguration=nodeConfiguration, clientInfoTableRssi=clientInfoTableRssi, signallevelTable=signallevelTable, clientInfoTableIndex=clientInfoTableIndex, signallevelTableRssi=signallevelTableRssi, engeniusmesh=engeniusmesh, clientInfoTableChannel=clientInfoTableChannel, signallevelTableIndex=signallevelTableIndex, signallevelTableSource=signallevelTableSource, clientInfoTable=clientInfoTable, engenius=engenius)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(time_ticks, ip_address, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, iso, enterprises, counter32, mib_identifier, integer32, object_identity, notification_type, counter64, bits, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'IpAddress', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'iso', 'enterprises', 'Counter32', 'MibIdentifier', 'Integer32', 'ObjectIdentity', 'NotificationType', 'Counter64', 'Bits', 'ModuleIdentity')
(display_string, date_and_time, time_interval, mac_address, row_status, textual_convention, time_stamp, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'DateAndTime', 'TimeInterval', 'MacAddress', 'RowStatus', 'TextualConvention', 'TimeStamp', 'TruthValue')
engeniusmesh = module_identity((1, 3, 6, 1, 4, 1, 14125, 1))
engeniusmesh.setRevisions(('2007-05-02 10:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
engeniusmesh.setRevisionsDescriptions(('First Release for client purpose',))
if mibBuilder.loadTexts:
engeniusmesh.setLastUpdated('200705021000Z')
if mibBuilder.loadTexts:
engeniusmesh.setOrganization('Senao Networks, Inc')
if mibBuilder.loadTexts:
engeniusmesh.setContactInfo('Senao Networks, Inc. No. 500, Fusing 3rd Rd, Hwa-Ya Technology Park Kuei-Shan Hsiang, Taoyuan County 333, Taiwan. Website: http://www.engeniustech.com/corporate/')
if mibBuilder.loadTexts:
engeniusmesh.setDescription('MIB Definition used in the EnGenius Mesh Product Line: iso(1).org(3).dod(6).internet(1).private(4).enterprises(1). engenius(14125).engeniusmesh(1)')
engenius = mib_identifier((1, 3, 6, 1, 4, 1, 14125))
node_configuration = mib_identifier((1, 3, 6, 1, 4, 1, 14125, 1, 2))
node_configuration_signallevel = mib_identifier((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30))
signallevel_table = mib_table((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2))
if mibBuilder.loadTexts:
signallevelTable.setStatus('current')
if mibBuilder.loadTexts:
signallevelTable.setDescription('This table contains the list of signal level between the node and its neighbour nodes.')
signallevel_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1)).setIndexNames((0, 'ENGENIUS-CLIENT-MIB', 'signallevelTableIndex'))
if mibBuilder.loadTexts:
signallevelTableEntry.setStatus('current')
if mibBuilder.loadTexts:
signallevelTableEntry.setDescription('Represent the entry in the Signal Level table.')
signallevel_table_index = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 32)))
if mibBuilder.loadTexts:
signallevelTableIndex.setStatus('current')
if mibBuilder.loadTexts:
signallevelTableIndex.setDescription('Specify the index of the node Signal Level table.')
signallevel_table_source = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 2), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
signallevelTableSource.setStatus('current')
if mibBuilder.loadTexts:
signallevelTableSource.setDescription("The source node's IP Address")
signallevel_table_destination = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 3), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
signallevelTableDestination.setStatus('current')
if mibBuilder.loadTexts:
signallevelTableDestination.setDescription("The destination node's IP Address")
signallevel_table_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 2, 1, 4), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
signallevelTableRssi.setStatus('current')
if mibBuilder.loadTexts:
signallevelTableRssi.setDescription('The singal level between the source node and destination node in RSSI.')
signallevel_execute = mib_scalar((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
signallevelExecute.setStatus('current')
if mibBuilder.loadTexts:
signallevelExecute.setDescription('A command to execute the RSSI update')
client_info_table = mib_table((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3))
if mibBuilder.loadTexts:
clientInfoTable.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTable.setDescription('This table contains the list of clients info of the nodes.')
client_info_table_entry = mib_table_row((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1)).setIndexNames((0, 'ENGENIUS-CLIENT-MIB', 'clientInfoTableIndex'))
if mibBuilder.loadTexts:
clientInfoTableEntry.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableEntry.setDescription('Represent the entry in the Client Info table.')
client_info_table_index = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 64)))
if mibBuilder.loadTexts:
clientInfoTableIndex.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableIndex.setDescription('Specify the index of the node Client Info table.')
client_info_table_essid = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 2), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
clientInfoTableEssid.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableEssid.setDescription('The ESSID of the AP')
client_info_table_mac = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 3), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
clientInfoTableMac.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableMac.setDescription('The MAC Address of the client')
client_info_table_channel = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 4), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
clientInfoTableChannel.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableChannel.setDescription('The channel of the Client')
client_info_table_rate = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 5), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
clientInfoTableRate.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableRate.setDescription('The speed rate of the client in kbps')
client_info_table_rssi = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 6), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
clientInfoTableRssi.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableRssi.setDescription('The singal level between the client and node in RSSI.')
client_info_table_idletime = mib_table_column((1, 3, 6, 1, 4, 1, 14125, 1, 2, 30, 3, 1, 7), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
clientInfoTableIdletime.setStatus('current')
if mibBuilder.loadTexts:
clientInfoTableIdletime.setDescription('The idle timeout in second of the client.')
mibBuilder.exportSymbols('ENGENIUS-CLIENT-MIB', signallevelTableEntry=signallevelTableEntry, clientInfoTableMac=clientInfoTableMac, signallevelTableDestination=signallevelTableDestination, clientInfoTableEssid=clientInfoTableEssid, clientInfoTableEntry=clientInfoTableEntry, signallevelExecute=signallevelExecute, clientInfoTableRate=clientInfoTableRate, nodeConfigurationSignallevel=nodeConfigurationSignallevel, clientInfoTableIdletime=clientInfoTableIdletime, PYSNMP_MODULE_ID=engeniusmesh, nodeConfiguration=nodeConfiguration, clientInfoTableRssi=clientInfoTableRssi, signallevelTable=signallevelTable, clientInfoTableIndex=clientInfoTableIndex, signallevelTableRssi=signallevelTableRssi, engeniusmesh=engeniusmesh, clientInfoTableChannel=clientInfoTableChannel, signallevelTableIndex=signallevelTableIndex, signallevelTableSource=signallevelTableSource, clientInfoTable=clientInfoTable, engenius=engenius) |
# Habibu-R-ahman
# 7th Jan, 2021
a = float(input())
salary = money = percentage = None
if a <= 400:
salary = a * 1.15
percentage = 15
elif a <= 800:
salary = a * 1.12
percentage = 12
elif a <= 1200:
salary = a * 1.10
percentage = 10
elif a <= 2000:
salary = a * 1.07
percentage = 7
else:
salary = a * 1.04
percentage = 4
print(f"Novo salario: {salary:.2f}")
print(f"Reajuste ganho: {salary - a:.2f}")
print(f"Em percentual: {percentage} %") | a = float(input())
salary = money = percentage = None
if a <= 400:
salary = a * 1.15
percentage = 15
elif a <= 800:
salary = a * 1.12
percentage = 12
elif a <= 1200:
salary = a * 1.1
percentage = 10
elif a <= 2000:
salary = a * 1.07
percentage = 7
else:
salary = a * 1.04
percentage = 4
print(f'Novo salario: {salary:.2f}')
print(f'Reajuste ganho: {salary - a:.2f}')
print(f'Em percentual: {percentage} %') |
def arbitage(plen):
lst1=list(permutations(lst,plen))
for j in [[0]+list(i)+[0] for i in lst1]:
val=1
length=len(j)
print([x+1 for x in j])
index=0
for k in j:
if index+1>=length:
break
print("index:{}, index+1:{},val:{}".format(j[index],j[index+1],vals[j[index]][j[index+1]]))
val=vals[j[index]][j[index+1]]*val
index+=1
print(val,(val-1)*100)
arbitage(1)
if __name__=="__main__":
dim=int(input())
lst=list(range(0,dim))
vals=[]
counter=0
for line in sys.stdin:
temp = list(map(float, line.split()))
temp.insert(counter,1)
counter+=1
vals.append(temp)
print(vals) | def arbitage(plen):
lst1 = list(permutations(lst, plen))
for j in [[0] + list(i) + [0] for i in lst1]:
val = 1
length = len(j)
print([x + 1 for x in j])
index = 0
for k in j:
if index + 1 >= length:
break
print('index:{}, index+1:{},val:{}'.format(j[index], j[index + 1], vals[j[index]][j[index + 1]]))
val = vals[j[index]][j[index + 1]] * val
index += 1
print(val, (val - 1) * 100)
arbitage(1)
if __name__ == '__main__':
dim = int(input())
lst = list(range(0, dim))
vals = []
counter = 0
for line in sys.stdin:
temp = list(map(float, line.split()))
temp.insert(counter, 1)
counter += 1
vals.append(temp)
print(vals) |
class Http:
def __init__(self, session):
self.session = session
async def download(self, url: str):
async with self.session.get(url, timeout=10) as res:
if res.status == 200:
return await res.read()
else:
return None
async def get_headers(self, url: str):
async with self.session.head(url, timeout=10) as res:
if res.status == 200:
return res.headers
| class Http:
def __init__(self, session):
self.session = session
async def download(self, url: str):
async with self.session.get(url, timeout=10) as res:
if res.status == 200:
return await res.read()
else:
return None
async def get_headers(self, url: str):
async with self.session.head(url, timeout=10) as res:
if res.status == 200:
return res.headers |
# Pretty lame athlete model
LT = 160
REST_HR = 50
MAX_HR = 175
| lt = 160
rest_hr = 50
max_hr = 175 |
class User:
def __init__(self, id, first_name, last_name, email, account_creation_date):
self.id = id
self.first_name = first_name
self.last_name = last_name
self.email = email
self.account_creation_date = account_creation_date | class User:
def __init__(self, id, first_name, last_name, email, account_creation_date):
self.id = id
self.first_name = first_name
self.last_name = last_name
self.email = email
self.account_creation_date = account_creation_date |
frase = 'Curso em video Python'
print(frase[5::2])
print('''jfafj aj fjaljsfkjasj fkasjfkaj sfjsajfljslkjjf
a fsjdfjs flasjfkldjfdjsfjasjfjaskjfsjfk sdkf
sjfsd fskjfs asfjlkds fjsf sdjflksjfslfs
s fslfjklsdjfsjfjlsjfklsjkfksldfk dsjfsdf''')
| frase = 'Curso em video Python'
print(frase[5::2])
print('jfafj aj fjaljsfkjasj fkasjfkaj sfjsajfljslkjjf\na fsjdfjs flasjfkldjfdjsfjasjfjaskjfsjfk sdkf \nsjfsd fskjfs asfjlkds fjsf sdjflksjfslfs\ns fslfjklsdjfsjfjlsjfklsjkfksldfk dsjfsdf') |
BRANCHES = {
'AdditiveExpression' : {
"!" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"(" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"+" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"-" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"BOUND" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"DATATYPE" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"LANG" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"LANGMATCHES" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"REGEX" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"STR" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'BooleanLiteral' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'DECIMAL' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'DOUBLE' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'INTEGER' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'IRI_REF' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'PNAME_LN' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'PNAME_NS' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'STRING_LITERAL1' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'STRING_LITERAL2' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'STRING_LITERAL_LONG1' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'STRING_LITERAL_LONG2' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'VAR1' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
'VAR2' : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"ISBLANK" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"ISIRI" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"ISLITERAL" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"ISURI" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"SAMETERM" : ['MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
},
'ArgList' : {
"(" : ["(",
'_Expression_COMMA_Expression_Star',
")"],
'NIL' : ['NIL'],
},
'AskQuery' : {
"ASK" : ["ASK",
'_DatasetClause_Star',
'WhereClause'],
},
'BaseDecl' : {
"BASE" : ["BASE",
'IRI_REF'],
},
'BlankNode' : {
'ANON' : ['ANON'],
'BLANK_NODE_LABEL' : ['BLANK_NODE_LABEL'],
},
'BlankNodePropertyList' : {
"[" : ["[",
'PropertyListNotEmpty',
"]"],
},
'BrackettedExpression' : {
"(" : ["(",
'Expression',
")"],
},
'BuiltInCall' : {
"BOUND" : ["BOUND",
"(",
'Var',
")"],
"DATATYPE" : ["DATATYPE",
"(",
'Expression',
")"],
"LANG" : ["LANG",
"(",
'Expression',
")"],
"LANGMATCHES" : ["LANGMATCHES",
"(",
'Expression',
",",
'Expression',
")"],
"REGEX" : ['RegexExpression'],
"STR" : ["STR",
"(",
'Expression',
")"],
"ISBLANK" : ["ISBLANK",
"(",
'Expression',
")"],
"ISIRI" : ["ISIRI",
"(",
'Expression',
")"],
"ISLITERAL" : ["ISLITERAL",
"(",
'Expression',
")"],
"ISURI" : ["ISURI",
"(",
'Expression',
")"],
"SAMETERM" : ["SAMETERM",
"(",
'Expression',
",",
'Expression',
")"],
},
'Collection' : {
"(" : ["(",
'_GraphNode_Plus',
")"],
},
'ConditionalAndExpression' : {
"!" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"(" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"+" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"-" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"BOUND" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"DATATYPE" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"LANG" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"LANGMATCHES" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"REGEX" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"STR" : ['ValueLogical',
'_AND_ValueLogical_Star'],
'BooleanLiteral' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'DECIMAL' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'DOUBLE' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'INTEGER' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'IRI_REF' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'PNAME_LN' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'PNAME_NS' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'STRING_LITERAL1' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'STRING_LITERAL2' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'STRING_LITERAL_LONG1' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'STRING_LITERAL_LONG2' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'VAR1' : ['ValueLogical',
'_AND_ValueLogical_Star'],
'VAR2' : ['ValueLogical',
'_AND_ValueLogical_Star'],
"ISBLANK" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"ISIRI" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"ISLITERAL" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"ISURI" : ['ValueLogical',
'_AND_ValueLogical_Star'],
"SAMETERM" : ['ValueLogical',
'_AND_ValueLogical_Star'],
},
'ConditionalOrExpression' : {
"!" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"(" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"+" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"-" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"BOUND" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"DATATYPE" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"LANG" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"LANGMATCHES" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"REGEX" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"STR" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'BooleanLiteral' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'DECIMAL' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'DOUBLE' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'INTEGER' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'IRI_REF' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'PNAME_LN' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'PNAME_NS' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'STRING_LITERAL1' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'STRING_LITERAL2' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'STRING_LITERAL_LONG1' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'STRING_LITERAL_LONG2' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'VAR1' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
'VAR2' : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"ISBLANK" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"ISIRI" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"ISLITERAL" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"ISURI" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
"SAMETERM" : ['ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
},
'Constraint' : {
"(" : ['BrackettedExpression'],
"BOUND" : ['BuiltInCall'],
"DATATYPE" : ['BuiltInCall'],
"LANG" : ['BuiltInCall'],
"LANGMATCHES" : ['BuiltInCall'],
"REGEX" : ['BuiltInCall'],
"STR" : ['BuiltInCall'],
'IRI_REF' : ['FunctionCall'],
'PNAME_LN' : ['FunctionCall'],
'PNAME_NS' : ['FunctionCall'],
"ISBLANK" : ['BuiltInCall'],
"ISIRI" : ['BuiltInCall'],
"ISLITERAL" : ['BuiltInCall'],
"ISURI" : ['BuiltInCall'],
"SAMETERM" : ['BuiltInCall'],
},
'ConstructQuery' : {
"CONSTRUCT" : ["CONSTRUCT",
'ConstructTemplate',
'_DatasetClause_Star',
'WhereClause',
'SolutionModifier'],
},
'ConstructTemplate' : {
"{" : ["{",
'_ConstructTriples_Opt',
"}"],
},
'ConstructTriples' : {
"(" : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
"+" : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
"-" : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
"[" : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'ANON' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'BLANK_NODE_LABEL' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'BooleanLiteral' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'DECIMAL' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'DOUBLE' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'INTEGER' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'IRI_REF' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'NIL' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'PNAME_LN' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'PNAME_NS' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'STRING_LITERAL1' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'STRING_LITERAL2' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'STRING_LITERAL_LONG1' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'STRING_LITERAL_LONG2' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'VAR1' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
'VAR2' : ['TriplesSameSubject',
'_DOT_ConstructTriples_Opt_Opt'],
},
'DatasetClause' : {
"FROM" : ["FROM",
'_DefaultGraphClause_or_NamedGraphClause'],
},
'DefaultGraphClause' : {
'IRI_REF' : ['SourceSelector'],
'PNAME_LN' : ['SourceSelector'],
'PNAME_NS' : ['SourceSelector'],
},
'DescribeQuery' : {
"DESCRIBE" : ["DESCRIBE",
'_VarOrIRIref_Plus_or_Star',
'_DatasetClause_Star',
'_WhereClause_Opt',
'SolutionModifier'],
},
'Expression' : {
"!" : ['ConditionalOrExpression'],
"(" : ['ConditionalOrExpression'],
"+" : ['ConditionalOrExpression'],
"-" : ['ConditionalOrExpression'],
"BOUND" : ['ConditionalOrExpression'],
"DATATYPE" : ['ConditionalOrExpression'],
"LANG" : ['ConditionalOrExpression'],
"LANGMATCHES" : ['ConditionalOrExpression'],
"REGEX" : ['ConditionalOrExpression'],
"STR" : ['ConditionalOrExpression'],
'BooleanLiteral' : ['ConditionalOrExpression'],
'DECIMAL' : ['ConditionalOrExpression'],
'DOUBLE' : ['ConditionalOrExpression'],
'INTEGER' : ['ConditionalOrExpression'],
'IRI_REF' : ['ConditionalOrExpression'],
'PNAME_LN' : ['ConditionalOrExpression'],
'PNAME_NS' : ['ConditionalOrExpression'],
'STRING_LITERAL1' : ['ConditionalOrExpression'],
'STRING_LITERAL2' : ['ConditionalOrExpression'],
'STRING_LITERAL_LONG1' : ['ConditionalOrExpression'],
'STRING_LITERAL_LONG2' : ['ConditionalOrExpression'],
'VAR1' : ['ConditionalOrExpression'],
'VAR2' : ['ConditionalOrExpression'],
"ISBLANK" : ['ConditionalOrExpression'],
"ISIRI" : ['ConditionalOrExpression'],
"ISLITERAL" : ['ConditionalOrExpression'],
"ISURI" : ['ConditionalOrExpression'],
"SAMETERM" : ['ConditionalOrExpression'],
},
'Filter' : {
"FILTER" : ["FILTER",
'Constraint'],
},
'FunctionCall' : {
'IRI_REF' : ['IRIref',
'ArgList'],
'PNAME_LN' : ['IRIref',
'ArgList'],
'PNAME_NS' : ['IRIref',
'ArgList'],
},
'GraphGraphPattern' : {
"GRAPH" : ["GRAPH",
'VarOrIRIref',
'GroupGraphPattern'],
},
'GraphNode' : {
"(" : ['TriplesNode'],
"+" : ['VarOrTerm'],
"-" : ['VarOrTerm'],
"[" : ['TriplesNode'],
'ANON' : ['VarOrTerm'],
'BLANK_NODE_LABEL' : ['VarOrTerm'],
'BooleanLiteral' : ['VarOrTerm'],
'DECIMAL' : ['VarOrTerm'],
'DOUBLE' : ['VarOrTerm'],
'INTEGER' : ['VarOrTerm'],
'IRI_REF' : ['VarOrTerm'],
'NIL' : ['VarOrTerm'],
'PNAME_LN' : ['VarOrTerm'],
'PNAME_NS' : ['VarOrTerm'],
'STRING_LITERAL1' : ['VarOrTerm'],
'STRING_LITERAL2' : ['VarOrTerm'],
'STRING_LITERAL_LONG1' : ['VarOrTerm'],
'STRING_LITERAL_LONG2' : ['VarOrTerm'],
'VAR1' : ['VarOrTerm'],
'VAR2' : ['VarOrTerm'],
},
'GraphPatternNotTriples' : {
"GRAPH" : ['GraphGraphPattern'],
"OPTIONAL" : ['OptionalGraphPattern'],
"{" : ['GroupOrUnionGraphPattern'],
},
'GraphTerm' : {
"+" : ['NumericLiteral'],
"-" : ['NumericLiteral'],
'ANON' : ['BlankNode'],
'BLANK_NODE_LABEL' : ['BlankNode'],
'BooleanLiteral' : ['BooleanLiteral'],
'DECIMAL' : ['NumericLiteral'],
'DOUBLE' : ['NumericLiteral'],
'INTEGER' : ['NumericLiteral'],
'IRI_REF' : ['IRIref'],
'NIL' : ['NIL'],
'PNAME_LN' : ['IRIref'],
'PNAME_NS' : ['IRIref'],
'STRING_LITERAL1' : ['RDFLiteral'],
'STRING_LITERAL2' : ['RDFLiteral'],
'STRING_LITERAL_LONG1' : ['RDFLiteral'],
'STRING_LITERAL_LONG2' : ['RDFLiteral'],
},
'GroupGraphPattern' : {
"{" : ["{",
'_TriplesBlock_Opt',
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star',
"}"],
},
'GroupOrUnionGraphPattern' : {
"{" : ['GroupGraphPattern',
'_UNION_GroupGraphPattern_Star'],
},
'IRIref' : {
'IRI_REF' : ['IRI_REF'],
'PNAME_LN' : ['PrefixedName'],
'PNAME_NS' : ['PrefixedName'],
},
'IRIrefOrFunction' : {
'IRI_REF' : ['IRIref',
'_ArgList_Opt'],
'PNAME_LN' : ['IRIref',
'_ArgList_Opt'],
'PNAME_NS' : ['IRIref',
'_ArgList_Opt'],
},
'LimitClause' : {
"LIMIT" : ["LIMIT",
'INTEGER'],
},
'LimitOffsetClauses' : {
"LIMIT" : ['LimitClause',
'_OffsetClause_Opt'],
"OFFSET" : ['OffsetClause',
'_LimitClause_Opt'],
},
'MultiplicativeExpression' : {
"!" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"(" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"+" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"-" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"BOUND" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"DATATYPE" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"LANG" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"LANGMATCHES" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"REGEX" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"STR" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'BooleanLiteral' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'DECIMAL' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'DOUBLE' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'INTEGER' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'IRI_REF' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'PNAME_LN' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'PNAME_NS' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'STRING_LITERAL1' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'STRING_LITERAL2' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'STRING_LITERAL_LONG1' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'STRING_LITERAL_LONG2' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'VAR1' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
'VAR2' : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"ISBLANK" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"ISIRI" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"ISLITERAL" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"ISURI" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"SAMETERM" : ['UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
},
'NamedGraphClause' : {
"NAMED" : ["NAMED",
'SourceSelector'],
},
'NumericExpression' : {
"!" : ['AdditiveExpression'],
"(" : ['AdditiveExpression'],
"+" : ['AdditiveExpression'],
"-" : ['AdditiveExpression'],
"BOUND" : ['AdditiveExpression'],
"DATATYPE" : ['AdditiveExpression'],
"LANG" : ['AdditiveExpression'],
"LANGMATCHES" : ['AdditiveExpression'],
"REGEX" : ['AdditiveExpression'],
"STR" : ['AdditiveExpression'],
'BooleanLiteral' : ['AdditiveExpression'],
'DECIMAL' : ['AdditiveExpression'],
'DOUBLE' : ['AdditiveExpression'],
'INTEGER' : ['AdditiveExpression'],
'IRI_REF' : ['AdditiveExpression'],
'PNAME_LN' : ['AdditiveExpression'],
'PNAME_NS' : ['AdditiveExpression'],
'STRING_LITERAL1' : ['AdditiveExpression'],
'STRING_LITERAL2' : ['AdditiveExpression'],
'STRING_LITERAL_LONG1' : ['AdditiveExpression'],
'STRING_LITERAL_LONG2' : ['AdditiveExpression'],
'VAR1' : ['AdditiveExpression'],
'VAR2' : ['AdditiveExpression'],
"ISBLANK" : ['AdditiveExpression'],
"ISIRI" : ['AdditiveExpression'],
"ISLITERAL" : ['AdditiveExpression'],
"ISURI" : ['AdditiveExpression'],
"SAMETERM" : ['AdditiveExpression'],
},
'NumericLiteral' : {
"+" : ['NumericLiteralPositive'],
"-" : ['NumericLiteralNegative'],
'DECIMAL' : ['NumericLiteralUnsigned'],
'DOUBLE' : ['NumericLiteralUnsigned'],
'INTEGER' : ['NumericLiteralUnsigned'],
},
'NumericLiteralNegative' : {
"-" : ["-",
'NumericLiteralUnsigned'],
},
'NumericLiteralPositive' : {
"+" : ["+",
'NumericLiteralUnsigned'],
},
'NumericLiteralUnsigned' : {
'DECIMAL' : ['DECIMAL'],
'DOUBLE' : ['DOUBLE'],
'INTEGER' : ['INTEGER'],
},
'Object' : {
"(" : ['GraphNode'],
"+" : ['GraphNode'],
"-" : ['GraphNode'],
"[" : ['GraphNode'],
'ANON' : ['GraphNode'],
'BLANK_NODE_LABEL' : ['GraphNode'],
'BooleanLiteral' : ['GraphNode'],
'DECIMAL' : ['GraphNode'],
'DOUBLE' : ['GraphNode'],
'INTEGER' : ['GraphNode'],
'IRI_REF' : ['GraphNode'],
'NIL' : ['GraphNode'],
'PNAME_LN' : ['GraphNode'],
'PNAME_NS' : ['GraphNode'],
'STRING_LITERAL1' : ['GraphNode'],
'STRING_LITERAL2' : ['GraphNode'],
'STRING_LITERAL_LONG1' : ['GraphNode'],
'STRING_LITERAL_LONG2' : ['GraphNode'],
'VAR1' : ['GraphNode'],
'VAR2' : ['GraphNode'],
},
'ObjectList' : {
"(" : ['Object',
'_COMMA_Object_Star'],
"+" : ['Object',
'_COMMA_Object_Star'],
"-" : ['Object',
'_COMMA_Object_Star'],
"[" : ['Object',
'_COMMA_Object_Star'],
'ANON' : ['Object',
'_COMMA_Object_Star'],
'BLANK_NODE_LABEL' : ['Object',
'_COMMA_Object_Star'],
'BooleanLiteral' : ['Object',
'_COMMA_Object_Star'],
'DECIMAL' : ['Object',
'_COMMA_Object_Star'],
'DOUBLE' : ['Object',
'_COMMA_Object_Star'],
'INTEGER' : ['Object',
'_COMMA_Object_Star'],
'IRI_REF' : ['Object',
'_COMMA_Object_Star'],
'NIL' : ['Object',
'_COMMA_Object_Star'],
'PNAME_LN' : ['Object',
'_COMMA_Object_Star'],
'PNAME_NS' : ['Object',
'_COMMA_Object_Star'],
'STRING_LITERAL1' : ['Object',
'_COMMA_Object_Star'],
'STRING_LITERAL2' : ['Object',
'_COMMA_Object_Star'],
'STRING_LITERAL_LONG1' : ['Object',
'_COMMA_Object_Star'],
'STRING_LITERAL_LONG2' : ['Object',
'_COMMA_Object_Star'],
'VAR1' : ['Object',
'_COMMA_Object_Star'],
'VAR2' : ['Object',
'_COMMA_Object_Star'],
},
'OffsetClause' : {
"OFFSET" : ["OFFSET",
'INTEGER'],
},
'OptionalGraphPattern' : {
"OPTIONAL" : ["OPTIONAL",
'GroupGraphPattern'],
},
'OrderClause' : {
"ORDER" : ["ORDER",
"BY",
'OrderCondition',
'_OrderCondition_Plus'],
},
'OrderCondition' : {
"(" : ['_Constraint_or_Var'],
"ASC" : ['_ASC_Or_DESC_BrackettedExpression'],
"BOUND" : ['_Constraint_or_Var'],
"DATATYPE" : ['_Constraint_or_Var'],
"DESC" : ['_ASC_Or_DESC_BrackettedExpression'],
"LANG" : ['_Constraint_or_Var'],
"LANGMATCHES" : ['_Constraint_or_Var'],
"REGEX" : ['_Constraint_or_Var'],
"STR" : ['_Constraint_or_Var'],
'IRI_REF' : ['_Constraint_or_Var'],
'PNAME_LN' : ['_Constraint_or_Var'],
'PNAME_NS' : ['_Constraint_or_Var'],
'VAR1' : ['_Constraint_or_Var'],
'VAR2' : ['_Constraint_or_Var'],
"ISBLANK" : ['_Constraint_or_Var'],
"ISIRI" : ['_Constraint_or_Var'],
"ISLITERAL" : ['_Constraint_or_Var'],
"ISURI" : ['_Constraint_or_Var'],
"SAMETERM" : ['_Constraint_or_Var'],
},
'PrefixDecl' : {
"PREFIX" : ["PREFIX",
'PNAME_NS',
'IRI_REF'],
},
'PrefixedName' : {
'PNAME_LN' : ['PNAME_LN'],
'PNAME_NS' : ['PNAME_NS'],
},
'PrimaryExpression' : {
"(" : ['BrackettedExpression'],
"+" : ['NumericLiteral'],
"-" : ['NumericLiteral'],
"BOUND" : ['BuiltInCall'],
"DATATYPE" : ['BuiltInCall'],
"LANG" : ['BuiltInCall'],
"LANGMATCHES" : ['BuiltInCall'],
"REGEX" : ['BuiltInCall'],
"STR" : ['BuiltInCall'],
'BooleanLiteral' : ['BooleanLiteral'],
'DECIMAL' : ['NumericLiteral'],
'DOUBLE' : ['NumericLiteral'],
'INTEGER' : ['NumericLiteral'],
'IRI_REF' : ['IRIrefOrFunction'],
'PNAME_LN' : ['IRIrefOrFunction'],
'PNAME_NS' : ['IRIrefOrFunction'],
'STRING_LITERAL1' : ['RDFLiteral'],
'STRING_LITERAL2' : ['RDFLiteral'],
'STRING_LITERAL_LONG1' : ['RDFLiteral'],
'STRING_LITERAL_LONG2' : ['RDFLiteral'],
'VAR1' : ['Var'],
'VAR2' : ['Var'],
"ISBLANK" : ['BuiltInCall'],
"ISIRI" : ['BuiltInCall'],
"ISLITERAL" : ['BuiltInCall'],
"ISURI" : ['BuiltInCall'],
"SAMETERM" : ['BuiltInCall'],
},
'Prologue' : {
"ASK" : ['_BaseDecl_Opt',
'_PrefixDecl_Star'],
"BASE" : ['_BaseDecl_Opt',
'_PrefixDecl_Star'],
"CONSTRUCT" : ['_BaseDecl_Opt',
'_PrefixDecl_Star'],
"DESCRIBE" : ['_BaseDecl_Opt',
'_PrefixDecl_Star'],
"PREFIX" : ['_BaseDecl_Opt',
'_PrefixDecl_Star'],
"SELECT" : ['_BaseDecl_Opt',
'_PrefixDecl_Star'],
},
'PropertyList' : {
"." : [],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"a" : ['PropertyListNotEmpty'],
'IRI_REF' : ['PropertyListNotEmpty'],
'PNAME_LN' : ['PropertyListNotEmpty'],
'PNAME_NS' : ['PropertyListNotEmpty'],
'VAR1' : ['PropertyListNotEmpty'],
'VAR2' : ['PropertyListNotEmpty'],
"{" : [],
"}" : [],
},
'PropertyListNotEmpty' : {
"a" : ['Verb',
'ObjectList',
'_SEMI_Verb_ObjectList_Opt_Star'],
'IRI_REF' : ['Verb',
'ObjectList',
'_SEMI_Verb_ObjectList_Opt_Star'],
'PNAME_LN' : ['Verb',
'ObjectList',
'_SEMI_Verb_ObjectList_Opt_Star'],
'PNAME_NS' : ['Verb',
'ObjectList',
'_SEMI_Verb_ObjectList_Opt_Star'],
'VAR1' : ['Verb',
'ObjectList',
'_SEMI_Verb_ObjectList_Opt_Star'],
'VAR2' : ['Verb',
'ObjectList',
'_SEMI_Verb_ObjectList_Opt_Star'],
},
'Query' : {
"ASK" : ['Prologue',
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery',
'eof'],
"BASE" : ['Prologue',
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery',
'eof'],
"CONSTRUCT" : ['Prologue',
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery',
'eof'],
"DESCRIBE" : ['Prologue',
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery',
'eof'],
"PREFIX" : ['Prologue',
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery',
'eof'],
"SELECT" : ['Prologue',
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery',
'eof'],
},
'RDFLiteral' : {
'STRING_LITERAL1' : ['String',
'_LANGTAG_IRIref_Opt'],
'STRING_LITERAL2' : ['String',
'_LANGTAG_IRIref_Opt'],
'STRING_LITERAL_LONG1' : ['String',
'_LANGTAG_IRIref_Opt'],
'STRING_LITERAL_LONG2' : ['String',
'_LANGTAG_IRIref_Opt'],
},
'RegexExpression' : {
"REGEX" : ["REGEX",
"(",
'Expression',
",",
'Expression',
'_COMMA_Expression_Opt',
")"],
},
'RelationalExpression' : {
"!" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"(" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"+" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"-" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"BOUND" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"DATATYPE" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"LANG" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"LANGMATCHES" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"REGEX" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"STR" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'BooleanLiteral' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'DECIMAL' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'DOUBLE' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'INTEGER' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'IRI_REF' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'PNAME_LN' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'PNAME_NS' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'STRING_LITERAL1' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'STRING_LITERAL2' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'STRING_LITERAL_LONG1' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'STRING_LITERAL_LONG2' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'VAR1' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
'VAR2' : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"ISBLANK" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"ISIRI" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"ISLITERAL" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"ISURI" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
"SAMETERM" : ['NumericExpression',
'_Compare_NumericExpression_Opt'],
},
'SelectQuery' : {
"SELECT" : ["SELECT",
'_DISTINCT_OR_REDUCED_Opt',
'_Var_Plus_or_Star',
'_DatasetClause_Star',
'WhereClause',
'SolutionModifier'],
},
'SolutionModifier' : {
"LIMIT" : ['_OrderClause_Opt',
'_LimitOffsetClauses_Opt'],
"OFFSET" : ['_OrderClause_Opt',
'_LimitOffsetClauses_Opt'],
"ORDER" : ['_OrderClause_Opt',
'_LimitOffsetClauses_Opt'],
'eof' : ['_OrderClause_Opt',
'_LimitOffsetClauses_Opt'],
},
'SourceSelector' : {
'IRI_REF' : ['IRIref'],
'PNAME_LN' : ['IRIref'],
'PNAME_NS' : ['IRIref'],
},
'String' : {
'STRING_LITERAL1' : ['STRING_LITERAL1'],
'STRING_LITERAL2' : ['STRING_LITERAL2'],
'STRING_LITERAL_LONG1' : ['STRING_LITERAL_LONG1'],
'STRING_LITERAL_LONG2' : ['STRING_LITERAL_LONG2'],
},
'TriplesBlock' : {
"(" : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
"+" : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
"-" : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
"[" : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'ANON' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'BLANK_NODE_LABEL' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'BooleanLiteral' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'DECIMAL' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'DOUBLE' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'INTEGER' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'IRI_REF' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'NIL' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'PNAME_LN' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'PNAME_NS' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'STRING_LITERAL1' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'STRING_LITERAL2' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'STRING_LITERAL_LONG1' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'STRING_LITERAL_LONG2' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'VAR1' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
'VAR2' : ['TriplesSameSubject',
'_Dot_TriplesBlock_Opt_Opt'],
},
'TriplesNode' : {
"(" : ['Collection'],
"[" : ['BlankNodePropertyList'],
},
'TriplesSameSubject' : {
"(" : ['TriplesNode',
'PropertyList'],
"+" : ['VarOrTerm',
'PropertyListNotEmpty'],
"-" : ['VarOrTerm',
'PropertyListNotEmpty'],
"[" : ['TriplesNode',
'PropertyList'],
'ANON' : ['VarOrTerm',
'PropertyListNotEmpty'],
'BLANK_NODE_LABEL' : ['VarOrTerm',
'PropertyListNotEmpty'],
'BooleanLiteral' : ['VarOrTerm',
'PropertyListNotEmpty'],
'DECIMAL' : ['VarOrTerm',
'PropertyListNotEmpty'],
'DOUBLE' : ['VarOrTerm',
'PropertyListNotEmpty'],
'INTEGER' : ['VarOrTerm',
'PropertyListNotEmpty'],
'IRI_REF' : ['VarOrTerm',
'PropertyListNotEmpty'],
'NIL' : ['VarOrTerm',
'PropertyListNotEmpty'],
'PNAME_LN' : ['VarOrTerm',
'PropertyListNotEmpty'],
'PNAME_NS' : ['VarOrTerm',
'PropertyListNotEmpty'],
'STRING_LITERAL1' : ['VarOrTerm',
'PropertyListNotEmpty'],
'STRING_LITERAL2' : ['VarOrTerm',
'PropertyListNotEmpty'],
'STRING_LITERAL_LONG1' : ['VarOrTerm',
'PropertyListNotEmpty'],
'STRING_LITERAL_LONG2' : ['VarOrTerm',
'PropertyListNotEmpty'],
'VAR1' : ['VarOrTerm',
'PropertyListNotEmpty'],
'VAR2' : ['VarOrTerm',
'PropertyListNotEmpty'],
},
'UnaryExpression' : {
"!" : ["!",
'PrimaryExpression'],
"(" : ['PrimaryExpression'],
"+" : ["+", 'PrimaryExpression'], # GK: Added back due to conflict
"-" : ["-", 'PrimaryExpression'], # GK: Added back due to conflict
"BOUND" : ['PrimaryExpression'],
"DATATYPE" : ['PrimaryExpression'],
"LANG" : ['PrimaryExpression'],
"LANGMATCHES" : ['PrimaryExpression'],
"REGEX" : ['PrimaryExpression'],
"STR" : ['PrimaryExpression'],
'BooleanLiteral' : ['PrimaryExpression'],
'DECIMAL' : ['PrimaryExpression'],
'DOUBLE' : ['PrimaryExpression'],
'INTEGER' : ['PrimaryExpression'],
'IRI_REF' : ['PrimaryExpression'],
'PNAME_LN' : ['PrimaryExpression'],
'PNAME_NS' : ['PrimaryExpression'],
'STRING_LITERAL1' : ['PrimaryExpression'],
'STRING_LITERAL2' : ['PrimaryExpression'],
'STRING_LITERAL_LONG1' : ['PrimaryExpression'],
'STRING_LITERAL_LONG2' : ['PrimaryExpression'],
'VAR1' : ['PrimaryExpression'],
'VAR2' : ['PrimaryExpression'],
"ISBLANK" : ['PrimaryExpression'],
"ISIRI" : ['PrimaryExpression'],
"ISLITERAL" : ['PrimaryExpression'],
"ISURI" : ['PrimaryExpression'],
"SAMETERM" : ['PrimaryExpression'],
},
'ValueLogical' : {
"!" : ['RelationalExpression'],
"(" : ['RelationalExpression'],
"+" : ['RelationalExpression'],
"-" : ['RelationalExpression'],
"BOUND" : ['RelationalExpression'],
"DATATYPE" : ['RelationalExpression'],
"LANG" : ['RelationalExpression'],
"LANGMATCHES" : ['RelationalExpression'],
"REGEX" : ['RelationalExpression'],
"STR" : ['RelationalExpression'],
'BooleanLiteral' : ['RelationalExpression'],
'DECIMAL' : ['RelationalExpression'],
'DOUBLE' : ['RelationalExpression'],
'INTEGER' : ['RelationalExpression'],
'IRI_REF' : ['RelationalExpression'],
'PNAME_LN' : ['RelationalExpression'],
'PNAME_NS' : ['RelationalExpression'],
'STRING_LITERAL1' : ['RelationalExpression'],
'STRING_LITERAL2' : ['RelationalExpression'],
'STRING_LITERAL_LONG1' : ['RelationalExpression'],
'STRING_LITERAL_LONG2' : ['RelationalExpression'],
'VAR1' : ['RelationalExpression'],
'VAR2' : ['RelationalExpression'],
"ISBLANK" : ['RelationalExpression'],
"ISIRI" : ['RelationalExpression'],
"ISLITERAL" : ['RelationalExpression'],
"ISURI" : ['RelationalExpression'],
"SAMETERM" : ['RelationalExpression'],
},
'Var' : {
'VAR1' : ['VAR1'],
'VAR2' : ['VAR2'],
},
'VarOrIRIref' : {
'IRI_REF' : ['IRIref'],
'PNAME_LN' : ['IRIref'],
'PNAME_NS' : ['IRIref'],
'VAR1' : ['Var'],
'VAR2' : ['Var'],
},
'VarOrTerm' : {
"+" : ['GraphTerm'],
"-" : ['GraphTerm'],
'ANON' : ['GraphTerm'],
'BLANK_NODE_LABEL' : ['GraphTerm'],
'BooleanLiteral' : ['GraphTerm'],
'DECIMAL' : ['GraphTerm'],
'DOUBLE' : ['GraphTerm'],
'INTEGER' : ['GraphTerm'],
'IRI_REF' : ['GraphTerm'],
'NIL' : ['GraphTerm'],
'PNAME_LN' : ['GraphTerm'],
'PNAME_NS' : ['GraphTerm'],
'STRING_LITERAL1' : ['GraphTerm'],
'STRING_LITERAL2' : ['GraphTerm'],
'STRING_LITERAL_LONG1' : ['GraphTerm'],
'STRING_LITERAL_LONG2' : ['GraphTerm'],
'VAR1' : ['Var'],
'VAR2' : ['Var'],
},
'Verb' : {
"a" : ["a"],
'IRI_REF' : ['VarOrIRIref'],
'PNAME_LN' : ['VarOrIRIref'],
'PNAME_NS' : ['VarOrIRIref'],
'VAR1' : ['VarOrIRIref'],
'VAR2' : ['VarOrIRIref'],
},
'WhereClause' : {
"WHERE" : ['_WHERE_Opt',
'GroupGraphPattern'],
"{" : ['_WHERE_Opt',
'GroupGraphPattern'],
},
'_AND_ValueLogical' : {
"&&" : ["&&",
'ValueLogical'],
},
'_AND_ValueLogical_Star' : {
"&&" : ['_AND_ValueLogical',
'_AND_ValueLogical_Star'],
")" : [],
"," : [],
"||" : [],
},
'_ASC_Or_DESC' : {
"ASC" : ["ASC"],
"DESC" : ["DESC"],
},
'_ASC_Or_DESC_BrackettedExpression' : {
"ASC" : ['_ASC_Or_DESC',
'BrackettedExpression'],
"DESC" : ['_ASC_Or_DESC',
'BrackettedExpression'],
},
'_Add_Sub_MultiplicativeExpression_Star' : {
"!=" : [],
"&&" : [],
")" : [],
"+" : ["+",
'MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"," : [],
"-" : ["-",
'MultiplicativeExpression',
'_Add_Sub_MultiplicativeExpression_Star'],
"<" : [],
"<=" : [],
"=" : [],
">=" : [],
">" : [],
"||" : [],
},
'_ArgList_Opt' : {
"!=" : [],
"&&" : [],
"(" : ['ArgList'],
")" : [],
"*" : [],
"+" : [],
"," : [],
"-" : [],
"/" : [],
"<" : [],
"<=" : [],
"=" : [],
">=" : [],
">" : [],
'NIL' : ['ArgList'],
"||" : [],
},
'_BaseDecl_Opt' : {
"ASK" : [],
"BASE" : ['BaseDecl'],
"CONSTRUCT" : [],
"DESCRIBE" : [],
"PREFIX" : [],
"SELECT" : [],
},
'_COMMA_Expression_Opt' : {
")" : [],
"," : [",",
'Expression'],
},
'_COMMA_Expression_Star' : {
")" : [],
"," : [",",
'Expression'],
},
'_COMMA_Object' : {
"," : [",",
'Object'],
},
'_COMMA_Object_Star' : {
"," : ['_COMMA_Object',
'_COMMA_Object_Star'],
"." : [],
";" : [],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"]" : [],
"{" : [],
"}" : [],
},
'_Compare_NumericExpression_Opt' : {
"!=" : ["!=",
'NumericExpression'],
"&&" : [],
")" : [],
"," : [],
"<" : ["<",
'NumericExpression'],
"<=" : ["<=",
'NumericExpression'],
"=" : ["=",
'NumericExpression'],
">=" : [">=",
'NumericExpression'],
">" : [">",
'NumericExpression'],
"||" : [],
},
'_Constraint_or_Var' : {
"(" : ['Constraint'],
"BOUND" : ['Constraint'],
"DATATYPE" : ['Constraint'],
"LANG" : ['Constraint'],
"LANGMATCHES" : ['Constraint'],
"REGEX" : ['Constraint'],
"STR" : ['Constraint'],
'IRI_REF' : ['Constraint'],
'PNAME_LN' : ['Constraint'],
'PNAME_NS' : ['Constraint'],
'VAR1' : ['Var'],
'VAR2' : ['Var'],
"ISBLANK" : ['Constraint'],
"ISIRI" : ['Constraint'],
"ISLITERAL" : ['Constraint'],
"ISURI" : ['Constraint'],
"SAMETERM" : ['Constraint'],
},
'_ConstructTriples_Opt' : {
"(" : ['ConstructTriples'],
"+" : ['ConstructTriples'],
"-" : ['ConstructTriples'],
"[" : ['ConstructTriples'],
'ANON' : ['ConstructTriples'],
'BLANK_NODE_LABEL' : ['ConstructTriples'],
'BooleanLiteral' : ['ConstructTriples'],
'DECIMAL' : ['ConstructTriples'],
'DOUBLE' : ['ConstructTriples'],
'INTEGER' : ['ConstructTriples'],
'IRI_REF' : ['ConstructTriples'],
'NIL' : ['ConstructTriples'],
'PNAME_LN' : ['ConstructTriples'],
'PNAME_NS' : ['ConstructTriples'],
'STRING_LITERAL1' : ['ConstructTriples'],
'STRING_LITERAL2' : ['ConstructTriples'],
'STRING_LITERAL_LONG1' : ['ConstructTriples'],
'STRING_LITERAL_LONG2' : ['ConstructTriples'],
'VAR1' : ['ConstructTriples'],
'VAR2' : ['ConstructTriples'],
"}" : [],
},
'_DISTINCT_OR_REDUCED_Opt' : {
"*" : [],
"DISTINCT" : ["DISTINCT"],
"REDUCED" : ["REDUCED"],
'VAR1' : [],
'VAR2' : [],
},
'_DOT_ConstructTriples_Opt_Opt' : {
"." : [".",
'_ConstructTriples_Opt'],
"}" : [],
},
'_DOT_Opt' : {
"(" : [],
"+" : [],
"-" : [],
"." : ["."],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"[" : [],
'ANON' : [],
'BLANK_NODE_LABEL' : [],
'BooleanLiteral' : [],
'DECIMAL' : [],
'DOUBLE' : [],
'INTEGER' : [],
'IRI_REF' : [],
'NIL' : [],
'PNAME_LN' : [],
'PNAME_NS' : [],
'STRING_LITERAL1' : [],
'STRING_LITERAL2' : [],
'STRING_LITERAL_LONG1' : [],
'STRING_LITERAL_LONG2' : [],
'VAR1' : [],
'VAR2' : [],
"{" : [],
"}" : [],
},
'_DatasetClause_Star' : {
"FROM" : ['DatasetClause',
'_DatasetClause_Star'],
"LIMIT" : [],
"OFFSET" : [],
"ORDER" : [],
"WHERE" : [],
'eof' : [],
"{" : [],
},
'_DefaultGraphClause_or_NamedGraphClause' : {
"NAMED" : ['NamedGraphClause'],
'IRI_REF' : ['DefaultGraphClause'],
'PNAME_LN' : ['DefaultGraphClause'],
'PNAME_NS' : ['DefaultGraphClause'],
},
'_Dot_TriplesBlock_Opt_Opt' : {
"." : [".",
'_TriplesBlock_Opt'],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"{" : [],
"}" : [],
},
'_Expression_COMMA_Expression_Star' : {
"!" : ['Expression',
'_COMMA_Expression_Star'],
"(" : ['Expression',
'_COMMA_Expression_Star'],
"+" : ['Expression',
'_COMMA_Expression_Star'],
"-" : ['Expression',
'_COMMA_Expression_Star'],
"BOUND" : ['Expression',
'_COMMA_Expression_Star'],
"DATATYPE" : ['Expression',
'_COMMA_Expression_Star'],
"LANG" : ['Expression',
'_COMMA_Expression_Star'],
"LANGMATCHES" : ['Expression',
'_COMMA_Expression_Star'],
"REGEX" : ['Expression',
'_COMMA_Expression_Star'],
"STR" : ['Expression',
'_COMMA_Expression_Star'],
'BooleanLiteral' : ['Expression',
'_COMMA_Expression_Star'],
'DECIMAL' : ['Expression',
'_COMMA_Expression_Star'],
'DOUBLE' : ['Expression',
'_COMMA_Expression_Star'],
'INTEGER' : ['Expression',
'_COMMA_Expression_Star'],
'IRI_REF' : ['Expression',
'_COMMA_Expression_Star'],
'PNAME_LN' : ['Expression',
'_COMMA_Expression_Star'],
'PNAME_NS' : ['Expression',
'_COMMA_Expression_Star'],
'STRING_LITERAL1' : ['Expression',
'_COMMA_Expression_Star'],
'STRING_LITERAL2' : ['Expression',
'_COMMA_Expression_Star'],
'STRING_LITERAL_LONG1' : ['Expression',
'_COMMA_Expression_Star'],
'STRING_LITERAL_LONG2' : ['Expression',
'_COMMA_Expression_Star'],
'VAR1' : ['Expression',
'_COMMA_Expression_Star'],
'VAR2' : ['Expression',
'_COMMA_Expression_Star'],
"ISBLANK" : ['Expression',
'_COMMA_Expression_Star'],
"ISIRI" : ['Expression',
'_COMMA_Expression_Star'],
"ISLITERAL" : ['Expression',
'_COMMA_Expression_Star'],
"ISURI" : ['Expression',
'_COMMA_Expression_Star'],
"SAMETERM" : ['Expression',
'_COMMA_Expression_Star'],
},
'_GraphNode_Opt' : {
"(" : ['GraphNode',
'_GraphNode_Opt'],
")" : [],
"+" : ['GraphNode',
'_GraphNode_Opt'],
"-" : ['GraphNode',
'_GraphNode_Opt'],
"[" : ['GraphNode',
'_GraphNode_Opt'],
'ANON' : ['GraphNode',
'_GraphNode_Opt'],
'BLANK_NODE_LABEL' : ['GraphNode',
'_GraphNode_Opt'],
'BooleanLiteral' : ['GraphNode',
'_GraphNode_Opt'],
'DECIMAL' : ['GraphNode',
'_GraphNode_Opt'],
'DOUBLE' : ['GraphNode',
'_GraphNode_Opt'],
'INTEGER' : ['GraphNode',
'_GraphNode_Opt'],
'IRI_REF' : ['GraphNode',
'_GraphNode_Opt'],
'NIL' : ['GraphNode',
'_GraphNode_Opt'],
'PNAME_LN' : ['GraphNode',
'_GraphNode_Opt'],
'PNAME_NS' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL1' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL2' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL_LONG1' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL_LONG2' : ['GraphNode',
'_GraphNode_Opt'],
'VAR1' : ['GraphNode',
'_GraphNode_Opt'],
'VAR2' : ['GraphNode',
'_GraphNode_Opt'],
},
'_GraphNode_Plus' : {
"(" : ['GraphNode',
'_GraphNode_Opt'],
"+" : ['GraphNode',
'_GraphNode_Opt'],
"-" : ['GraphNode',
'_GraphNode_Opt'],
"[" : ['GraphNode',
'_GraphNode_Opt'],
'ANON' : ['GraphNode',
'_GraphNode_Opt'],
'BLANK_NODE_LABEL' : ['GraphNode',
'_GraphNode_Opt'],
'BooleanLiteral' : ['GraphNode',
'_GraphNode_Opt'],
'DECIMAL' : ['GraphNode',
'_GraphNode_Opt'],
'DOUBLE' : ['GraphNode',
'_GraphNode_Opt'],
'INTEGER' : ['GraphNode',
'_GraphNode_Opt'],
'IRI_REF' : ['GraphNode',
'_GraphNode_Opt'],
'NIL' : ['GraphNode',
'_GraphNode_Opt'],
'PNAME_LN' : ['GraphNode',
'_GraphNode_Opt'],
'PNAME_NS' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL1' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL2' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL_LONG1' : ['GraphNode',
'_GraphNode_Opt'],
'STRING_LITERAL_LONG2' : ['GraphNode',
'_GraphNode_Opt'],
'VAR1' : ['GraphNode',
'_GraphNode_Opt'],
'VAR2' : ['GraphNode',
'_GraphNode_Opt'],
},
'_GraphPatternNotTriples_or_Filter' : {
"FILTER" : ['Filter'],
"GRAPH" : ['GraphPatternNotTriples'],
"OPTIONAL" : ['GraphPatternNotTriples'],
"{" : ['GraphPatternNotTriples'],
},
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt' : {
"FILTER" : ['_GraphPatternNotTriples_or_Filter',
'_DOT_Opt',
'_TriplesBlock_Opt'],
"GRAPH" : ['_GraphPatternNotTriples_or_Filter',
'_DOT_Opt',
'_TriplesBlock_Opt'],
"OPTIONAL" : ['_GraphPatternNotTriples_or_Filter',
'_DOT_Opt',
'_TriplesBlock_Opt'],
"{" : ['_GraphPatternNotTriples_or_Filter',
'_DOT_Opt',
'_TriplesBlock_Opt'],
},
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star' : {
"FILTER" : ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt',
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'],
"GRAPH" : ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt',
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'],
"OPTIONAL" : ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt',
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'],
"{" : ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt',
'_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'],
"}" : [],
},
'_LANGTAG_IRIref_Opt' : {
"!=" : [],
"&&" : [],
"(" : [],
")" : [],
"*" : [],
"+" : [],
"," : [],
"-" : [],
"." : [],
"/" : [],
";" : [],
"<" : [],
"<=" : [],
"=" : [],
">=" : [],
">" : [],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"[" : [],
"]" : [],
"^^" : ["^^",
'IRIref'],
"a" : [],
'ANON' : [],
'BLANK_NODE_LABEL' : [],
'BooleanLiteral' : [],
'DECIMAL' : [],
'DOUBLE' : [],
'INTEGER' : [],
'IRI_REF' : [],
'LANGTAG' : ['LANGTAG'],
'NIL' : [],
'PNAME_LN' : [],
'PNAME_NS' : [],
'STRING_LITERAL1' : [],
'STRING_LITERAL2' : [],
'STRING_LITERAL_LONG1' : [],
'STRING_LITERAL_LONG2' : [],
'VAR1' : [],
'VAR2' : [],
"{" : [],
"||" : [],
"}" : [],
},
'_LimitClause_Opt' : {
"LIMIT" : ['LimitClause'],
'eof' : [],
},
'_LimitOffsetClauses_Opt' : {
"LIMIT" : ['LimitOffsetClauses'],
"OFFSET" : ['LimitOffsetClauses'],
'eof' : [],
},
'_Mul_Div_UnaryExpression_Star' : {
"!=" : [],
"&&" : [],
")" : [],
"*" : ["*",
'UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"+" : [],
"," : [],
"-" : [],
"/" : ["/",
'UnaryExpression',
'_Mul_Div_UnaryExpression_Star'],
"<" : [],
"<=" : [],
"=" : [],
">=" : [],
">" : [],
"||" : [],
},
'_OR_ConditionalAndExpression' : {
"||" : ["||",
'ConditionalAndExpression'],
},
'_OR_ConditionalAndExpression_Star' : {
")" : [],
"," : [],
"||" : ['_OR_ConditionalAndExpression',
'_OR_ConditionalAndExpression_Star'],
},
'_OffsetClause_Opt' : {
"OFFSET" : ['OffsetClause'],
'eof' : [],
},
'_OrderClause_Opt' : {
"LIMIT" : [],
"OFFSET" : [],
"ORDER" : ['OrderClause'],
'eof' : [],
},
'_OrderCondition_Plus' : {
"(" : ['OrderCondition',
'_OrderCondition_Plus'],
"ASC" : ['OrderCondition',
'_OrderCondition_Plus'],
"BOUND" : ['OrderCondition',
'_OrderCondition_Plus'],
"DATATYPE" : ['OrderCondition',
'_OrderCondition_Plus'],
"DESC" : ['OrderCondition',
'_OrderCondition_Plus'],
"LANG" : ['OrderCondition',
'_OrderCondition_Plus'],
"LANGMATCHES" : ['OrderCondition',
'_OrderCondition_Plus'],
"LIMIT" : [],
"OFFSET" : [],
"REGEX" : ['OrderCondition',
'_OrderCondition_Plus'],
"STR" : ['OrderCondition',
'_OrderCondition_Plus'],
'eof' : [],
'IRI_REF' : ['OrderCondition',
'_OrderCondition_Plus'],
'PNAME_LN' : ['OrderCondition',
'_OrderCondition_Plus'],
'PNAME_NS' : ['OrderCondition',
'_OrderCondition_Plus'],
'VAR1' : ['OrderCondition',
'_OrderCondition_Plus'],
'VAR2' : ['OrderCondition',
'_OrderCondition_Plus'],
"ISBLANK" : ['OrderCondition',
'_OrderCondition_Plus'],
"ISIRI" : ['OrderCondition',
'_OrderCondition_Plus'],
"ISLITERAL" : ['OrderCondition',
'_OrderCondition_Plus'],
"ISURI" : ['OrderCondition',
'_OrderCondition_Plus'],
"SAMETERM" : ['OrderCondition',
'_OrderCondition_Plus'],
},
'_PrefixDecl_Star' : {
"ASK" : [],
"CONSTRUCT" : [],
"DESCRIBE" : [],
"PREFIX" : ['PrefixDecl',
'_PrefixDecl_Star'],
"SELECT" : [],
},
'_SEMI_Verb_ObjectList_Opt' : {
";" : [";",
'_Verb_ObjectList_Opt'],
},
'_SEMI_Verb_ObjectList_Opt_Star' : {
"." : [],
";" : ['_SEMI_Verb_ObjectList_Opt',
'_SEMI_Verb_ObjectList_Opt_Star'],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"]" : [],
"{" : [],
"}" : [],
},
'_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery' : {
"ASK" : ['AskQuery'],
"CONSTRUCT" : ['ConstructQuery'],
"DESCRIBE" : ['DescribeQuery'],
"SELECT" : ['SelectQuery'],
},
'_TriplesBlock_Opt' : {
"(" : ['TriplesBlock'],
"+" : ['TriplesBlock'],
"-" : ['TriplesBlock'],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"[" : ['TriplesBlock'],
'ANON' : ['TriplesBlock'],
'BLANK_NODE_LABEL' : ['TriplesBlock'],
'BooleanLiteral' : ['TriplesBlock'],
'DECIMAL' : ['TriplesBlock'],
'DOUBLE' : ['TriplesBlock'],
'INTEGER' : ['TriplesBlock'],
'IRI_REF' : ['TriplesBlock'],
'NIL' : ['TriplesBlock'],
'PNAME_LN' : ['TriplesBlock'],
'PNAME_NS' : ['TriplesBlock'],
'STRING_LITERAL1' : ['TriplesBlock'],
'STRING_LITERAL2' : ['TriplesBlock'],
'STRING_LITERAL_LONG1' : ['TriplesBlock'],
'STRING_LITERAL_LONG2' : ['TriplesBlock'],
'VAR1' : ['TriplesBlock'],
'VAR2' : ['TriplesBlock'],
"{" : [],
"}" : [],
},
'_UNION_GroupGraphPattern' : {
"UNION" : ["UNION",
'GroupGraphPattern'],
},
'_UNION_GroupGraphPattern_Star' : {
"(" : [],
"+" : [],
"-" : [],
"." : [],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"UNION" : ['_UNION_GroupGraphPattern',
'_UNION_GroupGraphPattern_Star'],
"[" : [],
'ANON' : [],
'BLANK_NODE_LABEL' : [],
'BooleanLiteral' : [],
'DECIMAL' : [],
'DOUBLE' : [],
'INTEGER' : [],
'IRI_REF' : [],
'NIL' : [],
'PNAME_LN' : [],
'PNAME_NS' : [],
'STRING_LITERAL1' : [],
'STRING_LITERAL2' : [],
'STRING_LITERAL_LONG1' : [],
'STRING_LITERAL_LONG2' : [],
'VAR1' : [],
'VAR2' : [],
"{" : [],
"}" : [],
},
'_VarOrIRIRef_Plus' : {
"FROM" : [],
"LIMIT" : [],
"OFFSET" : [],
"ORDER" : [],
"WHERE" : [],
'eof' : [],
'IRI_REF' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'PNAME_LN' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'PNAME_NS' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'VAR1' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'VAR2' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
"{" : [],
},
'_VarOrIRIref_Plus_or_Star' : {
"*" : ["*"],
'IRI_REF' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'PNAME_LN' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'PNAME_NS' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'VAR1' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
'VAR2' : ['VarOrIRIref',
'_VarOrIRIRef_Plus'],
},
'_Var_Plus' : {
"FROM" : [],
"LIMIT" : [],
"OFFSET" : [],
"ORDER" : [],
"WHERE" : [],
'eof' : [],
'VAR1' : ['Var',
'_Var_Plus'],
'VAR2' : ['Var',
'_Var_Plus'],
"{" : [],
},
'_Var_Plus_or_Star' : {
"*" : ["*"],
'VAR1' : ['Var',
'_Var_Plus'],
'VAR2' : ['Var',
'_Var_Plus'],
},
'_Verb_ObjectList_Opt' : {
"." : [],
";" : [],
"FILTER" : [],
"GRAPH" : [],
"OPTIONAL" : [],
"]" : [],
"a" : ['Verb',
'ObjectList'],
'IRI_REF' : ['Verb',
'ObjectList'],
'PNAME_LN' : ['Verb',
'ObjectList'],
'PNAME_NS' : ['Verb',
'ObjectList'],
'VAR1' : ['Verb',
'ObjectList'],
'VAR2' : ['Verb',
'ObjectList'],
"{" : [],
"}" : [],
},
'_WHERE_Opt' : {
"WHERE" : ["WHERE"],
"{" : [],
},
'_WhereClause_Opt' : {
"LIMIT" : [],
"OFFSET" : [],
"ORDER" : [],
"WHERE" : ['WhereClause'],
'eof' : [],
"{" : ['WhereClause'],
},
}
| branches = {'AdditiveExpression': {'!': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], '(': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], '+': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], '-': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'BOUND': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'DATATYPE': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'LANG': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'LANGMATCHES': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'REGEX': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'STR': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'BooleanLiteral': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'DECIMAL': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'DOUBLE': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'INTEGER': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'IRI_REF': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'PNAME_LN': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'PNAME_NS': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'STRING_LITERAL1': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'STRING_LITERAL2': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'STRING_LITERAL_LONG1': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'STRING_LITERAL_LONG2': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'VAR1': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'VAR2': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'ISBLANK': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'ISIRI': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'ISLITERAL': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'ISURI': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], 'SAMETERM': ['MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star']}, 'ArgList': {'(': ['(', '_Expression_COMMA_Expression_Star', ')'], 'NIL': ['NIL']}, 'AskQuery': {'ASK': ['ASK', '_DatasetClause_Star', 'WhereClause']}, 'BaseDecl': {'BASE': ['BASE', 'IRI_REF']}, 'BlankNode': {'ANON': ['ANON'], 'BLANK_NODE_LABEL': ['BLANK_NODE_LABEL']}, 'BlankNodePropertyList': {'[': ['[', 'PropertyListNotEmpty', ']']}, 'BrackettedExpression': {'(': ['(', 'Expression', ')']}, 'BuiltInCall': {'BOUND': ['BOUND', '(', 'Var', ')'], 'DATATYPE': ['DATATYPE', '(', 'Expression', ')'], 'LANG': ['LANG', '(', 'Expression', ')'], 'LANGMATCHES': ['LANGMATCHES', '(', 'Expression', ',', 'Expression', ')'], 'REGEX': ['RegexExpression'], 'STR': ['STR', '(', 'Expression', ')'], 'ISBLANK': ['ISBLANK', '(', 'Expression', ')'], 'ISIRI': ['ISIRI', '(', 'Expression', ')'], 'ISLITERAL': ['ISLITERAL', '(', 'Expression', ')'], 'ISURI': ['ISURI', '(', 'Expression', ')'], 'SAMETERM': ['SAMETERM', '(', 'Expression', ',', 'Expression', ')']}, 'Collection': {'(': ['(', '_GraphNode_Plus', ')']}, 'ConditionalAndExpression': {'!': ['ValueLogical', '_AND_ValueLogical_Star'], '(': ['ValueLogical', '_AND_ValueLogical_Star'], '+': ['ValueLogical', '_AND_ValueLogical_Star'], '-': ['ValueLogical', '_AND_ValueLogical_Star'], 'BOUND': ['ValueLogical', '_AND_ValueLogical_Star'], 'DATATYPE': ['ValueLogical', '_AND_ValueLogical_Star'], 'LANG': ['ValueLogical', '_AND_ValueLogical_Star'], 'LANGMATCHES': ['ValueLogical', '_AND_ValueLogical_Star'], 'REGEX': ['ValueLogical', '_AND_ValueLogical_Star'], 'STR': ['ValueLogical', '_AND_ValueLogical_Star'], 'BooleanLiteral': ['ValueLogical', '_AND_ValueLogical_Star'], 'DECIMAL': ['ValueLogical', '_AND_ValueLogical_Star'], 'DOUBLE': ['ValueLogical', '_AND_ValueLogical_Star'], 'INTEGER': ['ValueLogical', '_AND_ValueLogical_Star'], 'IRI_REF': ['ValueLogical', '_AND_ValueLogical_Star'], 'PNAME_LN': ['ValueLogical', '_AND_ValueLogical_Star'], 'PNAME_NS': ['ValueLogical', '_AND_ValueLogical_Star'], 'STRING_LITERAL1': ['ValueLogical', '_AND_ValueLogical_Star'], 'STRING_LITERAL2': ['ValueLogical', '_AND_ValueLogical_Star'], 'STRING_LITERAL_LONG1': ['ValueLogical', '_AND_ValueLogical_Star'], 'STRING_LITERAL_LONG2': ['ValueLogical', '_AND_ValueLogical_Star'], 'VAR1': ['ValueLogical', '_AND_ValueLogical_Star'], 'VAR2': ['ValueLogical', '_AND_ValueLogical_Star'], 'ISBLANK': ['ValueLogical', '_AND_ValueLogical_Star'], 'ISIRI': ['ValueLogical', '_AND_ValueLogical_Star'], 'ISLITERAL': ['ValueLogical', '_AND_ValueLogical_Star'], 'ISURI': ['ValueLogical', '_AND_ValueLogical_Star'], 'SAMETERM': ['ValueLogical', '_AND_ValueLogical_Star']}, 'ConditionalOrExpression': {'!': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], '(': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], '+': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], '-': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'BOUND': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'DATATYPE': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'LANG': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'LANGMATCHES': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'REGEX': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'STR': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'BooleanLiteral': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'DECIMAL': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'DOUBLE': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'INTEGER': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'IRI_REF': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'PNAME_LN': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'PNAME_NS': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'STRING_LITERAL1': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'STRING_LITERAL2': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'STRING_LITERAL_LONG1': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'STRING_LITERAL_LONG2': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'VAR1': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'VAR2': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'ISBLANK': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'ISIRI': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'ISLITERAL': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'ISURI': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star'], 'SAMETERM': ['ConditionalAndExpression', '_OR_ConditionalAndExpression_Star']}, 'Constraint': {'(': ['BrackettedExpression'], 'BOUND': ['BuiltInCall'], 'DATATYPE': ['BuiltInCall'], 'LANG': ['BuiltInCall'], 'LANGMATCHES': ['BuiltInCall'], 'REGEX': ['BuiltInCall'], 'STR': ['BuiltInCall'], 'IRI_REF': ['FunctionCall'], 'PNAME_LN': ['FunctionCall'], 'PNAME_NS': ['FunctionCall'], 'ISBLANK': ['BuiltInCall'], 'ISIRI': ['BuiltInCall'], 'ISLITERAL': ['BuiltInCall'], 'ISURI': ['BuiltInCall'], 'SAMETERM': ['BuiltInCall']}, 'ConstructQuery': {'CONSTRUCT': ['CONSTRUCT', 'ConstructTemplate', '_DatasetClause_Star', 'WhereClause', 'SolutionModifier']}, 'ConstructTemplate': {'{': ['{', '_ConstructTriples_Opt', '}']}, 'ConstructTriples': {'(': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], '+': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], '-': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], '[': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'ANON': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'BLANK_NODE_LABEL': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'BooleanLiteral': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'DECIMAL': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'DOUBLE': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'INTEGER': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'IRI_REF': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'NIL': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'PNAME_LN': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'PNAME_NS': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'STRING_LITERAL1': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'STRING_LITERAL2': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'STRING_LITERAL_LONG1': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'STRING_LITERAL_LONG2': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'VAR1': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt'], 'VAR2': ['TriplesSameSubject', '_DOT_ConstructTriples_Opt_Opt']}, 'DatasetClause': {'FROM': ['FROM', '_DefaultGraphClause_or_NamedGraphClause']}, 'DefaultGraphClause': {'IRI_REF': ['SourceSelector'], 'PNAME_LN': ['SourceSelector'], 'PNAME_NS': ['SourceSelector']}, 'DescribeQuery': {'DESCRIBE': ['DESCRIBE', '_VarOrIRIref_Plus_or_Star', '_DatasetClause_Star', '_WhereClause_Opt', 'SolutionModifier']}, 'Expression': {'!': ['ConditionalOrExpression'], '(': ['ConditionalOrExpression'], '+': ['ConditionalOrExpression'], '-': ['ConditionalOrExpression'], 'BOUND': ['ConditionalOrExpression'], 'DATATYPE': ['ConditionalOrExpression'], 'LANG': ['ConditionalOrExpression'], 'LANGMATCHES': ['ConditionalOrExpression'], 'REGEX': ['ConditionalOrExpression'], 'STR': ['ConditionalOrExpression'], 'BooleanLiteral': ['ConditionalOrExpression'], 'DECIMAL': ['ConditionalOrExpression'], 'DOUBLE': ['ConditionalOrExpression'], 'INTEGER': ['ConditionalOrExpression'], 'IRI_REF': ['ConditionalOrExpression'], 'PNAME_LN': ['ConditionalOrExpression'], 'PNAME_NS': ['ConditionalOrExpression'], 'STRING_LITERAL1': ['ConditionalOrExpression'], 'STRING_LITERAL2': ['ConditionalOrExpression'], 'STRING_LITERAL_LONG1': ['ConditionalOrExpression'], 'STRING_LITERAL_LONG2': ['ConditionalOrExpression'], 'VAR1': ['ConditionalOrExpression'], 'VAR2': ['ConditionalOrExpression'], 'ISBLANK': ['ConditionalOrExpression'], 'ISIRI': ['ConditionalOrExpression'], 'ISLITERAL': ['ConditionalOrExpression'], 'ISURI': ['ConditionalOrExpression'], 'SAMETERM': ['ConditionalOrExpression']}, 'Filter': {'FILTER': ['FILTER', 'Constraint']}, 'FunctionCall': {'IRI_REF': ['IRIref', 'ArgList'], 'PNAME_LN': ['IRIref', 'ArgList'], 'PNAME_NS': ['IRIref', 'ArgList']}, 'GraphGraphPattern': {'GRAPH': ['GRAPH', 'VarOrIRIref', 'GroupGraphPattern']}, 'GraphNode': {'(': ['TriplesNode'], '+': ['VarOrTerm'], '-': ['VarOrTerm'], '[': ['TriplesNode'], 'ANON': ['VarOrTerm'], 'BLANK_NODE_LABEL': ['VarOrTerm'], 'BooleanLiteral': ['VarOrTerm'], 'DECIMAL': ['VarOrTerm'], 'DOUBLE': ['VarOrTerm'], 'INTEGER': ['VarOrTerm'], 'IRI_REF': ['VarOrTerm'], 'NIL': ['VarOrTerm'], 'PNAME_LN': ['VarOrTerm'], 'PNAME_NS': ['VarOrTerm'], 'STRING_LITERAL1': ['VarOrTerm'], 'STRING_LITERAL2': ['VarOrTerm'], 'STRING_LITERAL_LONG1': ['VarOrTerm'], 'STRING_LITERAL_LONG2': ['VarOrTerm'], 'VAR1': ['VarOrTerm'], 'VAR2': ['VarOrTerm']}, 'GraphPatternNotTriples': {'GRAPH': ['GraphGraphPattern'], 'OPTIONAL': ['OptionalGraphPattern'], '{': ['GroupOrUnionGraphPattern']}, 'GraphTerm': {'+': ['NumericLiteral'], '-': ['NumericLiteral'], 'ANON': ['BlankNode'], 'BLANK_NODE_LABEL': ['BlankNode'], 'BooleanLiteral': ['BooleanLiteral'], 'DECIMAL': ['NumericLiteral'], 'DOUBLE': ['NumericLiteral'], 'INTEGER': ['NumericLiteral'], 'IRI_REF': ['IRIref'], 'NIL': ['NIL'], 'PNAME_LN': ['IRIref'], 'PNAME_NS': ['IRIref'], 'STRING_LITERAL1': ['RDFLiteral'], 'STRING_LITERAL2': ['RDFLiteral'], 'STRING_LITERAL_LONG1': ['RDFLiteral'], 'STRING_LITERAL_LONG2': ['RDFLiteral']}, 'GroupGraphPattern': {'{': ['{', '_TriplesBlock_Opt', '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star', '}']}, 'GroupOrUnionGraphPattern': {'{': ['GroupGraphPattern', '_UNION_GroupGraphPattern_Star']}, 'IRIref': {'IRI_REF': ['IRI_REF'], 'PNAME_LN': ['PrefixedName'], 'PNAME_NS': ['PrefixedName']}, 'IRIrefOrFunction': {'IRI_REF': ['IRIref', '_ArgList_Opt'], 'PNAME_LN': ['IRIref', '_ArgList_Opt'], 'PNAME_NS': ['IRIref', '_ArgList_Opt']}, 'LimitClause': {'LIMIT': ['LIMIT', 'INTEGER']}, 'LimitOffsetClauses': {'LIMIT': ['LimitClause', '_OffsetClause_Opt'], 'OFFSET': ['OffsetClause', '_LimitClause_Opt']}, 'MultiplicativeExpression': {'!': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], '(': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], '+': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], '-': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'BOUND': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'DATATYPE': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'LANG': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'LANGMATCHES': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'REGEX': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'STR': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'BooleanLiteral': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'DECIMAL': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'DOUBLE': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'INTEGER': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'IRI_REF': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'PNAME_LN': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'PNAME_NS': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'STRING_LITERAL1': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'STRING_LITERAL2': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'STRING_LITERAL_LONG1': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'STRING_LITERAL_LONG2': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'VAR1': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'VAR2': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'ISBLANK': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'ISIRI': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'ISLITERAL': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'ISURI': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star'], 'SAMETERM': ['UnaryExpression', '_Mul_Div_UnaryExpression_Star']}, 'NamedGraphClause': {'NAMED': ['NAMED', 'SourceSelector']}, 'NumericExpression': {'!': ['AdditiveExpression'], '(': ['AdditiveExpression'], '+': ['AdditiveExpression'], '-': ['AdditiveExpression'], 'BOUND': ['AdditiveExpression'], 'DATATYPE': ['AdditiveExpression'], 'LANG': ['AdditiveExpression'], 'LANGMATCHES': ['AdditiveExpression'], 'REGEX': ['AdditiveExpression'], 'STR': ['AdditiveExpression'], 'BooleanLiteral': ['AdditiveExpression'], 'DECIMAL': ['AdditiveExpression'], 'DOUBLE': ['AdditiveExpression'], 'INTEGER': ['AdditiveExpression'], 'IRI_REF': ['AdditiveExpression'], 'PNAME_LN': ['AdditiveExpression'], 'PNAME_NS': ['AdditiveExpression'], 'STRING_LITERAL1': ['AdditiveExpression'], 'STRING_LITERAL2': ['AdditiveExpression'], 'STRING_LITERAL_LONG1': ['AdditiveExpression'], 'STRING_LITERAL_LONG2': ['AdditiveExpression'], 'VAR1': ['AdditiveExpression'], 'VAR2': ['AdditiveExpression'], 'ISBLANK': ['AdditiveExpression'], 'ISIRI': ['AdditiveExpression'], 'ISLITERAL': ['AdditiveExpression'], 'ISURI': ['AdditiveExpression'], 'SAMETERM': ['AdditiveExpression']}, 'NumericLiteral': {'+': ['NumericLiteralPositive'], '-': ['NumericLiteralNegative'], 'DECIMAL': ['NumericLiteralUnsigned'], 'DOUBLE': ['NumericLiteralUnsigned'], 'INTEGER': ['NumericLiteralUnsigned']}, 'NumericLiteralNegative': {'-': ['-', 'NumericLiteralUnsigned']}, 'NumericLiteralPositive': {'+': ['+', 'NumericLiteralUnsigned']}, 'NumericLiteralUnsigned': {'DECIMAL': ['DECIMAL'], 'DOUBLE': ['DOUBLE'], 'INTEGER': ['INTEGER']}, 'Object': {'(': ['GraphNode'], '+': ['GraphNode'], '-': ['GraphNode'], '[': ['GraphNode'], 'ANON': ['GraphNode'], 'BLANK_NODE_LABEL': ['GraphNode'], 'BooleanLiteral': ['GraphNode'], 'DECIMAL': ['GraphNode'], 'DOUBLE': ['GraphNode'], 'INTEGER': ['GraphNode'], 'IRI_REF': ['GraphNode'], 'NIL': ['GraphNode'], 'PNAME_LN': ['GraphNode'], 'PNAME_NS': ['GraphNode'], 'STRING_LITERAL1': ['GraphNode'], 'STRING_LITERAL2': ['GraphNode'], 'STRING_LITERAL_LONG1': ['GraphNode'], 'STRING_LITERAL_LONG2': ['GraphNode'], 'VAR1': ['GraphNode'], 'VAR2': ['GraphNode']}, 'ObjectList': {'(': ['Object', '_COMMA_Object_Star'], '+': ['Object', '_COMMA_Object_Star'], '-': ['Object', '_COMMA_Object_Star'], '[': ['Object', '_COMMA_Object_Star'], 'ANON': ['Object', '_COMMA_Object_Star'], 'BLANK_NODE_LABEL': ['Object', '_COMMA_Object_Star'], 'BooleanLiteral': ['Object', '_COMMA_Object_Star'], 'DECIMAL': ['Object', '_COMMA_Object_Star'], 'DOUBLE': ['Object', '_COMMA_Object_Star'], 'INTEGER': ['Object', '_COMMA_Object_Star'], 'IRI_REF': ['Object', '_COMMA_Object_Star'], 'NIL': ['Object', '_COMMA_Object_Star'], 'PNAME_LN': ['Object', '_COMMA_Object_Star'], 'PNAME_NS': ['Object', '_COMMA_Object_Star'], 'STRING_LITERAL1': ['Object', '_COMMA_Object_Star'], 'STRING_LITERAL2': ['Object', '_COMMA_Object_Star'], 'STRING_LITERAL_LONG1': ['Object', '_COMMA_Object_Star'], 'STRING_LITERAL_LONG2': ['Object', '_COMMA_Object_Star'], 'VAR1': ['Object', '_COMMA_Object_Star'], 'VAR2': ['Object', '_COMMA_Object_Star']}, 'OffsetClause': {'OFFSET': ['OFFSET', 'INTEGER']}, 'OptionalGraphPattern': {'OPTIONAL': ['OPTIONAL', 'GroupGraphPattern']}, 'OrderClause': {'ORDER': ['ORDER', 'BY', 'OrderCondition', '_OrderCondition_Plus']}, 'OrderCondition': {'(': ['_Constraint_or_Var'], 'ASC': ['_ASC_Or_DESC_BrackettedExpression'], 'BOUND': ['_Constraint_or_Var'], 'DATATYPE': ['_Constraint_or_Var'], 'DESC': ['_ASC_Or_DESC_BrackettedExpression'], 'LANG': ['_Constraint_or_Var'], 'LANGMATCHES': ['_Constraint_or_Var'], 'REGEX': ['_Constraint_or_Var'], 'STR': ['_Constraint_or_Var'], 'IRI_REF': ['_Constraint_or_Var'], 'PNAME_LN': ['_Constraint_or_Var'], 'PNAME_NS': ['_Constraint_or_Var'], 'VAR1': ['_Constraint_or_Var'], 'VAR2': ['_Constraint_or_Var'], 'ISBLANK': ['_Constraint_or_Var'], 'ISIRI': ['_Constraint_or_Var'], 'ISLITERAL': ['_Constraint_or_Var'], 'ISURI': ['_Constraint_or_Var'], 'SAMETERM': ['_Constraint_or_Var']}, 'PrefixDecl': {'PREFIX': ['PREFIX', 'PNAME_NS', 'IRI_REF']}, 'PrefixedName': {'PNAME_LN': ['PNAME_LN'], 'PNAME_NS': ['PNAME_NS']}, 'PrimaryExpression': {'(': ['BrackettedExpression'], '+': ['NumericLiteral'], '-': ['NumericLiteral'], 'BOUND': ['BuiltInCall'], 'DATATYPE': ['BuiltInCall'], 'LANG': ['BuiltInCall'], 'LANGMATCHES': ['BuiltInCall'], 'REGEX': ['BuiltInCall'], 'STR': ['BuiltInCall'], 'BooleanLiteral': ['BooleanLiteral'], 'DECIMAL': ['NumericLiteral'], 'DOUBLE': ['NumericLiteral'], 'INTEGER': ['NumericLiteral'], 'IRI_REF': ['IRIrefOrFunction'], 'PNAME_LN': ['IRIrefOrFunction'], 'PNAME_NS': ['IRIrefOrFunction'], 'STRING_LITERAL1': ['RDFLiteral'], 'STRING_LITERAL2': ['RDFLiteral'], 'STRING_LITERAL_LONG1': ['RDFLiteral'], 'STRING_LITERAL_LONG2': ['RDFLiteral'], 'VAR1': ['Var'], 'VAR2': ['Var'], 'ISBLANK': ['BuiltInCall'], 'ISIRI': ['BuiltInCall'], 'ISLITERAL': ['BuiltInCall'], 'ISURI': ['BuiltInCall'], 'SAMETERM': ['BuiltInCall']}, 'Prologue': {'ASK': ['_BaseDecl_Opt', '_PrefixDecl_Star'], 'BASE': ['_BaseDecl_Opt', '_PrefixDecl_Star'], 'CONSTRUCT': ['_BaseDecl_Opt', '_PrefixDecl_Star'], 'DESCRIBE': ['_BaseDecl_Opt', '_PrefixDecl_Star'], 'PREFIX': ['_BaseDecl_Opt', '_PrefixDecl_Star'], 'SELECT': ['_BaseDecl_Opt', '_PrefixDecl_Star']}, 'PropertyList': {'.': [], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], 'a': ['PropertyListNotEmpty'], 'IRI_REF': ['PropertyListNotEmpty'], 'PNAME_LN': ['PropertyListNotEmpty'], 'PNAME_NS': ['PropertyListNotEmpty'], 'VAR1': ['PropertyListNotEmpty'], 'VAR2': ['PropertyListNotEmpty'], '{': [], '}': []}, 'PropertyListNotEmpty': {'a': ['Verb', 'ObjectList', '_SEMI_Verb_ObjectList_Opt_Star'], 'IRI_REF': ['Verb', 'ObjectList', '_SEMI_Verb_ObjectList_Opt_Star'], 'PNAME_LN': ['Verb', 'ObjectList', '_SEMI_Verb_ObjectList_Opt_Star'], 'PNAME_NS': ['Verb', 'ObjectList', '_SEMI_Verb_ObjectList_Opt_Star'], 'VAR1': ['Verb', 'ObjectList', '_SEMI_Verb_ObjectList_Opt_Star'], 'VAR2': ['Verb', 'ObjectList', '_SEMI_Verb_ObjectList_Opt_Star']}, 'Query': {'ASK': ['Prologue', '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery', 'eof'], 'BASE': ['Prologue', '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery', 'eof'], 'CONSTRUCT': ['Prologue', '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery', 'eof'], 'DESCRIBE': ['Prologue', '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery', 'eof'], 'PREFIX': ['Prologue', '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery', 'eof'], 'SELECT': ['Prologue', '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery', 'eof']}, 'RDFLiteral': {'STRING_LITERAL1': ['String', '_LANGTAG_IRIref_Opt'], 'STRING_LITERAL2': ['String', '_LANGTAG_IRIref_Opt'], 'STRING_LITERAL_LONG1': ['String', '_LANGTAG_IRIref_Opt'], 'STRING_LITERAL_LONG2': ['String', '_LANGTAG_IRIref_Opt']}, 'RegexExpression': {'REGEX': ['REGEX', '(', 'Expression', ',', 'Expression', '_COMMA_Expression_Opt', ')']}, 'RelationalExpression': {'!': ['NumericExpression', '_Compare_NumericExpression_Opt'], '(': ['NumericExpression', '_Compare_NumericExpression_Opt'], '+': ['NumericExpression', '_Compare_NumericExpression_Opt'], '-': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'BOUND': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'DATATYPE': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'LANG': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'LANGMATCHES': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'REGEX': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'STR': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'BooleanLiteral': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'DECIMAL': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'DOUBLE': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'INTEGER': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'IRI_REF': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'PNAME_LN': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'PNAME_NS': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'STRING_LITERAL1': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'STRING_LITERAL2': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'STRING_LITERAL_LONG1': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'STRING_LITERAL_LONG2': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'VAR1': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'VAR2': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'ISBLANK': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'ISIRI': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'ISLITERAL': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'ISURI': ['NumericExpression', '_Compare_NumericExpression_Opt'], 'SAMETERM': ['NumericExpression', '_Compare_NumericExpression_Opt']}, 'SelectQuery': {'SELECT': ['SELECT', '_DISTINCT_OR_REDUCED_Opt', '_Var_Plus_or_Star', '_DatasetClause_Star', 'WhereClause', 'SolutionModifier']}, 'SolutionModifier': {'LIMIT': ['_OrderClause_Opt', '_LimitOffsetClauses_Opt'], 'OFFSET': ['_OrderClause_Opt', '_LimitOffsetClauses_Opt'], 'ORDER': ['_OrderClause_Opt', '_LimitOffsetClauses_Opt'], 'eof': ['_OrderClause_Opt', '_LimitOffsetClauses_Opt']}, 'SourceSelector': {'IRI_REF': ['IRIref'], 'PNAME_LN': ['IRIref'], 'PNAME_NS': ['IRIref']}, 'String': {'STRING_LITERAL1': ['STRING_LITERAL1'], 'STRING_LITERAL2': ['STRING_LITERAL2'], 'STRING_LITERAL_LONG1': ['STRING_LITERAL_LONG1'], 'STRING_LITERAL_LONG2': ['STRING_LITERAL_LONG2']}, 'TriplesBlock': {'(': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], '+': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], '-': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], '[': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'ANON': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'BLANK_NODE_LABEL': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'BooleanLiteral': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'DECIMAL': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'DOUBLE': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'INTEGER': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'IRI_REF': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'NIL': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'PNAME_LN': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'PNAME_NS': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'STRING_LITERAL1': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'STRING_LITERAL2': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'STRING_LITERAL_LONG1': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'STRING_LITERAL_LONG2': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'VAR1': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt'], 'VAR2': ['TriplesSameSubject', '_Dot_TriplesBlock_Opt_Opt']}, 'TriplesNode': {'(': ['Collection'], '[': ['BlankNodePropertyList']}, 'TriplesSameSubject': {'(': ['TriplesNode', 'PropertyList'], '+': ['VarOrTerm', 'PropertyListNotEmpty'], '-': ['VarOrTerm', 'PropertyListNotEmpty'], '[': ['TriplesNode', 'PropertyList'], 'ANON': ['VarOrTerm', 'PropertyListNotEmpty'], 'BLANK_NODE_LABEL': ['VarOrTerm', 'PropertyListNotEmpty'], 'BooleanLiteral': ['VarOrTerm', 'PropertyListNotEmpty'], 'DECIMAL': ['VarOrTerm', 'PropertyListNotEmpty'], 'DOUBLE': ['VarOrTerm', 'PropertyListNotEmpty'], 'INTEGER': ['VarOrTerm', 'PropertyListNotEmpty'], 'IRI_REF': ['VarOrTerm', 'PropertyListNotEmpty'], 'NIL': ['VarOrTerm', 'PropertyListNotEmpty'], 'PNAME_LN': ['VarOrTerm', 'PropertyListNotEmpty'], 'PNAME_NS': ['VarOrTerm', 'PropertyListNotEmpty'], 'STRING_LITERAL1': ['VarOrTerm', 'PropertyListNotEmpty'], 'STRING_LITERAL2': ['VarOrTerm', 'PropertyListNotEmpty'], 'STRING_LITERAL_LONG1': ['VarOrTerm', 'PropertyListNotEmpty'], 'STRING_LITERAL_LONG2': ['VarOrTerm', 'PropertyListNotEmpty'], 'VAR1': ['VarOrTerm', 'PropertyListNotEmpty'], 'VAR2': ['VarOrTerm', 'PropertyListNotEmpty']}, 'UnaryExpression': {'!': ['!', 'PrimaryExpression'], '(': ['PrimaryExpression'], '+': ['+', 'PrimaryExpression'], '-': ['-', 'PrimaryExpression'], 'BOUND': ['PrimaryExpression'], 'DATATYPE': ['PrimaryExpression'], 'LANG': ['PrimaryExpression'], 'LANGMATCHES': ['PrimaryExpression'], 'REGEX': ['PrimaryExpression'], 'STR': ['PrimaryExpression'], 'BooleanLiteral': ['PrimaryExpression'], 'DECIMAL': ['PrimaryExpression'], 'DOUBLE': ['PrimaryExpression'], 'INTEGER': ['PrimaryExpression'], 'IRI_REF': ['PrimaryExpression'], 'PNAME_LN': ['PrimaryExpression'], 'PNAME_NS': ['PrimaryExpression'], 'STRING_LITERAL1': ['PrimaryExpression'], 'STRING_LITERAL2': ['PrimaryExpression'], 'STRING_LITERAL_LONG1': ['PrimaryExpression'], 'STRING_LITERAL_LONG2': ['PrimaryExpression'], 'VAR1': ['PrimaryExpression'], 'VAR2': ['PrimaryExpression'], 'ISBLANK': ['PrimaryExpression'], 'ISIRI': ['PrimaryExpression'], 'ISLITERAL': ['PrimaryExpression'], 'ISURI': ['PrimaryExpression'], 'SAMETERM': ['PrimaryExpression']}, 'ValueLogical': {'!': ['RelationalExpression'], '(': ['RelationalExpression'], '+': ['RelationalExpression'], '-': ['RelationalExpression'], 'BOUND': ['RelationalExpression'], 'DATATYPE': ['RelationalExpression'], 'LANG': ['RelationalExpression'], 'LANGMATCHES': ['RelationalExpression'], 'REGEX': ['RelationalExpression'], 'STR': ['RelationalExpression'], 'BooleanLiteral': ['RelationalExpression'], 'DECIMAL': ['RelationalExpression'], 'DOUBLE': ['RelationalExpression'], 'INTEGER': ['RelationalExpression'], 'IRI_REF': ['RelationalExpression'], 'PNAME_LN': ['RelationalExpression'], 'PNAME_NS': ['RelationalExpression'], 'STRING_LITERAL1': ['RelationalExpression'], 'STRING_LITERAL2': ['RelationalExpression'], 'STRING_LITERAL_LONG1': ['RelationalExpression'], 'STRING_LITERAL_LONG2': ['RelationalExpression'], 'VAR1': ['RelationalExpression'], 'VAR2': ['RelationalExpression'], 'ISBLANK': ['RelationalExpression'], 'ISIRI': ['RelationalExpression'], 'ISLITERAL': ['RelationalExpression'], 'ISURI': ['RelationalExpression'], 'SAMETERM': ['RelationalExpression']}, 'Var': {'VAR1': ['VAR1'], 'VAR2': ['VAR2']}, 'VarOrIRIref': {'IRI_REF': ['IRIref'], 'PNAME_LN': ['IRIref'], 'PNAME_NS': ['IRIref'], 'VAR1': ['Var'], 'VAR2': ['Var']}, 'VarOrTerm': {'+': ['GraphTerm'], '-': ['GraphTerm'], 'ANON': ['GraphTerm'], 'BLANK_NODE_LABEL': ['GraphTerm'], 'BooleanLiteral': ['GraphTerm'], 'DECIMAL': ['GraphTerm'], 'DOUBLE': ['GraphTerm'], 'INTEGER': ['GraphTerm'], 'IRI_REF': ['GraphTerm'], 'NIL': ['GraphTerm'], 'PNAME_LN': ['GraphTerm'], 'PNAME_NS': ['GraphTerm'], 'STRING_LITERAL1': ['GraphTerm'], 'STRING_LITERAL2': ['GraphTerm'], 'STRING_LITERAL_LONG1': ['GraphTerm'], 'STRING_LITERAL_LONG2': ['GraphTerm'], 'VAR1': ['Var'], 'VAR2': ['Var']}, 'Verb': {'a': ['a'], 'IRI_REF': ['VarOrIRIref'], 'PNAME_LN': ['VarOrIRIref'], 'PNAME_NS': ['VarOrIRIref'], 'VAR1': ['VarOrIRIref'], 'VAR2': ['VarOrIRIref']}, 'WhereClause': {'WHERE': ['_WHERE_Opt', 'GroupGraphPattern'], '{': ['_WHERE_Opt', 'GroupGraphPattern']}, '_AND_ValueLogical': {'&&': ['&&', 'ValueLogical']}, '_AND_ValueLogical_Star': {'&&': ['_AND_ValueLogical', '_AND_ValueLogical_Star'], ')': [], ',': [], '||': []}, '_ASC_Or_DESC': {'ASC': ['ASC'], 'DESC': ['DESC']}, '_ASC_Or_DESC_BrackettedExpression': {'ASC': ['_ASC_Or_DESC', 'BrackettedExpression'], 'DESC': ['_ASC_Or_DESC', 'BrackettedExpression']}, '_Add_Sub_MultiplicativeExpression_Star': {'!=': [], '&&': [], ')': [], '+': ['+', 'MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], ',': [], '-': ['-', 'MultiplicativeExpression', '_Add_Sub_MultiplicativeExpression_Star'], '<': [], '<=': [], '=': [], '>=': [], '>': [], '||': []}, '_ArgList_Opt': {'!=': [], '&&': [], '(': ['ArgList'], ')': [], '*': [], '+': [], ',': [], '-': [], '/': [], '<': [], '<=': [], '=': [], '>=': [], '>': [], 'NIL': ['ArgList'], '||': []}, '_BaseDecl_Opt': {'ASK': [], 'BASE': ['BaseDecl'], 'CONSTRUCT': [], 'DESCRIBE': [], 'PREFIX': [], 'SELECT': []}, '_COMMA_Expression_Opt': {')': [], ',': [',', 'Expression']}, '_COMMA_Expression_Star': {')': [], ',': [',', 'Expression']}, '_COMMA_Object': {',': [',', 'Object']}, '_COMMA_Object_Star': {',': ['_COMMA_Object', '_COMMA_Object_Star'], '.': [], ';': [], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], ']': [], '{': [], '}': []}, '_Compare_NumericExpression_Opt': {'!=': ['!=', 'NumericExpression'], '&&': [], ')': [], ',': [], '<': ['<', 'NumericExpression'], '<=': ['<=', 'NumericExpression'], '=': ['=', 'NumericExpression'], '>=': ['>=', 'NumericExpression'], '>': ['>', 'NumericExpression'], '||': []}, '_Constraint_or_Var': {'(': ['Constraint'], 'BOUND': ['Constraint'], 'DATATYPE': ['Constraint'], 'LANG': ['Constraint'], 'LANGMATCHES': ['Constraint'], 'REGEX': ['Constraint'], 'STR': ['Constraint'], 'IRI_REF': ['Constraint'], 'PNAME_LN': ['Constraint'], 'PNAME_NS': ['Constraint'], 'VAR1': ['Var'], 'VAR2': ['Var'], 'ISBLANK': ['Constraint'], 'ISIRI': ['Constraint'], 'ISLITERAL': ['Constraint'], 'ISURI': ['Constraint'], 'SAMETERM': ['Constraint']}, '_ConstructTriples_Opt': {'(': ['ConstructTriples'], '+': ['ConstructTriples'], '-': ['ConstructTriples'], '[': ['ConstructTriples'], 'ANON': ['ConstructTriples'], 'BLANK_NODE_LABEL': ['ConstructTriples'], 'BooleanLiteral': ['ConstructTriples'], 'DECIMAL': ['ConstructTriples'], 'DOUBLE': ['ConstructTriples'], 'INTEGER': ['ConstructTriples'], 'IRI_REF': ['ConstructTriples'], 'NIL': ['ConstructTriples'], 'PNAME_LN': ['ConstructTriples'], 'PNAME_NS': ['ConstructTriples'], 'STRING_LITERAL1': ['ConstructTriples'], 'STRING_LITERAL2': ['ConstructTriples'], 'STRING_LITERAL_LONG1': ['ConstructTriples'], 'STRING_LITERAL_LONG2': ['ConstructTriples'], 'VAR1': ['ConstructTriples'], 'VAR2': ['ConstructTriples'], '}': []}, '_DISTINCT_OR_REDUCED_Opt': {'*': [], 'DISTINCT': ['DISTINCT'], 'REDUCED': ['REDUCED'], 'VAR1': [], 'VAR2': []}, '_DOT_ConstructTriples_Opt_Opt': {'.': ['.', '_ConstructTriples_Opt'], '}': []}, '_DOT_Opt': {'(': [], '+': [], '-': [], '.': ['.'], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], '[': [], 'ANON': [], 'BLANK_NODE_LABEL': [], 'BooleanLiteral': [], 'DECIMAL': [], 'DOUBLE': [], 'INTEGER': [], 'IRI_REF': [], 'NIL': [], 'PNAME_LN': [], 'PNAME_NS': [], 'STRING_LITERAL1': [], 'STRING_LITERAL2': [], 'STRING_LITERAL_LONG1': [], 'STRING_LITERAL_LONG2': [], 'VAR1': [], 'VAR2': [], '{': [], '}': []}, '_DatasetClause_Star': {'FROM': ['DatasetClause', '_DatasetClause_Star'], 'LIMIT': [], 'OFFSET': [], 'ORDER': [], 'WHERE': [], 'eof': [], '{': []}, '_DefaultGraphClause_or_NamedGraphClause': {'NAMED': ['NamedGraphClause'], 'IRI_REF': ['DefaultGraphClause'], 'PNAME_LN': ['DefaultGraphClause'], 'PNAME_NS': ['DefaultGraphClause']}, '_Dot_TriplesBlock_Opt_Opt': {'.': ['.', '_TriplesBlock_Opt'], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], '{': [], '}': []}, '_Expression_COMMA_Expression_Star': {'!': ['Expression', '_COMMA_Expression_Star'], '(': ['Expression', '_COMMA_Expression_Star'], '+': ['Expression', '_COMMA_Expression_Star'], '-': ['Expression', '_COMMA_Expression_Star'], 'BOUND': ['Expression', '_COMMA_Expression_Star'], 'DATATYPE': ['Expression', '_COMMA_Expression_Star'], 'LANG': ['Expression', '_COMMA_Expression_Star'], 'LANGMATCHES': ['Expression', '_COMMA_Expression_Star'], 'REGEX': ['Expression', '_COMMA_Expression_Star'], 'STR': ['Expression', '_COMMA_Expression_Star'], 'BooleanLiteral': ['Expression', '_COMMA_Expression_Star'], 'DECIMAL': ['Expression', '_COMMA_Expression_Star'], 'DOUBLE': ['Expression', '_COMMA_Expression_Star'], 'INTEGER': ['Expression', '_COMMA_Expression_Star'], 'IRI_REF': ['Expression', '_COMMA_Expression_Star'], 'PNAME_LN': ['Expression', '_COMMA_Expression_Star'], 'PNAME_NS': ['Expression', '_COMMA_Expression_Star'], 'STRING_LITERAL1': ['Expression', '_COMMA_Expression_Star'], 'STRING_LITERAL2': ['Expression', '_COMMA_Expression_Star'], 'STRING_LITERAL_LONG1': ['Expression', '_COMMA_Expression_Star'], 'STRING_LITERAL_LONG2': ['Expression', '_COMMA_Expression_Star'], 'VAR1': ['Expression', '_COMMA_Expression_Star'], 'VAR2': ['Expression', '_COMMA_Expression_Star'], 'ISBLANK': ['Expression', '_COMMA_Expression_Star'], 'ISIRI': ['Expression', '_COMMA_Expression_Star'], 'ISLITERAL': ['Expression', '_COMMA_Expression_Star'], 'ISURI': ['Expression', '_COMMA_Expression_Star'], 'SAMETERM': ['Expression', '_COMMA_Expression_Star']}, '_GraphNode_Opt': {'(': ['GraphNode', '_GraphNode_Opt'], ')': [], '+': ['GraphNode', '_GraphNode_Opt'], '-': ['GraphNode', '_GraphNode_Opt'], '[': ['GraphNode', '_GraphNode_Opt'], 'ANON': ['GraphNode', '_GraphNode_Opt'], 'BLANK_NODE_LABEL': ['GraphNode', '_GraphNode_Opt'], 'BooleanLiteral': ['GraphNode', '_GraphNode_Opt'], 'DECIMAL': ['GraphNode', '_GraphNode_Opt'], 'DOUBLE': ['GraphNode', '_GraphNode_Opt'], 'INTEGER': ['GraphNode', '_GraphNode_Opt'], 'IRI_REF': ['GraphNode', '_GraphNode_Opt'], 'NIL': ['GraphNode', '_GraphNode_Opt'], 'PNAME_LN': ['GraphNode', '_GraphNode_Opt'], 'PNAME_NS': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL1': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL2': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL_LONG1': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL_LONG2': ['GraphNode', '_GraphNode_Opt'], 'VAR1': ['GraphNode', '_GraphNode_Opt'], 'VAR2': ['GraphNode', '_GraphNode_Opt']}, '_GraphNode_Plus': {'(': ['GraphNode', '_GraphNode_Opt'], '+': ['GraphNode', '_GraphNode_Opt'], '-': ['GraphNode', '_GraphNode_Opt'], '[': ['GraphNode', '_GraphNode_Opt'], 'ANON': ['GraphNode', '_GraphNode_Opt'], 'BLANK_NODE_LABEL': ['GraphNode', '_GraphNode_Opt'], 'BooleanLiteral': ['GraphNode', '_GraphNode_Opt'], 'DECIMAL': ['GraphNode', '_GraphNode_Opt'], 'DOUBLE': ['GraphNode', '_GraphNode_Opt'], 'INTEGER': ['GraphNode', '_GraphNode_Opt'], 'IRI_REF': ['GraphNode', '_GraphNode_Opt'], 'NIL': ['GraphNode', '_GraphNode_Opt'], 'PNAME_LN': ['GraphNode', '_GraphNode_Opt'], 'PNAME_NS': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL1': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL2': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL_LONG1': ['GraphNode', '_GraphNode_Opt'], 'STRING_LITERAL_LONG2': ['GraphNode', '_GraphNode_Opt'], 'VAR1': ['GraphNode', '_GraphNode_Opt'], 'VAR2': ['GraphNode', '_GraphNode_Opt']}, '_GraphPatternNotTriples_or_Filter': {'FILTER': ['Filter'], 'GRAPH': ['GraphPatternNotTriples'], 'OPTIONAL': ['GraphPatternNotTriples'], '{': ['GraphPatternNotTriples']}, '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt': {'FILTER': ['_GraphPatternNotTriples_or_Filter', '_DOT_Opt', '_TriplesBlock_Opt'], 'GRAPH': ['_GraphPatternNotTriples_or_Filter', '_DOT_Opt', '_TriplesBlock_Opt'], 'OPTIONAL': ['_GraphPatternNotTriples_or_Filter', '_DOT_Opt', '_TriplesBlock_Opt'], '{': ['_GraphPatternNotTriples_or_Filter', '_DOT_Opt', '_TriplesBlock_Opt']}, '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star': {'FILTER': ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt', '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'], 'GRAPH': ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt', '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'], 'OPTIONAL': ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt', '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'], '{': ['_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt', '_GraphPatternNotTriples_or_Filter_Dot_Opt_TriplesBlock_Opt_Star'], '}': []}, '_LANGTAG_IRIref_Opt': {'!=': [], '&&': [], '(': [], ')': [], '*': [], '+': [], ',': [], '-': [], '.': [], '/': [], ';': [], '<': [], '<=': [], '=': [], '>=': [], '>': [], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], '[': [], ']': [], '^^': ['^^', 'IRIref'], 'a': [], 'ANON': [], 'BLANK_NODE_LABEL': [], 'BooleanLiteral': [], 'DECIMAL': [], 'DOUBLE': [], 'INTEGER': [], 'IRI_REF': [], 'LANGTAG': ['LANGTAG'], 'NIL': [], 'PNAME_LN': [], 'PNAME_NS': [], 'STRING_LITERAL1': [], 'STRING_LITERAL2': [], 'STRING_LITERAL_LONG1': [], 'STRING_LITERAL_LONG2': [], 'VAR1': [], 'VAR2': [], '{': [], '||': [], '}': []}, '_LimitClause_Opt': {'LIMIT': ['LimitClause'], 'eof': []}, '_LimitOffsetClauses_Opt': {'LIMIT': ['LimitOffsetClauses'], 'OFFSET': ['LimitOffsetClauses'], 'eof': []}, '_Mul_Div_UnaryExpression_Star': {'!=': [], '&&': [], ')': [], '*': ['*', 'UnaryExpression', '_Mul_Div_UnaryExpression_Star'], '+': [], ',': [], '-': [], '/': ['/', 'UnaryExpression', '_Mul_Div_UnaryExpression_Star'], '<': [], '<=': [], '=': [], '>=': [], '>': [], '||': []}, '_OR_ConditionalAndExpression': {'||': ['||', 'ConditionalAndExpression']}, '_OR_ConditionalAndExpression_Star': {')': [], ',': [], '||': ['_OR_ConditionalAndExpression', '_OR_ConditionalAndExpression_Star']}, '_OffsetClause_Opt': {'OFFSET': ['OffsetClause'], 'eof': []}, '_OrderClause_Opt': {'LIMIT': [], 'OFFSET': [], 'ORDER': ['OrderClause'], 'eof': []}, '_OrderCondition_Plus': {'(': ['OrderCondition', '_OrderCondition_Plus'], 'ASC': ['OrderCondition', '_OrderCondition_Plus'], 'BOUND': ['OrderCondition', '_OrderCondition_Plus'], 'DATATYPE': ['OrderCondition', '_OrderCondition_Plus'], 'DESC': ['OrderCondition', '_OrderCondition_Plus'], 'LANG': ['OrderCondition', '_OrderCondition_Plus'], 'LANGMATCHES': ['OrderCondition', '_OrderCondition_Plus'], 'LIMIT': [], 'OFFSET': [], 'REGEX': ['OrderCondition', '_OrderCondition_Plus'], 'STR': ['OrderCondition', '_OrderCondition_Plus'], 'eof': [], 'IRI_REF': ['OrderCondition', '_OrderCondition_Plus'], 'PNAME_LN': ['OrderCondition', '_OrderCondition_Plus'], 'PNAME_NS': ['OrderCondition', '_OrderCondition_Plus'], 'VAR1': ['OrderCondition', '_OrderCondition_Plus'], 'VAR2': ['OrderCondition', '_OrderCondition_Plus'], 'ISBLANK': ['OrderCondition', '_OrderCondition_Plus'], 'ISIRI': ['OrderCondition', '_OrderCondition_Plus'], 'ISLITERAL': ['OrderCondition', '_OrderCondition_Plus'], 'ISURI': ['OrderCondition', '_OrderCondition_Plus'], 'SAMETERM': ['OrderCondition', '_OrderCondition_Plus']}, '_PrefixDecl_Star': {'ASK': [], 'CONSTRUCT': [], 'DESCRIBE': [], 'PREFIX': ['PrefixDecl', '_PrefixDecl_Star'], 'SELECT': []}, '_SEMI_Verb_ObjectList_Opt': {';': [';', '_Verb_ObjectList_Opt']}, '_SEMI_Verb_ObjectList_Opt_Star': {'.': [], ';': ['_SEMI_Verb_ObjectList_Opt', '_SEMI_Verb_ObjectList_Opt_Star'], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], ']': [], '{': [], '}': []}, '_SelectQuery_or_ConstructQuery_or_DescribeQuery_or_AskQuery': {'ASK': ['AskQuery'], 'CONSTRUCT': ['ConstructQuery'], 'DESCRIBE': ['DescribeQuery'], 'SELECT': ['SelectQuery']}, '_TriplesBlock_Opt': {'(': ['TriplesBlock'], '+': ['TriplesBlock'], '-': ['TriplesBlock'], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], '[': ['TriplesBlock'], 'ANON': ['TriplesBlock'], 'BLANK_NODE_LABEL': ['TriplesBlock'], 'BooleanLiteral': ['TriplesBlock'], 'DECIMAL': ['TriplesBlock'], 'DOUBLE': ['TriplesBlock'], 'INTEGER': ['TriplesBlock'], 'IRI_REF': ['TriplesBlock'], 'NIL': ['TriplesBlock'], 'PNAME_LN': ['TriplesBlock'], 'PNAME_NS': ['TriplesBlock'], 'STRING_LITERAL1': ['TriplesBlock'], 'STRING_LITERAL2': ['TriplesBlock'], 'STRING_LITERAL_LONG1': ['TriplesBlock'], 'STRING_LITERAL_LONG2': ['TriplesBlock'], 'VAR1': ['TriplesBlock'], 'VAR2': ['TriplesBlock'], '{': [], '}': []}, '_UNION_GroupGraphPattern': {'UNION': ['UNION', 'GroupGraphPattern']}, '_UNION_GroupGraphPattern_Star': {'(': [], '+': [], '-': [], '.': [], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], 'UNION': ['_UNION_GroupGraphPattern', '_UNION_GroupGraphPattern_Star'], '[': [], 'ANON': [], 'BLANK_NODE_LABEL': [], 'BooleanLiteral': [], 'DECIMAL': [], 'DOUBLE': [], 'INTEGER': [], 'IRI_REF': [], 'NIL': [], 'PNAME_LN': [], 'PNAME_NS': [], 'STRING_LITERAL1': [], 'STRING_LITERAL2': [], 'STRING_LITERAL_LONG1': [], 'STRING_LITERAL_LONG2': [], 'VAR1': [], 'VAR2': [], '{': [], '}': []}, '_VarOrIRIRef_Plus': {'FROM': [], 'LIMIT': [], 'OFFSET': [], 'ORDER': [], 'WHERE': [], 'eof': [], 'IRI_REF': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'PNAME_LN': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'PNAME_NS': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'VAR1': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'VAR2': ['VarOrIRIref', '_VarOrIRIRef_Plus'], '{': []}, '_VarOrIRIref_Plus_or_Star': {'*': ['*'], 'IRI_REF': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'PNAME_LN': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'PNAME_NS': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'VAR1': ['VarOrIRIref', '_VarOrIRIRef_Plus'], 'VAR2': ['VarOrIRIref', '_VarOrIRIRef_Plus']}, '_Var_Plus': {'FROM': [], 'LIMIT': [], 'OFFSET': [], 'ORDER': [], 'WHERE': [], 'eof': [], 'VAR1': ['Var', '_Var_Plus'], 'VAR2': ['Var', '_Var_Plus'], '{': []}, '_Var_Plus_or_Star': {'*': ['*'], 'VAR1': ['Var', '_Var_Plus'], 'VAR2': ['Var', '_Var_Plus']}, '_Verb_ObjectList_Opt': {'.': [], ';': [], 'FILTER': [], 'GRAPH': [], 'OPTIONAL': [], ']': [], 'a': ['Verb', 'ObjectList'], 'IRI_REF': ['Verb', 'ObjectList'], 'PNAME_LN': ['Verb', 'ObjectList'], 'PNAME_NS': ['Verb', 'ObjectList'], 'VAR1': ['Verb', 'ObjectList'], 'VAR2': ['Verb', 'ObjectList'], '{': [], '}': []}, '_WHERE_Opt': {'WHERE': ['WHERE'], '{': []}, '_WhereClause_Opt': {'LIMIT': [], 'OFFSET': [], 'ORDER': [], 'WHERE': ['WhereClause'], 'eof': [], '{': ['WhereClause']}} |
class Solution:
def minSteps(self, s: str, t: str) -> int:
res = 0
dic = {}
for _ in s:
if _ in dic:
dic[_] += 1
else:
dic[_] = 1
for _ in t:
if _ in dic:
dic[_] -= 1
if not dic[_]:
del dic[_]
else:
res += 1
return res | class Solution:
def min_steps(self, s: str, t: str) -> int:
res = 0
dic = {}
for _ in s:
if _ in dic:
dic[_] += 1
else:
dic[_] = 1
for _ in t:
if _ in dic:
dic[_] -= 1
if not dic[_]:
del dic[_]
else:
res += 1
return res |
# * Daily Coding Problem August 25 2020
# * [Easy] -- Google
# * In linear algebra, a Toeplitz matrix is one in which the elements on
# * any given diagonal from top left to bottom right are identical.
# * Write a program to determine whether a given input is a Toeplitz matrix.
def checkDiagonal(mat, i, j):
res = mat[i][j]
i += 1
j += 1
rows = len(mat)
cols = len(mat[0])
while (i < rows and j < cols):
# mismatch found
if (mat[i][j] != res):
return False
i += 1
j += 1
# we only reach here when all elements
# in given diagonal are same
return True
def isToeplitz(mat):
rows = len(mat)
cols = len(mat[0])
for j in range(rows - 1):
# check descending diagonal starting from
# position (0, j) in the matrix
if not(checkDiagonal(mat, 0, j)):
return False
for i in range(1, cols - 1):
# check descending diagonal starting
# from position (i, 0) in the matrix
if not(checkDiagonal(mat, i, 0)):
return False
return True
def main():
matrix = [
[1, 2, 3, 4, 8],
[5, 1, 2, 3, 4],
[4, 5, 1, 2, 3],
[7, 4, 5, 1, 2]
]
print('\n'.join(['\t'.join([str(cell) for cell in row])
for row in matrix]))
print(f"Toeplitz matrix ? {isToeplitz(matrix)}")
main()
# --------------------------TESTs----------------------------
def testIsToeplitz1():
matrix = [
[1, 2, 3, 4, 8],
[5, 1, 2, 3, 4],
[4, 5, 1, 2, 3],
[7, 4, 5, 1, 2]
]
assert isToeplitz(matrix) == True
def testIsToeplitz2():
matrix = [
[1, 5, 3, 4, 8],
[5, 1, 2, 3, 4],
[4, 5, 1, 2, 3],
[7, 4, 5, 1, 2]
]
assert isToeplitz(matrix) == False
def testIsToeplitz3():
matrix = [
[6, 7, 8, 9],
[4, 6, 7, 8],
[1, 4, 6, 7],
[0, 1, 4, 6],
[2, 0, 1, 4]
]
assert isToeplitz(matrix) == True
| def check_diagonal(mat, i, j):
res = mat[i][j]
i += 1
j += 1
rows = len(mat)
cols = len(mat[0])
while i < rows and j < cols:
if mat[i][j] != res:
return False
i += 1
j += 1
return True
def is_toeplitz(mat):
rows = len(mat)
cols = len(mat[0])
for j in range(rows - 1):
if not check_diagonal(mat, 0, j):
return False
for i in range(1, cols - 1):
if not check_diagonal(mat, i, 0):
return False
return True
def main():
matrix = [[1, 2, 3, 4, 8], [5, 1, 2, 3, 4], [4, 5, 1, 2, 3], [7, 4, 5, 1, 2]]
print('\n'.join(['\t'.join([str(cell) for cell in row]) for row in matrix]))
print(f'Toeplitz matrix ? {is_toeplitz(matrix)}')
main()
def test_is_toeplitz1():
matrix = [[1, 2, 3, 4, 8], [5, 1, 2, 3, 4], [4, 5, 1, 2, 3], [7, 4, 5, 1, 2]]
assert is_toeplitz(matrix) == True
def test_is_toeplitz2():
matrix = [[1, 5, 3, 4, 8], [5, 1, 2, 3, 4], [4, 5, 1, 2, 3], [7, 4, 5, 1, 2]]
assert is_toeplitz(matrix) == False
def test_is_toeplitz3():
matrix = [[6, 7, 8, 9], [4, 6, 7, 8], [1, 4, 6, 7], [0, 1, 4, 6], [2, 0, 1, 4]]
assert is_toeplitz(matrix) == True |
# Initialize sum
sum = 0
# Add 0.01, 0.02, ..., 0.99, 1 to sum
i = 0.01
while i <= 1.0:
sum += i
i = i + 0.01
# Display result
print("The sum is", sum) | sum = 0
i = 0.01
while i <= 1.0:
sum += i
i = i + 0.01
print('The sum is', sum) |
print('-' * 15)
medida = float(input('Digite uma distancia em metros:'))
centimetros = medida * 100
milimetros = medida * 1000
print('A media de {} corresponde a {:.0f} e {:.0f}'.format(medida, centimetros, milimetros)) | print('-' * 15)
medida = float(input('Digite uma distancia em metros:'))
centimetros = medida * 100
milimetros = medida * 1000
print('A media de {} corresponde a {:.0f} e {:.0f}'.format(medida, centimetros, milimetros)) |
def exponentiation(base, exponent):
if isinstance(base, str) or isinstance(exponent, str):
return "Trying to use strings in calculator"
solution = float(base) ** exponent
return solution
| def exponentiation(base, exponent):
if isinstance(base, str) or isinstance(exponent, str):
return 'Trying to use strings in calculator'
solution = float(base) ** exponent
return solution |
# Curbrock's Revenge (5501)
SABITRAMA = 1061005 # NPC ID
CURBROCKS_HIDEOUT_VER3 = 600050020 # MAP ID
CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 3
sm.setSpeakerID(SABITRAMA)
if sm.getFieldID() == CURBROCKS_ESCAPE_ROUTE_VER3:
sm.sendSayOkay("Please leave before reaccepting this quest again.")
else:
sm.sendNext("The rumors are true. "
"Curbrock has returned, and the people are worried.")
sm.sendSay("However, he doesn't seem to be interested in anyone but you.")
response = sm.sendAskYesNo("I can send you there now if you want. "
"Are you prepared?")
if response:
sm.sendNext("Since you last fought, Curbrock has learned a few new tricks.")
sm.sendSay("His Seal spell will stop you from using your skills.")
sm.sendSay("His Blind spell will stop you from seeing.")
sm.sendSay("And his Stun spell will stop you from moving.")
sm.sendSay("If you can avoid or counter his spells, you might yet beat him.")
chr.setPreviousFieldID(chr.getFieldID())
sm.startQuest(parentID)
sm.warpInstanceIn(CURBROCKS_HIDEOUT_VER3) | sabitrama = 1061005
curbrocks_hideout_ver3 = 600050020
curbrocks_escape_route_ver3 = 600050050
sm.setSpeakerID(SABITRAMA)
if sm.getFieldID() == CURBROCKS_ESCAPE_ROUTE_VER3:
sm.sendSayOkay('Please leave before reaccepting this quest again.')
else:
sm.sendNext('The rumors are true. Curbrock has returned, and the people are worried.')
sm.sendSay("However, he doesn't seem to be interested in anyone but you.")
response = sm.sendAskYesNo('I can send you there now if you want. Are you prepared?')
if response:
sm.sendNext('Since you last fought, Curbrock has learned a few new tricks.')
sm.sendSay('His Seal spell will stop you from using your skills.')
sm.sendSay('His Blind spell will stop you from seeing.')
sm.sendSay('And his Stun spell will stop you from moving.')
sm.sendSay('If you can avoid or counter his spells, you might yet beat him.')
chr.setPreviousFieldID(chr.getFieldID())
sm.startQuest(parentID)
sm.warpInstanceIn(CURBROCKS_HIDEOUT_VER3) |
#
# PySNMP MIB module CISCOSB-SECSD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-SECSD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:06:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
switch001, = mibBuilder.importSymbols("CISCOSB-MIB", "switch001")
EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Counter64, Bits, ObjectIdentity, MibIdentifier, Counter32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, TimeTicks, iso, Unsigned32, ModuleIdentity, NotificationType, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "Bits", "ObjectIdentity", "MibIdentifier", "Counter32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "TimeTicks", "iso", "Unsigned32", "ModuleIdentity", "NotificationType", "Gauge32")
DisplayString, RowStatus, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TruthValue", "TextualConvention")
rlSecSd = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209))
rlSecSd.setRevisions(('2011-08-31 00:00',))
if mibBuilder.loadTexts: rlSecSd.setLastUpdated('201108310000Z')
if mibBuilder.loadTexts: rlSecSd.setOrganization('Cisco Small Business')
class RlSecSdRuleUserType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("user-name", 1), ("default-user", 2), ("level-15-users", 3), ("all-users", 4))
class RlSecSdChannelType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("secure-xml-snmp", 1), ("secure", 2), ("insecure", 3), ("insecure-xml-snmp", 4))
class RlSecSdAccessType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("exclude", 1), ("include-encrypted", 2), ("include-decrypted", 3))
class RlSecSdPermitAccessType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("exclude", 1), ("include-encrypted", 2), ("include-decrypted", 3), ("include-all", 4))
class RlSecSdSessionAccessType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("exclude", 1), ("include-encrypted", 2), ("include-decrypted", 3), ("default", 4))
class RlSecSdRuleOwnerType(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("default", 1), ("user", 2))
rlSecSdRulesTable = MibTable((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1), )
if mibBuilder.loadTexts: rlSecSdRulesTable.setStatus('current')
rlSecSdRulesEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1), ).setIndexNames((0, "CISCOSB-SECSD-MIB", "rlSecSdRuleUser"), (0, "CISCOSB-SECSD-MIB", "rlSecSdRuleUserName"), (0, "CISCOSB-SECSD-MIB", "rlSecSdRuleChannel"))
if mibBuilder.loadTexts: rlSecSdRulesEntry.setStatus('current')
rlSecSdRuleUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 1), RlSecSdRuleUserType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRuleUser.setStatus('current')
rlSecSdRuleUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 39))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRuleUserName.setStatus('current')
rlSecSdRuleChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 3), RlSecSdChannelType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRuleChannel.setStatus('current')
rlSecSdRuleRead = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 4), RlSecSdAccessType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRuleRead.setStatus('current')
rlSecSdRulePermitRead = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 5), RlSecSdPermitAccessType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRulePermitRead.setStatus('current')
rlSecSdRuleIsDefault = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlSecSdRuleIsDefault.setStatus('current')
rlSecSdRuleOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 7), RlSecSdRuleOwnerType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRuleOwner.setStatus('current')
rlSecSdRuleStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 8), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdRuleStatus.setStatus('current')
rlSecSdMngSessionsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2), )
if mibBuilder.loadTexts: rlSecSdMngSessionsTable.setStatus('current')
rlSecSdMngSessionsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2), ).setIndexNames((0, "CISCOSB-SECSD-MIB", "rlSecSdMngSessionId"))
if mibBuilder.loadTexts: rlSecSdMngSessionsEntry.setStatus('current')
rlSecSdMngSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlSecSdMngSessionId.setStatus('current')
rlSecSdMngSessionUserLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlSecSdMngSessionUserLevel.setStatus('current')
rlSecSdMngSessionUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 160))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdMngSessionUserName.setStatus('current')
rlSecSdMngSessionChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 4), RlSecSdChannelType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlSecSdMngSessionChannel.setStatus('current')
rlSecSdSessionControl = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 3), RlSecSdSessionAccessType()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdSessionControl.setStatus('current')
rlSecSdCurrentSessionId = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlSecSdCurrentSessionId.setStatus('current')
rlSecSdPassPhrase = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 160))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdPassPhrase.setStatus('current')
rlSecSdFilePassphraseControl = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("restricted", 1), ("unrestricted", 2))).clone('unrestricted')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdFilePassphraseControl.setStatus('current')
rlSecSdFileIntegrityControl = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdFileIntegrityControl.setStatus('current')
rlSecSdConfigurationFileSsdDigest = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 160))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdConfigurationFileSsdDigest.setStatus('current')
rlSecSdConfigurationFileDigest = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 160))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdConfigurationFileDigest.setStatus('current')
rlSecSdFileIndicator = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 39))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlSecSdFileIndicator.setStatus('current')
mibBuilder.exportSymbols("CISCOSB-SECSD-MIB", PYSNMP_MODULE_ID=rlSecSd, rlSecSdRuleOwner=rlSecSdRuleOwner, rlSecSdRulesEntry=rlSecSdRulesEntry, rlSecSdMngSessionUserName=rlSecSdMngSessionUserName, rlSecSdCurrentSessionId=rlSecSdCurrentSessionId, RlSecSdSessionAccessType=RlSecSdSessionAccessType, rlSecSdRulesTable=rlSecSdRulesTable, RlSecSdChannelType=RlSecSdChannelType, rlSecSdRuleStatus=rlSecSdRuleStatus, rlSecSdRuleIsDefault=rlSecSdRuleIsDefault, rlSecSdRulePermitRead=rlSecSdRulePermitRead, RlSecSdRuleOwnerType=RlSecSdRuleOwnerType, rlSecSdMngSessionId=rlSecSdMngSessionId, rlSecSdSessionControl=rlSecSdSessionControl, rlSecSdMngSessionsTable=rlSecSdMngSessionsTable, rlSecSdRuleUserName=rlSecSdRuleUserName, RlSecSdAccessType=RlSecSdAccessType, rlSecSdConfigurationFileDigest=rlSecSdConfigurationFileDigest, rlSecSdMngSessionsEntry=rlSecSdMngSessionsEntry, RlSecSdRuleUserType=RlSecSdRuleUserType, rlSecSdMngSessionUserLevel=rlSecSdMngSessionUserLevel, rlSecSdRuleUser=rlSecSdRuleUser, rlSecSdConfigurationFileSsdDigest=rlSecSdConfigurationFileSsdDigest, rlSecSdRuleRead=rlSecSdRuleRead, rlSecSdPassPhrase=rlSecSdPassPhrase, rlSecSdMngSessionChannel=rlSecSdMngSessionChannel, RlSecSdPermitAccessType=RlSecSdPermitAccessType, rlSecSd=rlSecSd, rlSecSdFileIndicator=rlSecSdFileIndicator, rlSecSdFileIntegrityControl=rlSecSdFileIntegrityControl, rlSecSdRuleChannel=rlSecSdRuleChannel, rlSecSdFilePassphraseControl=rlSecSdFilePassphraseControl)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion')
(switch001,) = mibBuilder.importSymbols('CISCOSB-MIB', 'switch001')
(enabled_status,) = mibBuilder.importSymbols('P-BRIDGE-MIB', 'EnabledStatus')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(counter64, bits, object_identity, mib_identifier, counter32, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, time_ticks, iso, unsigned32, module_identity, notification_type, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'Bits', 'ObjectIdentity', 'MibIdentifier', 'Counter32', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'TimeTicks', 'iso', 'Unsigned32', 'ModuleIdentity', 'NotificationType', 'Gauge32')
(display_string, row_status, truth_value, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'TruthValue', 'TextualConvention')
rl_sec_sd = module_identity((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209))
rlSecSd.setRevisions(('2011-08-31 00:00',))
if mibBuilder.loadTexts:
rlSecSd.setLastUpdated('201108310000Z')
if mibBuilder.loadTexts:
rlSecSd.setOrganization('Cisco Small Business')
class Rlsecsdruleusertype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('user-name', 1), ('default-user', 2), ('level-15-users', 3), ('all-users', 4))
class Rlsecsdchanneltype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('secure-xml-snmp', 1), ('secure', 2), ('insecure', 3), ('insecure-xml-snmp', 4))
class Rlsecsdaccesstype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3))
named_values = named_values(('exclude', 1), ('include-encrypted', 2), ('include-decrypted', 3))
class Rlsecsdpermitaccesstype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('exclude', 1), ('include-encrypted', 2), ('include-decrypted', 3), ('include-all', 4))
class Rlsecsdsessionaccesstype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('exclude', 1), ('include-encrypted', 2), ('include-decrypted', 3), ('default', 4))
class Rlsecsdruleownertype(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('default', 1), ('user', 2))
rl_sec_sd_rules_table = mib_table((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1))
if mibBuilder.loadTexts:
rlSecSdRulesTable.setStatus('current')
rl_sec_sd_rules_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1)).setIndexNames((0, 'CISCOSB-SECSD-MIB', 'rlSecSdRuleUser'), (0, 'CISCOSB-SECSD-MIB', 'rlSecSdRuleUserName'), (0, 'CISCOSB-SECSD-MIB', 'rlSecSdRuleChannel'))
if mibBuilder.loadTexts:
rlSecSdRulesEntry.setStatus('current')
rl_sec_sd_rule_user = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 1), rl_sec_sd_rule_user_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRuleUser.setStatus('current')
rl_sec_sd_rule_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 39))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRuleUserName.setStatus('current')
rl_sec_sd_rule_channel = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 3), rl_sec_sd_channel_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRuleChannel.setStatus('current')
rl_sec_sd_rule_read = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 4), rl_sec_sd_access_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRuleRead.setStatus('current')
rl_sec_sd_rule_permit_read = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 5), rl_sec_sd_permit_access_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRulePermitRead.setStatus('current')
rl_sec_sd_rule_is_default = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 6), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlSecSdRuleIsDefault.setStatus('current')
rl_sec_sd_rule_owner = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 7), rl_sec_sd_rule_owner_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRuleOwner.setStatus('current')
rl_sec_sd_rule_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 1, 1, 8), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdRuleStatus.setStatus('current')
rl_sec_sd_mng_sessions_table = mib_table((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2))
if mibBuilder.loadTexts:
rlSecSdMngSessionsTable.setStatus('current')
rl_sec_sd_mng_sessions_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2)).setIndexNames((0, 'CISCOSB-SECSD-MIB', 'rlSecSdMngSessionId'))
if mibBuilder.loadTexts:
rlSecSdMngSessionsEntry.setStatus('current')
rl_sec_sd_mng_session_id = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlSecSdMngSessionId.setStatus('current')
rl_sec_sd_mng_session_user_level = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlSecSdMngSessionUserLevel.setStatus('current')
rl_sec_sd_mng_session_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 3), display_string().subtype(subtypeSpec=value_size_constraint(0, 160))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdMngSessionUserName.setStatus('current')
rl_sec_sd_mng_session_channel = mib_table_column((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 2, 2, 4), rl_sec_sd_channel_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlSecSdMngSessionChannel.setStatus('current')
rl_sec_sd_session_control = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 3), rl_sec_sd_session_access_type()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdSessionControl.setStatus('current')
rl_sec_sd_current_session_id = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlSecSdCurrentSessionId.setStatus('current')
rl_sec_sd_pass_phrase = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 160))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdPassPhrase.setStatus('current')
rl_sec_sd_file_passphrase_control = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('restricted', 1), ('unrestricted', 2))).clone('unrestricted')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdFilePassphraseControl.setStatus('current')
rl_sec_sd_file_integrity_control = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2))).clone('enable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdFileIntegrityControl.setStatus('current')
rl_sec_sd_configuration_file_ssd_digest = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 8), display_string().subtype(subtypeSpec=value_size_constraint(0, 160))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdConfigurationFileSsdDigest.setStatus('current')
rl_sec_sd_configuration_file_digest = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 9), display_string().subtype(subtypeSpec=value_size_constraint(0, 160))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdConfigurationFileDigest.setStatus('current')
rl_sec_sd_file_indicator = mib_scalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 209, 10), display_string().subtype(subtypeSpec=value_size_constraint(0, 39))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlSecSdFileIndicator.setStatus('current')
mibBuilder.exportSymbols('CISCOSB-SECSD-MIB', PYSNMP_MODULE_ID=rlSecSd, rlSecSdRuleOwner=rlSecSdRuleOwner, rlSecSdRulesEntry=rlSecSdRulesEntry, rlSecSdMngSessionUserName=rlSecSdMngSessionUserName, rlSecSdCurrentSessionId=rlSecSdCurrentSessionId, RlSecSdSessionAccessType=RlSecSdSessionAccessType, rlSecSdRulesTable=rlSecSdRulesTable, RlSecSdChannelType=RlSecSdChannelType, rlSecSdRuleStatus=rlSecSdRuleStatus, rlSecSdRuleIsDefault=rlSecSdRuleIsDefault, rlSecSdRulePermitRead=rlSecSdRulePermitRead, RlSecSdRuleOwnerType=RlSecSdRuleOwnerType, rlSecSdMngSessionId=rlSecSdMngSessionId, rlSecSdSessionControl=rlSecSdSessionControl, rlSecSdMngSessionsTable=rlSecSdMngSessionsTable, rlSecSdRuleUserName=rlSecSdRuleUserName, RlSecSdAccessType=RlSecSdAccessType, rlSecSdConfigurationFileDigest=rlSecSdConfigurationFileDigest, rlSecSdMngSessionsEntry=rlSecSdMngSessionsEntry, RlSecSdRuleUserType=RlSecSdRuleUserType, rlSecSdMngSessionUserLevel=rlSecSdMngSessionUserLevel, rlSecSdRuleUser=rlSecSdRuleUser, rlSecSdConfigurationFileSsdDigest=rlSecSdConfigurationFileSsdDigest, rlSecSdRuleRead=rlSecSdRuleRead, rlSecSdPassPhrase=rlSecSdPassPhrase, rlSecSdMngSessionChannel=rlSecSdMngSessionChannel, RlSecSdPermitAccessType=RlSecSdPermitAccessType, rlSecSd=rlSecSd, rlSecSdFileIndicator=rlSecSdFileIndicator, rlSecSdFileIntegrityControl=rlSecSdFileIntegrityControl, rlSecSdRuleChannel=rlSecSdRuleChannel, rlSecSdFilePassphraseControl=rlSecSdFilePassphraseControl) |
#
# @lc app=leetcode id=680 lang=python3
#
# [680] Valid Palindrome II
#
# @lc code=start
class Solution:
def validPalindrome(self, s: str) -> bool:
l, r = 0, len(s) - 1
while l < r:
if s[l] != s[r]:
pre, las = s[l:r], s[l + 1:r + 1]
return pre[::-1] == pre or las[::-1] == las
else:
l += 1
r -= 1
return True
# @lc code=end
| class Solution:
def valid_palindrome(self, s: str) -> bool:
(l, r) = (0, len(s) - 1)
while l < r:
if s[l] != s[r]:
(pre, las) = (s[l:r], s[l + 1:r + 1])
return pre[::-1] == pre or las[::-1] == las
else:
l += 1
r -= 1
return True |
# Space/Time O(n), O(nLogn)
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
# Sort intervals
intervals.sort(key=lambda x:x[0])
# start merged list and go through intervals
merged = [intervals[0]]
for si, ei in intervals:
sm, em = merged[-1]
if si <= em:
merged[-1] = (sm, max(em,ei))
else:
merged.append((si, ei))
return merged
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
if not intervals:
return
# sort intervals
intervals.sort(key = lambda x:x[0])
# start merged list and go through intervals
merged = [intervals[0]]
for i in intervals:
ms, me = merged[-1]
s, e = i
if s <= me:
merged[-1] = (ms, max(me, e))
else:
merged.append(i)
return merged
| class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals.sort(key=lambda x: x[0])
merged = [intervals[0]]
for (si, ei) in intervals:
(sm, em) = merged[-1]
if si <= em:
merged[-1] = (sm, max(em, ei))
else:
merged.append((si, ei))
return merged
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
if not intervals:
return
intervals.sort(key=lambda x: x[0])
merged = [intervals[0]]
for i in intervals:
(ms, me) = merged[-1]
(s, e) = i
if s <= me:
merged[-1] = (ms, max(me, e))
else:
merged.append(i)
return merged |
start_range = int(input())
stop_range = int(input())
for x in range(start_range, stop_range + 1):
print(f"{(chr(x))}", end=" ") | start_range = int(input())
stop_range = int(input())
for x in range(start_range, stop_range + 1):
print(f'{chr(x)}', end=' ') |
def brackets(sequence: str) -> bool:
brackets_dict = {"]": "[", ")": "(", "}": "{", ">": "<"}
stack = []
for symbol in sequence:
if symbol in "[({<":
stack.append(symbol)
elif symbol in "])}>":
if brackets_dict[symbol] != stack.pop():
return False
return True
if __name__ == "__main__":
print(brackets("[12 / (9) + 2(5{15 * <2 - 3>}6)]"))
print(brackets("1{2 + [3}45 - 6] * (7 - 8)9"))
| def brackets(sequence: str) -> bool:
brackets_dict = {']': '[', ')': '(', '}': '{', '>': '<'}
stack = []
for symbol in sequence:
if symbol in '[({<':
stack.append(symbol)
elif symbol in '])}>':
if brackets_dict[symbol] != stack.pop():
return False
return True
if __name__ == '__main__':
print(brackets('[12 / (9) + 2(5{15 * <2 - 3>}6)]'))
print(brackets('1{2 + [3}45 - 6] * (7 - 8)9')) |
def merge(left, right):
m = []
i,j = 0,0
k = 0
while i < len(left) and j < len(right):
# print(left,right,left[i], right[j])
if left[i] <= right[j]:
m.append(left[i])
i+=1
else:
m.append(right[j])
j +=1
if i < len(left):
m.extend(left[i:])
if j < len(right):
m.extend(right[j:])
print(left, right)
print(m)
return m
def sort(a):
n = len(a)
mid = n//2
if n <= 1:
return a
left = sort(a[:mid])
right = sort(a[mid:])
m=merge(left, right)
return m
if __name__ == "__main__":
a= [5,1,5,8,12,13,5,8,1,23,1,11]
print(sort(a)) | def merge(left, right):
m = []
(i, j) = (0, 0)
k = 0
while i < len(left) and j < len(right):
if left[i] <= right[j]:
m.append(left[i])
i += 1
else:
m.append(right[j])
j += 1
if i < len(left):
m.extend(left[i:])
if j < len(right):
m.extend(right[j:])
print(left, right)
print(m)
return m
def sort(a):
n = len(a)
mid = n // 2
if n <= 1:
return a
left = sort(a[:mid])
right = sort(a[mid:])
m = merge(left, right)
return m
if __name__ == '__main__':
a = [5, 1, 5, 8, 12, 13, 5, 8, 1, 23, 1, 11]
print(sort(a)) |
# T Y P E O F V E R B S
def pert_subjective_verbs(texts_tokens):
total_verbs = 0
total_subj_verbs = 0
return
def pert_report_verbs(text_tokens):
return
def pert_factive_verbs(text_tokens):
return
def pert_imperative_commands(text_tokens):
return | def pert_subjective_verbs(texts_tokens):
total_verbs = 0
total_subj_verbs = 0
return
def pert_report_verbs(text_tokens):
return
def pert_factive_verbs(text_tokens):
return
def pert_imperative_commands(text_tokens):
return |
load("@rules_python//python:defs.bzl", "py_test")
pycoverage_requirements = [
"//tools/pycoverage",
]
def pycoverage(name, deps):
if not name or not deps:
fail("Arguments 'name' and 'deps' are required")
py_test(
name = name,
main = "pycoverage_runner.py",
srcs = ["//tools/pycoverage:pycoverage_runner"],
imports = ["."],
args = deps,
deps = depset(direct = deps + pycoverage_requirements).to_list(),
)
| load('@rules_python//python:defs.bzl', 'py_test')
pycoverage_requirements = ['//tools/pycoverage']
def pycoverage(name, deps):
if not name or not deps:
fail("Arguments 'name' and 'deps' are required")
py_test(name=name, main='pycoverage_runner.py', srcs=['//tools/pycoverage:pycoverage_runner'], imports=['.'], args=deps, deps=depset(direct=deps + pycoverage_requirements).to_list()) |
filename = "test2.txt"
tree = [None]*16
with open(filename) as f:
line = f.readline().strip().strip('[]')
for c in line:
if c == ',':
continue
for line in f:
n = line.strip().strip('[]')
print(n) | filename = 'test2.txt'
tree = [None] * 16
with open(filename) as f:
line = f.readline().strip().strip('[]')
for c in line:
if c == ',':
continue
for line in f:
n = line.strip().strip('[]')
print(n) |
class Solution:
def searchMatrix(self, matrix, target):
i, j, r = 0, len(matrix[0]) - 1, len(matrix)
while i < r and j >= 0:
if matrix[i][j] == target:
return True
elif matrix[i][j] > target:
j -= 1
elif matrix[i][j] < target:
i += 1
return False
| class Solution:
def search_matrix(self, matrix, target):
(i, j, r) = (0, len(matrix[0]) - 1, len(matrix))
while i < r and j >= 0:
if matrix[i][j] == target:
return True
elif matrix[i][j] > target:
j -= 1
elif matrix[i][j] < target:
i += 1
return False |
def setUpModule() -> None:
print("[Module sserender Test Start]")
def tearDownModule() -> None:
print("[Module sserender Test End]") | def set_up_module() -> None:
print('[Module sserender Test Start]')
def tear_down_module() -> None:
print('[Module sserender Test End]') |
print('begin program')
# This program says hello and asks for my name.
print('Hello, World!')
print('What is your name?')
myName = input()
print('It is good to meet you, ' + myName)
print('end program')
| print('begin program')
print('Hello, World!')
print('What is your name?')
my_name = input()
print('It is good to meet you, ' + myName)
print('end program') |
#!/usr/bin/env python
'''
primes.py
@author: Lorenzo Cipriani <lorenzo1974@gmail.com>
@contact: https://www.linkedin.com/in/lorenzocipriani
@since: 2017-10-23
@see:
'''
primesToFind = 1000000
num = 0
found = 0
def isPrime(num):
if num > 1:
for i in range(2, num):
if (num % i) == 0: return False
else: return True
else: return False
if __name__ == '__main__':
print("Search for the first {} prime numbers:".format(primesToFind))
primesList = []
while primesToFind > 0:
num += 1
if isPrime(num):
primesList.append(num)
found += 1
print(found, num)
primesToFind -= 1
| """
primes.py
@author: Lorenzo Cipriani <lorenzo1974@gmail.com>
@contact: https://www.linkedin.com/in/lorenzocipriani
@since: 2017-10-23
@see:
"""
primes_to_find = 1000000
num = 0
found = 0
def is_prime(num):
if num > 1:
for i in range(2, num):
if num % i == 0:
return False
else:
return True
else:
return False
if __name__ == '__main__':
print('Search for the first {} prime numbers:'.format(primesToFind))
primes_list = []
while primesToFind > 0:
num += 1
if is_prime(num):
primesList.append(num)
found += 1
print(found, num)
primes_to_find -= 1 |
class ExportingTemplate():
def __init__(self, exporting_template_name=None, channel=None, target_sample_rate=None, duration=None, created_date=None, modified_date=None, id=None):
self.exporting_template_name = exporting_template_name
self.channel = channel
self.target_sample_rate = target_sample_rate
self.duration = duration
self.created_date = created_date
self.modified_date = modified_date
self.id = id
# getting the values
@property
def value(self):
# print('Getting value')
return self.exp_tem_name, self.channel, self.target_sample_rate, self.duration, self.created_date, self.modified_date, self.id
# setting the values
@value.setter
def value(self, exporting_template_name, channel, target_sample_rate, duration, created_date, modified_date, id):
self.exporting_template_name = exporting_template_name
self.target_sample_rate = target_sample_rate
self.duration = duration
self.created_date = created_date
self.modified_date = modified_date
self.id = id
self.channel = channel
# deleting the values
@value.deleter
def value(self):
# print('Deleting value')
del self.exporting_template_name, self.channel, self.target_sample_rate, self.duration, self.created_date, self.modified_date, self.id | class Exportingtemplate:
def __init__(self, exporting_template_name=None, channel=None, target_sample_rate=None, duration=None, created_date=None, modified_date=None, id=None):
self.exporting_template_name = exporting_template_name
self.channel = channel
self.target_sample_rate = target_sample_rate
self.duration = duration
self.created_date = created_date
self.modified_date = modified_date
self.id = id
@property
def value(self):
return (self.exp_tem_name, self.channel, self.target_sample_rate, self.duration, self.created_date, self.modified_date, self.id)
@value.setter
def value(self, exporting_template_name, channel, target_sample_rate, duration, created_date, modified_date, id):
self.exporting_template_name = exporting_template_name
self.target_sample_rate = target_sample_rate
self.duration = duration
self.created_date = created_date
self.modified_date = modified_date
self.id = id
self.channel = channel
@value.deleter
def value(self):
del self.exporting_template_name, self.channel, self.target_sample_rate, self.duration, self.created_date, self.modified_date, self.id |
# Given an array of strings strs, group the anagrams together. You can return the answer in any order.
# An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
# Example 1:
# Input: strs = ["eat","tea","tan","ate","nat","bat"]
# Output: [["bat"],["nat","tan"],["ate","eat","tea"]]
# Example 2:
# Input: strs = [""]
# Output: [[""]]
# Example 3:
# Input: strs = ["a"]
# Output: [["a"]]
# Constraints:
# 1 <= strs.length <= 104
# 0 <= strs[i].length <= 100
# strs[i] consists of lower-case English letters.
class Solution:
def groupAnagrams(self, strs):
result = []
lst = []
for i in strs:
a = sorted(i)
if a in lst:
x = lst.index(a)
result[x].append(i)
else:
lst.append(a)
result.append([i])
return result | class Solution:
def group_anagrams(self, strs):
result = []
lst = []
for i in strs:
a = sorted(i)
if a in lst:
x = lst.index(a)
result[x].append(i)
else:
lst.append(a)
result.append([i])
return result |
instructions = []
for line in open('input.txt', 'r').readlines():
readline = line.strip()
instructions.append((readline[0], int(readline[1:])))
directions = {
'E': [1, 0],
'S': [0, -1],
'W': [-1, 0],
'N': [0, 1],
}
direction = 'E'
x, y = 0, 0
for action, value in instructions:
if action in [*directions]:
x += directions[action][0] * value
y += directions[action][1] * value
elif action in ['L', 'R']:
idx = [*directions].index(direction)
idx += (-1 if action == 'L' else 1) * (value // 90)
direction = [*directions][idx % 4]
elif action == 'F':
x += directions[direction][0] * value
y += directions[direction][1] * value
print(abs(x) + abs(y))
| instructions = []
for line in open('input.txt', 'r').readlines():
readline = line.strip()
instructions.append((readline[0], int(readline[1:])))
directions = {'E': [1, 0], 'S': [0, -1], 'W': [-1, 0], 'N': [0, 1]}
direction = 'E'
(x, y) = (0, 0)
for (action, value) in instructions:
if action in [*directions]:
x += directions[action][0] * value
y += directions[action][1] * value
elif action in ['L', 'R']:
idx = [*directions].index(direction)
idx += (-1 if action == 'L' else 1) * (value // 90)
direction = [*directions][idx % 4]
elif action == 'F':
x += directions[direction][0] * value
y += directions[direction][1] * value
print(abs(x) + abs(y)) |
a = [ 1, 2, 3, 4, 5 ]
print(a)
print(a[0])
for i in range(len(a)):
print(a[i])
a.append(10)
a.append(20)
print(a) | a = [1, 2, 3, 4, 5]
print(a)
print(a[0])
for i in range(len(a)):
print(a[i])
a.append(10)
a.append(20)
print(a) |
def buble_sort(nums):
for i in range(1, len(nums)):
if nums[i] < nums[i - 1]:
nums[i], nums[i - 1] = nums[i - 1], nums[i]
def check_sort(nums):
for i in range(1, len(nums)):
if nums[i] < nums[i - 1]:
return False
return True
def main():
count_nums = int(input())
nums = list(map(int, input().split()))
if check_sort(nums):
print(*nums)
else:
while not check_sort(nums):
buble_sort(nums)
print(*nums)
if __name__ == '__main__':
main()
| def buble_sort(nums):
for i in range(1, len(nums)):
if nums[i] < nums[i - 1]:
(nums[i], nums[i - 1]) = (nums[i - 1], nums[i])
def check_sort(nums):
for i in range(1, len(nums)):
if nums[i] < nums[i - 1]:
return False
return True
def main():
count_nums = int(input())
nums = list(map(int, input().split()))
if check_sort(nums):
print(*nums)
else:
while not check_sort(nums):
buble_sort(nums)
print(*nums)
if __name__ == '__main__':
main() |
def temperature_statistics(t):
mean = sum(t)/len(t)
return mean, (sum((val-mean)**2 for val in t)/len(t))**0.5
print(temperature_statistics([4.4, 4.2, 7.0, 12.9, 18.5, 23.5, 26.4, 26.3, 22.5, 16.6, 11.2, 7.3])) | def temperature_statistics(t):
mean = sum(t) / len(t)
return (mean, (sum(((val - mean) ** 2 for val in t)) / len(t)) ** 0.5)
print(temperature_statistics([4.4, 4.2, 7.0, 12.9, 18.5, 23.5, 26.4, 26.3, 22.5, 16.6, 11.2, 7.3])) |
# Helper function to print out relation between losses and network parameters
# loss_list given as: [(name, loss_variable), ...]
# named_parameters_list using pytorch function named_parameters(): [(name, network.named_parameters()), ...]
def print_loss_params_relation(loss_list, named_parameters_list):
loss_variables = {}
for name, loss in loss_list:
if loss.grad_fn is None:
variables_ = []
else:
def recursive_sub(loss):
r = []
if hasattr(loss, 'next_functions'):
for el, _ in loss.next_functions:
if el is None:
continue
if hasattr(el, 'variable'):
r.append(el.variable)
else:
r += recursive_sub(el)
return r
variables_ = recursive_sub(loss=loss.grad_fn)
loss_variables[name] = variables_
# Assign params to networks and check for affection
max_char_length = 0
affected_network_params = {}
for network_name, named_parameters in named_parameters_list:
affected_params = {}
for n, p in named_parameters:
# Ignore bias since this will just duplicate the outcome
if (p.requires_grad) and ('bias' not in n):
for loss_name in loss_variables.keys():
# Skip if loss_name is already existing in affected params
if n in affected_params.keys() and loss_name in affected_params[n]:
continue
# Iterate through all variables
for v in loss_variables[loss_name]:
if v.shape == p.shape and (v.data == p.data).all():
if n in affected_params.keys():
affected_params[n].append(loss_name)
else:
affected_params[n] = [loss_name]
max_char_length = len(n) if len(n) > max_char_length else max_char_length
# Exit for after assigning loss name to param
break
affected_network_params[network_name] = affected_params
# Print out
for network_name in affected_network_params.keys():
print(f'Affected Params for {network_name}:')
if len(affected_network_params[network_name].keys()) == 0:
print('\t-')
else:
for p_name in affected_network_params[network_name].keys():
print(f'\t{p_name}:{" " * (max_char_length - len(p_name))}\t{affected_network_params[network_name][p_name]}')
print('') | def print_loss_params_relation(loss_list, named_parameters_list):
loss_variables = {}
for (name, loss) in loss_list:
if loss.grad_fn is None:
variables_ = []
else:
def recursive_sub(loss):
r = []
if hasattr(loss, 'next_functions'):
for (el, _) in loss.next_functions:
if el is None:
continue
if hasattr(el, 'variable'):
r.append(el.variable)
else:
r += recursive_sub(el)
return r
variables_ = recursive_sub(loss=loss.grad_fn)
loss_variables[name] = variables_
max_char_length = 0
affected_network_params = {}
for (network_name, named_parameters) in named_parameters_list:
affected_params = {}
for (n, p) in named_parameters:
if p.requires_grad and 'bias' not in n:
for loss_name in loss_variables.keys():
if n in affected_params.keys() and loss_name in affected_params[n]:
continue
for v in loss_variables[loss_name]:
if v.shape == p.shape and (v.data == p.data).all():
if n in affected_params.keys():
affected_params[n].append(loss_name)
else:
affected_params[n] = [loss_name]
max_char_length = len(n) if len(n) > max_char_length else max_char_length
break
affected_network_params[network_name] = affected_params
for network_name in affected_network_params.keys():
print(f'Affected Params for {network_name}:')
if len(affected_network_params[network_name].keys()) == 0:
print('\t-')
else:
for p_name in affected_network_params[network_name].keys():
print(f"\t{p_name}:{' ' * (max_char_length - len(p_name))}\t{affected_network_params[network_name][p_name]}")
print('') |
# %% [287. Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/)
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
for i, v in enumerate(nums, 1):
if v in nums[i:]:
return v
| class Solution:
def find_duplicate(self, nums: List[int]) -> int:
for (i, v) in enumerate(nums, 1):
if v in nums[i:]:
return v |
def staircase(n):
asteriscos = 1
# Write your code here
for espacios in range(n, 0, -1):
for i in range (espacios):
print(' ', end='')
for j in range(asteriscos):
print('*', end='')
print()
asteriscos+=2
staircase(7)
| def staircase(n):
asteriscos = 1
for espacios in range(n, 0, -1):
for i in range(espacios):
print(' ', end='')
for j in range(asteriscos):
print('*', end='')
print()
asteriscos += 2
staircase(7) |
#!/usr/bin/env python
class Host(object):
def __init__(self, name, groups,region, image, tags, size, meta=None):
self.name = name
self.groups = groups
self.meta = meta or {}
self.region = region
self.image = image
self.tags = tags
self.size = size
swifty_hosts = [
Host(
name='swifty-gw-iac',
region = 'ams3',
image = 'ubuntu-18-04-x64',
size = "s-2vcpu-4gb",
tags = 'iac',
groups=['gw'],
meta={
'vpn_ip': '192.168.0.1',
'public_dns': 'api.infra-ci.swifty.cloud',
'tinc_hostname': 'swygw'
}
),
Host(
name='swifty-mw-iac',
region = 'ams3',
image = 'ubuntu-18-04-x64',
size = "s-2vcpu-4gb",
tags = 'iac',
groups=['mw'],
meta={
'vpn_ip': '192.168.0.2',
'public_dns': 's3.infra-ci.swifty.cloud',
'tinc_hostname': 'swymw'
}
),
Host(
name='swifty-dashboard-iac',
region = 'ams3',
image = 'ubuntu-18-04-x64',
size = "s-1vcpu-2gb",
tags = 'iac',
groups=['ui'],
meta={
'vpn_ip': '192.168.0.3',
'public_dns': 'dashboard.infra-ci.swifty.cloud',
'tinc_hostname': 'swyui'
}
),
Host(
name='swifty-connector-iac',
region = 'ams3',
image = 'ubuntu-18-04-x64',
size = "s-1vcpu-2gb",
tags = 'iac',
groups=['connector'],
meta={
'vpn_ip': '192.168.0.4',
'public_dns': 'connector.infra-ci.swifty.cloud',
'tinc_hostname': 'swyconnector'
}
),
Host(
name='swifty-worker0-iac',
region = 'ams3',
image = 'ubuntu-18-04-x64',
size = "s-2vcpu-4gb",
tags = 'iac',
groups=['worker'],
meta={
'vpn_ip': '192.168.0.5',
'public_dns': 'worker0.infra-ci.swifty.cloud',
'tinc_hostname': 'swyworker0'
}
),
Host(
name='swifty-worker1-iac',
region = 'ams3',
image = 'ubuntu-18-04-x64',
size = "s-2vcpu-4gb",
tags = 'iac',
groups=['worker'],
meta={
'vpn_ip': '192.168.0.6',
'public_dns': 'worker1.infra-ci.swifty.cloud',
'tinc_hostname': 'swyworker1'
}
),
]
| class Host(object):
def __init__(self, name, groups, region, image, tags, size, meta=None):
self.name = name
self.groups = groups
self.meta = meta or {}
self.region = region
self.image = image
self.tags = tags
self.size = size
swifty_hosts = [host(name='swifty-gw-iac', region='ams3', image='ubuntu-18-04-x64', size='s-2vcpu-4gb', tags='iac', groups=['gw'], meta={'vpn_ip': '192.168.0.1', 'public_dns': 'api.infra-ci.swifty.cloud', 'tinc_hostname': 'swygw'}), host(name='swifty-mw-iac', region='ams3', image='ubuntu-18-04-x64', size='s-2vcpu-4gb', tags='iac', groups=['mw'], meta={'vpn_ip': '192.168.0.2', 'public_dns': 's3.infra-ci.swifty.cloud', 'tinc_hostname': 'swymw'}), host(name='swifty-dashboard-iac', region='ams3', image='ubuntu-18-04-x64', size='s-1vcpu-2gb', tags='iac', groups=['ui'], meta={'vpn_ip': '192.168.0.3', 'public_dns': 'dashboard.infra-ci.swifty.cloud', 'tinc_hostname': 'swyui'}), host(name='swifty-connector-iac', region='ams3', image='ubuntu-18-04-x64', size='s-1vcpu-2gb', tags='iac', groups=['connector'], meta={'vpn_ip': '192.168.0.4', 'public_dns': 'connector.infra-ci.swifty.cloud', 'tinc_hostname': 'swyconnector'}), host(name='swifty-worker0-iac', region='ams3', image='ubuntu-18-04-x64', size='s-2vcpu-4gb', tags='iac', groups=['worker'], meta={'vpn_ip': '192.168.0.5', 'public_dns': 'worker0.infra-ci.swifty.cloud', 'tinc_hostname': 'swyworker0'}), host(name='swifty-worker1-iac', region='ams3', image='ubuntu-18-04-x64', size='s-2vcpu-4gb', tags='iac', groups=['worker'], meta={'vpn_ip': '192.168.0.6', 'public_dns': 'worker1.infra-ci.swifty.cloud', 'tinc_hostname': 'swyworker1'})] |
'''
Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required.
Example 1:
Input: intervals = [[0,30],[5,10],[15,20]]
Output: 2
Example 2:
Input: intervals = [[7,10],[2,4]]
Output: 1
'''
#Approach 1: Priority Queues
'''
Algorithm
A) Sort the given meetings by their start time.
B) Initialize a new min-heap and add the first meeting's ending time to the heap. We simply need to keep track of the ending times as that tells us when a meeting room will
get free.
C) For every meeting room check if the minimum element of the heap i.e. the room at the top of the heap is free or not.
D) If the room is free, then we extract the topmost element and add it back with the ending time of the current meeting we are processing.
E) If not, then we allocate a new room and add it to the heap.
F) After processing all the meetings, the size of the heap will tell us the number of rooms allocated.
This will be the minimum number of rooms needed to accommodate all the meetings.
'''
class Solution(object):
def minMeetingRooms(self, intervals):
# MIN Heap (Priority QUEUE) TC (NLOGN), SPACE (N)
if not intervals:
return 0
intervals, res = sorted(intervals, key=lambda elem:elem[0]), []
# Add and create room for first meeting
heapq.heappush(res, intervals[0][1])
# for rest of meeting rooms
for elem in intervals[1:]:
# if room due to free up the earliest is free, assign room to this meeting
if res[0] <= elem[0]:
heapq.heappop(res)
#if new room assign then add to heap. If old room allocated, then add to heap with updated end time
heapq.heappush(res, elem[1])
# size of heap minimum rooms required
return len(res)
#Approach 2: Chronological Ordering
'''
Algorithm
A) Separate out the start times and the end times in their separate arrays.
B) Sort the start times and the end times separately. Note that this will mess up the original correspondence of start times and end times.
They will be treated individually now.
C) We consider two pointers: s_ptr and e_ptr which refer to start pointer and end pointer.
The start pointer simply iterates over all the meetings and the end pointer helps us track if a meeting has ended and if we can reuse a room.
D) When considering a specific meeting pointed to by s_ptr, we check if this start timing is greater than the meeting pointed to by e_ptr.
E) If this is the case then that would mean some meeting has ended by the time the meeting at s_ptr had to start. So we can reuse one of the rooms. Otherwise, we have to allocate a new room.
If a meeting has indeed ended i.e. if start[s_ptr] >= end[e_ptr], then we increment e_ptr.
F) Repeat this process until s_ptr processes all of the meetings.
'''
class Solution(object):
def minMeetingRooms(self, intervals):
# Chronocial Ordering TC (NLOGN) and Space (N)
if not intervals:
return 0
res = 0
#sort start and end time
start_time = sorted([elem[0] for elem in intervals])
end_time = sorted([elem[1] for elem in intervals])
# define two pointer
start_ptr, end_ptr = 0, 0
# untill all meeting room assigned
while start_ptr < len(intervals):
#if there is meeting ended by time the meeting at start_ptr starts
if start_time[start_ptr] >= end_time[end_ptr]:
# FreeUp rooma nd increment end_ptr
res -= 1
end_ptr += 1
#if room got free then res += 1 wouldn't effective. res would remains same in that case. If room will not free then increase room
res += 1
start_ptr += 1
return res
| """
Given an array of meeting time intervals intervals where intervals[i] = [starti, endi], return the minimum number of conference rooms required.
Example 1:
Input: intervals = [[0,30],[5,10],[15,20]]
Output: 2
Example 2:
Input: intervals = [[7,10],[2,4]]
Output: 1
"""
"\nAlgorithm\n\nA) Sort the given meetings by their start time.\nB) Initialize a new min-heap and add the first meeting's ending time to the heap. We simply need to keep track of the ending times as that tells us when a meeting room will\nget free.\nC) For every meeting room check if the minimum element of the heap i.e. the room at the top of the heap is free or not.\nD) If the room is free, then we extract the topmost element and add it back with the ending time of the current meeting we are processing.\nE) If not, then we allocate a new room and add it to the heap.\nF) After processing all the meetings, the size of the heap will tell us the number of rooms allocated. \nThis will be the minimum number of rooms needed to accommodate all the meetings.\n"
class Solution(object):
def min_meeting_rooms(self, intervals):
if not intervals:
return 0
(intervals, res) = (sorted(intervals, key=lambda elem: elem[0]), [])
heapq.heappush(res, intervals[0][1])
for elem in intervals[1:]:
if res[0] <= elem[0]:
heapq.heappop(res)
heapq.heappush(res, elem[1])
return len(res)
'\nAlgorithm\n\nA) Separate out the start times and the end times in their separate arrays.\nB) Sort the start times and the end times separately. Note that this will mess up the original correspondence of start times and end times.\nThey will be treated individually now.\nC) We consider two pointers: s_ptr and e_ptr which refer to start pointer and end pointer. \nThe start pointer simply iterates over all the meetings and the end pointer helps us track if a meeting has ended and if we can reuse a room.\nD) When considering a specific meeting pointed to by s_ptr, we check if this start timing is greater than the meeting pointed to by e_ptr. \nE) If this is the case then that would mean some meeting has ended by the time the meeting at s_ptr had to start. So we can reuse one of the rooms. Otherwise, we have to allocate a new room.\nIf a meeting has indeed ended i.e. if start[s_ptr] >= end[e_ptr], then we increment e_ptr.\nF) Repeat this process until s_ptr processes all of the meetings.\n'
class Solution(object):
def min_meeting_rooms(self, intervals):
if not intervals:
return 0
res = 0
start_time = sorted([elem[0] for elem in intervals])
end_time = sorted([elem[1] for elem in intervals])
(start_ptr, end_ptr) = (0, 0)
while start_ptr < len(intervals):
if start_time[start_ptr] >= end_time[end_ptr]:
res -= 1
end_ptr += 1
res += 1
start_ptr += 1
return res |
#!/usr/bin/env python3.5
#-*- coding: utf-8 -*-
def foo(s):
n = int(s)
assert n != 0, 'n is zero!'
return 10 / n
def main():
foo('0')
main()
| def foo(s):
n = int(s)
assert n != 0, 'n is zero!'
return 10 / n
def main():
foo('0')
main() |
class Libro:
def __init__(self, paginas, tapa,nombre, autor, genero, isbn):
self.paginas = paginas
self.tapa = tapa
self.nombre= nombre
self.autor = autor
self.genero = genero
self.isbn = isbn
def set_nombre(self,nombre):
self.nombre = nombre
def set_paginas(self,paginas):
self.paginas = paginas
def set_tapa(self,tapa):
self.tapa = tapa
def set_autor(self,autor):
self.autor = autor
def set_genero(self,genero):
self.genero = genero
def set_isbn(self,isbn):
self.isbn = isbn
| class Libro:
def __init__(self, paginas, tapa, nombre, autor, genero, isbn):
self.paginas = paginas
self.tapa = tapa
self.nombre = nombre
self.autor = autor
self.genero = genero
self.isbn = isbn
def set_nombre(self, nombre):
self.nombre = nombre
def set_paginas(self, paginas):
self.paginas = paginas
def set_tapa(self, tapa):
self.tapa = tapa
def set_autor(self, autor):
self.autor = autor
def set_genero(self, genero):
self.genero = genero
def set_isbn(self, isbn):
self.isbn = isbn |
#
# @lc app=leetcode id=68 lang=python3
#
# [68] Text Justification
#
class Solution:
def split(self, words: List[str], maxWidth: int) -> List[List[str]]:
if not words:
return []
lines, cur_len = [[words[0]]], len(words[0])
for w in words[1:]:
if cur_len + 1 + len(w) <= maxWidth:
lines[-1].append(w)
cur_len += 1 + len(w)
else:
lines.append([w])
cur_len = len(w)
return lines
def justify(self, words: List[str], width: int, full: bool = False) -> str:
word_len = sum(map(len, words))
space_len = width - word_len
space_cnt = len(words) - 1
if space_cnt == 0:
return words[0] + ' ' * space_len
if full:
return ' '.join(words) + ' ' * (space_len - space_cnt)
space_sizes = [0] * (space_cnt + 1)
while space_cnt > 0:
sz = space_len // space_cnt
space_sizes[space_cnt - 1] = sz
space_len -= sz
space_cnt -= 1
return ''.join(w + ' ' * sz for w, sz in zip(words, space_sizes))
def fullJustify(self, words: List[str], maxWidth: int) -> List[str]:
lines = self.split(words, maxWidth)
lines[-1] = self.justify(lines[-1], maxWidth, full=True)
for i in range(len(lines) - 1):
lines[i] = self.justify(lines[i], maxWidth)
return lines
| class Solution:
def split(self, words: List[str], maxWidth: int) -> List[List[str]]:
if not words:
return []
(lines, cur_len) = ([[words[0]]], len(words[0]))
for w in words[1:]:
if cur_len + 1 + len(w) <= maxWidth:
lines[-1].append(w)
cur_len += 1 + len(w)
else:
lines.append([w])
cur_len = len(w)
return lines
def justify(self, words: List[str], width: int, full: bool=False) -> str:
word_len = sum(map(len, words))
space_len = width - word_len
space_cnt = len(words) - 1
if space_cnt == 0:
return words[0] + ' ' * space_len
if full:
return ' '.join(words) + ' ' * (space_len - space_cnt)
space_sizes = [0] * (space_cnt + 1)
while space_cnt > 0:
sz = space_len // space_cnt
space_sizes[space_cnt - 1] = sz
space_len -= sz
space_cnt -= 1
return ''.join((w + ' ' * sz for (w, sz) in zip(words, space_sizes)))
def full_justify(self, words: List[str], maxWidth: int) -> List[str]:
lines = self.split(words, maxWidth)
lines[-1] = self.justify(lines[-1], maxWidth, full=True)
for i in range(len(lines) - 1):
lines[i] = self.justify(lines[i], maxWidth)
return lines |
def update_data(hyper_params):
return dict(
train=dict(
samples_per_gpu=hyper_params['batch_size'],
workers_per_gpu=hyper_params['workers_per_gpu'],
dataset=dict(
root_dir=hyper_params['dataset_root'],
cifar_type=hyper_params['dataset_name'],
noise_mode=hyper_params['noise_mode'],
noise_ratio=hyper_params['noise_ratio']
)
),
test=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=hyper_params['workers_per_gpu'],
dataset=dict(
root_dir=hyper_params['dataset_root'],
cifar_type=hyper_params['dataset_name']
)
),
eval=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=hyper_params['workers_per_gpu'],
)
)
def update_openset_data(hyper_params):
return dict(
train=dict(
samples_per_gpu=hyper_params['batch_size'],
workers_per_gpu=hyper_params['workers_per_gpu'],
dataset=dict(
root_dir=hyper_params['dataset_root'],
cifar_type=hyper_params['dataset_name'],
noise_mode=hyper_params['noise_mode'],
noise_ratio=hyper_params['noise_ratio'],
ood_noise_name=hyper_params['ood_noise_name'],
ood_noise_root_dir=hyper_params['ood_noise_root_dir'],
ood_noise_num=hyper_params['ood_noise_num_train']
)
),
test=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=hyper_params['workers_per_gpu'],
dataset=dict(
root_dir=hyper_params['dataset_root'],
cifar_type=hyper_params['dataset_name'],
ood_noise_name=hyper_params['ood_noise_name'],
ood_noise_root_dir=hyper_params['ood_noise_root_dir'],
ood_noise_num=hyper_params['ood_noise_num_test']
)
),
eval=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=hyper_params['workers_per_gpu'],
)
)
def update_webvision_data(hyper_params):
return dict(
train=dict(
samples_per_gpu=hyper_params['batch_size'],
workers_per_gpu=hyper_params['workers_per_gpu'],
),
test=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=hyper_params['workers_per_gpu'],
),
eval=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=hyper_params['workers_per_gpu'],
),
imagenet=dict(
samples_per_gpu=hyper_params['batch_size'] * 4,
workers_per_gpu=8,
)
)
def update_model(hyper_params):
return dict(
head=dict(num_classes=hyper_params['num_classes'], out_feat_dim=hyper_params['feature_dim']),
num_classes=hyper_params['num_classes'],
alpha=hyper_params['alpha'],
data_parallel=hyper_params['data_parallel']
)
def update_solver(hyper_params):
return dict(
hyper_params=hyper_params,
optimizer=dict(lr=hyper_params['lr'], weight_decay=hyper_params.get('weight_decay') or 5e-4),
lr_scheduler=dict(T_max=hyper_params['max_epochs']),
max_epochs=hyper_params['max_epochs'],
)
| def update_data(hyper_params):
return dict(train=dict(samples_per_gpu=hyper_params['batch_size'], workers_per_gpu=hyper_params['workers_per_gpu'], dataset=dict(root_dir=hyper_params['dataset_root'], cifar_type=hyper_params['dataset_name'], noise_mode=hyper_params['noise_mode'], noise_ratio=hyper_params['noise_ratio'])), test=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=hyper_params['workers_per_gpu'], dataset=dict(root_dir=hyper_params['dataset_root'], cifar_type=hyper_params['dataset_name'])), eval=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=hyper_params['workers_per_gpu']))
def update_openset_data(hyper_params):
return dict(train=dict(samples_per_gpu=hyper_params['batch_size'], workers_per_gpu=hyper_params['workers_per_gpu'], dataset=dict(root_dir=hyper_params['dataset_root'], cifar_type=hyper_params['dataset_name'], noise_mode=hyper_params['noise_mode'], noise_ratio=hyper_params['noise_ratio'], ood_noise_name=hyper_params['ood_noise_name'], ood_noise_root_dir=hyper_params['ood_noise_root_dir'], ood_noise_num=hyper_params['ood_noise_num_train'])), test=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=hyper_params['workers_per_gpu'], dataset=dict(root_dir=hyper_params['dataset_root'], cifar_type=hyper_params['dataset_name'], ood_noise_name=hyper_params['ood_noise_name'], ood_noise_root_dir=hyper_params['ood_noise_root_dir'], ood_noise_num=hyper_params['ood_noise_num_test'])), eval=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=hyper_params['workers_per_gpu']))
def update_webvision_data(hyper_params):
return dict(train=dict(samples_per_gpu=hyper_params['batch_size'], workers_per_gpu=hyper_params['workers_per_gpu']), test=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=hyper_params['workers_per_gpu']), eval=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=hyper_params['workers_per_gpu']), imagenet=dict(samples_per_gpu=hyper_params['batch_size'] * 4, workers_per_gpu=8))
def update_model(hyper_params):
return dict(head=dict(num_classes=hyper_params['num_classes'], out_feat_dim=hyper_params['feature_dim']), num_classes=hyper_params['num_classes'], alpha=hyper_params['alpha'], data_parallel=hyper_params['data_parallel'])
def update_solver(hyper_params):
return dict(hyper_params=hyper_params, optimizer=dict(lr=hyper_params['lr'], weight_decay=hyper_params.get('weight_decay') or 0.0005), lr_scheduler=dict(T_max=hyper_params['max_epochs']), max_epochs=hyper_params['max_epochs']) |
class Person:
def __init__(self, name, age=21, gender='unspecified',
occupation='unspecified'):
self.name = name
self.gender = gender
self.occupation = occupation
if age >= 0 and age <= 120:
self.age = age
else:
self.age = 21
def greets(self, greeter):
return f'Hello, {greeter}! My name is {self.name}, nice to meet you!'
def had_birthday(self):
self.age += 1
def set_gender(self, gender):
self.gender = gender
def get_gender(self):
return self.gender | class Person:
def __init__(self, name, age=21, gender='unspecified', occupation='unspecified'):
self.name = name
self.gender = gender
self.occupation = occupation
if age >= 0 and age <= 120:
self.age = age
else:
self.age = 21
def greets(self, greeter):
return f'Hello, {greeter}! My name is {self.name}, nice to meet you!'
def had_birthday(self):
self.age += 1
def set_gender(self, gender):
self.gender = gender
def get_gender(self):
return self.gender |
def obj_sort_by_lambda(obj_list, lmbd):
new_obj_list = obj_list.copy()
new_obj_list.sort(key=lmbd)
return new_obj_list
def obj_sort_by_property_name(obj_list, prop_name):
return obj_sort_by_lambda(obj_list, lambda x:getattr(x, prop_name))
def obj_list_decrypt(obj_list, enc):
new_obj_list = []
for obj in obj_list:
new_obj_list.append(obj.decrypt(enc))
return new_obj_list
| def obj_sort_by_lambda(obj_list, lmbd):
new_obj_list = obj_list.copy()
new_obj_list.sort(key=lmbd)
return new_obj_list
def obj_sort_by_property_name(obj_list, prop_name):
return obj_sort_by_lambda(obj_list, lambda x: getattr(x, prop_name))
def obj_list_decrypt(obj_list, enc):
new_obj_list = []
for obj in obj_list:
new_obj_list.append(obj.decrypt(enc))
return new_obj_list |
class InvalidUrl(Exception):
pass
class UnableToGetPage(Exception):
pass
class UnableToGetUploadTime(Exception):
pass
class UnableToGetApproximateNum(Exception):
pass
| class Invalidurl(Exception):
pass
class Unabletogetpage(Exception):
pass
class Unabletogetuploadtime(Exception):
pass
class Unabletogetapproximatenum(Exception):
pass |
# *******************************************************************************************
# *******************************************************************************************
#
# Name : error.py
# Purpose : Error class
# Date : 13th November 2021
# Author : Paul Robson (paul@robsons.org.uk)
#
# *******************************************************************************************
# *******************************************************************************************
# *******************************************************************************************
#
# HPL Exception
#
# *******************************************************************************************
class HPLException(Exception):
def __str__(self):
msg = Exception.__str__(self)
return msg if HPLException.LINE <= 0 else "{0} ({1}:{2})".format(msg,HPLException.FILE,HPLException.LINE)
HPLException.FILE = None
HPLException.LINE = 0
if __name__ == '__main__':
x = HPLException("Error !!")
print(">>",str(x))
raise x
| class Hplexception(Exception):
def __str__(self):
msg = Exception.__str__(self)
return msg if HPLException.LINE <= 0 else '{0} ({1}:{2})'.format(msg, HPLException.FILE, HPLException.LINE)
HPLException.FILE = None
HPLException.LINE = 0
if __name__ == '__main__':
x = hpl_exception('Error !!')
print('>>', str(x))
raise x |
# coding=utf-8
worker_thread_pool = None
key_loading_thread_pool = None
key_holder = None
is_debug = False
is_debug_requests = False
is_no_validate = False
is_only_validate_key = False
is_override = False
is_preview_filename = False
is_resize = False
thread_num = 1
src_dir = None
dest_dir = None
filename_pattern = None
filename_replace = None
resize_method = None
width = None
height = None
| worker_thread_pool = None
key_loading_thread_pool = None
key_holder = None
is_debug = False
is_debug_requests = False
is_no_validate = False
is_only_validate_key = False
is_override = False
is_preview_filename = False
is_resize = False
thread_num = 1
src_dir = None
dest_dir = None
filename_pattern = None
filename_replace = None
resize_method = None
width = None
height = None |
from_ = 1
to_ = 999901
# to_ = 1
output_file = open("result.txt", "w", encoding="utf-8")
for i in range(from_, to_ + 1, 100):
input_file = open("allTags/" + str(i) + ".txt", "r", encoding="utf-8")
data = input_file.read()
ind = 0
for j in range(100):
ind = data.find("class=\"i-tag\"", ind)
data = data[ind+1:]
x = data.find("#")
y = data.find("<", x)
tag = data[x + 1:y]
data = data[y:]
output_file.write(tag + "," + str(i + j) + '\n')
input_file.close()
output_file.close() | from_ = 1
to_ = 999901
output_file = open('result.txt', 'w', encoding='utf-8')
for i in range(from_, to_ + 1, 100):
input_file = open('allTags/' + str(i) + '.txt', 'r', encoding='utf-8')
data = input_file.read()
ind = 0
for j in range(100):
ind = data.find('class="i-tag"', ind)
data = data[ind + 1:]
x = data.find('#')
y = data.find('<', x)
tag = data[x + 1:y]
data = data[y:]
output_file.write(tag + ',' + str(i + j) + '\n')
input_file.close()
output_file.close() |
#!/usr/bin/env python3
''' In this question , we are going to find the longest common substring, among two given substrings. in order to solve this question
we will be making use of dynamic programming. so we will create a matrix with all 0s in the initial row and column
Step 1: we need to initialise a matrix with size len(String)+1, len(string)+1.
Step 2: once you initialise matrix you can start comparing the letter of each string'''
def LongestCommonSubstring(X,Y,m,n):
LCSmatrix=[[0 for k in range(n+1)] for l in range(m+1)]
result=0
for i in range(m+1):
for j in range(n+1):
if(i==0 or j==0):
LCSmatrix[i][j]=0
elif (X[i-1]==Y[j-1]) :
LCSmatrix[i][j]=LCSmatrix[i-1][j-1]+1
result= max(result, LCSmatrix[i][j])
else:
LCSmatrix[i][j]=0
return result
X = 'HELLO'
Y = 'HELLOS'
m = len(X)
n = len(Y)
print('Length of Longest Common Substring is', LongestCommonSubstring(X, Y, m, n))
| """ In this question , we are going to find the longest common substring, among two given substrings. in order to solve this question
we will be making use of dynamic programming. so we will create a matrix with all 0s in the initial row and column
Step 1: we need to initialise a matrix with size len(String)+1, len(string)+1.
Step 2: once you initialise matrix you can start comparing the letter of each string"""
def longest_common_substring(X, Y, m, n):
lc_smatrix = [[0 for k in range(n + 1)] for l in range(m + 1)]
result = 0
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
LCSmatrix[i][j] = 0
elif X[i - 1] == Y[j - 1]:
LCSmatrix[i][j] = LCSmatrix[i - 1][j - 1] + 1
result = max(result, LCSmatrix[i][j])
else:
LCSmatrix[i][j] = 0
return result
x = 'HELLO'
y = 'HELLOS'
m = len(X)
n = len(Y)
print('Length of Longest Common Substring is', longest_common_substring(X, Y, m, n)) |
'''
Author : Govind Patidar
DateTime : 10/07/2020 11:30AM
File : AllPageLocators
'''
class AllPageLocators():
def __init__(self, driver):
'''
:param driver:
'''
self.driver = driver
'''Home page locator'''
# get XPATH current temperature text
text_curr_temp = '/html/body/div/div[1]/h2'
# get ID current temperature value
curr_temp = "temperature"
# get XPATH moisturizes text
moisturizes = '/html/body/div/div[3]/div[1]/p'
# get XPATH buy moisturizes
buy_moisturizes = '/html/body/div/div[3]/div[1]/a/button'
# get XPATH sunscreens text
sunscreens = '/html/body/div/div[3]/div[2]/p'
# get XPATH buy sunscreens
buy_sunscreens = '/html/body/div/div[3]/div[2]/a/button'
'''Checkout page locator'''
# get ID in add to cart items
add_cart = 'cart'
# get ID total amount
total_amount = 'total'
# get XPATH pay with cart button
pay = '/html/body/div[1]/div[3]/form/button/span'
'''Payment page'''
# get XPATH payment page
email = '//input[@type="email"]'
cardNo = '//input[@type="tel"]'
date = '//input[@placeholder="MM / YY"]'
cvc = '//input[@placeholder="CVC"]'
zip = '//input[@placeholder="ZIP Code"]'
paynow = '//*[@id="container"]/section/span[2]/div/div/main/form/nav/div/div/div/button'
'''Payment done'''
pay_success = '/html/body/div/div[1]/h2'
pay_text = '/html/body/div/div[2]/p'
| """
Author : Govind Patidar
DateTime : 10/07/2020 11:30AM
File : AllPageLocators
"""
class Allpagelocators:
def __init__(self, driver):
"""
:param driver:
"""
self.driver = driver
'Home page locator'
text_curr_temp = '/html/body/div/div[1]/h2'
curr_temp = 'temperature'
moisturizes = '/html/body/div/div[3]/div[1]/p'
buy_moisturizes = '/html/body/div/div[3]/div[1]/a/button'
sunscreens = '/html/body/div/div[3]/div[2]/p'
buy_sunscreens = '/html/body/div/div[3]/div[2]/a/button'
'Checkout page locator'
add_cart = 'cart'
total_amount = 'total'
pay = '/html/body/div[1]/div[3]/form/button/span'
'Payment page'
email = '//input[@type="email"]'
card_no = '//input[@type="tel"]'
date = '//input[@placeholder="MM / YY"]'
cvc = '//input[@placeholder="CVC"]'
zip = '//input[@placeholder="ZIP Code"]'
paynow = '//*[@id="container"]/section/span[2]/div/div/main/form/nav/div/div/div/button'
'Payment done'
pay_success = '/html/body/div/div[1]/h2'
pay_text = '/html/body/div/div[2]/p' |
word = input()
out = ''
prev = ''
# remove same letters which are the same as the previous
for x in word:
if x != prev:
out+=x
prev = x
print(out)
| word = input()
out = ''
prev = ''
for x in word:
if x != prev:
out += x
prev = x
print(out) |
#
# PySNMP MIB module TPLINK-IPADDR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-IPADDR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:17:29 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, MibIdentifier, iso, Counter32, Unsigned32, TimeTicks, Gauge32, ObjectIdentity, Integer32, IpAddress, NotificationType, ModuleIdentity, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "MibIdentifier", "iso", "Counter32", "Unsigned32", "TimeTicks", "Gauge32", "ObjectIdentity", "Integer32", "IpAddress", "NotificationType", "ModuleIdentity", "Counter64")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
tplinkMgmt, = mibBuilder.importSymbols("TPLINK-MIB", "tplinkMgmt")
TPRowStatus, = mibBuilder.importSymbols("TPLINK-TC-MIB", "TPRowStatus")
class TpInterfaceMode(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))
namedValues = NamedValues(("none", 0), ("manual", 1), ("dhcp", 2), ("bootp", 3))
class TpInterfaceMode2(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1))
namedValues = NamedValues(("none", 0), ("manual", 1))
class TpPortLinkMode(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1))
namedValues = NamedValues(("bridge", 0), ("route", 1))
tplinkIpAddrMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 11863, 6, 6))
tplinkIpAddrMIB.setRevisions(('2012-12-13 09:30',))
if mibBuilder.loadTexts: tplinkIpAddrMIB.setLastUpdated('201212130930Z')
if mibBuilder.loadTexts: tplinkIpAddrMIB.setOrganization('TPLINK')
tplinkIpAddrMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1))
tplinkIpAddrNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11863, 6, 6, 2))
tpInterfaceConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1))
tpVlanInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1), )
if mibBuilder.loadTexts: tpVlanInterfaceTable.setStatus('current')
tpVlanInterfaceConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1), ).setIndexNames((0, "TPLINK-IPADDR-MIB", "tpVlanInterfaceVlanId"), (0, "TPLINK-IPADDR-MIB", "tpVlanInterfaceIp"), (0, "TPLINK-IPADDR-MIB", "tpVlanInterfaceSecondary"))
if mibBuilder.loadTexts: tpVlanInterfaceConfigEntry.setStatus('current')
tpVlanInterfaceVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpVlanInterfaceVlanId.setStatus('current')
tpVlanInterfaceSecondary = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpVlanInterfaceSecondary.setStatus('current')
tpVlanInterfaceMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 3), TpInterfaceMode()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpVlanInterfaceMode.setStatus('current')
tpVlanInterfaceIp = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpVlanInterfaceIp.setStatus('current')
tpVlanInterfaceMsk = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpVlanInterfaceMsk.setStatus('current')
tpVlanInterfaceName = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpVlanInterfaceName.setStatus('current')
tpVlanInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 7), TPRowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpVlanInterfaceStatus.setStatus('current')
tpLoopbackInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2), )
if mibBuilder.loadTexts: tpLoopbackInterfaceTable.setStatus('current')
tpLoopbackInterfaceConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1), ).setIndexNames((0, "TPLINK-IPADDR-MIB", "tpLoopbackInterfaceId"), (0, "TPLINK-IPADDR-MIB", "tpLoopbackInterfaceIp"), (0, "TPLINK-IPADDR-MIB", "tpLoopbackInterfaceSecondary"))
if mibBuilder.loadTexts: tpLoopbackInterfaceConfigEntry.setStatus('current')
tpLoopbackInterfaceId = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpLoopbackInterfaceId.setStatus('current')
tpLoopbackInterfaceSecondary = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpLoopbackInterfaceSecondary.setStatus('current')
tpLoopbackInterfaceMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 3), TpInterfaceMode2()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpLoopbackInterfaceMode.setStatus('current')
tpLoopbackInterfaceIp = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpLoopbackInterfaceIp.setStatus('current')
tpLoopbackInterfaceMsk = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpLoopbackInterfaceMsk.setStatus('current')
tpLoopbackInterfaceName = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpLoopbackInterfaceName.setStatus('current')
tpLoopbackInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 7), TPRowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpLoopbackInterfaceStatus.setStatus('current')
tpRoutedPortTable = MibTable((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3), )
if mibBuilder.loadTexts: tpRoutedPortTable.setStatus('current')
tpRoutedPortConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "TPLINK-IPADDR-MIB", "tpRoutedPortIp"), (0, "TPLINK-IPADDR-MIB", "tpRoutedPortSecondary"))
if mibBuilder.loadTexts: tpRoutedPortConfigEntry.setStatus('current')
tpRoutedPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpRoutedPortId.setStatus('current')
tpRoutedPortSecondary = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpRoutedPortSecondary.setStatus('current')
tpRoutedPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 3), TpInterfaceMode()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpRoutedPortMode.setStatus('current')
tpRoutedPortIp = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpRoutedPortIp.setStatus('current')
tpRoutedPortMsk = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpRoutedPortMsk.setStatus('current')
tpRoutedPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpRoutedPortName.setStatus('current')
tpRoutedPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 7), TPRowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpRoutedPortStatus.setStatus('current')
tpPortChannelTable = MibTable((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4), )
if mibBuilder.loadTexts: tpPortChannelTable.setStatus('current')
tpPortChannelConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1), ).setIndexNames((0, "TPLINK-IPADDR-MIB", "tpPortChannelId"), (0, "TPLINK-IPADDR-MIB", "tpPortChannelIp"), (0, "TPLINK-IPADDR-MIB", "tpPortChannelSecondary"))
if mibBuilder.loadTexts: tpPortChannelConfigEntry.setStatus('current')
tpPortChannelId = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpPortChannelId.setStatus('current')
tpPortChannelSecondary = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpPortChannelSecondary.setStatus('current')
tpPortChannelMode = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 3), TpInterfaceMode()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpPortChannelMode.setStatus('current')
tpPortChannelIp = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 4), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tpPortChannelIp.setStatus('current')
tpPortChannelMsk = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 5), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpPortChannelMsk.setStatus('current')
tpPortChannelName = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpPortChannelName.setStatus('current')
tpPortChannelStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 7), TPRowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: tpPortChannelStatus.setStatus('current')
mibBuilder.exportSymbols("TPLINK-IPADDR-MIB", tpVlanInterfaceMode=tpVlanInterfaceMode, tpPortChannelIp=tpPortChannelIp, tpRoutedPortIp=tpRoutedPortIp, tpPortChannelSecondary=tpPortChannelSecondary, tpVlanInterfaceVlanId=tpVlanInterfaceVlanId, tpLoopbackInterfaceId=tpLoopbackInterfaceId, tplinkIpAddrMIB=tplinkIpAddrMIB, tpVlanInterfaceMsk=tpVlanInterfaceMsk, tpInterfaceConfig=tpInterfaceConfig, TpInterfaceMode=TpInterfaceMode, tpLoopbackInterfaceName=tpLoopbackInterfaceName, tpRoutedPortSecondary=tpRoutedPortSecondary, tpPortChannelMsk=tpPortChannelMsk, tpRoutedPortStatus=tpRoutedPortStatus, tpRoutedPortId=tpRoutedPortId, tpPortChannelMode=tpPortChannelMode, tpVlanInterfaceConfigEntry=tpVlanInterfaceConfigEntry, tpRoutedPortConfigEntry=tpRoutedPortConfigEntry, tpRoutedPortMode=tpRoutedPortMode, TpInterfaceMode2=TpInterfaceMode2, tpRoutedPortMsk=tpRoutedPortMsk, tpLoopbackInterfaceConfigEntry=tpLoopbackInterfaceConfigEntry, tpPortChannelName=tpPortChannelName, tplinkIpAddrNotifications=tplinkIpAddrNotifications, tpLoopbackInterfaceMsk=tpLoopbackInterfaceMsk, tpVlanInterfaceTable=tpVlanInterfaceTable, tpVlanInterfaceName=tpVlanInterfaceName, tpVlanInterfaceStatus=tpVlanInterfaceStatus, PYSNMP_MODULE_ID=tplinkIpAddrMIB, tpPortChannelTable=tpPortChannelTable, tpLoopbackInterfaceStatus=tpLoopbackInterfaceStatus, tpPortChannelStatus=tpPortChannelStatus, tpRoutedPortTable=tpRoutedPortTable, tpPortChannelConfigEntry=tpPortChannelConfigEntry, tpLoopbackInterfaceIp=tpLoopbackInterfaceIp, tpRoutedPortName=tpRoutedPortName, tpPortChannelId=tpPortChannelId, TpPortLinkMode=TpPortLinkMode, tplinkIpAddrMIBObjects=tplinkIpAddrMIBObjects, tpVlanInterfaceIp=tpVlanInterfaceIp, tpLoopbackInterfaceSecondary=tpLoopbackInterfaceSecondary, tpVlanInterfaceSecondary=tpVlanInterfaceSecondary, tpLoopbackInterfaceTable=tpLoopbackInterfaceTable, tpLoopbackInterfaceMode=tpLoopbackInterfaceMode)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueSizeConstraint')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(mib_scalar, mib_table, mib_table_row, mib_table_column, bits, mib_identifier, iso, counter32, unsigned32, time_ticks, gauge32, object_identity, integer32, ip_address, notification_type, module_identity, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'MibIdentifier', 'iso', 'Counter32', 'Unsigned32', 'TimeTicks', 'Gauge32', 'ObjectIdentity', 'Integer32', 'IpAddress', 'NotificationType', 'ModuleIdentity', 'Counter64')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
(tplink_mgmt,) = mibBuilder.importSymbols('TPLINK-MIB', 'tplinkMgmt')
(tp_row_status,) = mibBuilder.importSymbols('TPLINK-TC-MIB', 'TPRowStatus')
class Tpinterfacemode(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3))
named_values = named_values(('none', 0), ('manual', 1), ('dhcp', 2), ('bootp', 3))
class Tpinterfacemode2(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1))
named_values = named_values(('none', 0), ('manual', 1))
class Tpportlinkmode(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1))
named_values = named_values(('bridge', 0), ('route', 1))
tplink_ip_addr_mib = module_identity((1, 3, 6, 1, 4, 1, 11863, 6, 6))
tplinkIpAddrMIB.setRevisions(('2012-12-13 09:30',))
if mibBuilder.loadTexts:
tplinkIpAddrMIB.setLastUpdated('201212130930Z')
if mibBuilder.loadTexts:
tplinkIpAddrMIB.setOrganization('TPLINK')
tplink_ip_addr_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1))
tplink_ip_addr_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 11863, 6, 6, 2))
tp_interface_config = mib_identifier((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1))
tp_vlan_interface_table = mib_table((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1))
if mibBuilder.loadTexts:
tpVlanInterfaceTable.setStatus('current')
tp_vlan_interface_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1)).setIndexNames((0, 'TPLINK-IPADDR-MIB', 'tpVlanInterfaceVlanId'), (0, 'TPLINK-IPADDR-MIB', 'tpVlanInterfaceIp'), (0, 'TPLINK-IPADDR-MIB', 'tpVlanInterfaceSecondary'))
if mibBuilder.loadTexts:
tpVlanInterfaceConfigEntry.setStatus('current')
tp_vlan_interface_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpVlanInterfaceVlanId.setStatus('current')
tp_vlan_interface_secondary = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpVlanInterfaceSecondary.setStatus('current')
tp_vlan_interface_mode = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 3), tp_interface_mode()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpVlanInterfaceMode.setStatus('current')
tp_vlan_interface_ip = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 4), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpVlanInterfaceIp.setStatus('current')
tp_vlan_interface_msk = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 5), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpVlanInterfaceMsk.setStatus('current')
tp_vlan_interface_name = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpVlanInterfaceName.setStatus('current')
tp_vlan_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 1, 1, 7), tp_row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpVlanInterfaceStatus.setStatus('current')
tp_loopback_interface_table = mib_table((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2))
if mibBuilder.loadTexts:
tpLoopbackInterfaceTable.setStatus('current')
tp_loopback_interface_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1)).setIndexNames((0, 'TPLINK-IPADDR-MIB', 'tpLoopbackInterfaceId'), (0, 'TPLINK-IPADDR-MIB', 'tpLoopbackInterfaceIp'), (0, 'TPLINK-IPADDR-MIB', 'tpLoopbackInterfaceSecondary'))
if mibBuilder.loadTexts:
tpLoopbackInterfaceConfigEntry.setStatus('current')
tp_loopback_interface_id = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpLoopbackInterfaceId.setStatus('current')
tp_loopback_interface_secondary = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpLoopbackInterfaceSecondary.setStatus('current')
tp_loopback_interface_mode = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 3), tp_interface_mode2()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpLoopbackInterfaceMode.setStatus('current')
tp_loopback_interface_ip = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 4), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpLoopbackInterfaceIp.setStatus('current')
tp_loopback_interface_msk = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 5), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpLoopbackInterfaceMsk.setStatus('current')
tp_loopback_interface_name = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpLoopbackInterfaceName.setStatus('current')
tp_loopback_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 2, 1, 7), tp_row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpLoopbackInterfaceStatus.setStatus('current')
tp_routed_port_table = mib_table((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3))
if mibBuilder.loadTexts:
tpRoutedPortTable.setStatus('current')
tp_routed_port_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'TPLINK-IPADDR-MIB', 'tpRoutedPortIp'), (0, 'TPLINK-IPADDR-MIB', 'tpRoutedPortSecondary'))
if mibBuilder.loadTexts:
tpRoutedPortConfigEntry.setStatus('current')
tp_routed_port_id = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(0, 16))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpRoutedPortId.setStatus('current')
tp_routed_port_secondary = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpRoutedPortSecondary.setStatus('current')
tp_routed_port_mode = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 3), tp_interface_mode()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpRoutedPortMode.setStatus('current')
tp_routed_port_ip = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 4), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpRoutedPortIp.setStatus('current')
tp_routed_port_msk = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 5), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpRoutedPortMsk.setStatus('current')
tp_routed_port_name = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpRoutedPortName.setStatus('current')
tp_routed_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 3, 1, 7), tp_row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpRoutedPortStatus.setStatus('current')
tp_port_channel_table = mib_table((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4))
if mibBuilder.loadTexts:
tpPortChannelTable.setStatus('current')
tp_port_channel_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1)).setIndexNames((0, 'TPLINK-IPADDR-MIB', 'tpPortChannelId'), (0, 'TPLINK-IPADDR-MIB', 'tpPortChannelIp'), (0, 'TPLINK-IPADDR-MIB', 'tpPortChannelSecondary'))
if mibBuilder.loadTexts:
tpPortChannelConfigEntry.setStatus('current')
tp_port_channel_id = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpPortChannelId.setStatus('current')
tp_port_channel_secondary = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpPortChannelSecondary.setStatus('current')
tp_port_channel_mode = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 3), tp_interface_mode()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpPortChannelMode.setStatus('current')
tp_port_channel_ip = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 4), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tpPortChannelIp.setStatus('current')
tp_port_channel_msk = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 5), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpPortChannelMsk.setStatus('current')
tp_port_channel_name = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpPortChannelName.setStatus('current')
tp_port_channel_status = mib_table_column((1, 3, 6, 1, 4, 1, 11863, 6, 6, 1, 1, 4, 1, 7), tp_row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
tpPortChannelStatus.setStatus('current')
mibBuilder.exportSymbols('TPLINK-IPADDR-MIB', tpVlanInterfaceMode=tpVlanInterfaceMode, tpPortChannelIp=tpPortChannelIp, tpRoutedPortIp=tpRoutedPortIp, tpPortChannelSecondary=tpPortChannelSecondary, tpVlanInterfaceVlanId=tpVlanInterfaceVlanId, tpLoopbackInterfaceId=tpLoopbackInterfaceId, tplinkIpAddrMIB=tplinkIpAddrMIB, tpVlanInterfaceMsk=tpVlanInterfaceMsk, tpInterfaceConfig=tpInterfaceConfig, TpInterfaceMode=TpInterfaceMode, tpLoopbackInterfaceName=tpLoopbackInterfaceName, tpRoutedPortSecondary=tpRoutedPortSecondary, tpPortChannelMsk=tpPortChannelMsk, tpRoutedPortStatus=tpRoutedPortStatus, tpRoutedPortId=tpRoutedPortId, tpPortChannelMode=tpPortChannelMode, tpVlanInterfaceConfigEntry=tpVlanInterfaceConfigEntry, tpRoutedPortConfigEntry=tpRoutedPortConfigEntry, tpRoutedPortMode=tpRoutedPortMode, TpInterfaceMode2=TpInterfaceMode2, tpRoutedPortMsk=tpRoutedPortMsk, tpLoopbackInterfaceConfigEntry=tpLoopbackInterfaceConfigEntry, tpPortChannelName=tpPortChannelName, tplinkIpAddrNotifications=tplinkIpAddrNotifications, tpLoopbackInterfaceMsk=tpLoopbackInterfaceMsk, tpVlanInterfaceTable=tpVlanInterfaceTable, tpVlanInterfaceName=tpVlanInterfaceName, tpVlanInterfaceStatus=tpVlanInterfaceStatus, PYSNMP_MODULE_ID=tplinkIpAddrMIB, tpPortChannelTable=tpPortChannelTable, tpLoopbackInterfaceStatus=tpLoopbackInterfaceStatus, tpPortChannelStatus=tpPortChannelStatus, tpRoutedPortTable=tpRoutedPortTable, tpPortChannelConfigEntry=tpPortChannelConfigEntry, tpLoopbackInterfaceIp=tpLoopbackInterfaceIp, tpRoutedPortName=tpRoutedPortName, tpPortChannelId=tpPortChannelId, TpPortLinkMode=TpPortLinkMode, tplinkIpAddrMIBObjects=tplinkIpAddrMIBObjects, tpVlanInterfaceIp=tpVlanInterfaceIp, tpLoopbackInterfaceSecondary=tpLoopbackInterfaceSecondary, tpVlanInterfaceSecondary=tpVlanInterfaceSecondary, tpLoopbackInterfaceTable=tpLoopbackInterfaceTable, tpLoopbackInterfaceMode=tpLoopbackInterfaceMode) |
#Programa que leia um nome completo e diga o primeiro e ultimo nome
nome = input('Digite seu nome completo: ').title()
splt = nome.split()
print(splt[0],splt[-1]) | nome = input('Digite seu nome completo: ').title()
splt = nome.split()
print(splt[0], splt[-1]) |
def binary_search(ary, tar):
head = 0
tail = len(ary) - 1
found = False
while head <= tail and not found:
mid = (head + tail) / 2
if ary[mid] == tar:
found = True
elif ary[mid] < tar:
head = mid + 1
elif ary[mid] > tar:
tail = mid - 1
return found
def binary_search_recursive(ary, tar):
if len(ary) == 0:
return False
mid = len(ary) / 2
if ary[mid] == tar:
return True
elif ary[mid] < tar:
return binary_search_recursive(ary[mid+1:], tar)
elif ary[mid] > tar:
return binary_search_recursive(ary[:mid], tar)
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(binary_search(a, 0))
print(binary_search(a, 1))
print(binary_search(a, 3))
print(binary_search(a, 4))
print(binary_search(a, 11))
print(binary_search_recursive(a, 0))
print(binary_search_recursive(a, 1))
print(binary_search_recursive(a, 3))
print(binary_search_recursive(a, 4))
print(binary_search_recursive(a, 11))
| def binary_search(ary, tar):
head = 0
tail = len(ary) - 1
found = False
while head <= tail and (not found):
mid = (head + tail) / 2
if ary[mid] == tar:
found = True
elif ary[mid] < tar:
head = mid + 1
elif ary[mid] > tar:
tail = mid - 1
return found
def binary_search_recursive(ary, tar):
if len(ary) == 0:
return False
mid = len(ary) / 2
if ary[mid] == tar:
return True
elif ary[mid] < tar:
return binary_search_recursive(ary[mid + 1:], tar)
elif ary[mid] > tar:
return binary_search_recursive(ary[:mid], tar)
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(binary_search(a, 0))
print(binary_search(a, 1))
print(binary_search(a, 3))
print(binary_search(a, 4))
print(binary_search(a, 11))
print(binary_search_recursive(a, 0))
print(binary_search_recursive(a, 1))
print(binary_search_recursive(a, 3))
print(binary_search_recursive(a, 4))
print(binary_search_recursive(a, 11)) |
# example solution.
# You are not expected to make a nice plotting function,
# you can simply call plt.imshow a number of times and observe
print(faces.DESCR) # this shows there are 40 classes, 10 samples per class
print(faces.target) #the targets i.e. classes
print(np.unique(faces.target).shape) # another way to see n_classes
X = faces.images
y = faces.target
fig = plt.figure(figsize=(16,5))
idxs = [0,1,2, 11,12,13, 40,41]
for i,k in enumerate(idxs):
ax=fig.add_subplot(2,4,i+1)
ax.imshow(X[k])
ax.set_title(f"target={y[k]}")
# looking at a few plots shows that each target is a single person. | print(faces.DESCR)
print(faces.target)
print(np.unique(faces.target).shape)
x = faces.images
y = faces.target
fig = plt.figure(figsize=(16, 5))
idxs = [0, 1, 2, 11, 12, 13, 40, 41]
for (i, k) in enumerate(idxs):
ax = fig.add_subplot(2, 4, i + 1)
ax.imshow(X[k])
ax.set_title(f'target={y[k]}') |
#python 3.5.2
def areAnagram(firstWord, secondWord):
firstList = list(firstWord)
secondList = list(secondWord)
result = True
if len(firstList) == len(secondList) and result:
#Sort both list alphabetically
firstList.sort()
secondList.sort()
i = 0
length = len(firstList)
while i < length :
if firstList[i] != secondList[i]:
result = False
i = i + 1
else:
result = False
return result
# Checking same word (Result should be True)
print ( 'Is "earth" and "earth" an anagram ?' , areAnagram('earth','earth') )
# Checking two anagrams (Result should be True)
print ( 'Is "heart" and "earth" an anagram ?' , areAnagram('heart','earth') )
# Checking two words that are not anagrams (Result should be False)
print ( 'Is "eartj" and "earth" an anagram ?' , areAnagram('eartj','earth') )
# Checking not the same number of characters (Result should be False)
print ( 'Is "eart" and "earth" an anagram ?' , areAnagram('eart','earth') )
# Checking more than one of the same characters (Result should be False)
print ( 'Is "eearth" and "earth" an anagram ?' , areAnagram('eearth','earth') )
'''
OUTPUT:
Is "earth" and "earth" an anagram ? True
Is "heart" and "earth" an anagram ? True
Is "eartj" and "earth" an anagram ? False
Is "eart" and "earth" an anagram ? False
Is "eearth" and "earth" an anagram ? False
'''
| def are_anagram(firstWord, secondWord):
first_list = list(firstWord)
second_list = list(secondWord)
result = True
if len(firstList) == len(secondList) and result:
firstList.sort()
secondList.sort()
i = 0
length = len(firstList)
while i < length:
if firstList[i] != secondList[i]:
result = False
i = i + 1
else:
result = False
return result
print('Is "earth" and "earth" an anagram ?', are_anagram('earth', 'earth'))
print('Is "heart" and "earth" an anagram ?', are_anagram('heart', 'earth'))
print('Is "eartj" and "earth" an anagram ?', are_anagram('eartj', 'earth'))
print('Is "eart" and "earth" an anagram ?', are_anagram('eart', 'earth'))
print('Is "eearth" and "earth" an anagram ?', are_anagram('eearth', 'earth'))
'\nOUTPUT:\n\nIs "earth" and "earth" an anagram ? True\nIs "heart" and "earth" an anagram ? True\nIs "eartj" and "earth" an anagram ? False\nIs "eart" and "earth" an anagram ? False\nIs "eearth" and "earth" an anagram ? False\n' |
#!/bin/zsh
'''
Regex Search
Write a program that opens all .txt files in a folder and searches for any line
that matches a user-supplied regular expression. The results should be printed to the screen.
''' | """
Regex Search
Write a program that opens all .txt files in a folder and searches for any line
that matches a user-supplied regular expression. The results should be printed to the screen.
""" |
''' Q1. Write a python code for creating a password for E-Aadhar card. The details used are the
first 4 letters of your name, date and month of your birth. The task is to generate a password
with the lambda function and display it.'''
name = input("Input your name (as on your Aadhar)\n")
dob = input("Please enter your dob in this order : 'ddmmyyyy'\n")
first = lambda name: name[:4]
last = lambda dob: dob[4:]
pw = first(name) + last(dob)
print("Your password is ",pw)
| """ Q1. Write a python code for creating a password for E-Aadhar card. The details used are the
first 4 letters of your name, date and month of your birth. The task is to generate a password
with the lambda function and display it."""
name = input('Input your name (as on your Aadhar)\n')
dob = input("Please enter your dob in this order : 'ddmmyyyy'\n")
first = lambda name: name[:4]
last = lambda dob: dob[4:]
pw = first(name) + last(dob)
print('Your password is ', pw) |
# !/usr/bin/env python
# coding: utf-8
'''
Description:
'''
| """
Description:
""" |
def getSampleMetadata(catalogName, tagName, digest):
return {
'schemaVersion': 2,
'mediaType': 'application/vnd.docker.distribution.manifest.v2+json',
'config': {
'mediaType': 'application/vnd.docker.container.image.v1+json',
'size': 1111,
'digest': digest
},
'layers': [
{
'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 123, 'digest': 'sha256:e6c96db7181be991f19a9fb6975cdbbd73c65f4a2681348e63a141a2192a5f10'
}, {
'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 123, 'digest': 'sha256:8985e402e050840450bd9d60b20a9bec70d57a507b33a85e5c3b3caf2e0ada6e'
}, {
'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 23, 'digest': 'sha256:78986f489cfa0d72ea6e357ab3e81a9d5ebdb9cf4797a41eb49bdefe579f1b01'
}
]
}
| def get_sample_metadata(catalogName, tagName, digest):
return {'schemaVersion': 2, 'mediaType': 'application/vnd.docker.distribution.manifest.v2+json', 'config': {'mediaType': 'application/vnd.docker.container.image.v1+json', 'size': 1111, 'digest': digest}, 'layers': [{'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 123, 'digest': 'sha256:e6c96db7181be991f19a9fb6975cdbbd73c65f4a2681348e63a141a2192a5f10'}, {'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 123, 'digest': 'sha256:8985e402e050840450bd9d60b20a9bec70d57a507b33a85e5c3b3caf2e0ada6e'}, {'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 23, 'digest': 'sha256:78986f489cfa0d72ea6e357ab3e81a9d5ebdb9cf4797a41eb49bdefe579f1b01'}]} |
class Solution:
def count(self, s, target):
ans = 0
for i in s:
if i == target:
ans += 1
return ans
def findMaxForm(self, strs: List[str], m: int, n: int) -> int:
dp = [[0 for i in range(n+1)] for j in range(m+1)]
for s in strs:
zero = self.count(s, '0')
one = self.count(s, '1')
for i in range(m, zero-1, -1):
for j in range(n, one-1, -1):
dp[i][j] = max(dp[i][j], dp[i-zero][j-one]+1)
return dp[m][n]
| class Solution:
def count(self, s, target):
ans = 0
for i in s:
if i == target:
ans += 1
return ans
def find_max_form(self, strs: List[str], m: int, n: int) -> int:
dp = [[0 for i in range(n + 1)] for j in range(m + 1)]
for s in strs:
zero = self.count(s, '0')
one = self.count(s, '1')
for i in range(m, zero - 1, -1):
for j in range(n, one - 1, -1):
dp[i][j] = max(dp[i][j], dp[i - zero][j - one] + 1)
return dp[m][n] |
# remove nth node from end
# https://leetcode.com/problems/remove-nth-node-from-end-of-list/
# brute
# create a new linked list without that element
# Time O(n)
# Space O(n)
# optimal
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
if(head.next == None):
return None
start = ListNode()
start.next = head
slow = fast = start
for i in range(1, n+1):
fast = fast.next
while(fast.next != None):
fast = fast.next
slow = slow.next
slow.next = slow.next.next
return start.next
| class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def remove_nth_from_end(self, head: ListNode, n: int) -> ListNode:
if head.next == None:
return None
start = list_node()
start.next = head
slow = fast = start
for i in range(1, n + 1):
fast = fast.next
while fast.next != None:
fast = fast.next
slow = slow.next
slow.next = slow.next.next
return start.next |
def readFile(fileName):
try:
with open(fileName,'r') as f:
print (f.read())
except FileNotFoundError:
print (f'File {fileName} is not found')
readFile('1.txt')
readFile('2.txt')
readFile('3.txt')
| def read_file(fileName):
try:
with open(fileName, 'r') as f:
print(f.read())
except FileNotFoundError:
print(f'File {fileName} is not found')
read_file('1.txt')
read_file('2.txt')
read_file('3.txt') |
'''
In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?
Examples:
make_negative(1); # return -1
make_negative(-5); # return -5
make_negative(0); # return 0
Notes:
* The number can be negative already, in which case no change is required.
* Zero (0) is not checked for any specific sign. Negative zeros make no mathematical sense.
'''
def make_negative(number):
return number * -1 if number > 0 else number | """
In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?
Examples:
make_negative(1); # return -1
make_negative(-5); # return -5
make_negative(0); # return 0
Notes:
* The number can be negative already, in which case no change is required.
* Zero (0) is not checked for any specific sign. Negative zeros make no mathematical sense.
"""
def make_negative(number):
return number * -1 if number > 0 else number |
cards = {'SPADE' : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'],
'HEART' : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'],
'CLUB' : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'],
'DIAMOND' : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']
}
| cards = {'SPADE': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'], 'HEART': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'], 'CLUB': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13'], 'DIAMOND': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13']} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.