content
stringlengths 7
1.05M
|
---|
numbers_of_electrons = int(input())
electrons = []
cell_number = 1
while numbers_of_electrons > 0:
possible_electrons = 2*cell_number**2
if possible_electrons > numbers_of_electrons:
electrons.append(numbers_of_electrons)
break
electrons.append(possible_electrons)
numbers_of_electrons -= possible_electrons
cell_number +=1
print(electrons)
|
# Jerry Landeros
def userInput():
number = int(input("Please enter a number: "))
return number
def primeChecker(number):
if number > 1:
for i in range(2, number):
if (number % i) == 0:
print(number, "is not a prime number.")
break
else:
print(number, "is a prime number.")
else:
print(number, "is not a prime number.")
# return aPrime, notPrime
pass
# def printResults(number):
# print(number, " is a prime number")
def repeat():
repeatProgram = input("Do you want to play again? (Y or N) ")
print("\n")
if repeatProgram.upper() == "Y":
pass
elif repeatProgram.upper() == "N":
print("Thank you for playing!")
quit()
# quit()
else:
print("Please enter Y or N.")
repeat()
def main():
while True:
number = userInput()
primeChecker(number)
# printResults(number)
repeat()
main()
|
def print_welcome():
return """
<h1>Hello world!</h1>
<p>
<h3>This API is intended for FoodExplorer application.</h2>
"""
def print_man():
return """
<h3>api/v1/food</h3>
<p>POST method</p>
<p>form data berisi image</p>
<h3>api/v1/food?q={query}</h3>
<p>GET method</p>
<p>search food using text</p>
<p>nyari pake query</p>
<h3>api/v1/food/all</h3>
<p>GET method</p>
<p>get all food in the database</p>
<p>ambil semua data</p>
<h3>api/v1/food/<int:food_id>/detail</h3>
<p>GET method</p>
<p>get food details based on id</p>
<p>pake path berupa id-nya food</p>
<h3>api/v1/food/<int:food_id>/location?latitude={latitude}&longitude={longitude}</h3>
<p>GET method</p>
<p>get food stores based on id</p>
<p>pake path berupa id-nya food</p>
"""
|
"""Solution to 2.7: Intersection."""
def intersect(list_one, list_two):
length_one = len(list_one)
length_two = len(list_two)
diff = abs(length_one - length_two)
head_one = list_one.head
head_two = list_two.head
while range(max(length_one, length_two)):
if diff > 0:
diff -= 1
if length_one > length_two:
head_one = head_one.next_node
else:
head_two = head_two.next_node
else:
if head_one is head_two:
return head_one
head_one = head_one.next_node
head_two = head_two.next_node
|
_base_ = [
'../_base_/models/deeplabv3_unet_s5-d16.py',
'./dataset.py', '../_base_/default_runtime.py',
'./schedule_20k.py'
]
model = dict(
decode_head=dict(
num_classes=2,loss_decode=dict(
_delete_=True, type='LovaszLoss', loss_weight=1.0, per_image=True)
# type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0, class_weight=[0.25, 0.25, 0.5])
),
# loss_decode=dict(
# _delete_=True, type='FocalDiceLoss', loss_weight=1.0, focal_weight=0.75)
# ),
auxiliary_head=dict(
num_classes=2,
loss_decode=dict(
_delete_=True, type='LovaszLoss', loss_weight=0.4, per_image=True)
# type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0, class_weight=[0.25, 0.25, 0.5])
),
# loss_decode=dict(
# _delete_=True, type='FocalDiceLoss', loss_weight=0.4, focal_weight=0.75)
# ),
test_cfg=dict(crop_size=(128, 128), stride=(85, 85)))
evaluation = dict(metric='mDice')
checkpoint_config = dict(max_keep_ckpts=5)
|
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n ) :
if ( n == 1 ) :
return True
i = 1
for i in range ( 1 , n ) :
if arr [ i - 1 ] < arr [ i ] :
if ( i == n ) :
return True
j = i
while ( arr [ j ] < arr [ j - 1 ] ) :
if ( i > 1 and arr [ j ] < arr [ i - 2 ] ) :
return False
j += 1
if ( j == n ) :
return True
k = j
if ( arr [ k ] < arr [ i - 1 ] ) :
return False
while ( k > 1 and k < n ) :
if ( arr [ k ] < arr [ k - 1 ] ) :
return False
k += 1
return True
#TOFILL
if __name__ == '__main__':
param = [
([1,2,5,4,3],5,),
([1,2,4,5,3],5,),
([1,1,0,0],4,),
([5, 99, 40, 33, 61, 4, 64, 92, 28, 27, 21, 35, 40, 79, 10, 20, 76, 87, 80, 15, 57, 39, 96, 98, 99, 72, 72, 50, 61, 39, 35, 70, 27],32,),
([-98, -92, -86, -58, -22, -12, 0, 26],6,),
([0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0],24,),
([6, 10, 27, 30, 40, 47, 49, 55, 59, 60, 68, 82, 91],8,),
([36, 56, -56, 94, 52, -82, 88, -62, 70, -94, 38, 10, -78, 66, -94, -72, 18, 96, -72, 88, -6, 48, 6, -88, 64, -96, -40, 8, 36, 36, -90, -68, -20, -76, 22, -92],30,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],31,),
([2, 5, 42, 28, 47, 26, 88, 16, 30, 30, 36, 49, 21, 95, 99, 21, 41, 52, 57, 39, 69, 2, 42, 22, 55, 92, 64, 27, 95, 71, 19, 38, 40, 65, 7, 21, 29, 38, 13, 11, 41, 54, 38, 40, 35, 51, 88],46,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param)))
|
# Maria O Sullivan
# Project Euler 5
# https://projecteuler.net/problem=5
i = 20
while 1:
i+=20
#i remainder 11 equals 0
if i%11==0 and i%12==0 and i%13==0 and i%14==0 and i%15==0\
and i%15==0 and i%16==0 and i%17==0 and i%18==0 and i%19==0:
print(i)
break
|
#
# Problem: Create a function that takes a message as a list of characters and reverses the order of the words
# in-place.
#
# For example:
# message = [ 'c', 'a', 'k', 'e', ' ',
# 'p', 'o', 'u', 'n', 'd', ' ',
# 's', 't', 'e', 'a', 'l' ]
#
# reverse_words(message)
#
# print ''.join(message) --- prints "steal pound cake"
#
def reverse_characters(chars, start_index, end_index):
while start_index < end_index:
chars[start_index], chars[end_index] = chars[end_index], chars[start_index]
start_index += 1
end_index -= 1
def reverse_words(chars):
"""
Solution: Reverse each character to get the words in the right order, then re-reverse each word.
Complexity:
Time: O(n) (twice)
Space: O(1)
"""
reverse_characters(chars, 0, len(chars) - 1)
start_index = 0
for i, char in enumerate(chars):
if char == ' ' or i == len(chars) - 1:
# If we find a space, set end index to previous index, otherwise we're at the end of our list
# and leave it at the last index
end_index = i - 1 if char == ' ' else i
reverse_characters(chars, start_index, end_index)
start_index = i + 1
|
"""
Copyright 2018 Akshit Grover
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
class ListenerCountReached(Exception):
def __init__(self, count = 0, event = ""):
self.__listenerCount = count
self.__eventName = event
def string(self):
return "\nListenerCountReached: Maximum Listener count '{}' reached for event '{}'\n".format(self.__listenerCount, self.__eventName)
pass
def errorHandler(err):
print(err.string())
|
class TreeNode:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def __repr__(self):
return str(self.data)
def insert(self, data):
"""
- If value is less then root node, find empty leaf and insert into left
- If value is greater than root node, find empty leaf and insert into right
:param data:
:return:
"""
if data:
if data < self.data:
if self.left is None:
print(f"{data} inserted into left side of {self.data}")
self.left = TreeNode(data=data)
else:
self.left.insert(data=data)
else:
if self.right is None:
print(f"{data} inserted into right side of {self.data}")
self.right = TreeNode(data=data)
else:
self.right.insert(data=data)
# Depth First Search
def inorder(root: TreeNode):
if root:
inorder(root.left)
print(root, end=" ")
inorder(root.right)
if __name__ == "__main__":
t = TreeNode(25)
t.insert(15)
t.insert(50)
t.insert(10)
t.insert(22)
t.insert(35)
t.insert(70)
t.insert(4)
t.insert(12)
t.insert(18)
t.insert(24)
t.insert(31)
t.insert(44)
t.insert(66)
t.insert(90)
inorder(t)
|
HTML_CODE_OPEN = "<code>"
HTML_CODE_CLOSE = "</code>"
HTML_NEW_LINE = "\n"
ETH_NULL_ADDRESS = '0x0000000000000000000000000000000000000000'
ETH_WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
question_data = [
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "The Neanderthals were a direct ancestor of modern humans.",
"correct_answer": "False", "incorrect_answers": ["True"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "The Doppler effect applies to light.", "correct_answer": "True",
"incorrect_answers": ["False"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "Chickens can live without a head.", "correct_answer": "True",
"incorrect_answers": ["False"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "The "Gympie Stinger" is the deadliest plant in the world.",
"correct_answer": "False", "incorrect_answers": ["True"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "Like with the Neanderthals, Homo sapiens sapiens also interbred with the Denisovans.",
"correct_answer": "True", "incorrect_answers": ["False"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "Type 1 diabetes is a result of the liver working improperly.",
"correct_answer": "False", "incorrect_answers": ["True"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "Anatomy considers the forms of macroscopic structures such as organs and organ systems.",
"correct_answer": "True", "incorrect_answers": ["False"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "In the periodic table, Potassium's symbol is the letter K.",
"correct_answer": "True", "incorrect_answers": ["False"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": "The most frequent subconscious activity repeated by the human body is blinking.",
"correct_answer": "False", "incorrect_answers": ["True"]},
{"category": "Science & Nature", "type": "boolean", "difficulty": "medium",
"question": ""Tachycardia" or "Tachyarrhythmia" refers to a resting heart-rate near or over 100 BPM.",
"correct_answer": "True", "incorrect_answers": ["False"]}
]
|
class User:
def __init__(self, guid, client):
self.guid = guid
self.client = client
def delete(self):
""" Delete this Cloud Foundry user """
# Delete from Cloud Controller
api_delete_endpoint = '/v2/users/%s' % self.guid
self.client.api_request(endpoint=api_delete_endpoint, method='delete')
# Delete from UAA
uaa_delete_endpoint = '/Users/%s' % self.guid
return self.client.uaa_request(
endpoint=uaa_delete_endpoint, method='delete'
)
def get_associated_workspace_for(self, role):
""" Returns the workspace for which the user have the stored role """
endpoint = "/v2/users/{0}/{1}".format(self.guid, role)
workspaces = self.client.api_request(endpoint=endpoint)
return workspaces.json()
def summary(self):
""" Returns the workspace for which the user have the stored role """
endpoint = "/v2/users/{0}/summary".format(self.guid)
return self.client.api_request(endpoint=endpoint).json()
|
# -*- coding: utf-8 -*-
class TrieNode:
def __init__(self):
self.children = {}
self.leaf = False
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
current = self.root
for char in word:
if char not in current.children:
current.children[char] = TrieNode()
current = current.children[char]
current.leaf = True
def search(self, word):
return self._search(word, self.root, False)
def _search(self, word, current, error):
for i, char in enumerate(word):
if not error:
for child in current.children:
if self._search(word[i + 1:], current.children[child], char != child):
return True
return False
elif error and char not in current.children:
return False
current = current.children[char]
return current.leaf and error
class MagicDictionary:
def __init__(self):
self.trie = Trie()
def buildDict(self, dict):
for word in dict:
self.trie.insert(word)
def search(self, word):
return self.trie.search(word)
if __name__ == '__main__':
obj = MagicDictionary()
obj.buildDict(['hello', 'leetcode'])
assert not obj.search('hello')
assert obj.search('hhllo')
assert not obj.search('hllo')
assert not obj.search('leetcoded')
obj.buildDict(['hello', 'hallo', 'hell', 'leetcoded'])
assert obj.search('hello')
assert obj.search('hhllo')
assert not obj.search('hllo')
assert not obj.search('leetcoded')
|
def yuvarlma(s):
return round(s+0.0000000001)
def odevHesaplama(v):
odev= 50+ v/2
return odev
def ortHesapla(v , o , f):
return v*0.3 + o *0.2 + f*0.5
vize = 60
odev = odevHesaplama(vize)
final = 45
print('Ödev :', odev)
print('Vize :', vize)
print('Final :', final)
ortalama = ortHesapla(vize,odev,final)
print('Ortalama :',ortalama)
print()
ortY = round(ortalama)
print('Yuvarlanmış Ortalama :', ortY)
ortY2 = yuvarlma(ortalama)
print()
print('Doğru Yuuvarlanmış Ortalama :', ortY2)
|
class Solution(object):
def countPoints(self, points, queries):
"""
:type points: List[List[int]]
:type queries: List[List[int]]
:rtype: List[int]
"""
qP = []
for q in queries:
count = 0
for p in points:
if(sqrt(pow(q[0] - p[0],2) + pow(q[1] - p[1], 2)) <= float(q[2])):
count += 1
qP.append(count)
return qP
|
class ActionRow:
def __init__(self, components: list):
self.base = {"type": 1, "components": [component.base for component in components]}
class SelectMenuOption:
def __init__(self, label: str, value, description: str ='', emoji: dict = {}):
self.base = {"label": label, "description": description, "value": value, "emoji":emoji}
class SelectMenu:
def __init__(self, custom_id, options):
self.base = {"type": 3, "custom_id": custom_id, "options": [opt.base for opt in options if isinstance(opt, SelectMenuOption)]}
class ButtonStyle:
PRIMARY = 1
SECONDARY = 2
SUCCESS = 3
DANGER = 4
LINK = 5
class Button:
def __init__(self, custom_id, style: int = ButtonStyle.PRIMARY, label: str = '', url: str = None, emoji: dict = None, disabled: bool = False):
self.base = {"type": 2, "style": style, "label": label, "custom_id": custom_id, "disabled": disabled}
if emoji is not None:
self.base['emoji'] = emoji
if style == ButtonStyle.LINK and url is not None:
self.base['url'] = url
|
class Node:
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
def __str__(self):
return f'<Node: ({self.key}, {self.value}, Next: {self.next})>'
def __repr__(self):
return str(self)
class Hash:
"""
Hash object class.
"""
def __init__(self):
self.buckets_capacity = 60
self.size = 0
self.buckets = [None] * self.buckets_capacity
def hash(self, key):
hash_sum = 0
# For each character in the key do this
# Add (index + length of key) ^ (current char code)
# Cap the hash_sum in range [0, self.buckets_capacity - 1]
for index, y in enumerate(key):
hash_sum += (index + len(key)) ** ord(y)
hash_sum = hash_sum % self.buckets_capacity
return hash_sum
def include(self, key, value):
"""
Include a new key-value pair in your already existing hash table.
Args:
- key (str): Any thing can be your key
- value (Any): Mention the value associated with your particular key
"""
index = self.hash(key)
node = self.buckets[index]
# If the bucket is empty then add the key, value pair
if node is None:
self.buckets[index] = Node(key, value)
return
prev = node
while node is not None:
prev = node
node = node.next
self.size += 1
prev.next = Node(key, value)
def searchFor(self, key):
"""
Search for a given key.
Args:
- key (str): Any thing can be your key. Mention the key you want to search for the value associated with it.
"""
index = self.hash(key)
node = self.buckets[index]
while node is not None and node.key != key:
node = node.next
if node is None:
return None
else:
return node.value
def removeFor(self, key):
"""
Remove value associated with some key.
Args:
- key (str): Mention the key for which you want to delete the value.
"""
index = self.hash(key)
node = self.buckets[index]
prev = None
# Go to the node for key in the args
while node is not None and node.key != key:
prev = node
node = node.next
if node is None:
return None
else:
# we found a key and now deleting the data
self.size -= 1
result = node.value
if prev is None:
self.buckets[index] = node.next
else:
prev.next = prev.next.next
return result
|
f_no = 1
s_no = 2
print(f_no)
print(s_no)
result = 2
while True:
t_no = f_no + s_no
if t_no >= 4000000:
break
if t_no % 2 == 0:
result += t_no # result = result + t_no
print(t_no)
f_no = s_no
s_no = t_no
print()
print("Sum of even numbers till 4000000 is ", result)
|
# @file Search in Rotated Sorted ArrayII
# @brief Given a sorted rotated array, search for target
# https://leetcode.com/problems/search-in-rotated-sorted-array-ii
'''
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Write a function to determine if a given target is in the array.
The array may contain duplicates.
'''
# avg time complexity: O(log n), worst case time complexity: O(n) - if everything is a duplicate
# space complexity: O(1)
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: bool
"""
b, e = 0, len(nums)-1
while b <= e:
mid = b + (e-b)/2
if nums[mid] == target:
return True
if nums[b] < nums[mid]:
if target >= nums[b] and target < nums[mid]:
e = mid - 1
else:
b = mid + 1
elif nums[mid] < nums[e]:
if target <= nums[e] and target >= nums[mid]:
b = mid + 1
else:
e = mid - 1
elif nums[b] != target:
b += 1
else:
e -= 1
return False
|
#Given a string and a non-negative int n, return a larger string that is n copies of the original string.
#string_times('Hi', 2) → 'HiHi'
#string_times('Hi', 3) → 'HiHiHi'
#string_times('Hi', 1) → 'Hi'
def string_times(string,n):
return string*n
|
class Bidict(dict):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.inverse = {}
for key, value in self.items():
self.inverse.setdefault(value, []).append(key)
def __setitem__(self, key, value):
if key in self:
self.inverse[self[key]].remove(key)
super().__setitem__(key, value)
self.inverse.setdefault(value, []).append(key)
def __delitem__(self, key):
self.inverse.setdefault(self[key], []).remove(key)
if self[key] in self.inverse and not self.inverse[self[key]]:
del self.inverse[self[key]]
super().__delitem__(key)
|
L=[]
for i in range(int(input())):
L.append([i+1]+list(map(int,input().split())))
L.sort(key = lambda t : t[3])
L.sort(key = lambda t : t[2])
L.sort(key = lambda t: 700-t[1])
print(L[0][0])
|
# ======================================================================
# Seating System
# Advent of Code 2020 Day 11 -- Eric Wastl -- https://adventofcode.com
#
# Python implementation by Dr. Dean Earl Wright III
# ======================================================================
# ======================================================================
# c o n w a y . p y
# ======================================================================
"A solver for the Advent of Code 2020 Day 11 puzzle"
# ----------------------------------------------------------------------
# import
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# constants
# ----------------------------------------------------------------------
FLOOR = '.'
EMPTY = 'L'
OCCUP = '#'
DELTA = [
(0, 1),
(1, 0),
(0, -1),
(-1, 0),
(1, 1),
(1, -1),
(-1, 1),
(-1, -1),
]
# ======================================================================
# Conway
# ======================================================================
class Conway(object): # pylint: disable=R0902, R0205
"Object for Seating System"
def __init__(self, text=None, part2=False):
# 1. Set the initial values
self.part2 = part2
self.text = text
self.rows = 0
self.cols = 0
self.rnds = 0
self.seats = set()
self.current = set()
self.previous = None
self.limit = 4
if part2:
self.limit = 5
# 2. Process text (if any)
if text is not None and len(text) > 0:
self.process_text(text)
def process_text(self, text):
"Get location of the seats"
self.rows = len(text)
self.cols = len(text[0])
self.seats = set()
for row, line in enumerate(text):
assert len(line) == self.cols
for col, space in enumerate(line):
if space == EMPTY:
self.seats.add((col, row))
def fill_all_seats(self):
"Butts in seats"
self.previous = set()
self.current = set()
for location in self.seats:
self.current.add(location)
self.rnds = 1
def count_occupied(self):
"Return total number of occupied seats"
return len(self.current)
def adjacent(self, loc):
"Return the number of adjacent occupied seats"
result = 0
for delta in DELTA:
if self.nearby(loc, delta):
result += 1
return result
def nearby(self, loc, delta):
"Returns True if the nearby seat is occupied"
# 1. Determine the adjacent location
nloc = (loc[0] + delta[0], loc[1] + delta[1])
# 2. Part one only cares about that location
if not self.part2:
return nloc in self.current
# 3. Part 2 takes a longer view
while self.in_bounds(nloc):
if nloc in self.current:
return True
if nloc in self.seats:
return False
nloc = (nloc[0] + delta[0], nloc[1] + delta[1])
return False
def in_bounds(self, loc):
"Returns True is location is in the seating area"
col, row = loc
if col < 0 or row < 0 or col >= self.cols or row >= self.rows:
return False
return True
def next_round(self):
"Ring a round the rosy"
# 1. Save the current status
self.previous = self.current.copy()
# 2. Start with a clean slate
nxt = set()
# 3. See if an occupied seat stays occupied
for loc in self.current:
if self.adjacent(loc) < self.limit:
nxt.add(loc)
# 4. See if an empty seat gets filled
for loc in self.seats:
if loc not in self.current:
if self.adjacent(loc) == 0:
nxt.add(loc)
# 5. Finish the round
self.current = nxt
self.rnds += 1
def unchanged(self):
"Returns True if there have been no changes in seating"
return self.current == self.previous
def run_until_no_change(self):
"Run the simulation until no change in seating and return the number of seats"
self.fill_all_seats()
while not self.unchanged():
self.next_round()
return self.count_occupied()
def __str__(self):
result = []
for row in range(self.rows):
line = []
for col in range(self.cols):
loc = (col, row)
if loc not in self.seats:
line.append(FLOOR)
elif loc in self.current:
line.append(OCCUP)
else:
line.append(EMPTY)
result.append(''.join(line))
return '\n'.join(result)
def part_one(self, verbose=False, limit=0):
"Returns the solution for part one"
# 1. Return the solution for part one
return self.run_until_no_change()
def part_two(self, verbose=False, limit=0):
"Returns the solution for part two"
# 1. Return the solution for part two
return self.run_until_no_change()
# ----------------------------------------------------------------------
# module initialization
# ----------------------------------------------------------------------
if __name__ == '__main__':
pass
# ======================================================================
# end c o n w a y . p y end
# ======================================================================
|
#
# PySNMP MIB module BENU-TWAG-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BENU-TWAG-STATS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:37:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection")
benuWAG, = mibBuilder.importSymbols("BENU-WAG-MIB", "benuWAG")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, Counter32, IpAddress, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Counter64, ObjectIdentity, iso, ModuleIdentity, TimeTicks, MibIdentifier, NotificationType, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Counter32", "IpAddress", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Counter64", "ObjectIdentity", "iso", "ModuleIdentity", "TimeTicks", "MibIdentifier", "NotificationType", "Integer32")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
benuTWagStatsMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7))
benuTWagStatsMIB.setRevisions(('2016-07-19 00:00', '2016-07-27 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: benuTWagStatsMIB.setRevisionsDescriptions(('Initial Version', 'Added counter bTWagPmip6DeletedDueToLmaInitBriMsg to indicate subs del by lma',))
if mibBuilder.loadTexts: benuTWagStatsMIB.setLastUpdated('201607270000Z')
if mibBuilder.loadTexts: benuTWagStatsMIB.setOrganization('Benu Networks,Inc')
if mibBuilder.loadTexts: benuTWagStatsMIB.setContactInfo('Benu Networks,Inc Corporate Headquarters 300 Concord Road, Suite 110 Billerica, MA 01821 USA Tel: +1 978-223-4700 Fax: +1 978-362-1908 Email: [email protected]')
if mibBuilder.loadTexts: benuTWagStatsMIB.setDescription('This MIB module defines statistics of Benu Wireless Access Gateway. Copyright (C) 2012 by Benu Networks, Inc. All rights reserved.')
bTWagNotifications = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 0))
if mibBuilder.loadTexts: bTWagNotifications.setStatus('current')
if mibBuilder.loadTexts: bTWagNotifications.setDescription('TWAG notifications are defined in this branch.')
bTWagS2aSubscriberMIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1))
if mibBuilder.loadTexts: bTWagS2aSubscriberMIBObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubscriberMIBObjects.setDescription('TWAG S2a subscriber statistics are defined in this branch.')
bTWagS2aSubscriberNotifObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 2))
if mibBuilder.loadTexts: bTWagS2aSubscriberNotifObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubscriberNotifObjects.setDescription('Notifications of TWAG S2a subscriber statistics are defined in this branch.')
bTWagS2aStatsMIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3))
if mibBuilder.loadTexts: bTWagS2aStatsMIBObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aStatsMIBObjects.setDescription('TWAG s2a interface statistics are defined in this branch.')
bTWagS2aNotifObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 4))
if mibBuilder.loadTexts: bTWagS2aNotifObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aNotifObjects.setDescription('Notifications of TWAG s2a interface statistics are defined in this branch.')
bTWagGTPStatsMIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 5))
if mibBuilder.loadTexts: bTWagGTPStatsMIBObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPStatsMIBObjects.setDescription('TWAG GTP statistics are defined in this branch.')
bTWagGTPNotifObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 6))
if mibBuilder.loadTexts: bTWagGTPNotifObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPNotifObjects.setDescription('Notifications of TWAG GTP statistics are defined in this branch.')
bTWagGnGpSubscriberMIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7))
if mibBuilder.loadTexts: bTWagGnGpSubscriberMIBObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubscriberMIBObjects.setDescription('TWAG GnGp subscriber statistics are defined in this branch.')
bTWagGnGpSubscriberNotifObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 8))
if mibBuilder.loadTexts: bTWagGnGpSubscriberNotifObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubscriberNotifObjects.setDescription('Notifications of TWAG GnGp subscriber statistics are defined in this branch.')
bTWagGnGpStatsMIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9))
if mibBuilder.loadTexts: bTWagGnGpStatsMIBObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpStatsMIBObjects.setDescription('TWAG GnGp interface statistics are defined in this branch.')
bTWagGnGpNotifObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 10))
if mibBuilder.loadTexts: bTWagGnGpNotifObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpNotifObjects.setDescription('Notifications of TWAG GnGp interface statistics are defined in this branch.')
bTWagPmip6MIBObjects = ObjectIdentity((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11))
if mibBuilder.loadTexts: bTWagPmip6MIBObjects.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6MIBObjects.setDescription('TWAG Pmip6 statistics are defined in this branch.')
bTWagGTPCurrentNumOfTunnels = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 5, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGTPCurrentNumOfTunnels.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPCurrentNumOfTunnels.setDescription('The current number of GTP Tunnels.')
bTWagNumCurrentSecureSSIDS2aSubscribers = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagNumCurrentSecureSSIDS2aSubscribers.setStatus('current')
if mibBuilder.loadTexts: bTWagNumCurrentSecureSSIDS2aSubscribers.setDescription('The current number of 802.1x subscribers.')
bTWagNumPreAuthenticatedS2aSubscribers = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagNumPreAuthenticatedS2aSubscribers.setStatus('current')
if mibBuilder.loadTexts: bTWagNumPreAuthenticatedS2aSubscribers.setDescription('The total number of pre-authenticated subscribers.')
bTWagNumCurrentSecureSSIDGnGpSubscribers = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagNumCurrentSecureSSIDGnGpSubscribers.setStatus('current')
if mibBuilder.loadTexts: bTWagNumCurrentSecureSSIDGnGpSubscribers.setDescription('The current number of 802.1x subscribers.')
bTWagNumPreAuthenticatedGnGpSubscribers = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagNumPreAuthenticatedGnGpSubscribers.setStatus('current')
if mibBuilder.loadTexts: bTWagNumPreAuthenticatedGnGpSubscribers.setDescription('The total number of pre-authenticated subscribers.')
bTWagNumPreAuthenticatedPmip6Subscribers = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagNumPreAuthenticatedPmip6Subscribers.setStatus('current')
if mibBuilder.loadTexts: bTWagNumPreAuthenticatedPmip6Subscribers.setDescription('The current total number of pre-authenticated subscribers.')
bTWagNumGrePmip6Tunnels = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagNumGrePmip6Tunnels.setStatus('current')
if mibBuilder.loadTexts: bTWagNumGrePmip6Tunnels.setDescription('The current total number of Gre Pmip6 tunnels.')
bTWagPmip6StatsTable = MibTable((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3), )
if mibBuilder.loadTexts: bTWagPmip6StatsTable.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6StatsTable.setDescription('A list of TWAG Pmip6 statistics.')
bTWagPmip6StatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1), ).setIndexNames((0, "BENU-TWAG-STATS-MIB", "bTWagPmip6StatsInterval"))
if mibBuilder.loadTexts: bTWagPmip6StatsEntry.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6StatsEntry.setDescription('A logical row in the bTWagPmip6StatsTable.')
bTWagPmip6StatsInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 1), Integer32())
if mibBuilder.loadTexts: bTWagPmip6StatsInterval.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6StatsInterval.setDescription('The interval during which the measurements are accumlated. Interval index 1 indicates the latest interval for which statistics accumulation is completed. Older the statistics, greater the interval index value. In a system supporting a history of n intervals with interval count 1 and interval count n, the most and the least recent intervals respectively, the following apply at the end of an interval: - statistics for interval count n are discarded - the statistics for interval count i become statistics for interval count i + 1, where 1 <= i < n - current statistics become statistics for interval count 1.')
bTWagPmip6IntervalDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6IntervalDuration.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6IntervalDuration.setDescription('Duration of statistics interval (or reporting period) in minutes')
bTWagPmip6TotalPacketsRxvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalPacketsRxvd.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalPacketsRxvd.setDescription('The total number of Pmip6 packets received')
bTWagPmip6TotalPacketsRxvdError = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalPacketsRxvdError.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalPacketsRxvdError.setDescription('The total number of Pmip6 error packets received')
bTWagPmip6TotalPacketHeaderDecodeError = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalPacketHeaderDecodeError.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalPacketHeaderDecodeError.setDescription('The total number of Pmip6 packet header decode errors')
bTWagPmip6TotalPbuSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalPbuSent.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalPbuSent.setDescription('The total number of Pmip6 proxy binding update packets sent')
bTWagPmip6TotalPbuSendError = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalPbuSendError.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalPbuSendError.setDescription('The total number of Pmip6 proxy binding update packets send error')
bTWagPmip6TotalPbaReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalPbaReceived.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalPbaReceived.setDescription('The total number of Pmip6 proxy binding ack packets received ')
bTWagPmip6TotalBriReceived = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalBriReceived.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalBriReceived.setDescription('The total number of Pmip6 binding revocation indication packets received')
bTWagPmip6TotalBraSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6TotalBraSent.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6TotalBraSent.setDescription('The total number of Pmip6 binding revocation ack packets sent')
bTWagPmip6HeartBeatReqSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6HeartBeatReqSent.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6HeartBeatReqSent.setDescription('The total number of Pmip6 heartbeat request sent')
bTWagPmip6HeartBeatRspSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6HeartBeatRspSent.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6HeartBeatRspSent.setDescription('The total number of Pmip6 heartbeat response sent')
bTWagPmip6HeartBeatReqRestartCountMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6HeartBeatReqRestartCountMismatch.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6HeartBeatReqRestartCountMismatch.setDescription('The total number of Pmip6 heartbeat request restart counter mismatch')
bTWagPmip6HeartBeatReqSeqMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6HeartBeatReqSeqMismatch.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6HeartBeatReqSeqMismatch.setDescription('The total number of Pmip6 heartbeat request restart sequence mismatch')
bTWagPmip6DeletedDueToLmaInitBriMsg = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 11, 3, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPmip6DeletedDueToLmaInitBriMsg.setStatus('current')
if mibBuilder.loadTexts: bTWagPmip6DeletedDueToLmaInitBriMsg.setDescription('The total number of Pmip6 subscribers deleted due to Lma initiated Bri message')
bTWagS2aSubscriberTable = MibTable((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3), )
if mibBuilder.loadTexts: bTWagS2aSubscriberTable.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubscriberTable.setDescription('A list of TWAG S2a subscriber statistics.')
bTWagS2aSubscriberEntry = MibTableRow((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1), ).setIndexNames((0, "BENU-TWAG-STATS-MIB", "bTWagS2aSubsStatsInterval"))
if mibBuilder.loadTexts: bTWagS2aSubscriberEntry.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubscriberEntry.setDescription('A logical row in the bTWagS2aSubscriberTable.')
bTWagS2aSubsStatsInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 1), Integer32())
if mibBuilder.loadTexts: bTWagS2aSubsStatsInterval.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsStatsInterval.setDescription('The interval during which the measurements are accumlated. Interval index 1 indicates the latest interval for which statistics accumulation is completed. Older the statistics, greater the interval index value. In a system supporting a history of n intervals with interval count 1 and interval count n, the most and the least recent intervals respectively, the following apply at the end of an interval: - statistics for interval count n are discarded - the statistics for interval count i become statistics for interval count i + 1, where 1 <= i < n - current statistics become statistics for interval count 1.')
bTWagS2aSubsIntervalDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsIntervalDuration.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsIntervalDuration.setDescription('Duration of statistics interval (or reporting period) in minutes')
bTWagSecureSSIDS2aSubsAdded = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagSecureSSIDS2aSubsAdded.setStatus('current')
if mibBuilder.loadTexts: bTWagSecureSSIDS2aSubsAdded.setDescription('The total number of secure SSID S2a subscribers added')
bTWagPreAuthenticatedS2aSubsAdded = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPreAuthenticatedS2aSubsAdded.setStatus('current')
if mibBuilder.loadTexts: bTWagPreAuthenticatedS2aSubsAdded.setDescription('The total number of pre authenticated S2a subscribers added')
bTWagS2aSubsDeletionsByDMinitiatedByPGW = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsDeletionsByDMinitiatedByPGW.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsDeletionsByDMinitiatedByPGW.setDescription('The total number of S2a subscribers deleted due to PGW initiated Disconnect Message')
bTWagS2aSubsGtpSessionCreateFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsGtpSessionCreateFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsGtpSessionCreateFailed.setDescription('The total number of S2a GTP subscriber session creation failed')
bTWagS2aSubsCSRQSendFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsCSRQSendFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsCSRQSendFailed.setDescription('The total number of CSRQ message send failed for S2a subscribers.')
bTWagS2aSubsInvalidGtpVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsInvalidGtpVersion.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsInvalidGtpVersion.setDescription('The total number of subscribers encountered with invalid GTP version')
bTWagS2aSubsRadiusMissingMandatoryParams = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusMissingMandatoryParams.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusMissingMandatoryParams.setDescription('The total number of subscribers with missing mandatory params in radius messages. ')
bTWagS2aSubsRadiusInvalidPGWIPAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusInvalidPGWIPAddr.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusInvalidPGWIPAddr.setDescription('The total number of subscriber with invalid PGW IP address in radius messages. ')
bTWagS2aSubsRadiusMSISDN = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusMSISDN.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusMSISDN.setDescription('The total number of subscriber with MSISDN received in radius messages. ')
bTWagS2aSubsRadiusQoSProfile = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusQoSProfile.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusQoSProfile.setDescription('The total number of subscriber with QoS Profile received in radius messages. ')
bTWagS2aSubsRadiusGBRQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusGBRQoS.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusGBRQoS.setDescription('The total number of subscriber with GBRQoS received in radius messages. ')
bTWagS2aSubsRadiusNonGBRQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusNonGBRQoS.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusNonGBRQoS.setDescription('The total number of subscriber with NonGBRQoS received in radius messages. ')
bTWagS2aSubsGtpIPAddFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 16), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsGtpIPAddFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsGtpIPAddFailed.setDescription('The total number of subscriber for whom GTP IP Add failed ')
bTWagS2aSubsRadiusEapAkaHash = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 1, 3, 1, 17), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSubsRadiusEapAkaHash.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSubsRadiusEapAkaHash.setDescription('The total number of subscriber authenticated via EAP-AKA HASH')
bTWagS2aTable = MibTable((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1), )
if mibBuilder.loadTexts: bTWagS2aTable.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aTable.setDescription('A list of TWAG S2a interface statistics.')
bTWagS2aEntry = MibTableRow((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1), ).setIndexNames((0, "BENU-TWAG-STATS-MIB", "bTWagS2aStatsInterval"))
if mibBuilder.loadTexts: bTWagS2aEntry.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aEntry.setDescription('A logical row in the bTWagS2aTable.')
bTWagS2aStatsInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 1), Integer32())
if mibBuilder.loadTexts: bTWagS2aStatsInterval.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aStatsInterval.setDescription('The interval during which the measurements are accumlated. Interval index 1 indicates the latest interval for which statistics accumulation is completed. Older the statistics, greater the interval index value. In a system supporting a history of n intervals with interval count 1 and interval count n, the most and the least recent intervals respectively, the following apply at the end of an interval: - statistics for interval count n are discarded - the statistics for interval count i become statistics for interval count i + 1, where 1 <= i < n - current statistics become statistics for interval count 1.')
bTWagS2aIntervalDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aIntervalDuration.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aIntervalDuration.setDescription('Duration of statistics accumulation interval in minutes.')
bTWagS2aSessCreateReqSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessCreateReqSent.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessCreateReqSent.setDescription('The total number of Create Session Requests(CSRQ) initiated by the TWAG during the measurement interval.')
bTWagS2aSessCreateRespRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessCreateRespRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessCreateRespRcvd.setDescription('The total number of Create Session Responses(CSRP) received by the TWAG during the measurement interval.')
bTWagS2aSessCreateRespAccepted = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessCreateRespAccepted.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessCreateRespAccepted.setDescription('The total number of Create Session Responses with cause REQUEST_ACCEPTED received by the TWAG during the measurement interval.')
bTWagS2aSessCreateRespRej = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessCreateRespRej.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessCreateRespRej.setDescription('The total number of Create Session Responses with cause REJECT received by the TWAG during the measurement interval.')
bTWagS2aSessDelReqSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessDelReqSent.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessDelReqSent.setDescription('The total number of Delete Session Requests initiated by the TWAG during the measurement interval.')
bTWagS2aSessDelRespRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessDelRespRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessDelRespRcvd.setDescription('The total number of delete Session Response messages received during measurement interval.')
bTWagS2aSessDelRespRejRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aSessDelRespRejRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aSessDelRespRejRcvd.setDescription('The total number of delete Session Response messages received with cause REJECT during measurement interval.')
bTWagS2aDBRQRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aDBRQRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aDBRQRcvd.setDescription('The total number of Delete Bearer Request(DBRQ) messages received during measurement interval.')
bTWagS2aDBRPSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aDBRPSent.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aDBRPSent.setDescription('The total number of Delete Bearer Response(DBRP) messages sent during measurement interval.')
bTWagS2aCBRQRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aCBRQRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aCBRQRcvd.setDescription('The total number of Create Bearer Request(CBRQ) messages received during measurement interval.')
bTWagS2aCBRPSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aCBRPSent.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aCBRPSent.setDescription('The total number of Create Bearer Response(CBRP) messages sent during measurement interval.')
bTWagS2aUBRQRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aUBRQRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aUBRQRcvd.setDescription('The total number of Update Bearer Request(UBRQ) messages received during measurement interval.')
bTWagS2aUBRPSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 3, 1, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagS2aUBRPSent.setStatus('current')
if mibBuilder.loadTexts: bTWagS2aUBRPSent.setDescription('The total number of Update Bearer Response(UBRP) messages sent during measurement interval.')
bTWagGnGpSubscriberTable = MibTable((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3), )
if mibBuilder.loadTexts: bTWagGnGpSubscriberTable.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubscriberTable.setDescription('A list of TWAG subscriber statistics.')
bTWagGnGpSubscriberEntry = MibTableRow((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1), ).setIndexNames((0, "BENU-TWAG-STATS-MIB", "bTWagGnGpSubsStatsInterval"))
if mibBuilder.loadTexts: bTWagGnGpSubscriberEntry.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubscriberEntry.setDescription('A logical row in the bTWagGnGpSubscriberTable.')
bTWagGnGpSubsStatsInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 1), Integer32())
if mibBuilder.loadTexts: bTWagGnGpSubsStatsInterval.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsStatsInterval.setDescription('The interval during which the measurements are accumlated. Interval index 1 indicates the latest interval for which statistics accumulation is completed. Older the statistics, greater the interval index value. In a system supporting a history of n intervals with interval count 1 and interval count n, the most and the least recent intervals respectively, the following apply at the end of an interval: - statistics for interval count n are discarded - the statistics for interval count i become statistics for interval count i + 1, where 1 <= i < n - current statistics become statistics for interval count 1.')
bTWagGnGpSubsIntervalDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsIntervalDuration.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsIntervalDuration.setDescription('Duration of statistics interval (or reporting period) in minutes')
bTWagSecureSSIDGnGpSubsAdded = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagSecureSSIDGnGpSubsAdded.setStatus('current')
if mibBuilder.loadTexts: bTWagSecureSSIDGnGpSubsAdded.setDescription('The total number of secure SSID GnGp subscribers added')
bTWagPreAuthenticatedGnGpSubsAdded = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagPreAuthenticatedGnGpSubsAdded.setStatus('current')
if mibBuilder.loadTexts: bTWagPreAuthenticatedGnGpSubsAdded.setDescription('The total number of pre authenticated GnGp subscribers added')
bTWagGnGpSubsDeletionsByDMinitiatedByGGSN = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsDeletionsByDMinitiatedByGGSN.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsDeletionsByDMinitiatedByGGSN.setDescription('The total number of GnGp subscribers deleted due to GGSN initiated Disconnect Message')
bTWagGnGpSubsGtpSessionCreateFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsGtpSessionCreateFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsGtpSessionCreateFailed.setDescription('The total number of GnGp GTP subscriber session creation failed')
bTWagGnGpSubsCPCRQSendFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsCPCRQSendFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsCPCRQSendFailed.setDescription('The total number of CSRQ message send failed for GnGp subscribers.')
bTWagGnGpSubsPDPCtxSendFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsPDPCtxSendFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsPDPCtxSendFailed.setDescription('The total number of CPCQ QoS message send failed for GnGp subscribers.')
bTWagGnGpSubsInvalidGtpVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsInvalidGtpVersion.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsInvalidGtpVersion.setDescription('The total number of subscribers encountered with invalid GTP version')
bTWagGnGpSubsRadiusMissingMandatoryParams = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusMissingMandatoryParams.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusMissingMandatoryParams.setDescription('The total number of subscribers with missing mandatory params in radius messages. ')
bTWagGnGpSubsRadiusInvalidGGSNIPAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusInvalidGGSNIPAddr.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusInvalidGGSNIPAddr.setDescription('The total number of subscriber with invalid PGW IP address in radius messages. ')
bTWagGnGpSubsRadiusMSISDN = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusMSISDN.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusMSISDN.setDescription('The total number of subscriber with MSISDN received in radius messages. ')
bTWagGnGpSubsRadiusQoSProfile = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusQoSProfile.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusQoSProfile.setDescription('The total number of subscriber with QoS Profile received in radius messages. ')
bTWagGnGpSubsRadiusGBRQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusGBRQoS.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusGBRQoS.setDescription('The total number of subscriber with GBRQoS received in radius messages. ')
bTWagGnGpSubsRadiusNonGBRQoS = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusNonGBRQoS.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusNonGBRQoS.setDescription('The total number of subscriber with NonGBRQoS received in radius messages. ')
bTWagGnGpSubsGtpIPAddFailed = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 16), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsGtpIPAddFailed.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsGtpIPAddFailed.setDescription('The total number of subscriber for whom GTP IP Add failed ')
bTWagGnGpSubsRadiusEapAkaHash = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 7, 3, 1, 17), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusEapAkaHash.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpSubsRadiusEapAkaHash.setDescription('The total number of subscriber authenticated via EAP-AKA HASH')
bTWagGnGpTable = MibTable((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1), )
if mibBuilder.loadTexts: bTWagGnGpTable.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpTable.setDescription('A list of TWAG GnGp interface statistics.')
bTWagGnGpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1), ).setIndexNames((0, "BENU-TWAG-STATS-MIB", "bTWagGnGpStatsInterval"))
if mibBuilder.loadTexts: bTWagGnGpEntry.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpEntry.setDescription('A logical row in the bTWagGnGpTable.')
bTWagGnGpStatsInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 1), Integer32())
if mibBuilder.loadTexts: bTWagGnGpStatsInterval.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpStatsInterval.setDescription('The interval during which the measurements are accumlated. Interval index 1 indicates the latest interval for which statistics accumulation is completed. Older the statistics, greater the interval index value. In a system supporting a history of n intervals with interval count 1 and interval count n, the most and the least recent intervals respectively, the following apply at the end of an interval: - statistics for interval count n are discarded - the statistics for interval count i become statistics for interval count i + 1, where 1 <= i < n - current statistics become statistics for interval count 1.')
bTWagGnGpIntervalDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpIntervalDuration.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpIntervalDuration.setDescription('Duration of statistics accumulation interval in minutes.')
bTWagGnGpCPCRQSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpCPCRQSent.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpCPCRQSent.setDescription('The total number of Create PDP Context requests(CPCRQ) initiated by the TWAG during the measurement interval.')
bTWagGnGpCPCRPRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpCPCRPRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpCPCRPRcvd.setDescription('The total number of Create PDP Context Responses(CPCRP) received by the TWAG during the measurement interval.')
bTWagGnGpCPCRPAccepted = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpCPCRPAccepted.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpCPCRPAccepted.setDescription('The total number of Create PDP Context Responses(CPCRP) with cause REQUEST_ACCEPTED received by the TWAG during the measurement interval.')
bTWagGnGpCPCRPRej = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 6), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpCPCRPRej.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpCPCRPRej.setDescription('The total number of Create PDP Context Responses(CPCRP) with cause REJECT received by the TWAG during the measurement interval.')
bTWagGnGpDPCRQSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpDPCRQSent.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpDPCRQSent.setDescription('The total number of Delete PDP Context Requests(DPCRQ) initiated by the TWAG during the measurement interval.')
bTWagGnGpDPCRPRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpDPCRPRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpDPCRPRcvd.setDescription('The total number of Delete PDP Context Response(DPCRP) messages received during measurement interval.')
bTWagGnGpDPCRPRejRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpDPCRPRejRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpDPCRPRejRcvd.setDescription('The total number of Delete PDP Context Response(DPCRP) messages received with cause REJECT during measurement interval.')
bTWagGnGpDPCRQRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpDPCRQRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpDPCRQRcvd.setDescription('The total number of Delete PDP Context Request(DPCRQ) messages received during measurement interval.')
bTWagGnGpDPCRPSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpDPCRPSent.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpDPCRPSent.setDescription('The total number of Delete PDP Context Response(DPCRP) messages sent during measurement interval.')
bTWagGnGpCPCRQRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpCPCRQRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpCPCRQRcvd.setDescription('The total number of Create PDP Context Request(CPCRQ) messages received during measurement interval.')
bTWagGnGpCPCRPSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpCPCRPSent.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpCPCRPSent.setDescription('The total number of Create PDP Context Response(CPCRP) messages sent during measurement interval.')
bTWagGnGpUPCRQRcvd = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpUPCRQRcvd.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpUPCRQRcvd.setDescription('The total number of Update PDP Conetxt Request(UPCRQ) messages received during measurement interval.')
bTWagGnGpUPCRPSent = MibTableColumn((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 9, 1, 1, 15), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bTWagGnGpUPCRPSent.setStatus('current')
if mibBuilder.loadTexts: bTWagGnGpUPCRPSent.setDescription('The total number of Update PDP Context Response(UPCRP) messages sent during measurement interval.')
bTWagGTPMaxNumOfTunnels = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 6, 1), Unsigned32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: bTWagGTPMaxNumOfTunnels.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPMaxNumOfTunnels.setDescription('Max Number of GTP-U that can exist at a given time. Any new GTP-U request beyond this number will be rejected')
bTWagGTPHighThreshold = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 6, 2), Unsigned32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: bTWagGTPHighThreshold.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPHighThreshold.setDescription('The high threshold for number of GTP-U that can exist at any given time . If a bTWagGTPLowThresholdReached event has been generated , and the value number of GTP-U in use has exceeded the value of bTWagGTPHighThreshold, then a bTWagGTPHighThresholdReached event will be generated. No more bTWagGTPHighThresholdReached events will be generated until the value for number of tunnels in use becomes equal to or less than the value of bTWagGTPLowThreshold.')
bTWagGTPLowThreshold = MibScalar((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 6, 3), Unsigned32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: bTWagGTPLowThreshold.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPLowThreshold.setDescription('The Lower threshold for number of GTP-U that can exist at any given time . If a bTWagGTPHighThresholdReached event has been generated , and the value number of tunnels in use falls below the value of bTWagGTPLowThreshold, then a bTWagGTPLowThresholdReached event will be generated. No more bTWagGTPLowThresholdReached events will be generated until the value for number of tunnels in use becomes equal to or greater than the value of bTWagGTPHighThreshold.')
bTWagGTPHighThresholdReached = NotificationType((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 0, 1)).setObjects(("BENU-TWAG-STATS-MIB", "bTWagGTPMaxNumOfTunnels"), ("BENU-TWAG-STATS-MIB", "bTWagGTPHighThreshold"))
if mibBuilder.loadTexts: bTWagGTPHighThresholdReached.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPHighThresholdReached.setDescription('This notification signifies that the current number of GTP-U has risen above the value of bTWagGTPHighThreshold.')
bTWagGTPLowThresholdReached = NotificationType((1, 3, 6, 1, 4, 1, 39406, 2, 1, 7, 0, 2)).setObjects(("BENU-TWAG-STATS-MIB", "bTWagGTPMaxNumOfTunnels"), ("BENU-TWAG-STATS-MIB", "bTWagGTPLowThreshold"))
if mibBuilder.loadTexts: bTWagGTPLowThresholdReached.setStatus('current')
if mibBuilder.loadTexts: bTWagGTPLowThresholdReached.setDescription('This notification signifies that the current number of GTP-U has fallen below the value of bTWagGTPLowThreshold.')
mibBuilder.exportSymbols("BENU-TWAG-STATS-MIB", bTWagPmip6HeartBeatReqSent=bTWagPmip6HeartBeatReqSent, bTWagGnGpUPCRQRcvd=bTWagGnGpUPCRQRcvd, bTWagS2aSubsGtpIPAddFailed=bTWagS2aSubsGtpIPAddFailed, bTWagS2aSubscriberNotifObjects=bTWagS2aSubscriberNotifObjects, bTWagGnGpSubsRadiusMSISDN=bTWagGnGpSubsRadiusMSISDN, bTWagPmip6TotalPacketsRxvd=bTWagPmip6TotalPacketsRxvd, bTWagNotifications=bTWagNotifications, bTWagGnGpSubsDeletionsByDMinitiatedByGGSN=bTWagGnGpSubsDeletionsByDMinitiatedByGGSN, bTWagSecureSSIDGnGpSubsAdded=bTWagSecureSSIDGnGpSubsAdded, bTWagS2aSubsRadiusMissingMandatoryParams=bTWagS2aSubsRadiusMissingMandatoryParams, bTWagGnGpSubsRadiusQoSProfile=bTWagGnGpSubsRadiusQoSProfile, bTWagNumPreAuthenticatedS2aSubscribers=bTWagNumPreAuthenticatedS2aSubscribers, bTWagGnGpDPCRPSent=bTWagGnGpDPCRPSent, bTWagPmip6TotalPbaReceived=bTWagPmip6TotalPbaReceived, bTWagS2aSessDelReqSent=bTWagS2aSessDelReqSent, bTWagS2aSubsRadiusQoSProfile=bTWagS2aSubsRadiusQoSProfile, bTWagGnGpNotifObjects=bTWagGnGpNotifObjects, bTWagPmip6TotalPbuSendError=bTWagPmip6TotalPbuSendError, bTWagNumPreAuthenticatedPmip6Subscribers=bTWagNumPreAuthenticatedPmip6Subscribers, bTWagGTPCurrentNumOfTunnels=bTWagGTPCurrentNumOfTunnels, bTWagS2aSubsDeletionsByDMinitiatedByPGW=bTWagS2aSubsDeletionsByDMinitiatedByPGW, bTWagGnGpDPCRPRejRcvd=bTWagGnGpDPCRPRejRcvd, bTWagPmip6HeartBeatRspSent=bTWagPmip6HeartBeatRspSent, bTWagS2aSubscriberEntry=bTWagS2aSubscriberEntry, bTWagGnGpSubscriberTable=bTWagGnGpSubscriberTable, bTWagS2aIntervalDuration=bTWagS2aIntervalDuration, bTWagS2aStatsInterval=bTWagS2aStatsInterval, bTWagPreAuthenticatedGnGpSubsAdded=bTWagPreAuthenticatedGnGpSubsAdded, bTWagS2aSubscriberTable=bTWagS2aSubscriberTable, bTWagGnGpSubscriberNotifObjects=bTWagGnGpSubscriberNotifObjects, bTWagS2aUBRQRcvd=bTWagS2aUBRQRcvd, bTWagGnGpCPCRPAccepted=bTWagGnGpCPCRPAccepted, bTWagNumCurrentSecureSSIDS2aSubscribers=bTWagNumCurrentSecureSSIDS2aSubscribers, bTWagGnGpDPCRQRcvd=bTWagGnGpDPCRQRcvd, bTWagGTPMaxNumOfTunnels=bTWagGTPMaxNumOfTunnels, bTWagS2aSubsRadiusGBRQoS=bTWagS2aSubsRadiusGBRQoS, bTWagGnGpSubscriberMIBObjects=bTWagGnGpSubscriberMIBObjects, bTWagS2aDBRPSent=bTWagS2aDBRPSent, bTWagGnGpStatsMIBObjects=bTWagGnGpStatsMIBObjects, bTWagS2aCBRPSent=bTWagS2aCBRPSent, bTWagS2aSubscriberMIBObjects=bTWagS2aSubscriberMIBObjects, bTWagGnGpSubsRadiusMissingMandatoryParams=bTWagGnGpSubsRadiusMissingMandatoryParams, bTWagS2aSessCreateRespRej=bTWagS2aSessCreateRespRej, bTWagS2aSubsRadiusNonGBRQoS=bTWagS2aSubsRadiusNonGBRQoS, bTWagGTPHighThreshold=bTWagGTPHighThreshold, bTWagGnGpSubsGtpIPAddFailed=bTWagGnGpSubsGtpIPAddFailed, bTWagGnGpUPCRPSent=bTWagGnGpUPCRPSent, bTWagS2aUBRPSent=bTWagS2aUBRPSent, bTWagS2aNotifObjects=bTWagS2aNotifObjects, bTWagGnGpCPCRQRcvd=bTWagGnGpCPCRQRcvd, bTWagGnGpSubsRadiusEapAkaHash=bTWagGnGpSubsRadiusEapAkaHash, bTWagS2aSubsRadiusMSISDN=bTWagS2aSubsRadiusMSISDN, bTWagGnGpDPCRQSent=bTWagGnGpDPCRQSent, bTWagPmip6StatsInterval=bTWagPmip6StatsInterval, benuTWagStatsMIB=benuTWagStatsMIB, bTWagS2aStatsMIBObjects=bTWagS2aStatsMIBObjects, bTWagPmip6TotalBriReceived=bTWagPmip6TotalBriReceived, bTWagNumPreAuthenticatedGnGpSubscribers=bTWagNumPreAuthenticatedGnGpSubscribers, bTWagGnGpSubsStatsInterval=bTWagGnGpSubsStatsInterval, bTWagPmip6HeartBeatReqRestartCountMismatch=bTWagPmip6HeartBeatReqRestartCountMismatch, bTWagS2aSubsStatsInterval=bTWagS2aSubsStatsInterval, bTWagPreAuthenticatedS2aSubsAdded=bTWagPreAuthenticatedS2aSubsAdded, bTWagGnGpSubsIntervalDuration=bTWagGnGpSubsIntervalDuration, bTWagS2aSubsCSRQSendFailed=bTWagS2aSubsCSRQSendFailed, bTWagS2aSessDelRespRejRcvd=bTWagS2aSessDelRespRejRcvd, bTWagGnGpDPCRPRcvd=bTWagGnGpDPCRPRcvd, bTWagPmip6StatsTable=bTWagPmip6StatsTable, PYSNMP_MODULE_ID=benuTWagStatsMIB, bTWagS2aSessCreateRespAccepted=bTWagS2aSessCreateRespAccepted, bTWagPmip6StatsEntry=bTWagPmip6StatsEntry, bTWagGnGpTable=bTWagGnGpTable, bTWagS2aDBRQRcvd=bTWagS2aDBRQRcvd, bTWagS2aTable=bTWagS2aTable, bTWagGnGpCPCRQSent=bTWagGnGpCPCRQSent, bTWagGnGpSubsRadiusNonGBRQoS=bTWagGnGpSubsRadiusNonGBRQoS, bTWagNumGrePmip6Tunnels=bTWagNumGrePmip6Tunnels, bTWagSecureSSIDS2aSubsAdded=bTWagSecureSSIDS2aSubsAdded, bTWagGnGpIntervalDuration=bTWagGnGpIntervalDuration, bTWagS2aSubsGtpSessionCreateFailed=bTWagS2aSubsGtpSessionCreateFailed, bTWagGnGpSubsInvalidGtpVersion=bTWagGnGpSubsInvalidGtpVersion, bTWagPmip6TotalPbuSent=bTWagPmip6TotalPbuSent, bTWagGnGpStatsInterval=bTWagGnGpStatsInterval, bTWagS2aSubsIntervalDuration=bTWagS2aSubsIntervalDuration, bTWagGnGpSubsGtpSessionCreateFailed=bTWagGnGpSubsGtpSessionCreateFailed, bTWagPmip6TotalPacketHeaderDecodeError=bTWagPmip6TotalPacketHeaderDecodeError, bTWagPmip6TotalPacketsRxvdError=bTWagPmip6TotalPacketsRxvdError, bTWagPmip6TotalBraSent=bTWagPmip6TotalBraSent, bTWagGnGpCPCRPRej=bTWagGnGpCPCRPRej, bTWagPmip6DeletedDueToLmaInitBriMsg=bTWagPmip6DeletedDueToLmaInitBriMsg, bTWagGnGpSubsPDPCtxSendFailed=bTWagGnGpSubsPDPCtxSendFailed, bTWagS2aSubsRadiusInvalidPGWIPAddr=bTWagS2aSubsRadiusInvalidPGWIPAddr, bTWagGTPLowThreshold=bTWagGTPLowThreshold, bTWagGnGpSubsCPCRQSendFailed=bTWagGnGpSubsCPCRQSendFailed, bTWagGTPStatsMIBObjects=bTWagGTPStatsMIBObjects, bTWagPmip6HeartBeatReqSeqMismatch=bTWagPmip6HeartBeatReqSeqMismatch, bTWagS2aSessDelRespRcvd=bTWagS2aSessDelRespRcvd, bTWagS2aSessCreateRespRcvd=bTWagS2aSessCreateRespRcvd, bTWagS2aSessCreateReqSent=bTWagS2aSessCreateReqSent, bTWagGnGpSubsRadiusInvalidGGSNIPAddr=bTWagGnGpSubsRadiusInvalidGGSNIPAddr, bTWagGTPLowThresholdReached=bTWagGTPLowThresholdReached, bTWagGTPNotifObjects=bTWagGTPNotifObjects, bTWagS2aSubsInvalidGtpVersion=bTWagS2aSubsInvalidGtpVersion, bTWagGTPHighThresholdReached=bTWagGTPHighThresholdReached, bTWagPmip6MIBObjects=bTWagPmip6MIBObjects, bTWagGnGpSubscriberEntry=bTWagGnGpSubscriberEntry, bTWagGnGpSubsRadiusGBRQoS=bTWagGnGpSubsRadiusGBRQoS, bTWagS2aSubsRadiusEapAkaHash=bTWagS2aSubsRadiusEapAkaHash, bTWagGnGpEntry=bTWagGnGpEntry, bTWagS2aCBRQRcvd=bTWagS2aCBRQRcvd, bTWagGnGpCPCRPRcvd=bTWagGnGpCPCRPRcvd, bTWagS2aEntry=bTWagS2aEntry, bTWagNumCurrentSecureSSIDGnGpSubscribers=bTWagNumCurrentSecureSSIDGnGpSubscribers, bTWagGnGpCPCRPSent=bTWagGnGpCPCRPSent, bTWagPmip6IntervalDuration=bTWagPmip6IntervalDuration)
|
class utils:
def __init__(self):
pass
def readFile(self, fileName):
pass
|
pole = [1, 2, 5, -1, 3]
maximum = pole[0]
i = 1
while i < len(pole):
maximum = max(maximum, pole[i])
i += 1
print(maximum)
|
"""
This package contains the DIRECT tools, a set of tkinter tools for exploring
and manipulating the Panda3D scene graph. By default, these are disabled,
but they can be explicitly enabled using the following PRC configuration::
want-directtools true
want-tk true
"""
|
class Solution:
def findDisappearedNumbers(self, nums):
# since num in nums belongs to [1, len(nums)], we just need loop i from 1 to len(nums) and check if i in nums.
# But the time complexity of checking whether an item in a list is O(n). We need O(1). So make a list to a set.
length = len(nums)
nums = set(nums)
return [i for i in range(1, length+1) if i not in nums]
print(Solution().findDisappearedNumbers([4,3,2,7,8,2,3,1]))
|
# declaring random seed
randomseed = 0
C, H, W = 3,112,112
input_resize = 171,128#
test_batch_size = 1
m1_path = 'models/model_CNN_94.pth'
m2_path = 'models/model_my_fc6_94.pth'
m3_path = 'models/model_score_regressor_94.pth'
m4_path = 'models/model_dive_classifier_94.pth'
c3d_path = 'models/c3d.pickle'
with_dive_classification = False
with_caption = False
max_epochs = 100
model_ckpt_interval = 1 # in epochs
base_learning_rate = 0.0001
temporal_stride = 16
BUCKET_NAME = 'aqa-diving'
BUCKET_WEIGHT_FC6 = 'model_my_fc6_94.pth'
BUCKET_WEIGHT_CNN = 'model_CNN_94.pth'
BUCKET_WEIGHT_SCORE_REG = 'model_score_regressor_94.pth'
BUCKET_WEIGHT_DIV_CLASS = 'model_dive_classifier_94.pth'
|
class _DoublyLinkedBase:
class _Node:
__slots__ = '_element', '_prev', '_next'
def __init__(self, element, prev, next):
self._element = element
self._prev = prev
self._next = next
def __init__(self):
self._header = self._Node(None, None, None)
self._trailer = self._Node(None, None, None)
self._header._next = self._trailer
self._trailer._prev = self._header
self._size = 0
def __len__(self):
return self._size
def is_empty(self):
return self._size == 0
def _insert_between(self, e, predecessor, successor):
newest = self._Node(e, predecessor, successor)
predecessor._next = newest
successor._prev = newest
self._size += 1
return newest
def _delete_node(self, node):
predecessor = node._prev
successor = node._next
predecessor._next = successor
successor._prev = predecessor
self._size -= 1
element = node._element
node._prev = node._next = node._element = None
return element
class LinkedDeque(_DoublyLinkedBase):
def first(self):
if self.is_empty():
raise Empty('Deque is empty')
return self._header._next._element
def last(self):
if self.is_empty():
raise Empty('Deque is empty')
return self._trailer._prev._element
def insert_first(self, e):
self._insert_between(e, self._header, self._header._next)
def insert_last(self, e):
self._insert_between(e, self._trailer._prev, self._trailer)
def delete_first(self):
if self.is_empty():
raise Empty('Deque is empty')
return self._delete_node(self._header._next)
def delete_last(self):
if self.is_empty():
raise Empty('Deque is empty')
return self._delete_node(self._trailer._prev)
|
class TV:
def __init__(self):
self.__mysonytvprice = 55000
def mysell(self):
print("The Selling Price is : {}".format(self.__mysonytvprice))
def myMaxPrice(self, myprice):
self.__mysonytvprice = myprice
myobj = TV()
myobj.mysell()
# trying to change the price
myobj.__mysonytvprice = 56000
myobj.mysell()
myobj.myMaxPrice(54000)
myobj.mysell()
|
f1 = open("../../../prachi/kbi/kbi-pytorch/hits_id/fb15k_hits_10_pred.txt",'r').readlines()
f2 = open("../../../prachi/kbi/kbi-pytorch/hits_id/fb15k_hits_10_true.txt",'r').readlines()
f3 = open("fb15k_hits10_not_hits1_pred.txt",'w')
for i in range(len(f1)):
if(f1[i]!=f2[i]):
print(f1[i].strip(),file=f3)
f3.close()
|
#!/usr/bin/env python
# Copyright 2010 Google Inc. All Rights Reserved.
"""GRR Rapid Response Framework."""
|
# Returned function
def mult_by_x(x):
def inner(y):
return y * x
return inner
# Global?
def alt_mult_by_x(x):
return alt_inner
def alt_inner(y):
return y * x
# Called function
def apply(f, x):
return f(x)
def id(x):
return x
# print(id(id)(id(13)))
def combine_funcs(op):
def combined(f, g):
def val(x):
return op(f(x), g(x))
return val
return combined
|
NobelFisica = {1901: "Wilhelm Conrad Röntgen", 1902: "Hendrik Antoon Lorentz e Pieter Zeeman", 1903: "Antoine-Henri Becquerel, Pierre Curie e Marie Curie", 1904: "John William Strutt", 1905: "Philipp Eduard Anton von Lenard", 1906: "Joseph John Thomson", 1907: "Albert Abraham Michelson", 1908: "Gabriel Lippmann", 1909: "Guglielmo Marconi e Karl Ferdinand Braun", 1910: "Johannes Diderik van der Waals",
1911: "Wilhelm Carl Werner Otto Fritz Franz Wien", 1912: "Nils Gustaf Dalén", 1913: "Heike Kamerlingh Onnes", 1914: "Max von Laue", 1915: "William Henry Bragg e William Lawrence Bragg", 1916: "Não houve premiação-Primeira Guerra Mundial", 1917: "Charles Glover Barkla", 1918: "Max Karl Ernst Ludwig Planck", 1919: "Johannes Stark", 1920: "Charles Edouard Guillaume"}
print(NobelFisica[1915])
d = {}
d.update(NobelFisica)
print(d)
print(d[1903])
d.clear()
print(d)
d.update(NobelFisica)
d.copy()
x = d.copy()
print(x)
print(d.get(1903, "nao tem"))
print(d.get(1921, "nao tem"))
print(d.get(1923))
print(d.items())
print(x.items())
print(d.keys())
print(d.pop(1920, "nao existe"))
print(d)
print(d.pop(1923, "nao existe"))
d.popitem()
d.setdefault(1921, "Albert Einstein")
print(d)
print(d.values())
|
##############################################
# DESCRIPTION : Format Based Steganography #
# Algorithm : Open space encoding #
# Author : Kishore #
##############################################
def to_ascii(charector):
# a method to convert charector into ascii int
assert type(charector) == str
return ord(charector)
def to_str(ascii):
# a method to convert ascii int into ascii char
assert type(ascii) == int
return chr(ascii)
def to_binary(ascii):
# a method to convert ascii int into binary string value
assert type(ascii) == int
return "{0:08b}".format(ascii)
def to_int(binary):
# a method to convert binary string value into ascii int
assert type(binary) == str
return int(binary, 2)
def encode_handling(file_name, binary, encoded_file_name = 'none'):
# a method to take file name and binary string with opetional encoding file name
# returns a binary string value and optional text file for encoding .
opener = open(file_name)
file = opener.read().splitlines()
sentences = [file[i].split(' ') for i in range(len(file))]
words = ''
count = 0
length_of_binary = len(binary)
for row in range(len(file)):
for col in range(len(sentences[row])):
try:
words+=sentences[row][col]
if count>=length_of_binary:
pass
elif int(binary[count]) == 1:
words+=' '
else:
words+=' '
count+=1
except:
print(count, ' this is problem.',length_of_binary)
opener.close()
if encoded_file_name != 'none':
encoded_file = open(encoded_file_name, 'w')
encoded_file.write(words)
encoded_file.close()
return binary
def decode_handling(encoded_file_name):
# a method to open encoded file and return binary string value of hidden text
file = open(encoded_file_name)
read = file.read()
binary = ''
prev = False
for i in range(1, len(read)-1):
if read[i]==' ' and read[i+1]==' ':
i+=1
binary+='1'
prev = True
continue
elif read[i]==' ':
if prev:
prev=False
continue
else:
binary+='0'
else:
pass
return binary
def encode():
binary_sentence = ''
ascii_sentence = []
sentence = input('Enter the sentence you want to Encode : ')
# sentence to ASCII
for i in iter(sentence):
ascii_sentence.append(to_ascii(i))
assert type(ascii_sentence)==list
# ASCII to Binary
for i in ascii_sentence:
binary_sentence+=to_binary(i)
# File Handling
file_name = input(" Enter the file to encrypt : ")
encoded_file_name = input("Enter the file name of encoded text to save as : ")
encode_binary = encode_handling(file_name= file_name,binary=binary_sentence,encoded_file_name= encoded_file_name)
def decode():
decoded_sentences = ''
# decode Method Handling
encoded_file_name = input('Enter the file name to decrypt : ')
decode_binary = decode_handling(encoded_file_name= encoded_file_name)
# Binary to ASCII
int_sentence = []
for i in range(0,len(decode_binary)-8,8):
if to_int(decode_binary[i:i+8]) == 0:
break
else:
int_sentence.append(to_int(decode_binary[i:i+8]))
int_sentence.append(to_int(decode_binary[len(decode_binary)-8:]))
# forming sentences
for i in int_sentence:
try:
decoded_sentences+=to_str(i)
except:
print(int_sentence[1], ' is out of range for chr().')
break
print("output after decoding is ", decoded_sentences)
def main():
session = input('Enter 1 to encode or 2 to decode : ')
# call encode
if session == '1':
encode()
elif session == '2':
decode()
else:
main()
if __name__ == "__main__":
main()
|
"""
cmd.do('distance ${1:dist3}, ${2:/rcsb074137//B/IOD`605/I`B}, ${3:/rcsb074137//B/IOD`605/I`A}')
"""
cmd.do('distance dist3, /rcsb074137//B/IOD`605/I`B, /rcsb074137//B/IOD`605/I`A')
# Description: H-bond distances.
# Source: placeHolder
|
def GetRoutes(area):
query = 'select distinct Route from [dimensions].[wells] where [Area] = \'' + area + '\''
return query
def GetWells(area, route):
query = 'select distinct WellName from [dimensions].[wells] where [Route] = \'' + route + '\' and [Area] = \'' + area + '\''
return query
|
# Problem: https://www.hackerrank.com/challenges/diagonal-difference/problem
# Score: 10
a = []
result = 0
for i in range(int(input())):
a = list(map(int, input().split()))
result += a[i] - a[- 1 - i]
print(abs(result))
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
#
# Utilities for interacting with Hive.
class HiveDbWrapper(object):
"""
A wrapper class for using `with` guards with databases created through Hive
ensuring deletion even if an exception occurs.
"""
def __init__(self, hive, db_name):
self.hive = hive
self.db_name = db_name
def __enter__(self):
self.hive.run_stmt_in_hive(
'create database if not exists ' + self.db_name)
return self.db_name
def __exit__(self, typ, value, traceback):
self.hive.run_stmt_in_hive(
'drop database if exists %s cascade' % self.db_name)
class HiveTableWrapper(object):
"""
A wrapper class for using `with` guards with tables created through Hive
ensuring deletion even if an exception occurs.
"""
def __init__(self, hive, table_name, table_spec):
self.hive = hive
self.table_name = table_name
self.table_spec = table_spec
def __enter__(self):
self.hive.run_stmt_in_hive(
'create table if not exists %s %s' %
(self.table_name, self.table_spec))
return self.table_name
def __exit__(self, typ, value, traceback):
self.hive.run_stmt_in_hive('drop table if exists %s' % self.table_name)
|
sm.removeEscapeButton()
sm.setSpeakerID(1102102)
sm.sendNext("THERE YOU ARE! I told you not to move! You're going to pay for that. Maybe not today, maybe not tomorrow, but one day, when you're on a particularly annoying mission, know that I've secretly arranged it. Now get back to the Drill Hall!")
sm.startQuest(parentID)
sm.warp(130030105, 0)
|
CSS_STYLE = """
.kts {{
line-height: 1.6;
}}
.kts * {{
box-sizing: content-box;
}}
.kts-wrapper {{
display: inline-flex;
flex-direction: column;
background-color: {first};
padding: 10px;
border-radius: 20px;
}}
.kts-wrapper-border {{
border: 0px solid {second};
}}
.kts-pool {{
display: flex;
flex-wrap: wrap;
background-color: {second};
padding: 5px;
border-radius: 20px;
margin: 5px;
}}
.kts-field {{
text-align: left;
border-radius: 15px;
padding: 5px 15px;
margin: 5px;
display: inline-block;
}}
.kts-field-bg {{
background-color: {second};
}}
.kts-field-bold {{
font-weight: bold;
}}
.kts-field-third {{
color: {third};
}}
.kts-field-accent {{
color: {accent};
}}
.kts-field-bg:hover {{
background-color: {fourth};
}}
.kts-annotation {{
text-align: left;
margin-left: 20px;
margin-bottom: -5px;
display: inline-block;
color: {third};
}}
.kts-title {{
text-align: center;
display: inline-block;
font-weight: bold;
color: {third};
}}
.kts-code {{
background-color: {second};
text-align: left;
border-radius: 15px;
padding: 0.5em 15px;
margin: 5px;
color: white;
display: inline-block;
}}
.kts-code:hover {{
background-color: {fourth};
}}
.kts-code > pre {{
background-color: {second};
overflow: auto;
white-space: pre-wrap;
}}
.kts-code:hover > pre {{
background-color: {fourth};
}}
.kts-output {{
background-color: {second};
text-align: left;
border-radius: 15px;
padding: 5px 15px;
margin: 5px;
font-weight: bold;
font-family: monospace;
color: {accent};
overflow: auto;
max-height: 4.8em;
display: flex;
flex-direction: column-reverse;
}}
.kts-df {{
background-color: {second};
text-align: left;
border-radius: 15px;
padding: 5px 15px;
margin: 5px;
display: inline-block;
color: {accent};
}}
.kts-title-with-cross {{
display: grid;
grid-template-columns: 1em auto 1em;
margin-left: 5px;
margin-right: 5px;
}}
.kts-cross-circle {{
background-color: {second};
width: 1em;
height: 1em;
position: relative;
border-radius: 50%;
cursor: pointer;
z-index: 2;
margin-top: 2px;
max-width: none;
}}
.kts-cross-before,
.kts-cross-after {{
background-color: {third};
content: '';
position: absolute;
width: 0.75em;
height: 2px;
border-radius: 0;
top: calc((1em - 2px) / 2);
z-index: 0;
}}
.kts-cross-before {{
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
transform: rotate(-45deg);
left: calc(1em / 8);
}}
.kts-cross-after {{
-webkit-transform: rotate(-135deg);
-moz-transform: rotate(-135deg);
transform: rotate(-135deg);
right: calc(1em / 8);
}}
#kts-hidden {{
display: none
}}
.kts-thumbnail {{
margin: 0;
cursor: pointer;
}}
.kts-thumbnail-first {{
background-color: {first};
}}
.kts-thumbnail-second {{
background-color: {second};
}}
#kts-collapsible {{
-webkit-transition: max-height {anim_height}, padding {anim_padding};
-moz-transition: max-height {anim_height}, padding {anim_padding};
-ms-transition: max-height {anim_height}, padding {anim_padding};
-o-transition: max-height {anim_height}, padding {anim_padding};
transition: max-height {anim_height}, padding {anim_padding};
padding: 0;
margin: 2px;
align-self: flex-start;
max-height: 100px;
overflow: hidden;
}}
.kts-check {{
display: none;
}}
.kts-check:checked + #kts-collapsible {{
padding: 10px;
max-height: {max_height_expanded};
}}
.kts-check:checked + #kts-collapsible > #kts-hidden {{
display: inline-flex;
}}
.kts-check:checked + #kts-collapsible > .kts-thumbnail {{
display: none;
}}
.kts-check:checked + .kts-wrapper-border {{
border: 2px solid {second};
}}
.kts-check-outer {{
display: none;
}}
.kts-check-outer:checked + #kts-collapsible {{
padding: 10px;
max-height: {max_height_expanded};
}}
.kts-check-outer:checked + #kts-collapsible > #kts-hidden {{
display: inline-flex;
}}
.kts-check-outer:checked + #kts-collapsible > .kts-thumbnail {{
display: none;
}}
.kts-check-outer:checked + .kts-wrapper-border {{
border: 2px solid {second};
}}
.kts-inner-wrapper {{
flex-direction: column;
}}
.kts-progressbar-wrapper {{
display: flex;
flex-direction: row;
align-items: center;
height: 1.6em;
}}
.kts-progressbar-outer {{
box-sizing: padding-box;
display: flex;
flex-direction: row;
background-color: {second};
align-items: center;
padding: 3px;
border-radius: 15px;
width: 100%;
}}
.kts-progressbar-inner {{
background-color: {third};
height: 0.7em;
border-radius: 15px;
}}
.kts-hbar-container {{
display: block;
position: relative;
height: min(calc(100% - 3px), 1.5em);
margin: 2px;
}}
.kts-hbar {{
position: absolute;
display: inline-block;
background-color: {third};
text-align: left;
height: 100%;
border-radius: 15px;
}}
.kts-hbar-line {{
position: absolute;
display: inline-block;
background-color: {accent};
text-align: left;
height: 1px;
top: 50%;
}}
.kts-inner-column {{
display: flex;
flex-direction: column;
padding: auto;
}}
.kts-row {{
display: flex;
flex-direction: row;
}}
.kts-hoverable-line, .kts-hoverable-line * {{
pointer-events: all;
transition: all 0.1s ease-out;
}}
.kts-hoverable-line:hover * {{
stroke: {second_accent};
stroke-width: 10;
}}
"""
|
"""
Title:
1004. Max Consecutive Ones III
1004. 最大连续1的个数 III
Address:
https://leetcode-cn.com/problems/max-consecutive-ones-iii/
"""
# 方法一:滑动窗口
# 思路:借鉴「424. 替换后的最长重复字符」的解题思路
class Solution:
def longestOnes(self, A: List[int], K: int) -> int:
if len(A) == 0 or K < 0:
return 0
maxLen = 0
left, right = 0, 0
while right < len(A):
if A[right] == 1:
maxLen += 1
if right - left + 1 > maxLen + K:
if A[left] == 1:
maxLen -= 1
left += 1
right += 1
return right - left
# 方法二:滑动窗口
class Solution_2:
def longestOnes(self, A: List[int], K: int) -> int:
cnt = 0 # 统计数组 A 中 0 的个数
ans = 0
left, right = 0, 0
while right < len(A):
if A[right] == 0:
cnt += 1
while cnt > K:
if A[left] == 0:
cnt -= 1
left += 1
ans = max(ans, right - left + 1)
right += 1
return ans
|
t = int(input())
for i in range(t):
n,m,k = map(int,input().split())
l = list(map(int,input().split()))
x = {}
for j in range(n):
x[j] = []
for j in range(n):
temp = l[j]
x[temp-1].append(j+1)
print(x)
j=0
me = l[0]
while m>0 and j+1<=me:
m-=len(x[j])
print(m)
k-=1
j+=1
if j-1>me:
print("YES")
elif j==me and m<0:
print("MAYBE")
else:
print("NO")
|
class PaginationHelper():
''' Help keep track of pagination for the web UI, in terms of correct offsets '''
def __init__(self, bare_route, offset, interval=20, num_items=None):
self.bare_route = bare_route
self.interval = interval
self.num_items = num_items
if offset % interval or offset < 0:
offset = 0
self.offset = offset
@property
def prev_url(self):
if self.offset == self.interval:
return self.bare_route
elif self.offset >= self.interval:
return self.bare_route + '/pos/%d' % (self.offset - self.interval)
@property
def next_url(self):
if (self.offset + self.interval) > self.num_items:
return False
return self.bare_route + '/pos/%d' % (self.offset + self.interval)
|
"""
#### Generic "Writer"
The ResultsWriter has been written s.t. it can be easily replaced if the way in which we would
like to write results changes. For example, in the future we may want to replace the
ResultsWriter with a writer to an SQL database or flat file system. Regardless of the "Writer"
that is used, the remaining portion of the code should be able to exist without change while
the only thing that will change will be this package.
No matter which "Writer" is used, a "Writer" will probably have some sort of username associated
with it that will map to a client.
A "Writer" will abstract away all writes AND reads to a DB, flat file, file system, etc..
#### This "Writer": ResultsWriter
The "ResultsWriter" handles all writes AND reads to a specific, statically defined,
directory structure.
"""
class ResultsWriter:
# Initialize a Results Writer with a path
def __init__(self, db_path):
self.db_path = db_path
def createNewUserDirectory(self, username):
pass
|
class TestingError(BaseException): pass
class MisnamedFunctionError(TestingError): pass
class TestNotFoundError(TestingError): pass
class SolutionNotFoundError(TestingError): pass
|
"""
### What is Bucket Sort ?
Bucket sort is a comparison sort algorithm that operates on elements by dividing
them into different buckets and then sorting these buckets individually. Each
bucket is sorted individually using a separate sorting algorithm or by applying
the bucket sort algorithm recursively. Bucket sort is mainly useful when the
input is uniformly distributed over a range.
#### Assume one has the following problem in front of them:
One has been given a large array of floating point integers lying uniformly
between the lower and upper bound. This array now needs to be sorted. A simple
way to solve this problem would be to use another sorting algorithm such as Merge
sort, Heap Sort or Quick Sort. However, these algorithms guarantee a best case
time complexity of O(NlogN). However, using bucket sort, the above task can be
completed in O(N) time.
#### Psuedo Code
```
void bucketSort(float[] a,int n)
{
for(each floating integer 'x' in n)
{
insert x into bucket[n*x];
}
for(each bucket)
{
sort(bucket);
}
}
```
### Time Complexity:
If one assumes that insertion in a bucket takes O(1) time, then steps 1 and 2 of the
above algorithm clearly take O(n) time.
"""
def bucket_sort(array):
largest = max(array)
length = len(array)
size = largest/length
buckets = [[] for _ in range(length)]
for i in range(length):
j = int(array[i]/size)
if j != length:
buckets[j].append(array[i])
else:
buckets[length - 1].append(array[i])
for i in range(length):
insertion_sort(buckets[i])
result = []
for i in range(length):
result = result + buckets[i]
return result
def insertion_sort(array):
for i in range(1, len(array)):
temp = array[i]
j = i - 1
while (j >= 0 and temp < array[j]):
array[j + 1] = array[j]
j = j - 1
array[j + 1] = temp
def sort(array):
return bucket_sort(array)
|
#
# 1763. Longest Nice Substring
#
# Q: https://leetcode.com/problems/longest-nice-substring/
# A: https://leetcode.com/problems/longest-nice-substring/discuss/1074560/Kt-Js-Py3-Cpp-Recursive
#
class Solution:
def longestNiceSubstring(self, s: str) -> str:
best = ''
def go(s):
nonlocal best
seen = set(s)
isNice = lambda c: c.lower() in seen and c.upper() in seen
for i in range(len(s)):
if not isNice(s[i]):
go(s[:i]); go(s[i + 1:])
return
if len(best) < len(s):
best = s
go(s)
return best
|
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 4 10:59:09 2021
@author: shubhransu
"""
a=[]
for i in range(0,5):
k = int(input())
a.append(k)
print(max(a))
|
s = input('Введите ФИО через пробел:')
lst = s.split()
print( 'Привет, ' )
for si in lst:
print( si)
|
#frequency function for cities (could be used for all of the columns)
def freq_function(col):
city = []
for item in col:
for j in item:
city.append(j)
freq= {x:city.count(x) for x in city}
sorted_freq = {k: v for k, v in sorted(freq.items(), key=lambda item: item[1], reverse=True)}
return sorted_freq
|
"""
Given scores of N athletes, find their relative ranks and the people with the top three highest scores,
who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".
Example 1:
Input: [5, 4, 3, 2, 1]
Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"]
Explanation: The first three athletes got the top three highest scores, so they got "Gold Medal", "Silver Medal" and "Bronze Medal".
For the left two athletes, you just need to output their relative ranks according to their scores.
Note:
N is a positive integer and won't exceed 10,000.
All the scores of athletes are guaranteed to be unique.
"""
def findRelativeRanks(nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
nums_sort = sorted(nums)[::-1]
ranks = ['Gold Medal', 'Silver Medal', 'Bronze Medal'] + [str(i + 1) for i in range(3, len(nums_sort))]
d = {n: r for n, r in zip(nums_sort, ranks)}
return [d[n] for n in nums]
def test_findRelativeRanks():
expected = ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"]
actual = findRelativeRanks([5, 4, 3, 2, 1])
for s, t in zip(expected, actual):
assert s == t, '{} vs {}'.format(s, t)
expected = ["Gold Medal", "5", "Bronze Medal", "Silver Medal", "4"]
actual = findRelativeRanks([10, 3, 8, 9, 4])
for s, t in zip(expected, actual):
assert s == t, '{} vs {}'.format(s, t)
if __name__ == '__main__':
test_findRelativeRanks()
|
#!/usr/bin/python3.6
# created by cicek on 06.12.2018 00:46
def average(midterm, final):
mid = (0.4)*midterm
fin = (0.6)*final
result = mid + fin
return result
while(True):
vize = int(input("vize puanınızı giriniz: "))
if vize == -1: exit(0)
final = int(input("final puanınızı giriniz: "))
print("ortalama: {0}\n".format(average(vize, final)))
# vize puanınızı giriniz: 50
# final puanınızı giriniz: 80
# ortalama: 68.0
#
# vize puanınızı giriniz: 40
# final puanınızı giriniz: 60
# ortalama: 52.0
#
# vize puanınızı giriniz: 100
# final puanınızı giriniz: 100
# ortalama: 100.0
#
# vize puanınızı giriniz: 49
# final puanınızı giriniz: 50
# ortalama: 49.6
#
# vize puanınızı giriniz:
|
class solution:
def max_distance(A):
if len(A) < 2:
return 0
A.sort()
pre = A[0]
max_gap = float("-inf")
for i in A:
max_gap = max(max_gap, i - pre)
pre = i
return max_gap
print(solution.max_distance([3, 5, 4, 2]))
|
val_premio = float(input("VALOR TOTAL DO PRÊMIO: "))
imposto = val_premio*0.07
val_real = val_premio - imposto
val_g1 = 0.46*val_real
val_g2 = 0.32*val_real
val_g3 = val_real - (val_g1 + val_g2)
print("-----------------------------------")
print("VALOR TOTAL DO PRÊMIO = {:.2f}".format(val_premio))
print("VALOR DO IMPOSTO = {:.2f}".format(imposto))
print("VALOR REAL (MENOS IMPOSTO) = {:.2f}".format(val_real))
print("PRÊMIO GANHADOR 1 = {:.2f}".format(val_g1))
print("PRÊMIO GANHADOR 2 = {:.2f}".format(val_g2))
print("PRÊMIO GANHADOR 3 = {:.2f}".format(val_g3))
print("-----------------------------------")
|
# Casting an integer to a string
# EXPECTED OUTPUT:
# case5.py: x -> int
# case5.py: y -> int
# case5.py: z -> int
# case5.py: my_function() -> str
def my_function():
x = 5
y = 10
z = x + y
return str(z)
|
letterFrequency = {
"E": 12.0,
"T": 9.10,
"A": 8.12,
"O": 7.68,
"I": 7.31,
"N": 6.95,
"S": 6.28,
"R": 6.02,
"H": 5.92,
"D": 4.32,
"L": 3.98,
"U": 2.88,
"C": 2.71,
"M": 2.61,
"F": 2.30,
"Y": 2.11,
"W": 2.09,
"G": 2.03,
"P": 1.82,
"B": 1.49,
"V": 1.11,
"K": 0.69,
"X": 0.17,
"Q": 0.11,
"J": 0.10,
"Z": 0.07,
}
def get_concidences_list(message):
"""
create shifted messages from each message and in each shited message compare the positions of the
letters to the original cipher and if it match increament the concidences by 1
e.x message-> iloveyou
iloveyo
ilovey
...
so in the first shifted message we comapre (l,i) (o,l) (v,o) (e,v) .... and if letter in the original message
match with letter in the shifted text we increament the concidence by 1
"""
concidences = list()
for i in range(1, len(message)):
li = message[0 : len(message) - i]
print(li)
concidences.insert(i - 1, 0)
for j in range(i, len(message)):
if li[j - i] == message[j]:
concidences[i - 1] += 1
return concidences
concidences_list = get_concidences_list(message)
print(concidences_list)
def get_the_highest_concidences(concidences):
sorted_concidences = concidences.copy()
sorted_concidences.sort(reverse=True)
print(sorted_concidences)
return sorted_concidences
def get_the_key_length(sorted_concidences, concidences_list):
max_peak = sorted_concidences[0]
key_length = 0
find_highest = False
for i in concidences_list:
if i == max_peak and key_length == 0:
key_length += 1
find_highest = True
elif i == max_peak:
break
elif find_highest:
key_length += 1
return key_length
def slice_the_cipher_text(message, key_length):
list_of_splited_litters = [message[i : i + key_length] for i in range(0, len(message), key_length)]
print(list_of_splited_litters)
return list_of_splited_litters
def slice_each_letter_of_key(list_of_splited_litters, key_length):
di = dict()
i = 0
for word in list_of_splited_litters:
i = 0
for letter in word:
if i > key_length:
i = 0
s = di.get(i + 1, 0)
if s == 0:
di[i + 1] = [letter]
else:
di[i + 1] = di[i + 1] + [letter]
i += 1
print(di)
return di
|
animals = ['bear' , 'python 3.6' , 'peacock' , 'kangroo' , 'whale' , 'zebra']
print(f"The animal at 1 is the 2nd animal and is a {animals[1]}.")
print(f"The third (3rd) animal is at 2 and is a {animals[2]}.")
print(f"The first (1st) animal is at 0 and is a {animals[0]}.")
print(f"The animal at 3 is the forth animal and is a animal {animals[3]}.")
print(f"The fifth (5th) animal is at 4 and is a {animals[4]}.")
print(f"The animal at 2 is the 3rd animal and is {animals[2]}.")
print(f"The sixth (6th) animal is at 5 and is a {animals[5]}.")
print(f"The animal at 4 is the 5th and is a {animals[4]}.")
|
#inputArray is the input dataset
#x is the searching integer in the array
def binarySearch(inputArray,x):
if (inputArray[-1] > x):
mid = len(inputArray)//2 # get the mid index of the inputArray
if (inputArray[mid] == x): #check it the with the searching number
return true #if yes return true
if (inputArray[mid] > x):
return binarySearch(inputArray[:mid],x)
return binarySearch(inputArray[mid:],x)
else:
return false
|
WALL = 'w'
FOOD = 'f'
SNAKEBODY = 'b'
SNAKEHEAD = 'h'
width = 5
height = 10
board = [[0 for i in range(width)] for j in range(height)]
board[0][0] = 5
print(board)
|
#program to compute the values of n
n = float(input( 'Enter the values of n.\n'))
Values = (n+(n*n)+(n*n*n))
print(f'Sample value of n is {n}')
print(f'The expected result:{Values} ')
|
# problem name: Array Shrinking
# problem link: https://codeforces.com/contest/1312/problem/E
# contest link: https://codeforces.com/contest/1312
# time: (?)
# author: reyad
# other_tags: greedy
# this solution style is a bit different for this problem than most of the cf solutions
# so i'm providing a tutorial link to the solution
# tutorial link: https://codeforces.com/blog/entry/74759
n = int(input())
b = [int(_) for _ in input().split()]
e = [[-1] * (n+1) for _ in range(2002)]
d = [[] for _ in range(n)]
for i, v in enumerate(b):
e[v][i] = i
d[i].append(i)
for v in range(1, 2002):
for i in range(n):
j = e[v][i]
h = e[v][j+1] if j != -1 else -1
if j != -1 and h != -1:
e[v+1][i] = h
d[i].append(h)
a = [_ for _ in range(1, n+1)]
for s in range(n):
for e in d[s]:
a[e] = min(a[e], a[s-1]+1 if s > 0 else 1)
print(a[n-1])
|
"""
x = "its global"
def fantastic():
print("about")
global x
x= 230
def lamented():
print("Sad")
y = input()
if y == "fantastic":
fantastic()
else:
lamented()
k = 5j
print(type(k))
"""
"""
lst = [1,2,3,4,5,6,7,8,9, 12,12,23,34,435,6,56,34,23,45,7678,3]
for x in lst:
print(x)
lst.append(777)
print(lst)
team = {
"leader" : {
"name" : "Fahad",
"batch" : 13
},
"commander" : {
"name" : "Shakil",
"batch" : 24,
55 : "Ok"
}
}
print(team['commander'][55])
battalion_1 = {
"cic" : "xxxx",
"rank" : "Lt. Colonel"
}
battalion_2 = {
"cic" : "yyy",
"rank" : "Lt. Colonel"
}
battalion_3 = {
"cic" : "zzz",
"rank" : "Lt. Colonel"
}
battalion_4 = {
"cic" : "ggg",
"rank" : "Lt. Colonel"
}
battalion_5 = {
"cic" : "hhh",
"rank" : "Lt. Colonel"
}
regiment = {
"battalion_1" : battalion_1,
"battalion_2" : battalion_2,
"battalion_3" : battalion_3,
"battalion_4" : battalion_4,
"battalion_5" : battalion_5,
}
print(regiment["battalion_3"]["cic"])
a = 33
b = 33
print("A") if a<b else print("AB") if a==b else print("B")
if a == b:
pass # scontinue in c
while a>0:
print(a)
a -= 1
adj = ["red", "big", "tasty"]
fruits = ["apple", "banana", "cherry"]
for x in adj:
for y in fruits:
print(x,y)
print("\n")
def fruit(*x):
print(x[1])
fruit("apple", "banana", "cherry")
def fruiit(**x):
print(x)
fruiit(a = "apple", b = "banana", c = "cherry")
def country(name = "Bangladesh"):
print(name)
country("Germany")
country()
def recurse(n):
if n<0:
return
else:
recurse(n-1)
print(n)
recurse(10)
x = 1111111
y = 3333333
z = 55555
txt = "ggggggggggg {} ggggggggg {} ggggggggggg {}"
print(txt.format(x, y, z))
txt = "ggggggggggg {1} ggggggggg {2} ggggggggggg {0}"
print(txt.format(x, y, z))
txt = "ggggggggggg {1} ggggggggg {2:.5f} ggggggggggg {0}"
print(txt.format(x, y, z))
m = 10
print(type(m))
t = 187687654564658970978909869576453
print(type(t))
n = 5
r = m % n
q = m / n
print(r)
print(q)
if(m%n == 0):
print("Ok")
# a = list(map(int, input().split()))
def double(i):
return 5*i
a=()
a = input()
r = map(double, a)
print(list(r))
def return_int(i):
return int(i)
a = ()
a = input()
r = map(return_int, a)
t = list(r)
print(t)
print(t[1])
x, y = input().split()
x = int(x)
y = int(y)
print(x)
print(y)
print()
m = list(map(int, input().split()))
print(m)
a = list(map(int, input().split()))
print(a)
while True:
try:
x = input()
print(x)
except EOFError:
break
while True:
try:
print(input())
except EOFError:
break
x = 90
y = 0
whil
try:
result = x / y
except ZeroDivisionError:
print("You can't divide s")
def avg(n):
if not n:
return none
return sum(n)/len(n)
if __name__ == "__main__":
l = [1,2,3,4,5]
print(avg(l))
lst = [9,5,2,2,4,1,0,8]
lst.sort()
print(lst)
while True:
n,q = input().split()
n = int(n)
q = int(q)
lst_n = []
lst_q = []
if (n == 0) and (q == 0):
break
else:
for i in range(n):
x = int(input())
lst_n.append(x)
lst_n.sort()
print(lst_n)
for i in range(q):
x = int(input())
lst_q.append(x)
def search(lst, x):
i = 0
n = len(lst)
while(i < n):
if lst[i] == x:
return i
i += 1
return -1
lst_n = [2,2,3,3,4,4,5,10,11,13]
lst_q = [3,2,4,8,10]
#lst_q = [2]
for i in lst_q:
print(i)
index = search(lst_n, i)
index = int(index)
print(index)
if index == -1:
print("{} not found".format(i))
else:
print("{} found at {}".format(i, index+1))
print(' '.join(str(x) for x in lst_n))
l = []
if not l:
print("not")
strg = "abracadabra"
lst = list(strg)
lst[5] = 'k'
lst = "".join(lst)
print(type(lst))
print(ord('9'))
"""
|
"""
CloudConvert exceptions classes.
"""
class CloudConvertError(Exception):
""" Basic CloudConvert exceptions class. """
pass
class MissingFileException(CloudConvertError):
"""Raises when file to conversion is missed. """
pass
class WrongRequestDataException(CloudConvertError):
"""Raises when some data in request sending to cloudconvert service are missed. """
pass
class WrongResourceException(CloudConvertError):
"""Raises when given resource URL is wrong. """
pass
class FilesCountException(CloudConvertError):
"""Raises when too many files are sent in one request """
|
class colored:
def __init__(self, text, color='\033[1000m', highlight='\033[1000m', effect='\033[1000m'):
self.text = text
none = '\033[1000m'
#---- color ----
Lred = '\033[91m'
red = '\033[31m'
Lblue = '\033[94m'
blue = '\033[34m'
Lgreen = '\033[92m'
green = '\033[32m'
yellow = '\033[93m'
cyan = '\033[96m'
Lcyan = '\033[36m'
pink = '\033[95m'
gray = '\033[90m'
Lgray = '\033[37m'
black = '\033[30m'
purple = '\033[35m'
orange = '\033[33m'
if color == "red":
self.color = red
elif color == "blue":
self.color = blue
elif color == "green":
self.color = green
elif color == "yellow":
self.color = yellow
elif color == "pink":
self.color = pink
elif color == "gray":
self.color = gray
elif color == "purple":
self.color = purple
elif color == "cyan":
self.color = cyan
elif color == "black":
self.color = black
elif color == "orange":
self.color = orange
elif color == "Lred":
self.color = Lred
elif color == "Lcyan":
self.color = Lcyan
elif color == "Lgreen":
self.color = Lgreen
elif color == "Lblue":
self.color = Lblue
elif color == "Lgray":
self.color = Lgray
else:
self.color = none
#---- highlight ----
on_Lred = '\033[101m'
on_Lblue = '\033[104m'
on_Lgreen = '\033[102m'
on_black = '\033[40m'
on_red = '\033[41m'
on_blue = '\033[44m'
on_green = '\033[42m'
on_yellow = '\033[103m'
on_Lcyan = '\033[106m'
on_cyan = '\033[46m'
on_pink = '\033[105m'
on_Lgray = '\033[47m'
on_gray = '\033[100m'
on_white = '\033[107m'
on_orange = '\033[43m'
on_purple = '\033[45m'
if highlight == "on_red":
self.highlight = on_red
elif highlight == "on_blue":
self.highlight = on_blue
elif highlight == "on_green":
self.highlight = on_green
elif highlight == "on_yellow":
self.highlight = on_yellow
elif highlight == "on_pink":
self.highlight = on_pink
elif highlight == "on_gray":
self.highlight = on_gray
elif highlight == "on_white":
self.highlight = on_white
elif highlight == "on_Lblue":
self.highlight = on_Lblue
elif highlight == "on_Lgreen":
self.highlight = on_Lgreen
elif highlight == "on_Lred":
self.highlight = on_Lred
elif highlight == "on_black":
self.highlight = on_black
elif highlight == "on_Lgray":
self.highlight = on_Lgray
elif highlight == "on_orange":
self.highlight = on_orange
elif highlight == "on_purple":
self.highlight = on_purple
elif highlight == "on_Lcyan":
self.highlight = on_Lcyan
elif highlight == "on_cyan":
self.highlight = on_cyan
else:
self.highlight = none
#---- effect ----
bold = '\033[1m'
underline = '\033[4m'
if effect == "bold":
self.effect = bold
elif effect == "underline":
self.effect = underline
else:
self.effect = none
def __repr__(self):
return self.color + self.highlight + self.effect + self.text + '\033[0m'
|
# Algo's described clearly on the following link
# https://math.stackexchange.com/questions/60742/finding-the-n-th-lexicographic-permutation-of-a-string
def nth_permutation(alpha, n):
# alpha is the list of item, and
# n is the nth permutation, that is to be found out
perm = []
t = len(alpha)
fact = [1 for i in range(t)]
for i in range(2, t):
fact[i] = fact[i-1]*i
for i in range(t-1, 0, -1):
if n % fact[i]:
p = int(n // fact[i])
perm.append(alpha[p])
n %= fact[i]
del alpha[p]
else:
p = int((n // fact[i]) - 1)
n -= (p * fact[i])
perm.append(alpha[p])
del alpha[p]
perm.append(alpha[0])
del alpha[:]
return perm
if __name__ == '__main__':
alpha = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print('I/P:', alpha)
ans = nth_permutation(alpha, 1000000)
print('O/P:', ans)
|
class Solution:
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
n=len(nums)
sub=[]
for i in range(2**n):
#l=[0 for k in range(n)]
k=i
p=[]
for j in range(n):
if (k & 1):
p.append(nums[j])
k>>=1
sub.append(p)
return sub
|
#Que 14 Bigger Number (x,y)
x= int(input('Enter first Number :- '))
y= int(input('Enter second Number :- '))
def Big_Number(x,y):
if x>y:
print ("Bigger Number is :- ",x)
if y>x:
print ("Bigger Number is :- ",y)
Big_Number(x,y)
|
# coding=utf-8
__author__ = 'mlaptev'
if __name__ == "__main__":
input_array = sorted([int(i) for i in input().split()])
amount = 0
for i in range(len(input_array) - 1):
if input_array[i] == input_array[i+1]:
amount += 1
elif amount > 0:
print(input_array[i], end=' ')
amount = 0
else:
amount = 0
if amount > 0:
print(input_array[-1], end=' ')
|
{
'targets': [{
'target_name': 'meow_hash_node',
'cflags': [ '-fno-exceptions', '-O3', '-mavx', '-maes', '-msse4' ],
'cflags_cc!': [ '-fno-exceptions', '-O3', '-mavx', '-maes', '-msse4' ],
'sources': [
'lib/cpp/meow_hash_native_stream.cpp',
'lib/cpp/main.cpp'
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")",
"lib/include/",
"lib/headers/"
],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'libraries': [],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS', 'NAPI_EXPERIMENTAL' ],
'conditions': [
[
'OS=="mac"', {
'xcode_settings': {
'OTHER_CFLAGS': [
'-mavx',
'-maes',
'-O3',
'-msse4.1'
]
},
}
]
]
}]
}
|
#!/usr/bin/env python3
# @Time : 17-9-2 01:53
# @Author : Wavky Huang
# @Contact : [email protected]
# @File : job.py
"""
Process information of the job.
"""
class Job:
def __init__(self, required_manhour=0, daily_work_hours=0, hourly_pay=0, max_daily_overhours=0):
"""
Define your job's condition.
:param required_manhour: monthly manhour required by company
:param daily_work_hours: daily work hours required by company
:param hourly_pay: hourly pay offers by company
:param max_daily_overhours: how many hours you can work overtime per day, while minus means unlimited
"""
self.required_manhour = required_manhour
self.daily_work_hours = daily_work_hours
self.hourly_pay = hourly_pay
self.max_daily_overhours = max_daily_overhours
if max_daily_overhours < 0:
self.max_daily_overhours = 24 - daily_work_hours
if daily_work_hours + max_daily_overhours > 24:
self.max_daily_overhours = 24 - daily_work_hours
print("daily_work_hours + max_daily_overhours > 24, max_daily_overhours has been set to {0}.".format(
self.max_daily_overhours))
def __str__(self):
return "Current Job: \t Require manhour = {0} \t Daily work hours = {1} \n\
\t\t Hourly pay = {2} \t\t Max daily overhours = {3}".format(self.required_manhour, self.daily_work_hours,
self.hourly_pay, self.max_daily_overhours)
def __repr__(self):
return self.__str__()
|
class ErrorResponse:
'''
This class handles if an Exception isreturn in a function.
'''
def __init__(self):
self.__error_response = self.__default_error_response
def __default_error_response(self, req, res, error_messages=None):
res.send_json({
"errors": error_messages
})
def override(self):
def handler(callback):
self.__error_response = callback
return handler
def call(self, req, res, error_messages):
self.__error_response(req, res, error_messages)
|
# dataset settings
dataset_type = 'ICCV09Dataset'
data_root = 'data/custom/iccv09Data'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (512, 512) # reduce crop size to avoid cuda memory issue, have to match with model input (if fine-tune from a pretrained model)
img_scale = (320, 240)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations'),
dict(type='Resize', img_scale=img_scale, ratio_range=(1., 1.5)), # imagine scale better larger than crop size after resized
dict(type='RandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
dict(type='RandomFlip', prob=0.5),
dict(type='PhotoMetricDistortion'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size=crop_size, pad_val=0, seg_pad_val=255),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_semantic_seg']),
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=img_scale,
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
flip=False,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
data = dict(
samples_per_gpu=2, # batch size
workers_per_gpu=0,
train=dict(
type=dataset_type,
data_root=data_root,
img_dir='images',
ann_dir='annotes',
split='splits/train.txt',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_root=data_root,
img_dir='images',
ann_dir='annotes',
split='splits/val.txt',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
data_root=data_root,
img_dir='images',
ann_dir='annotes',
split='splits/test.txt',
pipeline=test_pipeline))
|
# Enter your code here. Read input from STDIN. Print output to STDOUT
r = int(input("Enter no of matrix rows : "))
#c = input("Enter no of matrix column")
A = []
max = 0
for i in range(r):
a = []
row_list = input("Enter row "+str(i+1)+" columns : ")
a=list(map(int,row_list.split()))
A.append(a)
if len(A[i])>max:
max = len(A[i])
print('Original Matrix : ',A)
print('Maximum columns : ',max)
for i in range(r):
D = [0 for k in range(max)]
D[0:len(A[i])] = A[i]
A[i] = D
print('Final Matrix : ',A)
|
numbers = input().split(' ')
sorted_numbers = sorted(numbers)
reversed_numbers = list(reversed(sorted_numbers))
result = [print(x, end='') for x in reversed_numbers]
|
ACCOUNT_ID = '75ce4cee-6829-4274-80e1-77e89559ddfb'
JOB_CONFIG = {
'image': 'registry.console.elementai.com/eai.issam/ssh',
'data': ['c76999a2-05e7-4dcb-aef3-5da30b6c502c:/mnt/home',
'20552761-b5f3-4027-9811-d0f2f50a3e60:/mnt/results',
'9b4589c8-1b4d-4761-835b-474469b77153:/mnt/datasets'],
'preemptable':True,
'resources': {
'cpu': 4,
'mem': 8,
'gpu': 1
},
'interactive': False,
}
|
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
cursorA, cursorB = headA, headB
while cursorA != cursorB:
cursorA = cursorA.next if cursorA else headB
cursorB = cursorB.next if cursorB else headA
return cursorA
|
class DataGridViewDataErrorEventArgs(DataGridViewCellCancelEventArgs):
"""
Provides data for the System.Windows.Forms.DataGridView.DataError event.
DataGridViewDataErrorEventArgs(exception: Exception,columnIndex: int,rowIndex: int,context: DataGridViewDataErrorContexts)
"""
@staticmethod
def __new__(self, exception, columnIndex, rowIndex, context):
""" __new__(cls: type,exception: Exception,columnIndex: int,rowIndex: int,context: DataGridViewDataErrorContexts) """
pass
Context = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Gets details about the state of the System.Windows.Forms.DataGridView when the error occurred.
Get: Context(self: DataGridViewDataErrorEventArgs) -> DataGridViewDataErrorContexts
"""
Exception = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Gets the exception that represents the error.
Get: Exception(self: DataGridViewDataErrorEventArgs) -> Exception
"""
ThrowException = property(
lambda self: object(), lambda self, v: None, lambda self: None
)
"""Gets or sets a value indicating whether to throw the exception after the System.Windows.Forms.DataGridViewDataErrorEventHandler delegate is finished with it.
Get: ThrowException(self: DataGridViewDataErrorEventArgs) -> bool
Set: ThrowException(self: DataGridViewDataErrorEventArgs)=value
"""
|
times = ('Internacional', 'Galo', 'São Paulo', 'Flamengo', 'Palmeiras',
'Santos', 'Vasco', 'Flu', 'Ceará', 'Fortaleza', 'Atlético Goianinse',
'Grêmio', 'CAP', 'Sport', 'Corinthians', 'Bahia', 'Botafogo',
'Goias', 'Coritiba', 'Bragantino')
print('=-='*20)
print(f'Os cinco primeiros times são:', times[0:5])
print('=-='*20)
print(f'Os últimos quatro times são:', times[-4:])
print('=-='*20)
print(f'Os times em ordem alfabética são:', sorted(times))
print('=-='*20)
print(f'O Santos está na {times.index("Santos")+1}ª colocação.')
print('=-='*20)
|
#!/usr/bin/env python3
countryList = ["Unites States", "Russian Federation", "Germany", "Ireland"]
capitalLetters = [ country[0] for country in countryList ]
for i in range(len(capitalLetters)):
lineToPrint = str.join(" stands for ", [capitalLetters[i], countryList[i]])
print(lineToPrint)
|
n = int(input())
test_list = []
q = 0
for i in range(n):
entr = list(map(int, input().split()))
if 0 <= entr[0] <= 100 and 0 <= entr[1] <= 100:
test_list.append(entr)
for tests in test_list:
if tests[0] > tests[1]:
q += tests[1]
# if l > c:
# q += l - c
print(q)
|
def main():
determine_powerconsumption('src/december03/diagnostics.txt')
def determine_powerconsumption(diagnostics):
counter = [0] * 24
position = 0
with open(diagnostics, 'r') as diagnostics:
for diagnostic in diagnostics:
for position in range(12):
if diagnostic[position:position + 1] == "1":
counter[position] += 1
else:
counter[position + 12] += 1
gamma_rate_binary = [0] * 12
for position in range(12):
if counter[position] >= counter[position + 12]:
gamma_rate_binary[position] = 1
gamma_rate = ''.join(map(str, gamma_rate_binary))
flipbinary = gamma_rate.replace('1', 'p')
flipbinary = flipbinary.replace('0', '1')
epsilon_rate = flipbinary.replace('p', '0')
print("The power consumption of the submarine is ",
int(gamma_rate, 2) * int(epsilon_rate, 2))
if __name__ == "__main__":
main()
|
# Importação de bibliotecas
# Título do programa
print('\033[1;34;40mCONTANDO VOGAIS EM TUPLA\033[m')
# Objetos
varias = ('aprender', 'programar', 'linguagem', 'python', 'curso', 'gratis', 'estudar',
'praticar', 'trabalhar', 'mercador', 'programador', 'futuro')
tamvarias = len(varias)
vogais = ('a', 'e', 'i', 'o', 'u')
x = 0
y = 0
z = 0
# Lógica
while z < tamvarias:
palavra = varias[z]
tamanho = len(palavra)
print(f'\nNa palavra {palavra.upper()} tem as vogais', '', end='')
while y < tamanho:
letra = palavra[y]
while True:
if letra == vogais[x]:
print(vogais[x], '', end='')
x = 0
y = y + 1
break
else:
x = x + 1
if x == 5:
x = 0
y = y + 1
break
x = 0
y = 0
z = z + 1
|
class Solution:
def trap(self, height: List[int]) -> int:
if not height:
return 0
ans = 0
l = 0
r = len(height) - 1
maxL = height[l]
maxR = height[r]
while l < r:
if maxL < maxR:
ans += maxL - height[l]
l += 1
maxL = max(maxL, height[l])
else:
ans += maxR - height[r]
r -= 1
maxR = max(maxR, height[r])
return ans
|
class Solution:
def fractionToDecimal(self, numerator: int, denominator: int) -> str:
# is 0
if not numerator or not denominator:
return "0"
ans = ""
# negative
if (numerator < 0) != (denominator < 0):
ans += '-'
# to positive
numerator = abs( numerator )
denominator = abs( denominator )
remainder = numerator % denominator
ans += str(numerator // denominator)
# whole integer
if remainder == 0 :
return ans
ans += "."
remainder_hash = {}
while remainder != 0:
if remainder in remainder_hash:
ans = ans[:remainder_hash[remainder]] + "(" + ans[remainder_hash[remainder]:] + ")"
break
remainder_hash[remainder] = len(ans)
remainder *= 10
ans += str(remainder // denominator)
remainder %= denominator
return ans
|
_base_config_ = ["base.py"]
generator = dict(
use_norm=True,
style_cfg=dict(
type="SemanticStyleEncoder",
encoder_modulator="SPADE",
decoder_modulator="SPADE",middle_modulator="SPADE",
nhidden=256),
use_cse=False
)
discriminator=dict(pred_only_cse=True)
loss = dict(
gan_criterion=dict(type="fpn_cse", l1_weight=1, lambda_real=1, lambda_fake=0)
)
|
class Doc:
date = None
def __init__(self, title, content, data_src):
self.title = title
self.content = content
self.data_src = data_src
|
# https://www.hackerrank.com/challenges/python-mod-divmod/problem
if __name__ == '__main__':
number1 = int(input())
number2 = int(input())
division_oldWays = number1 // number2
division_mod_oldWays = number1 % number2
division_modernWays = number1.__divmod__(number2)
print(division_oldWays)
print(division_mod_oldWays)
print(division_modernWays)
|
times = ('Atlético-MG', 'Palmeiras', 'Fortaleza', 'Bragantino', 'Flamengo', 'Corinthians', 'Atlético-GO', 'Ceará', 'Atlético-PR', 'Internacional', 'Santos', 'São Paulo', 'Juventus', 'Cuiaba', 'Bahia', 'Fluminense', 'Gremio', 'Sport', 'America-MG', 'Chapecoense')
print('Os 5 primeros times são: ')
print(times[0:5])
print('-=-' *25)
print('Os 4 ultimos são: ')
print(times[-4:])
print('-=-'*25)
print('Times em ordem alfabética:')
print(sorted(times))
print('-=-'*25)
print('O time da chapecoense esta na posição: ')
print(times.index('Chapecoense')+1)
|
data_list = input().split(' -> ')
names_dict = {}
while not data_list[0] == 'end':
name = data_list[0]
tokens = data_list[1].split(', ')
if tokens[0].isdigit():
if name not in names_dict.keys():
names_dict[name] = []
else:
names_dict[name].extend(tokens)
else:
if tokens[0] in names_dict.keys():
if name not in names_dict.keys():
names_dict[name] = []
names_dict[name].extend(names_dict[tokens[0]])
data_list = input().split(' -> ')
|
#!/usr/bin/python
def lagFib():
k=1
mod=1000000
d=[None]
while True:
tmp = None
if k <= 55:
tmp = (100003 - 200003*k + 300007*k*k*k) % mod
else:
tmp = (d[32]+d.pop(1)) % mod
d.append(tmp)
yield tmp
k+=1
|
class CleanData():
def __init__(self):
pass
def clear_question_marks(self, df):
df = df[df['horsepower'] != '?']
df.astype({"horsepower": float})
return df
def drop_unused_columns(self, df):
return df.drop(['mpg', 'car_name'], axis=1)
def drop_car_name(self, df):
return df.drop(['car_name'], axis=1)
|
# !/usr/bin/env python
# -*-coding:utf-8 -*-
# Warning :The Hard Way Is Easier
"""
================================================================================================
两个等长整数列表a,b无序,允许交换a,b列表中的数据位置,使得a列表中数值的和与b列表中数据和的差最小
================================================================================================
"""
"""
way1.0:
"""
|
__author__ = 'Sphinx'
"""
Original newhsganalysis dependency lists
import os
import io
import glob
import errno
import copy
import json
import numpy as np
from scipy.optimize import curve_fit
import scipy.interpolate as spi
import scipy.optimize as spo
import scipy.fftpack as fft
import matplotlib.pyplot as plt
import scipy.ndimage as ndimage
import itertools as itt
"""
|
s={}
def update_s(s):
s.update({"a":1})
print(s)
update_s(s)
print(s)
class A:
def __init__(self):
self.test()
@property
def val(self):
print("call val")
return 1
def test(self):
self.val
a=A()
|
# print(type('Hello'))
# print(type(2))
# print(type(True))
# print(type('True'))
# print(type('False'))
# The bool() function converted the strings 'True' and 'False' to the Boolean values True and False.
# When the function is supplied with an empty string,
# it returns False, while any other non-empty string returns True.
# print(bool('True'))
# print(bool('False'))
# print(bool(''))
# print(bool(' '))
# print(bool('Hello'))
# The bool() function converts any non-zero value to True, but it converts the value 0 to False.
# print(bool(7))
# print(bool(1))
# print(bool(0))
# print(bool(-1))
# print(1 + 1 == 2)
# print(1 + 1 == 3)
# Comparison operators
# print(3 == 4)
# print(3 != 4)
# print(3 > 4)
# print(3 < 4)
# print(3 >= 4)
# print(3 <= 4)
ovejasN = 4
ovejasB = 2
print(ovejasN == (2 * ovejasB))
first_number = 5
second_number = 0
true_value = True
false_value = False
if first_number > 1 and first_number < 10:
print('The number is between 1 and 10')
if first_number > 1 or second_number < 1:
print('At lest one value is geater than 1')
print(not true_value)
print(not false_value)
if first_number > 1 and second_number < 1:
print('Both numbers pass the test')
else:
print('Both values do not passs the test')
|
'''Crie um programa que tenha uma dupla totalmente preenchida com uma contagem por extenso, de zero até vinte.
Seu programa deverá ler um número pelo teclado (entre 0 e 20) e mostrá-lo por extenso.'''
num = ('Zero', 'Um', 'Dois', 'Três', 'Quatro',
'Cinco', 'Seis', 'Sete', 'Oito', 'Nove', 'Dez',
'Onze', 'Doze', 'Treze', 'Quatorze', 'Quinze',
'Dezeseis', 'Desessete', 'Dezoito', 'Dezenove', 'Vinte')
res = 'S'
while res == 'S':
n = int(input('Digite um número de 0 a 20: '))
if not 0 <= n <= 20:
break
print(f'Você digitou o número {num[n]}')
res = str(input('Deseja continuar? [S/N] ')).upper().strip()[0]
|
#
# PySNMP MIB module PDN-CROSSCONNECT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-CROSSCONNECT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:29:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
crossConnect, = mibBuilder.importSymbols("PDN-HEADER-MIB", "crossConnect")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
IpAddress, Unsigned32, Counter32, Gauge32, iso, Bits, Integer32, Counter64, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, NotificationType, ObjectIdentity, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Unsigned32", "Counter32", "Gauge32", "iso", "Bits", "Integer32", "Counter64", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "NotificationType", "ObjectIdentity", "TimeTicks")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
devDs1FracTable = MibTable((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 1), )
if mibBuilder.loadTexts: devDs1FracTable.setStatus('mandatory')
devDs1FracEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 1, 1), ).setIndexNames((0, "PDN-CROSSCONNECT-MIB", "devDs1FracIndex"), (0, "PDN-CROSSCONNECT-MIB", "devDs1FracNumber"))
if mibBuilder.loadTexts: devDs1FracEntry.setStatus('mandatory')
devDs1FracIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: devDs1FracIndex.setStatus('mandatory')
devDs1FracNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 31))).setMaxAccess("readonly")
if mibBuilder.loadTexts: devDs1FracNumber.setStatus('mandatory')
devDs1FracIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 1, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: devDs1FracIfIndex.setStatus('mandatory')
devDs1FracIfFracNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: devDs1FracIfFracNumber.setStatus('mandatory')
devSyncDataPortAssignTable = MibTable((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 2), )
if mibBuilder.loadTexts: devSyncDataPortAssignTable.setStatus('mandatory')
devSyncDataPortAssignEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 2, 1), ).setIndexNames((0, "PDN-CROSSCONNECT-MIB", "devSyncDataPortAssignIndex"))
if mibBuilder.loadTexts: devSyncDataPortAssignEntry.setStatus('mandatory')
devSyncDataPortAssignIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: devSyncDataPortAssignIndex.setStatus('mandatory')
devSyncDataPortAssignRate = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24))).clone(namedValues=NamedValues(("rate56or64", 1), ("rate112or128", 2), ("rate168or192", 3), ("rate224or256", 4), ("rate280or320", 5), ("rate336or384", 6), ("rate392or448", 7), ("rate448or512", 8), ("rate504or576", 9), ("rate560or640", 10), ("rate616or704", 11), ("rate672or768", 12), ("rate728or832", 13), ("rate784or896", 14), ("rate840or960", 15), ("rate896or1024", 16), ("rate952or1088", 17), ("rate1008or1152", 18), ("rate1064or1216", 19), ("rate1120or1280", 20), ("rate1176or1344", 21), ("rate1232or1408", 22), ("rate1288or1472", 23), ("rate1344or1536", 24)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: devSyncDataPortAssignRate.setStatus('mandatory')
devSyncDataPortAssignIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 2, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: devSyncDataPortAssignIfIndex.setStatus('mandatory')
devCrossConUtility = MibIdentifier((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 4))
devCrossConClear = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("idle", 1), ("inprogress", 2), ("clear", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: devCrossConClear.setStatus('mandatory')
devCrossConTableLastChange = MibScalar((1, 3, 6, 1, 4, 1, 1795, 2, 24, 2, 6, 7, 4, 2), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: devCrossConTableLastChange.setStatus('mandatory')
mibBuilder.exportSymbols("PDN-CROSSCONNECT-MIB", devSyncDataPortAssignRate=devSyncDataPortAssignRate, devCrossConClear=devCrossConClear, devSyncDataPortAssignIfIndex=devSyncDataPortAssignIfIndex, devSyncDataPortAssignIndex=devSyncDataPortAssignIndex, devCrossConTableLastChange=devCrossConTableLastChange, devDs1FracEntry=devDs1FracEntry, devDs1FracIfFracNumber=devDs1FracIfFracNumber, devSyncDataPortAssignEntry=devSyncDataPortAssignEntry, devDs1FracNumber=devDs1FracNumber, devDs1FracTable=devDs1FracTable, devDs1FracIfIndex=devDs1FracIfIndex, devSyncDataPortAssignTable=devSyncDataPortAssignTable, devCrossConUtility=devCrossConUtility, devDs1FracIndex=devDs1FracIndex)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.