content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class BinarySearch:
def __init__(self):
pass
def search(self, array, item):
# return self.recursively_search(array, item, 0, len(array)-1)
return self.interactive_search(array, item, 0, len(array)-1)
def recursively_search(self, array, item, left, right):
if(left > right):
return -1
mid = int((left+right)/2)
if(item < array[mid]):
return self.recursively_search(array, item, left, mid - 1)
elif(item > array[mid]):
return self.recursively_search(array, item, mid + 1, right)
else:
return mid
def interactive_search(self, array, item, left, right):
while(left <= right):
mid = int((left+right)/2)
if(item > array[mid]):
left = mid + 1
elif(item < array[mid]):
right = mid - 1
else:
return mid
return -1
if __name__ == '__main__':
array = [ 3, 4, 5, 7, 12, 14, 18, 21, 35, 38, 44, 53, 67]
bs = BinarySearch()
print(bs.search(array, 44)) | class Binarysearch:
def __init__(self):
pass
def search(self, array, item):
return self.interactive_search(array, item, 0, len(array) - 1)
def recursively_search(self, array, item, left, right):
if left > right:
return -1
mid = int((left + right) / 2)
if item < array[mid]:
return self.recursively_search(array, item, left, mid - 1)
elif item > array[mid]:
return self.recursively_search(array, item, mid + 1, right)
else:
return mid
def interactive_search(self, array, item, left, right):
while left <= right:
mid = int((left + right) / 2)
if item > array[mid]:
left = mid + 1
elif item < array[mid]:
right = mid - 1
else:
return mid
return -1
if __name__ == '__main__':
array = [3, 4, 5, 7, 12, 14, 18, 21, 35, 38, 44, 53, 67]
bs = binary_search()
print(bs.search(array, 44)) |
class Solution:
def makeGood(self, s: str) -> str:
ans = []
for ch in s:
if ans and ans[-1].lower() == ch.lower() and ans[-1] != ch:
ans.pop()
else:
ans.append(ch)
return ''.join(ans)
| class Solution:
def make_good(self, s: str) -> str:
ans = []
for ch in s:
if ans and ans[-1].lower() == ch.lower() and (ans[-1] != ch):
ans.pop()
else:
ans.append(ch)
return ''.join(ans) |
#-----------------------------------------------------------------------------
# Runtime: 28ms
# Memory Usage:
# Link:
#-----------------------------------------------------------------------------
class Solution:
def spiralOrder(self, matrix: [[int]]) -> [int]:
row_length = len(matrix)
if row_length <= 0:
return matrix
col_length = len(matrix[0])
matrix_length = col_length * row_length
result = []
level = 0
while True:
first_col = level
first_row = level
last_col = col_length - level - 1
last_row = row_length - level - 1
for i in range(first_col, last_col + 1):
result.append(matrix[first_row][i])
if len(result) == matrix_length: break
for i in range(first_row + 1, last_row):
result.append(matrix[i][last_col])
if len(result) == matrix_length: break
for i in range(last_col, first_col - 1, -1):
result.append(matrix[last_row][i])
if len(result) == matrix_length: break
for i in range(last_row - 1, first_row, -1):
result.append(matrix[i][first_col])
if len(result) == matrix_length: break
level += 1
return result
| class Solution:
def spiral_order(self, matrix: [[int]]) -> [int]:
row_length = len(matrix)
if row_length <= 0:
return matrix
col_length = len(matrix[0])
matrix_length = col_length * row_length
result = []
level = 0
while True:
first_col = level
first_row = level
last_col = col_length - level - 1
last_row = row_length - level - 1
for i in range(first_col, last_col + 1):
result.append(matrix[first_row][i])
if len(result) == matrix_length:
break
for i in range(first_row + 1, last_row):
result.append(matrix[i][last_col])
if len(result) == matrix_length:
break
for i in range(last_col, first_col - 1, -1):
result.append(matrix[last_row][i])
if len(result) == matrix_length:
break
for i in range(last_row - 1, first_row, -1):
result.append(matrix[i][first_col])
if len(result) == matrix_length:
break
level += 1
return result |
def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Reserved'},
{'abbr': 'surf',
'code': 1,
'title': 'Surface',
'units': 'of the Earth, which includes sea surface'},
{'abbr': 'bcld', 'code': 2, 'title': 'Cloud base level'},
{'abbr': 'tcld', 'code': 3, 'title': 'Cloud top level'},
{'abbr': 'isot', 'code': 4, 'title': '0 deg (C) isotherm level'},
{'abbr': 5,
'code': 5,
'title': 'Adiabatic condensation level',
'units': 'parcel lifted from surface'},
{'abbr': 6, 'code': 6, 'title': 'Maximum wind speed level'},
{'abbr': 7, 'code': 7, 'title': 'Tropopause level'},
{'abbr': 'tatm', 'code': 8, 'title': 'Nominal top of atmosphere'},
{'abbr': 9, 'code': 9, 'title': 'Sea bottom'},
{'abbr': 'pl',
'code': 100,
'title': 'Isobaric level pressure in hectoPascals (hPa)',
'units': '2 octets'},
{'abbr': 101,
'code': 101,
'title': 'Layer between two isobaric levels pressure of top (kPa) pressure '
'of bottom',
'units': 'kPa'},
{'abbr': 'msl', 'code': 102, 'title': 'Mean sea level 0 0'},
{'abbr': 'hmsl',
'code': 103,
'title': 'Fixed height level height above mean sea level (MSL) in meters'},
{'abbr': 104,
'code': 104,
'title': 'Layer between two height levels above msl height of top (hm) above '
'mean sea level height of bottom (hm) above mean sea level'},
{'abbr': 'hl',
'code': 105,
'title': 'Fixed height above ground height in meters',
'units': '2 octets'},
{'abbr': 'lhl',
'code': 106,
'title': 'Layer between two height levels above ground height of top (hm) '
'above ground height of bottom (hm) above ground'},
{'abbr': 107,
'code': 107,
'title': 'Sigma level sigma value in 1/10000',
'units': '2 octets'},
{'abbr': 108,
'code': 108,
'title': 'Layer between two sigma levels sigma value at top in 1/100 sigma '
'value at bottom in 1/100'},
{'abbr': 'ml',
'code': 109,
'title': 'Hybrid level level number',
'units': '2 octets'},
{'abbr': 110,
'code': 110,
'title': 'Layer between two hybrid levels level number of top level number '
'of bottom'},
{'abbr': 111,
'code': 111,
'title': 'Depth below land surface centimeters',
'units': '2 octets'},
{'abbr': 'ldl',
'code': 112,
'title': 'Layer between two depths below land surface depth of upper surface '
'(cm) depth of lower surface',
'units': 'cm'},
{'abbr': 'pt',
'code': 113,
'title': 'Isentropic (theta) level Potential Temp. degrees K',
'units': '2 octets'},
{'abbr': 114,
'code': 114,
'title': 'Layer between two isentropic levels 475K minus theta of top in '
'Deg. K 475K minus theta of bottom in Deg. K'},
{'abbr': 115,
'code': 115,
'title': 'Level at specified pressure difference from ground to level hPa',
'units': '2 octets'},
{'abbr': 116,
'code': 116,
'title': 'Layer between two levels at specified pressure differences from '
'ground to levels pressure difference from ground to top level hPa '
'pressure difference from ground to bottom level hPa'},
{'abbr': 'pv',
'code': 117,
'title': 'Potential vorticity surface 10-9 K m2 kg-1 s-1'},
{'abbr': 121,
'code': 121,
'title': 'Layer between two isobaric surfaces (high precision) 1100 hPa '
'minus pressure of top, in hPa 1100 hPa minus pressure of bottom, '
'in hPa'},
{'abbr': 125,
'code': 125,
'title': 'Height level above ground (high precision) centimeters',
'units': '2 octets'},
{'abbr': 128,
'code': 128,
'title': 'Layer between two sigma levels (high precision) 1.1 minus sigma of '
'top, in 1/1000 of sigma 1.1 minus sigma of bottom, in 1/1000 of '
'sigma'},
{'abbr': 141,
'code': 141,
'title': 'Layer between two isobaric surfaces (mixed precision) pressure of '
'top, in kPa 1100hPa minus pressure of bottom, in hPa'},
{'abbr': 'dp',
'code': 160,
'title': 'Depth below sea level meters',
'units': '2 octets'},
{'abbr': 'nd',
'code': 191,
'title': 'Northern Direction',
'units': 'SMHI Extension'},
{'abbr': 'ned',
'code': 192,
'title': 'Northern-Eastern Direction',
'units': 'SMHI Extension'},
{'abbr': 'ed',
'code': 193,
'title': 'Eastern Direction',
'units': 'SMHI Extension'},
{'abbr': 'sed',
'code': 194,
'title': 'Southern-Eastern Direction',
'units': 'SMHI Extension'},
{'abbr': 'sd',
'code': 195,
'title': 'Southern Direction',
'units': 'SMHI Extension'},
{'abbr': 'swd',
'code': 196,
'title': 'Southern-Western Direction',
'units': 'SMHI Extension'},
{'abbr': 'wd',
'code': 197,
'title': 'Western Direction',
'units': 'SMHI Extension'},
{'abbr': 'nwd',
'code': 198,
'title': 'Northern-Western Direction',
'units': 'SMHI Extension'},
{'abbr': 'atm',
'code': 200,
'title': 'Entire atmosphere considered as a single layer 0',
'units': '2 octets'},
{'abbr': 201,
'code': 201,
'title': 'Entire ocean considered as a single layer 0',
'units': '2 octets'})
| def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'Reserved'}, {'abbr': 'surf', 'code': 1, 'title': 'Surface', 'units': 'of the Earth, which includes sea surface'}, {'abbr': 'bcld', 'code': 2, 'title': 'Cloud base level'}, {'abbr': 'tcld', 'code': 3, 'title': 'Cloud top level'}, {'abbr': 'isot', 'code': 4, 'title': '0 deg (C) isotherm level'}, {'abbr': 5, 'code': 5, 'title': 'Adiabatic condensation level', 'units': 'parcel lifted from surface'}, {'abbr': 6, 'code': 6, 'title': 'Maximum wind speed level'}, {'abbr': 7, 'code': 7, 'title': 'Tropopause level'}, {'abbr': 'tatm', 'code': 8, 'title': 'Nominal top of atmosphere'}, {'abbr': 9, 'code': 9, 'title': 'Sea bottom'}, {'abbr': 'pl', 'code': 100, 'title': 'Isobaric level pressure in hectoPascals (hPa)', 'units': '2 octets'}, {'abbr': 101, 'code': 101, 'title': 'Layer between two isobaric levels pressure of top (kPa) pressure of bottom', 'units': 'kPa'}, {'abbr': 'msl', 'code': 102, 'title': 'Mean sea level 0 0'}, {'abbr': 'hmsl', 'code': 103, 'title': 'Fixed height level height above mean sea level (MSL) in meters'}, {'abbr': 104, 'code': 104, 'title': 'Layer between two height levels above msl height of top (hm) above mean sea level height of bottom (hm) above mean sea level'}, {'abbr': 'hl', 'code': 105, 'title': 'Fixed height above ground height in meters', 'units': '2 octets'}, {'abbr': 'lhl', 'code': 106, 'title': 'Layer between two height levels above ground height of top (hm) above ground height of bottom (hm) above ground'}, {'abbr': 107, 'code': 107, 'title': 'Sigma level sigma value in 1/10000', 'units': '2 octets'}, {'abbr': 108, 'code': 108, 'title': 'Layer between two sigma levels sigma value at top in 1/100 sigma value at bottom in 1/100'}, {'abbr': 'ml', 'code': 109, 'title': 'Hybrid level level number', 'units': '2 octets'}, {'abbr': 110, 'code': 110, 'title': 'Layer between two hybrid levels level number of top level number of bottom'}, {'abbr': 111, 'code': 111, 'title': 'Depth below land surface centimeters', 'units': '2 octets'}, {'abbr': 'ldl', 'code': 112, 'title': 'Layer between two depths below land surface depth of upper surface (cm) depth of lower surface', 'units': 'cm'}, {'abbr': 'pt', 'code': 113, 'title': 'Isentropic (theta) level Potential Temp. degrees K', 'units': '2 octets'}, {'abbr': 114, 'code': 114, 'title': 'Layer between two isentropic levels 475K minus theta of top in Deg. K 475K minus theta of bottom in Deg. K'}, {'abbr': 115, 'code': 115, 'title': 'Level at specified pressure difference from ground to level hPa', 'units': '2 octets'}, {'abbr': 116, 'code': 116, 'title': 'Layer between two levels at specified pressure differences from ground to levels pressure difference from ground to top level hPa pressure difference from ground to bottom level hPa'}, {'abbr': 'pv', 'code': 117, 'title': 'Potential vorticity surface 10-9 K m2 kg-1 s-1'}, {'abbr': 121, 'code': 121, 'title': 'Layer between two isobaric surfaces (high precision) 1100 hPa minus pressure of top, in hPa 1100 hPa minus pressure of bottom, in hPa'}, {'abbr': 125, 'code': 125, 'title': 'Height level above ground (high precision) centimeters', 'units': '2 octets'}, {'abbr': 128, 'code': 128, 'title': 'Layer between two sigma levels (high precision) 1.1 minus sigma of top, in 1/1000 of sigma 1.1 minus sigma of bottom, in 1/1000 of sigma'}, {'abbr': 141, 'code': 141, 'title': 'Layer between two isobaric surfaces (mixed precision) pressure of top, in kPa 1100hPa minus pressure of bottom, in hPa'}, {'abbr': 'dp', 'code': 160, 'title': 'Depth below sea level meters', 'units': '2 octets'}, {'abbr': 'nd', 'code': 191, 'title': 'Northern Direction', 'units': 'SMHI Extension'}, {'abbr': 'ned', 'code': 192, 'title': 'Northern-Eastern Direction', 'units': 'SMHI Extension'}, {'abbr': 'ed', 'code': 193, 'title': 'Eastern Direction', 'units': 'SMHI Extension'}, {'abbr': 'sed', 'code': 194, 'title': 'Southern-Eastern Direction', 'units': 'SMHI Extension'}, {'abbr': 'sd', 'code': 195, 'title': 'Southern Direction', 'units': 'SMHI Extension'}, {'abbr': 'swd', 'code': 196, 'title': 'Southern-Western Direction', 'units': 'SMHI Extension'}, {'abbr': 'wd', 'code': 197, 'title': 'Western Direction', 'units': 'SMHI Extension'}, {'abbr': 'nwd', 'code': 198, 'title': 'Northern-Western Direction', 'units': 'SMHI Extension'}, {'abbr': 'atm', 'code': 200, 'title': 'Entire atmosphere considered as a single layer 0', 'units': '2 octets'}, {'abbr': 201, 'code': 201, 'title': 'Entire ocean considered as a single layer 0', 'units': '2 octets'}) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.preorder_i = 0
def buildTree(self, preorder, inorder) -> TreeNode:
return self.rec(preorder, inorder, 0, len(preorder) - 1)
def rec(self, preorder, inorder, inorder_l: int, inorder_r: int) -> TreeNode:
if inorder_l > inorder_r:
return None
node = TreeNode(preorder[self.preorder_i])
center = self.preorder_i
self.preorder_i += 1
left_l = inorder_l
right_l = inorder_l
while preorder[center] != inorder[right_l]:
right_l += 1
node.left = self.rec(preorder, inorder, left_l, right_l - 1)
node.right = self.rec(preorder, inorder, right_l + 1, inorder_r)
return node
x = Solution()
y = x.buildTree([3, 9, 20, 15, 7], [9, 3, 15, 20, 7])
print('here') | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.preorder_i = 0
def build_tree(self, preorder, inorder) -> TreeNode:
return self.rec(preorder, inorder, 0, len(preorder) - 1)
def rec(self, preorder, inorder, inorder_l: int, inorder_r: int) -> TreeNode:
if inorder_l > inorder_r:
return None
node = tree_node(preorder[self.preorder_i])
center = self.preorder_i
self.preorder_i += 1
left_l = inorder_l
right_l = inorder_l
while preorder[center] != inorder[right_l]:
right_l += 1
node.left = self.rec(preorder, inorder, left_l, right_l - 1)
node.right = self.rec(preorder, inorder, right_l + 1, inorder_r)
return node
x = solution()
y = x.buildTree([3, 9, 20, 15, 7], [9, 3, 15, 20, 7])
print('here') |
inpt1 = int(input('enter base: '))
inpt2 = int(input('enter height: '))
inpt3 = int(input('enter hypotenus: '))
def get_area(base, height):
return 0.5 * base * height
def get_per(base, height, hypo):
return base + height + hypo
print("area of the triangle is: ")
print(get_area(inpt1, inpt2))
print()
print('the perimeter of the triangle is')
print(get_per(inpt1, inpt2, inpt3))
| inpt1 = int(input('enter base: '))
inpt2 = int(input('enter height: '))
inpt3 = int(input('enter hypotenus: '))
def get_area(base, height):
return 0.5 * base * height
def get_per(base, height, hypo):
return base + height + hypo
print('area of the triangle is: ')
print(get_area(inpt1, inpt2))
print()
print('the perimeter of the triangle is')
print(get_per(inpt1, inpt2, inpt3)) |
def __getattr__():
pass
class C1:
def __str__(self):
return ''
def foo(self):
'''
>>> class Good():
... def __str__(self):
... return 1
'''
pass
class C2:
if True:
def __str__(self):
return ''
class C3:
try:
if True:
while True:
def __str__(self):
return ''
break
except:
pass
| def __getattr__():
pass
class C1:
def __str__(self):
return ''
def foo(self):
"""
>>> class Good():
... def __str__(self):
... return 1
"""
pass
class C2:
if True:
def __str__(self):
return ''
class C3:
try:
if True:
while True:
def __str__(self):
return ''
break
except:
pass |
class Config(object):
DEBUG = False
TESTING = False
SECRET_KEY = 'AAABBBBAAAA'
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
class ProductionConfig(Config):
DATABASE_URI = 'mysql://user@localhost/foo'
class DevelopmentConfig(Config):
DEBUG = True
class TestingConfig(Config):
TESTING = True
| class Config(object):
debug = False
testing = False
secret_key = 'AAABBBBAAAA'
sqlalchemy_database_uri = 'sqlite:////tmp/test.db'
class Productionconfig(Config):
database_uri = 'mysql://user@localhost/foo'
class Developmentconfig(Config):
debug = True
class Testingconfig(Config):
testing = True |
#!/usr/bin/python3
'''
Finds the coincidence index for the piece of text
Does not format the text so make sure to pass in a formatted one
'''
def findCoincidenceIndex(text: str, shift: int):
shiftedText = text[:-(shift)]
text = text[shift:]
shiftedLen = len(shiftedText)
similarCount = 0
for i in range(shiftedLen):
if text[i] == shiftedText[i]:
similarCount += 1
coincidenceIndex = similarCount/shiftedLen * 26
return coincidenceIndex
'''
Check all coincidence indices.
Returns the max of the coincidence indices, and the array of indices
Does not format the input
'''
def findBestCoincidenceIndex(text: str):
textLen = len(text)
indices = []
mx = 0
shift = -1
for i in range(1, textLen - 2):
index = findCoincidenceIndex(text, i)
if (index > mx):
mx = index
shift = i
indices.append(index)
return {'bestIndex': mx, 'bestShift': shift, 'indices': indices}
'''
Checks if the coincidenceIndex of a piece of text is similar i.e within the error margin to given coincidence index. If yes, then the shift and the index is returned, otherwise false
'''
def checkCoincidenceIndex(text: str, ci: float, errorMargin: float = 0.01):
textLen = len(text)
indices = []
bestIndex = 0
shift = -1
for i in range(1, textLen - 2):
index = findCoincidenceIndex(text, i)
diff = abs(index - ci)
if (diff < errorMargin):
if diff < abs(bestIndex - ci):
bestIndex = index
shift = i
indices.append((bestIndex, i))
return {'bestIndex': bestIndex, 'bestShift': shift, 'indices': indices} if shift != -1 else False
| """
Finds the coincidence index for the piece of text
Does not format the text so make sure to pass in a formatted one
"""
def find_coincidence_index(text: str, shift: int):
shifted_text = text[:-shift]
text = text[shift:]
shifted_len = len(shiftedText)
similar_count = 0
for i in range(shiftedLen):
if text[i] == shiftedText[i]:
similar_count += 1
coincidence_index = similarCount / shiftedLen * 26
return coincidenceIndex
'\nCheck all coincidence indices.\nReturns the max of the coincidence indices, and the array of indices\nDoes not format the input\n'
def find_best_coincidence_index(text: str):
text_len = len(text)
indices = []
mx = 0
shift = -1
for i in range(1, textLen - 2):
index = find_coincidence_index(text, i)
if index > mx:
mx = index
shift = i
indices.append(index)
return {'bestIndex': mx, 'bestShift': shift, 'indices': indices}
'\nChecks if the coincidenceIndex of a piece of text is similar i.e within the error margin to given coincidence index. If yes, then the shift and the index is returned, otherwise false\n'
def check_coincidence_index(text: str, ci: float, errorMargin: float=0.01):
text_len = len(text)
indices = []
best_index = 0
shift = -1
for i in range(1, textLen - 2):
index = find_coincidence_index(text, i)
diff = abs(index - ci)
if diff < errorMargin:
if diff < abs(bestIndex - ci):
best_index = index
shift = i
indices.append((bestIndex, i))
return {'bestIndex': bestIndex, 'bestShift': shift, 'indices': indices} if shift != -1 else False |
# Default
domainFile = "domains.txt"
assets = "./assets/"
targets = assets + "targets/"
subdomains = assets + "subdomains/"
domains = assets + "domains/"
takeover = assets + "takeover/"
dto = assets = "dto/"
# Target Information
targetFields = {
"Domain" : "",
"Analysis" : {
"Subdomain" : "",
"Ping" : "",
"Dns" : ""
}
}
| domain_file = 'domains.txt'
assets = './assets/'
targets = assets + 'targets/'
subdomains = assets + 'subdomains/'
domains = assets + 'domains/'
takeover = assets + 'takeover/'
dto = assets = 'dto/'
target_fields = {'Domain': '', 'Analysis': {'Subdomain': '', 'Ping': '', 'Dns': ''}} |
"""
Recipes available to data with tags ['GSAOI', 'IMAGE']
Default is "reduce_nostack".
"""
recipe_tags = {'GSAOI', 'IMAGE'}
def reduce_nostack(p):
"""
This recipe reduce GSAOI up to but NOT including alignment and stacking.
It will attempt to do flat correction if a processed calibration is
available. Sky subtraction is done when possible. QA metrics are
measured.
Parameters
----------
p : PrimitivesBASE object
A primitive set matching the recipe_tags.
"""
p.prepare()
p.addDQ()
p.nonlinearityCorrect()
p.ADUToElectrons()
p.addVAR(read_noise=True, poisson_noise=True)
p.flatCorrect()
p.detectSources(detect_thresh=5., analysis_thresh=5., back_size=128)
p.measureIQ(display=True)
p.measureBG()
p.addReferenceCatalog()
p.determineAstrometricSolution()
p.measureCC()
p.addToList(purpose='forSky')
p.getList(purpose='forSky', max_frames=9)
p.separateSky()
p.associateSky()
p.skyCorrect()
p.detectSources(detect_thresh=5., analysis_thresh=5., back_size=128)
p.measureIQ(display=True)
p.determineAstrometricSolution()
p.measureCC()
# p.scaleByExposureTime() # not really necessary in QA.
p.writeOutputs()
return
# The nostack version is used because stacking of GSAOI is time consuming.
_default = reduce_nostack
| """
Recipes available to data with tags ['GSAOI', 'IMAGE']
Default is "reduce_nostack".
"""
recipe_tags = {'GSAOI', 'IMAGE'}
def reduce_nostack(p):
"""
This recipe reduce GSAOI up to but NOT including alignment and stacking.
It will attempt to do flat correction if a processed calibration is
available. Sky subtraction is done when possible. QA metrics are
measured.
Parameters
----------
p : PrimitivesBASE object
A primitive set matching the recipe_tags.
"""
p.prepare()
p.addDQ()
p.nonlinearityCorrect()
p.ADUToElectrons()
p.addVAR(read_noise=True, poisson_noise=True)
p.flatCorrect()
p.detectSources(detect_thresh=5.0, analysis_thresh=5.0, back_size=128)
p.measureIQ(display=True)
p.measureBG()
p.addReferenceCatalog()
p.determineAstrometricSolution()
p.measureCC()
p.addToList(purpose='forSky')
p.getList(purpose='forSky', max_frames=9)
p.separateSky()
p.associateSky()
p.skyCorrect()
p.detectSources(detect_thresh=5.0, analysis_thresh=5.0, back_size=128)
p.measureIQ(display=True)
p.determineAstrometricSolution()
p.measureCC()
p.writeOutputs()
return
_default = reduce_nostack |
"""Error classes for authentise_services"""
class ResourceError(Exception):
"""arbitrary error whenever a call to a authentise resource doesnt go according to plan"""
pass
class ResourceStillProcessing(Exception):
"""most authentise resources have a status property to tell the user what state its in
Whenever the resource isnt ready in some way or another, throw one of these"""
pass
| """Error classes for authentise_services"""
class Resourceerror(Exception):
"""arbitrary error whenever a call to a authentise resource doesnt go according to plan"""
pass
class Resourcestillprocessing(Exception):
"""most authentise resources have a status property to tell the user what state its in
Whenever the resource isnt ready in some way or another, throw one of these"""
pass |
count = int(input())
matrix = []
for i in range(count):
matrix.append(list(map(int, input().split())))
# matrix = [list(map(int, input().split())) for i in range(n)]
roads = 0
for row in range(len(matrix)):
for col in range(row, len(matrix)):
roads += matrix[row][col]
print(roads)
| count = int(input())
matrix = []
for i in range(count):
matrix.append(list(map(int, input().split())))
roads = 0
for row in range(len(matrix)):
for col in range(row, len(matrix)):
roads += matrix[row][col]
print(roads) |
# BUILD FILE SYNTAX: SKYLARK
SE_VERSION = '3.9.1'
ASSEMBLY_VERSION = '3.9.1.0'
| se_version = '3.9.1'
assembly_version = '3.9.1.0' |
#
# PySNMP MIB module STN-SESSION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SESSION-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:11:40 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")
ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Bits, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, iso, Gauge32, MibIdentifier, TimeTicks, Integer32, Counter64, IpAddress, Unsigned32, ObjectIdentity, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "iso", "Gauge32", "MibIdentifier", "TimeTicks", "Integer32", "Counter64", "IpAddress", "Unsigned32", "ObjectIdentity", "ModuleIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
stnSystems, stnNotification = mibBuilder.importSymbols("SPRING-TIDE-NETWORKS-SMI", "stnSystems", "stnNotification")
StnUserFailureType, StnConfigFailureType = mibBuilder.importSymbols("SPRING-TIDE-NETWORKS-TC", "StnUserFailureType", "StnConfigFailureType")
stnEngineCpu, stnEngineIndex, stnEngineSlot = mibBuilder.importSymbols("STN-CHASSIS-MIB", "stnEngineCpu", "stnEngineIndex", "stnEngineSlot")
stnRouterIndex, = mibBuilder.importSymbols("STN-ROUTER-MIB", "stnRouterIndex")
stnSessions = ModuleIdentity((1, 3, 6, 1, 4, 1, 3551, 2, 5))
if mibBuilder.loadTexts: stnSessions.setLastUpdated('0002160000Z')
if mibBuilder.loadTexts: stnSessions.setOrganization('Spring Tide Networks, Inc.')
if mibBuilder.loadTexts: stnSessions.setContactInfo(' Spring Tide Networks, Inc. Customer Service Postal: 3 Clock Tower Place Maynard, MA 01754 Tel: 1 888-786-4357 Email: stncs@springtidenet.com ')
if mibBuilder.loadTexts: stnSessions.setDescription('This MIB module describes Spring Tide Networks session objects.')
stnSessionObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1))
stnSessionMibConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 2))
stnSessionTrapVars = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3))
stnSession = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1))
stnGlobalSession = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2))
stnSessionsPpp = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2))
stnSessionsL2tp = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3))
stnSessionsPptp = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4))
stnSessionsIpsec = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5))
stnSessionsIke = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6))
stnSessionsTelnet = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7))
stnSessionsFtp = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8))
stnSessionsFtpAlg = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9))
stnSessionsConsole = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10))
stnSessionsAggregate = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11))
stnSessionsEncaps = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12))
stnSessionsSecureUser = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13))
stnSessionsRemoteConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14))
class SessionOperStatus(TextualConvention, Integer32):
description = 'Operational status of a session.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("unknown", 1), ("inactive", 2), ("pend-active", 3), ("active", 4), ("pend-inactive", 5))
stnSessionTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1), )
if mibBuilder.loadTexts: stnSessionTable.setStatus('current')
if mibBuilder.loadTexts: stnSessionTable.setDescription('A list of session entries.')
stnSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1), ).setIndexNames((0, "STN-SESSION-MIB", "stnSessionIndex"))
if mibBuilder.loadTexts: stnSessionEntry.setStatus('current')
if mibBuilder.loadTexts: stnSessionEntry.setDescription('Entry contains information about a particular session.')
stnSessionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIndex.setStatus('current')
if mibBuilder.loadTexts: stnSessionIndex.setDescription('A sequence number that identifies a session entry in the table.')
stnSessionType = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))).clone(namedValues=NamedValues(("unknown", 1), ("ppp", 2), ("l2tp-tunnel", 3), ("pptp-tunnel", 4), ("ipsec", 5), ("ike", 6), ("telnet", 7), ("ftp", 8), ("ftp-alg", 9), ("console", 10), ("encaps", 11), ("secure-user", 12), ("remote-config", 13)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionType.setStatus('current')
if mibBuilder.loadTexts: stnSessionType.setDescription('Indicates the session type.')
stnSessionContext = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionContext.setStatus('current')
if mibBuilder.loadTexts: stnSessionContext.setDescription('A unique context identifier associated with the session.')
stnSessionOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 4), SessionOperStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionOperStatus.setStatus('current')
if mibBuilder.loadTexts: stnSessionOperStatus.setDescription('The operational status of the session.')
stnSessionLastChange = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionLastChange.setStatus('current')
if mibBuilder.loadTexts: stnSessionLastChange.setDescription('The value of sysUpTime at the time the session entered its current operational state.')
stnSessionPppTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPppTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPppTotalCount.setDescription('The total number of PPP sessions since system start.')
stnSessionPppFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPppFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPppFailedCount.setDescription('The total number of failed sessions since system start.')
stnSessionPppCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPppCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPppCurrentCount.setDescription('The total number of current PPP sessions.')
stnSessionPppCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPppCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPppCurrentActiveCount.setDescription('The total number of current active PPP sessions.')
stnSessionL2tpTunnelTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionL2tpTunnelTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionL2tpTunnelTotalCount.setDescription('The total number of L2TP tunnel sessions since system start.')
stnSessionL2tpTunnelFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionL2tpTunnelFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionL2tpTunnelFailedCount.setDescription('The total number of failed L2TP tunnel sessions since system start.')
stnSessionL2tpTunnelCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionL2tpTunnelCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionL2tpTunnelCurrentCount.setDescription('The total number of current L2TP tunnel sessions.')
stnSessionL2tpTunnelCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionL2tpTunnelCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionL2tpTunnelCurrentActiveCount.setDescription('The total number of current active L2TP tunnel sessions.')
stnSessionPptpTunnelTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPptpTunnelTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPptpTunnelTotalCount.setDescription('The total number of PPTP tunnel sessions since system start.')
stnSessionPptpTunnelFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPptpTunnelFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPptpTunnelFailedCount.setDescription('The total number of failed PPTP tunnel sessions since system start.')
stnSessionPptpTunnelCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPptpTunnelCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPptpTunnelCurrentCount.setDescription('The total number of current PPTP tunnel sessions.')
stnSessionPptpTunnelCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionPptpTunnelCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionPptpTunnelCurrentActiveCount.setDescription('The total number of current active PPTP tunnel sessions.')
stnSessionIpsecTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIpsecTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIpsecTotalCount.setDescription('The total number of IPSEC sessions since system start.')
stnSessionIpsecFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIpsecFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIpsecFailedCount.setDescription('The total number of failed IPSEC sessions since system start.')
stnSessionIpsecCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIpsecCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIpsecCurrentCount.setDescription('The total number of current IPSEC sessions.')
stnSessionIpsecCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIpsecCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIpsecCurrentActiveCount.setDescription('The total number of current active IPSEC sessions.')
stnSessionIkeTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIkeTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIkeTotalCount.setDescription('The total number of IKE sessions since system start.')
stnSessionIkeFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIkeFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIkeFailedCount.setDescription('The total number of failed IKE sessions since system start.')
stnSessionIkeCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIkeCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIkeCurrentCount.setDescription('The total number of current IKE sessions.')
stnSessionIkeCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionIkeCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionIkeCurrentActiveCount.setDescription('The total number of current active IKE sessions.')
stnSessionTelnetTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionTelnetTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionTelnetTotalCount.setDescription('The total number of Telnet sessions since system start.')
stnSessionTelnetFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionTelnetFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionTelnetFailedCount.setDescription('The total number of failed Telnet sessions since system start.')
stnSessionTelnetCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionTelnetCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionTelnetCurrentCount.setDescription('The total number of current Telnet sessions.')
stnSessionTelnetCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionTelnetCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionTelnetCurrentActiveCount.setDescription('The total number of current active Telnet sessions.')
stnSessionFtpTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpTotalCount.setDescription('The total number of FTP sessions since system start.')
stnSessionFtpFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpFailedCount.setDescription('The total number of failed FTP sessions since system start.')
stnSessionFtpCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpCurrentCount.setDescription('The total number of current FTP sessions.')
stnSessionFtpCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpCurrentActiveCount.setDescription('The total number of current active FTP sessions.')
stnSessionFtpAlgTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpAlgTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpAlgTotalCount.setDescription('The total number of FTP-ALG sessions since system start.')
stnSessionFtpAlgFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpAlgFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpAlgFailedCount.setDescription('The total number of failed FTP-ALG sessions since system start.')
stnSessionFtpAlgCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpAlgCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpAlgCurrentCount.setDescription('The total number of current FTP-ALG sessions.')
stnSessionFtpAlgCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionFtpAlgCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionFtpAlgCurrentActiveCount.setDescription('The total number of current active FTP-ALG sessions.')
stnSessionConsoleTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionConsoleTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionConsoleTotalCount.setDescription('The total number of console sessions since system start.')
stnSessionConsoleFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionConsoleFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionConsoleFailedCount.setDescription('The total number of failed console sessions since system start.')
stnSessionConsoleCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionConsoleCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionConsoleCurrentCount.setDescription('The total number of current console sessions.')
stnSessionConsoleCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionConsoleCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionConsoleCurrentActiveCount.setDescription('The total number of current active console sessions.')
stnSessionAggregateTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionAggregateTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionAggregateTotalCount.setDescription('The total number of sessions since system start.')
stnSessionAggregateFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionAggregateFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionAggregateFailedCount.setDescription('The total number of failed sessions since system start.')
stnSessionAggregateCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionAggregateCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionAggregateCurrentCount.setDescription('The total number of current sessions.')
stnSessionAggregateCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionAggregateCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionAggregateCurrentActiveCount.setDescription('The total number of current active sessions.')
stnSessionEncapsTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionEncapsTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionEncapsTotalCount.setDescription('The total number of encaps sessions since system start.')
stnSessionEncapsFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionEncapsFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionEncapsFailedCount.setDescription('The total number of failed encaps sessions since system start.')
stnSessionEncapsCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionEncapsCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionEncapsCurrentCount.setDescription('The total number of current encaps sessions.')
stnSessionEncapsCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionEncapsCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionEncapsCurrentActiveCount.setDescription('The total number of current active encaps sessions.')
stnSessionSecureUserTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionSecureUserTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionSecureUserTotalCount.setDescription('The total number of secure user sessions since system start.')
stnSessionSecureUserFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionSecureUserFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionSecureUserFailedCount.setDescription('The total number of failed secure user sessions since system start.')
stnSessionSecureUserCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionSecureUserCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionSecureUserCurrentCount.setDescription('The total number of current secure user sessions.')
stnSessionSecureUserCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionSecureUserCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionSecureUserCurrentActiveCount.setDescription('The total number of current active secure user sessions.')
stnSessionRemoteConfigTotalCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionRemoteConfigTotalCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionRemoteConfigTotalCount.setDescription('The total number of remote config sessions since system start.')
stnSessionRemoteConfigFailedCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionRemoteConfigFailedCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionRemoteConfigFailedCount.setDescription('The total number of failed remote config sessions since system start.')
stnSessionRemoteConfigCurrentCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionRemoteConfigCurrentCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionRemoteConfigCurrentCount.setDescription('The total number of current remote config sessions.')
stnSessionRemoteConfigCurrentActiveCount = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnSessionRemoteConfigCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts: stnSessionRemoteConfigCurrentActiveCount.setDescription('The total number of current active remote config sessions.')
stnGlobalSessionTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1), )
if mibBuilder.loadTexts: stnGlobalSessionTable.setStatus('current')
if mibBuilder.loadTexts: stnGlobalSessionTable.setDescription('A list of session entries with the box.')
stnGlobalSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1, 1), ).setIndexNames((0, "STN-SESSION-MIB", "stnGlobalSessionIndex"))
if mibBuilder.loadTexts: stnGlobalSessionEntry.setStatus('current')
if mibBuilder.loadTexts: stnGlobalSessionEntry.setDescription('Entry contains information about a particular session.')
stnGlobalSessionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: stnGlobalSessionIndex.setStatus('current')
if mibBuilder.loadTexts: stnGlobalSessionIndex.setDescription('A sequence number that identifies a session entry in the table.')
stnGlobalSessionOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("inactive", 1), ("active", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: stnGlobalSessionOperStatus.setStatus('current')
if mibBuilder.loadTexts: stnGlobalSessionOperStatus.setDescription('The operational status of the session.')
stnNotificationUsername = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnNotificationUsername.setStatus('current')
if mibBuilder.loadTexts: stnNotificationUsername.setDescription("The user's name associated with the trap.")
stnNotificationUserFailureType = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3, 2), StnUserFailureType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnNotificationUserFailureType.setStatus('current')
if mibBuilder.loadTexts: stnNotificationUserFailureType.setDescription('The type of user failure.')
stnNotificationConfigType = MibScalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3, 3), StnConfigFailureType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: stnNotificationConfigType.setStatus('current')
if mibBuilder.loadTexts: stnNotificationConfigType.setDescription('The type of configuration failure.')
stnUserFailure = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 17)).setObjects(("STN-ROUTER-MIB", "stnRouterIndex"), ("STN-SESSION-MIB", "stnNotificationUsername"), ("STN-SESSION-MIB", "stnNotificationUserFailureType"), ("STN-SESSION-MIB", "stnSessionType"))
if mibBuilder.loadTexts: stnUserFailure.setStatus('current')
if mibBuilder.loadTexts: stnUserFailure.setDescription('A stnUserFailure trap signifies that the agent entity has detected that a configuration failure has occurred. The generation of this trap can be controlled by the CommandLineIfaceTraps configuration object.')
stnConfigFailure = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 18)).setObjects(("STN-ROUTER-MIB", "stnRouterIndex"), ("STN-SESSION-MIB", "stnNotificationUsername"), ("STN-SESSION-MIB", "stnNotificationConfigType"))
if mibBuilder.loadTexts: stnConfigFailure.setStatus('current')
if mibBuilder.loadTexts: stnConfigFailure.setDescription('A stnConfigFailure trap signifies that the agent entity has detected that a configuration failure has occurred. The generation of this trap can be controlled by the CommandLineIfaceTraps configuration object.')
stnNoFlowEntriesAvailable = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 57)).setObjects(("STN-CHASSIS-MIB", "stnEngineIndex"), ("STN-CHASSIS-MIB", "stnEngineSlot"), ("STN-CHASSIS-MIB", "stnEngineCpu"))
if mibBuilder.loadTexts: stnNoFlowEntriesAvailable.setStatus('current')
if mibBuilder.loadTexts: stnNoFlowEntriesAvailable.setDescription('A stnNoFlowEntriesAvailable trap signifies that the agent entity has detected that the there are no more flow entries available on the indicated slot/cpu. This can occur if too many interfaces are assigned to an engine. The generation of this trap can be controlled by the SessionTraps configuration object.')
stnNoLayerIfsAvailable = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 58)).setObjects(("STN-CHASSIS-MIB", "stnEngineIndex"), ("STN-CHASSIS-MIB", "stnEngineSlot"), ("STN-CHASSIS-MIB", "stnEngineCpu"))
if mibBuilder.loadTexts: stnNoLayerIfsAvailable.setStatus('current')
if mibBuilder.loadTexts: stnNoLayerIfsAvailable.setDescription('A stnNoLayerIfsAvailable trap signifies that the agent entity has detected that the there are no more layer interfaces available on the indicated slot/cpu. This can occur if too many VCs are assigned to an engine. The generation of this trap can be controlled by the SessionTraps configuration object.')
stnMaxSessionLimitExceeded = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 59)).setObjects(("STN-CHASSIS-MIB", "stnEngineIndex"), ("STN-CHASSIS-MIB", "stnEngineSlot"), ("STN-CHASSIS-MIB", "stnEngineCpu"))
if mibBuilder.loadTexts: stnMaxSessionLimitExceeded.setStatus('current')
if mibBuilder.loadTexts: stnMaxSessionLimitExceeded.setDescription('A stnMaxSessionLimitExceeded trap signifies that the agent entity has detected that the maximum session limit has occurred on the indicated slot/cpu. The generation of this trap can be controlled by the SessionTraps configuration object.')
stnTunnelEngineLimitExceeded = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 60)).setObjects(("STN-CHASSIS-MIB", "stnEngineIndex"), ("STN-CHASSIS-MIB", "stnEngineSlot"), ("STN-CHASSIS-MIB", "stnEngineCpu"))
if mibBuilder.loadTexts: stnTunnelEngineLimitExceeded.setStatus('current')
if mibBuilder.loadTexts: stnTunnelEngineLimitExceeded.setDescription('A stnTunnelEngineLimitExceeded trap signifies that the agent entity has detected that the maximum tunnel limit has occurred on the indicated slot/cpu. The generation of this trap can be controlled by the SessionTraps configuration object.')
stnCallEngineLimitExceeded = NotificationType((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 61)).setObjects(("STN-CHASSIS-MIB", "stnEngineIndex"), ("STN-CHASSIS-MIB", "stnEngineSlot"), ("STN-CHASSIS-MIB", "stnEngineCpu"))
if mibBuilder.loadTexts: stnCallEngineLimitExceeded.setStatus('current')
if mibBuilder.loadTexts: stnCallEngineLimitExceeded.setDescription('A stnCallEngineLimitExceeded trap signifies that the agent entity has detected that the maximum call limit has occurred on the indicated slot/cpu. The generation of this trap can be controlled by the SessionTraps configuration object.')
mibBuilder.exportSymbols("STN-SESSION-MIB", stnSessionOperStatus=stnSessionOperStatus, stnSessionPppCurrentCount=stnSessionPppCurrentCount, stnGlobalSessionEntry=stnGlobalSessionEntry, stnSessionsEncaps=stnSessionsEncaps, stnSessionIpsecCurrentActiveCount=stnSessionIpsecCurrentActiveCount, stnSessionTable=stnSessionTable, stnNotificationUserFailureType=stnNotificationUserFailureType, stnSessionAggregateFailedCount=stnSessionAggregateFailedCount, stnMaxSessionLimitExceeded=stnMaxSessionLimitExceeded, stnSessionType=stnSessionType, stnSessionLastChange=stnSessionLastChange, stnSessionTelnetTotalCount=stnSessionTelnetTotalCount, stnSessionPppTotalCount=stnSessionPppTotalCount, stnSessionIkeCurrentActiveCount=stnSessionIkeCurrentActiveCount, stnUserFailure=stnUserFailure, stnSessionsAggregate=stnSessionsAggregate, stnSessionsTelnet=stnSessionsTelnet, stnSessionRemoteConfigTotalCount=stnSessionRemoteConfigTotalCount, stnSessionTrapVars=stnSessionTrapVars, stnSessionsPpp=stnSessionsPpp, stnSessionEncapsCurrentCount=stnSessionEncapsCurrentCount, SessionOperStatus=SessionOperStatus, stnSessionIpsecTotalCount=stnSessionIpsecTotalCount, stnNoFlowEntriesAvailable=stnNoFlowEntriesAvailable, stnSessionFtpAlgFailedCount=stnSessionFtpAlgFailedCount, stnSessionFtpAlgCurrentActiveCount=stnSessionFtpAlgCurrentActiveCount, stnSessionEncapsFailedCount=stnSessionEncapsFailedCount, stnSessionTelnetFailedCount=stnSessionTelnetFailedCount, stnSessionRemoteConfigCurrentActiveCount=stnSessionRemoteConfigCurrentActiveCount, stnSessionPppCurrentActiveCount=stnSessionPppCurrentActiveCount, stnSessionFtpAlgCurrentCount=stnSessionFtpAlgCurrentCount, stnSessionSecureUserCurrentCount=stnSessionSecureUserCurrentCount, stnSessionTelnetCurrentActiveCount=stnSessionTelnetCurrentActiveCount, stnSessionIndex=stnSessionIndex, stnSessionIkeCurrentCount=stnSessionIkeCurrentCount, stnSessionL2tpTunnelTotalCount=stnSessionL2tpTunnelTotalCount, stnSessionFtpAlgTotalCount=stnSessionFtpAlgTotalCount, stnSessionsSecureUser=stnSessionsSecureUser, stnSessionContext=stnSessionContext, stnSession=stnSession, stnConfigFailure=stnConfigFailure, stnSessionL2tpTunnelFailedCount=stnSessionL2tpTunnelFailedCount, stnSessionPptpTunnelCurrentCount=stnSessionPptpTunnelCurrentCount, stnSessionSecureUserCurrentActiveCount=stnSessionSecureUserCurrentActiveCount, stnSessions=stnSessions, stnSessionIkeFailedCount=stnSessionIkeFailedCount, stnSessionIkeTotalCount=stnSessionIkeTotalCount, stnCallEngineLimitExceeded=stnCallEngineLimitExceeded, stnSessionSecureUserTotalCount=stnSessionSecureUserTotalCount, stnSessionEncapsTotalCount=stnSessionEncapsTotalCount, PYSNMP_MODULE_ID=stnSessions, stnSessionConsoleFailedCount=stnSessionConsoleFailedCount, stnSessionRemoteConfigCurrentCount=stnSessionRemoteConfigCurrentCount, stnSessionTelnetCurrentCount=stnSessionTelnetCurrentCount, stnSessionPptpTunnelCurrentActiveCount=stnSessionPptpTunnelCurrentActiveCount, stnSessionRemoteConfigFailedCount=stnSessionRemoteConfigFailedCount, stnSessionAggregateCurrentActiveCount=stnSessionAggregateCurrentActiveCount, stnSessionsPptp=stnSessionsPptp, stnSessionFtpTotalCount=stnSessionFtpTotalCount, stnSessionFtpCurrentCount=stnSessionFtpCurrentCount, stnSessionPptpTunnelFailedCount=stnSessionPptpTunnelFailedCount, stnSessionIpsecFailedCount=stnSessionIpsecFailedCount, stnSessionMibConformance=stnSessionMibConformance, stnSessionIpsecCurrentCount=stnSessionIpsecCurrentCount, stnSessionsL2tp=stnSessionsL2tp, stnSessionPptpTunnelTotalCount=stnSessionPptpTunnelTotalCount, stnSessionsIke=stnSessionsIke, stnSessionConsoleCurrentActiveCount=stnSessionConsoleCurrentActiveCount, stnNoLayerIfsAvailable=stnNoLayerIfsAvailable, stnSessionsIpsec=stnSessionsIpsec, stnSessionFtpFailedCount=stnSessionFtpFailedCount, stnSessionsFtp=stnSessionsFtp, stnSessionsConsole=stnSessionsConsole, stnGlobalSession=stnGlobalSession, stnSessionFtpCurrentActiveCount=stnSessionFtpCurrentActiveCount, stnGlobalSessionOperStatus=stnGlobalSessionOperStatus, stnTunnelEngineLimitExceeded=stnTunnelEngineLimitExceeded, stnSessionsFtpAlg=stnSessionsFtpAlg, stnSessionL2tpTunnelCurrentCount=stnSessionL2tpTunnelCurrentCount, stnSessionAggregateCurrentCount=stnSessionAggregateCurrentCount, stnNotificationConfigType=stnNotificationConfigType, stnSessionConsoleTotalCount=stnSessionConsoleTotalCount, stnNotificationUsername=stnNotificationUsername, stnSessionsRemoteConfig=stnSessionsRemoteConfig, stnSessionObjects=stnSessionObjects, stnSessionEntry=stnSessionEntry, stnSessionL2tpTunnelCurrentActiveCount=stnSessionL2tpTunnelCurrentActiveCount, stnGlobalSessionIndex=stnGlobalSessionIndex, stnSessionAggregateTotalCount=stnSessionAggregateTotalCount, stnSessionPppFailedCount=stnSessionPppFailedCount, stnSessionSecureUserFailedCount=stnSessionSecureUserFailedCount, stnSessionEncapsCurrentActiveCount=stnSessionEncapsCurrentActiveCount, stnGlobalSessionTable=stnGlobalSessionTable, stnSessionConsoleCurrentCount=stnSessionConsoleCurrentCount)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(bits, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, iso, gauge32, mib_identifier, time_ticks, integer32, counter64, ip_address, unsigned32, object_identity, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'iso', 'Gauge32', 'MibIdentifier', 'TimeTicks', 'Integer32', 'Counter64', 'IpAddress', 'Unsigned32', 'ObjectIdentity', 'ModuleIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
(stn_systems, stn_notification) = mibBuilder.importSymbols('SPRING-TIDE-NETWORKS-SMI', 'stnSystems', 'stnNotification')
(stn_user_failure_type, stn_config_failure_type) = mibBuilder.importSymbols('SPRING-TIDE-NETWORKS-TC', 'StnUserFailureType', 'StnConfigFailureType')
(stn_engine_cpu, stn_engine_index, stn_engine_slot) = mibBuilder.importSymbols('STN-CHASSIS-MIB', 'stnEngineCpu', 'stnEngineIndex', 'stnEngineSlot')
(stn_router_index,) = mibBuilder.importSymbols('STN-ROUTER-MIB', 'stnRouterIndex')
stn_sessions = module_identity((1, 3, 6, 1, 4, 1, 3551, 2, 5))
if mibBuilder.loadTexts:
stnSessions.setLastUpdated('0002160000Z')
if mibBuilder.loadTexts:
stnSessions.setOrganization('Spring Tide Networks, Inc.')
if mibBuilder.loadTexts:
stnSessions.setContactInfo(' Spring Tide Networks, Inc. Customer Service Postal: 3 Clock Tower Place Maynard, MA 01754 Tel: 1 888-786-4357 Email: stncs@springtidenet.com ')
if mibBuilder.loadTexts:
stnSessions.setDescription('This MIB module describes Spring Tide Networks session objects.')
stn_session_objects = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1))
stn_session_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 2))
stn_session_trap_vars = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3))
stn_session = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1))
stn_global_session = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2))
stn_sessions_ppp = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2))
stn_sessions_l2tp = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3))
stn_sessions_pptp = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4))
stn_sessions_ipsec = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5))
stn_sessions_ike = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6))
stn_sessions_telnet = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7))
stn_sessions_ftp = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8))
stn_sessions_ftp_alg = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9))
stn_sessions_console = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10))
stn_sessions_aggregate = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11))
stn_sessions_encaps = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12))
stn_sessions_secure_user = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13))
stn_sessions_remote_config = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14))
class Sessionoperstatus(TextualConvention, Integer32):
description = 'Operational status of a session.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5))
named_values = named_values(('unknown', 1), ('inactive', 2), ('pend-active', 3), ('active', 4), ('pend-inactive', 5))
stn_session_table = mib_table((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1))
if mibBuilder.loadTexts:
stnSessionTable.setStatus('current')
if mibBuilder.loadTexts:
stnSessionTable.setDescription('A list of session entries.')
stn_session_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1)).setIndexNames((0, 'STN-SESSION-MIB', 'stnSessionIndex'))
if mibBuilder.loadTexts:
stnSessionEntry.setStatus('current')
if mibBuilder.loadTexts:
stnSessionEntry.setDescription('Entry contains information about a particular session.')
stn_session_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIndex.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIndex.setDescription('A sequence number that identifies a session entry in the table.')
stn_session_type = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))).clone(namedValues=named_values(('unknown', 1), ('ppp', 2), ('l2tp-tunnel', 3), ('pptp-tunnel', 4), ('ipsec', 5), ('ike', 6), ('telnet', 7), ('ftp', 8), ('ftp-alg', 9), ('console', 10), ('encaps', 11), ('secure-user', 12), ('remote-config', 13)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionType.setStatus('current')
if mibBuilder.loadTexts:
stnSessionType.setDescription('Indicates the session type.')
stn_session_context = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionContext.setStatus('current')
if mibBuilder.loadTexts:
stnSessionContext.setDescription('A unique context identifier associated with the session.')
stn_session_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 4), session_oper_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionOperStatus.setStatus('current')
if mibBuilder.loadTexts:
stnSessionOperStatus.setDescription('The operational status of the session.')
stn_session_last_change = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 1, 1, 5), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionLastChange.setStatus('current')
if mibBuilder.loadTexts:
stnSessionLastChange.setDescription('The value of sysUpTime at the time the session entered its current operational state.')
stn_session_ppp_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPppTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPppTotalCount.setDescription('The total number of PPP sessions since system start.')
stn_session_ppp_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPppFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPppFailedCount.setDescription('The total number of failed sessions since system start.')
stn_session_ppp_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPppCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPppCurrentCount.setDescription('The total number of current PPP sessions.')
stn_session_ppp_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 2, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPppCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPppCurrentActiveCount.setDescription('The total number of current active PPP sessions.')
stn_session_l2tp_tunnel_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelTotalCount.setDescription('The total number of L2TP tunnel sessions since system start.')
stn_session_l2tp_tunnel_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelFailedCount.setDescription('The total number of failed L2TP tunnel sessions since system start.')
stn_session_l2tp_tunnel_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelCurrentCount.setDescription('The total number of current L2TP tunnel sessions.')
stn_session_l2tp_tunnel_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 3, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionL2tpTunnelCurrentActiveCount.setDescription('The total number of current active L2TP tunnel sessions.')
stn_session_pptp_tunnel_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPptpTunnelTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPptpTunnelTotalCount.setDescription('The total number of PPTP tunnel sessions since system start.')
stn_session_pptp_tunnel_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPptpTunnelFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPptpTunnelFailedCount.setDescription('The total number of failed PPTP tunnel sessions since system start.')
stn_session_pptp_tunnel_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPptpTunnelCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPptpTunnelCurrentCount.setDescription('The total number of current PPTP tunnel sessions.')
stn_session_pptp_tunnel_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 4, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionPptpTunnelCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionPptpTunnelCurrentActiveCount.setDescription('The total number of current active PPTP tunnel sessions.')
stn_session_ipsec_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIpsecTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIpsecTotalCount.setDescription('The total number of IPSEC sessions since system start.')
stn_session_ipsec_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIpsecFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIpsecFailedCount.setDescription('The total number of failed IPSEC sessions since system start.')
stn_session_ipsec_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIpsecCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIpsecCurrentCount.setDescription('The total number of current IPSEC sessions.')
stn_session_ipsec_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 5, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIpsecCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIpsecCurrentActiveCount.setDescription('The total number of current active IPSEC sessions.')
stn_session_ike_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIkeTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIkeTotalCount.setDescription('The total number of IKE sessions since system start.')
stn_session_ike_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIkeFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIkeFailedCount.setDescription('The total number of failed IKE sessions since system start.')
stn_session_ike_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIkeCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIkeCurrentCount.setDescription('The total number of current IKE sessions.')
stn_session_ike_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 6, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionIkeCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionIkeCurrentActiveCount.setDescription('The total number of current active IKE sessions.')
stn_session_telnet_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionTelnetTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionTelnetTotalCount.setDescription('The total number of Telnet sessions since system start.')
stn_session_telnet_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionTelnetFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionTelnetFailedCount.setDescription('The total number of failed Telnet sessions since system start.')
stn_session_telnet_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionTelnetCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionTelnetCurrentCount.setDescription('The total number of current Telnet sessions.')
stn_session_telnet_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 7, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionTelnetCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionTelnetCurrentActiveCount.setDescription('The total number of current active Telnet sessions.')
stn_session_ftp_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpTotalCount.setDescription('The total number of FTP sessions since system start.')
stn_session_ftp_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpFailedCount.setDescription('The total number of failed FTP sessions since system start.')
stn_session_ftp_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpCurrentCount.setDescription('The total number of current FTP sessions.')
stn_session_ftp_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 8, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpCurrentActiveCount.setDescription('The total number of current active FTP sessions.')
stn_session_ftp_alg_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpAlgTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpAlgTotalCount.setDescription('The total number of FTP-ALG sessions since system start.')
stn_session_ftp_alg_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpAlgFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpAlgFailedCount.setDescription('The total number of failed FTP-ALG sessions since system start.')
stn_session_ftp_alg_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpAlgCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpAlgCurrentCount.setDescription('The total number of current FTP-ALG sessions.')
stn_session_ftp_alg_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 9, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionFtpAlgCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionFtpAlgCurrentActiveCount.setDescription('The total number of current active FTP-ALG sessions.')
stn_session_console_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionConsoleTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionConsoleTotalCount.setDescription('The total number of console sessions since system start.')
stn_session_console_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionConsoleFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionConsoleFailedCount.setDescription('The total number of failed console sessions since system start.')
stn_session_console_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionConsoleCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionConsoleCurrentCount.setDescription('The total number of current console sessions.')
stn_session_console_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 10, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionConsoleCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionConsoleCurrentActiveCount.setDescription('The total number of current active console sessions.')
stn_session_aggregate_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionAggregateTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionAggregateTotalCount.setDescription('The total number of sessions since system start.')
stn_session_aggregate_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionAggregateFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionAggregateFailedCount.setDescription('The total number of failed sessions since system start.')
stn_session_aggregate_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionAggregateCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionAggregateCurrentCount.setDescription('The total number of current sessions.')
stn_session_aggregate_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 11, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionAggregateCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionAggregateCurrentActiveCount.setDescription('The total number of current active sessions.')
stn_session_encaps_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionEncapsTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionEncapsTotalCount.setDescription('The total number of encaps sessions since system start.')
stn_session_encaps_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionEncapsFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionEncapsFailedCount.setDescription('The total number of failed encaps sessions since system start.')
stn_session_encaps_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionEncapsCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionEncapsCurrentCount.setDescription('The total number of current encaps sessions.')
stn_session_encaps_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 12, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionEncapsCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionEncapsCurrentActiveCount.setDescription('The total number of current active encaps sessions.')
stn_session_secure_user_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionSecureUserTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionSecureUserTotalCount.setDescription('The total number of secure user sessions since system start.')
stn_session_secure_user_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionSecureUserFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionSecureUserFailedCount.setDescription('The total number of failed secure user sessions since system start.')
stn_session_secure_user_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionSecureUserCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionSecureUserCurrentCount.setDescription('The total number of current secure user sessions.')
stn_session_secure_user_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 13, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionSecureUserCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionSecureUserCurrentActiveCount.setDescription('The total number of current active secure user sessions.')
stn_session_remote_config_total_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionRemoteConfigTotalCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionRemoteConfigTotalCount.setDescription('The total number of remote config sessions since system start.')
stn_session_remote_config_failed_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionRemoteConfigFailedCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionRemoteConfigFailedCount.setDescription('The total number of failed remote config sessions since system start.')
stn_session_remote_config_current_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionRemoteConfigCurrentCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionRemoteConfigCurrentCount.setDescription('The total number of current remote config sessions.')
stn_session_remote_config_current_active_count = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 1, 14, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnSessionRemoteConfigCurrentActiveCount.setStatus('current')
if mibBuilder.loadTexts:
stnSessionRemoteConfigCurrentActiveCount.setDescription('The total number of current active remote config sessions.')
stn_global_session_table = mib_table((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1))
if mibBuilder.loadTexts:
stnGlobalSessionTable.setStatus('current')
if mibBuilder.loadTexts:
stnGlobalSessionTable.setDescription('A list of session entries with the box.')
stn_global_session_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1, 1)).setIndexNames((0, 'STN-SESSION-MIB', 'stnGlobalSessionIndex'))
if mibBuilder.loadTexts:
stnGlobalSessionEntry.setStatus('current')
if mibBuilder.loadTexts:
stnGlobalSessionEntry.setDescription('Entry contains information about a particular session.')
stn_global_session_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
stnGlobalSessionIndex.setStatus('current')
if mibBuilder.loadTexts:
stnGlobalSessionIndex.setDescription('A sequence number that identifies a session entry in the table.')
stn_global_session_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 5, 1, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('inactive', 1), ('active', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
stnGlobalSessionOperStatus.setStatus('current')
if mibBuilder.loadTexts:
stnGlobalSessionOperStatus.setDescription('The operational status of the session.')
stn_notification_username = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3, 1), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnNotificationUsername.setStatus('current')
if mibBuilder.loadTexts:
stnNotificationUsername.setDescription("The user's name associated with the trap.")
stn_notification_user_failure_type = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3, 2), stn_user_failure_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnNotificationUserFailureType.setStatus('current')
if mibBuilder.loadTexts:
stnNotificationUserFailureType.setDescription('The type of user failure.')
stn_notification_config_type = mib_scalar((1, 3, 6, 1, 4, 1, 3551, 2, 5, 3, 3), stn_config_failure_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
stnNotificationConfigType.setStatus('current')
if mibBuilder.loadTexts:
stnNotificationConfigType.setDescription('The type of configuration failure.')
stn_user_failure = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 17)).setObjects(('STN-ROUTER-MIB', 'stnRouterIndex'), ('STN-SESSION-MIB', 'stnNotificationUsername'), ('STN-SESSION-MIB', 'stnNotificationUserFailureType'), ('STN-SESSION-MIB', 'stnSessionType'))
if mibBuilder.loadTexts:
stnUserFailure.setStatus('current')
if mibBuilder.loadTexts:
stnUserFailure.setDescription('A stnUserFailure trap signifies that the agent entity has detected that a configuration failure has occurred. The generation of this trap can be controlled by the CommandLineIfaceTraps configuration object.')
stn_config_failure = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 18)).setObjects(('STN-ROUTER-MIB', 'stnRouterIndex'), ('STN-SESSION-MIB', 'stnNotificationUsername'), ('STN-SESSION-MIB', 'stnNotificationConfigType'))
if mibBuilder.loadTexts:
stnConfigFailure.setStatus('current')
if mibBuilder.loadTexts:
stnConfigFailure.setDescription('A stnConfigFailure trap signifies that the agent entity has detected that a configuration failure has occurred. The generation of this trap can be controlled by the CommandLineIfaceTraps configuration object.')
stn_no_flow_entries_available = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 57)).setObjects(('STN-CHASSIS-MIB', 'stnEngineIndex'), ('STN-CHASSIS-MIB', 'stnEngineSlot'), ('STN-CHASSIS-MIB', 'stnEngineCpu'))
if mibBuilder.loadTexts:
stnNoFlowEntriesAvailable.setStatus('current')
if mibBuilder.loadTexts:
stnNoFlowEntriesAvailable.setDescription('A stnNoFlowEntriesAvailable trap signifies that the agent entity has detected that the there are no more flow entries available on the indicated slot/cpu. This can occur if too many interfaces are assigned to an engine. The generation of this trap can be controlled by the SessionTraps configuration object.')
stn_no_layer_ifs_available = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 58)).setObjects(('STN-CHASSIS-MIB', 'stnEngineIndex'), ('STN-CHASSIS-MIB', 'stnEngineSlot'), ('STN-CHASSIS-MIB', 'stnEngineCpu'))
if mibBuilder.loadTexts:
stnNoLayerIfsAvailable.setStatus('current')
if mibBuilder.loadTexts:
stnNoLayerIfsAvailable.setDescription('A stnNoLayerIfsAvailable trap signifies that the agent entity has detected that the there are no more layer interfaces available on the indicated slot/cpu. This can occur if too many VCs are assigned to an engine. The generation of this trap can be controlled by the SessionTraps configuration object.')
stn_max_session_limit_exceeded = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 59)).setObjects(('STN-CHASSIS-MIB', 'stnEngineIndex'), ('STN-CHASSIS-MIB', 'stnEngineSlot'), ('STN-CHASSIS-MIB', 'stnEngineCpu'))
if mibBuilder.loadTexts:
stnMaxSessionLimitExceeded.setStatus('current')
if mibBuilder.loadTexts:
stnMaxSessionLimitExceeded.setDescription('A stnMaxSessionLimitExceeded trap signifies that the agent entity has detected that the maximum session limit has occurred on the indicated slot/cpu. The generation of this trap can be controlled by the SessionTraps configuration object.')
stn_tunnel_engine_limit_exceeded = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 60)).setObjects(('STN-CHASSIS-MIB', 'stnEngineIndex'), ('STN-CHASSIS-MIB', 'stnEngineSlot'), ('STN-CHASSIS-MIB', 'stnEngineCpu'))
if mibBuilder.loadTexts:
stnTunnelEngineLimitExceeded.setStatus('current')
if mibBuilder.loadTexts:
stnTunnelEngineLimitExceeded.setDescription('A stnTunnelEngineLimitExceeded trap signifies that the agent entity has detected that the maximum tunnel limit has occurred on the indicated slot/cpu. The generation of this trap can be controlled by the SessionTraps configuration object.')
stn_call_engine_limit_exceeded = notification_type((1, 3, 6, 1, 4, 1, 3551, 2, 100, 0, 61)).setObjects(('STN-CHASSIS-MIB', 'stnEngineIndex'), ('STN-CHASSIS-MIB', 'stnEngineSlot'), ('STN-CHASSIS-MIB', 'stnEngineCpu'))
if mibBuilder.loadTexts:
stnCallEngineLimitExceeded.setStatus('current')
if mibBuilder.loadTexts:
stnCallEngineLimitExceeded.setDescription('A stnCallEngineLimitExceeded trap signifies that the agent entity has detected that the maximum call limit has occurred on the indicated slot/cpu. The generation of this trap can be controlled by the SessionTraps configuration object.')
mibBuilder.exportSymbols('STN-SESSION-MIB', stnSessionOperStatus=stnSessionOperStatus, stnSessionPppCurrentCount=stnSessionPppCurrentCount, stnGlobalSessionEntry=stnGlobalSessionEntry, stnSessionsEncaps=stnSessionsEncaps, stnSessionIpsecCurrentActiveCount=stnSessionIpsecCurrentActiveCount, stnSessionTable=stnSessionTable, stnNotificationUserFailureType=stnNotificationUserFailureType, stnSessionAggregateFailedCount=stnSessionAggregateFailedCount, stnMaxSessionLimitExceeded=stnMaxSessionLimitExceeded, stnSessionType=stnSessionType, stnSessionLastChange=stnSessionLastChange, stnSessionTelnetTotalCount=stnSessionTelnetTotalCount, stnSessionPppTotalCount=stnSessionPppTotalCount, stnSessionIkeCurrentActiveCount=stnSessionIkeCurrentActiveCount, stnUserFailure=stnUserFailure, stnSessionsAggregate=stnSessionsAggregate, stnSessionsTelnet=stnSessionsTelnet, stnSessionRemoteConfigTotalCount=stnSessionRemoteConfigTotalCount, stnSessionTrapVars=stnSessionTrapVars, stnSessionsPpp=stnSessionsPpp, stnSessionEncapsCurrentCount=stnSessionEncapsCurrentCount, SessionOperStatus=SessionOperStatus, stnSessionIpsecTotalCount=stnSessionIpsecTotalCount, stnNoFlowEntriesAvailable=stnNoFlowEntriesAvailable, stnSessionFtpAlgFailedCount=stnSessionFtpAlgFailedCount, stnSessionFtpAlgCurrentActiveCount=stnSessionFtpAlgCurrentActiveCount, stnSessionEncapsFailedCount=stnSessionEncapsFailedCount, stnSessionTelnetFailedCount=stnSessionTelnetFailedCount, stnSessionRemoteConfigCurrentActiveCount=stnSessionRemoteConfigCurrentActiveCount, stnSessionPppCurrentActiveCount=stnSessionPppCurrentActiveCount, stnSessionFtpAlgCurrentCount=stnSessionFtpAlgCurrentCount, stnSessionSecureUserCurrentCount=stnSessionSecureUserCurrentCount, stnSessionTelnetCurrentActiveCount=stnSessionTelnetCurrentActiveCount, stnSessionIndex=stnSessionIndex, stnSessionIkeCurrentCount=stnSessionIkeCurrentCount, stnSessionL2tpTunnelTotalCount=stnSessionL2tpTunnelTotalCount, stnSessionFtpAlgTotalCount=stnSessionFtpAlgTotalCount, stnSessionsSecureUser=stnSessionsSecureUser, stnSessionContext=stnSessionContext, stnSession=stnSession, stnConfigFailure=stnConfigFailure, stnSessionL2tpTunnelFailedCount=stnSessionL2tpTunnelFailedCount, stnSessionPptpTunnelCurrentCount=stnSessionPptpTunnelCurrentCount, stnSessionSecureUserCurrentActiveCount=stnSessionSecureUserCurrentActiveCount, stnSessions=stnSessions, stnSessionIkeFailedCount=stnSessionIkeFailedCount, stnSessionIkeTotalCount=stnSessionIkeTotalCount, stnCallEngineLimitExceeded=stnCallEngineLimitExceeded, stnSessionSecureUserTotalCount=stnSessionSecureUserTotalCount, stnSessionEncapsTotalCount=stnSessionEncapsTotalCount, PYSNMP_MODULE_ID=stnSessions, stnSessionConsoleFailedCount=stnSessionConsoleFailedCount, stnSessionRemoteConfigCurrentCount=stnSessionRemoteConfigCurrentCount, stnSessionTelnetCurrentCount=stnSessionTelnetCurrentCount, stnSessionPptpTunnelCurrentActiveCount=stnSessionPptpTunnelCurrentActiveCount, stnSessionRemoteConfigFailedCount=stnSessionRemoteConfigFailedCount, stnSessionAggregateCurrentActiveCount=stnSessionAggregateCurrentActiveCount, stnSessionsPptp=stnSessionsPptp, stnSessionFtpTotalCount=stnSessionFtpTotalCount, stnSessionFtpCurrentCount=stnSessionFtpCurrentCount, stnSessionPptpTunnelFailedCount=stnSessionPptpTunnelFailedCount, stnSessionIpsecFailedCount=stnSessionIpsecFailedCount, stnSessionMibConformance=stnSessionMibConformance, stnSessionIpsecCurrentCount=stnSessionIpsecCurrentCount, stnSessionsL2tp=stnSessionsL2tp, stnSessionPptpTunnelTotalCount=stnSessionPptpTunnelTotalCount, stnSessionsIke=stnSessionsIke, stnSessionConsoleCurrentActiveCount=stnSessionConsoleCurrentActiveCount, stnNoLayerIfsAvailable=stnNoLayerIfsAvailable, stnSessionsIpsec=stnSessionsIpsec, stnSessionFtpFailedCount=stnSessionFtpFailedCount, stnSessionsFtp=stnSessionsFtp, stnSessionsConsole=stnSessionsConsole, stnGlobalSession=stnGlobalSession, stnSessionFtpCurrentActiveCount=stnSessionFtpCurrentActiveCount, stnGlobalSessionOperStatus=stnGlobalSessionOperStatus, stnTunnelEngineLimitExceeded=stnTunnelEngineLimitExceeded, stnSessionsFtpAlg=stnSessionsFtpAlg, stnSessionL2tpTunnelCurrentCount=stnSessionL2tpTunnelCurrentCount, stnSessionAggregateCurrentCount=stnSessionAggregateCurrentCount, stnNotificationConfigType=stnNotificationConfigType, stnSessionConsoleTotalCount=stnSessionConsoleTotalCount, stnNotificationUsername=stnNotificationUsername, stnSessionsRemoteConfig=stnSessionsRemoteConfig, stnSessionObjects=stnSessionObjects, stnSessionEntry=stnSessionEntry, stnSessionL2tpTunnelCurrentActiveCount=stnSessionL2tpTunnelCurrentActiveCount, stnGlobalSessionIndex=stnGlobalSessionIndex, stnSessionAggregateTotalCount=stnSessionAggregateTotalCount, stnSessionPppFailedCount=stnSessionPppFailedCount, stnSessionSecureUserFailedCount=stnSessionSecureUserFailedCount, stnSessionEncapsCurrentActiveCount=stnSessionEncapsCurrentActiveCount, stnGlobalSessionTable=stnGlobalSessionTable, stnSessionConsoleCurrentCount=stnSessionConsoleCurrentCount) |
msg = "No Smoking here"
print(len(msg))
msg.count('o')
msg.count('s',3,5)
msg.count('n')
msg.count('N')
msg.count('O',7)
msg.count('o',7)
msg.count('o',1,7)
msg.count('o',7,15) | msg = 'No Smoking here'
print(len(msg))
msg.count('o')
msg.count('s', 3, 5)
msg.count('n')
msg.count('N')
msg.count('O', 7)
msg.count('o', 7)
msg.count('o', 1, 7)
msg.count('o', 7, 15) |
definition = [
{
"project_name" : "Project1",
"end_points": [
{
"local_development": "http://localhost:8066/",
"local_team_development": "http://192.168.5.217:8066/"
}
],
"api_end_point_partial_path": "api/"
}
]
| definition = [{'project_name': 'Project1', 'end_points': [{'local_development': 'http://localhost:8066/', 'local_team_development': 'http://192.168.5.217:8066/'}], 'api_end_point_partial_path': 'api/'}] |
print('----- range(3) -----')
print(range(3))
for x in range(3): print(x)
print('----- range(3, 10) -----')
print(range(3, 10))
for x in range(3, 10): print(x)
print('----- range(-3) -----')
print(range(-3))
for x in range(-3): print(x)
print('----- range(0,-3) -----')
print(range(0,-3))
for x in range(0,-3): print(x)
print('----- range(-3,0) -----')
print(range(-3,0))
for x in range(-3,0): print(x)
print('----- range(0,-3,-1) -----')
print(range(0,-3,-1))
for x in range(0,-3,-1): print(x)
| print('----- range(3) -----')
print(range(3))
for x in range(3):
print(x)
print('----- range(3, 10) -----')
print(range(3, 10))
for x in range(3, 10):
print(x)
print('----- range(-3) -----')
print(range(-3))
for x in range(-3):
print(x)
print('----- range(0,-3) -----')
print(range(0, -3))
for x in range(0, -3):
print(x)
print('----- range(-3,0) -----')
print(range(-3, 0))
for x in range(-3, 0):
print(x)
print('----- range(0,-3,-1) -----')
print(range(0, -3, -1))
for x in range(0, -3, -1):
print(x) |
# leetcode
class Solution:
def reverse(self, x: int) -> int:
str_x = str(x)
if str_x[:1] == "-":
isNeg = True
str_x = str_x[1:]
else:
isNeg = False
str_x = str_x[::-1]
new_x = int(str_x)
if isNeg:
new_x *= -1
if new_x < 2**31 * -1 or new_x > 2**31:
return 0
else:
return new_x
| class Solution:
def reverse(self, x: int) -> int:
str_x = str(x)
if str_x[:1] == '-':
is_neg = True
str_x = str_x[1:]
else:
is_neg = False
str_x = str_x[::-1]
new_x = int(str_x)
if isNeg:
new_x *= -1
if new_x < 2 ** 31 * -1 or new_x > 2 ** 31:
return 0
else:
return new_x |
# -*- coding: utf-8 -*-
class UnknownServiceEnvironmentNotConfiguredError(Exception):
"""
Raised when unknown service-environment is not configured for plugin.
"""
pass
| class Unknownserviceenvironmentnotconfigurederror(Exception):
"""
Raised when unknown service-environment is not configured for plugin.
"""
pass |
n = input()
# Reading first list
list1 = list(map(int, input().split()))
# Reading second list then to set
set1 = set(list(map(int, input().split())))
set2 = set(list(map(int, input().split())))
count = 0
# Looping through elements in
for el in list1:
# checking the element existence Set
if el in set1:
count += 1
elif el in set2:
count -= 1
print(count) | n = input()
list1 = list(map(int, input().split()))
set1 = set(list(map(int, input().split())))
set2 = set(list(map(int, input().split())))
count = 0
for el in list1:
if el in set1:
count += 1
elif el in set2:
count -= 1
print(count) |
pairs = {1: "apple",
"orange": [2,3,5],
True:False,
None:"True",
}
print(pairs.get("orange"))
print(pairs.get(7))
print(pairs.get(12345, "not in dictionary")) | pairs = {1: 'apple', 'orange': [2, 3, 5], True: False, None: 'True'}
print(pairs.get('orange'))
print(pairs.get(7))
print(pairs.get(12345, 'not in dictionary')) |
main = [{'category': 'Transfer Limits',
'field': [{'name': 'tx_transfer_min',
'title': 'Minimum amount a user can transfer per transaction',
'note': 'Default is set to zero.'},
{'name': 'tx_transfer_max_day',
'title': 'Maximum total amount a user can transfer per day',
'note': 'Default is set to unlimited.'},
{'name': 'tx_transfer_max_month',
'title': 'Maximum total amount a user can transfer per month',
'note': 'Default is set to unlimited.'}]},
{'category': 'Withdrawal Limits',
'field': [{'name': 'tx_withdraw_min',
'title': 'Minimum amount a user can withdraw per transaction',
'note': 'Default is set to zero.'},
{'name': 'tx_withdraw_max_day',
'title': 'Maximum total amount a user can withdraw per day',
'note': 'Default is set to unlimited.'},
{'name': 'tx_withdraw_max_month',
'title': 'Maximum total amount a user can withdraw per month',
'note': 'Default is set to unlimited.'}]},
{'category': 'Deposit Limits',
'field': [{'name': 'tx_deposit_min',
'title': 'Minimum amount a user can deposit per transaction',
'note': 'Default is set to zero.'},
{'name': 'tx_deposit_max_day',
'title': 'Maximum amount a user can deposit per day',
'note': 'Default is set to unlimited.'},
{'name': 'tx_deposit_max_month',
'title': 'Maximum amount a user can deposit per month',
'note': 'Default is set to unlimited.'},
]}]
template_list = main
def choice_list():
c = []
for l in main:
for i in l['field']:
c.append([i['name'], i['name']])
t = tuple(tuple(x) for x in c)
return t
| main = [{'category': 'Transfer Limits', 'field': [{'name': 'tx_transfer_min', 'title': 'Minimum amount a user can transfer per transaction', 'note': 'Default is set to zero.'}, {'name': 'tx_transfer_max_day', 'title': 'Maximum total amount a user can transfer per day', 'note': 'Default is set to unlimited.'}, {'name': 'tx_transfer_max_month', 'title': 'Maximum total amount a user can transfer per month', 'note': 'Default is set to unlimited.'}]}, {'category': 'Withdrawal Limits', 'field': [{'name': 'tx_withdraw_min', 'title': 'Minimum amount a user can withdraw per transaction', 'note': 'Default is set to zero.'}, {'name': 'tx_withdraw_max_day', 'title': 'Maximum total amount a user can withdraw per day', 'note': 'Default is set to unlimited.'}, {'name': 'tx_withdraw_max_month', 'title': 'Maximum total amount a user can withdraw per month', 'note': 'Default is set to unlimited.'}]}, {'category': 'Deposit Limits', 'field': [{'name': 'tx_deposit_min', 'title': 'Minimum amount a user can deposit per transaction', 'note': 'Default is set to zero.'}, {'name': 'tx_deposit_max_day', 'title': 'Maximum amount a user can deposit per day', 'note': 'Default is set to unlimited.'}, {'name': 'tx_deposit_max_month', 'title': 'Maximum amount a user can deposit per month', 'note': 'Default is set to unlimited.'}]}]
template_list = main
def choice_list():
c = []
for l in main:
for i in l['field']:
c.append([i['name'], i['name']])
t = tuple((tuple(x) for x in c))
return t |
# Author: Luke Hindman
# Date: Tue Oct 24 13:10:06 MDT 2017
# Description: In-class example for user input and lists
# Create an empty grocery list
groceryList = []
# Shopping list loop
done = False
while done == False:
# Prompt the user for an item to add to the list
item = input("Please enter an item or done when finished: ")
# Check if user is done entering items,
# otherwise add the item to the grocery list
if item.lower() == "done":
done = True
else:
groceryList.append(item)
# Print the grocery list
for g in groceryList:
print ("Don't forget the " + g + "!")
| grocery_list = []
done = False
while done == False:
item = input('Please enter an item or done when finished: ')
if item.lower() == 'done':
done = True
else:
groceryList.append(item)
for g in groceryList:
print("Don't forget the " + g + '!') |
space = [[1 for _ in range(21)] for _ in range(21)]
for x in range(1,21):
for y in range(1,21):
space[x][y] = space[x-1][y] + space[x][y-1]
print(space[20][20])
| space = [[1 for _ in range(21)] for _ in range(21)]
for x in range(1, 21):
for y in range(1, 21):
space[x][y] = space[x - 1][y] + space[x][y - 1]
print(space[20][20]) |
#4.6
def computepay(h,r):
# ( 40 hours * normal rate ) + (( overtime hours ) * time-and-a-half rate)
if(h>40):
p = ( 40 * r ) + (( h - 40 ) * 1.5 * r)
return p
else:
p = h * r
return p
hours = float(input("Enter Hours: "))
rate = float(input("Enter Rate per hour: "))
pay = computepay(hours, rate)
print("Pay", pay) | def computepay(h, r):
if h > 40:
p = 40 * r + (h - 40) * 1.5 * r
return p
else:
p = h * r
return p
hours = float(input('Enter Hours: '))
rate = float(input('Enter Rate per hour: '))
pay = computepay(hours, rate)
print('Pay', pay) |
class CellCountMissingCellsException(Exception):
pass
class UnknownAtlasValue(Exception):
pass
def atlas_value_to_structure_id(atlas_value, structures_reference_df):
line = structures_reference_df[
structures_reference_df["id"] == atlas_value
]
if len(line) == 0:
raise UnknownAtlasValue(atlas_value)
structure_id = line["structure_id_path"].values[0]
return structure_id
def atlas_value_to_name(atlas_value, structures_reference_df):
line = structures_reference_df[
structures_reference_df["id"] == atlas_value
]
if len(line) == 0:
raise UnknownAtlasValue(atlas_value)
name = line["name"]
return str(name.values[0])
| class Cellcountmissingcellsexception(Exception):
pass
class Unknownatlasvalue(Exception):
pass
def atlas_value_to_structure_id(atlas_value, structures_reference_df):
line = structures_reference_df[structures_reference_df['id'] == atlas_value]
if len(line) == 0:
raise unknown_atlas_value(atlas_value)
structure_id = line['structure_id_path'].values[0]
return structure_id
def atlas_value_to_name(atlas_value, structures_reference_df):
line = structures_reference_df[structures_reference_df['id'] == atlas_value]
if len(line) == 0:
raise unknown_atlas_value(atlas_value)
name = line['name']
return str(name.values[0]) |
x = 'abc'
x = "abc"
x = r'abc'
x = 'abc' \
'def'
x = ('abc'
'def')
x = 'ab"c'
x = "ab'c"
x = '''ab'c'''
| x = 'abc'
x = 'abc'
x = 'abc'
x = 'abcdef'
x = 'abcdef'
x = 'ab"c'
x = "ab'c"
x = "ab'c" |
class DefaultConfig (object) :
root_raw_train_data = 'path to be filled' # downloaded training data root
root_raw_eval_data = 'path to be filled' # downloaded evaluation/testing data root
root_dataset_file = './dataset/' # preprocessed dataset root
root_train_volume = './dataset/train/' # preprocessed training dataset root
root_eval_volume = './dataset/eval/' # preprocessed evaluation/testing dataset root
root_exp_file = './exp/' # training exp root
root_submit_file = './submit/' # submit file root
root_pred_dcm = 'path to be filled' # prediction array root
root_pred_save = 'path to be filled' # prediction result root
root_model_param = './params.pkl' # reference model parameter root
use_gpu = True
batch_size = 2
max_epoch = 1
learning_rate = 1e-3
decay_LR = (5, 0.1)
opt = DefaultConfig() | class Defaultconfig(object):
root_raw_train_data = 'path to be filled'
root_raw_eval_data = 'path to be filled'
root_dataset_file = './dataset/'
root_train_volume = './dataset/train/'
root_eval_volume = './dataset/eval/'
root_exp_file = './exp/'
root_submit_file = './submit/'
root_pred_dcm = 'path to be filled'
root_pred_save = 'path to be filled'
root_model_param = './params.pkl'
use_gpu = True
batch_size = 2
max_epoch = 1
learning_rate = 0.001
decay_lr = (5, 0.1)
opt = default_config() |
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 Solution:
def canPartition(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
total_sum = sum(nums)
if total_sum % 2 == 1:
return False
half_sum = total_sum//2
dp = [[0 for col in range(half_sum+1)] for row in range(len(nums))]
for j in range(nums[0], half_sum+1):
dp[0][j] = nums[0]
for i in range(1, len(nums)):
for j in range(nums[i], half_sum+1):
dp[i][j] = max(dp[i-1][j], dp[i-1][j-nums[i]]+nums[i])
if dp[len(nums)-1][half_sum] == half_sum:
return True
else:
return False
| class Solution:
def can_partition(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
total_sum = sum(nums)
if total_sum % 2 == 1:
return False
half_sum = total_sum // 2
dp = [[0 for col in range(half_sum + 1)] for row in range(len(nums))]
for j in range(nums[0], half_sum + 1):
dp[0][j] = nums[0]
for i in range(1, len(nums)):
for j in range(nums[i], half_sum + 1):
dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - nums[i]] + nums[i])
if dp[len(nums) - 1][half_sum] == half_sum:
return True
else:
return False |
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' |
class InvalidProtocolMessage(Exception):
"""Invalid protocol message function name"""
class InvalidHandshake(Exception):
"""Handshake message from peer is invalid"""
class InvalidAck(Exception):
"""Handshake message from peer is invalid"""
class IncompatibleProtocolVersion(Exception):
"""Protocol versions incompatible"""
class DuplicateConnection(Exception):
"""Already have connection with peer"""
class TooManyheadersRequested(Exception):
"""Requested too many header blocks"""
class TooManyBlocksRequested(Exception):
"""Requested too many blocks"""
class BlockNotInBlockchain(Exception):
"""Block not in blockchain"""
class NoProofsOfSpaceFound(Exception):
"""No proofs of space found for this challenge"""
class PeersDontHaveBlock(Exception):
"""None of our peers have the block we want"""
# Consensus errors
class InvalidWeight(Exception):
"""The weight of this block can not be validated"""
class InvalidUnfinishedBlock(Exception):
"""The unfinished block we received is invalid"""
class InvalidGenesisBlock(Exception):
"""Genesis block is not valid according to the consensus constants and rules"""
| class Invalidprotocolmessage(Exception):
"""Invalid protocol message function name"""
class Invalidhandshake(Exception):
"""Handshake message from peer is invalid"""
class Invalidack(Exception):
"""Handshake message from peer is invalid"""
class Incompatibleprotocolversion(Exception):
"""Protocol versions incompatible"""
class Duplicateconnection(Exception):
"""Already have connection with peer"""
class Toomanyheadersrequested(Exception):
"""Requested too many header blocks"""
class Toomanyblocksrequested(Exception):
"""Requested too many blocks"""
class Blocknotinblockchain(Exception):
"""Block not in blockchain"""
class Noproofsofspacefound(Exception):
"""No proofs of space found for this challenge"""
class Peersdonthaveblock(Exception):
"""None of our peers have the block we want"""
class Invalidweight(Exception):
"""The weight of this block can not be validated"""
class Invalidunfinishedblock(Exception):
"""The unfinished block we received is invalid"""
class Invalidgenesisblock(Exception):
"""Genesis block is not valid according to the consensus constants and rules""" |
"""
Florian Guillot & Julien Donche: Project 7
Topic modeling and keywords extractions for Holi.io
Jedha Full Stack, dsmf-paris-13
08-2021
FILE NAME :
topic_text.py
OBJECTIVE :
This function use a pretrained topic_modeling model to associate topics to a text
INPUTS:
- 'model' : a topic modeling model that will associate your text to topics. On our side we have chosen LDA
- 'article' : string, text to colorize
- 'n_topics' : integer, number of topics you want to associate to the text
OUTPUTS:
list of topics as string
"""
# -----------------------------------------------------------------------------
# Initialization
# -----------------------------------------------------------------------------
#The topics (bags of words from LDA) are analized by the business and associated and named.
list_topics = ['garbage', 'fooding', 'competition', 'people', 'weather', 'entertainment', 'finance', 'household', 'tourism', 'football', 'law', 'environment', 'university sport', 'cooking', 'urbanism', 'police', 'international', 'education', 'consumption', 'nfl', 'motors', 'basketball', 'baseball', 'health', 'US elections']
# Total number of topics in our model
topics_number =len(list_topics)
# We associate each topic_id to a name
dict_topics = {i: list_topics[i] for i in range(topics_number)}
# -----------------------------------------------------------------------------
# The model
# -----------------------------------------------------------------------------
def topic_text(model, article, n_topics):
topics = []
doc = model.id2word.doc2bow(article.split()) # Vectorization with Doc2Bow
doc_topics, word_topics, phi_values = model.get_document_topics(doc, per_word_topics=True) # Be careful to have a model with per_word_topics = True
for idd, prop in sorted(doc_topics,key=lambda x: x[1], reverse=True)[:n_topics+1]: # We sort the list to have the best topics at the beginning, and add 1 because we handle the topic "11" which is the trash topic
if idd != 0: # The topic '0' is a trash topic, as the model has put everything it does not understand in it. We won't use it
topics.append(dict_topics[idd])
if len(topics)>n_topics: topics = topics[:n_topics]
return topics | """
Florian Guillot & Julien Donche: Project 7
Topic modeling and keywords extractions for Holi.io
Jedha Full Stack, dsmf-paris-13
08-2021
FILE NAME :
topic_text.py
OBJECTIVE :
This function use a pretrained topic_modeling model to associate topics to a text
INPUTS:
- 'model' : a topic modeling model that will associate your text to topics. On our side we have chosen LDA
- 'article' : string, text to colorize
- 'n_topics' : integer, number of topics you want to associate to the text
OUTPUTS:
list of topics as string
"""
list_topics = ['garbage', 'fooding', 'competition', 'people', 'weather', 'entertainment', 'finance', 'household', 'tourism', 'football', 'law', 'environment', 'university sport', 'cooking', 'urbanism', 'police', 'international', 'education', 'consumption', 'nfl', 'motors', 'basketball', 'baseball', 'health', 'US elections']
topics_number = len(list_topics)
dict_topics = {i: list_topics[i] for i in range(topics_number)}
def topic_text(model, article, n_topics):
topics = []
doc = model.id2word.doc2bow(article.split())
(doc_topics, word_topics, phi_values) = model.get_document_topics(doc, per_word_topics=True)
for (idd, prop) in sorted(doc_topics, key=lambda x: x[1], reverse=True)[:n_topics + 1]:
if idd != 0:
topics.append(dict_topics[idd])
if len(topics) > n_topics:
topics = topics[:n_topics]
return topics |
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'}] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
"""Reduce integer values in coords attributes comma separated list of html 3.2 map area elements."""
ENCODING = "utf-8"
ENCODING_ERRORS_POLICY = "ignore"
def apply_scaling(reduction_factor:int, text_line: str):
"""Apply the scaling if coords attribute present in line."""
coords_token_start = ' coords="'
coords_token_end = '" '
line = text_line.rstrip()
if coords_token_start not in line:
return line
prefix, rest = line.split(coords_token_start, 1)
csv, postfix = rest.split(coords_token_end, 1)
numbers_in = [int(x.strip()) for x in csv.split(',')]
numbers_out = [n // reduction_factor for n in numbers_in]
coords = ','.join(str(s) for s in numbers_out)
return f"{prefix}{coords_token_start}{coords}{coords_token_end}{postfix}"
def scale_html_map_area_coords(reduction_factor: int, html_read_path: str):
"""Naive scaling of the coords attribute values relying on attribute name and values being on the same line."""
if not html_read_path: # Early raise
raise ValueError("path to html file missing")
scaled = []
with open(html_read_path, "rt", encoding=ENCODING) as handle:
for line in handle:
scaled.append(apply_scaling(reduction_factor, line))
return '\n'.join(scaled) + '\n'
| """Reduce integer values in coords attributes comma separated list of html 3.2 map area elements."""
encoding = 'utf-8'
encoding_errors_policy = 'ignore'
def apply_scaling(reduction_factor: int, text_line: str):
"""Apply the scaling if coords attribute present in line."""
coords_token_start = ' coords="'
coords_token_end = '" '
line = text_line.rstrip()
if coords_token_start not in line:
return line
(prefix, rest) = line.split(coords_token_start, 1)
(csv, postfix) = rest.split(coords_token_end, 1)
numbers_in = [int(x.strip()) for x in csv.split(',')]
numbers_out = [n // reduction_factor for n in numbers_in]
coords = ','.join((str(s) for s in numbers_out))
return f'{prefix}{coords_token_start}{coords}{coords_token_end}{postfix}'
def scale_html_map_area_coords(reduction_factor: int, html_read_path: str):
"""Naive scaling of the coords attribute values relying on attribute name and values being on the same line."""
if not html_read_path:
raise value_error('path to html file missing')
scaled = []
with open(html_read_path, 'rt', encoding=ENCODING) as handle:
for line in handle:
scaled.append(apply_scaling(reduction_factor, line))
return '\n'.join(scaled) + '\n' |
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 |
# Copyright (c) 2021 Qianyun, Inc. All rights reserved.
class ValidationError(Exception):
"""The validation exception"""
message = "ValidationError"
def __init__(self, message=None):
self.message = message or self.message
super(ValidationError, self).__init__(self.message)
class FusionComputeClientError(Exception):
def __init__(self, message, server_traceback=None,
status_code=-1, error_code=None):
super(FusionComputeClientError, self).__init__(message)
self.status_code = status_code
self.error_code = error_code
self.server_traceback = server_traceback
def __str__(self):
if self.status_code != -1:
return '{0}: {1}'.format(self.status_code, self.message)
return self.message
class IllegalParametersError(FusionComputeClientError):
ERROR_CODE = 'illegal_parameters_error'
class ServerNotFound(FusionComputeClientError):
ERROR_CODE = 'server_not_found'
class ServerCreationFailed(FusionComputeClientError):
ERROR_CODE = 'server_creation_failed'
ERROR_MAPPING = dict([
(error.ERROR_CODE, error)
for error in [
IllegalParametersError,
ServerNotFound,
ServerCreationFailed
]])
| class Validationerror(Exception):
"""The validation exception"""
message = 'ValidationError'
def __init__(self, message=None):
self.message = message or self.message
super(ValidationError, self).__init__(self.message)
class Fusioncomputeclienterror(Exception):
def __init__(self, message, server_traceback=None, status_code=-1, error_code=None):
super(FusionComputeClientError, self).__init__(message)
self.status_code = status_code
self.error_code = error_code
self.server_traceback = server_traceback
def __str__(self):
if self.status_code != -1:
return '{0}: {1}'.format(self.status_code, self.message)
return self.message
class Illegalparameterserror(FusionComputeClientError):
error_code = 'illegal_parameters_error'
class Servernotfound(FusionComputeClientError):
error_code = 'server_not_found'
class Servercreationfailed(FusionComputeClientError):
error_code = 'server_creation_failed'
error_mapping = dict([(error.ERROR_CODE, error) for error in [IllegalParametersError, ServerNotFound, ServerCreationFailed]]) |
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' |
#!/usr/bin/python
#
"""
Virtual superclass for all devices
Homepage and documentation: http://dev.moorescloud.com/
Copyright (c) 2013, Mark Pesce.
License: MIT (see LICENSE for details)
"""
__author__ = 'Mark Pesce'
__version__ = '0.1a'
__license__ = 'MIT'
class Device:
def __init__(self, dev):
self.dev = dev
return
def on(self):
self.dev.on()
return
def off(self):
self.dev.off()
return
def value(self):
try:
val = self.dev.value()
except:
raise Error("Method does not exist")
return val | """
Virtual superclass for all devices
Homepage and documentation: http://dev.moorescloud.com/
Copyright (c) 2013, Mark Pesce.
License: MIT (see LICENSE for details)
"""
__author__ = 'Mark Pesce'
__version__ = '0.1a'
__license__ = 'MIT'
class Device:
def __init__(self, dev):
self.dev = dev
return
def on(self):
self.dev.on()
return
def off(self):
self.dev.off()
return
def value(self):
try:
val = self.dev.value()
except:
raise error('Method does not exist')
return val |
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 |
# -*- coding: utf-8 -*-
"""
This module provides the utilities used by the requester.
"""
def make_host(headers, dst_ip):
if "Host" in headers:
return headers["Host"]
elif "host" in headers:
return headers["host"]
else:
return dst_ip
def make_request_url(host, port, uri):
if "http://" in host or "https://" in host:
return "%s%s" % (host, uri)
if port == 443:
return "https://%s%s" % (host, uri)
return "http://%s%s" % (host, uri)
def make_dumy_body(byte):
dumy_body = ""
if byte is None or byte <= 0:
return dumy_body
for i in range(byte):
dumy_body += "\x00"
return dumy_body
def make_ellipsis(text, max_len=1000):
if max_len <= 0 or len(text) < max_len:
return text
return text[:max_len] + "\n(ellipsised...)"
| """
This module provides the utilities used by the requester.
"""
def make_host(headers, dst_ip):
if 'Host' in headers:
return headers['Host']
elif 'host' in headers:
return headers['host']
else:
return dst_ip
def make_request_url(host, port, uri):
if 'http://' in host or 'https://' in host:
return '%s%s' % (host, uri)
if port == 443:
return 'https://%s%s' % (host, uri)
return 'http://%s%s' % (host, uri)
def make_dumy_body(byte):
dumy_body = ''
if byte is None or byte <= 0:
return dumy_body
for i in range(byte):
dumy_body += '\x00'
return dumy_body
def make_ellipsis(text, max_len=1000):
if max_len <= 0 or len(text) < max_len:
return text
return text[:max_len] + '\n(ellipsised...)' |
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 |
def test_get_building_block_id(case_data):
"""
Test :meth:`.BondInfo.get_building_block_id`.
Parameters
----------
case_data : :class:`.CaseData`
A test case. Holds the bond info to test and the building
block id it should be holding.
Returns
-------
None : :class:`NoneType`
"""
assert (
case_data.bond_info.get_building_block_id()
== case_data.building_block_id
)
| def test_get_building_block_id(case_data):
"""
Test :meth:`.BondInfo.get_building_block_id`.
Parameters
----------
case_data : :class:`.CaseData`
A test case. Holds the bond info to test and the building
block id it should be holding.
Returns
-------
None : :class:`NoneType`
"""
assert case_data.bond_info.get_building_block_id() == case_data.building_block_id |
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 |
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/bit-difference/0
def sol(a, b):
"""
Take an XOR, so 1 will be set whereever there is bit diff.
Keep doing AND with the number to check if the last bit is set
"""
c = a^b
count=0
while c:
if c&1:
count+=1
c=c>>1
return count | def sol(a, b):
"""
Take an XOR, so 1 will be set whereever there is bit diff.
Keep doing AND with the number to check if the last bit is set
"""
c = a ^ b
count = 0
while c:
if c & 1:
count += 1
c = c >> 1
return count |
# https://leetcode.com/explore/learn/card/n-ary-tree/130/traversal/925/
# N-ary Tree Preorder Traversal
#
# Given an n-ary tree, return the preorder traversal of its nodes'
# values.
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
# Note: for iterative, simply add all children to stack
#
# in reverse order so order matches leetcode check. Technically this
# is not required as the children can be processed in any order.
class Solution(object):
def preorder(self, root):
"""
:type root: Node
:rtype: List[int]
"""
return self.my_preorder(root)
# recursive, simple
def my_preorder(self, root):
def walk(x):
if x:
A.append(x.val)
for c in x.children:
walk(c)
A = []
walk(root)
return A
# 36 / 36 test cases passed.
# Status: Accepted
# Runtime: 217 ms
def my_preorder_iter(self, root):
# add node, then process children in reverse (reverse not
# technically required but needed so our answer matches
# leetcode check).
def walk(x):
s = [x] # initial stack
while s: # while stack is not empty
x = s.pop()
A.append(x.val) # visit(x)
for c in reversed(x.children): # add all children to stack
s.append(c)
A = []
if root:
walk(root)
return A
| class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
class Solution(object):
def preorder(self, root):
"""
:type root: Node
:rtype: List[int]
"""
return self.my_preorder(root)
def my_preorder(self, root):
def walk(x):
if x:
A.append(x.val)
for c in x.children:
walk(c)
a = []
walk(root)
return A
def my_preorder_iter(self, root):
def walk(x):
s = [x]
while s:
x = s.pop()
A.append(x.val)
for c in reversed(x.children):
s.append(c)
a = []
if root:
walk(root)
return A |
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} %') |
# -*- coding: utf-8 -*-
"""Top-level package for Generador Ficheros Agencia Tributaria."""
__author__ = """Pau Rosello Van Schoor"""
__email__ = 'paurosello@gmail.com'
__version__ = '0.1.1'
| """Top-level package for Generador Ficheros Agencia Tributaria."""
__author__ = 'Pau Rosello Van Schoor'
__email__ = 'paurosello@gmail.com'
__version__ = '0.1.1' |
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 |
"""
LeetCode Problem: 78. Subsets
Link: https://leetcode.com/problems/subsets/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(n*2^n)
Space Complexity: O(n*2^n)
"""
# Solution 1
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
def recursiveHelper(index, current):
# Creates a shallow copy of the current array and appends to the result array
result.append(current.copy())
for j in range(index, len(nums)):
current.append(nums[j]) # push the value at the current index to the current array
recursiveHelper(j+1, current) # Recursively call the next index
current.pop() # Backtrack
result = [] # Keeps track of the result
recursiveHelper(0, []) # Calls the recursive function
return result # Returns the answer
# Solution 2
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
def recursiveHelper(index, current):
# Base case
if index == len(nums):
result.append(current) # Append current to the result array
else:
recursiveHelper(index+1, current) # If the element is not selected
recursiveHelper(index+1, current + [nums[index]]) # if the element is selected
result = [] # Keeps track of the result
recursiveHelper(0, []) # Calls the recursive function
return result # Returns the answer | """
LeetCode Problem: 78. Subsets
Link: https://leetcode.com/problems/subsets/
Language: Python
Written by: Mostofa Adib Shakib
Time Complexity: O(n*2^n)
Space Complexity: O(n*2^n)
"""
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
def recursive_helper(index, current):
result.append(current.copy())
for j in range(index, len(nums)):
current.append(nums[j])
recursive_helper(j + 1, current)
current.pop()
result = []
recursive_helper(0, [])
return result
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
def recursive_helper(index, current):
if index == len(nums):
result.append(current)
else:
recursive_helper(index + 1, current)
recursive_helper(index + 1, current + [nums[index]])
result = []
recursive_helper(0, [])
return result |
# Pretty lame athlete model
LT = 160
REST_HR = 50
MAX_HR = 175
| lt = 160
rest_hr = 50
max_hr = 175 |
class Solution(object):
def findNthDigit(self, n):
"""
:type n: int
:rtype: int
"""
index = 1
result = 0
digit_num = 9 * 10 ** (index - 1)
while n > digit_num * index:
n -= digit_num * index
result += digit_num
index += 1
digit_num = 9 * 10 ** (index - 1)
offset = n / index
remainder = n - index * offset
return int(str(result + offset + (remainder > 0))[remainder-1]) | class Solution(object):
def find_nth_digit(self, n):
"""
:type n: int
:rtype: int
"""
index = 1
result = 0
digit_num = 9 * 10 ** (index - 1)
while n > digit_num * index:
n -= digit_num * index
result += digit_num
index += 1
digit_num = 9 * 10 ** (index - 1)
offset = n / index
remainder = n - index * offset
return int(str(result + offset + (remainder > 0))[remainder - 1]) |
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 |
# Copyright (C) 2007 Samuel Abels
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
class WorkflowInfo(object):
"""
This class represents a workflow definition.
"""
def __init__(self, handle, **kwargs):
"""
Constructor.
"""
assert not (kwargs.has_key('xml') and kwargs.has_key('file'))
self.id = None
self.handle = handle
self.name = handle
self.xml = kwargs.get('xml', None)
if kwargs.has_key('file'):
file = open(kwargs.get('file'), 'r')
self.xml = file.read()
file.close()
| class Workflowinfo(object):
"""
This class represents a workflow definition.
"""
def __init__(self, handle, **kwargs):
"""
Constructor.
"""
assert not (kwargs.has_key('xml') and kwargs.has_key('file'))
self.id = None
self.handle = handle
self.name = handle
self.xml = kwargs.get('xml', None)
if kwargs.has_key('file'):
file = open(kwargs.get('file'), 'r')
self.xml = file.read()
file.close() |
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) |
"""
1. For $V>-75$ mV, the derivative is negative.
2. For $V<-75$ mV, the derivative is positive.
3. For $V=-75$ mV, the derivative is equal to $0$ is and a stable point.
""" | """
1. For $V>-75$ mV, the derivative is negative.
2. For $V<-75$ mV, the derivative is positive.
3. For $V=-75$ mV, the derivative is equal to $0$ is and a stable point.
""" |
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 |
#!/usr/bin/env python
# -*- coding: utf-8
"""
Taxonomy Resolver
:copyright: (c) 2020-2021.
:license: Apache 2.0, see LICENSE for more details.
"""
ncbi_ranks = [
"class",
"cohort",
"family",
"forma",
"genus",
"infraclass",
"infraorder",
"kingdom",
"order",
"parvorder",
"phylum",
"section",
"series",
"species group",
"species subgroup",
"species",
"subclass",
"subcohort",
"subfamily",
"subgenus",
"subkingdom",
"suborder",
"subphylum",
"subsection",
"subspecies",
"subtribe",
"superclass",
"superfamily",
"superkingdom",
"superorder",
"superphylum",
"tribe",
"varietas",
"strain", # new from here
"isolate",
"clade",
"forma specialis",
"serotype",
"biotype",
"serogroup",
"genotype",
"morph",
"subvariety",
"pathogroup",
]
ncbi_node_fields = [
"tax_id", # node id in GenBank taxonomy database
"parent_tax_id", # parent node id in GenBank taxonomy database
"rank", # rank of this node (superkingdom, kingdom, ...)
"embl_code", # locus-name prefix; not unique
"division_id", # see division.dmp file
"inherited_div_flag", # (1 or 0) 1 if node inherits division from parent
"genetic_code_id", # see gencode.dmp file
"inherited_GC_flag", # (1 or 0) 1 if node inherits genetic code from parent
"mitochondrial_genetic_code_id", # see gencode.dmp file
"inherited_MGC_flag", # (1 or 0) 1 if node inherits mitochondrial gencode from parent
"GenBank_hidden_flag", # (1 or 0) 1 if name is suppressed in GenBank entry lineage
"hidden_subtree_root_flag", # (1 or 0) 1 if this subtree has no sequence data yet
"comments", # free-text comments and citations
]
| """
Taxonomy Resolver
:copyright: (c) 2020-2021.
:license: Apache 2.0, see LICENSE for more details.
"""
ncbi_ranks = ['class', 'cohort', 'family', 'forma', 'genus', 'infraclass', 'infraorder', 'kingdom', 'order', 'parvorder', 'phylum', 'section', 'series', 'species group', 'species subgroup', 'species', 'subclass', 'subcohort', 'subfamily', 'subgenus', 'subkingdom', 'suborder', 'subphylum', 'subsection', 'subspecies', 'subtribe', 'superclass', 'superfamily', 'superkingdom', 'superorder', 'superphylum', 'tribe', 'varietas', 'strain', 'isolate', 'clade', 'forma specialis', 'serotype', 'biotype', 'serogroup', 'genotype', 'morph', 'subvariety', 'pathogroup']
ncbi_node_fields = ['tax_id', 'parent_tax_id', 'rank', 'embl_code', 'division_id', 'inherited_div_flag', 'genetic_code_id', 'inherited_GC_flag', 'mitochondrial_genetic_code_id', 'inherited_MGC_flag', 'GenBank_hidden_flag', 'hidden_subtree_root_flag', 'comments'] |
# 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)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.