content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
def lambda_handler(event):
try:
first_num = event["queryStringParameters"]["firstNum"]
except KeyError:
first_num = 0
try:
second_num = event["queryStringParameters"]["secondNum"]
except KeyError:
second_num = 0
try:
operation_type = event["queryStringParameters"]["operation"]
if operation_type == "add":
result = add(first_num, second_num)
elif operation_type == "subtract":
result = subtract(first_num, second_num)
elif operation_type == "subtract":
result = multiply(first_num, second_num)
else:
result = "No Operation"
except KeyError:
return "No Operation"
return result
def add(first_num, second_num):
result = int(first_num) + int(second_num)
print("The result of % s + % s = %s" % (first_num, second_num, result))
return {"body": result, "statusCode": 200}
def subtract(first_num, second_num):
result = int(first_num) - int(second_num)
print("The result of % s - % s = %s" % (first_num, second_num, result))
return {"body": result, "statusCode": 200}
def multiply(first_num, second_num):
result = int(first_num) * int(second_num)
print("The result of % s * % s = %s" % (first_num, second_num, result))
return {"body": result, "statusCode": 200}
| def lambda_handler(event):
try:
first_num = event['queryStringParameters']['firstNum']
except KeyError:
first_num = 0
try:
second_num = event['queryStringParameters']['secondNum']
except KeyError:
second_num = 0
try:
operation_type = event['queryStringParameters']['operation']
if operation_type == 'add':
result = add(first_num, second_num)
elif operation_type == 'subtract':
result = subtract(first_num, second_num)
elif operation_type == 'subtract':
result = multiply(first_num, second_num)
else:
result = 'No Operation'
except KeyError:
return 'No Operation'
return result
def add(first_num, second_num):
result = int(first_num) + int(second_num)
print('The result of % s + % s = %s' % (first_num, second_num, result))
return {'body': result, 'statusCode': 200}
def subtract(first_num, second_num):
result = int(first_num) - int(second_num)
print('The result of % s - % s = %s' % (first_num, second_num, result))
return {'body': result, 'statusCode': 200}
def multiply(first_num, second_num):
result = int(first_num) * int(second_num)
print('The result of % s * % s = %s' % (first_num, second_num, result))
return {'body': result, 'statusCode': 200} |
input1 = int(input("Enter the first number: "))
input2 = int(input("Enter the second number: "))
input3 = int(input("Enter the third number: "))
input4 = int(input("Enter the fourth number: "))
input5 = int(input("Enter the fifth number: "))
tuple_num = []
tuple_num.append(input1)
tuple_num.append(input2)
tuple_num.append(input3)
tuple_num.append(input4)
tuple_num.append(input5)
print(tuple_num)
tuple_num.sort()
for a in tuple_num:
print(a * a) | input1 = int(input('Enter the first number: '))
input2 = int(input('Enter the second number: '))
input3 = int(input('Enter the third number: '))
input4 = int(input('Enter the fourth number: '))
input5 = int(input('Enter the fifth number: '))
tuple_num = []
tuple_num.append(input1)
tuple_num.append(input2)
tuple_num.append(input3)
tuple_num.append(input4)
tuple_num.append(input5)
print(tuple_num)
tuple_num.sort()
for a in tuple_num:
print(a * a) |
#Longest Common Prefix in python
#Implementation of python program to find the longest common prefix amongst the given list of strings.
#If there is no common prefix then returning 0.
#define the function to evaluate the longest common prefix
def longestCommonPrefix(s):
p = '' #declare an empty string
for i in range(len(min(s, key=len))):
f = s[0][i]
for j in s[1:]:
if j[i] != f:
return p
p += f
return p #return the longest common prefix
n = int(input("Enter the number of names in list for input:"))
print("Enter the Strings:")
s = [input() for i in range(n)]
if(longestCommonPrefix(s)):
print("The Common Prefix is:" ,longestCommonPrefix(s))
else:
print("There is no common prefix for the given list of strings, hence the answer is:", 0) | def longest_common_prefix(s):
p = ''
for i in range(len(min(s, key=len))):
f = s[0][i]
for j in s[1:]:
if j[i] != f:
return p
p += f
return p
n = int(input('Enter the number of names in list for input:'))
print('Enter the Strings:')
s = [input() for i in range(n)]
if longest_common_prefix(s):
print('The Common Prefix is:', longest_common_prefix(s))
else:
print('There is no common prefix for the given list of strings, hence the answer is:', 0) |
#!/usr/bin/env python
P = int(input())
for _ in range(P):
N, n, m = [int(i) for i in input().split()]
print(f"{N} {(n - m) * m + 1}")
| p = int(input())
for _ in range(P):
(n, n, m) = [int(i) for i in input().split()]
print(f'{N} {(n - m) * m + 1}') |
def handler(event, context):
return {
"statusCode": 302,
"headers": {
"Location": "https://www.nhsx.nhs.uk/covid-19-response/data-and-covid-19/national-covid-19-chest-imaging-database-nccid/"
},
}
| def handler(event, context):
return {'statusCode': 302, 'headers': {'Location': 'https://www.nhsx.nhs.uk/covid-19-response/data-and-covid-19/national-covid-19-chest-imaging-database-nccid/'}} |
__name__ = 'factory_djoy'
__version__ = '2.2.0'
__author__ = 'James Cooke'
__copyright__ = '2021, {}'.format(__author__)
__description__ = 'Factories for Django, creating valid model instances every time.'
__email__ = '[email protected]'
| __name__ = 'factory_djoy'
__version__ = '2.2.0'
__author__ = 'James Cooke'
__copyright__ = '2021, {}'.format(__author__)
__description__ = 'Factories for Django, creating valid model instances every time.'
__email__ = '[email protected]' |
class CyclesMeshSettings:
pass
| class Cyclesmeshsettings:
pass |
l = ["+", "-"]
def backRec(x):
for j in l:
x.append(j)
if consistent(x):
if solution(x):
solutionFound(x)
backRec(x)
x.pop()
def consistent(s):
return len(s) < n
def solution(s):
summ = list2[0]
if not len(s) == n - 1:
return False
for i in range(n - 1):
if s[i] == "-":
summ -= list2[i + 1]
else:
summ += list2[i + 1]
return summ > 0
def solutionFound(s):
print(s)
n = int(input("Give number"))
list2 = []
for i in range(n):
list2.append(int(input(str(i) + ":")))
backRec([])
| l = ['+', '-']
def back_rec(x):
for j in l:
x.append(j)
if consistent(x):
if solution(x):
solution_found(x)
back_rec(x)
x.pop()
def consistent(s):
return len(s) < n
def solution(s):
summ = list2[0]
if not len(s) == n - 1:
return False
for i in range(n - 1):
if s[i] == '-':
summ -= list2[i + 1]
else:
summ += list2[i + 1]
return summ > 0
def solution_found(s):
print(s)
n = int(input('Give number'))
list2 = []
for i in range(n):
list2.append(int(input(str(i) + ':')))
back_rec([]) |
# block between mission & 6th and howard & 5th in SF.
# appears to have lots of buses.
# https://www.openstreetmap.org/way/88572932 -- Mission St
# https://www.openstreetmap.org/relation/3406710 -- 14X to Daly City
# https://www.openstreetmap.org/relation/3406709 -- 14X to Downtown
# https://www.openstreetmap.org/relation/3406708 -- 14R to Mission
# https://www.openstreetmap.org/relation/3000713 -- 14R to Downtown
# ... and many more bus route relations
z, x, y = (16, 10484, 25329)
# test that at least one is present in tiles up to z12
while z >= 12:
assert_has_feature(
z, x, y, 'roads',
{ 'is_bus_route': True })
z, x, y = (z-1, x/2, y/2)
# but that none are present in the parent tile at z11
assert_no_matching_feature(
z, x, y, 'roads',
{ 'is_bus_route': True })
| (z, x, y) = (16, 10484, 25329)
while z >= 12:
assert_has_feature(z, x, y, 'roads', {'is_bus_route': True})
(z, x, y) = (z - 1, x / 2, y / 2)
assert_no_matching_feature(z, x, y, 'roads', {'is_bus_route': True}) |
class Zoo:
def __init__(self, name, locations):
self.name = name
self.stillActive = True
self.locations = locations
self.currentLocation = self.locations[1]
def changeLocation(self, direction):
neighborID = self.currentLocation.neighbors[direction]
self.currentLocation = self.locations[neighborID]
def exit(self):
if self.currentLocation.allowExit:
self.stillActive = False
class Location:
def __init__(self, id, name, animal, neighbors, allowExit):
self.id = id
self.name = name
self.animal = animal
self.neighbors = neighbors
self.allowExit = allowExit
class Animal:
def __init__(self, name, soundMade, foodEaten, shelterType):
self.name = name
self.soundMade = soundMade
self.foodEaten = foodEaten
self.shelterType = shelterType
def speak(self):
return 'The ' + self.name + ' sounds like: ' + self.soundMade
def diet(self):
return 'The ' + self.name + ' eats ' + self.foodEaten
def shelter(self):
return 'The ' + self.name + ' prefers: ' + self.shelterType
| class Zoo:
def __init__(self, name, locations):
self.name = name
self.stillActive = True
self.locations = locations
self.currentLocation = self.locations[1]
def change_location(self, direction):
neighbor_id = self.currentLocation.neighbors[direction]
self.currentLocation = self.locations[neighborID]
def exit(self):
if self.currentLocation.allowExit:
self.stillActive = False
class Location:
def __init__(self, id, name, animal, neighbors, allowExit):
self.id = id
self.name = name
self.animal = animal
self.neighbors = neighbors
self.allowExit = allowExit
class Animal:
def __init__(self, name, soundMade, foodEaten, shelterType):
self.name = name
self.soundMade = soundMade
self.foodEaten = foodEaten
self.shelterType = shelterType
def speak(self):
return 'The ' + self.name + ' sounds like: ' + self.soundMade
def diet(self):
return 'The ' + self.name + ' eats ' + self.foodEaten
def shelter(self):
return 'The ' + self.name + ' prefers: ' + self.shelterType |
def test_get_news(sa_session, sa_backend, sa_child_news):
assert(sa_child_news == sa_backend.get_news(sa_child_news.id))
assert(sa_backend.get_news(None) is None)
def test_get_news_list(sa_session, sa_backend, sa_child_news):
assert(sa_child_news in sa_backend.get_news_list())
assert(sa_child_news in sa_backend.get_news_list(
owner=sa_child_news.owner))
assert(sa_child_news in sa_backend.get_news_list(
root_url=sa_child_news.root.url))
assert(sa_child_news in sa_backend.get_news_list(
owner=sa_child_news.owner,
root_url=sa_child_news.root.url
))
def test_news_exists(sa_session, sa_backend, sa_child_news):
assert(sa_backend.news_exists(sa_child_news.id))
sa_backend.delete_news(sa_child_news)
assert(not sa_backend.news_exists(sa_child_news.id))
def test_save_news(sa_session, sa_backend,
sa_schedule, sa_news_model, url_root, content_root):
news = sa_news_model.create_instance(
schedule=sa_schedule,
url=url_root,
title='title',
content=content_root,
summary='summary'
)
assert(news not in sa_backend.get_news_list(sa_schedule.owner, url_root))
sa_backend.save_news(news)
assert(news in sa_backend.get_news_list(sa_schedule.owner, url_root))
def test_delete_news(sa_session, sa_backend, sa_child_news):
assert(sa_backend.news_exists(sa_child_news.id))
sa_backend.delete_news(sa_child_news)
assert(not sa_backend.news_exists(sa_child_news.id))
def test_get_schedule(sa_session, sa_backend, sa_schedule):
assert(sa_schedule == sa_backend.get_schedule(sa_schedule.id))
def test_get_schedules(sa_session, sa_backend, sa_schedule,
sa_owner, url_root):
assert(sa_schedule in sa_backend.get_schedules(sa_owner, url_root))
| def test_get_news(sa_session, sa_backend, sa_child_news):
assert sa_child_news == sa_backend.get_news(sa_child_news.id)
assert sa_backend.get_news(None) is None
def test_get_news_list(sa_session, sa_backend, sa_child_news):
assert sa_child_news in sa_backend.get_news_list()
assert sa_child_news in sa_backend.get_news_list(owner=sa_child_news.owner)
assert sa_child_news in sa_backend.get_news_list(root_url=sa_child_news.root.url)
assert sa_child_news in sa_backend.get_news_list(owner=sa_child_news.owner, root_url=sa_child_news.root.url)
def test_news_exists(sa_session, sa_backend, sa_child_news):
assert sa_backend.news_exists(sa_child_news.id)
sa_backend.delete_news(sa_child_news)
assert not sa_backend.news_exists(sa_child_news.id)
def test_save_news(sa_session, sa_backend, sa_schedule, sa_news_model, url_root, content_root):
news = sa_news_model.create_instance(schedule=sa_schedule, url=url_root, title='title', content=content_root, summary='summary')
assert news not in sa_backend.get_news_list(sa_schedule.owner, url_root)
sa_backend.save_news(news)
assert news in sa_backend.get_news_list(sa_schedule.owner, url_root)
def test_delete_news(sa_session, sa_backend, sa_child_news):
assert sa_backend.news_exists(sa_child_news.id)
sa_backend.delete_news(sa_child_news)
assert not sa_backend.news_exists(sa_child_news.id)
def test_get_schedule(sa_session, sa_backend, sa_schedule):
assert sa_schedule == sa_backend.get_schedule(sa_schedule.id)
def test_get_schedules(sa_session, sa_backend, sa_schedule, sa_owner, url_root):
assert sa_schedule in sa_backend.get_schedules(sa_owner, url_root) |
# Implemented from: https://stackoverflow.com/questions/9501337/binary-search-algorithm-in-python
def binary_search(sequence, value):
lo, hi = 0, len(sequence) - 1
while lo <= hi:
mid = (lo + hi) // 2
if sequence[mid] < value:
lo = mid + 1
elif value < sequence[mid]:
hi = mid - 1
else:
return mid
return None
def dfs(graph, node, visited=[]):
if node not in visited:
visited.append(node)
for n in graph[node]:
dfs(graph, n, visited)
return visited
# Implemented from: https://pythoninwonderland.wordpress.com/2017/03/18/how-to-implement-breadth-first-search-in-python/
def bfs(graph, start):
# keep track of all visited nodes
explored = []
# keep track of nodes to be checked
queue = [start]
# keep looping until there are nodes still to be checked
while queue:
# pop shallowest node (first node) from queue
node = queue.pop(0)
if node not in explored:
# add node to list of checked nodes
explored.append(node)
neighbours = graph[node]
# add neighbours of node to queue
for neighbour in neighbours:
queue.append(neighbour)
return explored
| def binary_search(sequence, value):
(lo, hi) = (0, len(sequence) - 1)
while lo <= hi:
mid = (lo + hi) // 2
if sequence[mid] < value:
lo = mid + 1
elif value < sequence[mid]:
hi = mid - 1
else:
return mid
return None
def dfs(graph, node, visited=[]):
if node not in visited:
visited.append(node)
for n in graph[node]:
dfs(graph, n, visited)
return visited
def bfs(graph, start):
explored = []
queue = [start]
while queue:
node = queue.pop(0)
if node not in explored:
explored.append(node)
neighbours = graph[node]
for neighbour in neighbours:
queue.append(neighbour)
return explored |
'''
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
'''
class Solution:
def threeSumClosest(self, nums: list, target: int) -> int:
nums.sort()
closest = 10**10
output = 0
for idx, x in enumerate(nums):
if idx > 0 and nums[idx - 1] == nums[idx]:
continue
l = idx + 1
r = len(nums) - 1
while l < r:
sums = x + nums[l] + nums[r]
subtraction = abs(sums - target)
if sums < target:
if subtraction < abs(closest):
closest = subtraction
output = sums
l += 1
elif sums > target:
if subtraction < abs(closest):
closest = subtraction
output = sums
r -= 1
else:
return target
return output
| """
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
"""
class Solution:
def three_sum_closest(self, nums: list, target: int) -> int:
nums.sort()
closest = 10 ** 10
output = 0
for (idx, x) in enumerate(nums):
if idx > 0 and nums[idx - 1] == nums[idx]:
continue
l = idx + 1
r = len(nums) - 1
while l < r:
sums = x + nums[l] + nums[r]
subtraction = abs(sums - target)
if sums < target:
if subtraction < abs(closest):
closest = subtraction
output = sums
l += 1
elif sums > target:
if subtraction < abs(closest):
closest = subtraction
output = sums
r -= 1
else:
return target
return output |
def print_lol(arr):
for row in arr:
if (isinstance(row, list)):
print_lol(row)
else:
print
row
| def print_lol(arr):
for row in arr:
if isinstance(row, list):
print_lol(row)
else:
print
row |
def cwinstart(callobj, *args, **kwargs):
print('cwinstart')
print(' args', repr(args))
for arg in args:
print(' ', arg)
print(' kwargs', len(kwargs))
for k, v in kwargs.items():
print(' ', k, v)
w = callobj(*args, **kwargs)
print(' callobj()->', w)
return w
def cwincall(req1, req2, *args, **kwargs):
print('cwincall')
print(' req1=', req1, 'req2=', req2)
print(' args', repr(args))
for arg in args:
print(' ', arg)
print('kwargs')
for k, v in kwargs.items():
print(' ', k, v)
return 'tomorrow'
| def cwinstart(callobj, *args, **kwargs):
print('cwinstart')
print(' args', repr(args))
for arg in args:
print(' ', arg)
print(' kwargs', len(kwargs))
for (k, v) in kwargs.items():
print(' ', k, v)
w = callobj(*args, **kwargs)
print(' callobj()->', w)
return w
def cwincall(req1, req2, *args, **kwargs):
print('cwincall')
print(' req1=', req1, 'req2=', req2)
print(' args', repr(args))
for arg in args:
print(' ', arg)
print('kwargs')
for (k, v) in kwargs.items():
print(' ', k, v)
return 'tomorrow' |
#!/usr/bin/env python3
# Copyright (C) 2020-2021 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except according to the terms contained in the LICENSE file.
"__init__ module for the btclib package."
name = "btclib"
__version__ = "2021.1"
__author__ = "The btclib developers"
__author_email__ = "[email protected]"
__copyright__ = "Copyright (C) 2017-2021 The btclib developers"
__license__ = "MIT License"
| """__init__ module for the btclib package."""
name = 'btclib'
__version__ = '2021.1'
__author__ = 'The btclib developers'
__author_email__ = '[email protected]'
__copyright__ = 'Copyright (C) 2017-2021 The btclib developers'
__license__ = 'MIT License' |
for num in range(1,6):
#code inside for loop
if num == 4:
continue
#code inside for loop
print(num)
#code outside for loop
print("continue statement executed on num = 4")
| for num in range(1, 6):
if num == 4:
continue
print(num)
print('continue statement executed on num = 4') |
def get_remain(cpf: str, start: int, upto: int) -> int:
total = 0
for count, num in enumerate(cpf[:upto]):
try:
total += int(num) * (start - count)
except ValueError:
return None
remain = (total * 10) % 11
remain = remain if remain != 10 else 0
return remain
def padronize_date(date: str) -> str:
day, month, year = map(lambda x: x.lstrip("0"), date.split("/"))
day = day if len(day) == 2 else f"0{day}"
month = month if len(month) == 2 else f"0{month}"
year = year if len(year) == 4 else f"{'0'*(4-len(year))}{year}"
return f"{day}/{month}/{year}"
def padronize_time(time: str) -> str:
hour, minute = map(lambda x: x.lstrip("0"), time.split(":"))
hour = hour if len(hour) == 2 else f"0{hour}"
minute = minute if len(minute) == 2 else f"0{minute}"
return f"{hour}:{minute}"
| def get_remain(cpf: str, start: int, upto: int) -> int:
total = 0
for (count, num) in enumerate(cpf[:upto]):
try:
total += int(num) * (start - count)
except ValueError:
return None
remain = total * 10 % 11
remain = remain if remain != 10 else 0
return remain
def padronize_date(date: str) -> str:
(day, month, year) = map(lambda x: x.lstrip('0'), date.split('/'))
day = day if len(day) == 2 else f'0{day}'
month = month if len(month) == 2 else f'0{month}'
year = year if len(year) == 4 else f"{'0' * (4 - len(year))}{year}"
return f'{day}/{month}/{year}'
def padronize_time(time: str) -> str:
(hour, minute) = map(lambda x: x.lstrip('0'), time.split(':'))
hour = hour if len(hour) == 2 else f'0{hour}'
minute = minute if len(minute) == 2 else f'0{minute}'
return f'{hour}:{minute}' |
class Student:
def __init__(self, name, hours, qpoints):
self.name = name
self.hours = float(hours)
self.qpoints = float(qpoints)
def get_name(self):
return self.name
def get_hours(self):
return self.hours
def get_qpoints(self):
return self.qpoints
def gpa(self):
return self.qpoints / self.hours
def make_student(info_str):
# info_str is a tab-separated line: name hours qpoints
# returns a corresponding Student object
name, hours, qpoints = info_str.split('\t')
return Student(name, hours, qpoints)
def main():
# open the input file for reading
filename = input('Enter the name of the grade file: ')
infile = open(filename, 'r')
# set best to the record for the first student in the file
best = make_student(infile.readline())
# process subsequent lines of the file
for line in infile:
# turn the line into a student record
s = make_student(line)
# if this student is best so far, remember it.
if s.gpa() > best.gpa():
best = s
infile.close()
# print information about the best student
print('The best student is', best.get_name())
print('hours:', best.get_hours())
print('GPA:', best.gpa())
if __name__ == '__main__': main() | class Student:
def __init__(self, name, hours, qpoints):
self.name = name
self.hours = float(hours)
self.qpoints = float(qpoints)
def get_name(self):
return self.name
def get_hours(self):
return self.hours
def get_qpoints(self):
return self.qpoints
def gpa(self):
return self.qpoints / self.hours
def make_student(info_str):
(name, hours, qpoints) = info_str.split('\t')
return student(name, hours, qpoints)
def main():
filename = input('Enter the name of the grade file: ')
infile = open(filename, 'r')
best = make_student(infile.readline())
for line in infile:
s = make_student(line)
if s.gpa() > best.gpa():
best = s
infile.close()
print('The best student is', best.get_name())
print('hours:', best.get_hours())
print('GPA:', best.gpa())
if __name__ == '__main__':
main() |
class Solution:
def firstUniqChar(self, s):
table = {}
for ele in s:
table[ele] = table.get(ele, 0) + 1
# for i in range(len(s)):
# if table[s[i]] == 1:
# return i
for ele in s:
if table[ele] == 1:
return s.index(ele)
return -1
if __name__ == '__main__':
s = 'leetcode' # output 0
#s = 'loveleetcode' # output 2
#s = 'llee' # output -1
print(Solution().firstUniqChar(s)) | class Solution:
def first_uniq_char(self, s):
table = {}
for ele in s:
table[ele] = table.get(ele, 0) + 1
for ele in s:
if table[ele] == 1:
return s.index(ele)
return -1
if __name__ == '__main__':
s = 'leetcode'
print(solution().firstUniqChar(s)) |
#program to compute and print sum of two given integers (more than or equal to zero).
# If given integers or the sum have more than 80 digits, print "overflow".
print("Input first integer:")
x = int(input())
print("Input second integer:")
y = int(input())
if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 ** 80:
print("Overflow!")
else:
print("Sum of the two integers: ",x + y) | print('Input first integer:')
x = int(input())
print('Input second integer:')
y = int(input())
if x >= 10 ** 80 or y >= 10 ** 80 or x + y >= 10 ** 80:
print('Overflow!')
else:
print('Sum of the two integers: ', x + y) |
{
"targets": [
{
"target_name": "allofw",
"include_dirs": [
"<!@(pkg-config liballofw --cflags-only-I | sed s/-I//g)",
"<!(node -e \"require('nan')\")"
],
"libraries": [
"<!@(pkg-config liballofw --libs)",
"<!@(pkg-config glew --libs)",
],
"cflags!": [ "-fno-exceptions", "-fno-rtti" ],
"cflags_cc!": [ "-fno-exceptions", "-fno-rtti" ],
"cflags_cc": [
"-std=c++11"
],
'conditions': [
[ 'OS=="mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS' : ['-std=c++11'],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES'
},
} ],
],
"sources": [
"src/allofw.cpp",
"src/node_graphics.cpp",
"src/node_sharedmemory.cpp",
"src/node_opengl.cpp",
"src/node_omnistereo.cpp",
"src/gl3binding/glbind.cpp"
]
}
]
}
| {'targets': [{'target_name': 'allofw', 'include_dirs': ['<!@(pkg-config liballofw --cflags-only-I | sed s/-I//g)', '<!(node -e "require(\'nan\')")'], 'libraries': ['<!@(pkg-config liballofw --libs)', '<!@(pkg-config glew --libs)'], 'cflags!': ['-fno-exceptions', '-fno-rtti'], 'cflags_cc!': ['-fno-exceptions', '-fno-rtti'], 'cflags_cc': ['-std=c++11'], 'conditions': [['OS=="mac"', {'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['-std=c++11'], 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', 'GCC_ENABLE_CPP_RTTI': 'YES'}}]], 'sources': ['src/allofw.cpp', 'src/node_graphics.cpp', 'src/node_sharedmemory.cpp', 'src/node_opengl.cpp', 'src/node_omnistereo.cpp', 'src/gl3binding/glbind.cpp']}]} |
TOKEN_PREALTA_CLIENTE = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsIm93bmVyX25hbWUiOiJSYXVsIEVucmlxdWUgVG9ycmVzIFJleWVzIiwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfY2xpZW50In0.R-nXh1nXvlBABfEdV1g81mdIzJqMFLvFV7FAP7PQRCM'
TOKEN_PREALTA_CLIENTE_CADUCO = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoibGF0aWVuZGl0YTJAZ2FtaWwuY29tIiwib3duZXJfbmFtZSI6IkFuZ2VsIEdhcmNpYSIsImV4cCI6MTU4NjU3ODg1MCwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfY2xpZW50In0.x66iQug11cjmkUHqmZq68gdbN3ffSVyD9MHagrspKRw'
TOKEN_PREALTA_USUARIO = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsIm5hbWUiOiJSYXVsIEVucmlxdWUgVG9ycmVzIFJleWVzIiwic2NoZW1hX25hbWUiOiJtaXRpZW5kaXRhIiwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfdXNlciJ9.gcagbNxnNxIkgZbP0mu-9MudiFb9b6cKvttPF4EHH5E'
TOKEN_USUARIO_LOGIN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsInNjaGVtYV9uYW1lIjoibWl0aWVuZGl0YSIsInR5cGUiOiJ1c2VyX2xvZ2luIn0.vCdeH0iP94XBucXYtWZvEQq7CuEr-P80SdfIjN673qI'
| token_prealta_cliente = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsIm93bmVyX25hbWUiOiJSYXVsIEVucmlxdWUgVG9ycmVzIFJleWVzIiwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfY2xpZW50In0.R-nXh1nXvlBABfEdV1g81mdIzJqMFLvFV7FAP7PQRCM'
token_prealta_cliente_caduco = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoibGF0aWVuZGl0YTJAZ2FtaWwuY29tIiwib3duZXJfbmFtZSI6IkFuZ2VsIEdhcmNpYSIsImV4cCI6MTU4NjU3ODg1MCwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfY2xpZW50In0.x66iQug11cjmkUHqmZq68gdbN3ffSVyD9MHagrspKRw'
token_prealta_usuario = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsIm5hbWUiOiJSYXVsIEVucmlxdWUgVG9ycmVzIFJleWVzIiwic2NoZW1hX25hbWUiOiJtaXRpZW5kaXRhIiwidHlwZSI6ImVtYWlsX2NvbmZpcm1hdGlvbl9uZXdfdXNlciJ9.gcagbNxnNxIkgZbP0mu-9MudiFb9b6cKvttPF4EHH5E'
token_usuario_login = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhdWx0ckBnbWFpbC5jb20iLCJleHAiOjQ3MzM1MTA0MDAsInNjaGVtYV9uYW1lIjoibWl0aWVuZGl0YSIsInR5cGUiOiJ1c2VyX2xvZ2luIn0.vCdeH0iP94XBucXYtWZvEQq7CuEr-P80SdfIjN673qI' |
SRM_TO_HEX = {
"0": "#FFFFFF",
"1": "#F3F993",
"2": "#F5F75C",
"3": "#F6F513",
"4": "#EAE615",
"5": "#E0D01B",
"6": "#D5BC26",
"7": "#CDAA37",
"8": "#C1963C",
"9": "#BE8C3A",
"10": "#BE823A",
"11": "#C17A37",
"12": "#BF7138",
"13": "#BC6733",
"14": "#B26033",
"15": "#A85839",
"16": "#985336",
"17": "#8D4C32",
"18": "#7C452D",
"19": "#6B3A1E",
"20": "#5D341A",
"21": "#4E2A0C",
"22": "#4A2727",
"23": "#361F1B",
"24": "#261716",
"25": "#231716",
"26": "#19100F",
"27": "#16100F",
"28": "#120D0C",
"29": "#100B0A",
"30": "#050B0A"
}
WATER_L_PER_GRAIN_KG = 2.5
MAIN_STYLES = {
"1": "LIGHT LAGER",
"2": "PILSNER",
"3": "EUROPEAN AMBER LAGER",
"4": "DARK LAGER",
"5": "BOCK",
"6": "LIGHT HYBRID BEER",
"7": "AMBER HYBRID BEER",
"8": "ENGLISH PALE ALE",
"9": "SCOTTISH AND IRISH ALE",
"10": "AMERICAN ALE",
"11": "ENGLISH BROWN ALE",
"12": "PORTER",
"13": "STOUT",
"14": "INDIA PALE ALE (IPA)",
"15": "GERMAN WHEAT AND RYE BEER",
"16": "BELGIAN AND FRENCH ALE",
"17": "SOUR ALE",
"18": "BELGIAN STRONG ALE",
"19": "STRONG ALE",
"20": "FRUIT BEER",
"21": "SPICE / HERB / VEGETABLE BEER",
"22": "SMOKE-FLAVORED AND WOOD-AGED BEER",
"23": "SPECIALTY BEER",
"24": "TRADITIONAL MEAD",
"25": "MELOMEL (FRUIT MEAD)",
"26": "OTHER MEAD",
"27": "STANDARD CIDER AND PERRY",
"28": "SPECIALTY CIDER AND PERRY"
}
| srm_to_hex = {'0': '#FFFFFF', '1': '#F3F993', '2': '#F5F75C', '3': '#F6F513', '4': '#EAE615', '5': '#E0D01B', '6': '#D5BC26', '7': '#CDAA37', '8': '#C1963C', '9': '#BE8C3A', '10': '#BE823A', '11': '#C17A37', '12': '#BF7138', '13': '#BC6733', '14': '#B26033', '15': '#A85839', '16': '#985336', '17': '#8D4C32', '18': '#7C452D', '19': '#6B3A1E', '20': '#5D341A', '21': '#4E2A0C', '22': '#4A2727', '23': '#361F1B', '24': '#261716', '25': '#231716', '26': '#19100F', '27': '#16100F', '28': '#120D0C', '29': '#100B0A', '30': '#050B0A'}
water_l_per_grain_kg = 2.5
main_styles = {'1': 'LIGHT LAGER', '2': 'PILSNER', '3': 'EUROPEAN AMBER LAGER', '4': 'DARK LAGER', '5': 'BOCK', '6': 'LIGHT HYBRID BEER', '7': 'AMBER HYBRID BEER', '8': 'ENGLISH PALE ALE', '9': 'SCOTTISH AND IRISH ALE', '10': 'AMERICAN ALE', '11': 'ENGLISH BROWN ALE', '12': 'PORTER', '13': 'STOUT', '14': 'INDIA PALE ALE (IPA)', '15': 'GERMAN WHEAT AND RYE BEER', '16': 'BELGIAN AND FRENCH ALE', '17': 'SOUR ALE', '18': 'BELGIAN STRONG ALE', '19': 'STRONG ALE', '20': 'FRUIT BEER', '21': 'SPICE / HERB / VEGETABLE BEER', '22': 'SMOKE-FLAVORED AND WOOD-AGED BEER', '23': 'SPECIALTY BEER', '24': 'TRADITIONAL MEAD', '25': 'MELOMEL (FRUIT MEAD)', '26': 'OTHER MEAD', '27': 'STANDARD CIDER AND PERRY', '28': 'SPECIALTY CIDER AND PERRY'} |
# ------ [ API ] ------
API = '/api'
# ---------- [ BLOCKCHAIN ] ----------
API_BLOCKCHAIN = f'{API}/blockchain'
API_BLOCKCHAIN_LENGTH = f'{API_BLOCKCHAIN}/length'
API_BLOCKCHAIN_BLOCKS = f'{API_BLOCKCHAIN}/blocks'
# ---------- [ BROADCASTS ] ----------
API_BROADCASTS = f'{API}/broadcasts'
API_BROADCASTS_NEW_BLOCK = f'{API_BROADCASTS}/new_block'
API_BROADCASTS_NEW_TRANSACTION = f'{API_BROADCASTS}/new_transaction'
# ---------- [ TRANSACTIONS ] ----------
API_TRANSACTIONS = f'{API}/transactions'
API_TRANSACTIONS_PENDING = f'{API_TRANSACTIONS}/pending'
API_TRANSACTIONS_UTXO = f'{API_TRANSACTIONS}/UTXO'
# ---------- [ NODES ] ----------
API_NODES = f'{API}/nodes'
API_NODES_LIST = f'{API_NODES}/list'
API_NODES_INFO = f'{API_NODES}/info'
API_NODES_REGISTER = f'{API_NODES}/register'
# ------ [ WEB ] ------
WEB_HOME = '/'
WEB_SELECTOR = '/selector'
WEB_CHAT = '/chat'
WEB_CHAT_WITH_ADDRESS = f'{WEB_CHAT}/<address>'
| api = '/api'
api_blockchain = f'{API}/blockchain'
api_blockchain_length = f'{API_BLOCKCHAIN}/length'
api_blockchain_blocks = f'{API_BLOCKCHAIN}/blocks'
api_broadcasts = f'{API}/broadcasts'
api_broadcasts_new_block = f'{API_BROADCASTS}/new_block'
api_broadcasts_new_transaction = f'{API_BROADCASTS}/new_transaction'
api_transactions = f'{API}/transactions'
api_transactions_pending = f'{API_TRANSACTIONS}/pending'
api_transactions_utxo = f'{API_TRANSACTIONS}/UTXO'
api_nodes = f'{API}/nodes'
api_nodes_list = f'{API_NODES}/list'
api_nodes_info = f'{API_NODES}/info'
api_nodes_register = f'{API_NODES}/register'
web_home = '/'
web_selector = '/selector'
web_chat = '/chat'
web_chat_with_address = f'{WEB_CHAT}/<address>' |
#tables or h5py
libname="h5py" #tables"
#libname="tables"
def setlib(name):
global libname
libname = name
| libname = 'h5py'
def setlib(name):
global libname
libname = name |
if __name__ == "__main__":
pages = [5, 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5]
faults = {3: 0, 4: 0}
for frames in faults:
memory = []
for page in pages:
out = None
if page not in memory:
if len(memory) == frames:
out = memory.pop(0)
memory.append(page)
faults[frames] += 1
print(f"In: {page} --> {memory} --> Out: {out}")
print(f"Marcos: {frames}, Fallas: {faults[frames]}\n")
if faults[4] > faults[3]:
print(f"La secuencia {pages} presenta anomalia de Belady")
| if __name__ == '__main__':
pages = [5, 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5]
faults = {3: 0, 4: 0}
for frames in faults:
memory = []
for page in pages:
out = None
if page not in memory:
if len(memory) == frames:
out = memory.pop(0)
memory.append(page)
faults[frames] += 1
print(f'In: {page} --> {memory} --> Out: {out}')
print(f'Marcos: {frames}, Fallas: {faults[frames]}\n')
if faults[4] > faults[3]:
print(f'La secuencia {pages} presenta anomalia de Belady') |
a={'a':'hello','b':'1','c':'jayalatha','d':[1,2]}
d={}
val=list(a.values())
val.sort(key=len)
print(val)
for i in val:
for j in a:
if(i==a[j]):
d.update({j:a[j]})
print(d)
| a = {'a': 'hello', 'b': '1', 'c': 'jayalatha', 'd': [1, 2]}
d = {}
val = list(a.values())
val.sort(key=len)
print(val)
for i in val:
for j in a:
if i == a[j]:
d.update({j: a[j]})
print(d) |
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library", "core_resx", "core_xunit_test")
core_resx(
name = "core_resource",
src = ":src/Moq/Properties/Resources.resx",
identifier = "Moq.Properties.Resources.resources",
)
core_library(
name = "Moq.dll",
srcs = glob(["src/Moq/**/*.cs"]),
defines = [
"NETCORE",
],
keyfile = ":Moq.snk",
resources = [":core_resource"],
visibility = ["//visibility:public"],
nowarn = ["CS3027"],
deps = [
"@//ifluentinterface:IFluentInterface.dll",
"@TypeNameFormatter//:TypeNameFormatter.dll",
"@castle.core//:Castle.Core.dll",
"@core_sdk_stdlib//:libraryset",
],
)
core_xunit_test(
name = "Moq.Tests.dll",
srcs = glob(
["tests/Moq.Tests/**/*.cs"],
exclude = ["**/FSharpCompatibilityFixture.cs"],
),
defines = [
"NETCORE",
],
keyfile = ":Moq.snk",
nowarn = ["CS1701"],
visibility = ["//visibility:public"],
deps = [
":Moq.dll",
"@xunit.assert//:lib",
"@xunit.extensibility.core//:lib",
"@xunit.extensibility.execution//:lib",
],
)
| load('@io_bazel_rules_dotnet//dotnet:defs.bzl', 'core_library', 'core_resx', 'core_xunit_test')
core_resx(name='core_resource', src=':src/Moq/Properties/Resources.resx', identifier='Moq.Properties.Resources.resources')
core_library(name='Moq.dll', srcs=glob(['src/Moq/**/*.cs']), defines=['NETCORE'], keyfile=':Moq.snk', resources=[':core_resource'], visibility=['//visibility:public'], nowarn=['CS3027'], deps=['@//ifluentinterface:IFluentInterface.dll', '@TypeNameFormatter//:TypeNameFormatter.dll', '@castle.core//:Castle.Core.dll', '@core_sdk_stdlib//:libraryset'])
core_xunit_test(name='Moq.Tests.dll', srcs=glob(['tests/Moq.Tests/**/*.cs'], exclude=['**/FSharpCompatibilityFixture.cs']), defines=['NETCORE'], keyfile=':Moq.snk', nowarn=['CS1701'], visibility=['//visibility:public'], deps=[':Moq.dll', '@xunit.assert//:lib', '@xunit.extensibility.core//:lib', '@xunit.extensibility.execution//:lib']) |
# Iterations: Definite Loops
'''
Use the 'for' word
there is a iteration variable like 'i' or 'friend'
'''
# for i in [5, 4, 3, 2, 1] :
# print(i)
# print('Blastoff!')
# friends = ['matheus', 'wataru', 'mogli']
# for friend in friends :
# print('happy new year:', friend)
# print('Done!')
| """
Use the 'for' word
there is a iteration variable like 'i' or 'friend'
""" |
class formstruct():
name = str()
while True:
name = input("\n.bot >> enter your first name:")
if not name.isalpha():
print(".bot >> your first name must have alphabets only!")
continue
else:
name = name.upper()
break
city = str()
while True:
city = input("\n.bot >> enter your city:")
if not city.isalpha():
print(".bot >> a city name can have alphabets only!")
continue
else:
city = city.upper()
break
state = str()
while True:
state = input(".bot >> which sate do your reside in?")
if not state.isalpha():
print(".bot >> a state name can have alphabets only!")
continue
else:
state = state.upper()
break
pincode = str()
while True:
pincode = input(".bot >> pincode of your area?")
if not pincode.isnumeric():
print(".bot >> a pincode has numeric characters only")
continue
if not len(pincode)==6:
print(".bot >> invalid pincode , please make sure your pincode is of 6 digits")
continue
else:
break
mobilenumber = str()
while True:
mobilenumber = input(".bot >> provide us the mobile number we can contact you with?")
if not mobilenumber.isnumeric():
print(".bot >> a mobile number has numeric characters only")
continue
if not len(mobilenumber) == 10:
print(".bot >> invalid mobile number , please make sure your mobile number is of 10 digits")
continue
else:
break
aadhaarnumber = str()
while True:
aadhaarnumber = input(".bot >> enter your aadhaar number:")
if not aadhaarnumber.isnumeric():
print(".bot >> an aadhaar number has numeric characters only")
continue
if not len(aadhaarnumber) == 12:
print(".bot >> invalid aadhaar number , please make sure your aadhaar number is of 12 digits")
continue
else:
break
def __init__(self,val):
print("In Class Method")
self.val = val
print("The Value is: ", val)
| class Formstruct:
name = str()
while True:
name = input('\n.bot >> enter your first name:')
if not name.isalpha():
print('.bot >> your first name must have alphabets only!')
continue
else:
name = name.upper()
break
city = str()
while True:
city = input('\n.bot >> enter your city:')
if not city.isalpha():
print('.bot >> a city name can have alphabets only!')
continue
else:
city = city.upper()
break
state = str()
while True:
state = input('.bot >> which sate do your reside in?')
if not state.isalpha():
print('.bot >> a state name can have alphabets only!')
continue
else:
state = state.upper()
break
pincode = str()
while True:
pincode = input('.bot >> pincode of your area?')
if not pincode.isnumeric():
print('.bot >> a pincode has numeric characters only')
continue
if not len(pincode) == 6:
print('.bot >> invalid pincode , please make sure your pincode is of 6 digits')
continue
else:
break
mobilenumber = str()
while True:
mobilenumber = input('.bot >> provide us the mobile number we can contact you with?')
if not mobilenumber.isnumeric():
print('.bot >> a mobile number has numeric characters only')
continue
if not len(mobilenumber) == 10:
print('.bot >> invalid mobile number , please make sure your mobile number is of 10 digits')
continue
else:
break
aadhaarnumber = str()
while True:
aadhaarnumber = input('.bot >> enter your aadhaar number:')
if not aadhaarnumber.isnumeric():
print('.bot >> an aadhaar number has numeric characters only')
continue
if not len(aadhaarnumber) == 12:
print('.bot >> invalid aadhaar number , please make sure your aadhaar number is of 12 digits')
continue
else:
break
def __init__(self, val):
print('In Class Method')
self.val = val
print('The Value is: ', val) |
#
# @lc app=leetcode id=719 lang=python3
#
# [719] Find K-th Smallest Pair Distance
#
# https://leetcode.com/problems/find-k-th-smallest-pair-distance/description/
#
# algorithms
# Hard (30.99%)
# Likes: 827
# Dislikes: 30
# Total Accepted: 29.9K
# Total Submissions: 96.4K
# Testcase Example: '[1,3,1]\n1'
#
# Given an integer array, return the k-th smallest distance among all the
# pairs. The distance of a pair (A, B) is defined as the absolute difference
# between A and B.
#
# Example 1:
#
# Input:
# nums = [1,3,1]
# k = 1
# Output: 0
# Explanation:
# Here are all the pairs:
# (1,3) -> 2
# (1,1) -> 0
# (3,1) -> 2
# Then the 1st smallest distance pair is (1,1), and its distance is 0.
#
#
#
# Note:
#
# 2 .
# 0 .
# 1 .
#
#
#
# @lc code=start
class Solution:
def smallestDistancePair(self, nums: List[int], k: int) -> int:
n = len(nums)
nums = sorted(nums)
low = 0
high = nums[n-1] - nums[0]
while low < high:
mid = int((low + high) / 2)
left, count = 0, 0
for right in range(n):
while nums[right] - nums[left] > mid:
left += 1
count += right - left
if count >= k:
high = mid
else:
low = mid + 1
return low
# @lc code=end
| class Solution:
def smallest_distance_pair(self, nums: List[int], k: int) -> int:
n = len(nums)
nums = sorted(nums)
low = 0
high = nums[n - 1] - nums[0]
while low < high:
mid = int((low + high) / 2)
(left, count) = (0, 0)
for right in range(n):
while nums[right] - nums[left] > mid:
left += 1
count += right - left
if count >= k:
high = mid
else:
low = mid + 1
return low |
def chess_knight(start, moves):
def knight_can_move(from_pos, to_pos):
return set(map(lambda x: abs(ord(x[0]) - ord(x[1])), zip(from_pos, to_pos))) == {1, 2}
def knight_moves(pos):
return {f + r for f in 'abcdefgh' for r in '12345678' if knight_can_move(pos, f + r)}
# till task become consistent, hardcode
res = knight_moves(start)
if moves == 2:
res.update(*map(knight_moves, res))
return sorted(res) | def chess_knight(start, moves):
def knight_can_move(from_pos, to_pos):
return set(map(lambda x: abs(ord(x[0]) - ord(x[1])), zip(from_pos, to_pos))) == {1, 2}
def knight_moves(pos):
return {f + r for f in 'abcdefgh' for r in '12345678' if knight_can_move(pos, f + r)}
res = knight_moves(start)
if moves == 2:
res.update(*map(knight_moves, res))
return sorted(res) |
n = str(input())
if("0000000" in n):
print("YES")
elif("1111111" in n):
print("YES")
else:
print("NO")
| n = str(input())
if '0000000' in n:
print('YES')
elif '1111111' in n:
print('YES')
else:
print('NO') |
list = ['a','b','c']
print(list)
| list = ['a', 'b', 'c']
print(list) |
#
# Copyright 2017 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Enable Spline tracking.
# For Spark 2.3+ we recommend the codeless approach to enable Spline - by setting spark.sql.queryExecutionListeners
# (See: examples/README.md)
# Otherwise execute the following method to enable Spline manually.
sc._jvm.za.co.absa.spline.harvester \
.SparkLineageInitializer.enableLineageTracking(spark._jsparkSession)
# Execute a Spark job as usual:
spark.read \
.option("header", "true") \
.option("inferschema", "true") \
.csv("data/input/batch/wikidata.csv") \
.write \
.mode('overwrite') \
.csv("data/output/batch/python-sample.csv")
| sc._jvm.za.co.absa.spline.harvester.SparkLineageInitializer.enableLineageTracking(spark._jsparkSession)
spark.read.option('header', 'true').option('inferschema', 'true').csv('data/input/batch/wikidata.csv').write.mode('overwrite').csv('data/output/batch/python-sample.csv') |
file = open("input.txt", "r")
num_valid = 0
for line in file:
# policy = part before colon
policy = line.strip().split(":")[0]
# get min/max number allowed for given letter
min_max = policy.split(" ")[0]
letter = policy.split(" ")[1]
min = int(min_max.split("-")[0])
max = int(min_max.split("-")[1])
# password = part after colon
password = line.strip().split(":")[1]
# check if password contains between min and max of given letter
if password.count(letter) >= min and password.count(letter) <= max:
num_valid += 1
print("Number of valid passwords = ", num_valid) | file = open('input.txt', 'r')
num_valid = 0
for line in file:
policy = line.strip().split(':')[0]
min_max = policy.split(' ')[0]
letter = policy.split(' ')[1]
min = int(min_max.split('-')[0])
max = int(min_max.split('-')[1])
password = line.strip().split(':')[1]
if password.count(letter) >= min and password.count(letter) <= max:
num_valid += 1
print('Number of valid passwords = ', num_valid) |
# Problem code
def search(nums, target):
return search_helper(nums, target, 0, len(nums) - 1)
def search_helper(nums, target, left, right):
if left > right:
return -1
mid = (left + right) // 2
# right part is good
if nums[mid] <= nums[right]:
# we fall for it
if target >= nums[mid] and target <= nums[right]:
return binary_search(nums, target, mid, right)
# we don't fall for it
else:
return search_helper(nums, target, left, mid - 1)
# left part is good
if nums[mid] >= nums[left]:
# we fall for it
if target >= nums[left] and target <= nums[mid]:
return binary_search(nums, target, left, mid)
#we don't fall for it
else:
return search_helper(nums, target, mid + 1, right)
return -1
def binary_search(nums, target, left, right):
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
return mid
elif target > nums[mid]:
left = mid + 1
else:
right = mid - 1
return -1
| def search(nums, target):
return search_helper(nums, target, 0, len(nums) - 1)
def search_helper(nums, target, left, right):
if left > right:
return -1
mid = (left + right) // 2
if nums[mid] <= nums[right]:
if target >= nums[mid] and target <= nums[right]:
return binary_search(nums, target, mid, right)
else:
return search_helper(nums, target, left, mid - 1)
if nums[mid] >= nums[left]:
if target >= nums[left] and target <= nums[mid]:
return binary_search(nums, target, left, mid)
else:
return search_helper(nums, target, mid + 1, right)
return -1
def binary_search(nums, target, left, right):
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
return mid
elif target > nums[mid]:
left = mid + 1
else:
right = mid - 1
return -1 |
#
# PySNMP MIB module CISCO-EMBEDDED-EVENT-MGR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-EMBEDDED-EVENT-MGR-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:13 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint")
ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
iso, Counter64, Unsigned32, Counter32, ModuleIdentity, Bits, IpAddress, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Integer32, TimeTicks, Gauge32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "Counter64", "Unsigned32", "Counter32", "ModuleIdentity", "Bits", "IpAddress", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Integer32", "TimeTicks", "Gauge32", "MibIdentifier")
TruthValue, TextualConvention, DisplayString, DateAndTime = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "DisplayString", "DateAndTime")
cEventMgrMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 134))
cEventMgrMIB.setRevisions(('2006-11-07 00:00', '2003-04-16 00:00',))
if mibBuilder.loadTexts: cEventMgrMIB.setLastUpdated('200611070000Z')
if mibBuilder.loadTexts: cEventMgrMIB.setOrganization('Cisco Systems, Inc.')
cEventMgrMIBNotif = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 0))
cEventMgrMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1))
cEventMgrConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3))
ceemEventMap = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1))
ceemHistory = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2))
ceemRegisteredPolicy = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3))
class NotifySource(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("server", 1), ("policy", 2))
ceemEventMapTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1), )
if mibBuilder.loadTexts: ceemEventMapTable.setStatus('current')
ceemEventMapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1), ).setIndexNames((0, "CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemEventIndex"))
if mibBuilder.loadTexts: ceemEventMapEntry.setStatus('current')
ceemEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: ceemEventIndex.setStatus('current')
ceemEventName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemEventName.setStatus('current')
ceemEventDescrText = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 3), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemEventDescrText.setStatus('current')
ceemHistoryMaxEventEntries = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 50)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ceemHistoryMaxEventEntries.setStatus('current')
ceemHistoryLastEventEntry = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryLastEventEntry.setStatus('current')
ceemHistoryEventTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3), )
if mibBuilder.loadTexts: ceemHistoryEventTable.setStatus('current')
ceemHistoryEventEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1), ).setIndexNames((0, "CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventIndex"))
if mibBuilder.loadTexts: ceemHistoryEventEntry.setStatus('current')
ceemHistoryEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)))
if mibBuilder.loadTexts: ceemHistoryEventIndex.setStatus('current')
ceemHistoryEventType1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType1.setStatus('current')
ceemHistoryEventType2 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType2.setStatus('current')
ceemHistoryEventType3 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType3.setStatus('current')
ceemHistoryEventType4 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType4.setStatus('current')
ceemHistoryPolicyPath = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 6), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryPolicyPath.setStatus('current')
ceemHistoryPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 7), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryPolicyName.setStatus('current')
ceemHistoryPolicyExitStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-2147483648, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryPolicyExitStatus.setStatus('current')
ceemHistoryPolicyIntData1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-2147483648, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryPolicyIntData1.setStatus('current')
ceemHistoryPolicyIntData2 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-2147483648, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryPolicyIntData2.setStatus('current')
ceemHistoryPolicyStrData = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 11), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryPolicyStrData.setStatus('current')
ceemHistoryNotifyType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 12), NotifySource()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryNotifyType.setStatus('current')
ceemHistoryEventType5 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType5.setStatus('current')
ceemHistoryEventType6 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType6.setStatus('current')
ceemHistoryEventType7 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType7.setStatus('current')
ceemHistoryEventType8 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 16), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemHistoryEventType8.setStatus('current')
ceemRegisteredPolicyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1), )
if mibBuilder.loadTexts: ceemRegisteredPolicyTable.setStatus('current')
ceemRegisteredPolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyIndex"))
if mibBuilder.loadTexts: ceemRegisteredPolicyEntry.setStatus('current')
ceemRegisteredPolicyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: ceemRegisteredPolicyIndex.setStatus('current')
ceemRegisteredPolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyName.setStatus('current')
ceemRegisteredPolicyEventType1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType1.setStatus('current')
ceemRegisteredPolicyEventType2 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType2.setStatus('current')
ceemRegisteredPolicyEventType3 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType3.setStatus('current')
ceemRegisteredPolicyEventType4 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType4.setStatus('current')
ceemRegisteredPolicyStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyStatus.setStatus('current')
ceemRegisteredPolicyType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("user", 1), ("system", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyType.setStatus('current')
ceemRegisteredPolicyNotifFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 9), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyNotifFlag.setStatus('current')
ceemRegisteredPolicyRegTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 10), DateAndTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyRegTime.setStatus('current')
ceemRegisteredPolicyEnabledTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 11), DateAndTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEnabledTime.setStatus('current')
ceemRegisteredPolicyRunTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 12), DateAndTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyRunTime.setStatus('current')
ceemRegisteredPolicyRunCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyRunCount.setStatus('current')
ceemRegisteredPolicyEventType5 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType5.setStatus('current')
ceemRegisteredPolicyEventType6 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType6.setStatus('current')
ceemRegisteredPolicyEventType7 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 16), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType7.setStatus('current')
ceemRegisteredPolicyEventType8 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 17), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ceemRegisteredPolicyEventType8.setStatus('current')
cEventMgrServerEvent = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 134, 0, 1)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyPath"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyExitStatus"))
if mibBuilder.loadTexts: cEventMgrServerEvent.setStatus('current')
cEventMgrPolicyEvent = NotificationType((1, 3, 6, 1, 4, 1, 9, 10, 134, 0, 2)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyPath"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyStrData"))
if mibBuilder.loadTexts: cEventMgrPolicyEvent.setStatus('current')
cEventMgrCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1))
cEventMgrGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2))
cEventMgrCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1, 1)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrDescrGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrNotificationsGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrRegisteredPolicyGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrHistoryGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrCompliance = cEventMgrCompliance.setStatus('deprecated')
cEventMgrComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1, 2)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrDescrGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrNotificationsGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrRegisteredPolicyGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrRegisteredPolicyGroupSup1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrHistoryGroup"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrHistoryGroupSup1"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrComplianceRev1 = cEventMgrComplianceRev1.setStatus('current')
cEventMgrDescrGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 1)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemEventName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemEventDescrText"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrDescrGroup = cEventMgrDescrGroup.setStatus('current')
cEventMgrHistoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 2)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryMaxEventEntries"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryLastEventEntry"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyPath"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyExitStatus"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyIntData2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryPolicyStrData"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryNotifyType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrHistoryGroup = cEventMgrHistoryGroup.setStatus('current')
cEventMgrNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 3)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrServerEvent"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "cEventMgrPolicyEvent"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrNotificationsGroup = cEventMgrNotificationsGroup.setStatus('current')
cEventMgrRegisteredPolicyGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 4)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyName"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType1"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType2"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType3"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType4"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyStatus"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyType"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyNotifFlag"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyRegTime"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEnabledTime"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyRunTime"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyRunCount"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrRegisteredPolicyGroup = cEventMgrRegisteredPolicyGroup.setStatus('current')
cEventMgrHistoryGroupSup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 5)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType5"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType6"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType7"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemHistoryEventType8"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrHistoryGroupSup1 = cEventMgrHistoryGroupSup1.setStatus('current')
cEventMgrRegisteredPolicyGroupSup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 6)).setObjects(("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType5"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType6"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType7"), ("CISCO-EMBEDDED-EVENT-MGR-MIB", "ceemRegisteredPolicyEventType8"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
cEventMgrRegisteredPolicyGroupSup1 = cEventMgrRegisteredPolicyGroupSup1.setStatus('current')
mibBuilder.exportSymbols("CISCO-EMBEDDED-EVENT-MGR-MIB", ceemEventDescrText=ceemEventDescrText, ceemHistoryEventType5=ceemHistoryEventType5, ceemRegisteredPolicyEventType4=ceemRegisteredPolicyEventType4, ceemEventName=ceemEventName, ceemHistoryPolicyIntData1=ceemHistoryPolicyIntData1, ceemRegisteredPolicyEntry=ceemRegisteredPolicyEntry, ceemHistoryPolicyExitStatus=ceemHistoryPolicyExitStatus, ceemRegisteredPolicyRunTime=ceemRegisteredPolicyRunTime, cEventMgrDescrGroup=cEventMgrDescrGroup, ceemHistory=ceemHistory, cEventMgrNotificationsGroup=cEventMgrNotificationsGroup, cEventMgrRegisteredPolicyGroup=cEventMgrRegisteredPolicyGroup, ceemRegisteredPolicyEventType3=ceemRegisteredPolicyEventType3, ceemRegisteredPolicyStatus=ceemRegisteredPolicyStatus, ceemEventIndex=ceemEventIndex, cEventMgrConformance=cEventMgrConformance, ceemRegisteredPolicyEventType6=ceemRegisteredPolicyEventType6, cEventMgrServerEvent=cEventMgrServerEvent, cEventMgrHistoryGroup=cEventMgrHistoryGroup, ceemHistoryPolicyStrData=ceemHistoryPolicyStrData, NotifySource=NotifySource, cEventMgrPolicyEvent=cEventMgrPolicyEvent, ceemRegisteredPolicyEventType8=ceemRegisteredPolicyEventType8, cEventMgrMIBNotif=cEventMgrMIBNotif, ceemHistoryEventType2=ceemHistoryEventType2, ceemEventMap=ceemEventMap, cEventMgrGroups=cEventMgrGroups, ceemHistoryEventType6=ceemHistoryEventType6, PYSNMP_MODULE_ID=cEventMgrMIB, ceemRegisteredPolicyRegTime=ceemRegisteredPolicyRegTime, cEventMgrRegisteredPolicyGroupSup1=cEventMgrRegisteredPolicyGroupSup1, cEventMgrMIB=cEventMgrMIB, ceemHistoryPolicyIntData2=ceemHistoryPolicyIntData2, ceemRegisteredPolicyEventType7=ceemRegisteredPolicyEventType7, ceemHistoryEventEntry=ceemHistoryEventEntry, ceemHistoryEventTable=ceemHistoryEventTable, cEventMgrMIBObjects=cEventMgrMIBObjects, ceemEventMapEntry=ceemEventMapEntry, ceemRegisteredPolicyName=ceemRegisteredPolicyName, ceemRegisteredPolicy=ceemRegisteredPolicy, ceemHistoryEventType3=ceemHistoryEventType3, ceemHistoryEventType8=ceemHistoryEventType8, ceemHistoryEventIndex=ceemHistoryEventIndex, cEventMgrCompliance=cEventMgrCompliance, ceemRegisteredPolicyNotifFlag=ceemRegisteredPolicyNotifFlag, ceemRegisteredPolicyRunCount=ceemRegisteredPolicyRunCount, ceemRegisteredPolicyEventType1=ceemRegisteredPolicyEventType1, ceemRegisteredPolicyIndex=ceemRegisteredPolicyIndex, ceemHistoryEventType1=ceemHistoryEventType1, ceemHistoryPolicyName=ceemHistoryPolicyName, ceemHistoryNotifyType=ceemHistoryNotifyType, ceemRegisteredPolicyEventType5=ceemRegisteredPolicyEventType5, ceemRegisteredPolicyType=ceemRegisteredPolicyType, ceemHistoryMaxEventEntries=ceemHistoryMaxEventEntries, ceemEventMapTable=ceemEventMapTable, ceemHistoryPolicyPath=ceemHistoryPolicyPath, cEventMgrHistoryGroupSup1=cEventMgrHistoryGroupSup1, ceemRegisteredPolicyEventType2=ceemRegisteredPolicyEventType2, ceemHistoryEventType4=ceemHistoryEventType4, ceemRegisteredPolicyTable=ceemRegisteredPolicyTable, ceemHistoryLastEventEntry=ceemHistoryLastEventEntry, cEventMgrCompliances=cEventMgrCompliances, ceemRegisteredPolicyEnabledTime=ceemRegisteredPolicyEnabledTime, ceemHistoryEventType7=ceemHistoryEventType7, cEventMgrComplianceRev1=cEventMgrComplianceRev1)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint')
(cisco_experiment,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoExperiment')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(iso, counter64, unsigned32, counter32, module_identity, bits, ip_address, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, integer32, time_ticks, gauge32, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'Counter64', 'Unsigned32', 'Counter32', 'ModuleIdentity', 'Bits', 'IpAddress', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Integer32', 'TimeTicks', 'Gauge32', 'MibIdentifier')
(truth_value, textual_convention, display_string, date_and_time) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'DisplayString', 'DateAndTime')
c_event_mgr_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 10, 134))
cEventMgrMIB.setRevisions(('2006-11-07 00:00', '2003-04-16 00:00'))
if mibBuilder.loadTexts:
cEventMgrMIB.setLastUpdated('200611070000Z')
if mibBuilder.loadTexts:
cEventMgrMIB.setOrganization('Cisco Systems, Inc.')
c_event_mgr_mib_notif = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 0))
c_event_mgr_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1))
c_event_mgr_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3))
ceem_event_map = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1))
ceem_history = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2))
ceem_registered_policy = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3))
class Notifysource(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('server', 1), ('policy', 2))
ceem_event_map_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1))
if mibBuilder.loadTexts:
ceemEventMapTable.setStatus('current')
ceem_event_map_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1)).setIndexNames((0, 'CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemEventIndex'))
if mibBuilder.loadTexts:
ceemEventMapEntry.setStatus('current')
ceem_event_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
ceemEventIndex.setStatus('current')
ceem_event_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 2), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(1, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemEventName.setStatus('current')
ceem_event_descr_text = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 1, 1, 1, 3), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemEventDescrText.setStatus('current')
ceem_history_max_event_entries = mib_scalar((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 50)).clone(10)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ceemHistoryMaxEventEntries.setStatus('current')
ceem_history_last_event_entry = mib_scalar((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryLastEventEntry.setStatus('current')
ceem_history_event_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3))
if mibBuilder.loadTexts:
ceemHistoryEventTable.setStatus('current')
ceem_history_event_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1)).setIndexNames((0, 'CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventIndex'))
if mibBuilder.loadTexts:
ceemHistoryEventEntry.setStatus('current')
ceem_history_event_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)))
if mibBuilder.loadTexts:
ceemHistoryEventIndex.setStatus('current')
ceem_history_event_type1 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType1.setStatus('current')
ceem_history_event_type2 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType2.setStatus('current')
ceem_history_event_type3 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType3.setStatus('current')
ceem_history_event_type4 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 5), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType4.setStatus('current')
ceem_history_policy_path = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 6), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryPolicyPath.setStatus('current')
ceem_history_policy_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 7), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryPolicyName.setStatus('current')
ceem_history_policy_exit_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(-2147483648, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryPolicyExitStatus.setStatus('current')
ceem_history_policy_int_data1 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(-2147483648, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryPolicyIntData1.setStatus('current')
ceem_history_policy_int_data2 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(-2147483648, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryPolicyIntData2.setStatus('current')
ceem_history_policy_str_data = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 11), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryPolicyStrData.setStatus('current')
ceem_history_notify_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 12), notify_source()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryNotifyType.setStatus('current')
ceem_history_event_type5 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 13), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType5.setStatus('current')
ceem_history_event_type6 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType6.setStatus('current')
ceem_history_event_type7 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 15), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType7.setStatus('current')
ceem_history_event_type8 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 2, 3, 1, 16), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemHistoryEventType8.setStatus('current')
ceem_registered_policy_table = mib_table((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1))
if mibBuilder.loadTexts:
ceemRegisteredPolicyTable.setStatus('current')
ceem_registered_policy_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1)).setIndexNames((0, 'CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyIndex'))
if mibBuilder.loadTexts:
ceemRegisteredPolicyEntry.setStatus('current')
ceem_registered_policy_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
ceemRegisteredPolicyIndex.setStatus('current')
ceem_registered_policy_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 2), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyName.setStatus('current')
ceem_registered_policy_event_type1 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType1.setStatus('current')
ceem_registered_policy_event_type2 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType2.setStatus('current')
ceem_registered_policy_event_type3 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 5), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType3.setStatus('current')
ceem_registered_policy_event_type4 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 6), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType4.setStatus('current')
ceem_registered_policy_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyStatus.setStatus('current')
ceem_registered_policy_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('user', 1), ('system', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyType.setStatus('current')
ceem_registered_policy_notif_flag = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 9), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyNotifFlag.setStatus('current')
ceem_registered_policy_reg_time = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 10), date_and_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyRegTime.setStatus('current')
ceem_registered_policy_enabled_time = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 11), date_and_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEnabledTime.setStatus('current')
ceem_registered_policy_run_time = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 12), date_and_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyRunTime.setStatus('current')
ceem_registered_policy_run_count = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyRunCount.setStatus('current')
ceem_registered_policy_event_type5 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType5.setStatus('current')
ceem_registered_policy_event_type6 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 15), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType6.setStatus('current')
ceem_registered_policy_event_type7 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 16), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType7.setStatus('current')
ceem_registered_policy_event_type8 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 10, 134, 1, 3, 1, 1, 17), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ceemRegisteredPolicyEventType8.setStatus('current')
c_event_mgr_server_event = notification_type((1, 3, 6, 1, 4, 1, 9, 10, 134, 0, 1)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType2'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType3'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType4'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyPath'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyName'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyExitStatus'))
if mibBuilder.loadTexts:
cEventMgrServerEvent.setStatus('current')
c_event_mgr_policy_event = notification_type((1, 3, 6, 1, 4, 1, 9, 10, 134, 0, 2)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType2'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType3'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType4'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyPath'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyName'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyIntData1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyIntData2'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyStrData'))
if mibBuilder.loadTexts:
cEventMgrPolicyEvent.setStatus('current')
c_event_mgr_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1))
c_event_mgr_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2))
c_event_mgr_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1, 1)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrDescrGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrNotificationsGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrRegisteredPolicyGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrHistoryGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_compliance = cEventMgrCompliance.setStatus('deprecated')
c_event_mgr_compliance_rev1 = module_compliance((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 1, 2)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrDescrGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrNotificationsGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrRegisteredPolicyGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrRegisteredPolicyGroupSup1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrHistoryGroup'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrHistoryGroupSup1'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_compliance_rev1 = cEventMgrComplianceRev1.setStatus('current')
c_event_mgr_descr_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 1)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemEventName'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemEventDescrText'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_descr_group = cEventMgrDescrGroup.setStatus('current')
c_event_mgr_history_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 2)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryMaxEventEntries'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryLastEventEntry'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType2'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType3'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType4'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyPath'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyName'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyExitStatus'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyIntData1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyIntData2'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryPolicyStrData'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryNotifyType'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_history_group = cEventMgrHistoryGroup.setStatus('current')
c_event_mgr_notifications_group = notification_group((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 3)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrServerEvent'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'cEventMgrPolicyEvent'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_notifications_group = cEventMgrNotificationsGroup.setStatus('current')
c_event_mgr_registered_policy_group = object_group((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 4)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyName'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType1'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType2'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType3'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType4'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyStatus'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyType'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyNotifFlag'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyRegTime'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEnabledTime'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyRunTime'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyRunCount'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_registered_policy_group = cEventMgrRegisteredPolicyGroup.setStatus('current')
c_event_mgr_history_group_sup1 = object_group((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 5)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType5'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType6'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType7'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemHistoryEventType8'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_history_group_sup1 = cEventMgrHistoryGroupSup1.setStatus('current')
c_event_mgr_registered_policy_group_sup1 = object_group((1, 3, 6, 1, 4, 1, 9, 10, 134, 3, 2, 6)).setObjects(('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType5'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType6'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType7'), ('CISCO-EMBEDDED-EVENT-MGR-MIB', 'ceemRegisteredPolicyEventType8'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
c_event_mgr_registered_policy_group_sup1 = cEventMgrRegisteredPolicyGroupSup1.setStatus('current')
mibBuilder.exportSymbols('CISCO-EMBEDDED-EVENT-MGR-MIB', ceemEventDescrText=ceemEventDescrText, ceemHistoryEventType5=ceemHistoryEventType5, ceemRegisteredPolicyEventType4=ceemRegisteredPolicyEventType4, ceemEventName=ceemEventName, ceemHistoryPolicyIntData1=ceemHistoryPolicyIntData1, ceemRegisteredPolicyEntry=ceemRegisteredPolicyEntry, ceemHistoryPolicyExitStatus=ceemHistoryPolicyExitStatus, ceemRegisteredPolicyRunTime=ceemRegisteredPolicyRunTime, cEventMgrDescrGroup=cEventMgrDescrGroup, ceemHistory=ceemHistory, cEventMgrNotificationsGroup=cEventMgrNotificationsGroup, cEventMgrRegisteredPolicyGroup=cEventMgrRegisteredPolicyGroup, ceemRegisteredPolicyEventType3=ceemRegisteredPolicyEventType3, ceemRegisteredPolicyStatus=ceemRegisteredPolicyStatus, ceemEventIndex=ceemEventIndex, cEventMgrConformance=cEventMgrConformance, ceemRegisteredPolicyEventType6=ceemRegisteredPolicyEventType6, cEventMgrServerEvent=cEventMgrServerEvent, cEventMgrHistoryGroup=cEventMgrHistoryGroup, ceemHistoryPolicyStrData=ceemHistoryPolicyStrData, NotifySource=NotifySource, cEventMgrPolicyEvent=cEventMgrPolicyEvent, ceemRegisteredPolicyEventType8=ceemRegisteredPolicyEventType8, cEventMgrMIBNotif=cEventMgrMIBNotif, ceemHistoryEventType2=ceemHistoryEventType2, ceemEventMap=ceemEventMap, cEventMgrGroups=cEventMgrGroups, ceemHistoryEventType6=ceemHistoryEventType6, PYSNMP_MODULE_ID=cEventMgrMIB, ceemRegisteredPolicyRegTime=ceemRegisteredPolicyRegTime, cEventMgrRegisteredPolicyGroupSup1=cEventMgrRegisteredPolicyGroupSup1, cEventMgrMIB=cEventMgrMIB, ceemHistoryPolicyIntData2=ceemHistoryPolicyIntData2, ceemRegisteredPolicyEventType7=ceemRegisteredPolicyEventType7, ceemHistoryEventEntry=ceemHistoryEventEntry, ceemHistoryEventTable=ceemHistoryEventTable, cEventMgrMIBObjects=cEventMgrMIBObjects, ceemEventMapEntry=ceemEventMapEntry, ceemRegisteredPolicyName=ceemRegisteredPolicyName, ceemRegisteredPolicy=ceemRegisteredPolicy, ceemHistoryEventType3=ceemHistoryEventType3, ceemHistoryEventType8=ceemHistoryEventType8, ceemHistoryEventIndex=ceemHistoryEventIndex, cEventMgrCompliance=cEventMgrCompliance, ceemRegisteredPolicyNotifFlag=ceemRegisteredPolicyNotifFlag, ceemRegisteredPolicyRunCount=ceemRegisteredPolicyRunCount, ceemRegisteredPolicyEventType1=ceemRegisteredPolicyEventType1, ceemRegisteredPolicyIndex=ceemRegisteredPolicyIndex, ceemHistoryEventType1=ceemHistoryEventType1, ceemHistoryPolicyName=ceemHistoryPolicyName, ceemHistoryNotifyType=ceemHistoryNotifyType, ceemRegisteredPolicyEventType5=ceemRegisteredPolicyEventType5, ceemRegisteredPolicyType=ceemRegisteredPolicyType, ceemHistoryMaxEventEntries=ceemHistoryMaxEventEntries, ceemEventMapTable=ceemEventMapTable, ceemHistoryPolicyPath=ceemHistoryPolicyPath, cEventMgrHistoryGroupSup1=cEventMgrHistoryGroupSup1, ceemRegisteredPolicyEventType2=ceemRegisteredPolicyEventType2, ceemHistoryEventType4=ceemHistoryEventType4, ceemRegisteredPolicyTable=ceemRegisteredPolicyTable, ceemHistoryLastEventEntry=ceemHistoryLastEventEntry, cEventMgrCompliances=cEventMgrCompliances, ceemRegisteredPolicyEnabledTime=ceemRegisteredPolicyEnabledTime, ceemHistoryEventType7=ceemHistoryEventType7, cEventMgrComplianceRev1=cEventMgrComplianceRev1) |
screen_resX=1920
screen_resY=1080
img_id=['1.JPG_HIGH_',
'2.JPG_HIGH_',
'7.JPG_HIGH_',
'12.JPG_HIGH_',
'13.JPG_HIGH_',
'15.JPG_HIGH_',
'19.JPG_HIGH_',
'25.JPG_HIGH_',
'27.JPG_HIGH_',
'29.JPG_HIGH_',
'41.JPG_HIGH_',
'42.JPG_HIGH_',
'43.JPG_HIGH_',
'44.JPG_HIGH_',
'48.JPG_HIGH_',
'49.JPG_HIGH_',
'51.JPG_HIGH_',
'54.JPG_HIGH_',
'55.JPG_HIGH_',
'59.JPG_HIGH_',
'61.JPG_HIGH_',
'64.JPG_HIGH_',
'67.JPG_HIGH_',
'74.JPG_HIGH_',
'76.JPG_HIGH_',
'77.JPG_HIGH_',
'84.JPG_HIGH_',
'87.JPG_HIGH_',
'88.JPG_HIGH_',
'91.JPG_HIGH_',
'94.JPG_HIGH_',
'95.JPG_HIGH_',
'100.JPG_HIGH_',
'101.JPG_HIGH_',
'112.JPG_HIGH_',
'113.JPG_HIGH_',
'3.JPG_LOW_',
'6.JPG_LOW_',
'10.JPG_LOW_',
'17.JPG_LOW_',
'21.JPG_LOW_',
'23.JPG_LOW_',
'28.JPG_LOW_',
'33.JPG_LOW_',
'35.JPG_LOW_',
'38.JPG_LOW_',
'39.JPG_LOW_',
'40.JPG_LOW_',
'46.JPG_LOW_',
'50.JPG_LOW_',
'52.JPG_LOW_',
'58.JPG_LOW_',
'60.JPG_LOW_',
'62.JPG_LOW_',
'63.JPG_LOW_',
'70.JPG_LOW_',
'72.JPG_LOW_',
'73.JPG_LOW_',
'75.JPG_LOW_',
'78.JPG_LOW_',
'80.JPG_LOW_',
'82.JPG_LOW_',
'89.JPG_LOW_',
'90.JPG_LOW_',
'92.JPG_LOW_',
'97.JPG_LOW_',
'99.JPG_LOW_',
'102.JPG_LOW_',
'103.JPG_LOW_',
'104.JPG_LOW_',
'105.JPG_LOW_',
'108.JPG_LOW_']
sub_id=[1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
25,
26,
28,
29,
30,
31]
BEHAVIORAL_FILE='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Behavioral Data/Memory/Preprocessed/Memory_all_dirty.csv'
DATA_PATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Raw'
TRIALS_PATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Eye Tracking Data/'\
'1. Associative Learning/Learn_trials'
EVENTS_PATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Eye Tracking Data/'\
'1. Associative Learning/Learn_events'
COLLATION_PATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Eye Tracking Data/'\
'1. Associative Learning/Learn_collation'
DIR_ROUTE_PATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Eye Tracking Data/'\
'1. Associative Learning/Learn_direct_route'
IMG_PATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Tasks/Task2/Scenes'
RAW_SCANPATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
'cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/'\
'Learn_ visualizations/Raw_Scanpaths'
#IVT_SCANPATH='C:/Users/presi/Desktop/PhD/Memory guided attention in '\
#'cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/'\
# 'Learn_visualizations/IVT_Scanpaths'
IVT_SCANPATH='E:/UCY PhD/Memory guided attention'\
' in cluttered scenes v.3/1. Associative Learning/'\
'Learn_visualizations/IVT_Scanpaths'
| screen_res_x = 1920
screen_res_y = 1080
img_id = ['1.JPG_HIGH_', '2.JPG_HIGH_', '7.JPG_HIGH_', '12.JPG_HIGH_', '13.JPG_HIGH_', '15.JPG_HIGH_', '19.JPG_HIGH_', '25.JPG_HIGH_', '27.JPG_HIGH_', '29.JPG_HIGH_', '41.JPG_HIGH_', '42.JPG_HIGH_', '43.JPG_HIGH_', '44.JPG_HIGH_', '48.JPG_HIGH_', '49.JPG_HIGH_', '51.JPG_HIGH_', '54.JPG_HIGH_', '55.JPG_HIGH_', '59.JPG_HIGH_', '61.JPG_HIGH_', '64.JPG_HIGH_', '67.JPG_HIGH_', '74.JPG_HIGH_', '76.JPG_HIGH_', '77.JPG_HIGH_', '84.JPG_HIGH_', '87.JPG_HIGH_', '88.JPG_HIGH_', '91.JPG_HIGH_', '94.JPG_HIGH_', '95.JPG_HIGH_', '100.JPG_HIGH_', '101.JPG_HIGH_', '112.JPG_HIGH_', '113.JPG_HIGH_', '3.JPG_LOW_', '6.JPG_LOW_', '10.JPG_LOW_', '17.JPG_LOW_', '21.JPG_LOW_', '23.JPG_LOW_', '28.JPG_LOW_', '33.JPG_LOW_', '35.JPG_LOW_', '38.JPG_LOW_', '39.JPG_LOW_', '40.JPG_LOW_', '46.JPG_LOW_', '50.JPG_LOW_', '52.JPG_LOW_', '58.JPG_LOW_', '60.JPG_LOW_', '62.JPG_LOW_', '63.JPG_LOW_', '70.JPG_LOW_', '72.JPG_LOW_', '73.JPG_LOW_', '75.JPG_LOW_', '78.JPG_LOW_', '80.JPG_LOW_', '82.JPG_LOW_', '89.JPG_LOW_', '90.JPG_LOW_', '92.JPG_LOW_', '97.JPG_LOW_', '99.JPG_LOW_', '102.JPG_LOW_', '103.JPG_LOW_', '104.JPG_LOW_', '105.JPG_LOW_', '108.JPG_LOW_']
sub_id = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 28, 29, 30, 31]
behavioral_file = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Behavioral Data/Memory/Preprocessed/Memory_all_dirty.csv'
data_path = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Raw'
trials_path = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Learn_trials'
events_path = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Learn_events'
collation_path = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Learn_collation'
dir_route_path = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Learn_direct_route'
img_path = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Tasks/Task2/Scenes'
raw_scanpath = 'C:/Users/presi/Desktop/PhD/Memory guided attention in cluttered scenes v.3/Eye Tracking Data/1. Associative Learning/Learn_ visualizations/Raw_Scanpaths'
ivt_scanpath = 'E:/UCY PhD/Memory guided attention in cluttered scenes v.3/1. Associative Learning/Learn_visualizations/IVT_Scanpaths' |
def create_matrix(rows_count):
matrix = []
for _ in range(rows_count):
matrix.append([int(x) for x in input().split(', ')])
return matrix
def get_square_sum(row, col, matrix):
square_sum = 0
for r in range(row, row + 2):
for c in range(col, col + 2):
square_sum += matrix[r][c]
return square_sum
def print_square(matrix, row, col):
for r in range(row, row + 2):
for c in range(col, col + 2):
print(matrix[r][c], end=' ')
print()
rows_count, cols_count = [int(x) for x in input().split(', ')]
matrix = create_matrix(rows_count)
best_pos = 0, 0
best_sum = get_square_sum(0, 0, matrix)
for r in range(rows_count - 1):
for c in range(cols_count - 1):
current_pos = r, c
current_sum = get_square_sum(r, c, matrix)
if current_sum > best_sum:
best_pos = current_pos
best_sum = current_sum
print_square(matrix, best_pos[0], best_pos[1])
print(best_sum)
| def create_matrix(rows_count):
matrix = []
for _ in range(rows_count):
matrix.append([int(x) for x in input().split(', ')])
return matrix
def get_square_sum(row, col, matrix):
square_sum = 0
for r in range(row, row + 2):
for c in range(col, col + 2):
square_sum += matrix[r][c]
return square_sum
def print_square(matrix, row, col):
for r in range(row, row + 2):
for c in range(col, col + 2):
print(matrix[r][c], end=' ')
print()
(rows_count, cols_count) = [int(x) for x in input().split(', ')]
matrix = create_matrix(rows_count)
best_pos = (0, 0)
best_sum = get_square_sum(0, 0, matrix)
for r in range(rows_count - 1):
for c in range(cols_count - 1):
current_pos = (r, c)
current_sum = get_square_sum(r, c, matrix)
if current_sum > best_sum:
best_pos = current_pos
best_sum = current_sum
print_square(matrix, best_pos[0], best_pos[1])
print(best_sum) |
#!/usr/bin/env python3
# Diodes
"1N4148"
"1N5817G"
"BAT43" # Zener
"1N457"
# bc junction of many transistors can also be used as dioded, i.e. 2SC1815, 2SA9012, etc. with very small leakage current (~1pA at -4V).
| """1N4148"""
'1N5817G'
'BAT43'
'1N457' |
clientId = 'CLIENT_ID'
clientSecret = 'CLIENT_SECRET'
geniusToken = 'GENIUS_TOKEN'
bitrate = '320' | client_id = 'CLIENT_ID'
client_secret = 'CLIENT_SECRET'
genius_token = 'GENIUS_TOKEN'
bitrate = '320' |
'''
Created on Jun 15, 2016
@author: eze
'''
class NotFoundException(Exception):
'''
classdocs
'''
def __init__(self, element):
'''
Constructor
'''
self.elementNotFound = element
def __str__(self, *args, **kwargs):
return "NotFoundException(%s)" % self.elementNotFound
| """
Created on Jun 15, 2016
@author: eze
"""
class Notfoundexception(Exception):
"""
classdocs
"""
def __init__(self, element):
"""
Constructor
"""
self.elementNotFound = element
def __str__(self, *args, **kwargs):
return 'NotFoundException(%s)' % self.elementNotFound |
class Contact:
def __init__(self, first_name = None, last_name = None, mobile_phone = None):
self.first_name = first_name
self.last_name = last_name
self.mobile_phone = mobile_phone | class Contact:
def __init__(self, first_name=None, last_name=None, mobile_phone=None):
self.first_name = first_name
self.last_name = last_name
self.mobile_phone = mobile_phone |
# Optional solution with tidy data representation (providing x and y)
monthly_victim_counts_melt = monthly_victim_counts.reset_index().melt(
id_vars="datetime", var_name="victim_type", value_name="count"
)
sns.relplot(
data=monthly_victim_counts_melt,
x="datetime",
y="count",
hue="victim_type",
kind="line",
palette="colorblind",
height=3, aspect=4,
) | monthly_victim_counts_melt = monthly_victim_counts.reset_index().melt(id_vars='datetime', var_name='victim_type', value_name='count')
sns.relplot(data=monthly_victim_counts_melt, x='datetime', y='count', hue='victim_type', kind='line', palette='colorblind', height=3, aspect=4) |
def findSmallest(arr):
smallest = arr[0]
smallest_index = 0
for i in range(1, len(arr)):
if arr[i] < smallest:
smallest = arr[i]
smallest_index = i
return smallest_index
def selection_sort(arr):
newarr = []
for i in range(len(arr)):
smallest_index = findSmallest(arr)
newarr.append(arr.pop(smallest_index))
return newarr
test_arr = [5, 3, 6, 1, 0, 0, 2, 10]
print(selection_sort(test_arr))
| def find_smallest(arr):
smallest = arr[0]
smallest_index = 0
for i in range(1, len(arr)):
if arr[i] < smallest:
smallest = arr[i]
smallest_index = i
return smallest_index
def selection_sort(arr):
newarr = []
for i in range(len(arr)):
smallest_index = find_smallest(arr)
newarr.append(arr.pop(smallest_index))
return newarr
test_arr = [5, 3, 6, 1, 0, 0, 2, 10]
print(selection_sort(test_arr)) |
{
'Hello World':'Salve Mondo',
'Welcome to web2py':'Ciao da wek2py',
}
| {'Hello World': 'Salve Mondo', 'Welcome to web2py': 'Ciao da wek2py'} |
domain='https://monbot.hopto.org'
apm_id='admin'
apm_pw='New1234!'
apm_url='https://monbot.hopto.org:3000'
db_host='monbot.hopto.org'
db_user='izyrtm'
db_pw='new1234!'
db_datadbase='monbot' | domain = 'https://monbot.hopto.org'
apm_id = 'admin'
apm_pw = 'New1234!'
apm_url = 'https://monbot.hopto.org:3000'
db_host = 'monbot.hopto.org'
db_user = 'izyrtm'
db_pw = 'new1234!'
db_datadbase = 'monbot' |
def load():
with open("input") as f:
yield next(f).strip()
next(f)
for x in f:
yield x.strip().split(" -> ")
def pair_insertion():
data = list(load())
polymer, rules = list(data[0]), dict(data[1:])
for _ in range(10):
new_polymer = [polymer[0]]
for i in range(len(polymer) - 1):
pair = polymer[i] + polymer[i + 1]
new_polymer.extend((rules[pair], polymer[i + 1]))
polymer = new_polymer
histogram = {}
for e in polymer:
histogram[e] = histogram.get(e, 0) + 1
return max(histogram.values()) - min(histogram.values())
print(pair_insertion())
| def load():
with open('input') as f:
yield next(f).strip()
next(f)
for x in f:
yield x.strip().split(' -> ')
def pair_insertion():
data = list(load())
(polymer, rules) = (list(data[0]), dict(data[1:]))
for _ in range(10):
new_polymer = [polymer[0]]
for i in range(len(polymer) - 1):
pair = polymer[i] + polymer[i + 1]
new_polymer.extend((rules[pair], polymer[i + 1]))
polymer = new_polymer
histogram = {}
for e in polymer:
histogram[e] = histogram.get(e, 0) + 1
return max(histogram.values()) - min(histogram.values())
print(pair_insertion()) |
class Colors:
END = '\033[0m'
ERROR = '\033[91m[ERROR] '
INFO = '\033[94m[INFO] '
WARN = '\033[93m[WARN] '
def get_color(msg_type):
if msg_type == 'ERROR':
return Colors.ERROR
elif msg_type == 'INFO':
return Colors.INFO
elif msg_type == 'WARN':
return Colors.WARN
else:
return Colors.END
def get_msg(msg, msg_type=None):
color = get_color(msg_type)
msg = ''.join([color, msg, Colors.END])
return msg
def print_msg(msg, msg_type=None):
msg = get_msg(msg, msg_type)
print(msg)
| class Colors:
end = '\x1b[0m'
error = '\x1b[91m[ERROR] '
info = '\x1b[94m[INFO] '
warn = '\x1b[93m[WARN] '
def get_color(msg_type):
if msg_type == 'ERROR':
return Colors.ERROR
elif msg_type == 'INFO':
return Colors.INFO
elif msg_type == 'WARN':
return Colors.WARN
else:
return Colors.END
def get_msg(msg, msg_type=None):
color = get_color(msg_type)
msg = ''.join([color, msg, Colors.END])
return msg
def print_msg(msg, msg_type=None):
msg = get_msg(msg, msg_type)
print(msg) |
def naive_string_matching(t, w, n, m):
for i in range(n - m + 1):
j = 0
while j < m and t[i + j + 1] == w[j + 1]:
j = j + 1
if j == m:
return True
return False | def naive_string_matching(t, w, n, m):
for i in range(n - m + 1):
j = 0
while j < m and t[i + j + 1] == w[j + 1]:
j = j + 1
if j == m:
return True
return False |
# Leo colorizer control file for kivy mode.
# This file is in the public domain.
# Properties for kivy mode.
properties = {
"ignoreWhitespace": "false",
"lineComment": "#",
}
# Attributes dict for kivy_main ruleset.
kivy_main_attributes_dict = {
"default": "null",
"digit_re": "",
"escape": "",
"highlight_digits": "true",
"ignore_case": "true",
"no_word_sep": "",
}
# Dictionary of attributes dictionaries for kivy mode.
attributesDictDict = {
"kivy_main": kivy_main_attributes_dict,
}
# Keywords dict for kivy_main ruleset.
kivy_main_keywords_dict = {
"app": "keyword2",
"args": "keyword2",
"canvas": "keyword1",
"id": "keyword1",
"root": "keyword2",
"self": "keyword2",
"size": "keyword1",
"text": "keyword1",
"x": "keyword1",
"y": "keyword1",
}
# Dictionary of keywords dictionaries for kivy mode.
keywordsDictDict = {
"kivy_main": kivy_main_keywords_dict,
}
# Rules for kivy_main ruleset.
def kivy_rule0(colorer, s, i):
return colorer.match_eol_span(s, i, kind="comment1", seq="#",
at_line_start=False, at_whitespace_end=False, at_word_start=False,
delegate="", exclude_match=False)
def kivy_rule1(colorer, s, i):
return colorer.match_span(s, i, kind="literal1", begin="\"", end="\"",
at_line_start=False, at_whitespace_end=False, at_word_start=False,
delegate="kivy::literal_one",exclude_match=False,
no_escape=False, no_line_break=False, no_word_break=False)
def kivy_rule2(colorer, s, i):
return colorer.match_keywords(s, i)
# Rules dict for kivy_main ruleset.
rulesDict1 = {
"\"": [kivy_rule1,],
"#": [kivy_rule0,],
"0": [kivy_rule2,],
"1": [kivy_rule2,],
"2": [kivy_rule2,],
"3": [kivy_rule2,],
"4": [kivy_rule2,],
"5": [kivy_rule2,],
"6": [kivy_rule2,],
"7": [kivy_rule2,],
"8": [kivy_rule2,],
"9": [kivy_rule2,],
"@": [kivy_rule2,],
"A": [kivy_rule2,],
"B": [kivy_rule2,],
"C": [kivy_rule2,],
"D": [kivy_rule2,],
"E": [kivy_rule2,],
"F": [kivy_rule2,],
"G": [kivy_rule2,],
"H": [kivy_rule2,],
"I": [kivy_rule2,],
"J": [kivy_rule2,],
"K": [kivy_rule2,],
"L": [kivy_rule2,],
"M": [kivy_rule2,],
"N": [kivy_rule2,],
"O": [kivy_rule2,],
"P": [kivy_rule2,],
"Q": [kivy_rule2,],
"R": [kivy_rule2,],
"S": [kivy_rule2,],
"T": [kivy_rule2,],
"U": [kivy_rule2,],
"V": [kivy_rule2,],
"W": [kivy_rule2,],
"X": [kivy_rule2,],
"Y": [kivy_rule2,],
"Z": [kivy_rule2,],
"a": [kivy_rule2,],
"b": [kivy_rule2,],
"c": [kivy_rule2,],
"d": [kivy_rule2,],
"e": [kivy_rule2,],
"f": [kivy_rule2,],
"g": [kivy_rule2,],
"h": [kivy_rule2,],
"i": [kivy_rule2,],
"j": [kivy_rule2,],
"k": [kivy_rule2,],
"l": [kivy_rule2,],
"m": [kivy_rule2,],
"n": [kivy_rule2,],
"o": [kivy_rule2,],
"p": [kivy_rule2,],
"q": [kivy_rule2,],
"r": [kivy_rule2,],
"s": [kivy_rule2,],
"t": [kivy_rule2,],
"u": [kivy_rule2,],
"v": [kivy_rule2,],
"w": [kivy_rule2,],
"x": [kivy_rule2,],
"y": [kivy_rule2,],
"z": [kivy_rule2,],
}
# x.rulesDictDict for kivy mode.
rulesDictDict = {
"kivy_main": rulesDict1,
}
# Import dict for kivy mode.
importDict = {}
| properties = {'ignoreWhitespace': 'false', 'lineComment': '#'}
kivy_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '', 'highlight_digits': 'true', 'ignore_case': 'true', 'no_word_sep': ''}
attributes_dict_dict = {'kivy_main': kivy_main_attributes_dict}
kivy_main_keywords_dict = {'app': 'keyword2', 'args': 'keyword2', 'canvas': 'keyword1', 'id': 'keyword1', 'root': 'keyword2', 'self': 'keyword2', 'size': 'keyword1', 'text': 'keyword1', 'x': 'keyword1', 'y': 'keyword1'}
keywords_dict_dict = {'kivy_main': kivy_main_keywords_dict}
def kivy_rule0(colorer, s, i):
return colorer.match_eol_span(s, i, kind='comment1', seq='#', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='', exclude_match=False)
def kivy_rule1(colorer, s, i):
return colorer.match_span(s, i, kind='literal1', begin='"', end='"', at_line_start=False, at_whitespace_end=False, at_word_start=False, delegate='kivy::literal_one', exclude_match=False, no_escape=False, no_line_break=False, no_word_break=False)
def kivy_rule2(colorer, s, i):
return colorer.match_keywords(s, i)
rules_dict1 = {'"': [kivy_rule1], '#': [kivy_rule0], '0': [kivy_rule2], '1': [kivy_rule2], '2': [kivy_rule2], '3': [kivy_rule2], '4': [kivy_rule2], '5': [kivy_rule2], '6': [kivy_rule2], '7': [kivy_rule2], '8': [kivy_rule2], '9': [kivy_rule2], '@': [kivy_rule2], 'A': [kivy_rule2], 'B': [kivy_rule2], 'C': [kivy_rule2], 'D': [kivy_rule2], 'E': [kivy_rule2], 'F': [kivy_rule2], 'G': [kivy_rule2], 'H': [kivy_rule2], 'I': [kivy_rule2], 'J': [kivy_rule2], 'K': [kivy_rule2], 'L': [kivy_rule2], 'M': [kivy_rule2], 'N': [kivy_rule2], 'O': [kivy_rule2], 'P': [kivy_rule2], 'Q': [kivy_rule2], 'R': [kivy_rule2], 'S': [kivy_rule2], 'T': [kivy_rule2], 'U': [kivy_rule2], 'V': [kivy_rule2], 'W': [kivy_rule2], 'X': [kivy_rule2], 'Y': [kivy_rule2], 'Z': [kivy_rule2], 'a': [kivy_rule2], 'b': [kivy_rule2], 'c': [kivy_rule2], 'd': [kivy_rule2], 'e': [kivy_rule2], 'f': [kivy_rule2], 'g': [kivy_rule2], 'h': [kivy_rule2], 'i': [kivy_rule2], 'j': [kivy_rule2], 'k': [kivy_rule2], 'l': [kivy_rule2], 'm': [kivy_rule2], 'n': [kivy_rule2], 'o': [kivy_rule2], 'p': [kivy_rule2], 'q': [kivy_rule2], 'r': [kivy_rule2], 's': [kivy_rule2], 't': [kivy_rule2], 'u': [kivy_rule2], 'v': [kivy_rule2], 'w': [kivy_rule2], 'x': [kivy_rule2], 'y': [kivy_rule2], 'z': [kivy_rule2]}
rules_dict_dict = {'kivy_main': rulesDict1}
import_dict = {} |
# -*- coding: utf-8 -*-
def case_insensitive_string(string, available, default=None):
if string is None:
return default
_available = [each.lower() for each in available]
try:
index = _available.index(f"{string}".lower())
except ValueError:
raise ValueError(f"unrecognised input ('{string}') - must be in {available}")
else:
return available[index]
def listing_type(entry):
if entry is None:
return ""
available_listing_types = ["Sale", "Rent", "Share", "Sold", "NewHomes"]
_alt = [each.lower() for each in available_listing_types]
try:
index = _alt.index(str(entry).lower())
except ValueError:
raise ValueError("listing type must be one of: {}".format(
", ".join(available_listing_types)))
else:
return available_listing_types[index]
def property_types(entries):
if entries is None:
return [""]
available_property_types = [
"AcreageSemiRural", "ApartmentUnitFlat", "BlockOfUnits", "CarSpace",
"DevelopmentSite", "Duplex", "Farm", "NewHomeDesigns", "House",
"NewHouseLand", "NewLand", "NewApartments", "Penthouse",
"RetirementVillage", "Rural", "SemiDetached", "SpecialistFarm",
"Studio", "Terrace", "Townhouse", "VacantLand", "Villa"]
_lower_pt = [each.lower() for each in available_property_types]
if isinstance(entries, (str, unicode)):
entries = [entries]
validated_entries = []
for entry in entries:
try:
index = _lower_pt.index(str(entry).lower())
except IndexError:
raise ValueError(
"Unrecognised property type '{}'. Available types: {}".format(
entry, ", ".join(available_property_types)))
validated_entries.append(available_property_types[index])
return validated_entries
def listing_attributes(entries):
if entries is None:
return [""]
available_listing_attributes = ["HasPhotos", "HasPrice", "NotUpForAuction",
"NotUnderContract", "MarkedAsNew"]
_lower_la = [each.lower() for each in available_listing_attributes]
if isinstance(entries, (str, unicode)):
entries = [entries]
validated_entries = []
for entry in entries:
try:
index = _lower_la.index(str(entry).lower())
except IndexError:
raise ValueError(
"Unrecognised listing attribute {}. Available attributes: {}"\
.format(entry, ", ".join(available_listing_attributes)))
validated_entries.append(available_listing_attributes[index])
return validated_entries
def integer_range(entry, default_value=-1):
entry = entry or default_value
# Allow a single value to be given.
if isinstance(entry, int) or entry == default_value:
return (entry, entry)
if len(entry) > 2:
raise ValueError("only lower and upper range can be given, not a list")
return tuple(sorted(entry))
def city(string, **kwargs):
cities = ("Sydney", "Melbourne", "Brisbane", "Adelaide", "Canberra")
return case_insensitive_string(string, cities, **kwargs)
def advertiser_ids(entries):
if entries is None:
return [""]
if isinstance(entries, (str, unicode)):
entries = [entries]
return entries
| def case_insensitive_string(string, available, default=None):
if string is None:
return default
_available = [each.lower() for each in available]
try:
index = _available.index(f'{string}'.lower())
except ValueError:
raise value_error(f"unrecognised input ('{string}') - must be in {available}")
else:
return available[index]
def listing_type(entry):
if entry is None:
return ''
available_listing_types = ['Sale', 'Rent', 'Share', 'Sold', 'NewHomes']
_alt = [each.lower() for each in available_listing_types]
try:
index = _alt.index(str(entry).lower())
except ValueError:
raise value_error('listing type must be one of: {}'.format(', '.join(available_listing_types)))
else:
return available_listing_types[index]
def property_types(entries):
if entries is None:
return ['']
available_property_types = ['AcreageSemiRural', 'ApartmentUnitFlat', 'BlockOfUnits', 'CarSpace', 'DevelopmentSite', 'Duplex', 'Farm', 'NewHomeDesigns', 'House', 'NewHouseLand', 'NewLand', 'NewApartments', 'Penthouse', 'RetirementVillage', 'Rural', 'SemiDetached', 'SpecialistFarm', 'Studio', 'Terrace', 'Townhouse', 'VacantLand', 'Villa']
_lower_pt = [each.lower() for each in available_property_types]
if isinstance(entries, (str, unicode)):
entries = [entries]
validated_entries = []
for entry in entries:
try:
index = _lower_pt.index(str(entry).lower())
except IndexError:
raise value_error("Unrecognised property type '{}'. Available types: {}".format(entry, ', '.join(available_property_types)))
validated_entries.append(available_property_types[index])
return validated_entries
def listing_attributes(entries):
if entries is None:
return ['']
available_listing_attributes = ['HasPhotos', 'HasPrice', 'NotUpForAuction', 'NotUnderContract', 'MarkedAsNew']
_lower_la = [each.lower() for each in available_listing_attributes]
if isinstance(entries, (str, unicode)):
entries = [entries]
validated_entries = []
for entry in entries:
try:
index = _lower_la.index(str(entry).lower())
except IndexError:
raise value_error('Unrecognised listing attribute {}. Available attributes: {}'.format(entry, ', '.join(available_listing_attributes)))
validated_entries.append(available_listing_attributes[index])
return validated_entries
def integer_range(entry, default_value=-1):
entry = entry or default_value
if isinstance(entry, int) or entry == default_value:
return (entry, entry)
if len(entry) > 2:
raise value_error('only lower and upper range can be given, not a list')
return tuple(sorted(entry))
def city(string, **kwargs):
cities = ('Sydney', 'Melbourne', 'Brisbane', 'Adelaide', 'Canberra')
return case_insensitive_string(string, cities, **kwargs)
def advertiser_ids(entries):
if entries is None:
return ['']
if isinstance(entries, (str, unicode)):
entries = [entries]
return entries |
# What should be printing the next snippet of code?
intNum = 10
negativeNum = -5
testString = "Hello "
testList = [1, 2, 3]
print(intNum * 5)
print(intNum - negativeNum)
print(testString + 'World')
print(testString * 2)
print(testString[-1])
print(testString[1:])
print(testList + testList)
# The sum of each three first numbers of each list should be resulted in the last element of each list
matrix = [
[1, 1, 1, 3],
[2, 2, 2, 7],
[3, 3, 3, 9],
[4, 4, 4, 13]
]
matrix[1][-1] = sum(matrix[1][:-1])
matrix[-1][-1] = sum(matrix[-1][:-1])
print(matrix)
# Reverse string str[::-1]
testString = "eoD hnoJ,01"
testString = testString[::-1]
print(testString)
n = 0
while n < 10:
if (n % 2) == 0:
print(n, 'even number')
else:
print(n, 'odd number')
n = n + 1
| int_num = 10
negative_num = -5
test_string = 'Hello '
test_list = [1, 2, 3]
print(intNum * 5)
print(intNum - negativeNum)
print(testString + 'World')
print(testString * 2)
print(testString[-1])
print(testString[1:])
print(testList + testList)
matrix = [[1, 1, 1, 3], [2, 2, 2, 7], [3, 3, 3, 9], [4, 4, 4, 13]]
matrix[1][-1] = sum(matrix[1][:-1])
matrix[-1][-1] = sum(matrix[-1][:-1])
print(matrix)
test_string = 'eoD hnoJ,01'
test_string = testString[::-1]
print(testString)
n = 0
while n < 10:
if n % 2 == 0:
print(n, 'even number')
else:
print(n, 'odd number')
n = n + 1 |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version = '1.9.0'
version = '1.9.0'
full_version = '1.9.0'
git_revision = '07601a64cdfeb1c0247bde1294ad6380413cab66'
release = True
if not release:
version = full_version
| short_version = '1.9.0'
version = '1.9.0'
full_version = '1.9.0'
git_revision = '07601a64cdfeb1c0247bde1294ad6380413cab66'
release = True
if not release:
version = full_version |
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
if not s :
return ""
s = list(s)
st = []
for i,n in enumerate(s):
if n == "(":
st.append(i)
elif n == ")" :
if st :
st.pop()
else :
s[i] = ""
while st:
s[st.pop()] = ""
return "".join(s)
| class Solution:
def min_remove_to_make_valid(self, s: str) -> str:
if not s:
return ''
s = list(s)
st = []
for (i, n) in enumerate(s):
if n == '(':
st.append(i)
elif n == ')':
if st:
st.pop()
else:
s[i] = ''
while st:
s[st.pop()] = ''
return ''.join(s) |
class PoolArgs:
def __init__(self, bankerBufCap, bankerMaxBufNumber, signerBufCap, signerBufMaxNumber, broadcasterBufCap, broadcasterMaxNumber, stakingBufCap, stakingMaxNumber, distributionBufCap, distributionMaxNumber, errorBufCap, errorMaxNumber):
self.BankerBufCap = bankerBufCap
self.BankerMaxBufNumber = bankerMaxBufNumber
self.SignerBufCap = signerBufCap
self.SignerBufMaxNumber = signerBufMaxNumber
self.BroadcasterBufCap = broadcasterBufCap
self.BroadcasterMaxNumber = broadcasterMaxNumber
self.StakingBufCap = stakingBufCap
self.StakingMaxNumber = stakingMaxNumber
self.DistributionBufCap = distributionBufCap
self.DistributionMaxNumber = distributionMaxNumber
self.ErrorBufCap = errorBufCap
self.ErrorMaxNumber = errorMaxNumber
def Check(self):
if self.BankerBufCap == 0:
return PoolArgsError('zero banker buffer capacity')
if self.BankerMaxBufNumber == 0:
return PoolArgsError('zero banker max buffer number')
if self.SignerBufCap == 0:
return PoolArgsError('zero signer buffer capacity')
if self.SignerBufMaxNumber == 0:
return PoolArgsError('zero signer max buffer number')
if self.BroadcasterBufCap == 0:
return PoolArgsError('zero broadcaster buffer capacity')
if self.BroadcasterMaxNumber == 0:
return PoolArgsError('zero broadcaster max buffer number')
if self.StakingBufCap == 0:
return PoolArgsError('zero staking buffer capacity')
if self.StakingMaxNumber == 0:
return PoolArgsError('zero staking max buffer number')
if self.DistributionBufCap == 0:
return PoolArgsError('zero distribution buffer capacity')
if self.DistributionMaxNumber == 0:
return PoolArgsError('zero distribution max buffer number')
if self.ErrorBufCap == 0:
return PoolArgsError('zero error buffer capacity')
if self.ErrorMaxNumber == 0:
return PoolArgsError('zero error max buffer number')
return None
class PoolArgsError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class ModuleArgs:
def __init__(self, bankers, signers, broadcasters, stakings, distributors):
self.Bankers = bankers
self.Signers = signers
self.Broadcasters = broadcasters
self.Stakings = stakings
self.Distributors = distributors
def Check(self):
if len(self.Bankers) == 0:
return ModuleArgsError('empty banker list')
if len(self.Signers) == 0:
return ModuleArgsError('empty signer list')
if len(self.Broadcasters) == 0:
return ModuleArgsError('empty broadcaster list')
if len(self.Stakings) == 0:
return ModuleArgsError('empty stakinger list')
if len(self.Distributors) == 0:
return ModuleArgsError('empty distributor list')
return None
class ModuleArgsError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SendCoinArgs:
def __init__(self, srcAccount, dstAccount, coins, fees, gas, gasAdjust):
self.srcAccount = srcAccount
self.dstAccount = dstAccount
self.coins = coins
self.fees = fees
self.gas = gas
self.gasAdjust = gasAdjust
def Check(self):
if self.srcAccount is None or self.srcAccount.getAddress() == '':
return SendCoinArgsError('srcAccount is invalid')
if self.dstAccount is None or self.dstAccount.getAddress() == '':
return SendCoinArgsError('dstAccount is invalid')
if self.coins is None or len(self.coins) == 0:
return SendCoinArgsError('empty coins')
if self.fees is None or len(self.fees) == 0:
return SendCoinArgsError('empty fess')
if self.gas is None:
return SendCoinArgsError('empty gas')
if self.gasAdjust is None:
return SendCoinArgsError('empty gasAdjust')
return None
class SendCoinArgsError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SendSignArgs:
def __init__(self, srcAccount, sendedJsonFilePath, node):
self.srcAccount = srcAccount
self.sendedJsonFilePath = sendedJsonFilePath
self.node = node
def Check(self):
if self.srcAccount is None or self.srcAccount.getAddress() == '':
return SendSignArgsError('srcAccount is invalid')
if self.sendedJsonFilePath is None:
return SendSignArgsError('empty sendedJsonFilePath')
if self.node is None:
return SendSignArgsError('empty node')
return None
class SendSignArgsError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class SendBroadcastArgs:
def __init__(self, srcAccount, body, mode='sync'):
self.srcAccount = srcAccount
self.body = body
self.mode = mode
def Check(self):
if self.body is None:
return SendBroadcastArgsError('empty broadcast body')
if self.srcAccount is None:
return SendBroadcastArgsError('unknown tx src account')
return None
class SendBroadcastArgsError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class DelegateArgs():
def __init__(self, delegator, validator, coin, fees, gas, gasAdjust):
self.delegator = delegator
self.validator = validator
self.coin = coin
self.fees = fees
self.gas = gas
self.gasAdjust = gasAdjust
def Check(self):
if self.delegator is None or self.delegator.getAddress() == '':
return DelegateArgsError('delegator is invalid')
if self.validator is None:
return DelegateArgsError('validator is invalid')
if self.coin is None:
return DelegateArgsError('empty coins')
if self.fees is None or len(self.fees) == 0:
return DelegateArgsError('empty fess')
if self.gas is None:
return DelegateArgsError('empty gas')
if self.gasAdjust is None:
return DelegateArgsError('empty gasAdjust')
return None
class StakingArgs():
def __init__(self, _type, data):
self._type = _type
self.data = data
def getType(self):
return self._type
def getData(self):
return self.data
class WithdrawDelegatorOneRewardArgs():
def __init__(self, delegator, validator, fees, gas, gasAdjust):
self.delegator = delegator
self.validator = validator
self.fees = fees
self.gas = gas
self.gasAdjust = gasAdjust
def Check(self):
if self.delegator is None or self.delegator.getAddress() == '':
return DelegateArgsError('delegator is invalid')
if self.validator is None:
return DelegateArgsError('validator is invalid')
if self.fees is None or len(self.fees) == 0:
return DelegateArgsError('empty fess')
if self.gas is None:
return DelegateArgsError('empty gas')
if self.gasAdjust is None:
return DelegateArgsError('empty gasAdjust')
return None
class DistributionArgs():
def __init__(self, _type, data):
self._type = _type
self.data = data
def getType(self):
return self._type
def getData(self):
return self.data
class DelegateArgsError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
| class Poolargs:
def __init__(self, bankerBufCap, bankerMaxBufNumber, signerBufCap, signerBufMaxNumber, broadcasterBufCap, broadcasterMaxNumber, stakingBufCap, stakingMaxNumber, distributionBufCap, distributionMaxNumber, errorBufCap, errorMaxNumber):
self.BankerBufCap = bankerBufCap
self.BankerMaxBufNumber = bankerMaxBufNumber
self.SignerBufCap = signerBufCap
self.SignerBufMaxNumber = signerBufMaxNumber
self.BroadcasterBufCap = broadcasterBufCap
self.BroadcasterMaxNumber = broadcasterMaxNumber
self.StakingBufCap = stakingBufCap
self.StakingMaxNumber = stakingMaxNumber
self.DistributionBufCap = distributionBufCap
self.DistributionMaxNumber = distributionMaxNumber
self.ErrorBufCap = errorBufCap
self.ErrorMaxNumber = errorMaxNumber
def check(self):
if self.BankerBufCap == 0:
return pool_args_error('zero banker buffer capacity')
if self.BankerMaxBufNumber == 0:
return pool_args_error('zero banker max buffer number')
if self.SignerBufCap == 0:
return pool_args_error('zero signer buffer capacity')
if self.SignerBufMaxNumber == 0:
return pool_args_error('zero signer max buffer number')
if self.BroadcasterBufCap == 0:
return pool_args_error('zero broadcaster buffer capacity')
if self.BroadcasterMaxNumber == 0:
return pool_args_error('zero broadcaster max buffer number')
if self.StakingBufCap == 0:
return pool_args_error('zero staking buffer capacity')
if self.StakingMaxNumber == 0:
return pool_args_error('zero staking max buffer number')
if self.DistributionBufCap == 0:
return pool_args_error('zero distribution buffer capacity')
if self.DistributionMaxNumber == 0:
return pool_args_error('zero distribution max buffer number')
if self.ErrorBufCap == 0:
return pool_args_error('zero error buffer capacity')
if self.ErrorMaxNumber == 0:
return pool_args_error('zero error max buffer number')
return None
class Poolargserror(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class Moduleargs:
def __init__(self, bankers, signers, broadcasters, stakings, distributors):
self.Bankers = bankers
self.Signers = signers
self.Broadcasters = broadcasters
self.Stakings = stakings
self.Distributors = distributors
def check(self):
if len(self.Bankers) == 0:
return module_args_error('empty banker list')
if len(self.Signers) == 0:
return module_args_error('empty signer list')
if len(self.Broadcasters) == 0:
return module_args_error('empty broadcaster list')
if len(self.Stakings) == 0:
return module_args_error('empty stakinger list')
if len(self.Distributors) == 0:
return module_args_error('empty distributor list')
return None
class Moduleargserror(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class Sendcoinargs:
def __init__(self, srcAccount, dstAccount, coins, fees, gas, gasAdjust):
self.srcAccount = srcAccount
self.dstAccount = dstAccount
self.coins = coins
self.fees = fees
self.gas = gas
self.gasAdjust = gasAdjust
def check(self):
if self.srcAccount is None or self.srcAccount.getAddress() == '':
return send_coin_args_error('srcAccount is invalid')
if self.dstAccount is None or self.dstAccount.getAddress() == '':
return send_coin_args_error('dstAccount is invalid')
if self.coins is None or len(self.coins) == 0:
return send_coin_args_error('empty coins')
if self.fees is None or len(self.fees) == 0:
return send_coin_args_error('empty fess')
if self.gas is None:
return send_coin_args_error('empty gas')
if self.gasAdjust is None:
return send_coin_args_error('empty gasAdjust')
return None
class Sendcoinargserror(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class Sendsignargs:
def __init__(self, srcAccount, sendedJsonFilePath, node):
self.srcAccount = srcAccount
self.sendedJsonFilePath = sendedJsonFilePath
self.node = node
def check(self):
if self.srcAccount is None or self.srcAccount.getAddress() == '':
return send_sign_args_error('srcAccount is invalid')
if self.sendedJsonFilePath is None:
return send_sign_args_error('empty sendedJsonFilePath')
if self.node is None:
return send_sign_args_error('empty node')
return None
class Sendsignargserror(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class Sendbroadcastargs:
def __init__(self, srcAccount, body, mode='sync'):
self.srcAccount = srcAccount
self.body = body
self.mode = mode
def check(self):
if self.body is None:
return send_broadcast_args_error('empty broadcast body')
if self.srcAccount is None:
return send_broadcast_args_error('unknown tx src account')
return None
class Sendbroadcastargserror(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
class Delegateargs:
def __init__(self, delegator, validator, coin, fees, gas, gasAdjust):
self.delegator = delegator
self.validator = validator
self.coin = coin
self.fees = fees
self.gas = gas
self.gasAdjust = gasAdjust
def check(self):
if self.delegator is None or self.delegator.getAddress() == '':
return delegate_args_error('delegator is invalid')
if self.validator is None:
return delegate_args_error('validator is invalid')
if self.coin is None:
return delegate_args_error('empty coins')
if self.fees is None or len(self.fees) == 0:
return delegate_args_error('empty fess')
if self.gas is None:
return delegate_args_error('empty gas')
if self.gasAdjust is None:
return delegate_args_error('empty gasAdjust')
return None
class Stakingargs:
def __init__(self, _type, data):
self._type = _type
self.data = data
def get_type(self):
return self._type
def get_data(self):
return self.data
class Withdrawdelegatoronerewardargs:
def __init__(self, delegator, validator, fees, gas, gasAdjust):
self.delegator = delegator
self.validator = validator
self.fees = fees
self.gas = gas
self.gasAdjust = gasAdjust
def check(self):
if self.delegator is None or self.delegator.getAddress() == '':
return delegate_args_error('delegator is invalid')
if self.validator is None:
return delegate_args_error('validator is invalid')
if self.fees is None or len(self.fees) == 0:
return delegate_args_error('empty fess')
if self.gas is None:
return delegate_args_error('empty gas')
if self.gasAdjust is None:
return delegate_args_error('empty gasAdjust')
return None
class Distributionargs:
def __init__(self, _type, data):
self._type = _type
self.data = data
def get_type(self):
return self._type
def get_data(self):
return self.data
class Delegateargserror(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg |
# Signal processing
SAMPLE_RATE = 16000
PREEMPHASIS_ALPHA = 0.97
FRAME_LEN = 0.025
FRAME_STEP = 0.01
NUM_FFT = 512
BUCKET_STEP = 1
MAX_SEC = 10
# Model
WEIGHTS_FILE = "data/model/weights.h5"
COST_METRIC = "cosine" # euclidean or cosine
INPUT_SHAPE=(NUM_FFT,None,1)
# IO
ENROLL_LIST_FILE = "cfg/enroll_list.csv"
TEST_LIST_FILE = "cfg/test_list.csv"
RESULT_FILE = "res/results.csv"
| sample_rate = 16000
preemphasis_alpha = 0.97
frame_len = 0.025
frame_step = 0.01
num_fft = 512
bucket_step = 1
max_sec = 10
weights_file = 'data/model/weights.h5'
cost_metric = 'cosine'
input_shape = (NUM_FFT, None, 1)
enroll_list_file = 'cfg/enroll_list.csv'
test_list_file = 'cfg/test_list.csv'
result_file = 'res/results.csv' |
class Mac_Address_Information:
par_id = ''
case_id = ''
evd_id = ''
mac_address = ''
description = ''
backup_flag = ''
source_location = []
def MACADDRESS(reg_system):
mac_address_list = []
mac_address_count = 0
reg_key = reg_system.find_key(r"ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}")
for reg_subkey in reg_key.subkeys():
try:
for reg_subkey_value in reg_subkey.values():
if reg_subkey_value.name() == 'DeviceInstanceID':
if 'FFFF' in reg_subkey_value.data():
mac_address_information = Mac_Address_Information()
mac_address_list.append(mac_address_information)
mac_address_list[mac_address_count].source_location = []
mac_address_list[mac_address_count].source_location.append('SYSTEM-ControlSet001/Control/Class/{4d36e972-e325-11ce-bfc1-08002be10318}')
mac_address_list[mac_address_count].mac_address = reg_subkey_value.data().split('\\')[-1][0:6] + reg_subkey_value.data().split('\\')[-1][10:16]
mac_address_list[mac_address_count].description = reg_subkey.value(name='DriverDesc').data()
mac_address_count = mac_address_count + 1
except:
print('-----MAC Address Error')
return mac_address_list | class Mac_Address_Information:
par_id = ''
case_id = ''
evd_id = ''
mac_address = ''
description = ''
backup_flag = ''
source_location = []
def macaddress(reg_system):
mac_address_list = []
mac_address_count = 0
reg_key = reg_system.find_key('ControlSet001\\Control\\Class\\{4d36e972-e325-11ce-bfc1-08002be10318}')
for reg_subkey in reg_key.subkeys():
try:
for reg_subkey_value in reg_subkey.values():
if reg_subkey_value.name() == 'DeviceInstanceID':
if 'FFFF' in reg_subkey_value.data():
mac_address_information = mac__address__information()
mac_address_list.append(mac_address_information)
mac_address_list[mac_address_count].source_location = []
mac_address_list[mac_address_count].source_location.append('SYSTEM-ControlSet001/Control/Class/{4d36e972-e325-11ce-bfc1-08002be10318}')
mac_address_list[mac_address_count].mac_address = reg_subkey_value.data().split('\\')[-1][0:6] + reg_subkey_value.data().split('\\')[-1][10:16]
mac_address_list[mac_address_count].description = reg_subkey.value(name='DriverDesc').data()
mac_address_count = mac_address_count + 1
except:
print('-----MAC Address Error')
return mac_address_list |
# ***************************************************************************************
# ***************************************************************************************
#
# Name : processcore.py
# Author : Paul Robson ([email protected])
# Date : 22nd December 2018
# Purpose : Convert vocabulary.asm to assemblable file by adding marker labels.
#
# ***************************************************************************************
# ***************************************************************************************
#
# Copy vocabulary.asm to __words.asm
#
hOut = open("__words.asm","w")
for l in [x.rstrip() for x in open("vocabulary.asm").readlines()]:
hOut.write(l+"\n")
#
# If ;; found insert a label which is generated using ASCII so all chars can be used
#
if l[:2] == ";;":
name = "_".join([str(ord(x)) for x in l[2:].strip()])
hOut.write("core_{0}:\n".format(name))
hOut.close() | h_out = open('__words.asm', 'w')
for l in [x.rstrip() for x in open('vocabulary.asm').readlines()]:
hOut.write(l + '\n')
if l[:2] == ';;':
name = '_'.join([str(ord(x)) for x in l[2:].strip()])
hOut.write('core_{0}:\n'.format(name))
hOut.close() |
class Ledfade:
def __init__(self, *args, **kwargs):
if 'start' in kwargs:
self.start = kwargs.get('start')
if 'end' in kwargs:
self.end = kwargs.get('end')
if 'action' in kwargs:
self.action = kwargs.get('action')
self.transit = self.end - self.start
def ledpwm(self, p):
c = 0.181+(0.0482*p)+(0.00323*p*p)+(0.0000629*p*p*p)
if c < 0.0:
return 0
if c > 0.0 and c <= 100.0:
return c
elif c > 100.0:
return 100
def update(self, now):
if self.action == 'sunrise':
return self.ledpwm(((now - self.start) / self.transit) * 100)
elif self.action == 'sunset':
return self.ledpwm(100 - ((now - self.start) / self.transit) * 100)
| class Ledfade:
def __init__(self, *args, **kwargs):
if 'start' in kwargs:
self.start = kwargs.get('start')
if 'end' in kwargs:
self.end = kwargs.get('end')
if 'action' in kwargs:
self.action = kwargs.get('action')
self.transit = self.end - self.start
def ledpwm(self, p):
c = 0.181 + 0.0482 * p + 0.00323 * p * p + 6.29e-05 * p * p * p
if c < 0.0:
return 0
if c > 0.0 and c <= 100.0:
return c
elif c > 100.0:
return 100
def update(self, now):
if self.action == 'sunrise':
return self.ledpwm((now - self.start) / self.transit * 100)
elif self.action == 'sunset':
return self.ledpwm(100 - (now - self.start) / self.transit * 100) |
def set_material(sg_node, sg_material_node):
'''Sets the material on a scenegraph group node and sets the materialid
user attribute at the same time.
Arguments:
sg_node (RixSGGroup) - scene graph group node to attach the material.
sg_material_node (RixSGMaterial) - the scene graph material node
'''
sg_node.SetMaterial(sg_material_node)
attrs = sg_node.GetAttributes()
attrs.SetString('user:__materialid', sg_material_node.GetIdentifier().CStr())
sg_node.SetAttributes(attrs) | def set_material(sg_node, sg_material_node):
"""Sets the material on a scenegraph group node and sets the materialid
user attribute at the same time.
Arguments:
sg_node (RixSGGroup) - scene graph group node to attach the material.
sg_material_node (RixSGMaterial) - the scene graph material node
"""
sg_node.SetMaterial(sg_material_node)
attrs = sg_node.GetAttributes()
attrs.SetString('user:__materialid', sg_material_node.GetIdentifier().CStr())
sg_node.SetAttributes(attrs) |
# Debug or not
DEBUG = 1
# Trackbar or not
CREATE_TRACKBARS = 1
# Display or not
DISPLAY = 1
# Image or Video, if "Video" is given as argument, program will use cv2.VideoCapture
# If "Image" argument is given the program will use cv2.imread
imageType = "Video"
# imageType = "Image"
# Image/Video source 0 or 1 for webcam or the file path of the video source such as
# "images/rocket/RocketPanelStraightDark72in.jpg" or "images/rocket/testvideo.mp4"
imageSource = 0
# Ip address
ipAddress = "10.99.99.2"
# The script to make camera arrangements
osScript = "v4l2-ctl --device /dev/video0 -c auto_exposure=1 -c exposure_auto_priority=0 -c exposure_time_absolute=20 --set-fmt-video=width=160,height=120,pixelformat=MJPG -p 15 && v4l2-ctl -d1 --get-fmt-video"
# Call OS script or not, close this in WINDOWS
callOS = 1
# NetworkTable Name
networkTableName = "visiontable"
# Camera Properties
camera = { 'HFOV' : 53.50, # 80.0, Horizontal FOV of the camera, see camera datasheet
'VFOV' : 41.41, # 64.0, Vertical FOV of the camera, see camera datasheet
'Brightness' : 1, # Brightness of the image
'Contrast' : 1000, # Contrast of the image
'HeightDiff' : 15, # Height difference between camera and target
'MountAngle' : -5, # Mounting angle of the camera need minus sign if pointing downwards
'WidthSize' : 320, # Resized image width size in pixels (image becomes square)
'HeightSize' : 240, # Resized image height size in pixels (image becomes square)
'FPS' : 15, # FPS of the camera
'AngleAcc' : 360, # 5 is normally used, you can use 360 to let the code ignore accuracy
'SetSize' : 0, # Set size of the camera with cap prop
'DoCrop' : 0, # Crop the image or don't
'DoResize' : 1, # Resize the image or don't
'CropXLow' : 0, # Lowest Point in X axis to be cropped
'CropYLow' : 125, # Lowest Point in Y axis to be cropped
'ColorSpace' : 'HSV', # Which color space to use BGR, HSV or Gray
'Gray_low' : 127, # Lower Gray value to be filtered
'Gray_high' : 255, # Higher Gray value to be filtered
'H_low' : 13, # Lower Hue value to be filtered, 55
'H_high' : 255, # Higher Hue to be filtered
'S_low' : 25, # Lower Saturation to be filtered, 97
'S_high' : 255, # Higher Saturation to be filtered
'V_low' : 24, # Lower Value to be filtered, 177
'V_high' : 255, # Higher Value to be filtered
'B_low' : 5, # Lower Blue value to be filtered
'B_high' : 95, # Higher Blue value to be filtered
'G_low' : 135, # Lower Green value to be filtered
'G_high' : 255, # Higher Green value to be filtered
'R_low' : 121, # Lower Red value to be filtered
'R_high' : 181 # Higher Red value to be filtered
}
filter = { 'MinArea' : 200, # Minimum value of area filter in pixels
'MaxArea' : 5000 # Maximum value of area filter in pixels
}
| debug = 1
create_trackbars = 1
display = 1
image_type = 'Video'
image_source = 0
ip_address = '10.99.99.2'
os_script = 'v4l2-ctl --device /dev/video0 -c auto_exposure=1 -c exposure_auto_priority=0 -c exposure_time_absolute=20 --set-fmt-video=width=160,height=120,pixelformat=MJPG -p 15 && v4l2-ctl -d1 --get-fmt-video'
call_os = 1
network_table_name = 'visiontable'
camera = {'HFOV': 53.5, 'VFOV': 41.41, 'Brightness': 1, 'Contrast': 1000, 'HeightDiff': 15, 'MountAngle': -5, 'WidthSize': 320, 'HeightSize': 240, 'FPS': 15, 'AngleAcc': 360, 'SetSize': 0, 'DoCrop': 0, 'DoResize': 1, 'CropXLow': 0, 'CropYLow': 125, 'ColorSpace': 'HSV', 'Gray_low': 127, 'Gray_high': 255, 'H_low': 13, 'H_high': 255, 'S_low': 25, 'S_high': 255, 'V_low': 24, 'V_high': 255, 'B_low': 5, 'B_high': 95, 'G_low': 135, 'G_high': 255, 'R_low': 121, 'R_high': 181}
filter = {'MinArea': 200, 'MaxArea': 5000} |
# Task 09. Hello, France
def validate_price(items_and_prices):
item = items_and_prices.split('->')[0]
prices = float(items_and_prices.split('->')[1])
if item == 'Clothes' and prices <= 50 or \
item == 'Shoes' and prices <= 35.00 or \
item == 'Accessories' and prices <= 20.50:
return True
return False
items_and_prices = input().split('|')
budget = float(input())
initial_budget = budget
new_prices = []
for item in items_and_prices:
item_price = float(item.split('->')[1])
if budget - item_price < 0:
continue
if validate_price(item):
budget -= item_price
new_price = item_price + (item_price * 0.40)
new_prices.append(new_price)
earned = sum(new_prices)
profit = budget + (earned-initial_budget)
budget += earned
if budget >= 150:
result = 'Hello, France!'
else:
result = 'Time to go.'
print(' '.join([f'{x:.2f}' for x in new_prices]))
print(f'Profit: {profit:.2f}')
print(result)
| def validate_price(items_and_prices):
item = items_and_prices.split('->')[0]
prices = float(items_and_prices.split('->')[1])
if item == 'Clothes' and prices <= 50 or (item == 'Shoes' and prices <= 35.0) or (item == 'Accessories' and prices <= 20.5):
return True
return False
items_and_prices = input().split('|')
budget = float(input())
initial_budget = budget
new_prices = []
for item in items_and_prices:
item_price = float(item.split('->')[1])
if budget - item_price < 0:
continue
if validate_price(item):
budget -= item_price
new_price = item_price + item_price * 0.4
new_prices.append(new_price)
earned = sum(new_prices)
profit = budget + (earned - initial_budget)
budget += earned
if budget >= 150:
result = 'Hello, France!'
else:
result = 'Time to go.'
print(' '.join([f'{x:.2f}' for x in new_prices]))
print(f'Profit: {profit:.2f}')
print(result) |
{
'name': 'Clean Theme',
'description': 'Clean Theme',
'category': 'Theme/Services',
'summary': 'Corporate, Business, Tech, Services',
'sequence': 120,
'version': '2.0',
'author': 'Odoo S.A.',
'depends': ['theme_common', 'website_animate'],
'data': [
'views/assets.xml',
'views/image_content.xml',
'views/snippets/s_cover.xml',
'views/snippets/s_carousel.xml',
'views/snippets/s_text_image.xml',
'views/snippets/s_three_columns.xml',
'views/snippets/s_call_to_action.xml',
],
'images': [
'static/description/Clean_description.jpg',
'static/description/clean_screenshot.jpg',
],
'license': 'LGPL-3',
'live_test_url': 'https://theme-clean.odoo.com',
}
| {'name': 'Clean Theme', 'description': 'Clean Theme', 'category': 'Theme/Services', 'summary': 'Corporate, Business, Tech, Services', 'sequence': 120, 'version': '2.0', 'author': 'Odoo S.A.', 'depends': ['theme_common', 'website_animate'], 'data': ['views/assets.xml', 'views/image_content.xml', 'views/snippets/s_cover.xml', 'views/snippets/s_carousel.xml', 'views/snippets/s_text_image.xml', 'views/snippets/s_three_columns.xml', 'views/snippets/s_call_to_action.xml'], 'images': ['static/description/Clean_description.jpg', 'static/description/clean_screenshot.jpg'], 'license': 'LGPL-3', 'live_test_url': 'https://theme-clean.odoo.com'} |
class ValidationException(Exception):
pass
class NeedsGridType(ValidationException):
def __init__(self, ghost_zones=0, fields=None):
self.ghost_zones = ghost_zones
self.fields = fields
def __str__(self):
return f"({self.ghost_zones}, {self.fields})"
class NeedsOriginalGrid(NeedsGridType):
def __init__(self):
self.ghost_zones = 0
class NeedsDataField(ValidationException):
def __init__(self, missing_fields):
self.missing_fields = missing_fields
def __str__(self):
return f"({self.missing_fields})"
class NeedsProperty(ValidationException):
def __init__(self, missing_properties):
self.missing_properties = missing_properties
def __str__(self):
return f"({self.missing_properties})"
class NeedsParameter(ValidationException):
def __init__(self, missing_parameters):
self.missing_parameters = missing_parameters
def __str__(self):
return f"({self.missing_parameters})"
class NeedsConfiguration(ValidationException):
def __init__(self, parameter, value):
self.parameter = parameter
self.value = value
def __str__(self):
return f"(Needs {self.parameter} = {self.value})"
class FieldUnitsError(Exception):
pass
| class Validationexception(Exception):
pass
class Needsgridtype(ValidationException):
def __init__(self, ghost_zones=0, fields=None):
self.ghost_zones = ghost_zones
self.fields = fields
def __str__(self):
return f'({self.ghost_zones}, {self.fields})'
class Needsoriginalgrid(NeedsGridType):
def __init__(self):
self.ghost_zones = 0
class Needsdatafield(ValidationException):
def __init__(self, missing_fields):
self.missing_fields = missing_fields
def __str__(self):
return f'({self.missing_fields})'
class Needsproperty(ValidationException):
def __init__(self, missing_properties):
self.missing_properties = missing_properties
def __str__(self):
return f'({self.missing_properties})'
class Needsparameter(ValidationException):
def __init__(self, missing_parameters):
self.missing_parameters = missing_parameters
def __str__(self):
return f'({self.missing_parameters})'
class Needsconfiguration(ValidationException):
def __init__(self, parameter, value):
self.parameter = parameter
self.value = value
def __str__(self):
return f'(Needs {self.parameter} = {self.value})'
class Fieldunitserror(Exception):
pass |
#import sys
#file = sys.stdin
file = open( r".\data\nestedlists.txt" )
data = file.read().strip().split()[1:]
records = [ [data[i], float(data[i+1])] for i in range(0, len(data), 2) ]
print(records)
low = min([r[1] for r in records])
dif = min([r[1] - low for r in records if r[1] != low])
print(dif)
names = [ r[0] for r in records if r[1]-dif == low]
[print(name) for name in sorted(names)]
#from decimal import Decimal
#from itertools import groupby, islice
#from operator import itemgetter
#a = []
#for i in range(int(input())):
# x, y = (input(), Decimal(input()))
# a.append((y, x))
#a.sort()
#for k, v in islice(groupby(a, key=itemgetter(0)), 1, 2):
# for x in v:
# print(x[1])
| file = open('.\\data\\nestedlists.txt')
data = file.read().strip().split()[1:]
records = [[data[i], float(data[i + 1])] for i in range(0, len(data), 2)]
print(records)
low = min([r[1] for r in records])
dif = min([r[1] - low for r in records if r[1] != low])
print(dif)
names = [r[0] for r in records if r[1] - dif == low]
[print(name) for name in sorted(names)] |
class Int_code:
def __init__(self, s, inputs):
memory = {}
nrs = map(int, s.split(","))
for i, x in enumerate(nrs):
memory[i] = x
self.memory = memory
self.inputs = inputs
def set(self, i, x):
self.memory[i] = x
def one(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = a + b
def two(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = a * b
def three(self, a, modes):
x = self.inputs.pop(0)
self.memory[a] = x
def four(self, a, modes):
if modes % 10 == 0:
a = self.memory[a]
print(a)
def five(self, a, b, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
if a != 0:
return (True, b)
else:
return (False, 0)
def six(self, a, b, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
if a == 0:
return (True, b)
else:
return (False, 0)
def seven(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = 1 if (a < b) else 0
def eight(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = 1 if (a == b) else 0
def run(self, start):
i = start
while True:
c = self.memory[i]
modes = c // 100
c %= 100
# print(i, self.memory[i])
if c == 99:
break
elif c == 1:
self.one(self.memory[i+1], self.memory[i+2], self.memory[i+3], modes)
i += 4
elif c == 2:
self.two(self.memory[i+1], self.memory[i+2], self.memory[i+3], modes)
i += 4
elif c == 3:
self.three(self.memory[i+1], modes)
i += 2
elif c == 4:
self.four(self.memory[i+1], modes)
i += 2
elif c == 5:
sol = self.five(self.memory[i+1], self.memory[i+2], modes)
if sol[0]:
i = sol[1]
else:
i += 3
elif c == 6:
sol = self.six(self.memory[i+1], self.memory[i+2], modes)
if sol[0]:
i = sol[1]
else:
i += 3
elif c == 7:
self.seven(self.memory[i+1], self.memory[i+2], self.memory[i+3], modes)
i += 4
elif c == 8:
self.eight(self.memory[i+1], self.memory[i+2], self.memory[i+3], modes)
i += 4
return self.memory[0]
start = input()
# part one
inputs_1 = [1]
computer = Int_code(start, inputs_1)
computer.run(0)
# part two
inputs_2 = [5]
computer = Int_code(start, inputs_2)
computer.run(0)
# # test
# inputs = [3]
# computer = Int_code(start, inputs)
# computer.run(0)
| class Int_Code:
def __init__(self, s, inputs):
memory = {}
nrs = map(int, s.split(','))
for (i, x) in enumerate(nrs):
memory[i] = x
self.memory = memory
self.inputs = inputs
def set(self, i, x):
self.memory[i] = x
def one(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = a + b
def two(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = a * b
def three(self, a, modes):
x = self.inputs.pop(0)
self.memory[a] = x
def four(self, a, modes):
if modes % 10 == 0:
a = self.memory[a]
print(a)
def five(self, a, b, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
if a != 0:
return (True, b)
else:
return (False, 0)
def six(self, a, b, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
if a == 0:
return (True, b)
else:
return (False, 0)
def seven(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = 1 if a < b else 0
def eight(self, a, b, c, modes):
if modes % 10 == 0:
a = self.memory[a]
modes //= 10
if modes % 10 == 0:
b = self.memory[b]
self.memory[c] = 1 if a == b else 0
def run(self, start):
i = start
while True:
c = self.memory[i]
modes = c // 100
c %= 100
if c == 99:
break
elif c == 1:
self.one(self.memory[i + 1], self.memory[i + 2], self.memory[i + 3], modes)
i += 4
elif c == 2:
self.two(self.memory[i + 1], self.memory[i + 2], self.memory[i + 3], modes)
i += 4
elif c == 3:
self.three(self.memory[i + 1], modes)
i += 2
elif c == 4:
self.four(self.memory[i + 1], modes)
i += 2
elif c == 5:
sol = self.five(self.memory[i + 1], self.memory[i + 2], modes)
if sol[0]:
i = sol[1]
else:
i += 3
elif c == 6:
sol = self.six(self.memory[i + 1], self.memory[i + 2], modes)
if sol[0]:
i = sol[1]
else:
i += 3
elif c == 7:
self.seven(self.memory[i + 1], self.memory[i + 2], self.memory[i + 3], modes)
i += 4
elif c == 8:
self.eight(self.memory[i + 1], self.memory[i + 2], self.memory[i + 3], modes)
i += 4
return self.memory[0]
start = input()
inputs_1 = [1]
computer = int_code(start, inputs_1)
computer.run(0)
inputs_2 = [5]
computer = int_code(start, inputs_2)
computer.run(0) |
# model settings
model = dict(
type='ImageClassifier',
backbone=dict(
type='OTEMobileNetV3',
mode='small',
width_mult=1.0),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='NonLinearClsHead',
num_classes=1000,
in_channels=576,
hid_channels=1024,
act_cfg=dict(type='HSwish'),
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
))
| model = dict(type='ImageClassifier', backbone=dict(type='OTEMobileNetV3', mode='small', width_mult=1.0), neck=dict(type='GlobalAveragePooling'), head=dict(type='NonLinearClsHead', num_classes=1000, in_channels=576, hid_channels=1024, act_cfg=dict(type='HSwish'), loss=dict(type='CrossEntropyLoss', loss_weight=1.0))) |
class BaseNode:
pass
class Node(BaseNode):
def __init__(self, offset, name=None, **opts):
self.offset = offset
self.end_offset = None
self.name = name
self.nodes = []
self.opts = opts
def __as_dict__(self):
return {"name": self.name, "nodes": [node.__as_dict__() for node in self.nodes]}
class Token(BaseNode):
def __init__(self, offset, value):
self.offset = offset
self.value = value
def __as_dict__(self):
return {"offset": self.offset, "value": self.value}
class NodeInspector:
def __init__(self, target):
if not isinstance(target, Node):
raise TypeError("target should be an instance of Node, not " + target.__class__)
self.target = target
self.names = {}
self.values = []
for node in target.nodes:
if isinstance(node, Node):
if node.name in self.names:
self.names[node.name] += [node]
else:
self.names[node.name] = [node]
else:
self.values.append(node)
if target.opts.get("flatten"):
if target.opts.get("as_list"):
if len(self.names) >= 1:
nodes = list(self.names.values())[0]
else:
nodes = []
self.mask = [NodeInspector(node).mask for node in nodes]
elif len(self.names) >= 1:
nodes = list(self.names.values())[0]
self.mask = NodeInspector(nodes[0]).mask
else:
self.mask = None
# elif len(self.names) == 0 and len(self.values) == 1:
# self.mask = self.values[0]
else:
self.mask = NodeMask(self)
class NodeMask:
def __init__(self, inspector):
super().__setattr__("_inspector", inspector)
super().__setattr__("_offset", inspector.target.offset)
super().__setattr__("_end_offset", inspector.target.end_offset)
super().__setattr__("_name", inspector.target.name)
def __str__(self):
target = self._inspector.target
n = target.name
v = len(self._inspector.values)
s = ", ".join(("{}[{}]".format(k, len(v)) for k,v in self._inspector.names))
return "<NodeMask name={}; values=[{}], nodes=[{}]>".format(n, v, s)
def __getattr__(self, name):
names = self._inspector.names
nodes = names.get(name)
if nodes:
node = NodeInspector(nodes[0]).mask
else:
node = None
return node
def __setattr__(self, name, value):
raise AttributeError
def __getitem__(self, i):
return self._inspector.values[i]
def __len__(self):
return len(self._inspector.values)
def __iter__(self):
return iter(self._inspector.values)
def __as_dict__(self):
return self._inspector.target.__as_dict__() | class Basenode:
pass
class Node(BaseNode):
def __init__(self, offset, name=None, **opts):
self.offset = offset
self.end_offset = None
self.name = name
self.nodes = []
self.opts = opts
def __as_dict__(self):
return {'name': self.name, 'nodes': [node.__as_dict__() for node in self.nodes]}
class Token(BaseNode):
def __init__(self, offset, value):
self.offset = offset
self.value = value
def __as_dict__(self):
return {'offset': self.offset, 'value': self.value}
class Nodeinspector:
def __init__(self, target):
if not isinstance(target, Node):
raise type_error('target should be an instance of Node, not ' + target.__class__)
self.target = target
self.names = {}
self.values = []
for node in target.nodes:
if isinstance(node, Node):
if node.name in self.names:
self.names[node.name] += [node]
else:
self.names[node.name] = [node]
else:
self.values.append(node)
if target.opts.get('flatten'):
if target.opts.get('as_list'):
if len(self.names) >= 1:
nodes = list(self.names.values())[0]
else:
nodes = []
self.mask = [node_inspector(node).mask for node in nodes]
elif len(self.names) >= 1:
nodes = list(self.names.values())[0]
self.mask = node_inspector(nodes[0]).mask
else:
self.mask = None
else:
self.mask = node_mask(self)
class Nodemask:
def __init__(self, inspector):
super().__setattr__('_inspector', inspector)
super().__setattr__('_offset', inspector.target.offset)
super().__setattr__('_end_offset', inspector.target.end_offset)
super().__setattr__('_name', inspector.target.name)
def __str__(self):
target = self._inspector.target
n = target.name
v = len(self._inspector.values)
s = ', '.join(('{}[{}]'.format(k, len(v)) for (k, v) in self._inspector.names))
return '<NodeMask name={}; values=[{}], nodes=[{}]>'.format(n, v, s)
def __getattr__(self, name):
names = self._inspector.names
nodes = names.get(name)
if nodes:
node = node_inspector(nodes[0]).mask
else:
node = None
return node
def __setattr__(self, name, value):
raise AttributeError
def __getitem__(self, i):
return self._inspector.values[i]
def __len__(self):
return len(self._inspector.values)
def __iter__(self):
return iter(self._inspector.values)
def __as_dict__(self):
return self._inspector.target.__as_dict__() |
n, m = [int(e) for e in input().split()]
mat = []
for i in range(n):
j = [int(e) for e in input().split()]
mat.append(j)
for i in range(n):
for j in range(m):
if mat[i][j] == 0:
if i == 0:
if mat[i][j+1] == 1 and mat[i][j-1] == 1 and mat[i+1][j] == 1:
print(i, j)
exit()
if j == 0:
if mat[i+1][j] == 1 and mat[i-1][j] == 1 and mat[i][j+1] == 1:
print(i, j)
exit()
if i == n-1:
if mat[i][j+1] == 1 and mat[i][j-1] == 1 and mat[i-1][j] == 1:
print(i, j)
exit()
if j == m-1:
if mat[i+1][j] == 1 and mat[i-1][j] == 1 and mat[i][j-1] == 1:
print(i, j)
exit()
if mat[i+1][j] == 1 and mat[i-1][j] == 1 and mat[i][j+1] == 1 and mat[i][j-1] == 1:
print(i, j)
exit()
print(0, 0)
| (n, m) = [int(e) for e in input().split()]
mat = []
for i in range(n):
j = [int(e) for e in input().split()]
mat.append(j)
for i in range(n):
for j in range(m):
if mat[i][j] == 0:
if i == 0:
if mat[i][j + 1] == 1 and mat[i][j - 1] == 1 and (mat[i + 1][j] == 1):
print(i, j)
exit()
if j == 0:
if mat[i + 1][j] == 1 and mat[i - 1][j] == 1 and (mat[i][j + 1] == 1):
print(i, j)
exit()
if i == n - 1:
if mat[i][j + 1] == 1 and mat[i][j - 1] == 1 and (mat[i - 1][j] == 1):
print(i, j)
exit()
if j == m - 1:
if mat[i + 1][j] == 1 and mat[i - 1][j] == 1 and (mat[i][j - 1] == 1):
print(i, j)
exit()
if mat[i + 1][j] == 1 and mat[i - 1][j] == 1 and (mat[i][j + 1] == 1) and (mat[i][j - 1] == 1):
print(i, j)
exit()
print(0, 0) |
CONNECTION_STRING = '/@'
CHUNK_SIZE = 100
BORDER_QTY = 5 # minimun matches per year per player for reload player
ATP_URL_PREFIX = 'http://www.atpworldtour.com'
DC_URL_PREFIX = 'https://www.daviscup.com'
ATP_TOURNAMENT_SERIES = ('gs', '1000', 'atp', 'ch')
DC_TOURNAMENT_SERIES = ('dc',)
DURATION_IN_DAYS = 18
ATP_CSV_PATH = ''
DC_CSV_PATH = ''
SLEEP_DURATION = 10
COUNTRY_CODE_MAP = {
'LIB': 'LBN',
'SIN': 'SGP',
'bra': 'BRA',
'ROM': 'ROU'}
COUNTRY_NAME_MAP = {
'Slovak Republic': 'Slovakia',
'Bosnia-Herzegovina': 'Bosnia and Herzegovina'}
INDOOR_OUTDOOR_MAP = {
'I': 'Indoor',
'O': 'Outdoor'}
SURFACE_MAP = {
'H': 'Hard',
'C': 'Clay',
'A': 'Carpet',
'G': 'Grass'}
STADIE_CODES_MAP = {
'Finals': 'F',
'Final': 'F',
'Semi-Finals': 'SF',
'Semifinals': 'SF',
'Quarter-Finals': 'QF',
'Quarterfinals': 'QF',
'Round of 16': 'R16',
'Round of 32': 'R32',
'Round of 64': 'R64',
'Round of 128': 'R128',
'Round Robin': 'RR',
'Olympic Bronze': 'BR',
'3rd Round Qualifying': 'Q3',
'2nd Round Qualifying': 'Q2',
'1st Round Qualifying': 'Q1'}
| connection_string = '/@'
chunk_size = 100
border_qty = 5
atp_url_prefix = 'http://www.atpworldtour.com'
dc_url_prefix = 'https://www.daviscup.com'
atp_tournament_series = ('gs', '1000', 'atp', 'ch')
dc_tournament_series = ('dc',)
duration_in_days = 18
atp_csv_path = ''
dc_csv_path = ''
sleep_duration = 10
country_code_map = {'LIB': 'LBN', 'SIN': 'SGP', 'bra': 'BRA', 'ROM': 'ROU'}
country_name_map = {'Slovak Republic': 'Slovakia', 'Bosnia-Herzegovina': 'Bosnia and Herzegovina'}
indoor_outdoor_map = {'I': 'Indoor', 'O': 'Outdoor'}
surface_map = {'H': 'Hard', 'C': 'Clay', 'A': 'Carpet', 'G': 'Grass'}
stadie_codes_map = {'Finals': 'F', 'Final': 'F', 'Semi-Finals': 'SF', 'Semifinals': 'SF', 'Quarter-Finals': 'QF', 'Quarterfinals': 'QF', 'Round of 16': 'R16', 'Round of 32': 'R32', 'Round of 64': 'R64', 'Round of 128': 'R128', 'Round Robin': 'RR', 'Olympic Bronze': 'BR', '3rd Round Qualifying': 'Q3', '2nd Round Qualifying': 'Q2', '1st Round Qualifying': 'Q1'} |
# 15. replace() -> Altera determinado valor de uma string por outro. Troca uma string por outra.
texto = 'vou Treinar todo Dia Python'
print(texto.replace('vou','Vamos'))
print(texto.replace('Python','Algoritmos')) | texto = 'vou Treinar todo Dia Python'
print(texto.replace('vou', 'Vamos'))
print(texto.replace('Python', 'Algoritmos')) |
class Email:
def __init__(self):
self.from_email = ''
self.to_email = ''
self.subject = ''
self.contents = ''
def send_mail(self):
print('From: '+ self.from_email)
print('To: '+ self.to_email)
print('Subject: '+ self.subject)
print('Contents: '+ self.contents) | class Email:
def __init__(self):
self.from_email = ''
self.to_email = ''
self.subject = ''
self.contents = ''
def send_mail(self):
print('From: ' + self.from_email)
print('To: ' + self.to_email)
print('Subject: ' + self.subject)
print('Contents: ' + self.contents) |
n, x = map(int, input().split())
ll = list(map(int, input().split()))
ans = 1
d_p = 0
d_c = 0
for i in range(n):
d_c = d_p + ll[i]
if d_c <= x:
ans += 1
d_p = d_c
print(ans) | (n, x) = map(int, input().split())
ll = list(map(int, input().split()))
ans = 1
d_p = 0
d_c = 0
for i in range(n):
d_c = d_p + ll[i]
if d_c <= x:
ans += 1
d_p = d_c
print(ans) |
def fill_the_box(*args):
height = args[0]
length = args[1]
width = args[2]
cube_size = height * length * width
for i in range(3, len(args)):
if args[i] == "Finish":
return f"There is free space in the box. You could put {cube_size} more cubes."
if cube_size < args[i]:
cubes_left = args[i] - cube_size
for c in range(i + 1, len(args)):
if args[c] == "Finish":
break
cubes_left += args[c]
return f"No more free space! You have {cubes_left} more cubes."
cube_size -= args[i]
print(fill_the_box(2, 8, 2, 2, 1, 7, 3, 1, 5, "Finish"))
print(fill_the_box(5, 5, 2, 40, 11, 7, 3, 1, 5, "Finish"))
print(fill_the_box(10, 10, 10, 40, "Finish", 2, 15, 30))
| def fill_the_box(*args):
height = args[0]
length = args[1]
width = args[2]
cube_size = height * length * width
for i in range(3, len(args)):
if args[i] == 'Finish':
return f'There is free space in the box. You could put {cube_size} more cubes.'
if cube_size < args[i]:
cubes_left = args[i] - cube_size
for c in range(i + 1, len(args)):
if args[c] == 'Finish':
break
cubes_left += args[c]
return f'No more free space! You have {cubes_left} more cubes.'
cube_size -= args[i]
print(fill_the_box(2, 8, 2, 2, 1, 7, 3, 1, 5, 'Finish'))
print(fill_the_box(5, 5, 2, 40, 11, 7, 3, 1, 5, 'Finish'))
print(fill_the_box(10, 10, 10, 40, 'Finish', 2, 15, 30)) |
#!/usr/bin/env python3
#Antonio Karlo Mijares
# return_text_value function
def return_text_value():
name = 'Terry'
greeting = 'Good Morning ' + name
return greeting
# return_number_value function
def return_number_value():
num1 = 10
num2 = 5
num3 = num1 + num2
return num3
# Main program
if __name__ == '__main__':
print('python code')
text = return_text_value()
print(text)
number = return_number_value()
print(str(number))
| def return_text_value():
name = 'Terry'
greeting = 'Good Morning ' + name
return greeting
def return_number_value():
num1 = 10
num2 = 5
num3 = num1 + num2
return num3
if __name__ == '__main__':
print('python code')
text = return_text_value()
print(text)
number = return_number_value()
print(str(number)) |
{
"variables": {
"HEROKU%": '<!(echo $HEROKU)'
},
"targets": [
{
"target_name": "gif2webp",
"defines": [
],
"sources": [
"src/gif2webp.cpp",
"src/webp/example_util.cpp",
"src/webp/gif2webp_util.cpp",
"src/webp/gif2webpMain.cpp"
],
"conditions": [
[
'OS=="mac"',
{
"include_dirs": [
"/usr/local/include",
"src/webp"
],
"libraries": [
"-lwebp",
"-lwebpmux",
"-lgif"
]
}
],
[
'OS=="linux"',
{
"include_dirs": [
"/usr/local/include",
"src/webp"
],
"libraries": [
"-lwebp",
"-lwebpmux",
"-lgif"
]
}
]
]
}
]
} | {'variables': {'HEROKU%': '<!(echo $HEROKU)'}, 'targets': [{'target_name': 'gif2webp', 'defines': [], 'sources': ['src/gif2webp.cpp', 'src/webp/example_util.cpp', 'src/webp/gif2webp_util.cpp', 'src/webp/gif2webpMain.cpp'], 'conditions': [['OS=="mac"', {'include_dirs': ['/usr/local/include', 'src/webp'], 'libraries': ['-lwebp', '-lwebpmux', '-lgif']}], ['OS=="linux"', {'include_dirs': ['/usr/local/include', 'src/webp'], 'libraries': ['-lwebp', '-lwebpmux', '-lgif']}]]}]} |
with open("day6_input.txt") as f:
initial_fish = list(map(int, f.readline().strip().split(",")))
fish = [0] * 9
for initial_f in initial_fish:
fish[initial_f] += 1
for day in range(80):
new_fish = [0] * 9
for state in range(9):
if state == 0:
new_fish[6] += fish[0]
new_fish[8] += fish[0]
else:
new_fish[state-1] += fish[state]
fish = new_fish
print(sum(fish))
| with open('day6_input.txt') as f:
initial_fish = list(map(int, f.readline().strip().split(',')))
fish = [0] * 9
for initial_f in initial_fish:
fish[initial_f] += 1
for day in range(80):
new_fish = [0] * 9
for state in range(9):
if state == 0:
new_fish[6] += fish[0]
new_fish[8] += fish[0]
else:
new_fish[state - 1] += fish[state]
fish = new_fish
print(sum(fish)) |
# [Root Abyss] Guardians of the World Tree
MYSTERIOUS_GIRL = 1064001 # npc Id
sm.removeEscapeButton()
sm.lockInGameUI(True)
sm.setPlayerAsSpeaker()
sm.sendNext("We need to find those baddies if we want to get you out of here.")
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("But... they all left")
sm.setPlayerAsSpeaker()
sm.sendNext("They had to have left some clues behind. "
"What about those weird doors over there?")
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("They showed up when the bad guys left, but I can't get through them.")
sm.setPlayerAsSpeaker()
sm.sendNext("Then that sounds like a good place to start. Maybe I should-")
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("Y-you're glowing!")
sm.invokeAtFixedRate(0, 2450, 3, "showEffect", "Effect/Direction11.img/effect/Aura/0", 3, 0)
sm.setPlayerAsSpeaker()
sm.sendNext("Ah! What is this?! Don't let it take all my fr00dz!!")
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("#h0#!!!")
sm.startQuest(parentID)
sm.lockInGameUI(False)
sm.warpInstanceIn(910700300, 0) # Fake Vellum Cave for QuestLine
| mysterious_girl = 1064001
sm.removeEscapeButton()
sm.lockInGameUI(True)
sm.setPlayerAsSpeaker()
sm.sendNext('We need to find those baddies if we want to get you out of here.')
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext('But... they all left')
sm.setPlayerAsSpeaker()
sm.sendNext('They had to have left some clues behind. What about those weird doors over there?')
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("They showed up when the bad guys left, but I can't get through them.")
sm.setPlayerAsSpeaker()
sm.sendNext('Then that sounds like a good place to start. Maybe I should-')
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext("Y-you're glowing!")
sm.invokeAtFixedRate(0, 2450, 3, 'showEffect', 'Effect/Direction11.img/effect/Aura/0', 3, 0)
sm.setPlayerAsSpeaker()
sm.sendNext("Ah! What is this?! Don't let it take all my fr00dz!!")
sm.setSpeakerID(MYSTERIOUS_GIRL)
sm.sendNext('#h0#!!!')
sm.startQuest(parentID)
sm.lockInGameUI(False)
sm.warpInstanceIn(910700300, 0) |
# 11 List Comprehensions
products = [
("Product1", 15),
("Product2", 50),
("Product3", 5)
]
print(products)
# prices = list(map(lambda item: item[1], products))
# print(prices)
prices = [item[1] for item in products] # With list comprehensions we can achive the same result with a clenaer code
print(prices)
# filtered_price = list(filter(lambda item: item[1] >= 10, products))
# print(filtered_price)
filtered_price = [item for item in products if item[1] >= 10]
print(filtered_price) | products = [('Product1', 15), ('Product2', 50), ('Product3', 5)]
print(products)
prices = [item[1] for item in products]
print(prices)
filtered_price = [item for item in products if item[1] >= 10]
print(filtered_price) |
class orgApiPara:
setOrg_POST_request = {"host": {"type": str, "default": ''},
"port": {"type": int, "default": 636},
"cer_path": {"type": str, "default": ''},
"use_sll": {"type": bool, "default": True},
"admin": {"type": str, "default": ''},
"admin_pwd": {"type": str, "default": ''},
"admin_group": {"type": str, "default": ''},
"base_group": {"type": str, "default": ''},
"org_name": {"type": str, "default": ''},
"des": {"type": str, "default": ''},
"search_base": {"type": str, "default": ''}},
updateOrg_POST_request = {"id": {"type": int, "default": -1},
"host": {"type": str, "default": ''},
"port": {"type": int, "default": 636},
"cer_path": {"type": str, "default": ''},
"use_sll": {"type": bool, "default": True},
"admin": {"type": str, "default": ''},
"admin_pwd": {"type": str, "default": ''},
"admin_group": {"type": str, "default": ''},
"base_group": {"type": str, "default": ''},
"org_name": {"type": str, "default": ''},
"des": {"type": str, "default": ''},
"search_base": {"type": str, "default": ''}},
setOrg_POST_response = {
"ldap_id": {"type": int, "default": -1},
"org_id": {"type": int, "default": -1},
"host": {"type": str, "default": ''},
"port": {"type": int, "default": 636},
"cer_path": {"type": str, "default": ''},
"use_sll": {"type": bool, "default": True},
"admin": {"type": str, "default": ''},
"admin_pwd": {"type": str, "default": ''},
"admin_group": {"type": str, "default": ''},
"base_group": {"type": str, "default": ''},
"org_name": {"type": str, "default": ''},
"des": {"type": str, "default": ''},
"search_base": {"type": str, "default": ''}}
updateOrg_POST_response = {
"ldap_id": {"type": int, "default": -1},
"org_id": {"type": int, "default": -1},
"host": {"type": str, "default": ''},
"port": {"type": int, "default": 636},
"use_sll": {"type": bool, "default": True},
"cer_path": {"type": str, "default": ''},
"admin": {"type": str, "default": ''},
"admin_pwd": {"type": str, "default": ''},
"admin_group": {"type": str, "default": ''},
"base_group": {"type": str, "default": ''},
"org_name": {"type": str, "default": ''},
"des": {"type": str, "default": ''},
"search_base": {"type": str, "default": ''}} | class Orgapipara:
set_org_post_request = ({'host': {'type': str, 'default': ''}, 'port': {'type': int, 'default': 636}, 'cer_path': {'type': str, 'default': ''}, 'use_sll': {'type': bool, 'default': True}, 'admin': {'type': str, 'default': ''}, 'admin_pwd': {'type': str, 'default': ''}, 'admin_group': {'type': str, 'default': ''}, 'base_group': {'type': str, 'default': ''}, 'org_name': {'type': str, 'default': ''}, 'des': {'type': str, 'default': ''}, 'search_base': {'type': str, 'default': ''}},)
update_org_post_request = ({'id': {'type': int, 'default': -1}, 'host': {'type': str, 'default': ''}, 'port': {'type': int, 'default': 636}, 'cer_path': {'type': str, 'default': ''}, 'use_sll': {'type': bool, 'default': True}, 'admin': {'type': str, 'default': ''}, 'admin_pwd': {'type': str, 'default': ''}, 'admin_group': {'type': str, 'default': ''}, 'base_group': {'type': str, 'default': ''}, 'org_name': {'type': str, 'default': ''}, 'des': {'type': str, 'default': ''}, 'search_base': {'type': str, 'default': ''}},)
set_org_post_response = {'ldap_id': {'type': int, 'default': -1}, 'org_id': {'type': int, 'default': -1}, 'host': {'type': str, 'default': ''}, 'port': {'type': int, 'default': 636}, 'cer_path': {'type': str, 'default': ''}, 'use_sll': {'type': bool, 'default': True}, 'admin': {'type': str, 'default': ''}, 'admin_pwd': {'type': str, 'default': ''}, 'admin_group': {'type': str, 'default': ''}, 'base_group': {'type': str, 'default': ''}, 'org_name': {'type': str, 'default': ''}, 'des': {'type': str, 'default': ''}, 'search_base': {'type': str, 'default': ''}}
update_org_post_response = {'ldap_id': {'type': int, 'default': -1}, 'org_id': {'type': int, 'default': -1}, 'host': {'type': str, 'default': ''}, 'port': {'type': int, 'default': 636}, 'use_sll': {'type': bool, 'default': True}, 'cer_path': {'type': str, 'default': ''}, 'admin': {'type': str, 'default': ''}, 'admin_pwd': {'type': str, 'default': ''}, 'admin_group': {'type': str, 'default': ''}, 'base_group': {'type': str, 'default': ''}, 'org_name': {'type': str, 'default': ''}, 'des': {'type': str, 'default': ''}, 'search_base': {'type': str, 'default': ''}} |
#!/usr/bin/python3
#-----------------bot session-------------------
UserCancel = 'You have cancel the process.'
welcomeMessage = ('User identity conformed, please input gallery urls ' +
'and use space to separate them'
)
denyMessage = 'You are not the admin of this bot, conversation end.'
urlComform = ('Received {0} gallery url(s). \nNow begin to download the content. ' +
'Once the download completed, you will receive a report.'
)
magnetLinkConform = ('Received a magnetLink. Now send it to bittorrent client')
magnetResultMessage = ('Torrent {0} has been added bittorrent client.')
urlNotFound = 'Could not find any gallery url, please check and re-input.'
gidError = 'Encountered an error gid: {0}'
#------------------magnet download session---------------------
emptyFileListError = ('Could not retrive file list for this link, maybe still '+
'downloading meta data.')
#-----------------dloptgenerate session---------------------
userCookiesFormError = 'userCookies form error, please check the config file.'
#-----------------managgessiongen session-------------------
usercookiesEXHError = 'This cookies could not access EXH'
#-----------------ehlogin session---------------------------
ehloginError = 'username or password error, please check.'
exhError = 'This username could not access exhentai.'
#------------------download session------------------------
galleryError = 'Gallery does not contain any page, maybe deleted.'
| user_cancel = 'You have cancel the process.'
welcome_message = 'User identity conformed, please input gallery urls ' + 'and use space to separate them'
deny_message = 'You are not the admin of this bot, conversation end.'
url_comform = 'Received {0} gallery url(s). \nNow begin to download the content. ' + 'Once the download completed, you will receive a report.'
magnet_link_conform = 'Received a magnetLink. Now send it to bittorrent client'
magnet_result_message = 'Torrent {0} has been added bittorrent client.'
url_not_found = 'Could not find any gallery url, please check and re-input.'
gid_error = 'Encountered an error gid: {0}'
empty_file_list_error = 'Could not retrive file list for this link, maybe still ' + 'downloading meta data.'
user_cookies_form_error = 'userCookies form error, please check the config file.'
usercookies_exh_error = 'This cookies could not access EXH'
ehlogin_error = 'username or password error, please check.'
exh_error = 'This username could not access exhentai.'
gallery_error = 'Gallery does not contain any page, maybe deleted.' |
(n,m) = [int(x) for x in input().split()]
loop_range = n + m
set_m = set()
set_n = set()
for _ in range(n):
set_n.add(int(input()))
for _ in range(m):
set_m.add(int(input()))
uniques = set_n.intersection(set_m)
[print(x) for x in (uniques)]
| (n, m) = [int(x) for x in input().split()]
loop_range = n + m
set_m = set()
set_n = set()
for _ in range(n):
set_n.add(int(input()))
for _ in range(m):
set_m.add(int(input()))
uniques = set_n.intersection(set_m)
[print(x) for x in uniques] |
class bcolors():
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OK = '\033[92m'
WARNING = '\033[96m'
FAIL = '\033[91m'
TITLE = '\033[93m'
ENDC = '\033[0m'
| class Bcolors:
header = '\x1b[95m'
okblue = '\x1b[94m'
ok = '\x1b[92m'
warning = '\x1b[96m'
fail = '\x1b[91m'
title = '\x1b[93m'
endc = '\x1b[0m' |
nz = 512 # noize vector size
nsf = 4 # encoded voxel size, scale factor
nvx = 32 # output voxel size
batch_size = 64
learning_rate = 2e-4
dataset_path_i = "/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox.thinned"
dataset_path_o = "/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox"
params_path = "params/voxel_dcgan_model.ckpt"
| nz = 512
nsf = 4
nvx = 32
batch_size = 64
learning_rate = 0.0002
dataset_path_i = '/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox.thinned'
dataset_path_o = '/media/wangyida/D0-P1/database/ShapeNetCore.v2/*/*/*/model_normalized.binvox'
params_path = 'params/voxel_dcgan_model.ckpt' |
class Fiz_contact:
def __init__(self, lastname, firstname, middlename, email, telephone, password, confirmpassword):
self.lastname=lastname
self.firstname=firstname
self.middlename=middlename
self.email=email
self.telephone=telephone
self.password=password
self.confirmpassword=confirmpassword
| class Fiz_Contact:
def __init__(self, lastname, firstname, middlename, email, telephone, password, confirmpassword):
self.lastname = lastname
self.firstname = firstname
self.middlename = middlename
self.email = email
self.telephone = telephone
self.password = password
self.confirmpassword = confirmpassword |
def main():
with open("number.txt", "r") as file:
data = file.read()
data = data.split("\n")
x = [row.split("\t") for row in data[:5]]
print(function(x))
def function(x):
sum=0
for el in x[0:]:
sum += int(el[0])
return sum
if __name__=="__main__":
main();
| def main():
with open('number.txt', 'r') as file:
data = file.read()
data = data.split('\n')
x = [row.split('\t') for row in data[:5]]
print(function(x))
def function(x):
sum = 0
for el in x[0:]:
sum += int(el[0])
return sum
if __name__ == '__main__':
main() |
a = input()
b= input()
print(ord(a) + ord(b))
| a = input()
b = input()
print(ord(a) + ord(b)) |
def prastevila_do_n(n):
pra = [2,3,5,7]
for x in range(8,n+1):
d = True
for y in range(2,int(x ** 0.5) + 1):
if d == False:
break
elif x % y == 0:
d = False
if d == True:
pra.append(x)
return pra
def euler_50():
pra = prastevila_do_n(1000000)
najvecja_vsot_ki_je_prastevilo = 0
stevilo_z_najvec_p = 0
for p in pra:
i = pra.index(p)
if sum(pra[i:i+stevilo_z_najvec_p]) > 1000000:
break
stevilo_p = 0
vsota = pra[i]
for p1 in range(i+1,len(pra)):
stevilo_p += 1
vsota += pra[p1]
if vsota > 1000000:
break
elif vsota in pra and stevilo_z_najvec_p < stevilo_p:
najvecja_vsot_ki_je_prastevilo = vsota
stevilo_z_najvec_p = stevilo_p
return najvecja_vsot_ki_je_prastevilo
euler_50() | def prastevila_do_n(n):
pra = [2, 3, 5, 7]
for x in range(8, n + 1):
d = True
for y in range(2, int(x ** 0.5) + 1):
if d == False:
break
elif x % y == 0:
d = False
if d == True:
pra.append(x)
return pra
def euler_50():
pra = prastevila_do_n(1000000)
najvecja_vsot_ki_je_prastevilo = 0
stevilo_z_najvec_p = 0
for p in pra:
i = pra.index(p)
if sum(pra[i:i + stevilo_z_najvec_p]) > 1000000:
break
stevilo_p = 0
vsota = pra[i]
for p1 in range(i + 1, len(pra)):
stevilo_p += 1
vsota += pra[p1]
if vsota > 1000000:
break
elif vsota in pra and stevilo_z_najvec_p < stevilo_p:
najvecja_vsot_ki_je_prastevilo = vsota
stevilo_z_najvec_p = stevilo_p
return najvecja_vsot_ki_je_prastevilo
euler_50() |
args_global = ['server_addr', 'port', 'timeout', 'verbose', 'dry_run', 'conn_retries',
'is_server', 'rpc_plugin', 'called_rpc_name', 'func', 'client']
def strip_globals(kwargs):
for arg in args_global:
kwargs.pop(arg, None)
def remove_null(kwargs):
keys = []
for key, value in kwargs.items():
if value is None:
keys.append(key)
for key in keys:
kwargs.pop(key, None)
def apply_defaults(kwargs, **defaults):
for key, value in defaults.items():
if key not in kwargs:
kwargs[key] = value
def group_as(kwargs, name, values):
group = {}
for arg in values:
if arg in kwargs and kwargs[arg] is not None:
group[arg] = kwargs.pop(arg, None)
kwargs[name] = group
| args_global = ['server_addr', 'port', 'timeout', 'verbose', 'dry_run', 'conn_retries', 'is_server', 'rpc_plugin', 'called_rpc_name', 'func', 'client']
def strip_globals(kwargs):
for arg in args_global:
kwargs.pop(arg, None)
def remove_null(kwargs):
keys = []
for (key, value) in kwargs.items():
if value is None:
keys.append(key)
for key in keys:
kwargs.pop(key, None)
def apply_defaults(kwargs, **defaults):
for (key, value) in defaults.items():
if key not in kwargs:
kwargs[key] = value
def group_as(kwargs, name, values):
group = {}
for arg in values:
if arg in kwargs and kwargs[arg] is not None:
group[arg] = kwargs.pop(arg, None)
kwargs[name] = group |
datasetFile = open("datasets/rosalind_ba1e.txt", "r")
genome = datasetFile.readline().strip()
otherArgs = datasetFile.readline().strip()
k, L, t = map(lambda x: int(x), otherArgs.split(" "))
def findClumps(genome, k, L, t):
kmerIndex = {}
clumpedKmers = set()
for i in range(len(genome) - k + 1):
kmer = genome[i:i+k]
if kmer in kmerIndex:
currentIndex = kmerIndex[kmer]
currentIndex.append(i)
if len(currentIndex) >= t:
clumpStart = currentIndex[-t]
if i - clumpStart <= L:
clumpedKmers.add(kmer)
else:
kmerIndex[kmer] = [i]
return clumpedKmers
solution = " ".join(findClumps(genome, k, L, t))
outputFile = open("output/rosalind_ba1e.txt", "a")
outputFile.write(solution)
| dataset_file = open('datasets/rosalind_ba1e.txt', 'r')
genome = datasetFile.readline().strip()
other_args = datasetFile.readline().strip()
(k, l, t) = map(lambda x: int(x), otherArgs.split(' '))
def find_clumps(genome, k, L, t):
kmer_index = {}
clumped_kmers = set()
for i in range(len(genome) - k + 1):
kmer = genome[i:i + k]
if kmer in kmerIndex:
current_index = kmerIndex[kmer]
currentIndex.append(i)
if len(currentIndex) >= t:
clump_start = currentIndex[-t]
if i - clumpStart <= L:
clumpedKmers.add(kmer)
else:
kmerIndex[kmer] = [i]
return clumpedKmers
solution = ' '.join(find_clumps(genome, k, L, t))
output_file = open('output/rosalind_ba1e.txt', 'a')
outputFile.write(solution) |
class Token:
def __init__(self, word, line, start, finish, category, reason=None):
self.__word__ = word
self.__line__ = line
self.__start__ = start
self.__finish__ = finish
self.__category__ = category
self.__reason__ = reason
@property
def word(self):
return self.__word__
@word.setter
def word(self, word):
self.__word__ = word
@property
def line(self):
return self.__line__
@line.setter
def line(self, line):
self.__line__ = line
@property
def start(self):
return self.__start__
@start.setter
def start(self, start):
self.__start__ = start
@property
def finish(self):
return self.__finish__
@finish.setter
def finish(self, finish):
self.__finish__ = finish
@property
def category(self):
return self.__category__
@category.setter
def category(self, category):
self.__category__ = category
@property
def reason(self):
return self.__reason__
@reason.setter
def reason(self, reason):
self.__reason__ = reason
| class Token:
def __init__(self, word, line, start, finish, category, reason=None):
self.__word__ = word
self.__line__ = line
self.__start__ = start
self.__finish__ = finish
self.__category__ = category
self.__reason__ = reason
@property
def word(self):
return self.__word__
@word.setter
def word(self, word):
self.__word__ = word
@property
def line(self):
return self.__line__
@line.setter
def line(self, line):
self.__line__ = line
@property
def start(self):
return self.__start__
@start.setter
def start(self, start):
self.__start__ = start
@property
def finish(self):
return self.__finish__
@finish.setter
def finish(self, finish):
self.__finish__ = finish
@property
def category(self):
return self.__category__
@category.setter
def category(self, category):
self.__category__ = category
@property
def reason(self):
return self.__reason__
@reason.setter
def reason(self, reason):
self.__reason__ = reason |
# Node types
TYPE_NODE = b'\x10'
TYPE_NODE_NR = b'\x11'
# Gateway types
TYPE_GATEWAY = b'\x20'
TYPE_GATEWAY_TIME = b'\x21'
# Special types
TYPE_PROVISIONING = b'\xFF' | type_node = b'\x10'
type_node_nr = b'\x11'
type_gateway = b' '
type_gateway_time = b'!'
type_provisioning = b'\xff' |
class Node:
def __init__(self, value):
self.value = value
self.next = None
# Have no idea how to do this
# import sys
# sys.path.insert(0, '../../data_structures')
# import node
def intersection(l1: Node, l2: Node) -> Node:
l1_end, len1 = get_tail(l1)
l2_end, len2 = get_tail(l2)
if l1_end != l2_end:
return None
if len1 > len2:
l1 = move_head(l1, len1 - len2)
else:
l2 = move_head(l2, len2 - len1)
while l1 != l2:
l1 = l1.next
l2 = l2.next
print(l1.value, l2.value)
return l1
def move_head(head: Node, pos: int) -> Node:
current = head
while pos > 0:
current = current.next
pos -= 1
return current
def get_tail(head: Node) -> (Node, int):
current = head
length = 0
while not current.next == None:
current = current.next
length += 1
return (current, length)
inter = Node('c')
inter.next = Node('a')
inter.next.next = Node('r')
l1 = Node('r')
l1.next = Node('a')
l1.next.next = Node('c')
l1.next.next.next = Node('e')
l1.next.next.next.next = inter
l2 = Node('r')
l2.next = Node('e')
l2.next.next = Node('d')
l2.next.next.next = inter
res = intersection(l1, l2)
print(res.value) | class Node:
def __init__(self, value):
self.value = value
self.next = None
def intersection(l1: Node, l2: Node) -> Node:
(l1_end, len1) = get_tail(l1)
(l2_end, len2) = get_tail(l2)
if l1_end != l2_end:
return None
if len1 > len2:
l1 = move_head(l1, len1 - len2)
else:
l2 = move_head(l2, len2 - len1)
while l1 != l2:
l1 = l1.next
l2 = l2.next
print(l1.value, l2.value)
return l1
def move_head(head: Node, pos: int) -> Node:
current = head
while pos > 0:
current = current.next
pos -= 1
return current
def get_tail(head: Node) -> (Node, int):
current = head
length = 0
while not current.next == None:
current = current.next
length += 1
return (current, length)
inter = node('c')
inter.next = node('a')
inter.next.next = node('r')
l1 = node('r')
l1.next = node('a')
l1.next.next = node('c')
l1.next.next.next = node('e')
l1.next.next.next.next = inter
l2 = node('r')
l2.next = node('e')
l2.next.next = node('d')
l2.next.next.next = inter
res = intersection(l1, l2)
print(res.value) |
# NAVI AND MATH
def power(base, exp):
res = 1
while exp>0:
if exp&1:
res = (res*base)%1000000007
exp = exp>>1
base = (base*base)%1000000007
return res%1000000007
mod = 1000000007
for i in range(int(input().strip())):
ans = "Case #" + str(i+1) + ': '
N = int(input().strip())
Arr = [int(a) for a in input().strip().split()]
mask = 3
maxx = -1
#ct = 0
while mask<(1<<N):
p = 0
sm = 0
ml = 1
#ct += 1
for j in range(0,N,1):
if mask&(1<<j):
sm += Arr[j]
ml = (ml*Arr[j])%mod
#print(Arr[j])
p = (ml*power(sm,mod-2))%mod
if maxx<p:
maxx = p
#print(maxx)
mask += 1
#print(ct)
ans += str(maxx)
print(ans)
| def power(base, exp):
res = 1
while exp > 0:
if exp & 1:
res = res * base % 1000000007
exp = exp >> 1
base = base * base % 1000000007
return res % 1000000007
mod = 1000000007
for i in range(int(input().strip())):
ans = 'Case #' + str(i + 1) + ': '
n = int(input().strip())
arr = [int(a) for a in input().strip().split()]
mask = 3
maxx = -1
while mask < 1 << N:
p = 0
sm = 0
ml = 1
for j in range(0, N, 1):
if mask & 1 << j:
sm += Arr[j]
ml = ml * Arr[j] % mod
p = ml * power(sm, mod - 2) % mod
if maxx < p:
maxx = p
mask += 1
ans += str(maxx)
print(ans) |
class Manifest:
def __init__(self, definition: dict):
self._definition = definition
def exists(self):
return self._definition is not None and self._definition != {}
def _resolve_node(self, name: str):
key = next((k for k in self._definition["nodes"].keys() if name == k.split(".")[-1]), None)
if key is None:
raise ValueError(
f"Could not find the ref {name} in the co-located dbt project."
" Please check the name in your dbt project."
)
return self._definition["nodes"][key]
def resolve_name(self, name: str):
node = self._resolve_node(name)
# return f"{node['database']}.{node['schema']}.{node['alias']}"
return f"{node['schema']}.{node['alias']}"
| class Manifest:
def __init__(self, definition: dict):
self._definition = definition
def exists(self):
return self._definition is not None and self._definition != {}
def _resolve_node(self, name: str):
key = next((k for k in self._definition['nodes'].keys() if name == k.split('.')[-1]), None)
if key is None:
raise value_error(f'Could not find the ref {name} in the co-located dbt project. Please check the name in your dbt project.')
return self._definition['nodes'][key]
def resolve_name(self, name: str):
node = self._resolve_node(name)
return f"{node['schema']}.{node['alias']}" |
load(":import_external.bzl", import_external = "import_external")
def dependencies():
import_external(
name = "commons_fileupload_commons_fileupload",
artifact = "commons-fileupload:commons-fileupload:1.4",
artifact_sha256 = "a4ec02336f49253ea50405698b79232b8c5cbf02cb60df3a674d77a749a1def7",
srcjar_sha256 = "2acfe29671daf8c94be5d684b8ac260d9c11f78611dff4899779b43a99205291",
excludes = [
"commons-io:commons-io",
],
)
| load(':import_external.bzl', import_external='import_external')
def dependencies():
import_external(name='commons_fileupload_commons_fileupload', artifact='commons-fileupload:commons-fileupload:1.4', artifact_sha256='a4ec02336f49253ea50405698b79232b8c5cbf02cb60df3a674d77a749a1def7', srcjar_sha256='2acfe29671daf8c94be5d684b8ac260d9c11f78611dff4899779b43a99205291', excludes=['commons-io:commons-io']) |
class Node:
props = ()
def __init__(self, **kwargs):
for prop in kwargs:
if prop not in self.props:
raise Exception('Invalid property %r, allowed only: %s' %
(prop, self.props))
self.__dict__[prop] = kwargs[prop]
for prop in self.props:
if prop not in self.__dict__:
self.__dict__[prop] = None
self.attrs = {}
def print_node(self, indent=0, indent_size=4,extra=0):
s = self.__class__.__name__
s += '(\n'
i = ' ' * (indent+indent_size)
for prop in self.props:
s += i + prop + ' = '
s += self._print_val(self.__dict__[prop], indent+indent_size, indent_size,
(len(prop) + 3) - indent_size)
s += '\n'
s += (' ' * (indent + extra)) + ')'
return s
def _print_val(self, val, indent, indent_size,extra=0):
if isinstance(val, Node):
return val.print_node(indent+indent_size,indent_size,extra)
elif type(val) == list:
s = '[\n'
i = ' ' * (indent+indent_size)
for e in val:
s += i + self._print_val(e, indent, indent_size)
s += ',\n'
s += (' ' * (indent+extra)) + ']'
return s
else:
return str(val)
class Statement(Node): pass
class Expression(Node): pass
class EmptyStatement(Statement): pass
EmptyStatement.INSTANCE = EmptyStatement()
class FunctionDeclaration(Statement): props = ('type', 'decl', 'body')
class Declaration(Statement): props = ('type', 'init')
class ParamDeclaration(Node): props = ('type', 'decl')
class StructTypeRef(Node): props = ('name',)
class DeclarationSpecifier(Node): props = ('store', 'qual', 'type')
class InitSpec(Node): props = ('decl', 'val')
class DeclaratorSpec(Node): props = ('pointer_depth', 'name_spec')
class ArrayDeclSpec(Node): props = ('name', 'dim')
class FuncDeclSpec(Node): props = ('name', 'params')
class VarArgs(Node): pass
VarArgs.INSTANCE = VarArgs()
class StructSpec(Node): props = ('name', 'decl')
class StructMemberDecl(Node): props = ('spec', 'decl')
class MemberReference(Node): props = ('child', 'idx', 'name')
class TypeName(Node): props = ('type', 'spec')
class LabelledStmt(Statement): props = ('label', 'stmt')
class WhileStmt(Statement): props = ('cond', 'body')
class DoWhileStmt(Statement): props = ('body', 'cond')
class ForStmt(Statement): props = ('init', 'cond', 'after', 'body')
class IfStmt(Statement): props = ('cond', 'true', 'false')
class SwitchStmt(Statement): props = ('expr', 'cases')
class ContinueStmt(Statement): pass
ContinueStmt.INSTANCE = ContinueStmt()
class BreakStmt(Statement): pass
BreakStmt.INSTANCE = BreakStmt()
class ReturnStmt(Statement): props = ('expr',)
class GotoStmt(Statement): props = ('label',)
class CaseStmt(Statement): props = ('choice', 'body')
class SyncStmt(Statement): pass
class ExpressionStmt(Statement): props = ('expr',)
class SizeofExpr(Expression): props = ('expr',)
class ConditionalExpr(Expression): props = ('cond', 'true', 'false')
class FunctionCallExpr(Expression): props = ('ref', 'args')
class IdentifierExpr(Expression): props = ('val',)
class AssignmentExpr(Expression): props = ('left', 'right')
class AssignmentOperatorExpr(Expression): props = ('left', 'op', 'right')
class UnaryExpr(Expression): props = ('op', 'expr')
class BinaryOperatorExpr(Expression): props = ('left', 'op', 'right')
class IncrementExpr(Expression): props = ('dir', 'post', 'expr')
class MemberAccessExpr(Expression): props = ('expr', 'prop', 'deref')
class ArraySubscriptExpr(Expression): props = ('expr', 'sub')
class Literal(Expression): props = ('val',)
class IntLiteral(Literal): pass
class StringLiteral(Literal): pass
class Pragma(Node): props = ('val',)
class Token:
class Type:
IDENTIFIER = 'identifier'
OPERATOR = 'operator'
NUMBER = 'number'
STRING = 'string'
def __init__(self, val, type=None):
self.val = val
self.type = type or Token.Type.OPERATOR
def __str__(self):
return 'Token(%r, %s)' % (self.val, self.type)
class Keyword(Token):
REGISTRY = {}
def __init__(self, val):
super().__init__(val, Token.Type.IDENTIFIER)
Keyword.REGISTRY[val] = self
Token.EOF = Token('<eof>')
Token.OPEN_PAREN = Token('(')
Token.CLOSE_PAREN = Token(')')
Token.OPEN_BRACE = Token('{')
Token.CLOSE_BRACE = Token('}')
Token.OPEN_SQUARE = Token('[')
Token.CLOSE_SQUARE = Token(']')
Token.COMMA = Token(',')
Token.SEMICOLON = Token(';')
Token.QUESTION = Token('?')
Token.COLON = Token(':')
Token.DOT = Token('.')
Token.ARROW = Token('->')
Token.VARARG = Token('...')
Token.OP_ASSIGN = Token('=')
Token.OP_MUL_ASSIGN = Token('*=')
Token.OP_DIV_ASSIGN = Token('/=')
Token.OP_MOD_ASSIGN = Token('%=')
Token.OP_PLUS_ASSIGN = Token('+=')
Token.OP_MINUS_ASSIGN = Token('-=')
Token.OP_LSHIFT_ASSIGN = Token('<<=')
Token.OP_RSHIFT_ASSIGN = Token('>>=')
Token.OP_AND_ASSIGN = Token('&=')
Token.OP_XOR_ASSIGN = Token('^=')
Token.OP_OR_ASSIGN = Token('|=')
Token.OP_PLUS = Token('+')
Token.OP_PLUS_PLUS = Token('++')
Token.OP_MINUS = Token('-')
Token.OP_MINUS_MINUS = Token('--')
Token.OP_STAR = Token('*')
Token.OP_DIV = Token('/')
Token.OP_MOD = Token('%')
Token.OP_AND = Token('&')
Token.OP_OR = Token('|')
Token.OP_AND_AND = Token('&&')
Token.OP_OR_OR = Token('||')
Token.OP_XOR = Token('^')
Token.OP_NOT = Token('!')
Token.OP_BITNOT = Token('~')
Token.OP_SHIFT_LEFT = Token('<<')
Token.OP_SHIFT_RIGHT = Token('>>')
Token.OP_EQUAL = Token('==')
Token.OP_NOT_EQUAL = Token('!=')
Token.OP_LESS_THAN = Token('<')
Token.OP_LESS_OR_EQUAL = Token('<=')
Token.OP_GREATER_THAN = Token('>')
Token.OP_GREATER_OR_EQUAL = Token('>=')
Keyword.DO = Keyword('do')
Keyword.WHILE = Keyword('while')
Keyword.FOR = Keyword('for')
Keyword.IF = Keyword('if')
Keyword.ELSE = Keyword('else')
Keyword.SIZEOF = Keyword('sizeof')
Keyword.SYNC = Keyword('sync')
Keyword.SWITCH = Keyword('switch')
Keyword.CASE = Keyword('case')
Keyword.DEFAULT = Keyword('default')
Keyword.GOTO = Keyword('goto')
Keyword.CONTINUE = Keyword('continue')
Keyword.BREAK = Keyword('break')
Keyword.RETURN = Keyword('return')
Keyword.CONST = Keyword('const')
Keyword.STATIC = Keyword('static')
Keyword.TYPEDEF = Keyword('typedef')
Keyword.STRUCT = Keyword('struct')
| class Node:
props = ()
def __init__(self, **kwargs):
for prop in kwargs:
if prop not in self.props:
raise exception('Invalid property %r, allowed only: %s' % (prop, self.props))
self.__dict__[prop] = kwargs[prop]
for prop in self.props:
if prop not in self.__dict__:
self.__dict__[prop] = None
self.attrs = {}
def print_node(self, indent=0, indent_size=4, extra=0):
s = self.__class__.__name__
s += '(\n'
i = ' ' * (indent + indent_size)
for prop in self.props:
s += i + prop + ' = '
s += self._print_val(self.__dict__[prop], indent + indent_size, indent_size, len(prop) + 3 - indent_size)
s += '\n'
s += ' ' * (indent + extra) + ')'
return s
def _print_val(self, val, indent, indent_size, extra=0):
if isinstance(val, Node):
return val.print_node(indent + indent_size, indent_size, extra)
elif type(val) == list:
s = '[\n'
i = ' ' * (indent + indent_size)
for e in val:
s += i + self._print_val(e, indent, indent_size)
s += ',\n'
s += ' ' * (indent + extra) + ']'
return s
else:
return str(val)
class Statement(Node):
pass
class Expression(Node):
pass
class Emptystatement(Statement):
pass
EmptyStatement.INSTANCE = empty_statement()
class Functiondeclaration(Statement):
props = ('type', 'decl', 'body')
class Declaration(Statement):
props = ('type', 'init')
class Paramdeclaration(Node):
props = ('type', 'decl')
class Structtyperef(Node):
props = ('name',)
class Declarationspecifier(Node):
props = ('store', 'qual', 'type')
class Initspec(Node):
props = ('decl', 'val')
class Declaratorspec(Node):
props = ('pointer_depth', 'name_spec')
class Arraydeclspec(Node):
props = ('name', 'dim')
class Funcdeclspec(Node):
props = ('name', 'params')
class Varargs(Node):
pass
VarArgs.INSTANCE = var_args()
class Structspec(Node):
props = ('name', 'decl')
class Structmemberdecl(Node):
props = ('spec', 'decl')
class Memberreference(Node):
props = ('child', 'idx', 'name')
class Typename(Node):
props = ('type', 'spec')
class Labelledstmt(Statement):
props = ('label', 'stmt')
class Whilestmt(Statement):
props = ('cond', 'body')
class Dowhilestmt(Statement):
props = ('body', 'cond')
class Forstmt(Statement):
props = ('init', 'cond', 'after', 'body')
class Ifstmt(Statement):
props = ('cond', 'true', 'false')
class Switchstmt(Statement):
props = ('expr', 'cases')
class Continuestmt(Statement):
pass
ContinueStmt.INSTANCE = continue_stmt()
class Breakstmt(Statement):
pass
BreakStmt.INSTANCE = break_stmt()
class Returnstmt(Statement):
props = ('expr',)
class Gotostmt(Statement):
props = ('label',)
class Casestmt(Statement):
props = ('choice', 'body')
class Syncstmt(Statement):
pass
class Expressionstmt(Statement):
props = ('expr',)
class Sizeofexpr(Expression):
props = ('expr',)
class Conditionalexpr(Expression):
props = ('cond', 'true', 'false')
class Functioncallexpr(Expression):
props = ('ref', 'args')
class Identifierexpr(Expression):
props = ('val',)
class Assignmentexpr(Expression):
props = ('left', 'right')
class Assignmentoperatorexpr(Expression):
props = ('left', 'op', 'right')
class Unaryexpr(Expression):
props = ('op', 'expr')
class Binaryoperatorexpr(Expression):
props = ('left', 'op', 'right')
class Incrementexpr(Expression):
props = ('dir', 'post', 'expr')
class Memberaccessexpr(Expression):
props = ('expr', 'prop', 'deref')
class Arraysubscriptexpr(Expression):
props = ('expr', 'sub')
class Literal(Expression):
props = ('val',)
class Intliteral(Literal):
pass
class Stringliteral(Literal):
pass
class Pragma(Node):
props = ('val',)
class Token:
class Type:
identifier = 'identifier'
operator = 'operator'
number = 'number'
string = 'string'
def __init__(self, val, type=None):
self.val = val
self.type = type or Token.Type.OPERATOR
def __str__(self):
return 'Token(%r, %s)' % (self.val, self.type)
class Keyword(Token):
registry = {}
def __init__(self, val):
super().__init__(val, Token.Type.IDENTIFIER)
Keyword.REGISTRY[val] = self
Token.EOF = token('<eof>')
Token.OPEN_PAREN = token('(')
Token.CLOSE_PAREN = token(')')
Token.OPEN_BRACE = token('{')
Token.CLOSE_BRACE = token('}')
Token.OPEN_SQUARE = token('[')
Token.CLOSE_SQUARE = token(']')
Token.COMMA = token(',')
Token.SEMICOLON = token(';')
Token.QUESTION = token('?')
Token.COLON = token(':')
Token.DOT = token('.')
Token.ARROW = token('->')
Token.VARARG = token('...')
Token.OP_ASSIGN = token('=')
Token.OP_MUL_ASSIGN = token('*=')
Token.OP_DIV_ASSIGN = token('/=')
Token.OP_MOD_ASSIGN = token('%=')
Token.OP_PLUS_ASSIGN = token('+=')
Token.OP_MINUS_ASSIGN = token('-=')
Token.OP_LSHIFT_ASSIGN = token('<<=')
Token.OP_RSHIFT_ASSIGN = token('>>=')
Token.OP_AND_ASSIGN = token('&=')
Token.OP_XOR_ASSIGN = token('^=')
Token.OP_OR_ASSIGN = token('|=')
Token.OP_PLUS = token('+')
Token.OP_PLUS_PLUS = token('++')
Token.OP_MINUS = token('-')
Token.OP_MINUS_MINUS = token('--')
Token.OP_STAR = token('*')
Token.OP_DIV = token('/')
Token.OP_MOD = token('%')
Token.OP_AND = token('&')
Token.OP_OR = token('|')
Token.OP_AND_AND = token('&&')
Token.OP_OR_OR = token('||')
Token.OP_XOR = token('^')
Token.OP_NOT = token('!')
Token.OP_BITNOT = token('~')
Token.OP_SHIFT_LEFT = token('<<')
Token.OP_SHIFT_RIGHT = token('>>')
Token.OP_EQUAL = token('==')
Token.OP_NOT_EQUAL = token('!=')
Token.OP_LESS_THAN = token('<')
Token.OP_LESS_OR_EQUAL = token('<=')
Token.OP_GREATER_THAN = token('>')
Token.OP_GREATER_OR_EQUAL = token('>=')
Keyword.DO = keyword('do')
Keyword.WHILE = keyword('while')
Keyword.FOR = keyword('for')
Keyword.IF = keyword('if')
Keyword.ELSE = keyword('else')
Keyword.SIZEOF = keyword('sizeof')
Keyword.SYNC = keyword('sync')
Keyword.SWITCH = keyword('switch')
Keyword.CASE = keyword('case')
Keyword.DEFAULT = keyword('default')
Keyword.GOTO = keyword('goto')
Keyword.CONTINUE = keyword('continue')
Keyword.BREAK = keyword('break')
Keyword.RETURN = keyword('return')
Keyword.CONST = keyword('const')
Keyword.STATIC = keyword('static')
Keyword.TYPEDEF = keyword('typedef')
Keyword.STRUCT = keyword('struct') |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.