content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
SECRET_KEY = '123'
#
# For mysql in python3.5, uncomment if you will Use MySQL database driver
# import pymysql
# pymysql.install_as_MySQLdb()
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
KB_NAME_FILE_PATH = '/home/g10k/git/knowledge_base/kb_links.json' | secret_key = '123'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3'}}
kb_name_file_path = '/home/g10k/git/knowledge_base/kb_links.json' |
class Solution:
def isDividingNumber(self, num):
if '0' in str(num):
return False
return 0 == sum(num % int(i) for i in str(num))
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
divlist = []
for i in range(left, right + 1, +1):
if self.isDividingNumber(i):
divlist.append(i)
return divlist
| class Solution:
def is_dividing_number(self, num):
if '0' in str(num):
return False
return 0 == sum((num % int(i) for i in str(num)))
def self_dividing_numbers(self, left: int, right: int) -> List[int]:
divlist = []
for i in range(left, right + 1, +1):
if self.isDividingNumber(i):
divlist.append(i)
return divlist |
"""Pyvista specific errors."""
CAMERA_ERROR_MESSAGE = """Invalid camera description
Camera description must be one of the following:
Iterable containing position, focal_point, and view up. For example:
[(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)]
Iterable containing a view vector. For example:
[-1.0, 2.0, -5.0]
A string containing the plane orthogonal to the view direction. For example:
'xy'
"""
class NotAllTrianglesError(ValueError):
"""Exception when a mesh does not contain all triangles."""
def __init__(self, message='Mesh must consist of only triangles'):
"""Empty init."""
ValueError.__init__(self, message)
class InvalidCameraError(ValueError):
"""Exception when passed an invalid camera."""
def __init__(self, message=CAMERA_ERROR_MESSAGE):
"""Empty init."""
ValueError.__init__(self, message)
| """Pyvista specific errors."""
camera_error_message = "Invalid camera description\nCamera description must be one of the following:\n\nIterable containing position, focal_point, and view up. For example:\n[(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)]\n\nIterable containing a view vector. For example:\n[-1.0, 2.0, -5.0]\n\nA string containing the plane orthogonal to the view direction. For example:\n'xy'\n"
class Notalltriangleserror(ValueError):
"""Exception when a mesh does not contain all triangles."""
def __init__(self, message='Mesh must consist of only triangles'):
"""Empty init."""
ValueError.__init__(self, message)
class Invalidcameraerror(ValueError):
"""Exception when passed an invalid camera."""
def __init__(self, message=CAMERA_ERROR_MESSAGE):
"""Empty init."""
ValueError.__init__(self, message) |
class InvalidIPv4Address(Exception):
"""
Exception raised for invalid IPv4 addresses.
Attributes:
ipv4: IPv4 address that triggered the error.
msg : Explanation of the error.
"""
def __init__(self, ipv4, msg="Invalid IPv4 Address"):
self.ipv4 = ipv4
self.msg = msg
def __str__(self):
return "{}: {}".format(self.msg, self.ipv4)
class ValueTooBig(Exception):
"""
Exception raised for trying to fit a value that cannot be fit in the specified
number of bytes or bits.
Attributes:
size : Specified size user entered.
value: Value user tried to fit in that size, but was too big.
unit : bit or byte, depending on how size was specified.
msg : Explanation of the error.
"""
def __init__(self, size, value, unit, msg="Cannot fit in"):
self.size = size
self.value = value
self.unit = unit
self.msg = msg
def __str__(self):
return "{} {} {} {}".format(self.value, self.msg, self.size, self.unit)
class InvalidValue(Exception):
"""
Exception raised for invalid values for Field.py.
Attributes:
value: value that triggered the error.
msg : Explanation of the error.
"""
def __init__(self, value, msg="Invalid type for value. Expecting int or bytes. Received"):
self.value = value
self.msg = msg
def __str__(self):
return "{}: {}".format(self.msg, self.value)
class InvalidSize(Exception):
"""
Exception raised for invalid sizes for Field.py.
Attributes:
size: size that triggered the error.
msg : Explanation of the error.
"""
def __init__(self, size, msg="Invalid type for size. Expecting str, int, or bytes. Received"):
self.size = size
self.msg = msg
def __str__(self):
return "{}: {}".format(self.msg, self.size)
class InvalidField(Exception):
"""
Exception raised for an invalid field for Field.py.
Attributes:
item: What was used to trigger error.
msg : Explanation of the error.
"""
def __init__(self, item, msg="Invalid Field. Recieved"):
self.item = item
self.msg = msg
def __str__(self):
return "{}: {}".format(self.msg, self.item)
class FieldNotFound(Exception):
"""
Exception raised when user tries to access nonexistent field.
Attributes:
name: name of field user tried to access, but does not exist.
msg : Explanation of the error.
"""
def __init__(self, name, msg="Field not found."):
self.name = name
self.msg = msg
def __str__(self):
return "{} -> {}".format(self.name, self.msg)
| class Invalidipv4Address(Exception):
"""
Exception raised for invalid IPv4 addresses.
Attributes:
ipv4: IPv4 address that triggered the error.
msg : Explanation of the error.
"""
def __init__(self, ipv4, msg='Invalid IPv4 Address'):
self.ipv4 = ipv4
self.msg = msg
def __str__(self):
return '{}: {}'.format(self.msg, self.ipv4)
class Valuetoobig(Exception):
"""
Exception raised for trying to fit a value that cannot be fit in the specified
number of bytes or bits.
Attributes:
size : Specified size user entered.
value: Value user tried to fit in that size, but was too big.
unit : bit or byte, depending on how size was specified.
msg : Explanation of the error.
"""
def __init__(self, size, value, unit, msg='Cannot fit in'):
self.size = size
self.value = value
self.unit = unit
self.msg = msg
def __str__(self):
return '{} {} {} {}'.format(self.value, self.msg, self.size, self.unit)
class Invalidvalue(Exception):
"""
Exception raised for invalid values for Field.py.
Attributes:
value: value that triggered the error.
msg : Explanation of the error.
"""
def __init__(self, value, msg='Invalid type for value. Expecting int or bytes. Received'):
self.value = value
self.msg = msg
def __str__(self):
return '{}: {}'.format(self.msg, self.value)
class Invalidsize(Exception):
"""
Exception raised for invalid sizes for Field.py.
Attributes:
size: size that triggered the error.
msg : Explanation of the error.
"""
def __init__(self, size, msg='Invalid type for size. Expecting str, int, or bytes. Received'):
self.size = size
self.msg = msg
def __str__(self):
return '{}: {}'.format(self.msg, self.size)
class Invalidfield(Exception):
"""
Exception raised for an invalid field for Field.py.
Attributes:
item: What was used to trigger error.
msg : Explanation of the error.
"""
def __init__(self, item, msg='Invalid Field. Recieved'):
self.item = item
self.msg = msg
def __str__(self):
return '{}: {}'.format(self.msg, self.item)
class Fieldnotfound(Exception):
"""
Exception raised when user tries to access nonexistent field.
Attributes:
name: name of field user tried to access, but does not exist.
msg : Explanation of the error.
"""
def __init__(self, name, msg='Field not found.'):
self.name = name
self.msg = msg
def __str__(self):
return '{} -> {}'.format(self.name, self.msg) |
# coding:utf-8
'''
@author = super_fazai
@File : __init__.py.py
@Time : 2016/12/13 15:39
@connect : superonesfazai@gmail.com
''' | """
@author = super_fazai
@File : __init__.py.py
@Time : 2016/12/13 15:39
@connect : superonesfazai@gmail.com
""" |
class Manager:
def __init__(self):
self.states = []
def process_input(self, event):
self.states[-1].process_input(event)
def update(self):
self.states[-1].update()
def draw(self, screen):
for state in self.states:
state.draw(screen)
def push(self, state):
if self.states:
self.states[-1].deactivate()
self.states.append(state)
def pop(self):
self.states[-1].deactivate()
self.states[-1].destroy()
self.states.pop()
def clear(self):
for s in self.states:
s.destroy()
self.states.clear()
| class Manager:
def __init__(self):
self.states = []
def process_input(self, event):
self.states[-1].process_input(event)
def update(self):
self.states[-1].update()
def draw(self, screen):
for state in self.states:
state.draw(screen)
def push(self, state):
if self.states:
self.states[-1].deactivate()
self.states.append(state)
def pop(self):
self.states[-1].deactivate()
self.states[-1].destroy()
self.states.pop()
def clear(self):
for s in self.states:
s.destroy()
self.states.clear() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
################################################################################
def add_dummy_scores(iterable, score=0):
"""Add zero scores to all sequences."""
for seq in iterable:
seq.letter_annotations["phred_quality"] = (score,) * len(seq)
yield seq | """
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
def add_dummy_scores(iterable, score=0):
"""Add zero scores to all sequences."""
for seq in iterable:
seq.letter_annotations['phred_quality'] = (score,) * len(seq)
yield seq |
#
# Formatting
#
x = 12
if x == 24:
print('Is valid')
else:
print("Not valid")
def helper(name='sample'):
pass
def another(name = 'sample'):
pass
msg = "abc"
msg2 = 'abc'
print(msg)
def print_hello(name) :
"""
Greets the user by name
Parameters:
name (str): The name of the user
Returns:
str: The greeting
"""
print('Hello, ' + name)
# print_hello(12) #throws error!
| x = 12
if x == 24:
print('Is valid')
else:
print('Not valid')
def helper(name='sample'):
pass
def another(name='sample'):
pass
msg = 'abc'
msg2 = 'abc'
print(msg)
def print_hello(name):
"""
Greets the user by name
Parameters:
name (str): The name of the user
Returns:
str: The greeting
"""
print('Hello, ' + name) |
#!/usr/bin/env python
class Real(object):
def method(self):
return "method"
@property
def prop(self):
# print "prop called"
return "prop"
class PropertyProxy(object):
def __init__( self, object, name ):
self._object = object
self._name = name
def __get__(self,obj,type):
# print self, "__get__", obj, type
return obj.__getattribute__(self._name)
class FunctionProxy(object):
def __init__( self, object, name ):
self._object = object
self._name = name
def __call__( self, *args, **kwds ):
return self._object.__getattribute__( self._name ).__call__( *args, **kwds )
def _func(): pass
_func = type(_func)
class Proxy(object):
def __init__( self, object ):
self.__object = object
def __getattribute__( self, name ):
o = super(Proxy,self).__getattribute__( "_Proxy__object" )
if name == "_Proxy__object":
return o
t = type( type(o).__dict__[ name ] )
if t == property:
return PropertyProxy( self.__object, name ).__get__(o,type(o))
elif t == _func:
return FunctionProxy( self.__object, name )
else: raise "hell"
r = Real()
p = Proxy( r )
m = p.method
# print m
# print m()
assert m() == "method"
prop = p.prop
# print prop
assert prop == "prop"
| class Real(object):
def method(self):
return 'method'
@property
def prop(self):
return 'prop'
class Propertyproxy(object):
def __init__(self, object, name):
self._object = object
self._name = name
def __get__(self, obj, type):
return obj.__getattribute__(self._name)
class Functionproxy(object):
def __init__(self, object, name):
self._object = object
self._name = name
def __call__(self, *args, **kwds):
return self._object.__getattribute__(self._name).__call__(*args, **kwds)
def _func():
pass
_func = type(_func)
class Proxy(object):
def __init__(self, object):
self.__object = object
def __getattribute__(self, name):
o = super(Proxy, self).__getattribute__('_Proxy__object')
if name == '_Proxy__object':
return o
t = type(type(o).__dict__[name])
if t == property:
return property_proxy(self.__object, name).__get__(o, type(o))
elif t == _func:
return function_proxy(self.__object, name)
else:
raise 'hell'
r = real()
p = proxy(r)
m = p.method
assert m() == 'method'
prop = p.prop
assert prop == 'prop' |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#Filename: print_index.py
colors = [ 'red', 'green', 'blue', 'yellow' ]
for i in range(len(colors)):
print (i, '->', colors[i])
# >>> 0 -> red
# 1 -> green
# 2 -> blue
# 3 -> yellow
# >>>
for i, color in enumerate(colors):
print (i, '->', color)
| colors = ['red', 'green', 'blue', 'yellow']
for i in range(len(colors)):
print(i, '->', colors[i])
for (i, color) in enumerate(colors):
print(i, '->', color) |
class Cluster(object):
"""
Base Cluster class. This is intended to be a generic interface
to different types of clusters. Clusters could be Kubernetes clusters,
Docker swarms, or cloud compute/container services.
"""
def deploy_flow(self, name=None):
"""
Deploys a flow to the cluster.
"""
def __enter__(self):
"""
Allocate ephemeral cluster resources.
"""
return self
def __exit__(self, exc_type, exc_val, exc_tb):
"""
Clean up ephemeral cluster resources.
"""
| class Cluster(object):
"""
Base Cluster class. This is intended to be a generic interface
to different types of clusters. Clusters could be Kubernetes clusters,
Docker swarms, or cloud compute/container services.
"""
def deploy_flow(self, name=None):
"""
Deploys a flow to the cluster.
"""
def __enter__(self):
"""
Allocate ephemeral cluster resources.
"""
return self
def __exit__(self, exc_type, exc_val, exc_tb):
"""
Clean up ephemeral cluster resources.
""" |
set_A = set(map(int,input().split()))
N = int(input())
for i in range(N):
arr_A = set(input().split())
arr_N = set(input().split())
if not arr_A.issuperset(arr_N):
print(False)
else:
print(True)
| set_a = set(map(int, input().split()))
n = int(input())
for i in range(N):
arr_a = set(input().split())
arr_n = set(input().split())
if not arr_A.issuperset(arr_N):
print(False)
else:
print(True) |
def main():
a = "Java"
b = a.replace("a", "ao")
print(b)
c = a.replace("a", "")
print(c)
print(b[1:3])
d = a[0] + b[5]
print("PRINTS D: " + d)
e = 3 * len(a)
print("prints e: " + str(e))
print(d + "k" + "e")
print(a[2])
main() | def main():
a = 'Java'
b = a.replace('a', 'ao')
print(b)
c = a.replace('a', '')
print(c)
print(b[1:3])
d = a[0] + b[5]
print('PRINTS D: ' + d)
e = 3 * len(a)
print('prints e: ' + str(e))
print(d + 'k' + 'e')
print(a[2])
main() |
#Your Own list.
List_of_transportation = ["car","bike","truck"]
print("I just love to ride a "+List_of_transportation[1]+".")
print("But i also love to sit in a "+List_of_transportation[0]+" comfortably and drive.")
print("I also play simulator games of "+List_of_transportation[2]+".")
| list_of_transportation = ['car', 'bike', 'truck']
print('I just love to ride a ' + List_of_transportation[1] + '.')
print('But i also love to sit in a ' + List_of_transportation[0] + ' comfortably and drive.')
print('I also play simulator games of ' + List_of_transportation[2] + '.') |
# Copyright 2017 The Bazel Authors. 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.
# 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.
"Install toolchain dependencies"
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "check_rules_nodejs_version", "yarn_install")
load("@bazel_gazelle//:deps.bzl", "go_repository")
def ts_setup_workspace():
"""This repository rule should be called from your WORKSPACE file.
It creates some additional Bazel external repositories that are used internally
by the TypeScript rules.
"""
# 0.14.0: @bazel_tools//tools/bash/runfiles is required
# 0.15.0: "data" attributes don't need 'cfg = "data"'
# 0.17.1: allow @ in package names is required for fine grained deps
check_bazel_version("0.17.1")
go_repository(
name = "com_github_kylelemons_godebug",
commit = "d65d576e9348f5982d7f6d83682b694e731a45c6",
importpath = "github.com/kylelemons/godebug",
)
go_repository(
name = "com_github_mattn_go_isatty",
commit = "3fb116b820352b7f0c281308a4d6250c22d94e27",
importpath = "github.com/mattn/go-isatty",
)
# 0.11.3: node module resolution fixes & check_rules_nodejs_version
# 0.14.0: fine grained npm dependencies support for ts_library
# 0.14.1: fine grained npm dependencies fix for npm_install
# 0.15.0: fine grained npm dependencies breaking change
check_rules_nodejs_version("0.15.0")
# Included here for backward compatability for downstream repositories
# that use @build_bazel_rules_typescript_tsc_wrapped_deps such as rxjs.
# @build_bazel_rules_typescript_tsc_wrapped_deps is not used locally.
yarn_install(
name = "build_bazel_rules_typescript_tsc_wrapped_deps",
package_json = "@build_bazel_rules_typescript//internal:tsc_wrapped/package.json",
yarn_lock = "@build_bazel_rules_typescript//internal:tsc_wrapped/yarn.lock",
)
yarn_install(
name = "build_bazel_rules_typescript_devserver_deps",
package_json = "@build_bazel_rules_typescript//internal/devserver:package.json",
yarn_lock = "@build_bazel_rules_typescript//internal/devserver:yarn.lock",
)
yarn_install(
name = "build_bazel_rules_typescript_protobufs_compiletime_deps",
package_json = "@build_bazel_rules_typescript//internal/protobufjs:package.json",
yarn_lock = "@build_bazel_rules_typescript//internal/protobufjs:yarn.lock",
)
| """Install toolchain dependencies"""
load('@build_bazel_rules_nodejs//:defs.bzl', 'check_bazel_version', 'check_rules_nodejs_version', 'yarn_install')
load('@bazel_gazelle//:deps.bzl', 'go_repository')
def ts_setup_workspace():
"""This repository rule should be called from your WORKSPACE file.
It creates some additional Bazel external repositories that are used internally
by the TypeScript rules.
"""
check_bazel_version('0.17.1')
go_repository(name='com_github_kylelemons_godebug', commit='d65d576e9348f5982d7f6d83682b694e731a45c6', importpath='github.com/kylelemons/godebug')
go_repository(name='com_github_mattn_go_isatty', commit='3fb116b820352b7f0c281308a4d6250c22d94e27', importpath='github.com/mattn/go-isatty')
check_rules_nodejs_version('0.15.0')
yarn_install(name='build_bazel_rules_typescript_tsc_wrapped_deps', package_json='@build_bazel_rules_typescript//internal:tsc_wrapped/package.json', yarn_lock='@build_bazel_rules_typescript//internal:tsc_wrapped/yarn.lock')
yarn_install(name='build_bazel_rules_typescript_devserver_deps', package_json='@build_bazel_rules_typescript//internal/devserver:package.json', yarn_lock='@build_bazel_rules_typescript//internal/devserver:yarn.lock')
yarn_install(name='build_bazel_rules_typescript_protobufs_compiletime_deps', package_json='@build_bazel_rules_typescript//internal/protobufjs:package.json', yarn_lock='@build_bazel_rules_typescript//internal/protobufjs:yarn.lock') |
supported_languages = {
# .c,.h: C
"c": "C",
"h": "C",
# .cc .cpp .cxx .c++ .h .hh : CPP
"cc": "CPP",
"cpp": "CPP",
"cxx": "CPP",
"c++": "CPP",
"h": "CPP",
"hh": "CPP",
# .py .pyw, .pyc, .pyo, .pyd : PYTHON
"py": "PYTHON",
"pyw": "PYTHON",
"pyc": "PYTHON",
"pyo": "PYTHON",
"pyd": "PYTHON",
# .clj .edn : CLOJURE
"clj": "CLOJURE",
"edn": "CLOJURE",
# .js : JAVASCRIPT
"js": "JAVASCRIPT",
# .java .class .jar :JAVA
"java": "JAVA",
"class": "JAVA",
"jar": "JAVA",
# .rb .rbw:RUBY
"rb": "RUBY",
"rbw": "RUBY",
# .hs .hls:HASKELL
"hs": "HASKELL",
"hls": "HASKELL",
# .pl .pm .t .pod:PERL
"pl": "PERL",
"pm": "PERL",
"t": "PERL",
"pod": "PERL",
# php, .phtml, .php4, .php3, .php5, .phps
"php": "PHP",
"phtml": "PHP",
"php4": "PHP",
"php3": "PHP",
"php5": "PHP",
"phps": "PHP",
# .cs : CSHARP
"cs": "CSHARP",
# .go : GO
"go": "GO",
# .r : R
"r": "R",
# .rb : RUBY
"rb": "RUBY",
}
| supported_languages = {'c': 'C', 'h': 'C', 'cc': 'CPP', 'cpp': 'CPP', 'cxx': 'CPP', 'c++': 'CPP', 'h': 'CPP', 'hh': 'CPP', 'py': 'PYTHON', 'pyw': 'PYTHON', 'pyc': 'PYTHON', 'pyo': 'PYTHON', 'pyd': 'PYTHON', 'clj': 'CLOJURE', 'edn': 'CLOJURE', 'js': 'JAVASCRIPT', 'java': 'JAVA', 'class': 'JAVA', 'jar': 'JAVA', 'rb': 'RUBY', 'rbw': 'RUBY', 'hs': 'HASKELL', 'hls': 'HASKELL', 'pl': 'PERL', 'pm': 'PERL', 't': 'PERL', 'pod': 'PERL', 'php': 'PHP', 'phtml': 'PHP', 'php4': 'PHP', 'php3': 'PHP', 'php5': 'PHP', 'phps': 'PHP', 'cs': 'CSHARP', 'go': 'GO', 'r': 'R', 'rb': 'RUBY'} |
#######################
# Dennis MUD #
# break_item.py #
# Copyright 2018-2020 #
# Michael D. Reiley #
#######################
# **********
# 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.
# **********
NAME = "break item"
CATEGORIES = ["items"]
ALIASES = ["delete item", "destroy item", "remove item"]
USAGE = "break item <item_id>"
DESCRIPTION = """Break the item in your inventory with ID <item_id>.
You must own the item and it must be in your inventory in order to break it.
Wizards can break any item from anywhere.
Ex. `break item 4` to break the item with ID 4."""
def COMMAND(console, args):
# Perform initial checks.
if not COMMON.check(NAME, console, args, argc=1):
return False
# Perform argument type checks and casts.
itemid = COMMON.check_argtypes(NAME, console, args, checks=[[0, int]], retargs=0)
if itemid is None:
return False
# Lookup the target item and perform item checks.
thisitem = COMMON.check_item(NAME, console, itemid, owner=True, holding=True)
if not thisitem:
return False
# Delete the item from the database.
console.database.delete_item(thisitem)
# The item is duplified, so start by deleting it from every user's inventory.
if thisitem["duplified"]:
for user in console.router.users.values():
try: # Trap to catch a rare crash
if itemid in user["console"].user["inventory"]:
user["console"].user["inventory"].remove(itemid)
user["console"].msg("{0} vanished from your inventory.".format(thisitem["name"]))
console.database.upsert_user(user["console"].user)
except:
with open('break_item_trap.txt', 'w') as file:
file.write("itemid: {0}, u: {1}".format(str(itemid), user))
file.write("console: {0}".format(user["console"]))
file.write("user: {0}".format(user["console"].user))
# If the item is duplified or we are a wizard, check all rooms for the presence of the item, and delete.
if thisitem["duplified"] or console.user["wizard"]:
for room in console.database.rooms.all():
if itemid in room["items"]:
room["items"].remove(itemid)
console.database.upsert_room(room)
# It's still in our inventory, so it must not have been duplified. Delete it from our inventory now.
if itemid in console.user["inventory"] and not thisitem["duplified"]:
console.user["inventory"].remove(itemid)
console.msg("{0} vanished from your inventory.".format(thisitem["name"]))
console.database.upsert_user(console.user)
# Finished.
console.msg("{0}: Done.".format(NAME))
return True
| name = 'break item'
categories = ['items']
aliases = ['delete item', 'destroy item', 'remove item']
usage = 'break item <item_id>'
description = 'Break the item in your inventory with ID <item_id>.\n\nYou must own the item and it must be in your inventory in order to break it.\nWizards can break any item from anywhere.\n\nEx. `break item 4` to break the item with ID 4.'
def command(console, args):
if not COMMON.check(NAME, console, args, argc=1):
return False
itemid = COMMON.check_argtypes(NAME, console, args, checks=[[0, int]], retargs=0)
if itemid is None:
return False
thisitem = COMMON.check_item(NAME, console, itemid, owner=True, holding=True)
if not thisitem:
return False
console.database.delete_item(thisitem)
if thisitem['duplified']:
for user in console.router.users.values():
try:
if itemid in user['console'].user['inventory']:
user['console'].user['inventory'].remove(itemid)
user['console'].msg('{0} vanished from your inventory.'.format(thisitem['name']))
console.database.upsert_user(user['console'].user)
except:
with open('break_item_trap.txt', 'w') as file:
file.write('itemid: {0}, u: {1}'.format(str(itemid), user))
file.write('console: {0}'.format(user['console']))
file.write('user: {0}'.format(user['console'].user))
if thisitem['duplified'] or console.user['wizard']:
for room in console.database.rooms.all():
if itemid in room['items']:
room['items'].remove(itemid)
console.database.upsert_room(room)
if itemid in console.user['inventory'] and (not thisitem['duplified']):
console.user['inventory'].remove(itemid)
console.msg('{0} vanished from your inventory.'.format(thisitem['name']))
console.database.upsert_user(console.user)
console.msg('{0}: Done.'.format(NAME))
return True |
def buildPalindrome(st):
if st == st[::-1]: # Check for initial palindrome
return st
index = 0
subStr = st[index:]
while subStr != subStr[::-1]: # while substring is not a palindrome
index += 1
subStr = st[index:]
return st + st[index - 1 :: -1]
| def build_palindrome(st):
if st == st[::-1]:
return st
index = 0
sub_str = st[index:]
while subStr != subStr[::-1]:
index += 1
sub_str = st[index:]
return st + st[index - 1::-1] |
class node:
def __init__(self, ID, log):
self.ID = ID
self.log = log
self.peers = list()
class ISP(node):
def __init__(self, ID, log):
super().__init__(ID, log)
self.type = 'ISP'
def print(self):
print(self.ID, self.log, self.peers, self.type)
class butt(node):
def __init__(self, ID, log):
super().__init__(ID, log)
self.peers = None
self.type = 'Butt'
def print(self):
print(self.ID, self.log, self.peers, self.type)
def connect(self, ISP):
if (self.peers != None):
self.peers.peers.remove(self)
self.peers = ISP
ISP.peers.append(self) | class Node:
def __init__(self, ID, log):
self.ID = ID
self.log = log
self.peers = list()
class Isp(node):
def __init__(self, ID, log):
super().__init__(ID, log)
self.type = 'ISP'
def print(self):
print(self.ID, self.log, self.peers, self.type)
class Butt(node):
def __init__(self, ID, log):
super().__init__(ID, log)
self.peers = None
self.type = 'Butt'
def print(self):
print(self.ID, self.log, self.peers, self.type)
def connect(self, ISP):
if self.peers != None:
self.peers.peers.remove(self)
self.peers = ISP
ISP.peers.append(self) |
__all__ = [
"gen_init_string"
, "gen_function_declaration_string"
, "gen_array_declaration"
]
def gen_init_string(_type, initializer, indent):
init_code = ""
if initializer is not None:
raw_code = _type.gen_usage_string(initializer)
# add indent to initializer code
init_code_lines = raw_code.split('\n')
init_code = "@b=@b" + init_code_lines[0]
for line in init_code_lines[1:]:
init_code += "\n" + indent + line
return init_code
def gen_function_declaration_string(indent, function,
pointer_name = None,
array_size = None
):
if function.args is None:
args = "void"
else:
args = ",@s".join(a.declaration_string for a in function.args)
return "{indent}{static}{inline}{ret_type}{name}(@a{args}@c)".format(
indent = indent,
static = "static@b" if function.static else "",
inline = "inline@b" if function.inline else "",
ret_type = function.ret_type.declaration_string,
name = function.c_name if pointer_name is None else (
"(*" + pointer_name + gen_array_declaration(array_size) + ')'
),
args = args
)
def gen_array_declaration(array_size):
if array_size is not None:
if array_size == 0:
array_decl = "[]"
elif array_size > 0:
array_decl = '[' + str(array_size) + ']'
else:
array_decl = ""
return array_decl
| __all__ = ['gen_init_string', 'gen_function_declaration_string', 'gen_array_declaration']
def gen_init_string(_type, initializer, indent):
init_code = ''
if initializer is not None:
raw_code = _type.gen_usage_string(initializer)
init_code_lines = raw_code.split('\n')
init_code = '@b=@b' + init_code_lines[0]
for line in init_code_lines[1:]:
init_code += '\n' + indent + line
return init_code
def gen_function_declaration_string(indent, function, pointer_name=None, array_size=None):
if function.args is None:
args = 'void'
else:
args = ',@s'.join((a.declaration_string for a in function.args))
return '{indent}{static}{inline}{ret_type}{name}(@a{args}@c)'.format(indent=indent, static='static@b' if function.static else '', inline='inline@b' if function.inline else '', ret_type=function.ret_type.declaration_string, name=function.c_name if pointer_name is None else '(*' + pointer_name + gen_array_declaration(array_size) + ')', args=args)
def gen_array_declaration(array_size):
if array_size is not None:
if array_size == 0:
array_decl = '[]'
elif array_size > 0:
array_decl = '[' + str(array_size) + ']'
else:
array_decl = ''
return array_decl |
with open("data/iris.csv") as f:
for line in f:
print (line.split(',')[:4]) | with open('data/iris.csv') as f:
for line in f:
print(line.split(',')[:4]) |
"""
Question 6
Write a function that will copy the contents of one file to a new file.
"""
def copy_file(infile, outfile):
with open(infile) as file:
with open(outfile, 'w') as new_file:
new_file.write(file.read())
copy_file('capitals.txt', 'new_capitals.txt')
| """
Question 6
Write a function that will copy the contents of one file to a new file.
"""
def copy_file(infile, outfile):
with open(infile) as file:
with open(outfile, 'w') as new_file:
new_file.write(file.read())
copy_file('capitals.txt', 'new_capitals.txt') |
"""A mocked database module."""
class DatabaseMongoCollectionMock:
"""The mocked database mongo class."""
def __init__(self, config):
"""Start the class."""
self.config = config
self.dummy_doc = {}
self.valid_response = {"_id": 123, "key": "456", "value": "789"}
async def find_one(self, key):
"""Mock method find_one.
Args: key(object) not considered for test
"""
return self.valid_response
async def update_one(self, key, update, **kwargs):
"""Mock method update_one.
Args: key(object) not considered for test
"""
return self.dummy_doc
async def delete_one(self, key):
"""Mock method delete_one.
Args: key(object) not considered for test
"""
return self.dummy_doc
| """A mocked database module."""
class Databasemongocollectionmock:
"""The mocked database mongo class."""
def __init__(self, config):
"""Start the class."""
self.config = config
self.dummy_doc = {}
self.valid_response = {'_id': 123, 'key': '456', 'value': '789'}
async def find_one(self, key):
"""Mock method find_one.
Args: key(object) not considered for test
"""
return self.valid_response
async def update_one(self, key, update, **kwargs):
"""Mock method update_one.
Args: key(object) not considered for test
"""
return self.dummy_doc
async def delete_one(self, key):
"""Mock method delete_one.
Args: key(object) not considered for test
"""
return self.dummy_doc |
n, m = map(int, input().split())
s = input().split()
t = input().split()
q = int(input())
for _ in range(q):
y = int(input())
print(s[(y-1)%len(s)]+t[(y-1)%len(t)])
| (n, m) = map(int, input().split())
s = input().split()
t = input().split()
q = int(input())
for _ in range(q):
y = int(input())
print(s[(y - 1) % len(s)] + t[(y - 1) % len(t)]) |
pkgname = "scdoc"
pkgver = "1.11.2"
pkgrel = 0
build_style = "makefile"
make_cmd = "gmake"
hostmakedepends = ["pkgconf", "gmake"]
pkgdesc = "Tool for generating roff manual pages"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://git.sr.ht/~sircmpwn/scdoc"
source = f"https://git.sr.ht/~sircmpwn/scdoc/archive/{pkgver}.tar.gz"
sha256 = "e9ff9981b5854301789a6778ee64ef1f6d1e5f4829a9dd3e58a9a63eacc2e6f0"
tool_flags = {"CFLAGS": [f"-DVERSION=\"{pkgver}\""]}
if self.cross_build:
hostmakedepends = ["scdoc"]
def pre_build(self):
if not self.cross_build:
return
self.ln_s("/usr/bin/scdoc", self.cwd / "scdoc")
def post_install(self):
self.install_license("COPYING")
| pkgname = 'scdoc'
pkgver = '1.11.2'
pkgrel = 0
build_style = 'makefile'
make_cmd = 'gmake'
hostmakedepends = ['pkgconf', 'gmake']
pkgdesc = 'Tool for generating roff manual pages'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
url = 'https://git.sr.ht/~sircmpwn/scdoc'
source = f'https://git.sr.ht/~sircmpwn/scdoc/archive/{pkgver}.tar.gz'
sha256 = 'e9ff9981b5854301789a6778ee64ef1f6d1e5f4829a9dd3e58a9a63eacc2e6f0'
tool_flags = {'CFLAGS': [f'-DVERSION="{pkgver}"']}
if self.cross_build:
hostmakedepends = ['scdoc']
def pre_build(self):
if not self.cross_build:
return
self.ln_s('/usr/bin/scdoc', self.cwd / 'scdoc')
def post_install(self):
self.install_license('COPYING') |
"""Base class for file formatters"""
__all__ = [
'BaseFormatter',
]
class BaseFormatter:
@classmethod
def from_file(cls, instr, filename=None, *args, **kwargs):
"""Reads a game from a file.
Args:
instr: The input stream.
filename: The filename, if any, for tool messages.
Returns:
A Game containing the game data.
"""
raise NotImplementedError()
@classmethod
def to_file(
cls, game, outstr, lua_writer_cls=None, lua_writer_args=None,
filename=None, *args, **kwargs):
"""Writes a game to a file.
Args:
game: The Game to write.
outstr: The output stream.
lua_writer_cls: The Lua writer class to use. If None, defaults to
LuaEchoWriter.
lua_writer_args: Args to pass to the Lua writer.
filename: The filename, if any, for tool messages.
"""
raise NotImplementedError()
| """Base class for file formatters"""
__all__ = ['BaseFormatter']
class Baseformatter:
@classmethod
def from_file(cls, instr, filename=None, *args, **kwargs):
"""Reads a game from a file.
Args:
instr: The input stream.
filename: The filename, if any, for tool messages.
Returns:
A Game containing the game data.
"""
raise not_implemented_error()
@classmethod
def to_file(cls, game, outstr, lua_writer_cls=None, lua_writer_args=None, filename=None, *args, **kwargs):
"""Writes a game to a file.
Args:
game: The Game to write.
outstr: The output stream.
lua_writer_cls: The Lua writer class to use. If None, defaults to
LuaEchoWriter.
lua_writer_args: Args to pass to the Lua writer.
filename: The filename, if any, for tool messages.
"""
raise not_implemented_error() |
__version__ = "3.2"
__author__ = "pyLARDA-dev-team"
__doc_link__ = "https://lacros-tropos.github.io/larda-doc/"
__init_text__ = f""">> LARDA initialized. Documentation available at {__doc_link__}"""
__default_info__ = """
The data from this campaign is provided by larda without warranty and liability.
Before publishing check the data license and contact the principal investigator.
Detailed information might be available using `larda.description('system', 'parameter')`."""
| __version__ = '3.2'
__author__ = 'pyLARDA-dev-team'
__doc_link__ = 'https://lacros-tropos.github.io/larda-doc/'
__init_text__ = f'>> LARDA initialized. Documentation available at {__doc_link__}'
__default_info__ = "\nThe data from this campaign is provided by larda without warranty and liability.\nBefore publishing check the data license and contact the principal investigator.\nDetailed information might be available using `larda.description('system', 'parameter')`." |
# -*- coding: utf-8 -*-
##########################################################################
# pySAP - Copyright (C) CEA, 2017 - 2018
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########################################################################
_Exception = Exception
class Exception(_Exception):
""" Base class for all exceptions in pysap.
"""
def __init__(self, *args, **kwargs):
_Exception.__init__(self, *args, **kwargs)
class Sparse2dError(Exception):
""" Base exception type for the package.
"""
def __init__(self, message):
super(Sparse2dError, self).__init__(message)
class Sparse2dRuntimeError(Sparse2dError):
""" Error thrown when call to the Sparse2d software failed.
"""
def __init__(self, algorithm_name, parameters, error=None):
message = (
"Sparse2d call for '{0}' failed, with parameters: '{1}'. Error:: "
"{2}.".format(algorithm_name, parameters, error))
super(Sparse2dRuntimeError, self).__init__(message)
class Sparse2dConfigurationError(Sparse2dError):
""" Error thrown when call to the Sparse2d software failed.
"""
def __init__(self, command_name):
message = "Sparse2d command '{0}' not found.".format(command_name)
super(Sparse2dConfigurationError, self).__init__(message)
| __exception = Exception
class Exception(_Exception):
""" Base class for all exceptions in pysap.
"""
def __init__(self, *args, **kwargs):
_Exception.__init__(self, *args, **kwargs)
class Sparse2Derror(Exception):
""" Base exception type for the package.
"""
def __init__(self, message):
super(Sparse2dError, self).__init__(message)
class Sparse2Druntimeerror(Sparse2dError):
""" Error thrown when call to the Sparse2d software failed.
"""
def __init__(self, algorithm_name, parameters, error=None):
message = "Sparse2d call for '{0}' failed, with parameters: '{1}'. Error:: {2}.".format(algorithm_name, parameters, error)
super(Sparse2dRuntimeError, self).__init__(message)
class Sparse2Dconfigurationerror(Sparse2dError):
""" Error thrown when call to the Sparse2d software failed.
"""
def __init__(self, command_name):
message = "Sparse2d command '{0}' not found.".format(command_name)
super(Sparse2dConfigurationError, self).__init__(message) |
#Simple calc
operations_math = ['+', '-', '*', '/']
print('This is simle calc')
try:
a = float(input('a = '))
b = float(input('b = '))
choice = input('Please input math operations: +, -, *, / and get result for you')
if choice == operations_math[0]:
print(a+b)
elif choice == operations_math[1]:
print(a-b)
print(b-a)
elif choice == operations_math[2]:
print(a*b)
elif choice == operations_math[3]:
print(a/b)
print(b/a)
else:
print('Incorrect input')
except ValueError:
print('Next time, please insert correct integer numbers!')
except ZeroDivisionError:
print('On zero share cannot be!')
| operations_math = ['+', '-', '*', '/']
print('This is simle calc')
try:
a = float(input('a = '))
b = float(input('b = '))
choice = input('Please input math operations: +, -, *, / and get result for you')
if choice == operations_math[0]:
print(a + b)
elif choice == operations_math[1]:
print(a - b)
print(b - a)
elif choice == operations_math[2]:
print(a * b)
elif choice == operations_math[3]:
print(a / b)
print(b / a)
else:
print('Incorrect input')
except ValueError:
print('Next time, please insert correct integer numbers!')
except ZeroDivisionError:
print('On zero share cannot be!') |
# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
a = int(input())
b = list(map(int, input().split()))
maximun = b[0]
minimun = b[0]
for data in b:
if maximun < data:
maximun = data
if minimun > data:
minimun = data
if(maximun - minimun + 1 == a):
print("YES")
else:
print("NO")
| a = int(input())
b = list(map(int, input().split()))
maximun = b[0]
minimun = b[0]
for data in b:
if maximun < data:
maximun = data
if minimun > data:
minimun = data
if maximun - minimun + 1 == a:
print('YES')
else:
print('NO') |
class Solution:
def convertToTitle(self, columnNumber: int) -> str:
if columnNumber < 27:
return chr(ord('A') - 1 + columnNumber)
val = list()
columnNumber = columnNumber - 1
while(True):
val.append(columnNumber % 26)
if (columnNumber < 26):
break
columnNumber = columnNumber // 26 - 1
ans = list()
for i in range(len(val)-1,-1,-1):
ans.append(chr(ord('A') + val[i]))
return "".join(ans)
| class Solution:
def convert_to_title(self, columnNumber: int) -> str:
if columnNumber < 27:
return chr(ord('A') - 1 + columnNumber)
val = list()
column_number = columnNumber - 1
while True:
val.append(columnNumber % 26)
if columnNumber < 26:
break
column_number = columnNumber // 26 - 1
ans = list()
for i in range(len(val) - 1, -1, -1):
ans.append(chr(ord('A') + val[i]))
return ''.join(ans) |
a = b = source()
c = 3
if c:
b = source2()
sink(b) | a = b = source()
c = 3
if c:
b = source2()
sink(b) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def garage(init_arr, final_arr):
init_arr = init_arr[::]
seqs = 0
seq = []
while init_arr != final_arr:
zero = init_arr.index(0)
if zero != final_arr.index(0):
tmp_val = final_arr[zero]
tmp_pos = init_arr.index(tmp_val)
init_arr[zero], init_arr[tmp_pos] = init_arr[tmp_pos], init_arr[zero]
else:
for i, v in enumerate(init_arr):
if v != final_arr[i]:
init_arr[zero], init_arr[i] = init_arr[i], init_arr[zero]
break
seqs += 1
seq.append(init_arr[::])
return seqs, seq
| def garage(init_arr, final_arr):
init_arr = init_arr[:]
seqs = 0
seq = []
while init_arr != final_arr:
zero = init_arr.index(0)
if zero != final_arr.index(0):
tmp_val = final_arr[zero]
tmp_pos = init_arr.index(tmp_val)
(init_arr[zero], init_arr[tmp_pos]) = (init_arr[tmp_pos], init_arr[zero])
else:
for (i, v) in enumerate(init_arr):
if v != final_arr[i]:
(init_arr[zero], init_arr[i]) = (init_arr[i], init_arr[zero])
break
seqs += 1
seq.append(init_arr[:])
return (seqs, seq) |
def test_environment_is_qa(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://myqa-env.com'
assert port == '80'
def test_environment_is_dev(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://mydev-env.com'
assert port == '8080'
| def test_environment_is_qa(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://myqa-env.com'
assert port == '80'
def test_environment_is_dev(app_config):
base_url = app_config.base_url
port = app_config.app_port
assert base_url == 'https://mydev-env.com'
assert port == '8080' |
class MyClass:
def __init__(self, my_val):
self.my_val = my_val
my_class = MyClass(1)
print(my_class.my_val)
print(2)
res = 2 | class Myclass:
def __init__(self, my_val):
self.my_val = my_val
my_class = my_class(1)
print(my_class.my_val)
print(2)
res = 2 |
'''
This problem was asked by Facebook.
Given a binary tree, return all paths from the root to leaves.
For example, given the tree:
1
/ \
2 3
/ \
4 5
Return [[1, 2], [1, 3, 4], [1, 3, 5]].
'''
# Definition for a binary tree node
class TreeNode:
def __init__(self, x, left=None, right=None):
self.val = x
self.left = left
self.right = right
def __repr__(self):
return str(self.val)
def dfs(root):
result = []
stack = [(root, [])]
while stack:
node, nodes_chain = stack.pop()
if node.left is None and node.right is None:
result.append(nodes_chain+[node.val])
else:
if node.right:
stack.append((node.right, nodes_chain+[node.val]))
if node.left:
stack.append((node.left, nodes_chain+[node.val]))
return result
if __name__ == "__main__":
data = [
[
TreeNode(1, TreeNode(2), TreeNode(3, TreeNode(4), TreeNode(5))),
[[1, 2], [1, 3, 4], [1, 3, 5]]
]
]
for d in data:
print('input', d[0], 'output', dfs(d[0])) | """
This problem was asked by Facebook.
Given a binary tree, return all paths from the root to leaves.
For example, given the tree:
1
/ 2 3
/ 4 5
Return [[1, 2], [1, 3, 4], [1, 3, 5]].
"""
class Treenode:
def __init__(self, x, left=None, right=None):
self.val = x
self.left = left
self.right = right
def __repr__(self):
return str(self.val)
def dfs(root):
result = []
stack = [(root, [])]
while stack:
(node, nodes_chain) = stack.pop()
if node.left is None and node.right is None:
result.append(nodes_chain + [node.val])
else:
if node.right:
stack.append((node.right, nodes_chain + [node.val]))
if node.left:
stack.append((node.left, nodes_chain + [node.val]))
return result
if __name__ == '__main__':
data = [[tree_node(1, tree_node(2), tree_node(3, tree_node(4), tree_node(5))), [[1, 2], [1, 3, 4], [1, 3, 5]]]]
for d in data:
print('input', d[0], 'output', dfs(d[0])) |
def loadPostSample():
posts = [['my','dog','has','flea','problems','help','please'],
['maybe','not','take','him','to','dog','park','stupid'],
['my','dalmation','is','so','cute','I','love','him'],
['stop','posting','stupid','worthless','garbage'],
['mr','licks','ate','my','steak','how','to','stop','him'],
['quit','buying','worthless','dog','food','stupid']
]
classVec = ['good','bad','good','bad','good','bad']
return posts,classVec | def load_post_sample():
posts = [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'], ['stop', 'posting', 'stupid', 'worthless', 'garbage'], ['mr', 'licks', 'ate', 'my', 'steak', 'how', 'to', 'stop', 'him'], ['quit', 'buying', 'worthless', 'dog', 'food', 'stupid']]
class_vec = ['good', 'bad', 'good', 'bad', 'good', 'bad']
return (posts, classVec) |
PROVIDER = "S3"
KEY = ""
SECRET = ""
CONTAINER = "yoredis.com"
# FOR LOCAL
PROVIDER = "LOCAL"
CONTAINER = "container_1"
CONTAINER2 = "container_2" | provider = 'S3'
key = ''
secret = ''
container = 'yoredis.com'
provider = 'LOCAL'
container = 'container_1'
container2 = 'container_2' |
def propagate_go(go_id, parent_set, go_term_dict):
if len(go_term_dict[go_id]) == 0:
return parent_set
for parent in go_term_dict[go_id]:
parent_set.add(parent)
for parent in go_term_dict[go_id]:
propagate_go(parent, parent_set, go_term_dict)
return parent_set
def form_all_go_parents_dict(go_term_dict):
go_parents_dict = dict()
for go_id in go_term_dict:
parent_set = set()
parent_set = propagate_go(go_id, parent_set, go_term_dict)
go_parents_dict[go_id] = parent_set
return go_parents_dict
| def propagate_go(go_id, parent_set, go_term_dict):
if len(go_term_dict[go_id]) == 0:
return parent_set
for parent in go_term_dict[go_id]:
parent_set.add(parent)
for parent in go_term_dict[go_id]:
propagate_go(parent, parent_set, go_term_dict)
return parent_set
def form_all_go_parents_dict(go_term_dict):
go_parents_dict = dict()
for go_id in go_term_dict:
parent_set = set()
parent_set = propagate_go(go_id, parent_set, go_term_dict)
go_parents_dict[go_id] = parent_set
return go_parents_dict |
def collide(obj1, obj2):
offset_x = obj2.x - obj1.x
offset_y = obj2.y - obj1.y
return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None
| def collide(obj1, obj2):
offset_x = obj2.x - obj1.x
offset_y = obj2.y - obj1.y
return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None |
"""
2.1
Remove duplicates from an unsorted linked lists.
What if a temporary buffer is not allow?
"""
# SOLUTION 1 - HASHTABLE
# EFFICIENCY
# space: O(n) time: O(n)
def remove_dups_ht(sll):
d = {}
c = sll
l = sll
while c:
if c.val in d:
l.nxt = c.nxt
c = l.nxt
else:
d[c.val] = True
c = c.nxt
l = l.nxt
return sll
# SOLUTION 2 - SCOUT
# EFFICIENCY
# space: 0(1) time: O(n^2)
def remove_dups_scout(sll):
c = sll
while c:
t = c.nxt
l = c
while t:
if t.val != c.val:
t = t.nxt
l = l.nxt
else:
l.nxt = t.nxt
t = l.nxt
c = c.nxt
return sll
"""
2.2
Find the kth to the last element of a singly linked list.
(if k = 1, the last element would be returned)
"""
# SOLUTION - ITERATIVE
# EFFICIENCY
# space: O(1) time: O(n)
def kth_to_last(sll):
s = sll
while k > 0:
s = s.nxt
k -= 1
c = sll
while s.nxt:
s = s.nxt
c = c.nxt
return c
"""
2.3
Delete a node in the middle (i.e., any node but the first and last node, not necessarily the exact middle)
of a singly linked list, given only access to that node.
"""
# SOLUTION - COPY & REPLACE
# EFFICIENCY
# space: O(1) time: O(1)
def delete_mid(node):
c = node
t = node.nxt
if not t.nxt:
raise Exception('The next node is the last in the list. You cannot delete the last node.')
c.val = t.val
c.nxt = t.nxt
| """
2.1
Remove duplicates from an unsorted linked lists.
What if a temporary buffer is not allow?
"""
def remove_dups_ht(sll):
d = {}
c = sll
l = sll
while c:
if c.val in d:
l.nxt = c.nxt
c = l.nxt
else:
d[c.val] = True
c = c.nxt
l = l.nxt
return sll
def remove_dups_scout(sll):
c = sll
while c:
t = c.nxt
l = c
while t:
if t.val != c.val:
t = t.nxt
l = l.nxt
else:
l.nxt = t.nxt
t = l.nxt
c = c.nxt
return sll
'\n2.2\nFind the kth to the last element of a singly linked list.\n(if k = 1, the last element would be returned)\n'
def kth_to_last(sll):
s = sll
while k > 0:
s = s.nxt
k -= 1
c = sll
while s.nxt:
s = s.nxt
c = c.nxt
return c
'\n2.3\nDelete a node in the middle (i.e., any node but the first and last node, not necessarily the exact middle)\nof a singly linked list, given only access to that node.\n'
def delete_mid(node):
c = node
t = node.nxt
if not t.nxt:
raise exception('The next node is the last in the list. You cannot delete the last node.')
c.val = t.val
c.nxt = t.nxt |
L1 = [1, 2, 3, 4]
L2 = ['A', 'B', 'C', 'D']
meshtuple = []
for x in L1:
for y in L2:
meshtuple.append([x, y])
print(meshtuple)
| l1 = [1, 2, 3, 4]
l2 = ['A', 'B', 'C', 'D']
meshtuple = []
for x in L1:
for y in L2:
meshtuple.append([x, y])
print(meshtuple) |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
TERM_FILTERS_QUERY = {
"bool": {
"must": [
{
"multi_match": {
"query": "mock_feature",
"fields": [
"feature_name.raw^25",
"feature_name^7",
"feature_group.raw^15",
"feature_group^7",
"version^7",
"description^3",
"status",
"entity",
"tags",
"badges",
],
"type": "cross_fields",
}
}
],
"filter": [
{"wildcard": {"badges": "pii"}},
{
"bool": {
"should": [
{"wildcard": {"feature_group.raw": "test_group"}},
{"wildcard": {"feature_group.raw": "mock_group"}},
],
"minimum_should_match": 1,
}
},
],
}
}
TERM_QUERY = {
"bool": {
"must": [
{
"multi_match": {
"query": "mock_table",
"fields": [
"name^3",
"name.raw^3",
"schema^2",
"description",
"column_names",
"badges",
],
"type": "cross_fields",
}
}
]
}
}
FILTER_QUERY = {
"bool": {
"filter": [
{
"bool": {
"should": [{"wildcard": {"name.raw": "mock_dashobard_*"}}],
"minimum_should_match": 1,
}
},
{
"bool": {
"should": [
{"wildcard": {"group_name.raw": "test_group"}},
{"wildcard": {"group_name.raw": "mock_group"}},
],
"minimum_should_match": 1,
}
},
{"wildcard": {"tags": "tag_*"}},
{"wildcard": {"tags": "tag_2"}},
]
}
}
RESPONSE_1 = [
{
"took": 10,
"timed_out": False,
"_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
"hits": {
"total": {"value": 2, "relation": "eq"},
"max_score": 804.52716,
"hits": [
{
"_index": "table_search_index",
"_type": "table",
"_id": "mock_id_1",
"_score": 804.52716,
"_source": {
"badges": ["pii", "beta"],
"cluster": "mock_cluster",
"column_descriptions": [
"mock_col_desc_1",
"mock_col_desc_2",
"mock_col_desc_3",
],
"column_names": ["mock_col_1", "mock_col_2", "mock_col_3"],
"database": "mock_db",
"description": "mock table description",
"display_name": "mock_schema.mock_table_1",
"key": "mock_db://mock_cluster.mock_schema/mock_table_1",
"last_updated_timestamp": 1635831717,
"name": "mock_table_1",
"programmatic_descriptions": [],
"schema": "mock_schema",
"schema_description": None,
"tags": ["mock_tag_1", "mock_tag_2", "mock_tag_3"],
"total_usage": 74841,
"unique_usage": 457,
"resource_type": "table",
},
},
{
"_index": "table_search_index",
"_type": "table",
"_id": "mock_id_2",
"_score": 9.104584,
"_source": {
"badges": [],
"cluster": "mock_cluster",
"column_descriptions": [
"mock_col_desc_1",
"mock_col_desc_2",
"mock_col_desc_3",
],
"column_names": ["mock_col_1", "mock_col_2", "mock_col_3"],
"database": "mock_db",
"description": "mock table description",
"display_name": "mock_schema.mock_table_2",
"key": "mock_db://mock_cluster.mock_schema/mock_table_2",
"last_updated_timestamp": 1635831717,
"name": "mock_table_2",
"programmatic_descriptions": [],
"schema": "mock_schema",
"schema_description": None,
"tags": ["mock_tag_4", "mock_tag_5", "mock_tag_6"],
"total_usage": 4715,
"unique_usage": 254,
"resource_type": "table",
},
},
],
},
"status": 200,
},
{
"took": 1,
"timed_out": False,
"_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
"hits": {
"total": {"value": 0, "relation": "eq"},
"max_score": None,
"hits": [],
},
"status": 200,
},
]
RESPONSE_2 = [
{
"took": 12,
"timed_out": False,
"_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
"hits": {
"total": {"value": 2, "relation": "eq"},
"max_score": 771.9865,
"hits": [
{
"_index": "table_search_index",
"_type": "table",
"_id": "mock_id_1",
"_score": 804.52716,
"_source": {
"badges": ["pii", "beta"],
"cluster": "mock_cluster",
"column_descriptions": [
"mock_col_desc_1",
"mock_col_desc_2",
"mock_col_desc_3",
],
"column_names": ["mock_col_1", "mock_col_2", "mock_col_3"],
"database": "mock_db",
"description": "mock table description",
"display_name": "mock_schema.mock_table_1",
"key": "mock_db://mock_cluster.mock_schema/mock_table_1",
"last_updated_timestamp": 1635831717,
"name": "mock_table_1",
"programmatic_descriptions": [],
"schema": "mock_schema",
"schema_description": None,
"tags": ["mock_tag_1", "mock_tag_2", "mock_tag_3"],
"total_usage": 74841,
"unique_usage": 457,
"resource_type": "table",
},
},
{
"_index": "table_search_index",
"_type": "table",
"_id": "mock_id_2",
"_score": 9.104584,
"_source": {
"badges": [],
"cluster": "mock_cluster",
"column_descriptions": [
"mock_col_desc_1",
"mock_col_desc_2",
"mock_col_desc_3",
],
"column_names": ["mock_col_1", "mock_col_2", "mock_col_3"],
"database": "mock_db",
"description": "mock table description",
"display_name": "mock_schema.mock_table_2",
"key": "mock_db://mock_cluster.mock_schema/mock_table_2",
"last_updated_timestamp": 1635831717,
"name": "mock_table_2",
"programmatic_descriptions": [],
"schema": "mock_schema",
"schema_description": None,
"tags": ["mock_tag_4", "mock_tag_5", "mock_tag_6"],
"total_usage": 4715,
"unique_usage": 254,
"resource_type": "table",
},
},
],
},
"status": 200,
},
{
"took": 6,
"timed_out": False,
"_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
"hits": {
"total": {"value": 1, "relation": "eq"},
"max_score": 61.40606,
"hits": [
{
"_index": "user_search_index",
"_type": "user",
"_id": "mack_user_id",
"_score": 61.40606,
"_source": {
"email": "mock_user@amundsen.com",
"employee_type": "",
"first_name": "Allison",
"full_name": "Allison Suarez Miranda",
"github_username": "allisonsuarez",
"is_active": True,
"last_name": "Suarez Miranda",
"manager_email": "mock_manager@amundsen.com",
"role_name": "SWE",
"slack_id": "",
"team_name": "Amundsen",
"total_follow": 0,
"total_own": 1,
"total_read": 0,
"resource_type": "user",
},
}
],
},
"status": 200,
},
{
"took": 8,
"timed_out": False,
"_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
"hits": {
"total": {"value": 3, "relation": "eq"},
"max_score": 62.66787,
"hits": [
{
"_index": "feature_search_index",
"_type": "feature",
"_id": "mock_feat_id",
"_score": 62.66787,
"_source": {
"availability": None,
"badges": [],
"description": "mock feature description",
"entity": None,
"feature_group": "fg_2",
"feature_name": "feature_1",
"key": "none/feature_1/1",
"last_updated_timestamp": 1525208316,
"status": "active",
"tags": [],
"total_usage": 0,
"version": 1,
"resource_type": "feature",
},
},
{
"_index": "feature_search_index",
"_type": "feature",
"_id": "mock_feat_id_2",
"_score": 62.66787,
"_source": {
"availability": None,
"badges": [],
"description": "mock feature description",
"entity": None,
"feature_group": "fg_2",
"feature_name": "feature_2",
"key": "fg_2/feature_2/1",
"last_updated_timestamp": 1525208316,
"status": "active",
"tags": [],
"total_usage": 10,
"version": 1,
"resource_type": "feature",
},
},
{
"_index": "feature_search_index",
"_type": "feature",
"_id": "mock_feat_id_3",
"_score": 62.66787,
"_source": {
"availability": None,
"badges": ["pii"],
"description": "mock feature description",
"entity": None,
"feature_group": "fg_3",
"feature_name": "feature_3",
"key": "fg_3/feature_3/2",
"last_updated_timestamp": 1525208316,
"status": "active",
"tags": [],
"total_usage": 3,
"version": 2,
"resource_type": "feature",
},
},
],
},
"status": 200,
},
]
| term_filters_query = {'bool': {'must': [{'multi_match': {'query': 'mock_feature', 'fields': ['feature_name.raw^25', 'feature_name^7', 'feature_group.raw^15', 'feature_group^7', 'version^7', 'description^3', 'status', 'entity', 'tags', 'badges'], 'type': 'cross_fields'}}], 'filter': [{'wildcard': {'badges': 'pii'}}, {'bool': {'should': [{'wildcard': {'feature_group.raw': 'test_group'}}, {'wildcard': {'feature_group.raw': 'mock_group'}}], 'minimum_should_match': 1}}]}}
term_query = {'bool': {'must': [{'multi_match': {'query': 'mock_table', 'fields': ['name^3', 'name.raw^3', 'schema^2', 'description', 'column_names', 'badges'], 'type': 'cross_fields'}}]}}
filter_query = {'bool': {'filter': [{'bool': {'should': [{'wildcard': {'name.raw': 'mock_dashobard_*'}}], 'minimum_should_match': 1}}, {'bool': {'should': [{'wildcard': {'group_name.raw': 'test_group'}}, {'wildcard': {'group_name.raw': 'mock_group'}}], 'minimum_should_match': 1}}, {'wildcard': {'tags': 'tag_*'}}, {'wildcard': {'tags': 'tag_2'}}]}}
response_1 = [{'took': 10, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0}, 'hits': {'total': {'value': 2, 'relation': 'eq'}, 'max_score': 804.52716, 'hits': [{'_index': 'table_search_index', '_type': 'table', '_id': 'mock_id_1', '_score': 804.52716, '_source': {'badges': ['pii', 'beta'], 'cluster': 'mock_cluster', 'column_descriptions': ['mock_col_desc_1', 'mock_col_desc_2', 'mock_col_desc_3'], 'column_names': ['mock_col_1', 'mock_col_2', 'mock_col_3'], 'database': 'mock_db', 'description': 'mock table description', 'display_name': 'mock_schema.mock_table_1', 'key': 'mock_db://mock_cluster.mock_schema/mock_table_1', 'last_updated_timestamp': 1635831717, 'name': 'mock_table_1', 'programmatic_descriptions': [], 'schema': 'mock_schema', 'schema_description': None, 'tags': ['mock_tag_1', 'mock_tag_2', 'mock_tag_3'], 'total_usage': 74841, 'unique_usage': 457, 'resource_type': 'table'}}, {'_index': 'table_search_index', '_type': 'table', '_id': 'mock_id_2', '_score': 9.104584, '_source': {'badges': [], 'cluster': 'mock_cluster', 'column_descriptions': ['mock_col_desc_1', 'mock_col_desc_2', 'mock_col_desc_3'], 'column_names': ['mock_col_1', 'mock_col_2', 'mock_col_3'], 'database': 'mock_db', 'description': 'mock table description', 'display_name': 'mock_schema.mock_table_2', 'key': 'mock_db://mock_cluster.mock_schema/mock_table_2', 'last_updated_timestamp': 1635831717, 'name': 'mock_table_2', 'programmatic_descriptions': [], 'schema': 'mock_schema', 'schema_description': None, 'tags': ['mock_tag_4', 'mock_tag_5', 'mock_tag_6'], 'total_usage': 4715, 'unique_usage': 254, 'resource_type': 'table'}}]}, 'status': 200}, {'took': 1, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0}, 'hits': {'total': {'value': 0, 'relation': 'eq'}, 'max_score': None, 'hits': []}, 'status': 200}]
response_2 = [{'took': 12, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0}, 'hits': {'total': {'value': 2, 'relation': 'eq'}, 'max_score': 771.9865, 'hits': [{'_index': 'table_search_index', '_type': 'table', '_id': 'mock_id_1', '_score': 804.52716, '_source': {'badges': ['pii', 'beta'], 'cluster': 'mock_cluster', 'column_descriptions': ['mock_col_desc_1', 'mock_col_desc_2', 'mock_col_desc_3'], 'column_names': ['mock_col_1', 'mock_col_2', 'mock_col_3'], 'database': 'mock_db', 'description': 'mock table description', 'display_name': 'mock_schema.mock_table_1', 'key': 'mock_db://mock_cluster.mock_schema/mock_table_1', 'last_updated_timestamp': 1635831717, 'name': 'mock_table_1', 'programmatic_descriptions': [], 'schema': 'mock_schema', 'schema_description': None, 'tags': ['mock_tag_1', 'mock_tag_2', 'mock_tag_3'], 'total_usage': 74841, 'unique_usage': 457, 'resource_type': 'table'}}, {'_index': 'table_search_index', '_type': 'table', '_id': 'mock_id_2', '_score': 9.104584, '_source': {'badges': [], 'cluster': 'mock_cluster', 'column_descriptions': ['mock_col_desc_1', 'mock_col_desc_2', 'mock_col_desc_3'], 'column_names': ['mock_col_1', 'mock_col_2', 'mock_col_3'], 'database': 'mock_db', 'description': 'mock table description', 'display_name': 'mock_schema.mock_table_2', 'key': 'mock_db://mock_cluster.mock_schema/mock_table_2', 'last_updated_timestamp': 1635831717, 'name': 'mock_table_2', 'programmatic_descriptions': [], 'schema': 'mock_schema', 'schema_description': None, 'tags': ['mock_tag_4', 'mock_tag_5', 'mock_tag_6'], 'total_usage': 4715, 'unique_usage': 254, 'resource_type': 'table'}}]}, 'status': 200}, {'took': 6, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0}, 'hits': {'total': {'value': 1, 'relation': 'eq'}, 'max_score': 61.40606, 'hits': [{'_index': 'user_search_index', '_type': 'user', '_id': 'mack_user_id', '_score': 61.40606, '_source': {'email': 'mock_user@amundsen.com', 'employee_type': '', 'first_name': 'Allison', 'full_name': 'Allison Suarez Miranda', 'github_username': 'allisonsuarez', 'is_active': True, 'last_name': 'Suarez Miranda', 'manager_email': 'mock_manager@amundsen.com', 'role_name': 'SWE', 'slack_id': '', 'team_name': 'Amundsen', 'total_follow': 0, 'total_own': 1, 'total_read': 0, 'resource_type': 'user'}}]}, 'status': 200}, {'took': 8, 'timed_out': False, '_shards': {'total': 5, 'successful': 5, 'skipped': 0, 'failed': 0}, 'hits': {'total': {'value': 3, 'relation': 'eq'}, 'max_score': 62.66787, 'hits': [{'_index': 'feature_search_index', '_type': 'feature', '_id': 'mock_feat_id', '_score': 62.66787, '_source': {'availability': None, 'badges': [], 'description': 'mock feature description', 'entity': None, 'feature_group': 'fg_2', 'feature_name': 'feature_1', 'key': 'none/feature_1/1', 'last_updated_timestamp': 1525208316, 'status': 'active', 'tags': [], 'total_usage': 0, 'version': 1, 'resource_type': 'feature'}}, {'_index': 'feature_search_index', '_type': 'feature', '_id': 'mock_feat_id_2', '_score': 62.66787, '_source': {'availability': None, 'badges': [], 'description': 'mock feature description', 'entity': None, 'feature_group': 'fg_2', 'feature_name': 'feature_2', 'key': 'fg_2/feature_2/1', 'last_updated_timestamp': 1525208316, 'status': 'active', 'tags': [], 'total_usage': 10, 'version': 1, 'resource_type': 'feature'}}, {'_index': 'feature_search_index', '_type': 'feature', '_id': 'mock_feat_id_3', '_score': 62.66787, '_source': {'availability': None, 'badges': ['pii'], 'description': 'mock feature description', 'entity': None, 'feature_group': 'fg_3', 'feature_name': 'feature_3', 'key': 'fg_3/feature_3/2', 'last_updated_timestamp': 1525208316, 'status': 'active', 'tags': [], 'total_usage': 3, 'version': 2, 'resource_type': 'feature'}}]}, 'status': 200}] |
# THEMES
# Requires restart
# Change the theme variable in config.py to one of these:
black = {
'foreground': '#FFFFFF',
'background': '#000000',
'fontshadow': '#010101'
}
orange = {
'foreground': '#d75f00',
'background': '#303030',
'fontshadow': '#010101'
}
| black = {'foreground': '#FFFFFF', 'background': '#000000', 'fontshadow': '#010101'}
orange = {'foreground': '#d75f00', 'background': '#303030', 'fontshadow': '#010101'} |
"""
This code was Ported from CPython's sha512module.c
"""
SHA_BLOCKSIZE = 128
SHA_DIGESTSIZE = 64
def new_shaobject():
return {
"digest": [0] * 8,
"count_lo": 0,
"count_hi": 0,
"data": [0] * SHA_BLOCKSIZE,
"local": 0,
"digestsize": 0,
}
ROR64 = (
lambda x, y: (((x & 0xFFFFFFFFFFFFFFFF) >> (y & 63)) | (x << (64 - (y & 63))))
& 0xFFFFFFFFFFFFFFFF
)
Ch = lambda x, y, z: (z ^ (x & (y ^ z)))
Maj = lambda x, y, z: (((x | y) & z) | (x & y))
S = lambda x, n: ROR64(x, n)
R = lambda x, n: (x & 0xFFFFFFFFFFFFFFFF) >> n
Sigma0 = lambda x: (S(x, 28) ^ S(x, 34) ^ S(x, 39))
Sigma1 = lambda x: (S(x, 14) ^ S(x, 18) ^ S(x, 41))
Gamma0 = lambda x: (S(x, 1) ^ S(x, 8) ^ R(x, 7))
Gamma1 = lambda x: (S(x, 19) ^ S(x, 61) ^ R(x, 6))
def sha_transform(sha_info):
W = []
d = sha_info["data"]
for i in range(0, 16):
W.append(
(d[8 * i] << 56)
+ (d[8 * i + 1] << 48)
+ (d[8 * i + 2] << 40)
+ (d[8 * i + 3] << 32)
+ (d[8 * i + 4] << 24)
+ (d[8 * i + 5] << 16)
+ (d[8 * i + 6] << 8)
+ d[8 * i + 7]
)
for i in range(16, 80):
W.append(
(Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]) & 0xFFFFFFFFFFFFFFFF
)
ss = sha_info["digest"][:]
def RND(a, b, c, d, e, f, g, h, i, ki):
t0 = (h + Sigma1(e) + Ch(e, f, g) + ki + W[i]) & 0xFFFFFFFFFFFFFFFF
t1 = (Sigma0(a) + Maj(a, b, c)) & 0xFFFFFFFFFFFFFFFF
d = (d + t0) & 0xFFFFFFFFFFFFFFFF
h = (t0 + t1) & 0xFFFFFFFFFFFFFFFF
return d & 0xFFFFFFFFFFFFFFFF, h & 0xFFFFFFFFFFFFFFFF
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 0, 0x428A2F98D728AE22
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 1, 0x7137449123EF65CD
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 2, 0xB5C0FBCFEC4D3B2F
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 3, 0xE9B5DBA58189DBBC
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 4, 0x3956C25BF348B538
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 5, 0x59F111F1B605D019
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 6, 0x923F82A4AF194F9B
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 7, 0xAB1C5ED5DA6D8118
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 8, 0xD807AA98A3030242
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 9, 0x12835B0145706FBE
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 10, 0x243185BE4EE4B28C
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 11, 0x550C7DC3D5FFB4E2
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 12, 0x72BE5D74F27B896F
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 13, 0x80DEB1FE3B1696B1
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 14, 0x9BDC06A725C71235
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 15, 0xC19BF174CF692694
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 16, 0xE49B69C19EF14AD2
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 17, 0xEFBE4786384F25E3
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 18, 0x0FC19DC68B8CD5B5
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 19, 0x240CA1CC77AC9C65
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 20, 0x2DE92C6F592B0275
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 21, 0x4A7484AA6EA6E483
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 22, 0x5CB0A9DCBD41FBD4
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 23, 0x76F988DA831153B5
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 24, 0x983E5152EE66DFAB
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 25, 0xA831C66D2DB43210
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 26, 0xB00327C898FB213F
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 27, 0xBF597FC7BEEF0EE4
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 28, 0xC6E00BF33DA88FC2
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 29, 0xD5A79147930AA725
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 30, 0x06CA6351E003826F
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 31, 0x142929670A0E6E70
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 32, 0x27B70A8546D22FFC
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 33, 0x2E1B21385C26C926
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 34, 0x4D2C6DFC5AC42AED
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 35, 0x53380D139D95B3DF
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 36, 0x650A73548BAF63DE
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 37, 0x766A0ABB3C77B2A8
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 38, 0x81C2C92E47EDAEE6
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 39, 0x92722C851482353B
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 40, 0xA2BFE8A14CF10364
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 41, 0xA81A664BBC423001
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 42, 0xC24B8B70D0F89791
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 43, 0xC76C51A30654BE30
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 44, 0xD192E819D6EF5218
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 45, 0xD69906245565A910
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 46, 0xF40E35855771202A
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 47, 0x106AA07032BBD1B8
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 48, 0x19A4C116B8D2D0C8
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 49, 0x1E376C085141AB53
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 50, 0x2748774CDF8EEB99
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 51, 0x34B0BCB5E19B48A8
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 52, 0x391C0CB3C5C95A63
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 53, 0x4ED8AA4AE3418ACB
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 54, 0x5B9CCA4F7763E373
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 55, 0x682E6FF3D6B2B8A3
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 56, 0x748F82EE5DEFB2FC
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 57, 0x78A5636F43172F60
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 58, 0x84C87814A1F0AB72
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 59, 0x8CC702081A6439EC
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 60, 0x90BEFFFA23631E28
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 61, 0xA4506CEBDE82BDE9
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 62, 0xBEF9A3F7B2C67915
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 63, 0xC67178F2E372532B
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 64, 0xCA273ECEEA26619C
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 65, 0xD186B8C721C0C207
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 66, 0xEADA7DD6CDE0EB1E
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 67, 0xF57D4F7FEE6ED178
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 68, 0x06F067AA72176FBA
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 69, 0x0A637DC5A2C898A6
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 70, 0x113F9804BEF90DAE
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 71, 0x1B710B35131C471B
)
ss[3], ss[7] = RND(
ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 72, 0x28DB77F523047D84
)
ss[2], ss[6] = RND(
ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 73, 0x32CAAB7B40C72493
)
ss[1], ss[5] = RND(
ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 74, 0x3C9EBE0A15C9BEBC
)
ss[0], ss[4] = RND(
ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 75, 0x431D67C49C100D4C
)
ss[7], ss[3] = RND(
ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 76, 0x4CC5D4BECB3E42B6
)
ss[6], ss[2] = RND(
ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 77, 0x597F299CFC657E2A
)
ss[5], ss[1] = RND(
ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 78, 0x5FCB6FAB3AD6FAEC
)
ss[4], ss[0] = RND(
ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 79, 0x6C44198C4A475817
)
dig = []
for i, x in enumerate(sha_info["digest"]):
dig.append((x + ss[i]) & 0xFFFFFFFFFFFFFFFF)
sha_info["digest"] = dig
def sha_init():
sha_info = new_shaobject()
sha_info["digest"] = [
0x6A09E667F3BCC908,
0xBB67AE8584CAA73B,
0x3C6EF372FE94F82B,
0xA54FF53A5F1D36F1,
0x510E527FADE682D1,
0x9B05688C2B3E6C1F,
0x1F83D9ABFB41BD6B,
0x5BE0CD19137E2179,
]
sha_info["count_lo"] = 0
sha_info["count_hi"] = 0
sha_info["local"] = 0
sha_info["digestsize"] = 64
return sha_info
def sha384_init():
sha_info = new_shaobject()
sha_info["digest"] = [
0xCBBB9D5DC1059ED8,
0x629A292A367CD507,
0x9159015A3070DD17,
0x152FECD8F70E5939,
0x67332667FFC00B31,
0x8EB44A8768581511,
0xDB0C2E0D64F98FA7,
0x47B5481DBEFA4FA4,
]
sha_info["count_lo"] = 0
sha_info["count_hi"] = 0
sha_info["local"] = 0
sha_info["digestsize"] = 48
return sha_info
def getbuf(s):
if isinstance(s, str):
return s.encode("ascii")
else:
return bytes(s)
def sha_update(sha_info, buffer):
if isinstance(buffer, str):
raise TypeError("Unicode strings must be encoded before hashing")
count = len(buffer)
buffer_idx = 0
clo = (sha_info["count_lo"] + (count << 3)) & 0xFFFFFFFF
if clo < sha_info["count_lo"]:
sha_info["count_hi"] += 1
sha_info["count_lo"] = clo
sha_info["count_hi"] += count >> 29
if sha_info["local"]:
i = SHA_BLOCKSIZE - sha_info["local"]
if i > count:
i = count
# copy buffer
for x in enumerate(buffer[buffer_idx : buffer_idx + i]):
sha_info["data"][sha_info["local"] + x[0]] = x[1]
count -= i
buffer_idx += i
sha_info["local"] += i
if sha_info["local"] == SHA_BLOCKSIZE:
sha_transform(sha_info)
sha_info["local"] = 0
else:
return
while count >= SHA_BLOCKSIZE:
# copy buffer
sha_info["data"] = list(buffer[buffer_idx : buffer_idx + SHA_BLOCKSIZE])
count -= SHA_BLOCKSIZE
buffer_idx += SHA_BLOCKSIZE
sha_transform(sha_info)
# copy buffer
pos = sha_info["local"]
sha_info["data"][pos : pos + count] = list(buffer[buffer_idx : buffer_idx + count])
sha_info["local"] = count
def sha_final(sha_info):
lo_bit_count = sha_info["count_lo"]
hi_bit_count = sha_info["count_hi"]
count = (lo_bit_count >> 3) & 0x7F
sha_info["data"][count] = 0x80
count += 1
if count > SHA_BLOCKSIZE - 16:
# zero the bytes in data after the count
sha_info["data"] = sha_info["data"][:count] + ([0] * (SHA_BLOCKSIZE - count))
sha_transform(sha_info)
# zero bytes in data
sha_info["data"] = [0] * SHA_BLOCKSIZE
else:
sha_info["data"] = sha_info["data"][:count] + ([0] * (SHA_BLOCKSIZE - count))
sha_info["data"][112] = 0
sha_info["data"][113] = 0
sha_info["data"][114] = 0
sha_info["data"][115] = 0
sha_info["data"][116] = 0
sha_info["data"][117] = 0
sha_info["data"][118] = 0
sha_info["data"][119] = 0
sha_info["data"][120] = (hi_bit_count >> 24) & 0xFF
sha_info["data"][121] = (hi_bit_count >> 16) & 0xFF
sha_info["data"][122] = (hi_bit_count >> 8) & 0xFF
sha_info["data"][123] = (hi_bit_count >> 0) & 0xFF
sha_info["data"][124] = (lo_bit_count >> 24) & 0xFF
sha_info["data"][125] = (lo_bit_count >> 16) & 0xFF
sha_info["data"][126] = (lo_bit_count >> 8) & 0xFF
sha_info["data"][127] = (lo_bit_count >> 0) & 0xFF
sha_transform(sha_info)
dig = []
for i in sha_info["digest"]:
dig.extend(
[
((i >> 56) & 0xFF),
((i >> 48) & 0xFF),
((i >> 40) & 0xFF),
((i >> 32) & 0xFF),
((i >> 24) & 0xFF),
((i >> 16) & 0xFF),
((i >> 8) & 0xFF),
(i & 0xFF),
]
)
return bytes(dig)
class sha512(object):
digest_size = digestsize = SHA_DIGESTSIZE
block_size = SHA_BLOCKSIZE
def __init__(self, s=None):
self._sha = sha_init()
if s:
sha_update(self._sha, getbuf(s))
def update(self, s):
sha_update(self._sha, getbuf(s))
def digest(self):
return sha_final(self._sha.copy())[: self._sha["digestsize"]]
def hexdigest(self):
return "".join(["%.2x" % i for i in self.digest()])
def copy(self):
new = sha512()
new._sha = self._sha.copy()
return new
class sha384(sha512):
digest_size = digestsize = 48
def __init__(self, s=None):
self._sha = sha384_init()
if s:
sha_update(self._sha, getbuf(s))
def copy(self):
new = sha384()
new._sha = self._sha.copy()
return new
def test():
a_str = "just a test string"
assert (
sha512().digest()
== b"\xcf\x83\xe15~\xef\xb8\xbd\xf1T(P\xd6m\x80\x07\xd6 \xe4\x05\x0bW\x15\xdc\x83\xf4\xa9!\xd3l\xe9\xceG\xd0\xd1<]\x85\xf2\xb0\xff\x83\x18\xd2\x87~\xec/c\xb91\xbdGAz\x81\xa582z\xf9'\xda>"
)
assert (
sha512().hexdigest()
== "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
)
assert (
sha512(a_str).hexdigest()
== "68be4c6664af867dd1d01c8d77e963d87d77b702400c8fabae355a41b8927a5a5533a7f1c28509bbd65c5f3ac716f33be271fbda0ca018b71a84708c9fae8a53"
)
assert (
sha512(a_str * 7).hexdigest()
== "3233acdbfcfff9bff9fc72401d31dbffa62bd24e9ec846f0578d647da73258d9f0879f7fde01fe2cc6516af3f343807fdef79e23d696c923d79931db46bf1819"
)
s = sha512(a_str)
s.update(a_str)
assert (
s.hexdigest()
== "341aeb668730bbb48127d5531115f3c39d12cb9586a6ca770898398aff2411087cfe0b570689adf328cddeb1f00803acce6737a19f310b53bbdb0320828f75bb"
)
if __name__ == "__main__":
test()
| """
This code was Ported from CPython's sha512module.c
"""
sha_blocksize = 128
sha_digestsize = 64
def new_shaobject():
return {'digest': [0] * 8, 'count_lo': 0, 'count_hi': 0, 'data': [0] * SHA_BLOCKSIZE, 'local': 0, 'digestsize': 0}
ror64 = lambda x, y: ((x & 18446744073709551615) >> (y & 63) | x << 64 - (y & 63)) & 18446744073709551615
ch = lambda x, y, z: z ^ x & (y ^ z)
maj = lambda x, y, z: (x | y) & z | x & y
s = lambda x, n: ror64(x, n)
r = lambda x, n: (x & 18446744073709551615) >> n
sigma0 = lambda x: s(x, 28) ^ s(x, 34) ^ s(x, 39)
sigma1 = lambda x: s(x, 14) ^ s(x, 18) ^ s(x, 41)
gamma0 = lambda x: s(x, 1) ^ s(x, 8) ^ r(x, 7)
gamma1 = lambda x: s(x, 19) ^ s(x, 61) ^ r(x, 6)
def sha_transform(sha_info):
w = []
d = sha_info['data']
for i in range(0, 16):
W.append((d[8 * i] << 56) + (d[8 * i + 1] << 48) + (d[8 * i + 2] << 40) + (d[8 * i + 3] << 32) + (d[8 * i + 4] << 24) + (d[8 * i + 5] << 16) + (d[8 * i + 6] << 8) + d[8 * i + 7])
for i in range(16, 80):
W.append(gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16] & 18446744073709551615)
ss = sha_info['digest'][:]
def rnd(a, b, c, d, e, f, g, h, i, ki):
t0 = h + sigma1(e) + ch(e, f, g) + ki + W[i] & 18446744073709551615
t1 = sigma0(a) + maj(a, b, c) & 18446744073709551615
d = d + t0 & 18446744073709551615
h = t0 + t1 & 18446744073709551615
return (d & 18446744073709551615, h & 18446744073709551615)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 0, 4794697086780616226)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 1, 8158064640168781261)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 2, 13096744586834688815)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 3, 16840607885511220156)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 4, 4131703408338449720)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 5, 6480981068601479193)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 6, 10538285296894168987)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 7, 12329834152419229976)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 8, 15566598209576043074)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 9, 1334009975649890238)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 10, 2608012711638119052)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 11, 6128411473006802146)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 12, 8268148722764581231)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 13, 9286055187155687089)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 14, 11230858885718282805)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 15, 13951009754708518548)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 16, 16472876342353939154)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 17, 17275323862435702243)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 18, 1135362057144423861)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 19, 2597628984639134821)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 20, 3308224258029322869)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 21, 5365058923640841347)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 22, 6679025012923562964)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 23, 8573033837759648693)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 24, 10970295158949994411)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 25, 12119686244451234320)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 26, 12683024718118986047)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 27, 13788192230050041572)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 28, 14330467153632333762)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 29, 15395433587784984357)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 30, 489312712824947311)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 31, 1452737877330783856)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 32, 2861767655752347644)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 33, 3322285676063803686)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 34, 5560940570517711597)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 35, 5996557281743188959)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 36, 7280758554555802590)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 37, 8532644243296465576)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 38, 9350256976987008742)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 39, 10552545826968843579)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 40, 11727347734174303076)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 41, 12113106623233404929)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 42, 14000437183269869457)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 43, 14369950271660146224)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 44, 15101387698204529176)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 45, 15463397548674623760)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 46, 17586052441742319658)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 47, 1182934255886127544)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 48, 1847814050463011016)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 49, 2177327727835720531)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 50, 2830643537854262169)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 51, 3796741975233480872)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 52, 4115178125766777443)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 53, 5681478168544905931)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 54, 6601373596472566643)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 55, 7507060721942968483)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 56, 8399075790359081724)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 57, 8693463985226723168)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 58, 9568029438360202098)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 59, 10144078919501101548)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 60, 10430055236837252648)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 61, 11840083180663258601)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 62, 13761210420658862357)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 63, 14299343276471374635)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 64, 14566680578165727644)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 65, 15097957966210449927)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 66, 16922976911328602910)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 67, 17689382322260857208)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 68, 500013540394364858)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 69, 748580250866718886)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 70, 1242879168328830382)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 71, 1977374033974150939)
(ss[3], ss[7]) = rnd(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], 72, 2944078676154940804)
(ss[2], ss[6]) = rnd(ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], 73, 3659926193048069267)
(ss[1], ss[5]) = rnd(ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], 74, 4368137639120453308)
(ss[0], ss[4]) = rnd(ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], ss[4], 75, 4836135668995329356)
(ss[7], ss[3]) = rnd(ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], ss[3], 76, 5532061633213252278)
(ss[6], ss[2]) = rnd(ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], ss[2], 77, 6448918945643986474)
(ss[5], ss[1]) = rnd(ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], ss[1], 78, 6902733635092675308)
(ss[4], ss[0]) = rnd(ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7], ss[0], 79, 7801388544844847127)
dig = []
for (i, x) in enumerate(sha_info['digest']):
dig.append(x + ss[i] & 18446744073709551615)
sha_info['digest'] = dig
def sha_init():
sha_info = new_shaobject()
sha_info['digest'] = [7640891576956012808, 13503953896175478587, 4354685564936845355, 11912009170470909681, 5840696475078001361, 11170449401992604703, 2270897969802886507, 6620516959819538809]
sha_info['count_lo'] = 0
sha_info['count_hi'] = 0
sha_info['local'] = 0
sha_info['digestsize'] = 64
return sha_info
def sha384_init():
sha_info = new_shaobject()
sha_info['digest'] = [14680500436340154072, 7105036623409894663, 10473403895298186519, 1526699215303891257, 7436329637833083697, 10282925794625328401, 15784041429090275239, 5167115440072839076]
sha_info['count_lo'] = 0
sha_info['count_hi'] = 0
sha_info['local'] = 0
sha_info['digestsize'] = 48
return sha_info
def getbuf(s):
if isinstance(s, str):
return s.encode('ascii')
else:
return bytes(s)
def sha_update(sha_info, buffer):
if isinstance(buffer, str):
raise type_error('Unicode strings must be encoded before hashing')
count = len(buffer)
buffer_idx = 0
clo = sha_info['count_lo'] + (count << 3) & 4294967295
if clo < sha_info['count_lo']:
sha_info['count_hi'] += 1
sha_info['count_lo'] = clo
sha_info['count_hi'] += count >> 29
if sha_info['local']:
i = SHA_BLOCKSIZE - sha_info['local']
if i > count:
i = count
for x in enumerate(buffer[buffer_idx:buffer_idx + i]):
sha_info['data'][sha_info['local'] + x[0]] = x[1]
count -= i
buffer_idx += i
sha_info['local'] += i
if sha_info['local'] == SHA_BLOCKSIZE:
sha_transform(sha_info)
sha_info['local'] = 0
else:
return
while count >= SHA_BLOCKSIZE:
sha_info['data'] = list(buffer[buffer_idx:buffer_idx + SHA_BLOCKSIZE])
count -= SHA_BLOCKSIZE
buffer_idx += SHA_BLOCKSIZE
sha_transform(sha_info)
pos = sha_info['local']
sha_info['data'][pos:pos + count] = list(buffer[buffer_idx:buffer_idx + count])
sha_info['local'] = count
def sha_final(sha_info):
lo_bit_count = sha_info['count_lo']
hi_bit_count = sha_info['count_hi']
count = lo_bit_count >> 3 & 127
sha_info['data'][count] = 128
count += 1
if count > SHA_BLOCKSIZE - 16:
sha_info['data'] = sha_info['data'][:count] + [0] * (SHA_BLOCKSIZE - count)
sha_transform(sha_info)
sha_info['data'] = [0] * SHA_BLOCKSIZE
else:
sha_info['data'] = sha_info['data'][:count] + [0] * (SHA_BLOCKSIZE - count)
sha_info['data'][112] = 0
sha_info['data'][113] = 0
sha_info['data'][114] = 0
sha_info['data'][115] = 0
sha_info['data'][116] = 0
sha_info['data'][117] = 0
sha_info['data'][118] = 0
sha_info['data'][119] = 0
sha_info['data'][120] = hi_bit_count >> 24 & 255
sha_info['data'][121] = hi_bit_count >> 16 & 255
sha_info['data'][122] = hi_bit_count >> 8 & 255
sha_info['data'][123] = hi_bit_count >> 0 & 255
sha_info['data'][124] = lo_bit_count >> 24 & 255
sha_info['data'][125] = lo_bit_count >> 16 & 255
sha_info['data'][126] = lo_bit_count >> 8 & 255
sha_info['data'][127] = lo_bit_count >> 0 & 255
sha_transform(sha_info)
dig = []
for i in sha_info['digest']:
dig.extend([i >> 56 & 255, i >> 48 & 255, i >> 40 & 255, i >> 32 & 255, i >> 24 & 255, i >> 16 & 255, i >> 8 & 255, i & 255])
return bytes(dig)
class Sha512(object):
digest_size = digestsize = SHA_DIGESTSIZE
block_size = SHA_BLOCKSIZE
def __init__(self, s=None):
self._sha = sha_init()
if s:
sha_update(self._sha, getbuf(s))
def update(self, s):
sha_update(self._sha, getbuf(s))
def digest(self):
return sha_final(self._sha.copy())[:self._sha['digestsize']]
def hexdigest(self):
return ''.join(['%.2x' % i for i in self.digest()])
def copy(self):
new = sha512()
new._sha = self._sha.copy()
return new
class Sha384(sha512):
digest_size = digestsize = 48
def __init__(self, s=None):
self._sha = sha384_init()
if s:
sha_update(self._sha, getbuf(s))
def copy(self):
new = sha384()
new._sha = self._sha.copy()
return new
def test():
a_str = 'just a test string'
assert sha512().digest() == b"\xcf\x83\xe15~\xef\xb8\xbd\xf1T(P\xd6m\x80\x07\xd6 \xe4\x05\x0bW\x15\xdc\x83\xf4\xa9!\xd3l\xe9\xceG\xd0\xd1<]\x85\xf2\xb0\xff\x83\x18\xd2\x87~\xec/c\xb91\xbdGAz\x81\xa582z\xf9'\xda>"
assert sha512().hexdigest() == 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
assert sha512(a_str).hexdigest() == '68be4c6664af867dd1d01c8d77e963d87d77b702400c8fabae355a41b8927a5a5533a7f1c28509bbd65c5f3ac716f33be271fbda0ca018b71a84708c9fae8a53'
assert sha512(a_str * 7).hexdigest() == '3233acdbfcfff9bff9fc72401d31dbffa62bd24e9ec846f0578d647da73258d9f0879f7fde01fe2cc6516af3f343807fdef79e23d696c923d79931db46bf1819'
s = sha512(a_str)
s.update(a_str)
assert s.hexdigest() == '341aeb668730bbb48127d5531115f3c39d12cb9586a6ca770898398aff2411087cfe0b570689adf328cddeb1f00803acce6737a19f310b53bbdb0320828f75bb'
if __name__ == '__main__':
test() |
def exchange(A, i, j):
temp = A[i]
A[i] = A[j]
A[j] = temp
return A
| def exchange(A, i, j):
temp = A[i]
A[i] = A[j]
A[j] = temp
return A |
while True:
num_items = int(input())
if num_items == 0:
break
# Normal sort also works
# items = list(sorted(map(int, input().split())))
# print(" ".join(map(str, items)))
buckets = [0 for i in range(101)]
for age in map(int, input().split()):
buckets[age] += 1
for i, j in enumerate(buckets):
if j > 0:
if num_items > j:
print(" ".join([str(i)]*j), end=" ")
else: # last batch
print(" ".join([str(i)]*j))
num_items -= j
| while True:
num_items = int(input())
if num_items == 0:
break
buckets = [0 for i in range(101)]
for age in map(int, input().split()):
buckets[age] += 1
for (i, j) in enumerate(buckets):
if j > 0:
if num_items > j:
print(' '.join([str(i)] * j), end=' ')
else:
print(' '.join([str(i)] * j))
num_items -= j |
src =Split('''
aos/board.c
aos/board_cli.c
aos/st7789.c
aos/soc_init.c
Src/stm32l4xx_hal_msp.c
''')
component =aos_board_component('starterkit', 'stm32l4xx_cube', src)
if aos_global_config.compiler == "armcc":
component.add_sources('startup_stm32l433xx_keil.s')
elif aos_global_config.compiler == "iar":
component.add_sources('startup_stm32l433xx_iar.s')
else:
component.add_sources('startup_stm32l433xx.s')
aos_global_config.add_ld_files('STM32L433RCTxP_FLASH.ld')
aos_global_config.set('MODULE', '1062')
aos_global_config.set('HOST_ARCH', 'Cortex-M4')
aos_global_config.set('HOST_MCU_FAMILY', 'stm32l4xx_cube')
aos_global_config.set('SUPPORT_BINS', 'no')
aos_global_config.set('HOST_MCU_NAME', 'STM32L433CCTx')
dependencis =Split('''
device/sensor
''')
for i in dependencis:
component.add_comp_deps(i)
global_includes =Split('''
hal
aos
Inc
''')
for i in global_includes:
component.add_global_includes(i)
global_macros =Split('''
STM32L433xx
STDIO_UART=0
CONFIG_AOS_CLI_BOARD
AOS_SENSOR_ACC_MIR3_DA217
AOS_SENSOR_ALS_LITEON_LTR553
AOS_SENSOR_PS_LITEON_LTR553
AOS_SENSOR_ACC_SUPPORT_STEP
AOS_TEST_MODE
''')
for i in global_macros:
component.add_global_macros(i)
if aos_global_config.get('sal') == None:
aos_global_config.set('sal',1)
if aos_global_config.get('no_tls') == None:
aos_global_config.set('no_tls',1)
if aos_global_config.get('sal') == 1:
component.add_comp_deps('network/sal')
if aos_global_config.get('module') == None:
aos_global_config.set('module','wifi.bk7231')
else:
aos_global_config.add_global_macros('CONFIG_NO_TCPIP')
aos_global_config.set('CONFIG_SYSINFO_PRODUCT_MODEL', 'ALI_AOS_starterkit')
aos_global_config.set('CONFIG_SYSINFO_DEVICE_NAME','starterkit')
CONFIG_SYSINFO_OS_VERSION = aos_global_config.get('CONFIG_SYSINFO_OS_VERSION')
component.add_global_macros('SYSINFO_OS_VERSION=\\"'+str(CONFIG_SYSINFO_OS_VERSION)+'\\"')
component.add_global_macros('SYSINFO_PRODUCT_MODEL=\\"'+'ALI_AOS_starterkit'+'\\"')
component.add_global_macros('SYSINFO_DEVICE_NAME=\\"'+'starterkit'+'\\"')
component.set_enable_vfp()
linux_only_targets="helloworld mqttapp acapp nano tls alinkapp coapapp hdlcapp.hdlcserver uDataapp networkapp littlevgl_starterkit wifihalapp hdlcapp.hdlcclient atapp linuxapp helloworld_nocli vflashdemo netmgrapp emwinapp blink"
windows_only_targets="helloworld|COMPILER=armcc acapp|COMPILER=armcc helloworld|COMPILER=iar acapp|COMPILER=iar mqttapp|COMPILER=armcc mqttapp|COMPILER=iar"
| src = split('\n aos/board.c\n aos/board_cli.c\n aos/st7789.c\n aos/soc_init.c\n Src/stm32l4xx_hal_msp.c\n')
component = aos_board_component('starterkit', 'stm32l4xx_cube', src)
if aos_global_config.compiler == 'armcc':
component.add_sources('startup_stm32l433xx_keil.s')
elif aos_global_config.compiler == 'iar':
component.add_sources('startup_stm32l433xx_iar.s')
else:
component.add_sources('startup_stm32l433xx.s')
aos_global_config.add_ld_files('STM32L433RCTxP_FLASH.ld')
aos_global_config.set('MODULE', '1062')
aos_global_config.set('HOST_ARCH', 'Cortex-M4')
aos_global_config.set('HOST_MCU_FAMILY', 'stm32l4xx_cube')
aos_global_config.set('SUPPORT_BINS', 'no')
aos_global_config.set('HOST_MCU_NAME', 'STM32L433CCTx')
dependencis = split('\n device/sensor\n')
for i in dependencis:
component.add_comp_deps(i)
global_includes = split('\n hal\n aos\n Inc\n')
for i in global_includes:
component.add_global_includes(i)
global_macros = split('\n STM32L433xx\n STDIO_UART=0\n CONFIG_AOS_CLI_BOARD\n AOS_SENSOR_ACC_MIR3_DA217\n AOS_SENSOR_ALS_LITEON_LTR553\n AOS_SENSOR_PS_LITEON_LTR553\n AOS_SENSOR_ACC_SUPPORT_STEP\n AOS_TEST_MODE\n')
for i in global_macros:
component.add_global_macros(i)
if aos_global_config.get('sal') == None:
aos_global_config.set('sal', 1)
if aos_global_config.get('no_tls') == None:
aos_global_config.set('no_tls', 1)
if aos_global_config.get('sal') == 1:
component.add_comp_deps('network/sal')
if aos_global_config.get('module') == None:
aos_global_config.set('module', 'wifi.bk7231')
else:
aos_global_config.add_global_macros('CONFIG_NO_TCPIP')
aos_global_config.set('CONFIG_SYSINFO_PRODUCT_MODEL', 'ALI_AOS_starterkit')
aos_global_config.set('CONFIG_SYSINFO_DEVICE_NAME', 'starterkit')
config_sysinfo_os_version = aos_global_config.get('CONFIG_SYSINFO_OS_VERSION')
component.add_global_macros('SYSINFO_OS_VERSION=\\"' + str(CONFIG_SYSINFO_OS_VERSION) + '\\"')
component.add_global_macros('SYSINFO_PRODUCT_MODEL=\\"' + 'ALI_AOS_starterkit' + '\\"')
component.add_global_macros('SYSINFO_DEVICE_NAME=\\"' + 'starterkit' + '\\"')
component.set_enable_vfp()
linux_only_targets = 'helloworld mqttapp acapp nano tls alinkapp coapapp hdlcapp.hdlcserver uDataapp networkapp littlevgl_starterkit wifihalapp hdlcapp.hdlcclient atapp linuxapp helloworld_nocli vflashdemo netmgrapp emwinapp blink'
windows_only_targets = 'helloworld|COMPILER=armcc acapp|COMPILER=armcc helloworld|COMPILER=iar acapp|COMPILER=iar mqttapp|COMPILER=armcc mqttapp|COMPILER=iar' |
return_date = list(map(lambda x: int(x), input().split()))
due_date = list(map(lambda x: int(x), input().split()))
day = 0
month = 1
year = 2
if return_date[year] > due_date[year]:
fine = 10000
elif return_date[year] < due_date[year]:
fine = 0
elif return_date[month] > due_date[month]:
fine = 500 * (return_date[month] - due_date[month])
elif return_date[day] > due_date[day]:
fine = 15 * (return_date[day] - due_date[day])
else:
fine = 0
print(fine)
| return_date = list(map(lambda x: int(x), input().split()))
due_date = list(map(lambda x: int(x), input().split()))
day = 0
month = 1
year = 2
if return_date[year] > due_date[year]:
fine = 10000
elif return_date[year] < due_date[year]:
fine = 0
elif return_date[month] > due_date[month]:
fine = 500 * (return_date[month] - due_date[month])
elif return_date[day] > due_date[day]:
fine = 15 * (return_date[day] - due_date[day])
else:
fine = 0
print(fine) |
#coding=utf-8
nombre = input("Dime tu nombre: ")
edad = int(input("dime tu edad wey: "))
nombre2 = input("dime tu nombre tambien wey: ")
edad2 = int(input("y tu edad es?... "))
if (edad>edad2):
print ("%s, eres mayor que %s" % (nombre , nombre2))
elif (edad<edad2):
print ("%s, eres mayor que %s" % (nombre2 , nombre))
else:
print ("%s y %s tienen la misma edad" % (nombre , nombre2))
| nombre = input('Dime tu nombre: ')
edad = int(input('dime tu edad wey: '))
nombre2 = input('dime tu nombre tambien wey: ')
edad2 = int(input('y tu edad es?... '))
if edad > edad2:
print('%s, eres mayor que %s' % (nombre, nombre2))
elif edad < edad2:
print('%s, eres mayor que %s' % (nombre2, nombre))
else:
print('%s y %s tienen la misma edad' % (nombre, nombre2)) |
class ChartError(Exception):
"""Raised whenever we have a generic error trying to draw the chart."""
class NoTicketsProvided(ChartError):
"""Raised if we provide no tickets to the chart."""
def __init__(self) -> None:
super().__init__("No tickets provided. Check your config.")
| class Charterror(Exception):
"""Raised whenever we have a generic error trying to draw the chart."""
class Noticketsprovided(ChartError):
"""Raised if we provide no tickets to the chart."""
def __init__(self) -> None:
super().__init__('No tickets provided. Check your config.') |
class SimpleAgg:
def __init__(self, query, size=0):
self.__size = size
self.__query = query
def build(self):
return {
"size": self.__size,
"query": {
"multi_match": {
"query": self.__query,
"analyzer": "english_expander",
"fields": ["name.keyword"]
}
},
"aggs": {
"categ_agg": {
"terms": {
"field": "name.keyword",
"size": 100
}
}
}
}
| class Simpleagg:
def __init__(self, query, size=0):
self.__size = size
self.__query = query
def build(self):
return {'size': self.__size, 'query': {'multi_match': {'query': self.__query, 'analyzer': 'english_expander', 'fields': ['name.keyword']}}, 'aggs': {'categ_agg': {'terms': {'field': 'name.keyword', 'size': 100}}}} |
'''
The purpose of this directory is to contain files used by multiple
platforms, but not by all. (In some cases GTK and Mac impls. can share code,
for example.)
'''
| """
The purpose of this directory is to contain files used by multiple
platforms, but not by all. (In some cases GTK and Mac impls. can share code,
for example.)
""" |
__all__ = [
"__name__",
"__version__",
"__author__",
"__author_email__",
"__description__",
"__license__"
]
__name__ = "python-fullcontact"
__version__ = "3.1.0"
__author__ = "FullContact"
__author_email__ = "pypy@fullcontact.com"
__description__ = "Client library for FullContact V3 Enrich and Resolve APIs"
__license__ = "Apache License, Version 2.0"
| __all__ = ['__name__', '__version__', '__author__', '__author_email__', '__description__', '__license__']
__name__ = 'python-fullcontact'
__version__ = '3.1.0'
__author__ = 'FullContact'
__author_email__ = 'pypy@fullcontact.com'
__description__ = 'Client library for FullContact V3 Enrich and Resolve APIs'
__license__ = 'Apache License, Version 2.0' |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def longestConsecutive(self, root: TreeNode) -> int:
ret = 0
def helper(node):
nonlocal ret
if not node:
return 0, 0
ld, lu = helper(node.left)
rd, ru = helper(node.right)
curd, curu = 1, 1
if node.left:
if node.val - node.left.val == 1:
curu = lu + 1
elif node.val - node.left.val == -1:
curd = ld + 1
if node.right:
if node.val - node.right.val == 1:
curu = max(curu, ru + 1)
elif node.val - node.right.val == -1:
curd = max(curd, rd + 1)
if curu > 1 and curd > 1:
ret = max(curu + curd - 1, ret)
else:
ret = max(ret, curu, curd)
return curd, curu
helper(root)
return ret
| class Solution:
def longest_consecutive(self, root: TreeNode) -> int:
ret = 0
def helper(node):
nonlocal ret
if not node:
return (0, 0)
(ld, lu) = helper(node.left)
(rd, ru) = helper(node.right)
(curd, curu) = (1, 1)
if node.left:
if node.val - node.left.val == 1:
curu = lu + 1
elif node.val - node.left.val == -1:
curd = ld + 1
if node.right:
if node.val - node.right.val == 1:
curu = max(curu, ru + 1)
elif node.val - node.right.val == -1:
curd = max(curd, rd + 1)
if curu > 1 and curd > 1:
ret = max(curu + curd - 1, ret)
else:
ret = max(ret, curu, curd)
return (curd, curu)
helper(root)
return ret |
#!/usr/bin/env python
NAME = 'InfoGuard Airlock'
def is_waf(self):
# credit goes to W3AF
return self.matchcookie('^AL[_-]?(SESS|LB)=')
| name = 'InfoGuard Airlock'
def is_waf(self):
return self.matchcookie('^AL[_-]?(SESS|LB)=') |
def splitT(l):
l = l.split(" ")
for i,e in enumerate(l):
try:
val = int(e)
except ValueError:
val = e
l[i] = val
return l
def strToTupple(l):
return [tuple(splitT(e)) if len(tuple(splitT(e))) != 1 else splitT(e)[0] for e in l]
lines = strToTupple(lines)
sys.stderr.write(str(lines))
f = lines.pop(0)
| def split_t(l):
l = l.split(' ')
for (i, e) in enumerate(l):
try:
val = int(e)
except ValueError:
val = e
l[i] = val
return l
def str_to_tupple(l):
return [tuple(split_t(e)) if len(tuple(split_t(e))) != 1 else split_t(e)[0] for e in l]
lines = str_to_tupple(lines)
sys.stderr.write(str(lines))
f = lines.pop(0) |
class Loss:
def __init__(self, name):
self.name = name
class MeanSquaredError(Loss):
"""Mean Squared Error
"""
def __init__(self):
super(MeanSquaredError, self).__init__('mean_squared_error')
class CategoricalCrossEntropy(Loss):
"""Categorical Cross-Entropy
"""
def __init__(self):
super(CategoricalCrossEntropy, self).__init__('categorical_crossentropy')
class CategoricalSoftCrossEntropy(Loss):
"""Categorical Soft Cross-Entropy
"""
def __init__(self):
super(CategoricalSoftCrossEntropy, self).__init__('categorical_soft_crossentropy')
| class Loss:
def __init__(self, name):
self.name = name
class Meansquarederror(Loss):
"""Mean Squared Error
"""
def __init__(self):
super(MeanSquaredError, self).__init__('mean_squared_error')
class Categoricalcrossentropy(Loss):
"""Categorical Cross-Entropy
"""
def __init__(self):
super(CategoricalCrossEntropy, self).__init__('categorical_crossentropy')
class Categoricalsoftcrossentropy(Loss):
"""Categorical Soft Cross-Entropy
"""
def __init__(self):
super(CategoricalSoftCrossEntropy, self).__init__('categorical_soft_crossentropy') |
TAX_RATES = {0 / 100: range(0, 1001), 10 / 100: range(1000, 10001), 15 / 100: range(10000, 20201),
20 / 100: range(20200, 30751),
25 / 100: range(30750, 50001)}
# , 30: 50000
def calculate_tax(people_sal):
"""
Calculate the annual tax
:param people_sal:
:return:
"""
result = {}
# for each key-value pair in TAX_RATES, calculate the rate
for tax_rate, band in TAX_RATES.items():
diff = max(band) - min(band)
for person, salary in people_sal.items():
if salary > 50000:
salary *= 0.3
# check if the salary is greater than max possible in band
if salary > max(band):
rate = tax_rate * diff
results(person, result, rate)
salary -= diff
# remaining salary
elif salary < max(band):
rate = (salary - min(band)) * tax_rate
results(person, result, rate)
break
return result
def results(person, result, rate):
"""
Checks if the current person is in the dict, if not adds them with their current rate
if they are, adds the current rate to the current person
:param person: the current person
:param result: the output result
:param rate: the current tax rate
:return: the resulting dict
"""
if person in result:
result[person] += int(rate)
else:
result[person] = int(rate)
return result
print(calculate_tax({
"James": 20500,
"Alex": 500,
"Kinuthia": 70000
}))
| tax_rates = {0 / 100: range(0, 1001), 10 / 100: range(1000, 10001), 15 / 100: range(10000, 20201), 20 / 100: range(20200, 30751), 25 / 100: range(30750, 50001)}
def calculate_tax(people_sal):
"""
Calculate the annual tax
:param people_sal:
:return:
"""
result = {}
for (tax_rate, band) in TAX_RATES.items():
diff = max(band) - min(band)
for (person, salary) in people_sal.items():
if salary > 50000:
salary *= 0.3
if salary > max(band):
rate = tax_rate * diff
results(person, result, rate)
salary -= diff
elif salary < max(band):
rate = (salary - min(band)) * tax_rate
results(person, result, rate)
break
return result
def results(person, result, rate):
"""
Checks if the current person is in the dict, if not adds them with their current rate
if they are, adds the current rate to the current person
:param person: the current person
:param result: the output result
:param rate: the current tax rate
:return: the resulting dict
"""
if person in result:
result[person] += int(rate)
else:
result[person] = int(rate)
return result
print(calculate_tax({'James': 20500, 'Alex': 500, 'Kinuthia': 70000})) |
def shell_sort(arr):
sublistcount = len(arr)/2
# While we still have sub lists
while sublistcount > 0:
for start in range(sublistcount):
# Use a gap insertion
gap_insertion_sort(arr,start,sublistcount)
sublistcount = sublistcount / 2
def gap_insertion_sort(arr,start,gap):
for i in range(start+gap,len(arr),gap):
currentvalue = arr[i]
position = i
# Using the Gap
while position>=gap and arr[position-gap]>currentvalue:
arr[position]=arr[position-gap]
position = position-gap
# Set current value
arr[position]=currentvalue
arr = [45,67,23,45,21,24,7,2,6,4,90]
shell_sort(arr) | def shell_sort(arr):
sublistcount = len(arr) / 2
while sublistcount > 0:
for start in range(sublistcount):
gap_insertion_sort(arr, start, sublistcount)
sublistcount = sublistcount / 2
def gap_insertion_sort(arr, start, gap):
for i in range(start + gap, len(arr), gap):
currentvalue = arr[i]
position = i
while position >= gap and arr[position - gap] > currentvalue:
arr[position] = arr[position - gap]
position = position - gap
arr[position] = currentvalue
arr = [45, 67, 23, 45, 21, 24, 7, 2, 6, 4, 90]
shell_sort(arr) |
def format_si(number, places=2):
number = float(number)
if number > 10**9:
return ("{0:.%sf} G" % places).format(number / 10**9)
if number > 10**6:
return ("{0:.%sf} M" % places).format(number / 10**6)
if number > 10**3:
return ("{0:.%sf} K" % places).format(number / 10**3)
return ("{0:.%sf}" % places).format(number)
def format_stream_output(stream_list, udp=False, summary=False):
output = ""
output += "%s%s" % ("{0:<15}".format("Interval"),
"{0:<15}".format("Throughput")
)
if udp:
output += "{0:<15}".format("Lost / Sent")
else:
output += "{0:<15}".format("Retransmits")
if not summary:
output += "{0:<15}".format("Current Window")
if summary and "receiver-throughput-bits" in stream_list[0]:
output += "{0:<20}".format("Receiver Throughput")
output += "\n"
for block in stream_list:
formatted_throughput = format_si(block["throughput-bits"])
formatted_throughput += "bps"
# tools like iperf3 report time with way more precision than we need to report,
# so make sure it's cut down to 1 decimal spot
start = "{0:.1f}".format(block["start"])
end = "{0:.1f}".format(block["end"])
interval = "{0:<15}".format("%s - %s" % (start, end))
throughput = "{0:<15}".format(formatted_throughput)
jitter = block.get("jitter")
output += "%s%s" % (interval, throughput)
if udp:
sent = block.get("sent")
lost = block.get("lost")
if sent == None:
loss = "{0:<15}".format("Not Reported")
else:
if lost == None:
loss = "{0:<15}".format("%s sent" % sent)
else:
loss = "{0:<15}".format("%s / %s" % (lost, sent))
output += loss
else:
retrans = block.get('retransmits')
if retrans == None:
retransmits = "{0:<15}".format("Not Reported")
else:
retransmits = "{0:<15}".format(retrans)
output += retransmits
if not summary:
window = block.get('tcp-window-size')
if window == None:
tcp_window = "{0:<15}".format("Not Reported")
else:
window = format_si(window) + "Bytes"
tcp_window = "{0:<15}".format(window)
output += tcp_window
if "receiver-throughput-bits" in block:
formatted_receiver_throughput = format_si(block["receiver-throughput-bits"])
formatted_receiver_throughput += "bps"
output += "{0:<20}".format(formatted_receiver_throughput)
jitter = block.get('jitter')
if jitter != None:
output += "{0:<20}".format("Jitter: %s ms" % jitter)
if block.get('omitted'):
output += " (omitted)"
output += "\n"
return output
if __name__ == "__main__":
print(format_si(10 ** 12))
print(format_si(10 ** 4))
print(format_si(10 ** 7))
print(format_si(10 ** 9))
| def format_si(number, places=2):
number = float(number)
if number > 10 ** 9:
return ('{0:.%sf} G' % places).format(number / 10 ** 9)
if number > 10 ** 6:
return ('{0:.%sf} M' % places).format(number / 10 ** 6)
if number > 10 ** 3:
return ('{0:.%sf} K' % places).format(number / 10 ** 3)
return ('{0:.%sf}' % places).format(number)
def format_stream_output(stream_list, udp=False, summary=False):
output = ''
output += '%s%s' % ('{0:<15}'.format('Interval'), '{0:<15}'.format('Throughput'))
if udp:
output += '{0:<15}'.format('Lost / Sent')
else:
output += '{0:<15}'.format('Retransmits')
if not summary:
output += '{0:<15}'.format('Current Window')
if summary and 'receiver-throughput-bits' in stream_list[0]:
output += '{0:<20}'.format('Receiver Throughput')
output += '\n'
for block in stream_list:
formatted_throughput = format_si(block['throughput-bits'])
formatted_throughput += 'bps'
start = '{0:.1f}'.format(block['start'])
end = '{0:.1f}'.format(block['end'])
interval = '{0:<15}'.format('%s - %s' % (start, end))
throughput = '{0:<15}'.format(formatted_throughput)
jitter = block.get('jitter')
output += '%s%s' % (interval, throughput)
if udp:
sent = block.get('sent')
lost = block.get('lost')
if sent == None:
loss = '{0:<15}'.format('Not Reported')
elif lost == None:
loss = '{0:<15}'.format('%s sent' % sent)
else:
loss = '{0:<15}'.format('%s / %s' % (lost, sent))
output += loss
else:
retrans = block.get('retransmits')
if retrans == None:
retransmits = '{0:<15}'.format('Not Reported')
else:
retransmits = '{0:<15}'.format(retrans)
output += retransmits
if not summary:
window = block.get('tcp-window-size')
if window == None:
tcp_window = '{0:<15}'.format('Not Reported')
else:
window = format_si(window) + 'Bytes'
tcp_window = '{0:<15}'.format(window)
output += tcp_window
if 'receiver-throughput-bits' in block:
formatted_receiver_throughput = format_si(block['receiver-throughput-bits'])
formatted_receiver_throughput += 'bps'
output += '{0:<20}'.format(formatted_receiver_throughput)
jitter = block.get('jitter')
if jitter != None:
output += '{0:<20}'.format('Jitter: %s ms' % jitter)
if block.get('omitted'):
output += ' (omitted)'
output += '\n'
return output
if __name__ == '__main__':
print(format_si(10 ** 12))
print(format_si(10 ** 4))
print(format_si(10 ** 7))
print(format_si(10 ** 9)) |
# Module is basically a dumping ground for various menus and help text blurbs the terminal may need.
def HelpText():
print("""
------------------ INFO ---------------------
TD Ameritrade API Query Tool
Version 0.0.1
Command List:
history\t\t: Displays ticker price history candles.
query\t\t: Pings the API for specific ticker data.
markethours\t: Gets market open/closed status.
quit\t\t: Quits the querytool terminal.
---------------------------------------------
""")
def QuoteHelpText():
print("""
\t Name: \t quote
\t Args: \t [symbol]
\t Func: \t Gets quote data for the ticker/symbol passed.
""")
def PriceHistoryHelpText():
print("""
\t Name: \t history
\t Args: \t [symbol] <'day'/'month'/'year'/'ytd'> <period> <'day'/'month'/'year'/'ytd'> <frequency>
\t Func: \t Gets candle history data for the specified symbol.
""")
def MarketHoursHelpText():
print("""
\t Name: \t markethours
\t Args: \t [market] <date>
\t Func: \t Gets market hours for the specified market. Default date and time is right now.
""")
def AuthHelpText():
print("""
\t Name: \t auth
\t Subcommands: \t set, get
\t Args:
\t Func: \t Function unimplemented.
""") | def help_text():
print('\n\t\t ------------------ INFO ---------------------\n\t\t TD Ameritrade API Query Tool\n\t Version 0.0.1\n\t\n\t Command List:\n\t history\t\t: Displays ticker price history candles.\n\t query\t\t: Pings the API for specific ticker data.\n\t markethours\t: Gets market open/closed status.\n\t quit\t\t: Quits the querytool terminal.\n\t ---------------------------------------------\n\t\t ')
def quote_help_text():
print('\n\t \t Name: \t quote\n\t \t Args: \t [symbol]\n\t \t Func: \t Gets quote data for the ticker/symbol passed.\n\t\t ')
def price_history_help_text():
print("\n\t\t \t Name: \t history\n\t \t Args: \t [symbol] <'day'/'month'/'year'/'ytd'> <period> <'day'/'month'/'year'/'ytd'> <frequency>\n\t \t Func: \t Gets candle history data for the specified symbol.\n\t\t ")
def market_hours_help_text():
print('\n\t\t \t Name: \t markethours\n\t\t \t Args: \t [market] <date>\n\t\t \t Func: \t Gets market hours for the specified market. Default date and time is right now.\n\t\t ')
def auth_help_text():
print('\n\t\t \t Name: \t auth\n\t \t Subcommands: \t set, get\n\t \t Args:\n\t \t Func: \t Function unimplemented.\n\t\t ') |
def check_user(user, session_type=False):
frontend.page(
"dashboard",
expect={
"script_user": testing.expect.script_user(user)
})
if session_type is False:
if user.id is None:
# Anonymous user.
session_type = None
else:
session_type = "normal"
frontend.json(
"sessions/current",
params={ "fields": "user,type" },
expect={
"user": user.id,
"type": session_type
})
anonymous = testing.User.anonymous()
alice = instance.user("alice")
admin = instance.user("admin")
check_user(anonymous)
| def check_user(user, session_type=False):
frontend.page('dashboard', expect={'script_user': testing.expect.script_user(user)})
if session_type is False:
if user.id is None:
session_type = None
else:
session_type = 'normal'
frontend.json('sessions/current', params={'fields': 'user,type'}, expect={'user': user.id, 'type': session_type})
anonymous = testing.User.anonymous()
alice = instance.user('alice')
admin = instance.user('admin')
check_user(anonymous) |
class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if len(strs) == 0:
return ''
min_str = strs[0]
for s in strs[1:]:
if len(s) < len(min_str):
min_str = s
common = ''
for i, c in enumerate(min_str):
for s in strs:
if s[i] != c:
return common
common += c
return common
| class Solution:
def longest_common_prefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if len(strs) == 0:
return ''
min_str = strs[0]
for s in strs[1:]:
if len(s) < len(min_str):
min_str = s
common = ''
for (i, c) in enumerate(min_str):
for s in strs:
if s[i] != c:
return common
common += c
return common |
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
left = 0
right = len(height)-1
maxarea = 0
while left < right:
maxarea = max(maxarea, (right-left) *
min(height[right], height[left]))
if height[right] < height[left]:
right -= 1
else:
left += 1
return maxarea
| class Solution(object):
def max_area(self, height):
"""
:type height: List[int]
:rtype: int
"""
left = 0
right = len(height) - 1
maxarea = 0
while left < right:
maxarea = max(maxarea, (right - left) * min(height[right], height[left]))
if height[right] < height[left]:
right -= 1
else:
left += 1
return maxarea |
class Solution:
# @param S, a list of integer
# @return a list of lists of integer
def subsets(self, S):
S.sort()
return self._subsets(S, len(S))
def _subsets(self, S, k):
if k == 0:
return [[]]
else:
res = [[]]
for i in range(len(S)):
rest_subsets = self._subsets(S[i + 1:], k - 1)
for subset in rest_subsets:
subset.insert(0, S[i])
res += rest_subsets
return res
| class Solution:
def subsets(self, S):
S.sort()
return self._subsets(S, len(S))
def _subsets(self, S, k):
if k == 0:
return [[]]
else:
res = [[]]
for i in range(len(S)):
rest_subsets = self._subsets(S[i + 1:], k - 1)
for subset in rest_subsets:
subset.insert(0, S[i])
res += rest_subsets
return res |
def _exec_hook(hook_name, self):
if hasattr(self, hook_name):
getattr(self, hook_name)()
def hooks(fn):
def hooked(self):
fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__
_exec_hook('pre_' + fn_name, self)
val = fn(self)
_exec_hook('post_' + fn_name, self)
return val
return hooked
| def _exec_hook(hook_name, self):
if hasattr(self, hook_name):
getattr(self, hook_name)()
def hooks(fn):
def hooked(self):
fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__
_exec_hook('pre_' + fn_name, self)
val = fn(self)
_exec_hook('post_' + fn_name, self)
return val
return hooked |
def print_formatted(number):
# your code goes here
for i in range(1, number + 1):
print('{0:>{w}d} {0:>{w}o} {0:>{w}X} {0:>{w}b}'.format(i, w=len(bin(number)) - 2))
if __name__ == '__main__':
n = int(input())
print_formatted(n)
| def print_formatted(number):
for i in range(1, number + 1):
print('{0:>{w}d} {0:>{w}o} {0:>{w}X} {0:>{w}b}'.format(i, w=len(bin(number)) - 2))
if __name__ == '__main__':
n = int(input())
print_formatted(n) |
# Copyright (c) OpenMMLab. All rights reserved.
_base_ = ['./t.py']
base = '_base_.item8'
item11 = {{ _base_.item8 }}
item12 = {{ _base_.item9 }}
item13 = {{ _base_.item10 }}
item14 = {{ _base_.item1 }}
item15 = dict(
a = dict( b = {{ _base_.item2 }} ),
b = [{{ _base_.item3 }}],
c = [{{ _base_.item4 }}],
d = [[dict(e = {{ _base_.item5.a }})],{{ _base_.item6 }}],
e = {{ _base_.item1 }}
)
| _base_ = ['./t.py']
base = '_base_.item8'
item11 = {{_base_.item8}}
item12 = {{_base_.item9}}
item13 = {{_base_.item10}}
item14 = {{_base_.item1}}
item15 = dict(a=dict(b={{_base_.item2}}), b=[{{_base_.item3}}], c=[{{_base_.item4}}], d=[[dict(e={{_base_.item5.a}})], {{_base_.item6}}], e={{_base_.item1}}) |
"""
Stack Min: How would you design a stack which, in addition to push and pop, has a function min which returns the minimum element? Push, pop and min should all operate in 0(1) time.
"""
class Stack:
def __init__(self):
self._arr = []
self._min_arr = []
def is_empty(self):
return not self._arr
def peek(self):
if not self._arr:
raise Exception("Empty Stack")
return self._arr[-1]
def pop(self):
result = self.peek()
if self._min_arr[-1] == result:
self._min_arr.pop()
self._arr.pop()
return result
def push(self, value):
if not self._min_arr or self._min_arr[-1] >= value:
self._min_arr.append(value)
self._arr.append(value)
def min(self):
if not self._min_arr:
raise Exception("Empty Stack")
return self._min_arr[-1]
if __name__ == "__main__":
stack = Stack()
stack.push(1)
stack.push(2)
stack.push(0)
stack.push(3)
print(stack.min())
stack.pop()
print(stack.min())
stack.pop()
print(stack.min())
stack.pop()
print(stack.min())
stack.pop()
| """
Stack Min: How would you design a stack which, in addition to push and pop, has a function min which returns the minimum element? Push, pop and min should all operate in 0(1) time.
"""
class Stack:
def __init__(self):
self._arr = []
self._min_arr = []
def is_empty(self):
return not self._arr
def peek(self):
if not self._arr:
raise exception('Empty Stack')
return self._arr[-1]
def pop(self):
result = self.peek()
if self._min_arr[-1] == result:
self._min_arr.pop()
self._arr.pop()
return result
def push(self, value):
if not self._min_arr or self._min_arr[-1] >= value:
self._min_arr.append(value)
self._arr.append(value)
def min(self):
if not self._min_arr:
raise exception('Empty Stack')
return self._min_arr[-1]
if __name__ == '__main__':
stack = stack()
stack.push(1)
stack.push(2)
stack.push(0)
stack.push(3)
print(stack.min())
stack.pop()
print(stack.min())
stack.pop()
print(stack.min())
stack.pop()
print(stack.min())
stack.pop() |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def recursion(n):
if n == 1:
return 1
return n + recursion(n - 1)
if __name__ == '__main__':
n = int(input("Enter n: "))
summary = 0
for i in range(1, n + 1):
summary += i
print(f"Iterative sum: {summary}")
print(f"Recursion sum: {recursion(n)}") | def recursion(n):
if n == 1:
return 1
return n + recursion(n - 1)
if __name__ == '__main__':
n = int(input('Enter n: '))
summary = 0
for i in range(1, n + 1):
summary += i
print(f'Iterative sum: {summary}')
print(f'Recursion sum: {recursion(n)}') |
#
# PySNMP MIB module SVRSYS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SVRSYS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:04:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
mgmt, enterprises, iso, Counter64, ObjectIdentity, Bits, Unsigned32, Integer32, NotificationType, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, ModuleIdentity, Counter32, TimeTicks, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "mgmt", "enterprises", "iso", "Counter64", "ObjectIdentity", "Bits", "Unsigned32", "Integer32", "NotificationType", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "ModuleIdentity", "Counter32", "TimeTicks", "IpAddress")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
dec = MibIdentifier((1, 3, 6, 1, 4, 1, 36))
ema = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2))
class KBytes(Integer32):
pass
class BusTypes(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15))
namedValues = NamedValues(("unknown", 1), ("other", 2), ("systemBus", 3), ("isa", 4), ("eisa", 5), ("mca", 6), ("turbochannel", 7), ("pci", 8), ("vme", 9), ("nuBus", 10), ("pcmcia", 11), ("cBus", 12), ("mpi", 13), ("mpsa", 14), ("usb", 15))
class SystemStatus(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("unknown", 1), ("ok", 2), ("warning", 3), ("failed", 4))
class MemoryAddress(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8)
fixedLength = 8
class ThermUnits(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("unknown", 1), ("other", 2), ("degreesF", 3), ("degreesC", 4), ("tempRelative", 5))
class PowerUnits(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))
namedValues = NamedValues(("unknown", 1), ("other", 2), ("milliVoltsDC", 3), ("milliVoltsAC", 4), ("voltsDC", 5), ("voltsAC", 6), ("milliAmpsDC", 7), ("milliAmpsAC", 8), ("ampsDC", 9), ("ampsAC", 10), ("relative", 11))
class Boolean(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("true", 1), ("false", 2))
mib_extensions_1 = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18)).setLabel("mib-extensions-1")
svrSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22))
svrBaseSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1))
svrSysMibInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 1))
svrBaseSysDescr = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2))
svrProcessors = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3))
svrMemory = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4))
svrBuses = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5))
svrDevices = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6))
svrConsoleKeyboard = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 4))
svrConsoleDisplay = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5))
svrConsolePointDevice = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6))
svrPhysicalConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7))
svrEnvironment = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8))
svrThermalSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1))
svrCoolingSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2))
svrPowerSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3))
svrSysMibMajorRev = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSysMibMajorRev.setStatus('mandatory')
svrSysMibMinorRev = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSysMibMinorRev.setStatus('mandatory')
svrSystemFamily = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("x86", 3), ("alpha", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemFamily.setStatus('mandatory')
svrSystemModel = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemModel.setStatus('mandatory')
svrSystemDescr = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemDescr.setStatus('mandatory')
svrSystemBoardFruIndex = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemBoardFruIndex.setStatus('mandatory')
svrSystemOCPDisplay = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 5), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrSystemOCPDisplay.setStatus('mandatory')
svrSystemBootedOS = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("windowsNT", 3), ("netWare", 4), ("scoUnix", 5), ("digitalUnix", 6), ("openVms", 7), ("windows", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemBootedOS.setStatus('mandatory')
svrSystemBootedOSVersion = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemBootedOSVersion.setStatus('mandatory')
svrSystemShutdownReason = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSystemShutdownReason.setStatus('mandatory')
svrSystemRemoteMgrNum = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 9), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrSystemRemoteMgrNum.setStatus('mandatory')
svrFirmwareTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10), )
if mibBuilder.loadTexts: svrFirmwareTable.setStatus('mandatory')
svrFirmwareEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrFirmwareIndex"))
if mibBuilder.loadTexts: svrFirmwareEntry.setStatus('mandatory')
svrFirmwareIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFirmwareIndex.setStatus('mandatory')
svrFirmwareDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFirmwareDescr.setStatus('mandatory')
svrFirmwareRev = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFirmwareRev.setStatus('mandatory')
svrFwSymbolTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11), )
if mibBuilder.loadTexts: svrFwSymbolTable.setStatus('mandatory')
svrFwSymbolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrFwSymbolName"))
if mibBuilder.loadTexts: svrFwSymbolEntry.setStatus('mandatory')
svrFwSymbolName = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11, 1, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFwSymbolName.setStatus('mandatory')
svrFwSymbolValue = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11, 1, 2), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFwSymbolValue.setStatus('mandatory')
svrCpuPollInterval = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 1), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrCpuPollInterval.setStatus('mandatory')
svrCpuMinPollInterval = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuMinPollInterval.setStatus('mandatory')
svrCpuTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3), )
if mibBuilder.loadTexts: svrCpuTable.setStatus('mandatory')
svrCpuEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrCpuIndex"))
if mibBuilder.loadTexts: svrCpuEntry.setStatus('mandatory')
svrCpuIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuIndex.setStatus('mandatory')
svrCpuType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("i386", 3), ("i486", 4), ("pentium", 5), ("pentiumPro", 6), ("alpha21064", 7), ("alpha21164", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuType.setStatus('mandatory')
svrCpuManufacturer = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuManufacturer.setStatus('mandatory')
svrCpuRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuRevision.setStatus('mandatory')
svrCpuFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuFruIndex.setStatus('mandatory')
svrCpuSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuSpeed.setStatus('mandatory')
svrCpuUtilCurrent = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuUtilCurrent.setStatus('mandatory')
svrCpuAvgNextIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuAvgNextIndex.setStatus('mandatory')
svrCpuHrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuHrIndex.setStatus('mandatory')
svrCpuAvgTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4), )
if mibBuilder.loadTexts: svrCpuAvgTable.setStatus('mandatory')
svrCpuAvgEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrCpuIndex"), (0, "SVRSYS-MIB", "svrCpuAvgIndex"))
if mibBuilder.loadTexts: svrCpuAvgEntry.setStatus('mandatory')
svrCpuAvgIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuAvgIndex.setStatus('mandatory')
svrCpuAvgInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrCpuAvgInterval.setStatus('mandatory')
svrCpuAvgStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("underCreation", 1), ("rowInvalid", 2), ("rowEnabled", 3), ("rowDisabled", 4), ("rowError", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrCpuAvgStatus.setStatus('mandatory')
svrCpuAvgPersist = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 4), Boolean()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrCpuAvgPersist.setStatus('mandatory')
svrCpuAvgValue = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuAvgValue.setStatus('mandatory')
svrCpuCacheTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5), )
if mibBuilder.loadTexts: svrCpuCacheTable.setStatus('mandatory')
svrCpuCacheEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrCpuIndex"), (0, "SVRSYS-MIB", "svrCpuCacheIndex"))
if mibBuilder.loadTexts: svrCpuCacheEntry.setStatus('mandatory')
svrCpuCacheIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuCacheIndex.setStatus('mandatory')
svrCpuCacheLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("primary", 3), ("secondary", 4), ("tertiary", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuCacheLevel.setStatus('mandatory')
svrCpuCacheType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("internal", 1), ("external", 2), ("internalI", 3), ("internalD", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuCacheType.setStatus('mandatory')
svrCpuCacheSize = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 4), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuCacheSize.setStatus('mandatory')
svrCpuCacheSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuCacheSpeed.setStatus('mandatory')
svrCpuCacheStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("enabled", 3), ("disabled", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrCpuCacheStatus.setStatus('mandatory')
svrPhysicalMemorySize = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 1), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPhysicalMemorySize.setStatus('mandatory')
svrPhysicalMemoryFree = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 2), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPhysicalMemoryFree.setStatus('mandatory')
svrPagingMemorySize = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 3), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPagingMemorySize.setStatus('mandatory')
svrPagingMemoryFree = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 4), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPagingMemoryFree.setStatus('mandatory')
svrMemComponentTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5), )
if mibBuilder.loadTexts: svrMemComponentTable.setStatus('mandatory')
svrMemComponentEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrMemIndex"))
if mibBuilder.loadTexts: svrMemComponentEntry.setStatus('mandatory')
svrMemIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemIndex.setStatus('optional')
svrMemType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("systemMemory", 3), ("shadowMemory", 4), ("videoMemory", 5), ("flashMemory", 6), ("nvram", 7), ("expansionRam", 8), ("expansionROM", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemType.setStatus('optional')
svrMemSize = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 3), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemSize.setStatus('optional')
svrMemStartAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 4), MemoryAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemStartAddress.setStatus('optional')
svrMemPhysLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("systemBoard", 3), ("memoryBoard", 4), ("processorBoard", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemPhysLocation.setStatus('mandatory')
svrMemEdcType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("none", 3), ("parity", 4), ("singleBitECC", 5), ("multiBitECC", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemEdcType.setStatus('mandatory')
svrMemElementSlots = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementSlots.setStatus('mandatory')
svrMemElementSlotsUsed = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementSlotsUsed.setStatus('mandatory')
svrMemInterleafFactor = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemInterleafFactor.setStatus('mandatory')
svrMemInterleafElement = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemInterleafElement.setStatus('mandatory')
svrMemFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemFruIndex.setStatus('mandatory')
svrMemElementTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6), )
if mibBuilder.loadTexts: svrMemElementTable.setStatus('mandatory')
svrMemElementEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrMemIndex"), (0, "SVRSYS-MIB", "svrMemElementIndex"))
if mibBuilder.loadTexts: svrMemElementEntry.setStatus('mandatory')
svrMemElementIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementIndex.setStatus('mandatory')
svrMemElementType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("nonremoveable", 3), ("simm", 4), ("dimm", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementType.setStatus('mandatory')
svrMemElementSlotNo = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementSlotNo.setStatus('mandatory')
svrMemElementWidth = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementWidth.setStatus('mandatory')
svrMemElementDepth = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 5), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementDepth.setStatus('mandatory')
svrMemElementSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementSpeed.setStatus('mandatory')
svrMemElementStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 7), SystemStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrMemElementStatus.setStatus('mandatory')
svrBusCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrBusCount.setStatus('mandatory')
svrBusTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2), )
if mibBuilder.loadTexts: svrBusTable.setStatus('mandatory')
svrBusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrBusIndex"))
if mibBuilder.loadTexts: svrBusEntry.setStatus('mandatory')
svrBusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrBusIndex.setStatus('mandatory')
svrBusType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 2), BusTypes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrBusType.setStatus('mandatory')
svrBusNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrBusNumber.setStatus('mandatory')
svrBusSlotCount = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrBusSlotCount.setStatus('mandatory')
svrLogicalSlotTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3), )
if mibBuilder.loadTexts: svrLogicalSlotTable.setStatus('mandatory')
svrLogicalSlotEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrBusIndex"), (0, "SVRSYS-MIB", "svrLogicalSlotNumber"))
if mibBuilder.loadTexts: svrLogicalSlotEntry.setStatus('mandatory')
svrLogicalSlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrLogicalSlotNumber.setStatus('mandatory')
svrLogicalSlotDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrLogicalSlotDescr.setStatus('mandatory')
svrLogicalSlotDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrLogicalSlotDeviceID.setStatus('mandatory')
svrLogicalSlotVendor = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrLogicalSlotVendor.setStatus('mandatory')
svrLogicalSlotRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrLogicalSlotRevision.setStatus('mandatory')
svrLogicalSlotFnCount = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrLogicalSlotFnCount.setStatus('mandatory')
svrSlotFunctionTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4), )
if mibBuilder.loadTexts: svrSlotFunctionTable.setStatus('mandatory')
svrSlotFunctionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrBusIndex"), (0, "SVRSYS-MIB", "svrLogicalSlotNumber"), (0, "SVRSYS-MIB", "svrSlotFnIndex"))
if mibBuilder.loadTexts: svrSlotFunctionEntry.setStatus('mandatory')
svrSlotFnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSlotFnIndex.setStatus('mandatory')
svrSlotFnDevType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSlotFnDevType.setStatus('mandatory')
svrSlotFnRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSlotFnRevision.setStatus('mandatory')
svrDeviceCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDeviceCount.setStatus('mandatory')
svrSerialPortCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSerialPortCount.setStatus('mandatory')
svrParallelPortCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrParallelPortCount.setStatus('mandatory')
svrKeybdHrIndex = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 4, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrKeybdHrIndex.setStatus('mandatory')
svrKeybdDescr = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 4, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrKeybdDescr.setStatus('mandatory')
svrVideoHrIndex = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoHrIndex.setStatus('mandatory')
svrVideoDescr = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoDescr.setStatus('mandatory')
svrVideoXRes = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoXRes.setStatus('mandatory')
svrVideoYRes = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoYRes.setStatus('mandatory')
svrVideoNumColor = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoNumColor.setStatus('mandatory')
svrVideoRefreshRate = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoRefreshRate.setStatus('mandatory')
svrVideoScanMode = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("interlaced", 2), ("nonInterlaced", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoScanMode.setStatus('mandatory')
svrVideoMemory = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 8), KBytes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrVideoMemory.setStatus('mandatory')
svrPointingHrIndex = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPointingHrIndex.setStatus('mandatory')
svrPointingDescr = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPointingDescr.setStatus('mandatory')
svrNumButtons = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrNumButtons.setStatus('mandatory')
svrSerialPortTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7), )
if mibBuilder.loadTexts: svrSerialPortTable.setStatus('mandatory')
svrSerialPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrSerialIndex"))
if mibBuilder.loadTexts: svrSerialPortEntry.setStatus('mandatory')
svrSerialIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSerialIndex.setStatus('mandatory')
svrSerialPortDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSerialPortDescr.setStatus('mandatory')
svrSerialHrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrSerialHrIndex.setStatus('mandatory')
svrParallelPortTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8), )
if mibBuilder.loadTexts: svrParallelPortTable.setStatus('mandatory')
svrParallelPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrParallelIndex"))
if mibBuilder.loadTexts: svrParallelPortEntry.setStatus('mandatory')
svrParallelIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrParallelIndex.setStatus('mandatory')
svrParallelPortDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrParallelPortDescr.setStatus('mandatory')
svrParallelHrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrParallelHrIndex.setStatus('mandatory')
svrDeviceTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9), )
if mibBuilder.loadTexts: svrDeviceTable.setStatus('mandatory')
svrDeviceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrDevIndex"))
if mibBuilder.loadTexts: svrDeviceEntry.setStatus('mandatory')
svrDevIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevIndex.setStatus('mandatory')
svrDevDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevDescr.setStatus('mandatory')
svrDevBusInterfaceType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 3), BusTypes()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevBusInterfaceType.setStatus('mandatory')
svrDevBusNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevBusNumber.setStatus('mandatory')
svrDevSlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevSlotNumber.setStatus('mandatory')
svrDevFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevFruIndex.setStatus('mandatory')
svrDevCPUAffinity = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevCPUAffinity.setStatus('mandatory')
svrDevHrIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevHrIndex.setStatus('mandatory')
svrDevInterruptTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10), )
if mibBuilder.loadTexts: svrDevInterruptTable.setStatus('mandatory')
svrDevIntEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrDevIndex"), (0, "SVRSYS-MIB", "svrDevIntIndex"))
if mibBuilder.loadTexts: svrDevIntEntry.setStatus('mandatory')
svrDevIntIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevIntIndex.setStatus('mandatory')
svrDevIntLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevIntLevel.setStatus('mandatory')
svrDevIntVector = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevIntVector.setStatus('mandatory')
svrDevIntShared = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 4), Boolean()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevIntShared.setStatus('mandatory')
svrDevIntTrigger = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("level", 1), ("latch", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevIntTrigger.setStatus('mandatory')
svrDevMemTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11), )
if mibBuilder.loadTexts: svrDevMemTable.setStatus('mandatory')
svrDevMemEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrDevIndex"), (0, "SVRSYS-MIB", "svrDevMemIndex"))
if mibBuilder.loadTexts: svrDevMemEntry.setStatus('mandatory')
svrDevMemIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevMemIndex.setStatus('mandatory')
svrDevMemAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 2), MemoryAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevMemAddress.setStatus('mandatory')
svrDevMemLength = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevMemLength.setStatus('mandatory')
svrDevMemMapping = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("memoryMapped", 3), ("ioSpaceMapped", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevMemMapping.setStatus('mandatory')
svrDevDmaTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12), )
if mibBuilder.loadTexts: svrDevDmaTable.setStatus('mandatory')
svrDevDmaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrDevIndex"), (0, "SVRSYS-MIB", "svrDevDmaIndex"))
if mibBuilder.loadTexts: svrDevDmaEntry.setStatus('mandatory')
svrDevDmaIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevDmaIndex.setStatus('mandatory')
svrDevDmaChannel = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrDevDmaChannel.setStatus('mandatory')
svrChassisType = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("desktop", 3), ("tower", 4), ("miniTower", 5), ("rackMount", 6), ("laptop", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrChassisType.setStatus('mandatory')
svrChassisFruIndex = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrChassisFruIndex.setStatus('mandatory')
svrFruTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3), )
if mibBuilder.loadTexts: svrFruTable.setStatus('mandatory')
svrFruEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrFruIndex"))
if mibBuilder.loadTexts: svrFruEntry.setStatus('mandatory')
svrFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruIndex.setStatus('mandatory')
svrFruType = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("motherBoard", 3), ("processor", 4), ("memoryCard", 5), ("memoryModule", 6), ("peripheralDevice", 7), ("systemBusBridge", 8), ("powerSupply", 9), ("chassis", 10), ("fan", 11), ("ioCard", 12)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruType.setStatus('mandatory')
svrFruDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrFruDescr.setStatus('mandatory')
svrFruVendor = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruVendor.setStatus('mandatory')
svrFruPartNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruPartNumber.setStatus('mandatory')
svrFruRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruRevision.setStatus('mandatory')
svrFruFirmwareRevision = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruFirmwareRevision.setStatus('mandatory')
svrFruSerialNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruSerialNumber.setStatus('mandatory')
svrFruAssetNo = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 9), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrFruAssetNo.setStatus('mandatory')
svrFruClass = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("currentBoardInSlot", 3), ("priorBoardInSlot", 4), ("parentBoard", 5), ("priorParentBoard", 6), ("priorParentSystem", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFruClass.setStatus('mandatory')
svrThermalSensorCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThermalSensorCount.setStatus('mandatory')
svrThermalSensorTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2), )
if mibBuilder.loadTexts: svrThermalSensorTable.setStatus('mandatory')
svrThermalSensorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrThSensorIndex"))
if mibBuilder.loadTexts: svrThermalSensorEntry.setStatus('mandatory')
svrThSensorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorIndex.setStatus('mandatory')
svrThSensorLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrThSensorLocation.setStatus('mandatory')
svrThSensorReading = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorReading.setStatus('mandatory')
svrThSensorReadingUnits = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 4), ThermUnits()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorReadingUnits.setStatus('mandatory')
svrThSensorLowThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorLowThresh.setStatus('mandatory')
svrThSensorHighThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorHighThresh.setStatus('mandatory')
svrThSensorShutSoonThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorShutSoonThresh.setStatus('mandatory')
svrThSensorShutNowThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorShutNowThresh.setStatus('mandatory')
svrThSensorThreshUnits = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 9), ThermUnits()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorThreshUnits.setStatus('mandatory')
svrThSensorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("low", 3), ("lowWarning", 4), ("statusOk", 5), ("highWarning", 6), ("high", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorStatus.setStatus('mandatory')
svrThSensorFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrThSensorFruIndex.setStatus('mandatory')
svrFanCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFanCount.setStatus('mandatory')
svrFanTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2), )
if mibBuilder.loadTexts: svrFanTable.setStatus('mandatory')
svrFanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrFanIndex"))
if mibBuilder.loadTexts: svrFanEntry.setStatus('mandatory')
svrFanIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFanIndex.setStatus('mandatory')
svrFanLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrFanLocation.setStatus('mandatory')
svrFanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("running", 2), ("backup", 3), ("failed", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFanStatus.setStatus('mandatory')
svrFanBackup = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFanBackup.setStatus('mandatory')
svrFanFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrFanFruIndex.setStatus('mandatory')
svrPowerRedunEnable = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 1), Boolean()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerRedunEnable.setStatus('mandatory')
svrPowerSensorCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorCount.setStatus('mandatory')
svrPowerSupplyCount = MibScalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSupplyCount.setStatus('mandatory')
svrPowerSensorTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4), )
if mibBuilder.loadTexts: svrPowerSensorTable.setStatus('mandatory')
svrPowerSensorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrPowerSensorIndex"))
if mibBuilder.loadTexts: svrPowerSensorEntry.setStatus('mandatory')
svrPowerSensorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorIndex.setStatus('mandatory')
svrPowerSensorLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: svrPowerSensorLocation.setStatus('mandatory')
svrPowerSensorRating = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorRating.setStatus('mandatory')
svrPowerSensorReading = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorReading.setStatus('mandatory')
svrPowerSensorReadingUnits = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 5), PowerUnits()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorReadingUnits.setStatus('mandatory')
svrPowerSensorNeedPwrThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorNeedPwrThresh.setStatus('mandatory')
svrPowerSensorLowThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorLowThresh.setStatus('mandatory')
svrPowerSensorHighThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorHighThresh.setStatus('mandatory')
svrPowerSensorShutNowThresh = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorShutNowThresh.setStatus('mandatory')
svrPowerSensorThreshUnits = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 10), PowerUnits()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorThreshUnits.setStatus('mandatory')
svrPowerSensorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("low", 3), ("lowWarning", 4), ("statusOk", 5), ("highWarning", 6), ("high", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorStatus.setStatus('mandatory')
svrPowerSensorFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSensorFruIndex.setStatus('mandatory')
svrPowerSupplyTable = MibTable((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5), )
if mibBuilder.loadTexts: svrPowerSupplyTable.setStatus('mandatory')
svrPowerSupplyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1), ).setIndexNames((0, "SVRSYS-MIB", "svrPowerSupplyIndex"))
if mibBuilder.loadTexts: svrPowerSupplyEntry.setStatus('mandatory')
svrPowerSupplyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSupplyIndex.setStatus('mandatory')
svrPowerSupplyStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("running", 2), ("backup", 3), ("warning", 4), ("failed", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSupplyStatus.setStatus('mandatory')
svrPowerSupplyFruIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: svrPowerSupplyFruIndex.setStatus('mandatory')
mibBuilder.exportSymbols("SVRSYS-MIB", svrKeybdHrIndex=svrKeybdHrIndex, svrDevInterruptTable=svrDevInterruptTable, svrSystemModel=svrSystemModel, svrFanStatus=svrFanStatus, svrCpuCacheTable=svrCpuCacheTable, svrPowerSensorCount=svrPowerSensorCount, svrCpuAvgInterval=svrCpuAvgInterval, svrMemElementEntry=svrMemElementEntry, svrCpuCacheSize=svrCpuCacheSize, svrThSensorShutSoonThresh=svrThSensorShutSoonThresh, svrLogicalSlotEntry=svrLogicalSlotEntry, svrThSensorReading=svrThSensorReading, ThermUnits=ThermUnits, svrFruDescr=svrFruDescr, svrFruVendor=svrFruVendor, svrVideoHrIndex=svrVideoHrIndex, SystemStatus=SystemStatus, svrFirmwareRev=svrFirmwareRev, svrFwSymbolName=svrFwSymbolName, svrThSensorHighThresh=svrThSensorHighThresh, svrCpuIndex=svrCpuIndex, svrSystemBootedOS=svrSystemBootedOS, svrPhysicalMemorySize=svrPhysicalMemorySize, svrSerialPortTable=svrSerialPortTable, svrMemElementType=svrMemElementType, KBytes=KBytes, svrPagingMemoryFree=svrPagingMemoryFree, svrConsolePointDevice=svrConsolePointDevice, svrSystemDescr=svrSystemDescr, svrSystemBootedOSVersion=svrSystemBootedOSVersion, svrDevFruIndex=svrDevFruIndex, svrDevBusNumber=svrDevBusNumber, svrDevDmaEntry=svrDevDmaEntry, svrFruTable=svrFruTable, svrPowerSupplyIndex=svrPowerSupplyIndex, svrVideoYRes=svrVideoYRes, svrConsoleKeyboard=svrConsoleKeyboard, svrCpuAvgIndex=svrCpuAvgIndex, svrParallelPortEntry=svrParallelPortEntry, svrVideoScanMode=svrVideoScanMode, svrDevIntTrigger=svrDevIntTrigger, svrCpuCacheType=svrCpuCacheType, svrSystemRemoteMgrNum=svrSystemRemoteMgrNum, svrPowerSensorStatus=svrPowerSensorStatus, svrThSensorStatus=svrThSensorStatus, svrBusCount=svrBusCount, svrLogicalSlotDescr=svrLogicalSlotDescr, svrDeviceEntry=svrDeviceEntry, svrCpuPollInterval=svrCpuPollInterval, svrSysMibMajorRev=svrSysMibMajorRev, svrMemElementIndex=svrMemElementIndex, svrDevSlotNumber=svrDevSlotNumber, svrChassisFruIndex=svrChassisFruIndex, mib_extensions_1=mib_extensions_1, dec=dec, svrBaseSysDescr=svrBaseSysDescr, svrPowerSensorEntry=svrPowerSensorEntry, svrSerialPortCount=svrSerialPortCount, svrCpuManufacturer=svrCpuManufacturer, svrVideoNumColor=svrVideoNumColor, PowerUnits=PowerUnits, svrDeviceTable=svrDeviceTable, svrDevIntVector=svrDevIntVector, svrMemElementSlotsUsed=svrMemElementSlotsUsed, svrSystem=svrSystem, svrCpuType=svrCpuType, svrBusIndex=svrBusIndex, svrSerialPortEntry=svrSerialPortEntry, svrCpuHrIndex=svrCpuHrIndex, svrConsoleDisplay=svrConsoleDisplay, svrThSensorFruIndex=svrThSensorFruIndex, svrMemElementWidth=svrMemElementWidth, svrPowerSensorNeedPwrThresh=svrPowerSensorNeedPwrThresh, svrFanLocation=svrFanLocation, svrPagingMemorySize=svrPagingMemorySize, svrMemInterleafElement=svrMemInterleafElement, svrBusNumber=svrBusNumber, svrMemStartAddress=svrMemStartAddress, svrFruRevision=svrFruRevision, svrBuses=svrBuses, svrVideoDescr=svrVideoDescr, svrDevIntEntry=svrDevIntEntry, svrMemPhysLocation=svrMemPhysLocation, svrSysMibMinorRev=svrSysMibMinorRev, svrSystemBoardFruIndex=svrSystemBoardFruIndex, svrPhysicalMemoryFree=svrPhysicalMemoryFree, svrPowerSensorHighThresh=svrPowerSensorHighThresh, svrFruIndex=svrFruIndex, svrPhysicalConfiguration=svrPhysicalConfiguration, svrFirmwareDescr=svrFirmwareDescr, svrCpuCacheLevel=svrCpuCacheLevel, svrCpuEntry=svrCpuEntry, svrSlotFunctionTable=svrSlotFunctionTable, svrPowerSensorFruIndex=svrPowerSensorFruIndex, svrSlotFnRevision=svrSlotFnRevision, svrCpuCacheSpeed=svrCpuCacheSpeed, svrCpuRevision=svrCpuRevision, svrCpuUtilCurrent=svrCpuUtilCurrent, svrVideoXRes=svrVideoXRes, svrFruEntry=svrFruEntry, svrMemElementSpeed=svrMemElementSpeed, svrFanCount=svrFanCount, svrParallelPortTable=svrParallelPortTable, svrFanBackup=svrFanBackup, Boolean=Boolean, svrLogicalSlotTable=svrLogicalSlotTable, svrParallelPortCount=svrParallelPortCount, svrBaseSystem=svrBaseSystem, svrPowerSensorRating=svrPowerSensorRating, svrThSensorReadingUnits=svrThSensorReadingUnits, svrDevMemIndex=svrDevMemIndex, BusTypes=BusTypes, svrCpuAvgValue=svrCpuAvgValue, svrCpuCacheEntry=svrCpuCacheEntry, svrDevMemMapping=svrDevMemMapping, svrFruPartNumber=svrFruPartNumber, svrBusTable=svrBusTable, svrFanFruIndex=svrFanFruIndex, svrPowerSensorReadingUnits=svrPowerSensorReadingUnits, svrMemSize=svrMemSize, svrDevIntShared=svrDevIntShared, svrFruFirmwareRevision=svrFruFirmwareRevision, svrCpuMinPollInterval=svrCpuMinPollInterval, svrCpuAvgEntry=svrCpuAvgEntry, svrPowerRedunEnable=svrPowerRedunEnable, svrSerialIndex=svrSerialIndex, svrSystemFamily=svrSystemFamily, svrCpuAvgPersist=svrCpuAvgPersist, svrDevIntIndex=svrDevIntIndex, svrThSensorShutNowThresh=svrThSensorShutNowThresh, svrLogicalSlotFnCount=svrLogicalSlotFnCount, svrCpuCacheStatus=svrCpuCacheStatus, svrEnvironment=svrEnvironment, svrDevIntLevel=svrDevIntLevel, svrDevCPUAffinity=svrDevCPUAffinity, svrBusType=svrBusType, svrLogicalSlotDeviceID=svrLogicalSlotDeviceID, svrMemType=svrMemType, svrDevDmaChannel=svrDevDmaChannel, svrBusEntry=svrBusEntry, svrThermalSensorEntry=svrThermalSensorEntry, svrDevDmaTable=svrDevDmaTable, svrSlotFnDevType=svrSlotFnDevType, svrPowerSensorLowThresh=svrPowerSensorLowThresh, svrChassisType=svrChassisType, svrDevMemLength=svrDevMemLength, svrPowerSensorReading=svrPowerSensorReading, svrFanTable=svrFanTable, svrThSensorIndex=svrThSensorIndex, svrPowerSensorThreshUnits=svrPowerSensorThreshUnits, svrParallelHrIndex=svrParallelHrIndex, svrPowerSystem=svrPowerSystem, svrDevices=svrDevices, svrDevIndex=svrDevIndex, svrMemElementSlots=svrMemElementSlots, svrCpuCacheIndex=svrCpuCacheIndex, svrParallelPortDescr=svrParallelPortDescr, svrThSensorThreshUnits=svrThSensorThreshUnits, svrCpuAvgTable=svrCpuAvgTable, svrMemElementStatus=svrMemElementStatus, svrFruType=svrFruType, svrSerialHrIndex=svrSerialHrIndex, svrMemEdcType=svrMemEdcType, svrFirmwareIndex=svrFirmwareIndex, svrSerialPortDescr=svrSerialPortDescr, svrFruAssetNo=svrFruAssetNo, svrCpuTable=svrCpuTable, svrLogicalSlotRevision=svrLogicalSlotRevision, svrDeviceCount=svrDeviceCount, svrPowerSupplyEntry=svrPowerSupplyEntry, svrCpuAvgNextIndex=svrCpuAvgNextIndex, MemoryAddress=MemoryAddress, svrParallelIndex=svrParallelIndex, svrProcessors=svrProcessors, svrMemComponentEntry=svrMemComponentEntry, ema=ema, svrMemory=svrMemory, svrFwSymbolValue=svrFwSymbolValue, svrVideoRefreshRate=svrVideoRefreshRate, svrLogicalSlotVendor=svrLogicalSlotVendor, svrDevBusInterfaceType=svrDevBusInterfaceType, svrVideoMemory=svrVideoMemory, svrDevMemEntry=svrDevMemEntry, svrDevMemTable=svrDevMemTable, svrMemComponentTable=svrMemComponentTable, svrSlotFnIndex=svrSlotFnIndex, svrDevHrIndex=svrDevHrIndex, svrDevMemAddress=svrDevMemAddress, svrCoolingSystem=svrCoolingSystem, svrMemElementTable=svrMemElementTable, svrLogicalSlotNumber=svrLogicalSlotNumber, svrPointingDescr=svrPointingDescr, svrMemElementSlotNo=svrMemElementSlotNo, svrThermalSensorCount=svrThermalSensorCount, svrFirmwareTable=svrFirmwareTable, svrSlotFunctionEntry=svrSlotFunctionEntry, svrPointingHrIndex=svrPointingHrIndex, svrPowerSupplyTable=svrPowerSupplyTable, svrFanEntry=svrFanEntry, svrPowerSupplyFruIndex=svrPowerSupplyFruIndex, svrCpuAvgStatus=svrCpuAvgStatus, svrMemIndex=svrMemIndex, svrFruSerialNumber=svrFruSerialNumber, svrThSensorLocation=svrThSensorLocation, svrCpuSpeed=svrCpuSpeed, svrFirmwareEntry=svrFirmwareEntry, svrFwSymbolTable=svrFwSymbolTable, svrPowerSensorIndex=svrPowerSensorIndex, svrNumButtons=svrNumButtons, svrFanIndex=svrFanIndex, svrCpuFruIndex=svrCpuFruIndex, svrFwSymbolEntry=svrFwSymbolEntry, svrMemInterleafFactor=svrMemInterleafFactor, svrThSensorLowThresh=svrThSensorLowThresh, svrPowerSupplyCount=svrPowerSupplyCount, svrDevDescr=svrDevDescr, svrPowerSensorLocation=svrPowerSensorLocation, svrPowerSensorTable=svrPowerSensorTable, svrBusSlotCount=svrBusSlotCount, svrSysMibInfo=svrSysMibInfo, svrKeybdDescr=svrKeybdDescr, svrPowerSensorShutNowThresh=svrPowerSensorShutNowThresh, svrMemElementDepth=svrMemElementDepth, svrThermalSystem=svrThermalSystem, svrThermalSensorTable=svrThermalSensorTable, svrFruClass=svrFruClass, svrMemFruIndex=svrMemFruIndex, svrDevDmaIndex=svrDevDmaIndex, svrSystemOCPDisplay=svrSystemOCPDisplay, svrSystemShutdownReason=svrSystemShutdownReason, svrPowerSupplyStatus=svrPowerSupplyStatus)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(mgmt, enterprises, iso, counter64, object_identity, bits, unsigned32, integer32, notification_type, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, module_identity, counter32, time_ticks, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'mgmt', 'enterprises', 'iso', 'Counter64', 'ObjectIdentity', 'Bits', 'Unsigned32', 'Integer32', 'NotificationType', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'ModuleIdentity', 'Counter32', 'TimeTicks', 'IpAddress')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
dec = mib_identifier((1, 3, 6, 1, 4, 1, 36))
ema = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2))
class Kbytes(Integer32):
pass
class Bustypes(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15))
named_values = named_values(('unknown', 1), ('other', 2), ('systemBus', 3), ('isa', 4), ('eisa', 5), ('mca', 6), ('turbochannel', 7), ('pci', 8), ('vme', 9), ('nuBus', 10), ('pcmcia', 11), ('cBus', 12), ('mpi', 13), ('mpsa', 14), ('usb', 15))
class Systemstatus(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('unknown', 1), ('ok', 2), ('warning', 3), ('failed', 4))
class Memoryaddress(OctetString):
subtype_spec = OctetString.subtypeSpec + value_size_constraint(8, 8)
fixed_length = 8
class Thermunits(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5))
named_values = named_values(('unknown', 1), ('other', 2), ('degreesF', 3), ('degreesC', 4), ('tempRelative', 5))
class Powerunits(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))
named_values = named_values(('unknown', 1), ('other', 2), ('milliVoltsDC', 3), ('milliVoltsAC', 4), ('voltsDC', 5), ('voltsAC', 6), ('milliAmpsDC', 7), ('milliAmpsAC', 8), ('ampsDC', 9), ('ampsAC', 10), ('relative', 11))
class Boolean(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('true', 1), ('false', 2))
mib_extensions_1 = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18)).setLabel('mib-extensions-1')
svr_system = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22))
svr_base_system = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1))
svr_sys_mib_info = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 1))
svr_base_sys_descr = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2))
svr_processors = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3))
svr_memory = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4))
svr_buses = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5))
svr_devices = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6))
svr_console_keyboard = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 4))
svr_console_display = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5))
svr_console_point_device = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6))
svr_physical_configuration = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7))
svr_environment = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8))
svr_thermal_system = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1))
svr_cooling_system = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2))
svr_power_system = mib_identifier((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3))
svr_sys_mib_major_rev = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSysMibMajorRev.setStatus('mandatory')
svr_sys_mib_minor_rev = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSysMibMinorRev.setStatus('mandatory')
svr_system_family = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('x86', 3), ('alpha', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemFamily.setStatus('mandatory')
svr_system_model = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemModel.setStatus('mandatory')
svr_system_descr = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemDescr.setStatus('mandatory')
svr_system_board_fru_index = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemBoardFruIndex.setStatus('mandatory')
svr_system_ocp_display = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 5), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrSystemOCPDisplay.setStatus('mandatory')
svr_system_booted_os = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('windowsNT', 3), ('netWare', 4), ('scoUnix', 5), ('digitalUnix', 6), ('openVms', 7), ('windows', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemBootedOS.setStatus('mandatory')
svr_system_booted_os_version = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 7), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemBootedOSVersion.setStatus('mandatory')
svr_system_shutdown_reason = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 8), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSystemShutdownReason.setStatus('mandatory')
svr_system_remote_mgr_num = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 9), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrSystemRemoteMgrNum.setStatus('mandatory')
svr_firmware_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10))
if mibBuilder.loadTexts:
svrFirmwareTable.setStatus('mandatory')
svr_firmware_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrFirmwareIndex'))
if mibBuilder.loadTexts:
svrFirmwareEntry.setStatus('mandatory')
svr_firmware_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFirmwareIndex.setStatus('mandatory')
svr_firmware_descr = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFirmwareDescr.setStatus('mandatory')
svr_firmware_rev = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 10, 1, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFirmwareRev.setStatus('mandatory')
svr_fw_symbol_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11))
if mibBuilder.loadTexts:
svrFwSymbolTable.setStatus('mandatory')
svr_fw_symbol_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrFwSymbolName'))
if mibBuilder.loadTexts:
svrFwSymbolEntry.setStatus('mandatory')
svr_fw_symbol_name = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11, 1, 1), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFwSymbolName.setStatus('mandatory')
svr_fw_symbol_value = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 2, 11, 1, 2), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFwSymbolValue.setStatus('mandatory')
svr_cpu_poll_interval = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 1), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrCpuPollInterval.setStatus('mandatory')
svr_cpu_min_poll_interval = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuMinPollInterval.setStatus('mandatory')
svr_cpu_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3))
if mibBuilder.loadTexts:
svrCpuTable.setStatus('mandatory')
svr_cpu_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrCpuIndex'))
if mibBuilder.loadTexts:
svrCpuEntry.setStatus('mandatory')
svr_cpu_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuIndex.setStatus('mandatory')
svr_cpu_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('i386', 3), ('i486', 4), ('pentium', 5), ('pentiumPro', 6), ('alpha21064', 7), ('alpha21164', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuType.setStatus('mandatory')
svr_cpu_manufacturer = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuManufacturer.setStatus('mandatory')
svr_cpu_revision = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 4), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuRevision.setStatus('mandatory')
svr_cpu_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuFruIndex.setStatus('mandatory')
svr_cpu_speed = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuSpeed.setStatus('mandatory')
svr_cpu_util_current = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuUtilCurrent.setStatus('mandatory')
svr_cpu_avg_next_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuAvgNextIndex.setStatus('mandatory')
svr_cpu_hr_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 3, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuHrIndex.setStatus('mandatory')
svr_cpu_avg_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4))
if mibBuilder.loadTexts:
svrCpuAvgTable.setStatus('mandatory')
svr_cpu_avg_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrCpuIndex'), (0, 'SVRSYS-MIB', 'svrCpuAvgIndex'))
if mibBuilder.loadTexts:
svrCpuAvgEntry.setStatus('mandatory')
svr_cpu_avg_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuAvgIndex.setStatus('mandatory')
svr_cpu_avg_interval = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrCpuAvgInterval.setStatus('mandatory')
svr_cpu_avg_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('underCreation', 1), ('rowInvalid', 2), ('rowEnabled', 3), ('rowDisabled', 4), ('rowError', 5)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrCpuAvgStatus.setStatus('mandatory')
svr_cpu_avg_persist = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 4), boolean()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrCpuAvgPersist.setStatus('mandatory')
svr_cpu_avg_value = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 4, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuAvgValue.setStatus('mandatory')
svr_cpu_cache_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5))
if mibBuilder.loadTexts:
svrCpuCacheTable.setStatus('mandatory')
svr_cpu_cache_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrCpuIndex'), (0, 'SVRSYS-MIB', 'svrCpuCacheIndex'))
if mibBuilder.loadTexts:
svrCpuCacheEntry.setStatus('mandatory')
svr_cpu_cache_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuCacheIndex.setStatus('mandatory')
svr_cpu_cache_level = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('primary', 3), ('secondary', 4), ('tertiary', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuCacheLevel.setStatus('mandatory')
svr_cpu_cache_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('internal', 1), ('external', 2), ('internalI', 3), ('internalD', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuCacheType.setStatus('mandatory')
svr_cpu_cache_size = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 4), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuCacheSize.setStatus('mandatory')
svr_cpu_cache_speed = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuCacheSpeed.setStatus('mandatory')
svr_cpu_cache_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 3, 5, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('enabled', 3), ('disabled', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrCpuCacheStatus.setStatus('mandatory')
svr_physical_memory_size = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 1), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPhysicalMemorySize.setStatus('mandatory')
svr_physical_memory_free = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 2), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPhysicalMemoryFree.setStatus('mandatory')
svr_paging_memory_size = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 3), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPagingMemorySize.setStatus('mandatory')
svr_paging_memory_free = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 4), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPagingMemoryFree.setStatus('mandatory')
svr_mem_component_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5))
if mibBuilder.loadTexts:
svrMemComponentTable.setStatus('mandatory')
svr_mem_component_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrMemIndex'))
if mibBuilder.loadTexts:
svrMemComponentEntry.setStatus('mandatory')
svr_mem_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemIndex.setStatus('optional')
svr_mem_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('systemMemory', 3), ('shadowMemory', 4), ('videoMemory', 5), ('flashMemory', 6), ('nvram', 7), ('expansionRam', 8), ('expansionROM', 9)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemType.setStatus('optional')
svr_mem_size = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 3), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemSize.setStatus('optional')
svr_mem_start_address = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 4), memory_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemStartAddress.setStatus('optional')
svr_mem_phys_location = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('systemBoard', 3), ('memoryBoard', 4), ('processorBoard', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemPhysLocation.setStatus('mandatory')
svr_mem_edc_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('none', 3), ('parity', 4), ('singleBitECC', 5), ('multiBitECC', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemEdcType.setStatus('mandatory')
svr_mem_element_slots = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementSlots.setStatus('mandatory')
svr_mem_element_slots_used = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementSlotsUsed.setStatus('mandatory')
svr_mem_interleaf_factor = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemInterleafFactor.setStatus('mandatory')
svr_mem_interleaf_element = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemInterleafElement.setStatus('mandatory')
svr_mem_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 5, 1, 11), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemFruIndex.setStatus('mandatory')
svr_mem_element_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6))
if mibBuilder.loadTexts:
svrMemElementTable.setStatus('mandatory')
svr_mem_element_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrMemIndex'), (0, 'SVRSYS-MIB', 'svrMemElementIndex'))
if mibBuilder.loadTexts:
svrMemElementEntry.setStatus('mandatory')
svr_mem_element_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementIndex.setStatus('mandatory')
svr_mem_element_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('nonremoveable', 3), ('simm', 4), ('dimm', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementType.setStatus('mandatory')
svr_mem_element_slot_no = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementSlotNo.setStatus('mandatory')
svr_mem_element_width = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementWidth.setStatus('mandatory')
svr_mem_element_depth = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 5), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementDepth.setStatus('mandatory')
svr_mem_element_speed = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementSpeed.setStatus('mandatory')
svr_mem_element_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 4, 6, 1, 7), system_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrMemElementStatus.setStatus('mandatory')
svr_bus_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrBusCount.setStatus('mandatory')
svr_bus_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2))
if mibBuilder.loadTexts:
svrBusTable.setStatus('mandatory')
svr_bus_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrBusIndex'))
if mibBuilder.loadTexts:
svrBusEntry.setStatus('mandatory')
svr_bus_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrBusIndex.setStatus('mandatory')
svr_bus_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 2), bus_types()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrBusType.setStatus('mandatory')
svr_bus_number = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrBusNumber.setStatus('mandatory')
svr_bus_slot_count = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 2, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrBusSlotCount.setStatus('mandatory')
svr_logical_slot_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3))
if mibBuilder.loadTexts:
svrLogicalSlotTable.setStatus('mandatory')
svr_logical_slot_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrBusIndex'), (0, 'SVRSYS-MIB', 'svrLogicalSlotNumber'))
if mibBuilder.loadTexts:
svrLogicalSlotEntry.setStatus('mandatory')
svr_logical_slot_number = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrLogicalSlotNumber.setStatus('mandatory')
svr_logical_slot_descr = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 2), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrLogicalSlotDescr.setStatus('mandatory')
svr_logical_slot_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrLogicalSlotDeviceID.setStatus('mandatory')
svr_logical_slot_vendor = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 4), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrLogicalSlotVendor.setStatus('mandatory')
svr_logical_slot_revision = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 5), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrLogicalSlotRevision.setStatus('mandatory')
svr_logical_slot_fn_count = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 3, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrLogicalSlotFnCount.setStatus('mandatory')
svr_slot_function_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4))
if mibBuilder.loadTexts:
svrSlotFunctionTable.setStatus('mandatory')
svr_slot_function_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrBusIndex'), (0, 'SVRSYS-MIB', 'svrLogicalSlotNumber'), (0, 'SVRSYS-MIB', 'svrSlotFnIndex'))
if mibBuilder.loadTexts:
svrSlotFunctionEntry.setStatus('mandatory')
svr_slot_fn_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSlotFnIndex.setStatus('mandatory')
svr_slot_fn_dev_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSlotFnDevType.setStatus('mandatory')
svr_slot_fn_revision = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 5, 4, 1, 3), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSlotFnRevision.setStatus('mandatory')
svr_device_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDeviceCount.setStatus('mandatory')
svr_serial_port_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSerialPortCount.setStatus('mandatory')
svr_parallel_port_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrParallelPortCount.setStatus('mandatory')
svr_keybd_hr_index = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 4, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrKeybdHrIndex.setStatus('mandatory')
svr_keybd_descr = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 4, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrKeybdDescr.setStatus('mandatory')
svr_video_hr_index = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoHrIndex.setStatus('mandatory')
svr_video_descr = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoDescr.setStatus('mandatory')
svr_video_x_res = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoXRes.setStatus('mandatory')
svr_video_y_res = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoYRes.setStatus('mandatory')
svr_video_num_color = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoNumColor.setStatus('mandatory')
svr_video_refresh_rate = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoRefreshRate.setStatus('mandatory')
svr_video_scan_mode = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('unknown', 1), ('interlaced', 2), ('nonInterlaced', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoScanMode.setStatus('mandatory')
svr_video_memory = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 5, 8), k_bytes()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrVideoMemory.setStatus('mandatory')
svr_pointing_hr_index = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPointingHrIndex.setStatus('mandatory')
svr_pointing_descr = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPointingDescr.setStatus('mandatory')
svr_num_buttons = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 6, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrNumButtons.setStatus('mandatory')
svr_serial_port_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7))
if mibBuilder.loadTexts:
svrSerialPortTable.setStatus('mandatory')
svr_serial_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrSerialIndex'))
if mibBuilder.loadTexts:
svrSerialPortEntry.setStatus('mandatory')
svr_serial_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSerialIndex.setStatus('mandatory')
svr_serial_port_descr = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSerialPortDescr.setStatus('mandatory')
svr_serial_hr_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 7, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrSerialHrIndex.setStatus('mandatory')
svr_parallel_port_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8))
if mibBuilder.loadTexts:
svrParallelPortTable.setStatus('mandatory')
svr_parallel_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrParallelIndex'))
if mibBuilder.loadTexts:
svrParallelPortEntry.setStatus('mandatory')
svr_parallel_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrParallelIndex.setStatus('mandatory')
svr_parallel_port_descr = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrParallelPortDescr.setStatus('mandatory')
svr_parallel_hr_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 8, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrParallelHrIndex.setStatus('mandatory')
svr_device_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9))
if mibBuilder.loadTexts:
svrDeviceTable.setStatus('mandatory')
svr_device_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrDevIndex'))
if mibBuilder.loadTexts:
svrDeviceEntry.setStatus('mandatory')
svr_dev_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevIndex.setStatus('mandatory')
svr_dev_descr = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 2), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevDescr.setStatus('mandatory')
svr_dev_bus_interface_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 3), bus_types()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevBusInterfaceType.setStatus('mandatory')
svr_dev_bus_number = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevBusNumber.setStatus('mandatory')
svr_dev_slot_number = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevSlotNumber.setStatus('mandatory')
svr_dev_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevFruIndex.setStatus('mandatory')
svr_dev_cpu_affinity = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevCPUAffinity.setStatus('mandatory')
svr_dev_hr_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 9, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevHrIndex.setStatus('mandatory')
svr_dev_interrupt_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10))
if mibBuilder.loadTexts:
svrDevInterruptTable.setStatus('mandatory')
svr_dev_int_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrDevIndex'), (0, 'SVRSYS-MIB', 'svrDevIntIndex'))
if mibBuilder.loadTexts:
svrDevIntEntry.setStatus('mandatory')
svr_dev_int_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevIntIndex.setStatus('mandatory')
svr_dev_int_level = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevIntLevel.setStatus('mandatory')
svr_dev_int_vector = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevIntVector.setStatus('mandatory')
svr_dev_int_shared = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 4), boolean()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevIntShared.setStatus('mandatory')
svr_dev_int_trigger = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 10, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('level', 1), ('latch', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevIntTrigger.setStatus('mandatory')
svr_dev_mem_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11))
if mibBuilder.loadTexts:
svrDevMemTable.setStatus('mandatory')
svr_dev_mem_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrDevIndex'), (0, 'SVRSYS-MIB', 'svrDevMemIndex'))
if mibBuilder.loadTexts:
svrDevMemEntry.setStatus('mandatory')
svr_dev_mem_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevMemIndex.setStatus('mandatory')
svr_dev_mem_address = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 2), memory_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevMemAddress.setStatus('mandatory')
svr_dev_mem_length = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevMemLength.setStatus('mandatory')
svr_dev_mem_mapping = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 11, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('memoryMapped', 3), ('ioSpaceMapped', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevMemMapping.setStatus('mandatory')
svr_dev_dma_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12))
if mibBuilder.loadTexts:
svrDevDmaTable.setStatus('mandatory')
svr_dev_dma_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrDevIndex'), (0, 'SVRSYS-MIB', 'svrDevDmaIndex'))
if mibBuilder.loadTexts:
svrDevDmaEntry.setStatus('mandatory')
svr_dev_dma_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevDmaIndex.setStatus('mandatory')
svr_dev_dma_channel = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 6, 12, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrDevDmaChannel.setStatus('mandatory')
svr_chassis_type = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('desktop', 3), ('tower', 4), ('miniTower', 5), ('rackMount', 6), ('laptop', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrChassisType.setStatus('mandatory')
svr_chassis_fru_index = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrChassisFruIndex.setStatus('mandatory')
svr_fru_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3))
if mibBuilder.loadTexts:
svrFruTable.setStatus('mandatory')
svr_fru_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrFruIndex'))
if mibBuilder.loadTexts:
svrFruEntry.setStatus('mandatory')
svr_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruIndex.setStatus('mandatory')
svr_fru_type = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('motherBoard', 3), ('processor', 4), ('memoryCard', 5), ('memoryModule', 6), ('peripheralDevice', 7), ('systemBusBridge', 8), ('powerSupply', 9), ('chassis', 10), ('fan', 11), ('ioCard', 12)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruType.setStatus('mandatory')
svr_fru_descr = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 3), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrFruDescr.setStatus('mandatory')
svr_fru_vendor = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 4), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruVendor.setStatus('mandatory')
svr_fru_part_number = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 5), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruPartNumber.setStatus('mandatory')
svr_fru_revision = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 6), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruRevision.setStatus('mandatory')
svr_fru_firmware_revision = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 7), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruFirmwareRevision.setStatus('mandatory')
svr_fru_serial_number = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 8), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruSerialNumber.setStatus('mandatory')
svr_fru_asset_no = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 9), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrFruAssetNo.setStatus('mandatory')
svr_fru_class = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 7, 3, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('currentBoardInSlot', 3), ('priorBoardInSlot', 4), ('parentBoard', 5), ('priorParentBoard', 6), ('priorParentSystem', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFruClass.setStatus('mandatory')
svr_thermal_sensor_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThermalSensorCount.setStatus('mandatory')
svr_thermal_sensor_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2))
if mibBuilder.loadTexts:
svrThermalSensorTable.setStatus('mandatory')
svr_thermal_sensor_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrThSensorIndex'))
if mibBuilder.loadTexts:
svrThermalSensorEntry.setStatus('mandatory')
svr_th_sensor_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorIndex.setStatus('mandatory')
svr_th_sensor_location = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 2), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrThSensorLocation.setStatus('mandatory')
svr_th_sensor_reading = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorReading.setStatus('mandatory')
svr_th_sensor_reading_units = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 4), therm_units()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorReadingUnits.setStatus('mandatory')
svr_th_sensor_low_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorLowThresh.setStatus('mandatory')
svr_th_sensor_high_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorHighThresh.setStatus('mandatory')
svr_th_sensor_shut_soon_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorShutSoonThresh.setStatus('mandatory')
svr_th_sensor_shut_now_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorShutNowThresh.setStatus('mandatory')
svr_th_sensor_thresh_units = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 9), therm_units()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorThreshUnits.setStatus('mandatory')
svr_th_sensor_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('low', 3), ('lowWarning', 4), ('statusOk', 5), ('highWarning', 6), ('high', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorStatus.setStatus('mandatory')
svr_th_sensor_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 1, 2, 1, 11), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrThSensorFruIndex.setStatus('mandatory')
svr_fan_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFanCount.setStatus('mandatory')
svr_fan_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2))
if mibBuilder.loadTexts:
svrFanTable.setStatus('mandatory')
svr_fan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrFanIndex'))
if mibBuilder.loadTexts:
svrFanEntry.setStatus('mandatory')
svr_fan_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFanIndex.setStatus('mandatory')
svr_fan_location = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 2), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrFanLocation.setStatus('mandatory')
svr_fan_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('unknown', 1), ('running', 2), ('backup', 3), ('failed', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFanStatus.setStatus('mandatory')
svr_fan_backup = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFanBackup.setStatus('mandatory')
svr_fan_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 2, 2, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrFanFruIndex.setStatus('mandatory')
svr_power_redun_enable = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 1), boolean()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerRedunEnable.setStatus('mandatory')
svr_power_sensor_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorCount.setStatus('mandatory')
svr_power_supply_count = mib_scalar((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSupplyCount.setStatus('mandatory')
svr_power_sensor_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4))
if mibBuilder.loadTexts:
svrPowerSensorTable.setStatus('mandatory')
svr_power_sensor_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrPowerSensorIndex'))
if mibBuilder.loadTexts:
svrPowerSensorEntry.setStatus('mandatory')
svr_power_sensor_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorIndex.setStatus('mandatory')
svr_power_sensor_location = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 2), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
svrPowerSensorLocation.setStatus('mandatory')
svr_power_sensor_rating = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorRating.setStatus('mandatory')
svr_power_sensor_reading = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorReading.setStatus('mandatory')
svr_power_sensor_reading_units = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 5), power_units()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorReadingUnits.setStatus('mandatory')
svr_power_sensor_need_pwr_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorNeedPwrThresh.setStatus('mandatory')
svr_power_sensor_low_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorLowThresh.setStatus('mandatory')
svr_power_sensor_high_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorHighThresh.setStatus('mandatory')
svr_power_sensor_shut_now_thresh = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorShutNowThresh.setStatus('mandatory')
svr_power_sensor_thresh_units = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 10), power_units()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorThreshUnits.setStatus('mandatory')
svr_power_sensor_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('unknown', 1), ('other', 2), ('low', 3), ('lowWarning', 4), ('statusOk', 5), ('highWarning', 6), ('high', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorStatus.setStatus('mandatory')
svr_power_sensor_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 4, 1, 12), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSensorFruIndex.setStatus('mandatory')
svr_power_supply_table = mib_table((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5))
if mibBuilder.loadTexts:
svrPowerSupplyTable.setStatus('mandatory')
svr_power_supply_entry = mib_table_row((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1)).setIndexNames((0, 'SVRSYS-MIB', 'svrPowerSupplyIndex'))
if mibBuilder.loadTexts:
svrPowerSupplyEntry.setStatus('mandatory')
svr_power_supply_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSupplyIndex.setStatus('mandatory')
svr_power_supply_status = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('unknown', 1), ('running', 2), ('backup', 3), ('warning', 4), ('failed', 5)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSupplyStatus.setStatus('mandatory')
svr_power_supply_fru_index = mib_table_column((1, 3, 6, 1, 4, 1, 36, 2, 18, 22, 1, 8, 3, 5, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
svrPowerSupplyFruIndex.setStatus('mandatory')
mibBuilder.exportSymbols('SVRSYS-MIB', svrKeybdHrIndex=svrKeybdHrIndex, svrDevInterruptTable=svrDevInterruptTable, svrSystemModel=svrSystemModel, svrFanStatus=svrFanStatus, svrCpuCacheTable=svrCpuCacheTable, svrPowerSensorCount=svrPowerSensorCount, svrCpuAvgInterval=svrCpuAvgInterval, svrMemElementEntry=svrMemElementEntry, svrCpuCacheSize=svrCpuCacheSize, svrThSensorShutSoonThresh=svrThSensorShutSoonThresh, svrLogicalSlotEntry=svrLogicalSlotEntry, svrThSensorReading=svrThSensorReading, ThermUnits=ThermUnits, svrFruDescr=svrFruDescr, svrFruVendor=svrFruVendor, svrVideoHrIndex=svrVideoHrIndex, SystemStatus=SystemStatus, svrFirmwareRev=svrFirmwareRev, svrFwSymbolName=svrFwSymbolName, svrThSensorHighThresh=svrThSensorHighThresh, svrCpuIndex=svrCpuIndex, svrSystemBootedOS=svrSystemBootedOS, svrPhysicalMemorySize=svrPhysicalMemorySize, svrSerialPortTable=svrSerialPortTable, svrMemElementType=svrMemElementType, KBytes=KBytes, svrPagingMemoryFree=svrPagingMemoryFree, svrConsolePointDevice=svrConsolePointDevice, svrSystemDescr=svrSystemDescr, svrSystemBootedOSVersion=svrSystemBootedOSVersion, svrDevFruIndex=svrDevFruIndex, svrDevBusNumber=svrDevBusNumber, svrDevDmaEntry=svrDevDmaEntry, svrFruTable=svrFruTable, svrPowerSupplyIndex=svrPowerSupplyIndex, svrVideoYRes=svrVideoYRes, svrConsoleKeyboard=svrConsoleKeyboard, svrCpuAvgIndex=svrCpuAvgIndex, svrParallelPortEntry=svrParallelPortEntry, svrVideoScanMode=svrVideoScanMode, svrDevIntTrigger=svrDevIntTrigger, svrCpuCacheType=svrCpuCacheType, svrSystemRemoteMgrNum=svrSystemRemoteMgrNum, svrPowerSensorStatus=svrPowerSensorStatus, svrThSensorStatus=svrThSensorStatus, svrBusCount=svrBusCount, svrLogicalSlotDescr=svrLogicalSlotDescr, svrDeviceEntry=svrDeviceEntry, svrCpuPollInterval=svrCpuPollInterval, svrSysMibMajorRev=svrSysMibMajorRev, svrMemElementIndex=svrMemElementIndex, svrDevSlotNumber=svrDevSlotNumber, svrChassisFruIndex=svrChassisFruIndex, mib_extensions_1=mib_extensions_1, dec=dec, svrBaseSysDescr=svrBaseSysDescr, svrPowerSensorEntry=svrPowerSensorEntry, svrSerialPortCount=svrSerialPortCount, svrCpuManufacturer=svrCpuManufacturer, svrVideoNumColor=svrVideoNumColor, PowerUnits=PowerUnits, svrDeviceTable=svrDeviceTable, svrDevIntVector=svrDevIntVector, svrMemElementSlotsUsed=svrMemElementSlotsUsed, svrSystem=svrSystem, svrCpuType=svrCpuType, svrBusIndex=svrBusIndex, svrSerialPortEntry=svrSerialPortEntry, svrCpuHrIndex=svrCpuHrIndex, svrConsoleDisplay=svrConsoleDisplay, svrThSensorFruIndex=svrThSensorFruIndex, svrMemElementWidth=svrMemElementWidth, svrPowerSensorNeedPwrThresh=svrPowerSensorNeedPwrThresh, svrFanLocation=svrFanLocation, svrPagingMemorySize=svrPagingMemorySize, svrMemInterleafElement=svrMemInterleafElement, svrBusNumber=svrBusNumber, svrMemStartAddress=svrMemStartAddress, svrFruRevision=svrFruRevision, svrBuses=svrBuses, svrVideoDescr=svrVideoDescr, svrDevIntEntry=svrDevIntEntry, svrMemPhysLocation=svrMemPhysLocation, svrSysMibMinorRev=svrSysMibMinorRev, svrSystemBoardFruIndex=svrSystemBoardFruIndex, svrPhysicalMemoryFree=svrPhysicalMemoryFree, svrPowerSensorHighThresh=svrPowerSensorHighThresh, svrFruIndex=svrFruIndex, svrPhysicalConfiguration=svrPhysicalConfiguration, svrFirmwareDescr=svrFirmwareDescr, svrCpuCacheLevel=svrCpuCacheLevel, svrCpuEntry=svrCpuEntry, svrSlotFunctionTable=svrSlotFunctionTable, svrPowerSensorFruIndex=svrPowerSensorFruIndex, svrSlotFnRevision=svrSlotFnRevision, svrCpuCacheSpeed=svrCpuCacheSpeed, svrCpuRevision=svrCpuRevision, svrCpuUtilCurrent=svrCpuUtilCurrent, svrVideoXRes=svrVideoXRes, svrFruEntry=svrFruEntry, svrMemElementSpeed=svrMemElementSpeed, svrFanCount=svrFanCount, svrParallelPortTable=svrParallelPortTable, svrFanBackup=svrFanBackup, Boolean=Boolean, svrLogicalSlotTable=svrLogicalSlotTable, svrParallelPortCount=svrParallelPortCount, svrBaseSystem=svrBaseSystem, svrPowerSensorRating=svrPowerSensorRating, svrThSensorReadingUnits=svrThSensorReadingUnits, svrDevMemIndex=svrDevMemIndex, BusTypes=BusTypes, svrCpuAvgValue=svrCpuAvgValue, svrCpuCacheEntry=svrCpuCacheEntry, svrDevMemMapping=svrDevMemMapping, svrFruPartNumber=svrFruPartNumber, svrBusTable=svrBusTable, svrFanFruIndex=svrFanFruIndex, svrPowerSensorReadingUnits=svrPowerSensorReadingUnits, svrMemSize=svrMemSize, svrDevIntShared=svrDevIntShared, svrFruFirmwareRevision=svrFruFirmwareRevision, svrCpuMinPollInterval=svrCpuMinPollInterval, svrCpuAvgEntry=svrCpuAvgEntry, svrPowerRedunEnable=svrPowerRedunEnable, svrSerialIndex=svrSerialIndex, svrSystemFamily=svrSystemFamily, svrCpuAvgPersist=svrCpuAvgPersist, svrDevIntIndex=svrDevIntIndex, svrThSensorShutNowThresh=svrThSensorShutNowThresh, svrLogicalSlotFnCount=svrLogicalSlotFnCount, svrCpuCacheStatus=svrCpuCacheStatus, svrEnvironment=svrEnvironment, svrDevIntLevel=svrDevIntLevel, svrDevCPUAffinity=svrDevCPUAffinity, svrBusType=svrBusType, svrLogicalSlotDeviceID=svrLogicalSlotDeviceID, svrMemType=svrMemType, svrDevDmaChannel=svrDevDmaChannel, svrBusEntry=svrBusEntry, svrThermalSensorEntry=svrThermalSensorEntry, svrDevDmaTable=svrDevDmaTable, svrSlotFnDevType=svrSlotFnDevType, svrPowerSensorLowThresh=svrPowerSensorLowThresh, svrChassisType=svrChassisType, svrDevMemLength=svrDevMemLength, svrPowerSensorReading=svrPowerSensorReading, svrFanTable=svrFanTable, svrThSensorIndex=svrThSensorIndex, svrPowerSensorThreshUnits=svrPowerSensorThreshUnits, svrParallelHrIndex=svrParallelHrIndex, svrPowerSystem=svrPowerSystem, svrDevices=svrDevices, svrDevIndex=svrDevIndex, svrMemElementSlots=svrMemElementSlots, svrCpuCacheIndex=svrCpuCacheIndex, svrParallelPortDescr=svrParallelPortDescr, svrThSensorThreshUnits=svrThSensorThreshUnits, svrCpuAvgTable=svrCpuAvgTable, svrMemElementStatus=svrMemElementStatus, svrFruType=svrFruType, svrSerialHrIndex=svrSerialHrIndex, svrMemEdcType=svrMemEdcType, svrFirmwareIndex=svrFirmwareIndex, svrSerialPortDescr=svrSerialPortDescr, svrFruAssetNo=svrFruAssetNo, svrCpuTable=svrCpuTable, svrLogicalSlotRevision=svrLogicalSlotRevision, svrDeviceCount=svrDeviceCount, svrPowerSupplyEntry=svrPowerSupplyEntry, svrCpuAvgNextIndex=svrCpuAvgNextIndex, MemoryAddress=MemoryAddress, svrParallelIndex=svrParallelIndex, svrProcessors=svrProcessors, svrMemComponentEntry=svrMemComponentEntry, ema=ema, svrMemory=svrMemory, svrFwSymbolValue=svrFwSymbolValue, svrVideoRefreshRate=svrVideoRefreshRate, svrLogicalSlotVendor=svrLogicalSlotVendor, svrDevBusInterfaceType=svrDevBusInterfaceType, svrVideoMemory=svrVideoMemory, svrDevMemEntry=svrDevMemEntry, svrDevMemTable=svrDevMemTable, svrMemComponentTable=svrMemComponentTable, svrSlotFnIndex=svrSlotFnIndex, svrDevHrIndex=svrDevHrIndex, svrDevMemAddress=svrDevMemAddress, svrCoolingSystem=svrCoolingSystem, svrMemElementTable=svrMemElementTable, svrLogicalSlotNumber=svrLogicalSlotNumber, svrPointingDescr=svrPointingDescr, svrMemElementSlotNo=svrMemElementSlotNo, svrThermalSensorCount=svrThermalSensorCount, svrFirmwareTable=svrFirmwareTable, svrSlotFunctionEntry=svrSlotFunctionEntry, svrPointingHrIndex=svrPointingHrIndex, svrPowerSupplyTable=svrPowerSupplyTable, svrFanEntry=svrFanEntry, svrPowerSupplyFruIndex=svrPowerSupplyFruIndex, svrCpuAvgStatus=svrCpuAvgStatus, svrMemIndex=svrMemIndex, svrFruSerialNumber=svrFruSerialNumber, svrThSensorLocation=svrThSensorLocation, svrCpuSpeed=svrCpuSpeed, svrFirmwareEntry=svrFirmwareEntry, svrFwSymbolTable=svrFwSymbolTable, svrPowerSensorIndex=svrPowerSensorIndex, svrNumButtons=svrNumButtons, svrFanIndex=svrFanIndex, svrCpuFruIndex=svrCpuFruIndex, svrFwSymbolEntry=svrFwSymbolEntry, svrMemInterleafFactor=svrMemInterleafFactor, svrThSensorLowThresh=svrThSensorLowThresh, svrPowerSupplyCount=svrPowerSupplyCount, svrDevDescr=svrDevDescr, svrPowerSensorLocation=svrPowerSensorLocation, svrPowerSensorTable=svrPowerSensorTable, svrBusSlotCount=svrBusSlotCount, svrSysMibInfo=svrSysMibInfo, svrKeybdDescr=svrKeybdDescr, svrPowerSensorShutNowThresh=svrPowerSensorShutNowThresh, svrMemElementDepth=svrMemElementDepth, svrThermalSystem=svrThermalSystem, svrThermalSensorTable=svrThermalSensorTable, svrFruClass=svrFruClass, svrMemFruIndex=svrMemFruIndex, svrDevDmaIndex=svrDevDmaIndex, svrSystemOCPDisplay=svrSystemOCPDisplay, svrSystemShutdownReason=svrSystemShutdownReason, svrPowerSupplyStatus=svrPowerSupplyStatus) |
chemin = r'c:\temp\demo.txt'
fichier = open(chemin,'r')
ligne = fichier.readline()
while ligne:
print(ligne, end='')
ligne = fichier.readline()
fichier.close() | chemin = 'c:\\temp\\demo.txt'
fichier = open(chemin, 'r')
ligne = fichier.readline()
while ligne:
print(ligne, end='')
ligne = fichier.readline()
fichier.close() |
def index(r):
pass
def sum(r):
pass | def index(r):
pass
def sum(r):
pass |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 13 13:00:03 2018
@author: Khaled Nakhleh
"""
if __name__ == "__main__":
print("\n\tThis file only contains internal functions. Please use main.py to run the program.\n")
exit | """
Created on Tue Mar 13 13:00:03 2018
@author: Khaled Nakhleh
"""
if __name__ == '__main__':
print('\n\tThis file only contains internal functions. Please use main.py to run the program.\n')
exit |
"""
Search in Rotated Sorted Array
Suppose an array sorted in ascending order is rotated at some pivot unknown
to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index,
otherwise return -1.
Your algorithm's runtime complexity must be in the order of O(log n).
---------------------------------------------------------------------------------
Explanation algorithm:
In classic binary search, we compare val with the midpoint to figure out if
val belongs on the low or the high side. The complication here is that the
array is rotated and may have an inflection point. Consider, for example:
Array1: [10, 15, 20, 0, 5]
Array2: [50, 5, 20, 30, 40]
Note that both arrays have a midpoint of 20, but 5 appears on the left side of
one and on the right side of the other. Therefore, comparing val with the
midpoint is insufficient.
However, if we look a bit deeper, we can see that one half of the array must be
ordered normally(increasing order). We can therefore look at the normally ordered
half to determine whether we should search the low or hight side.
For example, if we are searching for 5 in Array1, we can look at the left element (10)
and middle element (20). Since 10 < 20, the left half must be ordered normally. And, since 5
is not between those, we know that we must search the right half
In array2, we can see that since 50 > 20, the right half must be ordered normally. We turn to
the middle 20, and right 40 element to check if 5 would fall between them. The value 5 would not
Therefore, we search the left half.
There are 2 possible solution: iterative and recursion.
Recursion helps you understand better the above algorithm explanation
"""
def search_rotate(array, val):
"""
Finds the index of the given value in an array that has been sorted in
ascending order and then rotated at some unknown pivot.
"""
low, high = 0, len(array) - 1
while low <= high:
mid = (low + high) // 2
if val == array[mid]:
return mid
if array[low] <= array[mid]:
if array[low] <= val <= array[mid]:
high = mid - 1
else:
low = mid + 1
else:
if array[mid] <= val <= array[high]:
low = mid + 1
else:
high = mid - 1
return -1
# Recursion technique
def search_rotate_recur(array, low, high, val):
"""
Finds the index of the given value in an array that has been sorted in
ascending order and then rotated at some unknown pivot.
"""
if low >= high:
return -1
mid = (low + high) // 2
if val == array[mid]: # found element
return mid
if array[low] <= array[mid]:
if array[low] <= val <= array[mid]:
return search_rotate_recur(array, low, mid - 1, val) # Search left
return search_rotate_recur(array, mid + 1, high, val) # Search right
if array[mid] <= val <= array[high]:
return search_rotate_recur(array, mid + 1, high, val) # Search right
return search_rotate_recur(array, low, mid - 1, val) # Search left
| """
Search in Rotated Sorted Array
Suppose an array sorted in ascending order is rotated at some pivot unknown
to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index,
otherwise return -1.
Your algorithm's runtime complexity must be in the order of O(log n).
---------------------------------------------------------------------------------
Explanation algorithm:
In classic binary search, we compare val with the midpoint to figure out if
val belongs on the low or the high side. The complication here is that the
array is rotated and may have an inflection point. Consider, for example:
Array1: [10, 15, 20, 0, 5]
Array2: [50, 5, 20, 30, 40]
Note that both arrays have a midpoint of 20, but 5 appears on the left side of
one and on the right side of the other. Therefore, comparing val with the
midpoint is insufficient.
However, if we look a bit deeper, we can see that one half of the array must be
ordered normally(increasing order). We can therefore look at the normally ordered
half to determine whether we should search the low or hight side.
For example, if we are searching for 5 in Array1, we can look at the left element (10)
and middle element (20). Since 10 < 20, the left half must be ordered normally. And, since 5
is not between those, we know that we must search the right half
In array2, we can see that since 50 > 20, the right half must be ordered normally. We turn to
the middle 20, and right 40 element to check if 5 would fall between them. The value 5 would not
Therefore, we search the left half.
There are 2 possible solution: iterative and recursion.
Recursion helps you understand better the above algorithm explanation
"""
def search_rotate(array, val):
"""
Finds the index of the given value in an array that has been sorted in
ascending order and then rotated at some unknown pivot.
"""
(low, high) = (0, len(array) - 1)
while low <= high:
mid = (low + high) // 2
if val == array[mid]:
return mid
if array[low] <= array[mid]:
if array[low] <= val <= array[mid]:
high = mid - 1
else:
low = mid + 1
elif array[mid] <= val <= array[high]:
low = mid + 1
else:
high = mid - 1
return -1
def search_rotate_recur(array, low, high, val):
"""
Finds the index of the given value in an array that has been sorted in
ascending order and then rotated at some unknown pivot.
"""
if low >= high:
return -1
mid = (low + high) // 2
if val == array[mid]:
return mid
if array[low] <= array[mid]:
if array[low] <= val <= array[mid]:
return search_rotate_recur(array, low, mid - 1, val)
return search_rotate_recur(array, mid + 1, high, val)
if array[mid] <= val <= array[high]:
return search_rotate_recur(array, mid + 1, high, val)
return search_rotate_recur(array, low, mid - 1, val) |
class Planet:
def count_age(self, earth_years, planet):
if type(earth_years) is int and type(planet) is str:
if earth_years < 0:
raise Exception('Wiek nie moze byc ujemny')
stala = earth_years / 31557600
if planet == 'Ziemia':
return round(stala, 2)
elif planet == 'Merkury':
return round(stala / 0.2408467, 2)
elif planet == 'Wenus':
return round(stala / 0.61519726, 2)
elif planet == 'Mars':
return round(stala / 1.8808158, 2)
elif planet == 'Jowisz':
return round(stala / 11.862615, 2)
elif planet == 'Saturn':
return round(stala / 29.447498, 2)
elif planet == 'Uran':
return round(stala / 84.016846, 2)
elif planet == 'Neptun':
return round(stala / 164.79132, 2)
else:
return 'Planeta nie istnieje'
else:
raise Exception('Zle typy')
| class Planet:
def count_age(self, earth_years, planet):
if type(earth_years) is int and type(planet) is str:
if earth_years < 0:
raise exception('Wiek nie moze byc ujemny')
stala = earth_years / 31557600
if planet == 'Ziemia':
return round(stala, 2)
elif planet == 'Merkury':
return round(stala / 0.2408467, 2)
elif planet == 'Wenus':
return round(stala / 0.61519726, 2)
elif planet == 'Mars':
return round(stala / 1.8808158, 2)
elif planet == 'Jowisz':
return round(stala / 11.862615, 2)
elif planet == 'Saturn':
return round(stala / 29.447498, 2)
elif planet == 'Uran':
return round(stala / 84.016846, 2)
elif planet == 'Neptun':
return round(stala / 164.79132, 2)
else:
return 'Planeta nie istnieje'
else:
raise exception('Zle typy') |
imports = ["base.py"]
train_option = {
"n_train_iteration": 6000,
"interval_iter": 2000,
}
train_artifact_dir = "artifacts/train"
evaluate_artifact_dir = "artifacts/evaluate"
reference = False
model = torch.nn.Sequential(
modules=collections.OrderedDict(
items=[
[
"encoder",
torch.nn.Sequential(
modules=collections.OrderedDict(
items=[
[
"encoder",
Apply(
in_keys=[["test_case_tensor", "x"]],
out_key="input_feature",
module=mlprogram.nn.CNN2d(
in_channel=1,
out_channel=16,
hidden_channel=32,
n_conv_per_block=2,
n_block=2,
pool=2,
),
),
],
[
"reduction",
Apply(
in_keys=[["input_feature", "input"]],
out_key="input_feature",
module=torch.Mean(
dim=1,
),
),
],
],
),
),
],
[
"decoder",
torch.nn.Sequential(
modules=collections.OrderedDict(
items=[
[
"action_embedding",
Apply(
module=mlprogram.nn.action_sequence.PreviousActionsEmbedding(
n_rule=encoder._rule_encoder.vocab_size,
n_token=encoder._token_encoder.vocab_size,
embedding_size=256,
),
in_keys=["previous_actions"],
out_key="action_features",
),
],
[
"decoder",
Apply(
module=mlprogram.nn.action_sequence.LSTMDecoder(
inject_input=mlprogram.nn.action_sequence.CatInput(),
input_feature_size=mul(
x=16,
y=mul(
x=n_feature_pixel,
y=n_feature_pixel,
),
),
action_feature_size=256,
output_feature_size=512,
dropout=0.1,
),
in_keys=[
"input_feature",
"action_features",
"hidden_state",
"state",
],
out_key=[
"action_features",
"hidden_state",
"state",
],
),
],
[
"predictor",
Apply(
module=mlprogram.nn.action_sequence.Predictor(
feature_size=512,
reference_feature_size=1,
rule_size=encoder._rule_encoder.vocab_size,
token_size=encoder._token_encoder.vocab_size,
hidden_size=512,
),
in_keys=[
"reference_features",
"action_features",
],
out_key=[
"rule_probs",
"token_probs",
"reference_probs",
],
),
],
],
),
),
],
],
),
)
collate = mlprogram.utils.data.Collate(
test_case_tensor=mlprogram.utils.data.CollateOptions(
use_pad_sequence=False,
dim=0,
padding_value=0,
),
input_feature=mlprogram.utils.data.CollateOptions(
use_pad_sequence=False,
dim=0,
padding_value=0,
),
reference_features=mlprogram.utils.data.CollateOptions(
use_pad_sequence=True,
dim=0,
padding_value=0,
),
previous_actions=mlprogram.utils.data.CollateOptions(
use_pad_sequence=True,
dim=0,
padding_value=-1,
),
hidden_state=mlprogram.utils.data.CollateOptions(
use_pad_sequence=False,
dim=0,
padding_value=0,
),
state=mlprogram.utils.data.CollateOptions(
use_pad_sequence=False,
dim=0,
padding_value=0,
),
ground_truth_actions=mlprogram.utils.data.CollateOptions(
use_pad_sequence=True,
dim=0,
padding_value=-1,
),
)
transform_input = mlprogram.functools.Sequence(
funcs=collections.OrderedDict(
items=[
[
"add_reference",
Apply(
module=mlprogram.transforms.action_sequence.AddEmptyReference(),
in_keys=[],
out_key=["reference", "reference_features"],
),
],
[
"transform_canvas",
Apply(
module=mlprogram.languages.csg.transforms.TransformInputs(),
in_keys=["test_cases"],
out_key="test_case_tensor",
),
],
],
),
)
transform_action_sequence = mlprogram.functools.Sequence(
funcs=collections.OrderedDict(
items=[
[
"add_previous_actions",
Apply(
module=mlprogram.transforms.action_sequence.AddPreviousActions(
action_sequence_encoder=encoder,
n_dependent=1,
),
in_keys=["action_sequence", "reference", "train"],
out_key="previous_actions",
),
],
[
"add_state",
mlprogram.transforms.action_sequence.AddState(key="state"),
],
[
"add_hidden_state",
mlprogram.transforms.action_sequence.AddState(key="hidden_state"),
],
],
),
)
transform = mlprogram.functools.Sequence(
funcs=collections.OrderedDict(
items=[
[
"set_train",
Apply(module=Constant(value=True), in_keys=[], out_key="train"),
],
["transform_input", transform_input],
[
"transform_code",
Apply(
module=mlprogram.transforms.action_sequence.GroundTruthToActionSequence(
parser=parser,
),
in_keys=["ground_truth"],
out_key="action_sequence",
),
],
["transform_action_sequence", transform_action_sequence],
[
"transform_ground_truth",
Apply(
module=mlprogram.transforms.action_sequence.EncodeActionSequence(
action_sequence_encoder=encoder,
),
in_keys=["action_sequence", "reference"],
out_key="ground_truth_actions",
),
],
],
),
)
sampler = mlprogram.samplers.transform(
sampler=mlprogram.samplers.ActionSequenceSampler(
encoder=encoder,
is_subtype=mlprogram.languages.csg.IsSubtype(),
transform_input=transform_input,
transform_action_sequence=mlprogram.functools.Sequence(
funcs=collections.OrderedDict(
items=[
[
"set_train",
Apply(
module=Constant(value=False), in_keys=[], out_key="train"
),
],
["transform", transform_action_sequence],
]
)
),
collate=collate,
module=model,
),
transform=parser.unparse,
)
base_synthesizer = mlprogram.synthesizers.SMC(
max_step_size=mul(
x=5,
y=mul(
x=5,
y=dataset_option.evaluate_max_object,
),
),
initial_particle_size=100,
max_try_num=50,
sampler=sampler,
to_key=Pick(
key="action_sequence",
),
)
| imports = ['base.py']
train_option = {'n_train_iteration': 6000, 'interval_iter': 2000}
train_artifact_dir = 'artifacts/train'
evaluate_artifact_dir = 'artifacts/evaluate'
reference = False
model = torch.nn.Sequential(modules=collections.OrderedDict(items=[['encoder', torch.nn.Sequential(modules=collections.OrderedDict(items=[['encoder', apply(in_keys=[['test_case_tensor', 'x']], out_key='input_feature', module=mlprogram.nn.CNN2d(in_channel=1, out_channel=16, hidden_channel=32, n_conv_per_block=2, n_block=2, pool=2))], ['reduction', apply(in_keys=[['input_feature', 'input']], out_key='input_feature', module=torch.Mean(dim=1))]]))], ['decoder', torch.nn.Sequential(modules=collections.OrderedDict(items=[['action_embedding', apply(module=mlprogram.nn.action_sequence.PreviousActionsEmbedding(n_rule=encoder._rule_encoder.vocab_size, n_token=encoder._token_encoder.vocab_size, embedding_size=256), in_keys=['previous_actions'], out_key='action_features')], ['decoder', apply(module=mlprogram.nn.action_sequence.LSTMDecoder(inject_input=mlprogram.nn.action_sequence.CatInput(), input_feature_size=mul(x=16, y=mul(x=n_feature_pixel, y=n_feature_pixel)), action_feature_size=256, output_feature_size=512, dropout=0.1), in_keys=['input_feature', 'action_features', 'hidden_state', 'state'], out_key=['action_features', 'hidden_state', 'state'])], ['predictor', apply(module=mlprogram.nn.action_sequence.Predictor(feature_size=512, reference_feature_size=1, rule_size=encoder._rule_encoder.vocab_size, token_size=encoder._token_encoder.vocab_size, hidden_size=512), in_keys=['reference_features', 'action_features'], out_key=['rule_probs', 'token_probs', 'reference_probs'])]]))]]))
collate = mlprogram.utils.data.Collate(test_case_tensor=mlprogram.utils.data.CollateOptions(use_pad_sequence=False, dim=0, padding_value=0), input_feature=mlprogram.utils.data.CollateOptions(use_pad_sequence=False, dim=0, padding_value=0), reference_features=mlprogram.utils.data.CollateOptions(use_pad_sequence=True, dim=0, padding_value=0), previous_actions=mlprogram.utils.data.CollateOptions(use_pad_sequence=True, dim=0, padding_value=-1), hidden_state=mlprogram.utils.data.CollateOptions(use_pad_sequence=False, dim=0, padding_value=0), state=mlprogram.utils.data.CollateOptions(use_pad_sequence=False, dim=0, padding_value=0), ground_truth_actions=mlprogram.utils.data.CollateOptions(use_pad_sequence=True, dim=0, padding_value=-1))
transform_input = mlprogram.functools.Sequence(funcs=collections.OrderedDict(items=[['add_reference', apply(module=mlprogram.transforms.action_sequence.AddEmptyReference(), in_keys=[], out_key=['reference', 'reference_features'])], ['transform_canvas', apply(module=mlprogram.languages.csg.transforms.TransformInputs(), in_keys=['test_cases'], out_key='test_case_tensor')]]))
transform_action_sequence = mlprogram.functools.Sequence(funcs=collections.OrderedDict(items=[['add_previous_actions', apply(module=mlprogram.transforms.action_sequence.AddPreviousActions(action_sequence_encoder=encoder, n_dependent=1), in_keys=['action_sequence', 'reference', 'train'], out_key='previous_actions')], ['add_state', mlprogram.transforms.action_sequence.AddState(key='state')], ['add_hidden_state', mlprogram.transforms.action_sequence.AddState(key='hidden_state')]]))
transform = mlprogram.functools.Sequence(funcs=collections.OrderedDict(items=[['set_train', apply(module=constant(value=True), in_keys=[], out_key='train')], ['transform_input', transform_input], ['transform_code', apply(module=mlprogram.transforms.action_sequence.GroundTruthToActionSequence(parser=parser), in_keys=['ground_truth'], out_key='action_sequence')], ['transform_action_sequence', transform_action_sequence], ['transform_ground_truth', apply(module=mlprogram.transforms.action_sequence.EncodeActionSequence(action_sequence_encoder=encoder), in_keys=['action_sequence', 'reference'], out_key='ground_truth_actions')]]))
sampler = mlprogram.samplers.transform(sampler=mlprogram.samplers.ActionSequenceSampler(encoder=encoder, is_subtype=mlprogram.languages.csg.IsSubtype(), transform_input=transform_input, transform_action_sequence=mlprogram.functools.Sequence(funcs=collections.OrderedDict(items=[['set_train', apply(module=constant(value=False), in_keys=[], out_key='train')], ['transform', transform_action_sequence]])), collate=collate, module=model), transform=parser.unparse)
base_synthesizer = mlprogram.synthesizers.SMC(max_step_size=mul(x=5, y=mul(x=5, y=dataset_option.evaluate_max_object)), initial_particle_size=100, max_try_num=50, sampler=sampler, to_key=pick(key='action_sequence')) |
class Node(object):
def __init__(self, children=None, is_root=False):
if isinstance(children, Node):
children = [children]
self.is_root = is_root
self.children = list(children) if children else []
@classmethod
def precedence(self):
return 0
@classmethod
def is_logical(self):
return False
def add(self, child):
self.children.append(child)
return child
def pop(self):
return self.children.pop()
def dump(self, indent=0):
isroot = '(root)' if self.is_root else ''
result = [(indent * ' ') + self.__class__.__name__ + isroot]
for child in self.children:
result += child.dump(indent+1)
if self.is_root:
return '\n'.join(result)
return result
def each(self, func, node_type=None):
"""
Runs func once for every node in the object tree.
If node_type is not None, only call func for nodes with the given
type.
"""
if node_type is None or isinstance(self, node_type):
func(self)
for child in self.children:
child.each(func, node_type)
| class Node(object):
def __init__(self, children=None, is_root=False):
if isinstance(children, Node):
children = [children]
self.is_root = is_root
self.children = list(children) if children else []
@classmethod
def precedence(self):
return 0
@classmethod
def is_logical(self):
return False
def add(self, child):
self.children.append(child)
return child
def pop(self):
return self.children.pop()
def dump(self, indent=0):
isroot = '(root)' if self.is_root else ''
result = [indent * ' ' + self.__class__.__name__ + isroot]
for child in self.children:
result += child.dump(indent + 1)
if self.is_root:
return '\n'.join(result)
return result
def each(self, func, node_type=None):
"""
Runs func once for every node in the object tree.
If node_type is not None, only call func for nodes with the given
type.
"""
if node_type is None or isinstance(self, node_type):
func(self)
for child in self.children:
child.each(func, node_type) |
"""
Base class for exceptions in this module.
This class was created for better extensibility should more features be added
and need treatment.
"""
class Error(Exception):
pass
"""
Exception raised for errors in the input.
Attributes:
msg -- explanation of the error
"""
class InputError(Error):
def __init__(self, msg):
self.msg = msg
| """
Base class for exceptions in this module.
This class was created for better extensibility should more features be added
and need treatment.
"""
class Error(Exception):
pass
'\nException raised for errors in the input.\n\nAttributes:\n msg -- explanation of the error\n'
class Inputerror(Error):
def __init__(self, msg):
self.msg = msg |
# Copyright (c) 2010-2013 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class ClientException(Exception):
def __init__(self, msg, http_scheme='', http_host='', http_port='',
http_path='', http_query='', http_status=0, http_reason='',
http_device='', http_response_content=''):
Exception.__init__(self, msg)
self.msg = msg
self.http_scheme = http_scheme
self.http_host = http_host
self.http_port = http_port
self.http_path = http_path
self.http_query = http_query
self.http_status = http_status
self.http_reason = http_reason
self.http_device = http_device
self.http_response_content = http_response_content
def __str__(self):
a = self.msg
b = ''
if self.http_scheme:
b += '%s://' % self.http_scheme
if self.http_host:
b += self.http_host
if self.http_port:
b += ':%s' % self.http_port
if self.http_path:
b += self.http_path
if self.http_query:
b += '?%s' % self.http_query
if self.http_status:
if b:
b = '%s %s' % (b, self.http_status)
else:
b = str(self.http_status)
if self.http_reason:
if b:
b = '%s %s' % (b, self.http_reason)
else:
b = '- %s' % self.http_reason
if self.http_device:
if b:
b = '%s: device %s' % (b, self.http_device)
else:
b = 'device %s' % self.http_device
if self.http_response_content:
if len(self.http_response_content) <= 60:
b += ' %s' % self.http_response_content
else:
b += ' [first 60 chars of response] %s' \
% self.http_response_content[:60]
return b and '%s: %s' % (a, b) or a
class InvalidHeadersException(Exception):
pass
| class Clientexception(Exception):
def __init__(self, msg, http_scheme='', http_host='', http_port='', http_path='', http_query='', http_status=0, http_reason='', http_device='', http_response_content=''):
Exception.__init__(self, msg)
self.msg = msg
self.http_scheme = http_scheme
self.http_host = http_host
self.http_port = http_port
self.http_path = http_path
self.http_query = http_query
self.http_status = http_status
self.http_reason = http_reason
self.http_device = http_device
self.http_response_content = http_response_content
def __str__(self):
a = self.msg
b = ''
if self.http_scheme:
b += '%s://' % self.http_scheme
if self.http_host:
b += self.http_host
if self.http_port:
b += ':%s' % self.http_port
if self.http_path:
b += self.http_path
if self.http_query:
b += '?%s' % self.http_query
if self.http_status:
if b:
b = '%s %s' % (b, self.http_status)
else:
b = str(self.http_status)
if self.http_reason:
if b:
b = '%s %s' % (b, self.http_reason)
else:
b = '- %s' % self.http_reason
if self.http_device:
if b:
b = '%s: device %s' % (b, self.http_device)
else:
b = 'device %s' % self.http_device
if self.http_response_content:
if len(self.http_response_content) <= 60:
b += ' %s' % self.http_response_content
else:
b += ' [first 60 chars of response] %s' % self.http_response_content[:60]
return b and '%s: %s' % (a, b) or a
class Invalidheadersexception(Exception):
pass |
class Solution:
def regionsBySlashes(self, grid: List[str]) -> int:
def dfs(i, j, k):
if 0 <= i < n > j >= 0 and not matrix[i][j][k]:
if grid[i][j] == "*":
if k <= 1:
matrix[i][j][0] = matrix[i][j][1] = cnt
dfs(i - 1, j, 2)
dfs(i, j + 1, 3)
else:
matrix[i][j][2] = matrix[i][j][3] = cnt
dfs(i + 1, j, 0)
dfs(i, j - 1, 1)
elif grid[i][j] == "/":
if 1 <= k <= 2:
matrix[i][j][1] = matrix[i][j][2] = cnt
dfs(i, j + 1, 3)
dfs(i + 1, j, 0)
else:
matrix[i][j][0] = matrix[i][j][3] = cnt
dfs(i - 1, j, 2)
dfs(i, j - 1, 1)
else:
matrix[i][j][0] = matrix[i][j][1] = matrix[i][j][2] = matrix[i][j][3] = cnt
dfs(i - 1, j, 2)
dfs(i, j + 1, 3)
dfs(i + 1, j, 0)
dfs(i, j - 1, 1)
grid, n = [row.replace("\\", "*") for row in grid], len(grid)
matrix, cnt = [[[0, 0, 0, 0] for j in range(n)] for i in range(n)], 0
for i in range(n):
for j in range(n):
for k in range(4):
if not matrix[i][j][k]:
cnt += 1
dfs(i, j, k)
return cnt
| class Solution:
def regions_by_slashes(self, grid: List[str]) -> int:
def dfs(i, j, k):
if 0 <= i < n > j >= 0 and (not matrix[i][j][k]):
if grid[i][j] == '*':
if k <= 1:
matrix[i][j][0] = matrix[i][j][1] = cnt
dfs(i - 1, j, 2)
dfs(i, j + 1, 3)
else:
matrix[i][j][2] = matrix[i][j][3] = cnt
dfs(i + 1, j, 0)
dfs(i, j - 1, 1)
elif grid[i][j] == '/':
if 1 <= k <= 2:
matrix[i][j][1] = matrix[i][j][2] = cnt
dfs(i, j + 1, 3)
dfs(i + 1, j, 0)
else:
matrix[i][j][0] = matrix[i][j][3] = cnt
dfs(i - 1, j, 2)
dfs(i, j - 1, 1)
else:
matrix[i][j][0] = matrix[i][j][1] = matrix[i][j][2] = matrix[i][j][3] = cnt
dfs(i - 1, j, 2)
dfs(i, j + 1, 3)
dfs(i + 1, j, 0)
dfs(i, j - 1, 1)
(grid, n) = ([row.replace('\\', '*') for row in grid], len(grid))
(matrix, cnt) = ([[[0, 0, 0, 0] for j in range(n)] for i in range(n)], 0)
for i in range(n):
for j in range(n):
for k in range(4):
if not matrix[i][j][k]:
cnt += 1
dfs(i, j, k)
return cnt |
# The MIT License (MIT)
#
# Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
#
# 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.
# pylint: disable=too-few-public-methods
"""
`adafruit_register.spi_bit`
====================================================
Single bit registers
* Author(s): Scott Shawcroft
* Adaptation by Max Holliday
"""
class RWBit:
"""
Single bit register that is readable and writeable.
Values are `bool`
:param int register_address: The register address to read the bit from
:param type bit: The bit index within the byte at ``register_address``
:param int register_width: The number of bytes in the register. Defaults to 1.
:param bool lsb_first: Is the first byte we read from spi the LSB? Defaults to true
"""
def __init__(self, register_address, bit, register_width=1, lsb_first=True):
self.bit_mask = 1 << (bit%8) # the bitmask *within* the byte!
self.buffer = bytearray(1 + register_width)
self.buffer[0] = register_address
self.buffer[1] = register_width-1
if lsb_first:
self.byte = bit // 8 + 1 # the byte number within the buffer
else:
self.byte = register_width - (bit // 8) # the byte number within the buffer
def __get__(self, obj, objtype=None):
with obj.spi_device as spi:
spi.write(self.buffer, end=2)
spi.readinto(self.buffer, start=1)
return bool(self.buffer[self.byte] & self.bit_mask)
def __set__(self, obj, value):
with obj.spi_device as spi:
spi.write(self.buffer, end=2)
spi.readinto(self.buffer, start=1)
if value:
self.buffer[self.byte] |= self.bit_mask
else:
self.buffer[self.byte] &= ~self.bit_mask
spi.write(self.buffer)
class ROBit(RWBit):
"""Single bit register that is read only. Subclass of `RWBit`.
Values are `bool`
:param int register_address: The register address to read the bit from
:param type bit: The bit index within the byte at ``register_address``
:param int register_width: The number of bytes in the register. Defaults to 1.
"""
def __set__(self, obj, value):
raise AttributeError()
| """
`adafruit_register.spi_bit`
====================================================
Single bit registers
* Author(s): Scott Shawcroft
* Adaptation by Max Holliday
"""
class Rwbit:
"""
Single bit register that is readable and writeable.
Values are `bool`
:param int register_address: The register address to read the bit from
:param type bit: The bit index within the byte at ``register_address``
:param int register_width: The number of bytes in the register. Defaults to 1.
:param bool lsb_first: Is the first byte we read from spi the LSB? Defaults to true
"""
def __init__(self, register_address, bit, register_width=1, lsb_first=True):
self.bit_mask = 1 << bit % 8
self.buffer = bytearray(1 + register_width)
self.buffer[0] = register_address
self.buffer[1] = register_width - 1
if lsb_first:
self.byte = bit // 8 + 1
else:
self.byte = register_width - bit // 8
def __get__(self, obj, objtype=None):
with obj.spi_device as spi:
spi.write(self.buffer, end=2)
spi.readinto(self.buffer, start=1)
return bool(self.buffer[self.byte] & self.bit_mask)
def __set__(self, obj, value):
with obj.spi_device as spi:
spi.write(self.buffer, end=2)
spi.readinto(self.buffer, start=1)
if value:
self.buffer[self.byte] |= self.bit_mask
else:
self.buffer[self.byte] &= ~self.bit_mask
spi.write(self.buffer)
class Robit(RWBit):
"""Single bit register that is read only. Subclass of `RWBit`.
Values are `bool`
:param int register_address: The register address to read the bit from
:param type bit: The bit index within the byte at ``register_address``
:param int register_width: The number of bytes in the register. Defaults to 1.
"""
def __set__(self, obj, value):
raise attribute_error() |
class SubroutineDeclaration:
def __init__(self, header, varrefs, body, function=False):
'''
@param header: a tuple of (name, arglist)
@param body: a tuple of (subroutine statements string, span in source file);
The span is a (startpos, endpos) tuple.
'''
self.name = header[0]
self.arglist = header[1]
self.varrefs = varrefs
self.body = body[0]
self.bodyspan = body[1] # the location span
self.function = function # designates whether subroutine is function or procedure
return
def __repr__(self):
buf = 'subroutine:'
buf += str(self.name) + '\n' + str(self.arglist) + '\n' + str(self.varrefs) + \
'\n' + str(self.body) + '\n' + str(self.bodyspan)
return buf
def inline(self, params):
'''
Rewrite the body to contain actual arguments in place of the formal parameters.
@param params: the list of actual parameters in the same order as the formal
parameters in the subroutine definition
'''
starpos = self.bodyspan[0]
for v in self.varrefs:
arg = v[0] # the variable name
argspan = v[1] # begin and end position
return
# end of class SubroutineDefinition
class SubroutineDefinition(SubroutineDeclaration):
pass | class Subroutinedeclaration:
def __init__(self, header, varrefs, body, function=False):
"""
@param header: a tuple of (name, arglist)
@param body: a tuple of (subroutine statements string, span in source file);
The span is a (startpos, endpos) tuple.
"""
self.name = header[0]
self.arglist = header[1]
self.varrefs = varrefs
self.body = body[0]
self.bodyspan = body[1]
self.function = function
return
def __repr__(self):
buf = 'subroutine:'
buf += str(self.name) + '\n' + str(self.arglist) + '\n' + str(self.varrefs) + '\n' + str(self.body) + '\n' + str(self.bodyspan)
return buf
def inline(self, params):
"""
Rewrite the body to contain actual arguments in place of the formal parameters.
@param params: the list of actual parameters in the same order as the formal
parameters in the subroutine definition
"""
starpos = self.bodyspan[0]
for v in self.varrefs:
arg = v[0]
argspan = v[1]
return
class Subroutinedefinition(SubroutineDeclaration):
pass |
class AccessDeniedException(Exception):
def __init__(self, message):
pass
# Call the base class constructor
# super().__init__(message, None)
# Now custom code
# self.errors = errors
class InvalidEndpointException(Exception):
def __init__(self, message):
self.message = message
class BucketMightNotExistException(Exception):
def __init__(self):
pass
| class Accessdeniedexception(Exception):
def __init__(self, message):
pass
class Invalidendpointexception(Exception):
def __init__(self, message):
self.message = message
class Bucketmightnotexistexception(Exception):
def __init__(self):
pass |
def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('login', '/login')
config.add_route('launchpad', '/launchpad')
config.add_route('request_rx', '/request_rx')
config.add_route('rx_portal', '/rx_portal')
config.add_route('pending_rx', '/pending_rx')
config.add_route('write_rx', '/write_rx')
config.add_route('write_rx_form', '/write_rx_form')
| def includeme(config):
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('login', '/login')
config.add_route('launchpad', '/launchpad')
config.add_route('request_rx', '/request_rx')
config.add_route('rx_portal', '/rx_portal')
config.add_route('pending_rx', '/pending_rx')
config.add_route('write_rx', '/write_rx')
config.add_route('write_rx_form', '/write_rx_form') |
class DocumentTemplate:
def __init__(self):
pass
@staticmethod
def create_db_template(server, db_id, label, **kwargs):
db_url = "{}{}".format(server, db_id)
comment = kwargs.get("comment")
language = kwargs.get("language", "en")
allow_origin = kwargs.get("allow_origin", "*")
temp = {
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"terminus": "http://terminusdb.com/schema/terminus#",
"_": db_url,
},
"terminus:document": {
"@type": "terminus:Database",
"rdfs:label": {"@language": language, "@value": label},
"terminus:allow_origin": {
"@type": "xsd:string",
"@value": allow_origin,
},
"@id": db_url,
},
"@type": "terminus:APIUpdate",
}
if comment:
temp["rdfs:comment"] = {"@language": language, "@value": comment}
return temp
@staticmethod
def format_document(doc, schema_url, options=None, url_id=None):
document = {}
if isinstance(doc, dict):
document["@context"] = doc["@context"]
# add blank node prefix as document base url
if ("@context" in doc) and ("@id" in doc):
document["@context"]["_"] = doc["@id"]
if (
options
and options.get("terminus:encoding")
and options["terminus:encoding"] == "terminus:turtle"
):
document["terminus:turtle"] = doc
# document['terminus:schema'] = schema_url
del document["terminus:turtle"]["@context"]
else:
document["terminus:document"] = doc
del document["terminus:document"]["@context"]
document["@type"] = "terminus:APIUpdate"
if url_id:
document["@id"] = url_id
return document
| class Documenttemplate:
def __init__(self):
pass
@staticmethod
def create_db_template(server, db_id, label, **kwargs):
db_url = '{}{}'.format(server, db_id)
comment = kwargs.get('comment')
language = kwargs.get('language', 'en')
allow_origin = kwargs.get('allow_origin', '*')
temp = {'@context': {'rdfs': 'http://www.w3.org/2000/01/rdf-schema#', 'terminus': 'http://terminusdb.com/schema/terminus#', '_': db_url}, 'terminus:document': {'@type': 'terminus:Database', 'rdfs:label': {'@language': language, '@value': label}, 'terminus:allow_origin': {'@type': 'xsd:string', '@value': allow_origin}, '@id': db_url}, '@type': 'terminus:APIUpdate'}
if comment:
temp['rdfs:comment'] = {'@language': language, '@value': comment}
return temp
@staticmethod
def format_document(doc, schema_url, options=None, url_id=None):
document = {}
if isinstance(doc, dict):
document['@context'] = doc['@context']
if '@context' in doc and '@id' in doc:
document['@context']['_'] = doc['@id']
if options and options.get('terminus:encoding') and (options['terminus:encoding'] == 'terminus:turtle'):
document['terminus:turtle'] = doc
del document['terminus:turtle']['@context']
else:
document['terminus:document'] = doc
del document['terminus:document']['@context']
document['@type'] = 'terminus:APIUpdate'
if url_id:
document['@id'] = url_id
return document |
def DistanceToPlane(plane, point):
"""Returns the distance from a 3D point to a plane
Parameters:
plane (plane): the plane
point (point): List of 3 numbers or Point3d
Returns:
number: The distance if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
point = rs.GetPoint("Point to test")
if point:
plane = rs.ViewCPlane()
if plane:
distance = rs.DistanceToPlane(plane, point)
if distance is not None:
print("Distance to plane: ", distance)
See Also:
Distance
PlaneClosestPoint
"""
def EvaluatePlane(plane, parameter):
"""Evaluates a plane at a U,V parameter
Parameters:
plane (plane): the plane to evaluate
parameter ([number, number]): list of two numbers defining the U,V parameter to evaluate
Returns:
point: Point3d on success
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
plane = rs.ViewCPlane(view)
point = rs.EvaluatePlane(plane, (5,5))
rs.AddPoint( point )
See Also:
PlaneClosestPoint
"""
def IntersectPlanes(plane1, plane2, plane3):
"""Calculates the intersection of three planes
Parameters:
plane1 (plane): the 1st plane to intersect
plane2 (plane): the 2nd plane to intersect
plane3 (plane): the 3rd plane to intersect
Returns:
point: the intersection point between the 3 planes on success
None: on error
Example:
import rhinoscriptsyntax as rs
plane1 = rs.WorldXYPlane()
plane2 = rs.WorldYZPlane()
plane3 = rs.WorldZXPlane()
point = rs.IntersectPlanes(plane1, plane2, plane3)
if point: rs.AddPoint(point)
See Also:
LineLineIntersection
LinePlaneIntersection
PlanePlaneIntersection
"""
def MovePlane(plane, origin):
"""Moves the origin of a plane
Parameters:
plane (plane): Plane or ConstructionPlane
origin (point): Point3d or list of three numbers
Returns:
plane: moved plane
Example:
import rhinoscriptsyntax as rs
origin = rs.GetPoint("CPlane origin")
if origin:
plane = rs.ViewCPlane()
plane = rs.MovePlane(plane,origin)
rs.ViewCplane(plane)
See Also:
PlaneFromFrame
PlaneFromNormal
RotatePlane
"""
def PlaneClosestPoint(plane, point, return_point=True):
"""Returns the point on a plane that is closest to a test point.
Parameters:
plane (plane): The plane
point (point): The 3-D point to test.
return_point (bool, optional): If omitted or True, then the point on the plane
that is closest to the test point is returned. If False, then the
parameter of the point on the plane that is closest to the test
point is returned.
Returns:
point: If return_point is omitted or True, then the 3-D point
point: If return_point is False, then an array containing the U,V parameters
of the point
None: if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
point = rs.GetPoint("Point to test")
if point:
plane = rs.ViewCPlane()
if plane:
print(rs.PlaneClosestPoint(plane, point))
See Also:
DistanceToPlane
EvaluatePlane
"""
def PlaneCurveIntersection(plane, curve, tolerance=None):
"""Intersect an infinite plane and a curve object
Parameters:
plane (plane): The plane to intersect.
curve (guid): The identifier of the curve object
torerance (number, optional): The intersection tolerance. If omitted, the document's absolute tolerance is used.
Returns:
A list of intersection information tuple if successful. The list will contain one or more of the following tuple:
Element Type Description
[0] Number The intersection event type, either Point (1) or Overlap (2).
[1] Point3d If the event type is Point (1), then the intersection point on the curve.
If the event type is Overlap (2), then intersection start point on the curve.
[2] Point3d If the event type is Point (1), then the intersection point on the curve.
If the event type is Overlap (2), then intersection end point on the curve.
[3] Point3d If the event type is Point (1), then the intersection point on the plane.
If the event type is Overlap (2), then intersection start point on the plane.
[4] Point3d If the event type is Point (1), then the intersection point on the plane.
If the event type is Overlap (2), then intersection end point on the plane.
[5] Number If the event type is Point (1), then the curve parameter.
If the event type is Overlap (2), then the start value of the curve parameter range.
[6] Number If the event type is Point (1), then the curve parameter.
If the event type is Overlap (2), then the end value of the curve parameter range.
[7] Number If the event type is Point (1), then the U plane parameter.
If the event type is Overlap (2), then the U plane parameter for curve at (n, 5).
[8] Number If the event type is Point (1), then the V plane parameter.
If the event type is Overlap (2), then the V plane parameter for curve at (n, 5).
[9] Number If the event type is Point (1), then the U plane parameter.
If the event type is Overlap (2), then the U plane parameter for curve at (n, 6).
[10] Number If the event type is Point (1), then the V plane parameter.
If the event type is Overlap (2), then the V plane parameter for curve at (n, 6).
None: on error
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select curve", rs.filter.curve)
if curve:
plane = rs.WorldXYPlane()
intersections = rs.PlaneCurveIntersection(plane, curve)
if intersections:
for intersection in intersections:
rs.AddPoint(intersection[1])
See Also:
IntersectPlanes
PlanePlaneIntersection
PlaneSphereIntersection
"""
def PlaneEquation(plane):
"""Returns the equation of a plane as a tuple of four numbers. The standard
equation of a plane with a non-zero vector is Ax+By+Cz+D=0
Parameters:
plane (plane): the plane to deconstruct
Returns:
tuple(number, number, number, number): containing four numbers that represent the coefficients of the equation (A, B, C, D) if successful
None: if not successful
Example:
import rhinoscriptsyntax as rs
plane = rs.ViewCPlane()
equation = rs.PlaneEquation(plane)
print("A =", equation[0])
print("B =", equation[1])
print("C =", equation[2])
print("D =", equation[3])
See Also:
PlaneFromFrame
PlaneFromNormal
PlaneFromPoints
"""
def PlaneFitFromPoints(points):
"""Returns a plane that was fit through an array of 3D points.
Parameters:
points (point): An array of 3D points.
Returns:
plane: The plane if successful
None: if not successful
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints()
if points:
plane = rs.PlaneFitFromPoints(points)
if plane:
magX = plane.XAxis.Length
magY = plane.YAxis.Length
rs.AddPlaneSurface( plane, magX, magY )
See Also:
PlaneFromFrame
PlaneFromNormal
PlaneFromPoints
"""
def PlaneFromFrame(origin, x_axis, y_axis):
"""Construct a plane from a point, and two vectors in the plane.
Parameters:
origin (point): A 3D point identifying the origin of the plane.
x_axis (vector): A non-zero 3D vector in the plane that determines the X axis
direction.
y_axis (vector): A non-zero 3D vector not parallel to x_axis that is used
to determine the Y axis direction. Note, y_axis does not
have to be perpendicular to x_axis.
Returns:
plane: The plane if successful.
Example:
import rhinoscriptsyntax as rs
origin = rs.GetPoint("CPlane origin")
if origin:
xaxis = (1,0,0)
yaxis = (0,0,1)
plane = rs.PlaneFromFrame( origin, xaxis, yaxis )
rs.ViewCPlane(None, plane)
See Also:
MovePlane
PlaneFromNormal
PlaneFromPoints
RotatePlane
"""
def PlaneFromNormal(origin, normal, xaxis=None):
"""Creates a plane from an origin point and a normal direction vector.
Parameters:
origin (point): A 3D point identifying the origin of the plane.
normal (vector): A 3D vector identifying the normal direction of the plane.
xaxis (vector, optional): optional vector defining the plane's x-axis
Returns:
plane: The plane if successful.
Example:
import rhinoscriptsyntax as rs
origin = rs.GetPoint("CPlane origin")
if origin:
direction = rs.GetPoint("CPlane direction")
if direction:
normal = direction - origin
normal = rs.VectorUnitize(normal)
rs.ViewCPlane( None, rs.PlaneFromNormal(origin, normal) )
See Also:
MovePlane
PlaneFromFrame
PlaneFromPoints
RotatePlane
"""
def PlaneFromPoints(origin, x, y):
"""Creates a plane from three non-colinear points
Parameters:
origin (point): origin point of the plane
x, y (point): points on the plane's x and y axes
Returns:
plane: The plane if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
corners = rs.GetRectangle()
if corners:
rs.ViewCPlane( rs.PlaneFromPoints(corners[0], corners[1], corners[3]))
See Also:
PlaneFromFrame
PlaneFromNormal
"""
def PlanePlaneIntersection(plane1, plane2):
"""Calculates the intersection of two planes
Parameters:
plane1 (plane): the 1st plane to intersect
plane2 (plane): the 2nd plane to intersect
Returns:
line: a line with two 3d points identifying the starting/ending points of the intersection
None: on error
Example:
import rhinoscriptsyntax as rs
plane1 = rs.WorldXYPlane()
plane2 = rs.WorldYZPlane()
line = rs.PlanePlaneIntersection(plane1, plane2)
if line: rs.AddLine(line[0], line[1])
See Also:
IntersectPlanes
LineLineIntersection
LinePlaneIntersection
"""
def PlaneSphereIntersection(plane, sphere_plane, sphere_radius):
"""Calculates the intersection of a plane and a sphere
Parameters:
plane (plane): the plane to intersect
sphere_plane (plane): equatorial plane of the sphere. origin of the plane is
the center of the sphere
sphere_radius (number): radius of the sphere
Returns:
list(number, point|plane, number): of intersection results
Element Type Description
[0] number The type of intersection, where 0 = point and 1 = circle.
[1] point or plane If a point intersection, the a Point3d identifying the 3-D intersection location.
If a circle intersection, then the circle's plane. The origin of the plane will be the center point of the circle
[2] number If a circle intersection, then the radius of the circle.
None: on error
Example:
import rhinoscriptsyntax as rs
plane = rs.WorldXYPlane()
radius = 10
results = rs.PlaneSphereIntersection(plane, plane, radius)
if results:
if results[0]==0:
rs.AddPoint(results[1])
else:
rs.AddCircle(results[1], results[2])
See Also:
IntersectPlanes
LinePlaneIntersection
PlanePlaneIntersection
"""
def PlaneTransform(plane, xform):
"""Transforms a plane
Parameters:
plane (plane): Plane to transform
xform (transform): Transformation to apply
Returns:
plane:the resulting plane if successful
None: if not successful
Example:
import rhinoscriptsyntax as rs
plane = rs.ViewCPlane()
xform = rs.XformRotation(45.0, plane.Zaxis, plane.Origin)
plane = rs.PlaneTransform(plane, xform)
rs.ViewCPlane(None, plane)
See Also:
PlaneFromFrame
PlaneFromNormal
PlaneFromPoints
"""
def RotatePlane(plane, angle_degrees, axis):
"""Rotates a plane
Parameters:
plane (plane): Plane to rotate
angle_degrees (number): rotation angle in degrees
axis (vector): Axis of rotation or list of three numbers
Returns:
plane: rotated plane on success
Example:
import rhinoscriptsyntax as rs
plane = rs.ViewCPlane()
rotated = rs.RotatePlane(plane, 45.0, plane.XAxis)
rs.ViewCPlane( None, rotated )
See Also:
MovePlane
PlaneFromFrame
PlaneFromNormal
"""
def WorldXYPlane():
"""Returns Rhino's world XY plane
Returns:
plane: Rhino's world XY plane
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
rs.ViewCPlane( view, rs.WorldXYPlane() )
See Also:
WorldYZPlane
WorldZXPlane
"""
def WorldYZPlane():
"""Returns Rhino's world YZ plane
Returns:
plane: Rhino's world YZ plane
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
rs.ViewCPlane( view, rs.WorldYZPlane() )
See Also:
WorldXYPlane
WorldZXPlane
"""
def WorldZXPlane():
"""Returns Rhino's world ZX plane
Returns:
plane: Rhino's world ZX plane
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
rs.ViewCPlane( view, rs.WorldZXPlane() )
See Also:
WorldXYPlane
WorldYZPlane
"""
| def distance_to_plane(plane, point):
"""Returns the distance from a 3D point to a plane
Parameters:
plane (plane): the plane
point (point): List of 3 numbers or Point3d
Returns:
number: The distance if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
point = rs.GetPoint("Point to test")
if point:
plane = rs.ViewCPlane()
if plane:
distance = rs.DistanceToPlane(plane, point)
if distance is not None:
print("Distance to plane: ", distance)
See Also:
Distance
PlaneClosestPoint
"""
def evaluate_plane(plane, parameter):
"""Evaluates a plane at a U,V parameter
Parameters:
plane (plane): the plane to evaluate
parameter ([number, number]): list of two numbers defining the U,V parameter to evaluate
Returns:
point: Point3d on success
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
plane = rs.ViewCPlane(view)
point = rs.EvaluatePlane(plane, (5,5))
rs.AddPoint( point )
See Also:
PlaneClosestPoint
"""
def intersect_planes(plane1, plane2, plane3):
"""Calculates the intersection of three planes
Parameters:
plane1 (plane): the 1st plane to intersect
plane2 (plane): the 2nd plane to intersect
plane3 (plane): the 3rd plane to intersect
Returns:
point: the intersection point between the 3 planes on success
None: on error
Example:
import rhinoscriptsyntax as rs
plane1 = rs.WorldXYPlane()
plane2 = rs.WorldYZPlane()
plane3 = rs.WorldZXPlane()
point = rs.IntersectPlanes(plane1, plane2, plane3)
if point: rs.AddPoint(point)
See Also:
LineLineIntersection
LinePlaneIntersection
PlanePlaneIntersection
"""
def move_plane(plane, origin):
"""Moves the origin of a plane
Parameters:
plane (plane): Plane or ConstructionPlane
origin (point): Point3d or list of three numbers
Returns:
plane: moved plane
Example:
import rhinoscriptsyntax as rs
origin = rs.GetPoint("CPlane origin")
if origin:
plane = rs.ViewCPlane()
plane = rs.MovePlane(plane,origin)
rs.ViewCplane(plane)
See Also:
PlaneFromFrame
PlaneFromNormal
RotatePlane
"""
def plane_closest_point(plane, point, return_point=True):
"""Returns the point on a plane that is closest to a test point.
Parameters:
plane (plane): The plane
point (point): The 3-D point to test.
return_point (bool, optional): If omitted or True, then the point on the plane
that is closest to the test point is returned. If False, then the
parameter of the point on the plane that is closest to the test
point is returned.
Returns:
point: If return_point is omitted or True, then the 3-D point
point: If return_point is False, then an array containing the U,V parameters
of the point
None: if not successful, or on error.
Example:
import rhinoscriptsyntax as rs
point = rs.GetPoint("Point to test")
if point:
plane = rs.ViewCPlane()
if plane:
print(rs.PlaneClosestPoint(plane, point))
See Also:
DistanceToPlane
EvaluatePlane
"""
def plane_curve_intersection(plane, curve, tolerance=None):
"""Intersect an infinite plane and a curve object
Parameters:
plane (plane): The plane to intersect.
curve (guid): The identifier of the curve object
torerance (number, optional): The intersection tolerance. If omitted, the document's absolute tolerance is used.
Returns:
A list of intersection information tuple if successful. The list will contain one or more of the following tuple:
Element Type Description
[0] Number The intersection event type, either Point (1) or Overlap (2).
[1] Point3d If the event type is Point (1), then the intersection point on the curve.
If the event type is Overlap (2), then intersection start point on the curve.
[2] Point3d If the event type is Point (1), then the intersection point on the curve.
If the event type is Overlap (2), then intersection end point on the curve.
[3] Point3d If the event type is Point (1), then the intersection point on the plane.
If the event type is Overlap (2), then intersection start point on the plane.
[4] Point3d If the event type is Point (1), then the intersection point on the plane.
If the event type is Overlap (2), then intersection end point on the plane.
[5] Number If the event type is Point (1), then the curve parameter.
If the event type is Overlap (2), then the start value of the curve parameter range.
[6] Number If the event type is Point (1), then the curve parameter.
If the event type is Overlap (2), then the end value of the curve parameter range.
[7] Number If the event type is Point (1), then the U plane parameter.
If the event type is Overlap (2), then the U plane parameter for curve at (n, 5).
[8] Number If the event type is Point (1), then the V plane parameter.
If the event type is Overlap (2), then the V plane parameter for curve at (n, 5).
[9] Number If the event type is Point (1), then the U plane parameter.
If the event type is Overlap (2), then the U plane parameter for curve at (n, 6).
[10] Number If the event type is Point (1), then the V plane parameter.
If the event type is Overlap (2), then the V plane parameter for curve at (n, 6).
None: on error
Example:
import rhinoscriptsyntax as rs
curve = rs.GetObject("Select curve", rs.filter.curve)
if curve:
plane = rs.WorldXYPlane()
intersections = rs.PlaneCurveIntersection(plane, curve)
if intersections:
for intersection in intersections:
rs.AddPoint(intersection[1])
See Also:
IntersectPlanes
PlanePlaneIntersection
PlaneSphereIntersection
"""
def plane_equation(plane):
"""Returns the equation of a plane as a tuple of four numbers. The standard
equation of a plane with a non-zero vector is Ax+By+Cz+D=0
Parameters:
plane (plane): the plane to deconstruct
Returns:
tuple(number, number, number, number): containing four numbers that represent the coefficients of the equation (A, B, C, D) if successful
None: if not successful
Example:
import rhinoscriptsyntax as rs
plane = rs.ViewCPlane()
equation = rs.PlaneEquation(plane)
print("A =", equation[0])
print("B =", equation[1])
print("C =", equation[2])
print("D =", equation[3])
See Also:
PlaneFromFrame
PlaneFromNormal
PlaneFromPoints
"""
def plane_fit_from_points(points):
"""Returns a plane that was fit through an array of 3D points.
Parameters:
points (point): An array of 3D points.
Returns:
plane: The plane if successful
None: if not successful
Example:
import rhinoscriptsyntax as rs
points = rs.GetPoints()
if points:
plane = rs.PlaneFitFromPoints(points)
if plane:
magX = plane.XAxis.Length
magY = plane.YAxis.Length
rs.AddPlaneSurface( plane, magX, magY )
See Also:
PlaneFromFrame
PlaneFromNormal
PlaneFromPoints
"""
def plane_from_frame(origin, x_axis, y_axis):
"""Construct a plane from a point, and two vectors in the plane.
Parameters:
origin (point): A 3D point identifying the origin of the plane.
x_axis (vector): A non-zero 3D vector in the plane that determines the X axis
direction.
y_axis (vector): A non-zero 3D vector not parallel to x_axis that is used
to determine the Y axis direction. Note, y_axis does not
have to be perpendicular to x_axis.
Returns:
plane: The plane if successful.
Example:
import rhinoscriptsyntax as rs
origin = rs.GetPoint("CPlane origin")
if origin:
xaxis = (1,0,0)
yaxis = (0,0,1)
plane = rs.PlaneFromFrame( origin, xaxis, yaxis )
rs.ViewCPlane(None, plane)
See Also:
MovePlane
PlaneFromNormal
PlaneFromPoints
RotatePlane
"""
def plane_from_normal(origin, normal, xaxis=None):
"""Creates a plane from an origin point and a normal direction vector.
Parameters:
origin (point): A 3D point identifying the origin of the plane.
normal (vector): A 3D vector identifying the normal direction of the plane.
xaxis (vector, optional): optional vector defining the plane's x-axis
Returns:
plane: The plane if successful.
Example:
import rhinoscriptsyntax as rs
origin = rs.GetPoint("CPlane origin")
if origin:
direction = rs.GetPoint("CPlane direction")
if direction:
normal = direction - origin
normal = rs.VectorUnitize(normal)
rs.ViewCPlane( None, rs.PlaneFromNormal(origin, normal) )
See Also:
MovePlane
PlaneFromFrame
PlaneFromPoints
RotatePlane
"""
def plane_from_points(origin, x, y):
"""Creates a plane from three non-colinear points
Parameters:
origin (point): origin point of the plane
x, y (point): points on the plane's x and y axes
Returns:
plane: The plane if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
corners = rs.GetRectangle()
if corners:
rs.ViewCPlane( rs.PlaneFromPoints(corners[0], corners[1], corners[3]))
See Also:
PlaneFromFrame
PlaneFromNormal
"""
def plane_plane_intersection(plane1, plane2):
"""Calculates the intersection of two planes
Parameters:
plane1 (plane): the 1st plane to intersect
plane2 (plane): the 2nd plane to intersect
Returns:
line: a line with two 3d points identifying the starting/ending points of the intersection
None: on error
Example:
import rhinoscriptsyntax as rs
plane1 = rs.WorldXYPlane()
plane2 = rs.WorldYZPlane()
line = rs.PlanePlaneIntersection(plane1, plane2)
if line: rs.AddLine(line[0], line[1])
See Also:
IntersectPlanes
LineLineIntersection
LinePlaneIntersection
"""
def plane_sphere_intersection(plane, sphere_plane, sphere_radius):
"""Calculates the intersection of a plane and a sphere
Parameters:
plane (plane): the plane to intersect
sphere_plane (plane): equatorial plane of the sphere. origin of the plane is
the center of the sphere
sphere_radius (number): radius of the sphere
Returns:
list(number, point|plane, number): of intersection results
Element Type Description
[0] number The type of intersection, where 0 = point and 1 = circle.
[1] point or plane If a point intersection, the a Point3d identifying the 3-D intersection location.
If a circle intersection, then the circle's plane. The origin of the plane will be the center point of the circle
[2] number If a circle intersection, then the radius of the circle.
None: on error
Example:
import rhinoscriptsyntax as rs
plane = rs.WorldXYPlane()
radius = 10
results = rs.PlaneSphereIntersection(plane, plane, radius)
if results:
if results[0]==0:
rs.AddPoint(results[1])
else:
rs.AddCircle(results[1], results[2])
See Also:
IntersectPlanes
LinePlaneIntersection
PlanePlaneIntersection
"""
def plane_transform(plane, xform):
"""Transforms a plane
Parameters:
plane (plane): Plane to transform
xform (transform): Transformation to apply
Returns:
plane:the resulting plane if successful
None: if not successful
Example:
import rhinoscriptsyntax as rs
plane = rs.ViewCPlane()
xform = rs.XformRotation(45.0, plane.Zaxis, plane.Origin)
plane = rs.PlaneTransform(plane, xform)
rs.ViewCPlane(None, plane)
See Also:
PlaneFromFrame
PlaneFromNormal
PlaneFromPoints
"""
def rotate_plane(plane, angle_degrees, axis):
"""Rotates a plane
Parameters:
plane (plane): Plane to rotate
angle_degrees (number): rotation angle in degrees
axis (vector): Axis of rotation or list of three numbers
Returns:
plane: rotated plane on success
Example:
import rhinoscriptsyntax as rs
plane = rs.ViewCPlane()
rotated = rs.RotatePlane(plane, 45.0, plane.XAxis)
rs.ViewCPlane( None, rotated )
See Also:
MovePlane
PlaneFromFrame
PlaneFromNormal
"""
def world_xy_plane():
"""Returns Rhino's world XY plane
Returns:
plane: Rhino's world XY plane
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
rs.ViewCPlane( view, rs.WorldXYPlane() )
See Also:
WorldYZPlane
WorldZXPlane
"""
def world_yz_plane():
"""Returns Rhino's world YZ plane
Returns:
plane: Rhino's world YZ plane
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
rs.ViewCPlane( view, rs.WorldYZPlane() )
See Also:
WorldXYPlane
WorldZXPlane
"""
def world_zx_plane():
"""Returns Rhino's world ZX plane
Returns:
plane: Rhino's world ZX plane
Example:
import rhinoscriptsyntax as rs
view = rs.CurrentView()
rs.ViewCPlane( view, rs.WorldZXPlane() )
See Also:
WorldXYPlane
WorldYZPlane
""" |
numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
#using list comprehension to make square of given numbers in list
squared_numbers=[ n * n for n in numbers]
print(squared_numbers) | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
squared_numbers = [n * n for n in numbers]
print(squared_numbers) |
class NothingToProcess(ValueError):
pass
class FileAlreadyProcessed(ValueError):
pass
| class Nothingtoprocess(ValueError):
pass
class Filealreadyprocessed(ValueError):
pass |
# kpbochenek@gmail.com
def most_difference(*args):
if not args:
return 0
mn = min(args)
mx = max(args)
return mx - mn
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
def almost_equal(checked, correct, significant_digits):
precision = 0.1 ** significant_digits
return correct - precision < checked < correct + precision
assert almost_equal(most_difference(1, 2, 3), 2, 3), "3-1=2"
assert almost_equal(most_difference(5, 5), 0, 3), "5-5=0"
assert almost_equal(most_difference(10.2, 2.2, 0.00001, 1.1, 0.5), 10.199, 3), "10.2-(0.00001)=10.19999"
assert almost_equal(most_difference(), 0, 3), "Empty"
| def most_difference(*args):
if not args:
return 0
mn = min(args)
mx = max(args)
return mx - mn
if __name__ == '__main__':
def almost_equal(checked, correct, significant_digits):
precision = 0.1 ** significant_digits
return correct - precision < checked < correct + precision
assert almost_equal(most_difference(1, 2, 3), 2, 3), '3-1=2'
assert almost_equal(most_difference(5, 5), 0, 3), '5-5=0'
assert almost_equal(most_difference(10.2, 2.2, 1e-05, 1.1, 0.5), 10.199, 3), '10.2-(0.00001)=10.19999'
assert almost_equal(most_difference(), 0, 3), 'Empty' |
scope_configuration = dict(
drivers = ( # order is important!
('stand', 'leica.stand.Stand'),
('stage', 'leica.stage.Stage'),
#('nosepiece', 'leica.nosepiece.MotorizedNosepieceWithSafeMode'), # dm6000
#('nosepiece', 'leica.nosepiece.MotorizedNosepiece'), # dmi8
#('nosepiece', 'leica.nosepiece.ManualNosepiece'), # dm6
#('il', 'leica.illumination_axes.IL'), # dmi8
#('il', 'leica.illumination_axes.FieldWheel_IL'), # dm6000 dm6
#('tl', 'leica.illumination_axes.TL'), # dm6000 dm6
#('_shutter_watcher', 'leica.illumination_axes.ShutterWatcher'), # dm6000 dm6
('iotool', 'iotool.IOTool'),
#('il.spectra', 'spectra.Spectra'), # dm6
#('il.spectra', 'spectra.SpectraX'), # dm6000 dmi8
('tl.lamp', 'tl_lamp.SutterLED_Lamp'),
# ('camera', 'andor.Zyla'),
# ('camera', 'andor.Sona'),
('camera.acquisition_sequencer', 'acquisition_sequencer.AcquisitionSequencer'),
('camera.autofocus', 'autofocus.Autofocus'),
#('temperature_controller', 'temp_control.Peltier'), # dm6000
#('temperature_controller', 'temp_control.Circulator'), # dm6
#('humidity_controller', 'humidity_control.HumidityController'), # dm6, dm6000
('job_runner', 'runner_device.JobRunner')
),
server = dict(
LOCALHOST = '127.0.0.1',
PUBLICHOST = '*',
RPC_PORT = '6000',
RPC_INTERRUPT_PORT = '6001',
PROPERTY_PORT = '6002',
IMAGE_TRANSFER_RPC_PORT = '6003',
),
stand = dict(
SERIAL_PORT = '/dev/ttyScope',
SERIAL_ARGS = dict(
baudrate = 115200
),
TL_FIELD_DEFAULTS = {
#'5': 12, # dm6
#'5': 10, # dm6000
#'10': 16 # dm6
#'10': 18 # dm6000
},
TL_APERTURE_DEFAULTS = {
'5': 28, # dm6, dm6000
#'10': 26 # dm6
#'10': 22 # dm6000
}
),
camera = dict(
IOTOOL_PINS = dict(
trigger = 'B0',
arm = 'B1',
aux_out1 = 'B2'
),
),
iotool = dict(
SERIAL_PORT = '/dev/ttyIOTool',
SERIAL_ARGS = dict(
baudrate=115200
)
),
spectra = dict(
SERIAL_PORT = '/dev/ttySpectra',
SERIAL_ARGS = {},
IOTOOL_LAMP_PINS = dict(
uv = 'D6',
blue = 'D5',
cyan = 'D3',
teal = 'D4',
green_yellow = 'D2',
#red = 'D1' # dm6000 dmi8
),
#IOTOOL_GREEN_YELLOW_SWITCH_PIN = 'D1', # dm6
# TIMING: depends *strongly* on how recently the last time the
# lamp was turned on was. 100 ms ago vs. 10 sec ago changes the on-latency
# by as much as 100 us.
# Some lamps have different rise times vs. latencies.
# All lamps have ~6 us off latency and 9-13 us fall.
# With 100 ms delay between off and on:
# Lamp On-Latency Rise Off-Latency Fall
# Red 90 us 16 us 6 us 11 us
# Green 83 19 10 13
# Cyan 96 11 6 9
# UV 98 11 6 11
#
# With 5 sec delay, cyan and green on-latency goes to 123 usec.
# With 20 sec delay, it is at 130 us.
# Plug in sort-of average values below, assuming 5 sec delay:
TIMING = dict(
on_latency_ms = 0.120, # Time from trigger signal to start of rise
rise_ms = 0.015, # Time from start of rise to end of rise
off_latency_ms = 0.01, # Time from end of trigger to start of fall
fall_ms = 0.015 # Time from start of fall to end of fall
),
#FILTER_SWITCH_DELAY = 0.15 # dm6
),
sutter_led = dict(
IOTOOL_ENABLE_PIN = 'E6',
IOTOOL_PWM_PIN = 'D0',
IOTOOL_PWM_MAX = 255,
INITIAL_INTENSITY = 86,
TIMING = dict(
on_latency_ms = 0.025, # Time from trigger signal to start of rise
rise_ms = 0.06, # Time from start of rise to end of rise
off_latency_ms = 0.06, # Time from end of trigger to start of fall
fall_ms = 0.013 # Time from start of fall to end of fall
),
),
# peltier = dict(
# SERIAL_PORT = '/dev/ttyPeltier',
# SERIAL_ARGS = dict(
# baudrate = 2400
# )
# ),
#
# circulator = dict(
# SERIAL_PORT = '/dev/ttyCirculator',
# SERIAL_ARGS = dict(
# baudrate=9600
# )
# ),
#
# humidifier = dict(
# SERIAL_PORT = '/dev/ttyHumidifier',
# SERIAL_ARGS = dict(
# baudrate=19200
# )
# ),
mail_relay = 'osmtp.wustl.edu'
)
| scope_configuration = dict(drivers=(('stand', 'leica.stand.Stand'), ('stage', 'leica.stage.Stage'), ('iotool', 'iotool.IOTool'), ('tl.lamp', 'tl_lamp.SutterLED_Lamp'), ('camera.acquisition_sequencer', 'acquisition_sequencer.AcquisitionSequencer'), ('camera.autofocus', 'autofocus.Autofocus'), ('job_runner', 'runner_device.JobRunner')), server=dict(LOCALHOST='127.0.0.1', PUBLICHOST='*', RPC_PORT='6000', RPC_INTERRUPT_PORT='6001', PROPERTY_PORT='6002', IMAGE_TRANSFER_RPC_PORT='6003'), stand=dict(SERIAL_PORT='/dev/ttyScope', SERIAL_ARGS=dict(baudrate=115200), TL_FIELD_DEFAULTS={}, TL_APERTURE_DEFAULTS={'5': 28}), camera=dict(IOTOOL_PINS=dict(trigger='B0', arm='B1', aux_out1='B2')), iotool=dict(SERIAL_PORT='/dev/ttyIOTool', SERIAL_ARGS=dict(baudrate=115200)), spectra=dict(SERIAL_PORT='/dev/ttySpectra', SERIAL_ARGS={}, IOTOOL_LAMP_PINS=dict(uv='D6', blue='D5', cyan='D3', teal='D4', green_yellow='D2'), TIMING=dict(on_latency_ms=0.12, rise_ms=0.015, off_latency_ms=0.01, fall_ms=0.015)), sutter_led=dict(IOTOOL_ENABLE_PIN='E6', IOTOOL_PWM_PIN='D0', IOTOOL_PWM_MAX=255, INITIAL_INTENSITY=86, TIMING=dict(on_latency_ms=0.025, rise_ms=0.06, off_latency_ms=0.06, fall_ms=0.013)), mail_relay='osmtp.wustl.edu') |
a = set(input().split())
n = int(input())
for _ in range(n):
b = set(input().split())
if not a.issuperset(b):
print(False)
break
else:
print(True)
| a = set(input().split())
n = int(input())
for _ in range(n):
b = set(input().split())
if not a.issuperset(b):
print(False)
break
else:
print(True) |
def move(disks, source, auxiliary, target):
if disks > 0:
# move `N-1` discs from source to auxiliary using the target
# as an intermediate pole
move(disks - 1, source, target, auxiliary)
print("Move disk {} from {} to {}".format(disks, source, target))
# move `N-1` discs from auxiliary to target using the source
# as an intermediate pole
move(disks - 1, auxiliary, source, target)
# Tower of Hanoi Problem
if __name__ == '__main__':
N = 3
move(N, 1, 2, 3)
| def move(disks, source, auxiliary, target):
if disks > 0:
move(disks - 1, source, target, auxiliary)
print('Move disk {} from {} to {}'.format(disks, source, target))
move(disks - 1, auxiliary, source, target)
if __name__ == '__main__':
n = 3
move(N, 1, 2, 3) |
# Runners group
runners = ['harry', 'ron', 'harmoine']
our_group = ['mukul']
while runners:
athlete = runners.pop()
print("Adding user: " + athlete.title())
our_group.append(athlete)
print("That's our group:- ")
for our_group in our_group:
print(our_group.title() + " from harry potter!")
Dream_vacation = {}
polling_active = True
while polling_active:
name = input("\nWhat is your name?")
location = input("Which is your dream vacation ?")
Dream_vacation[name] = location
repeat = input("would you like to let another person respond? (yes/ no)")
if repeat == 'no':
polling_active = False
print("\n ---- Poll Results ---- ")
for name, location in Dream_vacation.items():
print(name + " ok you want to go " + location.title() + " !") | runners = ['harry', 'ron', 'harmoine']
our_group = ['mukul']
while runners:
athlete = runners.pop()
print('Adding user: ' + athlete.title())
our_group.append(athlete)
print("That's our group:- ")
for our_group in our_group:
print(our_group.title() + ' from harry potter!')
dream_vacation = {}
polling_active = True
while polling_active:
name = input('\nWhat is your name?')
location = input('Which is your dream vacation ?')
Dream_vacation[name] = location
repeat = input('would you like to let another person respond? (yes/ no)')
if repeat == 'no':
polling_active = False
print('\n ---- Poll Results ---- ')
for (name, location) in Dream_vacation.items():
print(name + ' ok you want to go ' + location.title() + ' !') |
n = int(input(" "))
S = 0
a = list(map(int,input(" ").split()))
#A massiv
for i in range(-n,0):
S+=a[i]
for i in range(-n,0):
if a[i] <= S/n:
print(" ",a[i])
| n = int(input(' '))
s = 0
a = list(map(int, input(' ').split()))
for i in range(-n, 0):
s += a[i]
for i in range(-n, 0):
if a[i] <= S / n:
print(' ', a[i]) |
class FunctionPluginError(RuntimeError):
"""Error raised when there's a problem with a function plugin
itself."""
class FunctionArgError(ValueError):
"""Error raised when a function plugin has a problem with the
function arguments."""
| class Functionpluginerror(RuntimeError):
"""Error raised when there's a problem with a function plugin
itself."""
class Functionargerror(ValueError):
"""Error raised when a function plugin has a problem with the
function arguments.""" |
class User:
'''
User class for user input
'''
user_list = [] # User Empty list
def __init__(self, username, password):
self.username = username
self.password = password
def save_user(self):
'''
save_usermethod saves user objects into user_list
'''
User.user_list.append(self)
@classmethod
def user_exists(cls, characters):
'''
Method to che if a user exists
args:
character:username to search if it exist
return:
Boolean: true or false depending o the search outcome
'''
for user in cls.user_list:
if user.password == characters:
return True
return False | class User:
"""
User class for user input
"""
user_list = []
def __init__(self, username, password):
self.username = username
self.password = password
def save_user(self):
"""
save_usermethod saves user objects into user_list
"""
User.user_list.append(self)
@classmethod
def user_exists(cls, characters):
"""
Method to che if a user exists
args:
character:username to search if it exist
return:
Boolean: true or false depending o the search outcome
"""
for user in cls.user_list:
if user.password == characters:
return True
return False |
#==================== Engine ====================
def run(code):
state = EngineState()
while True:
ip = state.ip
if ip >= len(code): break
state.ip = ip + 1
(fun,arg) = code[ip]
fun(state, arg)
class EngineState:
def __init__(self):
self.ip = 0
self.gctx = []
self.lctx = []
self.stack = []
self.ctxStack = []
def push(self, v): self.stack.append(v)
def pop(self): return self.stack.pop()
def peek(self): return self.stack[-1]
def swap(self):
st = self.stack
(st[-1],st[-2]) = (st[-2],st[-1])
#==================== Instructions ====================
#==================== Stack manipulation
def i_dup(state,arg): state.push(state.peek())
def i_pop(state,arg): state.pop()
def i_swap(state,arg): state.swap()
def i_pushInteger(state,arg):
state.push(arg)
def i_pushMarker(state,arg): pass
#==================== Arithmetic
def i_add(state,arg): state.push(state.pop() + state.pop())
def i_sub(state,arg): state.push(state.pop() - state.pop())
def i_mul(state,arg): state.push(state.pop() * state.pop())
def i_div(state,arg): pass
#==================== I/O
def i_input(state,arg): pass
def i_output(state,arg):
v = state.pop()
printIOList(v)
def i_printDebugDump(state,arg):
print("/---- DUMP:")
print("Stack: %s" % (state.stack,))
print("\\----")
def printIOList(v):
if type(v) == type(0):
print(chr(v))
else:
for x in v:
printIOList(x)
#==================== Flow control
def i_branch(state,arg): pass
def i_branchIfPositive(state,arg): pass
def i_call(state,arg): pass
def i_return(state,arg): pass
#==================== Arrays
def i_createArray(state,arg): pass
def i_arrayFetch(state,arg): pass
def i_arrayStore(state,arg): pass
def i_arrayGetSize(state,arg): pass
def i_arrayResize(state,arg): pass
#==================== Context access
def i_pushLocalContext(state,arg): pass
def i_pushGlobalContext(state,arg): pass
def i_enterScope(state,arg): pass
def i_exitScope(state,arg): pass
def i_(state,arg): pass
| def run(code):
state = engine_state()
while True:
ip = state.ip
if ip >= len(code):
break
state.ip = ip + 1
(fun, arg) = code[ip]
fun(state, arg)
class Enginestate:
def __init__(self):
self.ip = 0
self.gctx = []
self.lctx = []
self.stack = []
self.ctxStack = []
def push(self, v):
self.stack.append(v)
def pop(self):
return self.stack.pop()
def peek(self):
return self.stack[-1]
def swap(self):
st = self.stack
(st[-1], st[-2]) = (st[-2], st[-1])
def i_dup(state, arg):
state.push(state.peek())
def i_pop(state, arg):
state.pop()
def i_swap(state, arg):
state.swap()
def i_push_integer(state, arg):
state.push(arg)
def i_push_marker(state, arg):
pass
def i_add(state, arg):
state.push(state.pop() + state.pop())
def i_sub(state, arg):
state.push(state.pop() - state.pop())
def i_mul(state, arg):
state.push(state.pop() * state.pop())
def i_div(state, arg):
pass
def i_input(state, arg):
pass
def i_output(state, arg):
v = state.pop()
print_io_list(v)
def i_print_debug_dump(state, arg):
print('/---- DUMP:')
print('Stack: %s' % (state.stack,))
print('\\----')
def print_io_list(v):
if type(v) == type(0):
print(chr(v))
else:
for x in v:
print_io_list(x)
def i_branch(state, arg):
pass
def i_branch_if_positive(state, arg):
pass
def i_call(state, arg):
pass
def i_return(state, arg):
pass
def i_create_array(state, arg):
pass
def i_array_fetch(state, arg):
pass
def i_array_store(state, arg):
pass
def i_array_get_size(state, arg):
pass
def i_array_resize(state, arg):
pass
def i_push_local_context(state, arg):
pass
def i_push_global_context(state, arg):
pass
def i_enter_scope(state, arg):
pass
def i_exit_scope(state, arg):
pass
def i_(state, arg):
pass |
"""
# Definition for a Node.
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
"""
class Solution:
def __init__(self):
self.head = None
self.prev = None
def treeToDoublyList(self, root: 'Optional[Node]') -> 'Optional[Node]':
if not root:
return None
self.treetoDoublyHelper(root)
self.prev.right = self.head
self.head.left = self.prev
return self.head
def treetoDoublyHelper(self, node):
if not node:
return
self.treetoDoublyHelper(node.left)
if self.prev:
node.left = self.prev
self.prev.right = node
else:
self.head = node
self.prev = node
self.treetoDoublyHelper(node.right)
| """
# Definition for a Node.
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
"""
class Solution:
def __init__(self):
self.head = None
self.prev = None
def tree_to_doubly_list(self, root: 'Optional[Node]') -> 'Optional[Node]':
if not root:
return None
self.treetoDoublyHelper(root)
self.prev.right = self.head
self.head.left = self.prev
return self.head
def treeto_doubly_helper(self, node):
if not node:
return
self.treetoDoublyHelper(node.left)
if self.prev:
node.left = self.prev
self.prev.right = node
else:
self.head = node
self.prev = node
self.treetoDoublyHelper(node.right) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.