content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
def test_task_run():
print("test task run module")
assert 1 == 1
| def test_task_run():
print('test task run module')
assert 1 == 1 |
# A program to calculate frequency of array elements
class ArrayBasic:
def __init__(self, arr, n):
self.arr = arr
self.n = n
def calculate_frequency_hash_map(self):
"""
[A program to calculate counting frequency of array elements]
Time complexity: O(n)
Auxiliary space: O(n)
Returns:
[dict]: [A dict with count]
"""
hash_map = {}
for i in self.arr:
hash_map[i] = 1 if hash_map.get(i) == None else hash_map[i] + 1
return hash_map
# Driver
arr = [10, 20, 20, 10, 10, 20, 5, 20]
result = ArrayBasic(arr, len(arr))
print(f"Frequency of array elements is: {result.calculate_frequency_hash_map()}") | class Arraybasic:
def __init__(self, arr, n):
self.arr = arr
self.n = n
def calculate_frequency_hash_map(self):
"""
[A program to calculate counting frequency of array elements]
Time complexity: O(n)
Auxiliary space: O(n)
Returns:
[dict]: [A dict with count]
"""
hash_map = {}
for i in self.arr:
hash_map[i] = 1 if hash_map.get(i) == None else hash_map[i] + 1
return hash_map
arr = [10, 20, 20, 10, 10, 20, 5, 20]
result = array_basic(arr, len(arr))
print(f'Frequency of array elements is: {result.calculate_frequency_hash_map()}') |
n=int(input("Enter the Decimal Number:"))
def covbin(n):
if(n==0):
return 0
else:
return (n%2)+(10*covbin(n//2))
print("Binary is=",covbin(n))
| n = int(input('Enter the Decimal Number:'))
def covbin(n):
if n == 0:
return 0
else:
return n % 2 + 10 * covbin(n // 2)
print('Binary is=', covbin(n)) |
"""
ssml:sheetViews = ssml:CT_SheetViews
Sequence [1..1]
ssml:sheetView [1..*] Worksheet View
ssml:extLst [0..1] Future Feature Storage Area
ssml:sheetView = ssml:CT_SheetView
Sequence [1..1]
ssml:pane [0..1] View Pane
ssml:selection [0..4] Selection
ssml:pivotSelection [0..4] PivotTable Selection
ssml:extLst [0..1] Future Feature Storage Area
ssml:pane = ssml:CT_Pane
Attribute
xSplit [0..1] xsd:double Horizontal Split Position Default value is "0".
ySplit [0..1] xsd:double Vertical Split Position Default value is "0".
topLeftCell [0..1] ssml:ST_CellRef Top Left Visible Cell
activePane [0..1] ssml:ST_Pane Active Pane Default value is "topLeft".
state [0..1] ssml:ST_PaneState Split State Default value is "split".
ssml:selection = ssml:CT_Selection
Atrribute
pane [0..1] ssml:ST_Pane Pane Default value is "topLeft".
activeCell [0..1] ssml:ST_CellRef Active Cell Location
activeCellId [0..1] xsd:unsignedInt Active Cell Index Default value is "0".
sqref [0..1] ssml:ST_Sqref Sequence of References Default value is "A1".
ssml:pivotSelection = ssml:CT_PivotSelection
Atrribute
pane [0..1] ssml:ST_Pane Pane Default value is "topLeft".
showHeader [0..1] xsd:boolean Show Header Default value is "false".
label [0..1] xsd:boolean Label Default value is "false".
data [0..1] xsd:boolean Data Selection Default value is "false".
extendable [0..1] xsd:boolean Extendable Default value is "false".
count [0..1] xsd:unsignedInt Selection Count Default value is "0".
axis [0..1] ssml:ST_Axis Axis
dimension [0..1] xsd:unsignedInt Dimension Default value is "0".
start [0..1] xsd:unsignedInt Start Default value is "0".
min [0..1] xsd:unsignedInt Minimum Default value is "0".
max [0..1] xsd:unsignedInt Maximum Default value is "0".
activeRow [0..1] xsd:unsignedInt Active Row Default value is "0".
activeCol [0..1] xsd:unsignedInt Active Column Default value is "0".
previousRow [0..1] xsd:unsignedInt Previous Row Default value is "0".
previousCol [0..1] xsd:unsignedInt Previous Column Selection Default value is "0".
click [0..1] xsd:unsignedInt Click Count Default value is "0".
r:id [0..1] r:ST_RelationshipId Relationship Id
""" | """
ssml:sheetViews = ssml:CT_SheetViews
Sequence [1..1]
ssml:sheetView [1..*] Worksheet View
ssml:extLst [0..1] Future Feature Storage Area
ssml:sheetView = ssml:CT_SheetView
Sequence [1..1]
ssml:pane [0..1] View Pane
ssml:selection [0..4] Selection
ssml:pivotSelection [0..4] PivotTable Selection
ssml:extLst [0..1] Future Feature Storage Area
ssml:pane = ssml:CT_Pane
Attribute
xSplit [0..1] xsd:double Horizontal Split Position Default value is "0".
ySplit [0..1] xsd:double Vertical Split Position Default value is "0".
topLeftCell [0..1] ssml:ST_CellRef Top Left Visible Cell
activePane [0..1] ssml:ST_Pane Active Pane Default value is "topLeft".
state [0..1] ssml:ST_PaneState Split State Default value is "split".
ssml:selection = ssml:CT_Selection
Atrribute
pane [0..1] ssml:ST_Pane Pane Default value is "topLeft".
activeCell [0..1] ssml:ST_CellRef Active Cell Location
activeCellId [0..1] xsd:unsignedInt Active Cell Index Default value is "0".
sqref [0..1] ssml:ST_Sqref Sequence of References Default value is "A1".
ssml:pivotSelection = ssml:CT_PivotSelection
Atrribute
pane [0..1] ssml:ST_Pane Pane Default value is "topLeft".
showHeader [0..1] xsd:boolean Show Header Default value is "false".
label [0..1] xsd:boolean Label Default value is "false".
data [0..1] xsd:boolean Data Selection Default value is "false".
extendable [0..1] xsd:boolean Extendable Default value is "false".
count [0..1] xsd:unsignedInt Selection Count Default value is "0".
axis [0..1] ssml:ST_Axis Axis
dimension [0..1] xsd:unsignedInt Dimension Default value is "0".
start [0..1] xsd:unsignedInt Start Default value is "0".
min [0..1] xsd:unsignedInt Minimum Default value is "0".
max [0..1] xsd:unsignedInt Maximum Default value is "0".
activeRow [0..1] xsd:unsignedInt Active Row Default value is "0".
activeCol [0..1] xsd:unsignedInt Active Column Default value is "0".
previousRow [0..1] xsd:unsignedInt Previous Row Default value is "0".
previousCol [0..1] xsd:unsignedInt Previous Column Selection Default value is "0".
click [0..1] xsd:unsignedInt Click Count Default value is "0".
r:id [0..1] r:ST_RelationshipId Relationship Id
""" |
__all__ = ['descriptor',
'es_transport',
'flushing_buffer',
'line_buffer',
'sqs_transport',
'transport_exceptions',
'transport_result',
'transport_utils'] | __all__ = ['descriptor', 'es_transport', 'flushing_buffer', 'line_buffer', 'sqs_transport', 'transport_exceptions', 'transport_result', 'transport_utils'] |
# GPLv3 License
#
# Copyright (C) 2020 Ubisoft
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
This package defines how we send Blender updates to the server, and how we interpret updates we receive to update
Blender's data.
These functionalities are implemented in the BlenderClient class and in submodules of the package.
Submodules with a well defined entity name (camera, collection, light, ...) handle updates for the corresponding
data type in Blender. The goal is to replace all this specific code with the submodule data.py, which use
the blender_data package to treat updates of Blender's data in a generic way.
Specific code will still be required to handle non-Blender clients. As an example, mesh.py add to the MESH
message a triangulated, with modifiers applied, of the mesh. This is for non-Blender clients. In the future we want to
move these kind of specific processes to a plug-in system.
"""
| """
This package defines how we send Blender updates to the server, and how we interpret updates we receive to update
Blender's data.
These functionalities are implemented in the BlenderClient class and in submodules of the package.
Submodules with a well defined entity name (camera, collection, light, ...) handle updates for the corresponding
data type in Blender. The goal is to replace all this specific code with the submodule data.py, which use
the blender_data package to treat updates of Blender's data in a generic way.
Specific code will still be required to handle non-Blender clients. As an example, mesh.py add to the MESH
message a triangulated, with modifiers applied, of the mesh. This is for non-Blender clients. In the future we want to
move these kind of specific processes to a plug-in system.
""" |
def total_centro_custo(D_e):
D_return = {}
# Pecorre dados de cada pessoa
for v in D_e.values():
if v['centro de custo'] not in D_return:
D_return[v['centro de custo']] = 0
D_return[v['centro de custo']] += v['valor']
return D_return | def total_centro_custo(D_e):
d_return = {}
for v in D_e.values():
if v['centro de custo'] not in D_return:
D_return[v['centro de custo']] = 0
D_return[v['centro de custo']] += v['valor']
return D_return |
"""
jupylet/lru.py
Copyright (c) 2020, Nir Aides - nir@winpdb.org
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
SPRITE_TEXTURE_UNIT = 0
SKYBOX_TEXTURE_UNIT = 1
SHADOW_TEXTURE_UNIT = 2
class LRU(object):
"""Mechanism to allocate least recently used slot in array."""
def __init__(self, min_items, max_items):
self.mini = min_items
self.step = max_items
self.items = {i: [i, i, i, 0] for i in range(min_items, max_items)}
def reset(self, min_items, max_items):
self.mini = min_items
self.step = max_items
self.items = {i: [i, i, i, 0] for i in range(min_items, max_items)}
def allocate(self, lid=None):
"""Allocate slot.
Args:
lid (int): An id that identifies "object" in array. A new id will
be generated if None is given.
Returns:
tuple: A 4-tuple consisting of (step, lid, slot, new) where
*step* indicates the lru "timestamp" for this object,
*lid* is the allocated object id,
*slot* is the array index allocated for the "object", and
*new* is 1 if "object" was allocated a new slot or 0 if it
remains in the same slot it was before.
"""
self.step += 1
if lid is None:
lid = self.step
r = self.items.get(lid)
if r is None:
lid0, slot = min(self.items.values())[1:3]
self.items.pop(lid0)
self.items[lid] = [self.step, lid, slot, 0]
return self.step, lid, slot, 1
r[0] = self.step
return r
_MIN_TEXTURES = 3
_MAX_TEXTURES = 16
_lru_textures = LRU(_MIN_TEXTURES, _MAX_TEXTURES)
_MAX_MATERIALS = 12
_lru_materials = LRU(0, _MAX_MATERIALS)
| """
jupylet/lru.py
Copyright (c) 2020, Nir Aides - nir@winpdb.org
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
sprite_texture_unit = 0
skybox_texture_unit = 1
shadow_texture_unit = 2
class Lru(object):
"""Mechanism to allocate least recently used slot in array."""
def __init__(self, min_items, max_items):
self.mini = min_items
self.step = max_items
self.items = {i: [i, i, i, 0] for i in range(min_items, max_items)}
def reset(self, min_items, max_items):
self.mini = min_items
self.step = max_items
self.items = {i: [i, i, i, 0] for i in range(min_items, max_items)}
def allocate(self, lid=None):
"""Allocate slot.
Args:
lid (int): An id that identifies "object" in array. A new id will
be generated if None is given.
Returns:
tuple: A 4-tuple consisting of (step, lid, slot, new) where
*step* indicates the lru "timestamp" for this object,
*lid* is the allocated object id,
*slot* is the array index allocated for the "object", and
*new* is 1 if "object" was allocated a new slot or 0 if it
remains in the same slot it was before.
"""
self.step += 1
if lid is None:
lid = self.step
r = self.items.get(lid)
if r is None:
(lid0, slot) = min(self.items.values())[1:3]
self.items.pop(lid0)
self.items[lid] = [self.step, lid, slot, 0]
return (self.step, lid, slot, 1)
r[0] = self.step
return r
_min_textures = 3
_max_textures = 16
_lru_textures = lru(_MIN_TEXTURES, _MAX_TEXTURES)
_max_materials = 12
_lru_materials = lru(0, _MAX_MATERIALS) |
"""MicroESP Errors
"""
__author__ = 'Oleksandr Shepetko'
__email__ = 'a@shepetko.com'
__license__ = 'MIT'
class ESP8266Error(Exception):
pass
class DeviceNotConnectedError(ESP8266Error):
pass
class DeviceCodeExecutionError(ESP8266Error):
pass
| """MicroESP Errors
"""
__author__ = 'Oleksandr Shepetko'
__email__ = 'a@shepetko.com'
__license__ = 'MIT'
class Esp8266Error(Exception):
pass
class Devicenotconnectederror(ESP8266Error):
pass
class Devicecodeexecutionerror(ESP8266Error):
pass |
def print_n(s, n):
while n >= 0:
print(s)
n -= 1
| def print_n(s, n):
while n >= 0:
print(s)
n -= 1 |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file 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.
PACKAGE_XML_ELEMENT_ORDER = [
"name",
"version",
"description",
"author",
"maintainer",
"license",
"url",
"buildtool_depend",
"build_depend",
"build_export_depend",
"depend",
"exec_depend",
"test_depend",
"member_of_group",
"doc_depend",
"conflict",
"replace",
"export",
]
CMAKE_LISTS_RENAMED_VARIABLES = {
"${CATKIN_DEVEL_PREFIX}/": "",
"${CATKIN_GLOBAL_BIN_DESTINATION}": "bin",
"${CATKIN_GLOBAL_INCLUDE_DESTINATION}": "include",
"${CATKIN_GLOBAL_LIB_DESTINATION}": "lib",
"${CATKIN_GLOBAL_LIBEXEC_DESTINATION}": "lib",
"${CATKIN_GLOBAL_SHARE_DESTINATION}": "share",
"${CATKIN_PACKAGE_BIN_DESTINATION}": "bin",
"${CATKIN_PACKAGE_INCLUDE_DESTINATION}": "include/${PROJECT_NAME}",
"${CATKIN_PACKAGE_LIB_DESTINATION}": "lib",
"${CATKIN_PACKAGE_SHARE_DESTINATION}": "share/${PROJECT_NAME}",
"CATKIN_ENABLE_TESTING": "BUILD_TESTING"
}
# Commands that are not used by ROS2
CMAKE_LISTS_DELETED_COMMANDS = [
"catkin_package",
"roslaunch_add_file_check"
]
# List of ROS packages that have been renamed in ROS 2
RENAMED_ROS_PACKAGES = {
"tf": "tf2",
"roscpp": "rclcpp", # This shouldn't be here anyways
"rospy": "rclpy", # This shouldn't be here anyways
"nodelet": "rclcpp", # This shouldn't be here anyways
"message_generation": "rosidl_default_generators", # Shouldn't be here
"message_runtime": "rosidl_default_runtime", # Shouldn't be here
"rosconsole": "ros2_console", # Until ROS 2 replacement exists
"rviz": "rviz2",
"catkin": "ament_cmake" # Well.. it's not exactly a rename, but good enough
}
# List of packages that do not need to be found by CMake
NO_CMAKE_FIND_PACKAGES = [
"rosidl_default_runtime", # Shouldn't be here
"roslaunch", # They're probably trying to do roslaunch file testing
"catkin"
]
# List of packages that do not need to be found in package.xml
NO_PKG_XML_DEPENDS = [
"roslaunch"
]
# List of executables that have likely been renamed in ROS 2
RENAMED_ROS_EXECUTABLES = {
"rviz": "rviz2"
} | package_xml_element_order = ['name', 'version', 'description', 'author', 'maintainer', 'license', 'url', 'buildtool_depend', 'build_depend', 'build_export_depend', 'depend', 'exec_depend', 'test_depend', 'member_of_group', 'doc_depend', 'conflict', 'replace', 'export']
cmake_lists_renamed_variables = {'${CATKIN_DEVEL_PREFIX}/': '', '${CATKIN_GLOBAL_BIN_DESTINATION}': 'bin', '${CATKIN_GLOBAL_INCLUDE_DESTINATION}': 'include', '${CATKIN_GLOBAL_LIB_DESTINATION}': 'lib', '${CATKIN_GLOBAL_LIBEXEC_DESTINATION}': 'lib', '${CATKIN_GLOBAL_SHARE_DESTINATION}': 'share', '${CATKIN_PACKAGE_BIN_DESTINATION}': 'bin', '${CATKIN_PACKAGE_INCLUDE_DESTINATION}': 'include/${PROJECT_NAME}', '${CATKIN_PACKAGE_LIB_DESTINATION}': 'lib', '${CATKIN_PACKAGE_SHARE_DESTINATION}': 'share/${PROJECT_NAME}', 'CATKIN_ENABLE_TESTING': 'BUILD_TESTING'}
cmake_lists_deleted_commands = ['catkin_package', 'roslaunch_add_file_check']
renamed_ros_packages = {'tf': 'tf2', 'roscpp': 'rclcpp', 'rospy': 'rclpy', 'nodelet': 'rclcpp', 'message_generation': 'rosidl_default_generators', 'message_runtime': 'rosidl_default_runtime', 'rosconsole': 'ros2_console', 'rviz': 'rviz2', 'catkin': 'ament_cmake'}
no_cmake_find_packages = ['rosidl_default_runtime', 'roslaunch', 'catkin']
no_pkg_xml_depends = ['roslaunch']
renamed_ros_executables = {'rviz': 'rviz2'} |
class CommandModule:
def __init__(self, name, bus, conn, chan, conf):
self.name = name
self.conf = conf
self.chan = chan
self.conn = conn
self.bus = bus
def send(self, msg):
self.conn.privmsg(self.chan, msg)
def error(self, msg):
self.status('error: {}'.format(msg))
def status(self, msg):
self.send('[{}] {}'.format(self.name, msg))
def on_message(self, src, content):
content = content.strip()
words = content.split(' ')
if len(words) == 0:
return
cmd = words[0]
if cmd[0] != '!':
return
cmd = words[0][1:]
if hasattr(self, 'cmd_'+cmd):
getattr(self, 'cmd_'+cmd)(src, words[1:],
content[len(words[0]):].strip(), src)
def post(self, msg, *args, **kwargs):
self.bus.post(self, msg, args, kwargs)
def bus_handle(self, msg, args, kwargs):
mname = 'busmsg_' + msg
if hasattr(self, mname):
getattr(self, mname)(*args, **kwargs)
| class Commandmodule:
def __init__(self, name, bus, conn, chan, conf):
self.name = name
self.conf = conf
self.chan = chan
self.conn = conn
self.bus = bus
def send(self, msg):
self.conn.privmsg(self.chan, msg)
def error(self, msg):
self.status('error: {}'.format(msg))
def status(self, msg):
self.send('[{}] {}'.format(self.name, msg))
def on_message(self, src, content):
content = content.strip()
words = content.split(' ')
if len(words) == 0:
return
cmd = words[0]
if cmd[0] != '!':
return
cmd = words[0][1:]
if hasattr(self, 'cmd_' + cmd):
getattr(self, 'cmd_' + cmd)(src, words[1:], content[len(words[0]):].strip(), src)
def post(self, msg, *args, **kwargs):
self.bus.post(self, msg, args, kwargs)
def bus_handle(self, msg, args, kwargs):
mname = 'busmsg_' + msg
if hasattr(self, mname):
getattr(self, mname)(*args, **kwargs) |
text = input('Enter a text: ')
character = input('Enter a character that you can search in "'+text+'": ')
result = text.count(character)
print('The character "'+character+'" appears '+str(result)+' times in "'+text+'".') | text = input('Enter a text: ')
character = input('Enter a character that you can search in "' + text + '": ')
result = text.count(character)
print('The character "' + character + '" appears ' + str(result) + ' times in "' + text + '".') |
class BME280:
'''Class to mock temp sensor'''
def __init__(self):
'''Constructor for mock'''
def get_temperature(self):
'''Temp'''
return 20.0 | class Bme280:
"""Class to mock temp sensor"""
def __init__(self):
"""Constructor for mock"""
def get_temperature(self):
"""Temp"""
return 20.0 |
def test_movie_tech_sections(ia):
movie = ia.get_movie('0133093', info=['technical'])
tech = movie.get('tech', [])
assert set(tech.keys()) == set(['sound mix', 'color', 'aspect ratio', 'camera',
'laboratory', 'cinematographic process', 'printed film format',
'negative format', 'runtime', 'film length'])
| def test_movie_tech_sections(ia):
movie = ia.get_movie('0133093', info=['technical'])
tech = movie.get('tech', [])
assert set(tech.keys()) == set(['sound mix', 'color', 'aspect ratio', 'camera', 'laboratory', 'cinematographic process', 'printed film format', 'negative format', 'runtime', 'film length']) |
#!/usr/bin/env python3
#Swimming in the pool excercise
def getValue():
try:
valueInput = int(input())
except ValueError:
print("Wrong type")
quit()
else:
return valueInput
def calcResidue(length, coordinate):
halfOfLength = length / 2
residue = length - coordinate
if residue < halfOfLength:
return residue
else:
return coordinate
N = getValue()
M = getValue()
short = getValue()
long = getValue()
shortCalculated = short
longCalculated = long
if M < N:
shortCalculated = calcResidue(M, short)
else:
longCalculated = calcResidue(N, long)
if shortCalculated < longCalculated:
print(shortCalculated)
else:
print(longCalculated)
| def get_value():
try:
value_input = int(input())
except ValueError:
print('Wrong type')
quit()
else:
return valueInput
def calc_residue(length, coordinate):
half_of_length = length / 2
residue = length - coordinate
if residue < halfOfLength:
return residue
else:
return coordinate
n = get_value()
m = get_value()
short = get_value()
long = get_value()
short_calculated = short
long_calculated = long
if M < N:
short_calculated = calc_residue(M, short)
else:
long_calculated = calc_residue(N, long)
if shortCalculated < longCalculated:
print(shortCalculated)
else:
print(longCalculated) |
class Robot:
def greet(self):
print('Hello Viraj')
class RobotChild(Robot):
def greet(self):
print('Hello Scott')
# Instantiate RobotChild Class
child = RobotChild()
# Invoke Greet method from RobotChild class
child.greet()
| class Robot:
def greet(self):
print('Hello Viraj')
class Robotchild(Robot):
def greet(self):
print('Hello Scott')
child = robot_child()
child.greet() |
#!/usr/bin/env python3
def welcome():
print("Welcome")
def hi(name):
print("Hi " + name + "!")
welcome()
username = input("Who are there? ")
hi(name=username)
hi(username)
| def welcome():
print('Welcome')
def hi(name):
print('Hi ' + name + '!')
welcome()
username = input('Who are there? ')
hi(name=username)
hi(username) |
class Solution(object):
def reverseBits(self, n):
"""
:type n: int
:rtype: int
"""
for i in xrange(16):
a = (n >> i) & 1
b = (n >> (31-i)) & 1
if a:
n |= 1 << (31-i)
else:
n &= ~(1 << (31-i))
if b:
n |= 1 << i
else:
n &= ~(1 << i)
return n
if __name__ == '__main__':
sol = Solution()
sol.reverseBits(1) | class Solution(object):
def reverse_bits(self, n):
"""
:type n: int
:rtype: int
"""
for i in xrange(16):
a = n >> i & 1
b = n >> 31 - i & 1
if a:
n |= 1 << 31 - i
else:
n &= ~(1 << 31 - i)
if b:
n |= 1 << i
else:
n &= ~(1 << i)
return n
if __name__ == '__main__':
sol = solution()
sol.reverseBits(1) |
# preorder: root -> left -> right
# inorder: left -> root -> right
# we can first pick up root from preorder, then get the left and right subtrees from inorder
# Recursion
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
# preorder: root -> left -> right
# inorder: left -> root -> right
if not inorder:
return
# if inorder:
ind = inorder.index(preorder.pop(0))
root = TreeNode(inorder[ind])
root.left = self.buildTree(preorder, inorder[0:ind])
root.right = self.buildTree(preorder, inorder[ind+1:])
return root
# V2
class Solution:
def buildTree(self, preorder, inorder):
"""
:type preorder: List[int]
:type inorder: List[int]
:rtype: TreeNode
"""
def helper(in_left = 0, in_right = len(inorder)):
nonlocal pre_idx
# if there is no elements to construct subtrees
if in_left == in_right:
return None
# pick up pre_idx element as a root
root_val = preorder[pre_idx]
root = TreeNode(root_val)
# root splits inorder list
# into left and right subtrees
index = idx_map[root_val]
# recursion
pre_idx += 1
# build left subtree
root.left = helper(in_left, index)
# build right subtree
root.right = helper(index + 1, in_right)
return root
# start from first preorder element
pre_idx = 0
# build a hashmap value -> its index
idx_map = {val:idx for idx, val in enumerate(inorder)}
return helper()
# V3
class Solution(object):
def buildTree(self, preorder, inorder):
inorder_map = {val: i for i, val in enumerate(inorder)}
return self.dfs_helper(inorder_map, preorder, 0, len(inorder) - 1)
def dfs_helper(self, inorder_map, preorder, left, right):
if not preorder :
return
node = preorder.pop(0)
root = TreeNode(node)
root_index = inorder_map[node]
if root_index != left:
root.left = self.dfs_helper(inorder_map, preorder, left, root_index - 1)
if root_index != right:
root.right = self.dfs_helper(inorder_map, preorder, root_index + 1, right)
return root
# Time: O(N)
# Space;O(N)
| class Solution:
def build_tree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
if not inorder:
return
ind = inorder.index(preorder.pop(0))
root = tree_node(inorder[ind])
root.left = self.buildTree(preorder, inorder[0:ind])
root.right = self.buildTree(preorder, inorder[ind + 1:])
return root
class Solution:
def build_tree(self, preorder, inorder):
"""
:type preorder: List[int]
:type inorder: List[int]
:rtype: TreeNode
"""
def helper(in_left=0, in_right=len(inorder)):
nonlocal pre_idx
if in_left == in_right:
return None
root_val = preorder[pre_idx]
root = tree_node(root_val)
index = idx_map[root_val]
pre_idx += 1
root.left = helper(in_left, index)
root.right = helper(index + 1, in_right)
return root
pre_idx = 0
idx_map = {val: idx for (idx, val) in enumerate(inorder)}
return helper()
class Solution(object):
def build_tree(self, preorder, inorder):
inorder_map = {val: i for (i, val) in enumerate(inorder)}
return self.dfs_helper(inorder_map, preorder, 0, len(inorder) - 1)
def dfs_helper(self, inorder_map, preorder, left, right):
if not preorder:
return
node = preorder.pop(0)
root = tree_node(node)
root_index = inorder_map[node]
if root_index != left:
root.left = self.dfs_helper(inorder_map, preorder, left, root_index - 1)
if root_index != right:
root.right = self.dfs_helper(inorder_map, preorder, root_index + 1, right)
return root |
classes_names = [
'book',
'bottle',
'cabinet',
'ceiling',
'chair',
'cone',
'counter',
'dishwasher',
'faucet',
'fire extinguisher',
'floor',
'garbage bin',
'microwave',
'paper towel dispenser',
'paper',
'pot',
'refridgerator',
'stove burner',
'table',
'unknown',
'wall',
'bowl',
'magnet',
'sink',
'air vent',
'box',
'door knob',
'door',
'scissor',
'tape dispenser',
'telephone cord',
'telephone',
'track light',
'cork board',
'cup',
'desk',
'laptop',
'air duct',
'basket',
'camera',
'pipe',
'shelves',
'stacked chairs',
'styrofoam object',
'whiteboard',
'computer',
'keyboard',
'ladder',
'monitor',
'stand',
'bar',
'motion camera',
'projector screen',
'speaker',
'bag',
'clock',
'green screen',
'mantel',
'window',
'ball',
'hole puncher',
'light',
'manilla envelope',
'picture',
'mail shelf',
'printer',
'stapler',
'fax machine',
'folder',
'jar',
'magazine',
'ruler',
'cable modem',
'fan',
'file',
'hand sanitizer',
'paper rack',
'vase',
'air conditioner',
'blinds',
'flower',
'plant',
'sofa',
'stereo',
'books',
'exit sign',
'room divider',
'bookshelf',
'curtain',
'projector',
'modem',
'wire',
'water purifier',
'column',
'hooks',
'hanging hooks',
'pen',
'electrical outlet',
'doll',
'eraser',
'pencil holder',
'water carboy',
'mouse',
'cable rack',
'wire rack',
'flipboard',
'map',
'paper cutter',
'tape',
'thermostat',
'heater',
'circuit breaker box',
'paper towel',
'stamp',
'duster',
'poster case',
'whiteboard marker',
'ethernet jack',
'pillow',
'hair brush',
'makeup brush',
'mirror',
'shower curtain',
'toilet',
'toiletries bag',
'toothbrush holder',
'toothbrush',
'toothpaste',
'platter',
'rug',
'squeeze tube',
'shower cap',
'soap',
'towel rod',
'towel',
'bathtub',
'candle',
'tissue box',
'toilet paper',
'container',
'clothes',
'electric toothbrush',
'floor mat',
'lamp',
'drum',
'flower pot',
'banana',
'candlestick',
'shoe',
'stool',
'urn',
'earplugs',
'mailshelf',
'placemat',
'excercise ball',
'alarm clock',
'bed',
'night stand',
'deoderant',
'headphones',
'headboard',
'basketball hoop',
'foot rest',
'laundry basket',
'sock',
'football',
'mens suit',
'cable box',
'dresser',
'dvd player',
'shaver',
'television',
'contact lens solution bottle',
'drawer',
'remote control',
'cologne',
'stuffed animal',
'lint roller',
'tray',
'lock',
'purse',
'toy bottle',
'crate',
'vasoline',
'gift wrapping roll',
'wall decoration',
'hookah',
'radio',
'bicycle',
'pen box',
'mask',
'shorts',
'hat',
'hockey glove',
'hockey stick',
'vuvuzela',
'dvd',
'chessboard',
'suitcase',
'calculator',
'flashcard',
'staple remover',
'umbrella',
'bench',
'yoga mat',
'backpack',
'cd',
'sign',
'hangers',
'notebook',
'hanger',
'security camera',
'folders',
'clothing hanger',
'stairs',
'glass rack',
'saucer',
'tag',
'dolly',
'machine',
'trolly',
'shopping baskets',
'gate',
'bookrack',
'blackboard',
'coffee bag',
'coffee packet',
'hot water heater',
'muffins',
'napkin dispenser',
'plaque',
'plastic tub',
'plate',
'coffee machine',
'napkin holder',
'radiator',
'coffee grinder',
'oven',
'plant pot',
'scarf',
'spice rack',
'stove',
'tea kettle',
'napkin',
'bag of chips',
'bread',
'cutting board',
'dish brush',
'serving spoon',
'sponge',
'toaster',
'cooking pan',
'kitchen items',
'ladel',
'spatula',
'spice stand',
'trivet',
'knife rack',
'knife',
'baking dish',
'dish scrubber',
'drying rack',
'vessel',
'kichen towel',
'tin foil',
'kitchen utensil',
'utensil',
'blender',
'garbage bag',
'sink protector',
'box of ziplock bags',
'spice bottle',
'pitcher',
'pizza box',
'toaster oven',
'step stool',
'vegetable peeler',
'washing machine',
'can opener',
'can of food',
'paper towel holder',
'spoon stand',
'spoon',
'wooden kitchen utensils',
'bag of flour',
'fruit',
'sheet of metal',
'waffle maker',
'cake',
'cell phone',
'tv stand',
'tablecloth',
'wine glass',
'sculpture',
'wall stand',
'iphone',
'coke bottle',
'piano',
'wine rack',
'guitar',
'light switch',
'shirts in hanger',
'router',
'glass pot',
'cart',
'vacuum cleaner',
'bin',
'coins',
'hand sculpture',
'ipod',
'jersey',
'blanket',
'ironing board',
'pen stand',
'mens tie',
'glass baking dish',
'utensils',
'frying pan',
'shopping cart',
'plastic bowl',
'wooden container',
'onion',
'potato',
'jacket',
'dvds',
'surge protector',
'tumbler',
'broom',
'can',
'crock pot',
'person',
'salt shaker',
'wine bottle',
'apple',
'eye glasses',
'menorah',
'bicycle helmet',
'fire alarm',
'water fountain',
'humidifier',
'necklace',
'chandelier',
'barrel',
'chest',
'decanter',
'wooden utensils',
'globe',
'sheets',
'fork',
'napkin ring',
'gift wrapping',
'bed sheets',
'spot light',
'lighting track',
'cannister',
'coffee table',
'mortar and pestle',
'stack of plates',
'ottoman',
'server',
'salt container',
'utensil container',
'phone jack',
'switchbox',
'casserole dish',
'oven handle',
'whisk',
'dish cover',
'electric mixer',
'decorative platter',
'drawer handle',
'fireplace',
'stroller',
'bookend',
'table runner',
'typewriter',
'ashtray',
'key',
'suit jacket',
'range hood',
'cleaning wipes',
'six pack of beer',
'decorative plate',
'watch',
'balloon',
'ipad',
'coaster',
'whiteboard eraser',
'toy',
'toys basket',
'toy truck',
'classroom board',
'chart stand',
'picture of fish',
'plastic box',
'pencil',
'carton',
'walkie talkie',
'binder',
'coat hanger',
'filing shelves',
'plastic crate',
'plastic rack',
'plastic tray',
'flag',
'poster board',
'lunch bag',
'board',
'leg of a girl',
'file holder',
'chart',
'glass pane',
'cardboard tube',
'bassinet',
'toy car',
'toy shelf',
'toy bin',
'toys shelf',
'educational display',
'placard',
'soft toy group',
'soft toy',
'toy cube',
'toy cylinder',
'toy rectangle',
'toy triangle',
'bucket',
'chalkboard',
'game table',
'storage shelvesbooks',
'toy cuboid',
'toy tree',
'wooden toy',
'toy box',
'toy phone',
'toy sink',
'toyhouse',
'notecards',
'toy trucks',
'wall hand sanitizer dispenser',
'cap stand',
'music stereo',
'toys rack',
'display board',
'lid of jar',
'stacked bins boxes',
'stacked plastic racks',
'storage rack',
'roll of paper towels',
'cables',
'power surge',
'cardboard sheet',
'banister',
'show piece',
'pepper shaker',
'kitchen island',
'excercise equipment',
'treadmill',
'ornamental plant',
'piano bench',
'sheet music',
'grandfather clock',
'iron grill',
'pen holder',
'toy doll',
'globe stand',
'telescope',
'magazine holder',
'file container',
'paper holder',
'flower box',
'pyramid',
'desk mat',
'cordless phone',
'desk drawer',
'envelope',
'window frame',
'id card',
'file stand',
'paper weight',
'toy plane',
'money',
'papers',
'comforter',
'crib',
'doll house',
'toy chair',
'toy sofa',
'plastic chair',
'toy house',
'child carrier',
'cloth bag',
'cradle',
'baby chair',
'chart roll',
'toys box',
'railing',
'clothing dryer',
'clothing washer',
'laundry detergent jug',
'clothing detergent',
'bottle of soap',
'box of paper',
'trolley',
'hand sanitizer dispenser',
'soap holder',
'water dispenser',
'photo',
'water cooler',
'foosball table',
'crayon',
'hoola hoop',
'horse toy',
'plastic toy container',
'pool table',
'game system',
'pool sticks',
'console system',
'video game',
'pool ball',
'trampoline',
'tricycle',
'wii',
'furniture',
'alarm',
'toy table',
'ornamental item',
'copper vessel',
'stick',
'car',
'mezuza',
'toy cash register',
'lid',
'paper bundle',
'business cards',
'clipboard',
'flatbed scanner',
'paper tray',
'mouse pad',
'display case',
'tree sculpture',
'basketball',
'fiberglass case',
'framed certificate',
'cordless telephone',
'shofar',
'trophy',
'cleaner',
'cloth drying stand',
'electric box',
'furnace',
'piece of wood',
'wooden pillar',
'drying stand',
'cane',
'clothing drying rack',
'iron box',
'excercise machine',
'sheet',
'rope',
'sticks',
'wooden planks',
'toilet plunger',
'bar of soap',
'toilet bowl brush',
'light bulb',
'drain',
'faucet handle',
'nailclipper',
'shaving cream',
'rolled carpet',
'clothing iron',
'window cover',
'charger and wire',
'quilt',
'mattress',
'hair dryer',
'stones',
'pepper grinder',
'cat cage',
'dish rack',
'curtain rod',
'calendar',
'head phones',
'cd disc',
'head phone',
'usb drive',
'water heater',
'pan',
'tuna cans',
'baby gate',
'spoon sets',
'cans of cat food',
'cat',
'flower basket',
'fruit platter',
'grapefruit',
'kiwi',
'hand blender',
'knobs',
'vessels',
'cell phone charger',
'wire basket',
'tub of tupperware',
'candelabra',
'litter box',
'shovel',
'cat bed',
'door way',
'belt',
'surge protect',
'glass',
'console controller',
'shoe rack',
'door frame',
'computer disk',
'briefcase',
'mail tray',
'file pad',
'letter stand',
'plastic cup of coffee',
'glass box',
'ping pong ball',
'ping pong racket',
'ping pong table',
'tennis racket',
'ping pong racquet',
'xbox',
'electric toothbrush base',
'toilet brush',
'toiletries',
'razor',
'bottle of contact lens solution',
'contact lens case',
'cream',
'glass container',
'container of skin cream',
'soap dish',
'scale',
'soap stand',
'cactus',
'door window reflection',
'ceramic frog',
'incense candle',
'storage space',
'door lock',
'toilet paper holder',
'tissue',
'personal care liquid',
'shower head',
'shower knob',
'knob',
'cream tube',
'perfume box',
'perfume',
'back scrubber',
'door facing trimreflection',
'doorreflection',
'light switchreflection',
'medicine tube',
'wallet',
'soap tray',
'door curtain',
'shower pipe',
'face wash cream',
'flashlight',
'shower base',
'window shelf',
'shower hose',
'toothpaste holder',
'soap box',
'incense holder',
'conch shell',
'roll of toilet paper',
'shower tube',
'bottle of listerine',
'bottle of hand wash liquid',
'tea pot',
'lazy susan',
'avocado',
'fruit stand',
'fruitplate',
'oil container',
'package of water',
'bottle of liquid',
'door way arch',
'jug',
'bulb',
'bagel',
'bag of bagels',
'banana peel',
'bag of oreo',
'flask',
'collander',
'brick',
'torch',
'dog bowl',
'wooden plank',
'eggs',
'grill',
'dog',
'chimney',
'dog cage',
'orange plastic cap',
'glass set',
'vessel set',
'mellon',
'aluminium foil',
'orange',
'peach',
'tea coaster',
'butterfly sculpture',
'corkscrew',
'heating tray',
'food processor',
'corn',
'squash',
'watermellon',
'vegetables',
'celery',
'glass dish',
'hot dogs',
'plastic dish',
'vegetable',
'sticker',
'chapstick',
'sifter',
'fruit basket',
'glove',
'measuring cup',
'water filter',
'wine accessory',
'dishes',
'file box',
'ornamental pot',
'dog toy',
'salt and pepper',
'electrical kettle',
'kitchen container plastic',
'pineapple',
'suger jar',
'steamer',
'charger',
'mug holder',
'orange juicer',
'juicer',
'bag of hot dog buns',
'hamburger bun',
'mug hanger',
'bottle of ketchup',
'toy kitchen',
'food wrapped on a tray',
'kitchen utensils',
'oven mitt',
'bottle of comet',
'wooden utensil',
'decorative dish',
'handle',
'label',
'flask set',
'cooking pot cover',
'tupperware',
'garlic',
'tissue roll',
'lemon',
'wine',
'decorative bottle',
'wire tray',
'tea cannister',
'clothing hamper',
'guitar case',
'wardrobe',
'boomerang',
'button',
'karate belts',
'medal',
'window seat',
'window box',
'necklace holder',
'beeper',
'webcam',
'fish tank',
'luggage',
'life jacket',
'shoelace',
'pen cup',
'eyeball plastic ball',
'toy pyramid',
'model boat',
'certificate',
'puppy toy',
'wire board',
'quill',
'canister',
'toy boat',
'antenna',
'bean bag',
'lint comb',
'travel bag',
'wall divider',
'toy chest',
'headband',
'luggage rack',
'bunk bed',
'lego',
'yarmulka',
'package of bedroom sheets',
'bedding package',
'comb',
'dollar bill',
'pig',
'storage bin',
'storage chest',
'slide',
'playpen',
'electronic drumset',
'ipod dock',
'microphone',
'music keyboard',
'music stand',
'microphone stand',
'album',
'kinect',
'inkwell',
'baseball',
'decorative bowl',
'book holder',
'toy horse',
'desser',
'toy apple',
'toy dog',
'scenary',
'drawer knob',
'shoe hanger',
'tent',
'figurine',
'soccer ball',
'hand weight',
'magic 8ball',
'bottle of perfume',
'sleeping bag',
'decoration item',
'envelopes',
'trinket',
'hand fan',
'sculpture of the chrysler building',
'sculpture of the eiffel tower',
'sculpture of the empire state building',
'jeans',
'garage door',
'case',
'rags',
'decorative item',
'toy stroller',
'shelf frame',
'cat house',
'can of beer',
'dog bed',
'lamp shade',
'bracelet',
'reflection of window shutters',
'decorative egg',
'indoor fountain',
'photo album',
'decorative candle',
'walkietalkie',
'serving dish',
'floor trim',
'mini display platform',
'american flag',
'vhs tapes',
'throw',
'newspapers',
'mantle',
'package of bottled water',
'serving platter',
'display platter',
'centerpiece',
'tea box',
'gold piece',
'wreathe',
'lectern',
'hammer',
'matchbox',
'pepper',
'yellow pepper',
'duck',
'eggplant',
'glass ware',
'sewing machine',
'rolled up rug',
'doily',
'coffee pot',
'torah',
] | classes_names = ['book', 'bottle', 'cabinet', 'ceiling', 'chair', 'cone', 'counter', 'dishwasher', 'faucet', 'fire extinguisher', 'floor', 'garbage bin', 'microwave', 'paper towel dispenser', 'paper', 'pot', 'refridgerator', 'stove burner', 'table', 'unknown', 'wall', 'bowl', 'magnet', 'sink', 'air vent', 'box', 'door knob', 'door', 'scissor', 'tape dispenser', 'telephone cord', 'telephone', 'track light', 'cork board', 'cup', 'desk', 'laptop', 'air duct', 'basket', 'camera', 'pipe', 'shelves', 'stacked chairs', 'styrofoam object', 'whiteboard', 'computer', 'keyboard', 'ladder', 'monitor', 'stand', 'bar', 'motion camera', 'projector screen', 'speaker', 'bag', 'clock', 'green screen', 'mantel', 'window', 'ball', 'hole puncher', 'light', 'manilla envelope', 'picture', 'mail shelf', 'printer', 'stapler', 'fax machine', 'folder', 'jar', 'magazine', 'ruler', 'cable modem', 'fan', 'file', 'hand sanitizer', 'paper rack', 'vase', 'air conditioner', 'blinds', 'flower', 'plant', 'sofa', 'stereo', 'books', 'exit sign', 'room divider', 'bookshelf', 'curtain', 'projector', 'modem', 'wire', 'water purifier', 'column', 'hooks', 'hanging hooks', 'pen', 'electrical outlet', 'doll', 'eraser', 'pencil holder', 'water carboy', 'mouse', 'cable rack', 'wire rack', 'flipboard', 'map', 'paper cutter', 'tape', 'thermostat', 'heater', 'circuit breaker box', 'paper towel', 'stamp', 'duster', 'poster case', 'whiteboard marker', 'ethernet jack', 'pillow', 'hair brush', 'makeup brush', 'mirror', 'shower curtain', 'toilet', 'toiletries bag', 'toothbrush holder', 'toothbrush', 'toothpaste', 'platter', 'rug', 'squeeze tube', 'shower cap', 'soap', 'towel rod', 'towel', 'bathtub', 'candle', 'tissue box', 'toilet paper', 'container', 'clothes', 'electric toothbrush', 'floor mat', 'lamp', 'drum', 'flower pot', 'banana', 'candlestick', 'shoe', 'stool', 'urn', 'earplugs', 'mailshelf', 'placemat', 'excercise ball', 'alarm clock', 'bed', 'night stand', 'deoderant', 'headphones', 'headboard', 'basketball hoop', 'foot rest', 'laundry basket', 'sock', 'football', 'mens suit', 'cable box', 'dresser', 'dvd player', 'shaver', 'television', 'contact lens solution bottle', 'drawer', 'remote control', 'cologne', 'stuffed animal', 'lint roller', 'tray', 'lock', 'purse', 'toy bottle', 'crate', 'vasoline', 'gift wrapping roll', 'wall decoration', 'hookah', 'radio', 'bicycle', 'pen box', 'mask', 'shorts', 'hat', 'hockey glove', 'hockey stick', 'vuvuzela', 'dvd', 'chessboard', 'suitcase', 'calculator', 'flashcard', 'staple remover', 'umbrella', 'bench', 'yoga mat', 'backpack', 'cd', 'sign', 'hangers', 'notebook', 'hanger', 'security camera', 'folders', 'clothing hanger', 'stairs', 'glass rack', 'saucer', 'tag', 'dolly', 'machine', 'trolly', 'shopping baskets', 'gate', 'bookrack', 'blackboard', 'coffee bag', 'coffee packet', 'hot water heater', 'muffins', 'napkin dispenser', 'plaque', 'plastic tub', 'plate', 'coffee machine', 'napkin holder', 'radiator', 'coffee grinder', 'oven', 'plant pot', 'scarf', 'spice rack', 'stove', 'tea kettle', 'napkin', 'bag of chips', 'bread', 'cutting board', 'dish brush', 'serving spoon', 'sponge', 'toaster', 'cooking pan', 'kitchen items', 'ladel', 'spatula', 'spice stand', 'trivet', 'knife rack', 'knife', 'baking dish', 'dish scrubber', 'drying rack', 'vessel', 'kichen towel', 'tin foil', 'kitchen utensil', 'utensil', 'blender', 'garbage bag', 'sink protector', 'box of ziplock bags', 'spice bottle', 'pitcher', 'pizza box', 'toaster oven', 'step stool', 'vegetable peeler', 'washing machine', 'can opener', 'can of food', 'paper towel holder', 'spoon stand', 'spoon', 'wooden kitchen utensils', 'bag of flour', 'fruit', 'sheet of metal', 'waffle maker', 'cake', 'cell phone', 'tv stand', 'tablecloth', 'wine glass', 'sculpture', 'wall stand', 'iphone', 'coke bottle', 'piano', 'wine rack', 'guitar', 'light switch', 'shirts in hanger', 'router', 'glass pot', 'cart', 'vacuum cleaner', 'bin', 'coins', 'hand sculpture', 'ipod', 'jersey', 'blanket', 'ironing board', 'pen stand', 'mens tie', 'glass baking dish', 'utensils', 'frying pan', 'shopping cart', 'plastic bowl', 'wooden container', 'onion', 'potato', 'jacket', 'dvds', 'surge protector', 'tumbler', 'broom', 'can', 'crock pot', 'person', 'salt shaker', 'wine bottle', 'apple', 'eye glasses', 'menorah', 'bicycle helmet', 'fire alarm', 'water fountain', 'humidifier', 'necklace', 'chandelier', 'barrel', 'chest', 'decanter', 'wooden utensils', 'globe', 'sheets', 'fork', 'napkin ring', 'gift wrapping', 'bed sheets', 'spot light', 'lighting track', 'cannister', 'coffee table', 'mortar and pestle', 'stack of plates', 'ottoman', 'server', 'salt container', 'utensil container', 'phone jack', 'switchbox', 'casserole dish', 'oven handle', 'whisk', 'dish cover', 'electric mixer', 'decorative platter', 'drawer handle', 'fireplace', 'stroller', 'bookend', 'table runner', 'typewriter', 'ashtray', 'key', 'suit jacket', 'range hood', 'cleaning wipes', 'six pack of beer', 'decorative plate', 'watch', 'balloon', 'ipad', 'coaster', 'whiteboard eraser', 'toy', 'toys basket', 'toy truck', 'classroom board', 'chart stand', 'picture of fish', 'plastic box', 'pencil', 'carton', 'walkie talkie', 'binder', 'coat hanger', 'filing shelves', 'plastic crate', 'plastic rack', 'plastic tray', 'flag', 'poster board', 'lunch bag', 'board', 'leg of a girl', 'file holder', 'chart', 'glass pane', 'cardboard tube', 'bassinet', 'toy car', 'toy shelf', 'toy bin', 'toys shelf', 'educational display', 'placard', 'soft toy group', 'soft toy', 'toy cube', 'toy cylinder', 'toy rectangle', 'toy triangle', 'bucket', 'chalkboard', 'game table', 'storage shelvesbooks', 'toy cuboid', 'toy tree', 'wooden toy', 'toy box', 'toy phone', 'toy sink', 'toyhouse', 'notecards', 'toy trucks', 'wall hand sanitizer dispenser', 'cap stand', 'music stereo', 'toys rack', 'display board', 'lid of jar', 'stacked bins boxes', 'stacked plastic racks', 'storage rack', 'roll of paper towels', 'cables', 'power surge', 'cardboard sheet', 'banister', 'show piece', 'pepper shaker', 'kitchen island', 'excercise equipment', 'treadmill', 'ornamental plant', 'piano bench', 'sheet music', 'grandfather clock', 'iron grill', 'pen holder', 'toy doll', 'globe stand', 'telescope', 'magazine holder', 'file container', 'paper holder', 'flower box', 'pyramid', 'desk mat', 'cordless phone', 'desk drawer', 'envelope', 'window frame', 'id card', 'file stand', 'paper weight', 'toy plane', 'money', 'papers', 'comforter', 'crib', 'doll house', 'toy chair', 'toy sofa', 'plastic chair', 'toy house', 'child carrier', 'cloth bag', 'cradle', 'baby chair', 'chart roll', 'toys box', 'railing', 'clothing dryer', 'clothing washer', 'laundry detergent jug', 'clothing detergent', 'bottle of soap', 'box of paper', 'trolley', 'hand sanitizer dispenser', 'soap holder', 'water dispenser', 'photo', 'water cooler', 'foosball table', 'crayon', 'hoola hoop', 'horse toy', 'plastic toy container', 'pool table', 'game system', 'pool sticks', 'console system', 'video game', 'pool ball', 'trampoline', 'tricycle', 'wii', 'furniture', 'alarm', 'toy table', 'ornamental item', 'copper vessel', 'stick', 'car', 'mezuza', 'toy cash register', 'lid', 'paper bundle', 'business cards', 'clipboard', 'flatbed scanner', 'paper tray', 'mouse pad', 'display case', 'tree sculpture', 'basketball', 'fiberglass case', 'framed certificate', 'cordless telephone', 'shofar', 'trophy', 'cleaner', 'cloth drying stand', 'electric box', 'furnace', 'piece of wood', 'wooden pillar', 'drying stand', 'cane', 'clothing drying rack', 'iron box', 'excercise machine', 'sheet', 'rope', 'sticks', 'wooden planks', 'toilet plunger', 'bar of soap', 'toilet bowl brush', 'light bulb', 'drain', 'faucet handle', 'nailclipper', 'shaving cream', 'rolled carpet', 'clothing iron', 'window cover', 'charger and wire', 'quilt', 'mattress', 'hair dryer', 'stones', 'pepper grinder', 'cat cage', 'dish rack', 'curtain rod', 'calendar', 'head phones', 'cd disc', 'head phone', 'usb drive', 'water heater', 'pan', 'tuna cans', 'baby gate', 'spoon sets', 'cans of cat food', 'cat', 'flower basket', 'fruit platter', 'grapefruit', 'kiwi', 'hand blender', 'knobs', 'vessels', 'cell phone charger', 'wire basket', 'tub of tupperware', 'candelabra', 'litter box', 'shovel', 'cat bed', 'door way', 'belt', 'surge protect', 'glass', 'console controller', 'shoe rack', 'door frame', 'computer disk', 'briefcase', 'mail tray', 'file pad', 'letter stand', 'plastic cup of coffee', 'glass box', 'ping pong ball', 'ping pong racket', 'ping pong table', 'tennis racket', 'ping pong racquet', 'xbox', 'electric toothbrush base', 'toilet brush', 'toiletries', 'razor', 'bottle of contact lens solution', 'contact lens case', 'cream', 'glass container', 'container of skin cream', 'soap dish', 'scale', 'soap stand', 'cactus', 'door window reflection', 'ceramic frog', 'incense candle', 'storage space', 'door lock', 'toilet paper holder', 'tissue', 'personal care liquid', 'shower head', 'shower knob', 'knob', 'cream tube', 'perfume box', 'perfume', 'back scrubber', 'door facing trimreflection', 'doorreflection', 'light switchreflection', 'medicine tube', 'wallet', 'soap tray', 'door curtain', 'shower pipe', 'face wash cream', 'flashlight', 'shower base', 'window shelf', 'shower hose', 'toothpaste holder', 'soap box', 'incense holder', 'conch shell', 'roll of toilet paper', 'shower tube', 'bottle of listerine', 'bottle of hand wash liquid', 'tea pot', 'lazy susan', 'avocado', 'fruit stand', 'fruitplate', 'oil container', 'package of water', 'bottle of liquid', 'door way arch', 'jug', 'bulb', 'bagel', 'bag of bagels', 'banana peel', 'bag of oreo', 'flask', 'collander', 'brick', 'torch', 'dog bowl', 'wooden plank', 'eggs', 'grill', 'dog', 'chimney', 'dog cage', 'orange plastic cap', 'glass set', 'vessel set', 'mellon', 'aluminium foil', 'orange', 'peach', 'tea coaster', 'butterfly sculpture', 'corkscrew', 'heating tray', 'food processor', 'corn', 'squash', 'watermellon', 'vegetables', 'celery', 'glass dish', 'hot dogs', 'plastic dish', 'vegetable', 'sticker', 'chapstick', 'sifter', 'fruit basket', 'glove', 'measuring cup', 'water filter', 'wine accessory', 'dishes', 'file box', 'ornamental pot', 'dog toy', 'salt and pepper', 'electrical kettle', 'kitchen container plastic', 'pineapple', 'suger jar', 'steamer', 'charger', 'mug holder', 'orange juicer', 'juicer', 'bag of hot dog buns', 'hamburger bun', 'mug hanger', 'bottle of ketchup', 'toy kitchen', 'food wrapped on a tray', 'kitchen utensils', 'oven mitt', 'bottle of comet', 'wooden utensil', 'decorative dish', 'handle', 'label', 'flask set', 'cooking pot cover', 'tupperware', 'garlic', 'tissue roll', 'lemon', 'wine', 'decorative bottle', 'wire tray', 'tea cannister', 'clothing hamper', 'guitar case', 'wardrobe', 'boomerang', 'button', 'karate belts', 'medal', 'window seat', 'window box', 'necklace holder', 'beeper', 'webcam', 'fish tank', 'luggage', 'life jacket', 'shoelace', 'pen cup', 'eyeball plastic ball', 'toy pyramid', 'model boat', 'certificate', 'puppy toy', 'wire board', 'quill', 'canister', 'toy boat', 'antenna', 'bean bag', 'lint comb', 'travel bag', 'wall divider', 'toy chest', 'headband', 'luggage rack', 'bunk bed', 'lego', 'yarmulka', 'package of bedroom sheets', 'bedding package', 'comb', 'dollar bill', 'pig', 'storage bin', 'storage chest', 'slide', 'playpen', 'electronic drumset', 'ipod dock', 'microphone', 'music keyboard', 'music stand', 'microphone stand', 'album', 'kinect', 'inkwell', 'baseball', 'decorative bowl', 'book holder', 'toy horse', 'desser', 'toy apple', 'toy dog', 'scenary', 'drawer knob', 'shoe hanger', 'tent', 'figurine', 'soccer ball', 'hand weight', 'magic 8ball', 'bottle of perfume', 'sleeping bag', 'decoration item', 'envelopes', 'trinket', 'hand fan', 'sculpture of the chrysler building', 'sculpture of the eiffel tower', 'sculpture of the empire state building', 'jeans', 'garage door', 'case', 'rags', 'decorative item', 'toy stroller', 'shelf frame', 'cat house', 'can of beer', 'dog bed', 'lamp shade', 'bracelet', 'reflection of window shutters', 'decorative egg', 'indoor fountain', 'photo album', 'decorative candle', 'walkietalkie', 'serving dish', 'floor trim', 'mini display platform', 'american flag', 'vhs tapes', 'throw', 'newspapers', 'mantle', 'package of bottled water', 'serving platter', 'display platter', 'centerpiece', 'tea box', 'gold piece', 'wreathe', 'lectern', 'hammer', 'matchbox', 'pepper', 'yellow pepper', 'duck', 'eggplant', 'glass ware', 'sewing machine', 'rolled up rug', 'doily', 'coffee pot', 'torah'] |
'''
Return the nth Fibonacci number
F0 = 0 F1 = 1
Fn = Fn-1 + Fn-2
'''
def Fibonacci(n):
''' return nth fibonacci number
to reduce O(n), we invoke recursion only once during one call (Fn-1, Fn-2)
'''
if n <= 1:
return (n,0)
else:
(a,b) = Fibonacci(n-1)
return (a+b,a)
#print(Fibonacci(9)[0])
'''
sum the elements of a sequence recursively
'''
def linear_sum(data):
if len(data) == 0 :
return 0
else:
return data[len(data)-1]+linear_sum(data[0:len(data)-1])
# a = [4,3,6,2,8,9,3,2,8,5,1,7,2,8,3,7]
# print(linear_sum(a))
# b = [4,3,6,2,8]
# print(linear_sum(b))
'''
reverse a sequence with recursion
'''
def reverse_seq(sequence,start,stop):
if len(sequence[start:stop]) != 1:
print(start,stop)
sequence[stop-1],sequence[start] = sequence[start],sequence[stop-1]
reverse_seq(sequence,start+1,stop-1)
return sequence
# a = [1,2,3,4,5]
# print(reverse_seq(a,start= 0,stop = len(a)))
'''
computing powers
x**n = x * x**(n-1)
'''
def compute_powers(x,n):
if n == 0 :
return 1
else:
x = x * compute_powers(x,n-1)
return x
print(compute_powers(2,5))
| """
Return the nth Fibonacci number
F0 = 0 F1 = 1
Fn = Fn-1 + Fn-2
"""
def fibonacci(n):
""" return nth fibonacci number
to reduce O(n), we invoke recursion only once during one call (Fn-1, Fn-2)
"""
if n <= 1:
return (n, 0)
else:
(a, b) = fibonacci(n - 1)
return (a + b, a)
'\nsum the elements of a sequence recursively\n'
def linear_sum(data):
if len(data) == 0:
return 0
else:
return data[len(data) - 1] + linear_sum(data[0:len(data) - 1])
'\nreverse a sequence with recursion\n'
def reverse_seq(sequence, start, stop):
if len(sequence[start:stop]) != 1:
print(start, stop)
(sequence[stop - 1], sequence[start]) = (sequence[start], sequence[stop - 1])
reverse_seq(sequence, start + 1, stop - 1)
return sequence
'\ncomputing powers\nx**n = x * x**(n-1)\n'
def compute_powers(x, n):
if n == 0:
return 1
else:
x = x * compute_powers(x, n - 1)
return x
print(compute_powers(2, 5)) |
thisdict = {
"brand":"Ford",
"model":"Mustang",
"year":1964
}
for x in thisdict.values():
print(x)
| thisdict = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964}
for x in thisdict.values():
print(x) |
name = "ada lovelace"
print(name.title())
print(name.upper())
print(name.lower())
| name = 'ada lovelace'
print(name.title())
print(name.upper())
print(name.lower()) |
#!/usr/bin/env python
"""
Class definition to store attributes of micro architectural events
This module provides definitions for the following events
1. generic core - events programmable in general purpose pmu registers
2. fixed core - events colleted by fixed pmu registers
3. offcore - counters for offcore requests and responses
Author: Manikandan Dhamodharan, Morgan Stanley
"""
class GenericCoreEvent(object):
"""Generic PMU Core Event"""
eventType = 'GenericCore'
def __init__(self):
self.eventType = GenericCoreEvent.eventType
self.name = None
self.eventSelect = None
self.unitMask = None
self.counterMask = None
self.invert = None
self.briefDescription = None
self.description = None
self._validSmtPmc = None
self._validPmc = None
self.msrIndex = None
self.msrValue = None
self.anyThread = None
self.edgeDetect = None
self.pebs = None
self.takenAlone = None
self.dataLA = None
self.l1HitIndication = None
self.errata = None
self.isOffCore = False
@property
def validPmc(self):
"""returns a set of programmable pmc registers"""
return self._validPmc if self._validPmc else self._validSmtPmc
def unInitialized(self):
"""Checks if all required attribues are initialized"""
return (
self.name is None
or self.eventSelect is None
or self.unitMask is None
or self.counterMask is None
or self.invert is None
or self.briefDescription is None
or self.description is None
or self.validPmc is None
or self.msrIndex is None
or self.msrValue is None
or self.anyThread is None
or self.edgeDetect is None
or self.pebs is None
)
def rawValue(self):
"""Returns a raw bit mask for this event"""
val = self.eventSelect | (self.unitMask << 8)
val |= self.edgeDetect << 18
val |= self.anyThread << 21
val |= self.counterMask << 24
val |= self.invert << 23
return val
def canUse(self, counterIndex):
"""
Checks if this pmu event can be programmed at given register index
:param counterIndex: Index of the register to check
"""
return counterIndex in self.validPmc # pylint: disable=unsupported-membership-test
def isConstrained(self):
"""Checks if this event imposes, any constraints on programmable registers"""
return len(self.validPmc) < 8
def __repr__(self):
"""Returns string representation of this generic core event"""
counterMaskRepr = ' [CMask-{}]'.format(self.counterMask) if self.counterMask else ''
return '{:60s} [0x{:08X}] - {}{}'.format(self.name, self.rawValue(), self.briefDescription, counterMaskRepr)
def __eq__(self, other):
return self.__dict__ == other.__dict__
class FixedCoreEvent(GenericCoreEvent):
"""Fixed PMU Core Event"""
eventType = 'FixedCore'
def __init__(self):
GenericCoreEvent.__init__(self)
self.eventType = FixedCoreEvent.eventType
def __repr__(self):
eventName = '{} (FixedCtr {})'.format(self.name, self.validPmc)
return '{:60s} [FixedCtr-{}] - {}'.format(eventName, self.validPmc, self.briefDescription)
class OffCoreEvent(GenericCoreEvent):
"""
Offcore events need to program two general purpose counter with with request and response event select codes
in addition to two request/response msr registers. The event select in this case will be an array instead of a scalar
value
"""
eventType = 'OffCore'
eventSelects = [int('B7', 16), int('BB', 16)]
def __init__(self):
GenericCoreEvent.__init__(self)
self.eventType = OffCoreEvent.eventType
self.isOffCore = True
def __repr__(self):
"""str representation of a PMUGpEvent"""
return '{:60s} [0x{:02X},0x{:02X}|0x{:02X}] - {}'.format(
self.name,
self.eventSelect[0], self.eventSelect[1] if len(self.eventSelect) > 1 else 0, # pylint: disable=unsubscriptable-object
self.unitMask, self.briefDescription
)
class UnCoreEvent(object):
"""Offcore PMU Core Event"""
eventType = 'UnCore'
def __init__(self):
self.eventType = UnCoreEvent.eventType
| """
Class definition to store attributes of micro architectural events
This module provides definitions for the following events
1. generic core - events programmable in general purpose pmu registers
2. fixed core - events colleted by fixed pmu registers
3. offcore - counters for offcore requests and responses
Author: Manikandan Dhamodharan, Morgan Stanley
"""
class Genericcoreevent(object):
"""Generic PMU Core Event"""
event_type = 'GenericCore'
def __init__(self):
self.eventType = GenericCoreEvent.eventType
self.name = None
self.eventSelect = None
self.unitMask = None
self.counterMask = None
self.invert = None
self.briefDescription = None
self.description = None
self._validSmtPmc = None
self._validPmc = None
self.msrIndex = None
self.msrValue = None
self.anyThread = None
self.edgeDetect = None
self.pebs = None
self.takenAlone = None
self.dataLA = None
self.l1HitIndication = None
self.errata = None
self.isOffCore = False
@property
def valid_pmc(self):
"""returns a set of programmable pmc registers"""
return self._validPmc if self._validPmc else self._validSmtPmc
def un_initialized(self):
"""Checks if all required attribues are initialized"""
return self.name is None or self.eventSelect is None or self.unitMask is None or (self.counterMask is None) or (self.invert is None) or (self.briefDescription is None) or (self.description is None) or (self.validPmc is None) or (self.msrIndex is None) or (self.msrValue is None) or (self.anyThread is None) or (self.edgeDetect is None) or (self.pebs is None)
def raw_value(self):
"""Returns a raw bit mask for this event"""
val = self.eventSelect | self.unitMask << 8
val |= self.edgeDetect << 18
val |= self.anyThread << 21
val |= self.counterMask << 24
val |= self.invert << 23
return val
def can_use(self, counterIndex):
"""
Checks if this pmu event can be programmed at given register index
:param counterIndex: Index of the register to check
"""
return counterIndex in self.validPmc
def is_constrained(self):
"""Checks if this event imposes, any constraints on programmable registers"""
return len(self.validPmc) < 8
def __repr__(self):
"""Returns string representation of this generic core event"""
counter_mask_repr = ' [CMask-{}]'.format(self.counterMask) if self.counterMask else ''
return '{:60s} [0x{:08X}] - {}{}'.format(self.name, self.rawValue(), self.briefDescription, counterMaskRepr)
def __eq__(self, other):
return self.__dict__ == other.__dict__
class Fixedcoreevent(GenericCoreEvent):
"""Fixed PMU Core Event"""
event_type = 'FixedCore'
def __init__(self):
GenericCoreEvent.__init__(self)
self.eventType = FixedCoreEvent.eventType
def __repr__(self):
event_name = '{} (FixedCtr {})'.format(self.name, self.validPmc)
return '{:60s} [FixedCtr-{}] - {}'.format(eventName, self.validPmc, self.briefDescription)
class Offcoreevent(GenericCoreEvent):
"""
Offcore events need to program two general purpose counter with with request and response event select codes
in addition to two request/response msr registers. The event select in this case will be an array instead of a scalar
value
"""
event_type = 'OffCore'
event_selects = [int('B7', 16), int('BB', 16)]
def __init__(self):
GenericCoreEvent.__init__(self)
self.eventType = OffCoreEvent.eventType
self.isOffCore = True
def __repr__(self):
"""str representation of a PMUGpEvent"""
return '{:60s} [0x{:02X},0x{:02X}|0x{:02X}] - {}'.format(self.name, self.eventSelect[0], self.eventSelect[1] if len(self.eventSelect) > 1 else 0, self.unitMask, self.briefDescription)
class Uncoreevent(object):
"""Offcore PMU Core Event"""
event_type = 'UnCore'
def __init__(self):
self.eventType = UnCoreEvent.eventType |
"""
Functions for working with, checking and converting numbers.
All numbers are stored within the computer as the positive equivalent.
They may be interpreted as negative.
"""
def number_to_bitstring(number, bit_width=8):
"""
Convert a number to an equivalent bitstring of the given width.
Raises:
ValueError: If number doesn't fit in the bit width.
"""
if not number_is_within_bit_limit(number, bit_width=bit_width):
raise ValueError(
"{number} will not fit in {num_bits} bits.".format(
number=number, num_bits=bit_width
)
)
number = get_positive_equivalent(number)
return "{number:0{bit_width}b}".format(
number=number, bit_width=bit_width
)
def number_is_within_bit_limit(number, bit_width=8):
"""
Check if a number can be stored in the number of bits given.
Negative numbers are stored in 2's compliment binary.
Args:
number (int): The number to check.
bit_width (int, optional): The number of bits available.
Returns:
bool: True if within limits, False if not.
"""
min_val = (2**bit_width / 2) * -1
max_val = 2**bit_width - 1
return min_val <= number <= max_val
def get_positive_equivalent(number):
"""
Read the 2's compliment equivalent of this number as positive.
With a 3 bit number, the positive equivalent of -2 is 5. E.g.::
-4 4 100
-3 5 101
-2 6 110
-1 7 111
0 0 000
1 1 001
2 2 010
3 3 011
Args:
number (int): The number to convert to a positive quivalent
Returns:
int: The positive equivalent of the number.
"""
ret = number
if number < 0:
ret = number + 256
return ret
def bitstring_to_number(bitstring):
"""
Convert a bitstring to a number.
E.g. ``10110101`` gives 181.
Args:
bitstring (str): String of ``1``\ s and ``0``\ s.
Returns:
int: The equivalent integer.
"""
return int(bitstring, 2)
def bitstring_to_hex_string(bitstring, zero_pad_width=2):
"""
Convert a bitstring to a hex number.
Args:
bitstring (str): String of ``1``\ s and ``0``\ s.
zero_pad_width (int) (optional): How many zeroes to pad the
returned hex value with.
"""
return "{num:0{zero_pad_width}X}".format(
num=int(bitstring, 2), zero_pad_width=zero_pad_width
)
| """
Functions for working with, checking and converting numbers.
All numbers are stored within the computer as the positive equivalent.
They may be interpreted as negative.
"""
def number_to_bitstring(number, bit_width=8):
"""
Convert a number to an equivalent bitstring of the given width.
Raises:
ValueError: If number doesn't fit in the bit width.
"""
if not number_is_within_bit_limit(number, bit_width=bit_width):
raise value_error('{number} will not fit in {num_bits} bits.'.format(number=number, num_bits=bit_width))
number = get_positive_equivalent(number)
return '{number:0{bit_width}b}'.format(number=number, bit_width=bit_width)
def number_is_within_bit_limit(number, bit_width=8):
"""
Check if a number can be stored in the number of bits given.
Negative numbers are stored in 2's compliment binary.
Args:
number (int): The number to check.
bit_width (int, optional): The number of bits available.
Returns:
bool: True if within limits, False if not.
"""
min_val = 2 ** bit_width / 2 * -1
max_val = 2 ** bit_width - 1
return min_val <= number <= max_val
def get_positive_equivalent(number):
"""
Read the 2's compliment equivalent of this number as positive.
With a 3 bit number, the positive equivalent of -2 is 5. E.g.::
-4 4 100
-3 5 101
-2 6 110
-1 7 111
0 0 000
1 1 001
2 2 010
3 3 011
Args:
number (int): The number to convert to a positive quivalent
Returns:
int: The positive equivalent of the number.
"""
ret = number
if number < 0:
ret = number + 256
return ret
def bitstring_to_number(bitstring):
"""
Convert a bitstring to a number.
E.g. ``10110101`` gives 181.
Args:
bitstring (str): String of ``1``\\ s and ``0``\\ s.
Returns:
int: The equivalent integer.
"""
return int(bitstring, 2)
def bitstring_to_hex_string(bitstring, zero_pad_width=2):
"""
Convert a bitstring to a hex number.
Args:
bitstring (str): String of ``1``\\ s and ``0``\\ s.
zero_pad_width (int) (optional): How many zeroes to pad the
returned hex value with.
"""
return '{num:0{zero_pad_width}X}'.format(num=int(bitstring, 2), zero_pad_width=zero_pad_width) |
def has_style(tag):
return tag.has_attr('style')
def has_class(tag):
return tag.has_attr('class')
def clean(soup):
if soup.name == 'br' or soup.name == 'img' or soup.name == 'p' or soup.name == 'div':
return
try:
ll = 0
for j in soup.strings:
ll += len(j.replace('\n', ''))
if ll == 0:
soup.decompose()
else:
for child in soup.children:
clean(child)
except Exception as e:
pass
def dfs(soup, v):
if soup.name == 'a' or soup.name == 'br':
return
try:
lt = len(soup.get_text())
ls = len(str(soup))
a = soup.find_all('a')
at = 0
for j in a:
at += len(j.get_text())
lvt = lt - at
v.append((soup, lt / ls * lvt))
for child in soup.children:
dfs(child, v)
except Exception as e:
pass
def extract(soup, text_only = True, remove_img = True):
filt = ['script', 'noscript', 'style', 'embed', 'label', 'form', 'input', 'iframe', 'head', 'meta', 'link', 'object', 'aside', 'channel']
if remove_img:
filt.append('img')
for ff in filt:
for i in soup.find_all(ff):
i.decompose()
for tag in soup.find_all(has_style):
del tag['style']
for tag in soup.find_all(has_class):
del tag['class']
clean(soup)
LVT = len(soup.get_text())
for i in soup.find_all('a'):
LVT -= len(i.get_text())
v = []
dfs(soup, v)
mij = 0
for i in range(len(v)):
if v[i][1] > v[mij][1]:
mij = i
if text_only:
res = v[mij][0].get_text()
else:
res = str(v[mij][0])
return res, v[mij][1] / LVT
| def has_style(tag):
return tag.has_attr('style')
def has_class(tag):
return tag.has_attr('class')
def clean(soup):
if soup.name == 'br' or soup.name == 'img' or soup.name == 'p' or (soup.name == 'div'):
return
try:
ll = 0
for j in soup.strings:
ll += len(j.replace('\n', ''))
if ll == 0:
soup.decompose()
else:
for child in soup.children:
clean(child)
except Exception as e:
pass
def dfs(soup, v):
if soup.name == 'a' or soup.name == 'br':
return
try:
lt = len(soup.get_text())
ls = len(str(soup))
a = soup.find_all('a')
at = 0
for j in a:
at += len(j.get_text())
lvt = lt - at
v.append((soup, lt / ls * lvt))
for child in soup.children:
dfs(child, v)
except Exception as e:
pass
def extract(soup, text_only=True, remove_img=True):
filt = ['script', 'noscript', 'style', 'embed', 'label', 'form', 'input', 'iframe', 'head', 'meta', 'link', 'object', 'aside', 'channel']
if remove_img:
filt.append('img')
for ff in filt:
for i in soup.find_all(ff):
i.decompose()
for tag in soup.find_all(has_style):
del tag['style']
for tag in soup.find_all(has_class):
del tag['class']
clean(soup)
lvt = len(soup.get_text())
for i in soup.find_all('a'):
lvt -= len(i.get_text())
v = []
dfs(soup, v)
mij = 0
for i in range(len(v)):
if v[i][1] > v[mij][1]:
mij = i
if text_only:
res = v[mij][0].get_text()
else:
res = str(v[mij][0])
return (res, v[mij][1] / LVT) |
#
# PySNMP MIB module HIRSCHMANN-PIM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HIRSCHMANN-PIM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:31:12 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, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion")
hmPlatform4Multicast, = mibBuilder.importSymbols("HIRSCHMANN-MULTICAST-MIB", "hmPlatform4Multicast")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
ipMRouteNextHopGroup, ipMRouteSourceMask, ipMRouteNextHopIfIndex, ipMRouteNextHopAddress, ipMRouteNextHopSourceMask, ipMRouteGroup, ipMRouteNextHopSource, ipMRouteSource = mibBuilder.importSymbols("IPMROUTE-STD-MIB", "ipMRouteNextHopGroup", "ipMRouteSourceMask", "ipMRouteNextHopIfIndex", "ipMRouteNextHopAddress", "ipMRouteNextHopSourceMask", "ipMRouteGroup", "ipMRouteNextHopSource", "ipMRouteSource")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
Gauge32, IpAddress, iso, Unsigned32, Bits, ModuleIdentity, ObjectIdentity, Integer32, TimeTicks, MibIdentifier, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "IpAddress", "iso", "Unsigned32", "Bits", "ModuleIdentity", "ObjectIdentity", "Integer32", "TimeTicks", "MibIdentifier", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Counter64")
TruthValue, TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "RowStatus", "DisplayString")
hmPIMMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 248, 15, 4, 99))
hmPIMMIB.setRevisions(('2006-02-06 12:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: hmPIMMIB.setRevisionsDescriptions(('Initial version, published as RFC 2934.',))
if mibBuilder.loadTexts: hmPIMMIB.setLastUpdated('200602061200Z')
if mibBuilder.loadTexts: hmPIMMIB.setOrganization('Hirschmann Automation and Control GmbH')
if mibBuilder.loadTexts: hmPIMMIB.setContactInfo('Customer Support Postal: Hirschmann Automation and Control GmbH Stuttgarter Str. 45-51 72654 Neckartenzlingen Germany Tel: +49 7127 14 1981 Web: http://www.hicomcenter.com/ E-Mail: hicomcenter@hirschmann.com')
if mibBuilder.loadTexts: hmPIMMIB.setDescription('The Hirschmann Private Platform4 PIM MIB definitions for Platform devices.')
hmPIMMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1))
hmPIMTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0))
hmPIM = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1))
hmPIMJoinPruneInterval = MibScalar((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 1), Integer32()).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hmPIMJoinPruneInterval.setStatus('current')
if mibBuilder.loadTexts: hmPIMJoinPruneInterval.setDescription('The default interval at which periodic PIM-SM Join/Prune messages are to be sent.')
hmPIMInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2), )
if mibBuilder.loadTexts: hmPIMInterfaceTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceTable.setDescription("The (conceptual) table listing the router's PIM interfaces. IGMP and PIM are enabled on all interfaces listed in this table.")
hmPIMInterfaceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMInterfaceIfIndex"))
if mibBuilder.loadTexts: hmPIMInterfaceEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceEntry.setDescription('An entry (conceptual row) in the hmPIMInterfaceTable.')
hmPIMInterfaceIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 1), InterfaceIndex())
if mibBuilder.loadTexts: hmPIMInterfaceIfIndex.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceIfIndex.setDescription('The ifIndex value of this PIM interface.')
hmPIMInterfaceAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMInterfaceAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceAddress.setDescription('The IP address of the PIM interface.')
hmPIMInterfaceNetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 3), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMInterfaceNetMask.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceNetMask.setDescription('The network mask for the IP address of the PIM interface.')
hmPIMInterfaceMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dense", 1), ("sparse", 2), ("sparseDense", 3))).clone('dense')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMInterfaceMode.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceMode.setDescription('The configured mode of this PIM interface. A value of sparseDense is only valid for PIMv1.')
hmPIMInterfaceDR = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 5), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMInterfaceDR.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceDR.setDescription('The Designated Router on this PIM interface. For point-to- point interfaces, this object has the value 0.0.0.0.')
hmPIMInterfaceHelloInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 6), Integer32().clone(30)).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMInterfaceHelloInterval.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceHelloInterval.setDescription('The frequency at which PIM Hello messages are transmitted on this interface.')
hmPIMInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMInterfaceStatus.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceStatus.setDescription('The status of this entry. Creating the entry enables PIM on the interface; destroying the entry disables PIM on the interface.')
hmPIMInterfaceJoinPruneInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 8), Integer32()).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMInterfaceJoinPruneInterval.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceJoinPruneInterval.setDescription('The frequency at which PIM Join/Prune messages are transmitted on this PIM interface. The default value of this object is the hmPIMJoinPruneInterval.')
hmPIMInterfaceCBSRPreference = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMInterfaceCBSRPreference.setStatus('current')
if mibBuilder.loadTexts: hmPIMInterfaceCBSRPreference.setDescription('The preference value for the local interface as a candidate bootstrap router. The value of -1 is used to indicate that the local interface is not a candidate BSR interface.')
hmPIMNeighborTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3), )
if mibBuilder.loadTexts: hmPIMNeighborTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborTable.setDescription("The (conceptual) table listing the router's PIM neighbors.")
hmPIMNeighborEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMNeighborAddress"))
if mibBuilder.loadTexts: hmPIMNeighborEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborEntry.setDescription('An entry (conceptual row) in the hmPIMNeighborTable.')
hmPIMNeighborAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 1), IpAddress())
if mibBuilder.loadTexts: hmPIMNeighborAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborAddress.setDescription('The IP address of the PIM neighbor for which this entry contains information.')
hmPIMNeighborIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 2), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMNeighborIfIndex.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborIfIndex.setDescription('The value of ifIndex for the interface used to reach this PIM neighbor.')
hmPIMNeighborUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMNeighborUpTime.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborUpTime.setDescription('The time since this PIM neighbor (last) became a neighbor of the local router.')
hmPIMNeighborExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMNeighborExpiryTime.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborExpiryTime.setDescription('The minimum time remaining before this PIM neighbor will be aged out.')
hmPIMNeighborMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dense", 1), ("sparse", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMNeighborMode.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMNeighborMode.setDescription('The active PIM mode of this neighbor. This object is deprecated for PIMv2 routers since all neighbors on the interface must be either dense or sparse as determined by the protocol running on the interface.')
hmPIMIpMRouteTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4), )
if mibBuilder.loadTexts: hmPIMIpMRouteTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteTable defined in the IP Multicast MIB.')
hmPIMIpMRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1), ).setIndexNames((0, "IPMROUTE-STD-MIB", "ipMRouteGroup"), (0, "IPMROUTE-STD-MIB", "ipMRouteSource"), (0, "IPMROUTE-STD-MIB", "ipMRouteSourceMask"))
if mibBuilder.loadTexts: hmPIMIpMRouteEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteTable. There is one entry per entry in the ipMRouteTable whose incoming interface is running PIM.')
hmPIMIpMRouteUpstreamAssertTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 1), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMIpMRouteUpstreamAssertTimer.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteUpstreamAssertTimer.setDescription('The time remaining before the router changes its upstream neighbor back to its RPF neighbor. This timer is called the Assert timer in the PIM Sparse and Dense mode specification. A value of 0 indicates that no Assert has changed the upstream neighbor away from the RPF neighbor.')
hmPIMIpMRouteAssertMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetric.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetric.setDescription('The metric advertised by the assert winner on the upstream interface, or 0 if no such assert is in received.')
hmPIMIpMRouteAssertMetricPref = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetricPref.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteAssertMetricPref.setDescription('The preference advertised by the assert winner on the upstream interface, or 0 if no such assert is in effect.')
hmPIMIpMRouteAssertRPTBit = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 4), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMIpMRouteAssertRPTBit.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteAssertRPTBit.setDescription('The value of the RPT-bit advertised by the assert winner on the upstream interface, or false if no such assert is in effect.')
hmPIMIpMRouteFlags = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 5), Bits().clone(namedValues=NamedValues(("rpt", 0), ("spt", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMIpMRouteFlags.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteFlags.setDescription('This object describes PIM-specific flags related to a multicast state entry. See the PIM Sparse Mode specification for the meaning of the RPT and SPT bits.')
hmPIMIpMRouteNextHopTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7), )
if mibBuilder.loadTexts: hmPIMIpMRouteNextHopTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteNextHopTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteNextHopTable defined in the IP Multicast MIB.')
hmPIMIpMRouteNextHopEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1), ).setIndexNames((0, "IPMROUTE-STD-MIB", "ipMRouteNextHopGroup"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopSource"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopSourceMask"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopIfIndex"), (0, "IPMROUTE-STD-MIB", "ipMRouteNextHopAddress"))
if mibBuilder.loadTexts: hmPIMIpMRouteNextHopEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteNextHopEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteNextHopTable. There is one entry per entry in the ipMRouteNextHopTable whose interface is running PIM and whose ipMRouteNextHopState is pruned(1).')
hmPIMIpMRouteNextHopPruneReason = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("prune", 2), ("assert", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMIpMRouteNextHopPruneReason.setStatus('current')
if mibBuilder.loadTexts: hmPIMIpMRouteNextHopPruneReason.setDescription('This object indicates why the downstream interface was pruned, whether in response to a PIM prune message or due to PIM Assert processing.')
hmPIMRPTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5), )
if mibBuilder.loadTexts: hmPIMRPTable.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPTable.setDescription('The (conceptual) table listing PIM version 1 information for the Rendezvous Points (RPs) for IP multicast groups. This table is deprecated since its function is replaced by the hmPIMRPSetTable for PIM version 2.')
hmPIMRPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMRPGroupAddress"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPAddress"))
if mibBuilder.loadTexts: hmPIMRPEntry.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPEntry.setDescription('An entry (conceptual row) in the hmPIMRPTable. There is one entry per RP address for each IP multicast group.')
hmPIMRPGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 1), IpAddress())
if mibBuilder.loadTexts: hmPIMRPGroupAddress.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPGroupAddress.setDescription('The IP multicast group address for which this entry contains information about an RP.')
hmPIMRPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 2), IpAddress())
if mibBuilder.loadTexts: hmPIMRPAddress.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPAddress.setDescription('The unicast address of the RP.')
hmPIMRPState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMRPState.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPState.setDescription('The state of the RP.')
hmPIMRPStateTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMRPStateTimer.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPStateTimer.setDescription('The minimum time remaining before the next state change. When hmPIMRPState is up, this is the minimum time which must expire until it can be declared down. When hmPIMRPState is down, this is the time until it will be declared up (in order to retry).')
hmPIMRPLastChange = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMRPLastChange.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPLastChange.setDescription('The value of sysUpTime at the time when the corresponding instance of hmPIMRPState last changed its value.')
hmPIMRPRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMRPRowStatus.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.')
hmPIMRPSetTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6), )
if mibBuilder.loadTexts: hmPIMRPSetTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetTable.setDescription('The (conceptual) table listing PIM information for candidate Rendezvous Points (RPs) for IP multicast groups. When the local router is the BSR, this information is obtained from received Candidate-RP-Advertisements. When the local router is not the BSR, this information is obtained from received RP-Set messages.')
hmPIMRPSetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetComponent"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetGroupAddress"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetGroupMask"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMRPSetAddress"))
if mibBuilder.loadTexts: hmPIMRPSetEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetEntry.setDescription('An entry (conceptual row) in the hmPIMRPSetTable.')
hmPIMRPSetGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 1), IpAddress())
if mibBuilder.loadTexts: hmPIMRPSetGroupAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMRPSetGroupMask, gives the group prefix for which this entry contains information about the Candidate-RP.')
hmPIMRPSetGroupMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 2), IpAddress())
if mibBuilder.loadTexts: hmPIMRPSetGroupMask.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMRPSetGroupAddress, gives the group prefix for which this entry contains information about the Candidate-RP.')
hmPIMRPSetAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 3), IpAddress())
if mibBuilder.loadTexts: hmPIMRPSetAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetAddress.setDescription('The IP address of the Candidate-RP.')
hmPIMRPSetHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMRPSetHoldTime.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetHoldTime.setDescription('The holdtime of a Candidate-RP. If the local router is not the BSR, this value is 0.')
hmPIMRPSetExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMRPSetExpiryTime.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetExpiryTime.setDescription('The minimum time remaining before the Candidate-RP will be declared down. If the local router is not the BSR, this value is 0.')
hmPIMRPSetComponent = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)))
if mibBuilder.loadTexts: hmPIMRPSetComponent.setStatus('current')
if mibBuilder.loadTexts: hmPIMRPSetComponent.setDescription(' A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value.')
hmPIMCandidateRPTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11), )
if mibBuilder.loadTexts: hmPIMCandidateRPTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMCandidateRPTable.setDescription('The (conceptual) table listing the IP multicast groups for which the local router is to advertise itself as a Candidate-RP when the value of hmPIMComponentCRPHoldTime is non-zero. If this table is empty, then the local router will advertise itself as a Candidate-RP for all groups (providing the value of hmPIMComponentCRPHoldTime is non- zero).')
hmPIMCandidateRPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPGroupAddress"), (0, "HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPGroupMask"))
if mibBuilder.loadTexts: hmPIMCandidateRPEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMCandidateRPEntry.setDescription('An entry (conceptual row) in the hmPIMCandidateRPTable.')
hmPIMCandidateRPGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 1), IpAddress())
if mibBuilder.loadTexts: hmPIMCandidateRPGroupAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMCandidateRPGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.')
hmPIMCandidateRPGroupMask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 2), IpAddress())
if mibBuilder.loadTexts: hmPIMCandidateRPGroupMask.setStatus('current')
if mibBuilder.loadTexts: hmPIMCandidateRPGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.')
hmPIMCandidateRPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 3), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMCandidateRPAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMCandidateRPAddress.setDescription('The (unicast) address of the interface which will be advertised as a Candidate-RP.')
hmPIMCandidateRPRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMCandidateRPRowStatus.setStatus('current')
if mibBuilder.loadTexts: hmPIMCandidateRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.')
hmPIMComponentTable = MibTable((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12), )
if mibBuilder.loadTexts: hmPIMComponentTable.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentTable.setDescription('The (conceptual) table containing objects specific to a PIM domain. One row exists for each domain to which the router is connected. A PIM-SM domain is defined as an area of the network over which Bootstrap messages are forwarded. Typically, a PIM-SM router will be a member of exactly one domain. This table also supports, however, routers which may form a border between two PIM-SM domains and do not forward Bootstrap messages between them.')
hmPIMComponentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1), ).setIndexNames((0, "HIRSCHMANN-PIM-MIB", "hmPIMComponentIndex"))
if mibBuilder.loadTexts: hmPIMComponentEntry.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentEntry.setDescription('An entry (conceptual row) in the hmPIMComponentTable.')
hmPIMComponentIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)))
if mibBuilder.loadTexts: hmPIMComponentIndex.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentIndex.setDescription('A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value. Routers that only support membership in a single PIM-SM domain should use a hmPIMComponentIndex value of 1.')
hmPIMComponentBSRAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMComponentBSRAddress.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentBSRAddress.setDescription('The IP address of the bootstrap router (BSR) for the local PIM region.')
hmPIMComponentBSRExpiryTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hmPIMComponentBSRExpiryTime.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentBSRExpiryTime.setDescription('The minimum time remaining before the bootstrap router in the local domain will be declared down. For candidate BSRs, this is the time until the component sends an RP-Set message. For other routers, this is the time until it may accept an RP-Set message from a lower candidate BSR.')
hmPIMComponentCRPHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setUnits('seconds').setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMComponentCRPHoldTime.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentCRPHoldTime.setDescription('The holdtime of the component when it is a candidate RP in the local domain. The value of 0 is used to indicate that the local system is not a Candidate-RP.')
hmPIMComponentStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hmPIMComponentStatus.setStatus('current')
if mibBuilder.loadTexts: hmPIMComponentStatus.setDescription('The status of this entry. Creating the entry creates another protocol instance; destroying the entry disables a protocol instance.')
hmPIMNeighborLoss = NotificationType((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0, 1)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"))
if mibBuilder.loadTexts: hmPIMNeighborLoss.setStatus('current')
if mibBuilder.loadTexts: hmPIMNeighborLoss.setDescription('A hmPIMNeighborLoss trap signifies the loss of an adjacency with a neighbor. This trap should be generated when the neighbor timer expires, and the router has no other neighbors on the same interface with a lower IP address than itself.')
hmPIMMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2))
hmPIMMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1))
hmPIMMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2))
hmPIMV1MIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 1)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMV1MIBGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMV1MIBCompliance = hmPIMV1MIBCompliance.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMV1MIBCompliance.setDescription('The compliance statement for routers running PIMv1 and implementing the PIM MIB.')
hmPIMSparseV2MIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 2)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMV2MIBGroup"), ("HIRSCHMANN-PIM-MIB", "hmPIMV2CandidateRPMIBGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMSparseV2MIBCompliance = hmPIMSparseV2MIBCompliance.setStatus('current')
if mibBuilder.loadTexts: hmPIMSparseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Sparse Mode and implementing the PIM MIB.')
hmPIMDenseV2MIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 3)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMDenseV2MIBGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMDenseV2MIBCompliance = hmPIMDenseV2MIBCompliance.setStatus('current')
if mibBuilder.loadTexts: hmPIMDenseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Dense Mode and implementing the PIM MIB.')
hmPIMNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 1)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMNeighborLoss"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMNotificationGroup = hmPIMNotificationGroup.setStatus('current')
if mibBuilder.loadTexts: hmPIMNotificationGroup.setDescription('A collection of notifications for signaling important PIM events.')
hmPIMV2MIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 2)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborUpTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceNetMask"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceDR"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceHelloInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceCBSRPreference"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceMode"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPSetHoldTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPSetExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentBSRAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentBSRExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentCRPHoldTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMComponentStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteFlags"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteUpstreamAssertTimer"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMV2MIBGroup = hmPIMV2MIBGroup.setStatus('current')
if mibBuilder.loadTexts: hmPIMV2MIBGroup.setDescription('A collection of objects to support management of PIM Sparse Mode (version 2) routers.')
hmPIMDenseV2MIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 5)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborUpTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceNetMask"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceDR"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceHelloInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceMode"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMDenseV2MIBGroup = hmPIMDenseV2MIBGroup.setStatus('current')
if mibBuilder.loadTexts: hmPIMDenseV2MIBGroup.setDescription('A collection of objects to support management of PIM Dense Mode (version 2) routers.')
hmPIMV2CandidateRPMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 3)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMCandidateRPRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMV2CandidateRPMIBGroup = hmPIMV2CandidateRPMIBGroup.setStatus('current')
if mibBuilder.loadTexts: hmPIMV2CandidateRPMIBGroup.setDescription('A collection of objects to support configuration of which groups a router is to advertise itself as a Candidate-RP.')
hmPIMV1MIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 4)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborIfIndex"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborUpTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborExpiryTime"), ("HIRSCHMANN-PIM-MIB", "hmPIMNeighborMode"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceAddress"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceNetMask"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceJoinPruneInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceStatus"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceMode"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceDR"), ("HIRSCHMANN-PIM-MIB", "hmPIMInterfaceHelloInterval"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPState"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPStateTimer"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPLastChange"), ("HIRSCHMANN-PIM-MIB", "hmPIMRPRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMV1MIBGroup = hmPIMV1MIBGroup.setStatus('deprecated')
if mibBuilder.loadTexts: hmPIMV1MIBGroup.setDescription('A collection of objects to support management of PIM (version 1) routers.')
hmPIMNextHopGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 6)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteNextHopPruneReason"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMNextHopGroup = hmPIMNextHopGroup.setStatus('current')
if mibBuilder.loadTexts: hmPIMNextHopGroup.setDescription('A collection of optional objects to provide per-next hop information for diagnostic purposes. Supporting this group may add a large number of instances to a tree walk, but the information in this group can be extremely useful in tracking down multicast connectivity problems.')
hmPIMAssertGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 7)).setObjects(("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteAssertMetric"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteAssertMetricPref"), ("HIRSCHMANN-PIM-MIB", "hmPIMIpMRouteAssertRPTBit"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hmPIMAssertGroup = hmPIMAssertGroup.setStatus('current')
if mibBuilder.loadTexts: hmPIMAssertGroup.setDescription('A collection of optional objects to provide extra information about the assert election process. There is no protocol reason to keep such information, but some implementations may already keep this information and make it available. These objects can also be very useful in debugging connectivity or duplicate packet problems, especially if the assert winner does not support the PIM and IP Multicast MIBs.')
mibBuilder.exportSymbols("HIRSCHMANN-PIM-MIB", hmPIMComponentEntry=hmPIMComponentEntry, hmPIMInterfaceHelloInterval=hmPIMInterfaceHelloInterval, hmPIMCandidateRPTable=hmPIMCandidateRPTable, hmPIMIpMRouteNextHopTable=hmPIMIpMRouteNextHopTable, hmPIMMIBObjects=hmPIMMIBObjects, hmPIMIpMRouteAssertMetricPref=hmPIMIpMRouteAssertMetricPref, hmPIMIpMRouteTable=hmPIMIpMRouteTable, hmPIMDenseV2MIBGroup=hmPIMDenseV2MIBGroup, hmPIMCandidateRPEntry=hmPIMCandidateRPEntry, hmPIMJoinPruneInterval=hmPIMJoinPruneInterval, hmPIMMIBCompliances=hmPIMMIBCompliances, hmPIMCandidateRPAddress=hmPIMCandidateRPAddress, hmPIMComponentBSRExpiryTime=hmPIMComponentBSRExpiryTime, hmPIMMIB=hmPIMMIB, hmPIMIpMRouteAssertRPTBit=hmPIMIpMRouteAssertRPTBit, hmPIMComponentCRPHoldTime=hmPIMComponentCRPHoldTime, hmPIMRPLastChange=hmPIMRPLastChange, hmPIMComponentTable=hmPIMComponentTable, hmPIMNeighborIfIndex=hmPIMNeighborIfIndex, hmPIMRPSetTable=hmPIMRPSetTable, hmPIMComponentStatus=hmPIMComponentStatus, PYSNMP_MODULE_ID=hmPIMMIB, hmPIMMIBConformance=hmPIMMIBConformance, hmPIMRPStateTimer=hmPIMRPStateTimer, hmPIMNeighborTable=hmPIMNeighborTable, hmPIMNextHopGroup=hmPIMNextHopGroup, hmPIMAssertGroup=hmPIMAssertGroup, hmPIMNeighborMode=hmPIMNeighborMode, hmPIMInterfaceTable=hmPIMInterfaceTable, hmPIMRPSetAddress=hmPIMRPSetAddress, hmPIMInterfaceMode=hmPIMInterfaceMode, hmPIMSparseV2MIBCompliance=hmPIMSparseV2MIBCompliance, hmPIMRPGroupAddress=hmPIMRPGroupAddress, hmPIMCandidateRPRowStatus=hmPIMCandidateRPRowStatus, hmPIMRPSetHoldTime=hmPIMRPSetHoldTime, hmPIMRPTable=hmPIMRPTable, hmPIMIpMRouteAssertMetric=hmPIMIpMRouteAssertMetric, hmPIMMIBGroups=hmPIMMIBGroups, hmPIMInterfaceNetMask=hmPIMInterfaceNetMask, hmPIMRPSetEntry=hmPIMRPSetEntry, hmPIMInterfaceDR=hmPIMInterfaceDR, hmPIMInterfaceAddress=hmPIMInterfaceAddress, hmPIMIpMRouteEntry=hmPIMIpMRouteEntry, hmPIMV2CandidateRPMIBGroup=hmPIMV2CandidateRPMIBGroup, hmPIMNeighborEntry=hmPIMNeighborEntry, hmPIMRPSetGroupMask=hmPIMRPSetGroupMask, hmPIMTraps=hmPIMTraps, hmPIMIpMRouteUpstreamAssertTimer=hmPIMIpMRouteUpstreamAssertTimer, hmPIMInterfaceStatus=hmPIMInterfaceStatus, hmPIMRPAddress=hmPIMRPAddress, hmPIMInterfaceIfIndex=hmPIMInterfaceIfIndex, hmPIMRPEntry=hmPIMRPEntry, hmPIMNeighborUpTime=hmPIMNeighborUpTime, hmPIMNeighborLoss=hmPIMNeighborLoss, hmPIMInterfaceEntry=hmPIMInterfaceEntry, hmPIMNeighborAddress=hmPIMNeighborAddress, hmPIMCandidateRPGroupAddress=hmPIMCandidateRPGroupAddress, hmPIMRPRowStatus=hmPIMRPRowStatus, hmPIMDenseV2MIBCompliance=hmPIMDenseV2MIBCompliance, hmPIMNotificationGroup=hmPIMNotificationGroup, hmPIMIpMRouteNextHopPruneReason=hmPIMIpMRouteNextHopPruneReason, hmPIMCandidateRPGroupMask=hmPIMCandidateRPGroupMask, hmPIMComponentBSRAddress=hmPIMComponentBSRAddress, hmPIMRPSetComponent=hmPIMRPSetComponent, hmPIMV2MIBGroup=hmPIMV2MIBGroup, hmPIMV1MIBGroup=hmPIMV1MIBGroup, hmPIMInterfaceCBSRPreference=hmPIMInterfaceCBSRPreference, hmPIMRPSetGroupAddress=hmPIMRPSetGroupAddress, hmPIMComponentIndex=hmPIMComponentIndex, hmPIMInterfaceJoinPruneInterval=hmPIMInterfaceJoinPruneInterval, hmPIMNeighborExpiryTime=hmPIMNeighborExpiryTime, hmPIMRPSetExpiryTime=hmPIMRPSetExpiryTime, hmPIMV1MIBCompliance=hmPIMV1MIBCompliance, hmPIM=hmPIM, hmPIMIpMRouteFlags=hmPIMIpMRouteFlags, hmPIMRPState=hmPIMRPState, hmPIMIpMRouteNextHopEntry=hmPIMIpMRouteNextHopEntry)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion')
(hm_platform4_multicast,) = mibBuilder.importSymbols('HIRSCHMANN-MULTICAST-MIB', 'hmPlatform4Multicast')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(ip_m_route_next_hop_group, ip_m_route_source_mask, ip_m_route_next_hop_if_index, ip_m_route_next_hop_address, ip_m_route_next_hop_source_mask, ip_m_route_group, ip_m_route_next_hop_source, ip_m_route_source) = mibBuilder.importSymbols('IPMROUTE-STD-MIB', 'ipMRouteNextHopGroup', 'ipMRouteSourceMask', 'ipMRouteNextHopIfIndex', 'ipMRouteNextHopAddress', 'ipMRouteNextHopSourceMask', 'ipMRouteGroup', 'ipMRouteNextHopSource', 'ipMRouteSource')
(object_group, module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'ModuleCompliance', 'NotificationGroup')
(gauge32, ip_address, iso, unsigned32, bits, module_identity, object_identity, integer32, time_ticks, mib_identifier, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'IpAddress', 'iso', 'Unsigned32', 'Bits', 'ModuleIdentity', 'ObjectIdentity', 'Integer32', 'TimeTicks', 'MibIdentifier', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'Counter64')
(truth_value, textual_convention, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'RowStatus', 'DisplayString')
hm_pimmib = module_identity((1, 3, 6, 1, 4, 1, 248, 15, 4, 99))
hmPIMMIB.setRevisions(('2006-02-06 12:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
hmPIMMIB.setRevisionsDescriptions(('Initial version, published as RFC 2934.',))
if mibBuilder.loadTexts:
hmPIMMIB.setLastUpdated('200602061200Z')
if mibBuilder.loadTexts:
hmPIMMIB.setOrganization('Hirschmann Automation and Control GmbH')
if mibBuilder.loadTexts:
hmPIMMIB.setContactInfo('Customer Support Postal: Hirschmann Automation and Control GmbH Stuttgarter Str. 45-51 72654 Neckartenzlingen Germany Tel: +49 7127 14 1981 Web: http://www.hicomcenter.com/ E-Mail: hicomcenter@hirschmann.com')
if mibBuilder.loadTexts:
hmPIMMIB.setDescription('The Hirschmann Private Platform4 PIM MIB definitions for Platform devices.')
hm_pimmib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1))
hm_pim_traps = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0))
hm_pim = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1))
hm_pim_join_prune_interval = mib_scalar((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 1), integer32()).setUnits('seconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hmPIMJoinPruneInterval.setStatus('current')
if mibBuilder.loadTexts:
hmPIMJoinPruneInterval.setDescription('The default interval at which periodic PIM-SM Join/Prune messages are to be sent.')
hm_pim_interface_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2))
if mibBuilder.loadTexts:
hmPIMInterfaceTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceTable.setDescription("The (conceptual) table listing the router's PIM interfaces. IGMP and PIM are enabled on all interfaces listed in this table.")
hm_pim_interface_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceIfIndex'))
if mibBuilder.loadTexts:
hmPIMInterfaceEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceEntry.setDescription('An entry (conceptual row) in the hmPIMInterfaceTable.')
hm_pim_interface_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 1), interface_index())
if mibBuilder.loadTexts:
hmPIMInterfaceIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceIfIndex.setDescription('The ifIndex value of this PIM interface.')
hm_pim_interface_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 2), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMInterfaceAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceAddress.setDescription('The IP address of the PIM interface.')
hm_pim_interface_net_mask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 3), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMInterfaceNetMask.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceNetMask.setDescription('The network mask for the IP address of the PIM interface.')
hm_pim_interface_mode = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dense', 1), ('sparse', 2), ('sparseDense', 3))).clone('dense')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMInterfaceMode.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceMode.setDescription('The configured mode of this PIM interface. A value of sparseDense is only valid for PIMv1.')
hm_pim_interface_dr = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 5), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMInterfaceDR.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceDR.setDescription('The Designated Router on this PIM interface. For point-to- point interfaces, this object has the value 0.0.0.0.')
hm_pim_interface_hello_interval = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 6), integer32().clone(30)).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMInterfaceHelloInterval.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceHelloInterval.setDescription('The frequency at which PIM Hello messages are transmitted on this interface.')
hm_pim_interface_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 7), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMInterfaceStatus.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceStatus.setDescription('The status of this entry. Creating the entry enables PIM on the interface; destroying the entry disables PIM on the interface.')
hm_pim_interface_join_prune_interval = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 8), integer32()).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMInterfaceJoinPruneInterval.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceJoinPruneInterval.setDescription('The frequency at which PIM Join/Prune messages are transmitted on this PIM interface. The default value of this object is the hmPIMJoinPruneInterval.')
hm_pim_interface_cbsr_preference = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(-1, 255))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMInterfaceCBSRPreference.setStatus('current')
if mibBuilder.loadTexts:
hmPIMInterfaceCBSRPreference.setDescription('The preference value for the local interface as a candidate bootstrap router. The value of -1 is used to indicate that the local interface is not a candidate BSR interface.')
hm_pim_neighbor_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3))
if mibBuilder.loadTexts:
hmPIMNeighborTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborTable.setDescription("The (conceptual) table listing the router's PIM neighbors.")
hm_pim_neighbor_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMNeighborAddress'))
if mibBuilder.loadTexts:
hmPIMNeighborEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborEntry.setDescription('An entry (conceptual row) in the hmPIMNeighborTable.')
hm_pim_neighbor_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 1), ip_address())
if mibBuilder.loadTexts:
hmPIMNeighborAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborAddress.setDescription('The IP address of the PIM neighbor for which this entry contains information.')
hm_pim_neighbor_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 2), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMNeighborIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborIfIndex.setDescription('The value of ifIndex for the interface used to reach this PIM neighbor.')
hm_pim_neighbor_up_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 3), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMNeighborUpTime.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborUpTime.setDescription('The time since this PIM neighbor (last) became a neighbor of the local router.')
hm_pim_neighbor_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMNeighborExpiryTime.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborExpiryTime.setDescription('The minimum time remaining before this PIM neighbor will be aged out.')
hm_pim_neighbor_mode = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('dense', 1), ('sparse', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMNeighborMode.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMNeighborMode.setDescription('The active PIM mode of this neighbor. This object is deprecated for PIMv2 routers since all neighbors on the interface must be either dense or sparse as determined by the protocol running on the interface.')
hm_pim_ip_m_route_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4))
if mibBuilder.loadTexts:
hmPIMIpMRouteTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteTable defined in the IP Multicast MIB.')
hm_pim_ip_m_route_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1)).setIndexNames((0, 'IPMROUTE-STD-MIB', 'ipMRouteGroup'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteSource'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteSourceMask'))
if mibBuilder.loadTexts:
hmPIMIpMRouteEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteTable. There is one entry per entry in the ipMRouteTable whose incoming interface is running PIM.')
hm_pim_ip_m_route_upstream_assert_timer = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 1), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMIpMRouteUpstreamAssertTimer.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteUpstreamAssertTimer.setDescription('The time remaining before the router changes its upstream neighbor back to its RPF neighbor. This timer is called the Assert timer in the PIM Sparse and Dense mode specification. A value of 0 indicates that no Assert has changed the upstream neighbor away from the RPF neighbor.')
hm_pim_ip_m_route_assert_metric = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMIpMRouteAssertMetric.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteAssertMetric.setDescription('The metric advertised by the assert winner on the upstream interface, or 0 if no such assert is in received.')
hm_pim_ip_m_route_assert_metric_pref = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMIpMRouteAssertMetricPref.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteAssertMetricPref.setDescription('The preference advertised by the assert winner on the upstream interface, or 0 if no such assert is in effect.')
hm_pim_ip_m_route_assert_rpt_bit = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 4), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMIpMRouteAssertRPTBit.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteAssertRPTBit.setDescription('The value of the RPT-bit advertised by the assert winner on the upstream interface, or false if no such assert is in effect.')
hm_pim_ip_m_route_flags = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 4, 1, 5), bits().clone(namedValues=named_values(('rpt', 0), ('spt', 1)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMIpMRouteFlags.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteFlags.setDescription('This object describes PIM-specific flags related to a multicast state entry. See the PIM Sparse Mode specification for the meaning of the RPT and SPT bits.')
hm_pim_ip_m_route_next_hop_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7))
if mibBuilder.loadTexts:
hmPIMIpMRouteNextHopTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteNextHopTable.setDescription('The (conceptual) table listing PIM-specific information on a subset of the rows of the ipMRouteNextHopTable defined in the IP Multicast MIB.')
hm_pim_ip_m_route_next_hop_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1)).setIndexNames((0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopGroup'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopSource'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopSourceMask'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopIfIndex'), (0, 'IPMROUTE-STD-MIB', 'ipMRouteNextHopAddress'))
if mibBuilder.loadTexts:
hmPIMIpMRouteNextHopEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteNextHopEntry.setDescription('An entry (conceptual row) in the hmPIMIpMRouteNextHopTable. There is one entry per entry in the ipMRouteNextHopTable whose interface is running PIM and whose ipMRouteNextHopState is pruned(1).')
hm_pim_ip_m_route_next_hop_prune_reason = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 7, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('prune', 2), ('assert', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMIpMRouteNextHopPruneReason.setStatus('current')
if mibBuilder.loadTexts:
hmPIMIpMRouteNextHopPruneReason.setDescription('This object indicates why the downstream interface was pruned, whether in response to a PIM prune message or due to PIM Assert processing.')
hm_pimrp_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5))
if mibBuilder.loadTexts:
hmPIMRPTable.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPTable.setDescription('The (conceptual) table listing PIM version 1 information for the Rendezvous Points (RPs) for IP multicast groups. This table is deprecated since its function is replaced by the hmPIMRPSetTable for PIM version 2.')
hm_pimrp_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPGroupAddress'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPAddress'))
if mibBuilder.loadTexts:
hmPIMRPEntry.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPEntry.setDescription('An entry (conceptual row) in the hmPIMRPTable. There is one entry per RP address for each IP multicast group.')
hm_pimrp_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 1), ip_address())
if mibBuilder.loadTexts:
hmPIMRPGroupAddress.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPGroupAddress.setDescription('The IP multicast group address for which this entry contains information about an RP.')
hm_pimrp_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 2), ip_address())
if mibBuilder.loadTexts:
hmPIMRPAddress.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPAddress.setDescription('The unicast address of the RP.')
hm_pimrp_state = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('up', 1), ('down', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMRPState.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPState.setDescription('The state of the RP.')
hm_pimrp_state_timer = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMRPStateTimer.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPStateTimer.setDescription('The minimum time remaining before the next state change. When hmPIMRPState is up, this is the minimum time which must expire until it can be declared down. When hmPIMRPState is down, this is the time until it will be declared up (in order to retry).')
hm_pimrp_last_change = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 5), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMRPLastChange.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPLastChange.setDescription('The value of sysUpTime at the time when the corresponding instance of hmPIMRPState last changed its value.')
hm_pimrp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 5, 1, 6), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMRPRowStatus.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.')
hm_pimrp_set_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6))
if mibBuilder.loadTexts:
hmPIMRPSetTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetTable.setDescription('The (conceptual) table listing PIM information for candidate Rendezvous Points (RPs) for IP multicast groups. When the local router is the BSR, this information is obtained from received Candidate-RP-Advertisements. When the local router is not the BSR, this information is obtained from received RP-Set messages.')
hm_pimrp_set_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetComponent'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetGroupAddress'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetGroupMask'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMRPSetAddress'))
if mibBuilder.loadTexts:
hmPIMRPSetEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetEntry.setDescription('An entry (conceptual row) in the hmPIMRPSetTable.')
hm_pimrp_set_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 1), ip_address())
if mibBuilder.loadTexts:
hmPIMRPSetGroupAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMRPSetGroupMask, gives the group prefix for which this entry contains information about the Candidate-RP.')
hm_pimrp_set_group_mask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 2), ip_address())
if mibBuilder.loadTexts:
hmPIMRPSetGroupMask.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMRPSetGroupAddress, gives the group prefix for which this entry contains information about the Candidate-RP.')
hm_pimrp_set_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 3), ip_address())
if mibBuilder.loadTexts:
hmPIMRPSetAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetAddress.setDescription('The IP address of the Candidate-RP.')
hm_pimrp_set_hold_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMRPSetHoldTime.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetHoldTime.setDescription('The holdtime of a Candidate-RP. If the local router is not the BSR, this value is 0.')
hm_pimrp_set_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 5), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMRPSetExpiryTime.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetExpiryTime.setDescription('The minimum time remaining before the Candidate-RP will be declared down. If the local router is not the BSR, this value is 0.')
hm_pimrp_set_component = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 6, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 255)))
if mibBuilder.loadTexts:
hmPIMRPSetComponent.setStatus('current')
if mibBuilder.loadTexts:
hmPIMRPSetComponent.setDescription(' A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value.')
hm_pim_candidate_rp_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11))
if mibBuilder.loadTexts:
hmPIMCandidateRPTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMCandidateRPTable.setDescription('The (conceptual) table listing the IP multicast groups for which the local router is to advertise itself as a Candidate-RP when the value of hmPIMComponentCRPHoldTime is non-zero. If this table is empty, then the local router will advertise itself as a Candidate-RP for all groups (providing the value of hmPIMComponentCRPHoldTime is non- zero).')
hm_pim_candidate_rp_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPGroupAddress'), (0, 'HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPGroupMask'))
if mibBuilder.loadTexts:
hmPIMCandidateRPEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMCandidateRPEntry.setDescription('An entry (conceptual row) in the hmPIMCandidateRPTable.')
hm_pim_candidate_rp_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 1), ip_address())
if mibBuilder.loadTexts:
hmPIMCandidateRPGroupAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMCandidateRPGroupAddress.setDescription('The IP multicast group address which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.')
hm_pim_candidate_rp_group_mask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 2), ip_address())
if mibBuilder.loadTexts:
hmPIMCandidateRPGroupMask.setStatus('current')
if mibBuilder.loadTexts:
hmPIMCandidateRPGroupMask.setDescription('The multicast group address mask which, when combined with hmPIMCandidateRPGroupMask, identifies a group prefix for which the local router will advertise itself as a Candidate-RP.')
hm_pim_candidate_rp_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 3), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMCandidateRPAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMCandidateRPAddress.setDescription('The (unicast) address of the interface which will be advertised as a Candidate-RP.')
hm_pim_candidate_rp_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 11, 1, 4), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMCandidateRPRowStatus.setStatus('current')
if mibBuilder.loadTexts:
hmPIMCandidateRPRowStatus.setDescription('The status of this row, by which new entries may be created, or old entries deleted from this table.')
hm_pim_component_table = mib_table((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12))
if mibBuilder.loadTexts:
hmPIMComponentTable.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentTable.setDescription('The (conceptual) table containing objects specific to a PIM domain. One row exists for each domain to which the router is connected. A PIM-SM domain is defined as an area of the network over which Bootstrap messages are forwarded. Typically, a PIM-SM router will be a member of exactly one domain. This table also supports, however, routers which may form a border between two PIM-SM domains and do not forward Bootstrap messages between them.')
hm_pim_component_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1)).setIndexNames((0, 'HIRSCHMANN-PIM-MIB', 'hmPIMComponentIndex'))
if mibBuilder.loadTexts:
hmPIMComponentEntry.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentEntry.setDescription('An entry (conceptual row) in the hmPIMComponentTable.')
hm_pim_component_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255)))
if mibBuilder.loadTexts:
hmPIMComponentIndex.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentIndex.setDescription('A number uniquely identifying the component. Each protocol instance connected to a separate domain should have a different index value. Routers that only support membership in a single PIM-SM domain should use a hmPIMComponentIndex value of 1.')
hm_pim_component_bsr_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 2), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMComponentBSRAddress.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentBSRAddress.setDescription('The IP address of the bootstrap router (BSR) for the local PIM region.')
hm_pim_component_bsr_expiry_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 3), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hmPIMComponentBSRExpiryTime.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentBSRExpiryTime.setDescription('The minimum time remaining before the bootstrap router in the local domain will be declared down. For candidate BSRs, this is the time until the component sends an RP-Set message. For other routers, this is the time until it may accept an RP-Set message from a lower candidate BSR.')
hm_pim_component_crp_hold_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setUnits('seconds').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMComponentCRPHoldTime.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentCRPHoldTime.setDescription('The holdtime of the component when it is a candidate RP in the local domain. The value of 0 is used to indicate that the local system is not a Candidate-RP.')
hm_pim_component_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 1, 12, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hmPIMComponentStatus.setStatus('current')
if mibBuilder.loadTexts:
hmPIMComponentStatus.setDescription('The status of this entry. Creating the entry creates another protocol instance; destroying the entry disables a protocol instance.')
hm_pim_neighbor_loss = notification_type((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 1, 0, 1)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'))
if mibBuilder.loadTexts:
hmPIMNeighborLoss.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNeighborLoss.setDescription('A hmPIMNeighborLoss trap signifies the loss of an adjacency with a neighbor. This trap should be generated when the neighbor timer expires, and the router has no other neighbors on the same interface with a lower IP address than itself.')
hm_pimmib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2))
hm_pimmib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1))
hm_pimmib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2))
hm_pimv1_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 1)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMV1MIBGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pimv1_mib_compliance = hmPIMV1MIBCompliance.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMV1MIBCompliance.setDescription('The compliance statement for routers running PIMv1 and implementing the PIM MIB.')
hm_pim_sparse_v2_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 2)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMV2MIBGroup'), ('HIRSCHMANN-PIM-MIB', 'hmPIMV2CandidateRPMIBGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pim_sparse_v2_mib_compliance = hmPIMSparseV2MIBCompliance.setStatus('current')
if mibBuilder.loadTexts:
hmPIMSparseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Sparse Mode and implementing the PIM MIB.')
hm_pim_dense_v2_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 1, 3)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMDenseV2MIBGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pim_dense_v2_mib_compliance = hmPIMDenseV2MIBCompliance.setStatus('current')
if mibBuilder.loadTexts:
hmPIMDenseV2MIBCompliance.setDescription('The compliance statement for routers running PIM Dense Mode and implementing the PIM MIB.')
hm_pim_notification_group = notification_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 1)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborLoss'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pim_notification_group = hmPIMNotificationGroup.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNotificationGroup.setDescription('A collection of notifications for signaling important PIM events.')
hm_pimv2_mib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 2)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborUpTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceNetMask'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceDR'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceHelloInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceCBSRPreference'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceMode'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPSetHoldTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPSetExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentBSRAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentBSRExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentCRPHoldTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMComponentStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteFlags'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteUpstreamAssertTimer'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pimv2_mib_group = hmPIMV2MIBGroup.setStatus('current')
if mibBuilder.loadTexts:
hmPIMV2MIBGroup.setDescription('A collection of objects to support management of PIM Sparse Mode (version 2) routers.')
hm_pim_dense_v2_mib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 5)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborUpTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceNetMask'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceDR'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceHelloInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceMode'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pim_dense_v2_mib_group = hmPIMDenseV2MIBGroup.setStatus('current')
if mibBuilder.loadTexts:
hmPIMDenseV2MIBGroup.setDescription('A collection of objects to support management of PIM Dense Mode (version 2) routers.')
hm_pimv2_candidate_rpmib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 3)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMCandidateRPRowStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pimv2_candidate_rpmib_group = hmPIMV2CandidateRPMIBGroup.setStatus('current')
if mibBuilder.loadTexts:
hmPIMV2CandidateRPMIBGroup.setDescription('A collection of objects to support configuration of which groups a router is to advertise itself as a Candidate-RP.')
hm_pimv1_mib_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 4)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborIfIndex'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborUpTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborExpiryTime'), ('HIRSCHMANN-PIM-MIB', 'hmPIMNeighborMode'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceAddress'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceNetMask'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceJoinPruneInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceStatus'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceMode'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceDR'), ('HIRSCHMANN-PIM-MIB', 'hmPIMInterfaceHelloInterval'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPState'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPStateTimer'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPLastChange'), ('HIRSCHMANN-PIM-MIB', 'hmPIMRPRowStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pimv1_mib_group = hmPIMV1MIBGroup.setStatus('deprecated')
if mibBuilder.loadTexts:
hmPIMV1MIBGroup.setDescription('A collection of objects to support management of PIM (version 1) routers.')
hm_pim_next_hop_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 6)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteNextHopPruneReason'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pim_next_hop_group = hmPIMNextHopGroup.setStatus('current')
if mibBuilder.loadTexts:
hmPIMNextHopGroup.setDescription('A collection of optional objects to provide per-next hop information for diagnostic purposes. Supporting this group may add a large number of instances to a tree walk, but the information in this group can be extremely useful in tracking down multicast connectivity problems.')
hm_pim_assert_group = object_group((1, 3, 6, 1, 4, 1, 248, 15, 4, 99, 2, 2, 7)).setObjects(('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteAssertMetric'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteAssertMetricPref'), ('HIRSCHMANN-PIM-MIB', 'hmPIMIpMRouteAssertRPTBit'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hm_pim_assert_group = hmPIMAssertGroup.setStatus('current')
if mibBuilder.loadTexts:
hmPIMAssertGroup.setDescription('A collection of optional objects to provide extra information about the assert election process. There is no protocol reason to keep such information, but some implementations may already keep this information and make it available. These objects can also be very useful in debugging connectivity or duplicate packet problems, especially if the assert winner does not support the PIM and IP Multicast MIBs.')
mibBuilder.exportSymbols('HIRSCHMANN-PIM-MIB', hmPIMComponentEntry=hmPIMComponentEntry, hmPIMInterfaceHelloInterval=hmPIMInterfaceHelloInterval, hmPIMCandidateRPTable=hmPIMCandidateRPTable, hmPIMIpMRouteNextHopTable=hmPIMIpMRouteNextHopTable, hmPIMMIBObjects=hmPIMMIBObjects, hmPIMIpMRouteAssertMetricPref=hmPIMIpMRouteAssertMetricPref, hmPIMIpMRouteTable=hmPIMIpMRouteTable, hmPIMDenseV2MIBGroup=hmPIMDenseV2MIBGroup, hmPIMCandidateRPEntry=hmPIMCandidateRPEntry, hmPIMJoinPruneInterval=hmPIMJoinPruneInterval, hmPIMMIBCompliances=hmPIMMIBCompliances, hmPIMCandidateRPAddress=hmPIMCandidateRPAddress, hmPIMComponentBSRExpiryTime=hmPIMComponentBSRExpiryTime, hmPIMMIB=hmPIMMIB, hmPIMIpMRouteAssertRPTBit=hmPIMIpMRouteAssertRPTBit, hmPIMComponentCRPHoldTime=hmPIMComponentCRPHoldTime, hmPIMRPLastChange=hmPIMRPLastChange, hmPIMComponentTable=hmPIMComponentTable, hmPIMNeighborIfIndex=hmPIMNeighborIfIndex, hmPIMRPSetTable=hmPIMRPSetTable, hmPIMComponentStatus=hmPIMComponentStatus, PYSNMP_MODULE_ID=hmPIMMIB, hmPIMMIBConformance=hmPIMMIBConformance, hmPIMRPStateTimer=hmPIMRPStateTimer, hmPIMNeighborTable=hmPIMNeighborTable, hmPIMNextHopGroup=hmPIMNextHopGroup, hmPIMAssertGroup=hmPIMAssertGroup, hmPIMNeighborMode=hmPIMNeighborMode, hmPIMInterfaceTable=hmPIMInterfaceTable, hmPIMRPSetAddress=hmPIMRPSetAddress, hmPIMInterfaceMode=hmPIMInterfaceMode, hmPIMSparseV2MIBCompliance=hmPIMSparseV2MIBCompliance, hmPIMRPGroupAddress=hmPIMRPGroupAddress, hmPIMCandidateRPRowStatus=hmPIMCandidateRPRowStatus, hmPIMRPSetHoldTime=hmPIMRPSetHoldTime, hmPIMRPTable=hmPIMRPTable, hmPIMIpMRouteAssertMetric=hmPIMIpMRouteAssertMetric, hmPIMMIBGroups=hmPIMMIBGroups, hmPIMInterfaceNetMask=hmPIMInterfaceNetMask, hmPIMRPSetEntry=hmPIMRPSetEntry, hmPIMInterfaceDR=hmPIMInterfaceDR, hmPIMInterfaceAddress=hmPIMInterfaceAddress, hmPIMIpMRouteEntry=hmPIMIpMRouteEntry, hmPIMV2CandidateRPMIBGroup=hmPIMV2CandidateRPMIBGroup, hmPIMNeighborEntry=hmPIMNeighborEntry, hmPIMRPSetGroupMask=hmPIMRPSetGroupMask, hmPIMTraps=hmPIMTraps, hmPIMIpMRouteUpstreamAssertTimer=hmPIMIpMRouteUpstreamAssertTimer, hmPIMInterfaceStatus=hmPIMInterfaceStatus, hmPIMRPAddress=hmPIMRPAddress, hmPIMInterfaceIfIndex=hmPIMInterfaceIfIndex, hmPIMRPEntry=hmPIMRPEntry, hmPIMNeighborUpTime=hmPIMNeighborUpTime, hmPIMNeighborLoss=hmPIMNeighborLoss, hmPIMInterfaceEntry=hmPIMInterfaceEntry, hmPIMNeighborAddress=hmPIMNeighborAddress, hmPIMCandidateRPGroupAddress=hmPIMCandidateRPGroupAddress, hmPIMRPRowStatus=hmPIMRPRowStatus, hmPIMDenseV2MIBCompliance=hmPIMDenseV2MIBCompliance, hmPIMNotificationGroup=hmPIMNotificationGroup, hmPIMIpMRouteNextHopPruneReason=hmPIMIpMRouteNextHopPruneReason, hmPIMCandidateRPGroupMask=hmPIMCandidateRPGroupMask, hmPIMComponentBSRAddress=hmPIMComponentBSRAddress, hmPIMRPSetComponent=hmPIMRPSetComponent, hmPIMV2MIBGroup=hmPIMV2MIBGroup, hmPIMV1MIBGroup=hmPIMV1MIBGroup, hmPIMInterfaceCBSRPreference=hmPIMInterfaceCBSRPreference, hmPIMRPSetGroupAddress=hmPIMRPSetGroupAddress, hmPIMComponentIndex=hmPIMComponentIndex, hmPIMInterfaceJoinPruneInterval=hmPIMInterfaceJoinPruneInterval, hmPIMNeighborExpiryTime=hmPIMNeighborExpiryTime, hmPIMRPSetExpiryTime=hmPIMRPSetExpiryTime, hmPIMV1MIBCompliance=hmPIMV1MIBCompliance, hmPIM=hmPIM, hmPIMIpMRouteFlags=hmPIMIpMRouteFlags, hmPIMRPState=hmPIMRPState, hmPIMIpMRouteNextHopEntry=hmPIMIpMRouteNextHopEntry) |
"""
[Question.py]
@description: a set of functions which helps with asking console questions.
"""
def ask(question):
print(question)
answer = input("Response: ")
return answer
def ask_bool_positive_safe(question):
answer = input(question + " ")
return (answer.lower() == "true") or \
(answer.lower() == "t") or \
(answer.lower() == "yes") or \
(answer.lower() == "y") or \
(answer == "1")
def bool_negative_safe_question(question):
answer = input(question + " ")
return (answer.lower() == "false") or \
(answer.lower() == "f") or \
(answer.lower() == "no") or \
(answer.lower() == "n") or \
(answer == "0")
def ask_type(question, ans_type, loop=True):
"""
Used to ask and assert that the response to the question will be an integer
:param question: what to ask
:return: the result, of type specified
"""
answer = ask(question)
if loop:
# Loops until the user
while loop:
try:
ans_type(answer)
loop = False
except:
print("Please enter an", ans_type, "answer.")
answer = ask(question)
else:
try:
ans_type(answer)
except:
print("Error. The answer was not an " + str(ans_type) + ".")
return int(answer)
def ask_int(question, loop=True):
return ask_type(question=question, ans_type=int, loop=loop)
def ask_float(question, loop=True):
return ask_type(question=question, ans_type=float, loop=loop)
| """
[Question.py]
@description: a set of functions which helps with asking console questions.
"""
def ask(question):
print(question)
answer = input('Response: ')
return answer
def ask_bool_positive_safe(question):
answer = input(question + ' ')
return answer.lower() == 'true' or answer.lower() == 't' or answer.lower() == 'yes' or (answer.lower() == 'y') or (answer == '1')
def bool_negative_safe_question(question):
answer = input(question + ' ')
return answer.lower() == 'false' or answer.lower() == 'f' or answer.lower() == 'no' or (answer.lower() == 'n') or (answer == '0')
def ask_type(question, ans_type, loop=True):
"""
Used to ask and assert that the response to the question will be an integer
:param question: what to ask
:return: the result, of type specified
"""
answer = ask(question)
if loop:
while loop:
try:
ans_type(answer)
loop = False
except:
print('Please enter an', ans_type, 'answer.')
answer = ask(question)
else:
try:
ans_type(answer)
except:
print('Error. The answer was not an ' + str(ans_type) + '.')
return int(answer)
def ask_int(question, loop=True):
return ask_type(question=question, ans_type=int, loop=loop)
def ask_float(question, loop=True):
return ask_type(question=question, ans_type=float, loop=loop) |
load(
"@d2l_rules_csharp//csharp:defs.bzl",
"csharp_register_toolchains",
"csharp_repositories",
"import_nuget_package",
)
def selenium_register_dotnet():
csharp_register_toolchains()
csharp_repositories()
native.register_toolchains("//third_party/dotnet/ilmerge:all")
import_nuget_package(
name = "json.net",
file = "third_party/dotnet/nuget/packages/newtonsoft.json.12.0.2.nupkg",
sha256 = "056eec5d3d8b2a93f7ca5b026d34d9d5fe8c835b11e322faf1a2551da25c4e70",
)
import_nuget_package(
name = "moq",
file = "third_party/dotnet/nuget/packages/moq.4.12.0.nupkg",
sha256 = "339bbb71107e137a753a89c6b74adb5d9072f0916cf8f19f48b30ae29c41f434",
)
import_nuget_package(
name = "benderproxy",
file = "third_party/dotnet/nuget/packages/benderproxy.1.0.0.nupkg",
sha256 = "fd536dc97eb71268392173e7c4c0699795a31f6843470134ee068ade1be4b57d",
)
import_nuget_package(
name = "castle.core",
file = "third_party/dotnet/nuget/packages/castle.core.4.4.0.nupkg",
sha256 = "ee12c10079c1f9daebdb2538c37a34e5e317d800f2feb5cddd744f067d5dec66",
)
import_nuget_package(
name = "nunit",
file = "third_party/dotnet/nuget/packages/nunit.3.12.0.nupkg"
#sha256 = "056eec5d3d8b2a93f7ca5b026d34d9d5fe8c835b11e322faf1a2551da25c4e70",
)
#import_nuget_package(
# name = "system.threading.tasks.extensions",
# package = "system.threading.tasks.extensions",
# version = "4.5.1",
#)
#import_nuget_package(
# name = "nunit",
# package = "nunit",
# version = "3.12.0",
#)
| load('@d2l_rules_csharp//csharp:defs.bzl', 'csharp_register_toolchains', 'csharp_repositories', 'import_nuget_package')
def selenium_register_dotnet():
csharp_register_toolchains()
csharp_repositories()
native.register_toolchains('//third_party/dotnet/ilmerge:all')
import_nuget_package(name='json.net', file='third_party/dotnet/nuget/packages/newtonsoft.json.12.0.2.nupkg', sha256='056eec5d3d8b2a93f7ca5b026d34d9d5fe8c835b11e322faf1a2551da25c4e70')
import_nuget_package(name='moq', file='third_party/dotnet/nuget/packages/moq.4.12.0.nupkg', sha256='339bbb71107e137a753a89c6b74adb5d9072f0916cf8f19f48b30ae29c41f434')
import_nuget_package(name='benderproxy', file='third_party/dotnet/nuget/packages/benderproxy.1.0.0.nupkg', sha256='fd536dc97eb71268392173e7c4c0699795a31f6843470134ee068ade1be4b57d')
import_nuget_package(name='castle.core', file='third_party/dotnet/nuget/packages/castle.core.4.4.0.nupkg', sha256='ee12c10079c1f9daebdb2538c37a34e5e317d800f2feb5cddd744f067d5dec66')
import_nuget_package(name='nunit', file='third_party/dotnet/nuget/packages/nunit.3.12.0.nupkg') |
wifi_ssid = ""
wifi_password = ""
mqtt_username = ""
mqtt_password = ""
mqtt_address = ""
mqtt_port = 8883
| wifi_ssid = ''
wifi_password = ''
mqtt_username = ''
mqtt_password = ''
mqtt_address = ''
mqtt_port = 8883 |
# NOTE: \a is the delimiter for chat pages
# Quest ids can be found in Quests.py
SCRIPT = '''
ID reward_100
SHOW laffMeter
LERP_POS laffMeter 0 0 0 1
LERP_SCALE laffMeter 0.2 0.2 0.2 1
WAIT 1.5
ADD_LAFFMETER 1
WAIT 1
LERP_POS laffMeter -1.18 0 -0.87 1
LERP_SCALE laffMeter 0.075 0.075 0.075 1
WAIT 1
FINISH_QUEST_MOVIE
# TUTORIAL
ID tutorial_mickey
LOAD_SFX soundRun "phase_3.5/audio/sfx/AV_footstep_runloop.ogg"
LOAD_CC_DIALOGUE mickeyTutorialDialogue_1 "phase_3/audio/dial/CC_%s_tutorial02.ogg"
LOAD_CC_DIALOGUE mickeyTutorialDialogue_2 "phase_3.5/audio/dial/CC_tom_tutorial_%s01.ogg"
LOAD_CC_DIALOGUE mickeyTutorialDialogue_3a "phase_3/audio/dial/CC_%s_tutorial03.ogg"
LOAD_CC_DIALOGUE mickeyTutorialDialogue_3b "phase_3/audio/dial/CC_%s_tutorial05.ogg"
LOAD_DIALOGUE mickeyTutorialDialogue_4 "phase_3.5/audio/dial/CC_tom_tutorial_mickey02.ogg"
LOCK_LOCALTOON
REPARENTTO camera render
POSHPRSCALE camera 11 7 3 52 0 0 1 1 1
LOAD_CLASSIC_CHAR classicChar
REPARENTTO classicChar render
POS classicChar 0 0 0
HPR classicChar 0 0 0
POS localToon 0 0 0
HPR localToon 0 0 0
WAIT 2
PLAY_SFX soundRun 1
LOOP_ANIM classicChar "run"
LOOP_ANIM localToon "run"
LERP_POS localToon -1.8 14.4 0 2
LERP_POS classicChar 0 17 0 2
WAIT 2
#LERP_HPR localToon -110 0 0 0.5
LERP_HPR localToon -70 0 0 0.5
LERP_HPR classicChar -120 0 0 0.5
WAIT 0.5
STOP_SFX soundRun
LOOP_ANIM localToon "neutral"
PLAY_ANIM classicChar "left-point-start" 1
WAIT 1.63
LOOP_ANIM classicChar "left-point"
CC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_1" mickeyTutorialDialogue_1
PLAY_ANIM classicChar "left-point-start" -1.5
WAIT 1.0867
LOOP_ANIM classicChar "neutral"
CC_CHAT_TO_CONFIRM npc classicChar "QuestScriptTutorial%s_2" "CFSpeech" mickeyTutorialDialogue_2
PLAY_ANIM classicChar "right-point-start" 1
WAIT 1.0867
LOOP_ANIM classicChar "right-point"
CC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_3" mickeyTutorialDialogue_3a mickeyTutorialDialogue_3b
PLAY_SFX soundRun 1
LOOP_ANIM classicChar "run"
LERP_HPR classicChar -180 0 0 0.5
WAIT 0.5
LERP_POS classicChar 0 0 0 2
WAIT 2
STOP_SFX soundRun
REPARENTTO classicChar hidden
UNLOAD_CHAR classicChar
#CHAT npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4
REPARENTTO camera localToon
POS localToon 1.6 9.8 0
HPR localToon 14 0 0
FREE_LOCALTOON
LOCAL_CHAT_PERSIST npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4
ID quest_assign_101
CLEAR_CHAT npc
LOAD squirt1 "phase_3.5/models/gui/tutorial_gui" "squirt1"
LOAD squirt2 "phase_3.5/models/gui/tutorial_gui" "squirt2"
LOAD toonBuilding "phase_3.5/models/gui/tutorial_gui" "toon_buildings"
LOAD cogBuilding "phase_3.5/models/gui/tutorial_gui" "suit_buildings"
LOAD cogs "phase_3.5/models/gui/tutorial_gui" "suits"
LOAD tart "phase_3.5/models/props/tart"
LOAD flower "phase_3.5/models/props/squirting-flower"
LOAD_DIALOGUE tomDialogue_01 "phase_3.5/audio/dial/CC_tom_tutorial_questscript01.ogg"
LOAD_DIALOGUE tomDialogue_02 "phase_3.5/audio/dial/CC_tom_tutorial_questscript03.ogg"
LOAD_DIALOGUE tomDialogue_03 "phase_3.5/audio/dial/CC_tom_tutorial_questscript04.ogg"
LOAD_DIALOGUE tomDialogue_04 "phase_3.5/audio/dial/CC_tom_tutorial_questscript05.ogg"
LOAD_DIALOGUE tomDialogue_05 "phase_3.5/audio/dial/CC_tom_tutorial_questscript06.ogg"
LOAD_DIALOGUE tomDialogue_06 "phase_3.5/audio/dial/CC_tom_tutorial_questscript07.ogg"
LOAD_DIALOGUE tomDialogue_07 "phase_3.5/audio/dial/CC_tom_tutorial_questscript08.ogg"
LOAD_DIALOGUE tomDialogue_08 "phase_3.5/audio/dial/CC_tom_tutorial_questscript09.ogg"
LOAD_DIALOGUE tomDialogue_09 "phase_3.5/audio/dial/CC_tom_tutorial_questscript10.ogg"
LOAD_DIALOGUE tomDialogue_10 "phase_3.5/audio/dial/CC_tom_tutorial_questscript11.ogg"
LOAD_DIALOGUE tomDialogue_11 "phase_3.5/audio/dial/CC_tom_tutorial_questscript12.ogg"
LOAD_DIALOGUE tomDialogue_12 "phase_3.5/audio/dial/CC_tom_tutorial_questscript13.ogg"
LOAD_DIALOGUE tomDialogue_13 "phase_3.5/audio/dial/CC_tom_tutorial_questscript14.ogg"
LOAD_DIALOGUE tomDialogue_14 "phase_3.5/audio/dial/CC_tom_tutorial_questscript16.ogg"
POSHPRSCALE cogs -1.05 7 0 0 0 0 1 1 1
POSHPRSCALE toonBuilding -1.05 7 0 0 0 0 1 1 1
POSHPRSCALE cogBuilding -1.05 7 0 0 0 0 1 1 1
POSHPRSCALE squirt1 -1.05 7 0 0 0 0 1 1 1
POSHPRSCALE squirt2 -1.05 7 0 0 0 0 1 1 1
REPARENTTO camera npc
POS camera -2.2 5.2 3.3
HPR camera 215 5 0
WRTREPARENTTO camera localToon
PLAY_ANIM npc "right-hand-start" 1
WAIT 1
REPARENTTO cogs aspect2d
LERP_SCALE cogs 1 1 1 0.5
WAIT 1.0833
LOOP_ANIM npc "right-hand" 1
FUNCTION npc "angryEyes"
FUNCTION npc "blinkEyes"
LOCAL_CHAT_CONFIRM npc QuestScript101_1 "CFSpeech" tomDialogue_01
LOCAL_CHAT_CONFIRM npc QuestScript101_2 "CFSpeech" tomDialogue_02
REPARENTTO cogs hidden
REPARENTTO toonBuilding camera
LOCAL_CHAT_CONFIRM npc QuestScript101_3 "CFSpeech" tomDialogue_03
REPARENTTO toonBuilding hidden
REPARENTTO cogBuilding camera
FUNCTION npc "sadEyes"
FUNCTION npc "blinkEyes"
LOCAL_CHAT_CONFIRM npc QuestScript101_4 "CFSpeech" tomDialogue_04
REPARENTTO cogBuilding hidden
REPARENTTO squirt1 camera
FUNCTION npc "normalEyes"
FUNCTION npc "blinkEyes"
LOCAL_CHAT_CONFIRM npc QuestScript101_5 "CFSpeech" tomDialogue_05
REPARENTTO squirt1 hidden
REPARENTTO squirt2 camera
LOCAL_CHAT_CONFIRM npc QuestScript101_6 "CFSpeech" tomDialogue_06
PLAY_ANIM npc 'right-hand-start' -1.8
LERP_SCALE squirt2 1 1 0.01 0.5
WAIT 0.5
REPARENTTO squirt2 hidden
WAIT 0.6574
LOOP_ANIM npc 'neutral' 1
LOCAL_CHAT_CONFIRM npc QuestScript101_7 "CFSpeech" tomDialogue_07
# Make it look like the client has no inventory. Since the toon.dc
# specifies that the user really does have 1 of each item, we will
# just put on a show for the client of not having any items then
# handing them out.
SET_INVENTORY 4 0 0
SET_INVENTORY 5 0 0
REPARENTTO inventory camera
SHOW inventory
SET_INVENTORY_DETAIL -1
POSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 0.01 0.01 0.01
SET_INVENTORY_YPOS 4 0 -0.1
SET_INVENTORY_YPOS 5 0 -0.1
LERP_SCALE inventory 3 0.01 3 1
WAIT 1
REPARENTTO flower npc "**/1000/**/def_joint_right_hold"
POSHPRSCALE flower 0.10 -0.14 0.20 180.00 287.10 168.69 0.70 0.70 0.70
PLAY_ANIM npc 'right-hand-start' 1.8
WAIT 1.1574
LOOP_ANIM npc 'right-hand' 1.1
WAIT 0.8
WRTREPARENTTO flower camera
LERP_POSHPRSCALE flower -1.75 4.77 0.00 30.00 180.00 16.39 0.75 0.75 0.75 0.589
WAIT 1.094
LERP_POSHPRSCALE flower -1.76 7.42 -0.63 179.96 -89.9 -153.43 0.12 0.12 0.12 1
PLAY_ANIM npc 'right-hand-start' -1.5
WAIT 1
ADD_INVENTORY 5 0 1
POSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3
REPARENTTO flower hidden
REPARENTTO tart npc "**/1000/**/def_joint_right_hold"
POSHPRSCALE tart 0.19 0.02 0.00 0.00 0.00 349.38 0.34 0.34 0.34
PLAY_ANIM npc 'right-hand-start' 1.8
WAIT 1.1574
LOOP_ANIM npc 'right-hand' 1.1
WAIT 0.8
WRTREPARENTTO tart camera
LERP_POSHPRSCALE tart -1.37 4.56 0 329.53 39.81 346.76 0.6 0.6 0.6 0.589
WAIT 1.094
LERP_POSHPRSCALE tart -1.66 7.42 -0.36 0 30 30 0.12 0.12 0.12 1.0
PLAY_ANIM npc 'right-hand-start' -1.5
WAIT 1
ADD_INVENTORY 4 0 1
POSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3
REPARENTTO tart hidden
#PLAY_ANIM npc 'neutral' 1
#WAIT 2.0833
PLAY_ANIM npc 'right-hand-start' 1
WAIT 1.0
HIDE inventory
REPARENTTO inventory hidden
SET_INVENTORY_YPOS 4 0 0
SET_INVENTORY_YPOS 5 0 0
SET_INVENTORY_DETAIL 0
POSHPRSCALE inventory 0 0 0 0 0 0 1 1 1
OBSCURE_LAFFMETER 0
SHOW laffMeter
POS laffMeter 0 0 0
SCALE laffMeter 0.075 0.075 0.075
LERP_POS laffMeter 1.7 0 0.87 1
LERP_SCALE laffMeter 0.2 0.2 0.2 0.6
WAIT 1.0833
LOOP_ANIM npc "right-hand"
LOCAL_CHAT_CONFIRM npc QuestScript101_8 "CFSpeech" tomDialogue_08
LOCAL_CHAT_CONFIRM npc QuestScript101_9 "CFSpeech" tomDialogue_09
FUNCTION npc "sadEyes"
FUNCTION npc "blinkEyes"
LAFFMETER 15 15
WAIT 0.1
LAFFMETER 14 15
WAIT 0.1
LAFFMETER 13 15
WAIT 0.1
LAFFMETER 12 15
WAIT 0.1
LAFFMETER 11 15
WAIT 0.1
LAFFMETER 10 15
WAIT 0.1
LAFFMETER 9 15
WAIT 0.1
LAFFMETER 8 15
WAIT 0.1
LAFFMETER 7 15
WAIT 0.1
LAFFMETER 6 15
WAIT 0.1
LAFFMETER 5 15
WAIT 0.1
LAFFMETER 4 15
WAIT 0.1
LAFFMETER 3 15
WAIT 0.1
LAFFMETER 2 15
WAIT 0.1
LAFFMETER 1 15
WAIT 0.1
LAFFMETER 0 15
LOCAL_CHAT_CONFIRM npc QuestScript101_10 "CFSpeech" tomDialogue_10
FUNCTION npc "normalEyes"
FUNCTION npc "blinkEyes"
LAFFMETER 15 15
WAIT 0.5
LERP_POS laffMeter 0.15 0.15 0.15 1
LERP_SCALE laffMeter 0.085 0.085 0.085 0.6
PLAY_ANIM npc "right-hand-start" -2
WAIT 1.0625
LOOP_ANIM npc "neutral"
WAIT 0.5
LERP_HPR npc -50 0 0 0.5
FUNCTION npc "surpriseEyes"
FUNCTION npc "showSurpriseMuzzle"
PLAY_ANIM npc "right-point-start" 1.5
WAIT 0.6944
LOOP_ANIM npc "right-point"
LOCAL_CHAT_CONFIRM npc QuestScript101_11 "CFSpeech" tomDialogue_11
LOCAL_CHAT_CONFIRM npc QuestScript101_12 "CFSpeech" tomDialogue_12
PLAY_ANIM npc "right-point-start" -1
LERP_HPR npc -0.068 0 0 0.75
WAIT 1.0417
FUNCTION npc "angryEyes"
FUNCTION npc "blinkEyes"
FUNCTION npc "hideSurpriseMuzzle"
LOOP_ANIM npc "neutral"
FUNCTION localToon "questPage.showQuestsOnscreenTutorial"
LOCAL_CHAT_CONFIRM npc QuestScript101_13 "CFSpeech" tomDialogue_13
FUNCTION localToon "questPage.hideQuestsOnscreenTutorial"
LOCAL_CHAT_CONFIRM npc QuestScript101_14 1 "CFSpeech" tomDialogue_14
FUNCTION npc "normalEyes"
FUNCTION npc "blinkEyes"
# Cleanup
UPON_TIMEOUT FUNCTION tart "removeNode"
UPON_TIMEOUT FUNCTION flower "removeNode"
UPON_TIMEOUT FUNCTION cogs "removeNode"
UPON_TIMEOUT FUNCTION toonBuilding "removeNode"
UPON_TIMEOUT FUNCTION cogBuilding "removeNode"
UPON_TIMEOUT FUNCTION squirt1 "removeNode"
UPON_TIMEOUT FUNCTION squirt2 "removeNode"
UPON_TIMEOUT LOOP_ANIM npc "neutral"
UPON_TIMEOUT HIDE inventory
UPON_TIMEOUT SET_INVENTORY_DETAIL 0
UPON_TIMEOUT SHOW laffMeter
UPON_TIMEOUT POS laffMeter 0.15 0.15 0.15
UPON_TIMEOUT SCALE laffMeter 0.085 0.085 0.085
UPON_TIMEOUT POSHPRSCALE inventory 0 0 0 0 0 0 1 1 1
POS localToon 0.776 14.6 0
HPR localToon 47.5 0 0
FINISH_QUEST_MOVIE
# TUTORIAL HQ HARRY
ID quest_incomplete_110
DEBUG "quest assign 110"
LOAD_DIALOGUE harryDialogue_01 "phase_3.5/audio/dial/CC_harry_tutorial_questscript01.ogg"
LOAD_DIALOGUE harryDialogue_02 "phase_3.5/audio/dial/CC_harry_tutorial_questscript02.ogg"
LOAD_DIALOGUE harryDialogue_03 "phase_3.5/audio/dial/CC_harry_tutorial_questscript03.ogg"
LOAD_DIALOGUE harryDialogue_04 "phase_3.5/audio/dial/CC_harry_tutorial_questscript04.ogg"
LOAD_DIALOGUE harryDialogue_05 "phase_3.5/audio/dial/CC_harry_tutorial_questscript05.ogg"
LOAD_DIALOGUE harryDialogue_06 "phase_3.5/audio/dial/CC_harry_tutorial_questscript06.ogg"
LOAD_DIALOGUE harryDialogue_07 "phase_3.5/audio/dial/CC_harry_tutorial_questscript07.ogg"
LOAD_DIALOGUE harryDialogue_08 "phase_3.5/audio/dial/CC_harry_tutorial_questscript08.ogg"
LOAD_DIALOGUE harryDialogue_09 "phase_3.5/audio/dial/CC_harry_tutorial_questscript09.ogg"
LOAD_DIALOGUE harryDialogue_10 "phase_3.5/audio/dial/CC_harry_tutorial_questscript10.ogg"
LOAD_DIALOGUE harryDialogue_11 "phase_3.5/audio/dial/CC_harry_tutorial_questscript11.ogg"
SET_MUSIC_VOLUME 0.4 activityMusic 0.5 0.7
LOCAL_CHAT_CONFIRM npc QuestScript110_1 harryDialogue_01
OBSCURE_BOOK 0
SHOW bookOpenButton
LOCAL_CHAT_CONFIRM npc QuestScript110_2 harryDialogue_02
# ARROWS_ON 0.92 -0.89 0 1.22 -0.64 90
ARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90
LOCAL_CHAT_PERSIST npc QuestScript110_3 harryDialogue_03
WAIT_EVENT "enterStickerBook"
ARROWS_OFF
SHOW_BOOK
HIDE bookPrevArrow
HIDE bookNextArrow
CLEAR_CHAT npc
WAIT 0.5
TOON_HEAD npc -0.2 -0.45 1
LOCAL_CHAT_CONFIRM npc QuestScript110_4 harryDialogue_04
ARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90
SHOW bookNextArrow
LOCAL_CHAT_PERSIST npc QuestScript110_5 harryDialogue_05
WAIT_EVENT "stickerBookPageChange-4"
HIDE bookPrevArrow
HIDE bookNextArrow
ARROWS_OFF
CLEAR_CHAT npc
WAIT 0.5
LOCAL_CHAT_CONFIRM npc QuestScript110_6 harryDialogue_06
ARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90
SHOW bookNextArrow
LOCAL_CHAT_PERSIST npc QuestScript110_7 harryDialogue_07
WAIT_EVENT "stickerBookPageChange-5"
HIDE bookNextArrow
HIDE bookPrevArrow
ARROWS_OFF
CLEAR_CHAT npc
LOCAL_CHAT_CONFIRM npc QuestScript110_8 harryDialogue_08
LOCAL_CHAT_CONFIRM npc QuestScript110_9 harryDialogue_09
LOCAL_CHAT_PERSIST npc QuestScript110_10 harryDialogue_10
ENABLE_CLOSE_BOOK
ARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90
WAIT_EVENT "exitStickerBook"
ARROWS_OFF
TOON_HEAD npc 0 0 0
HIDE_BOOK
HIDE bookOpenButton
LOCAL_CHAT_CONFIRM npc QuestScript110_11 1 harryDialogue_11
SET_MUSIC_VOLUME 0.7 activityMusic 1.0 0.4
# Lots of cleanup
UPON_TIMEOUT DEBUG "testing upon death"
UPON_TIMEOUT OBSCURE_BOOK 0
UPON_TIMEOUT ARROWS_OFF
UPON_TIMEOUT HIDE_BOOK
UPON_TIMEOUT COLOR_SCALE bookOpenButton 1 1 1 1
UPON_TIMEOUT TOON_HEAD npc 0 0 0
UPON_TIMEOUT SHOW bookOpenButton
FINISH_QUEST_MOVIE
# TUTORIAL FLIPPY
ID tutorial_blocker
LOAD_DIALOGUE blockerDialogue_01 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker01.ogg"
LOAD_DIALOGUE blockerDialogue_02 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker02.ogg"
LOAD_DIALOGUE blockerDialogue_03 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker03.ogg"
LOAD_DIALOGUE blockerDialogue_04 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker04.ogg"
LOAD_DIALOGUE blockerDialogue_05a "phase_3.5/audio/dial/CC_flippy_tutorial_blocker05.ogg"
LOAD_DIALOGUE blockerDialogue_05b "phase_3.5/audio/dial/CC_flippy_tutorial_blocker06.ogg"
LOAD_DIALOGUE blockerDialogue_06 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker07.ogg"
LOAD_DIALOGUE blockerDialogue_07 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker08.ogg"
LOAD_DIALOGUE blockerDialogue_08 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker09.ogg"
HIDE localToon
REPARENTTO camera npc
FUNCTION npc "stopLookAround"
#POS camera 0.0 6.0 4.0
#HPR camera 180.0 0.0 0.0
LERP_POSHPR camera 0.0 6.0 4.0 180.0 0.0 0.0 0.5
SET_MUSIC_VOLUME 0.4 music 0.5 0.8
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_1 blockerDialogue_01
WAIT 0.8
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_2 blockerDialogue_02
WAIT 0.8
#POS camera -5.0 -9.0 6.0
#HPR camera -25.0 -10.0 0.0
LERP_POSHPR camera -5.0 -9.0 6.0 -25.0 -10.0 0.0 0.5
POS localToon 203.8 18.64 -0.475
HPR localToon -90.0 0.0 0.0
SHOW localToon
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_3 blockerDialogue_03
OBSCURE_CHAT 1 0 0
SHOW chatScButton
WAIT 0.6
ARROWS_ON -1.3644 0.91 180 -1.5644 0.74 -90
LOCAL_CHAT_PERSIST npc QuestScriptTutorialBlocker_4 blockerDialogue_04
WAIT_EVENT "enterSpeedChat"
ARROWS_OFF
BLACK_CAT_LISTEN 1
WAIT_EVENT "SCChatEvent"
BLACK_CAT_LISTEN 0
WAIT 0.5
CLEAR_CHAT localToon
REPARENTTO camera localToon
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_5 "CFSpeech" blockerDialogue_05a blockerDialogue_05b
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_6 "CFSpeech" blockerDialogue_06
OBSCURE_CHAT 0 0 0
SHOW chatNormalButton
WAIT 0.6
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_7 "CFSpeech" blockerDialogue_07
LOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_8 1 "CFSpeech" blockerDialogue_08
SET_MUSIC_VOLUME 0.8 music 1.0 0.4
LOOP_ANIM npc "walk"
LERP_HPR npc 270 0 0 0.5
WAIT 0.5
LOOP_ANIM npc "run"
LERP_POS npc 217.4 18.81 -0.475 0.75
LERP_HPR npc 240 0 0 0.75
WAIT 0.75
LERP_POS npc 222.4 15.0 -0.475 0.35
LERP_HPR npc 180 0 0 0.35
WAIT 0.35
LERP_POS npc 222.4 5.0 -0.475 0.75
WAIT 0.75
REPARENTTO npc hidden
FREE_LOCALTOON
UPON_TIMEOUT ARROWS_OFF
UPON_TIMEOUT OBSCURE_CHAT 0 0 0
UPON_TIMEOUT REPARENTTO camera localToon
FINISH_QUEST_MOVIE
ID quest_incomplete_120
CHAT_CONFIRM npc QuestScript120_1
# ANIM
CHAT_CONFIRM npc QuestScript120_2 1
FINISH_QUEST_MOVIE
ID quest_assign_121
CHAT_CONFIRM npc QuestScript121_1 1
FINISH_QUEST_MOVIE
ID quest_assign_130
CHAT_CONFIRM npc QuestScript130_1 1
FINISH_QUEST_MOVIE
ID quest_assign_131
CHAT_CONFIRM npc QuestScript131_1 1
FINISH_QUEST_MOVIE
ID quest_assign_140
CHAT_CONFIRM npc QuestScript140_1 1
FINISH_QUEST_MOVIE
ID quest_assign_141
CHAT_CONFIRM npc QuestScript141_1 1
FINISH_QUEST_MOVIE
# TUTORIAL COG
ID quest_incomplete_145
CHAT_CONFIRM npc QuestScript145_1 1
LOAD frame "phase_4/models/gui/tfa_images" "FrameBlankA"
LOAD tunnel "phase_4/models/gui/tfa_images" "tunnelSignA"
POSHPRSCALE tunnel 0 0 0 0 0 0 0.8 0.8 0.8
REPARENTTO tunnel frame
POSHPRSCALE frame 0 0 0 0 0 0 0.1 0.1 0.1
REPARENTTO frame aspect2d
LERP_SCALE frame 1.0 1.0 1.0 1.0
WAIT 3.0
LERP_SCALE frame 0.1 0.1 0.1 0.5
WAIT 0.5
REPARENTTO frame hidden
CHAT_CONFIRM npc QuestScript145_2 1
UPON_TIMEOUT FUNCTION frame "removeNode"
FINISH_QUEST_MOVIE
# TUTORIAL FRIENDS
ID quest_incomplete_150
CHAT_CONFIRM npc QuestScript150_1
ARROWS_ON 1.65 0.51 -120 1.65 0.51 -120
SHOW_FRIENDS_LIST
CHAT_CONFIRM npc QuestScript150_2
ARROWS_OFF
HIDE_FRIENDS_LIST
CHAT_CONFIRM npc QuestScript150_3
HIDE bFriendsList
CHAT_CONFIRM npc QuestScript150_4 1
UPON_TIMEOUT HIDE_FRIENDS_LIST
UPON_TIMEOUT ARROWS_OFF
FINISH_QUEST_MOVIE
# First Task: Assign Visit to Jester Chester
ID quest_assign_600
PLAY_ANIM npc "wave" 1
CHAT npc QuestScript600_1
LOAD_IMAGE logo "phase_3/maps/toontown-logo.png"
REPARENTTO logo aspect2d
POSHPRSCALE logo -0.4 7 0 0 0 0 0 0 0
LERP_SCALE logo 0.4 0.2 0.2 0.5
WAIT 2.5
LOOP_ANIM npc "neutral"
LERP_SCALE logo 0 0 0 0.5
WAIT 0.5
FUNCTION logo "destroy"
CLEAR_CHAT npc
CHAT_CONFIRM npc QuestScript600_2
CHAT_CONFIRM npc QuestScript600_3
CHAT_CONFIRM npc QuestScript600_4
CHAT_CONFIRM npc QuestScript600_5
PLAY_ANIM npc "wave" 1
CHAT_CONFIRM npc QuestScript600_6
LOOP_ANIM npc "neutral"
FINISH_QUEST_MOVIE
# Loopys Balls
ID quest_assign_10301
POSE_ANIM npc "wave" 20
CHAT_CONFIRM npc QuestScript10301_1
POSE_ANIM npc "neutral" 1
CHAT_CONFIRM npc QuestScript10301_2
POSE_ANIM npc "shrug" 25
CHAT_CONFIRM npc QuestScript10301_3
POSE_ANIM npc "think" 40
CHAT_CONFIRM npc QuestScript10301_4
POSE_ANIM npc "conked" 20
CHAT_CONFIRM npc QuestScript10301_5
POSE_ANIM npc "shrug" 25
CHAT_CONFIRM npc QuestScript10301_6
POSE_ANIM npc "think" 40
CHAT_CONFIRM npc QuestScript10301_7
POSE_ANIM npc "shrug" 25
CHAT_CONFIRM npc QuestScript10301_8
LOOP_ANIM npc "neutral"
FINISH_QUEST_MOVIE
# Loopys Balls
ID quest_incomplete_10301
POSE_ANIM npc "wave" 20
CHAT_CONFIRM npc QuestScript10301_1
POSE_ANIM npc "neutral" 1
CHAT_CONFIRM npc QuestScript10301_2
POSE_ANIM npc "shrug" 25
CHAT_CONFIRM npc QuestScript10301_3
POSE_ANIM npc "think" 40
CHAT_CONFIRM npc QuestScript10301_4
POSE_ANIM npc "conked" 20
CHAT_CONFIRM npc QuestScript10301_5
POSE_ANIM npc "shrug" 25
CHAT_CONFIRM npc QuestScript10301_6
POSE_ANIM npc "think" 40
CHAT_CONFIRM npc QuestScript10301_7
POSE_ANIM npc "shrug" 25
CHAT_CONFIRM npc QuestScript10301_8
LOOP_ANIM npc "neutral"
FINISH_QUEST_MOVIE
'''
| script = '\nID reward_100\nSHOW laffMeter\nLERP_POS laffMeter 0 0 0 1\nLERP_SCALE laffMeter 0.2 0.2 0.2 1\nWAIT 1.5\nADD_LAFFMETER 1\nWAIT 1\nLERP_POS laffMeter -1.18 0 -0.87 1\nLERP_SCALE laffMeter 0.075 0.075 0.075 1\nWAIT 1\nFINISH_QUEST_MOVIE\n\n# TUTORIAL\n\nID tutorial_mickey\nLOAD_SFX soundRun "phase_3.5/audio/sfx/AV_footstep_runloop.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_1 "phase_3/audio/dial/CC_%s_tutorial02.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_2 "phase_3.5/audio/dial/CC_tom_tutorial_%s01.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_3a "phase_3/audio/dial/CC_%s_tutorial03.ogg"\nLOAD_CC_DIALOGUE mickeyTutorialDialogue_3b "phase_3/audio/dial/CC_%s_tutorial05.ogg"\nLOAD_DIALOGUE mickeyTutorialDialogue_4 "phase_3.5/audio/dial/CC_tom_tutorial_mickey02.ogg"\nLOCK_LOCALTOON\nREPARENTTO camera render\nPOSHPRSCALE camera 11 7 3 52 0 0 1 1 1\nLOAD_CLASSIC_CHAR classicChar\nREPARENTTO classicChar render\nPOS classicChar 0 0 0\nHPR classicChar 0 0 0\nPOS localToon 0 0 0\nHPR localToon 0 0 0\nWAIT 2\nPLAY_SFX soundRun 1\nLOOP_ANIM classicChar "run"\nLOOP_ANIM localToon "run"\nLERP_POS localToon -1.8 14.4 0 2\nLERP_POS classicChar 0 17 0 2\nWAIT 2\n#LERP_HPR localToon -110 0 0 0.5\nLERP_HPR localToon -70 0 0 0.5\nLERP_HPR classicChar -120 0 0 0.5\nWAIT 0.5\nSTOP_SFX soundRun\nLOOP_ANIM localToon "neutral"\nPLAY_ANIM classicChar "left-point-start" 1\nWAIT 1.63\nLOOP_ANIM classicChar "left-point"\nCC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_1" mickeyTutorialDialogue_1\nPLAY_ANIM classicChar "left-point-start" -1.5\nWAIT 1.0867\nLOOP_ANIM classicChar "neutral"\nCC_CHAT_TO_CONFIRM npc classicChar "QuestScriptTutorial%s_2" "CFSpeech" mickeyTutorialDialogue_2\nPLAY_ANIM classicChar "right-point-start" 1\nWAIT 1.0867\nLOOP_ANIM classicChar "right-point"\nCC_CHAT_CONFIRM classicChar "QuestScriptTutorial%s_3" mickeyTutorialDialogue_3a mickeyTutorialDialogue_3b\nPLAY_SFX soundRun 1\nLOOP_ANIM classicChar "run"\nLERP_HPR classicChar -180 0 0 0.5\nWAIT 0.5\nLERP_POS classicChar 0 0 0 2\nWAIT 2\nSTOP_SFX soundRun\nREPARENTTO classicChar hidden\nUNLOAD_CHAR classicChar\n#CHAT npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4\nREPARENTTO camera localToon\nPOS localToon 1.6 9.8 0\nHPR localToon 14 0 0\nFREE_LOCALTOON\nLOCAL_CHAT_PERSIST npc QuestScriptTutorialMickey_4 mickeyTutorialDialogue_4\n\nID quest_assign_101\nCLEAR_CHAT npc\nLOAD squirt1 "phase_3.5/models/gui/tutorial_gui" "squirt1"\nLOAD squirt2 "phase_3.5/models/gui/tutorial_gui" "squirt2"\nLOAD toonBuilding "phase_3.5/models/gui/tutorial_gui" "toon_buildings"\nLOAD cogBuilding "phase_3.5/models/gui/tutorial_gui" "suit_buildings"\nLOAD cogs "phase_3.5/models/gui/tutorial_gui" "suits"\nLOAD tart "phase_3.5/models/props/tart"\nLOAD flower "phase_3.5/models/props/squirting-flower"\nLOAD_DIALOGUE tomDialogue_01 "phase_3.5/audio/dial/CC_tom_tutorial_questscript01.ogg"\nLOAD_DIALOGUE tomDialogue_02 "phase_3.5/audio/dial/CC_tom_tutorial_questscript03.ogg"\nLOAD_DIALOGUE tomDialogue_03 "phase_3.5/audio/dial/CC_tom_tutorial_questscript04.ogg"\nLOAD_DIALOGUE tomDialogue_04 "phase_3.5/audio/dial/CC_tom_tutorial_questscript05.ogg"\nLOAD_DIALOGUE tomDialogue_05 "phase_3.5/audio/dial/CC_tom_tutorial_questscript06.ogg"\nLOAD_DIALOGUE tomDialogue_06 "phase_3.5/audio/dial/CC_tom_tutorial_questscript07.ogg"\nLOAD_DIALOGUE tomDialogue_07 "phase_3.5/audio/dial/CC_tom_tutorial_questscript08.ogg"\nLOAD_DIALOGUE tomDialogue_08 "phase_3.5/audio/dial/CC_tom_tutorial_questscript09.ogg"\nLOAD_DIALOGUE tomDialogue_09 "phase_3.5/audio/dial/CC_tom_tutorial_questscript10.ogg"\nLOAD_DIALOGUE tomDialogue_10 "phase_3.5/audio/dial/CC_tom_tutorial_questscript11.ogg"\nLOAD_DIALOGUE tomDialogue_11 "phase_3.5/audio/dial/CC_tom_tutorial_questscript12.ogg"\nLOAD_DIALOGUE tomDialogue_12 "phase_3.5/audio/dial/CC_tom_tutorial_questscript13.ogg"\nLOAD_DIALOGUE tomDialogue_13 "phase_3.5/audio/dial/CC_tom_tutorial_questscript14.ogg"\nLOAD_DIALOGUE tomDialogue_14 "phase_3.5/audio/dial/CC_tom_tutorial_questscript16.ogg"\nPOSHPRSCALE cogs -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE toonBuilding -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE cogBuilding -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE squirt1 -1.05 7 0 0 0 0 1 1 1\nPOSHPRSCALE squirt2 -1.05 7 0 0 0 0 1 1 1\nREPARENTTO camera npc\nPOS camera -2.2 5.2 3.3\nHPR camera 215 5 0\nWRTREPARENTTO camera localToon\nPLAY_ANIM npc "right-hand-start" 1\nWAIT 1\nREPARENTTO cogs aspect2d\nLERP_SCALE cogs 1 1 1 0.5\nWAIT 1.0833\nLOOP_ANIM npc "right-hand" 1\nFUNCTION npc "angryEyes"\nFUNCTION npc "blinkEyes"\nLOCAL_CHAT_CONFIRM npc QuestScript101_1 "CFSpeech" tomDialogue_01\nLOCAL_CHAT_CONFIRM npc QuestScript101_2 "CFSpeech" tomDialogue_02\nREPARENTTO cogs hidden\nREPARENTTO toonBuilding camera\nLOCAL_CHAT_CONFIRM npc QuestScript101_3 "CFSpeech" tomDialogue_03\nREPARENTTO toonBuilding hidden\nREPARENTTO cogBuilding camera\nFUNCTION npc "sadEyes"\nFUNCTION npc "blinkEyes"\nLOCAL_CHAT_CONFIRM npc QuestScript101_4 "CFSpeech" tomDialogue_04\nREPARENTTO cogBuilding hidden\nREPARENTTO squirt1 camera\nFUNCTION npc "normalEyes"\nFUNCTION npc "blinkEyes"\nLOCAL_CHAT_CONFIRM npc QuestScript101_5 "CFSpeech" tomDialogue_05\nREPARENTTO squirt1 hidden\nREPARENTTO squirt2 camera\nLOCAL_CHAT_CONFIRM npc QuestScript101_6 "CFSpeech" tomDialogue_06\nPLAY_ANIM npc \'right-hand-start\' -1.8\nLERP_SCALE squirt2 1 1 0.01 0.5\nWAIT 0.5\nREPARENTTO squirt2 hidden\nWAIT 0.6574\nLOOP_ANIM npc \'neutral\' 1\nLOCAL_CHAT_CONFIRM npc QuestScript101_7 "CFSpeech" tomDialogue_07\n# Make it look like the client has no inventory. Since the toon.dc\n# specifies that the user really does have 1 of each item, we will\n# just put on a show for the client of not having any items then\n# handing them out.\nSET_INVENTORY 4 0 0\nSET_INVENTORY 5 0 0\nREPARENTTO inventory camera\nSHOW inventory\nSET_INVENTORY_DETAIL -1\nPOSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 0.01 0.01 0.01\nSET_INVENTORY_YPOS 4 0 -0.1\nSET_INVENTORY_YPOS 5 0 -0.1\nLERP_SCALE inventory 3 0.01 3 1\nWAIT 1\nREPARENTTO flower npc "**/1000/**/def_joint_right_hold"\nPOSHPRSCALE flower 0.10 -0.14 0.20 180.00 287.10 168.69 0.70 0.70 0.70\nPLAY_ANIM npc \'right-hand-start\' 1.8\nWAIT 1.1574\nLOOP_ANIM npc \'right-hand\' 1.1\nWAIT 0.8\nWRTREPARENTTO flower camera\nLERP_POSHPRSCALE flower -1.75 4.77 0.00 30.00 180.00 16.39 0.75 0.75 0.75 0.589\nWAIT 1.094\nLERP_POSHPRSCALE flower -1.76 7.42 -0.63 179.96 -89.9 -153.43 0.12 0.12 0.12 1\nPLAY_ANIM npc \'right-hand-start\' -1.5\nWAIT 1\nADD_INVENTORY 5 0 1\nPOSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3\nREPARENTTO flower hidden\nREPARENTTO tart npc "**/1000/**/def_joint_right_hold"\nPOSHPRSCALE tart 0.19 0.02 0.00 0.00 0.00 349.38 0.34 0.34 0.34\nPLAY_ANIM npc \'right-hand-start\' 1.8\nWAIT 1.1574\nLOOP_ANIM npc \'right-hand\' 1.1\nWAIT 0.8\nWRTREPARENTTO tart camera\nLERP_POSHPRSCALE tart -1.37 4.56 0 329.53 39.81 346.76 0.6 0.6 0.6 0.589\nWAIT 1.094\nLERP_POSHPRSCALE tart -1.66 7.42 -0.36 0 30 30 0.12 0.12 0.12 1.0\nPLAY_ANIM npc \'right-hand-start\' -1.5\nWAIT 1\nADD_INVENTORY 4 0 1\nPOSHPRSCALE inventory -0.77 7.42 1.11 0 0 0 3 0.01 3\nREPARENTTO tart hidden\n#PLAY_ANIM npc \'neutral\' 1\n#WAIT 2.0833\nPLAY_ANIM npc \'right-hand-start\' 1\nWAIT 1.0\nHIDE inventory\nREPARENTTO inventory hidden\nSET_INVENTORY_YPOS 4 0 0\nSET_INVENTORY_YPOS 5 0 0\nSET_INVENTORY_DETAIL 0\nPOSHPRSCALE inventory 0 0 0 0 0 0 1 1 1\nOBSCURE_LAFFMETER 0\nSHOW laffMeter\nPOS laffMeter 0 0 0\nSCALE laffMeter 0.075 0.075 0.075\nLERP_POS laffMeter 1.7 0 0.87 1\nLERP_SCALE laffMeter 0.2 0.2 0.2 0.6\nWAIT 1.0833\nLOOP_ANIM npc "right-hand"\nLOCAL_CHAT_CONFIRM npc QuestScript101_8 "CFSpeech" tomDialogue_08\nLOCAL_CHAT_CONFIRM npc QuestScript101_9 "CFSpeech" tomDialogue_09\nFUNCTION npc "sadEyes"\nFUNCTION npc "blinkEyes"\nLAFFMETER 15 15\nWAIT 0.1\nLAFFMETER 14 15\nWAIT 0.1\nLAFFMETER 13 15\nWAIT 0.1\nLAFFMETER 12 15\nWAIT 0.1\nLAFFMETER 11 15\nWAIT 0.1\nLAFFMETER 10 15\nWAIT 0.1\nLAFFMETER 9 15\nWAIT 0.1\nLAFFMETER 8 15\nWAIT 0.1\nLAFFMETER 7 15\nWAIT 0.1\nLAFFMETER 6 15\nWAIT 0.1\nLAFFMETER 5 15\nWAIT 0.1\nLAFFMETER 4 15\nWAIT 0.1\nLAFFMETER 3 15\nWAIT 0.1\nLAFFMETER 2 15\nWAIT 0.1\nLAFFMETER 1 15\nWAIT 0.1\nLAFFMETER 0 15\nLOCAL_CHAT_CONFIRM npc QuestScript101_10 "CFSpeech" tomDialogue_10\nFUNCTION npc "normalEyes"\nFUNCTION npc "blinkEyes"\nLAFFMETER 15 15\nWAIT 0.5\nLERP_POS laffMeter 0.15 0.15 0.15 1\nLERP_SCALE laffMeter 0.085 0.085 0.085 0.6\nPLAY_ANIM npc "right-hand-start" -2\nWAIT 1.0625\nLOOP_ANIM npc "neutral"\nWAIT 0.5\nLERP_HPR npc -50 0 0 0.5\nFUNCTION npc "surpriseEyes"\nFUNCTION npc "showSurpriseMuzzle"\nPLAY_ANIM npc "right-point-start" 1.5\nWAIT 0.6944\nLOOP_ANIM npc "right-point"\nLOCAL_CHAT_CONFIRM npc QuestScript101_11 "CFSpeech" tomDialogue_11\nLOCAL_CHAT_CONFIRM npc QuestScript101_12 "CFSpeech" tomDialogue_12\nPLAY_ANIM npc "right-point-start" -1\nLERP_HPR npc -0.068 0 0 0.75\nWAIT 1.0417\nFUNCTION npc "angryEyes"\nFUNCTION npc "blinkEyes"\nFUNCTION npc "hideSurpriseMuzzle"\nLOOP_ANIM npc "neutral"\nFUNCTION localToon "questPage.showQuestsOnscreenTutorial"\nLOCAL_CHAT_CONFIRM npc QuestScript101_13 "CFSpeech" tomDialogue_13\nFUNCTION localToon "questPage.hideQuestsOnscreenTutorial"\nLOCAL_CHAT_CONFIRM npc QuestScript101_14 1 "CFSpeech" tomDialogue_14\nFUNCTION npc "normalEyes"\nFUNCTION npc "blinkEyes"\n# Cleanup\nUPON_TIMEOUT FUNCTION tart "removeNode"\nUPON_TIMEOUT FUNCTION flower "removeNode"\nUPON_TIMEOUT FUNCTION cogs "removeNode"\nUPON_TIMEOUT FUNCTION toonBuilding "removeNode"\nUPON_TIMEOUT FUNCTION cogBuilding "removeNode"\nUPON_TIMEOUT FUNCTION squirt1 "removeNode"\nUPON_TIMEOUT FUNCTION squirt2 "removeNode"\nUPON_TIMEOUT LOOP_ANIM npc "neutral"\nUPON_TIMEOUT HIDE inventory\nUPON_TIMEOUT SET_INVENTORY_DETAIL 0\nUPON_TIMEOUT SHOW laffMeter\nUPON_TIMEOUT POS laffMeter 0.15 0.15 0.15\nUPON_TIMEOUT SCALE laffMeter 0.085 0.085 0.085\nUPON_TIMEOUT POSHPRSCALE inventory 0 0 0 0 0 0 1 1 1\nPOS localToon 0.776 14.6 0\nHPR localToon 47.5 0 0\nFINISH_QUEST_MOVIE\n\n# TUTORIAL HQ HARRY\n\nID quest_incomplete_110\nDEBUG "quest assign 110"\nLOAD_DIALOGUE harryDialogue_01 "phase_3.5/audio/dial/CC_harry_tutorial_questscript01.ogg"\nLOAD_DIALOGUE harryDialogue_02 "phase_3.5/audio/dial/CC_harry_tutorial_questscript02.ogg"\nLOAD_DIALOGUE harryDialogue_03 "phase_3.5/audio/dial/CC_harry_tutorial_questscript03.ogg"\nLOAD_DIALOGUE harryDialogue_04 "phase_3.5/audio/dial/CC_harry_tutorial_questscript04.ogg"\nLOAD_DIALOGUE harryDialogue_05 "phase_3.5/audio/dial/CC_harry_tutorial_questscript05.ogg"\nLOAD_DIALOGUE harryDialogue_06 "phase_3.5/audio/dial/CC_harry_tutorial_questscript06.ogg"\nLOAD_DIALOGUE harryDialogue_07 "phase_3.5/audio/dial/CC_harry_tutorial_questscript07.ogg"\nLOAD_DIALOGUE harryDialogue_08 "phase_3.5/audio/dial/CC_harry_tutorial_questscript08.ogg"\nLOAD_DIALOGUE harryDialogue_09 "phase_3.5/audio/dial/CC_harry_tutorial_questscript09.ogg"\nLOAD_DIALOGUE harryDialogue_10 "phase_3.5/audio/dial/CC_harry_tutorial_questscript10.ogg"\nLOAD_DIALOGUE harryDialogue_11 "phase_3.5/audio/dial/CC_harry_tutorial_questscript11.ogg"\nSET_MUSIC_VOLUME 0.4 activityMusic 0.5 0.7\nLOCAL_CHAT_CONFIRM npc QuestScript110_1 harryDialogue_01\nOBSCURE_BOOK 0\nSHOW bookOpenButton\nLOCAL_CHAT_CONFIRM npc QuestScript110_2 harryDialogue_02\n# ARROWS_ON 0.92 -0.89 0 1.22 -0.64 90\nARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90\nLOCAL_CHAT_PERSIST npc QuestScript110_3 harryDialogue_03\nWAIT_EVENT "enterStickerBook"\nARROWS_OFF\nSHOW_BOOK\nHIDE bookPrevArrow\nHIDE bookNextArrow\nCLEAR_CHAT npc\nWAIT 0.5\nTOON_HEAD npc -0.2 -0.45 1\nLOCAL_CHAT_CONFIRM npc QuestScript110_4 harryDialogue_04\nARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90\nSHOW bookNextArrow\nLOCAL_CHAT_PERSIST npc QuestScript110_5 harryDialogue_05\nWAIT_EVENT "stickerBookPageChange-4"\nHIDE bookPrevArrow\nHIDE bookNextArrow\nARROWS_OFF\nCLEAR_CHAT npc\nWAIT 0.5\nLOCAL_CHAT_CONFIRM npc QuestScript110_6 harryDialogue_06\nARROWS_ON 0.85 -0.75 -90 0.85 -0.75 -90\nSHOW bookNextArrow\nLOCAL_CHAT_PERSIST npc QuestScript110_7 harryDialogue_07\nWAIT_EVENT "stickerBookPageChange-5"\nHIDE bookNextArrow\nHIDE bookPrevArrow\nARROWS_OFF\nCLEAR_CHAT npc\nLOCAL_CHAT_CONFIRM npc QuestScript110_8 harryDialogue_08\nLOCAL_CHAT_CONFIRM npc QuestScript110_9 harryDialogue_09\nLOCAL_CHAT_PERSIST npc QuestScript110_10 harryDialogue_10\nENABLE_CLOSE_BOOK\nARROWS_ON 1.364477 -0.89 0 1.664477 -0.64 90\nWAIT_EVENT "exitStickerBook"\nARROWS_OFF\nTOON_HEAD npc 0 0 0\nHIDE_BOOK\nHIDE bookOpenButton\nLOCAL_CHAT_CONFIRM npc QuestScript110_11 1 harryDialogue_11\nSET_MUSIC_VOLUME 0.7 activityMusic 1.0 0.4\n# Lots of cleanup\nUPON_TIMEOUT DEBUG "testing upon death"\nUPON_TIMEOUT OBSCURE_BOOK 0\nUPON_TIMEOUT ARROWS_OFF\nUPON_TIMEOUT HIDE_BOOK\nUPON_TIMEOUT COLOR_SCALE bookOpenButton 1 1 1 1\nUPON_TIMEOUT TOON_HEAD npc 0 0 0\nUPON_TIMEOUT SHOW bookOpenButton\nFINISH_QUEST_MOVIE\n\n# TUTORIAL FLIPPY\n\nID tutorial_blocker\nLOAD_DIALOGUE blockerDialogue_01 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker01.ogg"\nLOAD_DIALOGUE blockerDialogue_02 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker02.ogg"\nLOAD_DIALOGUE blockerDialogue_03 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker03.ogg"\nLOAD_DIALOGUE blockerDialogue_04 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker04.ogg"\nLOAD_DIALOGUE blockerDialogue_05a "phase_3.5/audio/dial/CC_flippy_tutorial_blocker05.ogg"\nLOAD_DIALOGUE blockerDialogue_05b "phase_3.5/audio/dial/CC_flippy_tutorial_blocker06.ogg"\nLOAD_DIALOGUE blockerDialogue_06 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker07.ogg"\nLOAD_DIALOGUE blockerDialogue_07 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker08.ogg"\nLOAD_DIALOGUE blockerDialogue_08 "phase_3.5/audio/dial/CC_flippy_tutorial_blocker09.ogg"\nHIDE localToon\nREPARENTTO camera npc\nFUNCTION npc "stopLookAround"\n#POS camera 0.0 6.0 4.0\n#HPR camera 180.0 0.0 0.0\nLERP_POSHPR camera 0.0 6.0 4.0 180.0 0.0 0.0 0.5\nSET_MUSIC_VOLUME 0.4 music 0.5 0.8\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_1 blockerDialogue_01\nWAIT 0.8\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_2 blockerDialogue_02\nWAIT 0.8\n#POS camera -5.0 -9.0 6.0\n#HPR camera -25.0 -10.0 0.0\nLERP_POSHPR camera -5.0 -9.0 6.0 -25.0 -10.0 0.0 0.5\nPOS localToon 203.8 18.64 -0.475\nHPR localToon -90.0 0.0 0.0\nSHOW localToon\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_3 blockerDialogue_03\nOBSCURE_CHAT 1 0 0\nSHOW chatScButton\nWAIT 0.6\nARROWS_ON -1.3644 0.91 180 -1.5644 0.74 -90\nLOCAL_CHAT_PERSIST npc QuestScriptTutorialBlocker_4 blockerDialogue_04\nWAIT_EVENT "enterSpeedChat"\nARROWS_OFF\nBLACK_CAT_LISTEN 1\nWAIT_EVENT "SCChatEvent"\nBLACK_CAT_LISTEN 0\nWAIT 0.5\nCLEAR_CHAT localToon\nREPARENTTO camera localToon\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_5 "CFSpeech" blockerDialogue_05a blockerDialogue_05b\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_6 "CFSpeech" blockerDialogue_06\nOBSCURE_CHAT 0 0 0\nSHOW chatNormalButton\nWAIT 0.6\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_7 "CFSpeech" blockerDialogue_07\nLOCAL_CHAT_CONFIRM npc QuestScriptTutorialBlocker_8 1 "CFSpeech" blockerDialogue_08\nSET_MUSIC_VOLUME 0.8 music 1.0 0.4\nLOOP_ANIM npc "walk"\nLERP_HPR npc 270 0 0 0.5\nWAIT 0.5\nLOOP_ANIM npc "run"\nLERP_POS npc 217.4 18.81 -0.475 0.75\nLERP_HPR npc 240 0 0 0.75\nWAIT 0.75\nLERP_POS npc 222.4 15.0 -0.475 0.35\nLERP_HPR npc 180 0 0 0.35\nWAIT 0.35\nLERP_POS npc 222.4 5.0 -0.475 0.75\nWAIT 0.75\nREPARENTTO npc hidden\nFREE_LOCALTOON\nUPON_TIMEOUT ARROWS_OFF\nUPON_TIMEOUT OBSCURE_CHAT 0 0 0\nUPON_TIMEOUT REPARENTTO camera localToon\nFINISH_QUEST_MOVIE\n\nID quest_incomplete_120\nCHAT_CONFIRM npc QuestScript120_1\n# ANIM\nCHAT_CONFIRM npc QuestScript120_2 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_121\nCHAT_CONFIRM npc QuestScript121_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_130\nCHAT_CONFIRM npc QuestScript130_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_131\nCHAT_CONFIRM npc QuestScript131_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_140\nCHAT_CONFIRM npc QuestScript140_1 1\nFINISH_QUEST_MOVIE\n\nID quest_assign_141\nCHAT_CONFIRM npc QuestScript141_1 1\nFINISH_QUEST_MOVIE\n\n# TUTORIAL COG\n\nID quest_incomplete_145\nCHAT_CONFIRM npc QuestScript145_1 1\nLOAD frame "phase_4/models/gui/tfa_images" "FrameBlankA"\nLOAD tunnel "phase_4/models/gui/tfa_images" "tunnelSignA"\nPOSHPRSCALE tunnel 0 0 0 0 0 0 0.8 0.8 0.8\nREPARENTTO tunnel frame\nPOSHPRSCALE frame 0 0 0 0 0 0 0.1 0.1 0.1\nREPARENTTO frame aspect2d\nLERP_SCALE frame 1.0 1.0 1.0 1.0\nWAIT 3.0\nLERP_SCALE frame 0.1 0.1 0.1 0.5\nWAIT 0.5\nREPARENTTO frame hidden\nCHAT_CONFIRM npc QuestScript145_2 1\nUPON_TIMEOUT FUNCTION frame "removeNode"\nFINISH_QUEST_MOVIE\n\n# TUTORIAL FRIENDS\n\nID quest_incomplete_150\nCHAT_CONFIRM npc QuestScript150_1\nARROWS_ON 1.65 0.51 -120 1.65 0.51 -120\nSHOW_FRIENDS_LIST\nCHAT_CONFIRM npc QuestScript150_2\nARROWS_OFF\nHIDE_FRIENDS_LIST\nCHAT_CONFIRM npc QuestScript150_3\nHIDE bFriendsList\nCHAT_CONFIRM npc QuestScript150_4 1\nUPON_TIMEOUT HIDE_FRIENDS_LIST\nUPON_TIMEOUT ARROWS_OFF\nFINISH_QUEST_MOVIE\n\n# First Task: Assign Visit to Jester Chester\nID quest_assign_600\nPLAY_ANIM npc "wave" 1\nCHAT npc QuestScript600_1\nLOAD_IMAGE logo "phase_3/maps/toontown-logo.png"\nREPARENTTO logo aspect2d\nPOSHPRSCALE logo -0.4 7 0 0 0 0 0 0 0\nLERP_SCALE logo 0.4 0.2 0.2 0.5\nWAIT 2.5\nLOOP_ANIM npc "neutral"\nLERP_SCALE logo 0 0 0 0.5\nWAIT 0.5\nFUNCTION logo "destroy"\nCLEAR_CHAT npc\nCHAT_CONFIRM npc QuestScript600_2\nCHAT_CONFIRM npc QuestScript600_3\nCHAT_CONFIRM npc QuestScript600_4\nCHAT_CONFIRM npc QuestScript600_5\nPLAY_ANIM npc "wave" 1\nCHAT_CONFIRM npc QuestScript600_6\nLOOP_ANIM npc "neutral"\nFINISH_QUEST_MOVIE\n\n# Loopys Balls\nID quest_assign_10301\nPOSE_ANIM npc "wave" 20\nCHAT_CONFIRM npc QuestScript10301_1\nPOSE_ANIM npc "neutral" 1\nCHAT_CONFIRM npc QuestScript10301_2\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_3\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_4\nPOSE_ANIM npc "conked" 20\nCHAT_CONFIRM npc QuestScript10301_5\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_6\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_7\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_8\nLOOP_ANIM npc "neutral"\nFINISH_QUEST_MOVIE\n\n# Loopys Balls\nID quest_incomplete_10301\nPOSE_ANIM npc "wave" 20\nCHAT_CONFIRM npc QuestScript10301_1\nPOSE_ANIM npc "neutral" 1\nCHAT_CONFIRM npc QuestScript10301_2\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_3\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_4\nPOSE_ANIM npc "conked" 20\nCHAT_CONFIRM npc QuestScript10301_5\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_6\nPOSE_ANIM npc "think" 40\nCHAT_CONFIRM npc QuestScript10301_7\nPOSE_ANIM npc "shrug" 25\nCHAT_CONFIRM npc QuestScript10301_8\nLOOP_ANIM npc "neutral"\nFINISH_QUEST_MOVIE\n' |
# https://leetcode.com/submissions/detail/109225225/
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def reverseList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None:
return
stack = []
while(head):
stack.append(head)
head = head.next
#New head
head = stack.pop()
head.next = None
final_head = head
while len(stack)>0:
head.next = stack.pop()
head = head.next
head.next = None
return final_head
| class Solution(object):
def reverse_list(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None:
return
stack = []
while head:
stack.append(head)
head = head.next
head = stack.pop()
head.next = None
final_head = head
while len(stack) > 0:
head.next = stack.pop()
head = head.next
head.next = None
return final_head |
class Word():
"""docstring for Word"""
def __init__(self, text: str, start_time: float, end_time: float):
assert isinstance(text, str), "text should be string."
assert isinstance(start_time, float) and isinstance(end_time, float), "Start time and end time should be float values."
self.text = text
self.start_time = start_time
self.end_time = end_time
def __str__(self):
return "Word(text='{}', start_time={}s, end_time={}s)".format(self.text, self.start_time, self.end_time)
def __len__(self):
return self.end_time - self.start_time | class Word:
"""docstring for Word"""
def __init__(self, text: str, start_time: float, end_time: float):
assert isinstance(text, str), 'text should be string.'
assert isinstance(start_time, float) and isinstance(end_time, float), 'Start time and end time should be float values.'
self.text = text
self.start_time = start_time
self.end_time = end_time
def __str__(self):
return "Word(text='{}', start_time={}s, end_time={}s)".format(self.text, self.start_time, self.end_time)
def __len__(self):
return self.end_time - self.start_time |
while True:
valores = input().split()
n = int(valores[0])
d = a = int(valores[1])
e = b = int(valores[2])
if n == 0 and a == 0 and b == 0:
break
while e != 0:
d, e = e, d % e
c = (a * b) // d
a_l = len(range(a, n + 1, a))
b_l = len(range(b, n + 1, b))
c_l = len(range(c, n + 1, c))
print(a_l + b_l - c_l)
| while True:
valores = input().split()
n = int(valores[0])
d = a = int(valores[1])
e = b = int(valores[2])
if n == 0 and a == 0 and (b == 0):
break
while e != 0:
(d, e) = (e, d % e)
c = a * b // d
a_l = len(range(a, n + 1, a))
b_l = len(range(b, n + 1, b))
c_l = len(range(c, n + 1, c))
print(a_l + b_l - c_l) |
def convert_to_string(idx_list, form_manager):
w_list = []
for i in range(len(idx_list)):
w_list.append(form_manager.get_idx_symbol(int(idx_list[i])))
return " ".join(w_list)
def is_all_same(c1, c2, form_manager):
all_same = False
if len(c1) == len(c2):
all_same = True
for j in range(len(c1)):
if c1[j] != c2[j]:
all_same = False
break
return all_same
def compute_accuracy(candidate_list, reference_list, form_manager):
if len(candidate_list) != len(reference_list):
print(
"candidate list has length {}, reference list has length {}\n".format(
len(candidate_list), len(reference_list)
)
)
len_min = min(len(candidate_list), len(reference_list))
c = 0
for i in range(len_min):
if is_all_same(candidate_list[i], reference_list[i], form_manager):
c = c + 1
else:
pass
return c / float(len_min)
def compute_tree_accuracy(candidate_list_, reference_list_, form_manager):
candidate_list = []
for i in range(len(candidate_list_)):
candidate_list.append(candidate_list_[i])
reference_list = []
for i in range(len(reference_list_)):
reference_list.append(reference_list_[i])
return compute_accuracy(candidate_list, reference_list, form_manager)
| def convert_to_string(idx_list, form_manager):
w_list = []
for i in range(len(idx_list)):
w_list.append(form_manager.get_idx_symbol(int(idx_list[i])))
return ' '.join(w_list)
def is_all_same(c1, c2, form_manager):
all_same = False
if len(c1) == len(c2):
all_same = True
for j in range(len(c1)):
if c1[j] != c2[j]:
all_same = False
break
return all_same
def compute_accuracy(candidate_list, reference_list, form_manager):
if len(candidate_list) != len(reference_list):
print('candidate list has length {}, reference list has length {}\n'.format(len(candidate_list), len(reference_list)))
len_min = min(len(candidate_list), len(reference_list))
c = 0
for i in range(len_min):
if is_all_same(candidate_list[i], reference_list[i], form_manager):
c = c + 1
else:
pass
return c / float(len_min)
def compute_tree_accuracy(candidate_list_, reference_list_, form_manager):
candidate_list = []
for i in range(len(candidate_list_)):
candidate_list.append(candidate_list_[i])
reference_list = []
for i in range(len(reference_list_)):
reference_list.append(reference_list_[i])
return compute_accuracy(candidate_list, reference_list, form_manager) |
def test_geoadd(judge_command):
judge_command(
'GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"',
{
"command": "GEOADD",
"key": "Sicily",
"longitude": "15.087269",
"latitude": "37.502669",
"member": '"Catania"',
},
)
def test_georadiusbymember(judge_command):
judge_command(
"GEORADIUSBYMEMBER Sicily Agrigento 100 km",
{
"command": "GEORADIUSBYMEMBER",
"key": "Sicily",
"member": "Agrigento",
"float": "100",
"distunit": "km",
},
)
def test_georadius(judge_command):
judge_command(
"GEORADIUS Sicily 15 37 200 km WITHDIST WITHCOORD ",
{
"command": "GEORADIUS",
"key": "Sicily",
"longitude": "15",
"latitude": "37",
"float": "200",
"distunit": "km",
"geochoice": "WITHCOORD",
},
)
| def test_geoadd(judge_command):
judge_command('GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"', {'command': 'GEOADD', 'key': 'Sicily', 'longitude': '15.087269', 'latitude': '37.502669', 'member': '"Catania"'})
def test_georadiusbymember(judge_command):
judge_command('GEORADIUSBYMEMBER Sicily Agrigento 100 km', {'command': 'GEORADIUSBYMEMBER', 'key': 'Sicily', 'member': 'Agrigento', 'float': '100', 'distunit': 'km'})
def test_georadius(judge_command):
judge_command('GEORADIUS Sicily 15 37 200 km WITHDIST WITHCOORD ', {'command': 'GEORADIUS', 'key': 'Sicily', 'longitude': '15', 'latitude': '37', 'float': '200', 'distunit': 'km', 'geochoice': 'WITHCOORD'}) |
"""
Common utilities/lib for use by multiple services
"""
subscription_types = ['policy_eval', 'tag_update', 'vuln_update', 'repo_update', 'analysis_update']
resource_types = ['registries', 'users', 'images', 'policies', 'evaluations', 'subscriptions', 'archive']
bucket_types = ["analysis_data", "policy_bundles", "policy_evaluations", "query_data", "vulnerability_scan", "image_content_data", "manifest_data"]
super_users = ['admin', 'anchore-system']
image_content_types = ['os', 'files', 'npm', 'gem', 'python', 'java']
image_metadata_types = ['manifest', 'docker_history', 'dockerfile']
image_vulnerability_types = ['os', 'non-os']
os_package_types = ['rpm', 'dpkg', 'APKG']
nonos_package_types = ['java', 'python', 'npm', 'gem', 'maven', 'js']
| """
Common utilities/lib for use by multiple services
"""
subscription_types = ['policy_eval', 'tag_update', 'vuln_update', 'repo_update', 'analysis_update']
resource_types = ['registries', 'users', 'images', 'policies', 'evaluations', 'subscriptions', 'archive']
bucket_types = ['analysis_data', 'policy_bundles', 'policy_evaluations', 'query_data', 'vulnerability_scan', 'image_content_data', 'manifest_data']
super_users = ['admin', 'anchore-system']
image_content_types = ['os', 'files', 'npm', 'gem', 'python', 'java']
image_metadata_types = ['manifest', 'docker_history', 'dockerfile']
image_vulnerability_types = ['os', 'non-os']
os_package_types = ['rpm', 'dpkg', 'APKG']
nonos_package_types = ['java', 'python', 'npm', 'gem', 'maven', 'js'] |
"""
Dexter Legaspi
Class: CS 521 - Summer 2
Date: 08/03/2021
Homework Problem # 5.6.3
Description of Problem: A program that highlights the use of proper exception
handling.
"""
EXPECTED_INPUTS = 4
# validate input and the result loop
while True:
user_input = input('Please enter {} numbers delimited by space: '
.format(EXPECTED_INPUTS)).split()
if len(user_input) != EXPECTED_INPUTS:
print(f'We need {EXPECTED_INPUTS} numbers. Please try again.')
else:
try:
numbers = [float(t) for t in user_input]
num_result = (numbers[0] * numbers[1] + numbers[2]) / numbers[3]
except ValueError as err:
print(f'Input error; {err}. Please try again.')
except ZeroDivisionError:
print('Division by zero error encountered. Please try again.')
else:
# at this point the inputs are valid and calculation
# does not cause division by zero, so we break out of the loop
break
# print the result
print('({:,} * {:,} + {:,}) / {:,} = {:,}'
.format(numbers[0], numbers[1], numbers[2], numbers[3], num_result))
| """
Dexter Legaspi
Class: CS 521 - Summer 2
Date: 08/03/2021
Homework Problem # 5.6.3
Description of Problem: A program that highlights the use of proper exception
handling.
"""
expected_inputs = 4
while True:
user_input = input('Please enter {} numbers delimited by space: '.format(EXPECTED_INPUTS)).split()
if len(user_input) != EXPECTED_INPUTS:
print(f'We need {EXPECTED_INPUTS} numbers. Please try again.')
else:
try:
numbers = [float(t) for t in user_input]
num_result = (numbers[0] * numbers[1] + numbers[2]) / numbers[3]
except ValueError as err:
print(f'Input error; {err}. Please try again.')
except ZeroDivisionError:
print('Division by zero error encountered. Please try again.')
else:
break
print('({:,} * {:,} + {:,}) / {:,} = {:,}'.format(numbers[0], numbers[1], numbers[2], numbers[3], num_result)) |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'recipe_engine/cipd',
'recipe_engine/commit_position',
'recipe_engine/context',
'recipe_engine/file',
'recipe_engine/golang',
'recipe_engine/json',
'recipe_engine/nodejs',
'recipe_engine/path',
'recipe_engine/raw_io',
'recipe_engine/step',
'depot_tools/depot_tools',
'depot_tools/git',
'depot_tools/git_cl',
]
| python_version_compatibility = 'PY2+3'
deps = ['recipe_engine/cipd', 'recipe_engine/commit_position', 'recipe_engine/context', 'recipe_engine/file', 'recipe_engine/golang', 'recipe_engine/json', 'recipe_engine/nodejs', 'recipe_engine/path', 'recipe_engine/raw_io', 'recipe_engine/step', 'depot_tools/depot_tools', 'depot_tools/git', 'depot_tools/git_cl'] |
class Cup(object):
def __init__(self, name):
self.name = name
self.price = 0
class MyClass:
pass
def myfunc():
pass
if __name__ == '__main__':
cup1 = Cup('aaa')
cup2 = Cup('bbb')
# get attribute of object
print(getattr(cup1, 'name'))
print(getattr(cup2, 'name'))
try:
name = getattr(cup1, 'country')
except Exception as e:
print('occured getattr except:' + str(e))
# check attribute
print(hasattr(cup2, 'new_name'))
print(getattr(cup2, 'new_name', 'default'))
# set attribute
setattr(cup2, 'new_name', 'default')
print(hasattr(cup2, 'new_name'), end='\n\n')
# access class attribute
obj = MyClass()
print(obj.__class__.__name__)
print(myfunc.__name__)
| class Cup(object):
def __init__(self, name):
self.name = name
self.price = 0
class Myclass:
pass
def myfunc():
pass
if __name__ == '__main__':
cup1 = cup('aaa')
cup2 = cup('bbb')
print(getattr(cup1, 'name'))
print(getattr(cup2, 'name'))
try:
name = getattr(cup1, 'country')
except Exception as e:
print('occured getattr except:' + str(e))
print(hasattr(cup2, 'new_name'))
print(getattr(cup2, 'new_name', 'default'))
setattr(cup2, 'new_name', 'default')
print(hasattr(cup2, 'new_name'), end='\n\n')
obj = my_class()
print(obj.__class__.__name__)
print(myfunc.__name__) |
# set, himpunan:
super_hero = {'superman','ironman','hulk','flash'}
print(super_hero)
print('1=====================')
super_hero.add('gundala')
super_hero.add('121')
print(super_hero)
print('2=====================')
super_hero.add('hulk')
print(super_hero)
print(sorted(super_hero))
print('3=====================')
ganjil = {1,3,5,7,9}
genap = {2,4,6,8,10}
prima = {2,3,5,7}
print(ganjil.union(genap))
print(ganjil.intersection(prima))
| super_hero = {'superman', 'ironman', 'hulk', 'flash'}
print(super_hero)
print('1=====================')
super_hero.add('gundala')
super_hero.add('121')
print(super_hero)
print('2=====================')
super_hero.add('hulk')
print(super_hero)
print(sorted(super_hero))
print('3=====================')
ganjil = {1, 3, 5, 7, 9}
genap = {2, 4, 6, 8, 10}
prima = {2, 3, 5, 7}
print(ganjil.union(genap))
print(ganjil.intersection(prima)) |
# Python carefully avoids evaluating bools more than once in a variety of situations.
# Eg:
# In the statement
# if a or b:
# it doesn't simply compute (a or b) and then evaluate the result to decide whether to
# jump. If a is true it jumps directly to the body of the if statement.
# We can confirm that this behaviour is correct in python code.
# A Bool that raises an exception if evaluated twice!
class ExplodingBool():
def __init__(self, value):
self.value = value
self.booled = False
def __bool__(self):
assert not self.booled
self.booled = True
return self.value
y = (ExplodingBool(False) and False and True and False)
print(y)
if (ExplodingBool(True) or False or True or False):
pass
assert ExplodingBool(True) or False
while ExplodingBool(False) and False:
pass
# if ExplodingBool(False) and False and True and False:
# pass
| class Explodingbool:
def __init__(self, value):
self.value = value
self.booled = False
def __bool__(self):
assert not self.booled
self.booled = True
return self.value
y = exploding_bool(False) and False and True and False
print(y)
if exploding_bool(True) or False or True or False:
pass
assert exploding_bool(True) or False
while exploding_bool(False) and False:
pass |
def firstZero(arr, low, high):
if (high >= low):
# Check if mid element is first 0
mid = low + int((high - low) / 2)
if (( mid == 0 or arr[mid-1] == 1)
and arr[mid] == 0):
return mid
# If mid element is not 0
if (arr[mid] == 1):
return firstZero(arr, (mid + 1), high)
# If mid element is 0, but not first 0
else:
return firstZero(arr, low, (mid - 1))
return -1
# A wrapper over recursive
# function firstZero()
def countZeroes(arr, n):
# Find index of first zero in given array
first = firstZero(arr, 0, n - 1)
# If 0 is not present at all, return 0
if (first == -1):
return 0
return (n - first)
# Driver Code
arr = [1, 1, 1, 0, 0, 0, 0, 0]
n = len(arr)
print("Count of zeroes is",
countZeroes(arr, n)) | def first_zero(arr, low, high):
if high >= low:
mid = low + int((high - low) / 2)
if (mid == 0 or arr[mid - 1] == 1) and arr[mid] == 0:
return mid
if arr[mid] == 1:
return first_zero(arr, mid + 1, high)
else:
return first_zero(arr, low, mid - 1)
return -1
def count_zeroes(arr, n):
first = first_zero(arr, 0, n - 1)
if first == -1:
return 0
return n - first
arr = [1, 1, 1, 0, 0, 0, 0, 0]
n = len(arr)
print('Count of zeroes is', count_zeroes(arr, n)) |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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.
#
# Const Class
# this is a auto generated file generated by Cheetah
# Libre Office Version: 7.3
# Namespace: com.sun.star.ui.dialogs
class CommonFilePickerElementIds(object):
"""
Const Class
These constants are used to specify common controls of a FilePicker dialog.
**since**
OOo 1.1.2
See Also:
`API CommonFilePickerElementIds <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1ui_1_1dialogs_1_1CommonFilePickerElementIds.html>`_
"""
__ooo_ns__: str = 'com.sun.star.ui.dialogs'
__ooo_full_ns__: str = 'com.sun.star.ui.dialogs.CommonFilePickerElementIds'
__ooo_type_name__: str = 'const'
PUSHBUTTON_OK = 1
"""
The control id of the OK button.
"""
PUSHBUTTON_CANCEL = 2
"""
The control id of the Cancel button.
"""
LISTBOX_FILTER = 3
"""
The filter listbox of a FilePicker dialog.
"""
CONTROL_FILEVIEW = 4
"""
Is used to refer to the file view of the file picker.
This view shows the list of all files/folders in the currently selected folder.
"""
EDIT_FILEURL = 5
"""
Is used to refer to the edit line where a file or path can be entered by the user.
"""
LISTBOX_FILTER_LABEL = 6
"""
The label of the filter listbox of a FilePicker dialog.
**since**
OOo 1.1.2
"""
EDIT_FILEURL_LABEL = 7
"""
The label of the file name listbox of a FilePicker dialog.
**since**
OOo 1.1.2
"""
__all__ = ['CommonFilePickerElementIds']
| class Commonfilepickerelementids(object):
"""
Const Class
These constants are used to specify common controls of a FilePicker dialog.
**since**
OOo 1.1.2
See Also:
`API CommonFilePickerElementIds <https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1ui_1_1dialogs_1_1CommonFilePickerElementIds.html>`_
"""
__ooo_ns__: str = 'com.sun.star.ui.dialogs'
__ooo_full_ns__: str = 'com.sun.star.ui.dialogs.CommonFilePickerElementIds'
__ooo_type_name__: str = 'const'
pushbutton_ok = 1
'\n The control id of the OK button.\n '
pushbutton_cancel = 2
'\n The control id of the Cancel button.\n '
listbox_filter = 3
'\n The filter listbox of a FilePicker dialog.\n '
control_fileview = 4
'\n Is used to refer to the file view of the file picker.\n \n This view shows the list of all files/folders in the currently selected folder.\n '
edit_fileurl = 5
'\n Is used to refer to the edit line where a file or path can be entered by the user.\n '
listbox_filter_label = 6
'\n The label of the filter listbox of a FilePicker dialog.\n \n **since**\n \n OOo 1.1.2\n '
edit_fileurl_label = 7
'\n The label of the file name listbox of a FilePicker dialog.\n \n **since**\n \n OOo 1.1.2\n '
__all__ = ['CommonFilePickerElementIds'] |
"""Package pyang.transforms: transform plugins for YANG.
Modules:
* edit: YANG edit transform plugin
"""
| """Package pyang.transforms: transform plugins for YANG.
Modules:
* edit: YANG edit transform plugin
""" |
# augmented vertex
class Vertex:
def __init__(self, element, location):
self.element = element
self.location = location
def getElement(self):
return self.element
def setElement(self, element):
self.element = element
def getLocation(self):
return self.location
def setLocation(self, location):
self.location = location
def isIndeterminate(self):
return False
def toString(self):
return str(self.location)
| class Vertex:
def __init__(self, element, location):
self.element = element
self.location = location
def get_element(self):
return self.element
def set_element(self, element):
self.element = element
def get_location(self):
return self.location
def set_location(self, location):
self.location = location
def is_indeterminate(self):
return False
def to_string(self):
return str(self.location) |
def get_node_info(file):
nodes = set()
df = [line.strip().split() for line
in open('input/%s.txt' % file).readlines()
if line.startswith('/dev')]
for nodeinfo in df:
# Filesystem Size Used Avail Use%
# /dev/grid/node-x0-y0 92T 68T 24T 73%
_, x, y = nodeinfo[0].split('-')
size = int(nodeinfo[1][:-1])
used = int(nodeinfo[2][:-1])
node = (int(x[1:]), int(y[1:]), size, used)
nodes.add(node)
return nodes
def get_pair_count(nodes):
pair_count = 0
for a in nodes:
ax, ay, _, au = a
if au == 0: continue
for b in nodes:
bx, by, bs, bu = b
if bx == ax and by == ay:
continue
if au <= (bs-bu):
pair_count += 1
return pair_count
def make_grid(nodes, reg):
max_x = max([n[0] for n in nodes])
max_y = max([n[1] for n in nodes])
grid = [[None for x in range(max_x + 1)]for y in range(max_y + 1)]
walls = []
empty = (0,0)
for node in nodes:
x, y, _, u = node
if u == 0:
char = '0'
empty = (x,y)
elif u > reg:
char = '#'
walls.append((x,y))
else: char = '.'
grid[y][x] = char
grid[0][max_x] = 'D'
return grid, max_x, empty, walls
def swap(a,b,grid):
new = copy_grid(grid)
ax, ay = a
bx, by = b
node_a = grid[ay][ax]
node_b = grid[by][bx]
new[by][bx] = node_a
new[ay][ax] = node_b
return new
def copy_grid(grid):
return [[x for x in y] for y in grid]
def find_empty(grid):
for y in range(len(grid)):
for x in range(len(grid[0])):
if grid[y][x] == '0':
return (x,y)
def find_data(grid):
for y in range(len(grid)):
for x in range(len(grid[0])):
if grid[y][x] == 'D':
return (x,y)
def print_grid(grid):
for row in grid:
print(' '.join(row))
print()
def solve(input, reg):
nodes = get_node_info(input)
print("Part 1:", get_pair_count(nodes))
grid, max_x, empty, walls = make_grid(nodes, reg)
goal = (0,0)
data = (max_x, 0)
wall_edge = min([w[0] for w in walls if w[1] < empty[1]])
step_count = 0
# move to left of wall
old_empty = empty
while empty[0] >= wall_edge:
empty = (empty[0] - 1, empty[1])
step_count += 1
grid = swap(old_empty, empty, grid)
# go up to top row
old_empty = empty
while empty[1] != 0:
empty = (empty[0], empty[1] - 1)
step_count += 1
grid = swap(old_empty, empty, grid)
# move next to data
old_empty = empty
while empty[0] != data[0] - 1:
empty = (empty[0] + 1, empty[1])
step_count += 1
grid = swap(old_empty, empty, grid)
# swap data, move empty around to left, repeat
while data != goal:
grid = swap(empty, data, grid)
empty = find_empty(grid)
data = find_data(grid)
step_count += 1
if data != goal:
# down 1, left 2, up 1
old_empty = empty
empty = (empty[0], empty[1] + 1)
grid = swap(empty, old_empty, grid)
step_count += 1
old_empty = empty
empty = (empty[0]-2, empty[1])
grid = swap(empty, old_empty, grid)
step_count += 2
old_empty = empty
empty = (empty[0], empty[1] - 1)
grid = swap(empty, old_empty, grid)
step_count += 1
print("Part 2:", step_count)
solve('day22', 100)
| def get_node_info(file):
nodes = set()
df = [line.strip().split() for line in open('input/%s.txt' % file).readlines() if line.startswith('/dev')]
for nodeinfo in df:
(_, x, y) = nodeinfo[0].split('-')
size = int(nodeinfo[1][:-1])
used = int(nodeinfo[2][:-1])
node = (int(x[1:]), int(y[1:]), size, used)
nodes.add(node)
return nodes
def get_pair_count(nodes):
pair_count = 0
for a in nodes:
(ax, ay, _, au) = a
if au == 0:
continue
for b in nodes:
(bx, by, bs, bu) = b
if bx == ax and by == ay:
continue
if au <= bs - bu:
pair_count += 1
return pair_count
def make_grid(nodes, reg):
max_x = max([n[0] for n in nodes])
max_y = max([n[1] for n in nodes])
grid = [[None for x in range(max_x + 1)] for y in range(max_y + 1)]
walls = []
empty = (0, 0)
for node in nodes:
(x, y, _, u) = node
if u == 0:
char = '0'
empty = (x, y)
elif u > reg:
char = '#'
walls.append((x, y))
else:
char = '.'
grid[y][x] = char
grid[0][max_x] = 'D'
return (grid, max_x, empty, walls)
def swap(a, b, grid):
new = copy_grid(grid)
(ax, ay) = a
(bx, by) = b
node_a = grid[ay][ax]
node_b = grid[by][bx]
new[by][bx] = node_a
new[ay][ax] = node_b
return new
def copy_grid(grid):
return [[x for x in y] for y in grid]
def find_empty(grid):
for y in range(len(grid)):
for x in range(len(grid[0])):
if grid[y][x] == '0':
return (x, y)
def find_data(grid):
for y in range(len(grid)):
for x in range(len(grid[0])):
if grid[y][x] == 'D':
return (x, y)
def print_grid(grid):
for row in grid:
print(' '.join(row))
print()
def solve(input, reg):
nodes = get_node_info(input)
print('Part 1:', get_pair_count(nodes))
(grid, max_x, empty, walls) = make_grid(nodes, reg)
goal = (0, 0)
data = (max_x, 0)
wall_edge = min([w[0] for w in walls if w[1] < empty[1]])
step_count = 0
old_empty = empty
while empty[0] >= wall_edge:
empty = (empty[0] - 1, empty[1])
step_count += 1
grid = swap(old_empty, empty, grid)
old_empty = empty
while empty[1] != 0:
empty = (empty[0], empty[1] - 1)
step_count += 1
grid = swap(old_empty, empty, grid)
old_empty = empty
while empty[0] != data[0] - 1:
empty = (empty[0] + 1, empty[1])
step_count += 1
grid = swap(old_empty, empty, grid)
while data != goal:
grid = swap(empty, data, grid)
empty = find_empty(grid)
data = find_data(grid)
step_count += 1
if data != goal:
old_empty = empty
empty = (empty[0], empty[1] + 1)
grid = swap(empty, old_empty, grid)
step_count += 1
old_empty = empty
empty = (empty[0] - 2, empty[1])
grid = swap(empty, old_empty, grid)
step_count += 2
old_empty = empty
empty = (empty[0], empty[1] - 1)
grid = swap(empty, old_empty, grid)
step_count += 1
print('Part 2:', step_count)
solve('day22', 100) |
class Problem:
initial_state = [None, None, None, None, None, None, None, None]
row = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
col = [0,1,2,3,4,5,6,7]
def check_if_attacked(self, state): # returns True if attacked
try:
index = state.index(None) - 1
except ValueError:
index = 7
if index == 0:
return False
for i in range(0,index):
if (state[i][0] == state[index][0]) or (state[i][1] == state[index][1]):
return True #row and column attack check
if abs(ord(state[i][0]) - ord(state[index][0])) == abs(int(state[i][1]) - int(state[index][1])):
return True #diagonal attack detect
return False
def actions(self, state):
all_actions = []
#find the first (leftmost) None position
try:
index = state.index(None) # returns the first index on None or raises ValueError in None is not found
except ValueError:
return [state]
for i in range(0,8):
next_state = state[:]
next_state[index] = Problem.row[index] + str(i)
if not self.check_if_attacked(next_state):
all_actions.append(next_state)
return all_actions
def result(self, state, action):
return action
def goal_test(self, state):
try:
state.index(None)
return False
except ValueError:
return True
def step_cost(self, par_state=None, action=None, child_state=None):
return 0
class Node:
def __init__(self, state, parent, action, path_cost):
self.state = state
self.parent = parent
self.action = action
self.path_cost = path_cost
def child_node(problem, parent, action):
state = problem.result(parent.state, action)
path_cost = parent.path_cost + problem.step_cost(parent.state, action)
return Node(state, parent, action, path_cost)
def compare(node):
return node.path_cost
class Frontier:
def __init__(self):
self.p_queue = []
def is_empty(self):
return len(self.p_queue) == 0
def insert(self, node):
self.p_queue.append(node)
self.p_queue = sorted(self.p_queue, key=compare, reverse=True)
def pop(self):
return self.p_queue.pop()
def contains_state(self, state):
for node in self.p_queue[:]:
if node.state == state:
return True
return False
def replace_if_higher_path_cost_with_same_state(self,node):
for i in range(len(self.p_queue)):
if self.p_queue[i].state == node.state:
if self.p_queue[i].path_cost > node.path_cost:
self.p_queue[i] = node
def uniform_cost_search(problem):
node = Node(problem.initial_state.copy(),None, None, 0)
frontier = Frontier()
frontier.insert(node)
explored = []
n=1
while True:
if frontier.is_empty():
return "failure"
node = frontier.pop()
#print("popped from frontier")
if problem.goal_test(node.state):
print (str(n) +" "+ str(node.state))
paint(node.state)
n = n+1
explored.append(node.state)
for action in problem.actions(node.state):
#print(action)
child = child_node(problem, node, action)
if (child.state not in explored) and (not frontier.contains_state(child.state)):
frontier.insert(child)
#print('inserted in frontier')
else:
frontier.replace_if_higher_path_cost_with_same_state(child)
def paint(state):
print(" _ _ _ _ _ _ _ _ ")
for i in range(7,-1,-1):
prnt_str = str(i)
for j in range(0,8):
prnt_str = prnt_str + "|"
if int(state[j][1]) == i :
prnt_str = prnt_str + "Q"
else:
prnt_str = prnt_str + " "
prnt_str = prnt_str + "|"
print(prnt_str)
#print(" - - - - - - - - ")
print(" a b c d e f g h ")
problem = Problem()
uniform_cost_search(problem)
| class Problem:
initial_state = [None, None, None, None, None, None, None, None]
row = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
col = [0, 1, 2, 3, 4, 5, 6, 7]
def check_if_attacked(self, state):
try:
index = state.index(None) - 1
except ValueError:
index = 7
if index == 0:
return False
for i in range(0, index):
if state[i][0] == state[index][0] or state[i][1] == state[index][1]:
return True
if abs(ord(state[i][0]) - ord(state[index][0])) == abs(int(state[i][1]) - int(state[index][1])):
return True
return False
def actions(self, state):
all_actions = []
try:
index = state.index(None)
except ValueError:
return [state]
for i in range(0, 8):
next_state = state[:]
next_state[index] = Problem.row[index] + str(i)
if not self.check_if_attacked(next_state):
all_actions.append(next_state)
return all_actions
def result(self, state, action):
return action
def goal_test(self, state):
try:
state.index(None)
return False
except ValueError:
return True
def step_cost(self, par_state=None, action=None, child_state=None):
return 0
class Node:
def __init__(self, state, parent, action, path_cost):
self.state = state
self.parent = parent
self.action = action
self.path_cost = path_cost
def child_node(problem, parent, action):
state = problem.result(parent.state, action)
path_cost = parent.path_cost + problem.step_cost(parent.state, action)
return node(state, parent, action, path_cost)
def compare(node):
return node.path_cost
class Frontier:
def __init__(self):
self.p_queue = []
def is_empty(self):
return len(self.p_queue) == 0
def insert(self, node):
self.p_queue.append(node)
self.p_queue = sorted(self.p_queue, key=compare, reverse=True)
def pop(self):
return self.p_queue.pop()
def contains_state(self, state):
for node in self.p_queue[:]:
if node.state == state:
return True
return False
def replace_if_higher_path_cost_with_same_state(self, node):
for i in range(len(self.p_queue)):
if self.p_queue[i].state == node.state:
if self.p_queue[i].path_cost > node.path_cost:
self.p_queue[i] = node
def uniform_cost_search(problem):
node = node(problem.initial_state.copy(), None, None, 0)
frontier = frontier()
frontier.insert(node)
explored = []
n = 1
while True:
if frontier.is_empty():
return 'failure'
node = frontier.pop()
if problem.goal_test(node.state):
print(str(n) + ' ' + str(node.state))
paint(node.state)
n = n + 1
explored.append(node.state)
for action in problem.actions(node.state):
child = child_node(problem, node, action)
if child.state not in explored and (not frontier.contains_state(child.state)):
frontier.insert(child)
else:
frontier.replace_if_higher_path_cost_with_same_state(child)
def paint(state):
print(' _ _ _ _ _ _ _ _ ')
for i in range(7, -1, -1):
prnt_str = str(i)
for j in range(0, 8):
prnt_str = prnt_str + '|'
if int(state[j][1]) == i:
prnt_str = prnt_str + 'Q'
else:
prnt_str = prnt_str + ' '
prnt_str = prnt_str + '|'
print(prnt_str)
print(' a b c d e f g h ')
problem = problem()
uniform_cost_search(problem) |
# Easy
# https://leetcode.com/problems/climbing-stairs/
class Solution:
# Time complexity : O(n)
# Space complexity: O(1)
# Fibonacci sequence
def climbStairs(self, n: int) -> int:
a, b = 1, 2
for _ in range(1, n):
a, b = b, a + b
return a
| class Solution:
def climb_stairs(self, n: int) -> int:
(a, b) = (1, 2)
for _ in range(1, n):
(a, b) = (b, a + b)
return a |
"""
Author: Clinton Wang, E-mail: `clintonjwang@gmail.com`, Github: `https://github.com/clintonjwang/lipiodol`
"""
class Config:
def __init__(self):
self.proj_dims = [64,64,32]
self.world_dims = [32,64,64]
#self.aug_factor = 100
self.npy_dir = r"D:\CBCT\Train\NPYs"
self.nii_dir = r"D:\CBCT\Train\NIFTIs"
self.dcm_dir = r"D:\CBCT\Train\DICOMs"
self.train_dir = r"D:\CBCT\Train"
self.model_dir = r"D:\CBCT\Models" | """
Author: Clinton Wang, E-mail: `clintonjwang@gmail.com`, Github: `https://github.com/clintonjwang/lipiodol`
"""
class Config:
def __init__(self):
self.proj_dims = [64, 64, 32]
self.world_dims = [32, 64, 64]
self.npy_dir = 'D:\\CBCT\\Train\\NPYs'
self.nii_dir = 'D:\\CBCT\\Train\\NIFTIs'
self.dcm_dir = 'D:\\CBCT\\Train\\DICOMs'
self.train_dir = 'D:\\CBCT\\Train'
self.model_dir = 'D:\\CBCT\\Models' |
file = {'amy':5,
'bob':8,
'candy':6,
'doby':9,
'john':0}
print("Amy's number is:" +'\n\t' + str(file['amy']) +'.')
print("\nBob's number is:" +'\n\t' + str(file['bob']) +'.') | file = {'amy': 5, 'bob': 8, 'candy': 6, 'doby': 9, 'john': 0}
print("Amy's number is:" + '\n\t' + str(file['amy']) + '.')
print("\nBob's number is:" + '\n\t' + str(file['bob']) + '.') |
class Solution:
def myAtoi(self, str):
if len(str) == 0:
return 0
res = 0
max_int = 2147483647
min_int = -2147483648
for i in range(0, len(str)):
c = str[i]
if c != ' ':
break
s = str[i:]
pos = False
if s[0] == '-':
pos = False
s = s[1:]
elif s[0] == '+':
pos = True
s = s[1:]
else:
pos = True
s = s
for c in s:
if c >= '0' and c <= '9':
res = res*10 + int(c)
else:
break
if not pos:
res = -res
if res > max_int:
res = max_int
if res < min_int:
res = min_int
return res
a = Solution()
r = a.myAtoi("")
print(r)
r = a.myAtoi(" ab")
print(r)
r = a.myAtoi(" -123")
print(r)
| class Solution:
def my_atoi(self, str):
if len(str) == 0:
return 0
res = 0
max_int = 2147483647
min_int = -2147483648
for i in range(0, len(str)):
c = str[i]
if c != ' ':
break
s = str[i:]
pos = False
if s[0] == '-':
pos = False
s = s[1:]
elif s[0] == '+':
pos = True
s = s[1:]
else:
pos = True
s = s
for c in s:
if c >= '0' and c <= '9':
res = res * 10 + int(c)
else:
break
if not pos:
res = -res
if res > max_int:
res = max_int
if res < min_int:
res = min_int
return res
a = solution()
r = a.myAtoi('')
print(r)
r = a.myAtoi(' ab')
print(r)
r = a.myAtoi(' -123')
print(r) |
class Config:
def __init__(self):
self.basename = 'delta_video'
self.directory = '/home/eleanor/Documents/gcamp_analysis_files_temp/171019-06-bottom-experiment/data'
self.topics = ['/multi_tracker/1/delta_video',]
self.record_length_hours = 1 | class Config:
def __init__(self):
self.basename = 'delta_video'
self.directory = '/home/eleanor/Documents/gcamp_analysis_files_temp/171019-06-bottom-experiment/data'
self.topics = ['/multi_tracker/1/delta_video']
self.record_length_hours = 1 |
## -*- coding: utf-8 -*- ##
## Sage Doctest File ##
#**************************************#
#* Generated from PreTeXt source *#
#* on 2017-08-24T11:43:34-07:00 *#
#* *#
#* http://mathbook.pugetsound.edu *#
#* *#
#**************************************#
##
"""
Please contact Rob Beezer (beezer@ups.edu) with
any test failures here that need to be changed
as a result of changes accepted into Sage. You
may edit/change this file in any sensible way, so
that development work may procede. Your changes
may later be replaced by the authors of "Abstract
Algebra: Theory and Applications" when the text is
updated, and a replacement of this file is proposed
for review.
"""
##
## To execute doctests in these files, run
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
## or
## $ $SAGE_ROOT/sage -t <a-single-file>
##
## Replace -t by "-tp n" for parallel testing,
## "-tp 0" will use a sensible number of threads
##
## See: http://www.sagemath.org/doc/developer/doctesting.html
## or run $ $SAGE_ROOT/sage --advanced for brief help
##
## Generated at 2017-08-24T11:43:34-07:00
## From "Abstract Algebra"
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
##
## Section 6.5 Sage
##
r"""
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = SymmetricGroup(3)
sage: a = G("(1,2)")
sage: H = G.subgroup([a])
sage: rc = G.cosets(H, side='right'); rc
[[(), (1,2)], [(2,3), (1,3,2)], [(1,2,3), (1,3)]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: lc = G.cosets(H, side='left'); lc
[[(), (1,2)], [(2,3), (1,2,3)], [(1,3,2), (1,3)]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = SymmetricGroup(3)
sage: b = G("(1,2,3)")
sage: H = G.subgroup([b])
sage: rc = G.cosets(H, side='right'); rc
[[(), (1,2,3), (1,3,2)], [(2,3), (1,3), (1,2)]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: lc = G.cosets(H, side='left'); lc
[[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: rc == lc
False
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: rc_sorted = sorted([sorted(coset) for coset in rc])
sage: rc_sorted
[[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: lc_sorted = sorted([sorted(coset) for coset in lc])
sage: lc_sorted
[[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: rc_sorted == lc_sorted
True
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = SymmetricGroup(3)
sage: sg = G.subgroups(); sg
[Subgroup generated by [()] of (Symmetric group of order 3! as a permutation group),
Subgroup generated by [(2,3)] of (Symmetric group of order 3! as a permutation group),
Subgroup generated by [(1,2)] of (Symmetric group of order 3! as a permutation group),
Subgroup generated by [(1,3)] of (Symmetric group of order 3! as a permutation group),
Subgroup generated by [(1,2,3)] of (Symmetric group of order 3! as a permutation group),
Subgroup generated by [(2,3), (1,2,3)] of (Symmetric group of order 3! as a permutation group)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: H = sg[4]; H
Subgroup generated by [(1,2,3)] of (Symmetric group of order 3! as a permutation group)
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: H.order()
3
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: H.list()
[(), (1,3,2), (1,2,3)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: H.is_cyclic()
True
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = AlternatingGroup(4)
sage: sg = G.subgroups()
sage: [H.order() for H in sg]
[1, 2, 2, 2, 3, 3, 3, 3, 4, 12]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = SymmetricGroup(4)
sage: sg = G.subgroups()
sage: [H.order() for H in sg]
[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
6, 6, 6, 6, 8, 8, 8, 12, 24]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: len(sg)
30
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = CyclicPermutationGroup(20)
sage: [H.order() for H in G.subgroups()]
[1, 2, 4, 5, 10, 20]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = CyclicPermutationGroup(19)
sage: [H.order() for H in G.subgroups()]
[1, 19]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: n = 8
sage: G = CyclicPermutationGroup(n)
sage: [H.order() for H in G.subgroups()]
[1, 2, 4, 8]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: euler_phi(345)
176
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: m = random_prime(10000)
sage: n = random_prime(10000)
sage: m, n, euler_phi(m*n) == euler_phi(m)*euler_phi(n) # random
(5881, 1277, True)
"""
| """
Please contact Rob Beezer (beezer@ups.edu) with
any test failures here that need to be changed
as a result of changes accepted into Sage. You
may edit/change this file in any sensible way, so
that development work may procede. Your changes
may later be replaced by the authors of "Abstract
Algebra: Theory and Applications" when the text is
updated, and a replacement of this file is proposed
for review.
"""
'\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = SymmetricGroup(3)\n sage: a = G("(1,2)")\n sage: H = G.subgroup([a])\n sage: rc = G.cosets(H, side=\'right\'); rc\n [[(), (1,2)], [(2,3), (1,3,2)], [(1,2,3), (1,3)]]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: lc = G.cosets(H, side=\'left\'); lc\n [[(), (1,2)], [(2,3), (1,2,3)], [(1,3,2), (1,3)]]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = SymmetricGroup(3)\n sage: b = G("(1,2,3)")\n sage: H = G.subgroup([b])\n sage: rc = G.cosets(H, side=\'right\'); rc\n [[(), (1,2,3), (1,3,2)], [(2,3), (1,3), (1,2)]]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: lc = G.cosets(H, side=\'left\'); lc\n [[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: rc == lc\n False\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: rc_sorted = sorted([sorted(coset) for coset in rc])\n sage: rc_sorted\n [[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: lc_sorted = sorted([sorted(coset) for coset in lc])\n sage: lc_sorted\n [[(), (1,2,3), (1,3,2)], [(2,3), (1,2), (1,3)]]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: rc_sorted == lc_sorted\n True\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = SymmetricGroup(3)\n sage: sg = G.subgroups(); sg\n [Subgroup generated by [()] of (Symmetric group of order 3! as a permutation group),\n Subgroup generated by [(2,3)] of (Symmetric group of order 3! as a permutation group),\n Subgroup generated by [(1,2)] of (Symmetric group of order 3! as a permutation group),\n Subgroup generated by [(1,3)] of (Symmetric group of order 3! as a permutation group),\n Subgroup generated by [(1,2,3)] of (Symmetric group of order 3! as a permutation group),\n Subgroup generated by [(2,3), (1,2,3)] of (Symmetric group of order 3! as a permutation group)]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: H = sg[4]; H\n Subgroup generated by [(1,2,3)] of (Symmetric group of order 3! as a permutation group)\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: H.order()\n 3\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: H.list()\n [(), (1,3,2), (1,2,3)]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: H.is_cyclic()\n True\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = AlternatingGroup(4)\n sage: sg = G.subgroups()\n sage: [H.order() for H in sg]\n [1, 2, 2, 2, 3, 3, 3, 3, 4, 12]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = SymmetricGroup(4)\n sage: sg = G.subgroups()\n sage: [H.order() for H in sg]\n [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,\n 6, 6, 6, 6, 8, 8, 8, 12, 24]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: len(sg)\n 30\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = CyclicPermutationGroup(20)\n sage: [H.order() for H in G.subgroups()]\n [1, 2, 4, 5, 10, 20]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: G = CyclicPermutationGroup(19)\n sage: [H.order() for H in G.subgroups()]\n [1, 19]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: n = 8\n sage: G = CyclicPermutationGroup(n)\n sage: [H.order() for H in G.subgroups()]\n [1, 2, 4, 8]\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: euler_phi(345)\n 176\n\n~~~~~~~~~~~~~~~~~~~~~~ ::\n\n sage: m = random_prime(10000)\n sage: n = random_prime(10000)\n sage: m, n, euler_phi(m*n) == euler_phi(m)*euler_phi(n) # random\n (5881, 1277, True)\n\n' |
class Memory:
def __init__(self, size):
self.mem = bytearray(size)
self.bin_size = 0
def read8(self, addr):
val = self.mem[addr]
#if addr > self.bin_size:
# print(f'Read {val:02x} at {addr}')
return val
def write8(self, addr, val):
self.mem[addr] = val
def write_bin(self, addr, data):
self.mem[addr: addr+len(data)] = data
self.bin_size = addr + len(data)
def __len__(self):
return len(self.mem)
class MemoryMap:
def __init__(self, mems):
self.mems = mems
def resolve_addr(self, addr):
for start, m in self.mems:
if start <= addr < start + len(m):
return m, start
raise IndexError(f'Access to unmapped memory {addr:x}')
def read8(self, addr):
mem, start = self.resolve_addr(addr)
val = mem.read8(addr - start)
#print(f'Read {val:x} at {addr}')
return val
def write8(self, addr, val):
#print(f'Write {val:x} at {addr}')
mem, start = self.resolve_addr(addr)
mem.write8(addr - start, val)
| class Memory:
def __init__(self, size):
self.mem = bytearray(size)
self.bin_size = 0
def read8(self, addr):
val = self.mem[addr]
return val
def write8(self, addr, val):
self.mem[addr] = val
def write_bin(self, addr, data):
self.mem[addr:addr + len(data)] = data
self.bin_size = addr + len(data)
def __len__(self):
return len(self.mem)
class Memorymap:
def __init__(self, mems):
self.mems = mems
def resolve_addr(self, addr):
for (start, m) in self.mems:
if start <= addr < start + len(m):
return (m, start)
raise index_error(f'Access to unmapped memory {addr:x}')
def read8(self, addr):
(mem, start) = self.resolve_addr(addr)
val = mem.read8(addr - start)
return val
def write8(self, addr, val):
(mem, start) = self.resolve_addr(addr)
mem.write8(addr - start, val) |
__author__ = 'Jeffrey Seifried'
__description__ = 'A library for forecasting sun positions'
__email__ = 'jeffrey.seifried@gmail.com'
__program__ = 'analemma'
__url__ = 'http://github.com/jeffseif/{}'.format(__program__)
__version__ = '1.0.0'
__year__ = '2020'
| __author__ = 'Jeffrey Seifried'
__description__ = 'A library for forecasting sun positions'
__email__ = 'jeffrey.seifried@gmail.com'
__program__ = 'analemma'
__url__ = 'http://github.com/jeffseif/{}'.format(__program__)
__version__ = '1.0.0'
__year__ = '2020' |
"""
MIT License
Copyright (c) 2021 FelipeSavazi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
class Formattings:
def normal(self):
return f'\033[0m'
def bold(self, texto):
return f'\033[01m{texto}\033[0m'
def disable(self, texto):
return f'\033[02m{texto}\033[0m'
def underline(self, texto):
return f'\033[04m{texto}\033[0m'
def reverse(self, texto):
return f'\033[07m{texto}\033[0m'
def strikethrough(self, texto):
return f'\033[09m{texto}\033[0m'
def invisible(self, texto):
return f'\033[08m{texto}\033[0m'
| """
MIT License
Copyright (c) 2021 FelipeSavazi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
class Formattings:
def normal(self):
return f'\x1b[0m'
def bold(self, texto):
return f'\x1b[01m{texto}\x1b[0m'
def disable(self, texto):
return f'\x1b[02m{texto}\x1b[0m'
def underline(self, texto):
return f'\x1b[04m{texto}\x1b[0m'
def reverse(self, texto):
return f'\x1b[07m{texto}\x1b[0m'
def strikethrough(self, texto):
return f'\x1b[09m{texto}\x1b[0m'
def invisible(self, texto):
return f'\x1b[08m{texto}\x1b[0m' |
'''
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.
You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.
Example 1:
Input:
["Shogun", "Tapioca Express", "Burger King", "KFC"]
["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"]
Output: ["Shogun"]
Explanation: The only restaurant they both like is "Shogun".
Example 2:
Input:
["Shogun", "Tapioca Express", "Burger King", "KFC"]
["KFC", "Shogun", "Burger King"]
Output: ["Shogun"]
Explanation: The restaurant they both like and have the least index sum is "Shogun" with index sum 1 (0+1).
Note:
The length of both lists will be in the range of [1, 1000].
The length of strings in both lists will be in the range of [1, 30].
The index is starting from 0 to the list length minus 1.
No duplicates in both lists.
'''
class Solution(object):
def findRestaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
if len(list1) < len(list2):
return self.findRestaurant(list2, list1)
key_to_idx = {}
for i in xrange(len(list2)):
key_to_idx[list2[i]] = i
res = []
idx_sum = float('inf')
for i in xrange(len(list1)):
if list1[i] in key_to_idx:
tmp = i + key_to_idx[list1[i]]
if tmp < idx_sum:
res = [list1[i]]
idx_sum = tmp
elif tmp == idx_sum:
res.append(list1[i])
return res
| """
Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.
You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.
Example 1:
Input:
["Shogun", "Tapioca Express", "Burger King", "KFC"]
["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"]
Output: ["Shogun"]
Explanation: The only restaurant they both like is "Shogun".
Example 2:
Input:
["Shogun", "Tapioca Express", "Burger King", "KFC"]
["KFC", "Shogun", "Burger King"]
Output: ["Shogun"]
Explanation: The restaurant they both like and have the least index sum is "Shogun" with index sum 1 (0+1).
Note:
The length of both lists will be in the range of [1, 1000].
The length of strings in both lists will be in the range of [1, 30].
The index is starting from 0 to the list length minus 1.
No duplicates in both lists.
"""
class Solution(object):
def find_restaurant(self, list1, list2):
"""
:type list1: List[str]
:type list2: List[str]
:rtype: List[str]
"""
if len(list1) < len(list2):
return self.findRestaurant(list2, list1)
key_to_idx = {}
for i in xrange(len(list2)):
key_to_idx[list2[i]] = i
res = []
idx_sum = float('inf')
for i in xrange(len(list1)):
if list1[i] in key_to_idx:
tmp = i + key_to_idx[list1[i]]
if tmp < idx_sum:
res = [list1[i]]
idx_sum = tmp
elif tmp == idx_sum:
res.append(list1[i])
return res |
# -*- coding: utf-8 -*-
"""
Procurement
A module to handle Procurement
Currently handles
Suppliers
Planned Procurements
Purchase Orders (POs)
@ToDo: Extend to
Purchase Requests (PRs)
"""
if not settings.has_module(c):
raise HTTP(404, body="Module disabled: %s" % c)
# -----------------------------------------------------------------------------
def index():
""" Module's Home Page """
return s3db.cms_index(c)
# -----------------------------------------------------------------------------
def order():
""" RESTful CRUD controller """
return s3_rest_controller(rheader = s3db.proc_rheader,
hide_filter = True,
)
# -----------------------------------------------------------------------------
#def order_item():
# """ RESTful CRUD controller """
# return s3_rest_controller()
# -----------------------------------------------------------------------------
def plan():
""" RESTful CRUD controller """
return s3_rest_controller(rheader = s3db.proc_rheader,
hide_filter = True,
)
# -----------------------------------------------------------------------------
def supplier():
""" RESTful CRUD controller """
return s3_rest_controller("org", "organisation")
# END =========================================================================
| """
Procurement
A module to handle Procurement
Currently handles
Suppliers
Planned Procurements
Purchase Orders (POs)
@ToDo: Extend to
Purchase Requests (PRs)
"""
if not settings.has_module(c):
raise http(404, body='Module disabled: %s' % c)
def index():
""" Module's Home Page """
return s3db.cms_index(c)
def order():
""" RESTful CRUD controller """
return s3_rest_controller(rheader=s3db.proc_rheader, hide_filter=True)
def plan():
""" RESTful CRUD controller """
return s3_rest_controller(rheader=s3db.proc_rheader, hide_filter=True)
def supplier():
""" RESTful CRUD controller """
return s3_rest_controller('org', 'organisation') |
# flake8: noqa
# https://github.com/trezor/python-mnemonic/blob/master/vectors.json
trezor_vectors = {
"english": [
{
"id": 0,
"entropy": "00000000000000000000000000000000",
"mnemonic": "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
"salt": "TREZOR",
"binary": "00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 0000000",
"checksum": "0011",
"seed": "c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04",
"root": {
"private_key": "cbedc75b0d6412c85c79bc13875112ef912fd1e756631b5a00330866f22ff184",
"public_key": "02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd",
"xpub": "xpub661MyMwAqRbcGB88KaFbLGiYAat55APKhtWg4uYMkXAmfuSTbq2QYsn9sKJCj1YqZPafsboef4h4YbXXhNhPwMbkHTpkf3zLhx7HvFw1NDy",
"xpriv": "xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF",
"parent_fingerprint": "00",
"fingerprint": "b4e3f5ed",
"depth": 0,
"index": 0,
"chain_code": "a3fa8c983223306de0f0f65e74ebb1e98aba751633bf91d5fb56529aa5c132c1"
},
"derived_node": {
"path": "m/7'/13'/8'/65'/6/44/16/18'/7",
"public_key": "026381791f9bf7ec99538a408d61c911737a30488c78004feb34a73295776c2f17",
"private_key": "b4749323ef65b3898c8cf3f9978fa437c9113a3a91b26320a1047032ab9eaf47",
"xpub": "xpub6Qo94BJ44WgahcCbte4pYt2UU5AGBrkt4PyKWzG3KA9AR1EbERqbTo69Wtc4cXnB2DiuFcxwEDRNdQh1GXwF1jqHrwZS3KRS6X7eaceREJd",
"xpriv": "xprvABonefmAE98HV888ncXpBk5jv3KmnQ32hB3iibrRkpcBYCuSgtXLuzmffeBwvMLcouHL2WdJEZiiXJDB6cMDKytYPy37Em7BNCytyBhJd5A",
"parent_fingerprint": "fc4ca6e2",
"fingerprint": "264f90ed",
"depth": 9,
"index": 7,
"chain_code": "3c063c0a452d20fba1b1cc476a886def7096116dd0cb8400d90f6f55507bcca6"
}
}
]
}
# generated with: https://iancoleman.io/bip39/#english
test_vectors = {
"english": [
{
"id": 0,
"entropy": "a4e3fc4c0161698a22707cfbf30f7f83",
"mnemonic": "pilot cable basic actress bird shallow mean auto winner observe that all",
"salt": None,
"binary": "10100100111 00011111111 00010011000 00000010110 00010110100 11000101000 10001001110 00001111100 11111011111 10011000011 11011111111 0000011",
"checksum": "0011",
"seed": "af44c7ad86ba0a5f46d4c1e785c846db14e0f3d62b69c2ab7efa012a9c9155c024975d6897e36fe9e9e6f0bde55fdf325ff308914ed1b316da0f755f9dd7347d",
"root": {
"private_key": "c6796958d07afe0af1ba9a11da2b7a22d6226b4ff7ff5324c7c876cfc1ea0f1c",
"public_key": "029cfe11e5f33a2601083ff5e29d9b7f134f5edc6b7636674a7286ecf6d23804df",
"xpub": "xpub661MyMwAqRbcFXwuU8c1uEfmER2GW8A7XfaR9Cw41RCGr1xmr4WaLdU9cGPvcJXaaNYLFuu9bMimhKmGgaFja9BxcBAo98Eim1UuUu1dXAn",
"xpriv": "xprv9s21ZrQH143K33sSN751Y6j2gPBn6fSGASepLpXST5fHyDddJXCKnq9fm1gRmHk4CPPcEF9gBmJvPBf74ExYM6Ybe6zwA7HfX8dQkRFY9S4",
"parent_fingerprint": "00",
"fingerprint": "f3ac0f3f",
"depth": 0,
"index": 0,
"chain_code": "6399431d3f454a4acbe0f1cbb2d9a392a43dbea34e7fea952bdda675adde6e6e"
},
"derived_node": {
"path": "m/55'/16'/34'/20/19'/97/21'/88'",
"public_key": "039b8a22c4fb43cb4b52596fc2050357dd9771950d6b6881c6e4b2e78e1943f51d",
"private_key": "258dc521c0581a788a2f08fd64be0f4d29c0c7384031960e6b6986526bcb039f",
"xpub": "xpub6NjKMZDHrzmR8m4poa48Xzj3qeS32QQBbfXffSK5N4F6SLE35fFrBT9qECJ77LMic44hNnWTR86qVjE8r4DsMSNVztB1vyoYNvhzrg91zXV",
"xpriv": "xprvA9jxx3gQ2dD7vGzMhYX8ArnKHcbYcwgLESc4s3uToii7ZXttY7wbdeqMNtRdhhepm7cEKKparnDqeigAPgj7KTj7Gw5ZGUKCRBYbkd3sdGo",
"parent_fingerprint": "e33b22ce",
"fingerprint": "93195471",
"depth": 8,
"index": 2147483736,
"chain_code": "18eb1b59d8a529c9fdbfbce7f6cb03cc9b1bd80b2fc5abee1944b32a32c136f8"
}
},
{
"id": 1,
"entropy": "8cfc94f3846c43fa893b4950155de2369772c91e",
"mnemonic": "mind tool diagram angle service wool ceiling hard exotic priority joy honey jaguar goose kit",
"salt": None,
"binary": "10001100111 11100100101 00111100111 00001000110 11000100001 11111101010 00100100111 01101001001 01010000000 10101010111 01111000100 01101101001 01110111001 01100100100 011110",
"checksum": "10111",
"seed": "82555df2fd8c76fca417c83fc7ed0552a0310299eed41d3a45cf49e1ac056e21126e64d988052b9dbc0e04bd6b3580c51ab6a4ec5a62c5dba2039bd372e7d137",
"root": {
"private_key": "9fee59092ebbedc782277cf75bc85f9db0ea559818eb20de865c4897eb2144f4",
"public_key": "0357ffdd29d20d72d2061c154353835b9cd34016d6f63755a04d70a7033e2919b3",
"xpub": "xpub661MyMwAqRbcFyPp6zb6ZPcsuqVkvUm2Y61Gn7cRrkp2xxCD8ot9tgJQDKG6R6DWopMQrVoUhMChoCZcS4PKSFFx5AoNPAGFizikrRVTmpn",
"xpriv": "xprv9s21ZrQH143K3VKLzy46CFg9MofGX23BAs5fyjCpJRH469s4bGZuLsyvN2qGCAYoJYmHyT6XVVkhm7DHGyHSyYPintmfgxYrwKHzCgCthir",
"parent_fingerprint": "00",
"fingerprint": "94db54c0",
"depth": 0,
"index": 0,
"chain_code": "8faa80cab7372c9e12e2f54a445e434b5d2cb310bc92d7e304b914360a89278a"
},
"derived_node": {
"path": "m/96'/2'/10/81'/60'/90'",
"public_key": "0229d3838c6703a16aa9e7f8604dd308f36980ca891783f9e46dcc8d0a7c7da5ed",
"private_key": "6f7ae238af855eb9e0cee63333a4c05ef4c24a54a6951dcdf298ea13c85e2050",
"xpub": "xpub6JuoVny9rzjMruCwjgP66H9bLt97ow3jgg6Sjt5Eny85LQKoQzA6E9xhmFcVoQR2PoYnTTDMcXnyo1MZPHeW4PFBxaN6VitafnfA3csorkr",
"xpriv": "xprvA5vT6HSG2dB4eR8Uder5j9CrnrJdQUKtKTAqwVfdEdb6TbzesSqqgMeDv17Qa6M5jxRcbhDTTfzzBxuJqMURrsXnRXNJUwkRsqNmTHEs6Qx",
"parent_fingerprint": "db9f3893",
"fingerprint": "11b20e3d",
"depth": 6,
"index": 2147483738,
"chain_code": "91f4c0395a78095692132cb1f632834ab821c373057ccdb5637f7f9f34837fdd"
}
},
{
"id": 2,
"entropy": "15bf57143a38579300d9f4cbd65adaebe01398fbeb8f44f0",
"mnemonic": "between wide shallow inner lyrics sister address direct slim ready repeat style abuse small use impose eager liberty",
"salt": None,
"binary": "00010101101 11111010101 11000101000 01110100011 10000101011 11001001100 00000011011 00111110100 11001011110 10110010110 10110110101 11010111110 00000001001 11001100011 11101111101 01110001111 01000100111 10000",
"checksum": "000111",
"seed": "db6b9728bce174c1c14976415cfe06d63509e127f38ba265cf672315b5ed15953828f0fe5e9922654c07d3284f7ac11f814b564e87f94210d3bcc153ec6f698b",
"root": {
"private_key": "3a4014ab104dc69ba3820e3c1e9740998dfdd0b912f1f83268c639bac5fa64f0",
"public_key": "03230ac7166adf9664a911a4d4785a60e79e983f950b99fe9dc228dd1438c0aa36",
"xpub": "xpub661MyMwAqRbcFtZZGjnmsUKVffkBYUraocCexn2maSi1keXzdsaam5fwHRrwFaLNe1dCjqQQMgcGSQfaiD5BFuDbvy3cdkWrq3939hHHns9",
"xpriv": "xprv9s21ZrQH143K3QV6AiFmWLNm7duh928jSPH4APdA27B2srCr6LGLDHMTS94eTRRBfnoLErXZEXbkAHpybohWnb4tp8sv3cSK7nJKtpcwJ4U",
"parent_fingerprint": "00",
"fingerprint": "b46fe1d0",
"depth": 0,
"index": 0,
"chain_code": "874c576e48fdc3ebf6f0822b4d18498d0a545d6684dfd683ef215fd0273870e8"
},
"derived_node": {
"path": "m/87/19/76/25'/96'",
"public_key": "03540f45d9145cd5c9bdbf67b674df050255ac19380b0b6f3cc57dff99e17b836a",
"private_key": "c3c055a5154dafa361e82d585393d82a8bf3f82cbe96f7c4e2e758de7ac90a0e",
"xpub": "xpub6FwAvDCcTWuqD2hVZHoi3WhtWZbf2XBeo36HRFwCLLk85DxzvHau5dmx8o7VKsdrv98yigghdX6PkgeGvoe4LZ39Hoex2ZhGtJ53W4Tdnmn",
"xpriv": "xprvA2wpWhfid9MXzYd2TGGhgNm9xXmAd4ToRpAgcsXan1D9CRdrNkGeXqTUHWzAimdLSuZCMCqMhu545mtYP4mj13q5RWDbuyBHBbwMeaPcAyU",
"parent_fingerprint": "46ae4850",
"fingerprint": "94d1cc4b",
"depth": 5,
"index": 2147483744,
"chain_code": "309cff07ed70166ebe30ec31ee7a4c261fa9dfa6bdae249d498a84f4d224d472"
}
},
{
"id": 3,
"entropy": "a05a7afb69e2cd81c838a7d1ad4132d06bef59042b0388512881b61a",
"mnemonic": "park stable salute stable coast science can belt spider head erosion patch same prosper awful gather marriage matter call history pluck",
"salt": None,
"binary": "10100000010 11010011110 10111110110 11010011110 00101100110 11000000111 00100000111 00010100111 11010001101 01101010000 01001100101 10100000110 10111110111 10101100100 00010000101 01100000011 10001000010 10001001010 00100000011 01101100001 1010",
"checksum": "0110101",
"seed": "1929655fd266457fc620dd471f424b8351999338c837db07ec362dab19f11dbb2c2aff18d0a063a9d91239f81181d0fcebe327c37803b45012a8163fe3b716b6",
"root": {
"private_key": "a01b94f79e8c29ee63b8c27e40ef63f1cfe8f4cac870d0de5d20e889b1d8a13a",
"public_key": "031225fa5e457da949ab1021931887131c7a53c06df0fce4d6a3dd5819aa5776e0",
"xpub": "xpub661MyMwAqRbcFJsyHbfuQsjnh3qjSfXkxkEXa5JHoSbyU7UNoiXU3FXfcKUbdFqC5cyxexpUAYPZP6K9AU9C4FjfuiX743buQgF5k7BwUND",
"xpriv": "xprv9s21ZrQH143K2poWBa8u3jo4921F3CoubXJvmgtgF74zbK9EGBDDVTDBm3acAnd1cvowkj1pvi7PK3Ab6XrwYfJPWmQtCp5kor3tbqkreJ6",
"parent_fingerprint": "00",
"fingerprint": "056dd4ec",
"depth": 0,
"index": 0,
"chain_code": "4cf7eb64f359de9cdb7f2c05baf3267a2f1f96e1fc68333c60e92ff3dbbf0b78"
},
"derived_node": {
"path": "m/85'/15/76",
"public_key": "02029099fda4c09fa365c85cf785fb790270125bc0d9a584e1707ca2d85209eab2",
"private_key": "921255b836b8215d67d18949b217f3b3edf77cc0d185d37ff85da85d6ca0657e",
"xpub": "xpub6CnpKCiJ2WSFtjfzoreA69jdgCrLK2vVrzEhvJHHEDjREWLU2SYKwVkMVML9Gt22pMY2aa4RdEXedECPgyoegRy76vaPNpj8QzFwAxeRKmn",
"xpriv": "xprv9yoTuhBQC8sxgFbXhq79j1nu8B1quaCeVmK77usfftCSMi1KUuE5PhRse7PaX8uh8stKfMGjNGN6ZiXVXBL54daSjmLvEe57u3m8mbGvHGv",
"parent_fingerprint": "9aedbb6f",
"fingerprint": "6ad6b30a",
"depth": 3,
"index": 76,
"chain_code": "ec33efe03c9ad429a6e2cba47cdbc396ae2bded480c628f760396794e6f52729"
}
},
{
"id": 4,
"entropy": "39281ecca67d16aa629115340d8ad4923bd49ec2d6f17669fce458087ee89a92",
"mnemonic": "decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog",
"salt": None,
"binary": "00111001001 01000000111 10110011001 01001100111 11010001011 01010101001 10001010010 00100010101 00110100000 01101100010 10110101001 00100100011 10111101010 01001111011 00001011010 11011110001 01110110011 01001111111 00111001000 10110000000 10000111111 01110100010 01101010010 010",
"checksum": "11101001",
"seed": "c11b0ff978d88c0ae9f7c349733bbd1b7baf2237663e3064a4c62bc4f5a578e4fb14fc43c38f85bfe83a15790397d7a301df5233d7d520cd2cc974cd33ae47b2",
"root": {
"private_key": "36f0fcac8ff8e73506ae26aa1db732918e0db5c5635330eaed951e12eacedf3e",
"public_key": "02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e",
"xpub": "xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg",
"xpriv": "xprv9s21ZrQH143K44jbyZ33aXCnHS4tsAXwakmeNmvdJKQjUurc6gYHKknMNKtdTiC7jPbnEBmTWDEJ4HpxobatUpEKQgrshDpv8R1NrCkdWyT",
"parent_fingerprint": "00",
"fingerprint": "ea6be3d5",
"depth": 0,
"index": 0,
"chain_code": "c989c416cf4c4e3d3708c25893ab6c01bcb9893e153929ab9204eb374ab76a63"
},
"derived_node": {
"path": "m/51'",
"public_key": "028f08404abc652f3170f471591cab170f153a0772adf69d33116212f9219537cc",
"private_key": "e74f8cedbafd94797fd0d21ecb06ccac46721602ccb8a0fe86cdb54335d03691",
"xpub": "xpub69cS8waJoeNVm5qKbGi2eyspJLHgP1zyZWgFJt2knTHGUhF45C8tthWzJ5cJTKQA77UvXkKvpdGh49ewZhDyQD2vFcSyTz3qjvstaxjPd4F",
"xpriv": "xprv9vd5jS3QyGpCYbkrVFB2Hqw5kJTByZH8CHkeWVd9E7kHbtuuXepeLuCWSqFQy8o3iwPrPyw5trAwCpW9HvecxQkCNBeHUHmXiAu9mUWDviW",
"parent_fingerprint": "ea6be3d5",
"fingerprint": "97f01095",
"depth": 1,
"index": 2147483699,
"chain_code": "bfad5d31ac996363d635dad2304f9582e81ddd7cc8249c3cd5b327706103cb6e"
}
},
]
}
public_path_mnemonic = "decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog"
public_path = [
'xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg',
'xpub69cS8waATyqVK5tryNLyKKHMHzieRM4AQdG5aR9VSe29cJp4EyTrMDLHUi198chSiY86Dh1V57UPCdwSsNUPDKjhSeXvZ3ejvW76pRGFpQe',
'xpub6AB84inF91Uf26fue9dETg5rkNhDwEsWN2kpB7vJWHHuakuMeKPL7onruexAnWhLkEMv7Rjq2aA1z8h6iz4XX6tfRaiuZY83TQi4MR29UCN']
| trezor_vectors = {'english': [{'id': 0, 'entropy': '00000000000000000000000000000000', 'mnemonic': 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', 'salt': 'TREZOR', 'binary': '00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 00000000000 0000000', 'checksum': '0011', 'seed': 'c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04', 'root': {'private_key': 'cbedc75b0d6412c85c79bc13875112ef912fd1e756631b5a00330866f22ff184', 'public_key': '02f632717d78bf73e74aa8461e2e782532abae4eed5110241025afb59ebfd3d2fd', 'xpub': 'xpub661MyMwAqRbcGB88KaFbLGiYAat55APKhtWg4uYMkXAmfuSTbq2QYsn9sKJCj1YqZPafsboef4h4YbXXhNhPwMbkHTpkf3zLhx7HvFw1NDy', 'xpriv': 'xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF', 'parent_fingerprint': '00', 'fingerprint': 'b4e3f5ed', 'depth': 0, 'index': 0, 'chain_code': 'a3fa8c983223306de0f0f65e74ebb1e98aba751633bf91d5fb56529aa5c132c1'}, 'derived_node': {'path': "m/7'/13'/8'/65'/6/44/16/18'/7", 'public_key': '026381791f9bf7ec99538a408d61c911737a30488c78004feb34a73295776c2f17', 'private_key': 'b4749323ef65b3898c8cf3f9978fa437c9113a3a91b26320a1047032ab9eaf47', 'xpub': 'xpub6Qo94BJ44WgahcCbte4pYt2UU5AGBrkt4PyKWzG3KA9AR1EbERqbTo69Wtc4cXnB2DiuFcxwEDRNdQh1GXwF1jqHrwZS3KRS6X7eaceREJd', 'xpriv': 'xprvABonefmAE98HV888ncXpBk5jv3KmnQ32hB3iibrRkpcBYCuSgtXLuzmffeBwvMLcouHL2WdJEZiiXJDB6cMDKytYPy37Em7BNCytyBhJd5A', 'parent_fingerprint': 'fc4ca6e2', 'fingerprint': '264f90ed', 'depth': 9, 'index': 7, 'chain_code': '3c063c0a452d20fba1b1cc476a886def7096116dd0cb8400d90f6f55507bcca6'}}]}
test_vectors = {'english': [{'id': 0, 'entropy': 'a4e3fc4c0161698a22707cfbf30f7f83', 'mnemonic': 'pilot cable basic actress bird shallow mean auto winner observe that all', 'salt': None, 'binary': '10100100111 00011111111 00010011000 00000010110 00010110100 11000101000 10001001110 00001111100 11111011111 10011000011 11011111111 0000011', 'checksum': '0011', 'seed': 'af44c7ad86ba0a5f46d4c1e785c846db14e0f3d62b69c2ab7efa012a9c9155c024975d6897e36fe9e9e6f0bde55fdf325ff308914ed1b316da0f755f9dd7347d', 'root': {'private_key': 'c6796958d07afe0af1ba9a11da2b7a22d6226b4ff7ff5324c7c876cfc1ea0f1c', 'public_key': '029cfe11e5f33a2601083ff5e29d9b7f134f5edc6b7636674a7286ecf6d23804df', 'xpub': 'xpub661MyMwAqRbcFXwuU8c1uEfmER2GW8A7XfaR9Cw41RCGr1xmr4WaLdU9cGPvcJXaaNYLFuu9bMimhKmGgaFja9BxcBAo98Eim1UuUu1dXAn', 'xpriv': 'xprv9s21ZrQH143K33sSN751Y6j2gPBn6fSGASepLpXST5fHyDddJXCKnq9fm1gRmHk4CPPcEF9gBmJvPBf74ExYM6Ybe6zwA7HfX8dQkRFY9S4', 'parent_fingerprint': '00', 'fingerprint': 'f3ac0f3f', 'depth': 0, 'index': 0, 'chain_code': '6399431d3f454a4acbe0f1cbb2d9a392a43dbea34e7fea952bdda675adde6e6e'}, 'derived_node': {'path': "m/55'/16'/34'/20/19'/97/21'/88'", 'public_key': '039b8a22c4fb43cb4b52596fc2050357dd9771950d6b6881c6e4b2e78e1943f51d', 'private_key': '258dc521c0581a788a2f08fd64be0f4d29c0c7384031960e6b6986526bcb039f', 'xpub': 'xpub6NjKMZDHrzmR8m4poa48Xzj3qeS32QQBbfXffSK5N4F6SLE35fFrBT9qECJ77LMic44hNnWTR86qVjE8r4DsMSNVztB1vyoYNvhzrg91zXV', 'xpriv': 'xprvA9jxx3gQ2dD7vGzMhYX8ArnKHcbYcwgLESc4s3uToii7ZXttY7wbdeqMNtRdhhepm7cEKKparnDqeigAPgj7KTj7Gw5ZGUKCRBYbkd3sdGo', 'parent_fingerprint': 'e33b22ce', 'fingerprint': '93195471', 'depth': 8, 'index': 2147483736, 'chain_code': '18eb1b59d8a529c9fdbfbce7f6cb03cc9b1bd80b2fc5abee1944b32a32c136f8'}}, {'id': 1, 'entropy': '8cfc94f3846c43fa893b4950155de2369772c91e', 'mnemonic': 'mind tool diagram angle service wool ceiling hard exotic priority joy honey jaguar goose kit', 'salt': None, 'binary': '10001100111 11100100101 00111100111 00001000110 11000100001 11111101010 00100100111 01101001001 01010000000 10101010111 01111000100 01101101001 01110111001 01100100100 011110', 'checksum': '10111', 'seed': '82555df2fd8c76fca417c83fc7ed0552a0310299eed41d3a45cf49e1ac056e21126e64d988052b9dbc0e04bd6b3580c51ab6a4ec5a62c5dba2039bd372e7d137', 'root': {'private_key': '9fee59092ebbedc782277cf75bc85f9db0ea559818eb20de865c4897eb2144f4', 'public_key': '0357ffdd29d20d72d2061c154353835b9cd34016d6f63755a04d70a7033e2919b3', 'xpub': 'xpub661MyMwAqRbcFyPp6zb6ZPcsuqVkvUm2Y61Gn7cRrkp2xxCD8ot9tgJQDKG6R6DWopMQrVoUhMChoCZcS4PKSFFx5AoNPAGFizikrRVTmpn', 'xpriv': 'xprv9s21ZrQH143K3VKLzy46CFg9MofGX23BAs5fyjCpJRH469s4bGZuLsyvN2qGCAYoJYmHyT6XVVkhm7DHGyHSyYPintmfgxYrwKHzCgCthir', 'parent_fingerprint': '00', 'fingerprint': '94db54c0', 'depth': 0, 'index': 0, 'chain_code': '8faa80cab7372c9e12e2f54a445e434b5d2cb310bc92d7e304b914360a89278a'}, 'derived_node': {'path': "m/96'/2'/10/81'/60'/90'", 'public_key': '0229d3838c6703a16aa9e7f8604dd308f36980ca891783f9e46dcc8d0a7c7da5ed', 'private_key': '6f7ae238af855eb9e0cee63333a4c05ef4c24a54a6951dcdf298ea13c85e2050', 'xpub': 'xpub6JuoVny9rzjMruCwjgP66H9bLt97ow3jgg6Sjt5Eny85LQKoQzA6E9xhmFcVoQR2PoYnTTDMcXnyo1MZPHeW4PFBxaN6VitafnfA3csorkr', 'xpriv': 'xprvA5vT6HSG2dB4eR8Uder5j9CrnrJdQUKtKTAqwVfdEdb6TbzesSqqgMeDv17Qa6M5jxRcbhDTTfzzBxuJqMURrsXnRXNJUwkRsqNmTHEs6Qx', 'parent_fingerprint': 'db9f3893', 'fingerprint': '11b20e3d', 'depth': 6, 'index': 2147483738, 'chain_code': '91f4c0395a78095692132cb1f632834ab821c373057ccdb5637f7f9f34837fdd'}}, {'id': 2, 'entropy': '15bf57143a38579300d9f4cbd65adaebe01398fbeb8f44f0', 'mnemonic': 'between wide shallow inner lyrics sister address direct slim ready repeat style abuse small use impose eager liberty', 'salt': None, 'binary': '00010101101 11111010101 11000101000 01110100011 10000101011 11001001100 00000011011 00111110100 11001011110 10110010110 10110110101 11010111110 00000001001 11001100011 11101111101 01110001111 01000100111 10000', 'checksum': '000111', 'seed': 'db6b9728bce174c1c14976415cfe06d63509e127f38ba265cf672315b5ed15953828f0fe5e9922654c07d3284f7ac11f814b564e87f94210d3bcc153ec6f698b', 'root': {'private_key': '3a4014ab104dc69ba3820e3c1e9740998dfdd0b912f1f83268c639bac5fa64f0', 'public_key': '03230ac7166adf9664a911a4d4785a60e79e983f950b99fe9dc228dd1438c0aa36', 'xpub': 'xpub661MyMwAqRbcFtZZGjnmsUKVffkBYUraocCexn2maSi1keXzdsaam5fwHRrwFaLNe1dCjqQQMgcGSQfaiD5BFuDbvy3cdkWrq3939hHHns9', 'xpriv': 'xprv9s21ZrQH143K3QV6AiFmWLNm7duh928jSPH4APdA27B2srCr6LGLDHMTS94eTRRBfnoLErXZEXbkAHpybohWnb4tp8sv3cSK7nJKtpcwJ4U', 'parent_fingerprint': '00', 'fingerprint': 'b46fe1d0', 'depth': 0, 'index': 0, 'chain_code': '874c576e48fdc3ebf6f0822b4d18498d0a545d6684dfd683ef215fd0273870e8'}, 'derived_node': {'path': "m/87/19/76/25'/96'", 'public_key': '03540f45d9145cd5c9bdbf67b674df050255ac19380b0b6f3cc57dff99e17b836a', 'private_key': 'c3c055a5154dafa361e82d585393d82a8bf3f82cbe96f7c4e2e758de7ac90a0e', 'xpub': 'xpub6FwAvDCcTWuqD2hVZHoi3WhtWZbf2XBeo36HRFwCLLk85DxzvHau5dmx8o7VKsdrv98yigghdX6PkgeGvoe4LZ39Hoex2ZhGtJ53W4Tdnmn', 'xpriv': 'xprvA2wpWhfid9MXzYd2TGGhgNm9xXmAd4ToRpAgcsXan1D9CRdrNkGeXqTUHWzAimdLSuZCMCqMhu545mtYP4mj13q5RWDbuyBHBbwMeaPcAyU', 'parent_fingerprint': '46ae4850', 'fingerprint': '94d1cc4b', 'depth': 5, 'index': 2147483744, 'chain_code': '309cff07ed70166ebe30ec31ee7a4c261fa9dfa6bdae249d498a84f4d224d472'}}, {'id': 3, 'entropy': 'a05a7afb69e2cd81c838a7d1ad4132d06bef59042b0388512881b61a', 'mnemonic': 'park stable salute stable coast science can belt spider head erosion patch same prosper awful gather marriage matter call history pluck', 'salt': None, 'binary': '10100000010 11010011110 10111110110 11010011110 00101100110 11000000111 00100000111 00010100111 11010001101 01101010000 01001100101 10100000110 10111110111 10101100100 00010000101 01100000011 10001000010 10001001010 00100000011 01101100001 1010', 'checksum': '0110101', 'seed': '1929655fd266457fc620dd471f424b8351999338c837db07ec362dab19f11dbb2c2aff18d0a063a9d91239f81181d0fcebe327c37803b45012a8163fe3b716b6', 'root': {'private_key': 'a01b94f79e8c29ee63b8c27e40ef63f1cfe8f4cac870d0de5d20e889b1d8a13a', 'public_key': '031225fa5e457da949ab1021931887131c7a53c06df0fce4d6a3dd5819aa5776e0', 'xpub': 'xpub661MyMwAqRbcFJsyHbfuQsjnh3qjSfXkxkEXa5JHoSbyU7UNoiXU3FXfcKUbdFqC5cyxexpUAYPZP6K9AU9C4FjfuiX743buQgF5k7BwUND', 'xpriv': 'xprv9s21ZrQH143K2poWBa8u3jo4921F3CoubXJvmgtgF74zbK9EGBDDVTDBm3acAnd1cvowkj1pvi7PK3Ab6XrwYfJPWmQtCp5kor3tbqkreJ6', 'parent_fingerprint': '00', 'fingerprint': '056dd4ec', 'depth': 0, 'index': 0, 'chain_code': '4cf7eb64f359de9cdb7f2c05baf3267a2f1f96e1fc68333c60e92ff3dbbf0b78'}, 'derived_node': {'path': "m/85'/15/76", 'public_key': '02029099fda4c09fa365c85cf785fb790270125bc0d9a584e1707ca2d85209eab2', 'private_key': '921255b836b8215d67d18949b217f3b3edf77cc0d185d37ff85da85d6ca0657e', 'xpub': 'xpub6CnpKCiJ2WSFtjfzoreA69jdgCrLK2vVrzEhvJHHEDjREWLU2SYKwVkMVML9Gt22pMY2aa4RdEXedECPgyoegRy76vaPNpj8QzFwAxeRKmn', 'xpriv': 'xprv9yoTuhBQC8sxgFbXhq79j1nu8B1quaCeVmK77usfftCSMi1KUuE5PhRse7PaX8uh8stKfMGjNGN6ZiXVXBL54daSjmLvEe57u3m8mbGvHGv', 'parent_fingerprint': '9aedbb6f', 'fingerprint': '6ad6b30a', 'depth': 3, 'index': 76, 'chain_code': 'ec33efe03c9ad429a6e2cba47cdbc396ae2bded480c628f760396794e6f52729'}}, {'id': 4, 'entropy': '39281ecca67d16aa629115340d8ad4923bd49ec2d6f17669fce458087ee89a92', 'mnemonic': 'decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog', 'salt': None, 'binary': '00111001001 01000000111 10110011001 01001100111 11010001011 01010101001 10001010010 00100010101 00110100000 01101100010 10110101001 00100100011 10111101010 01001111011 00001011010 11011110001 01110110011 01001111111 00111001000 10110000000 10000111111 01110100010 01101010010 010', 'checksum': '11101001', 'seed': 'c11b0ff978d88c0ae9f7c349733bbd1b7baf2237663e3064a4c62bc4f5a578e4fb14fc43c38f85bfe83a15790397d7a301df5233d7d520cd2cc974cd33ae47b2', 'root': {'private_key': '36f0fcac8ff8e73506ae26aa1db732918e0db5c5635330eaed951e12eacedf3e', 'public_key': '02800f0237e39dce74f506c508985d4d71f8020342d7dfe781ca5cfb73e63eb43e', 'xpub': 'xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg', 'xpriv': 'xprv9s21ZrQH143K44jbyZ33aXCnHS4tsAXwakmeNmvdJKQjUurc6gYHKknMNKtdTiC7jPbnEBmTWDEJ4HpxobatUpEKQgrshDpv8R1NrCkdWyT', 'parent_fingerprint': '00', 'fingerprint': 'ea6be3d5', 'depth': 0, 'index': 0, 'chain_code': 'c989c416cf4c4e3d3708c25893ab6c01bcb9893e153929ab9204eb374ab76a63'}, 'derived_node': {'path': "m/51'", 'public_key': '028f08404abc652f3170f471591cab170f153a0772adf69d33116212f9219537cc', 'private_key': 'e74f8cedbafd94797fd0d21ecb06ccac46721602ccb8a0fe86cdb54335d03691', 'xpub': 'xpub69cS8waJoeNVm5qKbGi2eyspJLHgP1zyZWgFJt2knTHGUhF45C8tthWzJ5cJTKQA77UvXkKvpdGh49ewZhDyQD2vFcSyTz3qjvstaxjPd4F', 'xpriv': 'xprv9vd5jS3QyGpCYbkrVFB2Hqw5kJTByZH8CHkeWVd9E7kHbtuuXepeLuCWSqFQy8o3iwPrPyw5trAwCpW9HvecxQkCNBeHUHmXiAu9mUWDviW', 'parent_fingerprint': 'ea6be3d5', 'fingerprint': '97f01095', 'depth': 1, 'index': 2147483699, 'chain_code': 'bfad5d31ac996363d635dad2304f9582e81ddd7cc8249c3cd5b327706103cb6e'}}]}
public_path_mnemonic = 'decrease domain rebel erupt sphere festival medal cargo cross hobby release caught run exhaust area taste island exit decorate quote margin inmate heart frog'
public_path = ['xpub661MyMwAqRbcGYp55aa3wf9WqTuPGdFnwyhFBALErewiMiBkeDrXsZ6qDbUbawSiHVgqvqobbNdosLY7aJgsNVv4DtwPAWKEjgCaSEjvdBg', 'xpub69cS8waATyqVK5tryNLyKKHMHzieRM4AQdG5aR9VSe29cJp4EyTrMDLHUi198chSiY86Dh1V57UPCdwSsNUPDKjhSeXvZ3ejvW76pRGFpQe', 'xpub6AB84inF91Uf26fue9dETg5rkNhDwEsWN2kpB7vJWHHuakuMeKPL7onruexAnWhLkEMv7Rjq2aA1z8h6iz4XX6tfRaiuZY83TQi4MR29UCN'] |
# -*- coding: utf-8 -*-
# Copyright 2011 Fanficdownloader team
#
# 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.
#
## Just to shut up the appengine warning about "You are using the
## default Django version (0.96). The default Django version will
## change in an App Engine release in the near future. Please call
## use_library() to explicitly select a Django version. For more
## information see
## http://code.google.com/appengine/docs/python/tools/libraries.html#Django"
pass
| pass |
class Mapper(object):
""" A base clap from which to ineherit in order to create a keyboard mapper. """
def __init__(self):
self.base_map = None
self.alt_map = None
self.map = None
def create_map(self):
self.map = dict(zip(self.base_map, self.alt_map))
def map_key(self, key):
if key not in self.map.keys():
return key
return self.map[key]
class DvorakMapper(Mapper):
""" Maps a qwerty key to its dvorak equivalent. """
def __init__(self):
super(DvorakMapper, self).__init__()
self.base_map = '`1234567890-=QWERTYUIOP[]ASDFGHJKL;\'ZXCVBNM,./'
self.alt_map = '`1234567890[]\',.PYFGCRL/=AOEUIDHTNS-;QJKXBMWVZ'
super(DvorakMapper, self).create_map()
| class Mapper(object):
""" A base clap from which to ineherit in order to create a keyboard mapper. """
def __init__(self):
self.base_map = None
self.alt_map = None
self.map = None
def create_map(self):
self.map = dict(zip(self.base_map, self.alt_map))
def map_key(self, key):
if key not in self.map.keys():
return key
return self.map[key]
class Dvorakmapper(Mapper):
""" Maps a qwerty key to its dvorak equivalent. """
def __init__(self):
super(DvorakMapper, self).__init__()
self.base_map = "`1234567890-=QWERTYUIOP[]ASDFGHJKL;'ZXCVBNM,./"
self.alt_map = "`1234567890[]',.PYFGCRL/=AOEUIDHTNS-;QJKXBMWVZ"
super(DvorakMapper, self).create_map() |
"""
A package with everything you need to build a simple neural network
"""
# todo - add unit tests
| """
A package with everything you need to build a simple neural network
""" |
# Copyright (c) Microsoft Corporation.
#
# 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.
async def test_check_the_box(page):
await page.setContent('<input id="checkbox" type="checkbox"></input>')
await page.check("input")
assert await page.evaluate("checkbox.checked")
async def test_not_check_the_checked_box(page):
await page.setContent('<input id="checkbox" type="checkbox" checked></input>')
await page.check("input")
assert await page.evaluate("checkbox.checked")
async def test_uncheck_the_box(page):
await page.setContent('<input id="checkbox" type="checkbox" checked></input>')
await page.uncheck("input")
assert await page.evaluate("checkbox.checked") is False
async def test_not_uncheck_the_unchecked_box(page):
await page.setContent('<input id="checkbox" type="checkbox"></input>')
await page.uncheck("input")
assert await page.evaluate("checkbox.checked") is False
async def test_check_the_box_by_label(page):
await page.setContent(
'<label for="checkbox"><input id="checkbox" type="checkbox"></input></label>'
)
await page.check("label")
assert await page.evaluate("checkbox.checked")
async def test_check_the_box_outside_label(page):
await page.setContent(
'<label for="checkbox">Text</label><div><input id="checkbox" type="checkbox"></input></div>'
)
await page.check("label")
assert await page.evaluate("checkbox.checked")
async def test_check_the_box_inside_label_without_id(page):
await page.setContent(
'<label>Text<span><input id="checkbox" type="checkbox"></input></span></label>'
)
await page.check("label")
assert await page.evaluate("checkbox.checked")
async def test_check_radio(page):
await page.setContent(
"""
<input type='radio'>one</input>
<input id='two' type='radio'>two</input>
<input type='radio'>three</input>"""
)
await page.check("#two")
assert await page.evaluate("two.checked")
async def test_check_the_box_by_aria_role(page):
await page.setContent(
"""<div role='checkbox' id='checkbox'>CHECKBOX</div>
<script>
checkbox.addEventListener('click', () => checkbox.setAttribute('aria-checked', 'true'))
</script>"""
)
await page.check("div")
assert await page.evaluate("checkbox.getAttribute('aria-checked')")
| async def test_check_the_box(page):
await page.setContent('<input id="checkbox" type="checkbox"></input>')
await page.check('input')
assert await page.evaluate('checkbox.checked')
async def test_not_check_the_checked_box(page):
await page.setContent('<input id="checkbox" type="checkbox" checked></input>')
await page.check('input')
assert await page.evaluate('checkbox.checked')
async def test_uncheck_the_box(page):
await page.setContent('<input id="checkbox" type="checkbox" checked></input>')
await page.uncheck('input')
assert await page.evaluate('checkbox.checked') is False
async def test_not_uncheck_the_unchecked_box(page):
await page.setContent('<input id="checkbox" type="checkbox"></input>')
await page.uncheck('input')
assert await page.evaluate('checkbox.checked') is False
async def test_check_the_box_by_label(page):
await page.setContent('<label for="checkbox"><input id="checkbox" type="checkbox"></input></label>')
await page.check('label')
assert await page.evaluate('checkbox.checked')
async def test_check_the_box_outside_label(page):
await page.setContent('<label for="checkbox">Text</label><div><input id="checkbox" type="checkbox"></input></div>')
await page.check('label')
assert await page.evaluate('checkbox.checked')
async def test_check_the_box_inside_label_without_id(page):
await page.setContent('<label>Text<span><input id="checkbox" type="checkbox"></input></span></label>')
await page.check('label')
assert await page.evaluate('checkbox.checked')
async def test_check_radio(page):
await page.setContent("\n <input type='radio'>one</input>\n <input id='two' type='radio'>two</input>\n <input type='radio'>three</input>")
await page.check('#two')
assert await page.evaluate('two.checked')
async def test_check_the_box_by_aria_role(page):
await page.setContent("<div role='checkbox' id='checkbox'>CHECKBOX</div>\n <script>\n checkbox.addEventListener('click', () => checkbox.setAttribute('aria-checked', 'true'))\n </script>")
await page.check('div')
assert await page.evaluate("checkbox.getAttribute('aria-checked')") |
# https://leetcode.com/problems/single-number-iii/
class Solution:
def singleNumber(self, nums: List[int]) -> List[int]:
d = {}
for num in nums:
if num in d:
d[num] += 1
else:
d[num] = 1
result = []
for key, value in d.items():
if value == 1:
result.append(key)
return result
| class Solution:
def single_number(self, nums: List[int]) -> List[int]:
d = {}
for num in nums:
if num in d:
d[num] += 1
else:
d[num] = 1
result = []
for (key, value) in d.items():
if value == 1:
result.append(key)
return result |
# https://stackoverflow.com/questions/1883980/find-the-nth-occurrence-of-substring-in-a-string
def find_nth(haystack, needle, n):
start = haystack.find(needle)
while start >= 0 and n > 1:
start = haystack.find(needle, start+len(needle))
n -= 1
return start
file_to_be_read = input("Which file do you want to open? (Please specify the full filename.)\n")
rtz_file = open(file_to_be_read, 'r')
file_to_be_written = input("Which file do you want to write to? (The file ending 'rtz' will be added automagically.)\n")
file = open(file_to_be_written + ".rtz", "w")
count = 0
schedule_count = 0
date = "2018-04-06"
hours = 10
minutes = 40
seconds = 11
for line in rtz_file:
line = line.strip()
if line:
if "<!--" in line:
pass
else:
if line.startswith('<waypoint id="'):
count += 1
file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):] + '\n')
# file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):])
if "</waypoint><waypoint" in line:
count += 1
file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):] + '\n')
# file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):])
else:
if "<waypoint id=" in line:
pass
else:
if "<scheduleElement eta=" in line:
pass
else:
file.write(line + '\n')
if "<calculated" in line:
for number in range(count):
schedule_count += 1
seconds += 13
if seconds < 45:
seconds += 14
elif seconds > 59:
seconds = 15
if minutes < 59:
minutes += 1
elif minutes == 59:
minutes = 0
hours += 1
if minutes < 9:
file.write('<scheduleElement eta="' + date + "T" + str(hours) + ":0" + str(minutes) + ":" + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n')
elif minutes >= 10:
file.write('<scheduleElement eta="' + date + "T" + str(hours) + ":" + str(minutes) + ":" + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n')
# file.write(line + '\n')
| def find_nth(haystack, needle, n):
start = haystack.find(needle)
while start >= 0 and n > 1:
start = haystack.find(needle, start + len(needle))
n -= 1
return start
file_to_be_read = input('Which file do you want to open? (Please specify the full filename.)\n')
rtz_file = open(file_to_be_read, 'r')
file_to_be_written = input("Which file do you want to write to? (The file ending 'rtz' will be added automagically.)\n")
file = open(file_to_be_written + '.rtz', 'w')
count = 0
schedule_count = 0
date = '2018-04-06'
hours = 10
minutes = 40
seconds = 11
for line in rtz_file:
line = line.strip()
if line:
if '<!--' in line:
pass
else:
if line.startswith('<waypoint id="'):
count += 1
file.write(line[:14] + str(count) + line[find_nth(line, '"', 2):] + '\n')
if '</waypoint><waypoint' in line:
count += 1
file.write(line[0:11] + '\n' + line[11:25] + str(count) + line[find_nth(line, '"', 2):] + '\n')
elif '<waypoint id=' in line:
pass
else:
if '<scheduleElement eta=' in line:
pass
else:
file.write(line + '\n')
if '<calculated' in line:
for number in range(count):
schedule_count += 1
seconds += 13
if seconds < 45:
seconds += 14
elif seconds > 59:
seconds = 15
if minutes < 59:
minutes += 1
elif minutes == 59:
minutes = 0
hours += 1
if minutes < 9:
file.write('<scheduleElement eta="' + date + 'T' + str(hours) + ':0' + str(minutes) + ':' + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n')
elif minutes >= 10:
file.write('<scheduleElement eta="' + date + 'T' + str(hours) + ':' + str(minutes) + ':' + str(seconds) + '.000Z"' + ' speed="12.00' + '"' + ' waypointId="' + str(schedule_count) + '"/>' + '\n') |
a=int(input("Enter a number"))
if a%2==0:
print(a,"is an Even Number")
else:
print(a,"is an Odd Number")
| a = int(input('Enter a number'))
if a % 2 == 0:
print(a, 'is an Even Number')
else:
print(a, 'is an Odd Number') |
# wczytanie wszystkich trzech plikow
with open('../dane/dane5-1.txt') as f:
data1 = []
for line in f.readlines():
data1.append(int(line[:-1]))
with open('../dane/dane5-2.txt') as f:
data2 = []
for line in f.readlines():
data2.append(int(line[:-1]))
with open('../dane/dane5-3.txt') as f:
data3 = []
for line in f.readlines():
data3.append(int(line[:-1]))
# laczy elementy obok siebie ktore maja ten sam znak
def squish(data):
new_data = [data[0]]
prev_sign = data[0]
for num in data[1:]:
# jezeli pomnozone to te z tym samym znakiem beda dawaly dodatnia liczbe
if num * prev_sign > 0:
new_data[-1] += num
else:
new_data.append(num)
prev_sign = num
return new_data
# zwraca najlepsza sume ciagu
def best_sum(data):
# najlepsza suma
rec = -float('inf')
# przechodze po kazdym zakresie
for start in range(len(data)):
# aktualna suma
curr_sum = data[start]
for end in range(start + 1, len(data)):
# zliczenie sumy
curr_sum += data[end]
# jezeli suma wieksza od rekordu to zapisz
if curr_sum > rec:
rec = curr_sum
return rec
rec1 = best_sum(squish(data1))
rec2 = best_sum(squish(data2))
rec3 = best_sum(squish(data3))
# wyswietlenie odpowiedzi
answer = f'5 b) Najlepsza suma dla dane5-1.txt: {rec1}; '
answer += f'Najlepsza suma dla dane5-2.txt: {rec2}; '
answer += f'Najlepsza suma dla dane5-3.txt: {rec3}'
print(answer)
| with open('../dane/dane5-1.txt') as f:
data1 = []
for line in f.readlines():
data1.append(int(line[:-1]))
with open('../dane/dane5-2.txt') as f:
data2 = []
for line in f.readlines():
data2.append(int(line[:-1]))
with open('../dane/dane5-3.txt') as f:
data3 = []
for line in f.readlines():
data3.append(int(line[:-1]))
def squish(data):
new_data = [data[0]]
prev_sign = data[0]
for num in data[1:]:
if num * prev_sign > 0:
new_data[-1] += num
else:
new_data.append(num)
prev_sign = num
return new_data
def best_sum(data):
rec = -float('inf')
for start in range(len(data)):
curr_sum = data[start]
for end in range(start + 1, len(data)):
curr_sum += data[end]
if curr_sum > rec:
rec = curr_sum
return rec
rec1 = best_sum(squish(data1))
rec2 = best_sum(squish(data2))
rec3 = best_sum(squish(data3))
answer = f'5 b) Najlepsza suma dla dane5-1.txt: {rec1}; '
answer += f'Najlepsza suma dla dane5-2.txt: {rec2}; '
answer += f'Najlepsza suma dla dane5-3.txt: {rec3}'
print(answer) |
numbers = list(range(0, 110, 10))
numbers = (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
second = []
x = 0
while x < len(numbers):
t = numbers[x] *2.5
if t % 2 == 0:
second.append(int(t))
x += 1
print(second)
print(x) | numbers = list(range(0, 110, 10))
numbers = (0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
second = []
x = 0
while x < len(numbers):
t = numbers[x] * 2.5
if t % 2 == 0:
second.append(int(t))
x += 1
print(second)
print(x) |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "workspace_and_buildfile")
load(
"@bazel_tools//tools/cpp:lib_cc_configure.bzl",
"auto_configure_fail",
"auto_configure_warning",
"escape_string",
"get_env_var",
"get_starlark_list",
"resolve_labels",
"split_escaped",
"which",
)
load(
"//AvrToolchain:cc_toolchain/cc_toolchain.bzl",
"create_cc_toolchain_package",
)
load(
"//AvrToolchain:platforms/platforms.bzl",
"write_constraints",
)
load(
"//AvrToolchain:platforms/platform_list.bzl",
"platforms",
)
def _avr_toolchain_impl(repository_ctx):
prefix = "@EmbeddedSystemsBuildScripts//AvrToolchain:"
paths = resolve_labels(
repository_ctx,
[prefix + label for label in [
"cc_toolchain/cc_toolchain_config.bzl.tpl",
"platforms/cpu_frequency/cpu_frequency.bzl.tpl",
"platforms/misc/BUILD.tpl",
"platforms/BUILD.tpl",
"helpers.bzl.tpl",
"host_config/BUILD.tpl",
"platforms/platform_list.bzl",
"platforms/mcu/mcu.bzl",
"BUILD.tpl",
"cc_toolchain/avr-gcc.sh",
]],
)
write_constraints(repository_ctx, paths)
create_cc_toolchain_package(repository_ctx, paths)
repository_ctx.template(
"helpers.bzl",
paths["@EmbeddedSystemsBuildScripts//AvrToolchain:helpers.bzl.tpl"],
)
repository_ctx.file("BUILD")
repository_ctx.template("host_config/BUILD", paths["@EmbeddedSystemsBuildScripts//AvrToolchain:host_config/BUILD.tpl"])
repository_ctx.template(
"platforms/platform_list.bzl",
paths["@EmbeddedSystemsBuildScripts//AvrToolchain:platforms/platform_list.bzl"],
)
repository_ctx.template(
"platforms/mcu/mcu.bzl",
paths["@EmbeddedSystemsBuildScripts//AvrToolchain:platforms/mcu/mcu.bzl"],
)
repository_ctx.template(
"BUILD",
paths["@EmbeddedSystemsBuildScripts//AvrToolchain:BUILD.tpl"],
)
_get_avr_toolchain_def_attrs = {
"gcc_tool": attr.string(),
"size_tool": attr.string(),
"ar_tool": attr.string(),
"ld_tool": attr.string(),
"cpp_tool": attr.string(),
"gcov_tool": attr.string(),
"nm_tool": attr.string(),
"objdump_tool": attr.string(),
"strip_tool": attr.string(),
"objcopy_tool": attr.string(),
"mcu_list": attr.string_list(mandatory = True),
}
create_avr_toolchain = repository_rule(
implementation = _avr_toolchain_impl,
attrs = _get_avr_toolchain_def_attrs,
doc = """
Creates an avr toolchain repository. The repository
will contain toolchain definitions and constraints
to allow compilation for avr platforms using the avr-gcc
compiler. The compiler itself has to be provided by the
operating system and discoverable through the PATH variable.
Additionally avr-binutils and avr-libc should be installed.
""",
)
def avr_toolchain():
create_avr_toolchain(
name = "AvrToolchain",
mcu_list = platforms,
)
for mcu in platforms:
native.register_toolchains(
"@AvrToolchain//cc_toolchain:cc-toolchain-avr-" + mcu,
)
| load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'workspace_and_buildfile')
load('@bazel_tools//tools/cpp:lib_cc_configure.bzl', 'auto_configure_fail', 'auto_configure_warning', 'escape_string', 'get_env_var', 'get_starlark_list', 'resolve_labels', 'split_escaped', 'which')
load('//AvrToolchain:cc_toolchain/cc_toolchain.bzl', 'create_cc_toolchain_package')
load('//AvrToolchain:platforms/platforms.bzl', 'write_constraints')
load('//AvrToolchain:platforms/platform_list.bzl', 'platforms')
def _avr_toolchain_impl(repository_ctx):
prefix = '@EmbeddedSystemsBuildScripts//AvrToolchain:'
paths = resolve_labels(repository_ctx, [prefix + label for label in ['cc_toolchain/cc_toolchain_config.bzl.tpl', 'platforms/cpu_frequency/cpu_frequency.bzl.tpl', 'platforms/misc/BUILD.tpl', 'platforms/BUILD.tpl', 'helpers.bzl.tpl', 'host_config/BUILD.tpl', 'platforms/platform_list.bzl', 'platforms/mcu/mcu.bzl', 'BUILD.tpl', 'cc_toolchain/avr-gcc.sh']])
write_constraints(repository_ctx, paths)
create_cc_toolchain_package(repository_ctx, paths)
repository_ctx.template('helpers.bzl', paths['@EmbeddedSystemsBuildScripts//AvrToolchain:helpers.bzl.tpl'])
repository_ctx.file('BUILD')
repository_ctx.template('host_config/BUILD', paths['@EmbeddedSystemsBuildScripts//AvrToolchain:host_config/BUILD.tpl'])
repository_ctx.template('platforms/platform_list.bzl', paths['@EmbeddedSystemsBuildScripts//AvrToolchain:platforms/platform_list.bzl'])
repository_ctx.template('platforms/mcu/mcu.bzl', paths['@EmbeddedSystemsBuildScripts//AvrToolchain:platforms/mcu/mcu.bzl'])
repository_ctx.template('BUILD', paths['@EmbeddedSystemsBuildScripts//AvrToolchain:BUILD.tpl'])
_get_avr_toolchain_def_attrs = {'gcc_tool': attr.string(), 'size_tool': attr.string(), 'ar_tool': attr.string(), 'ld_tool': attr.string(), 'cpp_tool': attr.string(), 'gcov_tool': attr.string(), 'nm_tool': attr.string(), 'objdump_tool': attr.string(), 'strip_tool': attr.string(), 'objcopy_tool': attr.string(), 'mcu_list': attr.string_list(mandatory=True)}
create_avr_toolchain = repository_rule(implementation=_avr_toolchain_impl, attrs=_get_avr_toolchain_def_attrs, doc='\nCreates an avr toolchain repository. The repository\nwill contain toolchain definitions and constraints\nto allow compilation for avr platforms using the avr-gcc\ncompiler. The compiler itself has to be provided by the\noperating system and discoverable through the PATH variable.\nAdditionally avr-binutils and avr-libc should be installed.\n ')
def avr_toolchain():
create_avr_toolchain(name='AvrToolchain', mcu_list=platforms)
for mcu in platforms:
native.register_toolchains('@AvrToolchain//cc_toolchain:cc-toolchain-avr-' + mcu) |
class initial(object):
pass
INITIAL = initial()
another = INITIAL
print(another is INITIAL) | class Initial(object):
pass
initial = initial()
another = INITIAL
print(another is INITIAL) |
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
{*[1,2,3], *[4,5,6]}
# EXPECTED:
[
...,
BUILD_SET_UNPACK(2),
...
]
| {*[1, 2, 3], *[4, 5, 6]}
[..., build_set_unpack(2), ...] |
def capital_indexes(string: str) -> list:
return [index for index, char in enumerate(string) if char.isupper()]
# return [letter for letter in range(len(indexes)) if indexes[letter].isupper()]
def tests() -> None:
print(capital_indexes("mYtESt")) # [1, 3, 4]
print(capital_indexes("owO"))
if __name__ == "__main__":
tests()
| def capital_indexes(string: str) -> list:
return [index for (index, char) in enumerate(string) if char.isupper()]
def tests() -> None:
print(capital_indexes('mYtESt'))
print(capital_indexes('owO'))
if __name__ == '__main__':
tests() |
# dataset settings
dataset_type = 'ImageNet'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='RandomResizedCrop', size=224, backend='pillow'),
dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='ToTensor', keys=['gt_label']),
dict(type='Collect', keys=['img', 'gt_label'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', size=(256, -1), backend='pillow'),
dict(type='CenterCrop', crop_size=224),
dict(type='Normalize', **img_norm_cfg),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img'])
]
data_root = 'data/'
data = dict(
samples_per_gpu=32,
workers_per_gpu=2,
train=dict(
type=dataset_type,
data_prefix=data_root+'imagenet1k/train',
ann_file=data_root+'imagenet1k/meta/train.txt',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
data_prefix=data_root+'imagenet1k/val',
ann_file=data_root+'imagenet1k/meta/val.txt',
pipeline=test_pipeline),
test=dict(
# replace `data/val` with `data/test` for standard test
type=dataset_type,
data_prefix=data_root+'imagenet1k/val',
ann_file=data_root+'imagenet1k/meta/val.txt',
pipeline=test_pipeline))
# model settings
model = dict(
type='ImageClassifier',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(3, ),
style='pytorch'),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2048,
topk=(1, 5),
dropout_ratio=0.0,
loss=dict(
type='LabelSmoothLoss',
loss_weight=1.0,
label_smooth_val=0.1,
num_classes=1000),
))
# optimizer
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
# learning policy
#lr_config = dict(
# policy='CosineAnnealing',
# min_lr=0,
# warmup='linear',
# warmup_iters=2500,
# warmup_ratio=0.25)
lr_config = dict(policy='step', step=[30, 60, 90])
runner = dict(type='EpochBasedRunner', max_epochs=100)
# checkpoint saving
checkpoint_config = dict(interval=100)
evaluation = dict(interval=1, metric='accuracy')
# yapf:disable
log_config = dict(
interval=100,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
# yapf:enable
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
| dataset_type = 'ImageNet'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224, backend='pillow'), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])]
test_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=(256, -1), backend='pillow'), dict(type='CenterCrop', crop_size=224), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'])]
data_root = 'data/'
data = dict(samples_per_gpu=32, workers_per_gpu=2, train=dict(type=dataset_type, data_prefix=data_root + 'imagenet1k/train', ann_file=data_root + 'imagenet1k/meta/train.txt', pipeline=train_pipeline), val=dict(type=dataset_type, data_prefix=data_root + 'imagenet1k/val', ann_file=data_root + 'imagenet1k/meta/val.txt', pipeline=test_pipeline), test=dict(type=dataset_type, data_prefix=data_root + 'imagenet1k/val', ann_file=data_root + 'imagenet1k/meta/val.txt', pipeline=test_pipeline))
model = dict(type='ImageClassifier', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=2048, topk=(1, 5), dropout_ratio=0.0, loss=dict(type='LabelSmoothLoss', loss_weight=1.0, label_smooth_val=0.1, num_classes=1000)))
optimizer = dict(type='SGD', lr=0.1, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step', step=[30, 60, 90])
runner = dict(type='EpochBasedRunner', max_epochs=100)
checkpoint_config = dict(interval=100)
evaluation = dict(interval=1, metric='accuracy')
log_config = dict(interval=100, hooks=[dict(type='TextLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)] |
"""Scorer of model predictions. Adaped from OneIE. """
def safe_div(num, denom):
if denom > 0:
if num / denom <= 1:
return num / denom
else:
return 1
else:
return 0
def compute_f1(predicted, gold, matched):
precision = safe_div(matched, predicted)
recall = safe_div(matched, gold)
f1 = safe_div(2 * precision * recall, precision + recall)
return precision, recall, f1
def convert_arguments(triggers, roles):
args = set()
for role in roles:
trigger_idx = role[0]
trigger_label = triggers[trigger_idx][-1]
args.add((trigger_label, role[1], role[2], role[3]))
return args
def score_graphs(gold_graphs, pred_graphs):
gold_arg_num = pred_arg_num = arg_idn_num = arg_class_num = 0
gold_trigger_num = pred_trigger_num = trigger_idn_num = trigger_class_num = 0
gold_men_num = pred_men_num = men_match_num = 0
for gold_graph, pred_graph in zip(gold_graphs, pred_graphs):
# Trigger
gold_triggers = gold_graph.triggers
pred_triggers = pred_graph.triggers
gold_trigger_num += len(gold_triggers)
pred_trigger_num += len(pred_triggers)
for trg_start, trg_end, event_type in pred_triggers:
matched = [item for item in gold_triggers
if item[0] == trg_start and item[1] == trg_end]
if matched:
trigger_idn_num += 1
if matched[0][-1] == event_type:
trigger_class_num += 1
# Argument
gold_args = convert_arguments(gold_triggers, gold_graph.roles)
pred_args = convert_arguments(pred_triggers, pred_graph.roles)
gold_arg_num += len(gold_args)
pred_arg_num += len(pred_args)
for pred_arg in pred_args:
event_type, arg_start, arg_end, role = pred_arg
gold_idn = {item for item in gold_args
if item[1] == arg_start and item[2] == arg_end
and item[0] == event_type}
if gold_idn:
arg_idn_num += 1
gold_class = {item for item in gold_idn if item[-1] == role}
if gold_class:
arg_class_num += 1
trigger_id_prec, trigger_id_rec, trigger_id_f = compute_f1(
pred_trigger_num, gold_trigger_num, trigger_idn_num)
trigger_prec, trigger_rec, trigger_f = compute_f1(
pred_trigger_num, gold_trigger_num, trigger_class_num)
role_id_prec, role_id_rec, role_id_f = compute_f1(
pred_arg_num, gold_arg_num, arg_idn_num)
role_prec, role_rec, role_f = compute_f1(
pred_arg_num, gold_arg_num, arg_class_num)
print('Trigger Identification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(
trigger_id_prec * 100.0, trigger_id_rec * 100.0, trigger_id_f * 100.0))
print('Trigger Classification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(
trigger_prec * 100.0, trigger_rec * 100.0, trigger_f * 100.0))
print('Argument Identification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(
role_id_prec * 100.0, role_id_rec * 100.0, role_id_f * 100.0))
print('Argument Classification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(
role_prec * 100.0, role_rec * 100.0, role_f * 100.0))
scores = {
'TC': {'prec': trigger_prec, 'rec': trigger_rec, 'f': trigger_f},
'TI': {'prec': trigger_id_prec, 'rec': trigger_id_rec,
'f': trigger_id_f},
'AC': {'prec': role_prec, 'rec': role_rec, 'f': role_f},
'AI': {'prec': role_id_prec, 'rec': role_id_rec, 'f': role_id_f},
}
return scores | """Scorer of model predictions. Adaped from OneIE. """
def safe_div(num, denom):
if denom > 0:
if num / denom <= 1:
return num / denom
else:
return 1
else:
return 0
def compute_f1(predicted, gold, matched):
precision = safe_div(matched, predicted)
recall = safe_div(matched, gold)
f1 = safe_div(2 * precision * recall, precision + recall)
return (precision, recall, f1)
def convert_arguments(triggers, roles):
args = set()
for role in roles:
trigger_idx = role[0]
trigger_label = triggers[trigger_idx][-1]
args.add((trigger_label, role[1], role[2], role[3]))
return args
def score_graphs(gold_graphs, pred_graphs):
gold_arg_num = pred_arg_num = arg_idn_num = arg_class_num = 0
gold_trigger_num = pred_trigger_num = trigger_idn_num = trigger_class_num = 0
gold_men_num = pred_men_num = men_match_num = 0
for (gold_graph, pred_graph) in zip(gold_graphs, pred_graphs):
gold_triggers = gold_graph.triggers
pred_triggers = pred_graph.triggers
gold_trigger_num += len(gold_triggers)
pred_trigger_num += len(pred_triggers)
for (trg_start, trg_end, event_type) in pred_triggers:
matched = [item for item in gold_triggers if item[0] == trg_start and item[1] == trg_end]
if matched:
trigger_idn_num += 1
if matched[0][-1] == event_type:
trigger_class_num += 1
gold_args = convert_arguments(gold_triggers, gold_graph.roles)
pred_args = convert_arguments(pred_triggers, pred_graph.roles)
gold_arg_num += len(gold_args)
pred_arg_num += len(pred_args)
for pred_arg in pred_args:
(event_type, arg_start, arg_end, role) = pred_arg
gold_idn = {item for item in gold_args if item[1] == arg_start and item[2] == arg_end and (item[0] == event_type)}
if gold_idn:
arg_idn_num += 1
gold_class = {item for item in gold_idn if item[-1] == role}
if gold_class:
arg_class_num += 1
(trigger_id_prec, trigger_id_rec, trigger_id_f) = compute_f1(pred_trigger_num, gold_trigger_num, trigger_idn_num)
(trigger_prec, trigger_rec, trigger_f) = compute_f1(pred_trigger_num, gold_trigger_num, trigger_class_num)
(role_id_prec, role_id_rec, role_id_f) = compute_f1(pred_arg_num, gold_arg_num, arg_idn_num)
(role_prec, role_rec, role_f) = compute_f1(pred_arg_num, gold_arg_num, arg_class_num)
print('Trigger Identification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(trigger_id_prec * 100.0, trigger_id_rec * 100.0, trigger_id_f * 100.0))
print('Trigger Classification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(trigger_prec * 100.0, trigger_rec * 100.0, trigger_f * 100.0))
print('Argument Identification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(role_id_prec * 100.0, role_id_rec * 100.0, role_id_f * 100.0))
print('Argument Classification: P: {:.2f}, R: {:.2f}, F: {:.2f}'.format(role_prec * 100.0, role_rec * 100.0, role_f * 100.0))
scores = {'TC': {'prec': trigger_prec, 'rec': trigger_rec, 'f': trigger_f}, 'TI': {'prec': trigger_id_prec, 'rec': trigger_id_rec, 'f': trigger_id_f}, 'AC': {'prec': role_prec, 'rec': role_rec, 'f': role_f}, 'AI': {'prec': role_id_prec, 'rec': role_id_rec, 'f': role_id_f}}
return scores |
class StakeHolder:
def __init__(self, staker, amount_pending_for_approval, amount_approved, block_no_created):
self._staker = staker
self._amount_pending_for_approval = amount_pending_for_approval
self._amount_approved = amount_approved
self._block_no_created = block_no_created
def to_dict(self):
return {
"staker": self._staker,
"amount_pending_for_approval": self._amount_pending_for_approval,
"amount_approved": self._amount_approved,
"block_no_created": self._block_no_created
}
@property
def staker(self):
return self._staker
@property
def amount_pending_for_approval(self):
return self._amount_pending_for_approval
@property
def amount_approved(self):
return self._amount_approved
@property
def block_no_created(self):
return self._block_no_created
| class Stakeholder:
def __init__(self, staker, amount_pending_for_approval, amount_approved, block_no_created):
self._staker = staker
self._amount_pending_for_approval = amount_pending_for_approval
self._amount_approved = amount_approved
self._block_no_created = block_no_created
def to_dict(self):
return {'staker': self._staker, 'amount_pending_for_approval': self._amount_pending_for_approval, 'amount_approved': self._amount_approved, 'block_no_created': self._block_no_created}
@property
def staker(self):
return self._staker
@property
def amount_pending_for_approval(self):
return self._amount_pending_for_approval
@property
def amount_approved(self):
return self._amount_approved
@property
def block_no_created(self):
return self._block_no_created |
sender = ''
password = ''
smtp_name = 'smtp.gmail.com'
smtp_port = 587
body = """
<html>
<body>
<p>Hi User,<br>
How are you?<br>
</p>
</body>
</html>
"""
receiver = ''
signature_img_name = 'awesome_attachment.png'
signature_img_path = 'C:/Users/user/Desktop/'
attachment_name = signature_img_name
attachment_path = signature_img_path
important_body = '''
<html>
<body>
<p>
It is an e-mail with awesome attachment!<br>
<br>
And here it is</p>
<br>
Best regards,
<br>
<img src="cid:signature_image">
</body>
</html>
'''
| sender = ''
password = ''
smtp_name = 'smtp.gmail.com'
smtp_port = 587
body = '\n<html>\n <body>\n <p>Hi User,<br>\n How are you?<br>\n </p>\n </body>\n</html>\n'
receiver = ''
signature_img_name = 'awesome_attachment.png'
signature_img_path = 'C:/Users/user/Desktop/'
attachment_name = signature_img_name
attachment_path = signature_img_path
important_body = '\n<html>\n<body>\n<p>\nIt is an e-mail with awesome attachment!<br>\n<br>\nAnd here it is</p>\n<br>\nBest regards,\n<br>\n<img src="cid:signature_image">\n</body>\n</html>\n' |
"""
1120. Maximum Average Subtree
Medium
Given the root of a binary tree, find the maximum average value of any subtree of that tree.
(A subtree of a tree is any node of that tree plus all its descendants. The average value of a tree is the sum of its values, divided by the number of nodes.)
Example 1:
Input: [5,6,1]
Output: 6.00000
Explanation:
For the node with value = 5 we have an average of (5 + 6 + 1) / 3 = 4.
For the node with value = 6 we have an average of 6 / 1 = 6.
For the node with value = 1 we have an average of 1 / 1 = 1.
So the answer is 6 which is the maximum.
Note:
The number of nodes in the tree is between 1 and 5000.
Each node will have a value between 0 and 100000.
Answers will be accepted as correct if they are within 10^-5 of the correct answer.
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def maximumAverageSubtree(self, root: TreeNode) -> float:
self.res = 0
def helper(root):
if not root: return [0, 0.0]
n1, s1 = helper(root.left)
n2, s2 = helper(root.right)
n = n1 + n2 + 1
s = s1 + s2 + root.val
self.res = max(self.res, s / n)
return [n, s]
helper(root)
return self.res | """
1120. Maximum Average Subtree
Medium
Given the root of a binary tree, find the maximum average value of any subtree of that tree.
(A subtree of a tree is any node of that tree plus all its descendants. The average value of a tree is the sum of its values, divided by the number of nodes.)
Example 1:
Input: [5,6,1]
Output: 6.00000
Explanation:
For the node with value = 5 we have an average of (5 + 6 + 1) / 3 = 4.
For the node with value = 6 we have an average of 6 / 1 = 6.
For the node with value = 1 we have an average of 1 / 1 = 1.
So the answer is 6 which is the maximum.
Note:
The number of nodes in the tree is between 1 and 5000.
Each node will have a value between 0 and 100000.
Answers will be accepted as correct if they are within 10^-5 of the correct answer.
"""
class Solution:
def maximum_average_subtree(self, root: TreeNode) -> float:
self.res = 0
def helper(root):
if not root:
return [0, 0.0]
(n1, s1) = helper(root.left)
(n2, s2) = helper(root.right)
n = n1 + n2 + 1
s = s1 + s2 + root.val
self.res = max(self.res, s / n)
return [n, s]
helper(root)
return self.res |
# -*- coding: utf-8 -*-
template_model_creation = """import pandas as pd
from sklearn.model_selection import train_test_split
{model_import} as ChosenMLAlgorithm
from sklearn.metrics import accuracy_score, confusion_matrix
import pickle
csv_file = "{csv_file}"
model_file = "{model_file}"
predictors = {predictors}
targets = {targets}
historical_data = pd.read_csv(csv_file)
pred_train, pred_test, tar_train, tar_test = train_test_split(historical_data[predictors], historical_data[targets],
test_size=.3)
if len(targets) == 1:
tar_train = tar_train.values.ravel()
tar_test = tar_test.values.ravel()
model = ChosenMLAlgorithm().fit(pred_train, tar_train)
predictions = model.predict(pred_test)
# Analyze accuracy of prediction.
# Remember that the data is randomly split into training and test set, so the values below will change
# ever time you create a new model
print confusion_matrix(tar_test, predictions)
print accuracy_score(tar_test, predictions)
pickle.dump(model, open(model_file, "wb"))
"""
template_model_predictor = """import pickle
import numpy as np
model_file = "{model_file}"
model = pickle.load(open(model_file, 'rb'))
# input_to_predict has to follow the order below:
# {predictors}
prediction = model.predict(np.array([input_to_predict]))
print prediction
"""
| template_model_creation = 'import pandas as pd\nfrom sklearn.model_selection import train_test_split\n\n{model_import} as ChosenMLAlgorithm\n\nfrom sklearn.metrics import accuracy_score, confusion_matrix\nimport pickle\n\ncsv_file = "{csv_file}"\nmodel_file = "{model_file}"\npredictors = {predictors}\ntargets = {targets}\n\nhistorical_data = pd.read_csv(csv_file)\npred_train, pred_test, tar_train, tar_test = train_test_split(historical_data[predictors], historical_data[targets],\n test_size=.3)\nif len(targets) == 1:\n tar_train = tar_train.values.ravel()\n tar_test = tar_test.values.ravel()\nmodel = ChosenMLAlgorithm().fit(pred_train, tar_train)\n\npredictions = model.predict(pred_test)\n# Analyze accuracy of prediction.\n# Remember that the data is randomly split into training and test set, so the values below will change\n# ever time you create a new model\nprint confusion_matrix(tar_test, predictions)\nprint accuracy_score(tar_test, predictions)\n\npickle.dump(model, open(model_file, "wb"))\n'
template_model_predictor = 'import pickle\n\nimport numpy as np\n\nmodel_file = "{model_file}"\nmodel = pickle.load(open(model_file, \'rb\'))\n\n# input_to_predict has to follow the order below:\n# {predictors}\nprediction = model.predict(np.array([input_to_predict]))\nprint prediction\n' |
my_variabel = "hai darmawan"
for variabel_baru in my_variabel:
print("for string: ",variabel_baru)
my_list =["aku", "kamu", "dia"]
my_tuple=(1,5,6,7)
for variabel_baru3 in my_tuple:
print("for list or tuple", variabel_baru3)
| my_variabel = 'hai darmawan'
for variabel_baru in my_variabel:
print('for string: ', variabel_baru)
my_list = ['aku', 'kamu', 'dia']
my_tuple = (1, 5, 6, 7)
for variabel_baru3 in my_tuple:
print('for list or tuple', variabel_baru3) |
def main():
x=11
y=2
print("Addition X+Y=",x+y)
print("Subtraction X-Y=",x-y)
print("Multiplication X*Y=",x*y)
print("Division X/Y=",x/y)
print("Modulus X%Y=",x%y)
print("Exponent X**Y=",x**y)
print("Floor Division X//Y=",x//y)
if __name__ == '__main__':
main()
| def main():
x = 11
y = 2
print('Addition X+Y=', x + y)
print('Subtraction X-Y=', x - y)
print('Multiplication X*Y=', x * y)
print('Division X/Y=', x / y)
print('Modulus X%Y=', x % y)
print('Exponent X**Y=', x ** y)
print('Floor Division X//Y=', x // y)
if __name__ == '__main__':
main() |
def test_screen_two():
for num in range(0, 100):
col = int(num * 0.01 * 2.0)
y = (num * 0.01 - float(col) / 2.0) * 2.0
newY = y / 960.0 * 480.0 + 1.0 / 4.0
print('col:' + str(col) + ' num: ' + str(num) + ' y: ' + str(y) + ' newY: ' + str(newY))
# print(str(newY))
def test_scale():
for num in range(0, 100):
col = num * 0.01
textureCoordinateToUse = col - 0.5
use = textureCoordinateToUse / 1.5
newUse = use + 0.5
print(' textureCoordinateToUse: ' + str(textureCoordinateToUse)[0:5] + ' use: ' + str(use)[0:5] + ' newUse: ' + str(newUse)[0:5] + ' ' + str(col / 1.5)[0:5])
if __name__ == "__main__":
test_scale()
# test_screen_two()
| def test_screen_two():
for num in range(0, 100):
col = int(num * 0.01 * 2.0)
y = (num * 0.01 - float(col) / 2.0) * 2.0
new_y = y / 960.0 * 480.0 + 1.0 / 4.0
print('col:' + str(col) + ' num: ' + str(num) + ' y: ' + str(y) + ' newY: ' + str(newY))
def test_scale():
for num in range(0, 100):
col = num * 0.01
texture_coordinate_to_use = col - 0.5
use = textureCoordinateToUse / 1.5
new_use = use + 0.5
print(' textureCoordinateToUse: ' + str(textureCoordinateToUse)[0:5] + ' use: ' + str(use)[0:5] + ' newUse: ' + str(newUse)[0:5] + ' ' + str(col / 1.5)[0:5])
if __name__ == '__main__':
test_scale() |
__project__ = "o3seespy"
__author__ = "Maxim Millen & Minjie Zhu"
__version__ = "3.1.0.18"
__license__ = "MIT with OpenSees License"
| __project__ = 'o3seespy'
__author__ = 'Maxim Millen & Minjie Zhu'
__version__ = '3.1.0.18'
__license__ = 'MIT with OpenSees License' |
# By Kami Bigdely
# Decompose conditional: You have a complicated conditional(if-then-else) statement. Extract
# methods from the condition, then part, and else part(s).
def make_alert_sound():
print('made alert sound.')
def make_accept_sound():
print('made acceptance sound')
def check_if_toxin(ingredients):
"""Checks if any of the ingredients are in the list of toxic ingrediets"""
toxic_indredients = ['sodium nitrate', 'sodium benzoate', 'sodium oxide']
return any(item in ingredients for item in toxic_indredients)
ingredients = ['sodium benzoate']
if check_if_toxin(ingredients):
print('!!!')
print('there is a toxin in the food!')
print('!!!')
make_alert_sound()
else:
print('***')
print('Toxin Free')
print('***')
make_accept_sound() | def make_alert_sound():
print('made alert sound.')
def make_accept_sound():
print('made acceptance sound')
def check_if_toxin(ingredients):
"""Checks if any of the ingredients are in the list of toxic ingrediets"""
toxic_indredients = ['sodium nitrate', 'sodium benzoate', 'sodium oxide']
return any((item in ingredients for item in toxic_indredients))
ingredients = ['sodium benzoate']
if check_if_toxin(ingredients):
print('!!!')
print('there is a toxin in the food!')
print('!!!')
make_alert_sound()
else:
print('***')
print('Toxin Free')
print('***')
make_accept_sound() |
class MyClass:
def __init__(self):
self.var = 'var'
def method(self):
print('method')
x = MyClass()
x.method()
m = x.method
m()
| class Myclass:
def __init__(self):
self.var = 'var'
def method(self):
print('method')
x = my_class()
x.method()
m = x.method
m() |
'''
@author: l4zyc0d3r
People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt
'''
class Solution:
def kthFactor(self, n: int, k: int) -> int:
for i in range(1, n+1):
if n % i == 0:
k-=1
if k == 0: return i
return -1
| """
@author: l4zyc0d3r
People who are happy makes other happy. I am gonna finish it slowly but definitely.cdt
"""
class Solution:
def kth_factor(self, n: int, k: int) -> int:
for i in range(1, n + 1):
if n % i == 0:
k -= 1
if k == 0:
return i
return -1 |
"""This is the calculation class / abstraction class"""
class Calculation:
"""Creates the Calculation parent class for the arithmetic subclasses"""
# pylint: disable=bad-option-value, too-few-public-methods
def __init__(self, values: tuple):
"""Constructor Method"""
self.values = Calculation.convert_to_float(values)
@classmethod
def create(cls, values: tuple):
"""Creates an object"""
return cls(values)
@staticmethod
def convert_to_float(values):
"""Converts the values passed to function into float values in a list"""
list_of_floats = []
for item in values:
list_of_floats.append(float(item))
return tuple(list_of_floats)
| """This is the calculation class / abstraction class"""
class Calculation:
"""Creates the Calculation parent class for the arithmetic subclasses"""
def __init__(self, values: tuple):
"""Constructor Method"""
self.values = Calculation.convert_to_float(values)
@classmethod
def create(cls, values: tuple):
"""Creates an object"""
return cls(values)
@staticmethod
def convert_to_float(values):
"""Converts the values passed to function into float values in a list"""
list_of_floats = []
for item in values:
list_of_floats.append(float(item))
return tuple(list_of_floats) |
_base_ = [
'../_base_/datasets/nus-mono3d.py', '../_base_/models/fcos3d.py',
'../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py'
]
# model settings
model = dict(
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
# frozen_stages=1,
frozen_stages=1,
norm_cfg=dict(type='SyncBN', requires_grad=True),
# norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=False,
# norm_eval=True,
style='pytorch',
# style='caffe'
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, False, True, True)
))
class_names = [
'car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle',
'motorcycle', 'pedestrian', 'traffic_cone', 'barrier'
]
img_norm_cfg = dict(
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_pipeline = [
dict(type='LoadImageFromFileMono3D'),
dict(
type='LoadAnnotations3D',
with_bbox=True,
with_label=True,
with_attr_label=True,
with_bbox_3d=True,
with_label_3d=True,
with_bbox_depth=True),
dict(type='Resize', img_scale=(1600, 900), keep_ratio=True),
dict(type='RandomFlip3D', flip_ratio_bev_horizontal=0.5),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle3D', class_names=class_names),
dict(
type='Collect3D',
keys=[
'img', 'gt_bboxes', 'gt_labels', 'attr_labels', 'gt_bboxes_3d',
'gt_labels_3d', 'centers2d', 'depths'
]),
]
test_pipeline = [
dict(type='LoadImageFromFileMono3D'),
dict(
type='MultiScaleFlipAug',
scale_factor=1.0,
flip=False,
transforms=[
dict(type='RandomFlip3D'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(
type='DefaultFormatBundle3D',
class_names=class_names,
with_label=False),
dict(type='Collect3D', keys=['img']),
])
]
data = dict(
samples_per_gpu=8,
workers_per_gpu=8,
train=dict(pipeline=train_pipeline),
val=dict(pipeline=test_pipeline),
test=dict(pipeline=test_pipeline))
# optimizer
optimizer = dict(
lr=0.008, paramwise_cfg=dict(bias_lr_mult=2., bias_decay_mult=0.))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
# warmup_iters=1500, # for moco
warmup_ratio=1.0 / 3,
step=[8, 11])
total_epochs = 12
evaluation = dict(interval=2)
# load_from=None
# load_from='checkpoints/waymo_ep50_with_backbone.pth'
# load_from='checkpoints/imgsup_finetune_waymo_ep1_with_backbone.pth'
# load_from='checkpoints/resnet50-19c8e357_convert_mono3d.pth'
# load_from='checkpoints/imgsup_finetune_waymo_ep5_with_backbone_repro.pth'
# load_from='checkpoints/imgsup_finetune_waymo_ep5_with_backbone_moco.pth'
# load_from=None
# load_from='checkpoints/mono3d_waymo_half.pth'
# load_from='checkpoints/mono3d_waymo_oneten.pth'
load_from='checkpoints/mono3d_waymo_full.pth'
# load_from='checkpoints/mono3d_waymo_onefive.pth'
| _base_ = ['../_base_/datasets/nus-mono3d.py', '../_base_/models/fcos3d.py', '../_base_/schedules/mmdet_schedule_1x.py', '../_base_/default_runtime.py']
model = dict(backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, style='pytorch', dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False), stage_with_dcn=(False, False, True, True)))
class_names = ['car', 'truck', 'trailer', 'bus', 'construction_vehicle', 'bicycle', 'motorcycle', 'pedestrian', 'traffic_cone', 'barrier']
img_norm_cfg = dict(mean=[103.53, 116.28, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_pipeline = [dict(type='LoadImageFromFileMono3D'), dict(type='LoadAnnotations3D', with_bbox=True, with_label=True, with_attr_label=True, with_bbox_3d=True, with_label_3d=True, with_bbox_depth=True), dict(type='Resize', img_scale=(1600, 900), keep_ratio=True), dict(type='RandomFlip3D', flip_ratio_bev_horizontal=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle3D', class_names=class_names), dict(type='Collect3D', keys=['img', 'gt_bboxes', 'gt_labels', 'attr_labels', 'gt_bboxes_3d', 'gt_labels_3d', 'centers2d', 'depths'])]
test_pipeline = [dict(type='LoadImageFromFileMono3D'), dict(type='MultiScaleFlipAug', scale_factor=1.0, flip=False, transforms=[dict(type='RandomFlip3D'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle3D', class_names=class_names, with_label=False), dict(type='Collect3D', keys=['img'])])]
data = dict(samples_per_gpu=8, workers_per_gpu=8, train=dict(pipeline=train_pipeline), val=dict(pipeline=test_pipeline), test=dict(pipeline=test_pipeline))
optimizer = dict(lr=0.008, paramwise_cfg=dict(bias_lr_mult=2.0, bias_decay_mult=0.0))
optimizer_config = dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
lr_config = dict(policy='step', warmup='linear', warmup_iters=500, warmup_ratio=1.0 / 3, step=[8, 11])
total_epochs = 12
evaluation = dict(interval=2)
load_from = 'checkpoints/mono3d_waymo_full.pth' |
#! /usr/bin/env python3
def main():
languages = {
"Python": "Guido van Rossum",
"Ruby": "Yukihiro Matsumoto",
"PHP": "Rasmus Lerdorf"
}
for each in languages:
print(each + " was created by " + languages[each])
if __name__ == "__main__":
main() | def main():
languages = {'Python': 'Guido van Rossum', 'Ruby': 'Yukihiro Matsumoto', 'PHP': 'Rasmus Lerdorf'}
for each in languages:
print(each + ' was created by ' + languages[each])
if __name__ == '__main__':
main() |
ziehungen = input().split(",")
ziehungen = [int(x) for x in ziehungen]
boards = []
while True:
leer = input()
zeile = [input().split(" ")]
zeile[0] = [int(x) for x in zeile[0] if x != '']
if zeile[0] != []:
for i in range(1,5):
zeile.append(input().split(" "))
zeile[i] = [int(x) for x in zeile[i] if x != '']
boards.append([zeile[0], zeile[1], zeile[2], zeile[3], zeile[4]])
else:
break
gewinn_brett = ''
for n in range(len(ziehungen)):
letzte_zahl = ziehungen[n-1]
if gewinn_brett != '':
break
for i in range(len(boards)):
for ii in range(5):
for iii in range(5):
if boards[i][ii][iii] == ziehungen[n]:
boards[i][ii][iii] = "x"
for i in range(len(boards)):
if gewinn_brett != '':
break
for ii in range(5):
nicht_x = False
for iii in range(5):
if boards[i][ii][iii] != "x":
nicht_x = True
if nicht_x == False:
gewinn_brett = i
break
for i in range(len(boards)):
if gewinn_brett != '':
break
for ii in range(5):
nicht_x = False
for iii in range(5):
if boards[i][iii][ii] != "x":
nicht_x = True
if nicht_x == False:
gewinn_brett = i
break
summe_unmarkierter = 0
for i in range(5):
for ii in range(5):
if boards[gewinn_brett][i][ii] != "x":
summe_unmarkierter += boards[gewinn_brett][i][ii]
print(summe_unmarkierter * letzte_zahl)
| ziehungen = input().split(',')
ziehungen = [int(x) for x in ziehungen]
boards = []
while True:
leer = input()
zeile = [input().split(' ')]
zeile[0] = [int(x) for x in zeile[0] if x != '']
if zeile[0] != []:
for i in range(1, 5):
zeile.append(input().split(' '))
zeile[i] = [int(x) for x in zeile[i] if x != '']
boards.append([zeile[0], zeile[1], zeile[2], zeile[3], zeile[4]])
else:
break
gewinn_brett = ''
for n in range(len(ziehungen)):
letzte_zahl = ziehungen[n - 1]
if gewinn_brett != '':
break
for i in range(len(boards)):
for ii in range(5):
for iii in range(5):
if boards[i][ii][iii] == ziehungen[n]:
boards[i][ii][iii] = 'x'
for i in range(len(boards)):
if gewinn_brett != '':
break
for ii in range(5):
nicht_x = False
for iii in range(5):
if boards[i][ii][iii] != 'x':
nicht_x = True
if nicht_x == False:
gewinn_brett = i
break
for i in range(len(boards)):
if gewinn_brett != '':
break
for ii in range(5):
nicht_x = False
for iii in range(5):
if boards[i][iii][ii] != 'x':
nicht_x = True
if nicht_x == False:
gewinn_brett = i
break
summe_unmarkierter = 0
for i in range(5):
for ii in range(5):
if boards[gewinn_brett][i][ii] != 'x':
summe_unmarkierter += boards[gewinn_brett][i][ii]
print(summe_unmarkierter * letzte_zahl) |
def insertion_sort(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while(j>=0 and arr[j]>key):
arr[j+1]=arr[j]
j = j - 1
arr[j+1] = key
return arr
def main():
arr = [6, 5, 8, 9, 3, 1, 4, 7, 2]
sorted_arr = insertion_sort(arr)
for i in sorted_arr:
print(i, end=" ")
if __name__ == "__main__":
main() | def insertion_sort(arr):
for i in range(1, len(arr)):
key = arr[i]
j = i - 1
while j >= 0 and arr[j] > key:
arr[j + 1] = arr[j]
j = j - 1
arr[j + 1] = key
return arr
def main():
arr = [6, 5, 8, 9, 3, 1, 4, 7, 2]
sorted_arr = insertion_sort(arr)
for i in sorted_arr:
print(i, end=' ')
if __name__ == '__main__':
main() |
"""
This module contains all the submodules for the handybeam software package.
"""
name = "handybeam"
__all__ = [
'bugcatcher',
'cl_system',
'evaluators',
'misc',
'solver',
'translator',
'tx_array',
'tx_array_library',
'visiualize',
'world',
'cl',
'cl_py_ref_code',
'opencl_wrappers',
'propagator_mixins',
'samplers',
'solver_mixins',
'translator_mixins'
]
| """
This module contains all the submodules for the handybeam software package.
"""
name = 'handybeam'
__all__ = ['bugcatcher', 'cl_system', 'evaluators', 'misc', 'solver', 'translator', 'tx_array', 'tx_array_library', 'visiualize', 'world', 'cl', 'cl_py_ref_code', 'opencl_wrappers', 'propagator_mixins', 'samplers', 'solver_mixins', 'translator_mixins'] |
#
# PySNMP MIB module DNS-SERVER-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/DNS-SERVER-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:08:40 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( Integer, OctetString, ObjectIdentifier, ) = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection")
( NotificationGroup, ObjectGroup, ModuleCompliance, ) = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
( IpAddress, iso, Counter32, ObjectIdentity, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, Unsigned32, mib_2, Integer32, Gauge32, ModuleIdentity, TimeTicks, MibIdentifier, ) = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "iso", "Counter32", "ObjectIdentity", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "Unsigned32", "mib-2", "Integer32", "Gauge32", "ModuleIdentity", "TimeTicks", "MibIdentifier")
( TruthValue, TextualConvention, RowStatus, DisplayString, ) = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "RowStatus", "DisplayString")
dns = ObjectIdentity((1, 3, 6, 1, 2, 1, 32))
if mibBuilder.loadTexts: dns.setDescription('The OID assigned to DNS MIB work by the IANA.')
dnsServMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 32, 1))
if mibBuilder.loadTexts: dnsServMIB.setLastUpdated('9401282251Z')
if mibBuilder.loadTexts: dnsServMIB.setOrganization('IETF DNS Working Group')
if mibBuilder.loadTexts: dnsServMIB.setContactInfo(' Rob Austein\n Postal: Epilogue Technology Corporation\n 268 Main Street, Suite 283\n North Reading, MA 10864\n US\n Tel: +1 617 245 0804\n Fax: +1 617 245 8122\n E-Mail: sra@epilogue.com\n\n Jon Saperia\n Postal: Digital Equipment Corporation\n 110 Spit Brook Road\n ZKO1-3/H18\n Nashua, NH 03062-2698\n US\n Tel: +1 603 881 0480\n Fax: +1 603 881 0120\n Email: saperia@zko.dec.com')
if mibBuilder.loadTexts: dnsServMIB.setDescription('The MIB module for entities implementing the server side\n of the Domain Name System (DNS) protocol.')
dnsServMIBObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1))
dnsServConfig = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 1))
dnsServCounter = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 2))
dnsServOptCounter = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 3))
dnsServZone = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 4))
class DnsName(OctetString, TextualConvention):
subtypeSpec = OctetString.subtypeSpec+ValueSizeConstraint(0,255)
class DnsNameAsIndex(DnsName, TextualConvention):
pass
class DnsClass(Integer32, TextualConvention):
displayHint = '2d'
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535)
class DnsType(Integer32, TextualConvention):
displayHint = '2d'
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535)
class DnsQClass(Integer32, TextualConvention):
displayHint = '2d'
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535)
class DnsQType(Integer32, TextualConvention):
displayHint = '2d'
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,65535)
class DnsTime(Gauge32, TextualConvention):
displayHint = '4d'
class DnsOpCode(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,15)
class DnsRespCode(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+ValueRangeConstraint(0,15)
dnsServConfigImplementIdent = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServConfigImplementIdent.setDescription("The implementation identification string for the DNS\n server software in use on the system, for example;\n `FNS-2.1'")
dnsServConfigRecurs = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("available", 1), ("restricted", 2), ("unavailable", 3),))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dnsServConfigRecurs.setDescription('This represents the recursion services offered by this\n name server. The values that can be read or written\n are:\n\n available(1) - performs recursion on requests from\n clients.\n\n restricted(2) - recursion is performed on requests only\n from certain clients, for example; clients on an access\n control list.\n\n unavailable(3) - recursion is not available.')
dnsServConfigUpTime = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 3), DnsTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServConfigUpTime.setDescription('If the server has a persistent state (e.g., a process),\n this value will be the time elapsed since it started.\n For software without persistant state, this value will\n be zero.')
dnsServConfigResetTime = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 4), DnsTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServConfigResetTime.setDescription("If the server has a persistent state (e.g., a process)\n and supports a `reset' operation (e.g., can be told to\n re-read configuration files), this value will be the\n time elapsed since the last time the name server was\n `reset.' For software that does not have persistence or\n does not support a `reset' operation, this value will be\n zero.")
dnsServConfigReset = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4,))).clone(namedValues=NamedValues(("other", 1), ("reset", 2), ("initializing", 3), ("running", 4),))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dnsServConfigReset.setDescription('Status/action object to reinitialize any persistant name\n server state. When set to reset(2), any persistant\n name server state (such as a process) is reinitialized as\n if the name server had just been started. This value\n will never be returned by a read operation. When read,\n one of the following values will be returned:\n other(1) - server in some unknown state;\n initializing(3) - server (re)initializing;\n running(4) - server currently running.')
dnsServCounterAuthAns = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterAuthAns.setDescription('Number of queries which were authoritatively answered.')
dnsServCounterAuthNoNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterAuthNoNames.setDescription("Number of queries for which `authoritative no such name'\n responses were made.")
dnsServCounterAuthNoDataResps = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterAuthNoDataResps.setDescription("Number of queries for which `authoritative no such data'\n (empty answer) responses were made.")
dnsServCounterNonAuthDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterNonAuthDatas.setDescription('Number of queries which were non-authoritatively\n answered (cached data).')
dnsServCounterNonAuthNoDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterNonAuthNoDatas.setDescription('Number of queries which were non-authoritatively\n answered with no data (empty answer).')
dnsServCounterReferrals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterReferrals.setDescription('Number of requests that were referred to other servers.')
dnsServCounterErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterErrors.setDescription('Number of requests the server has processed that were\n answered with errors (RCODE values other than 0 and 3).')
dnsServCounterRelNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterRelNames.setDescription('Number of requests received by the server for names that\n are only 1 label long (text form - no internal dots).')
dnsServCounterReqRefusals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterReqRefusals.setDescription('Number of DNS requests refused by the server.')
dnsServCounterReqUnparses = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterReqUnparses.setDescription('Number of requests received which were unparseable.')
dnsServCounterOtherErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterOtherErrors.setDescription('Number of requests which were aborted for other (local)\n server errors.')
dnsServCounterTable = MibTable((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13), )
if mibBuilder.loadTexts: dnsServCounterTable.setDescription('Counter information broken down by DNS class and type.')
dnsServCounterEntry = MibTableRow((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1), ).setIndexNames((0, "DNS-SERVER-MIB", "dnsServCounterOpCode"), (0, "DNS-SERVER-MIB", "dnsServCounterQClass"), (0, "DNS-SERVER-MIB", "dnsServCounterQType"), (0, "DNS-SERVER-MIB", "dnsServCounterTransport"))
if mibBuilder.loadTexts: dnsServCounterEntry.setDescription("This table contains count information for each DNS class\n and type value known to the server. The index allows\n management software to to create indices to the table to\n get the specific information desired, e.g., number of\n queries over UDP for records with type value `A' which\n came to this server. In order to prevent an\n uncontrolled expansion of rows in the table; if\n dnsServCounterRequests is 0 and dnsServCounterResponses\n is 0, then the row does not exist and `no such' is\n returned when the agent is queried for such instances.")
dnsServCounterOpCode = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 1), DnsOpCode())
if mibBuilder.loadTexts: dnsServCounterOpCode.setDescription('The DNS OPCODE being counted in this row of the table.')
dnsServCounterQClass = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 2), DnsClass())
if mibBuilder.loadTexts: dnsServCounterQClass.setDescription('The class of record being counted in this row of the\n table.')
dnsServCounterQType = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 3), DnsType())
if mibBuilder.loadTexts: dnsServCounterQType.setDescription('The type of record which is being counted in this row in\n the table.')
dnsServCounterTransport = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3,))).clone(namedValues=NamedValues(("udp", 1), ("tcp", 2), ("other", 3),)))
if mibBuilder.loadTexts: dnsServCounterTransport.setDescription('A value of udp(1) indicates that the queries reported on\n this row were sent using UDP.\n\n A value of tcp(2) indicates that the queries reported on\n this row were sent using TCP.\n\n A value of other(3) indicates that the queries reported\n on this row were sent using a transport that was neither\n TCP nor UDP.')
dnsServCounterRequests = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterRequests.setDescription('Number of requests (queries) that have been recorded in\n this row of the table.')
dnsServCounterResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServCounterResponses.setDescription('Number of responses made by the server since\n initialization for the kind of query identified on this\n row of the table.')
dnsServOptCounterSelfAuthAns = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfAuthAns.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative answer.')
dnsServOptCounterSelfAuthNoNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfAuthNoNames.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative no such name answer\n given.')
dnsServOptCounterSelfAuthNoDataResps = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfAuthNoDataResps.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative no such data answer\n (empty answer) made.')
dnsServOptCounterSelfNonAuthDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfNonAuthDatas.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which a\n non-authoritative answer (cached data) was made.')
dnsServOptCounterSelfNonAuthNoDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfNonAuthNoDatas.setDescription("Number of requests the server has processed which\n originated from a resolver on the same host for which a\n `non-authoritative, no such data' response was made\n (empty answer).")
dnsServOptCounterSelfReferrals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfReferrals.setDescription('Number of queries the server has processed which\n originated from a resolver on the same host and were\n referred to other servers.')
dnsServOptCounterSelfErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfErrors.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host which have\n been answered with errors (RCODEs other than 0 and 3).')
dnsServOptCounterSelfRelNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfRelNames.setDescription('Number of requests received for names that are only 1\n label long (text form - no internal dots) the server has\n processed which originated from a resolver on the same\n host.')
dnsServOptCounterSelfReqRefusals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfReqRefusals.setDescription('Number of DNS requests refused by the server which\n originated from a resolver on the same host.')
dnsServOptCounterSelfReqUnparses = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfReqUnparses.setDescription('Number of requests received which were unparseable and\n which originated from a resolver on the same host.')
dnsServOptCounterSelfOtherErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterSelfOtherErrors.setDescription('Number of requests which were aborted for other (local)\n server errors and which originated on the same host.')
dnsServOptCounterFriendsAuthAns = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsAuthAns.setDescription('Number of queries originating from friends which were\n authoritatively answered. The definition of friends is\n a locally defined matter.')
dnsServOptCounterFriendsAuthNoNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsAuthNoNames.setDescription("Number of queries originating from friends, for which\n authoritative `no such name' responses were made. The\n definition of friends is a locally defined matter.")
dnsServOptCounterFriendsAuthNoDataResps = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsAuthNoDataResps.setDescription('Number of queries originating from friends for which\n authoritative no such data (empty answer) responses were\n made. The definition of friends is a locally defined\n matter.')
dnsServOptCounterFriendsNonAuthDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsNonAuthDatas.setDescription('Number of queries originating from friends which were\n non-authoritatively answered (cached data). The\n definition of friends is a locally defined matter.')
dnsServOptCounterFriendsNonAuthNoDatas = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsNonAuthNoDatas.setDescription('Number of queries originating from friends which were\n non-authoritatively answered with no such data (empty\n answer).')
dnsServOptCounterFriendsReferrals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsReferrals.setDescription('Number of requests which originated from friends that\n were referred to other servers. The definition of\n friends is a locally defined matter.')
dnsServOptCounterFriendsErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsErrors.setDescription('Number of requests the server has processed which\n originated from friends and were answered with errors\n (RCODE values other than 0 and 3). The definition of\n friends is a locally defined matter.')
dnsServOptCounterFriendsRelNames = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsRelNames.setDescription('Number of requests received for names from friends that\n are only 1 label long (text form - no internal dots) the\n server has processed.')
dnsServOptCounterFriendsReqRefusals = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsReqRefusals.setDescription("Number of DNS requests refused by the server which were\n received from `friends'.")
dnsServOptCounterFriendsReqUnparses = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsReqUnparses.setDescription("Number of requests received which were unparseable and\n which originated from `friends'.")
dnsServOptCounterFriendsOtherErrors = MibScalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServOptCounterFriendsOtherErrors.setDescription("Number of requests which were aborted for other (local)\n server errors and which originated from `friends'.")
dnsServZoneTable = MibTable((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1), )
if mibBuilder.loadTexts: dnsServZoneTable.setDescription("Table of zones for which this name server provides\n information. Each of the zones may be loaded from stable\n storage via an implementation-specific mechanism or may\n be obtained from another name server via a zone transfer.\n\n If name server doesn't load any zones, this table is\n empty.")
dnsServZoneEntry = MibTableRow((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1), ).setIndexNames((0, "DNS-SERVER-MIB", "dnsServZoneName"), (0, "DNS-SERVER-MIB", "dnsServZoneClass"))
if mibBuilder.loadTexts: dnsServZoneEntry.setDescription('An entry in the name server zone table. New rows may be\n added either via SNMP or by the name server itself.')
dnsServZoneName = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 1), DnsNameAsIndex())
if mibBuilder.loadTexts: dnsServZoneName.setDescription("DNS name of the zone described by this row of the table.\n This is the owner name of the SOA RR that defines the\n top of the zone. This is name is in uppercase:\n characters 'a' through 'z' are mapped to 'A' through 'Z'\n in order to make the lexical ordering useful.")
dnsServZoneClass = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 2), DnsClass())
if mibBuilder.loadTexts: dnsServZoneClass.setDescription('DNS class of the RRs in this zone.')
dnsServZoneLastReloadSuccess = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 3), DnsTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServZoneLastReloadSuccess.setDescription('Elapsed time in seconds since last successful reload of\n this zone.')
dnsServZoneLastReloadAttempt = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 4), DnsTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServZoneLastReloadAttempt.setDescription('Elapsed time in seconds since last attempted reload of\n this zone.')
dnsServZoneLastSourceAttempt = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 5), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServZoneLastSourceAttempt.setDescription('IP address of host from which most recent zone transfer\n of this zone was attempted. This value should match the\n value of dnsServZoneSourceSuccess if the attempt was\n succcessful. If zone transfer has not been attempted\n within the memory of this name server, this value should\n be 0.0.0.0.')
dnsServZoneStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: dnsServZoneStatus.setDescription('The status of the information represented in this row of\n the table.')
dnsServZoneSerial = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServZoneSerial.setDescription('Zone serial number (from the SOA RR) of the zone\n represented by this row of the table. If the zone has\n not been successfully loaded within the memory of this\n name server, the value of this variable is zero.')
dnsServZoneCurrent = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServZoneCurrent.setDescription("Whether the server's copy of the zone represented by\n this row of the table is currently valid. If the zone\n has never been successfully loaded or has expired since\n it was last succesfully loaded, this variable will have\n the value false(2), otherwise this variable will have\n the value true(1).")
dnsServZoneLastSourceSuccess = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 9), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dnsServZoneLastSourceSuccess.setDescription('IP address of host which was the source of the most\n recent successful zone transfer for this zone. If\n unknown (e.g., zone has never been successfully\n transfered) or irrelevant (e.g., zone was loaded from\n stable storage), this value should be 0.0.0.0.')
dnsServZoneSrcTable = MibTable((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2), )
if mibBuilder.loadTexts: dnsServZoneSrcTable.setDescription('This table is a list of IP addresses from which the\n server will attempt to load zone information using DNS\n zone transfer operations. A reload may occur due to SNMP\n operations that create a row in dnsServZoneTable or a\n SET to object dnsServZoneReload. This table is only\n used when the zone is loaded via zone transfer.')
dnsServZoneSrcEntry = MibTableRow((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1), ).setIndexNames((0, "DNS-SERVER-MIB", "dnsServZoneSrcName"), (0, "DNS-SERVER-MIB", "dnsServZoneSrcClass"), (0, "DNS-SERVER-MIB", "dnsServZoneSrcAddr"))
if mibBuilder.loadTexts: dnsServZoneSrcEntry.setDescription('An entry in the name server zone source table.')
dnsServZoneSrcName = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 1), DnsNameAsIndex())
if mibBuilder.loadTexts: dnsServZoneSrcName.setDescription('DNS name of the zone to which this entry applies.')
dnsServZoneSrcClass = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 2), DnsClass())
if mibBuilder.loadTexts: dnsServZoneSrcClass.setDescription('DNS class of zone to which this entry applies.')
dnsServZoneSrcAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 3), IpAddress())
if mibBuilder.loadTexts: dnsServZoneSrcAddr.setDescription('IP address of name server host from which this zone\n might be obtainable.')
dnsServZoneSrcStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 4), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: dnsServZoneSrcStatus.setDescription('The status of the information represented in this row of\n the table.')
dnsServMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 2))
dnsServConfigGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 1)).setObjects(*(("DNS-SERVER-MIB", "dnsServConfigImplementIdent"), ("DNS-SERVER-MIB", "dnsServConfigRecurs"), ("DNS-SERVER-MIB", "dnsServConfigUpTime"), ("DNS-SERVER-MIB", "dnsServConfigResetTime"), ("DNS-SERVER-MIB", "dnsServConfigReset"),))
if mibBuilder.loadTexts: dnsServConfigGroup.setDescription('A collection of objects providing basic configuration\n control of a DNS name server.')
dnsServCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 2)).setObjects(*(("DNS-SERVER-MIB", "dnsServCounterAuthAns"), ("DNS-SERVER-MIB", "dnsServCounterAuthNoNames"), ("DNS-SERVER-MIB", "dnsServCounterAuthNoDataResps"), ("DNS-SERVER-MIB", "dnsServCounterNonAuthDatas"), ("DNS-SERVER-MIB", "dnsServCounterNonAuthNoDatas"), ("DNS-SERVER-MIB", "dnsServCounterReferrals"), ("DNS-SERVER-MIB", "dnsServCounterErrors"), ("DNS-SERVER-MIB", "dnsServCounterRelNames"), ("DNS-SERVER-MIB", "dnsServCounterReqRefusals"), ("DNS-SERVER-MIB", "dnsServCounterReqUnparses"), ("DNS-SERVER-MIB", "dnsServCounterOtherErrors"), ("DNS-SERVER-MIB", "dnsServCounterOpCode"), ("DNS-SERVER-MIB", "dnsServCounterQClass"), ("DNS-SERVER-MIB", "dnsServCounterQType"), ("DNS-SERVER-MIB", "dnsServCounterTransport"), ("DNS-SERVER-MIB", "dnsServCounterRequests"), ("DNS-SERVER-MIB", "dnsServCounterResponses"),))
if mibBuilder.loadTexts: dnsServCounterGroup.setDescription('A collection of objects providing basic instrumentation\n of a DNS name server.')
dnsServOptCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 3)).setObjects(*(("DNS-SERVER-MIB", "dnsServOptCounterSelfAuthAns"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfAuthNoNames"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfAuthNoDataResps"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfNonAuthDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfNonAuthNoDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfReferrals"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfErrors"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfRelNames"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfReqRefusals"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfReqUnparses"), ("DNS-SERVER-MIB", "dnsServOptCounterSelfOtherErrors"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsAuthAns"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsAuthNoNames"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsAuthNoDataResps"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsNonAuthDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsNonAuthNoDatas"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsReferrals"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsErrors"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsRelNames"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsReqRefusals"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsReqUnparses"), ("DNS-SERVER-MIB", "dnsServOptCounterFriendsOtherErrors"),))
if mibBuilder.loadTexts: dnsServOptCounterGroup.setDescription('A collection of objects providing extended\n instrumentation of a DNS name server.')
dnsServZoneGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 32, 1, 2, 4)).setObjects(*(("DNS-SERVER-MIB", "dnsServZoneName"), ("DNS-SERVER-MIB", "dnsServZoneClass"), ("DNS-SERVER-MIB", "dnsServZoneLastReloadSuccess"), ("DNS-SERVER-MIB", "dnsServZoneLastReloadAttempt"), ("DNS-SERVER-MIB", "dnsServZoneLastSourceAttempt"), ("DNS-SERVER-MIB", "dnsServZoneLastSourceSuccess"), ("DNS-SERVER-MIB", "dnsServZoneStatus"), ("DNS-SERVER-MIB", "dnsServZoneSerial"), ("DNS-SERVER-MIB", "dnsServZoneCurrent"), ("DNS-SERVER-MIB", "dnsServZoneSrcName"), ("DNS-SERVER-MIB", "dnsServZoneSrcClass"), ("DNS-SERVER-MIB", "dnsServZoneSrcAddr"), ("DNS-SERVER-MIB", "dnsServZoneSrcStatus"),))
if mibBuilder.loadTexts: dnsServZoneGroup.setDescription('A collection of objects providing configuration control\n of a DNS name server which loads authoritative zones.')
dnsServMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 32, 1, 3))
dnsServMIBCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 32, 1, 3, 1)).setObjects(*(("DNS-SERVER-MIB", "dnsServConfigGroup"), ("DNS-SERVER-MIB", "dnsServCounterGroup"), ("DNS-SERVER-MIB", "dnsServOptCounterGroup"), ("DNS-SERVER-MIB", "dnsServZoneGroup"),))
if mibBuilder.loadTexts: dnsServMIBCompliance.setDescription('The compliance statement for agents implementing the DNS\n name server MIB extensions.')
mibBuilder.exportSymbols("DNS-SERVER-MIB", dnsServOptCounterSelfAuthNoDataResps=dnsServOptCounterSelfAuthNoDataResps, dnsServMIBCompliances=dnsServMIBCompliances, dnsServOptCounterSelfAuthNoNames=dnsServOptCounterSelfAuthNoNames, dnsServOptCounterSelfReqUnparses=dnsServOptCounterSelfReqUnparses, dnsServConfig=dnsServConfig, dnsServCounterReqUnparses=dnsServCounterReqUnparses, dnsServOptCounterSelfRelNames=dnsServOptCounterSelfRelNames, DnsName=DnsName, dnsServConfigRecurs=dnsServConfigRecurs, dnsServCounterTable=dnsServCounterTable, dnsServCounterOtherErrors=dnsServCounterOtherErrors, dnsServOptCounterFriendsRelNames=dnsServOptCounterFriendsRelNames, dnsServOptCounterSelfNonAuthNoDatas=dnsServOptCounterSelfNonAuthNoDatas, dnsServZoneEntry=dnsServZoneEntry, dnsServOptCounterGroup=dnsServOptCounterGroup, dnsServCounterReqRefusals=dnsServCounterReqRefusals, dnsServZoneSrcEntry=dnsServZoneSrcEntry, DnsType=DnsType, dnsServZoneLastSourceAttempt=dnsServZoneLastSourceAttempt, dnsServCounter=dnsServCounter, dnsServCounterAuthAns=dnsServCounterAuthAns, dnsServCounterEntry=dnsServCounterEntry, dnsServZoneLastReloadSuccess=dnsServZoneLastReloadSuccess, dnsServZoneLastReloadAttempt=dnsServZoneLastReloadAttempt, dnsServCounterOpCode=dnsServCounterOpCode, dnsServZone=dnsServZone, dnsServConfigReset=dnsServConfigReset, dnsServOptCounterFriendsOtherErrors=dnsServOptCounterFriendsOtherErrors, dnsServZoneTable=dnsServZoneTable, DnsClass=DnsClass, dnsServCounterRelNames=dnsServCounterRelNames, dnsServConfigGroup=dnsServConfigGroup, dnsServCounterAuthNoDataResps=dnsServCounterAuthNoDataResps, dnsServCounterQClass=dnsServCounterQClass, dnsServZoneStatus=dnsServZoneStatus, dnsServMIB=dnsServMIB, PYSNMP_MODULE_ID=dnsServMIB, dnsServMIBObjects=dnsServMIBObjects, dnsServCounterReferrals=dnsServCounterReferrals, DnsQClass=DnsQClass, dnsServZoneSrcClass=dnsServZoneSrcClass, dnsServMIBGroups=dnsServMIBGroups, dnsServOptCounterSelfAuthAns=dnsServOptCounterSelfAuthAns, dnsServOptCounter=dnsServOptCounter, DnsOpCode=DnsOpCode, dnsServOptCounterFriendsNonAuthNoDatas=dnsServOptCounterFriendsNonAuthNoDatas, dnsServMIBCompliance=dnsServMIBCompliance, dnsServCounterRequests=dnsServCounterRequests, dnsServOptCounterSelfReferrals=dnsServOptCounterSelfReferrals, dnsServZoneSrcAddr=dnsServZoneSrcAddr, dns=dns, dnsServCounterNonAuthDatas=dnsServCounterNonAuthDatas, dnsServZoneCurrent=dnsServZoneCurrent, dnsServConfigResetTime=dnsServConfigResetTime, dnsServCounterErrors=dnsServCounterErrors, dnsServCounterQType=dnsServCounterQType, dnsServZoneSrcStatus=dnsServZoneSrcStatus, dnsServOptCounterFriendsAuthAns=dnsServOptCounterFriendsAuthAns, dnsServZoneGroup=dnsServZoneGroup, dnsServOptCounterFriendsNonAuthDatas=dnsServOptCounterFriendsNonAuthDatas, DnsQType=DnsQType, DnsRespCode=DnsRespCode, dnsServZoneClass=dnsServZoneClass, dnsServCounterNonAuthNoDatas=dnsServCounterNonAuthNoDatas, dnsServOptCounterSelfNonAuthDatas=dnsServOptCounterSelfNonAuthDatas, dnsServOptCounterFriendsErrors=dnsServOptCounterFriendsErrors, dnsServCounterResponses=dnsServCounterResponses, DnsNameAsIndex=DnsNameAsIndex, dnsServOptCounterFriendsReqRefusals=dnsServOptCounterFriendsReqRefusals, dnsServCounterGroup=dnsServCounterGroup, dnsServOptCounterSelfReqRefusals=dnsServOptCounterSelfReqRefusals, dnsServZoneLastSourceSuccess=dnsServZoneLastSourceSuccess, dnsServOptCounterSelfErrors=dnsServOptCounterSelfErrors, dnsServCounterTransport=dnsServCounterTransport, dnsServCounterAuthNoNames=dnsServCounterAuthNoNames, dnsServOptCounterSelfOtherErrors=dnsServOptCounterSelfOtherErrors, dnsServConfigUpTime=dnsServConfigUpTime, DnsTime=DnsTime, dnsServOptCounterFriendsAuthNoDataResps=dnsServOptCounterFriendsAuthNoDataResps, dnsServOptCounterFriendsReferrals=dnsServOptCounterFriendsReferrals, dnsServZoneName=dnsServZoneName, dnsServZoneSrcName=dnsServZoneSrcName, dnsServOptCounterFriendsAuthNoNames=dnsServOptCounterFriendsAuthNoNames, dnsServZoneSrcTable=dnsServZoneSrcTable, dnsServZoneSerial=dnsServZoneSerial, dnsServConfigImplementIdent=dnsServConfigImplementIdent, dnsServOptCounterFriendsReqUnparses=dnsServOptCounterFriendsReqUnparses)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(ip_address, iso, counter32, object_identity, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, notification_type, unsigned32, mib_2, integer32, gauge32, module_identity, time_ticks, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'iso', 'Counter32', 'ObjectIdentity', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'NotificationType', 'Unsigned32', 'mib-2', 'Integer32', 'Gauge32', 'ModuleIdentity', 'TimeTicks', 'MibIdentifier')
(truth_value, textual_convention, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'RowStatus', 'DisplayString')
dns = object_identity((1, 3, 6, 1, 2, 1, 32))
if mibBuilder.loadTexts:
dns.setDescription('The OID assigned to DNS MIB work by the IANA.')
dns_serv_mib = module_identity((1, 3, 6, 1, 2, 1, 32, 1))
if mibBuilder.loadTexts:
dnsServMIB.setLastUpdated('9401282251Z')
if mibBuilder.loadTexts:
dnsServMIB.setOrganization('IETF DNS Working Group')
if mibBuilder.loadTexts:
dnsServMIB.setContactInfo(' Rob Austein\n Postal: Epilogue Technology Corporation\n 268 Main Street, Suite 283\n North Reading, MA 10864\n US\n Tel: +1 617 245 0804\n Fax: +1 617 245 8122\n E-Mail: sra@epilogue.com\n\n Jon Saperia\n Postal: Digital Equipment Corporation\n 110 Spit Brook Road\n ZKO1-3/H18\n Nashua, NH 03062-2698\n US\n Tel: +1 603 881 0480\n Fax: +1 603 881 0120\n Email: saperia@zko.dec.com')
if mibBuilder.loadTexts:
dnsServMIB.setDescription('The MIB module for entities implementing the server side\n of the Domain Name System (DNS) protocol.')
dns_serv_mib_objects = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 1))
dns_serv_config = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 1))
dns_serv_counter = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 2))
dns_serv_opt_counter = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 3))
dns_serv_zone = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 1, 4))
class Dnsname(OctetString, TextualConvention):
subtype_spec = OctetString.subtypeSpec + value_size_constraint(0, 255)
class Dnsnameasindex(DnsName, TextualConvention):
pass
class Dnsclass(Integer32, TextualConvention):
display_hint = '2d'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Dnstype(Integer32, TextualConvention):
display_hint = '2d'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Dnsqclass(Integer32, TextualConvention):
display_hint = '2d'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Dnsqtype(Integer32, TextualConvention):
display_hint = '2d'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Dnstime(Gauge32, TextualConvention):
display_hint = '4d'
class Dnsopcode(Integer32, TextualConvention):
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 15)
class Dnsrespcode(Integer32, TextualConvention):
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 15)
dns_serv_config_implement_ident = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 1), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServConfigImplementIdent.setDescription("The implementation identification string for the DNS\n server software in use on the system, for example;\n `FNS-2.1'")
dns_serv_config_recurs = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('available', 1), ('restricted', 2), ('unavailable', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dnsServConfigRecurs.setDescription('This represents the recursion services offered by this\n name server. The values that can be read or written\n are:\n\n available(1) - performs recursion on requests from\n clients.\n\n restricted(2) - recursion is performed on requests only\n from certain clients, for example; clients on an access\n control list.\n\n unavailable(3) - recursion is not available.')
dns_serv_config_up_time = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 3), dns_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServConfigUpTime.setDescription('If the server has a persistent state (e.g., a process),\n this value will be the time elapsed since it started.\n For software without persistant state, this value will\n be zero.')
dns_serv_config_reset_time = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 4), dns_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServConfigResetTime.setDescription("If the server has a persistent state (e.g., a process)\n and supports a `reset' operation (e.g., can be told to\n re-read configuration files), this value will be the\n time elapsed since the last time the name server was\n `reset.' For software that does not have persistence or\n does not support a `reset' operation, this value will be\n zero.")
dns_serv_config_reset = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('reset', 2), ('initializing', 3), ('running', 4)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dnsServConfigReset.setDescription('Status/action object to reinitialize any persistant name\n server state. When set to reset(2), any persistant\n name server state (such as a process) is reinitialized as\n if the name server had just been started. This value\n will never be returned by a read operation. When read,\n one of the following values will be returned:\n other(1) - server in some unknown state;\n initializing(3) - server (re)initializing;\n running(4) - server currently running.')
dns_serv_counter_auth_ans = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterAuthAns.setDescription('Number of queries which were authoritatively answered.')
dns_serv_counter_auth_no_names = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterAuthNoNames.setDescription("Number of queries for which `authoritative no such name'\n responses were made.")
dns_serv_counter_auth_no_data_resps = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterAuthNoDataResps.setDescription("Number of queries for which `authoritative no such data'\n (empty answer) responses were made.")
dns_serv_counter_non_auth_datas = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterNonAuthDatas.setDescription('Number of queries which were non-authoritatively\n answered (cached data).')
dns_serv_counter_non_auth_no_datas = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterNonAuthNoDatas.setDescription('Number of queries which were non-authoritatively\n answered with no data (empty answer).')
dns_serv_counter_referrals = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterReferrals.setDescription('Number of requests that were referred to other servers.')
dns_serv_counter_errors = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterErrors.setDescription('Number of requests the server has processed that were\n answered with errors (RCODE values other than 0 and 3).')
dns_serv_counter_rel_names = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterRelNames.setDescription('Number of requests received by the server for names that\n are only 1 label long (text form - no internal dots).')
dns_serv_counter_req_refusals = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterReqRefusals.setDescription('Number of DNS requests refused by the server.')
dns_serv_counter_req_unparses = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterReqUnparses.setDescription('Number of requests received which were unparseable.')
dns_serv_counter_other_errors = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterOtherErrors.setDescription('Number of requests which were aborted for other (local)\n server errors.')
dns_serv_counter_table = mib_table((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13))
if mibBuilder.loadTexts:
dnsServCounterTable.setDescription('Counter information broken down by DNS class and type.')
dns_serv_counter_entry = mib_table_row((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1)).setIndexNames((0, 'DNS-SERVER-MIB', 'dnsServCounterOpCode'), (0, 'DNS-SERVER-MIB', 'dnsServCounterQClass'), (0, 'DNS-SERVER-MIB', 'dnsServCounterQType'), (0, 'DNS-SERVER-MIB', 'dnsServCounterTransport'))
if mibBuilder.loadTexts:
dnsServCounterEntry.setDescription("This table contains count information for each DNS class\n and type value known to the server. The index allows\n management software to to create indices to the table to\n get the specific information desired, e.g., number of\n queries over UDP for records with type value `A' which\n came to this server. In order to prevent an\n uncontrolled expansion of rows in the table; if\n dnsServCounterRequests is 0 and dnsServCounterResponses\n is 0, then the row does not exist and `no such' is\n returned when the agent is queried for such instances.")
dns_serv_counter_op_code = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 1), dns_op_code())
if mibBuilder.loadTexts:
dnsServCounterOpCode.setDescription('The DNS OPCODE being counted in this row of the table.')
dns_serv_counter_q_class = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 2), dns_class())
if mibBuilder.loadTexts:
dnsServCounterQClass.setDescription('The class of record being counted in this row of the\n table.')
dns_serv_counter_q_type = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 3), dns_type())
if mibBuilder.loadTexts:
dnsServCounterQType.setDescription('The type of record which is being counted in this row in\n the table.')
dns_serv_counter_transport = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('udp', 1), ('tcp', 2), ('other', 3))))
if mibBuilder.loadTexts:
dnsServCounterTransport.setDescription('A value of udp(1) indicates that the queries reported on\n this row were sent using UDP.\n\n A value of tcp(2) indicates that the queries reported on\n this row were sent using TCP.\n\n A value of other(3) indicates that the queries reported\n on this row were sent using a transport that was neither\n TCP nor UDP.')
dns_serv_counter_requests = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterRequests.setDescription('Number of requests (queries) that have been recorded in\n this row of the table.')
dns_serv_counter_responses = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 2, 13, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServCounterResponses.setDescription('Number of responses made by the server since\n initialization for the kind of query identified on this\n row of the table.')
dns_serv_opt_counter_self_auth_ans = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfAuthAns.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative answer.')
dns_serv_opt_counter_self_auth_no_names = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfAuthNoNames.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative no such name answer\n given.')
dns_serv_opt_counter_self_auth_no_data_resps = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfAuthNoDataResps.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which\n there has been an authoritative no such data answer\n (empty answer) made.')
dns_serv_opt_counter_self_non_auth_datas = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfNonAuthDatas.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host for which a\n non-authoritative answer (cached data) was made.')
dns_serv_opt_counter_self_non_auth_no_datas = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfNonAuthNoDatas.setDescription("Number of requests the server has processed which\n originated from a resolver on the same host for which a\n `non-authoritative, no such data' response was made\n (empty answer).")
dns_serv_opt_counter_self_referrals = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfReferrals.setDescription('Number of queries the server has processed which\n originated from a resolver on the same host and were\n referred to other servers.')
dns_serv_opt_counter_self_errors = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfErrors.setDescription('Number of requests the server has processed which\n originated from a resolver on the same host which have\n been answered with errors (RCODEs other than 0 and 3).')
dns_serv_opt_counter_self_rel_names = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfRelNames.setDescription('Number of requests received for names that are only 1\n label long (text form - no internal dots) the server has\n processed which originated from a resolver on the same\n host.')
dns_serv_opt_counter_self_req_refusals = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfReqRefusals.setDescription('Number of DNS requests refused by the server which\n originated from a resolver on the same host.')
dns_serv_opt_counter_self_req_unparses = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfReqUnparses.setDescription('Number of requests received which were unparseable and\n which originated from a resolver on the same host.')
dns_serv_opt_counter_self_other_errors = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterSelfOtherErrors.setDescription('Number of requests which were aborted for other (local)\n server errors and which originated on the same host.')
dns_serv_opt_counter_friends_auth_ans = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsAuthAns.setDescription('Number of queries originating from friends which were\n authoritatively answered. The definition of friends is\n a locally defined matter.')
dns_serv_opt_counter_friends_auth_no_names = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsAuthNoNames.setDescription("Number of queries originating from friends, for which\n authoritative `no such name' responses were made. The\n definition of friends is a locally defined matter.")
dns_serv_opt_counter_friends_auth_no_data_resps = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsAuthNoDataResps.setDescription('Number of queries originating from friends for which\n authoritative no such data (empty answer) responses were\n made. The definition of friends is a locally defined\n matter.')
dns_serv_opt_counter_friends_non_auth_datas = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 15), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsNonAuthDatas.setDescription('Number of queries originating from friends which were\n non-authoritatively answered (cached data). The\n definition of friends is a locally defined matter.')
dns_serv_opt_counter_friends_non_auth_no_datas = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 16), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsNonAuthNoDatas.setDescription('Number of queries originating from friends which were\n non-authoritatively answered with no such data (empty\n answer).')
dns_serv_opt_counter_friends_referrals = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 17), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsReferrals.setDescription('Number of requests which originated from friends that\n were referred to other servers. The definition of\n friends is a locally defined matter.')
dns_serv_opt_counter_friends_errors = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 18), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsErrors.setDescription('Number of requests the server has processed which\n originated from friends and were answered with errors\n (RCODE values other than 0 and 3). The definition of\n friends is a locally defined matter.')
dns_serv_opt_counter_friends_rel_names = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 19), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsRelNames.setDescription('Number of requests received for names from friends that\n are only 1 label long (text form - no internal dots) the\n server has processed.')
dns_serv_opt_counter_friends_req_refusals = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsReqRefusals.setDescription("Number of DNS requests refused by the server which were\n received from `friends'.")
dns_serv_opt_counter_friends_req_unparses = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 21), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsReqUnparses.setDescription("Number of requests received which were unparseable and\n which originated from `friends'.")
dns_serv_opt_counter_friends_other_errors = mib_scalar((1, 3, 6, 1, 2, 1, 32, 1, 1, 3, 22), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServOptCounterFriendsOtherErrors.setDescription("Number of requests which were aborted for other (local)\n server errors and which originated from `friends'.")
dns_serv_zone_table = mib_table((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1))
if mibBuilder.loadTexts:
dnsServZoneTable.setDescription("Table of zones for which this name server provides\n information. Each of the zones may be loaded from stable\n storage via an implementation-specific mechanism or may\n be obtained from another name server via a zone transfer.\n\n If name server doesn't load any zones, this table is\n empty.")
dns_serv_zone_entry = mib_table_row((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1)).setIndexNames((0, 'DNS-SERVER-MIB', 'dnsServZoneName'), (0, 'DNS-SERVER-MIB', 'dnsServZoneClass'))
if mibBuilder.loadTexts:
dnsServZoneEntry.setDescription('An entry in the name server zone table. New rows may be\n added either via SNMP or by the name server itself.')
dns_serv_zone_name = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 1), dns_name_as_index())
if mibBuilder.loadTexts:
dnsServZoneName.setDescription("DNS name of the zone described by this row of the table.\n This is the owner name of the SOA RR that defines the\n top of the zone. This is name is in uppercase:\n characters 'a' through 'z' are mapped to 'A' through 'Z'\n in order to make the lexical ordering useful.")
dns_serv_zone_class = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 2), dns_class())
if mibBuilder.loadTexts:
dnsServZoneClass.setDescription('DNS class of the RRs in this zone.')
dns_serv_zone_last_reload_success = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 3), dns_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServZoneLastReloadSuccess.setDescription('Elapsed time in seconds since last successful reload of\n this zone.')
dns_serv_zone_last_reload_attempt = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 4), dns_time()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServZoneLastReloadAttempt.setDescription('Elapsed time in seconds since last attempted reload of\n this zone.')
dns_serv_zone_last_source_attempt = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 5), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServZoneLastSourceAttempt.setDescription('IP address of host from which most recent zone transfer\n of this zone was attempted. This value should match the\n value of dnsServZoneSourceSuccess if the attempt was\n succcessful. If zone transfer has not been attempted\n within the memory of this name server, this value should\n be 0.0.0.0.')
dns_serv_zone_status = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 6), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
dnsServZoneStatus.setDescription('The status of the information represented in this row of\n the table.')
dns_serv_zone_serial = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServZoneSerial.setDescription('Zone serial number (from the SOA RR) of the zone\n represented by this row of the table. If the zone has\n not been successfully loaded within the memory of this\n name server, the value of this variable is zero.')
dns_serv_zone_current = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 8), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServZoneCurrent.setDescription("Whether the server's copy of the zone represented by\n this row of the table is currently valid. If the zone\n has never been successfully loaded or has expired since\n it was last succesfully loaded, this variable will have\n the value false(2), otherwise this variable will have\n the value true(1).")
dns_serv_zone_last_source_success = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 1, 1, 9), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dnsServZoneLastSourceSuccess.setDescription('IP address of host which was the source of the most\n recent successful zone transfer for this zone. If\n unknown (e.g., zone has never been successfully\n transfered) or irrelevant (e.g., zone was loaded from\n stable storage), this value should be 0.0.0.0.')
dns_serv_zone_src_table = mib_table((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2))
if mibBuilder.loadTexts:
dnsServZoneSrcTable.setDescription('This table is a list of IP addresses from which the\n server will attempt to load zone information using DNS\n zone transfer operations. A reload may occur due to SNMP\n operations that create a row in dnsServZoneTable or a\n SET to object dnsServZoneReload. This table is only\n used when the zone is loaded via zone transfer.')
dns_serv_zone_src_entry = mib_table_row((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1)).setIndexNames((0, 'DNS-SERVER-MIB', 'dnsServZoneSrcName'), (0, 'DNS-SERVER-MIB', 'dnsServZoneSrcClass'), (0, 'DNS-SERVER-MIB', 'dnsServZoneSrcAddr'))
if mibBuilder.loadTexts:
dnsServZoneSrcEntry.setDescription('An entry in the name server zone source table.')
dns_serv_zone_src_name = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 1), dns_name_as_index())
if mibBuilder.loadTexts:
dnsServZoneSrcName.setDescription('DNS name of the zone to which this entry applies.')
dns_serv_zone_src_class = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 2), dns_class())
if mibBuilder.loadTexts:
dnsServZoneSrcClass.setDescription('DNS class of zone to which this entry applies.')
dns_serv_zone_src_addr = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 3), ip_address())
if mibBuilder.loadTexts:
dnsServZoneSrcAddr.setDescription('IP address of name server host from which this zone\n might be obtainable.')
dns_serv_zone_src_status = mib_table_column((1, 3, 6, 1, 2, 1, 32, 1, 1, 4, 2, 1, 4), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
dnsServZoneSrcStatus.setDescription('The status of the information represented in this row of\n the table.')
dns_serv_mib_groups = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 2))
dns_serv_config_group = object_group((1, 3, 6, 1, 2, 1, 32, 1, 2, 1)).setObjects(*(('DNS-SERVER-MIB', 'dnsServConfigImplementIdent'), ('DNS-SERVER-MIB', 'dnsServConfigRecurs'), ('DNS-SERVER-MIB', 'dnsServConfigUpTime'), ('DNS-SERVER-MIB', 'dnsServConfigResetTime'), ('DNS-SERVER-MIB', 'dnsServConfigReset')))
if mibBuilder.loadTexts:
dnsServConfigGroup.setDescription('A collection of objects providing basic configuration\n control of a DNS name server.')
dns_serv_counter_group = object_group((1, 3, 6, 1, 2, 1, 32, 1, 2, 2)).setObjects(*(('DNS-SERVER-MIB', 'dnsServCounterAuthAns'), ('DNS-SERVER-MIB', 'dnsServCounterAuthNoNames'), ('DNS-SERVER-MIB', 'dnsServCounterAuthNoDataResps'), ('DNS-SERVER-MIB', 'dnsServCounterNonAuthDatas'), ('DNS-SERVER-MIB', 'dnsServCounterNonAuthNoDatas'), ('DNS-SERVER-MIB', 'dnsServCounterReferrals'), ('DNS-SERVER-MIB', 'dnsServCounterErrors'), ('DNS-SERVER-MIB', 'dnsServCounterRelNames'), ('DNS-SERVER-MIB', 'dnsServCounterReqRefusals'), ('DNS-SERVER-MIB', 'dnsServCounterReqUnparses'), ('DNS-SERVER-MIB', 'dnsServCounterOtherErrors'), ('DNS-SERVER-MIB', 'dnsServCounterOpCode'), ('DNS-SERVER-MIB', 'dnsServCounterQClass'), ('DNS-SERVER-MIB', 'dnsServCounterQType'), ('DNS-SERVER-MIB', 'dnsServCounterTransport'), ('DNS-SERVER-MIB', 'dnsServCounterRequests'), ('DNS-SERVER-MIB', 'dnsServCounterResponses')))
if mibBuilder.loadTexts:
dnsServCounterGroup.setDescription('A collection of objects providing basic instrumentation\n of a DNS name server.')
dns_serv_opt_counter_group = object_group((1, 3, 6, 1, 2, 1, 32, 1, 2, 3)).setObjects(*(('DNS-SERVER-MIB', 'dnsServOptCounterSelfAuthAns'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfAuthNoNames'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfAuthNoDataResps'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfNonAuthDatas'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfNonAuthNoDatas'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfReferrals'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfErrors'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfRelNames'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfReqRefusals'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfReqUnparses'), ('DNS-SERVER-MIB', 'dnsServOptCounterSelfOtherErrors'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsAuthAns'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsAuthNoNames'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsAuthNoDataResps'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsNonAuthDatas'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsNonAuthNoDatas'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsReferrals'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsErrors'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsRelNames'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsReqRefusals'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsReqUnparses'), ('DNS-SERVER-MIB', 'dnsServOptCounterFriendsOtherErrors')))
if mibBuilder.loadTexts:
dnsServOptCounterGroup.setDescription('A collection of objects providing extended\n instrumentation of a DNS name server.')
dns_serv_zone_group = object_group((1, 3, 6, 1, 2, 1, 32, 1, 2, 4)).setObjects(*(('DNS-SERVER-MIB', 'dnsServZoneName'), ('DNS-SERVER-MIB', 'dnsServZoneClass'), ('DNS-SERVER-MIB', 'dnsServZoneLastReloadSuccess'), ('DNS-SERVER-MIB', 'dnsServZoneLastReloadAttempt'), ('DNS-SERVER-MIB', 'dnsServZoneLastSourceAttempt'), ('DNS-SERVER-MIB', 'dnsServZoneLastSourceSuccess'), ('DNS-SERVER-MIB', 'dnsServZoneStatus'), ('DNS-SERVER-MIB', 'dnsServZoneSerial'), ('DNS-SERVER-MIB', 'dnsServZoneCurrent'), ('DNS-SERVER-MIB', 'dnsServZoneSrcName'), ('DNS-SERVER-MIB', 'dnsServZoneSrcClass'), ('DNS-SERVER-MIB', 'dnsServZoneSrcAddr'), ('DNS-SERVER-MIB', 'dnsServZoneSrcStatus')))
if mibBuilder.loadTexts:
dnsServZoneGroup.setDescription('A collection of objects providing configuration control\n of a DNS name server which loads authoritative zones.')
dns_serv_mib_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 32, 1, 3))
dns_serv_mib_compliance = module_compliance((1, 3, 6, 1, 2, 1, 32, 1, 3, 1)).setObjects(*(('DNS-SERVER-MIB', 'dnsServConfigGroup'), ('DNS-SERVER-MIB', 'dnsServCounterGroup'), ('DNS-SERVER-MIB', 'dnsServOptCounterGroup'), ('DNS-SERVER-MIB', 'dnsServZoneGroup')))
if mibBuilder.loadTexts:
dnsServMIBCompliance.setDescription('The compliance statement for agents implementing the DNS\n name server MIB extensions.')
mibBuilder.exportSymbols('DNS-SERVER-MIB', dnsServOptCounterSelfAuthNoDataResps=dnsServOptCounterSelfAuthNoDataResps, dnsServMIBCompliances=dnsServMIBCompliances, dnsServOptCounterSelfAuthNoNames=dnsServOptCounterSelfAuthNoNames, dnsServOptCounterSelfReqUnparses=dnsServOptCounterSelfReqUnparses, dnsServConfig=dnsServConfig, dnsServCounterReqUnparses=dnsServCounterReqUnparses, dnsServOptCounterSelfRelNames=dnsServOptCounterSelfRelNames, DnsName=DnsName, dnsServConfigRecurs=dnsServConfigRecurs, dnsServCounterTable=dnsServCounterTable, dnsServCounterOtherErrors=dnsServCounterOtherErrors, dnsServOptCounterFriendsRelNames=dnsServOptCounterFriendsRelNames, dnsServOptCounterSelfNonAuthNoDatas=dnsServOptCounterSelfNonAuthNoDatas, dnsServZoneEntry=dnsServZoneEntry, dnsServOptCounterGroup=dnsServOptCounterGroup, dnsServCounterReqRefusals=dnsServCounterReqRefusals, dnsServZoneSrcEntry=dnsServZoneSrcEntry, DnsType=DnsType, dnsServZoneLastSourceAttempt=dnsServZoneLastSourceAttempt, dnsServCounter=dnsServCounter, dnsServCounterAuthAns=dnsServCounterAuthAns, dnsServCounterEntry=dnsServCounterEntry, dnsServZoneLastReloadSuccess=dnsServZoneLastReloadSuccess, dnsServZoneLastReloadAttempt=dnsServZoneLastReloadAttempt, dnsServCounterOpCode=dnsServCounterOpCode, dnsServZone=dnsServZone, dnsServConfigReset=dnsServConfigReset, dnsServOptCounterFriendsOtherErrors=dnsServOptCounterFriendsOtherErrors, dnsServZoneTable=dnsServZoneTable, DnsClass=DnsClass, dnsServCounterRelNames=dnsServCounterRelNames, dnsServConfigGroup=dnsServConfigGroup, dnsServCounterAuthNoDataResps=dnsServCounterAuthNoDataResps, dnsServCounterQClass=dnsServCounterQClass, dnsServZoneStatus=dnsServZoneStatus, dnsServMIB=dnsServMIB, PYSNMP_MODULE_ID=dnsServMIB, dnsServMIBObjects=dnsServMIBObjects, dnsServCounterReferrals=dnsServCounterReferrals, DnsQClass=DnsQClass, dnsServZoneSrcClass=dnsServZoneSrcClass, dnsServMIBGroups=dnsServMIBGroups, dnsServOptCounterSelfAuthAns=dnsServOptCounterSelfAuthAns, dnsServOptCounter=dnsServOptCounter, DnsOpCode=DnsOpCode, dnsServOptCounterFriendsNonAuthNoDatas=dnsServOptCounterFriendsNonAuthNoDatas, dnsServMIBCompliance=dnsServMIBCompliance, dnsServCounterRequests=dnsServCounterRequests, dnsServOptCounterSelfReferrals=dnsServOptCounterSelfReferrals, dnsServZoneSrcAddr=dnsServZoneSrcAddr, dns=dns, dnsServCounterNonAuthDatas=dnsServCounterNonAuthDatas, dnsServZoneCurrent=dnsServZoneCurrent, dnsServConfigResetTime=dnsServConfigResetTime, dnsServCounterErrors=dnsServCounterErrors, dnsServCounterQType=dnsServCounterQType, dnsServZoneSrcStatus=dnsServZoneSrcStatus, dnsServOptCounterFriendsAuthAns=dnsServOptCounterFriendsAuthAns, dnsServZoneGroup=dnsServZoneGroup, dnsServOptCounterFriendsNonAuthDatas=dnsServOptCounterFriendsNonAuthDatas, DnsQType=DnsQType, DnsRespCode=DnsRespCode, dnsServZoneClass=dnsServZoneClass, dnsServCounterNonAuthNoDatas=dnsServCounterNonAuthNoDatas, dnsServOptCounterSelfNonAuthDatas=dnsServOptCounterSelfNonAuthDatas, dnsServOptCounterFriendsErrors=dnsServOptCounterFriendsErrors, dnsServCounterResponses=dnsServCounterResponses, DnsNameAsIndex=DnsNameAsIndex, dnsServOptCounterFriendsReqRefusals=dnsServOptCounterFriendsReqRefusals, dnsServCounterGroup=dnsServCounterGroup, dnsServOptCounterSelfReqRefusals=dnsServOptCounterSelfReqRefusals, dnsServZoneLastSourceSuccess=dnsServZoneLastSourceSuccess, dnsServOptCounterSelfErrors=dnsServOptCounterSelfErrors, dnsServCounterTransport=dnsServCounterTransport, dnsServCounterAuthNoNames=dnsServCounterAuthNoNames, dnsServOptCounterSelfOtherErrors=dnsServOptCounterSelfOtherErrors, dnsServConfigUpTime=dnsServConfigUpTime, DnsTime=DnsTime, dnsServOptCounterFriendsAuthNoDataResps=dnsServOptCounterFriendsAuthNoDataResps, dnsServOptCounterFriendsReferrals=dnsServOptCounterFriendsReferrals, dnsServZoneName=dnsServZoneName, dnsServZoneSrcName=dnsServZoneSrcName, dnsServOptCounterFriendsAuthNoNames=dnsServOptCounterFriendsAuthNoNames, dnsServZoneSrcTable=dnsServZoneSrcTable, dnsServZoneSerial=dnsServZoneSerial, dnsServConfigImplementIdent=dnsServConfigImplementIdent, dnsServOptCounterFriendsReqUnparses=dnsServOptCounterFriendsReqUnparses) |
# _*_ coding: utf-8 _*_
"""
inst_save.py by xianhu
"""
class Saver(object):
"""
class of Saver, must include function working()
"""
def working(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object):
"""
working function, must "try-except" and don't change the parameters and returns
:return save_state: can be -1(save failed), 1(save success)
:return save_result: can be any object, or exception[class_name, excep]
"""
try:
save_state, save_result = self.item_save(priority, url, keys, deep, item)
except Exception as excep:
save_state, save_result = -1, [self.__class__.__name__, excep]
return save_state, save_result
def item_save(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object):
"""
save the content of a url. You must overwrite this function, parameters and returns refer to self.working()
"""
raise NotImplementedError
| """
inst_save.py by xianhu
"""
class Saver(object):
"""
class of Saver, must include function working()
"""
def working(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object):
"""
working function, must "try-except" and don't change the parameters and returns
:return save_state: can be -1(save failed), 1(save success)
:return save_result: can be any object, or exception[class_name, excep]
"""
try:
(save_state, save_result) = self.item_save(priority, url, keys, deep, item)
except Exception as excep:
(save_state, save_result) = (-1, [self.__class__.__name__, excep])
return (save_state, save_result)
def item_save(self, priority: int, url: str, keys: dict, deep: int, item: object) -> (int, object):
"""
save the content of a url. You must overwrite this function, parameters and returns refer to self.working()
"""
raise NotImplementedError |
"""
Get content from tag.
>>> from GDLC.GDLC import *
>>> dml = '''\
... <idx:entry scriptable="yes">
... <idx:orth value="ABC">
... <idx:infl>
... <idx:iform name="" value="ABC"/>
... </idx:infl>
... </idx:orth>
... <div>
... <span>
... <b>ABC</b>
... </span>
... </div>
... <span>
... <strong>ABC -xy</strong><sup class="calibre23">1</sup>.
... </span>
... <div>
... <blockquote align="left"><span>Definition here.</span></blockquote>
... </blockquote align="left"><span>More details here.</span></blockquote>
... </blockquote align="left"><span>Even more details here.</span></blockquote>
... </div>
... </idx:entry>'''
>>> soup = BeautifulSoup(dml, features='lxml')
>>> print(get_content(soup, tag='idx:entry'))
{'idx:entry': ['\n', <idx:orth value="ABC">
<idx:infl>
<idx:iform name="" value="ABC"></idx:iform>
</idx:infl>
</idx:orth>, '\n', <div>
<span>
<b>ABC</b>
</span>
</div>, '\n', <span>
<strong>ABC -xy</strong><sup class="calibre23">1</sup>.
</span>, '\n', <div>
<blockquote align="left"><span>Definition here.</span></blockquote>
<span>More details here.</span>
<span>Even more details here.</span>
</div>, '\n']}
"""
| """
Get content from tag.
>>> from GDLC.GDLC import *
>>> dml = '''... <idx:entry scriptable="yes">
... <idx:orth value="ABC">
... <idx:infl>
... <idx:iform name="" value="ABC"/>
... </idx:infl>
... </idx:orth>
... <div>
... <span>
... <b>ABC</b>
... </span>
... </div>
... <span>
... <strong>ABC -xy</strong><sup class="calibre23">1</sup>.
... </span>
... <div>
... <blockquote align="left"><span>Definition here.</span></blockquote>
... </blockquote align="left"><span>More details here.</span></blockquote>
... </blockquote align="left"><span>Even more details here.</span></blockquote>
... </div>
... </idx:entry>'''
>>> soup = BeautifulSoup(dml, features='lxml')
>>> print(get_content(soup, tag='idx:entry'))
{'idx:entry': ['
', <idx:orth value="ABC">
<idx:infl>
<idx:iform name="" value="ABC"></idx:iform>
</idx:infl>
</idx:orth>, '
', <div>
<span>
<b>ABC</b>
</span>
</div>, '
', <span>
<strong>ABC -xy</strong><sup class="calibre23">1</sup>.
</span>, '
', <div>
<blockquote align="left"><span>Definition here.</span></blockquote>
<span>More details here.</span>
<span>Even more details here.</span>
</div>, '
']}
""" |
#MAIN PROGRAM STARTS HERE:
num = int(input('Enter the number of rows and columns for the square: '))
k = 1
for x in range(0, num ):
for y in range(0, num):
print ('%d ' % (k), end='')
k += 2
print() | num = int(input('Enter the number of rows and columns for the square: '))
k = 1
for x in range(0, num):
for y in range(0, num):
print('%d ' % k, end='')
k += 2
print() |
class Point(object):
def __init__(self, x, y):
self.x, self.y = x, y
class PointHash(object):
def __init__(self, x, y):
self.x, self.y = x, y
def __hash__(self):
return hash((self.x, self.y))
def __eq__(self, other):
return self.x == other.x and self.y == other.y
if __name__ == "__main__":
print("Test with default hash function")
p1 = Point(1, 1)
p2 = Point(1, 1)
points = set([p1, p2])
print("Contents of set([p1, p2]): ", points)
print("Point(1, 1) in set([p1, p2]) = ", (Point(1, 1) in points))
print("Test with custom hash function")
p1 = PointHash(1, 1)
p2 = PointHash(1, 1)
points = set([p1, p2])
print("Contents of set([p1, p2]): ", points)
print("Point(1, 1) in set([p1, p2]) = ", (PointHash(1, 1) in points))
| class Point(object):
def __init__(self, x, y):
(self.x, self.y) = (x, y)
class Pointhash(object):
def __init__(self, x, y):
(self.x, self.y) = (x, y)
def __hash__(self):
return hash((self.x, self.y))
def __eq__(self, other):
return self.x == other.x and self.y == other.y
if __name__ == '__main__':
print('Test with default hash function')
p1 = point(1, 1)
p2 = point(1, 1)
points = set([p1, p2])
print('Contents of set([p1, p2]): ', points)
print('Point(1, 1) in set([p1, p2]) = ', point(1, 1) in points)
print('Test with custom hash function')
p1 = point_hash(1, 1)
p2 = point_hash(1, 1)
points = set([p1, p2])
print('Contents of set([p1, p2]): ', points)
print('Point(1, 1) in set([p1, p2]) = ', point_hash(1, 1) in points) |
"""
This is pure python implementation of interpolation search algorithm
"""
"""Pure implementation of interpolation search algorithm in Python
Be careful collection must be ascending sorted, otherwise result will be
unpredictable
"""
def interpolation_search(sorted_collection, item):
left = 0
right = len(sorted_collection) - 1
while left <= right:
if sorted_collection[left] == sorted_collection[right]:
if sorted_collection[left] == item:
return left
else:
return None
point = left + ((item - sorted_collection[left]) * (right - left)) // (
sorted_collection[right] - sorted_collection[left]
)
if point < 0 or point >= len(sorted_collection):
return None
current_item = sorted_collection[point]
if current_item == item:
return point
else:
if point < left:
right = left
left = point
elif point > right:
left = right
right = point
else:
if item < current_item:
right = point - 1
else:
left = point + 1
return None
| """
This is pure python implementation of interpolation search algorithm
"""
'Pure implementation of interpolation search algorithm in Python\nBe careful collection must be ascending sorted, otherwise result will be\nunpredictable\n'
def interpolation_search(sorted_collection, item):
left = 0
right = len(sorted_collection) - 1
while left <= right:
if sorted_collection[left] == sorted_collection[right]:
if sorted_collection[left] == item:
return left
else:
return None
point = left + (item - sorted_collection[left]) * (right - left) // (sorted_collection[right] - sorted_collection[left])
if point < 0 or point >= len(sorted_collection):
return None
current_item = sorted_collection[point]
if current_item == item:
return point
elif point < left:
right = left
left = point
elif point > right:
left = right
right = point
elif item < current_item:
right = point - 1
else:
left = point + 1
return None |
# -*- coding: utf-8 -*-
# 18/1/30
# create by: snower
version = "0.1.1"
version_info = (0,1.1) | version = '0.1.1'
version_info = (0, 1.1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.