content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
add_user_permissions_response = {
'user': 'enterprise_search',
'permissions': ['permission1']
}
| add_user_permissions_response = {'user': 'enterprise_search', 'permissions': ['permission1']} |
#
# Function for program annotation-to-outline. Responsible for writing the
# LaTex structure to file.
#
def writeToLatex(fileName, outlineContents, defContents, titleContents):
# Write contents to .tex file
f = open(fileName, 'w') # file object
# write LaTex preamble to file
f.write("\\documentclass[10pt,a4paper,draft]{report}\n\
\\usepackage{geometry}\\geometry{a4paper,\
left=22mm,\n\
right=22mm,\n\
top=25mm,\n\
bottom=30mm,\n\
}\n\
\\usepackage[utf8]{inputenc}\n\
\\usepackage[english]{babel}\n\
\\usepackage{amsmath}\n\
\\usepackage{amsfonts}\n\
\\usepackage{amssymb}\n\
\\usepackage{textcomp}\n\
\\setlength\\parindent{0pt}\n\
\\begin{document}\n\n")
if titleContents:
f.write("\\begin{center}\n\\section*{Summary -- %s}\n\\end{center}\n\n" % titleContents)
if defContents:
f.write("\n\\subsection*{Definitions}\n\n%s\n\n" % defContents)
if outlineContents:
f.write("\\subsection*{Outline}\n\n%s" % outlineContents)
f.write("\n\n\\end{document}") # end LaTex document
f.close() # close file
| def write_to_latex(fileName, outlineContents, defContents, titleContents):
f = open(fileName, 'w')
f.write('\\documentclass[10pt,a4paper,draft]{report}\n \\usepackage{geometry}\\geometry{a4paper, left=22mm,\n right=22mm,\n top=25mm,\n bottom=30mm,\n }\n \\usepackage[utf8]{inputenc}\n \\usepackage[english]{babel}\n \\usepackage{amsmath}\n \\usepackage{amsfonts}\n \\usepackage{amssymb}\n \\usepackage{textcomp}\n \\setlength\\parindent{0pt}\n \\begin{document}\n\n')
if titleContents:
f.write('\\begin{center}\n\\section*{Summary -- %s}\n\\end{center}\n\n' % titleContents)
if defContents:
f.write('\n\\subsection*{Definitions}\n\n%s\n\n' % defContents)
if outlineContents:
f.write('\\subsection*{Outline}\n\n%s' % outlineContents)
f.write('\n\n\\end{document}')
f.close() |
dist1={0: 460146, 1: 211769, 2: 89768, 3: 41207, 4: 21465, 5: 10368, 6: 6336, 7: 3640, 8: 2378, 9: 1440, 10: 1068, 11: 694, 12: 483, 13: 336, 14: 237, 15: 155, 16: 153, 17: 128, 18: 94, 19: 81, 20: 123, 21: 71, 22: 89, 23: 40, 24: 44, 25: 43, 26: 25, 27: 15, 28: 19, 29: 19, 30: 23, 31: 19, 32: 6, 33: 13, 34: 8, 35: 3, 36: 11, 37: 5, 38: 7, 39: 7, 40: 4, 41: 6, 42: 4, 43: 3, 44: 4, 45: 3, 46: 2, 47: 2, 48: 2, 49: 2, 50: 1, 51: 3, 52: 1, 53: 2, 54: 3, 56: 1, 57: 1, 58: 3, 59: 3, 60: 1, 61: 1, 62: 1, 63: 3, 64: 3, 65: 4, 66: 4, 67: 2, 68: 1, 69: 1, 70: 2, 71: 1, 72: 3, 73: 1, 74: 3, 75: 2, 77: 2, 78: 3, 79: 3, 80: 2, 83: 1, 84: 4, 85: 2, 86: 1, 88: 1, 89: 1, 90: 1, 91: 3, 92: 1, 93: 1}
dist2={0: 494751, 1: 205874, 2: 84597, 3: 45342, 4: 22439, 5: 11599, 6: 5925, 7: 3157, 8: 2042, 9: 1089, 10: 698, 11: 363, 12: 292, 13: 167, 14: 95, 15: 85, 16: 69, 17: 45, 18: 50, 19: 20, 20: 30, 21: 26, 22: 13, 23: 13, 24: 11, 25: 11, 26: 12, 27: 11, 28: 10, 29: 12, 30: 4, 31: 8, 32: 12, 33: 9, 34: 6, 35: 4, 36: 8, 37: 5, 38: 3, 39: 5, 40: 5, 41: 5, 42: 2, 43: 2, 44: 3, 45: 2, 46: 3, 47: 3, 48: 7, 49: 2, 50: 3, 51: 3, 52: 3, 53: 3, 54: 4, 55: 1, 56: 3, 58: 2, 59: 1, 60: 1, 61: 3, 62: 1, 63: 1, 64: 2, 65: 1, 67: 1, 68: 1, 69: 7, 72: 1, 74: 5, 75: 1, 77: 1, 78: 1, 80: 1, 83: 1, 84: 1, 87: 1, 88: 2, 91: 1, 92: 1, 93: 1}
dist3={0: 512229, 1: 219168, 2: 90981, 3: 48682, 4: 24545, 5: 11873, 6: 6081, 7: 3215, 8: 2252, 9: 1134, 10: 815, 11: 412, 12: 300, 13: 140, 14: 91, 15: 64, 16: 50, 17: 39, 18: 22, 19: 8, 20: 29, 21: 12, 22: 11, 23: 8, 24: 5, 25: 4, 26: 6, 27: 3, 28: 3, 29: 7, 30: 2, 31: 3, 32: 2, 33: 1, 34: 2, 38: 4, 39: 1, 40: 1, 41: 1, 43: 2, 45: 1, 47: 1, 48: 1, 50: 1, 52: 2, 57: 1, 63: 1, 79: 1, 80: 2, 93: 1}
dist1={k: v / total for total in (sum(dist1.values()),) for k, v in dist1.items()}
dist2={k: v / total for total in (sum(dist2.values()),) for k, v in dist2.items()}
dist3={k: v / total for total in (sum(dist3.values()),) for k, v in dist3.items()}
dist1_plus_dist2={ k: dist1.get(k, 0) + dist2.get(k, 0) for k in set(dist1) | set(dist2) }
# print (dist1_plus_dist2)
dist1_plus_dist2_plus_dist3={ k: dist1_plus_dist2.get(k, 0) + dist3.get(k, 0) for k in set(dist3) | set(dist1_plus_dist2) }
# dist1_plus_dist2_plus_dist3 = {k: v / total for total in (sum(dist1_plus_dist2_plus_dist3.values()),) for k, v in dist1_plus_dist2_plus_dist3.items()}
for key, value in dist1_plus_dist2_plus_dist3.items():
dist1_plus_dist2_plus_dist3[key] = value / 3
print(dist1_plus_dist2_plus_dist3)
| dist1 = {0: 460146, 1: 211769, 2: 89768, 3: 41207, 4: 21465, 5: 10368, 6: 6336, 7: 3640, 8: 2378, 9: 1440, 10: 1068, 11: 694, 12: 483, 13: 336, 14: 237, 15: 155, 16: 153, 17: 128, 18: 94, 19: 81, 20: 123, 21: 71, 22: 89, 23: 40, 24: 44, 25: 43, 26: 25, 27: 15, 28: 19, 29: 19, 30: 23, 31: 19, 32: 6, 33: 13, 34: 8, 35: 3, 36: 11, 37: 5, 38: 7, 39: 7, 40: 4, 41: 6, 42: 4, 43: 3, 44: 4, 45: 3, 46: 2, 47: 2, 48: 2, 49: 2, 50: 1, 51: 3, 52: 1, 53: 2, 54: 3, 56: 1, 57: 1, 58: 3, 59: 3, 60: 1, 61: 1, 62: 1, 63: 3, 64: 3, 65: 4, 66: 4, 67: 2, 68: 1, 69: 1, 70: 2, 71: 1, 72: 3, 73: 1, 74: 3, 75: 2, 77: 2, 78: 3, 79: 3, 80: 2, 83: 1, 84: 4, 85: 2, 86: 1, 88: 1, 89: 1, 90: 1, 91: 3, 92: 1, 93: 1}
dist2 = {0: 494751, 1: 205874, 2: 84597, 3: 45342, 4: 22439, 5: 11599, 6: 5925, 7: 3157, 8: 2042, 9: 1089, 10: 698, 11: 363, 12: 292, 13: 167, 14: 95, 15: 85, 16: 69, 17: 45, 18: 50, 19: 20, 20: 30, 21: 26, 22: 13, 23: 13, 24: 11, 25: 11, 26: 12, 27: 11, 28: 10, 29: 12, 30: 4, 31: 8, 32: 12, 33: 9, 34: 6, 35: 4, 36: 8, 37: 5, 38: 3, 39: 5, 40: 5, 41: 5, 42: 2, 43: 2, 44: 3, 45: 2, 46: 3, 47: 3, 48: 7, 49: 2, 50: 3, 51: 3, 52: 3, 53: 3, 54: 4, 55: 1, 56: 3, 58: 2, 59: 1, 60: 1, 61: 3, 62: 1, 63: 1, 64: 2, 65: 1, 67: 1, 68: 1, 69: 7, 72: 1, 74: 5, 75: 1, 77: 1, 78: 1, 80: 1, 83: 1, 84: 1, 87: 1, 88: 2, 91: 1, 92: 1, 93: 1}
dist3 = {0: 512229, 1: 219168, 2: 90981, 3: 48682, 4: 24545, 5: 11873, 6: 6081, 7: 3215, 8: 2252, 9: 1134, 10: 815, 11: 412, 12: 300, 13: 140, 14: 91, 15: 64, 16: 50, 17: 39, 18: 22, 19: 8, 20: 29, 21: 12, 22: 11, 23: 8, 24: 5, 25: 4, 26: 6, 27: 3, 28: 3, 29: 7, 30: 2, 31: 3, 32: 2, 33: 1, 34: 2, 38: 4, 39: 1, 40: 1, 41: 1, 43: 2, 45: 1, 47: 1, 48: 1, 50: 1, 52: 2, 57: 1, 63: 1, 79: 1, 80: 2, 93: 1}
dist1 = {k: v / total for total in (sum(dist1.values()),) for (k, v) in dist1.items()}
dist2 = {k: v / total for total in (sum(dist2.values()),) for (k, v) in dist2.items()}
dist3 = {k: v / total for total in (sum(dist3.values()),) for (k, v) in dist3.items()}
dist1_plus_dist2 = {k: dist1.get(k, 0) + dist2.get(k, 0) for k in set(dist1) | set(dist2)}
dist1_plus_dist2_plus_dist3 = {k: dist1_plus_dist2.get(k, 0) + dist3.get(k, 0) for k in set(dist3) | set(dist1_plus_dist2)}
for (key, value) in dist1_plus_dist2_plus_dist3.items():
dist1_plus_dist2_plus_dist3[key] = value / 3
print(dist1_plus_dist2_plus_dist3) |
class SpaceAge:
def __init__(self, seconds: float):
self.seconds = seconds
def _space_age(self, ratio: float = 1.0, ndigits: int = 2) -> float:
return round(self.seconds / 31557600.0 / ratio, ndigits)
def on_mercury(self) -> float:
return self._space_age(0.2408467)
def on_venus(self) -> float:
return self._space_age(0.61519726)
def on_earth(self) -> float:
return self._space_age()
def on_mars(self) -> float:
return self._space_age(1.8808158)
def on_jupiter(self) -> float:
return self._space_age(11.862615)
def on_saturn(self) -> float:
return self._space_age(29.447498)
def on_uranus(self) -> float:
return self._space_age(84.016846)
def on_neptune(self) -> float:
return self._space_age(164.79132)
| class Spaceage:
def __init__(self, seconds: float):
self.seconds = seconds
def _space_age(self, ratio: float=1.0, ndigits: int=2) -> float:
return round(self.seconds / 31557600.0 / ratio, ndigits)
def on_mercury(self) -> float:
return self._space_age(0.2408467)
def on_venus(self) -> float:
return self._space_age(0.61519726)
def on_earth(self) -> float:
return self._space_age()
def on_mars(self) -> float:
return self._space_age(1.8808158)
def on_jupiter(self) -> float:
return self._space_age(11.862615)
def on_saturn(self) -> float:
return self._space_age(29.447498)
def on_uranus(self) -> float:
return self._space_age(84.016846)
def on_neptune(self) -> float:
return self._space_age(164.79132) |
# This program demonstrates the repetition operator.
def main():
# Print nine rows increasing in length.
for count in range(1, 10):
print('Z' * count)
# Print nine rows decreasing in length.
for count in range(8, 0, -1):
print('Z' * count)
# Call the main function.
main()
| def main():
for count in range(1, 10):
print('Z' * count)
for count in range(8, 0, -1):
print('Z' * count)
main() |
#num = 1
#
#while num < 10:
# print(num)
# num = num+1
#nome = 'cecilia'
#
#for letra in nome:
# print(letra)
#for num in range(1,6):
# print(num)
lista = [1,2,3,4,5,6]
for num in lista:
print(num) | lista = [1, 2, 3, 4, 5, 6]
for num in lista:
print(num) |
s = input('as: ')
print(s)
| s = input('as: ')
print(s) |
class Solution:
def match(self, pattern, strs):
words = strs.split()
patterns = list(pattern)
patternList = self.getPattern(patterns)
wordList = self.getPattern(words)
return patternList == wordList
def getPattern(self, strList):
index = 1
tmpDict = {}
ptnList = []
for i, v in enumerate(strList):
if not v in tmpDict:
tmpDict[v] = index
index += 1
ptnList.append(tmpDict[v])
return ptnList
if __name__ == "__main__":
solution = Solution()
print(solution.match("1212c", "hello world hello world ychost"))
| class Solution:
def match(self, pattern, strs):
words = strs.split()
patterns = list(pattern)
pattern_list = self.getPattern(patterns)
word_list = self.getPattern(words)
return patternList == wordList
def get_pattern(self, strList):
index = 1
tmp_dict = {}
ptn_list = []
for (i, v) in enumerate(strList):
if not v in tmpDict:
tmpDict[v] = index
index += 1
ptnList.append(tmpDict[v])
return ptnList
if __name__ == '__main__':
solution = solution()
print(solution.match('1212c', 'hello world hello world ychost')) |
def getAverageOverPercentage(n, score):
avg = sum(score) / n
std = 0
for i in score:
if i > avg: std += 1
return round(std / n * 100, 3)
for _ in range(int(input())):
data = list(map(int, input().split()))
result = getAverageOverPercentage(data[0], data[1:])
print("%.3f"%result + '%')
| def get_average_over_percentage(n, score):
avg = sum(score) / n
std = 0
for i in score:
if i > avg:
std += 1
return round(std / n * 100, 3)
for _ in range(int(input())):
data = list(map(int, input().split()))
result = get_average_over_percentage(data[0], data[1:])
print('%.3f' % result + '%') |
# We explicitly test here that the constructor is not included in the signatures.
@abstract
class Abstract:
x: int
def __init__(self, x: int) -> None:
self.x = x
__book_url__ = "dummy"
__book_version__ = "dummy"
| @abstract
class Abstract:
x: int
def __init__(self, x: int) -> None:
self.x = x
__book_url__ = 'dummy'
__book_version__ = 'dummy' |
__author__ = 'chira'
# for-loop : when number of iterations known
# while-loop : when iteration depends on condition
for i in range(5,10):
print(i)
print("------------");
i = 5
while i < 10:
print(i)
i += 1
print("------------"); | __author__ = 'chira'
for i in range(5, 10):
print(i)
print('------------')
i = 5
while i < 10:
print(i)
i += 1
print('------------') |
class keyBox:
def __init__(self):
self.wallet_addresses = []
self.private_keys = []
#for testing
self.private_keys.append(b'p.Oids\xedb\xa3\x93\xc5\xad\xb9\x8d\x92\x94\x00\x06\xb9\x82\xde\xb9\xbdBg\\\x82\xd4\x90W\xd0\xd5')
self.private_keys.append(b'\x16\xc3\xb37\xb8\x8aG`\xdf\xad\xe3},\x9a\xb4~\xff7&?\xab\x80\x03\xf8\x9fo/:c\x18\xaa>')
# test = keyBoxClass()
# print(test.private_keys[b"\xdbL\xa4&\xd5;Y\xf6\x03p'O\xfb\x19\xf2&\x8d\xc3=\xdf"]) | class Keybox:
def __init__(self):
self.wallet_addresses = []
self.private_keys = []
self.private_keys.append(b'p.Oids\xedb\xa3\x93\xc5\xad\xb9\x8d\x92\x94\x00\x06\xb9\x82\xde\xb9\xbdBg\\\x82\xd4\x90W\xd0\xd5')
self.private_keys.append(b'\x16\xc3\xb37\xb8\x8aG`\xdf\xad\xe3},\x9a\xb4~\xff7&?\xab\x80\x03\xf8\x9fo/:c\x18\xaa>') |
for i in range(1, 6):
for j in range(1, i + 1):
print('* ', end='')
print()
for i in range(4, 0, -1):
for j in range(1, i + 1):
print('* ', end='')
print()
| for i in range(1, 6):
for j in range(1, i + 1):
print('* ', end='')
print()
for i in range(4, 0, -1):
for j in range(1, i + 1):
print('* ', end='')
print() |
class Solution:
# @param num, a list of integer
# @return an integer
def findPeakElement(self, num):
l, r = 0, len(num)-1
while l < r:
m = (l+r) / 2
if m == 0 or num[m] > num[m-1]:
if m == r or num[m] > num[m+1]:
return m
l = m + 1
else:
r = m - 1
return l
| class Solution:
def find_peak_element(self, num):
(l, r) = (0, len(num) - 1)
while l < r:
m = (l + r) / 2
if m == 0 or num[m] > num[m - 1]:
if m == r or num[m] > num[m + 1]:
return m
l = m + 1
else:
r = m - 1
return l |
OPENSEARCH_GIT_RAW = "gits"
OPENSEARCH_GIT_GITHUB_CLEAN = "git_github_clean"
OPENSEARCH_INDEX_GITHUB_COMMITS = "github_commits"
OPENSEARCH_INDEX_GITHUB_ISSUES = "github_issues"
OPENSEARCH_INDEX_GITHUB_ISSUES_COMMENTS = "github_issues_comments"
OPENSEARCH_INDEX_GITHUB_ISSUES_TIMELINE = "github_issues_timeline"
OPENSEARCH_INDEX_CHECK_SYNC_DATA = "check_sync_data"
OPENSEARCH_INDEX_GITHUB_PULL_REQUESTS = "github_pull_requests"
OPENSEARCH_INDEX_GITHUB_PROFILE = "github_profile"
OPENSEARCH_INDEX_MAILLISTS = "maillists"
| opensearch_git_raw = 'gits'
opensearch_git_github_clean = 'git_github_clean'
opensearch_index_github_commits = 'github_commits'
opensearch_index_github_issues = 'github_issues'
opensearch_index_github_issues_comments = 'github_issues_comments'
opensearch_index_github_issues_timeline = 'github_issues_timeline'
opensearch_index_check_sync_data = 'check_sync_data'
opensearch_index_github_pull_requests = 'github_pull_requests'
opensearch_index_github_profile = 'github_profile'
opensearch_index_maillists = 'maillists' |
Dataset_Path = dict(
CULane = "/workspace/CULANE_DATASET",
Tusimple = "/workspace/TUSIMPLE_DATASET",
bdd100k = "/workspace/BDD100K_DATASET"
)
| dataset__path = dict(CULane='/workspace/CULANE_DATASET', Tusimple='/workspace/TUSIMPLE_DATASET', bdd100k='/workspace/BDD100K_DATASET') |
code = [input() for _ in range(610)]
for i in range(len(code)-1):
if code[i][:3] == 'jmp':
code[i] = 'nop' + code[i][3:]
elif code[i][:3] == 'nop':
code[i] = 'jmp' + code[i][3:]
instr_idx = 0
acc_value = 0
executed_ops = set()
while instr_idx not in executed_ops and instr_idx < len(code):
executed_ops.add(instr_idx)
operation = code[instr_idx]
if operation[:3] == 'acc':
acc_value += int(operation[4:])
instr_idx += 1
if operation[:3] == 'jmp':
instr_idx += int(operation[4:])
if operation[:3] == 'nop':
instr_idx += 1
if instr_idx >= len(code):
print(acc_value)
if code[i][:3] == 'jmp':
code[i] = 'nop' + code[i][3:]
elif code[i][:3] == 'nop':
code[i] = 'jmp' + code[i][3:] | code = [input() for _ in range(610)]
for i in range(len(code) - 1):
if code[i][:3] == 'jmp':
code[i] = 'nop' + code[i][3:]
elif code[i][:3] == 'nop':
code[i] = 'jmp' + code[i][3:]
instr_idx = 0
acc_value = 0
executed_ops = set()
while instr_idx not in executed_ops and instr_idx < len(code):
executed_ops.add(instr_idx)
operation = code[instr_idx]
if operation[:3] == 'acc':
acc_value += int(operation[4:])
instr_idx += 1
if operation[:3] == 'jmp':
instr_idx += int(operation[4:])
if operation[:3] == 'nop':
instr_idx += 1
if instr_idx >= len(code):
print(acc_value)
if code[i][:3] == 'jmp':
code[i] = 'nop' + code[i][3:]
elif code[i][:3] == 'nop':
code[i] = 'jmp' + code[i][3:] |
array = [1,2,3,4,5]
result = [5,1,4,2,3]
# in-place replacement
def rearrange_sorted_max_min_2(arr):
max_index = len(arr) - 1
min_index = 0
max_elem = arr[max_index] + 1
# orig element of stored as remainder, max or min element stored
# as multiplier, this allows to swap numbers in place, finally
# divide each element by max element to get output array
for i in range(len(arr)):
if i%2 is 0:
arr[i] += (arr[max_index] % max_elem) * max_elem
max_index -= 1
else:
arr[i] += (arr[min_index] % max_elem) * max_elem
min_index += 1
for i in range(len(arr)):
arr[i] = arr[i] // max_elem
return arr
def main():
print("Input: " + str(array))
print("Expected: " + str(result))
print("Output: " + str(rearrange_sorted_max_min_2(array)))
if __name__ == '__main__':
main()
| array = [1, 2, 3, 4, 5]
result = [5, 1, 4, 2, 3]
def rearrange_sorted_max_min_2(arr):
max_index = len(arr) - 1
min_index = 0
max_elem = arr[max_index] + 1
for i in range(len(arr)):
if i % 2 is 0:
arr[i] += arr[max_index] % max_elem * max_elem
max_index -= 1
else:
arr[i] += arr[min_index] % max_elem * max_elem
min_index += 1
for i in range(len(arr)):
arr[i] = arr[i] // max_elem
return arr
def main():
print('Input: ' + str(array))
print('Expected: ' + str(result))
print('Output: ' + str(rearrange_sorted_max_min_2(array)))
if __name__ == '__main__':
main() |
n = int(input())
sv = sq = 0
for i in range(n):
sv += float(input())
q = len(str(input()).split())
sq += q
print('day {}: {} kg'.format(i + 1, q))
print('{:.2f} kg by day'.format(float(sq / n)))
print('R$ {:.2f} by day'.format(float(sv / n)))
| n = int(input())
sv = sq = 0
for i in range(n):
sv += float(input())
q = len(str(input()).split())
sq += q
print('day {}: {} kg'.format(i + 1, q))
print('{:.2f} kg by day'.format(float(sq / n)))
print('R$ {:.2f} by day'.format(float(sv / n))) |
# variables dependent on your setup
boardType = "atmega2560" # atmega168 | atmega328p | atmega2560 | atmega1280 | atmega32u4
comPort = "COM3" # com4 for atmega328 com8 for mega2560
SHIFT = 47
LATCH = 48
DATA = 49
# start Arduino service named arduino
arduino = Runtime.createAndStart("arduino", "Arduino")
arduino.setBoard(boardType) # atmega168 | mega2560 | etc
arduino.connect(comPort)
# set pinMode
arduino.pinMode(SHIFT, Arduino.OUTPUT)
arduino.pinMode(LATCH, Arduino.OUTPUT)
arduino.pinMode(DATA, Arduino.OUTPUT)
# Create shiftOut fonction
def shiftOut(value):
arduino.digitalWrite(LATCH, arduino.LOW) # Stop the copy
for byte in value:
if byte == 1 :
arduino.digitalWrite(DATA,arduino.HIGH)
else :
arduino.digitalWrite(DATA,arduino.LOW)
arduino.digitalWrite(SHIFT, arduino.HIGH)
arduino.digitalWrite(SHIFT, arduino.LOW)
arduino.digitalWrite(LATCH, arduino.HIGH) # copy
def smile():
shiftOut([1,1,0,1,1,1,0,0]) # send data
def notHappy():
shiftOut([0,0,1,1,1,1,1,0]) # send data
def speechLess():
shiftOut([1,0,1,1,1,1,0,0]) # send data
def talk():
shiftOut([0,0,0,0,0,0,0,0]) # send data
sleep(0.05)
shiftOut([0,0,0,0,0,1,0,0]) # send data
sleep(0.05)
shiftOut([0,0,0,1,1,1,0,0]) # send data
sleep(0.05)
shiftOut([0,0,0,0,0,1,0,0]) # send data
sleep(0.05)
x = 0
while (x<2) :
x=x+1
smile()
sleep(1)
notHappy()
sleep(1)
speechLess()
for i in range(0,10) :
talk()
| board_type = 'atmega2560'
com_port = 'COM3'
shift = 47
latch = 48
data = 49
arduino = Runtime.createAndStart('arduino', 'Arduino')
arduino.setBoard(boardType)
arduino.connect(comPort)
arduino.pinMode(SHIFT, Arduino.OUTPUT)
arduino.pinMode(LATCH, Arduino.OUTPUT)
arduino.pinMode(DATA, Arduino.OUTPUT)
def shift_out(value):
arduino.digitalWrite(LATCH, arduino.LOW)
for byte in value:
if byte == 1:
arduino.digitalWrite(DATA, arduino.HIGH)
else:
arduino.digitalWrite(DATA, arduino.LOW)
arduino.digitalWrite(SHIFT, arduino.HIGH)
arduino.digitalWrite(SHIFT, arduino.LOW)
arduino.digitalWrite(LATCH, arduino.HIGH)
def smile():
shift_out([1, 1, 0, 1, 1, 1, 0, 0])
def not_happy():
shift_out([0, 0, 1, 1, 1, 1, 1, 0])
def speech_less():
shift_out([1, 0, 1, 1, 1, 1, 0, 0])
def talk():
shift_out([0, 0, 0, 0, 0, 0, 0, 0])
sleep(0.05)
shift_out([0, 0, 0, 0, 0, 1, 0, 0])
sleep(0.05)
shift_out([0, 0, 0, 1, 1, 1, 0, 0])
sleep(0.05)
shift_out([0, 0, 0, 0, 0, 1, 0, 0])
sleep(0.05)
x = 0
while x < 2:
x = x + 1
smile()
sleep(1)
not_happy()
sleep(1)
speech_less()
for i in range(0, 10):
talk() |
airline = pd.read_csv('data/international-airline-passengers.csv', parse_dates=['Month'], sep=';')
airline.set_index('Month', inplace=True)
ax = airline.plot(legend=False)
ax.set_xlabel('Date')
ax.set_ylabel('Passengers') | airline = pd.read_csv('data/international-airline-passengers.csv', parse_dates=['Month'], sep=';')
airline.set_index('Month', inplace=True)
ax = airline.plot(legend=False)
ax.set_xlabel('Date')
ax.set_ylabel('Passengers') |
n=int(input())
if n>=0:
sum=int((n*(n+1))/2)
print(sum)
else:
print("Invalid Input") | n = int(input())
if n >= 0:
sum = int(n * (n + 1) / 2)
print(sum)
else:
print('Invalid Input') |
def moving_average(timeseries, k):
result = []
for begin_index in range(0, len(timeseries) - k):
end_index = begin_index + k
current_sum = 0
for v in timeseries[begin_index:end_index]:
current_sum += v
current_avg = current_sum / k
result.append(current_avg)
return result
def main():
ts = list(map(int, input().split()))
k = int(input())
print(moving_average(ts, k))
if __name__ == '__main__':
main()
| def moving_average(timeseries, k):
result = []
for begin_index in range(0, len(timeseries) - k):
end_index = begin_index + k
current_sum = 0
for v in timeseries[begin_index:end_index]:
current_sum += v
current_avg = current_sum / k
result.append(current_avg)
return result
def main():
ts = list(map(int, input().split()))
k = int(input())
print(moving_average(ts, k))
if __name__ == '__main__':
main() |
class Cord:
homepage = ( 1, 42, 529,984 )
question = ( 42,317,519,426 )
answer1 = ( 48,487,510,558 )
answer2 = ( 48,573,510,645 )
answer3 = ( 48,660,510,732 )
answer1_clk = ( 94,524 )
answer2_clk = ( 94,609 )
answer3_clk = ( 94,694 ) | class Cord:
homepage = (1, 42, 529, 984)
question = (42, 317, 519, 426)
answer1 = (48, 487, 510, 558)
answer2 = (48, 573, 510, 645)
answer3 = (48, 660, 510, 732)
answer1_clk = (94, 524)
answer2_clk = (94, 609)
answer3_clk = (94, 694) |
#Exercise 4-2 - Animals
animals = ['lion', 'tiger', 'cat']
for animal in animals:
print(animal.title(), "it's a feline.")
print('Only one is a great pet.')
| animals = ['lion', 'tiger', 'cat']
for animal in animals:
print(animal.title(), "it's a feline.")
print('Only one is a great pet.') |
PICTURE_DEFAULT = {
"image": {
"url": str,
"name": str
},
"thumbnail": {
"url": str,
"name": str
}
}
| picture_default = {'image': {'url': str, 'name': str}, 'thumbnail': {'url': str, 'name': str}} |
# Python3 function to calculate number of possible stairs arrangements with given number of boxes/bricks
def solution(n):
dp=[[0 for x in range(n + 5)]
for y in range(n + 5)]
for i in range(n+1):
for j in range (n+1):
dp[i][j]=0
dp[3][2]=1
dp[4][2]=1
for i in range(5,n+1):
for j in range(2,i+1):
if (j == 2) :
dp[i][j] = dp[i-j][j] + 1
else :
dp[i][j] = (dp[i-j][j] + dp[i-j][j - 1])
answer = 0
for i in range (1, n+1):
answer += dp[n][i]
return answer
print(solution(3))
| def solution(n):
dp = [[0 for x in range(n + 5)] for y in range(n + 5)]
for i in range(n + 1):
for j in range(n + 1):
dp[i][j] = 0
dp[3][2] = 1
dp[4][2] = 1
for i in range(5, n + 1):
for j in range(2, i + 1):
if j == 2:
dp[i][j] = dp[i - j][j] + 1
else:
dp[i][j] = dp[i - j][j] + dp[i - j][j - 1]
answer = 0
for i in range(1, n + 1):
answer += dp[n][i]
return answer
print(solution(3)) |
class PdfDoc():
def __init__(self, filename):
self.filename = filename
self.pages = []
def page_count(self):
return len(self.pages)
| class Pdfdoc:
def __init__(self, filename):
self.filename = filename
self.pages = []
def page_count(self):
return len(self.pages) |
arquivo =open('mobydick.txt', 'r')
saida = open('saida.txt', 'w')
texto = arquivo.readlines()[:]
for linha in texto:
if linha == '\n':
continue
else:
linha = linha.split()
for palavra in linha:
saida.write(f'{palavra} ')
saida.write('\n')
arquivo.close()
saida.close() | arquivo = open('mobydick.txt', 'r')
saida = open('saida.txt', 'w')
texto = arquivo.readlines()[:]
for linha in texto:
if linha == '\n':
continue
else:
linha = linha.split()
for palavra in linha:
saida.write(f'{palavra} ')
saida.write('\n')
arquivo.close()
saida.close() |
file = open('signalsAndNoise_input.txt', 'r')
lines_read = file.readlines()
message_length = len(lines_read[0].strip())
letter_frequencies = [None] * message_length
for index in range(message_length):
letter_frequencies[index] = dict()
for line in lines_read:
line = line.strip()
for i in range(len(line)):
frequency_dict = letter_frequencies[i]
letter = line[i]
if frequency_dict.__contains__(letter):
frequency_dict[letter] += 1
else:
frequency_dict[letter] = 1
for i in range(message_length):
frequency_dict = letter_frequencies[i]
max_letter = ''
max_freq = -1
for key in frequency_dict:
if frequency_dict[key] > max_freq:
max_letter = key
max_freq = frequency_dict[key]
print(max_letter)
| file = open('signalsAndNoise_input.txt', 'r')
lines_read = file.readlines()
message_length = len(lines_read[0].strip())
letter_frequencies = [None] * message_length
for index in range(message_length):
letter_frequencies[index] = dict()
for line in lines_read:
line = line.strip()
for i in range(len(line)):
frequency_dict = letter_frequencies[i]
letter = line[i]
if frequency_dict.__contains__(letter):
frequency_dict[letter] += 1
else:
frequency_dict[letter] = 1
for i in range(message_length):
frequency_dict = letter_frequencies[i]
max_letter = ''
max_freq = -1
for key in frequency_dict:
if frequency_dict[key] > max_freq:
max_letter = key
max_freq = frequency_dict[key]
print(max_letter) |
# Python - 3.6.0
def testing(actual, expected):
Test.assert_equals(actual, expected)
Test.describe('opstrings')
Test.it('Basic tests vert_mirror')
testing(oper(vert_mirror, 'hSgdHQ\nHnDMao\nClNNxX\niRvxxH\nbqTVvA\nwvSyRu'), 'QHdgSh\noaMDnH\nXxNNlC\nHxxvRi\nAvVTqb\nuRySvw')
testing(oper(vert_mirror, 'IzOTWE\nkkbeCM\nWuzZxM\nvDddJw\njiJyHF\nPVHfSx'), 'EWTOzI\nMCebkk\nMxZzuW\nwJddDv\nFHyJij\nxSfHVP')
Test.it('Basic tests hor_mirror')
testing(oper(hor_mirror, 'lVHt\nJVhv\nCSbg\nyeCt'), 'yeCt\nCSbg\nJVhv\nlVHt')
testing(oper(hor_mirror, 'njMK\ndbrZ\nLPKo\ncEYz'), 'cEYz\nLPKo\ndbrZ\nnjMK')
| def testing(actual, expected):
Test.assert_equals(actual, expected)
Test.describe('opstrings')
Test.it('Basic tests vert_mirror')
testing(oper(vert_mirror, 'hSgdHQ\nHnDMao\nClNNxX\niRvxxH\nbqTVvA\nwvSyRu'), 'QHdgSh\noaMDnH\nXxNNlC\nHxxvRi\nAvVTqb\nuRySvw')
testing(oper(vert_mirror, 'IzOTWE\nkkbeCM\nWuzZxM\nvDddJw\njiJyHF\nPVHfSx'), 'EWTOzI\nMCebkk\nMxZzuW\nwJddDv\nFHyJij\nxSfHVP')
Test.it('Basic tests hor_mirror')
testing(oper(hor_mirror, 'lVHt\nJVhv\nCSbg\nyeCt'), 'yeCt\nCSbg\nJVhv\nlVHt')
testing(oper(hor_mirror, 'njMK\ndbrZ\nLPKo\ncEYz'), 'cEYz\nLPKo\ndbrZ\nnjMK') |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
def headers(agentConfig, **kwargs):
# Build the request headers
res = {
'User-Agent': 'Datadog Agent/%s' % agentConfig.get('version', '0.0.0'),
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'text/html, */*',
}
if 'http_host' in kwargs:
res['Host'] = kwargs['http_host']
return res
| def headers(agentConfig, **kwargs):
res = {'User-Agent': 'Datadog Agent/%s' % agentConfig.get('version', '0.0.0'), 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'text/html, */*'}
if 'http_host' in kwargs:
res['Host'] = kwargs['http_host']
return res |
for i in range(101):
if i % 3 == 0:
print(i)
| for i in range(101):
if i % 3 == 0:
print(i) |
to_solve = ''
with open('input.txt') as f:
to_solve = f.readlines()
to_solve = list(map(lambda x: x.split(': '), to_solve))
temp = []
for i in to_solve:
ttemp = i[0].split(' ')
tttemp = ttemp[0].split('-')
ttttemp = {'char': ttemp[1], 'passwd': i[1], 'min': int(tttemp[0]), 'max': int(tttemp[1])}
temp.append(ttttemp)
to_solve = temp
part1 = 0
for i in to_solve:
char = i['char']
string = i['passwd']
counter = 0
for j in string:
if j == char:
counter += 1
if i['min'] <=counter <= i['max']:
part1 += 1
print(f'part 1: {part1}')
part2 = 0
for i in to_solve:
char = i['char']
string = i['passwd']
counter = 0
if string[i['min']-1] == char:
counter += 1
if string[i['max']-1] == char:
counter += 1
if counter == 1:
part2 += 1
print(f'part 2: {part2}')
| to_solve = ''
with open('input.txt') as f:
to_solve = f.readlines()
to_solve = list(map(lambda x: x.split(': '), to_solve))
temp = []
for i in to_solve:
ttemp = i[0].split(' ')
tttemp = ttemp[0].split('-')
ttttemp = {'char': ttemp[1], 'passwd': i[1], 'min': int(tttemp[0]), 'max': int(tttemp[1])}
temp.append(ttttemp)
to_solve = temp
part1 = 0
for i in to_solve:
char = i['char']
string = i['passwd']
counter = 0
for j in string:
if j == char:
counter += 1
if i['min'] <= counter <= i['max']:
part1 += 1
print(f'part 1: {part1}')
part2 = 0
for i in to_solve:
char = i['char']
string = i['passwd']
counter = 0
if string[i['min'] - 1] == char:
counter += 1
if string[i['max'] - 1] == char:
counter += 1
if counter == 1:
part2 += 1
print(f'part 2: {part2}') |
# http://codingbat.com/prob/p194053
def combo_string(a, b):
if len(a) > len(b):
return b + a + b
else:
return a + b + a
| def combo_string(a, b):
if len(a) > len(b):
return b + a + b
else:
return a + b + a |
def fibonacci(n):
if n == 1 or n == 2:
return 1
return fibonacci(n-1) + fibonacci(n-2)
| def fibonacci(n):
if n == 1 or n == 2:
return 1
return fibonacci(n - 1) + fibonacci(n - 2) |
class Solution:
# @return an integer
def maxArea(self, height):
n = len(height)
i = 0
j = n - 1
max_area = 0
while i < j:
max_area = max(max_area, (j - i) * min(height[i], height[j]))
if height[i] <= height[j]:
i += 1
else:
j -= 1
return max_area
| class Solution:
def max_area(self, height):
n = len(height)
i = 0
j = n - 1
max_area = 0
while i < j:
max_area = max(max_area, (j - i) * min(height[i], height[j]))
if height[i] <= height[j]:
i += 1
else:
j -= 1
return max_area |
def isnotebook():
try:
shell = get_ipython().__class__.__name__
if shell == 'ZMQInteractiveShell':
return True # Jupyter notebook or qtconsole
elif shell == 'TerminalInteractiveShell':
return False # Terminal running IPython
else:
return False
except NameError:
return False
| def isnotebook():
try:
shell = get_ipython().__class__.__name__
if shell == 'ZMQInteractiveShell':
return True
elif shell == 'TerminalInteractiveShell':
return False
else:
return False
except NameError:
return False |
l = [*map(int, input().split())]
l.sort()
if l[0]+l[3] == l[1]+l[2] or l[3] == l[0]+l[1]+l[2]:
print("YES")
else:
print("NO")
| l = [*map(int, input().split())]
l.sort()
if l[0] + l[3] == l[1] + l[2] or l[3] == l[0] + l[1] + l[2]:
print('YES')
else:
print('NO') |
def is_positive(num):
if int(num) > 0:
return True
else:
return False
def is_negative(num):
if int(num) < 0:
return True
else:
return False
def is_zero(num):
if int(num) == 0:
return True
else:
return False
def is_odd(num):
if int(num) <= 0:
return False
if int(num) % 2 != 0:
return True
else:
return False
def is_even(num):
if int(num) <= 0:
return False
if int(num) % 2 == 0:
return True
else:
return False
def is_prime(num):
if int(num) == 0 or int(num) == 1:
return False
result = 0
total = 0
while True:
if total == int(num):
break
total += 1
if int(num) % total == 0:
result += 1
if result <= 2:
return True
else:
return False
| def is_positive(num):
if int(num) > 0:
return True
else:
return False
def is_negative(num):
if int(num) < 0:
return True
else:
return False
def is_zero(num):
if int(num) == 0:
return True
else:
return False
def is_odd(num):
if int(num) <= 0:
return False
if int(num) % 2 != 0:
return True
else:
return False
def is_even(num):
if int(num) <= 0:
return False
if int(num) % 2 == 0:
return True
else:
return False
def is_prime(num):
if int(num) == 0 or int(num) == 1:
return False
result = 0
total = 0
while True:
if total == int(num):
break
total += 1
if int(num) % total == 0:
result += 1
if result <= 2:
return True
else:
return False |
def factorial(curr):
g = 1
for i in range(1, curr + 1):
g *= i
return g
def non_recurrsion():
num = 1
try:
row = int(input("Enter number of rows:"))
except:
print("Invalid input. Please enter an integer")
exit(1)
for i in range(1, row + 1):
for j in range(0, i):
print(factorial(num), end=" ")
num += 1
print("")
# Recursive statement included
def factorial_recursion(numb):
if numb == 1:
return 1
else:
return numb * factorial_recursion(numb - 1)
def recursion():
num = 1
try:
row = int(input("Enter number of rows:"))
except:
print("Invalid input. Please enter an integer")
exit(1)
for i in range(1, row + 1):
for j in range(0, i):
print(factorial_recursion(num), end=" ")
num += 1
print("")
non_recurrsion()
# recursion()
| def factorial(curr):
g = 1
for i in range(1, curr + 1):
g *= i
return g
def non_recurrsion():
num = 1
try:
row = int(input('Enter number of rows:'))
except:
print('Invalid input. Please enter an integer')
exit(1)
for i in range(1, row + 1):
for j in range(0, i):
print(factorial(num), end=' ')
num += 1
print('')
def factorial_recursion(numb):
if numb == 1:
return 1
else:
return numb * factorial_recursion(numb - 1)
def recursion():
num = 1
try:
row = int(input('Enter number of rows:'))
except:
print('Invalid input. Please enter an integer')
exit(1)
for i in range(1, row + 1):
for j in range(0, i):
print(factorial_recursion(num), end=' ')
num += 1
print('')
non_recurrsion() |
def can_build(env, platform):
return platform == "windows" # For now, GGPO isn't available on linux or mac
def configure(env):
env.Append(CPPPATH=["#modules/godotggpo/sdk/include/"])
if env["platform"] == "windows":
if env["CC"] == "cl":
env.Append(LINKFLAGS=["GGPO.lib"])
env.Append(LIBPATH=["#modules/godotggpo/sdk/bin"])
else:
env.Append(LIBS=["ggpo"])
env.Append(LIBPATH=["#modules/godotggpo/sdk/bin"])
def get_doc_classes():
return [
"GGPO",
]
def get_doc_path():
return "doc_class" | def can_build(env, platform):
return platform == 'windows'
def configure(env):
env.Append(CPPPATH=['#modules/godotggpo/sdk/include/'])
if env['platform'] == 'windows':
if env['CC'] == 'cl':
env.Append(LINKFLAGS=['GGPO.lib'])
env.Append(LIBPATH=['#modules/godotggpo/sdk/bin'])
else:
env.Append(LIBS=['ggpo'])
env.Append(LIBPATH=['#modules/godotggpo/sdk/bin'])
def get_doc_classes():
return ['GGPO']
def get_doc_path():
return 'doc_class' |
print("find greatest common divisor:")
def gcd(m, n):
cf = []
for i in range (1,min(m,n)+1):
if (m%i) == 0 and (n%i) == 0 :
cf.append(i)
print(cf)
print(cf[-1])
gcd(int(input()), int(input()))
| print('find greatest common divisor:')
def gcd(m, n):
cf = []
for i in range(1, min(m, n) + 1):
if m % i == 0 and n % i == 0:
cf.append(i)
print(cf)
print(cf[-1])
gcd(int(input()), int(input())) |
def object_function_apply_by_key(object_to_apply, key_to_find, function_to_apply):
if object_to_apply:
if isinstance(object_to_apply, list) and len(object_to_apply) > 0:
for item in object_to_apply:
object_function_apply_by_key(item, key_to_find, function_to_apply)
elif isinstance(object_to_apply, dict):
for k in object_to_apply:
if isinstance(object_to_apply[k], list):
for item in object_to_apply[k]:
object_function_apply_by_key(item, key_to_find, function_to_apply)
elif isinstance(object_to_apply[k], dict):
object_function_apply_by_key(object_to_apply[k], key_to_find, function_to_apply)
if k == key_to_find:
function_to_apply(object_to_apply, k)
| def object_function_apply_by_key(object_to_apply, key_to_find, function_to_apply):
if object_to_apply:
if isinstance(object_to_apply, list) and len(object_to_apply) > 0:
for item in object_to_apply:
object_function_apply_by_key(item, key_to_find, function_to_apply)
elif isinstance(object_to_apply, dict):
for k in object_to_apply:
if isinstance(object_to_apply[k], list):
for item in object_to_apply[k]:
object_function_apply_by_key(item, key_to_find, function_to_apply)
elif isinstance(object_to_apply[k], dict):
object_function_apply_by_key(object_to_apply[k], key_to_find, function_to_apply)
if k == key_to_find:
function_to_apply(object_to_apply, k) |
r=""
for _ in range(int(input())):
x=int(input())
if abs(x)%2==0:
r+=str(x)+" is even\n"
else:
r+=str(x)+" is odd\n"
print(r,end="")
| r = ''
for _ in range(int(input())):
x = int(input())
if abs(x) % 2 == 0:
r += str(x) + ' is even\n'
else:
r += str(x) + ' is odd\n'
print(r, end='') |
# Dictionaries
# Giving a key value and calling
my_stuff = {'key1': "123", "key2": "Value of key2"}
print(my_stuff['key1'])
print(my_stuff['key2'])
# Something nexted
my_stuff2 = {'key1': "123", "key2": "Value of key2", 'key3': {'key4': [1, 3, 2]}}
print(my_stuff2['key3'])
print(my_stuff2['key3']['key4']) # This will print the nexted dictionary in the mystuff_2
# Printing entire Dictionaries
print(my_stuff, '= Dictionary 1')
print(my_stuff2, '= Dictionary 2') # Note in the output is not same in the dictionary as they are different from lists
# SMALL EXERCISE
my_stuff3 = {'key1': "123", "key2": "Value of key2", 'key3': {'key4': [1, 3, 2, 'grab me']}}
print(my_stuff3['key3']['key4'][3]) # This is just an example for something complicated
print(my_stuff3['key3']['key4'][3].upper()) # Same result but in upper case
print(my_stuff3['key3']['key4'][3].capitalize()) # Same result but in capitalize form
# Redefining a the value
food = {'lunch': 'pizza', 'breakfast': 'eggs'} # Main dictionary for down CODE
food['lunch'] = 'burger'
print(food['lunch']) # re assaigned value for 'lunch'
print(food) # Value is changed here
food['dinner'] = 'Pasta'
print(food) # New value added here
| my_stuff = {'key1': '123', 'key2': 'Value of key2'}
print(my_stuff['key1'])
print(my_stuff['key2'])
my_stuff2 = {'key1': '123', 'key2': 'Value of key2', 'key3': {'key4': [1, 3, 2]}}
print(my_stuff2['key3'])
print(my_stuff2['key3']['key4'])
print(my_stuff, '= Dictionary 1')
print(my_stuff2, '= Dictionary 2')
my_stuff3 = {'key1': '123', 'key2': 'Value of key2', 'key3': {'key4': [1, 3, 2, 'grab me']}}
print(my_stuff3['key3']['key4'][3])
print(my_stuff3['key3']['key4'][3].upper())
print(my_stuff3['key3']['key4'][3].capitalize())
food = {'lunch': 'pizza', 'breakfast': 'eggs'}
food['lunch'] = 'burger'
print(food['lunch'])
print(food)
food['dinner'] = 'Pasta'
print(food) |
# Copyright 2018, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
i0 = Input("i0", ("TENSOR_FLOAT32", [2, 2])) # input 0
o1 = Output("o1", ("TENSOR_FLOAT32", [1, 2])) # output for model1
o2 = Output("o2", ("TENSOR_FLOAT32", [2, 1])) # output for model2
o3 = Output("o3", ("TENSOR_FLOAT32", [1])) # output for model3
model1 = Model().Operation("MEAN", i0, [0], 1).To(o1) # along axis 0, keep_dim=True
model2 = Model().Operation("MEAN", i0, [1], 1).To(o2) # along axis 1, keep_dim=True
model3 = Model().Operation("MEAN", i0, [0, 1], 0).To(o3) # along both axis, keep_dim=False
inputs1 = {i0: [1, 2, 3, 4]}
outputs11 = {o1: [4, 6]}
outputs12 = {o2: [3, 7]}
outputs13 = {o3: [10]}
inputs2 = {i0: [-1, -2, -3, -4]}
outputs21 = {o1: [-4, -6]}
outputs22 = {o2: [-3, -7]}
outputs23 = {o3: [-10]}
Example((inputs1, outputs11), model=model1)
Example((inputs1, outputs12), model=model2)
Example((inputs1, outputs13), model=model3)
Example((inputs2, outputs21), model=model1)
Example((inputs2, outputs22), model=model2)
Example((inputs2, outputs23), model=model3)
| i0 = input('i0', ('TENSOR_FLOAT32', [2, 2]))
o1 = output('o1', ('TENSOR_FLOAT32', [1, 2]))
o2 = output('o2', ('TENSOR_FLOAT32', [2, 1]))
o3 = output('o3', ('TENSOR_FLOAT32', [1]))
model1 = model().Operation('MEAN', i0, [0], 1).To(o1)
model2 = model().Operation('MEAN', i0, [1], 1).To(o2)
model3 = model().Operation('MEAN', i0, [0, 1], 0).To(o3)
inputs1 = {i0: [1, 2, 3, 4]}
outputs11 = {o1: [4, 6]}
outputs12 = {o2: [3, 7]}
outputs13 = {o3: [10]}
inputs2 = {i0: [-1, -2, -3, -4]}
outputs21 = {o1: [-4, -6]}
outputs22 = {o2: [-3, -7]}
outputs23 = {o3: [-10]}
example((inputs1, outputs11), model=model1)
example((inputs1, outputs12), model=model2)
example((inputs1, outputs13), model=model3)
example((inputs2, outputs21), model=model1)
example((inputs2, outputs22), model=model2)
example((inputs2, outputs23), model=model3) |
# auth.signature add default fields like the created on/ create by/ modified by/ modified on
db.define_table('blog_post',
Field('title', requires=IS_NOT_EMPTY()),
Field('body', 'text', requires=IS_NOT_EMPTY()),
Field('photo', 'upload'),
auth.signature)
db.define_table('blog_comment',
Field('blog_post', 'reference blog_post'),
Field('comments', 'text', requires=IS_NOT_EMPTY()),
auth.signature
)
db.blog_post.title.requires = IS_NOT_IN_DB(db, db.blog_post.title)
db.define_table('test',
Field('first_name', requires = IS_NOT_EMPTY()),
Field('last_name', requires = IS_NOT_EMPTY()),
Field('email', requires= IS_EMAIL()),
Field('email_validate',requires = IS_EQUAL_TO(request.vars.email)))
db.define_table("entries", Field("entry", "text"))
| db.define_table('blog_post', field('title', requires=is_not_empty()), field('body', 'text', requires=is_not_empty()), field('photo', 'upload'), auth.signature)
db.define_table('blog_comment', field('blog_post', 'reference blog_post'), field('comments', 'text', requires=is_not_empty()), auth.signature)
db.blog_post.title.requires = is_not_in_db(db, db.blog_post.title)
db.define_table('test', field('first_name', requires=is_not_empty()), field('last_name', requires=is_not_empty()), field('email', requires=is_email()), field('email_validate', requires=is_equal_to(request.vars.email)))
db.define_table('entries', field('entry', 'text')) |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ------------------------------------------------------------------
# Tested on Windows 10 1809 64bit with scikit-learn 0.22.1 and Python 3.7
hiddenimports = ['sklearn.neighbors.typedefs',
'sklearn.utils._cython_blas',
'sklearn.neighbors.quad_tree',
'sklearn.tree._utils']
| hiddenimports = ['sklearn.neighbors.typedefs', 'sklearn.utils._cython_blas', 'sklearn.neighbors.quad_tree', 'sklearn.tree._utils'] |
pkgname = "libxshmfence"
pkgver = "1.3"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--with-shared-memory-dir=/dev/shm"]
hostmakedepends = ["pkgconf"]
makedepends = ["xorgproto"]
pkgdesc = "X SyncFence synchronization primitive"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://xorg.freedesktop.org"
source = f"$(XORG_SITE)/lib/libxshmfence-{pkgver}.tar.bz2"
sha256 = "b884300d26a14961a076fbebc762a39831cb75f92bed5ccf9836345b459220c7"
def post_install(self):
self.install_license("COPYING")
@subpackage("libxshmfence-devel")
def _devel(self):
return self.default_devel()
| pkgname = 'libxshmfence'
pkgver = '1.3'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--with-shared-memory-dir=/dev/shm']
hostmakedepends = ['pkgconf']
makedepends = ['xorgproto']
pkgdesc = 'X SyncFence synchronization primitive'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
url = 'https://xorg.freedesktop.org'
source = f'$(XORG_SITE)/lib/libxshmfence-{pkgver}.tar.bz2'
sha256 = 'b884300d26a14961a076fbebc762a39831cb75f92bed5ccf9836345b459220c7'
def post_install(self):
self.install_license('COPYING')
@subpackage('libxshmfence-devel')
def _devel(self):
return self.default_devel() |
nombre_archivo = input("Ingrese el nombre del archivo que contiene las palabras: ")
archivo = open(nombre_archivo,"r")
texto = archivo.read()
palabras = texto.split()
ocurrencias = {}
for palabra in palabras:
if ocurrencias.get(palabra):
ocurrencias[palabra]+=1
else:
ocurrencias[palabra]=1
maxpar = None, 0
for palabra, cantidad in ocurrencias.items():
if maxpar[1]<cantidad:
maxpar=palabra,cantidad
print("La palabra con mayor cantidad de repeticion es: ",maxpar[0],"repetida",maxpar[1],"veces") | nombre_archivo = input('Ingrese el nombre del archivo que contiene las palabras: ')
archivo = open(nombre_archivo, 'r')
texto = archivo.read()
palabras = texto.split()
ocurrencias = {}
for palabra in palabras:
if ocurrencias.get(palabra):
ocurrencias[palabra] += 1
else:
ocurrencias[palabra] = 1
maxpar = (None, 0)
for (palabra, cantidad) in ocurrencias.items():
if maxpar[1] < cantidad:
maxpar = (palabra, cantidad)
print('La palabra con mayor cantidad de repeticion es: ', maxpar[0], 'repetida', maxpar[1], 'veces') |
#!/usr/bin/python
# ==============================================================================
# Author: Tao Li (taoli@ucsd.edu)
# Date: May 1, 2015
# Question: 009-Palindrome-Number
# Link: https://leetcode.com/problems/palindrome-number/
# ==============================================================================
# Determine whether an integer is a palindrome. Do this without extra space.
#
# Some hints:
# Could negative integers be palindromes? (ie, -1)
#
# If you are thinking of converting the integer to string, note the restriction of using extra space.
#
# You could also try reversing an integer. However, if you have solved the problem "Reverse Integer", you know that the reversed integer might overflow. How would you handle such case?
#
# There is a more generic way of solving this problem.
# ==============================================================================
class Solution:
# @param {integer} x
# @return {boolean}
def isPalindrome(self, x):
if x < 0:
return False
tmp_str = str(x)
for i in range(0, len(tmp_str)/2):
if tmp_str[i] != tmp_str[-(i+1)]:
return False
return True | class Solution:
def is_palindrome(self, x):
if x < 0:
return False
tmp_str = str(x)
for i in range(0, len(tmp_str) / 2):
if tmp_str[i] != tmp_str[-(i + 1)]:
return False
return True |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def trellis_deps():
maybe(
http_archive,
name = "ecal",
build_file = Label("//third_party:ecal.BUILD"),
sha256 = "1d83d3accfb4a936ffd343524e4a626f0265e600226d6e997b3dbbd7f62eaac6",
strip_prefix = "ecal-5.10.0",
urls = [
"https://github.com/continental/ecal/archive/refs/tags/v5.10.0.tar.gz",
],
)
maybe(
http_archive,
name = "fmt",
build_file = Label("//third_party:fmt.BUILD"),
sha256 = "36016a75dd6e0a9c1c7df5edb98c93a3e77dabcf122de364116efb9f23c6954a",
strip_prefix = "fmt-8.0.0",
urls = [
"https://github.com/fmtlib/fmt/releases/download/8.0.0/fmt-8.0.0.zip",
],
)
maybe(
http_archive,
name = "yaml-cpp",
sha256 = "43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3",
strip_prefix = "yaml-cpp-yaml-cpp-0.7.0",
urls = [
"https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.7.0.tar.gz",
],
)
maybe(
http_archive,
name = "cxxopts",
build_file = Label("//third_party:cxxopts.BUILD"),
sha256 = "984aa3c8917d649b14d7f6277104ce38dd142ce378a9198ec926f03302399681",
strip_prefix = "cxxopts-2.2.1",
urls = [
"https://github.com/jarro2783/cxxopts/archive/refs/tags/v2.2.1.tar.gz",
],
)
maybe(
http_archive,
name = "tclap",
build_file = Label("//third_party:tclap.BUILD"),
sha256 = "7363f8f571e6e733b269c4b4e9c18f392d3cd7240d39a379d95de5a4c4bdc47f",
strip_prefix = "tclap-1.2.4",
urls = [
"https://github.com/xguerin/tclap/archive/refs/tags/v1.2.4.tar.gz",
],
)
maybe(
http_archive,
name = "asio",
build_file = Label("//third_party:asio.BUILD"),
sha256 = "5ee191aee825dfb1325cbacf643d599b186de057c88464ea98f1bae5ba4ff47a",
strip_prefix = "asio-asio-1-19-2",
urls = [
"https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-19-2.tar.gz",
],
)
maybe(
http_archive,
name = "gtest",
sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb",
strip_prefix = "googletest-release-1.10.0",
urls = [
"https://github.com/google/googletest/archive/release-1.10.0.tar.gz", # Oct 3, 2019
],
)
maybe(
http_archive,
name = "simpleini",
build_file = Label("//third_party:simpleini.BUILD"),
sha256 = "14e5bc1cb318ed374d45d6faf48da0b79db7e069c12ec6e090523b8652ef47c7",
strip_prefix = "simpleini-4.17",
urls = [
"https://github.com/brofield/simpleini/archive/refs/tags/4.17.tar.gz",
],
)
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "cf63d46ef743f4c30b0e36a562caf83cabed3f10e6ca49eb476913c4655394d5",
strip_prefix = "protobuf-436bd7880e458532901c58f4d9d1ea23fa7edd52",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/protobuf/archive/436bd7880e458532901c58f4d9d1ea23fa7edd52.tar.gz",
"https://github.com/google/protobuf/archive/436bd7880e458532901c58f4d9d1ea23fa7edd52.tar.gz",
],
)
maybe(
http_archive,
name = "hdf5",
build_file = Label("//third_party:hdf5.BUILD"),
sha256 = "7a1a0a54371275ce2dfc5cd093775bb025c365846512961e7e5ceaecb437ef15",
strip_prefix = "hdf5-1.10.7",
urls = [
"https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_10_7/src/hdf5-1.10.7.tar.gz", # Oct 16, 2020
],
)
maybe(
http_archive,
name = "termcolor",
build_file = Label("//third_party:termcolor.BUILD"),
sha256 = "4a73a77053822ca1ed6d4a2af416d31028ec992fb0ffa794af95bd6216bb6a20",
strip_prefix = "termcolor-2.0.0",
urls = [
"https://github.com/ikalnytskyi/termcolor/archive/refs/tags/v2.0.0.tar.gz",
],
)
maybe(
http_archive,
name = "spdlog",
build_file = Label("//third_party:spdlog.BUILD"),
sha256 = "6fff9215f5cb81760be4cc16d033526d1080427d236e86d70bb02994f85e3d38",
strip_prefix = "spdlog-1.9.2",
urls = [
"https://github.com/gabime/spdlog/archive/refs/tags/v1.9.2.tar.gz",
],
)
maybe(
http_archive,
name = "json",
build_file = Label("//third_party:json.BUILD"),
sha256 = "61e605be15e88deeac4582aaf01c09d616f8302edde7adcaba9261ddc3b4ceca",
strip_prefix = "single_include/nlohmann",
urls = [
"https://github.com/nlohmann/json/releases/download/v3.10.2/include.zip",
],
)
# New eCAL dependency as of v5.10.0
maybe(
http_archive,
name = "tcp_pubsub",
build_file = Label("//third_party:tcp_pubsub.BUILD"),
sha256 = "c335faf859219070ef67d62821a5f9ac5a308152bf7a1293a0d0cc74fefb9b58",
strip_prefix = "tcp_pubsub-1.0.0/tcp_pubsub",
urls = [
"https://github.com/continental/tcp_pubsub/archive/refs/tags/v1.0.0.tar.gz",
],
)
# Submodule of tcp_pubsub
maybe(
http_archive,
name = "recycle",
build_file = Label("//third_party:recycle.BUILD"),
sha256 = "d1cf8a5256110c068f366b0e4e16ad39427b9def13876670aad9f167afd7aaee",
strip_prefix = "recycle-c5425709b2273ef6371647247d1a1d86aa75c2e6",
urls = [
"https://github.com/steinwurf/recycle/archive/c5425709b2273ef6371647247d1a1d86aa75c2e6.tar.gz",
],
)
maybe(
http_archive,
name = "rules_pkg",
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
],
)
maybe(
http_archive,
name = "variadic_table",
build_file = Label("//third_party:variadic_table.BUILD"),
sha256 = "6799c0ee507fb3c739bde936630fc826f3c13abeb7b3245ebf997a6446fd0cb3",
strip_prefix = "variadic_table-82fcf65c00c70afca95f71c0c77fba1982a20a86",
urls = [
"https://github.com/friedmud/variadic_table/archive/82fcf65c00c70afca95f71c0c77fba1982a20a86.tar.gz",
],
)
maybe(
http_archive,
name = "eigen",
build_file = Label("//third_party:eigen.BUILD"),
sha256 = "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72",
strip_prefix = "eigen-3.4.0",
urls = [
"https://github.com/agtonomy/eigen/archive/refs/tags/3.4.0.tar.gz",
],
)
| load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def trellis_deps():
maybe(http_archive, name='ecal', build_file=label('//third_party:ecal.BUILD'), sha256='1d83d3accfb4a936ffd343524e4a626f0265e600226d6e997b3dbbd7f62eaac6', strip_prefix='ecal-5.10.0', urls=['https://github.com/continental/ecal/archive/refs/tags/v5.10.0.tar.gz'])
maybe(http_archive, name='fmt', build_file=label('//third_party:fmt.BUILD'), sha256='36016a75dd6e0a9c1c7df5edb98c93a3e77dabcf122de364116efb9f23c6954a', strip_prefix='fmt-8.0.0', urls=['https://github.com/fmtlib/fmt/releases/download/8.0.0/fmt-8.0.0.zip'])
maybe(http_archive, name='yaml-cpp', sha256='43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3', strip_prefix='yaml-cpp-yaml-cpp-0.7.0', urls=['https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.7.0.tar.gz'])
maybe(http_archive, name='cxxopts', build_file=label('//third_party:cxxopts.BUILD'), sha256='984aa3c8917d649b14d7f6277104ce38dd142ce378a9198ec926f03302399681', strip_prefix='cxxopts-2.2.1', urls=['https://github.com/jarro2783/cxxopts/archive/refs/tags/v2.2.1.tar.gz'])
maybe(http_archive, name='tclap', build_file=label('//third_party:tclap.BUILD'), sha256='7363f8f571e6e733b269c4b4e9c18f392d3cd7240d39a379d95de5a4c4bdc47f', strip_prefix='tclap-1.2.4', urls=['https://github.com/xguerin/tclap/archive/refs/tags/v1.2.4.tar.gz'])
maybe(http_archive, name='asio', build_file=label('//third_party:asio.BUILD'), sha256='5ee191aee825dfb1325cbacf643d599b186de057c88464ea98f1bae5ba4ff47a', strip_prefix='asio-asio-1-19-2', urls=['https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-19-2.tar.gz'])
maybe(http_archive, name='gtest', sha256='9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb', strip_prefix='googletest-release-1.10.0', urls=['https://github.com/google/googletest/archive/release-1.10.0.tar.gz'])
maybe(http_archive, name='simpleini', build_file=label('//third_party:simpleini.BUILD'), sha256='14e5bc1cb318ed374d45d6faf48da0b79db7e069c12ec6e090523b8652ef47c7', strip_prefix='simpleini-4.17', urls=['https://github.com/brofield/simpleini/archive/refs/tags/4.17.tar.gz'])
maybe(http_archive, name='com_google_protobuf', sha256='cf63d46ef743f4c30b0e36a562caf83cabed3f10e6ca49eb476913c4655394d5', strip_prefix='protobuf-436bd7880e458532901c58f4d9d1ea23fa7edd52', urls=['https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/protobuf/archive/436bd7880e458532901c58f4d9d1ea23fa7edd52.tar.gz', 'https://github.com/google/protobuf/archive/436bd7880e458532901c58f4d9d1ea23fa7edd52.tar.gz'])
maybe(http_archive, name='hdf5', build_file=label('//third_party:hdf5.BUILD'), sha256='7a1a0a54371275ce2dfc5cd093775bb025c365846512961e7e5ceaecb437ef15', strip_prefix='hdf5-1.10.7', urls=['https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_10_7/src/hdf5-1.10.7.tar.gz'])
maybe(http_archive, name='termcolor', build_file=label('//third_party:termcolor.BUILD'), sha256='4a73a77053822ca1ed6d4a2af416d31028ec992fb0ffa794af95bd6216bb6a20', strip_prefix='termcolor-2.0.0', urls=['https://github.com/ikalnytskyi/termcolor/archive/refs/tags/v2.0.0.tar.gz'])
maybe(http_archive, name='spdlog', build_file=label('//third_party:spdlog.BUILD'), sha256='6fff9215f5cb81760be4cc16d033526d1080427d236e86d70bb02994f85e3d38', strip_prefix='spdlog-1.9.2', urls=['https://github.com/gabime/spdlog/archive/refs/tags/v1.9.2.tar.gz'])
maybe(http_archive, name='json', build_file=label('//third_party:json.BUILD'), sha256='61e605be15e88deeac4582aaf01c09d616f8302edde7adcaba9261ddc3b4ceca', strip_prefix='single_include/nlohmann', urls=['https://github.com/nlohmann/json/releases/download/v3.10.2/include.zip'])
maybe(http_archive, name='tcp_pubsub', build_file=label('//third_party:tcp_pubsub.BUILD'), sha256='c335faf859219070ef67d62821a5f9ac5a308152bf7a1293a0d0cc74fefb9b58', strip_prefix='tcp_pubsub-1.0.0/tcp_pubsub', urls=['https://github.com/continental/tcp_pubsub/archive/refs/tags/v1.0.0.tar.gz'])
maybe(http_archive, name='recycle', build_file=label('//third_party:recycle.BUILD'), sha256='d1cf8a5256110c068f366b0e4e16ad39427b9def13876670aad9f167afd7aaee', strip_prefix='recycle-c5425709b2273ef6371647247d1a1d86aa75c2e6', urls=['https://github.com/steinwurf/recycle/archive/c5425709b2273ef6371647247d1a1d86aa75c2e6.tar.gz'])
maybe(http_archive, name='rules_pkg', sha256='62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66', urls=['https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz', 'https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz'])
maybe(http_archive, name='variadic_table', build_file=label('//third_party:variadic_table.BUILD'), sha256='6799c0ee507fb3c739bde936630fc826f3c13abeb7b3245ebf997a6446fd0cb3', strip_prefix='variadic_table-82fcf65c00c70afca95f71c0c77fba1982a20a86', urls=['https://github.com/friedmud/variadic_table/archive/82fcf65c00c70afca95f71c0c77fba1982a20a86.tar.gz'])
maybe(http_archive, name='eigen', build_file=label('//third_party:eigen.BUILD'), sha256='8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72', strip_prefix='eigen-3.4.0', urls=['https://github.com/agtonomy/eigen/archive/refs/tags/3.4.0.tar.gz']) |
# VOLTAGE and CURRENT
#: Unit for Voltage
UNIT_VOLT = 'V'
#: Unit for Voltage*10^-3
UNIT_MILLI_VOLT = 'mV'
#: Unit for Current
UNIT_AMPERE = 'A'
#: Unit for Current*10^-3
UNIT_MILLI_AMPERE = 'mA'
#: Unit for Current*10^-6
UNIT_MICRO_AMPERE = 'uA'
# FREQUENCY
#: Unit for Frequencies
UNIT_HERTZ = 'Hz'
#: Unit for Frequencies*10^3
UNIT_KILO_HERTZ = 'kHz'
# POWER
#: Unit for reactive power
UNIT_VOLT_AMPERE = 'VA'
#: Unit for power*10^-3
UNIT_MILLI_WATT = 'mW'
#: Unit for power
UNIT_WATT = 'W'
#: Unit for power*10^3
UNIT_KILO_WATT = 'kW'
#: Unit for energy*10^3
UNIT_KILO_WATT_HOURS = 'kWh'
# TIME
#: Unit for seconds
UNIT_SECONDS = 's'
#: Unit for milliseconds
UNIT_MILLI_SECONDS = 'ms'
#: Unit for microseconds
UNIT_MICRO_SECONDS = 'us'
#: Unit for minutes
UNIT_MINUTES = 'min'
#: Unit for hours
UNIT_HOURS = 'h'
#: Unit for days
UNIT_DAYS = 'd'
| unit_volt = 'V'
unit_milli_volt = 'mV'
unit_ampere = 'A'
unit_milli_ampere = 'mA'
unit_micro_ampere = 'uA'
unit_hertz = 'Hz'
unit_kilo_hertz = 'kHz'
unit_volt_ampere = 'VA'
unit_milli_watt = 'mW'
unit_watt = 'W'
unit_kilo_watt = 'kW'
unit_kilo_watt_hours = 'kWh'
unit_seconds = 's'
unit_milli_seconds = 'ms'
unit_micro_seconds = 'us'
unit_minutes = 'min'
unit_hours = 'h'
unit_days = 'd' |
players = ['Nicola', 'Penny', 'Dom', 'Nathan', 'Josie']
print(f"Friends: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}")
find = input("Who did you find? ")
if find in players:
print(f"{find} has turned into a zombie!")
players[players.index(find)] = "Zombie"
print(f"Remaining players: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}")
else:
print("Everyone is still in the game!")
print(f"Remaining players: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}") | players = ['Nicola', 'Penny', 'Dom', 'Nathan', 'Josie']
print(f'Friends: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}')
find = input('Who did you find? ')
if find in players:
print(f'{find} has turned into a zombie!')
players[players.index(find)] = 'Zombie'
print(f'Remaining players: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}')
else:
print('Everyone is still in the game!')
print(f'Remaining players: {players[0]}, {players[1]}, {players[2]}, {players[3]}, {players[4]}') |
WINDOW_WIDTH = 560
MODE_SELECTOR_HEIGHT = 50
CONTROLS_FRAME_HEIGHT = 80
KEYBOARD_HEIGHT = 160
SCORE_DISPLAY_HEIGHT = 110
WINDOW_HEIGHT = KEYBOARD_HEIGHT + CONTROLS_FRAME_HEIGHT + MODE_SELECTOR_HEIGHT + SCORE_DISPLAY_HEIGHT
CHOICES = ['Scales','Chords','Chord Progressions']
| window_width = 560
mode_selector_height = 50
controls_frame_height = 80
keyboard_height = 160
score_display_height = 110
window_height = KEYBOARD_HEIGHT + CONTROLS_FRAME_HEIGHT + MODE_SELECTOR_HEIGHT + SCORE_DISPLAY_HEIGHT
choices = ['Scales', 'Chords', 'Chord Progressions'] |
'''
Writing and reading files using w+
'''
f=open("foo.txt","w+")
f.writelines(["Hello\n","This is a new line"])
f.flush()
f.seek(0)
print(f.read())
f.close()
| """
Writing and reading files using w+
"""
f = open('foo.txt', 'w+')
f.writelines(['Hello\n', 'This is a new line'])
f.flush()
f.seek(0)
print(f.read())
f.close() |
class Solution:
def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
def _build(l1, r1, l2, r2):
if l1 > r1:
return None
if l1 == r1 or l2 == r2:
return TreeNode(postorder[l2])
root = TreeNode(postorder[r2])
idx = inorder.index(root.val)
root.left = _build(l1, idx - 1, l2, l2 + idx - 1 - l1)
root.right = _build(idx + 1, r1, l2 + idx - l1, r2 - 1)
return root
n = len(inorder)
return _build(0, n - 1, 0, n - 1)
| class Solution:
def build_tree(self, inorder: List[int], postorder: List[int]) -> TreeNode:
def _build(l1, r1, l2, r2):
if l1 > r1:
return None
if l1 == r1 or l2 == r2:
return tree_node(postorder[l2])
root = tree_node(postorder[r2])
idx = inorder.index(root.val)
root.left = _build(l1, idx - 1, l2, l2 + idx - 1 - l1)
root.right = _build(idx + 1, r1, l2 + idx - l1, r2 - 1)
return root
n = len(inorder)
return _build(0, n - 1, 0, n - 1) |
class ProductFileMetadata(object):
def __init__(self, output_name, local_path, media_type=None, remote_path=None, data_start=None, data_end=None,
geojson=None):
self.data_start = data_start
self.data_end = data_end
self.geojson = geojson
self.local_path = local_path
self.media_type = media_type
self.output_name = output_name
self.remote_path = remote_path | class Productfilemetadata(object):
def __init__(self, output_name, local_path, media_type=None, remote_path=None, data_start=None, data_end=None, geojson=None):
self.data_start = data_start
self.data_end = data_end
self.geojson = geojson
self.local_path = local_path
self.media_type = media_type
self.output_name = output_name
self.remote_path = remote_path |
{
"name": "PersianTweets",
"version": "2020",
"task": "Corpus",
"splits": [],
"description": "LSCP: Enhanced Large Scale Colloquial Persian Language Understanding <br>\nLearn more about this study at https://iasbs.ac.ir/~ansari/lscp/",
"size": 20665964,
"filenames": ["lscp-0.5-fa-normalized.txt"]
}
| {'name': 'PersianTweets', 'version': '2020', 'task': 'Corpus', 'splits': [], 'description': 'LSCP: Enhanced Large Scale Colloquial Persian Language Understanding <br>\nLearn more about this study at https://iasbs.ac.ir/~ansari/lscp/', 'size': 20665964, 'filenames': ['lscp-0.5-fa-normalized.txt']} |
class LoginLimiter(object):
# use an array to keep track of most recent 10 requests
def __init__(self):
self.rctCalls = []
# receive timestamp of a call attempt
# return true if call is allowed
def isAllowed(self, ts):
if len(self.rctCalls) < 10:
# when client has made less than 10 requests, always pass request
self.rctCalls.append(ts)
print("Call API at timestamp %s" % ts)
return True
else:
# when client has made at least 10 requests, pass request only when
# new request is made less than 60 seconds after 10th most recent legal call
if ts - self.rctCalls[0] < 60:
# deny call
print("Exceeding call limit at timestamp %s. Call denied" % ts)
return False
else:
# pass call and update cache
self.rctCalls.pop(0)
self.rctCalls.append(ts)
print("Call API at timestamp %s" % ts)
return True
# test limiter functionality
print("\nTest basic limiter functionality:")
solver = LoginLimiter()
timestamps = [i * 5 for i in range(100)]
for ts in timestamps:
solver.isAllowed(ts)
print("\nTest multiple clients:")
# apply limiter to multiple client IDs
clientID = ["A", "B"]
clients = {ID: LoginLimiter() for ID in clientID}
# let multiple clients call API simultaneously
timestamps = [i for i in range(15)]
for ts in timestamps:
for ID in clients:
limiter = clients[ID]
print("client ID: %s" % ID, end=' ')
limiter.isAllowed(ts) | class Loginlimiter(object):
def __init__(self):
self.rctCalls = []
def is_allowed(self, ts):
if len(self.rctCalls) < 10:
self.rctCalls.append(ts)
print('Call API at timestamp %s' % ts)
return True
elif ts - self.rctCalls[0] < 60:
print('Exceeding call limit at timestamp %s. Call denied' % ts)
return False
else:
self.rctCalls.pop(0)
self.rctCalls.append(ts)
print('Call API at timestamp %s' % ts)
return True
print('\nTest basic limiter functionality:')
solver = login_limiter()
timestamps = [i * 5 for i in range(100)]
for ts in timestamps:
solver.isAllowed(ts)
print('\nTest multiple clients:')
client_id = ['A', 'B']
clients = {ID: login_limiter() for id in clientID}
timestamps = [i for i in range(15)]
for ts in timestamps:
for id in clients:
limiter = clients[ID]
print('client ID: %s' % ID, end=' ')
limiter.isAllowed(ts) |
class Node_Types:
image_texture = 'TEX_IMAGE'
pbr_node = 'BSDF_PRINCIPLED'
mapping = 'MAPPING'
normal_map = 'NORMAL_MAP'
bump_map = 'BUMP'
material_output = 'OUTPUT_MATERIAL'
class Shader_Node_Types:
emission = "ShaderNodeEmission"
image_texture = "ShaderNodeTexImage"
mapping = "ShaderNodeMapping"
normal = "ShaderNodeNormalMap"
ao = "ShaderNodeAmbientOcclusion"
uv = "ShaderNodeUVMap"
comp_image_node = 'CompositorNodeImage'
mix ="ShaderNodeMixRGB"
class Bake_Passes:
pbr = ["EMISSION"]
lightmap = ["NOISY", "NRM", "COLOR"]
ao = ["AO","COLOR"]
class Material_Suffix:
bake_type_mat_suffix = {
"pbr" : "_Bake",
"ao" : "_AO",
"lightmap" : "_AO"
}
| class Node_Types:
image_texture = 'TEX_IMAGE'
pbr_node = 'BSDF_PRINCIPLED'
mapping = 'MAPPING'
normal_map = 'NORMAL_MAP'
bump_map = 'BUMP'
material_output = 'OUTPUT_MATERIAL'
class Shader_Node_Types:
emission = 'ShaderNodeEmission'
image_texture = 'ShaderNodeTexImage'
mapping = 'ShaderNodeMapping'
normal = 'ShaderNodeNormalMap'
ao = 'ShaderNodeAmbientOcclusion'
uv = 'ShaderNodeUVMap'
comp_image_node = 'CompositorNodeImage'
mix = 'ShaderNodeMixRGB'
class Bake_Passes:
pbr = ['EMISSION']
lightmap = ['NOISY', 'NRM', 'COLOR']
ao = ['AO', 'COLOR']
class Material_Suffix:
bake_type_mat_suffix = {'pbr': '_Bake', 'ao': '_AO', 'lightmap': '_AO'} |
# https://www.codewars.com/kata/52b757663a95b11b3d00062d/
'''
Instructions :
Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased. The indexing just explained is zero based, so the zero-ith index is even, therefore that character should be upper cased.
The passed in string will only consist of alphabetical characters and spaces(' '). Spaces will only be present if there are multiple words. Words will be separated by a single space(' ').
Examples:
to_weird_case('String'); # => returns 'StRiNg'
to_weird_case('Weird string case') # => returns 'WeIrD StRiNg CaSe'
'''
def to_weird_case(string):
index = 0
new_string = ''
for word in string:
if word == ' ':
index = -1
new_string += word
elif index % 2 == 0:
new_string += word.upper()
else:
new_string += word.lower()
index += 1
return new_string
| """
Instructions :
Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased. The indexing just explained is zero based, so the zero-ith index is even, therefore that character should be upper cased.
The passed in string will only consist of alphabetical characters and spaces(' '). Spaces will only be present if there are multiple words. Words will be separated by a single space(' ').
Examples:
to_weird_case('String'); # => returns 'StRiNg'
to_weird_case('Weird string case') # => returns 'WeIrD StRiNg CaSe'
"""
def to_weird_case(string):
index = 0
new_string = ''
for word in string:
if word == ' ':
index = -1
new_string += word
elif index % 2 == 0:
new_string += word.upper()
else:
new_string += word.lower()
index += 1
return new_string |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
'target_name': 'device_hid',
'type': 'static_library',
'include_dirs': [
'../..',
],
'dependencies': [
'../../components/components.gyp:device_event_log_component',
'../../net/net.gyp:net',
'../core/core.gyp:device_core',
],
'sources': [
'hid_collection_info.cc',
'hid_collection_info.h',
'hid_connection.cc',
'hid_connection.h',
'hid_connection_linux.cc',
'hid_connection_linux.h',
'hid_connection_mac.cc',
'hid_connection_mac.h',
'hid_connection_win.cc',
'hid_connection_win.h',
'hid_device_filter.cc',
'hid_device_filter.h',
'hid_device_info.cc',
'hid_device_info.h',
'hid_device_info_linux.cc',
'hid_device_info_linux.h',
'hid_report_descriptor.cc',
'hid_report_descriptor.h',
'hid_report_descriptor_item.cc',
'hid_report_descriptor_item.h',
'hid_service.cc',
'hid_service.h',
'hid_service_mac.cc',
'hid_service_mac.h',
'hid_service_win.cc',
'hid_service_win.h',
'hid_usage_and_page.cc',
'hid_usage_and_page.h',
],
'conditions': [
['OS=="linux" and use_udev==1', {
'dependencies': [
'../udev_linux/udev.gyp:udev_linux',
],
'sources': [
'fake_input_service_linux.cc',
'fake_input_service_linux.h',
'hid_service_linux.cc',
'hid_service_linux.h',
'input_service_linux.cc',
'input_service_linux.h',
],
}],
['OS=="win"', {
'all_dependent_settings': {
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'hid.lib',
'setupapi.lib',
],
},
},
},
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'hid.lib',
'setupapi.lib',
],
},
},
}],
],
},
{
'target_name': 'device_hid_mocks',
'type': 'static_library',
'include_dirs': [
'../..',
],
'dependencies': [
'../../testing/gmock.gyp:gmock',
'device_hid',
],
'sources': [
'mock_hid_service.cc',
'mock_hid_service.h',
],
},
],
}
| {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'device_hid', 'type': 'static_library', 'include_dirs': ['../..'], 'dependencies': ['../../components/components.gyp:device_event_log_component', '../../net/net.gyp:net', '../core/core.gyp:device_core'], 'sources': ['hid_collection_info.cc', 'hid_collection_info.h', 'hid_connection.cc', 'hid_connection.h', 'hid_connection_linux.cc', 'hid_connection_linux.h', 'hid_connection_mac.cc', 'hid_connection_mac.h', 'hid_connection_win.cc', 'hid_connection_win.h', 'hid_device_filter.cc', 'hid_device_filter.h', 'hid_device_info.cc', 'hid_device_info.h', 'hid_device_info_linux.cc', 'hid_device_info_linux.h', 'hid_report_descriptor.cc', 'hid_report_descriptor.h', 'hid_report_descriptor_item.cc', 'hid_report_descriptor_item.h', 'hid_service.cc', 'hid_service.h', 'hid_service_mac.cc', 'hid_service_mac.h', 'hid_service_win.cc', 'hid_service_win.h', 'hid_usage_and_page.cc', 'hid_usage_and_page.h'], 'conditions': [['OS=="linux" and use_udev==1', {'dependencies': ['../udev_linux/udev.gyp:udev_linux'], 'sources': ['fake_input_service_linux.cc', 'fake_input_service_linux.h', 'hid_service_linux.cc', 'hid_service_linux.h', 'input_service_linux.cc', 'input_service_linux.h']}], ['OS=="win"', {'all_dependent_settings': {'msvs_settings': {'VCLinkerTool': {'AdditionalDependencies': ['hid.lib', 'setupapi.lib']}}}, 'msvs_settings': {'VCLinkerTool': {'AdditionalDependencies': ['hid.lib', 'setupapi.lib']}}}]]}, {'target_name': 'device_hid_mocks', 'type': 'static_library', 'include_dirs': ['../..'], 'dependencies': ['../../testing/gmock.gyp:gmock', 'device_hid'], 'sources': ['mock_hid_service.cc', 'mock_hid_service.h']}]} |
'''
Abstract base class for audio speech and sound command processing. Provides
methods shared among all platform implementations.
Copyright (c) 2008 Carolina Computer Assistive Technology
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'''
class ChannelBase(object):
def __init__(self, ch_id):
# unique id for this channel
self.id = ch_id
# observer for channel callbacks
self.observer = None
# queue of utterances
self.queue = []
# deferred results
self.deferreds = {}
# latest deferred request id that stalled the queue
self.stalled_id = None
# busy flag; used instead of tts and sound busy methods which are
# not documented as to when they are set and reset
self.busy = False
# name assigned by the client to a speech utterance or sound that
# can be paired with callback data
self.name = None
def _processQueue(self):
while (not self.busy) and len(self.queue):
# peek at the top command to see if it is deferred
cmd = self.queue[0]
reqid = cmd.get('deferred')
if reqid is not None:
# check if the deferred result is already available
result = self.deferreds.get(reqid)
if result is None:
# store the current request ID
self.stalled_id = reqid
# and stall the queue for now
return
else:
# set the deferred result action to that of the original
result['action'] = cmd['action']
# remove the deferred from the list of deferreds
del self.deferreds[reqid]
# use the result instead of the original
cmd = result
# handle the next command
self._handleCommand(cmd)
# remember to pop the command
cmd = self.queue.pop(0)
def _handleCommand(self, cmd):
action = cmd.get('action')
if action == 'say':
self.say(cmd)
elif action == 'play':
self.play(cmd)
elif action == 'set-queued':
self.setProperty(cmd)
elif action == 'get-config':
self.getConfig(cmd)
elif action == 'reset-queued':
self.reset()
def setObserver(self, ob):
self.observer = ob
def pushRequest(self, cmd):
action = cmd.get('action')
if action == 'stop':
# process stops immediately
self.stop()
elif action == 'set-now':
# process immediate property changes
self.setProperty(cmd)
elif action == 'reset-now':
# process immediate reset of all properties
self.reset()
elif action == 'deferred-result':
# process incoming deferred result
self.deferred(cmd)
else:
# queue command; slight waste of time if we immediately pull it back
# out again, but it's clean
self.queue.append(cmd)
# process the queue
self._processQueue()
def deferred(self, cmd):
try:
reqid = cmd['deferred']
except KeyError:
return
# put the deferred into holding
self.deferreds[reqid] = cmd
# check if this deferred is the one that stalled the pipe
if reqid == self.stalled_id:
# if so, pump the queue
self._processQueue()
# if not, just continue
def stop(self):
# reset queue and flags
self.queue = []
self.busy = False
self.name = None
# reset deferreds
self.stalled_id = None
self.deferreds = {}
def shutdown(self):
self.observer = None
| """
Abstract base class for audio speech and sound command processing. Provides
methods shared among all platform implementations.
Copyright (c) 2008 Carolina Computer Assistive Technology
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
class Channelbase(object):
def __init__(self, ch_id):
self.id = ch_id
self.observer = None
self.queue = []
self.deferreds = {}
self.stalled_id = None
self.busy = False
self.name = None
def _process_queue(self):
while not self.busy and len(self.queue):
cmd = self.queue[0]
reqid = cmd.get('deferred')
if reqid is not None:
result = self.deferreds.get(reqid)
if result is None:
self.stalled_id = reqid
return
else:
result['action'] = cmd['action']
del self.deferreds[reqid]
cmd = result
self._handleCommand(cmd)
cmd = self.queue.pop(0)
def _handle_command(self, cmd):
action = cmd.get('action')
if action == 'say':
self.say(cmd)
elif action == 'play':
self.play(cmd)
elif action == 'set-queued':
self.setProperty(cmd)
elif action == 'get-config':
self.getConfig(cmd)
elif action == 'reset-queued':
self.reset()
def set_observer(self, ob):
self.observer = ob
def push_request(self, cmd):
action = cmd.get('action')
if action == 'stop':
self.stop()
elif action == 'set-now':
self.setProperty(cmd)
elif action == 'reset-now':
self.reset()
elif action == 'deferred-result':
self.deferred(cmd)
else:
self.queue.append(cmd)
self._processQueue()
def deferred(self, cmd):
try:
reqid = cmd['deferred']
except KeyError:
return
self.deferreds[reqid] = cmd
if reqid == self.stalled_id:
self._processQueue()
def stop(self):
self.queue = []
self.busy = False
self.name = None
self.stalled_id = None
self.deferreds = {}
def shutdown(self):
self.observer = None |
text = input().split(" ")
even_words = [i for i in text if len(i) % 2 == 0]
for word in even_words:
print(word) | text = input().split(' ')
even_words = [i for i in text if len(i) % 2 == 0]
for word in even_words:
print(word) |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def insertionSortList(self, head: ListNode) -> ListNode:
if head == None or head.next == None:
return head
cur = head
root = None
while cur!=None:
post = cur.next
cur.next = None
root = self.insertSort(root, cur)
cur = post
return root
def insertSort(self,root, node):
if root==None or node.val < root.val:
node.next = root
return node
cur = root
while cur.next != None and cur.next.val < node.val:
cur = cur.next
tmp = cur.next
cur.next = node
node.next = tmp
return root
| class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def insertion_sort_list(self, head: ListNode) -> ListNode:
if head == None or head.next == None:
return head
cur = head
root = None
while cur != None:
post = cur.next
cur.next = None
root = self.insertSort(root, cur)
cur = post
return root
def insert_sort(self, root, node):
if root == None or node.val < root.val:
node.next = root
return node
cur = root
while cur.next != None and cur.next.val < node.val:
cur = cur.next
tmp = cur.next
cur.next = node
node.next = tmp
return root |
#
# PySNMP MIB module APCUPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APCUPS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:07:20 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)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
enterprises, Unsigned32, TimeTicks, NotificationType, IpAddress, Counter32, Counter64, Gauge32, iso, ModuleIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, ObjectIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "enterprises", "Unsigned32", "TimeTicks", "NotificationType", "IpAddress", "Counter32", "Counter64", "Gauge32", "iso", "ModuleIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "ObjectIdentity", "Integer32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
class DmiCounter(Counter32):
pass
class DmiGauge(Gauge32):
pass
class DmiInteger(Integer32):
pass
class DmiDisplaystring(DisplayString):
pass
class DmiDateX(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(28, 28)
fixedLength = 28
class DmiComponentIndex(Integer32):
pass
apc = MibIdentifier((1, 3, 6, 1, 4, 1, 318))
products = MibIdentifier((1, 3, 6, 1, 4, 1, 318, 1))
software = MibIdentifier((1, 3, 6, 1, 4, 1, 318, 1, 2))
powerChuteDMIAgent = MibIdentifier((1, 3, 6, 1, 4, 1, 318, 1, 2, 2))
dmtfGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1))
tComponentid = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1), )
if mibBuilder.loadTexts: tComponentid.setStatus('mandatory')
eComponentid = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eComponentid.setStatus('mandatory')
a1Manufacturer = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 1), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a1Manufacturer.setStatus('mandatory')
a1Product = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 2), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a1Product.setStatus('mandatory')
a1Version = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 3), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a1Version.setStatus('mandatory')
a1SerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 4), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a1SerialNumber.setStatus('mandatory')
a1Installation = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 5), DmiDateX()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a1Installation.setStatus('mandatory')
a1Verify = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("vAnErrorOccuredCheckStatusCode", 0), ("vThisComponentDoesNotExist", 1), ("vVerificationIsNotSupported", 2), ("vReserved", 3), ("vThisComponentExistsButTheFunctionalityI", 4), ("vThisComponentExistsButTheFunctionality1", 5), ("vThisComponentExistsAndIsNotFunctioningC", 6), ("vThisComponentExistsAndIsFunctioningCorr", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a1Verify.setStatus('mandatory')
tUpsBattery = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2), )
if mibBuilder.loadTexts: tUpsBattery.setStatus('mandatory')
eUpsBattery = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eUpsBattery.setStatus('mandatory')
a2BatteryStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("vUnknown", 1), ("vBatteryNormal", 2), ("vBatteryLow", 3), ("vBatteryDepleted", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2BatteryStatus.setStatus('mandatory')
a2SecondsOnBattery = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 2), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2SecondsOnBattery.setStatus('mandatory')
a2EstimatedMinutesRemaining = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 3), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2EstimatedMinutesRemaining.setStatus('mandatory')
a2EstimatedChargeRemaining = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 4), DmiGauge()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2EstimatedChargeRemaining.setStatus('mandatory')
a2BatteryVoltage = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 5), DmiGauge()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2BatteryVoltage.setStatus('mandatory')
a2BatteryCurrent = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 6), DmiGauge()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2BatteryCurrent.setStatus('mandatory')
a2TemperatureProbeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 7), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2TemperatureProbeIndex.setStatus('mandatory')
a2FruGroupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 8), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2FruGroupIndex.setStatus('mandatory')
a2OperationalGroupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 9), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a2OperationalGroupIndex.setStatus('mandatory')
tTemperatureProbe = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3), )
if mibBuilder.loadTexts: tTemperatureProbe.setStatus('mandatory')
eTemperatureProbe = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eTemperatureProbe.setStatus('mandatory')
a3TemperatureProbeTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 1), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureProbeTableIndex.setStatus('mandatory')
a3TemperatureProbeLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vProcessor", 3), ("vDisk", 4), ("vPeripheralBay", 5), ("vSmbMaster", 6), ("vMotherboard", 7), ("vMemoryModule", 8), ("vProcessorModule", 9), ("vPowerUnit", 10), ("vAdd-inCard", 11)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureProbeLocation.setStatus('mandatory')
a3TemperatureProbeDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 3), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureProbeDescription.setStatus('mandatory')
a3TemperatureStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vOk", 3), ("vNon-critical", 4), ("vCritical", 5), ("vNon-recoverable", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureStatus.setStatus('mandatory')
a3TemperatureProbeTemperatureReading = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 5), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureProbeTemperatureReading.setStatus('mandatory')
a3MonitoredTemperatureNominalReading = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 6), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3MonitoredTemperatureNominalReading.setStatus('mandatory')
a3MonitoredTemperatureNormalMaximum = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 7), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3MonitoredTemperatureNormalMaximum.setStatus('mandatory')
a3MonitoredTemperatureNormalMinimum = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 8), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3MonitoredTemperatureNormalMinimum.setStatus('mandatory')
a3TemperatureProbeMaximum = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 9), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureProbeMaximum.setStatus('mandatory')
a3TemperatureProbeMinimum = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 10), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3TemperatureProbeMinimum.setStatus('mandatory')
a3TemperatureReadingLowerThreshold_Non_c = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 11), DmiInteger()).setLabel("a3TemperatureReadingLowerThreshold-Non-c").setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureReadingLowerThreshold_Non_c.setStatus('mandatory')
a3TemperatureReadingUpperThreshold_Non_c = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 12), DmiInteger()).setLabel("a3TemperatureReadingUpperThreshold-Non-c").setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureReadingUpperThreshold_Non_c.setStatus('mandatory')
a3TemperatureReadingLowerThreshold_Criti = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 13), DmiInteger()).setLabel("a3TemperatureReadingLowerThreshold-Criti").setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureReadingLowerThreshold_Criti.setStatus('mandatory')
a3TemperatureReadingUpperThreshold_Criti = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 14), DmiInteger()).setLabel("a3TemperatureReadingUpperThreshold-Criti").setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureReadingUpperThreshold_Criti.setStatus('mandatory')
a3TemperatureReadingLowerThreshold_Non_r = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 15), DmiInteger()).setLabel("a3TemperatureReadingLowerThreshold-Non-r").setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureReadingLowerThreshold_Non_r.setStatus('mandatory')
a3TemperatureReadingUpperThreshold_Non_r = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 16), DmiInteger()).setLabel("a3TemperatureReadingUpperThreshold-Non-r").setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureReadingUpperThreshold_Non_r.setStatus('mandatory')
a3TemperatureProbeResolution = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 17), DmiInteger()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureProbeResolution.setStatus('mandatory')
a3TemperatureProbeTolerance = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 18), DmiInteger()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureProbeTolerance.setStatus('mandatory')
a3TemperatureProbeAccuracy = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 19), DmiInteger()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a3TemperatureProbeAccuracy.setStatus('mandatory')
a3FruGroupIndex = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 20), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3FruGroupIndex.setStatus('mandatory')
a3OperationalGroupIndex = MibScalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 21), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a3OperationalGroupIndex.setStatus('mandatory')
tOperationalStateTable = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4), )
if mibBuilder.loadTexts: tOperationalStateTable.setStatus('mandatory')
eOperationalStateTable = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"), (0, "APCUPS-MIB", "a4OperationalStateInstanceIndex"))
if mibBuilder.loadTexts: eOperationalStateTable.setStatus('mandatory')
a4OperationalStateInstanceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 1), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4OperationalStateInstanceIndex.setStatus('mandatory')
a4DeviceGroupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 2), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4DeviceGroupIndex.setStatus('mandatory')
a4OperationalStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vEnabled", 3), ("vDisabled", 4), ("vNotApplicable", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4OperationalStatus.setStatus('mandatory')
a4UsageState = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vIdle", 3), ("vActive", 4), ("vBusy", 5), ("vNotApplicable", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4UsageState.setStatus('mandatory')
a4AvailabilityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vRunning", 3), ("vWarning", 4), ("vInTest", 5), ("vNotApplicable", 6), ("vPowerOff", 7), ("vOffLine", 8), ("vOffDuty", 9), ("vDegraded", 10), ("vNotInstalled", 11), ("vInstallError", 12), ("vPowerSave", 13)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4AvailabilityStatus.setStatus('mandatory')
a4AdministrativeState = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vLocked", 3), ("vUnlocked", 4), ("vNotApplicable", 5), ("vShuttingDown", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4AdministrativeState.setStatus('mandatory')
a4FatalErrorCount = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 7), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4FatalErrorCount.setStatus('mandatory')
a4MajorErrorCount = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 8), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4MajorErrorCount.setStatus('mandatory')
a4WarningErrorCount = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 9), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4WarningErrorCount.setStatus('mandatory')
a4CurrentErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vOk", 3), ("vNon-critical", 4), ("vCritical", 5), ("vNon-recoverable", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a4CurrentErrorStatus.setStatus('mandatory')
tDiagnostics = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5), )
if mibBuilder.loadTexts: tDiagnostics.setStatus('mandatory')
eDiagnostics = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"), (0, "APCUPS-MIB", "a5DiagnosticFunctionTableIndex"))
if mibBuilder.loadTexts: eDiagnostics.setStatus('mandatory')
a5DiagnosticFunctionTableIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 1), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a5DiagnosticFunctionTableIndex.setStatus('mandatory')
a5DiagnosticFunctionName = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 2), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a5DiagnosticFunctionName.setStatus('mandatory')
a5DiagnosticFunctionDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 3), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a5DiagnosticFunctionDescription.setStatus('mandatory')
a5ExclusiveAccessRequired = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("vFalse", 0), ("vTrue", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a5ExclusiveAccessRequired.setStatus('mandatory')
a5PrerequisiteConditions = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("vOther", 1), ("vUnknown", 2), ("vNoPrerequisites", 3), ("vWrapPlugInstalled", 4), ("vNoMediaInstalled", 5), ("vScratchMediaInstalled", 6), ("vTestMediaInstalled", 7), ("vSystemReferenceDisketteInstalled", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a5PrerequisiteConditions.setStatus('mandatory')
a5PrerequisiteDiagnosticFunction = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 6), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a5PrerequisiteDiagnosticFunction.setStatus('mandatory')
tDiagnosticRequestGroup = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6), )
if mibBuilder.loadTexts: tDiagnosticRequestGroup.setStatus('mandatory')
eDiagnosticRequestGroup = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eDiagnosticRequestGroup.setStatus('mandatory')
a6DiagnosticFunctionReserveKey = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1, 1), DmiInteger()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a6DiagnosticFunctionReserveKey.setStatus('mandatory')
a6DiagnosticFunctionRequest = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1, 2), DmiInteger()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a6DiagnosticFunctionRequest.setStatus('mandatory')
a6DiagnosticFunctionResult = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1, 3), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a6DiagnosticFunctionResult.setStatus('mandatory')
tDiagnosticResults = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7), )
if mibBuilder.loadTexts: tDiagnosticResults.setStatus('mandatory')
eDiagnosticResults = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"), (0, "APCUPS-MIB", "a7DiagnosticFunctionId"), (0, "APCUPS-MIB", "a7DiagnosticFunctionResult"))
if mibBuilder.loadTexts: eDiagnosticResults.setStatus('mandatory')
a7DiagnosticFunctionId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 1), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a7DiagnosticFunctionId.setStatus('mandatory')
a7DiagnosticFunctionResult = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 2), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a7DiagnosticFunctionResult.setStatus('mandatory')
a7DiagnosticFunctionResultDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 3), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a7DiagnosticFunctionResultDescription.setStatus('mandatory')
a7FaultIsolatedToThisComponent = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("vFalse", 0), ("vTrue", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a7FaultIsolatedToThisComponent.setStatus('mandatory')
tErrorControlGroup = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8), )
if mibBuilder.loadTexts: tErrorControlGroup.setStatus('mandatory')
eErrorControlGroup = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eErrorControlGroup.setStatus('mandatory')
a8Selfid = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 1), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a8Selfid.setStatus('mandatory')
a8NumberOfFatalErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 2), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a8NumberOfFatalErrors.setStatus('mandatory')
a8NumberOfMajorErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 3), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a8NumberOfMajorErrors.setStatus('mandatory')
a8NumberOfWarnings = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 4), DmiCounter()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a8NumberOfWarnings.setStatus('mandatory')
a8ErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("vOk", 0), ("vWarning", 1), ("vMajor", 2), ("vFatal", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a8ErrorStatus.setStatus('mandatory')
a8ErrorStatusType = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("vPost", 0), ("vRuntime", 1), ("vDiagnosticTest", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: a8ErrorStatusType.setStatus('mandatory')
a8AlarmGeneration = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("vOff", 0), ("vOn", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a8AlarmGeneration.setStatus('mandatory')
tMiftomib = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99), )
if mibBuilder.loadTexts: tMiftomib.setStatus('mandatory')
eMiftomib = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eMiftomib.setStatus('mandatory')
a99MibName = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1, 1), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a99MibName.setStatus('mandatory')
a99MibOid = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1, 2), DmiDisplaystring()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a99MibOid.setStatus('mandatory')
a99DisableTrap = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1, 3), DmiInteger()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: a99DisableTrap.setStatus('mandatory')
tTrapGroup = MibTable((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999), )
if mibBuilder.loadTexts: tTrapGroup.setStatus('mandatory')
eTrapGroup = MibTableRow((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1), ).setIndexNames((0, "APCUPS-MIB", "DmiComponentIndex"))
if mibBuilder.loadTexts: eTrapGroup.setStatus('mandatory')
a9999ErrorTime = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ErrorTime.setStatus('mandatory')
a9999ErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 2), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ErrorStatus.setStatus('mandatory')
a9999ErrorGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 3), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ErrorGroupId.setStatus('mandatory')
a9999ErrorInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 4), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ErrorInstanceId.setStatus('mandatory')
a9999ComponentId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 5), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ComponentId.setStatus('mandatory')
a9999GroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 6), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999GroupId.setStatus('mandatory')
a9999InstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 7), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999InstanceId.setStatus('mandatory')
a9999VendorCode1 = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 8), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999VendorCode1.setStatus('mandatory')
a9999VendorCode2 = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 9), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999VendorCode2.setStatus('mandatory')
a9999VendorText = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 10), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999VendorText.setStatus('mandatory')
a9999ParentGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 11), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ParentGroupId.setStatus('mandatory')
a9999ParentInstanceId = MibTableColumn((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 12), DmiInteger()).setMaxAccess("readonly")
if mibBuilder.loadTexts: a9999ParentInstanceId.setStatus('mandatory')
pwrchuteEventError = NotificationType((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1) + (0,1)).setObjects(("APCUPS-MIB", "a9999ErrorTime"), ("APCUPS-MIB", "a9999ErrorStatus"), ("APCUPS-MIB", "a9999ErrorGroupId"), ("APCUPS-MIB", "a9999ErrorInstanceId"), ("APCUPS-MIB", "a9999ComponentId"), ("APCUPS-MIB", "a9999GroupId"), ("APCUPS-MIB", "a9999InstanceId"), ("APCUPS-MIB", "a9999VendorCode1"), ("APCUPS-MIB", "a9999VendorCode2"), ("APCUPS-MIB", "a9999VendorText"), ("APCUPS-MIB", "a9999ParentGroupId"), ("APCUPS-MIB", "a9999ParentInstanceId"))
mibBuilder.exportSymbols("APCUPS-MIB", a9999GroupId=a9999GroupId, a4AvailabilityStatus=a4AvailabilityStatus, dmtfGroups=dmtfGroups, a8ErrorStatusType=a8ErrorStatusType, a2EstimatedMinutesRemaining=a2EstimatedMinutesRemaining, a9999ErrorInstanceId=a9999ErrorInstanceId, a6DiagnosticFunctionReserveKey=a6DiagnosticFunctionReserveKey, a1Installation=a1Installation, a3TemperatureProbeTemperatureReading=a3TemperatureProbeTemperatureReading, a3TemperatureReadingUpperThreshold_Criti=a3TemperatureReadingUpperThreshold_Criti, a3TemperatureProbeMaximum=a3TemperatureProbeMaximum, a9999ErrorStatus=a9999ErrorStatus, tDiagnosticResults=tDiagnosticResults, a9999ErrorTime=a9999ErrorTime, a5DiagnosticFunctionDescription=a5DiagnosticFunctionDescription, a5PrerequisiteConditions=a5PrerequisiteConditions, DmiCounter=DmiCounter, a3MonitoredTemperatureNormalMinimum=a3MonitoredTemperatureNormalMinimum, tOperationalStateTable=tOperationalStateTable, a9999ParentInstanceId=a9999ParentInstanceId, a8ErrorStatus=a8ErrorStatus, powerChuteDMIAgent=powerChuteDMIAgent, a2FruGroupIndex=a2FruGroupIndex, tUpsBattery=tUpsBattery, a5ExclusiveAccessRequired=a5ExclusiveAccessRequired, a5DiagnosticFunctionTableIndex=a5DiagnosticFunctionTableIndex, a99MibOid=a99MibOid, a6DiagnosticFunctionResult=a6DiagnosticFunctionResult, a3FruGroupIndex=a3FruGroupIndex, tDiagnostics=tDiagnostics, a9999InstanceId=a9999InstanceId, a4OperationalStateInstanceIndex=a4OperationalStateInstanceIndex, eErrorControlGroup=eErrorControlGroup, a6DiagnosticFunctionRequest=a6DiagnosticFunctionRequest, a9999ParentGroupId=a9999ParentGroupId, a2OperationalGroupIndex=a2OperationalGroupIndex, DmiDisplaystring=DmiDisplaystring, tComponentid=tComponentid, a4OperationalStatus=a4OperationalStatus, a3TemperatureReadingUpperThreshold_Non_c=a3TemperatureReadingUpperThreshold_Non_c, a3TemperatureProbeLocation=a3TemperatureProbeLocation, a3TemperatureProbeTolerance=a3TemperatureProbeTolerance, a4MajorErrorCount=a4MajorErrorCount, a3TemperatureProbeAccuracy=a3TemperatureProbeAccuracy, a1Version=a1Version, a3TemperatureProbeDescription=a3TemperatureProbeDescription, a4DeviceGroupIndex=a4DeviceGroupIndex, a9999VendorCode2=a9999VendorCode2, a3MonitoredTemperatureNormalMaximum=a3MonitoredTemperatureNormalMaximum, eOperationalStateTable=eOperationalStateTable, a3TemperatureReadingLowerThreshold_Non_c=a3TemperatureReadingLowerThreshold_Non_c, eDiagnostics=eDiagnostics, a99DisableTrap=a99DisableTrap, a2EstimatedChargeRemaining=a2EstimatedChargeRemaining, eTrapGroup=eTrapGroup, DmiInteger=DmiInteger, eTemperatureProbe=eTemperatureProbe, a3TemperatureProbeResolution=a3TemperatureProbeResolution, a2BatteryCurrent=a2BatteryCurrent, a1Manufacturer=a1Manufacturer, a3OperationalGroupIndex=a3OperationalGroupIndex, a1Verify=a1Verify, a9999ComponentId=a9999ComponentId, a8NumberOfFatalErrors=a8NumberOfFatalErrors, apc=apc, a3TemperatureProbeMinimum=a3TemperatureProbeMinimum, a3TemperatureStatus=a3TemperatureStatus, a7DiagnosticFunctionResult=a7DiagnosticFunctionResult, a1Product=a1Product, tTemperatureProbe=tTemperatureProbe, a7DiagnosticFunctionId=a7DiagnosticFunctionId, eMiftomib=eMiftomib, a4WarningErrorCount=a4WarningErrorCount, a8NumberOfMajorErrors=a8NumberOfMajorErrors, a3TemperatureReadingLowerThreshold_Criti=a3TemperatureReadingLowerThreshold_Criti, a2BatteryVoltage=a2BatteryVoltage, a9999ErrorGroupId=a9999ErrorGroupId, a5PrerequisiteDiagnosticFunction=a5PrerequisiteDiagnosticFunction, pwrchuteEventError=pwrchuteEventError, DmiComponentIndex=DmiComponentIndex, eDiagnosticResults=eDiagnosticResults, a9999VendorCode1=a9999VendorCode1, DmiGauge=DmiGauge, eDiagnosticRequestGroup=eDiagnosticRequestGroup, a8Selfid=a8Selfid, eComponentid=eComponentid, a4FatalErrorCount=a4FatalErrorCount, a8NumberOfWarnings=a8NumberOfWarnings, a3TemperatureProbeTableIndex=a3TemperatureProbeTableIndex, a2TemperatureProbeIndex=a2TemperatureProbeIndex, products=products, tErrorControlGroup=tErrorControlGroup, a4CurrentErrorStatus=a4CurrentErrorStatus, a4UsageState=a4UsageState, a2SecondsOnBattery=a2SecondsOnBattery, a3TemperatureReadingLowerThreshold_Non_r=a3TemperatureReadingLowerThreshold_Non_r, software=software, tMiftomib=tMiftomib, a3MonitoredTemperatureNominalReading=a3MonitoredTemperatureNominalReading, tTrapGroup=tTrapGroup, a2BatteryStatus=a2BatteryStatus, DmiDateX=DmiDateX, a99MibName=a99MibName, a1SerialNumber=a1SerialNumber, eUpsBattery=eUpsBattery, a8AlarmGeneration=a8AlarmGeneration, a4AdministrativeState=a4AdministrativeState, tDiagnosticRequestGroup=tDiagnosticRequestGroup, a3TemperatureReadingUpperThreshold_Non_r=a3TemperatureReadingUpperThreshold_Non_r, a7FaultIsolatedToThisComponent=a7FaultIsolatedToThisComponent, a7DiagnosticFunctionResultDescription=a7DiagnosticFunctionResultDescription, a5DiagnosticFunctionName=a5DiagnosticFunctionName, a9999VendorText=a9999VendorText)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, value_size_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(enterprises, unsigned32, time_ticks, notification_type, ip_address, counter32, counter64, gauge32, iso, module_identity, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, object_identity, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'enterprises', 'Unsigned32', 'TimeTicks', 'NotificationType', 'IpAddress', 'Counter32', 'Counter64', 'Gauge32', 'iso', 'ModuleIdentity', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'ObjectIdentity', 'Integer32')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
class Dmicounter(Counter32):
pass
class Dmigauge(Gauge32):
pass
class Dmiinteger(Integer32):
pass
class Dmidisplaystring(DisplayString):
pass
class Dmidatex(OctetString):
subtype_spec = OctetString.subtypeSpec + value_size_constraint(28, 28)
fixed_length = 28
class Dmicomponentindex(Integer32):
pass
apc = mib_identifier((1, 3, 6, 1, 4, 1, 318))
products = mib_identifier((1, 3, 6, 1, 4, 1, 318, 1))
software = mib_identifier((1, 3, 6, 1, 4, 1, 318, 1, 2))
power_chute_dmi_agent = mib_identifier((1, 3, 6, 1, 4, 1, 318, 1, 2, 2))
dmtf_groups = mib_identifier((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1))
t_componentid = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1))
if mibBuilder.loadTexts:
tComponentid.setStatus('mandatory')
e_componentid = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eComponentid.setStatus('mandatory')
a1_manufacturer = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 1), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a1Manufacturer.setStatus('mandatory')
a1_product = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 2), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a1Product.setStatus('mandatory')
a1_version = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 3), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a1Version.setStatus('mandatory')
a1_serial_number = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 4), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a1SerialNumber.setStatus('mandatory')
a1_installation = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 5), dmi_date_x()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a1Installation.setStatus('mandatory')
a1_verify = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('vAnErrorOccuredCheckStatusCode', 0), ('vThisComponentDoesNotExist', 1), ('vVerificationIsNotSupported', 2), ('vReserved', 3), ('vThisComponentExistsButTheFunctionalityI', 4), ('vThisComponentExistsButTheFunctionality1', 5), ('vThisComponentExistsAndIsNotFunctioningC', 6), ('vThisComponentExistsAndIsFunctioningCorr', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a1Verify.setStatus('mandatory')
t_ups_battery = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2))
if mibBuilder.loadTexts:
tUpsBattery.setStatus('mandatory')
e_ups_battery = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eUpsBattery.setStatus('mandatory')
a2_battery_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('vUnknown', 1), ('vBatteryNormal', 2), ('vBatteryLow', 3), ('vBatteryDepleted', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2BatteryStatus.setStatus('mandatory')
a2_seconds_on_battery = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 2), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2SecondsOnBattery.setStatus('mandatory')
a2_estimated_minutes_remaining = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 3), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2EstimatedMinutesRemaining.setStatus('mandatory')
a2_estimated_charge_remaining = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 4), dmi_gauge()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2EstimatedChargeRemaining.setStatus('mandatory')
a2_battery_voltage = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 5), dmi_gauge()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2BatteryVoltage.setStatus('mandatory')
a2_battery_current = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 6), dmi_gauge()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2BatteryCurrent.setStatus('mandatory')
a2_temperature_probe_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 7), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2TemperatureProbeIndex.setStatus('mandatory')
a2_fru_group_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 8), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2FruGroupIndex.setStatus('mandatory')
a2_operational_group_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 2, 1, 9), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a2OperationalGroupIndex.setStatus('mandatory')
t_temperature_probe = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3))
if mibBuilder.loadTexts:
tTemperatureProbe.setStatus('mandatory')
e_temperature_probe = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eTemperatureProbe.setStatus('mandatory')
a3_temperature_probe_table_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 1), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureProbeTableIndex.setStatus('mandatory')
a3_temperature_probe_location = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vProcessor', 3), ('vDisk', 4), ('vPeripheralBay', 5), ('vSmbMaster', 6), ('vMotherboard', 7), ('vMemoryModule', 8), ('vProcessorModule', 9), ('vPowerUnit', 10), ('vAdd-inCard', 11)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureProbeLocation.setStatus('mandatory')
a3_temperature_probe_description = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 3), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureProbeDescription.setStatus('mandatory')
a3_temperature_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vOk', 3), ('vNon-critical', 4), ('vCritical', 5), ('vNon-recoverable', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureStatus.setStatus('mandatory')
a3_temperature_probe_temperature_reading = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 5), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureProbeTemperatureReading.setStatus('mandatory')
a3_monitored_temperature_nominal_reading = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 6), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3MonitoredTemperatureNominalReading.setStatus('mandatory')
a3_monitored_temperature_normal_maximum = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 7), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3MonitoredTemperatureNormalMaximum.setStatus('mandatory')
a3_monitored_temperature_normal_minimum = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 8), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3MonitoredTemperatureNormalMinimum.setStatus('mandatory')
a3_temperature_probe_maximum = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 9), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureProbeMaximum.setStatus('mandatory')
a3_temperature_probe_minimum = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 10), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3TemperatureProbeMinimum.setStatus('mandatory')
a3_temperature_reading_lower_threshold__non_c = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 11), dmi_integer()).setLabel('a3TemperatureReadingLowerThreshold-Non-c').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureReadingLowerThreshold_Non_c.setStatus('mandatory')
a3_temperature_reading_upper_threshold__non_c = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 12), dmi_integer()).setLabel('a3TemperatureReadingUpperThreshold-Non-c').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureReadingUpperThreshold_Non_c.setStatus('mandatory')
a3_temperature_reading_lower_threshold__criti = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 13), dmi_integer()).setLabel('a3TemperatureReadingLowerThreshold-Criti').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureReadingLowerThreshold_Criti.setStatus('mandatory')
a3_temperature_reading_upper_threshold__criti = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 14), dmi_integer()).setLabel('a3TemperatureReadingUpperThreshold-Criti').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureReadingUpperThreshold_Criti.setStatus('mandatory')
a3_temperature_reading_lower_threshold__non_r = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 15), dmi_integer()).setLabel('a3TemperatureReadingLowerThreshold-Non-r').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureReadingLowerThreshold_Non_r.setStatus('mandatory')
a3_temperature_reading_upper_threshold__non_r = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 16), dmi_integer()).setLabel('a3TemperatureReadingUpperThreshold-Non-r').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureReadingUpperThreshold_Non_r.setStatus('mandatory')
a3_temperature_probe_resolution = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 17), dmi_integer()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureProbeResolution.setStatus('mandatory')
a3_temperature_probe_tolerance = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 18), dmi_integer()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureProbeTolerance.setStatus('mandatory')
a3_temperature_probe_accuracy = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 19), dmi_integer()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a3TemperatureProbeAccuracy.setStatus('mandatory')
a3_fru_group_index = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 20), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3FruGroupIndex.setStatus('mandatory')
a3_operational_group_index = mib_scalar((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 3, 1, 21), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a3OperationalGroupIndex.setStatus('mandatory')
t_operational_state_table = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4))
if mibBuilder.loadTexts:
tOperationalStateTable.setStatus('mandatory')
e_operational_state_table = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'), (0, 'APCUPS-MIB', 'a4OperationalStateInstanceIndex'))
if mibBuilder.loadTexts:
eOperationalStateTable.setStatus('mandatory')
a4_operational_state_instance_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 1), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4OperationalStateInstanceIndex.setStatus('mandatory')
a4_device_group_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 2), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4DeviceGroupIndex.setStatus('mandatory')
a4_operational_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vEnabled', 3), ('vDisabled', 4), ('vNotApplicable', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4OperationalStatus.setStatus('mandatory')
a4_usage_state = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vIdle', 3), ('vActive', 4), ('vBusy', 5), ('vNotApplicable', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4UsageState.setStatus('mandatory')
a4_availability_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 5), 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(('vOther', 1), ('vUnknown', 2), ('vRunning', 3), ('vWarning', 4), ('vInTest', 5), ('vNotApplicable', 6), ('vPowerOff', 7), ('vOffLine', 8), ('vOffDuty', 9), ('vDegraded', 10), ('vNotInstalled', 11), ('vInstallError', 12), ('vPowerSave', 13)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4AvailabilityStatus.setStatus('mandatory')
a4_administrative_state = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vLocked', 3), ('vUnlocked', 4), ('vNotApplicable', 5), ('vShuttingDown', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4AdministrativeState.setStatus('mandatory')
a4_fatal_error_count = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 7), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4FatalErrorCount.setStatus('mandatory')
a4_major_error_count = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 8), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4MajorErrorCount.setStatus('mandatory')
a4_warning_error_count = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 9), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4WarningErrorCount.setStatus('mandatory')
a4_current_error_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 4, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vOk', 3), ('vNon-critical', 4), ('vCritical', 5), ('vNon-recoverable', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a4CurrentErrorStatus.setStatus('mandatory')
t_diagnostics = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5))
if mibBuilder.loadTexts:
tDiagnostics.setStatus('mandatory')
e_diagnostics = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'), (0, 'APCUPS-MIB', 'a5DiagnosticFunctionTableIndex'))
if mibBuilder.loadTexts:
eDiagnostics.setStatus('mandatory')
a5_diagnostic_function_table_index = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 1), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a5DiagnosticFunctionTableIndex.setStatus('mandatory')
a5_diagnostic_function_name = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 2), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a5DiagnosticFunctionName.setStatus('mandatory')
a5_diagnostic_function_description = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 3), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a5DiagnosticFunctionDescription.setStatus('mandatory')
a5_exclusive_access_required = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('vFalse', 0), ('vTrue', 1)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a5ExclusiveAccessRequired.setStatus('mandatory')
a5_prerequisite_conditions = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('vOther', 1), ('vUnknown', 2), ('vNoPrerequisites', 3), ('vWrapPlugInstalled', 4), ('vNoMediaInstalled', 5), ('vScratchMediaInstalled', 6), ('vTestMediaInstalled', 7), ('vSystemReferenceDisketteInstalled', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a5PrerequisiteConditions.setStatus('mandatory')
a5_prerequisite_diagnostic_function = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 5, 1, 6), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a5PrerequisiteDiagnosticFunction.setStatus('mandatory')
t_diagnostic_request_group = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6))
if mibBuilder.loadTexts:
tDiagnosticRequestGroup.setStatus('mandatory')
e_diagnostic_request_group = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eDiagnosticRequestGroup.setStatus('mandatory')
a6_diagnostic_function_reserve_key = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1, 1), dmi_integer()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a6DiagnosticFunctionReserveKey.setStatus('mandatory')
a6_diagnostic_function_request = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1, 2), dmi_integer()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a6DiagnosticFunctionRequest.setStatus('mandatory')
a6_diagnostic_function_result = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 6, 1, 3), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a6DiagnosticFunctionResult.setStatus('mandatory')
t_diagnostic_results = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7))
if mibBuilder.loadTexts:
tDiagnosticResults.setStatus('mandatory')
e_diagnostic_results = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'), (0, 'APCUPS-MIB', 'a7DiagnosticFunctionId'), (0, 'APCUPS-MIB', 'a7DiagnosticFunctionResult'))
if mibBuilder.loadTexts:
eDiagnosticResults.setStatus('mandatory')
a7_diagnostic_function_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 1), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a7DiagnosticFunctionId.setStatus('mandatory')
a7_diagnostic_function_result = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 2), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a7DiagnosticFunctionResult.setStatus('mandatory')
a7_diagnostic_function_result_description = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 3), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a7DiagnosticFunctionResultDescription.setStatus('mandatory')
a7_fault_isolated_to_this_component = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 7, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('vFalse', 0), ('vTrue', 1)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a7FaultIsolatedToThisComponent.setStatus('mandatory')
t_error_control_group = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8))
if mibBuilder.loadTexts:
tErrorControlGroup.setStatus('mandatory')
e_error_control_group = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eErrorControlGroup.setStatus('mandatory')
a8_selfid = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 1), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a8Selfid.setStatus('mandatory')
a8_number_of_fatal_errors = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 2), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a8NumberOfFatalErrors.setStatus('mandatory')
a8_number_of_major_errors = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 3), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a8NumberOfMajorErrors.setStatus('mandatory')
a8_number_of_warnings = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 4), dmi_counter()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a8NumberOfWarnings.setStatus('mandatory')
a8_error_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('vOk', 0), ('vWarning', 1), ('vMajor', 2), ('vFatal', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a8ErrorStatus.setStatus('mandatory')
a8_error_status_type = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('vPost', 0), ('vRuntime', 1), ('vDiagnosticTest', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a8ErrorStatusType.setStatus('mandatory')
a8_alarm_generation = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 8, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1))).clone(namedValues=named_values(('vOff', 0), ('vOn', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a8AlarmGeneration.setStatus('mandatory')
t_miftomib = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99))
if mibBuilder.loadTexts:
tMiftomib.setStatus('mandatory')
e_miftomib = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eMiftomib.setStatus('mandatory')
a99_mib_name = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1, 1), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a99MibName.setStatus('mandatory')
a99_mib_oid = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1, 2), dmi_displaystring()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a99MibOid.setStatus('mandatory')
a99_disable_trap = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 99, 1, 3), dmi_integer()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
a99DisableTrap.setStatus('mandatory')
t_trap_group = mib_table((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999))
if mibBuilder.loadTexts:
tTrapGroup.setStatus('mandatory')
e_trap_group = mib_table_row((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1)).setIndexNames((0, 'APCUPS-MIB', 'DmiComponentIndex'))
if mibBuilder.loadTexts:
eTrapGroup.setStatus('mandatory')
a9999_error_time = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 1), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ErrorTime.setStatus('mandatory')
a9999_error_status = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 2), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ErrorStatus.setStatus('mandatory')
a9999_error_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 3), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ErrorGroupId.setStatus('mandatory')
a9999_error_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 4), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ErrorInstanceId.setStatus('mandatory')
a9999_component_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 5), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ComponentId.setStatus('mandatory')
a9999_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 6), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999GroupId.setStatus('mandatory')
a9999_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 7), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999InstanceId.setStatus('mandatory')
a9999_vendor_code1 = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 8), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999VendorCode1.setStatus('mandatory')
a9999_vendor_code2 = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 9), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999VendorCode2.setStatus('mandatory')
a9999_vendor_text = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 10), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999VendorText.setStatus('mandatory')
a9999_parent_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 11), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ParentGroupId.setStatus('mandatory')
a9999_parent_instance_id = mib_table_column((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1, 12), dmi_integer()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
a9999ParentInstanceId.setStatus('mandatory')
pwrchute_event_error = notification_type((1, 3, 6, 1, 4, 1, 318, 1, 2, 2, 1, 9999, 1) + (0, 1)).setObjects(('APCUPS-MIB', 'a9999ErrorTime'), ('APCUPS-MIB', 'a9999ErrorStatus'), ('APCUPS-MIB', 'a9999ErrorGroupId'), ('APCUPS-MIB', 'a9999ErrorInstanceId'), ('APCUPS-MIB', 'a9999ComponentId'), ('APCUPS-MIB', 'a9999GroupId'), ('APCUPS-MIB', 'a9999InstanceId'), ('APCUPS-MIB', 'a9999VendorCode1'), ('APCUPS-MIB', 'a9999VendorCode2'), ('APCUPS-MIB', 'a9999VendorText'), ('APCUPS-MIB', 'a9999ParentGroupId'), ('APCUPS-MIB', 'a9999ParentInstanceId'))
mibBuilder.exportSymbols('APCUPS-MIB', a9999GroupId=a9999GroupId, a4AvailabilityStatus=a4AvailabilityStatus, dmtfGroups=dmtfGroups, a8ErrorStatusType=a8ErrorStatusType, a2EstimatedMinutesRemaining=a2EstimatedMinutesRemaining, a9999ErrorInstanceId=a9999ErrorInstanceId, a6DiagnosticFunctionReserveKey=a6DiagnosticFunctionReserveKey, a1Installation=a1Installation, a3TemperatureProbeTemperatureReading=a3TemperatureProbeTemperatureReading, a3TemperatureReadingUpperThreshold_Criti=a3TemperatureReadingUpperThreshold_Criti, a3TemperatureProbeMaximum=a3TemperatureProbeMaximum, a9999ErrorStatus=a9999ErrorStatus, tDiagnosticResults=tDiagnosticResults, a9999ErrorTime=a9999ErrorTime, a5DiagnosticFunctionDescription=a5DiagnosticFunctionDescription, a5PrerequisiteConditions=a5PrerequisiteConditions, DmiCounter=DmiCounter, a3MonitoredTemperatureNormalMinimum=a3MonitoredTemperatureNormalMinimum, tOperationalStateTable=tOperationalStateTable, a9999ParentInstanceId=a9999ParentInstanceId, a8ErrorStatus=a8ErrorStatus, powerChuteDMIAgent=powerChuteDMIAgent, a2FruGroupIndex=a2FruGroupIndex, tUpsBattery=tUpsBattery, a5ExclusiveAccessRequired=a5ExclusiveAccessRequired, a5DiagnosticFunctionTableIndex=a5DiagnosticFunctionTableIndex, a99MibOid=a99MibOid, a6DiagnosticFunctionResult=a6DiagnosticFunctionResult, a3FruGroupIndex=a3FruGroupIndex, tDiagnostics=tDiagnostics, a9999InstanceId=a9999InstanceId, a4OperationalStateInstanceIndex=a4OperationalStateInstanceIndex, eErrorControlGroup=eErrorControlGroup, a6DiagnosticFunctionRequest=a6DiagnosticFunctionRequest, a9999ParentGroupId=a9999ParentGroupId, a2OperationalGroupIndex=a2OperationalGroupIndex, DmiDisplaystring=DmiDisplaystring, tComponentid=tComponentid, a4OperationalStatus=a4OperationalStatus, a3TemperatureReadingUpperThreshold_Non_c=a3TemperatureReadingUpperThreshold_Non_c, a3TemperatureProbeLocation=a3TemperatureProbeLocation, a3TemperatureProbeTolerance=a3TemperatureProbeTolerance, a4MajorErrorCount=a4MajorErrorCount, a3TemperatureProbeAccuracy=a3TemperatureProbeAccuracy, a1Version=a1Version, a3TemperatureProbeDescription=a3TemperatureProbeDescription, a4DeviceGroupIndex=a4DeviceGroupIndex, a9999VendorCode2=a9999VendorCode2, a3MonitoredTemperatureNormalMaximum=a3MonitoredTemperatureNormalMaximum, eOperationalStateTable=eOperationalStateTable, a3TemperatureReadingLowerThreshold_Non_c=a3TemperatureReadingLowerThreshold_Non_c, eDiagnostics=eDiagnostics, a99DisableTrap=a99DisableTrap, a2EstimatedChargeRemaining=a2EstimatedChargeRemaining, eTrapGroup=eTrapGroup, DmiInteger=DmiInteger, eTemperatureProbe=eTemperatureProbe, a3TemperatureProbeResolution=a3TemperatureProbeResolution, a2BatteryCurrent=a2BatteryCurrent, a1Manufacturer=a1Manufacturer, a3OperationalGroupIndex=a3OperationalGroupIndex, a1Verify=a1Verify, a9999ComponentId=a9999ComponentId, a8NumberOfFatalErrors=a8NumberOfFatalErrors, apc=apc, a3TemperatureProbeMinimum=a3TemperatureProbeMinimum, a3TemperatureStatus=a3TemperatureStatus, a7DiagnosticFunctionResult=a7DiagnosticFunctionResult, a1Product=a1Product, tTemperatureProbe=tTemperatureProbe, a7DiagnosticFunctionId=a7DiagnosticFunctionId, eMiftomib=eMiftomib, a4WarningErrorCount=a4WarningErrorCount, a8NumberOfMajorErrors=a8NumberOfMajorErrors, a3TemperatureReadingLowerThreshold_Criti=a3TemperatureReadingLowerThreshold_Criti, a2BatteryVoltage=a2BatteryVoltage, a9999ErrorGroupId=a9999ErrorGroupId, a5PrerequisiteDiagnosticFunction=a5PrerequisiteDiagnosticFunction, pwrchuteEventError=pwrchuteEventError, DmiComponentIndex=DmiComponentIndex, eDiagnosticResults=eDiagnosticResults, a9999VendorCode1=a9999VendorCode1, DmiGauge=DmiGauge, eDiagnosticRequestGroup=eDiagnosticRequestGroup, a8Selfid=a8Selfid, eComponentid=eComponentid, a4FatalErrorCount=a4FatalErrorCount, a8NumberOfWarnings=a8NumberOfWarnings, a3TemperatureProbeTableIndex=a3TemperatureProbeTableIndex, a2TemperatureProbeIndex=a2TemperatureProbeIndex, products=products, tErrorControlGroup=tErrorControlGroup, a4CurrentErrorStatus=a4CurrentErrorStatus, a4UsageState=a4UsageState, a2SecondsOnBattery=a2SecondsOnBattery, a3TemperatureReadingLowerThreshold_Non_r=a3TemperatureReadingLowerThreshold_Non_r, software=software, tMiftomib=tMiftomib, a3MonitoredTemperatureNominalReading=a3MonitoredTemperatureNominalReading, tTrapGroup=tTrapGroup, a2BatteryStatus=a2BatteryStatus, DmiDateX=DmiDateX, a99MibName=a99MibName, a1SerialNumber=a1SerialNumber, eUpsBattery=eUpsBattery, a8AlarmGeneration=a8AlarmGeneration, a4AdministrativeState=a4AdministrativeState, tDiagnosticRequestGroup=tDiagnosticRequestGroup, a3TemperatureReadingUpperThreshold_Non_r=a3TemperatureReadingUpperThreshold_Non_r, a7FaultIsolatedToThisComponent=a7FaultIsolatedToThisComponent, a7DiagnosticFunctionResultDescription=a7DiagnosticFunctionResultDescription, a5DiagnosticFunctionName=a5DiagnosticFunctionName, a9999VendorText=a9999VendorText) |
class frodo:
def __init__(self,x):
self.x = x
def __less__(self,other):
if self.x < other.x:
return False
else:
return True
a = frodo(10)
b = frodo(50)
print(a<b) | class Frodo:
def __init__(self, x):
self.x = x
def __less__(self, other):
if self.x < other.x:
return False
else:
return True
a = frodo(10)
b = frodo(50)
print(a < b) |
better_eyesight = False
gold_mult = 1
legday_mult = 1
lifesteal_mult = 0
max_health_mult = 1
acid_blood_mult = 0
bleeding = 0
soul_collector = False
soul_eater = False
soul_blast = False
damage_mult = 1
knockback_mult = 1
resistance_mult = 1
enemy_health_mult = 1
def reset_multipliers():
global better_eyesight, gold_mult, legday_mult, lifesteal_mult, max_health_mult, acid_blood_mult, bleeding, soul_collector, soul_eater, soul_blast, damage_mult, knockback_mult, resistance_mult
better_eyesight = False
gold_mult = 1
legday_mult = 1
lifesteal_mult = 0
max_health_mult = 1
acid_blood_mult = 0
bleeding = 0
soul_collector = False
soul_eater = False
soul_blast = False
damage_mult = 1
knockback_mult = 1
resistance_mult = 1
coins = 0
| better_eyesight = False
gold_mult = 1
legday_mult = 1
lifesteal_mult = 0
max_health_mult = 1
acid_blood_mult = 0
bleeding = 0
soul_collector = False
soul_eater = False
soul_blast = False
damage_mult = 1
knockback_mult = 1
resistance_mult = 1
enemy_health_mult = 1
def reset_multipliers():
global better_eyesight, gold_mult, legday_mult, lifesteal_mult, max_health_mult, acid_blood_mult, bleeding, soul_collector, soul_eater, soul_blast, damage_mult, knockback_mult, resistance_mult
better_eyesight = False
gold_mult = 1
legday_mult = 1
lifesteal_mult = 0
max_health_mult = 1
acid_blood_mult = 0
bleeding = 0
soul_collector = False
soul_eater = False
soul_blast = False
damage_mult = 1
knockback_mult = 1
resistance_mult = 1
coins = 0 |
countdown_3_grid = [{(11, 16): 2, (4, 18): 2, (7, 16): 2, (11, 14): 2, (9, 18): 2, (7, 15): 2, (5, 18): 2, (10, 18): 2, (4, 13): 2, (11, 18): 2, (11, 13): 2, (7, 14): 2, (6, 18): 2, (4, 14): 2, (7, 18): 2, (4, 16): 2, (11, 17): 2, (20, 2): 3, (4, 15): 2, (4, 17): 2, (8, 18): 2, (7, 17): 2, (11, 15): 2}, (20, 2)]
countdown_2_grid = [{(11, 16): 2, (5, 13): 2, (7, 16): 2, (11, 14): 2, (6, 17): 2, (9, 15): 2, (5, 12): 2, (5, 18): 2, (10, 12): 2, (4, 13): 2, (11, 18): 2, (8, 16): 2, (8, 15): 2, (11, 13): 2, (6, 18): 2, (9, 14): 2, (5, 17): 2, (10, 13): 2, (4, 14): 2, (4, 16): 2, (9, 16): 2, (8, 17): 2, (11, 12): 2, (9, 13): 2, (11, 17): 2, (20, 2): 3, (4, 15): 2, (4, 17): 2, (10, 14): 2, (7, 17): 2, (11, 15): 2}, (20, 2)]
countdown_1_grid = [{(11, 16): 2, (5, 14): 2, (11, 17): 2, (7, 15): 2, (9, 15): 2, (20, 2): 3, (4, 15): 2, (10, 15): 2, (5, 15): 2, (11, 14): 2, (11, 15): 2, (6, 14): 2, (6, 15): 2, (8, 15): 2, (11, 13): 2}, (20, 2)]
init_grid = [{(14, 17): 2, (12, 1): 2, (16, 9): 2, (6, 28): 2, (18, 4): 2, (7, 25): 2, (13, 17): 2, (12, 31): 2, (4, 2): 2, (3, 7): 2, (6, 7): 2, (4, 19): 2, (6, 10): 2, (7, 19): 2, (14, 1): 2, (18, 9): 2, (15, 4): 2, (12, 28): 2, (1, 1): 2, (15, 18): 2, (14, 14): 2, (14, 24): 2, (4, 16): 2, (15, 29): 2, (12, 11): 2, (17, 13): 2, (7, 22): 2, (15, 1): 2, (12, 22): 2, (17, 18): 2, (4, 15): 2, (3, 1): 2, (16, 18): 2, (4, 26): 2, (6, 13): 2, (4, 21): 2, (15, 16): 2, (12, 8): 2, (1, 21): 2, (7, 21): 2, (12, 27): 2, (1, 26): 2, (17, 29): 2, (2, 1): 2, (1, 15): 2, (5, 1): 2, (15, 22): 2, (12, 2): 2, (7, 15): 2, (1, 16): 2, (7, 1): 2, (16, 29): 2, (17, 24): 2, (13, 29): 2, (18, 24): 2, (4, 1): 2, (4, 28): 2, (14, 21): 2, (16, 4): 2, (12, 7): 2, (1, 7): 2, (16, 23): 2, (1, 19): 2, (12, 29): 2, (18, 21): 2, (2, 7): 2, (16, 13): 2, (6, 1): 2, (5, 7): 2, (12, 4): 2, (15, 9): 2, (13, 9): 2, (12, 23): 2, (15, 21): 2, (1, 3): 2, (4, 8): 2, (5, 13): 2, (4, 27): 2, (15, 13): 2, (4, 22): 2, (14, 9): 2, (12, 9): 2, (1, 20): 2, (7, 20): 2, (2, 19): 2, (1, 25): 2, (3, 10): 2, (1, 14): 2, (4, 13): 2, (2, 13): 2, (12, 3): 2, (7, 14): 2, (1, 28): 2, (18, 2): 2, (7, 27): 2, (7, 28): 2, (1, 9): 2, (1, 22): 2, (14, 29): 2, (18, 1): 2, (7, 26): 2, (7, 13): 2, (17, 21): 2, (12, 30): 2, (2, 25): 2, (18, 18): 2, (7, 16): 2, (3, 4): 2, (2, 4): 2, (5, 9): 2, (4, 7): 2, (3, 25): 2, (7, 7): 2, (15, 3): 2, (16, 21): 2, (12, 16): 2, (13, 21): 2, (1, 2): 2, (4, 9): 2, (18, 29): 2, (7, 10): 2, (6, 22): 2, (5, 22): 2, (12, 10): 2, (15, 15): 2, (12, 21): 2, (18, 13): 2, (13, 24): 2, (3, 13): 2, (1, 13): 2, (4, 14): 2, (2, 10): 2, (4, 25): 2, (3, 19): 2, (5, 28): 2, (4, 20): 2, (17, 4): 2, (15, 23): 2, (13, 1): 2, (12, 15): 2, (18, 3): 2, (17, 9): 2, (15, 2): 2, (13, 14): 2, (1, 27): 2, (1, 8): 2, (4, 3): 2}]
| countdown_3_grid = [{(11, 16): 2, (4, 18): 2, (7, 16): 2, (11, 14): 2, (9, 18): 2, (7, 15): 2, (5, 18): 2, (10, 18): 2, (4, 13): 2, (11, 18): 2, (11, 13): 2, (7, 14): 2, (6, 18): 2, (4, 14): 2, (7, 18): 2, (4, 16): 2, (11, 17): 2, (20, 2): 3, (4, 15): 2, (4, 17): 2, (8, 18): 2, (7, 17): 2, (11, 15): 2}, (20, 2)]
countdown_2_grid = [{(11, 16): 2, (5, 13): 2, (7, 16): 2, (11, 14): 2, (6, 17): 2, (9, 15): 2, (5, 12): 2, (5, 18): 2, (10, 12): 2, (4, 13): 2, (11, 18): 2, (8, 16): 2, (8, 15): 2, (11, 13): 2, (6, 18): 2, (9, 14): 2, (5, 17): 2, (10, 13): 2, (4, 14): 2, (4, 16): 2, (9, 16): 2, (8, 17): 2, (11, 12): 2, (9, 13): 2, (11, 17): 2, (20, 2): 3, (4, 15): 2, (4, 17): 2, (10, 14): 2, (7, 17): 2, (11, 15): 2}, (20, 2)]
countdown_1_grid = [{(11, 16): 2, (5, 14): 2, (11, 17): 2, (7, 15): 2, (9, 15): 2, (20, 2): 3, (4, 15): 2, (10, 15): 2, (5, 15): 2, (11, 14): 2, (11, 15): 2, (6, 14): 2, (6, 15): 2, (8, 15): 2, (11, 13): 2}, (20, 2)]
init_grid = [{(14, 17): 2, (12, 1): 2, (16, 9): 2, (6, 28): 2, (18, 4): 2, (7, 25): 2, (13, 17): 2, (12, 31): 2, (4, 2): 2, (3, 7): 2, (6, 7): 2, (4, 19): 2, (6, 10): 2, (7, 19): 2, (14, 1): 2, (18, 9): 2, (15, 4): 2, (12, 28): 2, (1, 1): 2, (15, 18): 2, (14, 14): 2, (14, 24): 2, (4, 16): 2, (15, 29): 2, (12, 11): 2, (17, 13): 2, (7, 22): 2, (15, 1): 2, (12, 22): 2, (17, 18): 2, (4, 15): 2, (3, 1): 2, (16, 18): 2, (4, 26): 2, (6, 13): 2, (4, 21): 2, (15, 16): 2, (12, 8): 2, (1, 21): 2, (7, 21): 2, (12, 27): 2, (1, 26): 2, (17, 29): 2, (2, 1): 2, (1, 15): 2, (5, 1): 2, (15, 22): 2, (12, 2): 2, (7, 15): 2, (1, 16): 2, (7, 1): 2, (16, 29): 2, (17, 24): 2, (13, 29): 2, (18, 24): 2, (4, 1): 2, (4, 28): 2, (14, 21): 2, (16, 4): 2, (12, 7): 2, (1, 7): 2, (16, 23): 2, (1, 19): 2, (12, 29): 2, (18, 21): 2, (2, 7): 2, (16, 13): 2, (6, 1): 2, (5, 7): 2, (12, 4): 2, (15, 9): 2, (13, 9): 2, (12, 23): 2, (15, 21): 2, (1, 3): 2, (4, 8): 2, (5, 13): 2, (4, 27): 2, (15, 13): 2, (4, 22): 2, (14, 9): 2, (12, 9): 2, (1, 20): 2, (7, 20): 2, (2, 19): 2, (1, 25): 2, (3, 10): 2, (1, 14): 2, (4, 13): 2, (2, 13): 2, (12, 3): 2, (7, 14): 2, (1, 28): 2, (18, 2): 2, (7, 27): 2, (7, 28): 2, (1, 9): 2, (1, 22): 2, (14, 29): 2, (18, 1): 2, (7, 26): 2, (7, 13): 2, (17, 21): 2, (12, 30): 2, (2, 25): 2, (18, 18): 2, (7, 16): 2, (3, 4): 2, (2, 4): 2, (5, 9): 2, (4, 7): 2, (3, 25): 2, (7, 7): 2, (15, 3): 2, (16, 21): 2, (12, 16): 2, (13, 21): 2, (1, 2): 2, (4, 9): 2, (18, 29): 2, (7, 10): 2, (6, 22): 2, (5, 22): 2, (12, 10): 2, (15, 15): 2, (12, 21): 2, (18, 13): 2, (13, 24): 2, (3, 13): 2, (1, 13): 2, (4, 14): 2, (2, 10): 2, (4, 25): 2, (3, 19): 2, (5, 28): 2, (4, 20): 2, (17, 4): 2, (15, 23): 2, (13, 1): 2, (12, 15): 2, (18, 3): 2, (17, 9): 2, (15, 2): 2, (13, 14): 2, (1, 27): 2, (1, 8): 2, (4, 3): 2}] |
description = 'Kompass standard instrument'
group = 'basic'
includes = ['mono', 'guidefocus', 'selector', 'astrium', 'sample',
'reactor',
#'detector',
]
| description = 'Kompass standard instrument'
group = 'basic'
includes = ['mono', 'guidefocus', 'selector', 'astrium', 'sample', 'reactor'] |
# Use this to take notes on the Edpuzzle video. Try each example rather than just watching it - you will get much more out of it!
# Most things are commented out because they can't all coexist without a syntax error
user = {"name": "Kasey", "age": 15, "courses": ["History, CompSci"]}
for key, value in user.items():
print(key, value)
#print(user.items())
#print(user.values())
#print(user.keys())
#print(len(user))
#age=user.pop("age")
# del user['age']
'''user.update({"name": "Bob", "age": 25, "phone": "888-8888"})
user['phone'] = '888-8888'
user['name']='Bob'''''
#print(user.get("age",'not found'))
#print(user)
#print(age) | user = {'name': 'Kasey', 'age': 15, 'courses': ['History, CompSci']}
for (key, value) in user.items():
print(key, value)
'user.update({"name": "Bob", "age": 25, "phone": "888-8888"})\nuser[\'phone\'] = \'888-8888\'\nuser[\'name\']=\'Bob' |
class Solution:
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
target = []
for i, num in enumerate(nums):
idx = index[i]
target = target[:idx] + [num] + target[idx:]
return target
| class Solution:
def create_target_array(self, nums: List[int], index: List[int]) -> List[int]:
target = []
for (i, num) in enumerate(nums):
idx = index[i]
target = target[:idx] + [num] + target[idx:]
return target |
class MySQLClimateQuery:
@staticmethod
def drop_sport_climates():
return 'DROP TABLE IF EXISTS sport_climates'
@staticmethod
def create_sport_climates():
return ('CREATE TABLE sport_climates ('
'sport_id int NOT NULL,'
'climate_name varchar(50) NOT NULL,'
'PRIMARY KEY (sport_id, climate_name),'
'FOREIGN KEY (sport_id) REFERENCES sports(id) ON DELETE CASCADE,'
'FOREIGN KEY (climate_name) REFERENCES climates(name) ON DELETE CASCADE'
');')
@staticmethod
def drop_practice_center_climates():
return 'DROP TABLE IF EXISTS practice_center_climates'
@staticmethod
def create_practice_center_climates():
return ('CREATE TABLE practice_center_climates ('
'practice_center_id int NOT NULL,'
'climate_name varchar(50) NOT NULL,'
'PRIMARY KEY (practice_center_id, climate_name),'
'FOREIGN KEY (practice_center_id) REFERENCES practice_centers(id) '
'ON DELETE CASCADE,'
'FOREIGN KEY (climate_name) REFERENCES climates(name) ON DELETE CASCADE'
');')
@staticmethod
def drop_climates():
return 'DROP TABLE IF EXISTS climates'
@staticmethod
def create_climates():
return ('CREATE TABLE climates ('
'name varchar(50) NOT NULL PRIMARY KEY'
');')
| class Mysqlclimatequery:
@staticmethod
def drop_sport_climates():
return 'DROP TABLE IF EXISTS sport_climates'
@staticmethod
def create_sport_climates():
return 'CREATE TABLE sport_climates (sport_id int NOT NULL,climate_name varchar(50) NOT NULL,PRIMARY KEY (sport_id, climate_name),FOREIGN KEY (sport_id) REFERENCES sports(id) ON DELETE CASCADE,FOREIGN KEY (climate_name) REFERENCES climates(name) ON DELETE CASCADE);'
@staticmethod
def drop_practice_center_climates():
return 'DROP TABLE IF EXISTS practice_center_climates'
@staticmethod
def create_practice_center_climates():
return 'CREATE TABLE practice_center_climates (practice_center_id int NOT NULL,climate_name varchar(50) NOT NULL,PRIMARY KEY (practice_center_id, climate_name),FOREIGN KEY (practice_center_id) REFERENCES practice_centers(id) ON DELETE CASCADE,FOREIGN KEY (climate_name) REFERENCES climates(name) ON DELETE CASCADE);'
@staticmethod
def drop_climates():
return 'DROP TABLE IF EXISTS climates'
@staticmethod
def create_climates():
return 'CREATE TABLE climates (name varchar(50) NOT NULL PRIMARY KEY);' |
#!/usr/bin/env python3
# TODO nedd develop logic for handling strucutre with figure element
class FilterModule(object):
def filters(self):
return {
'json_select': self.json_select
}
def jmagik(self, jbody, jpth, jfil):
if jpth != "" and type(jpth) is not int:
jvar=jbody
for i in jpth:
jvar=jvar[i]
elif type(jpth) is int:
jvar=jbody[jpth]
else:
jvar=jbody
if type(jvar) is not list: # we must convert dict to list because without it, we geting ['','','','',''.........,''] but we need [{'','','',...,''}]
jvar = [jvar]
for nm in range(len(jvar)): # chek how levels exist if it's [{'.......'},....{'......'}]
for i in list((jvar[nm])): # convert jvar[nm] because it's dict(we need list) and iterate
jvar[nm].update(jfil)
return jvar
def json_select(self, jbody, jpth, jfil):
if(jpth != "" and type(jpth) is not int ):
if type(jbody is list):
jbody = self.jmagik(jbody, jpth, jfil)
else:
jbody[str(jpth)] = self.jmagik(jbody, jpth, jfil)
del jbody[str(jpth)]
elif(type(jpth) is int):
jbody[jpth] = self.jmagik(jbody, jpth, jfil)
else:
jbody = self.jmagik(jbody, jpth, jfil)
return jbody
| class Filtermodule(object):
def filters(self):
return {'json_select': self.json_select}
def jmagik(self, jbody, jpth, jfil):
if jpth != '' and type(jpth) is not int:
jvar = jbody
for i in jpth:
jvar = jvar[i]
elif type(jpth) is int:
jvar = jbody[jpth]
else:
jvar = jbody
if type(jvar) is not list:
jvar = [jvar]
for nm in range(len(jvar)):
for i in list(jvar[nm]):
jvar[nm].update(jfil)
return jvar
def json_select(self, jbody, jpth, jfil):
if jpth != '' and type(jpth) is not int:
if type(jbody is list):
jbody = self.jmagik(jbody, jpth, jfil)
else:
jbody[str(jpth)] = self.jmagik(jbody, jpth, jfil)
del jbody[str(jpth)]
elif type(jpth) is int:
jbody[jpth] = self.jmagik(jbody, jpth, jfil)
else:
jbody = self.jmagik(jbody, jpth, jfil)
return jbody |
__pycmd_map = {}
def register_pycmd(name, pycmd):
__pycmd_map[name] = pycmd
def get_pycmd(name):
if isinstance(name, str) and name in __pycmd_map:
return __pycmd_map[name]
elif callable(name):
return name
else:
return None
class PyCmdOption(object):
def __init__(self, globals, locals):
self.__globals = globals
self.__locals = locals
def globals(self):
return self.__globals
def locals(self):
return self.__locals
class PyCmd(object):
def __init__(self, body, name, inType=None, outType=None):
self.__body = body
self.__name = name
self.__inType = inType
self.__outType = outType
def __call__(self, *args, **kwds):
return self.__body(*args, **kwds)
def name(self):
return self.__name
def inType(self):
return self.__inType
def outType(self):
return self.__outType
def pycmd(*args, **kwds):
if args:
assert len(args) == 1
assert not kwds
assert callable(args[0])
cmd = args[0]
if not isinstance(cmd, PyCmd):
cmd = PyCmd(cmd, name=cmd.func_name)
register_pycmd(cmd.name(), cmd)
return cmd
if kwds:
assert not args
def register(func):
if 'name' not in kwds:
kwds['name'] = func.func_name
cmd = PyCmd(func, **kwds)
register_pycmd(cmd.name(), cmd)
return register
else:
raise Exception('Wrong params')
class IOType(object):
Python = 1
File = 2
No = 3
| __pycmd_map = {}
def register_pycmd(name, pycmd):
__pycmd_map[name] = pycmd
def get_pycmd(name):
if isinstance(name, str) and name in __pycmd_map:
return __pycmd_map[name]
elif callable(name):
return name
else:
return None
class Pycmdoption(object):
def __init__(self, globals, locals):
self.__globals = globals
self.__locals = locals
def globals(self):
return self.__globals
def locals(self):
return self.__locals
class Pycmd(object):
def __init__(self, body, name, inType=None, outType=None):
self.__body = body
self.__name = name
self.__inType = inType
self.__outType = outType
def __call__(self, *args, **kwds):
return self.__body(*args, **kwds)
def name(self):
return self.__name
def in_type(self):
return self.__inType
def out_type(self):
return self.__outType
def pycmd(*args, **kwds):
if args:
assert len(args) == 1
assert not kwds
assert callable(args[0])
cmd = args[0]
if not isinstance(cmd, PyCmd):
cmd = py_cmd(cmd, name=cmd.func_name)
register_pycmd(cmd.name(), cmd)
return cmd
if kwds:
assert not args
def register(func):
if 'name' not in kwds:
kwds['name'] = func.func_name
cmd = py_cmd(func, **kwds)
register_pycmd(cmd.name(), cmd)
return register
else:
raise exception('Wrong params')
class Iotype(object):
python = 1
file = 2
no = 3 |
def format_words(words):
if not words:
return ""
while "" in words:
words.remove("")
if not words:
return ""
elif len(words)==1:
return words[0]
return ", ".join(words[:-1])+" and "+words[-1] | def format_words(words):
if not words:
return ''
while '' in words:
words.remove('')
if not words:
return ''
elif len(words) == 1:
return words[0]
return ', '.join(words[:-1]) + ' and ' + words[-1] |
class Solution:
def removeDuplicates(self, nums):
i = 0
while i < len(nums):
if i == 0:
lastNum = nums[i]
else:
if lastNum != nums[i]:
lastNum = nums[i]
else:
nums.pop(i)
continue
i = i + 1
return len(nums)
if __name__ == "__main__":
test = Solution()
nums = [0,0,1,1,1,2,2,3,3,4]
ans = test.removeDuplicates(nums)
print(nums)
| class Solution:
def remove_duplicates(self, nums):
i = 0
while i < len(nums):
if i == 0:
last_num = nums[i]
elif lastNum != nums[i]:
last_num = nums[i]
else:
nums.pop(i)
continue
i = i + 1
return len(nums)
if __name__ == '__main__':
test = solution()
nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]
ans = test.removeDuplicates(nums)
print(nums) |
data = (
'You ', # 0x00
'Yang ', # 0x01
'Lu ', # 0x02
'Si ', # 0x03
'Jie ', # 0x04
'Ying ', # 0x05
'Du ', # 0x06
'Wang ', # 0x07
'Hui ', # 0x08
'Xie ', # 0x09
'Pan ', # 0x0a
'Shen ', # 0x0b
'Biao ', # 0x0c
'Chan ', # 0x0d
'Mo ', # 0x0e
'Liu ', # 0x0f
'Jian ', # 0x10
'Pu ', # 0x11
'Se ', # 0x12
'Cheng ', # 0x13
'Gu ', # 0x14
'Bin ', # 0x15
'Huo ', # 0x16
'Xian ', # 0x17
'Lu ', # 0x18
'Qin ', # 0x19
'Han ', # 0x1a
'Ying ', # 0x1b
'Yong ', # 0x1c
'Li ', # 0x1d
'Jing ', # 0x1e
'Xiao ', # 0x1f
'Ying ', # 0x20
'Sui ', # 0x21
'Wei ', # 0x22
'Xie ', # 0x23
'Huai ', # 0x24
'Hao ', # 0x25
'Zhu ', # 0x26
'Long ', # 0x27
'Lai ', # 0x28
'Dui ', # 0x29
'Fan ', # 0x2a
'Hu ', # 0x2b
'Lai ', # 0x2c
None, # 0x2d
None, # 0x2e
'Ying ', # 0x2f
'Mi ', # 0x30
'Ji ', # 0x31
'Lian ', # 0x32
'Jian ', # 0x33
'Ying ', # 0x34
'Fen ', # 0x35
'Lin ', # 0x36
'Yi ', # 0x37
'Jian ', # 0x38
'Yue ', # 0x39
'Chan ', # 0x3a
'Dai ', # 0x3b
'Rang ', # 0x3c
'Jian ', # 0x3d
'Lan ', # 0x3e
'Fan ', # 0x3f
'Shuang ', # 0x40
'Yuan ', # 0x41
'Zhuo ', # 0x42
'Feng ', # 0x43
'She ', # 0x44
'Lei ', # 0x45
'Lan ', # 0x46
'Cong ', # 0x47
'Qu ', # 0x48
'Yong ', # 0x49
'Qian ', # 0x4a
'Fa ', # 0x4b
'Guan ', # 0x4c
'Que ', # 0x4d
'Yan ', # 0x4e
'Hao ', # 0x4f
'Hyeng ', # 0x50
'Sa ', # 0x51
'Zan ', # 0x52
'Luan ', # 0x53
'Yan ', # 0x54
'Li ', # 0x55
'Mi ', # 0x56
'Shan ', # 0x57
'Tan ', # 0x58
'Dang ', # 0x59
'Jiao ', # 0x5a
'Chan ', # 0x5b
None, # 0x5c
'Hao ', # 0x5d
'Ba ', # 0x5e
'Zhu ', # 0x5f
'Lan ', # 0x60
'Lan ', # 0x61
'Nang ', # 0x62
'Wan ', # 0x63
'Luan ', # 0x64
'Xun ', # 0x65
'Xian ', # 0x66
'Yan ', # 0x67
'Gan ', # 0x68
'Yan ', # 0x69
'Yu ', # 0x6a
'Huo ', # 0x6b
'Si ', # 0x6c
'Mie ', # 0x6d
'Guang ', # 0x6e
'Deng ', # 0x6f
'Hui ', # 0x70
'Xiao ', # 0x71
'Xiao ', # 0x72
'Hu ', # 0x73
'Hong ', # 0x74
'Ling ', # 0x75
'Zao ', # 0x76
'Zhuan ', # 0x77
'Jiu ', # 0x78
'Zha ', # 0x79
'Xie ', # 0x7a
'Chi ', # 0x7b
'Zhuo ', # 0x7c
'Zai ', # 0x7d
'Zai ', # 0x7e
'Can ', # 0x7f
'Yang ', # 0x80
'Qi ', # 0x81
'Zhong ', # 0x82
'Fen ', # 0x83
'Niu ', # 0x84
'Jiong ', # 0x85
'Wen ', # 0x86
'Po ', # 0x87
'Yi ', # 0x88
'Lu ', # 0x89
'Chui ', # 0x8a
'Pi ', # 0x8b
'Kai ', # 0x8c
'Pan ', # 0x8d
'Yan ', # 0x8e
'Kai ', # 0x8f
'Pang ', # 0x90
'Mu ', # 0x91
'Chao ', # 0x92
'Liao ', # 0x93
'Gui ', # 0x94
'Kang ', # 0x95
'Tun ', # 0x96
'Guang ', # 0x97
'Xin ', # 0x98
'Zhi ', # 0x99
'Guang ', # 0x9a
'Guang ', # 0x9b
'Wei ', # 0x9c
'Qiang ', # 0x9d
None, # 0x9e
'Da ', # 0x9f
'Xia ', # 0xa0
'Zheng ', # 0xa1
'Zhu ', # 0xa2
'Ke ', # 0xa3
'Zhao ', # 0xa4
'Fu ', # 0xa5
'Ba ', # 0xa6
'Duo ', # 0xa7
'Duo ', # 0xa8
'Ling ', # 0xa9
'Zhuo ', # 0xaa
'Xuan ', # 0xab
'Ju ', # 0xac
'Tan ', # 0xad
'Pao ', # 0xae
'Jiong ', # 0xaf
'Pao ', # 0xb0
'Tai ', # 0xb1
'Tai ', # 0xb2
'Bing ', # 0xb3
'Yang ', # 0xb4
'Tong ', # 0xb5
'Han ', # 0xb6
'Zhu ', # 0xb7
'Zha ', # 0xb8
'Dian ', # 0xb9
'Wei ', # 0xba
'Shi ', # 0xbb
'Lian ', # 0xbc
'Chi ', # 0xbd
'Huang ', # 0xbe
None, # 0xbf
'Hu ', # 0xc0
'Shuo ', # 0xc1
'Lan ', # 0xc2
'Jing ', # 0xc3
'Jiao ', # 0xc4
'Xu ', # 0xc5
'Xing ', # 0xc6
'Quan ', # 0xc7
'Lie ', # 0xc8
'Huan ', # 0xc9
'Yang ', # 0xca
'Xiao ', # 0xcb
'Xiu ', # 0xcc
'Xian ', # 0xcd
'Yin ', # 0xce
'Wu ', # 0xcf
'Zhou ', # 0xd0
'Yao ', # 0xd1
'Shi ', # 0xd2
'Wei ', # 0xd3
'Tong ', # 0xd4
'Xue ', # 0xd5
'Zai ', # 0xd6
'Kai ', # 0xd7
'Hong ', # 0xd8
'Luo ', # 0xd9
'Xia ', # 0xda
'Zhu ', # 0xdb
'Xuan ', # 0xdc
'Zheng ', # 0xdd
'Po ', # 0xde
'Yan ', # 0xdf
'Hui ', # 0xe0
'Guang ', # 0xe1
'Zhe ', # 0xe2
'Hui ', # 0xe3
'Kao ', # 0xe4
None, # 0xe5
'Fan ', # 0xe6
'Shao ', # 0xe7
'Ye ', # 0xe8
'Hui ', # 0xe9
None, # 0xea
'Tang ', # 0xeb
'Jin ', # 0xec
'Re ', # 0xed
None, # 0xee
'Xi ', # 0xef
'Fu ', # 0xf0
'Jiong ', # 0xf1
'Che ', # 0xf2
'Pu ', # 0xf3
'Jing ', # 0xf4
'Zhuo ', # 0xf5
'Ting ', # 0xf6
'Wan ', # 0xf7
'Hai ', # 0xf8
'Peng ', # 0xf9
'Lang ', # 0xfa
'Shan ', # 0xfb
'Hu ', # 0xfc
'Feng ', # 0xfd
'Chi ', # 0xfe
'Rong ', # 0xff
)
| data = ('You ', 'Yang ', 'Lu ', 'Si ', 'Jie ', 'Ying ', 'Du ', 'Wang ', 'Hui ', 'Xie ', 'Pan ', 'Shen ', 'Biao ', 'Chan ', 'Mo ', 'Liu ', 'Jian ', 'Pu ', 'Se ', 'Cheng ', 'Gu ', 'Bin ', 'Huo ', 'Xian ', 'Lu ', 'Qin ', 'Han ', 'Ying ', 'Yong ', 'Li ', 'Jing ', 'Xiao ', 'Ying ', 'Sui ', 'Wei ', 'Xie ', 'Huai ', 'Hao ', 'Zhu ', 'Long ', 'Lai ', 'Dui ', 'Fan ', 'Hu ', 'Lai ', None, None, 'Ying ', 'Mi ', 'Ji ', 'Lian ', 'Jian ', 'Ying ', 'Fen ', 'Lin ', 'Yi ', 'Jian ', 'Yue ', 'Chan ', 'Dai ', 'Rang ', 'Jian ', 'Lan ', 'Fan ', 'Shuang ', 'Yuan ', 'Zhuo ', 'Feng ', 'She ', 'Lei ', 'Lan ', 'Cong ', 'Qu ', 'Yong ', 'Qian ', 'Fa ', 'Guan ', 'Que ', 'Yan ', 'Hao ', 'Hyeng ', 'Sa ', 'Zan ', 'Luan ', 'Yan ', 'Li ', 'Mi ', 'Shan ', 'Tan ', 'Dang ', 'Jiao ', 'Chan ', None, 'Hao ', 'Ba ', 'Zhu ', 'Lan ', 'Lan ', 'Nang ', 'Wan ', 'Luan ', 'Xun ', 'Xian ', 'Yan ', 'Gan ', 'Yan ', 'Yu ', 'Huo ', 'Si ', 'Mie ', 'Guang ', 'Deng ', 'Hui ', 'Xiao ', 'Xiao ', 'Hu ', 'Hong ', 'Ling ', 'Zao ', 'Zhuan ', 'Jiu ', 'Zha ', 'Xie ', 'Chi ', 'Zhuo ', 'Zai ', 'Zai ', 'Can ', 'Yang ', 'Qi ', 'Zhong ', 'Fen ', 'Niu ', 'Jiong ', 'Wen ', 'Po ', 'Yi ', 'Lu ', 'Chui ', 'Pi ', 'Kai ', 'Pan ', 'Yan ', 'Kai ', 'Pang ', 'Mu ', 'Chao ', 'Liao ', 'Gui ', 'Kang ', 'Tun ', 'Guang ', 'Xin ', 'Zhi ', 'Guang ', 'Guang ', 'Wei ', 'Qiang ', None, 'Da ', 'Xia ', 'Zheng ', 'Zhu ', 'Ke ', 'Zhao ', 'Fu ', 'Ba ', 'Duo ', 'Duo ', 'Ling ', 'Zhuo ', 'Xuan ', 'Ju ', 'Tan ', 'Pao ', 'Jiong ', 'Pao ', 'Tai ', 'Tai ', 'Bing ', 'Yang ', 'Tong ', 'Han ', 'Zhu ', 'Zha ', 'Dian ', 'Wei ', 'Shi ', 'Lian ', 'Chi ', 'Huang ', None, 'Hu ', 'Shuo ', 'Lan ', 'Jing ', 'Jiao ', 'Xu ', 'Xing ', 'Quan ', 'Lie ', 'Huan ', 'Yang ', 'Xiao ', 'Xiu ', 'Xian ', 'Yin ', 'Wu ', 'Zhou ', 'Yao ', 'Shi ', 'Wei ', 'Tong ', 'Xue ', 'Zai ', 'Kai ', 'Hong ', 'Luo ', 'Xia ', 'Zhu ', 'Xuan ', 'Zheng ', 'Po ', 'Yan ', 'Hui ', 'Guang ', 'Zhe ', 'Hui ', 'Kao ', None, 'Fan ', 'Shao ', 'Ye ', 'Hui ', None, 'Tang ', 'Jin ', 'Re ', None, 'Xi ', 'Fu ', 'Jiong ', 'Che ', 'Pu ', 'Jing ', 'Zhuo ', 'Ting ', 'Wan ', 'Hai ', 'Peng ', 'Lang ', 'Shan ', 'Hu ', 'Feng ', 'Chi ', 'Rong ') |
# -*- coding: utf-8 -*-
def main():
n = int(input())
mod = 10 ** 9 + 7
ans = 0
for i in range(n):
ans += ((i + 1) ** 10 - i ** 10) * (n // (i + 1)) ** 10
ans %= mod
print(ans)
if __name__ == '__main__':
main()
| def main():
n = int(input())
mod = 10 ** 9 + 7
ans = 0
for i in range(n):
ans += ((i + 1) ** 10 - i ** 10) * (n // (i + 1)) ** 10
ans %= mod
print(ans)
if __name__ == '__main__':
main() |
Import("env")
print("Extra Script (Pre): common_pre.py")
# Get build flags values from env
def get_build_flag_value(flag_name):
build_flags = env.ParseFlags(env['BUILD_FLAGS'])
flags_with_value_list = [build_flag for build_flag in build_flags.get('CPPDEFINES') if type(build_flag) == list]
defines = {k: v for (k, v) in flags_with_value_list}
return defines.get(flag_name)
# Current details
print("Device Code: %s" % get_build_flag_value("DEVICE_CODE"))
print("Build tag: %s" % get_build_flag_value("BUILD_TAG"))
# Change build file name
new_name = "%s-Pv%s" % (get_build_flag_value("DEVICE_CODE"), get_build_flag_value("BUILD_TAG"))
print("Changing build file name to: %s" % new_name)
env.Replace(PROGNAME=new_name)
| import('env')
print('Extra Script (Pre): common_pre.py')
def get_build_flag_value(flag_name):
build_flags = env.ParseFlags(env['BUILD_FLAGS'])
flags_with_value_list = [build_flag for build_flag in build_flags.get('CPPDEFINES') if type(build_flag) == list]
defines = {k: v for (k, v) in flags_with_value_list}
return defines.get(flag_name)
print('Device Code: %s' % get_build_flag_value('DEVICE_CODE'))
print('Build tag: %s' % get_build_flag_value('BUILD_TAG'))
new_name = '%s-Pv%s' % (get_build_flag_value('DEVICE_CODE'), get_build_flag_value('BUILD_TAG'))
print('Changing build file name to: %s' % new_name)
env.Replace(PROGNAME=new_name) |
KONSTANT = "KONSTANT"
def funktion(value):
print(value)
class Klass:
def method(self):
funktion(KONSTANT)
Klass().method()
| konstant = 'KONSTANT'
def funktion(value):
print(value)
class Klass:
def method(self):
funktion(KONSTANT)
klass().method() |
conf = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'isAccessLog': {
'()': 'utils.CustomLogFilter.AccessLogFilter'
},
'isHuntLog': {
'()': 'utils.CustomLogFilter.HuntLogFilter'
},
'isHuntResultLog': {
'()': 'utils.CustomLogFilter.HuntResultLogFilter'
},
},
# 'loggers': {
# 'elasticsearch': {
# 'level': 'INFO',
# 'handlers': [
# 'consoleHandler',
# 'logFileHandler',
# ],
# "propagate": "no",
# }
# },
'root': {
'level': 'DEBUG',
'handlers': [
'consoleHandler',
'logFileHandler',
'AccessLogFileHandler',
# 'AccessLogSysLogHandler',
'HuntLogFileHandler',
'HuntResultLogFileHandler',
]
},
'handlers': {
'consoleHandler': {
'class': 'logging.StreamHandler',
'level': 'INFO',
'formatter': 'consoleFormatter',
'stream': 'ext://sys.stdout'
},
'logFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'DEBUG',
'formatter': 'logFileFormatter',
'filename': './log/wowhoneypot.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8'
},
'AccessLogFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'INFO',
'formatter': 'AccessLogFileFormatter',
'filename': './log/access.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8',
'filters': [
'isAccessLog'
]
},
# 'AccessLogSysLogHandler': {
# 'class': 'logging.handlers.SysLogHandler',
# 'address': ('127.0.0.1', 514),
# 'facility': "local0",
# 'filters': [
# 'isAccessLog'
# ]
# },
'HuntLogFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'INFO',
'formatter': 'HuntLogFileFormatter',
'filename': './log/hunting.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8',
'filters': [
'isHuntLog'
]
},
'HuntResultLogFileHandler': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'level': 'INFO',
'formatter': 'HuntLogFileFormatter',
'filename': './log/hunt_result.log',
'when': 'MIDNIGHT',
'backupCount': 10,
'encoding': 'utf-8',
'filters': [
'isHuntResultLog'
]
},
},
'formatters': {
'consoleFormatter': {
'format': '%(asctime)s [%(levelname)-8s] %(funcName)s - %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'logFileFormatter': {
'format': '%(asctime)s|%(levelname)-8s|%(name)s|%(funcName)s|%(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'AccessLogFileFormatter': {
'format': '%(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'HuntLogFileFormatter': {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
'HuntResultLogFileFormatter': {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S%z'
},
}
}
| conf = {'version': 1, 'disable_existing_loggers': False, 'filters': {'isAccessLog': {'()': 'utils.CustomLogFilter.AccessLogFilter'}, 'isHuntLog': {'()': 'utils.CustomLogFilter.HuntLogFilter'}, 'isHuntResultLog': {'()': 'utils.CustomLogFilter.HuntResultLogFilter'}}, 'root': {'level': 'DEBUG', 'handlers': ['consoleHandler', 'logFileHandler', 'AccessLogFileHandler', 'HuntLogFileHandler', 'HuntResultLogFileHandler']}, 'handlers': {'consoleHandler': {'class': 'logging.StreamHandler', 'level': 'INFO', 'formatter': 'consoleFormatter', 'stream': 'ext://sys.stdout'}, 'logFileHandler': {'class': 'logging.handlers.TimedRotatingFileHandler', 'level': 'DEBUG', 'formatter': 'logFileFormatter', 'filename': './log/wowhoneypot.log', 'when': 'MIDNIGHT', 'backupCount': 10, 'encoding': 'utf-8'}, 'AccessLogFileHandler': {'class': 'logging.handlers.TimedRotatingFileHandler', 'level': 'INFO', 'formatter': 'AccessLogFileFormatter', 'filename': './log/access.log', 'when': 'MIDNIGHT', 'backupCount': 10, 'encoding': 'utf-8', 'filters': ['isAccessLog']}, 'HuntLogFileHandler': {'class': 'logging.handlers.TimedRotatingFileHandler', 'level': 'INFO', 'formatter': 'HuntLogFileFormatter', 'filename': './log/hunting.log', 'when': 'MIDNIGHT', 'backupCount': 10, 'encoding': 'utf-8', 'filters': ['isHuntLog']}, 'HuntResultLogFileHandler': {'class': 'logging.handlers.TimedRotatingFileHandler', 'level': 'INFO', 'formatter': 'HuntLogFileFormatter', 'filename': './log/hunt_result.log', 'when': 'MIDNIGHT', 'backupCount': 10, 'encoding': 'utf-8', 'filters': ['isHuntResultLog']}}, 'formatters': {'consoleFormatter': {'format': '%(asctime)s [%(levelname)-8s] %(funcName)s - %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S%z'}, 'logFileFormatter': {'format': '%(asctime)s|%(levelname)-8s|%(name)s|%(funcName)s|%(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S%z'}, 'AccessLogFileFormatter': {'format': '%(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S%z'}, 'HuntLogFileFormatter': {'format': '[%(asctime)s] %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S%z'}, 'HuntResultLogFileFormatter': {'format': '[%(asctime)s] %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S%z'}}} |
def isPerfectCube(num):
ans = 0
while ans**3 < abs(num):
ans += 1
if ans**3 != abs(num):
print("Not a perfect cube")
else:
if num < 0:
ans = -ans
print(ans, "is a cube root of", num)
def main():
if __name__ == "__main__":
print(isPerfectCube(8), "answer is 2")
print(isPerfectCube(-8), "answer is -2")
print(isPerfectCube(9), "answer is not perfect cube")
main() | def is_perfect_cube(num):
ans = 0
while ans ** 3 < abs(num):
ans += 1
if ans ** 3 != abs(num):
print('Not a perfect cube')
else:
if num < 0:
ans = -ans
print(ans, 'is a cube root of', num)
def main():
if __name__ == '__main__':
print(is_perfect_cube(8), 'answer is 2')
print(is_perfect_cube(-8), 'answer is -2')
print(is_perfect_cube(9), 'answer is not perfect cube')
main() |
NORMALIZED_POWERS = {
191: ('1x127', '1.5'),
200: ('1x133', '1.5'),
330: ('1x220', '1.5'),
345: ('1x230', '1.5'),
381: ('1x127', '3'),
399: ('1x133', '3'),
445: ('1x127', '3.5'),
466: ('1x133', '3.5'),
572: ('3x220/127', '1.5'),
598: ('3x230/133', '1.5'),
635: ('1x127', '5'),
660: ('1x220', '3'),
665: ('1x133', '5'),
690: ('1x230', '3'),
770: ('1x220', '3.5'),
805: ('1x230', '3.5'),
953: ('1x127', '7.5'),
987: ('3x380/220', '1.5'),
998: ('1x133', '7.5'),
1039: ('3x400/230', '1.5'),
1100: ('1x220', '5'),
1143: ('3x220/127', '3'),
1150: ('1x230', '5'),
1195: ('3x230/133', '3'),
1270: ('1x127', '10'),
1330: ('1x133', '10'),
1334: ('3x220/127', '3.5'),
1394: ('3x230/133', '3.5'),
1650: ('1x220', '7.5'),
1725: ('1x230', '7.5'),
1905: ('1x127', '15'),
1975: ('3x380/220', '3'),
1992: ('3x230/133', '5'),
1995: ('1x133', '15'),
2078: ('3x400/230', '3'),
2200: ('1x220', '10'),
2300: ('1x230', '10'),
2304: ('3x380/220', '3.5'),
2425: ('3x400/230', '3.5'),
2540: ('1x127', '20'),
2660: ('1x133', '20'),
2858: ('3x220/127', '7.5'),
2988: ('3x230/133', '7.5'),
3175: ('1x127', '25'),
3291: ('3x380/220', '5'),
3300: ('1x220', '15'),
3325: ('1x133', '25'),
3450: ('1x230', '15'),
3464: ('3x400/230', '5'),
3810: ('1x127', '30'),
3811: ('3x220/127', '10'),
3984: ('3x230/133', '10'),
3990: ('1x133', '30'),
4400: ('1x220', '20'),
4445: ('1x127', '35'),
4600: ('1x230', '20'),
4655: ('1x133', '35'),
4936: ('3x380/220', '7.5'),
5080: ('1x127', '40'),
5196: ('3x400/230', '7.5'),
5320: ('1x133', '40'),
5500: ('1x220', '25'),
5715: ('1x127', '45'),
5716: ('3x220/127', '15'),
5750: ('1x230', '25'),
5976: ('3x230/133', '15'),
5985: ('1x133', '45'),
6350: ('1x127', '50'),
6582: ('3x380/220', '10'),
6600: ('1x220', '30'),
6650: ('1x133', '50'),
6900: ('1x230', '30'),
6928: ('3x400/230', '10'),
7621: ('3x220/127', '20'),
7700: ('1x220', '35'),
7967: ('3x230/133', '20'),
8001: ('1x127', '63'),
8050: ('1x230', '35'),
8379: ('1x133', '63'),
8800: ('1x220', '40'),
9200: ('1x230', '40'),
9526: ('3x220/127', '25'),
9873: ('3x380/220', '15'),
9900: ('1x220', '45'),
9959: ('3x230/133', '25'),
10350: ('1x230', '45'),
10392: ('3x400/230', '15'),
11000: ('1x220', '50'),
11432: ('3x220/127', '30'),
11500: ('1x230', '50'),
11951: ('3x230/133', '30'),
13164: ('3x380/220', '20'),
13337: ('3x220/127', '35'),
13856: ('3x400/230', '20'),
13860: ('1x220', '63'),
13943: ('3x230/133', '35'),
14490: ('1x230', '63'),
15242: ('3x220/127', '40'),
15935: ('3x230/133', '40'),
16454: ('3x380/220', '25'),
17147: ('3x220/127', '45'),
17321: ('3x400/230', '25'),
17927: ('3x230/133', '45'),
19053: ('3x220/127', '50'),
19745: ('3x380/220', '30'),
19919: ('3x230/133', '50'),
20785: ('3x400/230', '30'),
23036: ('3x380/220', '35'),
24006: ('3x220/127', '63'),
24249: ('3x400/230', '35'),
25097: ('3x230/133', '63'),
26327: ('3x380/220', '40'),
27713: ('3x400/230', '40'),
29618: ('3x380/220', '45'),
31177: ('3x400/230', '45'),
32909: ('3x380/220', '50'),
34641: ('3x400/230', '50'),
41465: ('3x380/220', '63'),
43648: ('3x400/230', '63')
}
NOT_NORMALIZED_100 = dict([(p, (None, None)) for p in range(100, 15001, 100)
if p not in NORMALIZED_POWERS])
ALL_POWERS = NOT_NORMALIZED_100.copy()
ALL_POWERS.update(NORMALIZED_POWERS)
class NormalizedPower(object):
def get_volt_int(self, pot):
volt_int = ALL_POWERS.get(pot, None)
if volt_int is None:
raise ValueError('The given power is not normalized')
return volt_int
def is_normalized(self, pot):
return pot in ALL_POWERS
def get_norm_powers(self, pot_min, pot_max):
for norm_pow in sorted(ALL_POWERS):
if pot_min < norm_pow <= pot_max:
yield norm_pow
elif norm_pow > pot_max:
break
| normalized_powers = {191: ('1x127', '1.5'), 200: ('1x133', '1.5'), 330: ('1x220', '1.5'), 345: ('1x230', '1.5'), 381: ('1x127', '3'), 399: ('1x133', '3'), 445: ('1x127', '3.5'), 466: ('1x133', '3.5'), 572: ('3x220/127', '1.5'), 598: ('3x230/133', '1.5'), 635: ('1x127', '5'), 660: ('1x220', '3'), 665: ('1x133', '5'), 690: ('1x230', '3'), 770: ('1x220', '3.5'), 805: ('1x230', '3.5'), 953: ('1x127', '7.5'), 987: ('3x380/220', '1.5'), 998: ('1x133', '7.5'), 1039: ('3x400/230', '1.5'), 1100: ('1x220', '5'), 1143: ('3x220/127', '3'), 1150: ('1x230', '5'), 1195: ('3x230/133', '3'), 1270: ('1x127', '10'), 1330: ('1x133', '10'), 1334: ('3x220/127', '3.5'), 1394: ('3x230/133', '3.5'), 1650: ('1x220', '7.5'), 1725: ('1x230', '7.5'), 1905: ('1x127', '15'), 1975: ('3x380/220', '3'), 1992: ('3x230/133', '5'), 1995: ('1x133', '15'), 2078: ('3x400/230', '3'), 2200: ('1x220', '10'), 2300: ('1x230', '10'), 2304: ('3x380/220', '3.5'), 2425: ('3x400/230', '3.5'), 2540: ('1x127', '20'), 2660: ('1x133', '20'), 2858: ('3x220/127', '7.5'), 2988: ('3x230/133', '7.5'), 3175: ('1x127', '25'), 3291: ('3x380/220', '5'), 3300: ('1x220', '15'), 3325: ('1x133', '25'), 3450: ('1x230', '15'), 3464: ('3x400/230', '5'), 3810: ('1x127', '30'), 3811: ('3x220/127', '10'), 3984: ('3x230/133', '10'), 3990: ('1x133', '30'), 4400: ('1x220', '20'), 4445: ('1x127', '35'), 4600: ('1x230', '20'), 4655: ('1x133', '35'), 4936: ('3x380/220', '7.5'), 5080: ('1x127', '40'), 5196: ('3x400/230', '7.5'), 5320: ('1x133', '40'), 5500: ('1x220', '25'), 5715: ('1x127', '45'), 5716: ('3x220/127', '15'), 5750: ('1x230', '25'), 5976: ('3x230/133', '15'), 5985: ('1x133', '45'), 6350: ('1x127', '50'), 6582: ('3x380/220', '10'), 6600: ('1x220', '30'), 6650: ('1x133', '50'), 6900: ('1x230', '30'), 6928: ('3x400/230', '10'), 7621: ('3x220/127', '20'), 7700: ('1x220', '35'), 7967: ('3x230/133', '20'), 8001: ('1x127', '63'), 8050: ('1x230', '35'), 8379: ('1x133', '63'), 8800: ('1x220', '40'), 9200: ('1x230', '40'), 9526: ('3x220/127', '25'), 9873: ('3x380/220', '15'), 9900: ('1x220', '45'), 9959: ('3x230/133', '25'), 10350: ('1x230', '45'), 10392: ('3x400/230', '15'), 11000: ('1x220', '50'), 11432: ('3x220/127', '30'), 11500: ('1x230', '50'), 11951: ('3x230/133', '30'), 13164: ('3x380/220', '20'), 13337: ('3x220/127', '35'), 13856: ('3x400/230', '20'), 13860: ('1x220', '63'), 13943: ('3x230/133', '35'), 14490: ('1x230', '63'), 15242: ('3x220/127', '40'), 15935: ('3x230/133', '40'), 16454: ('3x380/220', '25'), 17147: ('3x220/127', '45'), 17321: ('3x400/230', '25'), 17927: ('3x230/133', '45'), 19053: ('3x220/127', '50'), 19745: ('3x380/220', '30'), 19919: ('3x230/133', '50'), 20785: ('3x400/230', '30'), 23036: ('3x380/220', '35'), 24006: ('3x220/127', '63'), 24249: ('3x400/230', '35'), 25097: ('3x230/133', '63'), 26327: ('3x380/220', '40'), 27713: ('3x400/230', '40'), 29618: ('3x380/220', '45'), 31177: ('3x400/230', '45'), 32909: ('3x380/220', '50'), 34641: ('3x400/230', '50'), 41465: ('3x380/220', '63'), 43648: ('3x400/230', '63')}
not_normalized_100 = dict([(p, (None, None)) for p in range(100, 15001, 100) if p not in NORMALIZED_POWERS])
all_powers = NOT_NORMALIZED_100.copy()
ALL_POWERS.update(NORMALIZED_POWERS)
class Normalizedpower(object):
def get_volt_int(self, pot):
volt_int = ALL_POWERS.get(pot, None)
if volt_int is None:
raise value_error('The given power is not normalized')
return volt_int
def is_normalized(self, pot):
return pot in ALL_POWERS
def get_norm_powers(self, pot_min, pot_max):
for norm_pow in sorted(ALL_POWERS):
if pot_min < norm_pow <= pot_max:
yield norm_pow
elif norm_pow > pot_max:
break |
dict_camera = {'wfpc1': 1, 'wfpc1_planetary': 2, 'wfpc1_foc_f48': 3, 'wfpc1_foc_f48': 4, 'wfpc2': 5, 'wfpc2_planetary': 6, 'wfpc2_foc_f48': 7, 'wfpc2_foc_f48': 8, 'nicmos1_precryo': 9, 'nicmos2_precryo': 10, 'nicmos3_precryo': 11, 'stis_ccd': 12, 'stis_nuv': 13, 'stis_fuv': 14, 'acs_widefield': 15, 'acs_highres': 16, 'acs_coronoffspot': 17, 'acs_solarblind': 18, 'nicmos1_cryo': 19, 'nicmos2_cryo': 20, 'nicmos3_cryo': 21, 'wfc3_uvis': 22, 'wfc3_ir': 23,}
dict_spectrum_form = {'stellar': 1, 'blackbody': 2, 'powerlaw_nu': 3, 'powerlaw_lam': 4, 'user': 5}
dict_spectrum_stellar = {'o5': 1, 'o8f': 2, 'o6': 3, 'b1v': 4, 'b3v': 5, 'b6v': 6,
'a0v': 7, 'a5v': 8, 'f6v': 9, 'f8v': 10, 'g2v': 11, 'g5v': 12, 'g8v': 13,
'k4v': 14, 'k7v': 15, 'm1.5v': 16, 'm3v': 17}
| dict_camera = {'wfpc1': 1, 'wfpc1_planetary': 2, 'wfpc1_foc_f48': 3, 'wfpc1_foc_f48': 4, 'wfpc2': 5, 'wfpc2_planetary': 6, 'wfpc2_foc_f48': 7, 'wfpc2_foc_f48': 8, 'nicmos1_precryo': 9, 'nicmos2_precryo': 10, 'nicmos3_precryo': 11, 'stis_ccd': 12, 'stis_nuv': 13, 'stis_fuv': 14, 'acs_widefield': 15, 'acs_highres': 16, 'acs_coronoffspot': 17, 'acs_solarblind': 18, 'nicmos1_cryo': 19, 'nicmos2_cryo': 20, 'nicmos3_cryo': 21, 'wfc3_uvis': 22, 'wfc3_ir': 23}
dict_spectrum_form = {'stellar': 1, 'blackbody': 2, 'powerlaw_nu': 3, 'powerlaw_lam': 4, 'user': 5}
dict_spectrum_stellar = {'o5': 1, 'o8f': 2, 'o6': 3, 'b1v': 4, 'b3v': 5, 'b6v': 6, 'a0v': 7, 'a5v': 8, 'f6v': 9, 'f8v': 10, 'g2v': 11, 'g5v': 12, 'g8v': 13, 'k4v': 14, 'k7v': 15, 'm1.5v': 16, 'm3v': 17} |
def log_error(error):
'''
This logging function just print a formated error message
'''
print(error)
| def log_error(error):
"""
This logging function just print a formated error message
"""
print(error) |
host = 'Your SMTP server host here'
port = 25 # Your SMTP server port here
username = 'Your SMTP server username here'
password = 'Your SMTP server password here'
encryption = 'required' # Your SMTP server security policy here. Must be one of 'required', 'optional', or 'ssl'
__all__ = ['host', 'port', 'username', 'password', 'encryption']
| host = 'Your SMTP server host here'
port = 25
username = 'Your SMTP server username here'
password = 'Your SMTP server password here'
encryption = 'required'
__all__ = ['host', 'port', 'username', 'password', 'encryption'] |
class Solution:
# @param {string} a a number
# @param {string} b a number
# @return {string} the result
def addBinary(self, a, b):
# Write your code here
alen, blen = len(a), len(b)
if alen > blen:
b = '0' * (alen - blen) + b
nlen = alen
else:
a = '0' * (blen - alen) + a
nlen = blen
res, c = '', 0
for i in range(nlen - 1, -1, -1):
at, bt = int(a[i]), int(b[i])
if at + bt + c > 1:
res = str(at + bt + c - 2) + res
c = 1
else:
res = str(at + bt + c) + res
c = 0
if c == 1:
res = '1' + res
return res
| class Solution:
def add_binary(self, a, b):
(alen, blen) = (len(a), len(b))
if alen > blen:
b = '0' * (alen - blen) + b
nlen = alen
else:
a = '0' * (blen - alen) + a
nlen = blen
(res, c) = ('', 0)
for i in range(nlen - 1, -1, -1):
(at, bt) = (int(a[i]), int(b[i]))
if at + bt + c > 1:
res = str(at + bt + c - 2) + res
c = 1
else:
res = str(at + bt + c) + res
c = 0
if c == 1:
res = '1' + res
return res |
palettes = {
"material_design": {
"red_500": 0xF44336,
"pink_500": 0xE91E63,
"purple_500": 0x9C27B0,
"deep_purple_500": 0x673AB7,
"indigo_500": 0x3F51B5,
"blue_500": 0x2196F3,
"light_blue_500": 0x03A9F4,
"cyan_500": 0x00BCD4,
"teal_500": 0x009688,
"green_500": 0x4CAF50,
"light_green_500": 0x8BC34A,
"lime_500": 0xCDDC39,
"yellow_500": 0xFFEB3B,
"amber_500": 0xFFC107,
"orange_500": 0xFF9800,
"deep_orange_500": 0xFF5722,
"brown_500": 0x795548,
}
}
| palettes = {'material_design': {'red_500': 16007990, 'pink_500': 15277667, 'purple_500': 10233776, 'deep_purple_500': 6765239, 'indigo_500': 4149685, 'blue_500': 2201331, 'light_blue_500': 240116, 'cyan_500': 48340, 'teal_500': 38536, 'green_500': 5025616, 'light_green_500': 9159498, 'lime_500': 13491257, 'yellow_500': 16771899, 'amber_500': 16761095, 'orange_500': 16750592, 'deep_orange_500': 16733986, 'brown_500': 7951688}} |
def main(request, response):
try:
name = "recon_fail_" + request.GET.first("id")
headers = [("Content-Type", "text/event-stream")]
cookie = request.cookies.first(name, None)
state = cookie.value if cookie is not None else None
if state == 'opened':
status = (200, "RECONNECT")
response.set_cookie(name, "reconnected")
body = "data: reconnected\n\n"
elif state == 'reconnected':
status = (204, "NO CONTENT (CLOSE)")
response.delete_cookie(name)
body = "data: closed\n\n" # Will never get through
else:
status = (200, "OPEN")
response.set_cookie(name, "opened")
body = "retry: 2\ndata: opened\n\n"
return status, headers, body
except Exception as ex:
return "error"
| def main(request, response):
try:
name = 'recon_fail_' + request.GET.first('id')
headers = [('Content-Type', 'text/event-stream')]
cookie = request.cookies.first(name, None)
state = cookie.value if cookie is not None else None
if state == 'opened':
status = (200, 'RECONNECT')
response.set_cookie(name, 'reconnected')
body = 'data: reconnected\n\n'
elif state == 'reconnected':
status = (204, 'NO CONTENT (CLOSE)')
response.delete_cookie(name)
body = 'data: closed\n\n'
else:
status = (200, 'OPEN')
response.set_cookie(name, 'opened')
body = 'retry: 2\ndata: opened\n\n'
return (status, headers, body)
except Exception as ex:
return 'error' |
# Python - 3.6.0
paradise = God()
test.assert_equals(isinstance(paradise[0], Man), True, 'First object are a man')
| paradise = god()
test.assert_equals(isinstance(paradise[0], Man), True, 'First object are a man') |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: disable=unused-argument
# EXAMPLE: /RedisEnterprise/put/RedisEnterpriseCreate
# NOTE: Functions will always first be looked up in manual/custom.py followed by generated/custom.py
def step_create(test, checks=None, cache_num=1):
if checks is None:
checks = []
if test.kwargs.get('no_database'):
test.cmd('az redisenterprise create '
'--cluster-name "{cluster}" '
'--sku "EnterpriseFlash_F300" '
'--tags tag1="value1" '
'--no-database '
'--resource-group "{rg}"',
checks=checks)
elif test.kwargs.get('geo-replication'):
if cache_num == 1:
test.cmd('az redisenterprise create '
'--cluster-name "{cluster31}" '
'--sku "EnterpriseFlash_F300" '
'--tags tag1="value1" '
'--no-database '
'--resource-group "{rg31}"',
checks=checks)
elif cache_num == 2:
test.cmd('az redisenterprise create '
'--location "West US" '
'--cluster-name "{cluster32}" '
'--sku "EnterpriseFlash_F300" '
'--client-protocol "Encrypted" '
'--clustering-policy "EnterpriseCluster" '
'--eviction-policy "NoEviction" '
'--group-nickname "groupName" '
'--linked-databases id="/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{cluster31}/databases/{database}" '
'--linked-databases id="/subscriptions/{subscription}/resourceGroups/{rg32}/providers/Microsoft.Cache/redisEnterprise/{cluster32}/databases/{database}" '
'--port 10000 '
'--resource-group "{rg32}"',
checks=checks)
else:
test.cmd('az redisenterprise create '
'--cluster-name "{cluster}" '
'--sku "Enterprise_E20" '
'--capacity 4 '
'--tags tag1="value1" '
'--zones "1" "2" "3" '
'--minimum-tls-version "1.2" '
'--client-protocol "Encrypted" '
'--clustering-policy "EnterpriseCluster" '
'--eviction-policy "NoEviction" '
'--modules name="RedisBloom" '
'--modules name="RedisTimeSeries" '
'--modules name="RediSearch" '
'--port 10000 '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesForceUnlink - unlinking a database during a regional outage
def step_database_force_unlink(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database force-unlink '
'--cluster-name "{cluster32}" '
'--unlink-ids "/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{'
'myRedisEnterprise2}/databases/{database}" '
'--resource-group "{rg32}"',
checks=checks)
# EXAMPLE: /RedisEnterprise/get/RedisEnterpriseGet
def step_show(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise show '
'--cluster-name "{cluster32}" '
'--resource-group "{rg32}"',
checks=checks)
else:
test.cmd('az redisenterprise show '
'--cluster-name "{cluster}" '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /RedisEnterprise/delete/RedisEnterpriseDelete
def step_delete(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise delete -y '
'--cluster-name "{cluster31}" '
'--resource-group "{rg31}"',
checks=checks)
test.cmd('az redisenterprise delete -y '
'--cluster-name "{cluster32}" '
'--resource-group "{rg32}"',
checks=checks)
else:
test.cmd('az redisenterprise delete -y '
'--cluster-name "{cluster}" '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /Databases/put/RedisEnterpriseDatabasesCreate
def step_database_create(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise database create '
'--cluster-name "{cluster31}" '
'--client-protocol "Encrypted" '
'--clustering-policy "EnterpriseCluster" '
'--eviction-policy "NoEviction" '
'--group-nickname "groupName" '
'--linked-databases id="/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{cluster31}/databases/{database}" '
'--port 10000 '
'--resource-group "{rg31}"',
checks=checks)
else:
test.cmd('az redisenterprise database create '
'--cluster-name "{cluster}" '
'--client-protocol "Plaintext" '
'--clustering-policy "OSSCluster" '
'--eviction-policy "AllKeysLRU" '
'--port 10000 '
'--resource-group "{rg}"',
checks=checks)
def step_database_force_unlink(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database force-unlink '
'--cluster-name "{cluster32}" '
'--unlink-ids "/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{'
'cluster31}/databases/{database}" '
'--resource-group "{rg32}"',
checks=checks)
# EXAMPLE: /Databases/get/RedisEnterpriseDatabasesGet
def step_database_show(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database show '
'--cluster-name "{cluster}" '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /Databases/get/RedisEnterpriseDatabasesListByCluster
def step_database_list(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database list '
'--cluster-name "{cluster}" '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesListKeys
def step_database_list_keys(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database list-keys '
'--cluster-name "{cluster}" '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /Databases/post/RedisEnterpriseDatabasesRegenerateKey
def step_database_regenerate_key(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database regenerate-key '
'--cluster-name "{cluster}" '
'--key-type "Primary" '
'--resource-group "{rg}"',
checks=checks)
# EXAMPLE: /Databases/delete/RedisEnterpriseDatabasesDelete
def step_database_delete(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise database delete -y '
'--cluster-name "{cluster31}" '
'--resource-group "{rg31}"',
checks=checks)
test.cmd('az redisenterprise database delete -y '
'--cluster-name "{cluster32}" '
'--resource-group "{rg32}"',
checks=checks)
else:
test.cmd('az redisenterprise database delete -y '
'--cluster-name "{cluster}" '
'--resource-group "{rg}"',
checks=checks)
| def step_create(test, checks=None, cache_num=1):
if checks is None:
checks = []
if test.kwargs.get('no_database'):
test.cmd('az redisenterprise create --cluster-name "{cluster}" --sku "EnterpriseFlash_F300" --tags tag1="value1" --no-database --resource-group "{rg}"', checks=checks)
elif test.kwargs.get('geo-replication'):
if cache_num == 1:
test.cmd('az redisenterprise create --cluster-name "{cluster31}" --sku "EnterpriseFlash_F300" --tags tag1="value1" --no-database --resource-group "{rg31}"', checks=checks)
elif cache_num == 2:
test.cmd('az redisenterprise create --location "West US" --cluster-name "{cluster32}" --sku "EnterpriseFlash_F300" --client-protocol "Encrypted" --clustering-policy "EnterpriseCluster" --eviction-policy "NoEviction" --group-nickname "groupName" --linked-databases id="/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{cluster31}/databases/{database}" --linked-databases id="/subscriptions/{subscription}/resourceGroups/{rg32}/providers/Microsoft.Cache/redisEnterprise/{cluster32}/databases/{database}" --port 10000 --resource-group "{rg32}"', checks=checks)
else:
test.cmd('az redisenterprise create --cluster-name "{cluster}" --sku "Enterprise_E20" --capacity 4 --tags tag1="value1" --zones "1" "2" "3" --minimum-tls-version "1.2" --client-protocol "Encrypted" --clustering-policy "EnterpriseCluster" --eviction-policy "NoEviction" --modules name="RedisBloom" --modules name="RedisTimeSeries" --modules name="RediSearch" --port 10000 --resource-group "{rg}"', checks=checks)
def step_database_force_unlink(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database force-unlink --cluster-name "{cluster32}" --unlink-ids "/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{myRedisEnterprise2}/databases/{database}" --resource-group "{rg32}"', checks=checks)
def step_show(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise show --cluster-name "{cluster32}" --resource-group "{rg32}"', checks=checks)
else:
test.cmd('az redisenterprise show --cluster-name "{cluster}" --resource-group "{rg}"', checks=checks)
def step_delete(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise delete -y --cluster-name "{cluster31}" --resource-group "{rg31}"', checks=checks)
test.cmd('az redisenterprise delete -y --cluster-name "{cluster32}" --resource-group "{rg32}"', checks=checks)
else:
test.cmd('az redisenterprise delete -y --cluster-name "{cluster}" --resource-group "{rg}"', checks=checks)
def step_database_create(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise database create --cluster-name "{cluster31}" --client-protocol "Encrypted" --clustering-policy "EnterpriseCluster" --eviction-policy "NoEviction" --group-nickname "groupName" --linked-databases id="/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{cluster31}/databases/{database}" --port 10000 --resource-group "{rg31}"', checks=checks)
else:
test.cmd('az redisenterprise database create --cluster-name "{cluster}" --client-protocol "Plaintext" --clustering-policy "OSSCluster" --eviction-policy "AllKeysLRU" --port 10000 --resource-group "{rg}"', checks=checks)
def step_database_force_unlink(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database force-unlink --cluster-name "{cluster32}" --unlink-ids "/subscriptions/{subscription}/resourceGroups/{rg31}/providers/Microsoft.Cache/redisEnterprise/{cluster31}/databases/{database}" --resource-group "{rg32}"', checks=checks)
def step_database_show(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database show --cluster-name "{cluster}" --resource-group "{rg}"', checks=checks)
def step_database_list(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database list --cluster-name "{cluster}" --resource-group "{rg}"', checks=checks)
def step_database_list_keys(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database list-keys --cluster-name "{cluster}" --resource-group "{rg}"', checks=checks)
def step_database_regenerate_key(test, checks=None):
if checks is None:
checks = []
test.cmd('az redisenterprise database regenerate-key --cluster-name "{cluster}" --key-type "Primary" --resource-group "{rg}"', checks=checks)
def step_database_delete(test, checks=None):
if checks is None:
checks = []
if test.kwargs.get('geo-replication'):
test.cmd('az redisenterprise database delete -y --cluster-name "{cluster31}" --resource-group "{rg31}"', checks=checks)
test.cmd('az redisenterprise database delete -y --cluster-name "{cluster32}" --resource-group "{rg32}"', checks=checks)
else:
test.cmd('az redisenterprise database delete -y --cluster-name "{cluster}" --resource-group "{rg}"', checks=checks) |
#input
# 15
# 2 4 3 6 7 9 1 5 8
# 9 3 7 8 6 1 5 2 4
# 1 4 9 5 6 3 2 8 7
# 1 6 8 3 4 2 9 7 5
# 7 4 6 5 1 9 3 8 2
# 8 1 7 5 6 3 9 2 4
# 2 4 3 9 7 8 5 1 6
# 6 3 1 9 2 7 4 5 8
# 1 4 7 6 8 9 5 3 2
# 7 9 1 8 5 6 3 2 4
# 1 3 9 6 8 2 5 7 4
# 8 5 4 6 3 7 2 1 9
# 7 2 4 5 8 1 9 3 6
# 5 2 6 1 8 4 9 3 7
# 4 8 5 3 2 6 1 7 9
class Game:
board = []
def initialize(self):
self.board = []
for i in range(0, 3):
self.board.append([None, None, None])
def mark(self, pos, p):
self.board[pos // 3][pos % 3] = p
def is_game_over(self):
##check rows
for i in range(0, 3):
if (self.board[i][0] == None):
continue
if (self.board[i][0] == self.board[i][1]
and self.board[i][1] == self.board[i][2]):
return True
##check columns
for i in range(0, 3):
if (self.board[0][i] == None):
continue
if (self.board[0][i] == self.board[1][i]
and self.board[1][i] == self.board[2][i]):
return True
##check diagonals
if self.board[1][1] == None:
return False
if self.board[0][0] == self.board[1][1] and self.board[1][1] == self.board[2][2]:
return True
if self.board[2][0] == self.board[1][1] and self.board[1][1] == self.board[0][2]:
return True
return False
game = Game()
n = int(input())
for i in range(0, n):
game.initialize()
moves = [int(x) for x in input().split()]
for j in range(0, len(moves)):
player = None
if j % 2 == 0:
player = 'x'
else:
player = 'o'
game.mark(moves[j] - 1, player)
if game.is_game_over():
print(str(j+1), "", end="")
break
if j == len(moves) - 1:
print(0, "", end="") | class Game:
board = []
def initialize(self):
self.board = []
for i in range(0, 3):
self.board.append([None, None, None])
def mark(self, pos, p):
self.board[pos // 3][pos % 3] = p
def is_game_over(self):
for i in range(0, 3):
if self.board[i][0] == None:
continue
if self.board[i][0] == self.board[i][1] and self.board[i][1] == self.board[i][2]:
return True
for i in range(0, 3):
if self.board[0][i] == None:
continue
if self.board[0][i] == self.board[1][i] and self.board[1][i] == self.board[2][i]:
return True
if self.board[1][1] == None:
return False
if self.board[0][0] == self.board[1][1] and self.board[1][1] == self.board[2][2]:
return True
if self.board[2][0] == self.board[1][1] and self.board[1][1] == self.board[0][2]:
return True
return False
game = game()
n = int(input())
for i in range(0, n):
game.initialize()
moves = [int(x) for x in input().split()]
for j in range(0, len(moves)):
player = None
if j % 2 == 0:
player = 'x'
else:
player = 'o'
game.mark(moves[j] - 1, player)
if game.is_game_over():
print(str(j + 1), '', end='')
break
if j == len(moves) - 1:
print(0, '', end='') |
load(
"//ruby/private/tools:deps.bzl",
_transitive_deps = "transitive_deps",
)
load(
"//ruby/private:providers.bzl",
"RubyGem",
"RubyLibrary",
)
def _get_transitive_srcs(srcs, deps):
return depset(
srcs,
transitive = [dep[RubyLibrary].transitive_ruby_srcs for dep in deps],
)
def _rb_gem_impl(ctx):
gemspec = ctx.actions.declare_file("{}.gemspec".format(ctx.attr.gem_name))
metadata_file = ctx.actions.declare_file("{}_metadata".format(ctx.attr.gem_name))
_ruby_files = []
file_deps = _get_transitive_srcs([], ctx.attr.deps).to_list()
for f in file_deps:
# For some files the src_path and dest_path will be the same, but
# for othrs the src_path will be in bazel)out while the dest_path
# will be from the workspace root.
_ruby_files.append({
"src_path": f.path,
"dest_path": f.short_path,
})
ctx.actions.write(
output = metadata_file,
content = struct(
name = ctx.attr.gem_name,
raw_srcs = _ruby_files,
authors = ctx.attr.authors,
version = ctx.attr.version,
licenses = ctx.attr.licenses,
require_paths = ctx.attr.require_paths,
).to_json(),
)
ctx.actions.run(
inputs = [
ctx.file._gemspec_template,
ctx.file._gemspec_builder,
metadata_file,
] + file_deps,
executable = ctx.attr.ruby_interpreter.files_to_run.executable,
arguments = [
ctx.file._gemspec_builder.path,
"--output",
gemspec.path,
"--metadata",
metadata_file.path,
"--template",
ctx.file._gemspec_template.path,
],
outputs = [gemspec],
execution_requirements = {
"no-sandbox": "1",
},
)
return [
DefaultInfo(files = _get_transitive_srcs([gemspec], ctx.attr.deps)),
RubyGem(
ctx = ctx,
version = ctx.attr.version,
gemspec = gemspec,
),
]
_ATTRS = {
"version": attr.string(
default = "0.0.1",
),
"authors": attr.string_list(),
"licenses": attr.string_list(),
"deps": attr.label_list(
allow_files = True,
),
"data": attr.label_list(
allow_files = True,
),
"gem_name": attr.string(),
"srcs": attr.label_list(
allow_files = True,
default = [],
),
"gem_deps": attr.label_list(
allow_files = True,
),
"require_paths": attr.string_list(),
"_gemspec_template": attr.label(
allow_single_file = True,
default = "gemspec_template.tpl",
),
"ruby_sdk": attr.string(
default = "@org_ruby_lang_ruby_toolchain",
),
"ruby_interpreter": attr.label(
default = "@org_ruby_lang_ruby_toolchain//:ruby_bin",
allow_files = True,
executable = True,
cfg = "host",
),
"_gemspec_builder": attr.label(
default = Label("@coinbase_rules_ruby//ruby/private/gem:gemspec_builder.rb"),
allow_single_file = True,
),
}
rb_gemspec = rule(
implementation = _rb_gem_impl,
attrs = _ATTRS,
provides = [DefaultInfo, RubyGem],
)
| load('//ruby/private/tools:deps.bzl', _transitive_deps='transitive_deps')
load('//ruby/private:providers.bzl', 'RubyGem', 'RubyLibrary')
def _get_transitive_srcs(srcs, deps):
return depset(srcs, transitive=[dep[RubyLibrary].transitive_ruby_srcs for dep in deps])
def _rb_gem_impl(ctx):
gemspec = ctx.actions.declare_file('{}.gemspec'.format(ctx.attr.gem_name))
metadata_file = ctx.actions.declare_file('{}_metadata'.format(ctx.attr.gem_name))
_ruby_files = []
file_deps = _get_transitive_srcs([], ctx.attr.deps).to_list()
for f in file_deps:
_ruby_files.append({'src_path': f.path, 'dest_path': f.short_path})
ctx.actions.write(output=metadata_file, content=struct(name=ctx.attr.gem_name, raw_srcs=_ruby_files, authors=ctx.attr.authors, version=ctx.attr.version, licenses=ctx.attr.licenses, require_paths=ctx.attr.require_paths).to_json())
ctx.actions.run(inputs=[ctx.file._gemspec_template, ctx.file._gemspec_builder, metadata_file] + file_deps, executable=ctx.attr.ruby_interpreter.files_to_run.executable, arguments=[ctx.file._gemspec_builder.path, '--output', gemspec.path, '--metadata', metadata_file.path, '--template', ctx.file._gemspec_template.path], outputs=[gemspec], execution_requirements={'no-sandbox': '1'})
return [default_info(files=_get_transitive_srcs([gemspec], ctx.attr.deps)), ruby_gem(ctx=ctx, version=ctx.attr.version, gemspec=gemspec)]
_attrs = {'version': attr.string(default='0.0.1'), 'authors': attr.string_list(), 'licenses': attr.string_list(), 'deps': attr.label_list(allow_files=True), 'data': attr.label_list(allow_files=True), 'gem_name': attr.string(), 'srcs': attr.label_list(allow_files=True, default=[]), 'gem_deps': attr.label_list(allow_files=True), 'require_paths': attr.string_list(), '_gemspec_template': attr.label(allow_single_file=True, default='gemspec_template.tpl'), 'ruby_sdk': attr.string(default='@org_ruby_lang_ruby_toolchain'), 'ruby_interpreter': attr.label(default='@org_ruby_lang_ruby_toolchain//:ruby_bin', allow_files=True, executable=True, cfg='host'), '_gemspec_builder': attr.label(default=label('@coinbase_rules_ruby//ruby/private/gem:gemspec_builder.rb'), allow_single_file=True)}
rb_gemspec = rule(implementation=_rb_gem_impl, attrs=_ATTRS, provides=[DefaultInfo, RubyGem]) |
def average_price_per_year(dates,prices):
year = ''
counter = 0
accumulator = 0
average_year_years = []
average_year_prices = []
# for every date in the date list
# do the following
for index in range(len(dates)):
# Set the first year.
if year == '':
year = dates[index][6:10]
accumulator += float(prices[index])
counter += 1
# Continue with the rest dates.
# if we are still in the same year then
elif dates[index][6:10] == year:
# add the price to the accumulator
accumulator += float(prices[index])
counter += 1
# if the year changed, caclculate the average for the year
# and continue with the next year.
else:
average = accumulator / counter
average_year_years.append(year)
average_year_prices.append(average)
year = dates[index][6:10]
counter = 1
accumulator = float(prices[index])
print('Average Price Per Year')
print('----------------------')
print()
print('Year\t\tPrice')
print('----\t\t-----')
for index in range(len(average_year_years)):
print(average_year_years[index],'\t--->\t',format(average_year_prices[index],',.3f'))
def average_price_per_month(dates,prices):
month = ''
year = ''
counter = 0
accumulator = 0
average_price_months = []
average_price_prices = []
for index in range(len(dates)):
if year == '':
year = dates[index][6:10]
elif month == '':
month = dates[index][0:2]
elif dates[index][0:2] == month and dates[index][6:10] == year:
accumulator += float(prices[index])
counter += 1
else:
average = accumulator / counter
average_price_months.append(year + '-' + month)
average_price_prices.append(average)
counter = 1
accumulator = float(prices[index])
year = dates[index][6:10]
month = dates[index][0:2]
print('Average Price Per Month')
print('-----------------------')
print()
print('Month\t\tPrice')
print('-----\t\t-----')
for index in range(len(average_price_months)):
print(average_price_months[index],'----->\t',format(average_price_prices[index],',.3f'))
def highest_lowest_price_per_year(dates,prices):
year = ''
year_list = []
highest_per_year = []
lowest_per_year = []
find_max_min_price = []
for index in range(len(prices)):
prices[index] = float(prices[index])
for index in range(len(dates)):
if year == '':
year = dates[index][6:10]
find_max_min_price.append(prices[index])
elif dates[index][6:10] == year:
find_max_min_price.append(prices[index])
else:
year_list.append(year)
highest_per_year.append(max(find_max_min_price))
lowest_per_year.append(min(find_max_min_price))
year = dates[index][6:10]
find_max_min_price = [prices[index]]
print('Highest and Lowest Prices Per Year')
print('----------------------------------')
print()
print('Year\tHigh\tLow')
print('----\t----\t---')
for index in range(len(year_list)):
print(year_list[index],'\t',format(highest_per_year[index],',.3f'),'\t',format(lowest_per_year[index],',.3f'))
def list_of_prices_lowest_to_highest(dates,prices):
min_to_max_prices = []
min_to_max_dates = []
price_list_ = []
date_list = dates[:]
outfile = open('LowToHigh.txt','w')
for index in range(len(prices)):
price_list_.append(float(prices[index]))
for count in range(len(price_list_)):
min_to_max_prices.append(min(price_list_))
min_to_max_dates.append(dates[price_list_.index(min(price_list_))])
del date_list[price_list_.index(min(price_list_))]
del price_list_[price_list_.index(min(price_list_))]
print('List of Prices, Lowest to Highest')
print('---------------------------------')
print()
print('Date\t\tPrice')
print('----\t-----')
for index in range(len(min_to_max_prices)):
print(min_to_max_dates[index],'\t',min_to_max_prices[index])
outfile.write(str(min_to_max_dates[index]) + ':' + str(min_to_max_prices[index]) + '\n')
outfile.close()
def list_of_prices_highest_to_lowest(dates,prices):
max_to_min_prices = []
max_to_min_dates = []
price_list_ = []
date_list = dates[:]
outfile = open('HighToLow.txt', 'w')
for index in range(len(prices)):
price_list_.append(float(prices[index]))
for count in range(len(price_list_)):
max_to_min_prices.append(max(price_list_))
max_to_min_dates.append(date_list[price_list_.index(max(price_list_))])
del date_list[price_list_.index(max(price_list_))]
del price_list_[price_list_.index(max(price_list_))]
print('List of Prices, Highest to Lowest')
print('---------------------------------')
print()
print('Date\t\tPrice')
print('----\t\t-----')
for index in range(len(max_to_min_prices)):
print(max_to_min_dates[index],'\t',max_to_min_prices[index])
outfile.write(str(max_to_min_dates[index]) + ':' + str(max_to_min_prices[index]) + '\n')
def main():
infile = open('GasPrices.txt', 'r')
infile_list = infile.readlines()
date_list = []
price_lists = []
for line in infile_list:
date_list.append(line[0:10])
price_lists.append(line[11:].rstrip('\n'))
infile.close()
average_price_per_year(date_list,price_lists)
average_price_per_month(date_list,price_lists)
highest_lowest_price_per_year(date_list,price_lists)
list_of_prices_lowest_to_highest(date_list,price_lists)
list_of_prices_highest_to_lowest(date_list,price_lists)
main()
| def average_price_per_year(dates, prices):
year = ''
counter = 0
accumulator = 0
average_year_years = []
average_year_prices = []
for index in range(len(dates)):
if year == '':
year = dates[index][6:10]
accumulator += float(prices[index])
counter += 1
elif dates[index][6:10] == year:
accumulator += float(prices[index])
counter += 1
else:
average = accumulator / counter
average_year_years.append(year)
average_year_prices.append(average)
year = dates[index][6:10]
counter = 1
accumulator = float(prices[index])
print('Average Price Per Year')
print('----------------------')
print()
print('Year\t\tPrice')
print('----\t\t-----')
for index in range(len(average_year_years)):
print(average_year_years[index], '\t--->\t', format(average_year_prices[index], ',.3f'))
def average_price_per_month(dates, prices):
month = ''
year = ''
counter = 0
accumulator = 0
average_price_months = []
average_price_prices = []
for index in range(len(dates)):
if year == '':
year = dates[index][6:10]
elif month == '':
month = dates[index][0:2]
elif dates[index][0:2] == month and dates[index][6:10] == year:
accumulator += float(prices[index])
counter += 1
else:
average = accumulator / counter
average_price_months.append(year + '-' + month)
average_price_prices.append(average)
counter = 1
accumulator = float(prices[index])
year = dates[index][6:10]
month = dates[index][0:2]
print('Average Price Per Month')
print('-----------------------')
print()
print('Month\t\tPrice')
print('-----\t\t-----')
for index in range(len(average_price_months)):
print(average_price_months[index], '----->\t', format(average_price_prices[index], ',.3f'))
def highest_lowest_price_per_year(dates, prices):
year = ''
year_list = []
highest_per_year = []
lowest_per_year = []
find_max_min_price = []
for index in range(len(prices)):
prices[index] = float(prices[index])
for index in range(len(dates)):
if year == '':
year = dates[index][6:10]
find_max_min_price.append(prices[index])
elif dates[index][6:10] == year:
find_max_min_price.append(prices[index])
else:
year_list.append(year)
highest_per_year.append(max(find_max_min_price))
lowest_per_year.append(min(find_max_min_price))
year = dates[index][6:10]
find_max_min_price = [prices[index]]
print('Highest and Lowest Prices Per Year')
print('----------------------------------')
print()
print('Year\tHigh\tLow')
print('----\t----\t---')
for index in range(len(year_list)):
print(year_list[index], '\t', format(highest_per_year[index], ',.3f'), '\t', format(lowest_per_year[index], ',.3f'))
def list_of_prices_lowest_to_highest(dates, prices):
min_to_max_prices = []
min_to_max_dates = []
price_list_ = []
date_list = dates[:]
outfile = open('LowToHigh.txt', 'w')
for index in range(len(prices)):
price_list_.append(float(prices[index]))
for count in range(len(price_list_)):
min_to_max_prices.append(min(price_list_))
min_to_max_dates.append(dates[price_list_.index(min(price_list_))])
del date_list[price_list_.index(min(price_list_))]
del price_list_[price_list_.index(min(price_list_))]
print('List of Prices, Lowest to Highest')
print('---------------------------------')
print()
print('Date\t\tPrice')
print('----\t-----')
for index in range(len(min_to_max_prices)):
print(min_to_max_dates[index], '\t', min_to_max_prices[index])
outfile.write(str(min_to_max_dates[index]) + ':' + str(min_to_max_prices[index]) + '\n')
outfile.close()
def list_of_prices_highest_to_lowest(dates, prices):
max_to_min_prices = []
max_to_min_dates = []
price_list_ = []
date_list = dates[:]
outfile = open('HighToLow.txt', 'w')
for index in range(len(prices)):
price_list_.append(float(prices[index]))
for count in range(len(price_list_)):
max_to_min_prices.append(max(price_list_))
max_to_min_dates.append(date_list[price_list_.index(max(price_list_))])
del date_list[price_list_.index(max(price_list_))]
del price_list_[price_list_.index(max(price_list_))]
print('List of Prices, Highest to Lowest')
print('---------------------------------')
print()
print('Date\t\tPrice')
print('----\t\t-----')
for index in range(len(max_to_min_prices)):
print(max_to_min_dates[index], '\t', max_to_min_prices[index])
outfile.write(str(max_to_min_dates[index]) + ':' + str(max_to_min_prices[index]) + '\n')
def main():
infile = open('GasPrices.txt', 'r')
infile_list = infile.readlines()
date_list = []
price_lists = []
for line in infile_list:
date_list.append(line[0:10])
price_lists.append(line[11:].rstrip('\n'))
infile.close()
average_price_per_year(date_list, price_lists)
average_price_per_month(date_list, price_lists)
highest_lowest_price_per_year(date_list, price_lists)
list_of_prices_lowest_to_highest(date_list, price_lists)
list_of_prices_highest_to_lowest(date_list, price_lists)
main() |
# The maximum size of a WebSocket message that can be sent or received
# by the Determined agent and trial-runner. The master uses a different limit,
# because it uses the uwsgi WebSocket implementation; see
# `websocket-max-size` in `uwsgi.ini`.
MAX_WEBSOCKET_MSG_SIZE = 128 * 1024 * 1024
# The maximum HTTP request size that will be accepted by the master. This
# is intended as a safeguard to quickly drop overly large HTTP requests.
MAX_HTTP_REQUEST_SIZE = 128 * 1024 * 1024
# The maximum size of a model (the sum of the model definition plus any
# additional package dependencies). Models are created via HTTP and sent
# to agents via WebSockets; we also have to account for the overhead of
# base64 encoding. Models are also stored in Postgres but the max
# Postgres field size is 1GB, so we ignore that here.
MAX_ENCODED_SIZE = (min(MAX_WEBSOCKET_MSG_SIZE, MAX_HTTP_REQUEST_SIZE) // 8) * 6
# We subtract one megabyte to account for any message envelope size we may have.
MAX_CONTEXT_SIZE = MAX_ENCODED_SIZE - (1 * 1024 * 1024)
# The username and password for the default user.
DEFAULT_DETERMINED_USER = "determined"
DEFAULT_DETERMINED_PASSWORD = ""
DEFAULT_CHECKPOINT_PATH = "checkpoints"
ACTIVE = "ACTIVE"
CANCELED = "CANCELED"
COMPLETED = "COMPLETED"
DELETED = "DELETED"
ERROR = "ERROR"
TERMINAL_STATES = {COMPLETED, CANCELED, ERROR}
SHARED_FS_CONTAINER_PATH = "/determined_shared_fs"
# By default, we ignore:
# - all byte-compiled Python files to ignore a potential stale compilation
# - terraform files generated by `det deploy gcp`, e.g. when user creates
# a cluster from the (tutorial) model def directory.
# - .git and IDE-related content
# Users may also define custom .detignore files to ignore arbitrary paths.
DEFAULT_DETIGNORE = [
"__pycache__/",
"*.py[co]",
"*$py.class",
"terraform",
"terraform_data",
"terraform.tfstate*",
"terraform.tfvars*",
".terraform*",
".git/",
".vscode/",
".idea/",
".mypy_cache/",
]
| max_websocket_msg_size = 128 * 1024 * 1024
max_http_request_size = 128 * 1024 * 1024
max_encoded_size = min(MAX_WEBSOCKET_MSG_SIZE, MAX_HTTP_REQUEST_SIZE) // 8 * 6
max_context_size = MAX_ENCODED_SIZE - 1 * 1024 * 1024
default_determined_user = 'determined'
default_determined_password = ''
default_checkpoint_path = 'checkpoints'
active = 'ACTIVE'
canceled = 'CANCELED'
completed = 'COMPLETED'
deleted = 'DELETED'
error = 'ERROR'
terminal_states = {COMPLETED, CANCELED, ERROR}
shared_fs_container_path = '/determined_shared_fs'
default_detignore = ['__pycache__/', '*.py[co]', '*$py.class', 'terraform', 'terraform_data', 'terraform.tfstate*', 'terraform.tfvars*', '.terraform*', '.git/', '.vscode/', '.idea/', '.mypy_cache/'] |
def avaliarSituacao(media):
if media >= 6:
print('aprovado')
else:
print('reprovado')
def calcularMedia(p1, p2):
media = (p1 + p2) / 2
avaliarSituacao(media)
def main():
p1 = float(input('Digite a primeira nota: '))
p2 = float(input('Digite a segunda nota: '))
calcularMedia(p1, p2)
main()
| def avaliar_situacao(media):
if media >= 6:
print('aprovado')
else:
print('reprovado')
def calcular_media(p1, p2):
media = (p1 + p2) / 2
avaliar_situacao(media)
def main():
p1 = float(input('Digite a primeira nota: '))
p2 = float(input('Digite a segunda nota: '))
calcular_media(p1, p2)
main() |
# i = 4, tallest library building
''' Nearly complete
building_coordinations = [[(-0.126585027793863,16.8195412372661),
(-1.26360571382314,26.9366491540346),
(-15.8471949722061,25.2976587627339),
(-14.7101742861769,15.1805508459654)],
[(-23.0767794626376,16.8481382394501),
(-15.1990122585185,17.6638842108194),
(-16.2936205373624,28.2346617605499),
(-24.1713877414815,27.4189157891806)],
[(-24.6491019813129,-2.8185334334924),
(-14.101147340091,-2.84946701921701),
(-14.0468980186871,15.6488534334924),
(-24.594852659909,15.679787019217)],
[(-21.5000842110591,-9.44961399824389),
(-14.0429792391866,-9.28372083691639),
(-14.1765157889409,-3.28108600175611),
(-21.6336207608134,-3.44697916308361)],
[(3.94535013848411,-3.36623865637194),
(14.493304779706,-3.39717224209654),
(14.5540698615159,17.3229386563719),
(4.00611522029401,17.3538722420965)],
[(8.04858173555005,-30.4958667788278),
(12.4781226874434,-30.5088571252425),
(12.53001826445,-12.8131332211722),
(8.10047731255663,-12.8001428747575)],
[(16.1178588413269,-32.2262223173032),
(20.5473997932202,-32.2392126637179),
(20.5917411586731,-17.1193776826968),
(16.1622002067798,-17.1063873362821)],
[(20.5041475657755,-32.1942704687495),
(24.9336885176689,-32.2072608151642),
(24.9464524342245,-27.8549295312505),
(20.5169114823311,-27.8419391848358)],
[(19.5743191710178,-16.0103447371203),
(25.002585828147,-16.0262640084564),
(25.0170808289822,-11.0836552628797),
(19.588814171853,-11.0677359915436)]]
'''
# The last one is the tallest building i = 6
building_coordinations = [[(-0.126585027793863,16.8195412372661),
(-1.26360571382314,26.9366491540346),
(-15.8471949722061,25.2976587627339),
(-14.7101742861769,15.1805508459654)],
[(-23.0767794626376,16.8481382394501),
(-15.1990122585185,17.6638842108194),
(-16.2936205373624,28.2346617605499),
(-24.1713877414815,27.4189157891806)],
[(-24.6491019813129,-2.8185334334924),
(-14.101147340091,-2.84946701921701),
(-14.0468980186871,15.6488534334924),
(-24.594852659909,15.679787019217)],
[(-21.5000842110591,-9.44961399824389),
(-14.0429792391866,-9.28372083691639),
(-14.1765157889409,-3.28108600175611),
(-21.6336207608134,-3.44697916308361)],
[(3.94535013848411,-3.36623865637194),
(14.493304779706,-3.39717224209654),
(14.5540698615159,17.3229386563719),
(4.00611522029401,17.3538722420965)],
[(2.57209348808029,-3.26004248341449),
(3.79342823604293,-3.26362424541571),
(3.81202651191971,3.07814848341449),
(2.59069176395707,3.08173024541571)],
[(-3.2169746262757,-5.0930349504193),
(2.44827101178602,-5.1096492010069),
(2.4795386262757,5.5522049504193),
(-3.18570701178602,5.5688192010069)]]
''' # Complete
lawn_coordinations = [[(-19.0,-14.0),
(2.0,-14.0),
(-4.5,-24.0),
(-11.0,-24.0)],
[(-19.5,-20.0),
(-14.5,-25.5),
(-14.5,-30.5),
(-19.5,-37.0)],
[(-1.0,-24.5),
(4.5,-18.5),
(4.5,-36.5),
(-1.0,-30.5)],
[(-11.0,-32.5),
(-4.5,-32.5),
(2.0,-42.0),
(-19.0,-42.0)],
[(-8.5,1.0),
(-3.0,1.0),
(-3.0,-4.5),
(-8.5,-4.5)],
[(14.5,11.0),
(27.0,8.0),
(15.5,-4.5)],
[(28.0,2.0),
(27.5,-11.0),
(17.5,-10.0)]]
'''
lawn_coordinations = [[(-10.5,1.0),
(-5.0,1.0),
(-5.0,-4.5),
(-10.5,-4.5)],
[(14.5,11.0),
(27.0,8.0),
(15.5,-4.5)],
[(28.0,2.0),
(27.5,-11.0),
(17.5,-10.0)]]
forest_coordinations = [[(1.0,21.5),
(18.0,36.0),
(4.0,40.0)],
[(7.0,17.5),
(27.5,17.5),
(24.5,30.5)]]
food_coordinations = [[-14.5,39.0],[-7.0,10.0],[15.0,30.0]]
red_chaser_init_pos = [[-8.0,0.0],[-10.0,30.0],[15.0,29.0]]
green_escaper_init_pos = [[-5.0,-5.0],[-2.0,-9.5],[-10.0,34.0],[20.0,4.5],[17.5,17.0],[-15.0,28.5],[15.5,35.0],[18.0,26.0]]
init_plaza = [-10.0,-5.0]
init_forest_1 = [4.0,37.0]
init_forest_2 = [20.0,24.0]
escaper_starter_range = [[[-14.0,25.0],[-10.0,-7.0]],
[[-13.0,-5.0],[-7.0,14.0]],
[[-5.0,3.0],[7.0,29.0]],
[[4.0,25.0],[19.0,29.0]],
[[15.0,25.0],[-7.0,18.0]],
[[-25.0,25.0],[30.0,40.0]]]
| """ Nearly complete
building_coordinations = [[(-0.126585027793863,16.8195412372661),
(-1.26360571382314,26.9366491540346),
(-15.8471949722061,25.2976587627339),
(-14.7101742861769,15.1805508459654)],
[(-23.0767794626376,16.8481382394501),
(-15.1990122585185,17.6638842108194),
(-16.2936205373624,28.2346617605499),
(-24.1713877414815,27.4189157891806)],
[(-24.6491019813129,-2.8185334334924),
(-14.101147340091,-2.84946701921701),
(-14.0468980186871,15.6488534334924),
(-24.594852659909,15.679787019217)],
[(-21.5000842110591,-9.44961399824389),
(-14.0429792391866,-9.28372083691639),
(-14.1765157889409,-3.28108600175611),
(-21.6336207608134,-3.44697916308361)],
[(3.94535013848411,-3.36623865637194),
(14.493304779706,-3.39717224209654),
(14.5540698615159,17.3229386563719),
(4.00611522029401,17.3538722420965)],
[(8.04858173555005,-30.4958667788278),
(12.4781226874434,-30.5088571252425),
(12.53001826445,-12.8131332211722),
(8.10047731255663,-12.8001428747575)],
[(16.1178588413269,-32.2262223173032),
(20.5473997932202,-32.2392126637179),
(20.5917411586731,-17.1193776826968),
(16.1622002067798,-17.1063873362821)],
[(20.5041475657755,-32.1942704687495),
(24.9336885176689,-32.2072608151642),
(24.9464524342245,-27.8549295312505),
(20.5169114823311,-27.8419391848358)],
[(19.5743191710178,-16.0103447371203),
(25.002585828147,-16.0262640084564),
(25.0170808289822,-11.0836552628797),
(19.588814171853,-11.0677359915436)]]
"""
building_coordinations = [[(-0.126585027793863, 16.8195412372661), (-1.26360571382314, 26.9366491540346), (-15.8471949722061, 25.2976587627339), (-14.7101742861769, 15.1805508459654)], [(-23.0767794626376, 16.8481382394501), (-15.1990122585185, 17.6638842108194), (-16.2936205373624, 28.2346617605499), (-24.1713877414815, 27.4189157891806)], [(-24.6491019813129, -2.8185334334924), (-14.101147340091, -2.84946701921701), (-14.0468980186871, 15.6488534334924), (-24.594852659909, 15.679787019217)], [(-21.5000842110591, -9.44961399824389), (-14.0429792391866, -9.28372083691639), (-14.1765157889409, -3.28108600175611), (-21.6336207608134, -3.44697916308361)], [(3.94535013848411, -3.36623865637194), (14.493304779706, -3.39717224209654), (14.5540698615159, 17.3229386563719), (4.00611522029401, 17.3538722420965)], [(2.57209348808029, -3.26004248341449), (3.79342823604293, -3.26362424541571), (3.81202651191971, 3.07814848341449), (2.59069176395707, 3.08173024541571)], [(-3.2169746262757, -5.0930349504193), (2.44827101178602, -5.1096492010069), (2.4795386262757, 5.5522049504193), (-3.18570701178602, 5.5688192010069)]]
' # Complete\nlawn_coordinations = [[(-19.0,-14.0),\n\t\t\t\t\t(2.0,-14.0),\n\t\t\t\t\t(-4.5,-24.0),\n\t\t\t\t\t(-11.0,-24.0)],\n\t\t\t[(-19.5,-20.0),\n\t\t\t\t\t(-14.5,-25.5),\n\t\t\t\t\t(-14.5,-30.5),\n\t\t\t\t\t(-19.5,-37.0)],\n\t\t\t[(-1.0,-24.5),\n\t\t\t\t\t(4.5,-18.5),\n\t\t\t\t\t(4.5,-36.5),\n\t\t\t\t\t(-1.0,-30.5)],\n\t\t\t[(-11.0,-32.5),\n\t\t\t\t\t(-4.5,-32.5),\n\t\t\t\t\t(2.0,-42.0),\n\t\t\t\t\t(-19.0,-42.0)],\n\t\t\t[(-8.5,1.0),\n\t\t\t\t\t(-3.0,1.0),\n\t\t\t\t\t(-3.0,-4.5),\n\t\t\t\t\t(-8.5,-4.5)],\n\t\t\t[(14.5,11.0),\n\t\t\t\t\t(27.0,8.0),\n\t\t\t\t\t(15.5,-4.5)],\n\t\t\t[(28.0,2.0),\n\t\t\t\t\t(27.5,-11.0),\n\t\t\t\t\t(17.5,-10.0)]]\n'
lawn_coordinations = [[(-10.5, 1.0), (-5.0, 1.0), (-5.0, -4.5), (-10.5, -4.5)], [(14.5, 11.0), (27.0, 8.0), (15.5, -4.5)], [(28.0, 2.0), (27.5, -11.0), (17.5, -10.0)]]
forest_coordinations = [[(1.0, 21.5), (18.0, 36.0), (4.0, 40.0)], [(7.0, 17.5), (27.5, 17.5), (24.5, 30.5)]]
food_coordinations = [[-14.5, 39.0], [-7.0, 10.0], [15.0, 30.0]]
red_chaser_init_pos = [[-8.0, 0.0], [-10.0, 30.0], [15.0, 29.0]]
green_escaper_init_pos = [[-5.0, -5.0], [-2.0, -9.5], [-10.0, 34.0], [20.0, 4.5], [17.5, 17.0], [-15.0, 28.5], [15.5, 35.0], [18.0, 26.0]]
init_plaza = [-10.0, -5.0]
init_forest_1 = [4.0, 37.0]
init_forest_2 = [20.0, 24.0]
escaper_starter_range = [[[-14.0, 25.0], [-10.0, -7.0]], [[-13.0, -5.0], [-7.0, 14.0]], [[-5.0, 3.0], [7.0, 29.0]], [[4.0, 25.0], [19.0, 29.0]], [[15.0, 25.0], [-7.0, 18.0]], [[-25.0, 25.0], [30.0, 40.0]]] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.