content
stringlengths 7
1.05M
|
|---|
"""
Decorators provide a way to intercept a decorated function, method, or class.
Ultimately, the decorator accepts the function as its only argument
Decorators can then either return the original function, or another one
"""
# pattern 1: Decorator that returns the original function
def change_default(func):
"""This decorator changes the default value of a single-argument function"""
func.__defaults__ = ("changed",)
return func
@change_default
def test_func(a=5):
return a
print(f"Calling test_func: {test_func()}")
# pattern 2: Decorator that returns a new function
def deprecate(func):
"""This decorator stops a function from running and prints a message"""
def nothing(*args, **kwargs):
print(f"{func.__name__} has been deprecated")
return nothing
@deprecate
def old_func():
return "I'm and old function that shouldn't be used"
print(f"Calling old_func: {old_func()}")
# pattern 3: Decorator that accepts arguments and returns original function
def add_attributes(**attributes):
"""This decorator adds specified attributes to a function"""
def decorator(func):
for key, value in attributes.items():
setattr(func, key, value)
return func
return decorator
@add_attributes(something="else", another=True)
def basic_func():
return
print(f"Calling basic_func: {basic_func()}")
print(f"basic_func.something: {basic_func.something}")
print(f"basic_func.another: {basic_func.another}")
# pattern 4: Decorator that accepts arguments and returns a new function
def return_type(ret_type):
def decorator(func):
def runner(*args, **kwargs):
result = func(*args, **kwargs)
assert isinstance(result, ret_type)
return result
return runner
return decorator
@return_type(str)
def loose_return(obj):
print(f"I'm returning an object of type {type(obj)}")
return obj
print(f"Calling loose_return with a string: {loose_return('Test')}")
# print(f"Calling loose_return with an integer: {loose_return(15)}")
# Decorators can stack
@add_attributes(something="else")
@return_type(str)
@change_default
def very_decorated(argument=17):
return argument
print(f"Calling very_decorated: {very_decorated()}")
print(f"very_decorated.something: {very_decorated.something}")
|
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
),
}
ALLOWED_HOSTS = []
TIME_ZONE = "UTC"
MEDIA_ROOT = ""
MEDIA_URL = ""
STATIC_ROOT = ""
STATIC_URL = "/static/"
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
)
SECRET_KEY = "1234567890"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"debug": True,
"context_processors": [
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
],
},
},
]
MIDDLEWARE = (
"django.middleware.common.CommonMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
)
ROOT_URLCONF = "tests.urls"
INSTALLED_APPS = (
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.staticfiles",
"django.contrib.admin",
"django.contrib.messages",
"rest_framework",
"drf_stripe",
"tests",
)
USE_TZ = True
|
# Projeto estruturado para aperfeiçoamento de lógica da programação
#cria linhas para separar o códico na hora da compilação e ficar mais facíl entendimento
def lin():
print('_' * 30)
# semana 2 etapa 1 se apresentando e pedindo alguns dados do cliente
def obter_limite():
print ('Olá, seja bem-vindo a loja variados store, meu nome é Johnny Carvalho e eu estou aqui para te ajudar.')
lin()
print ('É um prazer ter você como nosso cliente, para isso iremos fazer um breve cadastro.')
lin()
print ('Iremos fazer uma breve análise de crédito para você, precisamos que forneça alguns dados pessoais para continuar:')
lin()
# abaixo segue os dados do cliente
cargo = input ('Qual é o seu cargo na empresa aonde trabalha? ')
print (cargo)
lin()
salario = float(input('Qual é o seu salário mensal atual? R$ '))
print ('R$ {:.2f}'.format(salario))
lin()
#semana 3 etapa 2
# abaixo segue a data de nascimento
print('digite a data do seu nascimento separado entre dia, mês e ano: ')
dia = input('dia: ')
mes = input('mes: ')
ano = int(input('ano: '))
# calculo para saber a idade
ano_atual = int(2020)
lin()
print('A data do seu nascimento é: {}/{}/{}'.format(dia, mes, ano))
lin()
idade = int(ano_atual-ano)
lin()
print ('você tem {} anos de idade'.format(idade))
lin()
# calculo para a análise de crédito
x = float(idade / 1000)
y = float(salario * x)
z = int(100)
credito = float(y + z)
print('De acordo com os dados fornecidos lhe informamos que seu limite de credito é de: R${:.2f}'.format(credito))
lin()
return credito, idade
# semana 4 etapa 3 pedindo ao cliente que digite o nome do produto e o preço dele
def verificar_produto(limite):
produto = input('Digite o nome de um produto escolhido: ')
lin()
valor = float(input('Digite o valor desse item: '))
lin()
print('O produto é um(a) {} e o valor dele é R${} reais'.format(produto, valor,))
limite_disponivel = limite - valor
print('Seu limite atual é de R$ {}'.format(limite_disponivel))
lin()
# calculo da porcentagem para ver se libera ou não o produto para o cliente
percentual = float((valor) / (limite)) * 100
lin()
if percentual<=60:
print('compra liberada, você utilizou {:.2f} % do seu limite'.format(percentual))
lin()
elif 60< percentual <90:
print('O seu produto irá utilizar {:.2f} % do seu limite\nNesse caso podemos liberar ao parcelar em 2 vezes!'.format(percentual))
lin()
elif 90< percentual <100:
print('O seu produto irá utilizar {:.2f} % do seu limite\nNesse caso podemos liberar ao parcelar em 3 ou mais vezes!'.format(percentual))
lin()
else:
print('Seu limite excedeu!\nEle utilizou {:.2f}% do seu limite total'.format(percentual))
# abaixo segue o calculo para desconto ao cliente
meu_nome = ('JohnnyEldodeCarvalho')
numeros_meu_nome = len(meu_nome)
primeiro_nome = ('Johnny')
numero_primeiro_nome = float(len(primeiro_nome))
lin()
soma_idade_nome = int((idade) + (numeros_meu_nome))
lin()
desconto = float((valor) - (numero_primeiro_nome))
if valor <=soma_idade_nome:
print('Parabéns você acaba de ganhar um desconto de R${:.2f} na sua compra\nAgora o valor da sua compra é de R${:.2f} reais!'.format(numero_primeiro_nome, desconto))
lin()
return valor
#calcula limite disponível para gasto
def limite_disponivel():
a = limite - valor
print('Seu limite agora é de R$ {:.2f}'.format(a))
return a
limite, idade = obter_limite()
valor = verificar_produto(limite)
disponivel = limite_disponivel()
if disponivel > 0:
pergunta = str(input('Deseja cadastrar mais algum produto? \nDigite [s] para sim e [n] para não: '))
lin()
soma = 0
if (pergunta == 's'):
n = int(input('Quantos produtos o sr(a) deseja cadastrar?\nDigite aqui: '))
lin()
for i in range(n):
prod = input('Digite o nome do {}º produto :'.format(i+1))
lin()
val = float(input('Digite o valor do {}º produto : '.format(i+1)))
soma += val
disp = disponivel - soma
lin()
print('Seu limite disponivel é: R$ {:.2f}'.format(disp))
lin()
if (soma > disponivel):
print('limite excedido!\nObrigado volte sempre!', end='\n')
lin()
break
print(end='\n')
else:
print('***Nós agradecemos a sua preferência***\n\n***Volte sempre!***')
else:
print('###limite excedido!###\n***Obrigado volte sempre!***', end='\n')
|
# Motor Controller class initialization constants
ZERO_POWER = 309 # Value to set thrusters to 0 power
NEG_MAX_POWER = 226 # Value to set thrusters to max negative power
POS_MAX_POWER = 391 # Value to set thrusters to max positive power
FREQUENCY = 49.5 # Frequency at which the i2c to pwm will be updated
POWER_THRESH = 115 # Power threshold for each individual thruster in Watts
# Tool Pin Placements
MANIPULATOR_PIN = 15
OBS_TOOL_PIN = 14
REVERSE_POLARITY = []
|
class Solution:
def checkIfExist(self, arr: List[int]) -> bool:
for i in range(len(arr)):
for j in range(len(arr)):
if i != j and arr[i] == 2*arr[j]:
return True
return False
|
"""
Name : Even odd
Author : [Mayank Goyal) [https://github.com/mayankgoyal-13]
"""
num = int(input("Enter your number: "))
if num % 2 == 0:
print('The given number is even')
else:
print('The given number is odd')
|
valorCasa = float(input("Valor da casa: "))
salario = float(input("Seu salário: "))
tempoPgtoAno = int(input("Pagará em quantos anos: "))
tempoPgtoMes = tempoPgtoAno * 12
valorMaxPar = salario * .3
valorPar = valorCasa / tempoPgtoMes
if valorPar > valorMaxPar:
print("\033[31mEmpréstimo negado.\033[m")
else:
print("\033[32mEmpréstimo liberado.\033[m")
print("\033[32m{} parcelas de R$ {:.2f}".format(tempoPgtoMes, valorPar),"\033[m")
|
def pattern(N):
if(N==2):
for i in range(N):
print(("#"*1+" ")*N)
if(N==3):
for i in range(N-1):
print(("#"*2+" ")*N)
if(N==4):
for i in range(N-2):
print(("#"*3+" ")*N)
pattern(2)
pattern(3)
pattern(4)
|
my_list = ['один', 'два', 'три', 'четыре', 'пять']
list_2 = ['шесть', 'семь']
my_list.extend(list_2)
print(my_list)
|
def addDataSource(doc, name, url):
"""
Add a DataSource to the given InterMine items XML
Returns the item.
"""
dataSourceItem = doc.createItem('DataSource')
dataSourceItem.addAttribute('name', name)
dataSourceItem.addAttribute('url', url)
doc.addItem(dataSourceItem)
return dataSourceItem
def addDataSet(doc, name, sourceItem):
"""
Add a DataSet to the given InterMine items XML
:param doc:
:param name:
:param sourceItem:
:return: the item added
"""
datasetItem = doc.createItem('DataSet')
datasetItem.addAttribute('name', name)
datasetItem.addAttribute('dataSource', sourceItem)
doc.addItem(datasetItem)
return datasetItem
|
# import numpy as np
# a = np.array([17,22,4,2,14,24,0,5,8,7,27,28,15,25,12,9,20,3,29,16,10,6,1,13,18,23,11,26,21,19])
# np.random.shuffle(a)
# print(a.tolist())
# np.random.shuffle(a)
# print(a.tolist())
# np.random.shuffle(a)
# print(a.tolist())
need_rerun = [
{'bodies': [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315],
'seed': 4, 'method': 'align'},
{'bodies': [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315],
'seed': 6, 'method': 'random'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 0, 'method': 'align'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 4, 'method': 'align'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 6, 'method': 'align'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 0, 'method': 'random'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 3, 'method': 'random'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 5, 'method': 'random'},
{'bodies': [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515],
'seed': 6, 'method': 'random'},
{'bodies': [600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615],
'seed': 4, 'method': 'align'},
{'bodies': [600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615],
'seed': 6, 'method': 'align'}]
print("\n"*2)
for r in need_rerun:
cmd = f"sbatch -J exp_010_rerun submit.sh python 1.train.py --seed={r['seed']} --train_bodies={','.join([str(x) for x in r['bodies']])} --test_bodies={','.join([str(x) for x in r['bodies']])}"
if r["method"]=='random':
cmd += " --random_align_obs"
print(cmd)
print("\n"*2)
|
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/1107/B
# 类似筛子?
# https://codeforces.com/blog/entry/64847
# 性质: n%9=x
def f(l):
k,x = l
return 9*(k-1)+x
t = int(input())
for _ in range(t):
l = list(map(int,input().split()))
print(f(l))
|
# Copyright (c) 2021 Jeff Irion and contributors
#
# This file is part of the adb-shell package.
"""ADB shell functionality.
"""
__version__ = '0.4.1'
|
class _Food:
color = (107, 0, 0)
def __init__(self, pos_x, pos_y, live = 100):
self.pos_x = pos_x
self.pos_y = pos_y
self.live = live
def get_pos_x(self):
return self.pos_x
def get_pos_y(self):
return self.pos_y
def live_decrement(self):
self.live -=1
|
""" Code to solve Lychrel number
So this is a very popular math question
The idea is to take any number as num and reverse it.
Now add the reversed number to num and repeat the process unless
a palindrome is obtained. The weird thing about this process is that
for nearly every number ends with a palindrome except the number 196
noone is able to explain why:)"""
"""
DO NOT REMOVE THIS COMMENT AS THE CODE BELOW INCREASE THE RECUSION LIMIT
THIS MAY ALSO RESULT TO TOTAL CRASH OF THE SYSTEM. IF YOUR PC IS STRONG ENOUGH TO TACKLE
RECURSION, FEEL FREE TO USE THE CODE BY REMOVING THE COMMENTS.
#import sys
#sys.setrecursionlimit(1500)
"""
#function to solve the lychrel number
def prob(num):
temp=num
rev=0
while(num>0):
dig=num%10
rev=rev*10+dig
num=num//10
if(temp==rev):
print(f"At last! we found a palindrome which is {temp}")
else:
print(f"The number {temp} isn't a palindrome!")
again = temp + reverse(temp)
prob(again)
#function to reverse a given number
def reverse(num):
reversed_num = 0
while num != 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num //= 10
return reversed_num
#driver code
num = int(input("Enter a two digit number or more"))
prob(num)
|
# -*- coding: utf-8 -*-
"""Test for autolag of adfuller, unitroot_adf
Created on Wed May 30 21:39:46 2012
Author: Josef Perktold
"""
# The only test from this file has been moved to test_unit_root (2018-05-04)
|
while True:
print('Enter you age: ')
age = input()
if age.isdecimal():
break
print('Please enter a number for age')
while True:
print('Select a new password (letters and numbers only):')
password = input()
if password.isalnum():
break
print('Passwords can only have letters and numbers')
|
# -*- coding: utf-8 -*-
class ApiException(Exception):
errors = []
def __init__(self, errors, code):
self.errors = errors
self.code = code
|
#
# PySNMP MIB module HP-ICF-DHCPv6-SNOOP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-ICF-DHCPv6-SNOOP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:21:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint")
hpSwitch, = mibBuilder.importSymbols("HP-ICF-OID", "hpSwitch")
VidList, = mibBuilder.importSymbols("HP-ICF-TC", "VidList")
hpicfSaviObjectsPortEntry, hpicfSaviObjectsBindingEntry = mibBuilder.importSymbols("HPICF-SAVI-MIB", "hpicfSaviObjectsPortEntry", "hpicfSaviObjectsBindingEntry")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
VlanIndex, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanIndex")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
NotificationType, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, IpAddress, TimeTicks, iso, ModuleIdentity, Gauge32, Counter32, MibIdentifier, Bits, Unsigned32, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "IpAddress", "TimeTicks", "iso", "ModuleIdentity", "Gauge32", "Counter32", "MibIdentifier", "Bits", "Unsigned32", "Counter64")
RowStatus, TruthValue, TextualConvention, DateAndTime, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "TextualConvention", "DateAndTime", "MacAddress", "DisplayString")
hpicfDSnoopV6 = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102))
hpicfDSnoopV6.setRevisions(('2017-11-08 00:00', '2015-01-28 00:00', '2013-10-06 00:00', '2013-04-30 00:00',))
if mibBuilder.loadTexts: hpicfDSnoopV6.setLastUpdated('201711080000Z')
if mibBuilder.loadTexts: hpicfDSnoopV6.setOrganization('HP Networking')
hpicfDSnoopV6Notifications = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0))
hpicfDSnoopV6Objects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1))
hpicfDSnoopV6Config = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1))
hpicfDSnoopV6GlobalCfg = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1))
hpicfDSnoopV6Enable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6Enable.setStatus('current')
hpicfDSnoopV6VlanEnable = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 2), VidList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6VlanEnable.setStatus('current')
hpicfDSnoopV6DatabaseFile = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 3), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseFile.setStatus('current')
hpicfDSnoopV6DatabaseWriteDelay = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(15, 86400))).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseWriteDelay.setStatus('current')
hpicfDSnoopV6DatabaseWriteTimeout = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 86400))).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseWriteTimeout.setStatus('current')
hpicfDSnoopV6OutOfResourcesTrapCtrl = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6OutOfResourcesTrapCtrl.setStatus('current')
hpicfDSnoopV6ErrantReplyTrapCtrl = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6ErrantReplyTrapCtrl.setStatus('current')
hpicfDSnoopV6DatabaseFTPort = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseFTPort.setStatus('current')
hpicfDSnoopV6DatabaseSFTPUsername = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 9), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseSFTPUsername.setStatus('current')
hpicfDSnoopV6DatabaseSFTPPassword = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 10), SnmpAdminString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseSFTPPassword.setStatus('current')
hpicfDSnoopV6DatabaseValidateSFTPServer = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6DatabaseValidateSFTPServer.setStatus('current')
hpicfDSnoopV6AuthorizedServerTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 2), )
if mibBuilder.loadTexts: hpicfDSnoopV6AuthorizedServerTable.setStatus('current')
hpicfDSnoopV6AuthorizedServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 2, 1), ).setIndexNames((0, "HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6AuthorizedServerAddrType"), (0, "HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6AuthorizedServerAddress"))
if mibBuilder.loadTexts: hpicfDSnoopV6AuthorizedServerEntry.setStatus('current')
hpicfDSnoopV6AuthorizedServerAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 2, 1, 1), InetAddressType())
if mibBuilder.loadTexts: hpicfDSnoopV6AuthorizedServerAddrType.setStatus('current')
hpicfDSnoopV6AuthorizedServerAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 2, 1, 2), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(16, 16), ValueSizeConstraint(20, 20), )))
if mibBuilder.loadTexts: hpicfDSnoopV6AuthorizedServerAddress.setStatus('current')
hpicfDSnoopV6AuthorizedServerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 2, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpicfDSnoopV6AuthorizedServerStatus.setStatus('current')
hpicfDSnoopV6GlobalStats = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2))
hpicfDSnoopV6CSForwards = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6CSForwards.setStatus('current')
hpicfDSnoopV6CSMACMismatches = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6CSMACMismatches.setStatus('current')
hpicfDSnoopV6CSBadReleases = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6CSBadReleases.setStatus('current')
hpicfDSnoopV6CSUntrustedDestPorts = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6CSUntrustedDestPorts.setStatus('current')
hpicfDSnoopV6SCForwards = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6SCForwards.setStatus('current')
hpicfDSnoopV6SCUntrustedPorts = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6SCUntrustedPorts.setStatus('current')
hpicfDSnoopV6SCRelayReplyUntrustedPorts = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6SCRelayReplyUntrustedPorts.setStatus('current')
hpicfDSnoopV6SCUnauthorizedServers = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6SCUnauthorizedServers.setStatus('current')
hpicfDSnoopV6DBFileWriteAttempts = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6DBFileWriteAttempts.setStatus('current')
hpicfDSnoopV6DBFileWriteFailures = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6DBFileWriteFailures.setStatus('current')
hpicfDSnoopV6DBFileReadStatus = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("notConfigured", 1), ("inProgress", 2), ("succeeded", 3), ("failed", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6DBFileReadStatus.setStatus('current')
hpicfDSnoopV6DBFileWriteStatus = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("notConfigured", 1), ("delaying", 2), ("inProgress", 3), ("succeeded", 4), ("failed", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6DBFileWriteStatus.setStatus('current')
hpicfDSnoopV6DBFileLastWriteTime = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 13), DateAndTime()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6DBFileLastWriteTime.setStatus('current')
hpicfDSnoopV6MaxbindPktsDropped = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 2, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6MaxbindPktsDropped.setStatus('current')
hpicfDSnoopV6ClearStatsOptions = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 3))
hpicfDSnoopV6ClearStats = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 3, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6ClearStats.setStatus('current')
hpicfDSnoopV6PortMaxBindingTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 3), )
if mibBuilder.loadTexts: hpicfDSnoopV6PortMaxBindingTable.setStatus('current')
hpicfDSnoopV6PortMaxBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 3, 1), )
hpicfSaviObjectsPortEntry.registerAugmentions(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6PortMaxBindingEntry"))
hpicfDSnoopV6PortMaxBindingEntry.setIndexNames(*hpicfSaviObjectsPortEntry.getIndexNames())
if mibBuilder.loadTexts: hpicfDSnoopV6PortMaxBindingEntry.setStatus('current')
hpicfDSnoopV6PortStaticBinding = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 3, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 8192))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6PortStaticBinding.setStatus('current')
hpicfDSnoopV6PortDynamicBinding = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 3, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 8192))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6PortDynamicBinding.setStatus('current')
hpicfDSnoopV6StaticBindingTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 4), )
if mibBuilder.loadTexts: hpicfDSnoopV6StaticBindingTable.setStatus('current')
hpicfDSnoopV6StaticBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 4, 1), )
hpicfSaviObjectsBindingEntry.registerAugmentions(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6StaticBindingEntry"))
hpicfDSnoopV6StaticBindingEntry.setIndexNames(*hpicfSaviObjectsBindingEntry.getIndexNames())
if mibBuilder.loadTexts: hpicfDSnoopV6StaticBindingEntry.setStatus('current')
hpicfDSnoopV6BindingVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 4, 1, 1), VlanIndex().subtype(subtypeSpec=ValueRangeConstraint(1, 4094))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6BindingVlanId.setStatus('current')
hpicfDSnoopV6BindingLLAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 4, 1, 2), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpicfDSnoopV6BindingLLAddress.setStatus('current')
hpicfDSnoopV6BindingSecVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 1, 1, 4, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDSnoopV6BindingSecVlan.setStatus('current')
hpicfDSnoopV6SourceBindingOutOfResources = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 1)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingPort"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingMacAddress"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingIpAddressType"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingIpAddress"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingVlan"))
if mibBuilder.loadTexts: hpicfDSnoopV6SourceBindingOutOfResources.setStatus('current')
hpicfDsnoopV6SourceBindingOutOfResourcesObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 2))
hpicfDsnoopV6SourceBindingPort = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 2, 1), InterfaceIndex()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDsnoopV6SourceBindingPort.setStatus('current')
hpicfDsnoopV6SourceBindingMacAddress = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 2, 2), MacAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDsnoopV6SourceBindingMacAddress.setStatus('current')
hpicfDsnoopV6SourceBindingIpAddressType = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 2, 3), InetAddressType()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDsnoopV6SourceBindingIpAddressType.setStatus('current')
hpicfDsnoopV6SourceBindingIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 2, 4), InetAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDsnoopV6SourceBindingIpAddress.setStatus('current')
hpicfDsnoopV6SourceBindingVlan = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 2, 5), VlanIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpicfDsnoopV6SourceBindingVlan.setStatus('current')
hpicfDSnoopV6SourceBindingErrantReply = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 3)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingNotifyCount"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantSrcMAC"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantSrcIPType"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantSrcIP"))
if mibBuilder.loadTexts: hpicfDSnoopV6SourceBindingErrantReply.setStatus('current')
hpicfDSnoopV6SourceBindingNotifyObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 4))
hpicfDSnoopV6SourceBindingNotifyCount = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 4, 1), Counter32()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDSnoopV6SourceBindingNotifyCount.setStatus('current')
hpicfDSnoopV6SourceBindingErrantSrcMAC = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 4, 2), MacAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDSnoopV6SourceBindingErrantSrcMAC.setStatus('current')
hpicfDSnoopV6SourceBindingErrantSrcIPType = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 4, 3), InetAddressType()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDSnoopV6SourceBindingErrantSrcIPType.setStatus('current')
hpicfDSnoopV6SourceBindingErrantSrcIP = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 0, 4, 4), InetAddress()).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: hpicfDSnoopV6SourceBindingErrantSrcIP.setStatus('current')
hpicfDSnoopV6Conformance = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2))
hpicfDSnoopV6Groups = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1))
hpicfDSnoopV6BaseGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 1)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6Enable"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6VlanEnable"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6CSForwards"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6CSBadReleases"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6CSUntrustedDestPorts"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6CSMACMismatches"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SCForwards"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SCUnauthorizedServers"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SCUntrustedPorts"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SCRelayReplyUntrustedPorts"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6BaseGroup = hpicfDSnoopV6BaseGroup.setStatus('current')
hpicfDSnoopV6ServersGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 2)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6AuthorizedServerStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6ServersGroup = hpicfDSnoopV6ServersGroup.setStatus('current')
hpicfDSnoopV6DbaseFileGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 3)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseFile"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseWriteDelay"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseWriteTimeout"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileWriteAttempts"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileWriteFailures"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileReadStatus"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileWriteStatus"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileLastWriteTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6DbaseFileGroup = hpicfDSnoopV6DbaseFileGroup.setStatus('deprecated')
hpicfDSnoopV6MaxBindingsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 4)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6MaxbindPktsDropped"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6PortStaticBinding"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6PortDynamicBinding"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6MaxBindingsGroup = hpicfDSnoopV6MaxBindingsGroup.setStatus('current')
hpicfDSnoopV6StaticBindingsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 5)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6BindingVlanId"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6BindingLLAddress"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6BindingSecVlan"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6StaticBindingsGroup = hpicfDSnoopV6StaticBindingsGroup.setStatus('current')
hpicfDSnoopV6ClearStatsOptionsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 6)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6ClearStats"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6ClearStatsOptionsGroup = hpicfDSnoopV6ClearStatsOptionsGroup.setStatus('current')
hpicfDSnoopV6TrapObjectsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 7)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingNotifyCount"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantSrcMAC"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantSrcIPType"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantSrcIP"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingPort"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingMacAddress"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingIpAddressType"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingIpAddress"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDsnoopV6SourceBindingVlan"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6OutOfResourcesTrapCtrl"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6ErrantReplyTrapCtrl"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6TrapObjectsGroup = hpicfDSnoopV6TrapObjectsGroup.setStatus('current')
hpicfDSnoopV6TrapsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 8)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingOutOfResources"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6SourceBindingErrantReply"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6TrapsGroup = hpicfDSnoopV6TrapsGroup.setStatus('current')
hpicfDSnoopV6DbaseFileGroup1 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 1, 9)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseFile"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseWriteDelay"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseWriteTimeout"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileWriteAttempts"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileWriteFailures"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileReadStatus"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileWriteStatus"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DBFileLastWriteTime"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseFTPort"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseSFTPUsername"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseSFTPPassword"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DatabaseValidateSFTPServer"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6DbaseFileGroup1 = hpicfDSnoopV6DbaseFileGroup1.setStatus('current')
hpicfDSnoopV6Compliances = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 3))
hpicfDSnoopV6Compliance2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 3, 1)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6BaseGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6ServersGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DbaseFileGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6MaxBindingsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6StaticBindingsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6ClearStatsOptionsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6TrapObjectsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6TrapsGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6Compliance2 = hpicfDSnoopV6Compliance2.setStatus('deprecated')
hpicfDSnoopV6Compliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 5, 1, 102, 2, 3, 2)).setObjects(("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6BaseGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6ServersGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6MaxBindingsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6StaticBindingsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6ClearStatsOptionsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6TrapObjectsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6TrapsGroup"), ("HP-ICF-DHCPv6-SNOOP-MIB", "hpicfDSnoopV6DbaseFileGroup1"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
hpicfDSnoopV6Compliance = hpicfDSnoopV6Compliance.setStatus('current')
mibBuilder.exportSymbols("HP-ICF-DHCPv6-SNOOP-MIB", hpicfDSnoopV6DatabaseWriteDelay=hpicfDSnoopV6DatabaseWriteDelay, hpicfDSnoopV6MaxbindPktsDropped=hpicfDSnoopV6MaxbindPktsDropped, hpicfDSnoopV6ClearStats=hpicfDSnoopV6ClearStats, hpicfDSnoopV6BindingVlanId=hpicfDSnoopV6BindingVlanId, hpicfDSnoopV6Compliance2=hpicfDSnoopV6Compliance2, hpicfDSnoopV6AuthorizedServerAddress=hpicfDSnoopV6AuthorizedServerAddress, hpicfDSnoopV6DBFileReadStatus=hpicfDSnoopV6DBFileReadStatus, hpicfDSnoopV6SourceBindingOutOfResources=hpicfDSnoopV6SourceBindingOutOfResources, hpicfDSnoopV6DatabaseSFTPPassword=hpicfDSnoopV6DatabaseSFTPPassword, hpicfDSnoopV6AuthorizedServerTable=hpicfDSnoopV6AuthorizedServerTable, hpicfDSnoopV6PortMaxBindingEntry=hpicfDSnoopV6PortMaxBindingEntry, hpicfDSnoopV6StaticBindingTable=hpicfDSnoopV6StaticBindingTable, hpicfDSnoopV6BindingSecVlan=hpicfDSnoopV6BindingSecVlan, hpicfDSnoopV6Objects=hpicfDSnoopV6Objects, hpicfDsnoopV6SourceBindingIpAddressType=hpicfDsnoopV6SourceBindingIpAddressType, hpicfDSnoopV6VlanEnable=hpicfDSnoopV6VlanEnable, hpicfDSnoopV6SourceBindingErrantSrcIPType=hpicfDSnoopV6SourceBindingErrantSrcIPType, hpicfDSnoopV6ClearStatsOptionsGroup=hpicfDSnoopV6ClearStatsOptionsGroup, hpicfDSnoopV6CSForwards=hpicfDSnoopV6CSForwards, hpicfDSnoopV6PortDynamicBinding=hpicfDSnoopV6PortDynamicBinding, hpicfDSnoopV6DatabaseWriteTimeout=hpicfDSnoopV6DatabaseWriteTimeout, hpicfDSnoopV6DBFileWriteStatus=hpicfDSnoopV6DBFileWriteStatus, hpicfDSnoopV6SourceBindingNotifyCount=hpicfDSnoopV6SourceBindingNotifyCount, hpicfDSnoopV6SourceBindingErrantSrcIP=hpicfDSnoopV6SourceBindingErrantSrcIP, hpicfDSnoopV6MaxBindingsGroup=hpicfDSnoopV6MaxBindingsGroup, hpicfDSnoopV6AuthorizedServerAddrType=hpicfDSnoopV6AuthorizedServerAddrType, hpicfDSnoopV6DbaseFileGroup=hpicfDSnoopV6DbaseFileGroup, hpicfDSnoopV6ErrantReplyTrapCtrl=hpicfDSnoopV6ErrantReplyTrapCtrl, hpicfDSnoopV6DatabaseSFTPUsername=hpicfDSnoopV6DatabaseSFTPUsername, hpicfDSnoopV6CSUntrustedDestPorts=hpicfDSnoopV6CSUntrustedDestPorts, hpicfDSnoopV6DBFileWriteFailures=hpicfDSnoopV6DBFileWriteFailures, hpicfDSnoopV6StaticBindingEntry=hpicfDSnoopV6StaticBindingEntry, hpicfDSnoopV6Groups=hpicfDSnoopV6Groups, hpicfDsnoopV6SourceBindingOutOfResourcesObjects=hpicfDsnoopV6SourceBindingOutOfResourcesObjects, hpicfDSnoopV6SourceBindingErrantSrcMAC=hpicfDSnoopV6SourceBindingErrantSrcMAC, hpicfDSnoopV6TrapObjectsGroup=hpicfDSnoopV6TrapObjectsGroup, hpicfDSnoopV6SCUntrustedPorts=hpicfDSnoopV6SCUntrustedPorts, hpicfDSnoopV6OutOfResourcesTrapCtrl=hpicfDSnoopV6OutOfResourcesTrapCtrl, hpicfDSnoopV6CSBadReleases=hpicfDSnoopV6CSBadReleases, hpicfDSnoopV6DbaseFileGroup1=hpicfDSnoopV6DbaseFileGroup1, hpicfDSnoopV6ClearStatsOptions=hpicfDSnoopV6ClearStatsOptions, hpicfDSnoopV6DBFileLastWriteTime=hpicfDSnoopV6DBFileLastWriteTime, hpicfDSnoopV6PortStaticBinding=hpicfDSnoopV6PortStaticBinding, hpicfDSnoopV6SCForwards=hpicfDSnoopV6SCForwards, PYSNMP_MODULE_ID=hpicfDSnoopV6, hpicfDSnoopV6PortMaxBindingTable=hpicfDSnoopV6PortMaxBindingTable, hpicfDSnoopV6BindingLLAddress=hpicfDSnoopV6BindingLLAddress, hpicfDsnoopV6SourceBindingMacAddress=hpicfDsnoopV6SourceBindingMacAddress, hpicfDSnoopV6AuthorizedServerEntry=hpicfDSnoopV6AuthorizedServerEntry, hpicfDSnoopV6AuthorizedServerStatus=hpicfDSnoopV6AuthorizedServerStatus, hpicfDSnoopV6SourceBindingNotifyObjects=hpicfDSnoopV6SourceBindingNotifyObjects, hpicfDSnoopV6Conformance=hpicfDSnoopV6Conformance, hpicfDSnoopV6BaseGroup=hpicfDSnoopV6BaseGroup, hpicfDsnoopV6SourceBindingPort=hpicfDsnoopV6SourceBindingPort, hpicfDSnoopV6Compliance=hpicfDSnoopV6Compliance, hpicfDSnoopV6Enable=hpicfDSnoopV6Enable, hpicfDSnoopV6SCUnauthorizedServers=hpicfDSnoopV6SCUnauthorizedServers, hpicfDSnoopV6CSMACMismatches=hpicfDSnoopV6CSMACMismatches, hpicfDsnoopV6SourceBindingIpAddress=hpicfDsnoopV6SourceBindingIpAddress, hpicfDSnoopV6SourceBindingErrantReply=hpicfDSnoopV6SourceBindingErrantReply, hpicfDSnoopV6GlobalStats=hpicfDSnoopV6GlobalStats, hpicfDSnoopV6StaticBindingsGroup=hpicfDSnoopV6StaticBindingsGroup, hpicfDSnoopV6DatabaseFile=hpicfDSnoopV6DatabaseFile, hpicfDSnoopV6Config=hpicfDSnoopV6Config, hpicfDSnoopV6DatabaseValidateSFTPServer=hpicfDSnoopV6DatabaseValidateSFTPServer, hpicfDSnoopV6SCRelayReplyUntrustedPorts=hpicfDSnoopV6SCRelayReplyUntrustedPorts, hpicfDSnoopV6ServersGroup=hpicfDSnoopV6ServersGroup, hpicfDSnoopV6Notifications=hpicfDSnoopV6Notifications, hpicfDSnoopV6TrapsGroup=hpicfDSnoopV6TrapsGroup, hpicfDSnoopV6DBFileWriteAttempts=hpicfDSnoopV6DBFileWriteAttempts, hpicfDSnoopV6Compliances=hpicfDSnoopV6Compliances, hpicfDsnoopV6SourceBindingVlan=hpicfDsnoopV6SourceBindingVlan, hpicfDSnoopV6=hpicfDSnoopV6, hpicfDSnoopV6DatabaseFTPort=hpicfDSnoopV6DatabaseFTPort, hpicfDSnoopV6GlobalCfg=hpicfDSnoopV6GlobalCfg)
|
#
# PySNMP MIB module ESI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ESI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:52:21 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
iso, NotificationType, Counter64, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Integer32, Counter32, ObjectIdentity, Unsigned32, MibIdentifier, enterprises, Bits, Gauge32, TimeTicks, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "NotificationType", "Counter64", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Integer32", "Counter32", "ObjectIdentity", "Unsigned32", "MibIdentifier", "enterprises", "Bits", "Gauge32", "TimeTicks", "ModuleIdentity")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
esi = MibIdentifier((1, 3, 6, 1, 4, 1, 683))
general = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 1))
commands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 2))
esiSNMP = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 3))
esiSNMPCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 3, 2))
driver = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 4))
tokenRing = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 5))
printServers = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6))
psGeneral = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 1))
psOutput = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 2))
psProtocols = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3))
genProtocols = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 1, 15))
outputCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 2, 2))
outputConfigure = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 2, 3))
outputJobLog = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 2, 6))
trCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 5, 2))
trConfigure = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 5, 3))
tcpip = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 1))
netware = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 2))
vines = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 3))
lanManager = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 4))
eTalk = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 5))
tcpipCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 3))
tcpipConfigure = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4))
tcpipStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 5))
nwCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 3))
nwConfigure = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4))
nwStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 5))
bvCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 3))
bvConfigure = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4))
bvStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5))
eTalkCommands = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 3))
eTalkConfigure = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4))
eTalkStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 5))
genGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: genGroupVersion.setStatus('mandatory')
genMIBVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: genMIBVersion.setStatus('mandatory')
genProductName = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genProductName.setStatus('mandatory')
genProductNumber = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 5))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genProductNumber.setStatus('mandatory')
genSerialNumber = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 7))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genSerialNumber.setStatus('mandatory')
genHWAddress = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: genHWAddress.setStatus('mandatory')
genCableType = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("tenbase2", 1), ("tenbaseT", 2), ("aui", 3), ("utp", 4), ("stp", 5), ("fiber100fx", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genCableType.setStatus('mandatory')
genDateCode = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 10))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genDateCode.setStatus('mandatory')
genVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 10))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genVersion.setStatus('mandatory')
genConfigurationDirty = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genConfigurationDirty.setStatus('mandatory')
genCompanyName = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genCompanyName.setStatus('mandatory')
genCompanyLoc = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 12), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genCompanyLoc.setStatus('mandatory')
genCompanyPhone = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genCompanyPhone.setStatus('mandatory')
genCompanyTechSupport = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genCompanyTechSupport.setStatus('mandatory')
genNumProtocols = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 15, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: genNumProtocols.setStatus('mandatory')
genProtocolTable = MibTable((1, 3, 6, 1, 4, 1, 683, 1, 15, 2), )
if mibBuilder.loadTexts: genProtocolTable.setStatus('mandatory')
genProtocolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 1, 15, 2, 1), ).setIndexNames((0, "ESI-MIB", "genProtocolIndex"))
if mibBuilder.loadTexts: genProtocolEntry.setStatus('mandatory')
genProtocolIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 1, 15, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: genProtocolIndex.setStatus('mandatory')
genProtocolDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 1, 15, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genProtocolDescr.setStatus('mandatory')
genProtocolID = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 1, 15, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("tcp-ip", 1), ("netware", 2), ("vines", 3), ("lanmanger", 4), ("ethertalk", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genProtocolID.setStatus('mandatory')
genSysUpTimeString = MibScalar((1, 3, 6, 1, 4, 1, 683, 1, 16), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 35))).setMaxAccess("readonly")
if mibBuilder.loadTexts: genSysUpTimeString.setStatus('mandatory')
cmdGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 2, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cmdGroupVersion.setStatus('mandatory')
cmdReset = MibScalar((1, 3, 6, 1, 4, 1, 683, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cmdReset.setStatus('optional')
cmdPrintConfig = MibScalar((1, 3, 6, 1, 4, 1, 683, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cmdPrintConfig.setStatus('optional')
cmdRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 2, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cmdRestoreDefaults.setStatus('optional')
snmpGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 3, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: snmpGroupVersion.setStatus('mandatory')
snmpRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 3, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: snmpRestoreDefaults.setStatus('optional')
snmpGetCommunityName = MibScalar((1, 3, 6, 1, 4, 1, 683, 3, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: snmpGetCommunityName.setStatus('optional')
snmpSetCommunityName = MibScalar((1, 3, 6, 1, 4, 1, 683, 3, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: snmpSetCommunityName.setStatus('optional')
snmpTrapCommunityName = MibScalar((1, 3, 6, 1, 4, 1, 683, 3, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: snmpTrapCommunityName.setStatus('optional')
driverGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverGroupVersion.setStatus('mandatory')
driverRXPackets = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverRXPackets.setStatus('mandatory')
driverTXPackets = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverTXPackets.setStatus('mandatory')
driverRXPacketsUnavailable = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverRXPacketsUnavailable.setStatus('mandatory')
driverRXPacketErrors = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverRXPacketErrors.setStatus('mandatory')
driverTXPacketErrors = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverTXPacketErrors.setStatus('mandatory')
driverTXPacketRetries = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverTXPacketRetries.setStatus('mandatory')
driverChecksumErrors = MibScalar((1, 3, 6, 1, 4, 1, 683, 4, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: driverChecksumErrors.setStatus('mandatory')
trGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: trGroupVersion.setStatus('mandatory')
trRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: trRestoreDefaults.setStatus('optional')
trPriority = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 6))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: trPriority.setStatus('optional')
trEarlyTokenRelease = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: trEarlyTokenRelease.setStatus('optional')
trPacketSize = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 3, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("one-k", 1), ("two-k", 2), ("four-k", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: trPacketSize.setStatus('optional')
trRouting = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 3, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("off", 1), ("all-None", 2), ("single-All", 3), ("single-None", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: trRouting.setStatus('optional')
trLocallyAdminAddr = MibScalar((1, 3, 6, 1, 4, 1, 683, 5, 3, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: trLocallyAdminAddr.setStatus('optional')
psGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psGroupVersion.setStatus('mandatory')
psJetAdminEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: psJetAdminEnabled.setStatus('mandatory')
psVerifyConfiguration = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("getvalue", 0), ("serial-configuration", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: psVerifyConfiguration.setStatus('optional')
outputGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 2, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputGroupVersion.setStatus('mandatory')
outputRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 2, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputRestoreDefaults.setStatus('mandatory')
outputCommandsTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 2, 2, 2), )
if mibBuilder.loadTexts: outputCommandsTable.setStatus('mandatory')
outputCommandsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 2, 2, 2, 1), ).setIndexNames((0, "ESI-MIB", "outputIndex"))
if mibBuilder.loadTexts: outputCommandsEntry.setStatus('mandatory')
outputCancelCurrentJob = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputCancelCurrentJob.setStatus('optional')
outputNumPorts = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputNumPorts.setStatus('mandatory')
outputTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2), )
if mibBuilder.loadTexts: outputTable.setStatus('mandatory')
outputEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1), ).setIndexNames((0, "ESI-MIB", "outputIndex"))
if mibBuilder.loadTexts: outputEntry.setStatus('mandatory')
outputIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputIndex.setStatus('mandatory')
outputName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputName.setStatus('mandatory')
outputStatusString = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 80))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputStatusString.setStatus('mandatory')
outputStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on-Line", 1), ("off-Line", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputStatus.setStatus('mandatory')
outputExtendedStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 15))).clone(namedValues=NamedValues(("none", 1), ("no-Printer-Attached", 2), ("toner-Low", 3), ("paper-Out", 4), ("paper-Jam", 5), ("door-Open", 6), ("printer-Error", 15)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputExtendedStatus.setStatus('mandatory')
outputPrinter = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("hp-III", 1), ("hp-IIISi", 2), ("ibm", 3), ("no-Specific-Printer", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputPrinter.setStatus('optional')
outputLanguageSwitching = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("off", 1), ("pcl", 2), ("postScript", 3), ("als", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputLanguageSwitching.setStatus('optional')
outputConfigLanguage = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("text", 1), ("pcl", 2), ("postScript", 3), ("off", 4), ("epl-zpl", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputConfigLanguage.setStatus('mandatory')
outputPCLString = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(127, 127)).setFixedLength(127)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputPCLString.setStatus('optional')
outputPSString = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(127, 127)).setFixedLength(127)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputPSString.setStatus('optional')
outputCascaded = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputCascaded.setStatus('optional')
outputSetting = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(32758, 32759, 32760, 32761, 32762, 32763, 32764, 32765, 32766, 32767))).clone(namedValues=NamedValues(("serial-infrared", 32758), ("serial-bidirectional", 32759), ("serial-unidirectional", 32760), ("serial-input", 32761), ("parallel-compatibility-no-bidi", 32762), ("ieee-1284-std-nibble-mode", 32763), ("z-Link", 32764), ("internal", 32765), ("ieee-1284-ecp-or-fast-nibble-mode", 32766), ("extendedLink", 32767)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputSetting.setStatus('mandatory')
outputOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("no-Owner", 1), ("tcpip", 2), ("netware", 3), ("vines", 4), ("lanManager", 5), ("etherTalk", 6), ("config-Page", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputOwner.setStatus('mandatory')
outputBIDIStatusEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputBIDIStatusEnabled.setStatus('optional')
outputPrinterModel = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 15), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 60))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputPrinterModel.setStatus('optional')
outputPrinterDisplay = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 16), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputPrinterDisplay.setStatus('optional')
outputCapabilities = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16, 32, 64, 128, 256, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824))).clone(namedValues=NamedValues(("serial-Uni-Baud-9600", 1), ("serial-Uni-Baud-19200", 2), ("serial-Uni-Baud-38400", 4), ("serial-Uni-Baud-57600", 8), ("serial-Uni-Baud-115200", 16), ("serial-bidi-Baud-9600", 32), ("serial-bidi-Baud-19200", 64), ("serial-bidi-Baud-38400", 128), ("serial-bidi-Baud-57600", 256), ("zpl-epl-capable", 262144), ("serial-irin", 524288), ("serial-in", 1048576), ("serial-config-settings", 2097152), ("parallel-compatibility-no-bidi", 4194304), ("ieee-1284-std-nibble-mode", 8388608), ("z-link", 16777216), ("bidirectional", 33554432), ("serial-Software-Handshake", 67108864), ("serial-Output", 134217728), ("extendedLink", 268435456), ("internal", 536870912), ("ieee-1284-ecp-or-fast-nibble-mode", 1073741824)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputCapabilities.setStatus('mandatory')
outputHandshake = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("not-Supported", 1), ("hardware-Software", 2), ("hardware", 3), ("software", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputHandshake.setStatus('optional')
outputDataBits = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(7, 8, 255))).clone(namedValues=NamedValues(("seven-bits", 7), ("eight-bits", 8), ("not-Supported", 255)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputDataBits.setStatus('optional')
outputStopBits = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 255))).clone(namedValues=NamedValues(("one-bit", 1), ("two-bits", 2), ("not-Supported", 255)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputStopBits.setStatus('optional')
outputParity = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 255))).clone(namedValues=NamedValues(("none", 1), ("odd", 2), ("even", 3), ("not-Supported", 255)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputParity.setStatus('optional')
outputBaudRate = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("unidirectional-9600", 1), ("unidirectional-19200", 2), ("unidirectional-38400", 3), ("unidirectional-57600", 4), ("unidirectional-115200", 5), ("bidirectional-9600", 6), ("bidirectional-19200", 7), ("bidirectional-38400", 8), ("bidirectional-57600", 9)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: outputBaudRate.setStatus('optional')
outputProtocolManager = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 3, 2, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("protocol-none", 0), ("protocol-compatibility", 1), ("protocol-1284-4", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputProtocolManager.setStatus('optional')
outputDisplayMask = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 2, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputDisplayMask.setStatus('mandatory')
outputAvailableTrapsMask = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 2, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputAvailableTrapsMask.setStatus('mandatory')
outputNumLogEntries = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputNumLogEntries.setStatus('mandatory')
outputJobLogTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 2), )
if mibBuilder.loadTexts: outputJobLogTable.setStatus('mandatory')
outputJobLogEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 2, 1), ).setIndexNames((0, "ESI-MIB", "outputIndex"))
if mibBuilder.loadTexts: outputJobLogEntry.setStatus('mandatory')
outputJobLogInformation = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 100))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputJobLogInformation.setStatus('mandatory')
outputJobLogTime = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 50))).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputJobLogTime.setStatus('mandatory')
outputTotalJobTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 3), )
if mibBuilder.loadTexts: outputTotalJobTable.setStatus('mandatory')
outputTotalJobEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 3, 1), ).setIndexNames((0, "ESI-MIB", "outputTotalJobIndex"))
if mibBuilder.loadTexts: outputTotalJobEntry.setStatus('mandatory')
outputTotalJobIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputTotalJobIndex.setStatus('mandatory')
outputTotalJobsLogged = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 2, 6, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: outputTotalJobsLogged.setStatus('mandatory')
tcpipGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipGroupVersion.setStatus('mandatory')
tcpipEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipEnabled.setStatus('optional')
tcpipRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipRestoreDefaults.setStatus('optional')
tcpipFirmwareUpgrade = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipFirmwareUpgrade.setStatus('optional')
tcpipIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipIPAddress.setStatus('optional')
tcpipDefaultGateway = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipDefaultGateway.setStatus('optional')
tcpipSubnetMask = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSubnetMask.setStatus('optional')
tcpipUsingNetProtocols = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipUsingNetProtocols.setStatus('optional')
tcpipBootProtocolsEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipBootProtocolsEnabled.setStatus('optional')
tcpipIPAddressSource = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("permanent", 1), ("default", 2), ("rarp", 3), ("bootp", 4), ("dhcp", 5), ("glean", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipIPAddressSource.setStatus('optional')
tcpipIPAddressServerAddress = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 7), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipIPAddressServerAddress.setStatus('optional')
tcpipTimeoutChecking = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipTimeoutChecking.setStatus('optional')
tcpipNumTraps = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipNumTraps.setStatus('mandatory')
tcpipTrapTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10), )
if mibBuilder.loadTexts: tcpipTrapTable.setStatus('mandatory')
tcpipTrapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10, 1), ).setIndexNames((0, "ESI-MIB", "tcpipTrapIndex"))
if mibBuilder.loadTexts: tcpipTrapEntry.setStatus('mandatory')
tcpipTrapIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipTrapIndex.setStatus('mandatory')
tcpipTrapDestination = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipTrapDestination.setStatus('optional')
tcpipProtocolTrapMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipProtocolTrapMask.setStatus('optional')
tcpipPrinterTrapMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipPrinterTrapMask.setStatus('optional')
tcpipOutputTrapMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 10, 1, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipOutputTrapMask.setStatus('optional')
tcpipBanners = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipBanners.setStatus('optional')
tcpipWinsAddress = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 12), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWinsAddress.setStatus('optional')
tcpipWinsAddressSource = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("dhcp", 1), ("permanent", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWinsAddressSource.setStatus('optional')
tcpipConfigPassword = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(5, 24))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipConfigPassword.setStatus('optional')
tcpipTimeoutCheckingValue = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipTimeoutCheckingValue.setStatus('optional')
tcpipArpInterval = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 30))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipArpInterval.setStatus('optional')
tcpipRawPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 17), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipRawPortNumber.setStatus('optional')
tcpipNumSecurity = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipNumSecurity.setStatus('mandatory')
tcpipSecurityTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19), )
if mibBuilder.loadTexts: tcpipSecurityTable.setStatus('mandatory')
tcpipSecurityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19, 1), ).setIndexNames((0, "ESI-MIB", "tcpipSecurityIndex"))
if mibBuilder.loadTexts: tcpipSecurityEntry.setStatus('mandatory')
tcpipSecurityIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipSecurityIndex.setStatus('mandatory')
tcpipSecureStartIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSecureStartIPAddress.setStatus('optional')
tcpipSecureEndIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19, 1, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSecureEndIPAddress.setStatus('optional')
tcpipSecurePrinterMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSecurePrinterMask.setStatus('optional')
tcpipSecureAdminEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 19, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSecureAdminEnabled.setStatus('optional')
tcpipLowBandwidth = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipLowBandwidth.setStatus('optional')
tcpipNumLogicalPrinters = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 21), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipNumLogicalPrinters.setStatus('mandatory')
tcpipMLPTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22), )
if mibBuilder.loadTexts: tcpipMLPTable.setStatus('mandatory')
tcpipMLPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1), ).setIndexNames((0, "ESI-MIB", "tcpipMLPIndex"))
if mibBuilder.loadTexts: tcpipMLPEntry.setStatus('mandatory')
tcpipMLPIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipMLPIndex.setStatus('optional')
tcpipMLPName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipMLPName.setStatus('optional')
tcpipMLPPort = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipMLPPort.setStatus('optional')
tcpipMLPTCPPort = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipMLPTCPPort.setStatus('optional')
tcpipMLPPreString = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipMLPPreString.setStatus('optional')
tcpipMLPPostString = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipMLPPostString.setStatus('optional')
tcpipMLPDeleteBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 22, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipMLPDeleteBytes.setStatus('optional')
tcpipSmtpServerAddr = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 23), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSmtpServerAddr.setStatus('optional')
tcpipNumSmtpDestinations = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 24), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipNumSmtpDestinations.setStatus('mandatory')
tcpipSmtpTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25), )
if mibBuilder.loadTexts: tcpipSmtpTable.setStatus('mandatory')
tcpipSmtpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25, 1), ).setIndexNames((0, "ESI-MIB", "tcpipSmtpIndex"))
if mibBuilder.loadTexts: tcpipSmtpEntry.setStatus('mandatory')
tcpipSmtpIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipSmtpIndex.setStatus('mandatory')
tcpipSmtpEmailAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSmtpEmailAddr.setStatus('optional')
tcpipSmtpProtocolMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSmtpProtocolMask.setStatus('optional')
tcpipSmtpPrinterMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSmtpPrinterMask.setStatus('optional')
tcpipSmtpOutputMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 25, 1, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipSmtpOutputMask.setStatus('optional')
tcpipWebAdminName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 26), OctetString().subtype(subtypeSpec=ValueSizeConstraint(25, 25)).setFixedLength(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebAdminName.setStatus('optional')
tcpipWebAdminPassword = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 27), OctetString().subtype(subtypeSpec=ValueSizeConstraint(25, 25)).setFixedLength(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebAdminPassword.setStatus('optional')
tcpipWebUserName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 28), OctetString().subtype(subtypeSpec=ValueSizeConstraint(25, 25)).setFixedLength(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebUserName.setStatus('optional')
tcpipWebUserPassword = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 29), OctetString().subtype(subtypeSpec=ValueSizeConstraint(25, 25)).setFixedLength(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebUserPassword.setStatus('optional')
tcpipWebHtttpPort = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 30), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebHtttpPort.setStatus('optional')
tcpipWebFaqURL = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 31), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebFaqURL.setStatus('optional')
tcpipWebUpdateURL = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 32), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebUpdateURL.setStatus('optional')
tcpipWebCustomLinkName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 33), OctetString().subtype(subtypeSpec=ValueSizeConstraint(25, 25)).setFixedLength(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebCustomLinkName.setStatus('optional')
tcpipWebCustomLinkURL = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 34), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipWebCustomLinkURL.setStatus('optional')
tcpipPOP3ServerAddress = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 35), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipPOP3ServerAddress.setStatus('optional')
tcpipPOP3PollInterval = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 36), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipPOP3PollInterval.setStatus('mandatory')
tcpipPOP3UserName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 37), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipPOP3UserName.setStatus('optional')
tcpipPOP3Password = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 38), OctetString().subtype(subtypeSpec=ValueSizeConstraint(20, 20)).setFixedLength(20)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipPOP3Password.setStatus('optional')
tcpipDomainName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 4, 39), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tcpipDomainName.setStatus('optional')
tcpipError = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 5, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 80))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipError.setStatus('optional')
tcpipDisplayMask = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tcpipDisplayMask.setStatus('mandatory')
nwGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwGroupVersion.setStatus('mandatory')
nwEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwEnabled.setStatus('optional')
nwRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwRestoreDefaults.setStatus('optional')
nwFirmwareUpgrade = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwFirmwareUpgrade.setStatus('optional')
nwFrameFormat = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("ethernet-II", 2), ("ethernet-802-3", 3), ("ethernet-802-2", 4), ("ethernet-Snap", 5), ("token-Ring", 6), ("token-Ring-Snap", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwFrameFormat.setStatus('optional')
nwSetFrameFormat = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("auto-Sense", 1), ("forced-Ethernet-II", 2), ("forced-Ethernet-802-3", 3), ("forced-Ethernet-802-2", 4), ("forced-Ethernet-Snap", 5), ("forced-Token-Ring", 6), ("forced-Token-Ring-Snap", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwSetFrameFormat.setStatus('optional')
nwMode = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("pserver", 2), ("rprinter", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwMode.setStatus('optional')
nwPrintServerName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 47))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPrintServerName.setStatus('optional')
nwPrintServerPassword = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 9))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPrintServerPassword.setStatus('optional')
nwQueueScanTime = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwQueueScanTime.setStatus('optional')
nwNetworkNumber = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwNetworkNumber.setStatus('optional')
nwMaxFileServers = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwMaxFileServers.setStatus('optional')
nwFileServerTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 9), )
if mibBuilder.loadTexts: nwFileServerTable.setStatus('optional')
nwFileServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 9, 1), ).setIndexNames((0, "ESI-MIB", "nwFileServerIndex"))
if mibBuilder.loadTexts: nwFileServerEntry.setStatus('optional')
nwFileServerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 9, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwFileServerIndex.setStatus('optional')
nwFileServerName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 9, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 47))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwFileServerName.setStatus('optional')
nwFileServerConnectionStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 9, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 258, 261, 276, 512, 515, 768, 769, 32767))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("startupInProgress", 3), ("serverReattaching", 4), ("serverNeverAttached", 5), ("pse-UNKNOWN-FILE-SERVER", 258), ("pse-NO-RESPONSE", 261), ("pse-CANT-LOGIN", 276), ("pse-NO-SUCH-QUEUE", 512), ("pse-UNABLE-TO-ATTACH-TO-QUEUE", 515), ("bad-CONNECTION", 768), ("bad-SERVICE-CONNECTION", 769), ("other", 32767)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwFileServerConnectionStatus.setStatus('optional')
nwPortTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10), )
if mibBuilder.loadTexts: nwPortTable.setStatus('optional')
nwPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1), ).setIndexNames((0, "ESI-MIB", "nwPortIndex"))
if mibBuilder.loadTexts: nwPortEntry.setStatus('optional')
nwPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwPortIndex.setStatus('optional')
nwPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 80))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwPortStatus.setStatus('optional')
nwPortPrinterNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortPrinterNumber.setStatus('optional')
nwPortFontDownload = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("disabled", 1), ("enabled-No-Power-Sense", 2), ("enabled-Power-Sense", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortFontDownload.setStatus('optional')
nwPortPCLQueue = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 47))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortPCLQueue.setStatus('optional')
nwPortPSQueue = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 47))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortPSQueue.setStatus('optional')
nwPortFormsOn = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortFormsOn.setStatus('optional')
nwPortFormNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortFormNumber.setStatus('optional')
nwPortNotification = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 10, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPortNotification.setStatus('optional')
nwNumTraps = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwNumTraps.setStatus('mandatory')
nwTrapTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12), )
if mibBuilder.loadTexts: nwTrapTable.setStatus('mandatory')
nwTrapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1), ).setIndexNames((0, "ESI-MIB", "nwTrapIndex"))
if mibBuilder.loadTexts: nwTrapEntry.setStatus('mandatory')
nwTrapIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwTrapIndex.setStatus('mandatory')
nwTrapDestination = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwTrapDestination.setStatus('optional')
nwTrapDestinationNet = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwTrapDestinationNet.setStatus('mandatory')
nwProtocolTrapMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwProtocolTrapMask.setStatus('optional')
nwPrinterTrapMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1, 5), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwPrinterTrapMask.setStatus('optional')
nwOutputTrapMask = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 12, 1, 6), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwOutputTrapMask.setStatus('optional')
nwNDSPrintServerName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 512))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwNDSPrintServerName.setStatus('optional')
nwNDSPreferredDSTree = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 47))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwNDSPreferredDSTree.setStatus('optional')
nwNDSPreferredDSFileServer = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 15), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 47))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwNDSPreferredDSFileServer.setStatus('optional')
nwNDSPacketCheckSumEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 16), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwNDSPacketCheckSumEnabled.setStatus('optional')
nwNDSPacketSignatureLevel = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 17), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwNDSPacketSignatureLevel.setStatus('optional')
nwAvailablePrintModes = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwAvailablePrintModes.setStatus('optional')
nwDirectPrintEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwDirectPrintEnabled.setStatus('optional')
nwJAConfig = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwJAConfig.setStatus('optional')
nwDisableSAP = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 4, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nwDisableSAP.setStatus('optional')
nwError = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 5, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 160))).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwError.setStatus('optional')
nwDisplayMask = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 2, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nwDisplayMask.setStatus('mandatory')
bvGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvGroupVersion.setStatus('mandatory')
bvEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvEnabled.setStatus('optional')
bvRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvRestoreDefaults.setStatus('optional')
bvFirmwareUpgrade = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvFirmwareUpgrade.setStatus('optional')
bvSetSequenceRouting = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 3, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("automatic-Routing", 1), ("force-Sequenced-Routing", 2), ("force-Non-Sequenced-Routing", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvSetSequenceRouting.setStatus('optional')
bvDisableVPMan = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 3, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvDisableVPMan.setStatus('optional')
bvLoginName = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(5, 63))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvLoginName.setStatus('optional')
bvLoginPassword = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvLoginPassword.setStatus('optional')
bvNumberPrintServices = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvNumberPrintServices.setStatus('optional')
bvPrintServiceTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 4), )
if mibBuilder.loadTexts: bvPrintServiceTable.setStatus('optional')
bvPrintServiceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 4, 1), ).setIndexNames((0, "ESI-MIB", "bvPrintServiceIndex"))
if mibBuilder.loadTexts: bvPrintServiceEntry.setStatus('optional')
bvPrintServiceIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvPrintServiceIndex.setStatus('optional')
bvPrintServiceName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 4, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 63))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvPrintServiceName.setStatus('optional')
bvPrintServiceRouting = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 4, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvPrintServiceRouting.setStatus('optional')
bvPnicDescription = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 4, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: bvPnicDescription.setStatus('optional')
bvError = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 48))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvError.setStatus('optional')
bvRouting = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 32766, 32767))).clone(namedValues=NamedValues(("sequenced-Routing", 1), ("non-Sequenced-Routing", 2), ("unknown-Routing", 32766), ("protocol-Disabled", 32767)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvRouting.setStatus('optional')
bvNumPrintServices = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvNumPrintServices.setStatus('optional')
bvPrintServiceStatusTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4), )
if mibBuilder.loadTexts: bvPrintServiceStatusTable.setStatus('optional')
bvPrintServiceStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1), ).setIndexNames((0, "ESI-MIB", "bvPSStatusIndex"))
if mibBuilder.loadTexts: bvPrintServiceStatusEntry.setStatus('optional')
bvPSStatusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvPSStatusIndex.setStatus('optional')
bvPSName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 63))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvPSName.setStatus('optional')
bvPSStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 48))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvPSStatus.setStatus('optional')
bvPSDestination = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvPSDestination.setStatus('optional')
bvPrinterStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 80))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvPrinterStatus.setStatus('optional')
bvJobActive = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvJobActive.setStatus('optional')
bvJobSource = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvJobSource.setStatus('optional')
bvJobTitle = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvJobTitle.setStatus('optional')
bvJobSize = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 9))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvJobSize.setStatus('optional')
bvJobNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 3, 5, 4, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 4))).setMaxAccess("readonly")
if mibBuilder.loadTexts: bvJobNumber.setStatus('optional')
lmGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 4, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: lmGroupVersion.setStatus('mandatory')
lmEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 4, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: lmEnabled.setStatus('optional')
eTalkGroupVersion = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkGroupVersion.setStatus('mandatory')
eTalkEnabled = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkEnabled.setStatus('optional')
eTalkRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkRestoreDefaults.setStatus('optional')
eTalkNetwork = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkNetwork.setStatus('optional')
eTalkNode = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 1)).setFixedLength(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkNode.setStatus('optional')
eTalkNumPorts = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkNumPorts.setStatus('optional')
eTalkPortTable = MibTable((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4), )
if mibBuilder.loadTexts: eTalkPortTable.setStatus('optional')
eTalkPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1), ).setIndexNames((0, "ESI-MIB", "eTalkPortIndex"))
if mibBuilder.loadTexts: eTalkPortEntry.setStatus('optional')
eTalkPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkPortIndex.setStatus('optional')
eTalkPortEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkPortEnable.setStatus('optional')
eTalkName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkName.setStatus('optional')
eTalkActiveName = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkActiveName.setStatus('optional')
eTalkType1 = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkType1.setStatus('optional')
eTalkType2 = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkType2.setStatus('optional')
eTalkZone = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eTalkZone.setStatus('optional')
eTalkActiveZone = MibTableColumn((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 4, 4, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkActiveZone.setStatus('optional')
eTalkError = MibScalar((1, 3, 6, 1, 4, 1, 683, 6, 3, 5, 5, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 80))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eTalkError.setStatus('optional')
trapPrinterOnline = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,1)).setObjects(("ESI-MIB", "outputIndex"))
trapPrinterOffline = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,2)).setObjects(("ESI-MIB", "outputIndex"))
trapNoPrinterAttached = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,3)).setObjects(("ESI-MIB", "outputIndex"))
trapPrinterTonerLow = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,4)).setObjects(("ESI-MIB", "outputIndex"))
trapPrinterPaperOut = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,5)).setObjects(("ESI-MIB", "outputIndex"))
trapPrinterPaperJam = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,6)).setObjects(("ESI-MIB", "outputIndex"))
trapPrinterDoorOpen = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,7)).setObjects(("ESI-MIB", "outputIndex"))
trapPrinterError = NotificationType((1, 3, 6, 1, 4, 1, 683, 6) + (0,16)).setObjects(("ESI-MIB", "outputIndex"))
mibBuilder.exportSymbols("ESI-MIB", genNumProtocols=genNumProtocols, tcpipSmtpServerAddr=tcpipSmtpServerAddr, outputStopBits=outputStopBits, genSerialNumber=genSerialNumber, tcpipWebUserName=tcpipWebUserName, nwGroupVersion=nwGroupVersion, outputPrinterDisplay=outputPrinterDisplay, cmdRestoreDefaults=cmdRestoreDefaults, tcpipArpInterval=tcpipArpInterval, genSysUpTimeString=genSysUpTimeString, tcpipSecureStartIPAddress=tcpipSecureStartIPAddress, tokenRing=tokenRing, outputConfigure=outputConfigure, outputJobLogInformation=outputJobLogInformation, tcpipConfigPassword=tcpipConfigPassword, tcpipMLPTable=tcpipMLPTable, tcpipSmtpOutputMask=tcpipSmtpOutputMask, driverGroupVersion=driverGroupVersion, tcpipSmtpPrinterMask=tcpipSmtpPrinterMask, trapPrinterTonerLow=trapPrinterTonerLow, lmGroupVersion=lmGroupVersion, tcpipNumSecurity=tcpipNumSecurity, outputTotalJobEntry=outputTotalJobEntry, commands=commands, tcpipSmtpTable=tcpipSmtpTable, snmpGroupVersion=snmpGroupVersion, psOutput=psOutput, tcpipSecureEndIPAddress=tcpipSecureEndIPAddress, tcpipPOP3UserName=tcpipPOP3UserName, genProtocolEntry=genProtocolEntry, tcpipPrinterTrapMask=tcpipPrinterTrapMask, tcpipPOP3Password=tcpipPOP3Password, cmdReset=cmdReset, cmdPrintConfig=cmdPrintConfig, outputPrinter=outputPrinter, trEarlyTokenRelease=trEarlyTokenRelease, nwCommands=nwCommands, tcpipDomainName=tcpipDomainName, nwFirmwareUpgrade=nwFirmwareUpgrade, bvPrintServiceName=bvPrintServiceName, driverTXPacketErrors=driverTXPacketErrors, outputPrinterModel=outputPrinterModel, nwFileServerConnectionStatus=nwFileServerConnectionStatus, nwFileServerIndex=nwFileServerIndex, eTalkPortIndex=eTalkPortIndex, tcpipTrapDestination=tcpipTrapDestination, outputCommandsTable=outputCommandsTable, nwNumTraps=nwNumTraps, genProtocolIndex=genProtocolIndex, nwEnabled=nwEnabled, eTalk=eTalk, nwFileServerTable=nwFileServerTable, bvPrintServiceEntry=bvPrintServiceEntry, nwNDSPacketSignatureLevel=nwNDSPacketSignatureLevel, nwNDSPacketCheckSumEnabled=nwNDSPacketCheckSumEnabled, eTalkEnabled=eTalkEnabled, outputCommands=outputCommands, nwDirectPrintEnabled=nwDirectPrintEnabled, psGroupVersion=psGroupVersion, bvPrintServiceRouting=bvPrintServiceRouting, eTalkActiveName=eTalkActiveName, outputCommandsEntry=outputCommandsEntry, nwTrapEntry=nwTrapEntry, nwNDSPreferredDSFileServer=nwNDSPreferredDSFileServer, tcpipGroupVersion=tcpipGroupVersion, tcpipSecurePrinterMask=tcpipSecurePrinterMask, bvPSName=bvPSName, tcpipWinsAddress=tcpipWinsAddress, eTalkName=eTalkName, tcpipIPAddress=tcpipIPAddress, genCableType=genCableType, nwTrapTable=nwTrapTable, trapPrinterPaperOut=trapPrinterPaperOut, trRestoreDefaults=trRestoreDefaults, tcpipTimeoutCheckingValue=tcpipTimeoutCheckingValue, bvLoginName=bvLoginName, outputGroupVersion=outputGroupVersion, trPriority=trPriority, tcpipMLPName=tcpipMLPName, outputJobLogTable=outputJobLogTable, genCompanyTechSupport=genCompanyTechSupport, tcpipWebHtttpPort=tcpipWebHtttpPort, printServers=printServers, outputDataBits=outputDataBits, nwPrinterTrapMask=nwPrinterTrapMask, genCompanyLoc=genCompanyLoc, eTalkCommands=eTalkCommands, nwAvailablePrintModes=nwAvailablePrintModes, bvFirmwareUpgrade=bvFirmwareUpgrade, bvPrinterStatus=bvPrinterStatus, trapPrinterPaperJam=trapPrinterPaperJam, nwPortPSQueue=nwPortPSQueue, nwNetworkNumber=nwNetworkNumber, nwPortPrinterNumber=nwPortPrinterNumber, outputNumPorts=outputNumPorts, bvPSStatus=bvPSStatus, genCompanyName=genCompanyName, tcpipBanners=tcpipBanners, tcpipSecurityEntry=tcpipSecurityEntry, tcpipMLPTCPPort=tcpipMLPTCPPort, nwProtocolTrapMask=nwProtocolTrapMask, outputTable=outputTable, nwMaxFileServers=nwMaxFileServers, bvPrintServiceIndex=bvPrintServiceIndex, tcpipNumSmtpDestinations=tcpipNumSmtpDestinations, bvJobSource=bvJobSource, tcpip=tcpip, tcpipMLPPreString=tcpipMLPPreString, bvPrintServiceStatusTable=bvPrintServiceStatusTable, eTalkGroupVersion=eTalkGroupVersion, genProductNumber=genProductNumber, outputConfigLanguage=outputConfigLanguage, tcpipWebUpdateURL=tcpipWebUpdateURL, tcpipTrapTable=tcpipTrapTable, driverChecksumErrors=driverChecksumErrors, outputCancelCurrentJob=outputCancelCurrentJob, tcpipSubnetMask=tcpipSubnetMask, outputBIDIStatusEnabled=outputBIDIStatusEnabled, tcpipSmtpProtocolMask=tcpipSmtpProtocolMask, snmpSetCommunityName=snmpSetCommunityName, nwPortFormsOn=nwPortFormsOn, outputTotalJobsLogged=outputTotalJobsLogged, eTalkNumPorts=eTalkNumPorts, nwQueueScanTime=nwQueueScanTime, nwPortFormNumber=nwPortFormNumber, genProductName=genProductName, psJetAdminEnabled=psJetAdminEnabled, tcpipSecureAdminEnabled=tcpipSecureAdminEnabled, nwTrapDestinationNet=nwTrapDestinationNet, tcpipMLPIndex=tcpipMLPIndex, tcpipMLPDeleteBytes=tcpipMLPDeleteBytes, esiSNMPCommands=esiSNMPCommands, driver=driver, bvJobTitle=bvJobTitle, bvSetSequenceRouting=bvSetSequenceRouting, bvStatus=bvStatus, outputDisplayMask=outputDisplayMask, tcpipPOP3PollInterval=tcpipPOP3PollInterval, vines=vines, genGroupVersion=genGroupVersion, outputOwner=outputOwner, nwFileServerName=nwFileServerName, tcpipWinsAddressSource=tcpipWinsAddressSource, bvRestoreDefaults=bvRestoreDefaults, nwPortTable=nwPortTable, trapPrinterOnline=trapPrinterOnline, trGroupVersion=trGroupVersion, tcpipNumLogicalPrinters=tcpipNumLogicalPrinters, tcpipBootProtocolsEnabled=tcpipBootProtocolsEnabled, nwFileServerEntry=nwFileServerEntry, outputAvailableTrapsMask=outputAvailableTrapsMask, trapPrinterDoorOpen=trapPrinterDoorOpen, nwTrapDestination=nwTrapDestination, eTalkError=eTalkError, tcpipSmtpEmailAddr=tcpipSmtpEmailAddr, outputEntry=outputEntry, nwPortStatus=nwPortStatus, outputPSString=outputPSString, snmpRestoreDefaults=snmpRestoreDefaults, outputParity=outputParity, tcpipConfigure=tcpipConfigure, tcpipEnabled=tcpipEnabled, tcpipNumTraps=tcpipNumTraps, outputIndex=outputIndex, nwTrapIndex=nwTrapIndex, bvLoginPassword=bvLoginPassword, eTalkRestoreDefaults=eTalkRestoreDefaults, tcpipTrapIndex=tcpipTrapIndex, nwPortEntry=nwPortEntry, tcpipSmtpIndex=tcpipSmtpIndex, snmpGetCommunityName=snmpGetCommunityName, bvNumPrintServices=bvNumPrintServices, general=general, eTalkType1=eTalkType1, bvPrintServiceStatusEntry=bvPrintServiceStatusEntry, esiSNMP=esiSNMP, tcpipTrapEntry=tcpipTrapEntry, nwPortIndex=nwPortIndex, nwPortNotification=nwPortNotification, genConfigurationDirty=genConfigurationDirty, eTalkPortEnable=eTalkPortEnable, tcpipDefaultGateway=tcpipDefaultGateway, tcpipDisplayMask=tcpipDisplayMask, outputRestoreDefaults=outputRestoreDefaults, bvJobNumber=bvJobNumber, tcpipUsingNetProtocols=tcpipUsingNetProtocols, nwMode=nwMode, bvDisableVPMan=bvDisableVPMan, nwPortFontDownload=nwPortFontDownload, driverTXPackets=driverTXPackets, tcpipMLPEntry=tcpipMLPEntry, tcpipWebFaqURL=tcpipWebFaqURL, tcpipWebAdminPassword=tcpipWebAdminPassword, tcpipSecurityTable=tcpipSecurityTable, eTalkZone=eTalkZone, trLocallyAdminAddr=trLocallyAdminAddr, tcpipCommands=tcpipCommands, tcpipIPAddressSource=tcpipIPAddressSource, nwError=nwError, lmEnabled=lmEnabled, genProtocolTable=genProtocolTable, outputJobLogTime=outputJobLogTime, nwPortPCLQueue=nwPortPCLQueue, outputJobLogEntry=outputJobLogEntry, tcpipTimeoutChecking=tcpipTimeoutChecking, eTalkActiveZone=eTalkActiveZone, eTalkNode=eTalkNode, tcpipSecurityIndex=tcpipSecurityIndex, outputProtocolManager=outputProtocolManager, tcpipProtocolTrapMask=tcpipProtocolTrapMask, tcpipSmtpEntry=tcpipSmtpEntry, outputStatus=outputStatus, driverRXPacketErrors=driverRXPacketErrors, trRouting=trRouting, tcpipStatus=tcpipStatus, cmdGroupVersion=cmdGroupVersion, nwConfigure=nwConfigure, trPacketSize=trPacketSize, tcpipRestoreDefaults=tcpipRestoreDefaults, nwJAConfig=nwJAConfig, eTalkPortTable=eTalkPortTable, nwFrameFormat=nwFrameFormat, psVerifyConfiguration=psVerifyConfiguration, tcpipWebUserPassword=tcpipWebUserPassword, netware=netware, driverTXPacketRetries=driverTXPacketRetries, outputSetting=outputSetting, bvJobActive=bvJobActive, tcpipWebCustomLinkName=tcpipWebCustomLinkName, tcpipMLPPostString=tcpipMLPPostString, lanManager=lanManager, esi=esi, trapPrinterError=trapPrinterError, outputExtendedStatus=outputExtendedStatus, outputBaudRate=outputBaudRate, genCompanyPhone=genCompanyPhone, psGeneral=psGeneral, outputName=outputName, tcpipOutputTrapMask=tcpipOutputTrapMask, trConfigure=trConfigure, bvGroupVersion=bvGroupVersion, tcpipWebAdminName=tcpipWebAdminName, psProtocols=psProtocols, eTalkStatus=eTalkStatus, nwDisplayMask=nwDisplayMask, outputLanguageSwitching=outputLanguageSwitching, nwPrintServerPassword=nwPrintServerPassword, bvEnabled=bvEnabled, bvPSDestination=bvPSDestination, bvError=bvError, eTalkPortEntry=eTalkPortEntry, driverRXPackets=driverRXPackets, trapPrinterOffline=trapPrinterOffline, tcpipIPAddressServerAddress=tcpipIPAddressServerAddress)
mibBuilder.exportSymbols("ESI-MIB", nwRestoreDefaults=nwRestoreDefaults, genProtocolID=genProtocolID, outputPCLString=outputPCLString, eTalkType2=eTalkType2, trCommands=trCommands, tcpipError=tcpipError, outputHandshake=outputHandshake, tcpipPOP3ServerAddress=tcpipPOP3ServerAddress, nwSetFrameFormat=nwSetFrameFormat, outputTotalJobIndex=outputTotalJobIndex, bvRouting=bvRouting, genHWAddress=genHWAddress, outputJobLog=outputJobLog, outputStatusString=outputStatusString, outputTotalJobTable=outputTotalJobTable, trapNoPrinterAttached=trapNoPrinterAttached, outputCascaded=outputCascaded, tcpipMLPPort=tcpipMLPPort, bvConfigure=bvConfigure, bvPSStatusIndex=bvPSStatusIndex, tcpipFirmwareUpgrade=tcpipFirmwareUpgrade, nwNDSPrintServerName=nwNDSPrintServerName, tcpipLowBandwidth=tcpipLowBandwidth, bvJobSize=bvJobSize, nwPrintServerName=nwPrintServerName, driverRXPacketsUnavailable=driverRXPacketsUnavailable, nwNDSPreferredDSTree=nwNDSPreferredDSTree, genMIBVersion=genMIBVersion, genProtocols=genProtocols, genDateCode=genDateCode, snmpTrapCommunityName=snmpTrapCommunityName, outputNumLogEntries=outputNumLogEntries, bvPrintServiceTable=bvPrintServiceTable, genProtocolDescr=genProtocolDescr, bvNumberPrintServices=bvNumberPrintServices, nwDisableSAP=nwDisableSAP, tcpipWebCustomLinkURL=tcpipWebCustomLinkURL, eTalkNetwork=eTalkNetwork, genVersion=genVersion, eTalkConfigure=eTalkConfigure, outputCapabilities=outputCapabilities, bvPnicDescription=bvPnicDescription, tcpipRawPortNumber=tcpipRawPortNumber, nwOutputTrapMask=nwOutputTrapMask, nwStatus=nwStatus, bvCommands=bvCommands)
|
# Copyright 2018 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
doc="range"
a = range(255)
b = [e for e in a]
assert len(a) == len(b)
a = range(5, 100, 5)
b = [e for e in a]
assert len(a) == len(b)
a = range(100 ,0, 1)
b = [e for e in a]
assert len(a) == len(b)
a = range(100, 0, -1)
b = [e for e in a]
assert len(a) == 100
assert len(b) == 100
doc="range_get_item"
a = range(3)
assert a[2] == 2
assert a[1] == 1
assert a[0] == 0
assert a[-1] == 2
assert a[-2] == 1
assert a[-3] == 0
b = range(0, 10, 2)
assert b[4] == 8
assert b[3] == 6
assert b[2] == 4
assert b[1] == 2
assert b[0] == 0
assert b[-4] == 2
assert b[-3] == 4
assert b[-2] == 6
assert b[-1] == 8
doc="range_eq"
assert range(10) == range(0, 10)
assert not range(10) == 3
assert range(20) != range(10)
assert range(100, 200, 1) == range(100, 200)
assert range(0, 10, 3) == range(0, 12, 3)
assert range(2000, 100) == range(3, 1)
assert range(0, 10, -3) == range(0, 12, -3)
assert not range(0, 20, 2) == range(0, 20, 4)
try:
range('3', 10) == range(2)
except TypeError:
pass
else:
assert False, "TypeError not raised"
doc="range_ne"
assert range(10, 0, -3) != range(12, 0, -3)
assert range(10) != 3
assert not range(100, 200, 1) != range(100, 200)
assert range(0, 10) != range(0, 12)
assert range(0, 10) != range(0, 10, 2)
assert range(0, 20, 2) != range(0, 21, 2)
assert range(0, 20, 2) != range(0, 20, 4)
assert not range(0, 20, 3) != range(0, 20, 3)
try:
range('3', 10) != range(2)
except TypeError:
pass
else:
assert False, "TypeError not raised"
doc="range_str"
assert str(range(10)) == 'range(0, 10)'
assert str(range(10, 0, 3)) == 'range(10, 0, 3)'
assert str(range(0, 3)) == 'range(0, 3)'
assert str(range(10, 3, -2)) == 'range(10, 3, -2)'
doc="finished"
|
def selectionsort(arr):
i=0
while(i<len(arr)):
#find index of minimum number between index i and index n-1 where n=len(arr)
num,ind=arr[i],i
for j in range(i+1,len(arr)):
if(arr[j]<num):
num=arr[j]
ind=j
#swap number at ind with number at i
temp=arr[i]
arr[i]=arr[ind]
arr[ind]=temp
i+=1
return arr
def main():
arr = [9,7,4,3,1,5,3,6,7,0]
sorted_arr = selectionsort(arr)
print(sorted_arr)
if __name__ == "__main__":
main()
|
__title__ = 'road-surface-detection'
__version__ = '0.0.0'
__author__ = 'Esri Advanced Analytics Team'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2020 by Esri Advanced Analytics Team'
# add specific imports below if you want more control over what is visible
## from . import utils
|
ImgHeight = 32
data_roots = {
'iam_word': '/mydrive/MyDrive/khoa_luan/khoa_luan/data/'
}
data_paths = {
'iam_word': {'trnval': 'trnvalset_words%d.hdf5'%ImgHeight,
'test': 'testset_words%d.hdf5'%ImgHeight},
'iam_word_org': {'trnval': 'trnvalset_words%d_OrgSz.hdf5'%ImgHeight,
'test': 'testset_words%d_OrgSz.hdf5'%ImgHeight}
}
|
# vim: set fileencoding=<utf-8> :
# Copyright 2018-2020 John Lees and Nick Croucher
'''PopPUNK (POPulation Partitioning Using Nucleotide Kmers)'''
__version__ = '2.2.1'
|
n=int(input())
a=list(map(int,input().split()))
a.sort()
l=list(set(a))
k=l[0]
i=0
c=0
while(i!=n and k<=max(l)):
if(k==l[i]):
k=k+1
i=i+1
c=c+1
else:
break
print(c)
|
#Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the #node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, #you should return NULL.
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def searchBST(self, root: TreeNode, val: int) -> TreeNode:
if not root:
return None
while root:
if root.val == val:
return root
elif val < root.val:
root = root.left
else:
root = root.right
return None
|
# Purpose: Grouping entities by DXF attributes or a key function.
# Created: 03.02.2017
# Copyright (C) 2017, Manfred Moitzi
# License: MIT License
def groupby(entities, dxfattrib='', key=None):
"""
Groups a sequence of DXF entities by an DXF attribute like 'layer', returns the result as dict. Just specify
argument `dxfattrib` OR a `key` function.
Args:
entities: sequence of DXF entities to group by a key
dxfattrib: grouping DXF attribute like 'layer'
key: key function, which accepts a DXFEntity as argument, returns grouping key of this entity or None for ignore
this object. Reason for ignoring: a queried DXF attribute is not supported by this entity
Returns:
dict
"""
if all((dxfattrib, key)):
raise ValueError('Specify a dxfattrib or a key function, but not both.')
if dxfattrib != '':
key = lambda entity: entity.get_dxf_attrib(dxfattrib, None)
if key is None:
raise ValueError('no valid argument found, specify a dxfattrib or a key function, but not both.')
result = dict()
for dxf_entity in entities:
try:
group_key = key(dxf_entity)
except AttributeError: # ignore DXF entities, which do not support all query attributes
continue
if group_key is not None:
group = result.setdefault(group_key, [])
group.append(dxf_entity)
return result
|
def find_pivot_index(nums):
"""
Suppose a sorted array A 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).
Find the minimum element. NOTE: The array will not contain duplicates.
"""
min_num = nums[0]
pivot_index = 0
left = 0
right = len(nums) - 1
if left == right:
return pivot_index, nums[pivot_index]
while left <= right:
mid = (left + right) // 2
print(nums[mid])
if min_num > nums[mid]:
min_num = nums[mid]
pivot_index = mid
right = mid - 1
else:
left = mid + 1
return pivot_index, min_num
def find_pivot_index_in_duplicates(nums):
"""
Suppose a sorted array A 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).
Find the minimum element. NOTE: The array will contain duplicates.
"""
min_num = nums[0]
pivot_index = 0
left = 0
right = len(nums) - 1
if left == right:
return pivot_index, nums[pivot_index]
while left <= right:
mid = (left + right) // 2
print(nums[mid], mid)
if min_num > nums[mid]:
min_num = nums[mid]
pivot_index = mid
right = mid - 1
# elif min_num == nums[mid]:
# # continue
else:
left = mid + 1
return pivot_index, min_num
# nums = [4, 5, 6, 7, 0, 1, 2]
nums = [10, 10, 10, 10, 1]
single = [5, 5, 5, 5, 3]
result = find_pivot_index_in_duplicates(nums)
print(result)
|
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 19:55:42 2017
@author: Zachary
"""
aList = [[1,'a',['cat'],2],[[[3]],'dog'],4,5]
def flatten(aList):
flattenedList = []
for i in range(len(aList)):
listOne = aList[i]
if type(listOne) == list:
for k in range(len(listOne)):
listTwo = listOne[k]
if type(listTwo) == list:
for j in range(len(listTwo)):
listThree = listTwo[j]
if type(listThree) == list:
for z in range(len(listThree)):
listFour = listThree[z]
if type(listFour) == list:
flattenedList.append(listFour)
else:
flattenedList.append(listFour)
else:
flattenedList.append(listThree)
else:
flattenedList.append(listTwo)
else:
flattenedList.append(listOne)
return flattenedList
print(flatten(aList))
|
class ContainerAlreadyResolved(Exception):
def __init__(self):
super().__init__("Container already resolved can't be resolved again")
class ForbiddenChangeOnResolvedContainer(Exception):
def __init__(self):
super().__init__("Container can't be modified once resolved")
class ServiceAlreadyDefined(Exception):
def __init__(self, identifier: str):
self.identifier = identifier
super().__init__(
f"The service identified by {identifier} has already been defined in container"
)
class ServiceNotFoundInContainer(Exception):
def __init__(self, identifier: str):
self.identifier = identifier
super().__init__(
f"The service identified by {identifier} has not been defined in container"
)
class ServiceNotFoundFromFullyQualifiedName(Exception):
def __init__(self, fully_qualified_name: str):
self.fully_qualified_name = fully_qualified_name
super().__init__(
f"Container can't locate any class in {fully_qualified_name}"
)
class ServiceInstantiationFailed(Exception):
def __init__(self, service_fqn: str) -> None:
self.service_fqn = service_fqn
super().__init__(f"Type {service_fqn} cannot be instantiated by the container")
|
'''
We are given a list schedule of employees, which represents the working time for each employee.
Each employee has a list of non-overlapping Intervals, and these intervals are in sorted order.
Return the list of finite intervals representing common, positive-length free time for all employees, also in sorted order.
Example 1:
Input: schedule = [[[1,2],[5,6]],[[1,3]],[[4,10]]]
Output: [[3,4]]
Explanation:
There are a total of three employees, and all common
free time intervals would be [-inf, 1], [3, 4], [10, inf].
We discard any intervals that contain inf as they aren't finite.
Example 2:
Input: schedule = [[[1,3],[6,7]],[[2,4]],[[2,5],[9,12]]]
Output: [[5,6],[7,9]]
(Even though we are representing Intervals in the form [x, y], the objects inside are Intervals, not lists or arrays. For example, schedule[0][0].start = 1, schedule[0][0].end = 2, and schedule[0][0][0] is not defined.)
Also, we wouldn't include intervals like [5, 5] in our answer, as they have zero length.
Note:
schedule and schedule[i] are lists with lengths in range [1, 50].
0 <= schedule[i].start < schedule[i].end <= 10^8.
'''
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def employeeFreeTime(self, schedule):
"""
:type schedule: List[List[Interval]]
:rtype: List[Interval]
"""
intervals = []
for row in schedule:
intervals.extend(row)
intervals.sort(key = lambda x: (x.start, x.end))
busy = [intervals[0]]
for i in xrange(1, len(intervals)):
if busy[-1].end < intervals[i].start:
busy.append(intervals[i])
else:
busy[-1].end = max(busy[-1].end, intervals[i].end)
res = []
for i in xrange(len(busy)-1):
res.append(Interval(busy[i].end, busy[i+1].start))
return res
|
# from cf.util import read_train_data
# 1. 获取用户和用户之间的相似度
# 1.1 正常逻辑的用户相似度计算 jaccard distance=交集/并集
def user_normal_simmilarity(train_data):
# 相似度字典
w = dict()
# n^2*l^2 l < m
for u in train_data.keys():
if w.get(u, -1) == -1:
w[u] = dict()
for v in train_data.keys():
if u == v: continue
# 相似度计算,通过两个用户共同拥有的物品集合数量
w[u][v] = len(set(train_data[u]) & set(train_data[v])) # l < m l^2 # jaccard distance
w[u][v] = w[u][v] / (len(set(train_data[u]) | set(train_data[v])))
return w
# # print(w['196'])
# # 发现相似度为0的数据 '826': 0.0 O(n^2)
# print('all user cnt: ', len(w.keys()))
# print('user_196 sim user cnt: ', len(w['196']))
# print(sorted(w['196'].items(),key=lambda x:x[1],reverse=False)[:10])
# 1.2 优化计算用户与用户之间的相似度 user->item => item->user
# m*k^2+m*n m>n
def user_sim(train_data):
# 建立item->users的倒排表 n*m
item_users = dict()
for u, items in train_data.items(): # items item,rating n
for i in items.keys(): # m
if item_users.get(i, -1) == -1:
item_users[i] = set()
item_users[i].add(u)
# 计算共同的items数量
C = dict()
# m*k^2
for i, users in item_users.items(): # m
for u in users: # k<n
if C.get(u, -1) == -1:
C[u] = dict()
for v in users: # k<n
if u == v:
continue
if C[u].get(v, -1) == -1:
C[u][v] = 0
C[u][v] += 1
del item_users # 从内存中删除
for u,sim_users in C.items():
for v,cuv in sim_users.items():
C[u][v] = 2*C[u][v]/(float(len(train_data[u])+len(train_data[v])))
return C
# # print(C['196'])
# # 发现相似度为0的数据 '826': 0.0 O(n^2)
# print('all user cnt: ', len(C.keys()))
# print('user_196 sim user cnt: ', len(C['196']))
# print(sorted(C['196'].items(),key=lambda x:x[1],reverse=False)[:10])
# k=item_id v=score k:要获取的相似用户数量 C:相似用户矩阵
def recommend(user,train_data,C,k=5):
rank = dict()
# 用户之前评论过的电影
watched_items = train_data[user].keys()
# 取相似的k个用户的items
for v,cuv in sorted(C[user].items(),key=lambda x:x[1],reverse=True)[:k]:
# 取相似k个用户的items ②rating
for i,rating in train_data[v].items():
# 过滤掉已经评论过的电影(购买过的商品)
if i in watched_items:
continue
elif rank.get(i,-1) == -1:
rank[i] = 0
# 物品的打分是①用户相似度[0-1]*②用户相似用户对电影的打分[0-5]=[0-1]
# 相似用户评论了同一个物品是累加操作
rank[i] += cuv * rating
return rank
# if __name__ == '__main__':
# train_data = read_train_data()
# # user_normal_simmilarity(train_data)
# C = user_sim(train_data)
# user_id = '196'
# rank = recommend(user_id,train_data,C)
# print(sorted(rank.items(),key=lambda x:x[1],reverse=True)[:10])
|
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Callgraph helpers for ast nodes.
#
# AUTHOR Michal Bukovsky <michal.bukovsky@trilogic.cz>
#
class VariablesScope(object):
def __init__(self, ctx):
self.ctx, self.var_names = ctx, ctx.var_names.copy()
def __enter__(self):
return self
def __exit__(self, exp_type, exp_value, traceback):
for var_name in self.vars_in_scope(): self.ctx.scope.pop(var_name)
def freeze(self):
self.freezed_var_names = self.ctx.var_names.copy()
def vars_in_scope(self):
var_names = getattr(self, "freezed_var_names", self.ctx.var_names)
yield from var_names - self.var_names
class UniqueNameGenerator(object):
""" Generates unique names.
"""
counter = 0
def make_unique_name(self, prefix="unique_name"):
UniqueNameGenerator.counter += 1
return "{0}_{1}".format(prefix, UniqueNameGenerator.counter)
|
peso = float(input('Digite seu peso: [KG]'))
alt = float(input('Digite a altura: [m]'))
imc = peso / (alt**2)
print("IMC: {:.2f}".format(imc))
if imc < 18.5:
print("Abaixo do Peso!")
elif imc >= 18.5 and imc <= 25:
print("Você está no PESO IDEAL!")
elif 25.1 >= imc and imc <= 30:
print("Você está com SOBREPESO!")
elif imc >= 30.1 and imc <= 40:
print("Você está OBESO!")
else:
print('Você está com OBESIDADE MÓRBIDA!')
|
dna_to_rna_map = {
"G" : "C",
"C" : "G",
"T" : "A",
"A" : "U"
}
def to_rna(dna_strand):
return "".join([dna_to_rna_map[nuc] for nuc in dna_strand])
|
# Design a hit counter which counts the number of hits received in the past 5 minutes.
#
# Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made to the system in chronological order (ie, the timestamp is monotonically increasing). You may assume that the earliest timestamp starts at 1.
#
# It is possible that several hits arrive roughly at the same time.
#
# Example:
# HitCounter counter = new HitCounter();
#
# // hit at timestamp 1.
# counter.hit(1);
#
# // hit at timestamp 2.
# counter.hit(2);
#
# // hit at timestamp 3.
# counter.hit(3);
#
# // get hits at timestamp 4, should return 3.
# counter.getHits(4);
#
# // hit at timestamp 300.
# counter.hit(300);
#
# // get hits at timestamp 300, should return 4.
# counter.getHits(300);
#
# // get hits at timestamp 301, should return 3.
# counter.getHits(301);
# Follow up:
# What if the number of hits per second could be very large? Does your design scale?
class HitCounter(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.count = 0
self.queue = []
def hit(self, timestamp):
"""
Record a hit.
@param timestamp - The current timestamp (in seconds granularity).
:type timestamp: int
:rtype: void
"""
if not self.queue or self.queue[-1][0] != timestamp:
self.queue.append([timestamp,1])
else:
self.queue[-1][1] += 1
self.count += 1
def getHits(self, timestamp):
"""
Return the number of hits in the past 5 minutes.
@param timestamp - The current timestamp (in seconds granularity).
:type timestamp: int
:rtype: int
"""
# move forward
while self.queue and timestamp - self.queue[0][0] >= 300:
self.count -= self.queue.pop(0)[1]
return self.count
# Your HitCounter object will be instantiated and called as such:
# obj = HitCounter()
# obj.hit(timestamp)
# param_2 = obj.getHits(timestamp)
|
# Program untuk menampilkan belah ketupat
print('\n==========Belah Ketupat==========\n')
obj_1 = 1
for row_1 in range(6, 0, -1):
for col_1 in range(row_1):
print(' ', end='')
for print_obj_1 in range(obj_1):
print('#', end='')
obj_1+=2
if row_1 == 1:
obj_2 = 9
print('')
for row_2 in range(2, 6+1, 1):
for col_2 in range(row_2):
print(' ', end='')
for print_obj_2 in range(obj_2):
print('#', end='')
obj_2-=2
print('')
print('')
|
blocks = {
'CJK Unified Ideographs Extension A': (0x3400, 0x4DBF),
'CJK Unified Ideographs': (0x4E00, 0x9FFF),
'CJK Unified Ideographs Extension B': (0x20000, 0x2A6DF),
'CJK Unified Ideographs Extension C': (0x2A700, 0x2B73F),
'CJK Unified Ideographs Extension D': (0x2B740, 0x2B81F),
'CJK Unified Ideographs Extension E': (0x2B820, 0x2CEAF),
'CJK Unified Ideographs Extension F': (0x2CEB0, 0x2EBEF),
'CJK Unified Ideographs Extension G': (0x30000, 0x3134F),
}
for name, (start, end) in blocks.items():
with open(f'Tables/Character Sets/Unicode {name}.txt', 'w') as f:
f.writelines(chr(i) + '\n' for i in range(start, end + 1))
|
#app = faust.App('myapp', broker='kafka://localhost')
class QUANTAXIS_PUBSUBER():
def __init__(self, name, broker='rabbitmq://localhost'):
self.exchange = name
#@app.agent(value_type=Order)
def agent(value_type=order):
pass
|
class Util:
def __init__(self):
pass
@staticmethod
def compress_uri(uri, base_uri, prefix_map):
uri = uri.strip('<>')
if uri.startswith(base_uri):
return '<' + uri[len(base_uri):] + '>'
for prefix, prefix_uri in prefix_map.items():
if uri.startswith(prefix_uri):
return prefix + ':' + uri[len(prefix_uri):]
return uri
|
class Image(object):
"""Image.
:param src:
:type src: str
:param alt:
:type alt: str
"""
def __init__(self, data=None):
if data is None:
data = {}
self.src = data.get('src', None)
self.alt = data.get('alt', None)
|
class ContactHelper:
def __init__(self, app):
self.app = app
def open_add_contact_page(self):
# open add creation new contact
wd = self.app.wd
wd.find_element_by_link_text("add new").click()
def fill_form(self, contact):
# fill contacts form
wd = self.app.wd
self.open_add_contact_page()
wd.find_element_by_name("firstname").click()
wd.find_element_by_name("firstname").clear()
wd.find_element_by_name("firstname").send_keys(contact.first_name)
wd.find_element_by_name("lastname").click()
wd.find_element_by_name("lastname").clear()
wd.find_element_by_name("lastname").send_keys(contact.last_name)
wd.find_element_by_name("nickname").click()
wd.find_element_by_name("nickname").clear()
wd.find_element_by_name("nickname").send_keys(contact.nick)
wd.find_element_by_name("home").click()
wd.find_element_by_name("home").clear()
wd.find_element_by_name("home").send_keys(contact.home_phone)
wd.find_element_by_name("mobile").click()
wd.find_element_by_name("mobile").clear()
wd.find_element_by_name("mobile").send_keys(contact.mobile_phone)
wd.find_element_by_name("email").click()
wd.find_element_by_name("email").clear()
wd.find_element_by_name("email").send_keys(contact.email)
wd.find_element_by_xpath("//div[@id='content']/form/input[21]").click()
self.back_to_contacts_list()
def modification_first_contact(self, contact):
wd = self.app.wd
self.select_first_contact(wd)
# find edit button
wd.find_element_by_xpath("//table[@id='maintable']/tbody/tr[2]/td[8]/a/img").click()
wd.find_element_by_name("firstname").click()
wd.find_element_by_name("firstname").clear()
wd.find_element_by_name("firstname").send_keys(contact.first_name)
wd.find_element_by_name("lastname").click()
wd.find_element_by_name("lastname").clear()
wd.find_element_by_name("lastname").send_keys(contact.last_name)
wd.find_element_by_name("nickname").click()
wd.find_element_by_name("nickname").clear()
wd.find_element_by_name("nickname").send_keys(contact.nick)
wd.find_element_by_name("home").click()
wd.find_element_by_name("home").clear()
wd.find_element_by_name("home").send_keys(contact.home_phone)
wd.find_element_by_name("mobile").click()
wd.find_element_by_name("mobile").clear()
wd.find_element_by_name("mobile").send_keys(contact.mobile_phone)
wd.find_element_by_name("email").click()
wd.find_element_by_name("email").clear()
wd.find_element_by_name("email").send_keys(contact.email)
wd.find_element_by_name("update").click()
self.back_to_contacts_list()
def delete_first_contact(self):
wd = self.app.wd
self.select_first_contact(wd)
# find button delete
wd.find_element_by_xpath("//div[@id='content']/form[2]/div[2]/input").click()
wd.switch_to_alert().accept()
self.back_to_contacts_list()
def select_first_contact(self, wd):
wd.find_element_by_name("selected[]").click()
def back_to_contacts_list(self):
wd = self.app.wd
wd.find_element_by_link_text("home").click()
|
MODEL_CONFIG = {
'unet':{
'simplenet':{
'in_channels':1,
'encoder_name':'simplenet',
'encoder_depth':5,
'encoder_channels':[32,64,128,256,512], #[1,2,4,8,16]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[8,4,2,1]
'upsampling':1,
'classes':2,
'aux_classifier': False
},
'swin_transformer':{
'in_channels':1,
'encoder_name':'swin_transformer',
'encoder_depth':4,
'encoder_channels':[96,192,384,768], #[4,8,16,32]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64], #[16,8,4]
'upsampling':4,
'classes':2,
'aux_classifier': False
},
'swinplusr18':{
'in_channels':1,
'encoder_name':'swinplusr18',
'encoder_depth':5,
'encoder_channels':[64,64,128,256,512], #[2,4,8,16,32]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[16,8,4,2]
'upsampling':2,
'classes':2,
'aux_classifier': False
}
},
# att unet
'att_unet':{
'simplenet':{
'in_channels':1,
'encoder_name':'simplenet',
'encoder_depth':5,
'encoder_channels':[32,64,128,256,512], #[1,2,4,8,16]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[8,4,2,1]
'upsampling':1,
'classes':2,
'aux_classifier': False
},
'swin_transformer':{
'in_channels':1,
'encoder_name':'swin_transformer',
'encoder_depth':4,
'encoder_channels':[96,192,384,768], #[4,8,16,32]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64], #[16,8,4]
'upsampling':4,
'classes':2,
'aux_classifier': False
},
'resnet18':{
'in_channels':1,
'encoder_name':'resnet18',
'encoder_depth':5,
'encoder_channels':[64,64,128,256,512], #[2,4,8,16,32]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[16,8,4,2]
'upsampling':2,
'classes':2,
'aux_classifier': False
}
},
# res unet
'res_unet':{
'simplenet':{
'in_channels':1,
'encoder_name':'simplenet_res',
'encoder_depth':5,
'encoder_channels':[32,64,128,256,512], #[1,2,4,8,16]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[8,4,2,1]
'upsampling':1,
'classes':2,
'aux_classifier': False
},
'resnet18':{
'in_channels':1,
'encoder_name':'resnet18',
'encoder_depth':5,
'encoder_channels':[64,64,128,256,512], #[2,4,8,16,32]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[16,8,4,2]
'upsampling':2,
'classes':2,
'aux_classifier': False
},
'swinplusr18':{
'in_channels':1,
'encoder_name':'swinplusr18',
'encoder_depth':5,
'encoder_channels':[64,64,128,256,512], #[2,4,8,16,32]
'encoder_weights':None,
'decoder_use_batchnorm':True,
'decoder_attention_type':None,
'decoder_channels':[256,128,64,32], #[16,8,4,2]
'upsampling':2,
'classes':2,
'aux_classifier': False
}
},
# deeplabv3+
'deeplabv3+':{
'swinplusr18':{
'in_channels':1,
'encoder_name':'swinplusr18',
'encoder_weights':None,
'encoder_depth':5,
'encoder_channels':[64,64,128,256,512], #[2,4,8,16,32]
'encoder_output_stride':32, #[8,16,32]
'decoder_channels':256, #[4]
'decoder_atrous_rates':(12, 24, 36),
'upsampling':4,
'classes':2,
'aux_classifier': False
}
}
}
|
# Python - 3.6.0
stock = {
'football': 4,
'boardgame': 10,
'leggos': 1,
'doll': 5
}
test.assert_equals(fillable(stock, 'football', 3), True)
test.assert_equals(fillable(stock, 'leggos', 2), False)
test.assert_equals(fillable(stock, 'action figure', 1), False)
|
# How to Find the Smallest value
largest_so_far = -1
print('Before', largest_so_far)
for the_num in [1, 99, 24, 25, 56, 4, 57, 89, 5, 94, 21] :
if the_num > largest_so_far :
largest_so_far = the_num
print(largest_so_far, the_num)
print('After', largest_so_far)
|
"""Common utilities for dealing with paths."""
def filter_files(filetypes, files):
"""Filters a list of files based on a list of strings."""
filtered_files = []
for file_to_filter in files:
for filetype in filetypes:
filename = file_to_filter if type(file_to_filter) == "string" else file_to_filter.basename
if filename.endswith(filetype):
filtered_files.append(file_to_filter)
break
return filtered_files
def relative_path(from_dir, to_path):
"""Returns the relative path from a directory to a path via the repo root."""
if to_path.startswith("/") or from_dir.startswith("/"):
fail("Absolute paths are not supported.")
if not from_dir:
return to_path
return "../" * len(from_dir.split("/")) + to_path
def strip_extension(path):
index = path.rfind(".")
if index == -1:
return path
return path[0:index]
|
integers = [ 1, 6, 4, 3, 15, -2]
print("integers[0] = ", integers[0])
print("integers[1] = ", integers[1])
print("integers[2] = ", integers[2])
print("integers[3] = ", integers[3])
print("integers[4] = ", integers[4])
print("integers[5] = ", integers[5])
|
#!/usr/bin/env python3
"""Find the element that appears once in sorted array.
Given a sorted array A, size N, of integers; every element appears twice except for one. Find that element
in linear time complexity and without using extra memory.
Source:
https://practice.geeksforgeeks.org/problems/find-the-element-that-appears-once-in-sorted-array/0
"""
def find_unique_value(items: list):
"""Find the element that appears once in sorted array."""
unique = -1
for index, i in enumerate(items):
# Set the unique value. Continue to next i value.
if unique < 0:
unique = i
continue
# If duplicate found and next is different, reset to -1.
if unique == i and i != items[index + 1]:
unique = -1
# Since list is sorted, once unique is greater than 0
# and i is less than unique break from loop.
if unique > 0 and unique < i:
break
return unique
def main():
print(find_unique_value(
items=[1, 1, 1, 2, 2, 2, 3, 3, 4, 50, 50, 65, 65, ]))
if __name__ == "__main__":
main()
|
# # ###
# #
# letter = input ("Please enter a letter:\n")
# if (letter == 'i'):
# print ("am lettera vowela")
# elif (letter== 'a'):
# print("am lettera vowela")
# if (letter == 'u'):
# print ("am lettera vowela")
# elif (letter== 'e'):
# print("am lettera vowela")
# if (letter == 'o'):
# print('am lettera vowela')
# else:
# print("am lettera vowela nye")
#
# if (letter=='i') | (letter=='a')|(letter=='u')|(letter=='e'):
# print('am lettera vowela')
# else:
# print('am lettera vowela')
# txt="Hello i have a Aieroplane"
# x=txt.split("hello", "i have a Aieroplane")
# print(x)
# #
# for i in v:
# if(i=='a' or i=='e' or i=='i' or i=='o' or i=='u'):
#
# print('i')
# print('e')
# print('a')
#
#
# n=int(input("enter the number:"))
# temp=n
# rev=0
# while(n>0):
# dig=n%10
# rev=rev*10+dig
# n=n//10
# if(temp==rev):
# print("The number is a palindrome!")
# else:
# print("The number is not a palindrome!")
#
# NUMBERS = ["zero", "one", "two","three","four","five","six","seven","eight","nine",
# "ten"]
# TENS = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty",
# "ninety"]
# HUNNITS = ["","hundred","thousand","million","billion","trillion"]
#
# n = eval(input("What is the number the you want to convert? "))
# def convert():
# if n >= 20:
# tens = n // 10
# units = n % 10
#
# if units != 0:
# result = TENS[tens] + "-" + NUMBERS[units]
# else:
# result = TENS[tens]
# else:
# result = NUMBERS[n]
#
# print (result)
#
# def convert2():
# if n >=100:
# tens2 = n//100
# units2 = n%100
#
# if units2 != 0:
# result2 = HUNNITS[tens2] + "-" + TENS[tens2] + "and" + NUMBERS[units2]
# else:
# result2 = HUNNITS[tens2]
# else:
# result2 = HUNNITS[n]
#
# print(result2)
# def main():
# if n >=20 and n< 100:
# x = convert()
# if n >=100:
# y = convert2()
#
# main()
def check_vowels():
input_str = input("Enter string: ")
str_without_space = input_str.replace(' ', '')
if len([char for char in str_without_space if char in ['a', 'e', 'i', 'o', 'u']]) == len(input_str):
print("input contains all the vowels")
else:
print("string does not have all the vowels")
#
def check_palindrom():
num = input("Enter number")
if num == num[::-1]:
print("input is palindrome")
else:
print("input is not a palindrome")
check_palindrom()
#
def convert_Number_to_words():
dicto = {'0': 'zero', '1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9':'nine'}
num = input("Enter number: ")
try:
for item in list(str(num)):
print(dicto[item], end=' ')
except KeyError:
raise ("Invalid input")
|
n = input()
l = list(map(int,raw_input().split()))
m = 0
mi = n-1
for i in range(n):
if l[i]> l[m]:
m=i
if l[i]<=l[mi]:
mi = i
if mi>m:
print (n+m-mi-1)
else:
print (n+m-mi-2)
|
class Solution(object):
def processQueries(self, queries, m):
"""
:type queries: List[int]
:type m: int
:rtype: List[int]
"""
ans=[]
P=range(1, m+1)
for i in range(len(queries)):
toPop=P.index(queries[i])
ans.append(toPop)
P.insert(0, P.pop(toPop))
return ans
|
districts = {
'C01':("Downtown", "Harbourfront", "King West Village", "Little Italy"),
'C02':("The Annex", "Yorkville", "Summerhill", "Wychwood Park", "Deer Park (Yonge-St. Clair)", "South Hill"),
'C03':("Corso Italia", "Forest Hill South", "Oakwood-Vaughan", "Cedarvale"),
'C04':("Bedford Park", "Lawrence Manor", "North Toronto", "Forest Hill North"),
'C06':("North York", "Clanton Park", "Bathurst Manor"),
'C07':("Willowdale", "Newtonbrook West", "Westminister-Branson", "Lansing-Westgate"),
'C08':("Cabbagetown", "St. Lawrence Market", "Waterfront Communities", "Moss Park", "Church-Yonge Corridor", "Garden District"),
'C09':("Moore Park", "Rosedale"),
'C10':("Davisville Village", "Mount Pleasant East"),
'C11':("Leaside", "Thorncliffe Park", "Flemingdon Park"),
'C12':("St. Andrew", "Windfields", "Lawrence Park North"),
'C13':("Banbury", "Don Mills", "Parkwoods-Donalda", "Victoria Village"),
'C14':("Newtonbrook East", "Willowdale East"),
'C15':("Hillcrest Village", "Bayview Woods", "Steeles North", "Bayview Village", "Don Valley Village", "Henry Farm", "Pleasant View"),
'E01':("North Riverdale", "South Riverdale", "Danforth", "Leslieville", "Outer Harbour"),
'E02':("The Beaches", "Woodbine Corridor"),
'E03':("Danforth", "East York", "Playter Estates", "Broadview North", "O’Connor-Parkview", "Crescent Town"),
'E04':("The Golden Mile", "Dorset Park", "Wexford", "Maryvale", "Kennedy Park", "Ionview Park", "Clairlea", "Birchmount"),
'E05':("Steeles", "L’Amoreaux", "Tam O’Shanter", "Sullivan"),
'E06':("Birch Cliff", "Cliffside", "Oakridge", "Hunt Club"),
'E07':("Milliken", "Agincourt North", "Agincourt South", "Malvern West"),
'E08':("Scarborough Village", "Cliffcrest", "Guildwood", "Eglinton East"),
'E09':("Scarborough City Centre", "Woburn", "Morningside", "Bendale"),
'E10':("Rouge (South),", "Centennial Scarborough", "West Hill", "Highland Creek"),
'E11':("Rouge (West),", "Malvern", "Cedarwood"),
'W01':("High Park", "Swansea", "South Parkdale", "Roncesvalles Village"),
'W02':("High Park North", "Bloor West Village", "Baby Point", "The Junction (Junction Area),"),
'W03':("Corso Italia", "Keelesdale", "Eglingon West", "Weston-Pellam Park", "Rockcliffe-Smythe"),
'W04':("Yorkdale", "Glen Park", "Brookhaven", "Amesbury", "Humberlea", "Pelmo Park", "Weston", "Briar Hill", "Belgravia", "Maple Leaf", "Mount Dennis"),
'W05':("Downsview", "Humber Summit", "Humbermede", "Black Creek", "York University Heights", "Glenfield-Jane Heights", "incl. Downsview Airport"),
'W06':("New Toronto", "Long Branch", "Mimico", "Alderwood"),
'W07':("Stonegate-Queensway (Sunnylea),"),
'W08':("Kingsway South", "Central Etobicoke", "Eringate-Centennial-West Deane", "Princess-Rosethorn", "Edenbridge", "Humber Valley", "Islington (City Centre West),", "Markland Wood"),
'W09':("Kingsview Village", "The Westway", "Willowridge", "Martingrove", "Richview", "Humber Heights"),
'W10':("Rexdale", "The Elms", "Kipling", "West-Humber", "Clairville", "Thistletown", "Beaumond Heights", "Mount Olive", "Silverstone", "Jamestown")
}
neighborhoods = ["Wychwood",
"Yonge-Eglinton",
"Yonge-St.Clair",
"York University Heights",
"Yorkdale-Glen Park",
"Lambton Baby Point",
"Lansing-Westgate",
"Lawrence Park North",
"Lawrence Park South","Leaside-Bennington",
"Little Portugal",
"Long Branch",
"Malvern",
"Maple Leaf",
"Markland Wood",
"Milliken",
"Mimico includes Humber Bay Shores",
"Morningside",
"Moss Park",
"Mount Dennis",
"Mount Olive-Silverstone-Jamestown",
"Mount Pleasant East","Mount Pleasant West","New Toronto",
"Newtonbrook East",
"Newtonbrook West",
"Niagara",
"North Riverdale",
"North St.James Town",
"O'Connor-Parkview",
"Oakridge",
"Oakwood Village",
"Old East York",
"Palmerston-Little Italy",
"Parkwoods-Donalda",
"Pelmo Park-Humberlea",
"Playter Estates-Danforth",
"Pleasant View",
"Princess-Rosethorn",
"Regent Park",
"Rexdale-Kipling",
"Rockcliffe-Smythe",
"Roncesvalles",
"Rosedale-Moore Park",
"Rouge",
"Runnymede-Bloor West Village",
"Rustic",
"Scarborough Village",
"South Parkdale",
"South Riverdale",
"St.Andrew-Windfields",
"Steeles",
"Stonegate-Queensway",
"Tam O'Shanter-Sullivan",
"Taylor-Massey",
"The Beaches",
"Thistletown-Beaumond Heights",
"Thorncliffe Park",
"Trinity-Bellwoods",
"University",
"Victoria Village",
"Waterfront Communities-The Island",
"West Hill",
"West Humber-Clairville",
"Westminster-Branson",
"Weston",
"Weston-Pellam Park",
"Wexford/Maryvale",
"Willowdale East",
"Willowdale West",
"Willowridge-Martingrove-Richview",
"Woburn",
"Woodbine Corridor",
"Woodbine-Lumsden",
"Agincourt North",
"Agincourt South-Malvern West",
"Alderwood",
"Annex",
"Banbury-Don Mills",
"Bathurst Manor",
"Bay Street Corridor",
"Bayview Village",
"Bayview Woods-Steeles",
"Bedford Park-Nortown",
"Beechborough-Greenbrook",
"Bendale",
"Birchcliffe-Cliffside",
"Black Creek",
"Blake-Jones",
"Briar Hill-Belgravia",
"Bridle Path-Sunnybrook-York Mills",
"Broadview North",
"Brookhaven-Amesbury",
"Cabbagetown-South St.James Town",
"Caledonia-Fairbank",
"Casa Loma",
"Centennial Scarborough",
"Church-Yonge Corridor",
"Clairlea-Birchmount",
"Clanton Park",
"Cliffcrest",
"Corso Italia-Davenport",
"Danforth",
"Danforth East York",
"Don Valley Village",
"Dorset Park",
"Dovercourt-Wallace Emerson-Junction",
"Downsview-Roding-CFB",
"Dufferin Grove",
"East End-Danforth",
"Edenbridge-Humber Valley",
"Eglinton East",
"Elms-Old Rexdale",
"Englemount-Lawrence",
"Eringate-Centennial-West Deane",
"Etobicoke West Mall",
"Flemingdon Park",
"Forest Hill North",
"Forest Hill South",
"Glenfield-Jane Heights",
"Greenwood-Coxwell",
"Guildwood",
"Henry Farm",
"High Park North",
"High Park-Swansea",
"Highland Creek",
"Hillcrest Village",
"Humber Heights-Westmount",
"Humber Summit",
"Humbermede",
"Humewood-Cedarvale",
"Ionview",
"Islington-City Centre West",
"Junction Area",
"Keelesdale-Eglinton West",
"Kennedy Park",
"Kensington-Chinatown",
"Kingsview Village-The Westway",
"Kingsway South",
"L'Amoreaux"]
for key, value in districts.items():
for i in value:
for j in neighborhoods:
if j in i:
print (key+": "+j)
#change to district only - then copy and paste into district column
# else:
# print ("no")
|
'''Bet.py
'''
class Bets:
def __init__(self):
self.win = 0
self.info = {"dealer":self.dealer, "player":self.player}
def dealer(self, dealer):
self.dealer = dealer
def player(self, player):
self.player = player
def win(self):
self.win = self.odds * self.bet
def lose(self):
return None
def pass_bet(self):
bet = int(input("How much are you betting?: "))
self.pass_line_bet = bet
self.money -self.pass_line_bet
return self.pass_line_bet
def ask_bet(self, bet =0):
if bet == 0:
bet = int(input("How much are you betting?: "))
self.bet = bet
self.money - self.bet
else:
self.bet = bet
self.money - self.bet
return self.bet
def bet_the_pass_line(self):
a = input("Are you betting With" \
"or Against the player? [W] or [A]: ")
if a.upper() == "W":
a = True
else:
a = False
player.pass_line = a
print("Dealer:",self.dealer.money," Player",player.money)
self.dealer.money = self.dealer.money + bet
print(self.dealer.money)
txt =self.open_roll()
print(txt)
print(self.dealer.money)
def get_hard_way_num(self, player, number = 0):
player = player
if number == 0:
number = int(input("What number are we betting hard ways on: 2, 4, 6, 8, 10, 12?: "))
elif number == 2:
player.hw_num
print("Snake eyes! Cheeky monkey.")
elif number == 4:
player.hw_num
elif number == 6:
player.hw_num
elif number == 8:
player.hw_num
elif number == 10:
player.hw_num
elif number == 12:
player.hw_num
print("BOX CARS!")
else:
print("Gotta be an even number Einstein! Try again... Please.")
self.hard_way_num(self, player)
bet = int(player.ask_bet())
return player.hw_num, bet
def hard_way(self, bet):
bet = int(bet)
return 30 * bet
def select_bet(self, player):
player = player
b = None
while b == None:
print("Select from a bet below: ")
print("**************************")
print("[1] Hard Ways bet")
print("We automatically select" \
"hard ways for testing.")
b = 1
if b == 1:
print("Hard ways bet")
player.funds()
bet = self.hard_way_num(player)
number = bet[0]
hw_amount = bet[1] #amount bet
player.money = player.money - hw_amount
self.dealer.collect_bet(number, hw_amount)
def main():
bet = Bets()
#print(bet.attr)
if __name__ == "__main__":
main()
|
"""Exercício Python 094: Crie um programa que leia nome, sexo e idade de várias pessoas,
guardando os dados de cada pessoa em um dicionário e todos os dicionários em uma lista.
No final, mostre:
A) Quantas pessoas foram cadastradas
B) A média de idade
C) Uma lista com as mulheres
D) Uma lista de pessoas com idade acima da média"""
pessoa = dict()
cadastro = list()
soma = 0
while True:
pessoa["Nome"] = str(input('Nome: ')).strip()
while True:
pessoa["Sexo"] = str(input('M/F: ')).upper().strip()
if pessoa["Sexo"] not in "MF":
print('Erro! Digite M (Masculino) ou F (Femenino)')
if pessoa["Sexo"] in "MF":
break
pessoa["Idade"] = int(input('Digite a Idade: '))
cadastro.append(pessoa.copy())
while True:
resp = str(input("Deseja Continuar? (S/N)")).upper().strip()
if resp not in "SN":
print('Erro! Digite S-Sim ou N-Não')
if resp in "SN":
break
if resp in "N":
break
print(cadastro)
print('*-*'*30)
print(f'Foram Cadastradas {len(cadastro)} pessoas.')
for i in cadastro:
soma += i["Idade"]
print(f'A média das idades é {soma / len(cadastro)}')
print('As mulheres cadastradas são: ')
for i in cadastro:
if i["Sexo"] in "F":
print(f'{i["Nome"]} com {i["Idade"]} anos')
print('As pessoas com idade acima da média são: ')
for i in cadastro:
if i["Idade"] > soma / len(cadastro):
print(f'{i["Nome"]} com {i["Idade"]} anos')
|
#!/usr/bin/python
with open('INCAR', 'r') as file:
lines=file.readlines()
for n,i in enumerate(lines):
if 'MAGMOM' in i:
# print(i)
items=i.split()
index=items.index('=')
moments=items[index+1:]
# print(moments)
magmom=''
size=4
for i in range(len(moments)//3):
k=' '.join(k for k in moments[3*i:3*i+3])
magmom+=(k+' ')*size
print(magmom)
|
#
# Copyright 2019 Google 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
#
# https://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.
# author: Reza Hosseini
""" Functions to to generate sequential data from timestamped data
and work with sequential data
we allow you to define what dimensions each sequence element contains
e.g. we can have a one-dimensional sequence of the form: browsingFeat>mailingFeat>watchFeat
or a 3-dim sequence of the form browsingFeat-COMP-VIEW>mailingFeat-PHN-READ
this code includes function for augmenting the data by shifting sequences
this code includes methods to add useful slicing methods to sequences when
generating them
for example columns to keep track of event_1st event_2nd etc in the sequences
this also includes functions to extract significant transitions in the sequence
as well as significant triples etc
"""
## simulate usage data with timestamps
## this is for testing code etc
def GenUsageData(
userNum=None,
userIds=None,
dt1=datetime.datetime(2017, 4, 12),
dt2=datetime.datetime(2017, 4, 12, 1, 0, 0),
timeGridLen='1min',
durLimit=None,
prodsChoice=[
'browsingFeat', 'mailingFeat',
'editingFeat', 'exploreFeat', 'photoFeat',
'PresFeat', 'locFeat', 'StorageFeat']):
timeCol = 'time'
timeColEnd = 'end_time'
userCol = 'user_id'
respCol = 'prod'
timeGrid = pd.date_range(start=dt1, end=dt2, freq=timeGridLen)
if userIds is None:
userIds = pd.Series(range(userNum))
userDf = pd.DataFrame({
userCol: userIds,
'country': np.random.choice(a=['US', 'JP', 'FR'],
size=userNum, replace=True)})
timeDf = pd.DataFrame({timeCol: timeGrid})
userDf['key'] = 0
timeDf['key'] = 0
df = userDf.merge(timeDf, how='outer', on=['key'])
del df['key']
size = df.shape[0]
df[respCol] = np.random.choice(
a=prodsChoice,
size=size,
replace=True)
df['form_factor'] = np.random.choice(a=['COMP', 'PHN'],
size=size, replace=True)
df2 = df.sample(frac=0.5, replace=False)
df2 = df2.sort_values(['user_id', 'time'])
def F(df):
df['delta'] = ((df[timeCol] - df[timeCol].shift()).fillna(0)).shift(-1).fillna(0)
df['prop'] = np.random.uniform(low=1.0, high=5.0, size=df.shape[0])
df['delta'] = (df['delta'] / df['prop'])
df[timeColEnd] = df[timeCol] + df['delta']
return(df)
g = df2.groupby(['user_id'], as_index=False)
df3 = g.apply(F)
df3['date'] = df3['time'].dt.date
df3[timeColEnd] = pd.DatetimeIndex(df3[timeColEnd]).round('1s')
del df3['delta']
del df3['prop']
df3[userCol] = df3[userCol].map(str)
df3['start_hour'] = (df3['time'].dt.hour).map(str)
df3 = df3[[
'country', 'user_id', 'date', 'prod', 'form_factor',
'time', 'end_time', 'start_hour']]
df3['dur_secs'] = (df3['end_time'] - df3['time']) / np.timedelta64(1, 's')
if durLimit is not None:
df3['dur_secs'] = df3['dur_secs'].map(lambda x: min(x, durLimit))
return df3
'''
GenUsageData(5)
'''
## generate experiment data with patterns
def GenUsageData_withExpt(
userIdsPair,
dt1,
dt2,
timeGridLenPair=['2h', '2h'],
durLimitPair = [3600, 3600],
prodsChoicePair = [
['browsingFeat', 'mailingFeat', 'editingFeat',
'exploreFeat', 'photoFeat', 'PresFeat',
'locFeat', 'StorageFeat'],
['browsingFeat', 'mailingFeat', 'editingFeat',
'exploreFeat', 'photoFeat', 'PresFeat',
'locFeat', 'StorageFeat', 'browsingFeat',
'editingFeat']]):
dfList = []
labels = ['base', 'test']
for i in range(2):
res = GenUsageData(
userIds=userIdsPair[i],
dt1=dt1,
dt2=dt2,
timeGridLen=timeGridLenPair[i],
durLimit=durLimitPair[i],
prodsChoice=prodsChoicePair[i])
res['expt'] = labels[i]
dfList.append(res)
outDf = dfList[0].append(dfList[1], ignore_index=True)
return outDf
'''
df = GenUsageData_withExpt(
userIdsPair=[range(10), range(11, 20)],
dt1=datetime.datetime(2017, 4, 12),
dt2=datetime.datetime(2017, 4, 14),
timeGridLenPair=['2h', '2h'],
durLimitPair = [3600, 3000],
prodsChoicePair = [
['browsingFeat', 'mailingFeat', 'editingFeat', 'exploreFeat',
'photoFeat', 'PresFeat',
'locFeat', 'StorageFeat'],
['browsingFeat', 'mailingFeat', 'editingFeat', 'exploreFeat',
'photoFeat', 'PresFeat',
'locFeat', 'StorageFeat', 'browsingFeat', 'editingFeat']])
'''
### simulate dependent data, with repeating a subseq
def Sim_depUsageData(userNum=10, subSeqLen=3, repeatPattern=None):
df = GenUsageData(
userNum=userNum,
dt1=datetime.datetime(2017, 4, 11, 23, 10, 0),
dt2=datetime.datetime(2017, 4, 12, 0, 50, 0))
df['date'] = df['time'].dt.date
df['date'] = df['date'].map(str)
## generate some pattern
subSeq = ['photoFeat', 'locFeat', 'browsingFeat',
'editingFeat', 'exploreFeat'][:subSeqLen]
l = subSeqLen + 1
if repeatPattern is None:
repeatPattern = (len(df) // l) - 2
Mark(repeatPattern, 'repeatPattern')
Mark(df.shape, 'df.shape')
for i in range(repeatPattern):
x = subSeq + list(np.random.choice(
a=['browsingFeat', 'mailingFeat', 'editingFeat',
'exploreFeat', 'photoFeat',
'PresFeat', 'locFeat'],
size=(l-len(subSeq)),
replace=True))
ind = range(l*i, l*(i+1))
booleanInd = [i in ind for i in range(len(df))]
df.loc[booleanInd, 'prod'] = x
return df
'''
df = Sim_depUsageData()
'''
################################ seq functions #############################
## it generates a function which for each string s
## returns a label in labelList if it is found to be a part of string s "y in s"
## but if more than one element is a match then returns MIXED
def String_isMixedFcn(labelList, mixedLabel='MIXED', noneLabel='None'):
def F(s):
elemInd = []
[(y in s) for y in labelList]
v = np.array(elemInd).sum()
if v > 1:
return mixedLabel
if v == 1:
ind = [i for i, j in enumerate(elemInd) if j]
return labelList[ind[0]]
return noneLabel
return F
## adds a column to a given df about a column "col"
# including a label coming from labelList
def AddStringContainsDf(
df,
col,
labelList,
newColName=None,
mixedLabel='MIXED',
noneLabel='None'):
if newColName == None:
newColName = 'string_contains_' + col
F = String_isMixedFcn(labelList=labelList,
mixedLabel=mixedLabel,
noneLabel=noneLabel)
df[newColName] = df[col].map(F)
return df
'''
labelList = ['aaa', 'ccc', 'ddd', 'bbb']
mixedLabel = 'MIXED'
noneLabel = 'None'
Fcn = String_isMixedFcn(labelList=labelList, mixedLabel='MIXED',
noneLabel='None')
print(Fcn('aaa-bbb-awww'))
print(Fcn('aaa-aas'))
import pandas as pd
df = pd.DataFrame({'col': ['aaa-bbb-asdsdsa', 'aaa', 'bbb', 'aaa-bbb']})
AddStringContainsDf(df=df, col='col', labelList=labelList, newColName=None,
mixedLabel='MIXED',
noneLabel='None')
'''
## this adds a new column to a dataframe by inspecting a seq column
## if the seq is only unique elements, it will return the unique element
## if there are more than one elements in the seq, it returns "MIXED"
def AddSeq_uniqueOrMixed(
df,
seqCol,
sepStr=None,
newColName=None,
mixedLabel='MIXED',
noneLabel='None'):
df2 = df.copy()
df3 = df.copy()
if sepStr is not None:
df3 = df2.assign(**{seqCol: df2[seqCol].str.split(sepStr)})
# for a list x, if all elements are the same, will assign the unique values,
# otherwise will assign "mixed"
def F(x):
if len(x) == 0:
return noneLabel
if len(set(x)) == 1:
return(x[0])
return mixedLabel
if newColName == None:
newColName = seqCol + '_mix'
df2[newColName] = df3[seqCol].map(F)
return df2
'''
df = pd.DataFrame({
'seq': ['a>b>c>d', 'd>e>f>t>l>h'],
'interface': ['aa>bb>cc>dd', 'dd>ee>ff>tt>ll>hh'],
'browser': ['aaa>aaa>aaa>aaa', 'ddd>eee>fff>ttt>lll>hhh'],
'var2': [1, 2], 'seq_count':[5, 6]
})
AddSeq_uniqueOrMixed(df=df, seqCol='browser', sepStr='>')
'''
## construct the set of all values for the respCol grouped by partitionCols
def GetSetIndCols(df, respCol, partitionCols):
g = df.groupby(partitionCols)
out = g[respCol].apply(lambda x: list(set(list(x))))
out = out.reset_index()
return out
'''
df = pd.DataFrame( {'a':['A', 'A', 'B', 'B', 'B', 'C', 'C'],
'b':[1, 2, 5, 5, 4, 6, 7]})
out = GetSetIndCols(df=df, respCol='b', partitionCols=['a'])
df = GenUsageData(8)
GetSetIndCols(df=df, respCol='prod', partitionCols=['user_id'])
'''
## returns a function which adds a ind column to setDf for each pair [pre, post]
def AddMembershipColFcn(setDf, setCol):
def F(subSet):
ind = setDf[setCol].apply(lambda x: set(subSet) < set(x))
setDf['elems_exist'] = ind
return (setDf)
return F
'''
df = GenUsageData(userNum=4, dt1=datetime.datetime(2017, 4, 12, 0, 0, 0),
dt2=datetime.datetime(2017, 4, 12, 1, 0, 0))
setDf = GetSetIndCols(df=df, respCol='prod', partitionCols=['user_id'])
print(setDf)
Fcn = AddMembershipColFcn(setDf=setDf, setCol='prod')
print(Fcn('k', 'j'))
print(Fcn('a', 'b'))
'''
## generates a Fcn (SubsetDfFcn) which for each given subSet:
## generates a function SubsetDf=SubsetDfFcn(subSet)
## which adds a boolean column about membership of all the elements of subSet
def ElemsExist_subsetDfFcn(setDf, setCol, partitionCols):
AddPairMembership = AddMembershipColFcn(setDf=setDf, setCol=setCol)
def SubsetDfFcn(subSet):
def SubsetDf(df):
setDf2 = AddPairMembership(subSet)
setDf2 = setDf2[partitionCols + ['elems_exist']]
df2 = pd.merge(df, setDf2, on=partitionCols)
df2 = df2[df2['elems_exist']]
return df2
return SubsetDf
return SubsetDfFcn
'''
df = GenUsageData(userNum=4, dt1=datetime.datetime(2017, 4, 12, 0, 0, 0),
dt2=datetime.datetime(2017, 4, 12, 1, 0, 0))
setDf = GetSetIndCols(df=df, respCol='prod', partitionCols=['user_id'])
#print(setDf)
AddPairMembership = AddMembershipColFcn(setDf=setDf, setCol='prod')
SubsetDfFcn = ElemsExist_subsetDfFcn(setDf=setDf, setCol='prod',
partitionCols=['user_id'])
SubsetDf = SubsetDfFcn(pair)
pair = ['watchFeat', 'browsingFeat']
Mark(AddPairMembership(pair))
Mark(SubsetDf(df=df)['user_id'].value_counts())
'''
## create sequence data for a variable (categorical) using timestamps and
## add blanks when there are long time time gaps
## extraCols will build a corresponding sequence for other columns of interest
## for example it can keep track of interface for a sequence of events
## we specify index columns and the sequences are built
# for each index column combination
## no deduping at this point
def CreateTimeSeq(
df,
respCol,
timeCol,
timeGap,
timeColEnd=None,
partitionCols=[],
extraCols=[],
ordered=False):
## we keep the main sequence column to build sequences (respCol)
# we also keep the extra columns to build parallel sequences
# we remove repetitions with UniqueList
df['seq_undeduped'] = df[respCol]
respCol = 'seq_undeduped'
respCols = UniqueList([respCol] + extraCols)
df2 = df[respCols].copy()
df3 = df2[df2.isnull().any(axis=1)].copy()
if len(df3) > 0:
warnings.warn("\n\n the data has " + str(len(df3)) + " rows with Nulls." +
" CreateTimeSeq fails with Nulls." +
" Therefore rows with any Null are omitted."
" See data with Null examples below:")
print(df3[:3])
df2 = df2[~df2.isnull().any(axis=1)].copy()
if not ordered:
df = df.sort_values(partitionCols + [timeCol])
## creating a single column to keep track of inds
df['all_ind'] = 0
df['ind_change'] = False
if len(partitionCols) > 0:
df = Concat_stringColsDf(df, cols=partitionCols, colName='all_ind', sepStr='-')
df['ind_pair'] = list(zip(df['all_ind'], df['all_ind'].shift()))
df['ind_change'] = df['ind_pair'].map(lambda x: len(set(x))) > 1
## if durations are available by providing the end timestamp, we use that
if timeColEnd is None:
timeColEnd = timeCol
df['delta'] = (df[timeCol] - df[timeColEnd].shift()).fillna(0)
df['delta_sec'] = df['delta'].values / np.timedelta64(1, 's')
del df['delta']
## we identify the beginning of new visits
df['is_gap'] = df['delta_sec'] > timeGap
del df['delta_sec']
## an ind change has the same effect as a gap
# all we need to do is to cut the sequence at that point anyway
# we also need to insure not to throw a way is resp is repeated
# at this time (row)
df['is_gap'] = df['ind_change'] | df['is_gap']
ind = [i for i,j in enumerate(df['is_gap'].values) if j == 1]
groupNum = len(ind) + 1
groupsNames = range(groupNum)
ind1 = [0] + ind + [len(df['is_gap'])]
diff = pd.Series(ind1) - pd.Series(ind1).shift()
diff = list(diff[1:])
# create a column to keep track of large time gaps
# whenever there is a gap (or ind change), we start a new group
tempCol = []
#Mark(zip(groupsNames, diff))
for i in zip(groupsNames, diff):
tempCol = tempCol + [i[0]] * int(i[1])
df['tempCol'] = tempCol
df['seq_start_timestamp'] = df[timeCol]
df['seq_end_timestamp'] = df[timeColEnd]
df = df[partitionCols + respCols +
['seq_start_timestamp', 'seq_end_timestamp', 'tempCol']].copy()
#start = time.time()
g = df.groupby(partitionCols + ['tempCol'])
aggDict = {'seq_start_timestamp': min, 'seq_end_timestamp': max}
for col in respCols:
aggDict[col] = (lambda x: '>'.join(x))
seqDf = g.agg(aggDict)
seqDf = seqDf.reset_index()
#end = time.time()
#Mark(end - start, 'CreateTimeSeq running: time agg took')
#seqDf['seq'] = seqDf[respCol]
del seqDf['tempCol']
#del seqDf[respCol]
seqDf = seqDf.reset_index(drop=True)
return seqDf
'''
# example
df = GenUsageDf_forTesting()
Mark(df[:5])
respCol = 'prod'
extraCols =['form_factor']
timeCol = 'time'
timeGap = 10*1
partitionCols = ['user_id'] # example 1
partitionCols = ['user_id', 'date'] # example 2
#df['date'] = df['date'].map(str)
timeColEnd = 'end_time'
tic = time.clock()
seqDf1 = CreateTimeSeq(
df=df.copy(),
respCol=respCol,
timeCol=timeCol,
timeGap=timeGap,
timeColEnd=timeColEnd,
partitionCols = partitionCols,
extraCols=extraCols,
ordered=False)
'''
## dedupe sequences data with parallel
def DedupeSeqDf(
df,
seqCol,
extraCols=[],
sepStr='>',
dedupedColName='seq_deduped',
parallelSuffix='_parallel'):
def DedupingInd(s):
l = s.split(sepStr)
inds = [
next(group)
for key, group in itertools.groupby(
enumerate(l), key=operator.itemgetter(1))
]
ind = tuple([x[0] for x in inds])
return ind
def SubseqWithInd(s, ind):
l = s.split(sepStr)
ind = list(ind)
out = [l[j] for j in ind]
outString = sepStr.join(out)
return outString
def SubseqCol(col, subseqColName):
df[subseqColName] = df.apply(
lambda x: SubseqWithInd(s=x[col], ind=x['deduping_ind']), axis=1)
return None
df['deduping_ind'] = df[seqCol].apply(DedupingInd)
SubseqCol(col=seqCol, subseqColName=dedupedColName)
def ChangeColname(col):
SubseqCol(col, subseqColName=col + parallelSuffix)
[ChangeColname(col) for col in extraCols]
return df
'''
df = GenUsageDf_forTesting()
respCol = 'prod'
extraCols =['form_factor', 'country']
timeCol = 'time'
timeGap = 10*1
partitionCols = ['user_id'] # example 1
partitionCols = ['user_id', 'date'] # example 2
#df['date'] = df['date'].map(str)
timeColEnd = 'end_time'
tic = time.clock()
seqDf1 = CreateTimeSeq(
df=df.copy(),
respCol=respCol,
timeCol=timeCol,
timeGap=timeGap,
timeColEnd=timeColEnd,
partitionCols = partitionCols,
extraCols=extraCols,
ordered=False)
DedupeSeqDf(df=seqDf1, seqCol='seq', extraCols=extraCols, sepStr='>',
dedupedColName='seq_deduped', parallelSuffix='_parallel')
'''
def CreateTimeSeq_andDedupe(
df,
respCol,
timeCol,
timeGap,
timeColEnd=None,
partitionCols=[],
extraCols=[],
ordered=False,
seqCol='seq_undeduped',
dedupedColName='seq_deduped',
parallelSuffix='_parallel',
method='split_by_ind'):
if len(set(partitionCols) & set(extraCols)) > 0:
warnings.warn("partitionCols and extraCols intersect. This can cause errors.")
if method == 'default':
seqDf = CreateTimeSeq(
df=df.copy(),
respCol=respCol,
timeCol=timeCol,
timeGap=timeGap,
timeColEnd=timeColEnd,
partitionCols = partitionCols,
extraCols=extraCols,
ordered=ordered)
elif method == 'split_by_ind':
def CalcPerSlice(group):
out = CreateTimeSeq(
df=group,
respCol=respCol,
timeCol=timeCol,
timeGap=timeGap,
timeColEnd=timeColEnd,
partitionCols = [],
extraCols=extraCols,
ordered=ordered)
#Mark(out)
for col in partitionCols:
out[col] = group[col].values[0]
return(out)
if len(partitionCols) == 0:
seqDf = CalcPerSlice(df)
else:
g = df.groupby(partitionCols, as_index=False)
seqDf = g.apply(CalcPerSlice)
seqDf = seqDf.reset_index(drop=True)
else:
print(
"This method: "
+ method
+ " is not implemented for seq calculation. we return nothing.")
return None
out = DedupeSeqDf(
df=seqDf.copy(),
seqCol=seqCol,
extraCols=extraCols,
sepStr='>',
dedupedColName=dedupedColName,
parallelSuffix=parallelSuffix)
return out
'''
df = GenUsageDf_forTesting()
respCol = 'prod'
extraCols =['form_factor', 'country']
timeCol = 'time'
timeColEnd = 'end_time'
timeGap = 10*1
partitionCols = ['user_id'] # example 1
partitionCols = ['user_id', 'date'] # example 2
#df['date'] = df['date'].map(str)
CreateTimeSeq_andDedupe(
df,
respCol,
timeCol,
timeGap,
timeColEnd=timeColEnd,
partitionCols=partitionCols,
extraCols=extraCols,
ordered=False,
dedupingSuffix='_deduped',
parallelSuffix='_parallel')
'''
'''
df = GenUsageData(userNum=500,
dt1=datetime.datetime(2017, 4, 12),
dt2=datetime.datetime(2017, 4, 12, 10, 0, 0))
import cProfile
cProfile.run(
"
start = time.time()
seqDf1 = CreateTimeSeq_andDedupe(
df=df,
respCol='prod',
timeCol='time',
timeGap=1*60,
timeColEnd='end_time',
partitionCols=['user_id'],
extraCols=['country'],
ordered=True,
dedupedColName='seq_deduped',
parallelSuffix='_parallel',
method='split_by_ind')
end = time.time()
Mark(end - start, 'time for split')
"
)
Mark("*******************")
cProfile.run(
"
start = time.time()
seqDf2 = CreateTimeSeq_andDedupe(
df=df,
respCol='prod',
timeCol='time',
timeGap=1*60,
timeColEnd='end_time',
partitionCols=['user_id'],
extraCols=['country'],
ordered=True,
dedupedColName='seq_deduped',
parallelSuffix='_parallel',
method='default')
end = time.time()
Mark(end - start, 'time for default')
"
)
'''
## trims a seq which is given in a string format with a separator
def SeqTrim(s, k, sepStr='>'):
ind = [pos for pos, char in enumerate(s) if char == sepStr]
if len(ind) < k:
return s
else:
return s[:ind[k - 1]]
'''
print(SeqTrim('aaa>rre>dssd>das', k=2))
print(SeqTrim('aaa>rre>dssd>das', k=1))
print(SeqTrim('aaa', k=2))
'''
## turns seq columns to basket columns
def SeqToBasketDf(
df, cols, sepStr='>', prefix='', suffix='_basket',
basketSepStr=';'):
df2 = df.copy()
def F(s):
x = s
if sepStr is not None:
x = s.split(sepStr)
out = tuple(sorted(list(set(x))))
if basketSepStr is not None:
out = basketSepStr.join(out)
return out
for col in cols:
df2[prefix + col + suffix] = df2[col].map(F)
return df2
'''
df = pd.DataFrame({'seq': ['a>b>c>d', 'd>e>f>t>l>h'],
'interface': ['pc>phone>laptop>phone', 'phone>laptop>phone>phone>phone>pc'],
'browser': ['ch>agsa>ch>agsa', 'agsa>ch>someBr>ch>someBr>ch'],
'var2': [1, 2], 'seq_count':[5, 6]})
print(df)
SeqToBasketDf(df=df, cols=['seq', 'interface', 'browser'],
sepStr='>', prefix='', suffix='_basket')
'''
## complete deduping of a sequence,
# we only keep the first occurrence of an elem in the seq
def Seq_completeDedupeDf(
df, cols, sepStr='>', prefix='', suffix='_completely_deduped'):
df2 = df.copy()
def F(s):
x = s
if sepStr is not None:
x = s.split(sepStr)
out = UniqueList(x)
if sepStr is not None:
out = sepStr.join(out)
return out
for col in cols:
df2[prefix + col + suffix] = df2[col].map(F)
return df2
'''
df = pd.DataFrame({
'seq': ['a>a>c>d>a', 'd>e>f>d>l>h'],
'interface': ['pc>phone>laptop>phone', 'phone>laptop>phone>phone>phone>pc'],
'browser': ['ch>agsa>ch>agsa', 'agsa>ch>someBr>ch>someBr>ch'],
'var2': [1, 2],
'seq_count': [5, 6]})
print(df)
Seq_completeDedupeDf(
df=df,
cols=['seq', 'interface', 'browser'],
sepStr='>',
prefix='',
suffix='_completely_deduped')
'''
### shift augmenting
## for a given sequence given in string format it constructs sequences
# by shifting the given seq one by one
# it insures the resulting sequences are of length k
# unless the full seq is shorter
# it also provides the lag sequence
def SeqShiftedList(
s, k=None, lagK=None, sepStr=None, basketSepStr=',', blankStr='BLANK'):
if k == None:
k = len(s)
seq = s
if sepStr != None:
seq = s.split(sepStr)
l = len(seq)
if l <= k:
return ({'lagSeq':[blankStr], 'lagBasket':[blankStr], 'shifted':[s]})
shifted = []
lagSeq = []
lagBasket = []
for i in range(l-k+1):
seq0 = seq[i:(i+k)]
m = 0
if lagK != None:
m = max([i - lagK, 0])
lag0 = seq[m:i]
basket0 = tuple(sorted(list(set(lag0))))
if basketSepStr != None:
basket0 = ','.join(basket0)
if sepStr != None:
seq0 = sepStr.join(seq0)
lag0 = sepStr.join(lag0)
## resetting empty string with BLANK
if lag0 == '':
lag0 = blankStr
basket0 = blankStr
shifted.append(seq0)
lagSeq.append(lag0)
lagBasket.append(basket0)
outDict = {'lagSeq':lagSeq, 'lagBasket':lagBasket, 'shifted':shifted}
return outDict
'''
s = 'a>b>c>d'
SeqShiftedList(s=s, k=2, sepStr=None)
'''
## creates a data frame by shifting sequences
# and creating multiple sequences from one
# if extraCols are also presented the same will be done to extraCols
def ShiftedSeqDf(
df,
seqCol,
k=None,
lagK=None,
sepStr='>',
extraCols=[],
colPrefix='trimmed_',
colSuffix=''):
## add shifted
def F(s):
return SeqShiftedList(s=s, k=k, sepStr=sepStr)['shifted']
## add start time (omitted, this would work only if we included all shifts,
#but now we are not including short shifts)
#def G(s):
# if sepStr == None:
# return(range(len(s)))
# return(range(len(s.split(sepStr))))
## add lagSeq
def H(s):
return SeqShiftedList(s=s, k=k, lagK=lagK, sepStr=sepStr)['lagSeq']
def B(s):
return SeqShiftedList(s=s, k=k, lagK=lagK, sepStr=sepStr)['lagBasket']
df2 = df.copy()
df2[seqCol] = [F(x) for x in df[seqCol].values]
df2['seq_shift_order'] = [range(len(x)) for x in df2[seqCol].values]
seqDf = Flatten_RepField(df=df2, listCol=seqCol, sep=None)
df2['lag'] = [H(x) for x in df[seqCol].values]
seqDf2 = Flatten_RepField(df=df2, listCol='lag', sep=None)
seqDf['lag'] = seqDf2['lag']
df2['lagBasket'] = [B(x) for x in df[seqCol].values]
seqDf2 = Flatten_RepField(df=df2, listCol='lagBasket', sep=None)
seqDf['lagBasket'] = seqDf2['lagBasket']
for col in (extraCols):
df2[col] = [F(x) for x in df2[col].values]
seqDf2 = Flatten_RepField(df=df2, listCol=col, sep=None)
seqDf[col] = seqDf2[col]
df2[col + '_lag'] = [H(x) for x in df[col].values]
seqDf2 = Flatten_RepField(df=df2, listCol=col + '_lag', sep=None)
seqDf[col + '_lag'] = seqDf2[col + '_lag']
df2[col + '_lagBasket'] = [B(x) for x in df[col].values]
seqDf2 = Flatten_RepField(df=df2, listCol=col + '_lagBasket', sep=None)
seqDf[col + '_lagBasket'] = seqDf2[col + '_lagBasket']
orderDf = Flatten_RepField(df=df2, listCol='seq_shift_order', sep=None)
seqDf['seq_shift_order'] = orderDf['seq_shift_order'].map(str)
for col in ([seqCol] + extraCols):
seqDf.rename(columns={col: colPrefix + col + colSuffix}, inplace=True)
return seqDf
'''
df = pd.DataFrame({'seq': ['a>b>c>d', 'd>e>f>t>l>h'],
'interface': ['pc>phone>laptop>phone', 'phone>laptop>phone>phone>phone>pc'],
'browser': ['ch>agsa>ch>agsa', 'agsa>ch>someBr>ch>someBr>ch'],
'var2': [1, 2], 'seq_count':[5, 6]})
print(df)
ShiftedSeqDf(df=df, seqCol='seq', k=3, lagK=2, sepStr='>',
extraCols=['interface', 'browser'])
'''
## adds condition columns to seq data, eg a condition for the 2nd seq element
# this is useful to study the entry points to an app,
# because we can condition the second element of the seq to be equal
# to that app of interest
def AddSeqOrdEvent(
df, seqCol, sepStr=None, basketSepStr=',', noneValue='BLANK'):
df2 = df.copy()
if sepStr != None:
df3 = df2.assign(**{seqCol: df2[seqCol].str.split(sepStr)})
def GetListKthElFcn(k, noneValue=None):
def F(x):
if len(x) <= k:
return noneValue
else:
return x[k]
return F
F1st = GetListKthElFcn(k=0, noneValue=noneValue)
F2nd = GetListKthElFcn(k=1, noneValue=noneValue)
F3rd = GetListKthElFcn(k=2, noneValue=noneValue)
F4th = GetListKthElFcn(k=3, noneValue=noneValue)
df2['event_1'] =[F1st(x) for x in df3[seqCol].values]
df2['event_2'] = [F2nd(x) for x in df3[seqCol].values]
df2['event_3'] = [F3rd(x) for x in df3[seqCol].values]
df2['event_4'] = [F4th(x) for x in df3[seqCol].values]
## add subseq info
if sepStr is not None:
df2['subseq_1_2'] = df2['event_1'] + sepStr + df2['event_2']
df2['subseq_1_2_3'] = df2['subseq_1_2'] + sepStr + df2['event_3']
df2['subseq_1_2_3_4'] = df2['subseq_1_2_3'] + sepStr + df2['event_4']
for col in ['subseq_1_2', 'subseq_1_2_3', 'subseq_1_2_3_4']:
df2[col] = df2[col].map(lambda x: x.replace((sepStr + noneValue), ''))
else:
df2['subseq_1_2'] = df2[['event_1', 'event_2']].apply(
lambda x: tuple(x), axis=1)
df2['subseq_1_2_3'] = df2[['event_1', 'event_2', 'event_3']].apply(
lambda x: tuple(x), axis=1)
df2['subseq_1_2_3_4'] = df2[['event_1', 'event_2', 'event_3', 'event_4']].apply(
lambda x: tuple(x), axis=1)
## add basketed data (set of events, rather than subseq)
df2['basket_1_2'] = df2[['event_1', 'event_2']].apply(
lambda x: basketSepStr.join(sorted(list(set(x)))), axis=1)
df2['basket_1_2_3'] = df2[['event_1', 'event_2', 'event_3']].apply(
lambda x: basketSepStr.join(sorted(list(set(x)))), axis=1)
df2['basket_1_2_3_4'] = df2[['event_1', 'event_2', 'event_3', 'event_4']].apply(
lambda x: basketSepStr.join(sorted(list(set(x)))), axis=1)
return df2
'''
df = pd.DataFrame({'seq': ['a>b>c>d', 'd>e>f>t>l>h'], 'var2': [1, 2],
'seq_count':[5, 6]})
print(df)
seqDf = ShiftedSeqDf(df=df, seqCol='seq', k=3, sepStr='>')
AddSeqOrdEvent(df=seqDf, seqCol='seq', sepStr='>')
'''
'''
size = 8
df = pd.DataFrame({
'seq':np.random.choice(
a=['a>b>c>d', 'b>c>f>g', 'f>c>v>f>g>a>b'],
size=8,
replace=True),
'col1':np.random.uniform(low=0.0, high=100.0, size=size),
'col2':np.random.uniform(low=0.0, high=100.0, size=size),
'col3':np.random.uniform(low=0.0, high=100.0, size=size),
'col4':np.random.uniform(low=0.0, high=100.0, size=size)})
#print(df)
seqDf = ShiftedSeqDf(df=df, seqCol='seq', k=3, sepStr='>')
AddSeqOrdEvent(df=seqDf, seqCol='seq')
'''
'''
df0 = pd.DataFrame({
'categ':np.random.choice(
a=['a>b>c>d', 'b>c>f>g', 'f>c>v>f>g>a>b'],
size=8,
replace=True),
'col1':np.random.uniform(low=0.0, high=100.0, size=5),
'col2':np.random.uniform(low=0.0, high=100.0, size=5),
'col3':np.random.uniform(low=0.0, high=100.0, size=5),
'col4':np.random.uniform(low=0.0, high=100.0, size=5)})
print(df)
seqDf = ShiftedSeqDf(df=df, seqCol=seqCol, k=3, sepStr='>')
AddSeqOrdEvent(df=seqDf, seqCol='seq')
'''
## adds a sequence length column to seq data
def AddSeqLength(df, seqCol, seqLenCol='seq_length', sepStr=None):
df2 = df.copy()
df3 = df2.copy()
if sepStr is not None:
df3 = df2.assign(**{seqCol: df2[seqCol].str.split(sepStr)})
def F(x):
return len(x)
df2[seqLenCol] = [F(x) for x in df3[seqCol].values]
return df2
'''
df = pd.DataFrame({
'seq': ['a>b>c>d', 'd>e>f>t>l>h'],
'var2': [1, 2],
'seq_count':[5, 6]})
print(df)
seqDf = ShiftedSeqDf(df=df, seqCol='seq', k=3, sepStr='>')
seqDf2 = AddSeqOrdEvent(df=seqDf, seqCol='seq', sepStr='>')
seqDf3 = AddSeqLength(df=seqDf, seqCol='seq', sepStr='>')
'''
## dedupe consecutive elements repetitions in a seq
def DedupeSeq(s, sepStr=None):
if sepStr != None:
s = s.split(sepStr)
out = [x[0] for x in itertools.groupby(s)]
if sepStr != None:
out = sepStr.join(out)
return(out)
'''
DedupeSeq(s='a>a>b>b>a>a', sepStr='>')
DedupeSeq(s='a', sepStr='>')
DedupeSeq(s='ab', sepStr='>')
DedupeSeq(s=['a'], sepStr=None)
DedupeSeq(s=['a', 'a', 'b', 'b'], sepStr=None)
'''
## creates a seq table
# which also includes slicing based on what boolean columns
# for the seq containing prods
# seqDimCols are the dimensions used in the sequence definition,
# for example if seqDimCols=['prod', 'form_factor']
# then the sequence elements look like: mailingFeat-COMP
# partitionCols are the dimensions for which we slice the sequence data
# keepIndCols specifies if we should also keep the partitionCols in the seq table
# e.g. partitionCols=['user_id', 'date'] would insure
# that the sequences for each [user and date] are separated
#(in different rows)
# this only happens if keepIndCols = True
# we always shift but keep track of event order
# condDict is for slicing the data
def CreateSeqDf(
df,
timeCol,
seqDimCols,
partitionCols,
timeGap,
trim,
keepTimeCols=False,
timeColEnd=None,
extraCols=[],
extraColsDeduped=[],
seqIdCols=None,
addOrigSeqInfo=True,
addBasket=True,
addLagInfo=True,
lagTrim=2,
ordered=False,
method='split_by_ind',
addResetDate_seqStartDate=True):
df = df.reset_index(drop=True)
#Mark(df)
df = Concat_stringColsDf(df, cols=seqDimCols, colName=None, sepStr='-')
respCol = '-'.join(seqDimCols)
seqDf = CreateTimeSeq_andDedupe(
df=df,
respCol=respCol,
timeCol=timeCol,
timeGap=timeGap,
timeColEnd=timeColEnd,
partitionCols=partitionCols,
extraCols=extraCols,
ordered=ordered,
seqCol='seq_undeduped',
dedupedColName='seq_deduped',
parallelSuffix='_parallel',
method=method)
extraCols_parallel = [s + '_parallel' for s in extraCols]
## reset an existing (or add) date column to be seq_start_date
if addResetDate_seqStartDate:
seqDf['date'] = seqDf['seq_start_timestamp'].dt.date
seqDf['full_seq_dur_secs'] = (seqDf['seq_end_timestamp'] -
seqDf['seq_start_timestamp']).values / np.timedelta64(1, 's')
for col in ['seq_start_timestamp', 'seq_end_timestamp', 'date']:
if col in seqDf.columns:
seqDf[col] = seqDf[col].map(str)
## assign seq id
if seqIdCols is None:
seqIdCols = partitionCols
seqDf = Concat_stringColsDf(
df=seqDf, cols=seqIdCols, colName='seq_id', sepStr='-')
seqDf['seq_id'] = seqDf['seq_id'] + '-' + seqDf['seq_start_timestamp']
## add basket info for full sequences (not trimmed)
if addOrigSeqInfo:
seqDf = SeqToBasketDf(
df=seqDf,
cols=(['seq_deduped'] + extraCols),
sepStr='>',
prefix='full_',
suffix='_basket')
## add completely deduped versions for the full sequences
seqDf = Seq_completeDedupeDf(
df=seqDf,
cols=(['seq_deduped'] + extraCols),
sepStr='>',
prefix='full_',
suffix='_completely_deduped')
for col in (['seq_undeduped', 'seq_deduped'] +
extraCols + extraCols_parallel):
seqDf['full_' + col] = seqDf[col]
## fix the over expressive column names
seqDf.rename(
columns={
'full_seq_deduped_completely_deduped': 'full_seq_completely_deduped',
'full_seq_deduped_basket': 'full_seq_basket'},
inplace=True)
seqDf = AddSeqLength(
df=seqDf,
seqCol='seq_undeduped',
seqLenCol='full_seq_undeduped_length',
sepStr='>')
seqDf = AddSeqLength(
df=seqDf,
seqCol='seq_deduped',
seqLenCol='full_seq_deduped_length',
sepStr='>')
#Mark(seqDf[:5])
## shift-augmenting the sequences
# this will also add the seq_shift_order
# in case we want to get back un-shifted seq only
seqDf = ShiftedSeqDf(
df=seqDf,
seqCol='seq_deduped',
k=trim,
lagK=lagTrim,
sepStr='>',
extraCols=extraCols_parallel)
seqDf['shifted_seq_id'] = seqDf['seq_id'] + '-' + seqDf['seq_shift_order']
## adding event order
seqDf = AddSeqOrdEvent(
df=seqDf.copy(),
seqCol='trimmed_seq_deduped',
sepStr='>',
noneValue='BLANK')
## adding baskets to the shifted sequences and their extra columns
seqDf = SeqToBasketDf(
df=seqDf,
cols=(
['trimmed_seq_deduped']
+ [('trimmed_'+ x) for x in extraCols_parallel]),
sepStr='>',
prefix='',
suffix='_basket')
## changing overly expressive column names
# (basket is more reduction that deduping so we drop deduped)
seqDf.rename(
columns={
'trimmed_seq_deduped_basket': 'trimmed_sequence_basket'},
inplace=True)
seqDf['trimmed_seq_count'] = 1
## adding seq length
seqDf = AddSeqLength(
df=seqDf,
seqCol='trimmed_seq_deduped',
seqLenCol='trimmed_seq_deduped_length',
sepStr='>')
## for each extraCol (e.g. interface)
# we check if the corresponding seq is mixed or same
for col in extraCols:
seqDf = AddSeq_uniqueOrMixed(
df=seqDf,
seqCol='trimmed_' + col + '_parallel',
newColName='trimmed_' + col + '_parallel' + '_mix',
sepStr='>')
for col in extraColsDeduped:
seqDf['trimmed_' + col + '_seq_deduped'] = (
seqDf['trimmed_' + col + '_parallel'].map(
lambda s: DedupeSeq(s, sepStr='>')))
## removing the columns created on the fly which are not needed.
for col in ['seq_undeduped'] + extraCols:
del seqDf[col]
return seqDf
'''
df = GenUsageDf_forTesting()
extraCols =['form_factor']
timeCol = 'time'
timeGap = 10*1
timeColEnd = 'end_time'
trim = 3
## Example
seqDf = CreateSeqDf(
df=df,
timeCol='time',
seqDimCols=['prod', 'form_factor'],
partitionCols=['user_id'],
timeGap=timeGap,
trim=trim,
keepTimeCols=True,
timeColEnd=timeColEnd,
extraCols=extraCols,
ordered=True)
for col in list(seqDf.columns):
print(col)
seqDf[['full_seq_undeduped',
'full_seq_deduped',
'trimmed_seq_deduped',
'trimmed_seq_deduped_basket',
'trimmed_form_factor_parallel',
'trimmed_form_factor_parallel_basket',
'trimmed_form_factor_parallel_mix']]
'''
####
'''
df = GenUsageData(userNum=50, dt1=datetime.datetime(2017, 4, 12, 23, 0, 0),
dt2=datetime.datetime(2017, 4, 13, 2, 0, 0))
## Example 1
seqDf1 = CreateSeqDf(
df=df,
timeCol='time',
seqDimCols=['prod', 'form_factor'],
partitionCols=['user_id'],
timeGap=1*60,
trim=3,
extraCols=[],
ordered=True)
Mark(seqDf1)
## Example 2
df = GenUsageData(userNum=50, dt1=datetime.datetime(2017, 4, 12, 23, 0, 0),
dt2=datetime.datetime(2017, 4, 13, 2, 0, 0))
seqDf2 = CreateSeqDf(
df=df,
timeCol='time',
seqDimCols=['prod', 'form_factor'],
partitionCols=['user_id'],
timeGap=1*60,
trim=3,
extraCols=['prod', 'form_factor'],
ordered=True)
'''
'''
## better example
df = pd.DataFrame(columns=['country', 'user_id', 'date', 'time', 'end_time', 'prod', 'form_factor'])
df.loc[0] = ['US', '0', '2017-04-12', '2017-04-12 00:03:00', '2017-04-12 00:04:00', 'PresFeat', 'COMP']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:04:01', '2017-04-12 00:05:03', 'photoFeat', 'COMP']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:05:05', '2017-04-12 00:06:04', 'PresFeat', 'PHN']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:06:05', '2017-04-12 00:06:08', 'PresFeat', 'PHN']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:06:30', '2017-04-12 00:06:45', 'exploreFeat', 'COMP']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:07:00', '2017-04-12 00:07:50', 'editingFeat', 'PHN']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:14:00', '2017-04-12 00:14:10', 'photoFeat', 'COMP']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:16:00', '2017-04-12 00:18:59', 'locFeat', 'COMP']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:19:00', '2017-04-12 00:20:00', 'locFeat', 'COMP']
df.loc[len(df)] = ['US', '0', '2017-04-12', '2017-04-12 00:22:00', '2017-04-12 00:22:00', 'browsingFeat', 'PHN']
for col in ['time', 'end_time']:
df[col] = df[col].map(ConvertToDateTimeFcn())
extraCols =['form_factor']
timeCol = 'time'
timeGap = 10*1
timeColEnd = 'end_time'
trim = 3
## Example
seqDf = CreateSeqDf(
df=df,
timeCol='time',
seqDimCols=['prod', 'form_factor'],
partitionCols=['user_id'],
timeGap=timeGap,
trim=trim,
keepTimeCols=True,
timeColEnd=timeColEnd,
extraCols=[],
ordered=True)
'''
## this function builds sequential data and
def BuildAndWriteSeqDf(
df,
fn,
seqDimCols,
partitionCols,
timeGap,
trim,
timeCol,
keepTimeCols=False,
timeColEnd=None,
seqPropCols=[],
seqPropColsDeduped=[],
seqIdCols=None,
writePath='',
addOrigSeqInfo=True,
addBasket=True,
addLagInfo=False,
lagTrim=3,
ordered=False,
method='split_by_ind',
addResetDate_seqStartDate=True):
"""
This function takes timestamped event data and create sequential data.
Inputs
df: data frame which has the data
timeCol: the column which include the event times
timeColEnd: the column which ends the end of the event, this could be passed
same as timeCol
seqDimCols: these are the building blocks for the sequence elements
for example [form_factor, product]
partitionCols: these are partition columns used to partition the data.
you will be able to slice by them in the sequential data generated.
for example partitionCols = [user_id, country]
timeGap: the length of time gap (inactivity) used to break the sequences.
seqPropCols: columns which are properties of events to be also tracked.
we build parallel sequences to the main sequence using these properties.
for example if seqPropCols = []
seqPropColsDeduped: a subset of seqPropCols which are to be deduped as well
ordered: If this is True the code will assume the data is already ordered wrt
time. If not it will order the data.
Output:
output is a data frame which includes sequential data.
The sequences are denoted as a1>a2>a3 where ">" is the separator
full_[col]_parallel: for a property given in col,
(we refer to these properties in code by seqPropCols),
this is the parallel sequence to “full_seq_deduped
full_seq_deduped: this is the full sequence after complete deduping
full_seq_basket: this is the basket (set) of elements appearing
in the full sequence
trimmed_seq_deduped: this is the sequence after deduping and trimming.
This is usually the most important dimension for many use cases
trimmed_seq_basket: this is the set of elements appearing
in the trimmed sequence given in trimmed_seq_basket
trimmed_[col]_parallel: for a given property in col, e.g. form_factor,
this is the parallel sequence to the trimmed sequence
seq_shift_order: the data includes full sequences of actions for a user visit,
but it is also augmented by shifted version of sequences.
To restrict the data to sequences which start from time zero,
choose: seq_shift_order=0
full_seq_undeduped_length: the length of the undeduped sequence
full_seq_deduped_length: you can restrict the sequences of the represented data
by using this variable. For example you can choose all lengths
bigger than 1 to explore flows better.
event_1, event_2, … You can restrict to for example second
event being equal to a particular event.
[col]_mix: if a sequence includes only one value for a property given in [col]
this will be equal to that values.
If the property includes multiple values during the sequence/journey
then its equal to “MIXED”. For example for col = [form_factor] we might have
a sequence which changes the form factor: COMP > PHONE > COMP
which will be assigned "MIXED"
[col]_parallel is the parallel sequence built along the main sequence to
track a specific property.
subseq_1_2, subseq_1_2_3, subseq_1_2_3_4: these are shorter versions of the
main sequence data given in "full_seq_deduped"
"""
seqDf = CreateSeqDf(
df=df,
timeCol=timeCol,
seqDimCols=seqDimCols,
partitionCols=partitionCols,
timeGap=timeGap,
trim=trim,
keepTimeCols=keepTimeCols,
timeColEnd=timeColEnd,
extraCols=seqPropCols,
extraColsDeduped=seqPropColsDeduped,
seqIdCols=seqIdCols,
addOrigSeqInfo=addOrigSeqInfo,
addBasket=addBasket,
addLagInfo=addLagInfo,
lagTrim=lagTrim,
ordered=ordered,
method=method,
addResetDate_seqStartDate=addResetDate_seqStartDate)
'''
for col in ['trimmed_seq_deduped_length',
'full_seq_deduped_length',
'full_seq_undeduped_length']:
if col in list(seqDf.columns):
seqDf[col] = seqDf[col].map(str)
'''
#Mark(seqDf)
del seqDf['deduping_ind']
if fn != None:
WriteCsv(df=seqDf, fn=writePath + fn + '.csv', printLog=True)
return seqDf
## create random sequences
def GenRandomSeq(size, pvals=[0.5, 0.1] + [0.05]*8):
x = np.random.multinomial(n=10, pvals=pvals, size=size)
df = pd.DataFrame({'seq': x.tolist()})
def F(x):
x = [str(y) for y in x]
return '>'.join(x)
df['seq'] = df['seq'].map(F)
df['seq_count'] = np.random.poisson(lam=5.0, size=size)
return df
# simulation for sig odds
def SimulationSeqOdds():
df = GenRandomSeq(size=1000, pvals=[0.5, 0.3, 0.1, 0.1])
res = SeqConfIntDf(
df=df,
seqCol='seq',
Fcn=SeqTransOddsFcn,
seqCountCol='seq_count',
shift=True,
sepStr='>',
bsSize=200)
res['odds'].map(np.log).hist()
plt.title('log odds')
return res
'''
res = SimulationSeqOdds()
print(res['lower'] > 2).mean()
print(res['upper'] < 0.5).mean()
'''
|
class text:
def __init__(self,text,*,thin=False,cancel=False,underline=False,bold=False,Italic=False,hide=False,Bg="black",Txt="white"):
self.__color={
"black":30,
"red":31,
"green":32,
"yellow":33,
"blue":34,
"mazenta":35,
"cian":36,
"white":37
}
self.underline=""
if underline:self.underline="\033[4m"
self.bold=""
if bold:self.bold="\033[1m"
self.italic=""
if Italic:self.italic="\033[3m"
self.hide=""
if hide:self.hide=="\033[8m"
self.cancel=""
if cancel:self.cancel=="\033[9m"
self.thin=""
if thin:self.thin=="\033[9m"
self.bg="\033["+str(self.__color[Bg]+10)+"m"
self.txt="\033["+str(self.__color[Txt])+"m"
self.text=self.cancel+self.thin+self.underline+self.bold+self.italic+self.bg+self.hide+self.txt+text+"\033[m"
useable_color=[
"black",
"red",
"green",
"yellow",
"blue",
"mazenta",
"cian",
"white"
]
def move_up(n=1):
print("\033["+str(n)+"A")
def move_up_start(n=1):
print("\033["+str(n)+"E")
def move_down(n=1):
print("\033["+str(n)+"B")
def move_down_start(n=1):
print("\033["+str(n)+"F")
def move_right(n=1):
print("\033["+str(n)+"C")
def move_left(n=1):
print("\033["+str(n)+"D")
def clear_before():
print("\033[1")
def clear_after():
print("\033[0")
def clear_all():
print("\033[2")
def clear_line_before():
print("\033[1K")
def clear_line_after():
print("\033[0K")
def clear_line_all():
print("\033[2K")
def scroll_before(n):
print("\033["+str(n)+"T")
def scroll_after(n):
print("\033["+str(n)+"S")
class canvas:
def __init__(self,*,width=10,height=5):
self.__width=width
self.__height=height
print(str(" "*self.__width,"\n")*height)
#print(text("test",cancel=True,thin=True,underline=True,bold=True,Txt="mazenta",Bg="cian").text)
#scroll_before(20)
|
# 23. Merge k Sorted Lists
# Runtime: 148 ms, faster than 33.74% of Python3 online submissions for Merge k Sorted Lists.
# Memory Usage: 17.8 MB, less than 82.01% of Python3 online submissions for Merge k Sorted Lists.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
# Merge with Divide And Conquer
def mergeKLists(self, lists: list[ListNode]) -> ListNode:
def merge_two_lists(list1: ListNode, list2: ListNode) -> ListNode:
head = ListNode()
curr = head
while list1 and list2:
if list1.val < list2.val:
curr.next = list1
list1 = list1.next
else:
curr.next = list2
list2 = list2.next
curr = curr.next
if list1:
curr.next = list1
else:
curr.next = list2
return head.next
while len(lists) > 1:
new_lists = []
for i in range(0, len(lists) - 1, 2):
new_lists.append(merge_two_lists(lists[i], lists[i + 1]))
if len(lists) % 2 != 0:
new_lists.append(lists[-1])
lists = new_lists
return lists[0] if lists else None
|
configuration = None
def init():
global configuration
configuration = None
|
class FileSourceDepleted(Exception):
"""Exception raised when attempting to read from a depleted source file
Attributes:
filepath(str): path to depleted file
message(str): error message
"""
def __init__(self, filepath: str, message: str = "File source is depleted"):
"""Construct FileSourceDepleted
:param filepath: path to depleted file
:type filepath: str
:param message: error message
:type message: str
"""
self.filepath = filepath
self.message = message
super().__init__(message)
def __str__(self) -> str:
"""Get the informal string representation of the error
:return: full error message
:rtype: str
"""
return f"{self.filepath}: {self.message}"
|
class ArpProperties(object):
def __init__(self, bpm, base_note, pitch_value):
self.bpm = bpm
self.base_note = base_note
self.pitch = pitch_value
|
# Python añadirá internamente el nombre de la clase delante de __baz
class Foo(object):
def __init__(self):
self.__baz = 42
def foo(self):
print(self.__baz)
# Como el método __init__ empieza por __, en realidad será Bar__init__, y el del padre Foo__init__. Así existen por separado
class Bar(Foo):
def __init__(self):
super().__init__()
self.__baz = 21
def bar(self):
print(self.__baz)
x = Bar()
x.foo() # 42, porque el método imprime Foo__baz
x.bar() # 21, porque el método imprime Bar__baz
# Podemos ver los miembros "mangleados" que tiene la instancia x
print(x.__dict__) # {'_Bar__baz': 21, '_Foo__baz': 42}
|
# Day26 of 100 Days Of Code in Python
# get common numbers from two files using list comprehension
with open("file1.txt") as file1:
file1_data = file1.readlines()
with open("file2.txt") as file2:
file2_data = file2.readlines()
result = [int(item) for item in file1_data if item in file2_data]
print(result)
|
pricelist = []
price = ""
while price != "kolar":
print(""" \n\nThe following things are
what you can do whith this program.
0 = Exit
1 = Show pricelist
2 = Add price
3 = Delete pricelist
4 = Sort pricelist """)
choice = input(" \n Choice : ")
if choice == "0":
print ("\n ***GOOD BYE***")
elif choice == "1":
print ("\n The following is the list of this program \n")
for item in pricelist:
print (item)
elif choice == "2":
add = int(input("\n Add any price you like sir : "))
pricelist.append(add)
elif choice == "3":
delete = int(input("\n Please Type number you wanna delete : "))
if delete in pricelist:
pricelist.remove(delete)
else:
print (delete), ("\n not in our pricelist")
elif choice == "4":
pricelist.sort()
else:
print ("\n Hello can't you read English \n yout choice is : ") ,
"choice"
|
#!/usr/bin/python3
# Problem : https://code.google.com/codejam/contest/351101/dashboard#s=p0
__author__ = 'Varun Barad'
def main():
no_of_test_cases = int(input())
for i in range(no_of_test_cases):
credit = int(input())
no_of_items = int(input())
items = input().split(' ')
for j in range(no_of_items):
items[j] = int(items[j])
for j in range(no_of_items):
if (credit-items[j]) in items[(j+1):]:
break
print('Case #{0}: {1} {2}'.format((i+1), (j+1), (items[(j+1):].index(credit-items[j])+j+2)))
if __name__ == '__main__':
main()
|
# The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
##
#73167176531330624919225119674426574742355349194934
#96983520312774506326239578318016984801869478851843
#85861560789112949495459501737958331952853208805511
#12540698747158523863050715693290963295227443043557
#66896648950445244523161731856403098711121722383113
#62229893423380308135336276614282806444486645238749
#30358907296290491560440772390713810515859307960866
#70172427121883998797908792274921901699720888093776
#65727333001053367881220235421809751254540594752243
#52584907711670556013604839586446706324415722155397
#53697817977846174064955149290862569321978468622482
#83972241375657056057490261407972968652414535100474
#82166370484403199890008895243450658541227588666881
#16427171479924442928230863465674813919123162824586
#17866458359124566529476545682848912883142607690042
#24219022671055626321111109370544217506941658960408
#07198403850962455444362981230987879927244284909188
#84580156166097919133875499200524063689912560717606
#05886116467109405077541002256983155200055935729725
#71636269561882670428252483600823257530420752963450
##
#Find the thirteen adjacent digits in the 1000-digit number that have the greatest product.
#What is the value of this product?
def naredi_seznam(n):
"""dobimo seznam, ki vsebuje posamezne cifre števila"""
sez = []
while n > 9:
ostanek = n % 10
n = n // 10
sez.append(ostanek)
sez.append(n)
return sez[::-1]
def the_greatest_product_13(n):
sez = naredi_seznam(n)
max_product = 0
while len(sez) >= 13:
new_product = 1
for i in sez[:13]:
new_product *= i
max_product = max(max_product, new_product)
sez = sez[1:]
return max_product
num = int("""
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450""".replace("\n", ""))
print(the_greatest_product_13(num))
|
usuarios={
"iperurena": {
"nombre": "Iñaki",
"apellido": "Perurena",
"password": "123123"
},
"fmuguruza": {
"nombre": "Fermín",
"apellido": "Muguruza",
"password": "654321"
},
"aolaizola": {
"nombre": "Aimar",
"apellido": "Olaizola",
"password": "123456"
}
}
p=0
lista=[]
for key in usuarios.items():
user=str(input("Ingrese su usuario: "))
contraseña=int(input("Ingrese contraseña: "))
lista.append(key)
if user in lista and contraseña in lista:
p=p+1
print("incorrecto")
else:
print(usuarios[user]["nombre"])
print(usuarios[user]["apellido"])
break
if(p==3):
print("Cuenta bloqueada")
break
|
def dibujo (base,altura):
dibujo=print("x"*base)
for fila in range (altura):
print("x"+" "*(base-2)+"x")
dibujo=print("x"*base)
dibujo(7,5)
|
class Solution:
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
G = [0]*(n+1)
G[0], G[1] = 1, 1
for i in range(2, n+1):
for j in range(1, i+1):
G[i] += G[j-1] * G[i-j]
return G[n]
class MathSolution(object):
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
C = 1
for i in range(0, n):
C = C * 2*(2*i+1)/(i+2)
return int(C)
|
#
# PySNMP MIB module PACKETFRONT-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PACKETFRONT-SMI
# Produced by pysmi-0.3.4 at Wed May 1 14:36:10 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
IpAddress, ModuleIdentity, iso, ObjectIdentity, Counter64, NotificationType, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Gauge32, enterprises, Unsigned32, Integer32, Bits, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "ModuleIdentity", "iso", "ObjectIdentity", "Counter64", "NotificationType", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Gauge32", "enterprises", "Unsigned32", "Integer32", "Bits", "MibIdentifier")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
packetfront = ModuleIdentity((1, 3, 6, 1, 4, 1, 9303))
packetfront.setRevisions(('2009-03-23 10:39', '2008-01-17 14:05', '2007-05-11 12:28',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: packetfront.setRevisionsDescriptions(('Updated telephone number in contact-info', 'Correct warnings in imports', 'Created from PACKETFRONT-MIB.mib',))
if mibBuilder.loadTexts: packetfront.setLastUpdated('200903231039Z')
if mibBuilder.loadTexts: packetfront.setOrganization('PacketFront Systems AB')
if mibBuilder.loadTexts: packetfront.setContactInfo('PacketFront Systems AB Customer Service Mail : Isafjordsgatan 35 SE-164 28 Kista Sweden Tel : +46 8 5090 1500 E-mail: snmp@packetfront.com Web : http://www.packetfront.com')
if mibBuilder.loadTexts: packetfront.setDescription('The PacketFront management information base SMI definitions')
pfProduct = ObjectIdentity((1, 3, 6, 1, 4, 1, 9303, 1))
if mibBuilder.loadTexts: pfProduct.setStatus('current')
if mibBuilder.loadTexts: pfProduct.setDescription('The product group from which sysObjectID values are set.')
pfConfig = ObjectIdentity((1, 3, 6, 1, 4, 1, 9303, 2))
if mibBuilder.loadTexts: pfConfig.setStatus('current')
if mibBuilder.loadTexts: pfConfig.setDescription('The configuration subtree')
ipdConfig = ObjectIdentity((1, 3, 6, 1, 4, 1, 9303, 2, 1))
if mibBuilder.loadTexts: ipdConfig.setStatus('current')
if mibBuilder.loadTexts: ipdConfig.setDescription('The configuration subtree')
pfExperiment = ObjectIdentity((1, 3, 6, 1, 4, 1, 9303, 3))
if mibBuilder.loadTexts: pfExperiment.setStatus('current')
if mibBuilder.loadTexts: pfExperiment.setDescription('The root object for experimental objects. Experimental objects are used during development before a permanent assignment to the packetfront mib has been determined. Objects in this tree will come and go. No guarantees for their existance or accuracy is ever provided.')
pfMgmt = ObjectIdentity((1, 3, 6, 1, 4, 1, 9303, 4))
if mibBuilder.loadTexts: pfMgmt.setStatus('current')
if mibBuilder.loadTexts: pfMgmt.setDescription('The root object for all PacketFront management objects')
pfModules = ObjectIdentity((1, 3, 6, 1, 4, 1, 9303, 5))
if mibBuilder.loadTexts: pfModules.setStatus('current')
if mibBuilder.loadTexts: pfModules.setDescription('pfModules provides a root object identifier from which the MODULE-IDENTITY values may be assigned')
mibBuilder.exportSymbols("PACKETFRONT-SMI", ipdConfig=ipdConfig, pfProduct=pfProduct, pfConfig=pfConfig, packetfront=packetfront, pfModules=pfModules, pfExperiment=pfExperiment, pfMgmt=pfMgmt, PYSNMP_MODULE_ID=packetfront)
|
casa = float(input('Valor da casa: '))
sal = float(input('Salário do comprador: R$'))
anos = int(input('prazo em anos de financiamento: '))
prest = casa / (anos * 12)
smin = sal * 0.3
print('para pagar uma casa de R${:.2f} em {} anos '.format(casa, anos), end='')
print('a prestação será de R${:.2f}'.format(prest))
if prest <= smin:
print('Empréstimo \33[32mCONCEDIDO!\33[m')
else:
print('Empréstimo \33[31mNEGADO!\33[m')
|
#!/bin/python3
def generate_prime_numbers(lim):
"""
Generates prime numbers above 100 10**100
"""
start = 10**100
l = []
for num in range(start, lim):
for n in range(2, num):
if num % n == 0:
print("Not found")
break
else: # If the modulus is never zero, it is prime
print(num)
return l
test = generate_prime_numbers((10**100)+38)
|
#coding:utf-8
'''
使用ProxyHandler在程序中动态设置代理
import urllib2
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:8087'})
opener = urllib2.build_opener([proxy,])
urllib2.install_opener(opener)
response = urllib2.urlopen('http://www.zhihu.com/')
print response.read()
'''
'''
直接调用 opener 的 open方法代替全局的 urlopen方法
import urllib2
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:8087'})
opener = urllib2.build_opener(proxy,)
response = opener.open("http://www.zhihu.com/")
print response.read()
'''
|
"""7 valores numéricos
lista de par
lista de impar"""
números = [[], []]
print('=-' * 30)
for c in range(1, 8):
num = int(input('Digite o {}o. valor. '.format(c)))
if num % 2 == 0:
números[1].append(num)
else:
números[0].append(num)
for c in range(0, 2):
números[c].sort()
print('=-' * 30)
print(f'Os valores pares digitados foram: {números[1]}')
print(f'Os valores impares digitados foram: {números[0]}')
|
"""
Board class that the game takes place in/against/on
"""
class Board(object):
"""The game Board"""
def __init__(self):
brown = ('Mediterranean Avenue', 'Baltic Avenue')
lightBlue = ('Oriential Avenue', 'Vermont Avenue', 'Connecticut Avenue')
pink = ('St. Charles PLace', 'States Avenue', 'Virginia Avenue')
orange = ('St. James Place', 'Tennessee Avenue', 'New York Avenue')
red = ('Kentucky Avenue', 'Indiana Avenue', 'Illinois Avenue')
yellow = ('Atlantic Avenue', 'Ventnor Avenue', 'Marvin Gardens')
green = ('Pacific Avenue', 'North Carolina Avenue', 'Pennsylvania Avenue')
darkBlue = ('Park Place', 'Boardwalk')
stations = ('Reading Railroad', 'Pennsylvania Railroad', 'B & O Railroad', 'Short Line')
jail = ('jail')
go = ('go')
utilities = ('Electric Company', 'Water Works')
|
# Python3.5
# 定义一个栈类
class Stack():
# 栈的初始化
def __init__(self):
self.items = []
# 判断栈是否为空,为空返回True
def isEmpty(self):
return self.items ==[]
# 向栈内压入一个元素
def push(self, item):
self.items.append(item)
# 从栈内推出最后一个元素
def pop(self):
return self.items.pop()
# 返回栈顶元素
def peek(self):
return self.items[len(self.items)-1]
# 判断栈的大小
def size(self):
return len(self.items)
# 栈属性测试
# 测试数据
# s = Stack()
# print(s.isEmpty())
# s.push(4)
# s.push('dog')
# print(s.peek())
# s.push(True)
# print(s.isEmpty())
# s.push(8.4)
# print(s.pop())
# print(s.pop())
# print(s.size())
# 利用栈将字串的字符反转
def revstring(mystr):
# your code here
s = Stack()
outputStr = ''
for c in mystr:
s.push(c)
while not s.isEmpty():
outputStr += s.pop()
return outputStr
# print(revstring('apple'))
# print(revstring('x'))
# print(revstring('1234567890'))
# 利用栈判断括号平衡Balanced parentheses
def parChecker(symbolString):
s = Stack()
balanced = True
index = 0
while index < len(symbolString) and balanced:
symbol = symbolString[index]
if symbol in '([{':
s.push(symbol)
else:
if s.isEmpty():
balanced = False
else:
top = s.pop()
if not matches(top, symbol):
balanced = False
index += 1
if balanced and s.isEmpty():
return True
else:
return False
def matches(open, close):
opens = '([{'
closers = ')]}'
return opens.index(open) == closers.index(close)
# print(parChecker('({([()])}){}'))
# 利用栈将十进制整数转化为二进制整数
def Dec2Bin(decNumber):
s = Stack()
while decNumber > 0:
temp = decNumber % 2
s.push(temp)
decNumber = decNumber // 2
binString = ''
while not s.isEmpty():
binString += str(s.pop())
return binString
# print(Dec2Bin(42))
# 利用栈实现多进制转换
def baseConverter(decNumber, base):
digits = '0123456789ABCDEF'
s = Stack()
while decNumber > 0:
temp = decNumber % base
s.push(temp)
decNumber = decNumber // base
newString = ''
while not s.isEmpty():
newString = newString + digits[s.pop()]
return newString
# print(baseConverter(59, 16))
# 利用栈实现普通多项式的后缀表达式
def infixToPostfix(infixexpr):
prec = {}
prec['*'] = 3
prec['/'] = 3
prec['+'] = 2
prec['-'] = 2
prec['('] = 1
opStack = Stack()
postfixList = []
tokenList = infixexpr.split()
for token in tokenList:
if token in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' or token in '0123456789':
postfixList.append(token)
elif token == '(':
opStack.push(token)
elif token == ')':
topToken = opStack.pop()
while topToken != '(':
postfixList.append(topToken)
topToken = opStack.pop()
else:
while (not opStack.isEmpty()) and (prec[opStack.peek()] >= prec[token]):
postfixList.append(opStack.pop())
opStack.push(token)
while not opStack.isEmpty():
postfixList.append(opStack.pop())
return ''.join(postfixList)
# print(infixToPostfix("A * B + C * D"))
# print(infixToPostfix("( A + B ) * C - ( D - E ) * ( F + G )"))
|
"""Rules for ANTLR 3."""
def imports(folder):
""" Returns the grammar and token files found below the given lib directory. """
return (native.glob(["{0}/*.g".format(folder)]) +
native.glob(["{0}/*.g3".format(folder)]) +
native.glob(["{0}/*.tokens".format(folder)]))
def _get_lib_dir(imports):
""" Determines the directory that contains the given imports. """
lib = {}
for resource in imports:
lib[resource.path.replace("/" + resource.basename, "")] = None
count = len(lib)
# the lib directory does not allow nested directories
if count > 1:
fail("All imports must be located in the same directory, but found {}".format(lib))
return lib.keys()[0] if count == 1 else None;
def _generate(ctx):
""" Generates the source files. """
if not ctx.files.srcs:
fail("No grammars provided, either add the srcs attribute or check your filespec", attr="srcs")
args = ctx.actions.args()
if ctx.attr.debug:
args.add("-debug")
if ctx.attr.depend:
args.add("-depend")
if ctx.attr.dfa:
args.add("-dfa")
if ctx.attr.dump:
args.add("-dump")
if ctx.attr.language:
args.add("-language")
args.add(ctx.attr.language)
lib = _get_lib_dir(ctx.files.imports)
if lib:
args.add("-lib")
args.add(lib)
args.add("-make")
if ctx.attr.message_format:
args.add("-message-format")
args.add(ctx.attr.message_format)
if ctx.attr.nfa:
args.add("-nfa")
output_dir = ctx.configuration.genfiles_dir.path
args.add("-o")
args.add(output_dir)
if ctx.attr.profile:
args.add("-profile")
if ctx.attr.report:
args.add("-report")
if ctx.attr.trace:
args.add("-trace")
if ctx.attr.Xconversiontimeout:
args.add("-Xconversiontimeout")
args.add(ctx.attr.Xconversiontimeout)
if ctx.attr.Xdbgconversion:
args.add("-Xdbgconversion")
if ctx.attr.Xdbgst:
args.add("-XdbgST")
if ctx.attr.Xdfa:
args.add("-Xdfa")
if ctx.attr.Xdfaverbose:
args.add("-Xdfaverbose")
if ctx.attr.Xgrtree:
args.add("-Xgrtree")
if ctx.attr.Xm:
args.add("-Xm")
args.add(ctx.attr.Xm)
if ctx.attr.Xmaxdfaedges:
args.add("-Xmaxdfaedges")
args.add(ctx.attr.Xmaxdfaedges)
if ctx.attr.Xmaxinlinedfastates:
args.add("-Xmaxinlinedfastates")
args.add(ctx.attr.Xmaxinlinedfastates)
if ctx.attr.Xmultithreaded:
args.add("-Xmultithreaded")
if ctx.attr.Xnfastates:
args.add("-Xnfastates")
if ctx.attr.Xnocollapse:
args.add("-Xnocollapse")
if ctx.attr.Xnomergestopstates:
args.add("-Xnomergestopstates")
if ctx.attr.Xnoprune:
args.add("-Xnoprune")
if ctx.attr.XsaveLexer:
args.add("-XsaveLexer")
if ctx.attr.Xwatchconversion:
args.add("-Xwatchconversion")
srcjar = ctx.outputs.src_jar
tool_inputs, _, input_manifests=ctx.resolve_command(tools=ctx.attr.deps + [ctx.attr._tool])
ctx.actions.run(
arguments = [args],
inputs = ctx.files.srcs + ctx.files.imports + tool_inputs,
outputs = [srcjar],
mnemonic = "ANTLR3",
executable = ctx.executable._tool,
env = {
"ANTLR_VERSION": "3",
"GRAMMARS": ",".join([f.path for f in ctx.files.srcs]),
"OUTPUT_DIRECTORY": output_dir,
"SRC_JAR": srcjar.path,
"TOOL_CLASSPATH": ",".join([f.path for f in tool_inputs]),
},
input_manifests = input_manifests,
progress_message = "Processing ANTLR 3 grammars",
)
antlr3 = rule(
implementation = _generate,
attrs = {
"debug": attr.bool(default=False),
"depend": attr.bool(default=False),
"deps": attr.label_list(default=[
Label("@antlr3_runtime//jar"),
Label("@antlr3_tool//jar"),
Label("@stringtemplate4//jar"),
]),
"dfa": attr.bool(default=False),
"dump": attr.bool(default=False),
"imports": attr.label_list(allow_files=True),
"language": attr.string(),
"message_format": attr.string(),
"nfa": attr.bool(default=False),
"profile": attr.bool(default=False),
"report": attr.bool(default=False),
"srcs": attr.label_list(allow_files=True, mandatory=True),
"trace": attr.bool(default=False),
"Xconversiontimeout": attr.int(),
"Xdbgconversion": attr.bool(default=False),
"Xdbgst": attr.bool(default=False),
"Xdfa": attr.bool(default=False),
"Xdfaverbose": attr.bool(default=False),
"Xgrtree": attr.bool(default=False),
"Xm": attr.int(),
"Xmaxdfaedges": attr.int(),
"Xmaxinlinedfastates": attr.int(),
"Xminswitchalts": attr.int(),
"Xmultithreaded": attr.bool(default=False),
"Xnfastates": attr.bool(default=False),
"Xnocollapse": attr.bool(default=False),
"Xnoprune": attr.bool(default=False),
"Xnomergestopstates": attr.bool(default=False),
"XsaveLexer": attr.bool(default=False),
"Xwatchconversion": attr.bool(default=False),
"_tool": attr.label(
executable=True,
cfg="host",
default=Label("@rules_antlr//src/main/java/org/antlr/bazel")),
},
outputs = {
"src_jar": "%{name}.srcjar",
},
)
""" Runs [ANTLR 3](https://www.antlr.org//) on a set of grammars.
Args:
debug: Generate a parser that emits debugging events.
depend: Generate file dependencies; don't actually run antlr.
deps: The dependencies to use. Defaults to the most recent ANTLR 3 release,
but if you need to use a different version, you can specify the
dependencies here.
dfa: Generate a DFA for each decision point.
imports: The grammar and .tokens files to import. Must be all in the same directory.
language: The code generation target language. Either C, Cpp, CSharp2, CSharp3,
JavaScript, Java, ObjC, Python, Python3 or Ruby (case-sensitive).
message_format: Specify output style for messages.
nfa: Generate an NFA for each rule.
dump: Print out the grammar without actions.
profile: Generate a parser that computes profiling information.
report: Print out a report about the grammar(s) processed.
srcs: The grammar files to process.
trace: Generate a parser with trace output. If the default output is not
enough, you can override the traceIn and traceOut methods.
Xgrtree: Print the grammar AST.
Xdfa: Print DFA as text.
Xnoprune: Do not test EBNF block exit branches.
Xnocollapse: Collapse incident edges into DFA states.
Xdbgconversion: Dump lots of info during NFA conversion.
Xmultithreaded: Run the analysis in 2 threads.
Xnomergestopstates: Do not merge stop states.
Xdfaverbose: Generate DFA states in DOT with NFA configs.
Xwatchconversion: Print a message for each NFA before converting.
Xdbgst: Put tags at start/stop of all templates in output.
Xm: Max number of rule invocations during conversion.
Xmaxdfaedges: Max "comfortable" number of edges for single DFA state.
Xminswitchalts: Don't generate switch() statements for dfas smaller than given number.
Xconversiontimeout: Set NFA conversion timeout for each decision.
Xmaxinlinedfastates: Max DFA states before table used rather than inlining.
Xnfastates: For nondeterminisms, list NFA states for each path.
Xsavelexer: Don't delete temporary lexers generated from combined grammars.
Outputs:
name.srcjar: The .srcjar with the generated files.
"""
|
#
# @lc app=leetcode id=989 lang=python3
#
# [989] Add to Array-Form of Integer
#
# https://leetcode.com/problems/add-to-array-form-of-integer/description/
#
# algorithms
# Easy (44.85%)
# Total Accepted: 12.6K
# Total Submissions: 28.1K
# Testcase Example: '[1,2,0,0]\n34'
#
# For a non-negative integer X, the array-form of X is an array of its digits
# in left to right order. For example, if X = 1231, then the array form is
# [1,2,3,1].
#
# Given the array-form A of a non-negative integer X, return the array-form of
# the integer X+K.
#
#
#
#
#
#
#
# Example 1:
#
#
# Input: A = [1,2,0,0], K = 34
# Output: [1,2,3,4]
# Explanation: 1200 + 34 = 1234
#
#
#
# Example 2:
#
#
# Input: A = [2,7,4], K = 181
# Output: [4,5,5]
# Explanation: 274 + 181 = 455
#
#
#
# Example 3:
#
#
# Input: A = [2,1,5], K = 806
# Output: [1,0,2,1]
# Explanation: 215 + 806 = 1021
#
#
#
# Example 4:
#
#
# Input: A = [9,9,9,9,9,9,9,9,9,9], K = 1
# Output: [1,0,0,0,0,0,0,0,0,0,0]
# Explanation: 9999999999 + 1 = 10000000000
#
#
#
#
# Note:
#
#
# 1 <= A.length <= 10000
# 0 <= A[i] <= 9
# 0 <= K <= 10000
# If A.length > 1, then A[0] != 0
#
#
#
#
#
#
class Solution:
def addToArrayForm(self, A: List[int], K: int) -> List[int]:
sizeTable = [9, 99, 999, 9999, 99999,
999999, 9999999, 99999999, 999999999]
def stringSize(x):
for i in range(len(sizeTable)):
if x <= sizeTable[i]:
return i+1
mylen = max(len(A), stringSize(K))
sol = [0 for _ in range(mylen)]
for i in range(1, len(A)+1):
sol[-i] = A[-i]
plus = (sol[-1] + K) // 10
sol[-1] = (sol[-1] + K) % 10
for i in range(len(sol)-2, -1, -1):
sol[i] += plus
plus = sol[i] // 10
if plus != 0:
sol[i] %= 10
if plus:
sol.insert(0, 1)
return sol
|
class Error(Exception):
"""
Base class for other exceptions
"""
def __init__(self, *args):
if args:
self.message = args[0]
else:
self.message = None
def __str__(self):
return self.message if self.message else " "
class DatabaseError(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class DatabaseIsLocked(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class DatabaseUndefinedTable(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class DatabaseNotFound(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class OSNotSupported(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class BadOS(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class BrowserNotImplemented(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class MacOSKeychainAccessError(Error):
def __init__(self, *args):
Error.__init__(self, *args)
class LinuxSafeStorageError(Error):
def __init__(self, *args):
Error.__init__(self, *args)
|
# Python Program to find Perfect Number using For loop
Number = int(input(" Please Enter any Number: "))
Sum = 0
for i in range(1, Number):
if(Number % i == 0):
Sum = Sum + i
if (Sum == Number):
print(" %d is a Perfect Number" %Number)
else:
print(" %d is not a Perfect Number" %Number)
|
## Copyright (c) 2022, Team FirmWire
## SPDX-License-Identifier: BSD-3-Clause
TASKNAMES_LTE = [
"ERT",
"EMACDL",
"EL2H",
"EL2",
"ERRC",
"EMM",
"EVAL",
"ETC",
"LPP",
"IMC",
"SDM",
"VDM",
"IWLAN",
"WO",
"EL1",
"EL1_MPC",
"MLL1",
"SIMMNGR",
"L1ADT",
"SSDS",
]
TASKNAMES_2G3G = [
"RRLP",
"RATCM",
"MRS",
"URR",
"UL2",
"TL2",
"UL2D",
"TL2D",
"GL1_PCORE",
"RSVA",
"MM",
"CC",
"CISS",
"SMS",
"SIM",
"SIM2",
"L4",
"RR_FDD",
"RR_TDD",
"RSMFDD",
"RSMTDD",
"SNDCP",
"USM",
"LLC",
"ULCS",
"NWSEL",
"MMF_PCORE",
"TRR",
"UL1",
"L1",
"L1_2",
"LAS",
"MRF",
"TL1",
"TL1DATA",
"FTA",
"XTST",
"ATP",
"DDM",
"L1D_MDM",
"LMD",
"CPSW",
"CVAL",
"XRLP",
"CHLP",
"CUIM",
"CSS",
"CHSC",
"EVSLC",
"EVCLC",
"EVRMC",
"EVFCP",
"EVRCP",
"CLEC",
"CSEC",
"CL1TST",
"RR_SMP",
"RR_sMP_TDD",
"SBP",
"IPC_ADAPTER",
"SSIPC",
"SSDIAG",
"SSU",
"CASS",
"SS_STARTUP",
]
TASKNAMES_SRV = [
"NVRAM",
"SRVCCCI",
"DHL",
"DR",
"DRT0",
"DRT1",
"0MDDBG",
"1MDDBG",
"DHL_SPR",
"DHLHD",
"DSMT",
"DSMR",
"STKBRG",
"STKMBUF",
"STKEVTD",
"STKDEMX",
"MDM",
]
TASKNAMES_MIDDLEWARE = [
"VT",
"FT",
"FTC",
"LBS",
"IPCORE",
"NMU",
"DEVCCCI",
"LTECSR",
"DPCOPRO",
"KPALV",
"CMUX",
"AUDIO",
"L1AUDIO_SPH_SRV",
"MED",
"0IDLE",
"1IDLE",
"2IDLE",
"3IDLE",
"AUDL",
"CCISMCORE",
"LHIFCORE",
"CCBCCISM",
"SCPCCISM",
]
TASKNAMES_DEACTIVATED = [
# 2G/3G
"MRF",
# LTE
"ERT",
"EMACDL",
"EL2H",
"EL2",
"EL1",
"EL1_MPC",
"MLL1",
# Middle ware
"AUDIO",
]
ROM_BASE_ADDR = 0x0
|
def helper(N):
if (N <= 2):
print ("NO")
return
value = (N * (N + 1)) // 2
if(value%2==1):
print ("NO")
return
s1 = []
s2 = []
if (N%2==0):
shift = True
start = 1
last = N
while (start < last):
if (shift):
s1.append(start)
s1.append(last)
turn = 0
else:
s2.append(start)
s2.append(last)
turn = 1
start += 1
last -= 1
else:
rem = value // 2
vis = [False] * (N + 1)
for i in range (1, N + 1):
vis[i] = False
vis[0] = True
for i in range (N , 0, -1):
if (rem > i):
s1.append(i)
vis[i] = True
rem -= i
else:
s1.append(rem)
vis[rem] = True
break
for i in range (1, N + 1):
if (not vis[i]):
s2.append(i)
s1.sort()
s2.sort()
print("YES")
print (len(s1))
print(s1)
print(len(s2))
print(s2)
n = int(input())
helper(n)
|
ls=[12,3,9,4,1]
a=len(ls)
l=[]
for i in reversed(range(a)):
l.append(ls[i])
print(l)
|
html = """\
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>$title</title>
<style media="screen">
html {
background-color: #dfdfdf;
color: #333;
}
body {
max-width: 750px;
margin: auto;
}
.content {
border-top: 10px solid rgb(5, 75, 159);
border-bottom: 10px solid rgb(123, 207, 3);
box-shadow: 0px 0px 5px 1px #ccc;
padding: 20px;
background-color: #eee;
}
pre {
padding: 5px;
overflow-x: auto;;
background-color: #b6b6b6;
}
code {
padding: 1px 5px;
border-radius: 2px;
background-color: #b6b6b6;
}
pre code {
padding: 0;
}
/* Pygements bw.css
Credits: https://github.com/richleland/pygments-css */
.highlight code, .highlight pre{color:#fdce93;background-color:#3f3f3f}
.highlight .hll{background-color:#222}
.highlight .c{color:#7f9f7f}
.highlight .err{color:#e37170;background-color:#3d3535}
.highlight .g{color:#7f9f7f}
.highlight .k{color:#f0dfaf}
.highlight .l{color:#ccc}
.highlight .n{color:#dcdccc}
.highlight .o{color:#f0efd0}
.highlight .x{color:#ccc}
.highlight .p{color:#41706f}
.highlight .cm{color:#7f9f7f}
.highlight .cp{color:#7f9f7f}
.highlight .c1{color:#7f9f7f}
.highlight .cs{color:#cd0000;font-weight:bold}
.highlight .gd{color:#cd0000}
.highlight .ge{color:#ccc;font-style:italic}
.highlight .gr{color:red}
.highlight .gh{color:#dcdccc;font-weight:bold}
.highlight .gi{color:#00cd00}
.highlight .go{color:gray}
.highlight .gp{color:#dcdccc;font-weight:bold}
.highlight .gs{color:#ccc;font-weight:bold}
.highlight .gu{color:purple;font-weight:bold}
.highlight .gt{color:#0040D0}
.highlight .kc{color:#dca3a3}
.highlight .kd{color:#ffff86}
.highlight .kn{color:#dfaf8f;font-weight:bold}
.highlight .kp{color:#cdcf99}
.highlight .kr{color:#cdcd00}
.highlight .kt{color:#00cd00}
.highlight .ld{color:#cc9393}
.highlight .m{color:#8cd0d3}
.highlight .s{color:#cc9393}
.highlight .na{color:#9ac39f}
.highlight .nb{color:#efef8f}
.highlight .nc{color:#efef8f}
.highlight .no{color:#ccc}
.highlight .nd{color:#ccc}
.highlight .ni{color:#c28182}
.highlight .ne{color:#c3bf9f;font-weight:bold}
.highlight .nf{color:#efef8f}
.highlight .nl{color:#ccc}
.highlight .nn{color:#8fbede}
.highlight .nx{color:#ccc}
.highlight .py{color:#ccc}
.highlight .nt{color:#9ac39f}
.highlight .nv{color:#dcdccc}
.highlight .ow{color:#f0efd0}
.highlight .w{color:#ccc}
.highlight .mf{color:#8cd0d3}
.highlight .mh{color:#8cd0d3}
.highlight .mi{color:#8cd0d3}
.highlight .mo{color:#8cd0d3}
.highlight .sb{color:#cc9393}
.highlight .sc{color:#cc9393}
.highlight .sd{color:#cc9393}
.highlight .s2{color:#cc9393}
.highlight .se{color:#cc9393}
.highlight .sh{color:#cc9393}
.highlight .si{color:#cc9393}
.highlight .sx{color:#cc9393}
.highlight .sr{color:#cc9393}
.highlight .s1{color:#cc9393}
.highlight .ss{color:#cc9393}
.highlight .bp{color:#efef8f}
.highlight .vc{color:#efef8f}
.highlight .vg{color:#dcdccc}
.highlight .vi{color:#ffffc7}
.highlight .il{color:#8cd0d3}
</style>
</head>
<body>
<div class="content">
$content
</div>
</body>
</html>
"""
|
def test_alert_message(alert_message):
"""Use this for check message in different cases:Incorrectly username/password, only username, only password by
parameters """
print(alert_message)
assert 'No match for Username and/or Password.' in alert_message
|
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
n = len(height)
d = [0] * n
for i in range(n):
d[i] = height[i]
for i in range(1, n):
avg = d[i-1] / (i * 1.0)
if height[i] >= avg:
d[i] = max(d[i], d[i-1], d[i-1] + avg)
else:
d[i] = max(d[i], d[i-1], height[i] * (1 + d[i-1]/(avg *1.0)))
for j in range(n):
print('d[%d]:%d' % (j, d[j]))
return d[n-1]
sol = Solution()
height = [10, 8, 0, 7, 7, 9, 9]
ret = sol.maxArea(height)
print('ret: %d' % ret)
|
'''Crie um programa onde o usuário possa digitar sete valores numéricos e cadastre-os em uma lista única que mantenha separados os valores pares e ímpares.
No final, mostre os valores pares e ímpares em ordem crescente.'''
num = [[], []]
c=0
while True:
n = int(input('Digite um número: '))
if n % 2 == 0:
num[0].append(n)
else:
num[1].append(n)
ans=str(input('Quer continuar? [S/N]')).strip().upper()[0]
if ans=="N":
break
for pos,i in enumerate(num):
num[pos].sort
print('---'*20)
print(f'\nLista par {num[0]}.\nLista impar {num[1]}.')
|
"""
Function to retrieve location of a key in nested data structure
"""
def locate_element(data, look_up_elem):
'''
Function to locate the exact location of a an element in a data structure
'''
data_orig = data
loc_list = []
#### Step 1: Create loop: while look_up_elem not in loc_list
while look_up_elem not in loc_list:
data = data_orig
if loc_list != []:
for location in loc_list:
data = data[location]
#### Step 2: Create loop for each element in data.
# This element needs to be appended to loc_list if element is
# found in (sub-levels of) this element
# Combine step 4 and 5 in one function.
# Function is to flatten the data and check if look_up_elem is present in data.
# If element is found, return loc_list
def check_branche(data):
#### Step 2: Check if look_up_element is present on 1st level of data
if look_up_elem in data:
loc_list.append(look_up_elem)
return loc_list
#### Step 3: If element not present on 1st level, filter out strings and integers from data.
# Method is different for different data types
# Note: data_tuple = () (will be problematic, as you cannot append elements to a tuple).
# We may be able to add items from tuple to list as tuple is also a Sequence
# Define data_elements
if isinstance(data, dict):
data_elements = list(data.keys())
elif isinstance(data, list):
data_elements = list(range(len(data)))
# elif type(data)==tuple:
# data_elements = list(range(len(data)))
else:
return "Element not present"
for element in data_elements:
data_to_check = data[element]
# Define data_dict, data_list and data_tuple
if isinstance(data_to_check, dict):
data_dict = data_to_check
data_list = []
data_tuple = ()
elif isinstance(data_to_check, list):
data_dict = {}
data_list = data_to_check
data_tuple = ()
elif isinstance(data_to_check, tuple):
data_dict = {}
data_list = []
data_tuple = data_to_check
elif not isinstance(data_to_check, dict) and not isinstance(data_to_check, list) \
and not isinstance(data_to_check, tuple):
continue
else:
return "Error"
#### Step 5: Enter while loop (is within the for loop of step 4).
# From the filtered data obtained in step 3, divide the different elements into its data type
# Then, flatten type(data) data type first and then the other two data types
# When look_up_elem is found, append element to loc_list and return loc_list
while data_dict != {} or data_list != [] or data_tuple != ():
# Flatten dictionary and check if element is present on any of the levels and
# add list elements to data_list
# After first round, if any elements were added to data_dict,
# go through these added elements
while data_dict != {}:
if look_up_elem in data_dict:
loc_list.append(element)
return
data_dict_temp = {}
# Filter the elements in data_dict
for key, value in iter(data_dict.items()):
if isinstance(value, dict):
data_dict_temp.update(value)
elif isinstance(value, list):
data_list.append(value)
# elif isinstance(value, tuple):
# test_tuple
# to check if tuple is also a sequence, can also use chain(element) for this
else:
continue
data_dict = data_dict_temp
# After data_dict is (temporarily) exhausted, go through data_list
while data_list != []:
if look_up_elem in data_list:
loc_list.append(element)
return loc_list
data_list_temp = []
# Filter the elements in data_dict
for item in data_list:
if isinstance(item, dict):
data_dict.update(item)
elif isinstance(item, list):
for idx in item:
data_list_temp.append(idx)
else:
continue
data_list = data_list_temp
# After data_list is (temporarily) exhausted, go through data_tuple
# while data_tuple !=():
# Flatten tuple, check if element is present on any of the levels and add dictionary
# and list elements to data_dict or data_list
# pass
if look_up_elem not in loc_list:
return "Element not Found"
check_branche(data)
return loc_list
|
#default
def printx(name,age):
print(name)
print(age)
return;
printx(name='miki',age=96)
#keyword
def printm(str):
print(str)
return;
printm(str='sandy')
#required
def printme(str):
print(str)
return;
printme()
|
# Add Bold Tag in String
# Given a string s and a list of strings words, you need to add a closed pair of bold tag
# <b> and </b> to wrap the substrings in s that exist in dict.
# If two such substrings overlap, you need to wrap them together by only one pair of closed bold tag.
# Also, if two substrings wrapped by bold tags are consecutive, you need to combine them.
# Example:
# s = "aaabbcc"
# words = ["aaa","aab","bc"]
# => "<b>aaabbc</b>c"
# assume words won't contain duplicates
class Solution(object):
def addBoldTag(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: str
"""
bold = [False] * len(s)
# index can't jump or skip since there is overlappign words
right = -1 # last index so far of the char that should be bold
for i in range(len(s)):
for word in words:
if s.startswith(word, i):
right = max(right, i + len(word) - 1)
bold[i] = i <= right
res = []
for i in range(len(s)):
if bold[i]:
if i == 0 or not bold[i-1]:
res.append('<b>')
res.append(s[i])
if i == len(s) - 1 or not bold[i+1]:
res.append('</b>')
else:
res.append(s[i])
return ''.join(res)
# note: words can be matched for multiple times
# O(n * c) time, O(n) space, with n being length of s, c being total chars in words
|
class Car:
def __init__(self,marka,model,god,speed=0):
self.marka=marka
self.model=model
self.god=god
self.speed=speed
def speed_up(self):
self.speed+=5
def speed_down(self):
self.speed-=5
def speed_stop(self):
self.speed=0
def print_speed(self):
print(f'Скорость: {self.speed}')
def speed_back(self):
self.speed*=-1
|
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n , k ) :
count = 0
for i in range ( 0 , n ) :
if ( arr [ i ] <= k ) :
count = count + 1
bad = 0
for i in range ( 0 , count ) :
if ( arr [ i ] > k ) :
bad = bad + 1
ans = bad
j = count
for i in range ( 0 , n ) :
if ( j == n ) :
break
if ( arr [ i ] > k ) :
bad = bad - 1
if ( arr [ j ] > k ) :
bad = bad + 1
ans = min ( ans , bad )
j = j + 1
return ans
#TOFILL
if __name__ == '__main__':
param = [
([7, 12, 15, 30, 33, 34, 53, 66, 73, 74, 76, 77, 85, 90],9,8,),
([-62, -20, -26, -24, 92, 66, -74, -4, 18, -82, -36, 92, -4, 92, -80, 56, -24, 4, -48, -10, -14, -46, -16, -58, -58, -6, -68, -22, -82, -16, 76, -30, -86, -38, -66, 28, 58, 30, -44, -56],24,28,),
([0, 0, 0, 0, 0, 1, 1],5,6,),
([8, 48, 64, 77, 61, 60, 96, 95, 41, 68, 9, 67, 10, 66, 16, 59, 83, 21, 47, 16, 13, 85, 52, 11, 48, 31, 99, 57, 57, 44, 66, 93, 80, 69, 23, 2, 55, 90],36,24,),
([-80, -58, -40, -34, 14, 36, 48, 56, 58, 60, 84, 90, 92, 92],7,8,),
([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1],26,23,),
([4, 4, 8, 9, 13, 17, 18, 19, 21, 22, 22, 23, 27, 28, 30, 44, 46, 48, 53, 53, 55, 60, 61, 62, 68, 70, 70, 71, 73, 80, 82, 82, 85, 88, 90, 93, 99],28,36,),
([-28, 50, 82, -32, 32, -78, 12, 50, 38, 34, -10, 6, 86, -56, -2],13,9,),
([0, 0, 0, 0, 1, 1, 1, 1, 1, 1],9,8,),
([37, 88, 83, 91, 11, 39, 98, 70, 93, 74, 24, 90, 66, 3, 6, 28],12,12,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param)))
|
def is_leap(year):
leap = False
if year%400==0:
return True
if year%4==0 and year%100!=0:
return True
return leap
year = int(input())
print(is_leap(year))
|
"""
'The module for first_inside_quotes'
Arthur Wayne asw263
September 22 2020
"""
def first_inside_quotes(s):
"""
Returns the first substring of s between two (double) quotes
A quote character is one that is inside a string, not one that
delimits it. We typically use single quotes (') to delimit a
string if want to use a double quote character (") inside of it.
Examples:
first_inside_quotes('A "B C" D') returns 'B C'
first_inside_quotes('A "B C" D "E F" G') also returns 'B C',
because it only picks the first such substring
Parameter s: a string to search
Precondition: s is a string containing at least two double quotes
"""
start = s.index('"')+1
end = s.index('"',start)
insidequotes = s[start:end]
return insidequotes
|
"""
A linked list is given such that each node contains an additional random pointer
which could point to any node in the list or null.
Return a deep copy of the list.
"""
# Definition for singly-linked list with a random pointer.
# class RandomListNode(object):
# def __init__(self, x):
# self.label = x
# self.next = None
# self.random = None
class Solution(object):
def copyRandomList(self, head):
"""
:type head: RandomListNode
:rtype: RandomListNode
"""
if head is None:
return head
curr = head
while curr:
p = curr.next
curr.next = RandomListNode(curr.label)
curr.next.next = p
curr = p
curr = head
while curr:
if curr.random:
curr.next.random = curr.random.next
else:
curr.next.random = None
curr = curr.next.next
newhead = RandomListNode(0)
newhead.next = head.next
curr = head
while curr:
p = curr.next.next
if p:
curr.next.next = p.next
else:
curr.next.next = None
curr.next = p
curr = p
return newhead.next
"""
Solved with the help of hash dictionary
def copyRandomList(self, head):
if head is None:
return head
table = {}
table[None] = None
curr = head
while curr:
table[curr] = RandomListNode(curr.label)
curr = curr.next
newhead = table[head]
curr = head
while curr:
table[curr].next = table[curr.next]
table[curr].random = table[curr.random]
curr = curr.next
return newhead
"""
|
with open("inp1.txt") as file:
data = file.read()
depths = [int(line) for line in data.splitlines()]
depth_inc_cnt = 0
for i in range(1, len(depths)):
if depths[i] > depths[i - 1]:
depth_inc_cnt += 1
print(f"Part 1: {depth_inc_cnt}")
assert depth_inc_cnt == 1832
depth_windowed_inc_cnt = 0
for i in range(1, len(depths) - 2):
if sum(depths[i: i + 3]) > sum(depths[i - 1: i + 2]):
depth_windowed_inc_cnt += 1
print(f"Part 2: {depth_windowed_inc_cnt}")
assert depth_windowed_inc_cnt == 1858
|
class ListNode:
def __init__ (self, val, next = None):
self.val = val
self.next = next
class Solution:
def swapPairs(self, head):
dummy = ListNode(0)
curr = dummy
dummy.next = head
while curr.next and curr.next.next:
tmp = curr.next
tmp2 = curr.next.next
tmp3 = curr.next.next.next
curr.next = tmp2
tmp2.next = tmp
tmp.next = tmp3
curr = tmp
return dummy.next
if __name__ == "__main__":
l1 = ListNode(1)
l2 = ListNode(2)
l3 = ListNode(3)
l4 = ListNode(4)
l1.next = l2
l2.next = l3
l3.next = l4
s = Solution()
s.swapPairs(l1)
|
# UVa 11450 - Wedding Shopping - Bottom Up (faster than Top Down)
def main():
TC = int(input())
for tc in range(TC):
MAX_gm = 30 # 20 garments at most and 20 models per garment at most
MAX_M = 210 # maximum budget is 200
price = [[-1 for i in range(MAX_gm)] for j in range(MAX_gm)] # price[g (<= 20)][model (<= 20)]
#reachable = [[False for i in range(MAX_M)] for j in range(MAX_gm)] # reachable table[g (<= 20)][money (<= 200)]
# if using space saving technique
reachable = [[False for i in range(MAX_M)] for j in range(2)] # reachable table[ONLY TWO ROWS][money (<= 200)]
M, C = [int(x) for x in input().split(" ")]
for g in range(C):
s = [int(x) for x in input().split(" ")]
price[g][0] = s[0] # store number of models in price[g][0]
for k in range(1, price[g][0]+1):
price[g][k] = s[k]
# initial values (base cases), using first garment g = 0
for k in range(1, price[0][0]+1):
if (M-price[0][k] >= 0):
reachable[0][M-price[0][k]] = True
# for g in range(1, C): # for each remaining garment
# for money in range(0, M):
# if (reachable[g-1][money]):
# for k in range(1, price[g][0]+1):
# if (money-price[g][k] >= 0):
# reachable[g][money-price[g][k]] = True # also reachable now
# money = 0
# while (money <= M and not reachable[C-1][money]):
# money += 1
# then we modify the main loop in main a bit
cur = 1 # we start with this row
for g in range(1, C): # for each remaining garment
reachable[cur] = [False for i in range(MAX_M)] # reset row
for money in range(0, M):
if (reachable[1-cur][money]):
for k in range(1, price[g][0]+1):
if (money-price[g][k] >= 0):
reachable[cur][money-price[g][k]] = True
cur = 1-cur # IMPORTANT technique: flip the two rows
money = 0
while (money <= M and not reachable[1-cur][money]):
money += 1
if (money == M+1):
print("no solution")
else:
print(str(M-money))
main()
|
LOVE = 'this'
def lover():
"""
docstring
"""
print(LOVE)
def print_nothing():
"""
printing nothing
"""
print('nothing')
def print_nothings():
"""
printing nothings
"""
print('nothings')
class All():
"""
Some doc right here
"""
def __init__(self):
"""
Doctst
"""
self.hell = 'ok'
def alpha(self):
"""
Some doc right here
"""
print(self.hell)
def alphax(self):
"""
Some doc right heres
"""
print(self.hell)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.