content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
pkgname = "pcre"
pkgver = "8.45"
pkgrel = 0
build_style = "gnu_configure"
configure_args = [
"--with-pic",
"--enable-utf8",
"--enable-unicode-properties",
"--enable-pcretest-libedit",
"--enable-pcregrep-libz",
"--enable-pcregrep-libbz2",
"--enable-newline-is-anycrlf",
"--enable-jit",
"--enable-static",
"--disable-stack-for-recursion",
]
hostmakedepends = ["pkgconf"]
makedepends = ["zlib-devel", "libbz2-devel", "libedit-devel"]
pkgdesc = "Perl Compatible Regular Expressions"
maintainer = "q66 <q66@chimera-linux.org>"
license = "BSD-3-Clause"
url = "http://www.pcre.org"
source = f"$(SOURCEFORGE_SITE)/{pkgname}/{pkgname}/{pkgver}/{pkgname}-{pkgver}.tar.bz2"
sha256 = "4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8"
options = ["!cross"]
def post_install(self):
self.install_license("LICENCE")
@subpackage("libpcrecpp")
def _libpcrecpp(self):
self.pkgdesc = f"{pkgdesc} (C++ shared libraries)"
return ["usr/lib/libpcrecpp.so.*"]
@subpackage("libpcre")
def _libpcre(self):
self.pkgdesc = f"{pkgdesc} (shared libraries)"
return self.default_libs()
@subpackage("pcre-devel")
def _devel(self):
self.depends += ["zlib-devel", "libbz2-devel"]
return self.default_devel(man = True, extra = ["usr/share/doc"])
| pkgname = 'pcre'
pkgver = '8.45'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--with-pic', '--enable-utf8', '--enable-unicode-properties', '--enable-pcretest-libedit', '--enable-pcregrep-libz', '--enable-pcregrep-libbz2', '--enable-newline-is-anycrlf', '--enable-jit', '--enable-static', '--disable-stack-for-recursion']
hostmakedepends = ['pkgconf']
makedepends = ['zlib-devel', 'libbz2-devel', 'libedit-devel']
pkgdesc = 'Perl Compatible Regular Expressions'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'BSD-3-Clause'
url = 'http://www.pcre.org'
source = f'$(SOURCEFORGE_SITE)/{pkgname}/{pkgname}/{pkgver}/{pkgname}-{pkgver}.tar.bz2'
sha256 = '4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8'
options = ['!cross']
def post_install(self):
self.install_license('LICENCE')
@subpackage('libpcrecpp')
def _libpcrecpp(self):
self.pkgdesc = f'{pkgdesc} (C++ shared libraries)'
return ['usr/lib/libpcrecpp.so.*']
@subpackage('libpcre')
def _libpcre(self):
self.pkgdesc = f'{pkgdesc} (shared libraries)'
return self.default_libs()
@subpackage('pcre-devel')
def _devel(self):
self.depends += ['zlib-devel', 'libbz2-devel']
return self.default_devel(man=True, extra=['usr/share/doc']) |
def m2f_e(s, st):
return [[st.index(ch), st.insert(0, st.pop(st.index(ch)))][0] for ch in s]
def m2f_d(sq, st):
return ''.join([st[i], st.insert(0, st.pop(i))][0] for i in sq)
ST = list('abcdefghijklmnopqrstuvwxyz')
for s in ['broood', 'bananaaa', 'hiphophiphop']:
encode = m2f_e(s, ST[::])
print('%14r encodes to %r' % (s, encode), end=', ')
decode = m2f_d(encode, ST[::])
print('decodes back to %r' % decode)
assert s == decode, 'Whoops!'
| def m2f_e(s, st):
return [[st.index(ch), st.insert(0, st.pop(st.index(ch)))][0] for ch in s]
def m2f_d(sq, st):
return ''.join(([st[i], st.insert(0, st.pop(i))][0] for i in sq))
st = list('abcdefghijklmnopqrstuvwxyz')
for s in ['broood', 'bananaaa', 'hiphophiphop']:
encode = m2f_e(s, ST[:])
print('%14r encodes to %r' % (s, encode), end=', ')
decode = m2f_d(encode, ST[:])
print('decodes back to %r' % decode)
assert s == decode, 'Whoops!' |
def get_pyenv_root():
return "/usr/local/pyenv"
def get_user():
return "root"
def get_group():
return "root"
def get_rc_file():
return "/etc/profile.d/pyenv.sh"
def get_python_test_case():
return "3.9.0", True
def get_venv_test_case():
return "neovim", True
| def get_pyenv_root():
return '/usr/local/pyenv'
def get_user():
return 'root'
def get_group():
return 'root'
def get_rc_file():
return '/etc/profile.d/pyenv.sh'
def get_python_test_case():
return ('3.9.0', True)
def get_venv_test_case():
return ('neovim', True) |
# https://www.hackerrank.com/challenges/30-testing/forum/comments/138775
print("5")
print("5 3\n-1 90 999 100 0")
print("4 2\n0 -1 2 1")
print("3 3\n-1 0 1")
print("6 1\n-1 0 1 -1 2 3")
print("7 3\n-1 0 1 2 3 4 5")
| print('5')
print('5 3\n-1 90 999 100 0')
print('4 2\n0 -1 2 1')
print('3 3\n-1 0 1')
print('6 1\n-1 0 1 -1 2 3')
print('7 3\n-1 0 1 2 3 4 5') |
def inorde_tree_walk(self, vertice = None):
if(self.raiz == None): #arvore vazia
return
if(verice == None): #Por padrao comeca pela raiz
vertice = self.raiz
if(vertice.left != None): #Decomposicao
self.inorde_tree_walk(vertice = vertice.left)
print(vertice)
if(vertice.right != None): #Decomposicao
self.inorde_tree_walk(vertice = vertice.right) | def inorde_tree_walk(self, vertice=None):
if self.raiz == None:
return
if verice == None:
vertice = self.raiz
if vertice.left != None:
self.inorde_tree_walk(vertice=vertice.left)
print(vertice)
if vertice.right != None:
self.inorde_tree_walk(vertice=vertice.right) |
#
# PySNMP MIB module HM2-DHCPS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HM2-DHCPS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:31:20 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")
ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint")
HmEnabledStatus, hm2ConfigurationMibs = mibBuilder.importSymbols("HM2-TC-MIB", "HmEnabledStatus", "hm2ConfigurationMibs")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter32, Bits, Unsigned32, ModuleIdentity, ObjectIdentity, Counter64, Integer32, iso, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, IpAddress, Gauge32, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Bits", "Unsigned32", "ModuleIdentity", "ObjectIdentity", "Counter64", "Integer32", "iso", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "IpAddress", "Gauge32", "NotificationType")
TextualConvention, RowStatus, DisplayString, MacAddress = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString", "MacAddress")
hm2DhcpsMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 248, 11, 91))
hm2DhcpsMib.setRevisions(('2012-03-16 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: hm2DhcpsMib.setRevisionsDescriptions(('Initial version.',))
if mibBuilder.loadTexts: hm2DhcpsMib.setLastUpdated('201203160000Z')
if mibBuilder.loadTexts: hm2DhcpsMib.setOrganization('Hirschmann Automation and Control GmbH')
if mibBuilder.loadTexts: hm2DhcpsMib.setContactInfo('Postal: Stuttgarter Str. 45-51 72654 Neckartenzlingen Germany Phone: +49 7127 140 E-mail: hac.support@belden.com')
if mibBuilder.loadTexts: hm2DhcpsMib.setDescription('Hirschmann DHCP server MIB. Copyright (C) 2012. All Rights Reserved.')
hm2DHCPServerMibNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 0))
hm2DHCPServerMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1))
hm2DHCPServerSNMPExtensionGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 3))
hm2DHCPServerGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1))
hm2DHCPServerConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1))
hm2DHCPServerLeaseGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2))
hm2DHCPServerInterfaceGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3))
hm2DHCPServerCounterGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4))
hm2DHCPServerMode = MibScalar((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 1), HmEnabledStatus().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2DHCPServerMode.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerMode.setDescription('Enable or disable DHCP server global.')
hm2DHCPServerMaxPoolEntries = MibScalar((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerMaxPoolEntries.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerMaxPoolEntries.setDescription('Maximum possible entries in hm2DHCPServerPoolTable.')
hm2DHCPServerMaxLeaseEntries = MibScalar((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerMaxLeaseEntries.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerMaxLeaseEntries.setDescription('Maximum possible entries in hm2DHCPServerLeaseTable.')
hm2DHCPServerPoolTable = MibTable((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5), )
if mibBuilder.loadTexts: hm2DHCPServerPoolTable.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolTable.setDescription('A table containing the DHCP server pools.')
hm2DHCPServerPoolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1), ).setIndexNames((0, "HM2-DHCPS-MIB", "hm2DHCPServerPoolIndex"))
if mibBuilder.loadTexts: hm2DHCPServerPoolEntry.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolEntry.setDescription('A logical row in the hm2DHCPServerPoolTable.')
hm2DHCPServerPoolIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerPoolIndex.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolIndex.setDescription('The index of hm2DHCPServerPoolTable.')
hm2DHCPServerPoolStartIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 2), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolStartIpAddress.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolStartIpAddress.setDescription('The IPv4 address of the first address in the range. The value of hm2DHCPServerPoolStartIpAddress MUST be less than or equal to the value of hm2DHCPServerPoolEndIpAddress.')
hm2DHCPServerPoolEndIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 3), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolEndIpAddress.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolEndIpAddress.setDescription('The IPv4 address of the last address in the range. The value of hm2DHCPServerPoolEndIpAddress MUST be greater than or equal to the value of hm2DHCPServerPoolStartIpAddress.')
hm2DHCPServerPoolLeaseTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 4), Unsigned32().clone(86400)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolLeaseTime.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolLeaseTime.setDescription("The pools lease time in number of seconds. A value of 4294967295 SHOULD be used for leases that have a lease time which is 'infinite' and for BOOTP leases.")
hm2DHCPServerPoolFlags = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 5), Bits().clone(namedValues=NamedValues(("interface", 0), ("mac", 1), ("gateway", 2), ("clientid", 3), ("remoteid", 4), ("circuitid", 5), ("dynamic", 6), ("vlanid", 7)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolFlags.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolFlags.setDescription('This object shows the parameters that are used to lease the IP Address.')
hm2DHCPServerPoolIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 6), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolIfIndex.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolIfIndex.setDescription('The index of the interface.')
hm2DHCPServerPoolMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 7), MacAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolMacAddress.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolMacAddress.setDescription('The MAC Address of the entry that is used to lease the IP Address.')
hm2DHCPServerPoolGateway = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 8), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolGateway.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolGateway.setDescription('The IPv4 address of the Gatewayinterface that is used to lease the IP Address.')
hm2DHCPServerPoolClientId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 9), OctetString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolClientId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolClientId.setDescription('The Client Identifier of the entry that is used to lease the IP Address.')
hm2DHCPServerPoolRemoteId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 10), OctetString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolRemoteId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolRemoteId.setDescription('The Remote Identifier of the entry that is used to lease the IP Address. The Remote Identifier must be send in Option 82 as defined in RFC 3046.')
hm2DHCPServerPoolCircuitId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 11), OctetString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolCircuitId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolCircuitId.setDescription('The Cicuit Identifier of the entry that is used to lease the IP Address. The Circuit Identifier must be send in Option 82 as defined in RFC 3046.')
hm2DHCPServerPoolHirschmannClient = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 12), HmEnabledStatus().clone('disable')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolHirschmannClient.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolHirschmannClient.setDescription('Enable or disable Hirschmann Multicast.')
hm2DHCPServerPoolVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 13), Integer32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolVlanId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolVlanId.setDescription('The Vlan ID of the entry that is used to lease the IP Address. A value of -1 corresponds to management vlan (the default), any other value (1-4042) represents a specific VLAN')
hm2DHCPServerPoolOptionConfFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 30), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 70))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionConfFileName.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionConfFileName.setDescription('Full specified name of the configuration file e.g. tftp://192.9.200.1/cfg/config1.sav. An empty string zeros the SNAME and the FILE field in the DHCP header.')
hm2DHCPServerPoolOptionGateway = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 31), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionGateway.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionGateway.setDescription('The IPv4 address of the Gateway. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2DHCPServerPoolOptionNetmask = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 32), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionNetmask.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionNetmask.setDescription('The subnet mask. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2DHCPServerPoolOptionWINS = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 33), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionWINS.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionWINS.setDescription('The IPv4 address of the WINS Server. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2DHCPServerPoolOptionDNS = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 34), IpAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionDNS.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionDNS.setDescription('The IPv4 address of the DNS Server. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2DHCPServerPoolOptionHostname = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 35), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionHostname.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolOptionHostname.setDescription('The name of the client (Option 12). An empty string disables the attachment of the option field in the DHCP message.')
hm2DHCPServerPoolMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 36), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("config", 2), ("ttdp", 3))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2DHCPServerPoolMethod.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolMethod.setDescription('The source of the DHCP Server Pool. User can set the object to none(1), config(2), ttdp(3).')
hm2DHCPServerPoolErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 99), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerPoolErrorStatus.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolErrorStatus.setDescription('The error Code by create a new Pool.')
hm2DHCPServerPoolRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 100), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hm2DHCPServerPoolRowStatus.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerPoolRowStatus.setDescription('This object indicates the status of this entry.')
hm2DHCPServerLeaseTable = MibTable((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1), )
if mibBuilder.loadTexts: hm2DHCPServerLeaseTable.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseTable.setDescription('A table containing the DHCP server leases.')
hm2DHCPServerLeaseEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1), ).setIndexNames((0, "HM2-DHCPS-MIB", "hm2DHCPServerLeasePoolIndex"), (0, "HM2-DHCPS-MIB", "hm2DHCPServerLeaseIpAddress"))
if mibBuilder.loadTexts: hm2DHCPServerLeaseEntry.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseEntry.setDescription('A logical row in the hm2DHCPServerLeaseTable.')
hm2DHCPServerLeasePoolIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 128))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeasePoolIndex.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeasePoolIndex.setDescription('The index of the hm2DHCPServerPoolTable above.')
hm2DHCPServerLeaseIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 2), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseIpAddress.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseIpAddress.setDescription('This is an IP address from the pool with index hm2DHCPServerLeasePoolIndex.')
hm2DHCPServerLeaseState = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("bootp", 1), ("offering", 2), ("requesting", 3), ("bound", 4), ("renewing", 5), ("rebinding", 6), ("declined", 7), ("released", 8)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseState.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseState.setDescription('The state of the lease.')
hm2DHCPServerLeaseTimeRemaining = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseTimeRemaining.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseTimeRemaining.setDescription('The remaining time of the lease configured in hm2DHCPServerPoolLeaseTime.')
hm2DHCPServerLeaseIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseIfIndex.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseIfIndex.setDescription('The interface index where the lease is currently active.')
hm2DHCPServerLeaseClientMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 6), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseClientMacAddress.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseClientMacAddress.setDescription('The MAC Address of the entry that has leased the IP Address.')
hm2DHCPServerLeaseGateway = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 7), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseGateway.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseGateway.setDescription('The IPv4 address of the Gatewayinterface that was used to lease the IP Address.')
hm2DHCPServerLeaseClientId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseClientId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseClientId.setDescription('The Client Identifier of the entry that was used to lease the IP Address.')
hm2DHCPServerLeaseRemoteId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseRemoteId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseRemoteId.setDescription('The Remote Identifier of the entry that was used to lease the IP Address.')
hm2DHCPServerLeaseCircuitId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseCircuitId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseCircuitId.setDescription('The Cicuit Identifier of the entry that was used to lease the IP Address.')
hm2DHCPServerLeaseStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseStartTime.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseStartTime.setDescription('Lease start Time.')
hm2DHCPServerLeaseAction = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("other", 1), ("release", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2DHCPServerLeaseAction.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseAction.setDescription('Manually release this ip address for new assignment.')
hm2DHCPServerLeaseVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerLeaseVlanId.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerLeaseVlanId.setDescription('The Vlan ID of the entry that is used to lease the IP Address. A value of -1 corresponds to management vlan (the default), any other value (1-4042) represents a specific VLAN')
hm2DHCPServerIfConfigTable = MibTable((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1), )
if mibBuilder.loadTexts: hm2DHCPServerIfConfigTable.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerIfConfigTable.setDescription('A table containing current configuration information for each interface.')
hm2DHCPServerIfConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1, 1), ).setIndexNames((0, "HM2-DHCPS-MIB", "hm2DHCPServerIfConfigIndex"))
if mibBuilder.loadTexts: hm2DHCPServerIfConfigEntry.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerIfConfigEntry.setDescription('A logical row in the hm2DHCPServerIfConfigTable.')
hm2DHCPServerIfConfigIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerIfConfigIndex.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerIfConfigIndex.setDescription('The index of the interface.')
hm2DHCPServerIfConfigMode = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1, 1, 2), HmEnabledStatus().clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hm2DHCPServerIfConfigMode.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerIfConfigMode.setDescription('Enable or disable DHCP server on this interface.')
hm2DHCPServerCounterIfTable = MibTable((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2), )
if mibBuilder.loadTexts: hm2DHCPServerCounterIfTable.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterIfTable.setDescription('A table containing current configuration information for each interface.')
hm2DHCPServerCounterIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1), ).setIndexNames((0, "HM2-DHCPS-MIB", "hm2DHCPServerCounterIfIndex"))
if mibBuilder.loadTexts: hm2DHCPServerCounterIfEntry.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterIfEntry.setDescription('A logical row in the hm2DHCPServerCounterIfTable.')
hm2DHCPServerCounterIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterIfIndex.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterIfIndex.setDescription('The index of the interface.')
hm2DHCPServerCounterBootpRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpRequests.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpRequests.setDescription('The number of packets received that contain a Message Type of 1 (BOOTREQUEST) in the first octet and do not contain option number 53 (DHCP Message Type) in the options.')
hm2DHCPServerCounterBootpInvalids = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpInvalids.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpInvalids.setDescription('The number of packets received that do not contain a Message Type of 1 (BOOTREQUEST) in the first octet or are not valid BOOTP packets (e.g., too short, invalid field in packet header).')
hm2DHCPServerCounterBootpReplies = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpReplies.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpReplies.setDescription('The number of packets sent that contain a Message Type of 2 (BOOTREPLY) in the first octet and do not contain option number 53 (DHCP Message Type) in the options.')
hm2DHCPServerCounterBootpDroppedUnknownClients = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpDroppedUnknownClients.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpDroppedUnknownClients.setDescription('The number of BOOTP packets dropped due to the server not recognizing or not providing service to the hardware address received in the incoming packet.')
hm2DHCPServerCounterBootpDroppedNotServingSubnet = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpDroppedNotServingSubnet.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterBootpDroppedNotServingSubnet.setDescription('The number of BOOTP packets dropped due to the server not being configured or not otherwise able to serve addresses on the subnet from which this message was received.')
hm2DHCPServerCounterDhcpv4Discovers = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Discovers.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Discovers.setDescription('The number of DHCPDISCOVER (option 53 with value 1) packets received.')
hm2DHCPServerCounterDhcpv4Offers = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Offers.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Offers.setDescription('The number of DHCPOFFER (option 53 with value 2) packets sent.')
hm2DHCPServerCounterDhcpv4Requests = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Requests.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Requests.setDescription('The number of DHCPREQUEST (option 53 with value 3) packets received.')
hm2DHCPServerCounterDhcpv4Declines = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Declines.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Declines.setDescription('The number of DHCPDECLINE (option 53 with value 4) packets received.')
hm2DHCPServerCounterDhcpv4Acks = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Acks.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Acks.setDescription('The number of DHCPACK (option 53 with value 5) packets sent.')
hm2DHCPServerCounterDhcpv4Naks = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Naks.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Naks.setDescription('The number of DHCPNACK (option 53 with value 6) packets sent.')
hm2DHCPServerCounterDhcpv4Releases = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Releases.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Releases.setDescription('The number of DHCPRELEASE (option 53 with value 7) packets received.')
hm2DHCPServerCounterDhcpv4Informs = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 27), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Informs.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Informs.setDescription('The number of DHCPINFORM (option 53 with value 8) packets received.')
hm2DHCPServerCounterDhcpv4ForcedRenews = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 28), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4ForcedRenews.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4ForcedRenews.setDescription('The number of DHCPFORCERENEW (option 53 with value 9) packets sent.')
hm2DHCPServerCounterDhcpv4Invalids = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 29), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Invalids.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4Invalids.setDescription('The number of DHCP packets received whose DHCP message type (i.e., option number 53) is not understood or handled by the server.')
hm2DHCPServerCounterDhcpv4DroppedUnknownClient = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 30), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4DroppedUnknownClient.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4DroppedUnknownClient.setDescription('The number of DHCP packets dropped due to the server not recognizing or not providing service to the client-id and/or hardware address received in the incoming packet.')
hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 31), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet.setDescription('The number of DHCP packets dropped due to the server not being configured or not otherwise able to serve addresses on the subnet from which this message was received.')
hm2DHCPServerCounterMiscOtherDhcpServer = MibTableColumn((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 40), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hm2DHCPServerCounterMiscOtherDhcpServer.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerCounterMiscOtherDhcpServer.setDescription('The number of BOOTP and DHCP packets from another DHCP server seen on this interface.')
hm2DHCPServerRowStatusInvalidConfigurationErrorReturn = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 11, 91, 3, 1))
if mibBuilder.loadTexts: hm2DHCPServerRowStatusInvalidConfigurationErrorReturn.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerRowStatusInvalidConfigurationErrorReturn.setDescription('DHCP Server pool with index {0} cannot be enabled, errors in data entry.')
hm2DHCPServerConflictDHCPRrelayErrorReturn = ObjectIdentity((1, 3, 6, 1, 4, 1, 248, 11, 91, 3, 2))
if mibBuilder.loadTexts: hm2DHCPServerConflictDHCPRrelayErrorReturn.setStatus('current')
if mibBuilder.loadTexts: hm2DHCPServerConflictDHCPRrelayErrorReturn.setDescription('{0} and {1} cannot be active at the same time.')
mibBuilder.exportSymbols("HM2-DHCPS-MIB", hm2DHCPServerPoolMacAddress=hm2DHCPServerPoolMacAddress, hm2DHCPServerLeaseAction=hm2DHCPServerLeaseAction, hm2DHCPServerIfConfigIndex=hm2DHCPServerIfConfigIndex, hm2DHCPServerMibNotifications=hm2DHCPServerMibNotifications, hm2DHCPServerConfigGroup=hm2DHCPServerConfigGroup, hm2DHCPServerCounterMiscOtherDhcpServer=hm2DHCPServerCounterMiscOtherDhcpServer, hm2DHCPServerCounterDhcpv4Discovers=hm2DHCPServerCounterDhcpv4Discovers, hm2DHCPServerLeaseStartTime=hm2DHCPServerLeaseStartTime, hm2DHCPServerPoolLeaseTime=hm2DHCPServerPoolLeaseTime, hm2DHCPServerPoolErrorStatus=hm2DHCPServerPoolErrorStatus, hm2DHCPServerCounterIfTable=hm2DHCPServerCounterIfTable, hm2DHCPServerLeaseEntry=hm2DHCPServerLeaseEntry, hm2DHCPServerCounterBootpDroppedUnknownClients=hm2DHCPServerCounterBootpDroppedUnknownClients, hm2DHCPServerPoolEntry=hm2DHCPServerPoolEntry, hm2DHCPServerIfConfigMode=hm2DHCPServerIfConfigMode, hm2DHCPServerCounterBootpReplies=hm2DHCPServerCounterBootpReplies, hm2DHCPServerLeaseGroup=hm2DHCPServerLeaseGroup, hm2DHCPServerLeaseClientId=hm2DHCPServerLeaseClientId, hm2DHCPServerCounterIfIndex=hm2DHCPServerCounterIfIndex, hm2DHCPServerCounterDhcpv4Naks=hm2DHCPServerCounterDhcpv4Naks, hm2DHCPServerPoolVlanId=hm2DHCPServerPoolVlanId, hm2DHCPServerIfConfigEntry=hm2DHCPServerIfConfigEntry, hm2DHCPServerCounterDhcpv4ForcedRenews=hm2DHCPServerCounterDhcpv4ForcedRenews, hm2DHCPServerPoolOptionWINS=hm2DHCPServerPoolOptionWINS, hm2DHCPServerInterfaceGroup=hm2DHCPServerInterfaceGroup, hm2DHCPServerPoolOptionNetmask=hm2DHCPServerPoolOptionNetmask, hm2DHCPServerCounterDhcpv4Acks=hm2DHCPServerCounterDhcpv4Acks, hm2DHCPServerCounterDhcpv4Releases=hm2DHCPServerCounterDhcpv4Releases, PYSNMP_MODULE_ID=hm2DhcpsMib, hm2DHCPServerPoolRemoteId=hm2DHCPServerPoolRemoteId, hm2DHCPServerPoolTable=hm2DHCPServerPoolTable, hm2DHCPServerSNMPExtensionGroup=hm2DHCPServerSNMPExtensionGroup, hm2DHCPServerPoolEndIpAddress=hm2DHCPServerPoolEndIpAddress, hm2DHCPServerLeaseTable=hm2DHCPServerLeaseTable, hm2DHCPServerLeaseState=hm2DHCPServerLeaseState, hm2DHCPServerMibObjects=hm2DHCPServerMibObjects, hm2DHCPServerPoolRowStatus=hm2DHCPServerPoolRowStatus, hm2DHCPServerCounterDhcpv4Declines=hm2DHCPServerCounterDhcpv4Declines, hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet=hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet, hm2DHCPServerLeasePoolIndex=hm2DHCPServerLeasePoolIndex, hm2DHCPServerPoolMethod=hm2DHCPServerPoolMethod, hm2DHCPServerIfConfigTable=hm2DHCPServerIfConfigTable, hm2DHCPServerCounterDhcpv4Requests=hm2DHCPServerCounterDhcpv4Requests, hm2DhcpsMib=hm2DhcpsMib, hm2DHCPServerRowStatusInvalidConfigurationErrorReturn=hm2DHCPServerRowStatusInvalidConfigurationErrorReturn, hm2DHCPServerCounterIfEntry=hm2DHCPServerCounterIfEntry, hm2DHCPServerCounterBootpDroppedNotServingSubnet=hm2DHCPServerCounterBootpDroppedNotServingSubnet, hm2DHCPServerMaxLeaseEntries=hm2DHCPServerMaxLeaseEntries, hm2DHCPServerLeaseIfIndex=hm2DHCPServerLeaseIfIndex, hm2DHCPServerPoolIndex=hm2DHCPServerPoolIndex, hm2DHCPServerCounterBootpInvalids=hm2DHCPServerCounterBootpInvalids, hm2DHCPServerPoolStartIpAddress=hm2DHCPServerPoolStartIpAddress, hm2DHCPServerPoolFlags=hm2DHCPServerPoolFlags, hm2DHCPServerCounterDhcpv4Informs=hm2DHCPServerCounterDhcpv4Informs, hm2DHCPServerGroup=hm2DHCPServerGroup, hm2DHCPServerCounterGroup=hm2DHCPServerCounterGroup, hm2DHCPServerPoolOptionGateway=hm2DHCPServerPoolOptionGateway, hm2DHCPServerLeaseGateway=hm2DHCPServerLeaseGateway, hm2DHCPServerPoolHirschmannClient=hm2DHCPServerPoolHirschmannClient, hm2DHCPServerLeaseClientMacAddress=hm2DHCPServerLeaseClientMacAddress, hm2DHCPServerCounterDhcpv4Invalids=hm2DHCPServerCounterDhcpv4Invalids, hm2DHCPServerMode=hm2DHCPServerMode, hm2DHCPServerPoolClientId=hm2DHCPServerPoolClientId, hm2DHCPServerLeaseIpAddress=hm2DHCPServerLeaseIpAddress, hm2DHCPServerCounterDhcpv4DroppedUnknownClient=hm2DHCPServerCounterDhcpv4DroppedUnknownClient, hm2DHCPServerPoolIfIndex=hm2DHCPServerPoolIfIndex, hm2DHCPServerLeaseRemoteId=hm2DHCPServerLeaseRemoteId, hm2DHCPServerConflictDHCPRrelayErrorReturn=hm2DHCPServerConflictDHCPRrelayErrorReturn, hm2DHCPServerLeaseTimeRemaining=hm2DHCPServerLeaseTimeRemaining, hm2DHCPServerPoolOptionDNS=hm2DHCPServerPoolOptionDNS, hm2DHCPServerCounterBootpRequests=hm2DHCPServerCounterBootpRequests, hm2DHCPServerLeaseVlanId=hm2DHCPServerLeaseVlanId, hm2DHCPServerPoolCircuitId=hm2DHCPServerPoolCircuitId, hm2DHCPServerPoolGateway=hm2DHCPServerPoolGateway, hm2DHCPServerPoolOptionHostname=hm2DHCPServerPoolOptionHostname, hm2DHCPServerLeaseCircuitId=hm2DHCPServerLeaseCircuitId, hm2DHCPServerCounterDhcpv4Offers=hm2DHCPServerCounterDhcpv4Offers, hm2DHCPServerMaxPoolEntries=hm2DHCPServerMaxPoolEntries, hm2DHCPServerPoolOptionConfFileName=hm2DHCPServerPoolOptionConfFileName)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ValueRangeConstraint', 'SingleValueConstraint')
(hm_enabled_status, hm2_configuration_mibs) = mibBuilder.importSymbols('HM2-TC-MIB', 'HmEnabledStatus', 'hm2ConfigurationMibs')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(counter32, bits, unsigned32, module_identity, object_identity, counter64, integer32, iso, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, time_ticks, ip_address, gauge32, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Bits', 'Unsigned32', 'ModuleIdentity', 'ObjectIdentity', 'Counter64', 'Integer32', 'iso', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'TimeTicks', 'IpAddress', 'Gauge32', 'NotificationType')
(textual_convention, row_status, display_string, mac_address) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'DisplayString', 'MacAddress')
hm2_dhcps_mib = module_identity((1, 3, 6, 1, 4, 1, 248, 11, 91))
hm2DhcpsMib.setRevisions(('2012-03-16 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
hm2DhcpsMib.setRevisionsDescriptions(('Initial version.',))
if mibBuilder.loadTexts:
hm2DhcpsMib.setLastUpdated('201203160000Z')
if mibBuilder.loadTexts:
hm2DhcpsMib.setOrganization('Hirschmann Automation and Control GmbH')
if mibBuilder.loadTexts:
hm2DhcpsMib.setContactInfo('Postal: Stuttgarter Str. 45-51 72654 Neckartenzlingen Germany Phone: +49 7127 140 E-mail: hac.support@belden.com')
if mibBuilder.loadTexts:
hm2DhcpsMib.setDescription('Hirschmann DHCP server MIB. Copyright (C) 2012. All Rights Reserved.')
hm2_dhcp_server_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 0))
hm2_dhcp_server_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1))
hm2_dhcp_server_snmp_extension_group = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 3))
hm2_dhcp_server_group = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1))
hm2_dhcp_server_config_group = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1))
hm2_dhcp_server_lease_group = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2))
hm2_dhcp_server_interface_group = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3))
hm2_dhcp_server_counter_group = mib_identifier((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4))
hm2_dhcp_server_mode = mib_scalar((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 1), hm_enabled_status().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hm2DHCPServerMode.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerMode.setDescription('Enable or disable DHCP server global.')
hm2_dhcp_server_max_pool_entries = mib_scalar((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerMaxPoolEntries.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerMaxPoolEntries.setDescription('Maximum possible entries in hm2DHCPServerPoolTable.')
hm2_dhcp_server_max_lease_entries = mib_scalar((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerMaxLeaseEntries.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerMaxLeaseEntries.setDescription('Maximum possible entries in hm2DHCPServerLeaseTable.')
hm2_dhcp_server_pool_table = mib_table((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5))
if mibBuilder.loadTexts:
hm2DHCPServerPoolTable.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolTable.setDescription('A table containing the DHCP server pools.')
hm2_dhcp_server_pool_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1)).setIndexNames((0, 'HM2-DHCPS-MIB', 'hm2DHCPServerPoolIndex'))
if mibBuilder.loadTexts:
hm2DHCPServerPoolEntry.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolEntry.setDescription('A logical row in the hm2DHCPServerPoolTable.')
hm2_dhcp_server_pool_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerPoolIndex.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolIndex.setDescription('The index of hm2DHCPServerPoolTable.')
hm2_dhcp_server_pool_start_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 2), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolStartIpAddress.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolStartIpAddress.setDescription('The IPv4 address of the first address in the range. The value of hm2DHCPServerPoolStartIpAddress MUST be less than or equal to the value of hm2DHCPServerPoolEndIpAddress.')
hm2_dhcp_server_pool_end_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 3), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolEndIpAddress.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolEndIpAddress.setDescription('The IPv4 address of the last address in the range. The value of hm2DHCPServerPoolEndIpAddress MUST be greater than or equal to the value of hm2DHCPServerPoolStartIpAddress.')
hm2_dhcp_server_pool_lease_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 4), unsigned32().clone(86400)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolLeaseTime.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolLeaseTime.setDescription("The pools lease time in number of seconds. A value of 4294967295 SHOULD be used for leases that have a lease time which is 'infinite' and for BOOTP leases.")
hm2_dhcp_server_pool_flags = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 5), bits().clone(namedValues=named_values(('interface', 0), ('mac', 1), ('gateway', 2), ('clientid', 3), ('remoteid', 4), ('circuitid', 5), ('dynamic', 6), ('vlanid', 7)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolFlags.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolFlags.setDescription('This object shows the parameters that are used to lease the IP Address.')
hm2_dhcp_server_pool_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 6), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolIfIndex.setDescription('The index of the interface.')
hm2_dhcp_server_pool_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 7), mac_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolMacAddress.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolMacAddress.setDescription('The MAC Address of the entry that is used to lease the IP Address.')
hm2_dhcp_server_pool_gateway = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 8), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolGateway.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolGateway.setDescription('The IPv4 address of the Gatewayinterface that is used to lease the IP Address.')
hm2_dhcp_server_pool_client_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 9), octet_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolClientId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolClientId.setDescription('The Client Identifier of the entry that is used to lease the IP Address.')
hm2_dhcp_server_pool_remote_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 10), octet_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolRemoteId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolRemoteId.setDescription('The Remote Identifier of the entry that is used to lease the IP Address. The Remote Identifier must be send in Option 82 as defined in RFC 3046.')
hm2_dhcp_server_pool_circuit_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 11), octet_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolCircuitId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolCircuitId.setDescription('The Cicuit Identifier of the entry that is used to lease the IP Address. The Circuit Identifier must be send in Option 82 as defined in RFC 3046.')
hm2_dhcp_server_pool_hirschmann_client = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 12), hm_enabled_status().clone('disable')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolHirschmannClient.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolHirschmannClient.setDescription('Enable or disable Hirschmann Multicast.')
hm2_dhcp_server_pool_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 13), integer32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolVlanId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolVlanId.setDescription('The Vlan ID of the entry that is used to lease the IP Address. A value of -1 corresponds to management vlan (the default), any other value (1-4042) represents a specific VLAN')
hm2_dhcp_server_pool_option_conf_file_name = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 30), display_string().subtype(subtypeSpec=value_size_constraint(0, 70))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionConfFileName.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionConfFileName.setDescription('Full specified name of the configuration file e.g. tftp://192.9.200.1/cfg/config1.sav. An empty string zeros the SNAME and the FILE field in the DHCP header.')
hm2_dhcp_server_pool_option_gateway = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 31), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionGateway.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionGateway.setDescription('The IPv4 address of the Gateway. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2_dhcp_server_pool_option_netmask = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 32), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionNetmask.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionNetmask.setDescription('The subnet mask. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2_dhcp_server_pool_option_wins = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 33), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionWINS.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionWINS.setDescription('The IPv4 address of the WINS Server. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2_dhcp_server_pool_option_dns = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 34), ip_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionDNS.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionDNS.setDescription('The IPv4 address of the DNS Server. A value of 0 disables the attachment of the option field in the DHCP message.')
hm2_dhcp_server_pool_option_hostname = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 35), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionHostname.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolOptionHostname.setDescription('The name of the client (Option 12). An empty string disables the attachment of the option field in the DHCP message.')
hm2_dhcp_server_pool_method = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 36), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('config', 2), ('ttdp', 3))).clone('none')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hm2DHCPServerPoolMethod.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolMethod.setDescription('The source of the DHCP Server Pool. User can set the object to none(1), config(2), ttdp(3).')
hm2_dhcp_server_pool_error_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 99), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerPoolErrorStatus.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolErrorStatus.setDescription('The error Code by create a new Pool.')
hm2_dhcp_server_pool_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 1, 5, 1, 100), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hm2DHCPServerPoolRowStatus.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerPoolRowStatus.setDescription('This object indicates the status of this entry.')
hm2_dhcp_server_lease_table = mib_table((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1))
if mibBuilder.loadTexts:
hm2DHCPServerLeaseTable.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseTable.setDescription('A table containing the DHCP server leases.')
hm2_dhcp_server_lease_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1)).setIndexNames((0, 'HM2-DHCPS-MIB', 'hm2DHCPServerLeasePoolIndex'), (0, 'HM2-DHCPS-MIB', 'hm2DHCPServerLeaseIpAddress'))
if mibBuilder.loadTexts:
hm2DHCPServerLeaseEntry.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseEntry.setDescription('A logical row in the hm2DHCPServerLeaseTable.')
hm2_dhcp_server_lease_pool_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 128))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeasePoolIndex.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeasePoolIndex.setDescription('The index of the hm2DHCPServerPoolTable above.')
hm2_dhcp_server_lease_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 2), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseIpAddress.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseIpAddress.setDescription('This is an IP address from the pool with index hm2DHCPServerLeasePoolIndex.')
hm2_dhcp_server_lease_state = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('bootp', 1), ('offering', 2), ('requesting', 3), ('bound', 4), ('renewing', 5), ('rebinding', 6), ('declined', 7), ('released', 8)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseState.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseState.setDescription('The state of the lease.')
hm2_dhcp_server_lease_time_remaining = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseTimeRemaining.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseTimeRemaining.setDescription('The remaining time of the lease configured in hm2DHCPServerPoolLeaseTime.')
hm2_dhcp_server_lease_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseIfIndex.setDescription('The interface index where the lease is currently active.')
hm2_dhcp_server_lease_client_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 6), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseClientMacAddress.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseClientMacAddress.setDescription('The MAC Address of the entry that has leased the IP Address.')
hm2_dhcp_server_lease_gateway = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 7), ip_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseGateway.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseGateway.setDescription('The IPv4 address of the Gatewayinterface that was used to lease the IP Address.')
hm2_dhcp_server_lease_client_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 8), octet_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseClientId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseClientId.setDescription('The Client Identifier of the entry that was used to lease the IP Address.')
hm2_dhcp_server_lease_remote_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 9), octet_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseRemoteId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseRemoteId.setDescription('The Remote Identifier of the entry that was used to lease the IP Address.')
hm2_dhcp_server_lease_circuit_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 10), octet_string().subtype(subtypeSpec=value_size_constraint(0, 255))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseCircuitId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseCircuitId.setDescription('The Cicuit Identifier of the entry that was used to lease the IP Address.')
hm2_dhcp_server_lease_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 11), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseStartTime.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseStartTime.setDescription('Lease start Time.')
hm2_dhcp_server_lease_action = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('other', 1), ('release', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseAction.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseAction.setDescription('Manually release this ip address for new assignment.')
hm2_dhcp_server_lease_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 2, 1, 1, 13), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseVlanId.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerLeaseVlanId.setDescription('The Vlan ID of the entry that is used to lease the IP Address. A value of -1 corresponds to management vlan (the default), any other value (1-4042) represents a specific VLAN')
hm2_dhcp_server_if_config_table = mib_table((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1))
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigTable.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigTable.setDescription('A table containing current configuration information for each interface.')
hm2_dhcp_server_if_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1, 1)).setIndexNames((0, 'HM2-DHCPS-MIB', 'hm2DHCPServerIfConfigIndex'))
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigEntry.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigEntry.setDescription('A logical row in the hm2DHCPServerIfConfigTable.')
hm2_dhcp_server_if_config_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1, 1, 1), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigIndex.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigIndex.setDescription('The index of the interface.')
hm2_dhcp_server_if_config_mode = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 3, 1, 1, 2), hm_enabled_status().clone('enable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigMode.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerIfConfigMode.setDescription('Enable or disable DHCP server on this interface.')
hm2_dhcp_server_counter_if_table = mib_table((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2))
if mibBuilder.loadTexts:
hm2DHCPServerCounterIfTable.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterIfTable.setDescription('A table containing current configuration information for each interface.')
hm2_dhcp_server_counter_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1)).setIndexNames((0, 'HM2-DHCPS-MIB', 'hm2DHCPServerCounterIfIndex'))
if mibBuilder.loadTexts:
hm2DHCPServerCounterIfEntry.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterIfEntry.setDescription('A logical row in the hm2DHCPServerCounterIfTable.')
hm2_dhcp_server_counter_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 1), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterIfIndex.setDescription('The index of the interface.')
hm2_dhcp_server_counter_bootp_requests = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpRequests.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpRequests.setDescription('The number of packets received that contain a Message Type of 1 (BOOTREQUEST) in the first octet and do not contain option number 53 (DHCP Message Type) in the options.')
hm2_dhcp_server_counter_bootp_invalids = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpInvalids.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpInvalids.setDescription('The number of packets received that do not contain a Message Type of 1 (BOOTREQUEST) in the first octet or are not valid BOOTP packets (e.g., too short, invalid field in packet header).')
hm2_dhcp_server_counter_bootp_replies = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpReplies.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpReplies.setDescription('The number of packets sent that contain a Message Type of 2 (BOOTREPLY) in the first octet and do not contain option number 53 (DHCP Message Type) in the options.')
hm2_dhcp_server_counter_bootp_dropped_unknown_clients = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpDroppedUnknownClients.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpDroppedUnknownClients.setDescription('The number of BOOTP packets dropped due to the server not recognizing or not providing service to the hardware address received in the incoming packet.')
hm2_dhcp_server_counter_bootp_dropped_not_serving_subnet = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpDroppedNotServingSubnet.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterBootpDroppedNotServingSubnet.setDescription('The number of BOOTP packets dropped due to the server not being configured or not otherwise able to serve addresses on the subnet from which this message was received.')
hm2_dhcp_server_counter_dhcpv4_discovers = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Discovers.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Discovers.setDescription('The number of DHCPDISCOVER (option 53 with value 1) packets received.')
hm2_dhcp_server_counter_dhcpv4_offers = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 21), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Offers.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Offers.setDescription('The number of DHCPOFFER (option 53 with value 2) packets sent.')
hm2_dhcp_server_counter_dhcpv4_requests = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 22), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Requests.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Requests.setDescription('The number of DHCPREQUEST (option 53 with value 3) packets received.')
hm2_dhcp_server_counter_dhcpv4_declines = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 23), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Declines.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Declines.setDescription('The number of DHCPDECLINE (option 53 with value 4) packets received.')
hm2_dhcp_server_counter_dhcpv4_acks = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 24), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Acks.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Acks.setDescription('The number of DHCPACK (option 53 with value 5) packets sent.')
hm2_dhcp_server_counter_dhcpv4_naks = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 25), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Naks.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Naks.setDescription('The number of DHCPNACK (option 53 with value 6) packets sent.')
hm2_dhcp_server_counter_dhcpv4_releases = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 26), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Releases.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Releases.setDescription('The number of DHCPRELEASE (option 53 with value 7) packets received.')
hm2_dhcp_server_counter_dhcpv4_informs = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 27), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Informs.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Informs.setDescription('The number of DHCPINFORM (option 53 with value 8) packets received.')
hm2_dhcp_server_counter_dhcpv4_forced_renews = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 28), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4ForcedRenews.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4ForcedRenews.setDescription('The number of DHCPFORCERENEW (option 53 with value 9) packets sent.')
hm2_dhcp_server_counter_dhcpv4_invalids = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 29), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Invalids.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4Invalids.setDescription('The number of DHCP packets received whose DHCP message type (i.e., option number 53) is not understood or handled by the server.')
hm2_dhcp_server_counter_dhcpv4_dropped_unknown_client = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 30), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4DroppedUnknownClient.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4DroppedUnknownClient.setDescription('The number of DHCP packets dropped due to the server not recognizing or not providing service to the client-id and/or hardware address received in the incoming packet.')
hm2_dhcp_server_counter_dhcpv4_dropped_not_serving_subnet = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 31), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet.setDescription('The number of DHCP packets dropped due to the server not being configured or not otherwise able to serve addresses on the subnet from which this message was received.')
hm2_dhcp_server_counter_misc_other_dhcp_server = mib_table_column((1, 3, 6, 1, 4, 1, 248, 11, 91, 1, 1, 4, 2, 1, 40), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hm2DHCPServerCounterMiscOtherDhcpServer.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerCounterMiscOtherDhcpServer.setDescription('The number of BOOTP and DHCP packets from another DHCP server seen on this interface.')
hm2_dhcp_server_row_status_invalid_configuration_error_return = object_identity((1, 3, 6, 1, 4, 1, 248, 11, 91, 3, 1))
if mibBuilder.loadTexts:
hm2DHCPServerRowStatusInvalidConfigurationErrorReturn.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerRowStatusInvalidConfigurationErrorReturn.setDescription('DHCP Server pool with index {0} cannot be enabled, errors in data entry.')
hm2_dhcp_server_conflict_dhcp_rrelay_error_return = object_identity((1, 3, 6, 1, 4, 1, 248, 11, 91, 3, 2))
if mibBuilder.loadTexts:
hm2DHCPServerConflictDHCPRrelayErrorReturn.setStatus('current')
if mibBuilder.loadTexts:
hm2DHCPServerConflictDHCPRrelayErrorReturn.setDescription('{0} and {1} cannot be active at the same time.')
mibBuilder.exportSymbols('HM2-DHCPS-MIB', hm2DHCPServerPoolMacAddress=hm2DHCPServerPoolMacAddress, hm2DHCPServerLeaseAction=hm2DHCPServerLeaseAction, hm2DHCPServerIfConfigIndex=hm2DHCPServerIfConfigIndex, hm2DHCPServerMibNotifications=hm2DHCPServerMibNotifications, hm2DHCPServerConfigGroup=hm2DHCPServerConfigGroup, hm2DHCPServerCounterMiscOtherDhcpServer=hm2DHCPServerCounterMiscOtherDhcpServer, hm2DHCPServerCounterDhcpv4Discovers=hm2DHCPServerCounterDhcpv4Discovers, hm2DHCPServerLeaseStartTime=hm2DHCPServerLeaseStartTime, hm2DHCPServerPoolLeaseTime=hm2DHCPServerPoolLeaseTime, hm2DHCPServerPoolErrorStatus=hm2DHCPServerPoolErrorStatus, hm2DHCPServerCounterIfTable=hm2DHCPServerCounterIfTable, hm2DHCPServerLeaseEntry=hm2DHCPServerLeaseEntry, hm2DHCPServerCounterBootpDroppedUnknownClients=hm2DHCPServerCounterBootpDroppedUnknownClients, hm2DHCPServerPoolEntry=hm2DHCPServerPoolEntry, hm2DHCPServerIfConfigMode=hm2DHCPServerIfConfigMode, hm2DHCPServerCounterBootpReplies=hm2DHCPServerCounterBootpReplies, hm2DHCPServerLeaseGroup=hm2DHCPServerLeaseGroup, hm2DHCPServerLeaseClientId=hm2DHCPServerLeaseClientId, hm2DHCPServerCounterIfIndex=hm2DHCPServerCounterIfIndex, hm2DHCPServerCounterDhcpv4Naks=hm2DHCPServerCounterDhcpv4Naks, hm2DHCPServerPoolVlanId=hm2DHCPServerPoolVlanId, hm2DHCPServerIfConfigEntry=hm2DHCPServerIfConfigEntry, hm2DHCPServerCounterDhcpv4ForcedRenews=hm2DHCPServerCounterDhcpv4ForcedRenews, hm2DHCPServerPoolOptionWINS=hm2DHCPServerPoolOptionWINS, hm2DHCPServerInterfaceGroup=hm2DHCPServerInterfaceGroup, hm2DHCPServerPoolOptionNetmask=hm2DHCPServerPoolOptionNetmask, hm2DHCPServerCounterDhcpv4Acks=hm2DHCPServerCounterDhcpv4Acks, hm2DHCPServerCounterDhcpv4Releases=hm2DHCPServerCounterDhcpv4Releases, PYSNMP_MODULE_ID=hm2DhcpsMib, hm2DHCPServerPoolRemoteId=hm2DHCPServerPoolRemoteId, hm2DHCPServerPoolTable=hm2DHCPServerPoolTable, hm2DHCPServerSNMPExtensionGroup=hm2DHCPServerSNMPExtensionGroup, hm2DHCPServerPoolEndIpAddress=hm2DHCPServerPoolEndIpAddress, hm2DHCPServerLeaseTable=hm2DHCPServerLeaseTable, hm2DHCPServerLeaseState=hm2DHCPServerLeaseState, hm2DHCPServerMibObjects=hm2DHCPServerMibObjects, hm2DHCPServerPoolRowStatus=hm2DHCPServerPoolRowStatus, hm2DHCPServerCounterDhcpv4Declines=hm2DHCPServerCounterDhcpv4Declines, hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet=hm2DHCPServerCounterDhcpv4DroppedNotServingSubnet, hm2DHCPServerLeasePoolIndex=hm2DHCPServerLeasePoolIndex, hm2DHCPServerPoolMethod=hm2DHCPServerPoolMethod, hm2DHCPServerIfConfigTable=hm2DHCPServerIfConfigTable, hm2DHCPServerCounterDhcpv4Requests=hm2DHCPServerCounterDhcpv4Requests, hm2DhcpsMib=hm2DhcpsMib, hm2DHCPServerRowStatusInvalidConfigurationErrorReturn=hm2DHCPServerRowStatusInvalidConfigurationErrorReturn, hm2DHCPServerCounterIfEntry=hm2DHCPServerCounterIfEntry, hm2DHCPServerCounterBootpDroppedNotServingSubnet=hm2DHCPServerCounterBootpDroppedNotServingSubnet, hm2DHCPServerMaxLeaseEntries=hm2DHCPServerMaxLeaseEntries, hm2DHCPServerLeaseIfIndex=hm2DHCPServerLeaseIfIndex, hm2DHCPServerPoolIndex=hm2DHCPServerPoolIndex, hm2DHCPServerCounterBootpInvalids=hm2DHCPServerCounterBootpInvalids, hm2DHCPServerPoolStartIpAddress=hm2DHCPServerPoolStartIpAddress, hm2DHCPServerPoolFlags=hm2DHCPServerPoolFlags, hm2DHCPServerCounterDhcpv4Informs=hm2DHCPServerCounterDhcpv4Informs, hm2DHCPServerGroup=hm2DHCPServerGroup, hm2DHCPServerCounterGroup=hm2DHCPServerCounterGroup, hm2DHCPServerPoolOptionGateway=hm2DHCPServerPoolOptionGateway, hm2DHCPServerLeaseGateway=hm2DHCPServerLeaseGateway, hm2DHCPServerPoolHirschmannClient=hm2DHCPServerPoolHirschmannClient, hm2DHCPServerLeaseClientMacAddress=hm2DHCPServerLeaseClientMacAddress, hm2DHCPServerCounterDhcpv4Invalids=hm2DHCPServerCounterDhcpv4Invalids, hm2DHCPServerMode=hm2DHCPServerMode, hm2DHCPServerPoolClientId=hm2DHCPServerPoolClientId, hm2DHCPServerLeaseIpAddress=hm2DHCPServerLeaseIpAddress, hm2DHCPServerCounterDhcpv4DroppedUnknownClient=hm2DHCPServerCounterDhcpv4DroppedUnknownClient, hm2DHCPServerPoolIfIndex=hm2DHCPServerPoolIfIndex, hm2DHCPServerLeaseRemoteId=hm2DHCPServerLeaseRemoteId, hm2DHCPServerConflictDHCPRrelayErrorReturn=hm2DHCPServerConflictDHCPRrelayErrorReturn, hm2DHCPServerLeaseTimeRemaining=hm2DHCPServerLeaseTimeRemaining, hm2DHCPServerPoolOptionDNS=hm2DHCPServerPoolOptionDNS, hm2DHCPServerCounterBootpRequests=hm2DHCPServerCounterBootpRequests, hm2DHCPServerLeaseVlanId=hm2DHCPServerLeaseVlanId, hm2DHCPServerPoolCircuitId=hm2DHCPServerPoolCircuitId, hm2DHCPServerPoolGateway=hm2DHCPServerPoolGateway, hm2DHCPServerPoolOptionHostname=hm2DHCPServerPoolOptionHostname, hm2DHCPServerLeaseCircuitId=hm2DHCPServerLeaseCircuitId, hm2DHCPServerCounterDhcpv4Offers=hm2DHCPServerCounterDhcpv4Offers, hm2DHCPServerMaxPoolEntries=hm2DHCPServerMaxPoolEntries, hm2DHCPServerPoolOptionConfFileName=hm2DHCPServerPoolOptionConfFileName) |
table_pkeys_map = {
"account": [
"account_id"
],
"account_assignd_cert": [
"account_id",
"x509_cert_id",
"x509_key_usg"
],
"account_auth_log": [
"account_id",
"account_auth_ts",
"auth_resource",
"account_auth_seq"
],
"account_coll_type_relation": [
"account_collection_type",
"account_collection_relation"
],
"account_collection": [
"account_collection_id"
],
"account_collection_account": [
"account_id",
"account_collection_id"
],
"account_collection_hier": [
"account_collection_id",
"child_account_collection_id"
],
"account_password": [
"account_id",
"account_realm_id",
"password_type"
],
"account_realm": [
"account_realm_id"
],
"account_realm_acct_coll_type": [
"account_realm_id",
"account_collection_type"
],
"account_realm_company": [
"account_realm_id",
"company_id"
],
"account_realm_password_type": [
"password_type",
"account_realm_id"
],
"account_ssh_key": [
"account_id",
"ssh_key_id"
],
"account_token": [
"account_token_id"
],
"account_unix_info": [
"account_id"
],
"appaal": [
"appaal_id"
],
"appaal_instance": [
"appaal_instance_id"
],
"appaal_instance_device_coll": [
"appaal_instance_id",
"device_collection_id"
],
"appaal_instance_property": [
"app_key",
"appaal_group_name",
"appaal_group_rank",
"appaal_instance_id"
],
"approval_instance": [
"approval_instance_id"
],
"approval_instance_item": [
"approval_instance_item_id"
],
"approval_instance_link": [
"approval_instance_link_id"
],
"approval_instance_step": [
"approval_instance_step_id"
],
"approval_instance_step_notify": [
"approv_instance_step_notify_id"
],
"approval_process": [
"approval_process_id"
],
"approval_process_chain": [
"approval_process_chain_id"
],
"asset": [
"asset_id"
],
"badge": [
"card_number"
],
"badge_type": [
"badge_type_id"
],
"certificate_signing_request": [
"certificate_signing_request_id"
],
"chassis_location": [
"chassis_location_id"
],
"circuit": [
"circuit_id"
],
"company": [
"company_id"
],
"company_collection": [
"company_collection_id"
],
"company_collection_company": [
"company_id",
"company_collection_id"
],
"company_collection_hier": [
"child_company_collection_id",
"company_collection_id"
],
"company_type": [
"company_type",
"company_id"
],
"component": [
"component_id"
],
"component_property": [
"component_property_id"
],
"component_type": [
"component_type_id"
],
"component_type_component_func": [
"component_function",
"component_type_id"
],
"component_type_slot_tmplt": [
"component_type_slot_tmplt_id"
],
"contract": [
"contract_id"
],
"contract_type": [
"contract_id",
"contract_type"
],
"department": [
"account_collection_id"
],
"device": [
"device_id"
],
"device_collection": [
"device_collection_id"
],
"device_collection_assignd_cert": [
"device_collection_id",
"x509_cert_id",
"x509_key_usg"
],
"device_collection_device": [
"device_id",
"device_collection_id"
],
"device_collection_hier": [
"device_collection_id",
"child_device_collection_id"
],
"device_collection_ssh_key": [
"device_collection_id",
"ssh_key_id",
"account_collection_id"
],
"device_encapsulation_domain": [
"device_id",
"encapsulation_type"
],
"device_layer2_network": [
"layer2_network_id",
"device_id"
],
"device_management_controller": [
"manager_device_id",
"device_id"
],
"device_note": [
"note_id"
],
"device_ssh_key": [
"ssh_key_id",
"device_id"
],
"device_ticket": [
"ticketing_system_id",
"device_id",
"ticket_number"
],
"device_type": [
"device_type_id"
],
"device_type_module": [
"device_type_module_name",
"device_type_id"
],
"device_type_module_device_type": [
"device_type_module_name",
"device_type_id",
"module_device_type_id"
],
"dns_change_record": [
"dns_change_record_id"
],
"dns_domain": [
"dns_domain_id"
],
"dns_domain_collection": [
"dns_domain_collection_id"
],
"dns_domain_collection_dns_dom": [
"dns_domain_collection_id",
"dns_domain_id"
],
"dns_domain_collection_hier": [
"child_dns_domain_collection_id",
"dns_domain_collection_id"
],
"dns_domain_ip_universe": [
"dns_domain_id",
"ip_universe_id"
],
"dns_record": [
"dns_record_id"
],
"dns_record_relation": [
"dns_record_id",
"related_dns_record_id",
"dns_record_relation_type"
],
"encapsulation_domain": [
"encapsulation_type",
"encapsulation_domain"
],
"encapsulation_range": [
"encapsulation_range_id"
],
"encryption_key": [
"encryption_key_id"
],
"inter_component_connection": [
"inter_component_connection_id"
],
"ip_universe": [
"ip_universe_id"
],
"ip_universe_visibility": [
"visible_ip_universe_id",
"ip_universe_id"
],
"kerberos_realm": [
"krb_realm_id"
],
"klogin": [
"klogin_id"
],
"klogin_mclass": [
"device_collection_id",
"klogin_id"
],
"l2_network_coll_l2_network": [
"layer2_network_collection_id",
"layer2_network_id"
],
"l3_network_coll_l3_network": [
"layer3_network_id",
"layer3_network_collection_id"
],
"layer2_connection": [
"layer2_connection_id"
],
"layer2_connection_l2_network": [
"layer2_connection_id",
"layer2_network_id"
],
"layer2_network": [
"layer2_network_id"
],
"layer2_network_collection": [
"layer2_network_collection_id"
],
"layer2_network_collection_hier": [
"child_l2_network_coll_id",
"layer2_network_collection_id"
],
"layer3_network": [
"layer3_network_id"
],
"layer3_network_collection": [
"layer3_network_collection_id"
],
"layer3_network_collection_hier": [
"layer3_network_collection_id",
"child_l3_network_coll_id"
],
"logical_port": [
"logical_port_id"
],
"logical_port_slot": [
"logical_port_id",
"slot_id"
],
"logical_volume": [
"logical_volume_id"
],
"logical_volume_property": [
"logical_volume_property_id"
],
"logical_volume_purpose": [
"logical_volume_purpose",
"logical_volume_id"
],
"mlag_peering": [
"mlag_peering_id"
],
"netblock": [
"netblock_id"
],
"netblock_collection": [
"netblock_collection_id"
],
"netblock_collection_hier": [
"netblock_collection_id",
"child_netblock_collection_id"
],
"netblock_collection_netblock": [
"netblock_collection_id",
"netblock_id"
],
"network_interface": [
"network_interface_id"
],
"network_interface_netblock": [
"network_interface_id",
"device_id",
"netblock_id"
],
"network_interface_purpose": [
"network_interface_purpose",
"device_id"
],
"network_range": [
"network_range_id"
],
"network_service": [
"network_service_id"
],
"operating_system": [
"operating_system_id"
],
"operating_system_snapshot": [
"operating_system_snapshot_id"
],
"person": [
"person_id"
],
"person_account_realm_company": [
"account_realm_id",
"person_id",
"company_id"
],
"person_auth_question": [
"person_id",
"auth_question_id"
],
"person_company": [
"company_id",
"person_id"
],
"person_company_attr": [
"person_company_attr_name",
"company_id",
"person_id"
],
"person_company_badge": [
"company_id",
"person_id",
"badge_id"
],
"person_contact": [
"person_contact_id"
],
"person_image": [
"person_image_id"
],
"person_image_usage": [
"person_image_usage",
"person_image_id"
],
"person_location": [
"person_location_id"
],
"person_note": [
"note_id"
],
"person_parking_pass": [
"person_id",
"person_parking_pass_id"
],
"person_vehicle": [
"person_vehicle_id"
],
"physical_address": [
"physical_address_id"
],
"physical_connection": [
"physical_connection_id"
],
"physicalish_volume": [
"physicalish_volume_id"
],
"private_key": [
"private_key_id"
],
"property": [
"property_id"
],
"property_collection": [
"property_collection_id"
],
"property_collection_hier": [
"property_collection_id",
"child_property_collection_id"
],
"property_collection_property": [
"property_collection_id",
"property_type",
"property_name"
],
"pseudo_klogin": [
"pseudo_klogin_id"
],
"rack": [
"rack_id"
],
"rack_location": [
"rack_location_id"
],
"service_environment": [
"service_environment_id"
],
"service_environment_coll_hier": [
"child_service_env_coll_id",
"service_env_collection_id"
],
"service_environment_collection": [
"service_env_collection_id"
],
"shared_netblock": [
"shared_netblock_id"
],
"shared_netblock_network_int": [
"shared_netblock_id",
"network_interface_id"
],
"site": [
"site_code"
],
"slot": [
"slot_id"
],
"slot_type": [
"slot_type_id"
],
"slot_type_prmt_comp_slot_type": [
"slot_type_id",
"component_slot_type_id"
],
"slot_type_prmt_rem_slot_type": [
"slot_type_id",
"remote_slot_type_id"
],
"snmp_commstr": [
"snmp_commstr_id"
],
"ssh_key": [
"ssh_key_id"
],
"static_route": [
"static_route_id"
],
"static_route_template": [
"static_route_template_id"
],
"sudo_acct_col_device_collectio": [
"sudo_alias_name",
"account_collection_id",
"device_collection_id"
],
"sudo_alias": [
"sudo_alias_name"
],
"svc_environment_coll_svc_env": [
"service_environment_id",
"service_env_collection_id"
],
"sw_package": [
"sw_package_id"
],
"ticketing_system": [
"ticketing_system_id"
],
"token": [
"token_id"
],
"token_collection": [
"token_collection_id"
],
"token_collection_hier": [
"token_collection_id",
"child_token_collection_id"
],
"token_collection_token": [
"token_collection_id",
"token_id"
],
"token_sequence": [
"token_id"
],
"unix_group": [
"account_collection_id"
],
"val_account_collection_relatio": [
"account_collection_relation"
],
"val_account_collection_type": [
"account_collection_type"
],
"val_account_role": [
"account_role"
],
"val_account_type": [
"account_type"
],
"val_app_key": [
"appaal_group_name",
"app_key"
],
"val_app_key_values": [
"app_value",
"app_key",
"appaal_group_name"
],
"val_appaal_group_name": [
"appaal_group_name"
],
"val_approval_chain_resp_prd": [
"approval_chain_response_period"
],
"val_approval_expiration_action": [
"approval_expiration_action"
],
"val_approval_notifty_type": [
"approval_notify_type"
],
"val_approval_process_type": [
"approval_process_type"
],
"val_approval_type": [
"approval_type"
],
"val_attestation_frequency": [
"attestation_frequency"
],
"val_auth_question": [
"auth_question_id"
],
"val_auth_resource": [
"auth_resource"
],
"val_badge_status": [
"badge_status"
],
"val_cable_type": [
"cable_type"
],
"val_company_collection_type": [
"company_collection_type"
],
"val_company_type": [
"company_type"
],
"val_company_type_purpose": [
"company_type_purpose"
],
"val_component_function": [
"component_function"
],
"val_component_property": [
"component_property_name",
"component_property_type"
],
"val_component_property_type": [
"component_property_type"
],
"val_component_property_value": [
"component_property_name",
"valid_property_value",
"component_property_type"
],
"val_contract_type": [
"contract_type"
],
"val_country_code": [
"iso_country_code"
],
"val_device_auto_mgmt_protocol": [
"auto_mgmt_protocol"
],
"val_device_collection_type": [
"device_collection_type"
],
"val_device_mgmt_ctrl_type": [
"device_mgmt_control_type"
],
"val_device_status": [
"device_status"
],
"val_diet": [
"diet"
],
"val_dns_class": [
"dns_class"
],
"val_dns_domain_collection_type": [
"dns_domain_collection_type"
],
"val_dns_domain_type": [
"dns_domain_type"
],
"val_dns_record_relation_type": [
"dns_record_relation_type"
],
"val_dns_srv_service": [
"dns_srv_service"
],
"val_dns_type": [
"dns_type"
],
"val_encapsulation_mode": [
"encapsulation_type",
"encapsulation_mode"
],
"val_encapsulation_type": [
"encapsulation_type"
],
"val_encryption_key_purpose": [
"encryption_key_purpose",
"encryption_key_purpose_version"
],
"val_encryption_method": [
"encryption_method"
],
"val_filesystem_type": [
"filesystem_type"
],
"val_image_type": [
"image_type"
],
"val_ip_namespace": [
"ip_namespace"
],
"val_iso_currency_code": [
"iso_currency_code"
],
"val_key_usg_reason_for_assgn": [
"key_usage_reason_for_assign"
],
"val_layer2_network_coll_type": [
"layer2_network_collection_type"
],
"val_layer3_network_coll_type": [
"layer3_network_collection_type"
],
"val_logical_port_type": [
"logical_port_type"
],
"val_logical_volume_property": [
"filesystem_type",
"logical_volume_property_name"
],
"val_logical_volume_purpose": [
"logical_volume_purpose"
],
"val_logical_volume_type": [
"logical_volume_type"
],
"val_netblock_collection_type": [
"netblock_collection_type"
],
"val_netblock_status": [
"netblock_status"
],
"val_netblock_type": [
"netblock_type"
],
"val_network_interface_purpose": [
"network_interface_purpose"
],
"val_network_interface_type": [
"network_interface_type"
],
"val_network_range_type": [
"network_range_type"
],
"val_network_service_type": [
"network_service_type"
],
"val_operating_system_family": [
"operating_system_family"
],
"val_os_snapshot_type": [
"operating_system_snapshot_type"
],
"val_ownership_status": [
"ownership_status"
],
"val_package_relation_type": [
"package_relation_type"
],
"val_password_type": [
"password_type"
],
"val_person_company_attr_dtype": [
"person_company_attr_data_type"
],
"val_person_company_attr_name": [
"person_company_attr_name"
],
"val_person_company_attr_value": [
"person_company_attr_value",
"person_company_attr_name"
],
"val_person_company_relation": [
"person_company_relation"
],
"val_person_contact_loc_type": [
"person_contact_location_type"
],
"val_person_contact_technology": [
"person_contact_technology",
"person_contact_type"
],
"val_person_contact_type": [
"person_contact_type"
],
"val_person_image_usage": [
"person_image_usage"
],
"val_person_location_type": [
"person_location_type"
],
"val_person_status": [
"person_status"
],
"val_physical_address_type": [
"physical_address_type"
],
"val_physicalish_volume_type": [
"physicalish_volume_type"
],
"val_processor_architecture": [
"processor_architecture"
],
"val_production_state": [
"production_state"
],
"val_property": [
"property_type",
"property_name"
],
"val_property_collection_type": [
"property_collection_type"
],
"val_property_data_type": [
"property_data_type"
],
"val_property_type": [
"property_type"
],
"val_property_value": [
"valid_property_value",
"property_name",
"property_type"
],
"val_pvt_key_encryption_type": [
"private_key_encryption_type"
],
"val_rack_type": [
"rack_type"
],
"val_raid_type": [
"raid_type"
],
"val_service_env_coll_type": [
"service_env_collection_type"
],
"val_shared_netblock_protocol": [
"shared_netblock_protocol"
],
"val_slot_function": [
"slot_function"
],
"val_slot_physical_interface": [
"slot_function",
"slot_physical_interface_type"
],
"val_snmp_commstr_type": [
"snmp_commstr_type"
],
"val_ssh_key_type": [
"ssh_key_type"
],
"val_sw_package_type": [
"sw_package_type"
],
"val_token_collection_type": [
"token_collection_type"
],
"val_token_status": [
"token_status"
],
"val_token_type": [
"token_type"
],
"val_volume_group_purpose": [
"volume_group_purpose"
],
"val_volume_group_relation": [
"volume_group_relation"
],
"val_volume_group_type": [
"volume_group_type"
],
"val_x509_certificate_file_fmt": [
"x509_file_format"
],
"val_x509_certificate_type": [
"x509_certificate_type"
],
"val_x509_key_usage": [
"x509_key_usg"
],
"val_x509_key_usage_category": [
"x509_key_usg_cat"
],
"val_x509_revocation_reason": [
"x509_revocation_reason"
],
"volume_group": [
"volume_group_id"
],
"volume_group_physicalish_vol": [
"volume_group_id",
"physicalish_volume_id"
],
"volume_group_purpose": [
"volume_group_id",
"volume_group_purpose"
],
"x509_key_usage_attribute": [
"x509_cert_id",
"x509_key_usg"
],
"x509_key_usage_categorization": [
"x509_key_usg_cat",
"x509_key_usg"
],
"x509_key_usage_default": [
"x509_key_usg",
"x509_signed_certificate_id"
],
"x509_signed_certificate": [
"x509_signed_certificate_id"
]
} | table_pkeys_map = {'account': ['account_id'], 'account_assignd_cert': ['account_id', 'x509_cert_id', 'x509_key_usg'], 'account_auth_log': ['account_id', 'account_auth_ts', 'auth_resource', 'account_auth_seq'], 'account_coll_type_relation': ['account_collection_type', 'account_collection_relation'], 'account_collection': ['account_collection_id'], 'account_collection_account': ['account_id', 'account_collection_id'], 'account_collection_hier': ['account_collection_id', 'child_account_collection_id'], 'account_password': ['account_id', 'account_realm_id', 'password_type'], 'account_realm': ['account_realm_id'], 'account_realm_acct_coll_type': ['account_realm_id', 'account_collection_type'], 'account_realm_company': ['account_realm_id', 'company_id'], 'account_realm_password_type': ['password_type', 'account_realm_id'], 'account_ssh_key': ['account_id', 'ssh_key_id'], 'account_token': ['account_token_id'], 'account_unix_info': ['account_id'], 'appaal': ['appaal_id'], 'appaal_instance': ['appaal_instance_id'], 'appaal_instance_device_coll': ['appaal_instance_id', 'device_collection_id'], 'appaal_instance_property': ['app_key', 'appaal_group_name', 'appaal_group_rank', 'appaal_instance_id'], 'approval_instance': ['approval_instance_id'], 'approval_instance_item': ['approval_instance_item_id'], 'approval_instance_link': ['approval_instance_link_id'], 'approval_instance_step': ['approval_instance_step_id'], 'approval_instance_step_notify': ['approv_instance_step_notify_id'], 'approval_process': ['approval_process_id'], 'approval_process_chain': ['approval_process_chain_id'], 'asset': ['asset_id'], 'badge': ['card_number'], 'badge_type': ['badge_type_id'], 'certificate_signing_request': ['certificate_signing_request_id'], 'chassis_location': ['chassis_location_id'], 'circuit': ['circuit_id'], 'company': ['company_id'], 'company_collection': ['company_collection_id'], 'company_collection_company': ['company_id', 'company_collection_id'], 'company_collection_hier': ['child_company_collection_id', 'company_collection_id'], 'company_type': ['company_type', 'company_id'], 'component': ['component_id'], 'component_property': ['component_property_id'], 'component_type': ['component_type_id'], 'component_type_component_func': ['component_function', 'component_type_id'], 'component_type_slot_tmplt': ['component_type_slot_tmplt_id'], 'contract': ['contract_id'], 'contract_type': ['contract_id', 'contract_type'], 'department': ['account_collection_id'], 'device': ['device_id'], 'device_collection': ['device_collection_id'], 'device_collection_assignd_cert': ['device_collection_id', 'x509_cert_id', 'x509_key_usg'], 'device_collection_device': ['device_id', 'device_collection_id'], 'device_collection_hier': ['device_collection_id', 'child_device_collection_id'], 'device_collection_ssh_key': ['device_collection_id', 'ssh_key_id', 'account_collection_id'], 'device_encapsulation_domain': ['device_id', 'encapsulation_type'], 'device_layer2_network': ['layer2_network_id', 'device_id'], 'device_management_controller': ['manager_device_id', 'device_id'], 'device_note': ['note_id'], 'device_ssh_key': ['ssh_key_id', 'device_id'], 'device_ticket': ['ticketing_system_id', 'device_id', 'ticket_number'], 'device_type': ['device_type_id'], 'device_type_module': ['device_type_module_name', 'device_type_id'], 'device_type_module_device_type': ['device_type_module_name', 'device_type_id', 'module_device_type_id'], 'dns_change_record': ['dns_change_record_id'], 'dns_domain': ['dns_domain_id'], 'dns_domain_collection': ['dns_domain_collection_id'], 'dns_domain_collection_dns_dom': ['dns_domain_collection_id', 'dns_domain_id'], 'dns_domain_collection_hier': ['child_dns_domain_collection_id', 'dns_domain_collection_id'], 'dns_domain_ip_universe': ['dns_domain_id', 'ip_universe_id'], 'dns_record': ['dns_record_id'], 'dns_record_relation': ['dns_record_id', 'related_dns_record_id', 'dns_record_relation_type'], 'encapsulation_domain': ['encapsulation_type', 'encapsulation_domain'], 'encapsulation_range': ['encapsulation_range_id'], 'encryption_key': ['encryption_key_id'], 'inter_component_connection': ['inter_component_connection_id'], 'ip_universe': ['ip_universe_id'], 'ip_universe_visibility': ['visible_ip_universe_id', 'ip_universe_id'], 'kerberos_realm': ['krb_realm_id'], 'klogin': ['klogin_id'], 'klogin_mclass': ['device_collection_id', 'klogin_id'], 'l2_network_coll_l2_network': ['layer2_network_collection_id', 'layer2_network_id'], 'l3_network_coll_l3_network': ['layer3_network_id', 'layer3_network_collection_id'], 'layer2_connection': ['layer2_connection_id'], 'layer2_connection_l2_network': ['layer2_connection_id', 'layer2_network_id'], 'layer2_network': ['layer2_network_id'], 'layer2_network_collection': ['layer2_network_collection_id'], 'layer2_network_collection_hier': ['child_l2_network_coll_id', 'layer2_network_collection_id'], 'layer3_network': ['layer3_network_id'], 'layer3_network_collection': ['layer3_network_collection_id'], 'layer3_network_collection_hier': ['layer3_network_collection_id', 'child_l3_network_coll_id'], 'logical_port': ['logical_port_id'], 'logical_port_slot': ['logical_port_id', 'slot_id'], 'logical_volume': ['logical_volume_id'], 'logical_volume_property': ['logical_volume_property_id'], 'logical_volume_purpose': ['logical_volume_purpose', 'logical_volume_id'], 'mlag_peering': ['mlag_peering_id'], 'netblock': ['netblock_id'], 'netblock_collection': ['netblock_collection_id'], 'netblock_collection_hier': ['netblock_collection_id', 'child_netblock_collection_id'], 'netblock_collection_netblock': ['netblock_collection_id', 'netblock_id'], 'network_interface': ['network_interface_id'], 'network_interface_netblock': ['network_interface_id', 'device_id', 'netblock_id'], 'network_interface_purpose': ['network_interface_purpose', 'device_id'], 'network_range': ['network_range_id'], 'network_service': ['network_service_id'], 'operating_system': ['operating_system_id'], 'operating_system_snapshot': ['operating_system_snapshot_id'], 'person': ['person_id'], 'person_account_realm_company': ['account_realm_id', 'person_id', 'company_id'], 'person_auth_question': ['person_id', 'auth_question_id'], 'person_company': ['company_id', 'person_id'], 'person_company_attr': ['person_company_attr_name', 'company_id', 'person_id'], 'person_company_badge': ['company_id', 'person_id', 'badge_id'], 'person_contact': ['person_contact_id'], 'person_image': ['person_image_id'], 'person_image_usage': ['person_image_usage', 'person_image_id'], 'person_location': ['person_location_id'], 'person_note': ['note_id'], 'person_parking_pass': ['person_id', 'person_parking_pass_id'], 'person_vehicle': ['person_vehicle_id'], 'physical_address': ['physical_address_id'], 'physical_connection': ['physical_connection_id'], 'physicalish_volume': ['physicalish_volume_id'], 'private_key': ['private_key_id'], 'property': ['property_id'], 'property_collection': ['property_collection_id'], 'property_collection_hier': ['property_collection_id', 'child_property_collection_id'], 'property_collection_property': ['property_collection_id', 'property_type', 'property_name'], 'pseudo_klogin': ['pseudo_klogin_id'], 'rack': ['rack_id'], 'rack_location': ['rack_location_id'], 'service_environment': ['service_environment_id'], 'service_environment_coll_hier': ['child_service_env_coll_id', 'service_env_collection_id'], 'service_environment_collection': ['service_env_collection_id'], 'shared_netblock': ['shared_netblock_id'], 'shared_netblock_network_int': ['shared_netblock_id', 'network_interface_id'], 'site': ['site_code'], 'slot': ['slot_id'], 'slot_type': ['slot_type_id'], 'slot_type_prmt_comp_slot_type': ['slot_type_id', 'component_slot_type_id'], 'slot_type_prmt_rem_slot_type': ['slot_type_id', 'remote_slot_type_id'], 'snmp_commstr': ['snmp_commstr_id'], 'ssh_key': ['ssh_key_id'], 'static_route': ['static_route_id'], 'static_route_template': ['static_route_template_id'], 'sudo_acct_col_device_collectio': ['sudo_alias_name', 'account_collection_id', 'device_collection_id'], 'sudo_alias': ['sudo_alias_name'], 'svc_environment_coll_svc_env': ['service_environment_id', 'service_env_collection_id'], 'sw_package': ['sw_package_id'], 'ticketing_system': ['ticketing_system_id'], 'token': ['token_id'], 'token_collection': ['token_collection_id'], 'token_collection_hier': ['token_collection_id', 'child_token_collection_id'], 'token_collection_token': ['token_collection_id', 'token_id'], 'token_sequence': ['token_id'], 'unix_group': ['account_collection_id'], 'val_account_collection_relatio': ['account_collection_relation'], 'val_account_collection_type': ['account_collection_type'], 'val_account_role': ['account_role'], 'val_account_type': ['account_type'], 'val_app_key': ['appaal_group_name', 'app_key'], 'val_app_key_values': ['app_value', 'app_key', 'appaal_group_name'], 'val_appaal_group_name': ['appaal_group_name'], 'val_approval_chain_resp_prd': ['approval_chain_response_period'], 'val_approval_expiration_action': ['approval_expiration_action'], 'val_approval_notifty_type': ['approval_notify_type'], 'val_approval_process_type': ['approval_process_type'], 'val_approval_type': ['approval_type'], 'val_attestation_frequency': ['attestation_frequency'], 'val_auth_question': ['auth_question_id'], 'val_auth_resource': ['auth_resource'], 'val_badge_status': ['badge_status'], 'val_cable_type': ['cable_type'], 'val_company_collection_type': ['company_collection_type'], 'val_company_type': ['company_type'], 'val_company_type_purpose': ['company_type_purpose'], 'val_component_function': ['component_function'], 'val_component_property': ['component_property_name', 'component_property_type'], 'val_component_property_type': ['component_property_type'], 'val_component_property_value': ['component_property_name', 'valid_property_value', 'component_property_type'], 'val_contract_type': ['contract_type'], 'val_country_code': ['iso_country_code'], 'val_device_auto_mgmt_protocol': ['auto_mgmt_protocol'], 'val_device_collection_type': ['device_collection_type'], 'val_device_mgmt_ctrl_type': ['device_mgmt_control_type'], 'val_device_status': ['device_status'], 'val_diet': ['diet'], 'val_dns_class': ['dns_class'], 'val_dns_domain_collection_type': ['dns_domain_collection_type'], 'val_dns_domain_type': ['dns_domain_type'], 'val_dns_record_relation_type': ['dns_record_relation_type'], 'val_dns_srv_service': ['dns_srv_service'], 'val_dns_type': ['dns_type'], 'val_encapsulation_mode': ['encapsulation_type', 'encapsulation_mode'], 'val_encapsulation_type': ['encapsulation_type'], 'val_encryption_key_purpose': ['encryption_key_purpose', 'encryption_key_purpose_version'], 'val_encryption_method': ['encryption_method'], 'val_filesystem_type': ['filesystem_type'], 'val_image_type': ['image_type'], 'val_ip_namespace': ['ip_namespace'], 'val_iso_currency_code': ['iso_currency_code'], 'val_key_usg_reason_for_assgn': ['key_usage_reason_for_assign'], 'val_layer2_network_coll_type': ['layer2_network_collection_type'], 'val_layer3_network_coll_type': ['layer3_network_collection_type'], 'val_logical_port_type': ['logical_port_type'], 'val_logical_volume_property': ['filesystem_type', 'logical_volume_property_name'], 'val_logical_volume_purpose': ['logical_volume_purpose'], 'val_logical_volume_type': ['logical_volume_type'], 'val_netblock_collection_type': ['netblock_collection_type'], 'val_netblock_status': ['netblock_status'], 'val_netblock_type': ['netblock_type'], 'val_network_interface_purpose': ['network_interface_purpose'], 'val_network_interface_type': ['network_interface_type'], 'val_network_range_type': ['network_range_type'], 'val_network_service_type': ['network_service_type'], 'val_operating_system_family': ['operating_system_family'], 'val_os_snapshot_type': ['operating_system_snapshot_type'], 'val_ownership_status': ['ownership_status'], 'val_package_relation_type': ['package_relation_type'], 'val_password_type': ['password_type'], 'val_person_company_attr_dtype': ['person_company_attr_data_type'], 'val_person_company_attr_name': ['person_company_attr_name'], 'val_person_company_attr_value': ['person_company_attr_value', 'person_company_attr_name'], 'val_person_company_relation': ['person_company_relation'], 'val_person_contact_loc_type': ['person_contact_location_type'], 'val_person_contact_technology': ['person_contact_technology', 'person_contact_type'], 'val_person_contact_type': ['person_contact_type'], 'val_person_image_usage': ['person_image_usage'], 'val_person_location_type': ['person_location_type'], 'val_person_status': ['person_status'], 'val_physical_address_type': ['physical_address_type'], 'val_physicalish_volume_type': ['physicalish_volume_type'], 'val_processor_architecture': ['processor_architecture'], 'val_production_state': ['production_state'], 'val_property': ['property_type', 'property_name'], 'val_property_collection_type': ['property_collection_type'], 'val_property_data_type': ['property_data_type'], 'val_property_type': ['property_type'], 'val_property_value': ['valid_property_value', 'property_name', 'property_type'], 'val_pvt_key_encryption_type': ['private_key_encryption_type'], 'val_rack_type': ['rack_type'], 'val_raid_type': ['raid_type'], 'val_service_env_coll_type': ['service_env_collection_type'], 'val_shared_netblock_protocol': ['shared_netblock_protocol'], 'val_slot_function': ['slot_function'], 'val_slot_physical_interface': ['slot_function', 'slot_physical_interface_type'], 'val_snmp_commstr_type': ['snmp_commstr_type'], 'val_ssh_key_type': ['ssh_key_type'], 'val_sw_package_type': ['sw_package_type'], 'val_token_collection_type': ['token_collection_type'], 'val_token_status': ['token_status'], 'val_token_type': ['token_type'], 'val_volume_group_purpose': ['volume_group_purpose'], 'val_volume_group_relation': ['volume_group_relation'], 'val_volume_group_type': ['volume_group_type'], 'val_x509_certificate_file_fmt': ['x509_file_format'], 'val_x509_certificate_type': ['x509_certificate_type'], 'val_x509_key_usage': ['x509_key_usg'], 'val_x509_key_usage_category': ['x509_key_usg_cat'], 'val_x509_revocation_reason': ['x509_revocation_reason'], 'volume_group': ['volume_group_id'], 'volume_group_physicalish_vol': ['volume_group_id', 'physicalish_volume_id'], 'volume_group_purpose': ['volume_group_id', 'volume_group_purpose'], 'x509_key_usage_attribute': ['x509_cert_id', 'x509_key_usg'], 'x509_key_usage_categorization': ['x509_key_usg_cat', 'x509_key_usg'], 'x509_key_usage_default': ['x509_key_usg', 'x509_signed_certificate_id'], 'x509_signed_certificate': ['x509_signed_certificate_id']} |
# LANGUAGE: Python
# AUTHOR: randy
# GITHUB: https://github.com/randy1369
print('Hello, python!') | print('Hello, python!') |
def test_opendota_api_type(heroes):
# Ensure data returned by fetch_hero_stats() is a list
assert isinstance(heroes, list)
def test_opendota_api_count(heroes, N_HEROES):
# Ensure all heroes are included
assert len(heroes) == N_HEROES
def test_opendota_api_contents(heroes, N_HEROES):
# Verify that all elements in heroes list are dicts
assert all(isinstance(hero, dict) for hero in heroes)
| def test_opendota_api_type(heroes):
assert isinstance(heroes, list)
def test_opendota_api_count(heroes, N_HEROES):
assert len(heroes) == N_HEROES
def test_opendota_api_contents(heroes, N_HEROES):
assert all((isinstance(hero, dict) for hero in heroes)) |
class Structure(object):
_fields = ()
def __init__(self, *args):
if len(_fields) != len(args):
raise TypeError(f"Expected {len(_fields)} arguments.")
for name, value in zip(self._fields, args):
setattr(self, name, value)
if __name__ == '__main__':
class Shares(Structure):
_fields = ('name', 'share', 'price')
class Point(Structure):
_fields = ('x', 'y')
class Circle(Structure):
_fields = ('radius')
| class Structure(object):
_fields = ()
def __init__(self, *args):
if len(_fields) != len(args):
raise type_error(f'Expected {len(_fields)} arguments.')
for (name, value) in zip(self._fields, args):
setattr(self, name, value)
if __name__ == '__main__':
class Shares(Structure):
_fields = ('name', 'share', 'price')
class Point(Structure):
_fields = ('x', 'y')
class Circle(Structure):
_fields = 'radius' |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
ID = 'ID'
TOKEN = 'TOKEN'
SUB_DOMAIN = 'xsy'
DOMAIN = 'admxj.pw'
| id = 'ID'
token = 'TOKEN'
sub_domain = 'xsy'
domain = 'admxj.pw' |
'''
this program translates any integer base to decimal.
examples for testing:
assert checkio("101", 2) == 5, "Binary"
assert checkio("111112", 3) == 365, "Ternary"
assert checkio("200", 4) == 32, "Quaternary"
assert checkio("101", 5) == 26, "5 base"
assert checkio("25", 6) == 17, "Heximal/Senary"
assert checkio("112", 8) == 74, "Octal
assert checkio("AB", 10) == -1, "B > A > 10"
assert checkio("10000", 12) == 20736, "duodecimal"
assert checkio("AF", 16) == 175, "Hex"
assert checkio("20", 20) == 40, "Vigesimal"
assert checkio("D0", 20) == 260, "Vigesimal"
assert checkio("100", 20) == 400, "Vigesimal"
assert checkio("Z", 36) == 35, "Hexatrigesimal"
'''
def checkio(str_number, radix):
myList = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
# initialise first digit
letter = str_number[0].lower();
faktor = myList.index(letter);
# digit cannot be greater than base
if faktor >= radix:
return -1
# only one digit
if len(str_number) == 1:
return faktor;
# only two digits
if len(str_number) == 2:
letter = str_number[0].lower();
faktor = myList.index(letter);
if faktor > radix:
return -1
result = faktor * radix;
letter = str_number[1].lower();
faktor = myList.index(letter);
if faktor > radix:
return -1
result += faktor;
return result
# all other cases
result = faktor;
for elem in range(1, len(str_number)):
letter = str_number[elem].lower();
faktor = myList.index(letter);
# check that digit is not greater than base
if faktor > radix:
return -1
result *= radix;
result += faktor;
return result;
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("AF", 16) == 175, "Hex"
assert checkio("101", 2) == 5, "Bin"
assert checkio("101", 5) == 26, "5 base"
assert checkio("Z", 36) == 35, "Z base"
assert checkio("AB", 10) == -1, "B > A > 10"
| """
this program translates any integer base to decimal.
examples for testing:
assert checkio("101", 2) == 5, "Binary"
assert checkio("111112", 3) == 365, "Ternary"
assert checkio("200", 4) == 32, "Quaternary"
assert checkio("101", 5) == 26, "5 base"
assert checkio("25", 6) == 17, "Heximal/Senary"
assert checkio("112", 8) == 74, "Octal
assert checkio("AB", 10) == -1, "B > A > 10"
assert checkio("10000", 12) == 20736, "duodecimal"
assert checkio("AF", 16) == 175, "Hex"
assert checkio("20", 20) == 40, "Vigesimal"
assert checkio("D0", 20) == 260, "Vigesimal"
assert checkio("100", 20) == 400, "Vigesimal"
assert checkio("Z", 36) == 35, "Hexatrigesimal"
"""
def checkio(str_number, radix):
my_list = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
letter = str_number[0].lower()
faktor = myList.index(letter)
if faktor >= radix:
return -1
if len(str_number) == 1:
return faktor
if len(str_number) == 2:
letter = str_number[0].lower()
faktor = myList.index(letter)
if faktor > radix:
return -1
result = faktor * radix
letter = str_number[1].lower()
faktor = myList.index(letter)
if faktor > radix:
return -1
result += faktor
return result
result = faktor
for elem in range(1, len(str_number)):
letter = str_number[elem].lower()
faktor = myList.index(letter)
if faktor > radix:
return -1
result *= radix
result += faktor
return result
if __name__ == '__main__':
assert checkio('AF', 16) == 175, 'Hex'
assert checkio('101', 2) == 5, 'Bin'
assert checkio('101', 5) == 26, '5 base'
assert checkio('Z', 36) == 35, 'Z base'
assert checkio('AB', 10) == -1, 'B > A > 10' |
classes = [
{
'name': 'science-1',
'subjects': [
{
'name': 'Math',
'taughtBy': 'Turing',
'duration': 60
},
{
'name': 'English',
'taughtBy': 'Adele',
'duration': 60
},
{
'name': 'Sports',
'taughtBy': 'Dinho',
'duration': 60
},
{
'name': 'Science',
'taughtBy': 'Harish',
'duration': 60
}
],
},
{
'name': 'science-2',
'subjects': [
{
'name': 'Math',
'taughtBy': 'Harish',
'duration': 60
},
{
'name': 'English',
'taughtBy': 'Freddie',
'duration': 60
},
{
'name': 'Music',
'taughtBy': 'Freddie',
'duration': 60
},
{
'name': 'Science',
'taughtBy': 'Harish',
'duration': 60
}
]
},
{
'name': 'biology',
'subjects': [
{
'name': 'Botany',
'taughtBy': 'Dalton',
'duration': 60
},
{
'name': 'Zoology',
'taughtBy': 'Dalton',
'duration': 60
}
]
},
{
'name': 'politics',
'subjects': [
{
'name': 'Political Administration',
'taughtBy': 'Trump',
'duration': 60
},
{
'name': 'Business Administration',
'taughtBy': 'Trump',
'duration': 60
},
{
'name': 'Foreign Affairs',
'taughtBy': 'Trump',
'duration': 60
}
]
},
{
'name': 'politics-2',
'subjects': [
{
'name': 'Foreign Affairs',
'taughtBy': 'Swaraj',
'duration': 60
}
]
},
{
'name': 'philosophy',
'subjects': [
{
'name': 'Philosophy',
'taughtBy': 'Socrates',
'duration': 60
},
{
'name': 'Moral Science',
'taughtBy': 'Socrates',
'duration': 60
}
]
},
]
| classes = [{'name': 'science-1', 'subjects': [{'name': 'Math', 'taughtBy': 'Turing', 'duration': 60}, {'name': 'English', 'taughtBy': 'Adele', 'duration': 60}, {'name': 'Sports', 'taughtBy': 'Dinho', 'duration': 60}, {'name': 'Science', 'taughtBy': 'Harish', 'duration': 60}]}, {'name': 'science-2', 'subjects': [{'name': 'Math', 'taughtBy': 'Harish', 'duration': 60}, {'name': 'English', 'taughtBy': 'Freddie', 'duration': 60}, {'name': 'Music', 'taughtBy': 'Freddie', 'duration': 60}, {'name': 'Science', 'taughtBy': 'Harish', 'duration': 60}]}, {'name': 'biology', 'subjects': [{'name': 'Botany', 'taughtBy': 'Dalton', 'duration': 60}, {'name': 'Zoology', 'taughtBy': 'Dalton', 'duration': 60}]}, {'name': 'politics', 'subjects': [{'name': 'Political Administration', 'taughtBy': 'Trump', 'duration': 60}, {'name': 'Business Administration', 'taughtBy': 'Trump', 'duration': 60}, {'name': 'Foreign Affairs', 'taughtBy': 'Trump', 'duration': 60}]}, {'name': 'politics-2', 'subjects': [{'name': 'Foreign Affairs', 'taughtBy': 'Swaraj', 'duration': 60}]}, {'name': 'philosophy', 'subjects': [{'name': 'Philosophy', 'taughtBy': 'Socrates', 'duration': 60}, {'name': 'Moral Science', 'taughtBy': 'Socrates', 'duration': 60}]}] |
cont = 0
lista = []
while cont < 20:
x = input()
lista.append(x)
cont += 1
cont2 = 0
valor = -1
while cont2 < 20:
print("N[" + str(cont2) + "] = " + str(lista[valor]))
valor -= 1
cont2 += 1 | cont = 0
lista = []
while cont < 20:
x = input()
lista.append(x)
cont += 1
cont2 = 0
valor = -1
while cont2 < 20:
print('N[' + str(cont2) + '] = ' + str(lista[valor]))
valor -= 1
cont2 += 1 |
class Solution:
def isRobotBounded(self, instructions: str) -> bool:
x, y, dx, dy = 0, 0, 0, 1
for it in instructions:
if it == 'L':
dx, dy = -dy, dx
elif it == 'R':
dx, dy = dy, -dx
else:
x = x + dx
y = y + dy
return (x, y) == (0, 0) or (dx, dy) != (0, 1)
| class Solution:
def is_robot_bounded(self, instructions: str) -> bool:
(x, y, dx, dy) = (0, 0, 0, 1)
for it in instructions:
if it == 'L':
(dx, dy) = (-dy, dx)
elif it == 'R':
(dx, dy) = (dy, -dx)
else:
x = x + dx
y = y + dy
return (x, y) == (0, 0) or (dx, dy) != (0, 1) |
### TODO use the details of your database connection
REGION = 'eu-west-2'
DBPORT = 1433
DBUSERNAME = 'admin' # the name of the database user you created in step 2
DBNAME = 'EventDatabase' # the name of the database your database user is granted access to
DBENDPOINT = 'eventdatabase.cu9s0xzhp0zw.eu-west-2.rds.amazonaws.com' #
DBPASSWORD = 'Eventpassword'
#config file containing credentials for RDS MySQL instance
db_username = "admin"
db_password = "Eventpassword"
db_name = "event_shema"
| region = 'eu-west-2'
dbport = 1433
dbusername = 'admin'
dbname = 'EventDatabase'
dbendpoint = 'eventdatabase.cu9s0xzhp0zw.eu-west-2.rds.amazonaws.com'
dbpassword = 'Eventpassword'
db_username = 'admin'
db_password = 'Eventpassword'
db_name = 'event_shema' |
MAILBOX_MOVIE_CLEAR = 2
MAILBOX_MOVIE_EMPTY = 3
MAILBOX_MOVIE_WAITING = 4
MAILBOX_MOVIE_READY = 5
MAILBOX_MOVIE_NOT_OWNER = 6
MAILBOX_MOVIE_EXIT = 7
| mailbox_movie_clear = 2
mailbox_movie_empty = 3
mailbox_movie_waiting = 4
mailbox_movie_ready = 5
mailbox_movie_not_owner = 6
mailbox_movie_exit = 7 |
answer = int(input("How many times do you want to play? "))
for i in range(0,answer):
person1 = input("What is the first name? ")
person2 = input("What is the second name? ")
if person1 > person2:
print(person1)
print("has won")
elif person1 == person2:
print("friendship")
print("has won")
else:
print(person2)
print("has won")
| answer = int(input('How many times do you want to play? '))
for i in range(0, answer):
person1 = input('What is the first name? ')
person2 = input('What is the second name? ')
if person1 > person2:
print(person1)
print('has won')
elif person1 == person2:
print('friendship')
print('has won')
else:
print(person2)
print('has won') |
# 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 ( X , Y , m , n ) :
LCSuff = [ [ 0 for k in range ( n + 1 ) ] for l in range ( m + 1 ) ]
result = 0
for i in range ( m + 1 ) :
for j in range ( n + 1 ) :
if ( i == 0 or j == 0 ) :
LCSuff [ i ] [ j ] = 0
elif ( X [ i - 1 ] == Y [ j - 1 ] ) :
LCSuff [ i ] [ j ] = LCSuff [ i - 1 ] [ j - 1 ] + 1
result = max ( result , LCSuff [ i ] [ j ] )
else :
LCSuff [ i ] [ j ] = 0
return result
#TOFILL
if __name__ == '__main__':
param = [
(['A', 'D', 'E', 'E', 'L', 'L', 'T', 'r', 'x'],['D', 'F', 'H', 'O', 'g', 'o', 'u', 'v', 'w'],4,4,),
(['9', '3', '4', '8', '7', '6', '3', '8', '3', '3', '5', '3', '5', '4', '2', '5', '5', '3', '6', '2', '1', '7', '4', '2', '7', '3', '2', '1', '3', '7', '6', '5', '0', '6', '3', '8', '5', '1', '7', '9', '2', '7'],['5', '5', '3', '7', '8', '0', '9', '8', '5', '8', '5', '1', '4', '4', '0', '2', '9', '2', '3', '1', '1', '3', '6', '1', '2', '0', '5', '4', '3', '7', '5', '5', '8', '1', '1', '4', '8', '1', '7', '5', '5', '4'],41,37,),
(['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],35,29,),
(['W', 'X', 'P', 'u', 's', 'k', 'O', 'y', 'Q', 'i', 't', 'z', 'F', 'f', 's', 'N', 'K', 'm', 'I', 'M', 'g', 'e', 'E', 'P', 'b', 'Y', 'c', 'O', ' ', 'G', 'F', 'x'],['e', 'R', 'P', 'W', 'd', 'a', 'A', 'j', 'H', 'v', 'T', 'w', 'x', 'I', 'd', 'o', 'z', 'K', 'B', 'M', 'J', 'L', 'a', ' ', 'T', 'L', 'V', 't', 'M', 'U', 'z', 'R'],31,18,),
(['0', '1', '2', '4', '5', '7', '7', '7', '8', '8', '9', '9', '9'],['0', '0', '2', '2', '2', '3', '4', '6', '6', '7', '8', '9', '9'],12,8,),
(['0', '0', '1'],['0', '0', '1'],1,1,),
(['A', 'C', 'F', 'G', 'G', 'H', 'I', 'K', 'K', 'N', 'O', 'Q', 'R', 'V', 'V', 'W', 'Y', 'a', 'a', 'c', 'd', 'k', 'k', 'm', 'o', 'p', 't', 'u', 'y', 'y', 'y', 'z'],[' ', ' ', 'B', 'C', 'C', 'C', 'D', 'E', 'I', 'J', 'M', 'N', 'P', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'Y', 'b', 'c', 'e', 'i', 'o', 'p', 'r', 't', 'y', 'y', 'z'],21,23,),
(['0', '0', '0', '2', '8', '3', '5', '1', '0', '7', '7', '9', '9', '4', '8', '9', '5'],['8', '5', '8', '7', '1', '4', '0', '2', '2', '7', '2', '4', '0', '8', '3', '8', '7'],13,12,),
(['0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1'],['0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1'],9,9,),
(['B', 'o', 'R', 'k', 'Y', 'M', 'g', 'b', 'h', 'A', 'i', 'X', 'p', 'i', 'j', 'f', 'V', 'n', 'd', 'P', 'T', 'U', 'f', 'G', 'M', 'W', 'g', 'a', 'C', 'E', 'v', 'C', ' '],['F', 'h', 'G', 'H', 'Q', 'Q', 'K', 'g', 'k', 'u', 'l', 'c', 'c', 'o', 'n', 'G', 'i', 'Z', 'd', 'b', 'c', 'b', 'v', 't', 'S', 't', 'P', 'A', 'K', 'g', 'G', 'i', 'm'],19,32,)
]
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 f_gold(X, Y, m, n):
lc_suff = [[0 for k in range(n + 1)] for l in range(m + 1)]
result = 0
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
LCSuff[i][j] = 0
elif X[i - 1] == Y[j - 1]:
LCSuff[i][j] = LCSuff[i - 1][j - 1] + 1
result = max(result, LCSuff[i][j])
else:
LCSuff[i][j] = 0
return result
if __name__ == '__main__':
param = [(['A', 'D', 'E', 'E', 'L', 'L', 'T', 'r', 'x'], ['D', 'F', 'H', 'O', 'g', 'o', 'u', 'v', 'w'], 4, 4), (['9', '3', '4', '8', '7', '6', '3', '8', '3', '3', '5', '3', '5', '4', '2', '5', '5', '3', '6', '2', '1', '7', '4', '2', '7', '3', '2', '1', '3', '7', '6', '5', '0', '6', '3', '8', '5', '1', '7', '9', '2', '7'], ['5', '5', '3', '7', '8', '0', '9', '8', '5', '8', '5', '1', '4', '4', '0', '2', '9', '2', '3', '1', '1', '3', '6', '1', '2', '0', '5', '4', '3', '7', '5', '5', '8', '1', '1', '4', '8', '1', '7', '5', '5', '4'], 41, 37), (['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'], ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'], 35, 29), (['W', 'X', 'P', 'u', 's', 'k', 'O', 'y', 'Q', 'i', 't', 'z', 'F', 'f', 's', 'N', 'K', 'm', 'I', 'M', 'g', 'e', 'E', 'P', 'b', 'Y', 'c', 'O', ' ', 'G', 'F', 'x'], ['e', 'R', 'P', 'W', 'd', 'a', 'A', 'j', 'H', 'v', 'T', 'w', 'x', 'I', 'd', 'o', 'z', 'K', 'B', 'M', 'J', 'L', 'a', ' ', 'T', 'L', 'V', 't', 'M', 'U', 'z', 'R'], 31, 18), (['0', '1', '2', '4', '5', '7', '7', '7', '8', '8', '9', '9', '9'], ['0', '0', '2', '2', '2', '3', '4', '6', '6', '7', '8', '9', '9'], 12, 8), (['0', '0', '1'], ['0', '0', '1'], 1, 1), (['A', 'C', 'F', 'G', 'G', 'H', 'I', 'K', 'K', 'N', 'O', 'Q', 'R', 'V', 'V', 'W', 'Y', 'a', 'a', 'c', 'd', 'k', 'k', 'm', 'o', 'p', 't', 'u', 'y', 'y', 'y', 'z'], [' ', ' ', 'B', 'C', 'C', 'C', 'D', 'E', 'I', 'J', 'M', 'N', 'P', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'Y', 'b', 'c', 'e', 'i', 'o', 'p', 'r', 't', 'y', 'y', 'z'], 21, 23), (['0', '0', '0', '2', '8', '3', '5', '1', '0', '7', '7', '9', '9', '4', '8', '9', '5'], ['8', '5', '8', '7', '1', '4', '0', '2', '2', '7', '2', '4', '0', '8', '3', '8', '7'], 13, 12), (['0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1'], ['0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1'], 9, 9), (['B', 'o', 'R', 'k', 'Y', 'M', 'g', 'b', 'h', 'A', 'i', 'X', 'p', 'i', 'j', 'f', 'V', 'n', 'd', 'P', 'T', 'U', 'f', 'G', 'M', 'W', 'g', 'a', 'C', 'E', 'v', 'C', ' '], ['F', 'h', 'G', 'H', 'Q', 'Q', 'K', 'g', 'k', 'u', 'l', 'c', 'c', 'o', 'n', 'G', 'i', 'Z', 'd', 'b', 'c', 'b', 'v', 't', 'S', 't', 'P', 'A', 'K', 'g', 'G', 'i', 'm'], 19, 32)]
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))) |
#Simple declaration of Funtion
'''def say_hello():
print('hello')
say_hello()
'''
def greeting(name):
print(f'Hello {name}')
greeting('raj') | """def say_hello():
print('hello')
say_hello()
"""
def greeting(name):
print(f'Hello {name}')
greeting('raj') |
def for_hyphen():
for row in range(3):
for col in range(3):
if row==1:
print("*",end=" ")
else:
print(" ",end=" ")
print()
def while_hyphen():
row=0
while row<3:
col=0
while col<3:
if row==1:
print("*",end=" ")
else:
print(" ",end=" ")
col+=1
row+=1
print()
| def for_hyphen():
for row in range(3):
for col in range(3):
if row == 1:
print('*', end=' ')
else:
print(' ', end=' ')
print()
def while_hyphen():
row = 0
while row < 3:
col = 0
while col < 3:
if row == 1:
print('*', end=' ')
else:
print(' ', end=' ')
col += 1
row += 1
print() |
def tabuada(numero):
for i in range(1, 11):
print(f'{i} x {numero} = {i * numero}')
tabuada(int(input()))
| def tabuada(numero):
for i in range(1, 11):
print(f'{i} x {numero} = {i * numero}')
tabuada(int(input())) |
class RadarSensor:
angle = None
axis = None
distance = None
property = None
| class Radarsensor:
angle = None
axis = None
distance = None
property = None |
#!/usr/bin/env python3
class Course:
'''Course superclass for any course'''
def __init__(self, dept, num, name='',
units=4, prereq=set(), restr=set(), coclass=None):
self.dept, self.num, self.name = dept, num, name
self.units = units
self.prereq, self.restr = prereq, restr
if coclass:
self.coclass = coclass
else:
self.coclass = 'No co-classes required'
def __repr__(self):
return self.dept+' '+self.num
def get_info(self):
return self.__repr__()+': '+self.name\
+'\nPrerequisites: '+', '.join(self.prereq)\
+ '\nCoclasses: '+self.coclass
class GE(Course):
'''GE class'''
def __init__(self, dept, num, name='',
units=4, prereq=set(), restr=set(), coclass=None, section=set()):
self.section = section
super.__init__(dept, num, name, units, prereq, restr, coclass) | class Course:
"""Course superclass for any course"""
def __init__(self, dept, num, name='', units=4, prereq=set(), restr=set(), coclass=None):
(self.dept, self.num, self.name) = (dept, num, name)
self.units = units
(self.prereq, self.restr) = (prereq, restr)
if coclass:
self.coclass = coclass
else:
self.coclass = 'No co-classes required'
def __repr__(self):
return self.dept + ' ' + self.num
def get_info(self):
return self.__repr__() + ': ' + self.name + '\nPrerequisites: ' + ', '.join(self.prereq) + '\nCoclasses: ' + self.coclass
class Ge(Course):
"""GE class"""
def __init__(self, dept, num, name='', units=4, prereq=set(), restr=set(), coclass=None, section=set()):
self.section = section
super.__init__(dept, num, name, units, prereq, restr, coclass) |
# LIS2DW12 3-axis motion seneor micropython drive
# ver: 1.0
# License: MIT
# Author: shaoziyang (shaoziyang@micropython.org.cn)
# v1.0 2019.7
LIS2DW12_CTRL1 = const(0x20)
LIS2DW12_CTRL2 = const(0x21)
LIS2DW12_CTRL3 = const(0x22)
LIS2DW12_CTRL6 = const(0x25)
LIS2DW12_STATUS = const(0x27)
LIS2DW12_OUT_T_L = const(0x0D)
LIS2DW12_OUT_X_L = const(0x28)
LIS2DW12_OUT_Y_L = const(0x2A)
LIS2DW12_OUT_Z_L = const(0x2C)
LIS2DW12_SCALE = ('2g', '4g', '8g', '16g')
class LIS2DW12():
def __init__(self, i2c, addr = 0x19):
self.i2c = i2c
self.addr = addr
self.tb = bytearray(1)
self.rb = bytearray(1)
self.oneshot = False
self.irq_v = [0, 0, 0]
self._power = 0x20
# ODR=5 MODE=0 LP=1
self.setreg(LIS2DW12_CTRL1, 0x51)
# BDU=1
self.setreg(LIS2DW12_CTRL2, 0x0C)
# SLP_MODE_SEL=1
self.setreg(LIS2DW12_CTRL3, 0x02)
# scale=2G
self._scale = 0
self.scale(self._scale)
self.oneshot_mode(False)
def int16(self, d):
return d if d < 0x8000 else d - 0x10000
def setreg(self, reg, dat):
self.tb[0] = dat
self.i2c.writeto_mem(self.addr, reg, self.tb)
def getreg(self, reg):
self.i2c.readfrom_mem_into(self.addr, reg, self.rb)
return self.rb[0]
def get2reg(self, reg):
return self.getreg(reg) + self.getreg(reg+1) * 256
def r_w_reg(self, reg, dat, mask):
self.getreg(reg)
self.rb[0] = (self.rb[0] & mask) | dat
self.setreg(reg, self.rb[0])
def oneshot_mode(self, oneshot=None):
if oneshot is None:
return self.oneshot
else:
self.oneshot = oneshot
d = 8 if oneshot else 0
self.r_w_reg(LIS2DW12_CTRL1, d, 0xF3)
def ONE_SHOT(self):
if self.oneshot:
self.r_w_reg(LIS2DW12_CTRL3, 1, 0xFE)
while 1:
if (self.getreg(LIS2DW12_CTRL3) & 0x01) == 0:
return
def x_raw(self):
self.ONE_SHOT()
return self.int16(self.get2reg(LIS2DW12_OUT_X_L))>>2
def y_raw(self):
self.ONE_SHOT()
return self.int16(self.get2reg(LIS2DW12_OUT_Y_L))>>2
def z_raw(self):
self.ONE_SHOT()
return self.int16(self.get2reg(LIS2DW12_OUT_Z_L))>>2
def get_raw(self):
self.ONE_SHOT()
self.irq_v[0] = self.int16(self.get2reg(LIS2DW12_OUT_X_L))>>2
self.irq_v[1] = self.int16(self.get2reg(LIS2DW12_OUT_Y_L))>>2
self.irq_v[2] = self.int16(self.get2reg(LIS2DW12_OUT_Z_L))>>2
return self.irq_v
def mg(self, reg):
return round(self.int16(self.get2reg(reg)) * 0.061 * (1 << self._scale))
def x(self):
self.ONE_SHOT()
return self.mg(LIS2DW12_OUT_X_L)
def y(self):
self.ONE_SHOT()
return self.mg(LIS2DW12_OUT_Y_L)
def z(self):
self.ONE_SHOT()
return self.mg(LIS2DW12_OUT_Z_L)
def get(self):
self.ONE_SHOT()
self.irq_v[0] = self.mg(LIS2DW12_OUT_X_L)
self.irq_v[1] = self.mg(LIS2DW12_OUT_Y_L)
self.irq_v[2] = self.mg(LIS2DW12_OUT_Z_L)
return self.irq_v
def temperature(self):
try:
return self.int16(self.get2reg(LIS2DW12_OUT_T_L))/256 + 25
except MemoryError:
return self.temperature_irq()
def temperature_irq(self):
self.getreg(LIS2DW12_OUT_T_L+1)
if self.rb[0] & 0x80: self.rb[0] -= 256
return self.rb[0] + 25
def scale(self, dat=None):
if dat is None:
return LIS2DW12_SCALE[self._scale]
else:
if type(dat) is str:
if not dat in LIS2DW12_SCALE: return
self._scale = LIS2DW12_SCALE.index(dat)
else: return
self.r_w_reg(LIS2DW12_CTRL6, self._scale<<4, 0xCF)
def power(self, on=None):
if on is None:
return self._power > 0
else:
if on:
self.r_w_reg(LIS2DW12_CTRL1, self._power, 0x0F)
self._power = 0
else:
self._power = self.getreg(LIS2DW12_CTRL1) & 0xF0
self.r_w_reg(LIS2DW12_CTRL1, 0, 0x0F)
| lis2_dw12_ctrl1 = const(32)
lis2_dw12_ctrl2 = const(33)
lis2_dw12_ctrl3 = const(34)
lis2_dw12_ctrl6 = const(37)
lis2_dw12_status = const(39)
lis2_dw12_out_t_l = const(13)
lis2_dw12_out_x_l = const(40)
lis2_dw12_out_y_l = const(42)
lis2_dw12_out_z_l = const(44)
lis2_dw12_scale = ('2g', '4g', '8g', '16g')
class Lis2Dw12:
def __init__(self, i2c, addr=25):
self.i2c = i2c
self.addr = addr
self.tb = bytearray(1)
self.rb = bytearray(1)
self.oneshot = False
self.irq_v = [0, 0, 0]
self._power = 32
self.setreg(LIS2DW12_CTRL1, 81)
self.setreg(LIS2DW12_CTRL2, 12)
self.setreg(LIS2DW12_CTRL3, 2)
self._scale = 0
self.scale(self._scale)
self.oneshot_mode(False)
def int16(self, d):
return d if d < 32768 else d - 65536
def setreg(self, reg, dat):
self.tb[0] = dat
self.i2c.writeto_mem(self.addr, reg, self.tb)
def getreg(self, reg):
self.i2c.readfrom_mem_into(self.addr, reg, self.rb)
return self.rb[0]
def get2reg(self, reg):
return self.getreg(reg) + self.getreg(reg + 1) * 256
def r_w_reg(self, reg, dat, mask):
self.getreg(reg)
self.rb[0] = self.rb[0] & mask | dat
self.setreg(reg, self.rb[0])
def oneshot_mode(self, oneshot=None):
if oneshot is None:
return self.oneshot
else:
self.oneshot = oneshot
d = 8 if oneshot else 0
self.r_w_reg(LIS2DW12_CTRL1, d, 243)
def one_shot(self):
if self.oneshot:
self.r_w_reg(LIS2DW12_CTRL3, 1, 254)
while 1:
if self.getreg(LIS2DW12_CTRL3) & 1 == 0:
return
def x_raw(self):
self.ONE_SHOT()
return self.int16(self.get2reg(LIS2DW12_OUT_X_L)) >> 2
def y_raw(self):
self.ONE_SHOT()
return self.int16(self.get2reg(LIS2DW12_OUT_Y_L)) >> 2
def z_raw(self):
self.ONE_SHOT()
return self.int16(self.get2reg(LIS2DW12_OUT_Z_L)) >> 2
def get_raw(self):
self.ONE_SHOT()
self.irq_v[0] = self.int16(self.get2reg(LIS2DW12_OUT_X_L)) >> 2
self.irq_v[1] = self.int16(self.get2reg(LIS2DW12_OUT_Y_L)) >> 2
self.irq_v[2] = self.int16(self.get2reg(LIS2DW12_OUT_Z_L)) >> 2
return self.irq_v
def mg(self, reg):
return round(self.int16(self.get2reg(reg)) * 0.061 * (1 << self._scale))
def x(self):
self.ONE_SHOT()
return self.mg(LIS2DW12_OUT_X_L)
def y(self):
self.ONE_SHOT()
return self.mg(LIS2DW12_OUT_Y_L)
def z(self):
self.ONE_SHOT()
return self.mg(LIS2DW12_OUT_Z_L)
def get(self):
self.ONE_SHOT()
self.irq_v[0] = self.mg(LIS2DW12_OUT_X_L)
self.irq_v[1] = self.mg(LIS2DW12_OUT_Y_L)
self.irq_v[2] = self.mg(LIS2DW12_OUT_Z_L)
return self.irq_v
def temperature(self):
try:
return self.int16(self.get2reg(LIS2DW12_OUT_T_L)) / 256 + 25
except MemoryError:
return self.temperature_irq()
def temperature_irq(self):
self.getreg(LIS2DW12_OUT_T_L + 1)
if self.rb[0] & 128:
self.rb[0] -= 256
return self.rb[0] + 25
def scale(self, dat=None):
if dat is None:
return LIS2DW12_SCALE[self._scale]
else:
if type(dat) is str:
if not dat in LIS2DW12_SCALE:
return
self._scale = LIS2DW12_SCALE.index(dat)
else:
return
self.r_w_reg(LIS2DW12_CTRL6, self._scale << 4, 207)
def power(self, on=None):
if on is None:
return self._power > 0
elif on:
self.r_w_reg(LIS2DW12_CTRL1, self._power, 15)
self._power = 0
else:
self._power = self.getreg(LIS2DW12_CTRL1) & 240
self.r_w_reg(LIS2DW12_CTRL1, 0, 15) |
recomputation_vm_memory = 2048
haskell_vm_memory = 4096
recomputation_vm_cpus = 2
vagrantfile_templates_dict = {
"python": "python/python.vagrantfile",
"node_js": "nodejs/nodejs.vagrantfile",
"cpp": "cpp/cpp.vagrantfile",
"c++": "cpp/cpp.vagrantfile",
"c": "cpp/cpp.vagrantfile",
"haskell": "haskell/haskell.vagrantfile",
"go": "go/go.vagrantfile"
}
languages_version_dict = {
"python": "2.7",
"node_js": "0.10"
}
languages_install_dict = {
"python": ["pip install -r requirements.txt"],
"node_js": ["npm install"],
"cpp": ["chmod +x configure", "./configure", "make", "sudo make install"],
"c++": ["chmod +x configure", "./configure", "make", "sudo make install"],
"c": ["chmod +x configure", "./configure", "make", "sudo make install"],
"haskell": ["$VAGRANT_USER 'cabal configure'", "$VAGRANT_USER 'cabal install'"]
}
boxes_install_scripts = {
"gecode": ["echo \"export LD_LIBRARY_PATH=/home/vagrant/gecode\" >> /home/vagrant/.bashrc", "source /home/vagrant/.bashrc"],
"Idris-dev": ["$VAGRANT_USER 'sudo cabal configure'", "$VAGRANT_USER 'sudo cabal install'"]
}
ignore_test_scripts = ["Idris-dev"]
| recomputation_vm_memory = 2048
haskell_vm_memory = 4096
recomputation_vm_cpus = 2
vagrantfile_templates_dict = {'python': 'python/python.vagrantfile', 'node_js': 'nodejs/nodejs.vagrantfile', 'cpp': 'cpp/cpp.vagrantfile', 'c++': 'cpp/cpp.vagrantfile', 'c': 'cpp/cpp.vagrantfile', 'haskell': 'haskell/haskell.vagrantfile', 'go': 'go/go.vagrantfile'}
languages_version_dict = {'python': '2.7', 'node_js': '0.10'}
languages_install_dict = {'python': ['pip install -r requirements.txt'], 'node_js': ['npm install'], 'cpp': ['chmod +x configure', './configure', 'make', 'sudo make install'], 'c++': ['chmod +x configure', './configure', 'make', 'sudo make install'], 'c': ['chmod +x configure', './configure', 'make', 'sudo make install'], 'haskell': ["$VAGRANT_USER 'cabal configure'", "$VAGRANT_USER 'cabal install'"]}
boxes_install_scripts = {'gecode': ['echo "export LD_LIBRARY_PATH=/home/vagrant/gecode" >> /home/vagrant/.bashrc', 'source /home/vagrant/.bashrc'], 'Idris-dev': ["$VAGRANT_USER 'sudo cabal configure'", "$VAGRANT_USER 'sudo cabal install'"]}
ignore_test_scripts = ['Idris-dev'] |
def pay(hours,rate) :
return hours * rate
hours = float(input('Enter Hours:'))
rate = float(input('Enter Rate:'))
print(pay(hours,rate)) | def pay(hours, rate):
return hours * rate
hours = float(input('Enter Hours:'))
rate = float(input('Enter Rate:'))
print(pay(hours, rate)) |
{
"targets": [
{
"target_name": "mynanojs",
"sources": [ "./src/mynanojs.c", "./src/utility.c", "./src/mybitcoinjs.c" ],
"include_dirs":[ "./include", "./include/sodium" ],
"libraries": [
"../lib/libnanocrypto1.a", "../lib/libsodium.a"
],
}
]
}
| {'targets': [{'target_name': 'mynanojs', 'sources': ['./src/mynanojs.c', './src/utility.c', './src/mybitcoinjs.c'], 'include_dirs': ['./include', './include/sodium'], 'libraries': ['../lib/libnanocrypto1.a', '../lib/libsodium.a']}]} |
input00 = open("input/input00.txt", "r")
input01 = open("input/input01.txt", "r")
input00_list = input00.read().splitlines()
input01_list = input01.read().splitlines()
count_elements = int(input00_list[0])
dictionary = {}
for i in range(count_elements):
str_elements = input00_list[i+1].split()
dictionary[str_elements[0]] = [str_elements[1], str_elements[2], str_elements[3]]
average = sum(map(int, dictionary[input00_list[count_elements + 1]])) / len(input00_list)
print(average)
# query_scores = student_marks[query_name]
# print("{0:.2f}".format(sum(query_scores) / len(query_scores)))
| input00 = open('input/input00.txt', 'r')
input01 = open('input/input01.txt', 'r')
input00_list = input00.read().splitlines()
input01_list = input01.read().splitlines()
count_elements = int(input00_list[0])
dictionary = {}
for i in range(count_elements):
str_elements = input00_list[i + 1].split()
dictionary[str_elements[0]] = [str_elements[1], str_elements[2], str_elements[3]]
average = sum(map(int, dictionary[input00_list[count_elements + 1]])) / len(input00_list)
print(average) |
{
"variables": {
"library%": "shared_library",
"mikmod_dir%": "../libmikmod"
},
"target_defaults": {
"include_dirs": [
"include",
"<(mikmod_dir)/include"
],
"defines": [
"HAVE_CONFIG_H"
],
"cflags": [
"-Wall",
"-finline-functions",
"-funroll-loops",
"-ffast-math"
],
"target_conditions": [
["OS == 'win'", {
"defines": [ "WIN32" ]
}],
["OS != 'win'", {
"defines": [ "unix" ]
}],
["_type == 'shared_library' and OS == 'win'", {
"defines": [ "DLL_EXPORTS" ]
}],
["_type == 'shared_library' and OS == 'linux'", {
"cflags": [ "-fPIC" ]
}]
],
"default_configuration": "Release",
"configurations": {
"Debug": {
"defines": [ "MIKMOD_DEBUG" ],
"cflags": [ "-g3", "-Werror" ],
"msvs_settings": {
"VCCLCompilerTool": {
"RuntimeLibrary": 3
}
}
},
"Release": {
"cflags": [ "-g", "-O2" ],
"msvs_settings": {
"VCCLCompilerTool": {
"RuntimeLibrary": 2
}
}
}
}
},
"targets": [
{
"target_name": "mikmod",
"type": "<(library)",
"product_dir": "../../System",
"sources": [
"<(mikmod_dir)/drivers/drv_nos.c",
"<(mikmod_dir)/drivers/drv_raw.c",
"<(mikmod_dir)/drivers/drv_stdout.c",
"<(mikmod_dir)/drivers/drv_wav.c",
"<(mikmod_dir)/loaders/load_669.c",
"<(mikmod_dir)/loaders/load_amf.c",
"<(mikmod_dir)/loaders/load_asy.c",
"<(mikmod_dir)/loaders/load_dsm.c",
"<(mikmod_dir)/loaders/load_far.c",
"<(mikmod_dir)/loaders/load_gdm.c",
"<(mikmod_dir)/loaders/load_gt2.c",
"<(mikmod_dir)/loaders/load_it.c",
"<(mikmod_dir)/loaders/load_imf.c",
"<(mikmod_dir)/loaders/load_m15.c",
"<(mikmod_dir)/loaders/load_med.c",
"<(mikmod_dir)/loaders/load_mod.c",
"<(mikmod_dir)/loaders/load_mtm.c",
"<(mikmod_dir)/loaders/load_okt.c",
"<(mikmod_dir)/loaders/load_s3m.c",
"<(mikmod_dir)/loaders/load_stm.c",
"<(mikmod_dir)/loaders/load_stx.c",
"<(mikmod_dir)/loaders/load_ult.c",
"<(mikmod_dir)/loaders/load_uni.c",
"<(mikmod_dir)/loaders/load_xm.c",
"<(mikmod_dir)/mmio/mmalloc.c",
"<(mikmod_dir)/mmio/mmerror.c",
"<(mikmod_dir)/mmio/mmio.c",
"<(mikmod_dir)/playercode/mdriver.c",
"<(mikmod_dir)/playercode/mdreg.c",
"<(mikmod_dir)/playercode/mdulaw.c",
"<(mikmod_dir)/playercode/mloader.c",
"<(mikmod_dir)/playercode/mlreg.c",
"<(mikmod_dir)/playercode/mlutil.c",
"<(mikmod_dir)/playercode/mplayer.c",
"<(mikmod_dir)/playercode/munitrk.c",
"<(mikmod_dir)/playercode/mwav.c",
"<(mikmod_dir)/playercode/npertab.c",
"<(mikmod_dir)/playercode/sloader.c",
"<(mikmod_dir)/playercode/virtch.c",
"<(mikmod_dir)/playercode/virtch2.c",
"<(mikmod_dir)/playercode/virtch_common.c"
],
"all_dependent_settings": {
"include_dirs": [
"include",
"<(mikmod_dir)/include"
]
},
"conditions": [
["OS != 'win'", {
"libraries": [ "-lm" ]
}]
]
}
]
}
| {'variables': {'library%': 'shared_library', 'mikmod_dir%': '../libmikmod'}, 'target_defaults': {'include_dirs': ['include', '<(mikmod_dir)/include'], 'defines': ['HAVE_CONFIG_H'], 'cflags': ['-Wall', '-finline-functions', '-funroll-loops', '-ffast-math'], 'target_conditions': [["OS == 'win'", {'defines': ['WIN32']}], ["OS != 'win'", {'defines': ['unix']}], ["_type == 'shared_library' and OS == 'win'", {'defines': ['DLL_EXPORTS']}], ["_type == 'shared_library' and OS == 'linux'", {'cflags': ['-fPIC']}]], 'default_configuration': 'Release', 'configurations': {'Debug': {'defines': ['MIKMOD_DEBUG'], 'cflags': ['-g3', '-Werror'], 'msvs_settings': {'VCCLCompilerTool': {'RuntimeLibrary': 3}}}, 'Release': {'cflags': ['-g', '-O2'], 'msvs_settings': {'VCCLCompilerTool': {'RuntimeLibrary': 2}}}}}, 'targets': [{'target_name': 'mikmod', 'type': '<(library)', 'product_dir': '../../System', 'sources': ['<(mikmod_dir)/drivers/drv_nos.c', '<(mikmod_dir)/drivers/drv_raw.c', '<(mikmod_dir)/drivers/drv_stdout.c', '<(mikmod_dir)/drivers/drv_wav.c', '<(mikmod_dir)/loaders/load_669.c', '<(mikmod_dir)/loaders/load_amf.c', '<(mikmod_dir)/loaders/load_asy.c', '<(mikmod_dir)/loaders/load_dsm.c', '<(mikmod_dir)/loaders/load_far.c', '<(mikmod_dir)/loaders/load_gdm.c', '<(mikmod_dir)/loaders/load_gt2.c', '<(mikmod_dir)/loaders/load_it.c', '<(mikmod_dir)/loaders/load_imf.c', '<(mikmod_dir)/loaders/load_m15.c', '<(mikmod_dir)/loaders/load_med.c', '<(mikmod_dir)/loaders/load_mod.c', '<(mikmod_dir)/loaders/load_mtm.c', '<(mikmod_dir)/loaders/load_okt.c', '<(mikmod_dir)/loaders/load_s3m.c', '<(mikmod_dir)/loaders/load_stm.c', '<(mikmod_dir)/loaders/load_stx.c', '<(mikmod_dir)/loaders/load_ult.c', '<(mikmod_dir)/loaders/load_uni.c', '<(mikmod_dir)/loaders/load_xm.c', '<(mikmod_dir)/mmio/mmalloc.c', '<(mikmod_dir)/mmio/mmerror.c', '<(mikmod_dir)/mmio/mmio.c', '<(mikmod_dir)/playercode/mdriver.c', '<(mikmod_dir)/playercode/mdreg.c', '<(mikmod_dir)/playercode/mdulaw.c', '<(mikmod_dir)/playercode/mloader.c', '<(mikmod_dir)/playercode/mlreg.c', '<(mikmod_dir)/playercode/mlutil.c', '<(mikmod_dir)/playercode/mplayer.c', '<(mikmod_dir)/playercode/munitrk.c', '<(mikmod_dir)/playercode/mwav.c', '<(mikmod_dir)/playercode/npertab.c', '<(mikmod_dir)/playercode/sloader.c', '<(mikmod_dir)/playercode/virtch.c', '<(mikmod_dir)/playercode/virtch2.c', '<(mikmod_dir)/playercode/virtch_common.c'], 'all_dependent_settings': {'include_dirs': ['include', '<(mikmod_dir)/include']}, 'conditions': [["OS != 'win'", {'libraries': ['-lm']}]]}]} |
##
# Copyright (c) 2006-2016 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
def parsetoken(text, delimiters=" \t"):
if not text:
return "", ""
if text[0] == '"':
return parsequoted(text, delimiters)
else:
for pos, c in enumerate(text):
if c in delimiters:
token = text[0:pos]
break
else:
return text, ""
return token, lstripdelimiters(text[pos:], delimiters)
def parsequoted(text, delimiters=" \t"):
assert(text)
assert(text[0] == '"')
pos = 1
while True:
next_pos = text.find('"', pos)
if next_pos == -1:
return text[1:].replace("\\\\", "\\").replace("\\\"", "\""), ""
if text[next_pos - 1] == '\\':
pos = next_pos + 1
else:
return (
text[1:next_pos].replace("\\\\", "\\").replace("\\\"", "\""),
lstripdelimiters(text[next_pos + 1:], delimiters)
)
def lstripdelimiters(text, delimiters):
for pos, c in enumerate(text):
if c not in delimiters:
return text[pos:]
else:
return ""
def parseStatusLine(status):
status = status.strip()
# Must have 'HTTP/1.1' version at start
if status[0:9] != "HTTP/1.1 ":
return 0
# Must have three digits followed by nothing or one space
if not status[9:12].isdigit() or (len(status) > 12 and status[12] != " "):
return 0
# Read in the status code
return int(status[9:12])
| def parsetoken(text, delimiters=' \t'):
if not text:
return ('', '')
if text[0] == '"':
return parsequoted(text, delimiters)
else:
for (pos, c) in enumerate(text):
if c in delimiters:
token = text[0:pos]
break
else:
return (text, '')
return (token, lstripdelimiters(text[pos:], delimiters))
def parsequoted(text, delimiters=' \t'):
assert text
assert text[0] == '"'
pos = 1
while True:
next_pos = text.find('"', pos)
if next_pos == -1:
return (text[1:].replace('\\\\', '\\').replace('\\"', '"'), '')
if text[next_pos - 1] == '\\':
pos = next_pos + 1
else:
return (text[1:next_pos].replace('\\\\', '\\').replace('\\"', '"'), lstripdelimiters(text[next_pos + 1:], delimiters))
def lstripdelimiters(text, delimiters):
for (pos, c) in enumerate(text):
if c not in delimiters:
return text[pos:]
else:
return ''
def parse_status_line(status):
status = status.strip()
if status[0:9] != 'HTTP/1.1 ':
return 0
if not status[9:12].isdigit() or (len(status) > 12 and status[12] != ' '):
return 0
return int(status[9:12]) |
units=int(input("Enter the number of units you used: "))
if(units>=0 and units <= 50):
amount = units * 0.50
elif(units <= 150):
amount = units * 0.75
elif(units <= 250):
amount = units * 1.25
else:
amount = units * 1.50
surcharge = amount * 17/100
ebill = amount + surcharge
print("Electricity Bill = Rs.",ebill)
| units = int(input('Enter the number of units you used: '))
if units >= 0 and units <= 50:
amount = units * 0.5
elif units <= 150:
amount = units * 0.75
elif units <= 250:
amount = units * 1.25
else:
amount = units * 1.5
surcharge = amount * 17 / 100
ebill = amount + surcharge
print('Electricity Bill = Rs.', ebill) |
class matching_matrix_proportion():
def __init__(self, sol, n, * args, **kwargs):
self.rows = {i : {int(j):1} for i, j in enumerate(sol)}
self.n = n
self.k = len(Counter(sol))
self.update_A = {}
self.maximums = np.zeros(self.k)
self.where = np.zeros(self.k)
def merge_rows(self, i_1, i_2, k):
if i_1 >= self.n:
i_1 = self.update_A.pop(i_1)
if i_2 >= self.n:
i_2 = self.update_A.pop(i_2)
if (len(self.rows[i_1]) >= len(self.rows[i_2]) and
i_1 >= self.n and i_2 >= self.n):
i_1 , i_2 = i_2, i_1
self.update_A[k + self.n] = i_2
r1, r2 = self.rows.pop(i_1), self.rows[i_2]
# If the maximum is moving then update it's location
if i_1 in self.where:
self.where[np.where(self.where == i_1)] = i_2
for elem in r1:
if elem not in r2:
r2[elem] = r1[elem]
else:
value_1 = r1[elem]
value_2 = r2[elem]
value_new = value_1 + value_2
r2[elem] = value_new
if value_new > self.maximums[elem]:
self.maximums[elem] = value_new
self.where[elem] = i_2
self.rows[i_2] = r2
def to_dense(self):
m = len(self.rows)
n = self.k
M = np.zeros((m, n))
for i, row in enumerate(self.rows):
for j, col in self.rows[row].items():
M[i, j] = self.rows[row][j]
return(M) | class Matching_Matrix_Proportion:
def __init__(self, sol, n, *args, **kwargs):
self.rows = {i: {int(j): 1} for (i, j) in enumerate(sol)}
self.n = n
self.k = len(counter(sol))
self.update_A = {}
self.maximums = np.zeros(self.k)
self.where = np.zeros(self.k)
def merge_rows(self, i_1, i_2, k):
if i_1 >= self.n:
i_1 = self.update_A.pop(i_1)
if i_2 >= self.n:
i_2 = self.update_A.pop(i_2)
if len(self.rows[i_1]) >= len(self.rows[i_2]) and i_1 >= self.n and (i_2 >= self.n):
(i_1, i_2) = (i_2, i_1)
self.update_A[k + self.n] = i_2
(r1, r2) = (self.rows.pop(i_1), self.rows[i_2])
if i_1 in self.where:
self.where[np.where(self.where == i_1)] = i_2
for elem in r1:
if elem not in r2:
r2[elem] = r1[elem]
else:
value_1 = r1[elem]
value_2 = r2[elem]
value_new = value_1 + value_2
r2[elem] = value_new
if value_new > self.maximums[elem]:
self.maximums[elem] = value_new
self.where[elem] = i_2
self.rows[i_2] = r2
def to_dense(self):
m = len(self.rows)
n = self.k
m = np.zeros((m, n))
for (i, row) in enumerate(self.rows):
for (j, col) in self.rows[row].items():
M[i, j] = self.rows[row][j]
return M |
class Solution:
def findNumbers(self, nums: List[int]) -> int:
ans = 0
if(len(nums) == 0):
return 0
for i in nums:
if(len(str(i))%2 == 0):
ans+=1;
return ans
| class Solution:
def find_numbers(self, nums: List[int]) -> int:
ans = 0
if len(nums) == 0:
return 0
for i in nums:
if len(str(i)) % 2 == 0:
ans += 1
return ans |
class Store:
def __init__(self):
self.store_item = []
def __str__(self):
if self.store_item == []:
return 'No items'
return '\n'.join(map(str,self.store_item))
def add_item(self,item):
self.store_item.append(item)
def count(self):
return len(self.store_item)
def filter(self, q_object):
store_obj = Store()
for items in self.store_item:
field_name = q_object.field
if q_object.operation == 'EQ' and getattr(items,field_name) == q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'GT' and getattr(items,field_name) > q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'GTE' and getattr(items,field_name) >= q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'LT' and getattr(items,field_name) < q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'LTE' and getattr(items,field_name) <= q_object.value:
store_obj.add_item(items)
elif (q_object.operation == 'CONTAINS' or q_object.operation == 'STARTS_WITH' or q_object.operation== 'ENDS_WITH') and q_object.value in getattr(items,field_name):
store_obj.add_item(items)
elif q_object.operation == 'IN' and getattr(items,field_name) in q_object.value:
store_obj.add_item(items)
return store_obj
def exclude(self, q_object):
exclude_obj = Store()
include_obj = self.filter(q_object)
for items in self.store_item:
if items not in include_obj.store_item:
exclude_obj.add_item(items)
return exclude_obj
class Item:
def __init__(self, name=None, price=0, category=None):
self._name = name
self._price = price
self._category = category
#raise error for value
if price <= 0:
raise ValueError('Invalid value for price, got {}'.format(price))
@property
def name(self):
return self._name
@property
def price(self):
return self._price
@property
def category(self):
return self._category
def __str__(self):
return f'{self._name}@{self._price}-{self._category}'
class Query:
valid_op = ['IN','EQ','GT','GTE','LT','LTE','STARTS_WITH','ENDS_WITH','CONTAINS']
def __init__(self, field=None, operation=None, value=None):
self.field = field
self.operation = operation
self.value = value
if operation not in Query.valid_op:
raise ValueError('Invalid value for operation, got {}'.format(operation))
def __str__(self):
return f"{self.field} {self.operation} {self.value}"
| class Store:
def __init__(self):
self.store_item = []
def __str__(self):
if self.store_item == []:
return 'No items'
return '\n'.join(map(str, self.store_item))
def add_item(self, item):
self.store_item.append(item)
def count(self):
return len(self.store_item)
def filter(self, q_object):
store_obj = store()
for items in self.store_item:
field_name = q_object.field
if q_object.operation == 'EQ' and getattr(items, field_name) == q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'GT' and getattr(items, field_name) > q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'GTE' and getattr(items, field_name) >= q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'LT' and getattr(items, field_name) < q_object.value:
store_obj.add_item(items)
elif q_object.operation == 'LTE' and getattr(items, field_name) <= q_object.value:
store_obj.add_item(items)
elif (q_object.operation == 'CONTAINS' or q_object.operation == 'STARTS_WITH' or q_object.operation == 'ENDS_WITH') and q_object.value in getattr(items, field_name):
store_obj.add_item(items)
elif q_object.operation == 'IN' and getattr(items, field_name) in q_object.value:
store_obj.add_item(items)
return store_obj
def exclude(self, q_object):
exclude_obj = store()
include_obj = self.filter(q_object)
for items in self.store_item:
if items not in include_obj.store_item:
exclude_obj.add_item(items)
return exclude_obj
class Item:
def __init__(self, name=None, price=0, category=None):
self._name = name
self._price = price
self._category = category
if price <= 0:
raise value_error('Invalid value for price, got {}'.format(price))
@property
def name(self):
return self._name
@property
def price(self):
return self._price
@property
def category(self):
return self._category
def __str__(self):
return f'{self._name}@{self._price}-{self._category}'
class Query:
valid_op = ['IN', 'EQ', 'GT', 'GTE', 'LT', 'LTE', 'STARTS_WITH', 'ENDS_WITH', 'CONTAINS']
def __init__(self, field=None, operation=None, value=None):
self.field = field
self.operation = operation
self.value = value
if operation not in Query.valid_op:
raise value_error('Invalid value for operation, got {}'.format(operation))
def __str__(self):
return f'{self.field} {self.operation} {self.value}' |
class A:
def __init__(self, *, kw_only, optional_kw_only=None):
pass
class B(A):
def __init__(self, *, kw_only):
super().__init__(kw_only=kw_only) | class A:
def __init__(self, *, kw_only, optional_kw_only=None):
pass
class B(A):
def __init__(self, *, kw_only):
super().__init__(kw_only=kw_only) |
'''
Problem description:
Given an array of unsorted integers, find the smallest positive integer not in the array.
'''
def find_smallest_missing_pos_int_sort(array):
'''
runtime: O(nlogn)
space : O(1) - this depends on the sort but python's list.sort() performs an in-place sort
This sort-based solution is slow but requires no additional space, given the right sorting
algorithm.
'''
array.sort()
n = len(array)
# move to index of first positive integer; if none exist, return 1
index_of_first_pos = 0
for index_of_first_pos in xrange(n):
if array[index_of_first_pos] > 0:
break
current_pos_int = 1
for i in xrange(index_of_first_pos, n):
if array[i] != current_pos_int:
return current_pos_int
current_pos_int += 1
return current_pos_int
def find_smallest_missing_pos_int_set(array):
'''
runtime: O(n)
space : O(n)
This set-based solution is fast and readable but requires linear additional space.
'''
as_set = set(array)
n = len(array)
for x in xrange(1, n + 1):
if x not in as_set:
return x
return n + 1
def find_smallest_missing_pos_int_optimal(array):
'''
runtime: O(n)
space : O(1)
This in-place swap solution runs in linear time and requires constant space. Aside from some
constant-factor performance optimizations, this is the optimal solution.
'''
n = len(array)
def in_bounds(value):
return 1 <= value <= n
# swap integers within 1 to n into their respective cells
# all other values (x < 1, x > n, and repeats) end up in the remaining empty cells
for i in xrange(n):
while in_bounds(array[i]) and array[i] != i + 1 and array[array[i] - 1] != array[i]:
swap_cell = array[i] - 1
array[i], array[swap_cell] = array[swap_cell], array[i]
for i in xrange(n):
if array[i] != i + 1:
return i + 1
return n + 1
| """
Problem description:
Given an array of unsorted integers, find the smallest positive integer not in the array.
"""
def find_smallest_missing_pos_int_sort(array):
"""
runtime: O(nlogn)
space : O(1) - this depends on the sort but python's list.sort() performs an in-place sort
This sort-based solution is slow but requires no additional space, given the right sorting
algorithm.
"""
array.sort()
n = len(array)
index_of_first_pos = 0
for index_of_first_pos in xrange(n):
if array[index_of_first_pos] > 0:
break
current_pos_int = 1
for i in xrange(index_of_first_pos, n):
if array[i] != current_pos_int:
return current_pos_int
current_pos_int += 1
return current_pos_int
def find_smallest_missing_pos_int_set(array):
"""
runtime: O(n)
space : O(n)
This set-based solution is fast and readable but requires linear additional space.
"""
as_set = set(array)
n = len(array)
for x in xrange(1, n + 1):
if x not in as_set:
return x
return n + 1
def find_smallest_missing_pos_int_optimal(array):
"""
runtime: O(n)
space : O(1)
This in-place swap solution runs in linear time and requires constant space. Aside from some
constant-factor performance optimizations, this is the optimal solution.
"""
n = len(array)
def in_bounds(value):
return 1 <= value <= n
for i in xrange(n):
while in_bounds(array[i]) and array[i] != i + 1 and (array[array[i] - 1] != array[i]):
swap_cell = array[i] - 1
(array[i], array[swap_cell]) = (array[swap_cell], array[i])
for i in xrange(n):
if array[i] != i + 1:
return i + 1
return n + 1 |
class Crawler:
def __init__(self, root):
self._root = root
def crawl(self):
pass
def crawl_into(self):
pass
| class Crawler:
def __init__(self, root):
self._root = root
def crawl(self):
pass
def crawl_into(self):
pass |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def buildbuddy_deps():
maybe(
http_archive,
name = "rules_cc",
sha256 = "b6f34b3261ec02f85dbc5a8bdc9414ce548e1f5f67e000d7069571799cb88b25",
strip_prefix = "rules_cc-726dd8157557f1456b3656e26ab21a1646653405",
urls = ["https://github.com/bazelbuild/rules_cc/archive/726dd8157557f1456b3656e26ab21a1646653405.tar.gz"],
)
| load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
def buildbuddy_deps():
maybe(http_archive, name='rules_cc', sha256='b6f34b3261ec02f85dbc5a8bdc9414ce548e1f5f67e000d7069571799cb88b25', strip_prefix='rules_cc-726dd8157557f1456b3656e26ab21a1646653405', urls=['https://github.com/bazelbuild/rules_cc/archive/726dd8157557f1456b3656e26ab21a1646653405.tar.gz']) |
# Copyright (C) 2016 Benoit Myard <myardbenoit@gmail.com>
# Released under the terms of the BSD license.
class BaseRemoteStorage(object):
def __init__(self, config, root):
self.config = config
self.root = root
def __enter__(self):
raise NotImplementedError
def __exit__(self, *args):
pass
def push(self, filename):
raise NotImplementedError
def pull(self, path):
raise NotImplementedError
| class Baseremotestorage(object):
def __init__(self, config, root):
self.config = config
self.root = root
def __enter__(self):
raise NotImplementedError
def __exit__(self, *args):
pass
def push(self, filename):
raise NotImplementedError
def pull(self, path):
raise NotImplementedError |
get_f = float(input("Enter temperature in Fahrenheit: "))
convert_c = (get_f - 32) * 5/9
print(f"{get_f} in Fahrenheit is equal to {convert_c} in Celsius")
| get_f = float(input('Enter temperature in Fahrenheit: '))
convert_c = (get_f - 32) * 5 / 9
print(f'{get_f} in Fahrenheit is equal to {convert_c} in Celsius') |
#!/usr/bin/env python
# coding: utf-8
# # Exercise 1. Regex and Parsing challenges :
# ### writer : Faranak Alikhah 1954128
# ### 14.Regex Substitution :
# In[ ]:
for _ in range(int(input())):
line = input()
while '&&'in line or '||'in line:
line = line.replace("&&", "and").replace("||", "or")
print(line)
#
#
| for _ in range(int(input())):
line = input()
while '&&' in line or '||' in line:
line = line.replace('&&', 'and').replace('||', 'or')
print(line) |
def is_valid_story_or_comment(form_data):
parent = form_data.get('parent')
title = bool(form_data.get('title'))
url = bool(form_data.get('url'))
text = bool(form_data.get('text'))
if parent:
if title or url:
return (False, 'Invalid fields for a comment')
if not text:
return (False, 'Comment field is missing')
else:
if not title:
return (False, 'Missing title field')
if text and url:
return (False, 'Please enter either URL or text, but not both')
return (True, 'success')
| def is_valid_story_or_comment(form_data):
parent = form_data.get('parent')
title = bool(form_data.get('title'))
url = bool(form_data.get('url'))
text = bool(form_data.get('text'))
if parent:
if title or url:
return (False, 'Invalid fields for a comment')
if not text:
return (False, 'Comment field is missing')
else:
if not title:
return (False, 'Missing title field')
if text and url:
return (False, 'Please enter either URL or text, but not both')
return (True, 'success') |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self, values = []):
self.head = None
for value in values:
self.append(value)
def append(self, value):
if self.head is None:
self.head = Node(value)
return
node = self.head
while node.next:
node = node.next
node.next = Node(value)
def search(self, value):
if self.head is None:
return False
node = self.head
while node:
if node.value == value:
return True
node = node.next
return False
def delete(self, value):
if self.head is None:
return
if self.head.value == value:
self.head = self.head.next
return
node = self.head
while node.next:
if node.next.value == value:
node.next = node.next.next
return
node = node.next
def pop(self):
if self.head is None:
return None
node = self.head
self.head = self.head.next
return node.value
def to_list(self):
out = []
node = self.head
while node is not None:
out.append(node.value)
node = node.next
return out
# Test Case
linked_list = LinkedList([5, 7, -1, 0.9, 71])
print("Linked List tests:")
print (" Initialization: " + "Pass" if (linked_list.to_list() == [5, 7, -1, 0.9, 71]) else "Fail")
linked_list.delete(-1)
print (" Delete: " + "Pass" if (linked_list.to_list() == [5, 7, 0.9, 71]) else "Fail")
print (" Search: " + "Pass" if (linked_list.search(0.9)) else "Fail")
print (" Search: " + "Pass" if (not linked_list.search(55)) else "Fail")
linked_list.append(91)
print (" Append: " + "Pass" if (linked_list.to_list() == [5, 7, 0.9, 71, 91]) else "Fail")
print (" Pop: " + "Pass" if (linked_list.pop() == 5) else "Fail")
| class Node:
def __init__(self, value):
self.value = value
self.next = None
class Linkedlist:
def __init__(self, values=[]):
self.head = None
for value in values:
self.append(value)
def append(self, value):
if self.head is None:
self.head = node(value)
return
node = self.head
while node.next:
node = node.next
node.next = node(value)
def search(self, value):
if self.head is None:
return False
node = self.head
while node:
if node.value == value:
return True
node = node.next
return False
def delete(self, value):
if self.head is None:
return
if self.head.value == value:
self.head = self.head.next
return
node = self.head
while node.next:
if node.next.value == value:
node.next = node.next.next
return
node = node.next
def pop(self):
if self.head is None:
return None
node = self.head
self.head = self.head.next
return node.value
def to_list(self):
out = []
node = self.head
while node is not None:
out.append(node.value)
node = node.next
return out
linked_list = linked_list([5, 7, -1, 0.9, 71])
print('Linked List tests:')
print(' Initialization: ' + 'Pass' if linked_list.to_list() == [5, 7, -1, 0.9, 71] else 'Fail')
linked_list.delete(-1)
print(' Delete: ' + 'Pass' if linked_list.to_list() == [5, 7, 0.9, 71] else 'Fail')
print(' Search: ' + 'Pass' if linked_list.search(0.9) else 'Fail')
print(' Search: ' + 'Pass' if not linked_list.search(55) else 'Fail')
linked_list.append(91)
print(' Append: ' + 'Pass' if linked_list.to_list() == [5, 7, 0.9, 71, 91] else 'Fail')
print(' Pop: ' + 'Pass' if linked_list.pop() == 5 else 'Fail') |
loss_fns = ['retrain_regu_mas', 'retrain_regu_mine', 'retrain_regu_minen', 'retrain_regu_fisher', 'retrain_regu_fishern',\
'retrain', 'retrain_regu', 'retrain_regu_selfless']#'retrain_regu_mine3', 'cnn'
model_log_map = {'fishern': 'EWCN', 'mine': 'Arms', 'minen': 'ArmsN', 'regu': 'RetrainRegu', \
'fisher': 'EWC', 'mas': 'MAS', 'selfless': 'Selfless', 'retrain':'Retrain'} | loss_fns = ['retrain_regu_mas', 'retrain_regu_mine', 'retrain_regu_minen', 'retrain_regu_fisher', 'retrain_regu_fishern', 'retrain', 'retrain_regu', 'retrain_regu_selfless']
model_log_map = {'fishern': 'EWCN', 'mine': 'Arms', 'minen': 'ArmsN', 'regu': 'RetrainRegu', 'fisher': 'EWC', 'mas': 'MAS', 'selfless': 'Selfless', 'retrain': 'Retrain'} |
def digit_to_text(digit):
if digit == 1:
return "one"
elif digit == 2:
return "two"
elif digit == 3:
return "three"
elif digit == 4:
return "four"
elif digit == 5:
return "five"
elif digit == 6:
return "six"
elif digit == 7:
return "seven"
elif digit == 8:
return "eight"
elif digit == 9:
return "nine"
else:
return None
def teen_to_text(digit):
if digit == 1:
return "ten"
elif digit == 11:
return "eleven"
elif digit == 12:
return "twelve"
elif digit == 13:
return "thirteen"
elif digit == 14:
return "fourteen"
elif digit == 15:
return "fifteen"
elif digit == 16:
return "sixteen"
elif digit == 17:
return "seventeen"
elif digit == 18:
return "eighteen"
elif digit == 19:
return "nineteen"
else:
return None
def convert_to_text(num):
text = ""
hundreds = num // 100
tens = num // 10
if hundreds:
text += digit_to_text(hundreds) + " hundred"
if tens:
if tens == 1:
if num > 100:
real_ten = real_ten - (hundreds * 100)
else:
real_ten = num
text += teen_to_text(real_ten)
return text
print(convert_to_text(1))
print(convert_to_text(11))
print(convert_to_text(16))
print(convert_to_text(22))
| def digit_to_text(digit):
if digit == 1:
return 'one'
elif digit == 2:
return 'two'
elif digit == 3:
return 'three'
elif digit == 4:
return 'four'
elif digit == 5:
return 'five'
elif digit == 6:
return 'six'
elif digit == 7:
return 'seven'
elif digit == 8:
return 'eight'
elif digit == 9:
return 'nine'
else:
return None
def teen_to_text(digit):
if digit == 1:
return 'ten'
elif digit == 11:
return 'eleven'
elif digit == 12:
return 'twelve'
elif digit == 13:
return 'thirteen'
elif digit == 14:
return 'fourteen'
elif digit == 15:
return 'fifteen'
elif digit == 16:
return 'sixteen'
elif digit == 17:
return 'seventeen'
elif digit == 18:
return 'eighteen'
elif digit == 19:
return 'nineteen'
else:
return None
def convert_to_text(num):
text = ''
hundreds = num // 100
tens = num // 10
if hundreds:
text += digit_to_text(hundreds) + ' hundred'
if tens:
if tens == 1:
if num > 100:
real_ten = real_ten - hundreds * 100
else:
real_ten = num
text += teen_to_text(real_ten)
return text
print(convert_to_text(1))
print(convert_to_text(11))
print(convert_to_text(16))
print(convert_to_text(22)) |
def get_schema():
return {
'type': 'object',
'properties':
{
'aftale_id': {'type': 'string'},
'state': {'type': 'string'},
'gateway_fejlkode': {'type': 'string'}
},
'required': ['aftale_id', 'gateway_fejlkode']
}
| def get_schema():
return {'type': 'object', 'properties': {'aftale_id': {'type': 'string'}, 'state': {'type': 'string'}, 'gateway_fejlkode': {'type': 'string'}}, 'required': ['aftale_id', 'gateway_fejlkode']} |
w = h = 600
s = 40
off = s/4
shift = 3
x = y = 0
newPage(w, h)
strokeWidth(2)
stroke(.5)
while (y * s) < h:
while (x *s) < w:
fill(0) if x % 2 == 0 else fill(1)
rect(off + x * s, y * s, s, s)
x += 1
if y % 3 == 0: off *= -1
off += s/4
x = 0
y += 1
saveImage('imgs/cafe_wall.png') | w = h = 600
s = 40
off = s / 4
shift = 3
x = y = 0
new_page(w, h)
stroke_width(2)
stroke(0.5)
while y * s < h:
while x * s < w:
fill(0) if x % 2 == 0 else fill(1)
rect(off + x * s, y * s, s, s)
x += 1
if y % 3 == 0:
off *= -1
off += s / 4
x = 0
y += 1
save_image('imgs/cafe_wall.png') |
class Solution:
def recoverTree(self, root):
def inorder(node):
if node.left:
yield from inorder(node.left)
yield node
if node.right:
yield from inorder(node.right)
swap1 = swap2 = smaller = None
for node in inorder(root):
if smaller and smaller.val > node.val:
if not swap1:
swap1 = smaller
swap2 = node
smaller = node
if swap1:
swap1.val, swap2.val = swap2.val, swap1.val | class Solution:
def recover_tree(self, root):
def inorder(node):
if node.left:
yield from inorder(node.left)
yield node
if node.right:
yield from inorder(node.right)
swap1 = swap2 = smaller = None
for node in inorder(root):
if smaller and smaller.val > node.val:
if not swap1:
swap1 = smaller
swap2 = node
smaller = node
if swap1:
(swap1.val, swap2.val) = (swap2.val, swap1.val) |
expected_output = {
"dhcp_guard_policy_config":{
"policy_name":"pol1",
"trusted_port":True,
"device_role":"dhcp server",
"max_preference":255,
"min_preference":0,
"access_list":"acl2",
"prefix_list":"abc",
"targets":{
"vlan 2":{
"target":"vlan 2",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 3":{
"target":"vlan 3",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 4":{
"target":"vlan 4",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 5":{
"target":"vlan 5",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 6":{
"target":"vlan 6",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 7":{
"target":"vlan 7",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 8":{
"target":"vlan 8",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 9":{
"target":"vlan 9",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
},
"vlan 10":{
"target":"vlan 10",
"type":"VLAN",
"feature":"DHCP Guard",
"target_range":"vlan all"
}
}
}
} | expected_output = {'dhcp_guard_policy_config': {'policy_name': 'pol1', 'trusted_port': True, 'device_role': 'dhcp server', 'max_preference': 255, 'min_preference': 0, 'access_list': 'acl2', 'prefix_list': 'abc', 'targets': {'vlan 2': {'target': 'vlan 2', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 3': {'target': 'vlan 3', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 4': {'target': 'vlan 4', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 5': {'target': 'vlan 5', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 6': {'target': 'vlan 6', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 7': {'target': 'vlan 7', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 8': {'target': 'vlan 8', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 9': {'target': 'vlan 9', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}, 'vlan 10': {'target': 'vlan 10', 'type': 'VLAN', 'feature': 'DHCP Guard', 'target_range': 'vlan all'}}}} |
class Person:
Y = "You are young."
T = "You are a teenager."
O = "You are old."
age = int(0)
def __init__(self, initialAge):
if initialAge < 0:
print('Age is not valid, setting age to 0.')
else:
self.age = initialAge
def amIOld(self):
if self.age < 13:
print(self.Y)
elif self.age < 18:
print(self.T)
else:
print(self.O)
def yearPasses(self):
self.age += 1
| class Person:
y = 'You are young.'
t = 'You are a teenager.'
o = 'You are old.'
age = int(0)
def __init__(self, initialAge):
if initialAge < 0:
print('Age is not valid, setting age to 0.')
else:
self.age = initialAge
def am_i_old(self):
if self.age < 13:
print(self.Y)
elif self.age < 18:
print(self.T)
else:
print(self.O)
def year_passes(self):
self.age += 1 |
# Improved Position Calculation
# objectposncalc.py (improved)
print("This program calculates an object's final position.")
do_calculation = True
while(do_calculation):
# Get information about the object from the user
while (True):
try:
initial_position = float(input("\nEnter the object's initial position: "))
except ValueError:
print("The value you entered is invalid. Only numerical values are valid.");
else:
break
while (True):
try:
initial_velocity = float(input("Enter the object's initial velocity: "))
except ValueError:
print("The value you entered is invalid. Only numerical values are valid.");
else:
break
while (True):
try:
acceleration = float(input("Enter the object's acceleration: "))
except ValueError:
print("The value you entered is invalid. Only numerical values are valid.");
else:
break
while (True):
try:
time_elapsed = float(input("Enter the time that has elapsed: "))
if (time_elapsed < 0):
print("Negative times are not allowed.")
continue
except ValueError:
print("The value you entered is invalid. Only numerical values are valid.");
else:
break
# Calculate the final position
final_position = initial_position + initial_velocity * time_elapsed + 0.5 * acceleration * time_elapsed ** 2
# Output final position
print("\nThe object's final position is", final_position)
# Check if the user wants to perform another calculation
another_calculation = input("\nDo you want to perform another calculation? (y/n): ")
if (another_calculation != "y"):
do_calculation = False
| print("This program calculates an object's final position.")
do_calculation = True
while do_calculation:
while True:
try:
initial_position = float(input("\nEnter the object's initial position: "))
except ValueError:
print('The value you entered is invalid. Only numerical values are valid.')
else:
break
while True:
try:
initial_velocity = float(input("Enter the object's initial velocity: "))
except ValueError:
print('The value you entered is invalid. Only numerical values are valid.')
else:
break
while True:
try:
acceleration = float(input("Enter the object's acceleration: "))
except ValueError:
print('The value you entered is invalid. Only numerical values are valid.')
else:
break
while True:
try:
time_elapsed = float(input('Enter the time that has elapsed: '))
if time_elapsed < 0:
print('Negative times are not allowed.')
continue
except ValueError:
print('The value you entered is invalid. Only numerical values are valid.')
else:
break
final_position = initial_position + initial_velocity * time_elapsed + 0.5 * acceleration * time_elapsed ** 2
print("\nThe object's final position is", final_position)
another_calculation = input('\nDo you want to perform another calculation? (y/n): ')
if another_calculation != 'y':
do_calculation = False |
CELL_DIM = 46
NEXT_CELL_DISTANCE = 66
NEXT_ROW_DISTANCE_V = 57
NEXT_ROW_DISTANCE_H = 33
INITIAL_V = 44
INITIAL_H = 230
| cell_dim = 46
next_cell_distance = 66
next_row_distance_v = 57
next_row_distance_h = 33
initial_v = 44
initial_h = 230 |
class Node:
def __init__(self, value, adj):
self.value = value
self.adj = adj
self.visited = False
def dfs(graph):
for source in graph:
source.visited = True
dfs_node(source)
def dfs_node(node):
print(node.value)
for e in node.adj:
if not e.visited:
e.visited = True
dfs_node(e) | class Node:
def __init__(self, value, adj):
self.value = value
self.adj = adj
self.visited = False
def dfs(graph):
for source in graph:
source.visited = True
dfs_node(source)
def dfs_node(node):
print(node.value)
for e in node.adj:
if not e.visited:
e.visited = True
dfs_node(e) |
class Cuenta():
def __init__(self, nombre, saldo):
self.nombre=nombre
self.saldo=saldo
def get_ingreso(self):
ingresos=self.saldo + 100
return ingresos
def get_reintegro(self):
reintegro=self.saldo-300
return reintegro
def get_transferencia(self):
dinero_tranferido=300
impuestos=10
transferencia=self.saldo-300-10
return transferencia
| class Cuenta:
def __init__(self, nombre, saldo):
self.nombre = nombre
self.saldo = saldo
def get_ingreso(self):
ingresos = self.saldo + 100
return ingresos
def get_reintegro(self):
reintegro = self.saldo - 300
return reintegro
def get_transferencia(self):
dinero_tranferido = 300
impuestos = 10
transferencia = self.saldo - 300 - 10
return transferencia |
class MessageDispatcher:
def __init__(self):
self._bacteria = []
self.message_uid = 1
def broadcast(self, message):
message.uid = self.message_uid
#print('-- {} Broad casting for agent# {}'.format(message.uid, message.sender.uid))
self.message_uid += 1
for bacterium in self._bacteria:
if bacterium is not message.sender:
bacterium.receive(message)
def register(self, bacterium):
self._bacteria.append(bacterium)
def unregister(self, bacterium):
self._bacteria.remove(bacterium)
class Message:
def __init__(self, sender):#, points, points_info):# position_of, x, y):
self.sender = sender
#self.uid = 0
#self.position_of = position_of
#self.x = x
#self.y = y
#self.points = points
#self.points_info = points_info
| class Messagedispatcher:
def __init__(self):
self._bacteria = []
self.message_uid = 1
def broadcast(self, message):
message.uid = self.message_uid
self.message_uid += 1
for bacterium in self._bacteria:
if bacterium is not message.sender:
bacterium.receive(message)
def register(self, bacterium):
self._bacteria.append(bacterium)
def unregister(self, bacterium):
self._bacteria.remove(bacterium)
class Message:
def __init__(self, sender):
self.sender = sender |
#!/usr/local/bin/python3
class Cpu():
def __init__(self, components):
self.components = [ tuple([int(x) for x in component.strip().split("/")]) for component in components ]
self.validBridges = self.__generateValidBridges(0, self.components)
def __generateValidBridges(self, port, components, bridge=None):
if not bridge:
bridge = []
validBridges = []
matchingComponents = [ x for x in components if (x[0] == port or x[1] == port) ]
if len(matchingComponents) != 0:
for component in matchingComponents:
newbridge = bridge + [tuple(component)]
validBridges.append(newbridge)
if component[0] != port:
newport = component[0]
else:
newport = component[1]
remainingComponents = [ m for m in components if m not in [component] ]
validBridges += self.__generateValidBridges(newport, remainingComponents, newbridge)
return validBridges
def __calcStrength(self, bridge):
return sum([item for sublist in bridge for item in sublist])
def findStrongest(self, bridges):
return max([ self.__calcStrength(bridge) for bridge in bridges ])
def findLongest(self):
longest = [self.validBridges[0]]
for bridge in self.validBridges:
if len(bridge) > len(longest[0]):
longest = [bridge]
elif len(bridge) == len(longest[0]):
longest.append(bridge)
return longest
with open("./input.txt") as f: INPUT = f.readlines()
bridge = Cpu(INPUT)
print("Star 1: %i" % bridge.findStrongest(bridge.validBridges))
print("Star 2: %i" % bridge.findStrongest(bridge.findLongest()))
#print("Star 2: %i" % tubes.steps)
| class Cpu:
def __init__(self, components):
self.components = [tuple([int(x) for x in component.strip().split('/')]) for component in components]
self.validBridges = self.__generateValidBridges(0, self.components)
def __generate_valid_bridges(self, port, components, bridge=None):
if not bridge:
bridge = []
valid_bridges = []
matching_components = [x for x in components if x[0] == port or x[1] == port]
if len(matchingComponents) != 0:
for component in matchingComponents:
newbridge = bridge + [tuple(component)]
validBridges.append(newbridge)
if component[0] != port:
newport = component[0]
else:
newport = component[1]
remaining_components = [m for m in components if m not in [component]]
valid_bridges += self.__generateValidBridges(newport, remainingComponents, newbridge)
return validBridges
def __calc_strength(self, bridge):
return sum([item for sublist in bridge for item in sublist])
def find_strongest(self, bridges):
return max([self.__calcStrength(bridge) for bridge in bridges])
def find_longest(self):
longest = [self.validBridges[0]]
for bridge in self.validBridges:
if len(bridge) > len(longest[0]):
longest = [bridge]
elif len(bridge) == len(longest[0]):
longest.append(bridge)
return longest
with open('./input.txt') as f:
input = f.readlines()
bridge = cpu(INPUT)
print('Star 1: %i' % bridge.findStrongest(bridge.validBridges))
print('Star 2: %i' % bridge.findStrongest(bridge.findLongest())) |
def create_log_file(fname, optimization_method, directions, nodes, step, method_dd, method_ds_db, method_d2s_db2,
method_jacobian, method_hessian, e_dd, e_ds_db, ex_d2s_db2, ey_d2s_db2, e_jacobian,
ex_hessian, ey_hessian):
format1 = "# {:71}: {}\n"
format2 = "# {:71}: {:25}| e : {:10}\n"
format3 = "# {:71}: {:25}| e : {:10}| ey : {:10}\n"
# Clear file
open(fname, 'w').close()
f = open(fname, "a")
f.write(format1.format("Method of Optimization", optimization_method))
f.write(format1.format("Directions of Optimization", directions))
f.write(format1.format("Number of Nodes", nodes))
if optimization_method == "Steepest Decent":
f.write(format1.format("Step", step))
if (optimization_method == "Newton" and method_hessian == "dd-av") or method_jacobian == "direct":
if method_dd == "finite differences":
f.write(format2.format("Method of first derivatives of Velocity and Pressure Calculation", method_dd, str(e_dd)))
else:
f.write(format1.format("Method of first derivatives of Velocity and Pressure Calculation", method_dd))
if method_jacobian != "finite differences" and method_hessian != "finite differences":
if method_ds_db == "finite differences":
f.write(format2.format("Method of first derivatives of Cross-Section Area Calculation", method_ds_db, str(e_ds_db)))
else:
f.write(format1.format("Method of first derivatives of Cross-Section Area Calculation", method_ds_db))
if optimization_method == "Newton" and method_hessian == "dd-av":
if method_d2s_db2 == "finite differences":
f.write(format3.format("Method of second derivatives of Cross-Secion Area Calculation",
method_d2s_db2, str(ex_d2s_db2), str(ey_d2s_db2)))
else:
f.write(format1.format("Method of second derivatives of Cross-Secion Area Calculation", method_d2s_db2))
if method_jacobian == "finite differences":
f.write(format2.format("Method of Jacobian Calculation", method_jacobian, str(e_jacobian)))
else:
f.write(format1.format("Method of Jacobian Calculation", method_jacobian))
if optimization_method == "Newton":
if method_hessian == "finite differences":
f.write(format3.format("Method of Hessian Calculation", method_hessian, str(ex_hessian), str(ey_hessian)))
else:
f.write(format1.format("Method of Hessian Calculation", method_hessian))
f.write("\n")
f.close()
def write_log_file_headers(fname, num_of_cp, directions):
x = ["X" + str(i) for i in range(num_of_cp)]
y = ["Y" + str(i) for i in range(num_of_cp)]
for i in range(num_of_cp - 2):
if directions == 1:
y[i + 1] += " (b" + str(i) + ")"
else:
x[i + 1] += " (b" + str(i) + ")"
y[i + 1] += " (b" + str(i + num_of_cp - 2) + ")"
f = open(fname, "a")
f.write("# {:25}{:25}{:25}{:25}".format("Cycle of Optimization", "Time Units of Cycle", "Total Time Units",
"F Objective") + str(num_of_cp * "{:25}").format(*x) +
str(num_of_cp * "{:25}").format(*y) + "\n\n")
f.close()
def write_optimization_cycle_data(fname, cycle, time_units, total_time_units, f_objective, cp):
f = open(fname, "a")
f.write(" {:25}{:25}{:25}{:25}".format(str(cycle), str(time_units), str(total_time_units), str(f_objective)) +
str(len(cp) * "{:25}").format(*[str(cp[i, 0].real) for i in range(len(cp))]) +
str(len(cp) * "{:25}").format(*[str(cp[i, 1].real) for i in range(len(cp))]) + "\n")
f.close()
| def create_log_file(fname, optimization_method, directions, nodes, step, method_dd, method_ds_db, method_d2s_db2, method_jacobian, method_hessian, e_dd, e_ds_db, ex_d2s_db2, ey_d2s_db2, e_jacobian, ex_hessian, ey_hessian):
format1 = '# {:71}: {}\n'
format2 = '# {:71}: {:25}| e : {:10}\n'
format3 = '# {:71}: {:25}| e : {:10}| ey : {:10}\n'
open(fname, 'w').close()
f = open(fname, 'a')
f.write(format1.format('Method of Optimization', optimization_method))
f.write(format1.format('Directions of Optimization', directions))
f.write(format1.format('Number of Nodes', nodes))
if optimization_method == 'Steepest Decent':
f.write(format1.format('Step', step))
if optimization_method == 'Newton' and method_hessian == 'dd-av' or method_jacobian == 'direct':
if method_dd == 'finite differences':
f.write(format2.format('Method of first derivatives of Velocity and Pressure Calculation', method_dd, str(e_dd)))
else:
f.write(format1.format('Method of first derivatives of Velocity and Pressure Calculation', method_dd))
if method_jacobian != 'finite differences' and method_hessian != 'finite differences':
if method_ds_db == 'finite differences':
f.write(format2.format('Method of first derivatives of Cross-Section Area Calculation', method_ds_db, str(e_ds_db)))
else:
f.write(format1.format('Method of first derivatives of Cross-Section Area Calculation', method_ds_db))
if optimization_method == 'Newton' and method_hessian == 'dd-av':
if method_d2s_db2 == 'finite differences':
f.write(format3.format('Method of second derivatives of Cross-Secion Area Calculation', method_d2s_db2, str(ex_d2s_db2), str(ey_d2s_db2)))
else:
f.write(format1.format('Method of second derivatives of Cross-Secion Area Calculation', method_d2s_db2))
if method_jacobian == 'finite differences':
f.write(format2.format('Method of Jacobian Calculation', method_jacobian, str(e_jacobian)))
else:
f.write(format1.format('Method of Jacobian Calculation', method_jacobian))
if optimization_method == 'Newton':
if method_hessian == 'finite differences':
f.write(format3.format('Method of Hessian Calculation', method_hessian, str(ex_hessian), str(ey_hessian)))
else:
f.write(format1.format('Method of Hessian Calculation', method_hessian))
f.write('\n')
f.close()
def write_log_file_headers(fname, num_of_cp, directions):
x = ['X' + str(i) for i in range(num_of_cp)]
y = ['Y' + str(i) for i in range(num_of_cp)]
for i in range(num_of_cp - 2):
if directions == 1:
y[i + 1] += ' (b' + str(i) + ')'
else:
x[i + 1] += ' (b' + str(i) + ')'
y[i + 1] += ' (b' + str(i + num_of_cp - 2) + ')'
f = open(fname, 'a')
f.write('# {:25}{:25}{:25}{:25}'.format('Cycle of Optimization', 'Time Units of Cycle', 'Total Time Units', 'F Objective') + str(num_of_cp * '{:25}').format(*x) + str(num_of_cp * '{:25}').format(*y) + '\n\n')
f.close()
def write_optimization_cycle_data(fname, cycle, time_units, total_time_units, f_objective, cp):
f = open(fname, 'a')
f.write(' {:25}{:25}{:25}{:25}'.format(str(cycle), str(time_units), str(total_time_units), str(f_objective)) + str(len(cp) * '{:25}').format(*[str(cp[i, 0].real) for i in range(len(cp))]) + str(len(cp) * '{:25}').format(*[str(cp[i, 1].real) for i in range(len(cp))]) + '\n')
f.close() |
class Node:
def __init__(self, element):
self.item = element
self.next_link = None
class QueueLL:
def __init__(self):
self.head = None
def is_empty(self):
if self.head is None:
print("Error! The queue is empty!")
return True
else:
return False
def print_queue(self):
if not QueueLL.is_empty(self):
node = self.head
while node is not None:
print(node.item)
node = node.next_link
def search_item(self, element):
if not QueueLL.is_empty(self):
node = self.head
while node is not None:
if node.item == element:
print("Found")
return True
node = node.next_link
print("Not found")
return False
def enqueue(self, element):
new_node = Node(element)
node = self.head
if node is None:
self.head = new_node
else:
while node.next_link is not None:
node = node.next_link
node.next_link = new_node
def dequeue(self):
node = self.head
if not QueueLL.is_empty(self):
self.head = node.next_link
print(node.item)
return node.item
| class Node:
def __init__(self, element):
self.item = element
self.next_link = None
class Queuell:
def __init__(self):
self.head = None
def is_empty(self):
if self.head is None:
print('Error! The queue is empty!')
return True
else:
return False
def print_queue(self):
if not QueueLL.is_empty(self):
node = self.head
while node is not None:
print(node.item)
node = node.next_link
def search_item(self, element):
if not QueueLL.is_empty(self):
node = self.head
while node is not None:
if node.item == element:
print('Found')
return True
node = node.next_link
print('Not found')
return False
def enqueue(self, element):
new_node = node(element)
node = self.head
if node is None:
self.head = new_node
else:
while node.next_link is not None:
node = node.next_link
node.next_link = new_node
def dequeue(self):
node = self.head
if not QueueLL.is_empty(self):
self.head = node.next_link
print(node.item)
return node.item |
def simulateSeats(seats):
#output seats
new_seats = []
# seat_n
# seat_ne
# seat_e
# seat_se
# seat_s
# seat_sw
# seat_w
# seat_nw
for i, seat_row in enumerate(seats):
for j, seat in enumerate(seats[i]):
print(" i : " + str(i) + " j : "+ str(j) + " seat : " + seat)
return 0
#maybe need helper function to get adjacent?
f = open("day11test.txt","r")
seats = f.read().splitlines()
print(simulateSeats(seats))
#to track when it stops changing, just keep a tab when it changes
| def simulate_seats(seats):
new_seats = []
for (i, seat_row) in enumerate(seats):
for (j, seat) in enumerate(seats[i]):
print(' i : ' + str(i) + ' j : ' + str(j) + ' seat : ' + seat)
return 0
f = open('day11test.txt', 'r')
seats = f.read().splitlines()
print(simulate_seats(seats)) |
# General system information
system_information = {
"SERVICE": "wecken_api",
"ENVIRONMENT": "development",
"BUILD": "dev_build",
}
# Database settings
database = {
"CONNECTION_STRING": "",
"LOCAL_DB_NAME": "mongo-wecken-dev-db"
}
# user settings
user = {
"profile": {
"max_length": 500
}
}
| system_information = {'SERVICE': 'wecken_api', 'ENVIRONMENT': 'development', 'BUILD': 'dev_build'}
database = {'CONNECTION_STRING': '', 'LOCAL_DB_NAME': 'mongo-wecken-dev-db'}
user = {'profile': {'max_length': 500}} |
#string
my_var1="hello students"
myvar1="hello \t students"
print(my_var1)
print(myvar1)
print("class \t hello \t studennts")
#innt
my_var2=20
print("number is",my_var2, "msg ",my_var1)
#float
my_var3=20.123456789123456789
print(my_var3)
#complex
my_var4=23j
print(my_var4)
#list
my_var5=[1,20,"hello","world"]
print(my_var5)
#tuple
my_var6=(1,20,"hello","tuple","world")
print(my_var6)
#dict
my_var7={
"name":"gaurav",
"age":20,
"marks":80.234
}
print(my_var7)
#range
my_var8=range(0,10)
print(my_var8)
#bool
my_var9=True
print(my_var9)
#set
my_var10={"student1","student2",3,3}
print(my_var10)
#to know about ddata type use type(<variable>)
| my_var1 = 'hello students'
myvar1 = 'hello \t students'
print(my_var1)
print(myvar1)
print('class \t hello \t studennts')
my_var2 = 20
print('number is', my_var2, 'msg ', my_var1)
my_var3 = 20.123456789123455
print(my_var3)
my_var4 = 23j
print(my_var4)
my_var5 = [1, 20, 'hello', 'world']
print(my_var5)
my_var6 = (1, 20, 'hello', 'tuple', 'world')
print(my_var6)
my_var7 = {'name': 'gaurav', 'age': 20, 'marks': 80.234}
print(my_var7)
my_var8 = range(0, 10)
print(my_var8)
my_var9 = True
print(my_var9)
my_var10 = {'student1', 'student2', 3, 3}
print(my_var10) |
#
# PySNMP MIB module CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:26:51 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")
ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion")
snmpAgentInfo_Utilities_ces, = mibBuilder.importSymbols("CONTIVITY-INFO-V1-MIB", "snmpAgentInfo-Utilities-ces")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Bits, MibIdentifier, TimeTicks, Integer32, Gauge32, ModuleIdentity, Unsigned32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Counter64, IpAddress, ObjectIdentity, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "MibIdentifier", "TimeTicks", "Integer32", "Gauge32", "ModuleIdentity", "Unsigned32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Counter64", "IpAddress", "ObjectIdentity", "iso")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
snmpAgentInfo_Utilities_TrapAck_ces = ModuleIdentity((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2)).setLabel("snmpAgentInfo-Utilities-TrapAck-ces")
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_TrapAck_ces.setLastUpdated('0604062230Z')
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_TrapAck_ces.setOrganization('Nortel')
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_TrapAck_ces.setContactInfo('support@nortel.com Postal: Nortel 600 Technology Park Drive Billerica, MA 01821 Tel: +1 978 670 8888 E-Mail: support@nortel.com')
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_TrapAck_ces.setDescription('Contivity Trap Acknowledgment MIB')
trapAck_RevInfo_ces = MibIdentifier((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1)).setLabel("trapAck-RevInfo-ces")
trapAck_RevDate_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1, 1), DisplayString()).setLabel("trapAck-RevDate-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: trapAck_RevDate_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapAck_RevDate_ces.setDescription('This value should match the LAST-UPDATED value in the MIB if this section of the mib was modified.')
trapAck_Rev_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1, 2), Integer32()).setLabel("trapAck-Rev-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: trapAck_Rev_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapAck_Rev_ces.setDescription('This is an integer that is increment for each change in the implementation of the MIB since the LAST-UPDATED date/time.')
trapAck_ServerRev_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1, 3), DisplayString()).setLabel("trapAck-ServerRev-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: trapAck_ServerRev_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapAck_ServerRev_ces.setDescription('This is the lowest major and minor version numbers for the server image that this mib implementation is compatible with. Usage: if a customer develops an application that utilizes this mib in server version V4_00. By checking this value they can tell how far back this implementation is available. ')
trapSeverity_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 2), Integer32()).setLabel("trapSeverity-ces")
if mibBuilder.loadTexts: trapSeverity_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapSeverity_ces.setDescription('')
trapDescription_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 3), Integer32()).setLabel("trapDescription-ces")
if mibBuilder.loadTexts: trapDescription_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapDescription_ces.setDescription('')
trapSysUpTime_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 4), Integer32()).setLabel("trapSysUpTime-ces")
if mibBuilder.loadTexts: trapSysUpTime_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapSysUpTime_ces.setDescription('')
trapOID_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 5), ObjectIdentifier()).setLabel("trapOID-ces")
if mibBuilder.loadTexts: trapOID_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapOID_ces.setDescription('')
trapAckTable_ces = MibTable((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 6), ).setLabel("trapAckTable-ces")
if mibBuilder.loadTexts: trapAckTable_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapAckTable_ces.setDescription('')
trapAckEntry_ces = MibTableRow((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 6, 1), ).setLabel("trapAckEntry-ces").setIndexNames((0, "CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB", "trapSeverity-ces"), (0, "CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB", "trapDescription-ces"), (0, "CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB", "trapSysUpTime-ces"), (0, "CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB", "trapOID-ces"))
if mibBuilder.loadTexts: trapAckEntry_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapAckEntry_ces.setDescription('')
trapAcknowledgement_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 6, 1, 1), Integer32()).setLabel("trapAcknowledgement-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: trapAcknowledgement_ces.setStatus('mandatory')
if mibBuilder.loadTexts: trapAcknowledgement_ces.setDescription('Possible Values: -1 the trap could not be acknowledged. -2 the trap OID was not found. 1 the trap acknowledgement was successful.')
mibBuilder.exportSymbols("CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB", trapOID_ces=trapOID_ces, trapAckTable_ces=trapAckTable_ces, trapAckEntry_ces=trapAckEntry_ces, trapAck_RevDate_ces=trapAck_RevDate_ces, PYSNMP_MODULE_ID=snmpAgentInfo_Utilities_TrapAck_ces, trapDescription_ces=trapDescription_ces, trapAck_RevInfo_ces=trapAck_RevInfo_ces, snmpAgentInfo_Utilities_TrapAck_ces=snmpAgentInfo_Utilities_TrapAck_ces, trapAck_Rev_ces=trapAck_Rev_ces, trapAck_ServerRev_ces=trapAck_ServerRev_ces, trapSeverity_ces=trapSeverity_ces, trapSysUpTime_ces=trapSysUpTime_ces, trapAcknowledgement_ces=trapAcknowledgement_ces)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsUnion')
(snmp_agent_info__utilities_ces,) = mibBuilder.importSymbols('CONTIVITY-INFO-V1-MIB', 'snmpAgentInfo-Utilities-ces')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(bits, mib_identifier, time_ticks, integer32, gauge32, module_identity, unsigned32, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, counter64, ip_address, object_identity, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'MibIdentifier', 'TimeTicks', 'Integer32', 'Gauge32', 'ModuleIdentity', 'Unsigned32', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'Counter64', 'IpAddress', 'ObjectIdentity', 'iso')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
snmp_agent_info__utilities__trap_ack_ces = module_identity((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2)).setLabel('snmpAgentInfo-Utilities-TrapAck-ces')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_TrapAck_ces.setLastUpdated('0604062230Z')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_TrapAck_ces.setOrganization('Nortel')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_TrapAck_ces.setContactInfo('support@nortel.com Postal: Nortel 600 Technology Park Drive Billerica, MA 01821 Tel: +1 978 670 8888 E-Mail: support@nortel.com')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_TrapAck_ces.setDescription('Contivity Trap Acknowledgment MIB')
trap_ack__rev_info_ces = mib_identifier((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1)).setLabel('trapAck-RevInfo-ces')
trap_ack__rev_date_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1, 1), display_string()).setLabel('trapAck-RevDate-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
trapAck_RevDate_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapAck_RevDate_ces.setDescription('This value should match the LAST-UPDATED value in the MIB if this section of the mib was modified.')
trap_ack__rev_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1, 2), integer32()).setLabel('trapAck-Rev-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
trapAck_Rev_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapAck_Rev_ces.setDescription('This is an integer that is increment for each change in the implementation of the MIB since the LAST-UPDATED date/time.')
trap_ack__server_rev_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 1, 3), display_string()).setLabel('trapAck-ServerRev-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
trapAck_ServerRev_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapAck_ServerRev_ces.setDescription('This is the lowest major and minor version numbers for the server image that this mib implementation is compatible with. Usage: if a customer develops an application that utilizes this mib in server version V4_00. By checking this value they can tell how far back this implementation is available. ')
trap_severity_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 2), integer32()).setLabel('trapSeverity-ces')
if mibBuilder.loadTexts:
trapSeverity_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapSeverity_ces.setDescription('')
trap_description_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 3), integer32()).setLabel('trapDescription-ces')
if mibBuilder.loadTexts:
trapDescription_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapDescription_ces.setDescription('')
trap_sys_up_time_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 4), integer32()).setLabel('trapSysUpTime-ces')
if mibBuilder.loadTexts:
trapSysUpTime_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapSysUpTime_ces.setDescription('')
trap_oid_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 5), object_identifier()).setLabel('trapOID-ces')
if mibBuilder.loadTexts:
trapOID_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapOID_ces.setDescription('')
trap_ack_table_ces = mib_table((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 6)).setLabel('trapAckTable-ces')
if mibBuilder.loadTexts:
trapAckTable_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapAckTable_ces.setDescription('')
trap_ack_entry_ces = mib_table_row((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 6, 1)).setLabel('trapAckEntry-ces').setIndexNames((0, 'CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB', 'trapSeverity-ces'), (0, 'CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB', 'trapDescription-ces'), (0, 'CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB', 'trapSysUpTime-ces'), (0, 'CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB', 'trapOID-ces'))
if mibBuilder.loadTexts:
trapAckEntry_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapAckEntry_ces.setDescription('')
trap_acknowledgement_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 2, 6, 1, 1), integer32()).setLabel('trapAcknowledgement-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
trapAcknowledgement_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
trapAcknowledgement_ces.setDescription('Possible Values: -1 the trap could not be acknowledged. -2 the trap OID was not found. 1 the trap acknowledgement was successful.')
mibBuilder.exportSymbols('CONTIVITY-TRAP-ACKNOWLEDGMENT-MIB', trapOID_ces=trapOID_ces, trapAckTable_ces=trapAckTable_ces, trapAckEntry_ces=trapAckEntry_ces, trapAck_RevDate_ces=trapAck_RevDate_ces, PYSNMP_MODULE_ID=snmpAgentInfo_Utilities_TrapAck_ces, trapDescription_ces=trapDescription_ces, trapAck_RevInfo_ces=trapAck_RevInfo_ces, snmpAgentInfo_Utilities_TrapAck_ces=snmpAgentInfo_Utilities_TrapAck_ces, trapAck_Rev_ces=trapAck_Rev_ces, trapAck_ServerRev_ces=trapAck_ServerRev_ces, trapSeverity_ces=trapSeverity_ces, trapSysUpTime_ces=trapSysUpTime_ces, trapAcknowledgement_ces=trapAcknowledgement_ces) |
filename = "classes.csv"
filout = "classescleaned.csv"
with open(filename) as filein:
with open(filout,"w") as fileo:
for line in filein.readlines():
lineSplit = line.split(",")
# if len(lineSplit)>1:
# print(lineSplit[2])
# try:
# int(lineSplit[2][1:-1])
# if len(lineSplit)==16:
# fileo.write(line)
# except:
# print("nice")
while len(lineSplit)!=15:
lineSplit[1] = lineSplit[0]+lineSplit[1]
lineSplit = lineSplit[1:]
fileo.write(",".join(lineSplit)) | filename = 'classes.csv'
filout = 'classescleaned.csv'
with open(filename) as filein:
with open(filout, 'w') as fileo:
for line in filein.readlines():
line_split = line.split(',')
while len(lineSplit) != 15:
lineSplit[1] = lineSplit[0] + lineSplit[1]
line_split = lineSplit[1:]
fileo.write(','.join(lineSplit)) |
# def multiply(a, b):
# if b == 0:
# return 0
# if b == 1:
# return a
# return a + multiply(a, b - 1)
def multiply(a, b):
if a < 0 and b < 0:
return multiply(-a, -b)
elif a < 0 or b < 0:
return -multiply(abs(a), abs(b))
elif b == 0:
return 0
elif b == 1:
return a
else:
return a + multiply(a, b - 1)
print(multiply(-5, 6)) | def multiply(a, b):
if a < 0 and b < 0:
return multiply(-a, -b)
elif a < 0 or b < 0:
return -multiply(abs(a), abs(b))
elif b == 0:
return 0
elif b == 1:
return a
else:
return a + multiply(a, b - 1)
print(multiply(-5, 6)) |
def checkDigestionWithTwoEnzymes(splitdic, probebindingsites, keyfeatures):
keylist2 = []; newSplitDic = {}; keylistTwoEnzymes = []; keydict = {}; banddic = {}
for key in splitdic:
keylist2.append(key)
for i in range(len(keylist2)):
for j in range(i+1, len(keylist2)):
bandsTwoEnzymes = splitdic[keylist2[i]]+splitdic[keylist2[j]]
keylistTwoEnzymes.append(keylist2[i]+"+"+keylist2[j])
bandsTwoEnzymes.sort()
newSplitDic.update({keylist2[i]+"+"+keylist2[j]: bandsTwoEnzymes})
for k in range(len(keylistTwoEnzymes)):
surroundingBands = []
for m in range(len(keyfeatures)):
smallerBands = []; biggerBands = []
twoEnzymes = newSplitDic[keylistTwoEnzymes[k]]
for v in range(len(twoEnzymes)):
if int(twoEnzymes[v]) < int(probebindingsites[keyfeatures[m]][0]):
smallerBands.append(twoEnzymes[v])
if int(twoEnzymes[v]) > int(probebindingsites[keyfeatures[m]][1]):
biggerBands.append(twoEnzymes[v])
if smallerBands and biggerBands:
surroundingBands.append([smallerBands[-1], biggerBands[0]])
else:
surroundingBands.append([])
banddic.update({keylistTwoEnzymes[k]: surroundingBands})
for n in range(len(keylistTwoEnzymes)):
keylist3 = []
for q in range(len(keyfeatures)):
bandsTwoEnzymes = banddic[keylistTwoEnzymes[n]]
if bandsTwoEnzymes and bandsTwoEnzymes[q] and bandsTwoEnzymes[q][1] - bandsTwoEnzymes[q][0] not in keylist3:
keylist3.append(bandsTwoEnzymes[q][1] - bandsTwoEnzymes[q][0])
keylist3.sort(reverse=True)
keydict.update({keylistTwoEnzymes[n]: keylist3})
return keylistTwoEnzymes, keydict, newSplitDic
| def check_digestion_with_two_enzymes(splitdic, probebindingsites, keyfeatures):
keylist2 = []
new_split_dic = {}
keylist_two_enzymes = []
keydict = {}
banddic = {}
for key in splitdic:
keylist2.append(key)
for i in range(len(keylist2)):
for j in range(i + 1, len(keylist2)):
bands_two_enzymes = splitdic[keylist2[i]] + splitdic[keylist2[j]]
keylistTwoEnzymes.append(keylist2[i] + '+' + keylist2[j])
bandsTwoEnzymes.sort()
newSplitDic.update({keylist2[i] + '+' + keylist2[j]: bandsTwoEnzymes})
for k in range(len(keylistTwoEnzymes)):
surrounding_bands = []
for m in range(len(keyfeatures)):
smaller_bands = []
bigger_bands = []
two_enzymes = newSplitDic[keylistTwoEnzymes[k]]
for v in range(len(twoEnzymes)):
if int(twoEnzymes[v]) < int(probebindingsites[keyfeatures[m]][0]):
smallerBands.append(twoEnzymes[v])
if int(twoEnzymes[v]) > int(probebindingsites[keyfeatures[m]][1]):
biggerBands.append(twoEnzymes[v])
if smallerBands and biggerBands:
surroundingBands.append([smallerBands[-1], biggerBands[0]])
else:
surroundingBands.append([])
banddic.update({keylistTwoEnzymes[k]: surroundingBands})
for n in range(len(keylistTwoEnzymes)):
keylist3 = []
for q in range(len(keyfeatures)):
bands_two_enzymes = banddic[keylistTwoEnzymes[n]]
if bandsTwoEnzymes and bandsTwoEnzymes[q] and (bandsTwoEnzymes[q][1] - bandsTwoEnzymes[q][0] not in keylist3):
keylist3.append(bandsTwoEnzymes[q][1] - bandsTwoEnzymes[q][0])
keylist3.sort(reverse=True)
keydict.update({keylistTwoEnzymes[n]: keylist3})
return (keylistTwoEnzymes, keydict, newSplitDic) |
@bot.command(name='roll')
async def roll(ctx, roll_type="action", number=1, placeholder="d", sides=20, modifier=0):
# broken
if number <= 0 or number > 10:
await ctx.send("Please enter a number of dice between 1 and 10.")
return
if sides < 1:
await ctx.send("Please enter a valid number of dice sides.")
return
response = ""
if sides != 20:
for i in range(0, number):
response += f"Your roll: {random.randint(1, sides)}\n\n"
else:
for i in range(0, number):
mod_int = int(modifier)
raw_roll = random.randint(1,sides)
modified_roll = raw_roll
if raw_roll != 1 and raw_roll != 20:
modified_roll += mod_int
if modified_roll > 20:
modified_roll = 20
if modified_roll < 1:
modified_roll = 1
response += f"Your roll: {raw_roll}\n Modified roll: {raw_roll} + {mod_int} = {modified_roll}\n"
else:
response += f"Your roll: Natural {raw_roll}\n"
if roll_type.lower() == "action":
response += outcome_tables.action_outcomes(modified_roll)+"\n\n"
elif roll_type.lower() == "combat":
response += outcome_tables.combat_outcomes(modified_roll)+"\n\n"
elif roll_type.lower() == "item":
response += outcome_tables.item_outcomes(modified_roll)+"\n\n"
else:
response += ("Invalid roll type" + raw_roll) + modified_roll
await ctx.send(response)
# This works but it is missing all the new commands
@bot.command(name='commands')
async def commands(ctx):
#deprecated
inforandt = "```$randtrait``` to get a random trait from our list,\n"
infofind = "```$find \"Name of trait in quotes\" ``` to find a trait in the list and have me define it, \n"
infoins = "```$insert \"Name of trait in quotes\" \"Definition of trait in quotes\"``` to insert a new trait and definition in our traits file,"
infodel = "```$delete \"Name of trait in quotes\" ``` to delete a trait if it is in our traits file,\n"
infogimme = "```$gimme``` to get the file of traits in chat, \n"
infochar = "``` $charactertraits``` to get a list of traits to choose from and one which you are stuck with,\n"
inforoll = "``` $roll [type \"action\"\"combat\"\"item\"] [number of dice to roll] [\"d\"][sides of dice] [modifier]``` to roll for an outcome of the three types, and how many dice you want to roll. Defaults to action roll of 1d20 with modifier 0."
message = f'Type {inforandt}{infofind}{infoins}{infodel}{infogimme}{infochar}{inforoll}'
await ctx.send(message)
| @bot.command(name='roll')
async def roll(ctx, roll_type='action', number=1, placeholder='d', sides=20, modifier=0):
if number <= 0 or number > 10:
await ctx.send('Please enter a number of dice between 1 and 10.')
return
if sides < 1:
await ctx.send('Please enter a valid number of dice sides.')
return
response = ''
if sides != 20:
for i in range(0, number):
response += f'Your roll: {random.randint(1, sides)}\n\n'
else:
for i in range(0, number):
mod_int = int(modifier)
raw_roll = random.randint(1, sides)
modified_roll = raw_roll
if raw_roll != 1 and raw_roll != 20:
modified_roll += mod_int
if modified_roll > 20:
modified_roll = 20
if modified_roll < 1:
modified_roll = 1
response += f'Your roll: {raw_roll}\n Modified roll: {raw_roll} + {mod_int} = {modified_roll}\n'
else:
response += f'Your roll: Natural {raw_roll}\n'
if roll_type.lower() == 'action':
response += outcome_tables.action_outcomes(modified_roll) + '\n\n'
elif roll_type.lower() == 'combat':
response += outcome_tables.combat_outcomes(modified_roll) + '\n\n'
elif roll_type.lower() == 'item':
response += outcome_tables.item_outcomes(modified_roll) + '\n\n'
else:
response += 'Invalid roll type' + raw_roll + modified_roll
await ctx.send(response)
@bot.command(name='commands')
async def commands(ctx):
inforandt = '```$randtrait``` to get a random trait from our list,\n'
infofind = '```$find "Name of trait in quotes" ``` to find a trait in the list and have me define it, \n'
infoins = '```$insert "Name of trait in quotes" "Definition of trait in quotes"``` to insert a new trait and definition in our traits file,'
infodel = '```$delete "Name of trait in quotes" ``` to delete a trait if it is in our traits file,\n'
infogimme = '```$gimme``` to get the file of traits in chat, \n'
infochar = '``` $charactertraits``` to get a list of traits to choose from and one which you are stuck with,\n'
inforoll = '``` $roll [type "action""combat""item"] [number of dice to roll] ["d"][sides of dice] [modifier]``` to roll for an outcome of the three types, and how many dice you want to roll. Defaults to action roll of 1d20 with modifier 0.'
message = f'Type {inforandt}{infofind}{infoins}{infodel}{infogimme}{infochar}{inforoll}'
await ctx.send(message) |
# ---------------------------- defining functions ---------------------------- #
def f(x, z):
return z
def s(x, z):
return -alpha * x
# ---------------------- system parameters and constants --------------------- #
g = 9.8 # gravitational acceleration | m/s^2
mu = 0.6 # kinetic friction coefficient
m = 0.5 # mass of the rod | kg
l = 1.5 # length between centres of the disks | m
alpha = 2 * g * mu / l
# --------------------------- ODE solvers variable --------------------------- #
h = 0.005 # increment
tEnd = 20 # end of simulation | s
numberOfSteps = int(tEnd / h) # number of steps
xInitial = 0.1 # initial height of water relative to base | m | added a small change relative to the centre
zInitial = 0 # initial velocity through the hole | m/s | def f(x, z):
return z
def s(x, z):
return -alpha * x
g = 9.8
mu = 0.6
m = 0.5
l = 1.5
alpha = 2 * g * mu / l
h = 0.005
t_end = 20
number_of_steps = int(tEnd / h)
x_initial = 0.1
z_initial = 0 |
def max_number(n):
sorting ="".join(sorted(str(n), reverse = True))
s =int(sorting)
return s
def max_number2(n):
return int(''.join(sorted(str(n), reverse=True)))
| def max_number(n):
sorting = ''.join(sorted(str(n), reverse=True))
s = int(sorting)
return s
def max_number2(n):
return int(''.join(sorted(str(n), reverse=True))) |
for i in range(1,101):
print(i,"(",end="")
if i % 2 == 0:
print(2,",",end="")
if i % 3 == 0:
print(3,",",end="")
if i % 5 == 0:
print(5,",",end="")
print(")")
| for i in range(1, 101):
print(i, '(', end='')
if i % 2 == 0:
print(2, ',', end='')
if i % 3 == 0:
print(3, ',', end='')
if i % 5 == 0:
print(5, ',', end='')
print(')') |
class ProcessingNode:
def execute(self, processor, img):
raise NotImplementedError()
def dependencies(self, processor):
return []
| class Processingnode:
def execute(self, processor, img):
raise not_implemented_error()
def dependencies(self, processor):
return [] |
#
# PySNMP MIB module SIP-UA-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/SIP-UA-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:28:20 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)
#
( OctetString, ObjectIdentifier, Integer, ) = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection")
( applIndex, ) = mibBuilder.importSymbols("NETWORK-SERVICES-MIB", "applIndex")
( sipMIB, ) = mibBuilder.importSymbols("SIP-MIB-SMI", "sipMIB")
( ModuleCompliance, NotificationGroup, ObjectGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
( MibIdentifier, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ObjectIdentity, Counter64, iso, ModuleIdentity, NotificationType, Gauge32, IpAddress, TimeTicks, Unsigned32, Counter32, ) = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ObjectIdentity", "Counter64", "iso", "ModuleIdentity", "NotificationType", "Gauge32", "IpAddress", "TimeTicks", "Unsigned32", "Counter32")
( DisplayString, TextualConvention, ) = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
sipUAMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 9998, 3))
if mibBuilder.loadTexts: sipUAMIB.setLastUpdated('200007080000Z')
if mibBuilder.loadTexts: sipUAMIB.setOrganization('IETF SIP Working Group, SIP MIB Team')
if mibBuilder.loadTexts: sipUAMIB.setContactInfo('SIP MIB Team email: sip-mib@egroups.com \n\n Co-editor Kevin Lingle \n Cisco Systems, Inc. \n postal: 7025 Kit Creek Road \n P.O. Box 14987 \n Research Triangle Park, NC 27709 \n USA \n email: klingle@cisco.com \n phone: +1-919-392-2029 \n\n Co-editor Joon Maeng \n VTEL Corporation \n postal: 108 Wild Basin Rd. \n Austin, TX 78746 \n USA \n email: joon_maeng@vtel.com \n phone: +1-512-437-4567 \n\n Co-editor Dave Walker \n SS8 Networks, Inc. \n postal: 80 Hines Road \n Kanata, ON K2K 2T8 \n Canada \n email: drwalker@ss8networks.com \n phone: +1 613 592 2100')
if mibBuilder.loadTexts: sipUAMIB.setDescription('Initial version of Session Initiation Protocol (SIP) \n User Agent (UA) MIB module. \n\n SIP is an application-layer signalling protocol for \n creating, modifying and terminating multimedia \n sessions with one or more participants. These sessions \n include Internet multimedia conferences and Internet \n telephone calls. SIP is defined in RFC 2543 (March \n 1999). \n\n A User Agent is an application that contains both a \n User Agent Client (UAC) and a User Agent Server (UAS). \n A UAC is an application that initiates a SIP request. \n A UAS is an application that contacts the user when a \n SIP request is received and that returns a response on \n behalf of the user. The response accepts, rejects, or \n redirects the request.')
sipUACfg = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 1))
sipUACfgTimer = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1))
sipUACfgRetry = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2))
sipUAStats = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 2))
sipUAStatsRetry = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1))
sipUACfgTimerTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1), )
if mibBuilder.loadTexts: sipUACfgTimerTable.setDescription('This table contains timer configuration objects applicable \n to each SIP user agent in this system. The instances of \n SIP entities are uniquely identified by applIndex.')
sipUACfgTimerEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipUACfgTimerEntry.setDescription('A row of timer configuration.')
sipUACfgTimerTrying = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100,1000))).setUnits('milliseconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgTimerTrying.setDescription('This object specifies the time a user agent will wait to \n receive a provisional response to an INVITE before \n resending the INVITE.')
sipUACfgTimerProv = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60000,300000))).setUnits('milliseconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgTimerProv.setDescription('This object specifies the time a user agent will wait to \n receive a final response to an INVITE before canceling the \n transaction.')
sipUACfgTimerAck = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100,1000))).setUnits('milliseconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgTimerAck.setDescription('This object specifies the time a user agent will wait to \n receive an ACK confirmation indicating that a session is \n established.')
sipUACfgTimerDisconnect = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100,1000))).setUnits('milliseconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgTimerDisconnect.setDescription('This object specifies the time a user agent will wait to \n receive a BYE confirmation indicating that a session is \n disconnected.')
sipUACfgTimerReRegister = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,2147483647))).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgTimerReRegister.setDescription('This object specifies how long the user agent wishes its \n registrations to be valid.')
sipUACfgRetryTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1), )
if mibBuilder.loadTexts: sipUACfgRetryTable.setDescription('This table contains retry configuration objects applicable \n to each SIP user agent in this system. The instances of \n SIP entities are uniquely identified by applIndex.')
sipUACfgRetryEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipUACfgRetryEntry.setDescription('A row of retry configuration.')
sipUACfgRetryInvite = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgRetryInvite.setDescription('This object will specify the number of times a user agent \n will retry sending an INVITE request.')
sipUACfgRetryBye = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgRetryBye.setDescription('This object will specify the number of times a user agent \n will retry sending a BYE request.')
sipUACfgRetryCancel = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgRetryCancel.setDescription('This object will specify the number of times a user agent \n will retry sending a CANCEL request.')
sipUACfgRetryRegister = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgRetryRegister.setDescription('This object will specify the number of times a user agent \n will retry sending a REGISTER request.')
sipUACfgRetryResponse = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1,10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sipUACfgRetryResponse.setDescription('This object will specify the number of times a user agent \n will retry sending a Response and expecting an ACK.')
sipUAStatsRetryTable = MibTable((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1), )
if mibBuilder.loadTexts: sipUAStatsRetryTable.setDescription('This table contains retry statistics objects applicable \n to each SIP user agent in this system. The instances of \n SIP entities are uniquely identified by applIndex.')
sipUAStatsRetryEntry = MibTableRow((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1), ).setIndexNames((0, "NETWORK-SERVICES-MIB", "applIndex"))
if mibBuilder.loadTexts: sipUAStatsRetryEntry.setDescription('A row of retry statistics.')
sipStatsRetryInvites = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipStatsRetryInvites.setDescription("This object reflects the total number of INVITE retries \n that have been sent by the user agent. If the number of \n 'first attempt' INVITES is of interest, subtract the value \n of this object from sipStatsTrafficInviteOut.")
sipStatsRetryByes = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipStatsRetryByes.setDescription('This object reflects the total number of BYE retries that \n have been sent by the user agent.')
sipStatsRetryCancels = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipStatsRetryCancels.setDescription('This object reflects the total number of CANCEL retries \n that have been sent by the user agent.')
sipStatsRetryRegisters = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipStatsRetryRegisters.setDescription('This object reflects the total number of REGISTER retries \n that have been sent by the user agent.')
sipStatsRetryResponses = MibTableColumn((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sipStatsRetryResponses.setDescription('This object reflects the total number of Response (while \n expecting an ACK) retries that have been sent by the user \n agent.')
sipUAMIBNotif = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 3))
sipUAMIBConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 4))
sipUAMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 4, 1))
sipUAMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 9998, 3, 4, 2))
sipUACompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 9998, 3, 4, 1, 1)).setObjects(*(("SIP-UA-MIB", "sipUAConfigGroup"), ("SIP-UA-MIB", "sipUAStatsGroup"),))
if mibBuilder.loadTexts: sipUACompliance.setDescription('The compliance statement for SIP entities.')
sipUAConfigGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 9998, 3, 4, 2, 1)).setObjects(*(("SIP-UA-MIB", "sipUACfgTimerTrying"), ("SIP-UA-MIB", "sipUACfgTimerProv"), ("SIP-UA-MIB", "sipUACfgTimerAck"), ("SIP-UA-MIB", "sipUACfgTimerDisconnect"), ("SIP-UA-MIB", "sipUACfgTimerReRegister"), ("SIP-UA-MIB", "sipUACfgRetryInvite"), ("SIP-UA-MIB", "sipUACfgRetryBye"), ("SIP-UA-MIB", "sipUACfgRetryCancel"), ("SIP-UA-MIB", "sipUACfgRetryRegister"), ("SIP-UA-MIB", "sipUACfgRetryResponse"),))
if mibBuilder.loadTexts: sipUAConfigGroup.setDescription('A collection of objects providing configuration for \n SIP User Agents.')
sipUAStatsGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 9998, 3, 4, 2, 2)).setObjects(*(("SIP-UA-MIB", "sipStatsRetryInvites"), ("SIP-UA-MIB", "sipStatsRetryByes"), ("SIP-UA-MIB", "sipStatsRetryCancels"), ("SIP-UA-MIB", "sipStatsRetryRegisters"), ("SIP-UA-MIB", "sipStatsRetryResponses"),))
if mibBuilder.loadTexts: sipUAStatsGroup.setDescription('A collection of objects providing statistics for \n SIP User Agents.')
mibBuilder.exportSymbols("SIP-UA-MIB", PYSNMP_MODULE_ID=sipUAMIB, sipStatsRetryInvites=sipStatsRetryInvites, sipUACfgTimerTrying=sipUACfgTimerTrying, sipUACfgTimerAck=sipUACfgTimerAck, sipUAMIBNotif=sipUAMIBNotif, sipUACfgRetryEntry=sipUACfgRetryEntry, sipUACfgRetryCancel=sipUACfgRetryCancel, sipUAMIBCompliances=sipUAMIBCompliances, sipUAMIBGroups=sipUAMIBGroups, sipStatsRetryRegisters=sipStatsRetryRegisters, sipUAStatsRetryTable=sipUAStatsRetryTable, sipUAMIB=sipUAMIB, sipUACfgTimerDisconnect=sipUACfgTimerDisconnect, sipStatsRetryCancels=sipStatsRetryCancels, sipStatsRetryResponses=sipStatsRetryResponses, sipUACfgRetryBye=sipUACfgRetryBye, sipUAStatsRetry=sipUAStatsRetry, sipUACfgTimer=sipUACfgTimer, sipUACfgTimerProv=sipUACfgTimerProv, sipUACfgTimerEntry=sipUACfgTimerEntry, sipUAStatsRetryEntry=sipUAStatsRetryEntry, sipUACfg=sipUACfg, sipUACfgRetryInvite=sipUACfgRetryInvite, sipUACfgRetryRegister=sipUACfgRetryRegister, sipUAStatsGroup=sipUAStatsGroup, sipUACfgTimerReRegister=sipUACfgTimerReRegister, sipUACfgRetryResponse=sipUACfgRetryResponse, sipUAConfigGroup=sipUAConfigGroup, sipUACfgRetryTable=sipUACfgRetryTable, sipUAMIBConformance=sipUAMIBConformance, sipUACompliance=sipUACompliance, sipUACfgRetry=sipUACfgRetry, sipStatsRetryByes=sipStatsRetryByes, sipUAStats=sipUAStats, sipUACfgTimerTable=sipUACfgTimerTable)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection')
(appl_index,) = mibBuilder.importSymbols('NETWORK-SERVICES-MIB', 'applIndex')
(sip_mib,) = mibBuilder.importSymbols('SIP-MIB-SMI', 'sipMIB')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(mib_identifier, bits, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, object_identity, counter64, iso, module_identity, notification_type, gauge32, ip_address, time_ticks, unsigned32, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'ObjectIdentity', 'Counter64', 'iso', 'ModuleIdentity', 'NotificationType', 'Gauge32', 'IpAddress', 'TimeTicks', 'Unsigned32', 'Counter32')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
sip_uamib = module_identity((1, 3, 6, 1, 2, 1, 9998, 3))
if mibBuilder.loadTexts:
sipUAMIB.setLastUpdated('200007080000Z')
if mibBuilder.loadTexts:
sipUAMIB.setOrganization('IETF SIP Working Group, SIP MIB Team')
if mibBuilder.loadTexts:
sipUAMIB.setContactInfo('SIP MIB Team email: sip-mib@egroups.com \n\n Co-editor Kevin Lingle \n Cisco Systems, Inc. \n postal: 7025 Kit Creek Road \n P.O. Box 14987 \n Research Triangle Park, NC 27709 \n USA \n email: klingle@cisco.com \n phone: +1-919-392-2029 \n\n Co-editor Joon Maeng \n VTEL Corporation \n postal: 108 Wild Basin Rd. \n Austin, TX 78746 \n USA \n email: joon_maeng@vtel.com \n phone: +1-512-437-4567 \n\n Co-editor Dave Walker \n SS8 Networks, Inc. \n postal: 80 Hines Road \n Kanata, ON K2K 2T8 \n Canada \n email: drwalker@ss8networks.com \n phone: +1 613 592 2100')
if mibBuilder.loadTexts:
sipUAMIB.setDescription('Initial version of Session Initiation Protocol (SIP) \n User Agent (UA) MIB module. \n\n SIP is an application-layer signalling protocol for \n creating, modifying and terminating multimedia \n sessions with one or more participants. These sessions \n include Internet multimedia conferences and Internet \n telephone calls. SIP is defined in RFC 2543 (March \n 1999). \n\n A User Agent is an application that contains both a \n User Agent Client (UAC) and a User Agent Server (UAS). \n A UAC is an application that initiates a SIP request. \n A UAS is an application that contacts the user when a \n SIP request is received and that returns a response on \n behalf of the user. The response accepts, rejects, or \n redirects the request.')
sip_ua_cfg = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 1))
sip_ua_cfg_timer = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1))
sip_ua_cfg_retry = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2))
sip_ua_stats = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 2))
sip_ua_stats_retry = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1))
sip_ua_cfg_timer_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1))
if mibBuilder.loadTexts:
sipUACfgTimerTable.setDescription('This table contains timer configuration objects applicable \n to each SIP user agent in this system. The instances of \n SIP entities are uniquely identified by applIndex.')
sip_ua_cfg_timer_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipUACfgTimerEntry.setDescription('A row of timer configuration.')
sip_ua_cfg_timer_trying = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(100, 1000))).setUnits('milliseconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgTimerTrying.setDescription('This object specifies the time a user agent will wait to \n receive a provisional response to an INVITE before \n resending the INVITE.')
sip_ua_cfg_timer_prov = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(60000, 300000))).setUnits('milliseconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgTimerProv.setDescription('This object specifies the time a user agent will wait to \n receive a final response to an INVITE before canceling the \n transaction.')
sip_ua_cfg_timer_ack = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(100, 1000))).setUnits('milliseconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgTimerAck.setDescription('This object specifies the time a user agent will wait to \n receive an ACK confirmation indicating that a session is \n established.')
sip_ua_cfg_timer_disconnect = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(100, 1000))).setUnits('milliseconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgTimerDisconnect.setDescription('This object specifies the time a user agent will wait to \n receive a BYE confirmation indicating that a session is \n disconnected.')
sip_ua_cfg_timer_re_register = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 1, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setUnits('seconds').setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgTimerReRegister.setDescription('This object specifies how long the user agent wishes its \n registrations to be valid.')
sip_ua_cfg_retry_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1))
if mibBuilder.loadTexts:
sipUACfgRetryTable.setDescription('This table contains retry configuration objects applicable \n to each SIP user agent in this system. The instances of \n SIP entities are uniquely identified by applIndex.')
sip_ua_cfg_retry_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipUACfgRetryEntry.setDescription('A row of retry configuration.')
sip_ua_cfg_retry_invite = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgRetryInvite.setDescription('This object will specify the number of times a user agent \n will retry sending an INVITE request.')
sip_ua_cfg_retry_bye = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgRetryBye.setDescription('This object will specify the number of times a user agent \n will retry sending a BYE request.')
sip_ua_cfg_retry_cancel = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgRetryCancel.setDescription('This object will specify the number of times a user agent \n will retry sending a CANCEL request.')
sip_ua_cfg_retry_register = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgRetryRegister.setDescription('This object will specify the number of times a user agent \n will retry sending a REGISTER request.')
sip_ua_cfg_retry_response = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 1, 2, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
sipUACfgRetryResponse.setDescription('This object will specify the number of times a user agent \n will retry sending a Response and expecting an ACK.')
sip_ua_stats_retry_table = mib_table((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1))
if mibBuilder.loadTexts:
sipUAStatsRetryTable.setDescription('This table contains retry statistics objects applicable \n to each SIP user agent in this system. The instances of \n SIP entities are uniquely identified by applIndex.')
sip_ua_stats_retry_entry = mib_table_row((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1)).setIndexNames((0, 'NETWORK-SERVICES-MIB', 'applIndex'))
if mibBuilder.loadTexts:
sipUAStatsRetryEntry.setDescription('A row of retry statistics.')
sip_stats_retry_invites = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipStatsRetryInvites.setDescription("This object reflects the total number of INVITE retries \n that have been sent by the user agent. If the number of \n 'first attempt' INVITES is of interest, subtract the value \n of this object from sipStatsTrafficInviteOut.")
sip_stats_retry_byes = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipStatsRetryByes.setDescription('This object reflects the total number of BYE retries that \n have been sent by the user agent.')
sip_stats_retry_cancels = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipStatsRetryCancels.setDescription('This object reflects the total number of CANCEL retries \n that have been sent by the user agent.')
sip_stats_retry_registers = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipStatsRetryRegisters.setDescription('This object reflects the total number of REGISTER retries \n that have been sent by the user agent.')
sip_stats_retry_responses = mib_table_column((1, 3, 6, 1, 2, 1, 9998, 3, 2, 1, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
sipStatsRetryResponses.setDescription('This object reflects the total number of Response (while \n expecting an ACK) retries that have been sent by the user \n agent.')
sip_uamib_notif = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 3))
sip_uamib_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 4))
sip_uamib_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 4, 1))
sip_uamib_groups = mib_identifier((1, 3, 6, 1, 2, 1, 9998, 3, 4, 2))
sip_ua_compliance = module_compliance((1, 3, 6, 1, 2, 1, 9998, 3, 4, 1, 1)).setObjects(*(('SIP-UA-MIB', 'sipUAConfigGroup'), ('SIP-UA-MIB', 'sipUAStatsGroup')))
if mibBuilder.loadTexts:
sipUACompliance.setDescription('The compliance statement for SIP entities.')
sip_ua_config_group = object_group((1, 3, 6, 1, 2, 1, 9998, 3, 4, 2, 1)).setObjects(*(('SIP-UA-MIB', 'sipUACfgTimerTrying'), ('SIP-UA-MIB', 'sipUACfgTimerProv'), ('SIP-UA-MIB', 'sipUACfgTimerAck'), ('SIP-UA-MIB', 'sipUACfgTimerDisconnect'), ('SIP-UA-MIB', 'sipUACfgTimerReRegister'), ('SIP-UA-MIB', 'sipUACfgRetryInvite'), ('SIP-UA-MIB', 'sipUACfgRetryBye'), ('SIP-UA-MIB', 'sipUACfgRetryCancel'), ('SIP-UA-MIB', 'sipUACfgRetryRegister'), ('SIP-UA-MIB', 'sipUACfgRetryResponse')))
if mibBuilder.loadTexts:
sipUAConfigGroup.setDescription('A collection of objects providing configuration for \n SIP User Agents.')
sip_ua_stats_group = object_group((1, 3, 6, 1, 2, 1, 9998, 3, 4, 2, 2)).setObjects(*(('SIP-UA-MIB', 'sipStatsRetryInvites'), ('SIP-UA-MIB', 'sipStatsRetryByes'), ('SIP-UA-MIB', 'sipStatsRetryCancels'), ('SIP-UA-MIB', 'sipStatsRetryRegisters'), ('SIP-UA-MIB', 'sipStatsRetryResponses')))
if mibBuilder.loadTexts:
sipUAStatsGroup.setDescription('A collection of objects providing statistics for \n SIP User Agents.')
mibBuilder.exportSymbols('SIP-UA-MIB', PYSNMP_MODULE_ID=sipUAMIB, sipStatsRetryInvites=sipStatsRetryInvites, sipUACfgTimerTrying=sipUACfgTimerTrying, sipUACfgTimerAck=sipUACfgTimerAck, sipUAMIBNotif=sipUAMIBNotif, sipUACfgRetryEntry=sipUACfgRetryEntry, sipUACfgRetryCancel=sipUACfgRetryCancel, sipUAMIBCompliances=sipUAMIBCompliances, sipUAMIBGroups=sipUAMIBGroups, sipStatsRetryRegisters=sipStatsRetryRegisters, sipUAStatsRetryTable=sipUAStatsRetryTable, sipUAMIB=sipUAMIB, sipUACfgTimerDisconnect=sipUACfgTimerDisconnect, sipStatsRetryCancels=sipStatsRetryCancels, sipStatsRetryResponses=sipStatsRetryResponses, sipUACfgRetryBye=sipUACfgRetryBye, sipUAStatsRetry=sipUAStatsRetry, sipUACfgTimer=sipUACfgTimer, sipUACfgTimerProv=sipUACfgTimerProv, sipUACfgTimerEntry=sipUACfgTimerEntry, sipUAStatsRetryEntry=sipUAStatsRetryEntry, sipUACfg=sipUACfg, sipUACfgRetryInvite=sipUACfgRetryInvite, sipUACfgRetryRegister=sipUACfgRetryRegister, sipUAStatsGroup=sipUAStatsGroup, sipUACfgTimerReRegister=sipUACfgTimerReRegister, sipUACfgRetryResponse=sipUACfgRetryResponse, sipUAConfigGroup=sipUAConfigGroup, sipUACfgRetryTable=sipUACfgRetryTable, sipUAMIBConformance=sipUAMIBConformance, sipUACompliance=sipUACompliance, sipUACfgRetry=sipUACfgRetry, sipStatsRetryByes=sipStatsRetryByes, sipUAStats=sipUAStats, sipUACfgTimerTable=sipUACfgTimerTable) |
class Model(object):
def __init__(self):
self.username = None
self.password = None
self.deck = None
def username(self):
return self.username
def password(self):
return self.password
def deck(self):
return self.deck | class Model(object):
def __init__(self):
self.username = None
self.password = None
self.deck = None
def username(self):
return self.username
def password(self):
return self.password
def deck(self):
return self.deck |
with open('text.txt', 'r') as f:
for num, line in enumerate(f):
if line.find('text') > -1:
print(f'The word text is present on the line {num + 1}')
# print(content)
| with open('text.txt', 'r') as f:
for (num, line) in enumerate(f):
if line.find('text') > -1:
print(f'The word text is present on the line {num + 1}') |
def collision(x1, y1, radius1, x2, y2, radius2) -> bool:
if ((x1 - x2) ** 2 + (y1 - y2) ** 2) <= (radius1 + radius2) ** 2:
return True
return False
| def collision(x1, y1, radius1, x2, y2, radius2) -> bool:
if (x1 - x2) ** 2 + (y1 - y2) ** 2 <= (radius1 + radius2) ** 2:
return True
return False |
#removing duplicates
l1=list()
for i in range(5):
l1.append((input("enter element:")))
print(l1)
i=0
while i<len(l1):
j=i+1
while j<len(l1):
if l1[i]==l1[j]:
del l1[j]
else:
j+=1
i+=1
print(l1)
| l1 = list()
for i in range(5):
l1.append(input('enter element:'))
print(l1)
i = 0
while i < len(l1):
j = i + 1
while j < len(l1):
if l1[i] == l1[j]:
del l1[j]
else:
j += 1
i += 1
print(l1) |
EXPECTED_METRICS = {
"php_apcu.cache.mem_size": 0,
"php_apcu.cache.num_slots": 1,
"php_apcu.cache.ttl": 0,
"php_apcu.cache.num_hits": 0,
"php_apcu.cache.num_misses": 0,
"php_apcu.cache.num_inserts": 0,
"php_apcu.cache.num_entries": 0,
"php_apcu.cache.num_expunges": 0,
"php_apcu.cache.uptime": 1,
"php_apcu.sma.avail_mem": 1,
"php_apcu.sma.seg_size": 1,
"php_apcu.sma.num_seg": 1,
}
| expected_metrics = {'php_apcu.cache.mem_size': 0, 'php_apcu.cache.num_slots': 1, 'php_apcu.cache.ttl': 0, 'php_apcu.cache.num_hits': 0, 'php_apcu.cache.num_misses': 0, 'php_apcu.cache.num_inserts': 0, 'php_apcu.cache.num_entries': 0, 'php_apcu.cache.num_expunges': 0, 'php_apcu.cache.uptime': 1, 'php_apcu.sma.avail_mem': 1, 'php_apcu.sma.seg_size': 1, 'php_apcu.sma.num_seg': 1} |
'''
QUESTION:
868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.
If there aren't two consecutive 1's, return 0.
Example 1:
Input: 22
Output: 2
Explanation:
22 in binary is 0b10110.
In the binary representation of 22, there are three ones, and two consecutive pairs of 1's.
The first consecutive pair of 1's have distance 2.
The second consecutive pair of 1's have distance 1.
The answer is the largest of these two distances, which is 2.
Example 2:
Input: 5
Output: 2
Explanation:
5 in binary is 0b101.
Example 3:
Input: 6
Output: 1
Explanation:
6 in binary is 0b110.
Example 4:
Input: 8
Output: 0
Explanation:
8 in binary is 0b1000.
There aren't any consecutive pairs of 1's in the binary representation of 8, so we return 0.
'''
class Solution(object):
def binaryGap(self, N):
index_lst = []
b = bin(N)[2:]
for i in range(len(b)):
if b[i] == '1':
index_lst.append(i)
max = 0
for i in range(len(index_lst) - 1):
if (index_lst[i + 1] - index_lst[i]) > max:
max = index_lst[i + 1] - index_lst[i]
return max
'''
Ideas/thoughts:
convert the binary and find the positions of 1's and
and see the long diff of digits.
'''
| """
QUESTION:
868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N.
If there aren't two consecutive 1's, return 0.
Example 1:
Input: 22
Output: 2
Explanation:
22 in binary is 0b10110.
In the binary representation of 22, there are three ones, and two consecutive pairs of 1's.
The first consecutive pair of 1's have distance 2.
The second consecutive pair of 1's have distance 1.
The answer is the largest of these two distances, which is 2.
Example 2:
Input: 5
Output: 2
Explanation:
5 in binary is 0b101.
Example 3:
Input: 6
Output: 1
Explanation:
6 in binary is 0b110.
Example 4:
Input: 8
Output: 0
Explanation:
8 in binary is 0b1000.
There aren't any consecutive pairs of 1's in the binary representation of 8, so we return 0.
"""
class Solution(object):
def binary_gap(self, N):
index_lst = []
b = bin(N)[2:]
for i in range(len(b)):
if b[i] == '1':
index_lst.append(i)
max = 0
for i in range(len(index_lst) - 1):
if index_lst[i + 1] - index_lst[i] > max:
max = index_lst[i + 1] - index_lst[i]
return max
"\nIdeas/thoughts:\nconvert the binary and find the positions of 1's and \nand see the long diff of digits.\n\n" |
file1 = open('/home/student/.ros/log/a13f3d8c-1369-11eb-a6ad-08002707b8e3/rosout.log','r')
file2 = open('/home/student/CarND-Capstone/imgs/Train_Imgs/Train_data.txt','w')
count=1
while True:
line = file1.readline()
if not line:
break
# if line.split(' ')[2][1:7]=='tl_det':
sep_line = line.split(' ')
if len(sep_line)>2 and sep_line[2][-5:-1]=='data':
if sep_line[-2]!='image':
print(sep_line[-2],sep_line[-1].rstrip())
file2.write(''.join(sep_line[-2:]))
file1.close()
file2.close()
| file1 = open('/home/student/.ros/log/a13f3d8c-1369-11eb-a6ad-08002707b8e3/rosout.log', 'r')
file2 = open('/home/student/CarND-Capstone/imgs/Train_Imgs/Train_data.txt', 'w')
count = 1
while True:
line = file1.readline()
if not line:
break
sep_line = line.split(' ')
if len(sep_line) > 2 and sep_line[2][-5:-1] == 'data':
if sep_line[-2] != 'image':
print(sep_line[-2], sep_line[-1].rstrip())
file2.write(''.join(sep_line[-2:]))
file1.close()
file2.close() |
def kebab_to_snake_case(json):
if isinstance(json, dict):
return kebab_to_snake_case_dict(json)
if isinstance(json, list):
new_json = []
for d in json:
if isinstance(d, dict):
new_json.append(kebab_to_snake_case_dict)
return json
def kebab_to_snake_case_dict(d: dict):
return {key.replace('-', '_'): kebab_to_snake_case(value) for key, value in d.items()}
| def kebab_to_snake_case(json):
if isinstance(json, dict):
return kebab_to_snake_case_dict(json)
if isinstance(json, list):
new_json = []
for d in json:
if isinstance(d, dict):
new_json.append(kebab_to_snake_case_dict)
return json
def kebab_to_snake_case_dict(d: dict):
return {key.replace('-', '_'): kebab_to_snake_case(value) for (key, value) in d.items()} |
#Every true traveler must know how to do 3 things: fix the fire, find the water and extract useful information
#from the nature around him. Programming won't help you with the fire and water, but when it comes to the
#information extraction - it might be just the thing you need.
#Your task is to find the angle of the sun above the horizon knowing the time of the day. Input data:
#the sun rises in the East at 6:00 AM, which corresponds to the angle of 0 degrees. At 12:00 PM the sun
#reaches its zenith, which means that the angle equals 90 degrees. 6:00 PM is the time of the sunset so
#the angle is 180 degrees. If the input will be the time of the night (before 6:00 AM or after 6:00 PM),
#your function should return - "I don't see the sun!".
def sun_angle(hora):
hora = hora.split(':')
lista = []
for c in hora:
c = int(c)
lista.append(c)
if 6<=int(lista[0])<18:
angulo = ((lista[0]-6)*15)+(lista[1]*0.25)
elif lista[0]==18 and lista[1]==00:
angulo = ((lista[0]-6)*15)+(lista[1]*0.25)
else:
return "I don't see the sun!"
return angulo
if __name__ == '__main__':
print("Example:")
print(sun_angle("07:00"))
print(sun_angle("07:00")) == 15
print(sun_angle("08:27"))
print(sun_angle("06:00"))
print(sun_angle("18:00"))
print(sun_angle("12:00"))
print(sun_angle("18:01"))
print(sun_angle("18:02"))
print(sun_angle("01:23")) == "I don't see the sun!"
| def sun_angle(hora):
hora = hora.split(':')
lista = []
for c in hora:
c = int(c)
lista.append(c)
if 6 <= int(lista[0]) < 18:
angulo = (lista[0] - 6) * 15 + lista[1] * 0.25
elif lista[0] == 18 and lista[1] == 0:
angulo = (lista[0] - 6) * 15 + lista[1] * 0.25
else:
return "I don't see the sun!"
return angulo
if __name__ == '__main__':
print('Example:')
print(sun_angle('07:00'))
print(sun_angle('07:00')) == 15
print(sun_angle('08:27'))
print(sun_angle('06:00'))
print(sun_angle('18:00'))
print(sun_angle('12:00'))
print(sun_angle('18:01'))
print(sun_angle('18:02'))
print(sun_angle('01:23')) == "I don't see the sun!" |
class Lightbulb:
def __init__(self):
self.state = "off"
def change_state(self):
if self.state == "off":
self.state = "on"
print("Turning the light on")
else:
self.state = "off"
print("Turning the light off")
| class Lightbulb:
def __init__(self):
self.state = 'off'
def change_state(self):
if self.state == 'off':
self.state = 'on'
print('Turning the light on')
else:
self.state = 'off'
print('Turning the light off') |
# Enable standard authentication functionality for this application
def user():
return dict(form=auth())
def index():
return dict()
def login():
form = auth.login(next=URL(a='loginexample', c='default',f='gallery'))
form.custom.widget.email['_class'] = 'form-control my-3 bg-light'
form.custom.widget.email['_placeholder'] = 'Email'
form.custom.widget.password['_class'] = 'form-control my-3 bg-light'
form.custom.widget.password['_placeholder'] = 'Password'
form.custom.widget.remember_me['_class'] = 'checkbox'
return dict(form=form)
def change_password():
form = auth.change_password()
form.custom.widget.old_password['_class'] = 'form-control my-3 bg-light'
form.custom.widget.old_password['_placeholder'] = 'Old Password'
form.custom.widget.new_password['_class'] = 'form-control my-3 bg-light'
form.custom.widget.new_password['_placeholder'] = 'New Password'
form.custom.widget.new_password2['_class'] = 'form-control my-3 bg-light'
form.custom.widget.new_password2['_placeholder'] = 'Confirm New Password'
return dict(form=form)
def register():
records = db().select(db_hivetu.auth_user.ALL)
# Define which page to open after the login sequence
form = auth.register(next=URL(a='hivetu', c='default',f='login'))
# First Name
form.custom.widget.first_name['_class'] = 'form-control'
form.custom.widget.first_name['_placeholder'] = 'First Name'
form.custom.widget.first_name['_type'] = 'text'
# Last Name
form.custom.widget.last_name['_class'] = 'form-control'
form.custom.widget.last_name['_placeholder'] = 'Last Name'
form.custom.widget.last_name['_type'] = 'text'
# Email
form.custom.widget.email['_class'] = 'form-control'
form.custom.widget.email['_placeholder'] = 'Email'
form.custom.widget.email['_type'] = 'email'
# Password
form.custom.widget.password['_class'] = 'form-control'
form.custom.widget.password['_placeholder'] = 'Password'
form.custom.widget.password['_type'] = 'password'
# Confirm Password
form.custom.widget.password_two['_class'] = 'form-control'
form.custom.widget.password_two['_placeholder'] = 'Confirm Password'
form.custom.widget.password_two['_type'] = 'password'
return dict(form=form)
@auth.requires_login()
def gallery():
return dict()
def test():
form = auth.register()
return dict(form=form)
@auth.requires_login()
def profile():
form = auth.profile()
form.custom.widget.first_name['_class'] = 'form-control my-3 bg-light'
form.custom.widget.last_name['_class'] = 'form-control my-3 bg-light'
#form.custom.widget.email['_class'] = 'form-control my-3 bg-light'
#form.custom.widget.email['_type'] = 'email'
return dict(form=form)
@auth.requires_login()
def gallery_summary():
return dict()
| def user():
return dict(form=auth())
def index():
return dict()
def login():
form = auth.login(next=url(a='loginexample', c='default', f='gallery'))
form.custom.widget.email['_class'] = 'form-control my-3 bg-light'
form.custom.widget.email['_placeholder'] = 'Email'
form.custom.widget.password['_class'] = 'form-control my-3 bg-light'
form.custom.widget.password['_placeholder'] = 'Password'
form.custom.widget.remember_me['_class'] = 'checkbox'
return dict(form=form)
def change_password():
form = auth.change_password()
form.custom.widget.old_password['_class'] = 'form-control my-3 bg-light'
form.custom.widget.old_password['_placeholder'] = 'Old Password'
form.custom.widget.new_password['_class'] = 'form-control my-3 bg-light'
form.custom.widget.new_password['_placeholder'] = 'New Password'
form.custom.widget.new_password2['_class'] = 'form-control my-3 bg-light'
form.custom.widget.new_password2['_placeholder'] = 'Confirm New Password'
return dict(form=form)
def register():
records = db().select(db_hivetu.auth_user.ALL)
form = auth.register(next=url(a='hivetu', c='default', f='login'))
form.custom.widget.first_name['_class'] = 'form-control'
form.custom.widget.first_name['_placeholder'] = 'First Name'
form.custom.widget.first_name['_type'] = 'text'
form.custom.widget.last_name['_class'] = 'form-control'
form.custom.widget.last_name['_placeholder'] = 'Last Name'
form.custom.widget.last_name['_type'] = 'text'
form.custom.widget.email['_class'] = 'form-control'
form.custom.widget.email['_placeholder'] = 'Email'
form.custom.widget.email['_type'] = 'email'
form.custom.widget.password['_class'] = 'form-control'
form.custom.widget.password['_placeholder'] = 'Password'
form.custom.widget.password['_type'] = 'password'
form.custom.widget.password_two['_class'] = 'form-control'
form.custom.widget.password_two['_placeholder'] = 'Confirm Password'
form.custom.widget.password_two['_type'] = 'password'
return dict(form=form)
@auth.requires_login()
def gallery():
return dict()
def test():
form = auth.register()
return dict(form=form)
@auth.requires_login()
def profile():
form = auth.profile()
form.custom.widget.first_name['_class'] = 'form-control my-3 bg-light'
form.custom.widget.last_name['_class'] = 'form-control my-3 bg-light'
return dict(form=form)
@auth.requires_login()
def gallery_summary():
return dict() |
# Space: O(1)
# Time: O(n)
# recursive approach
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapPairs(self, head):
if head is None or head.next is None:
return head
first_node = head
second_node = head.next
first_node.next = self.swapPairs(head.next.next)
second_node.next = first_node
return second_node
| class Solution:
def swap_pairs(self, head):
if head is None or head.next is None:
return head
first_node = head
second_node = head.next
first_node.next = self.swapPairs(head.next.next)
second_node.next = first_node
return second_node |
fin = open("input_18.txt")
digits = '1234567890'
def prep(text):
text = text.strip().replace(' ','')
text = text[::-1]
text = text.replace('(','X')
text = text.replace(')','(')
text = text.replace('X',')')
return text
def geval(text):
# print(text)
if text[0] == '(':
plevel = 1
for i,char in enumerate(text[1:],1):
if char == '(':
plevel += 1
elif char == ')':
plevel += -1
if plevel == 0:
leftop = text[1:i]
parsepos=i
break
# print('parsepos',parsepos,len(text),leftop)
if parsepos == len(text)-1:
return int(geval(leftop))
else:
op=text[parsepos+1]
rightop=text[parsepos+2:]
elif text[0] in digits:
if len(text) == 1:
return int(text)
else:
leftop = text[0]
op = text[1]
rightop = text[2:]
# print(leftop,':',op,':',rightop)
if op=='+':
return int(geval(leftop))+int(geval(rightop))
elif op=='*':
return int(geval(leftop))*int(geval(rightop))
total = 0
for line in fin:
print(line,end='')
pline = prep(line)
result = int(geval(pline))
total += result
print(pline,'=',result,'\n')
fin.close()
print(total) | fin = open('input_18.txt')
digits = '1234567890'
def prep(text):
text = text.strip().replace(' ', '')
text = text[::-1]
text = text.replace('(', 'X')
text = text.replace(')', '(')
text = text.replace('X', ')')
return text
def geval(text):
if text[0] == '(':
plevel = 1
for (i, char) in enumerate(text[1:], 1):
if char == '(':
plevel += 1
elif char == ')':
plevel += -1
if plevel == 0:
leftop = text[1:i]
parsepos = i
break
if parsepos == len(text) - 1:
return int(geval(leftop))
else:
op = text[parsepos + 1]
rightop = text[parsepos + 2:]
elif text[0] in digits:
if len(text) == 1:
return int(text)
else:
leftop = text[0]
op = text[1]
rightop = text[2:]
if op == '+':
return int(geval(leftop)) + int(geval(rightop))
elif op == '*':
return int(geval(leftop)) * int(geval(rightop))
total = 0
for line in fin:
print(line, end='')
pline = prep(line)
result = int(geval(pline))
total += result
print(pline, '=', result, '\n')
fin.close()
print(total) |
#!/usr/bin/env python
#
# Converts the Gonnet matrix to a pair-wise score
#
# Read replacements
replacements = {}
filename = 'gonnet.csv'
print('Reading ' + filename)
rows = []
arow = []
acol = []
with open(filename, 'r') as f:
for k, line in enumerate(f):
row = line.strip().split(',')
if k < 19:
row = row[:row.index('')]
if k < 20:
arow.append(row[0])
rows.append([float(x) for x in row[1:]])
else:
acol = row[1:]
break
if arow != acol:
print('Warning: Order of acids in rows does not match order in columns')
# Write list of replacements
minscore = float('inf')
maxscore = -minscore
filename = 'gonnet_score.csv'
print('Writing ' + filename)
with open(filename, 'w') as f:
f.write('key1,key2,score\n')
for i, ar in enumerate(arow):
for j, ac in enumerate(acol):
if ar == ac:
break
score = rows[i][j]
f.write(ar + ',' + ac + ',' + str(score) + '\n')
f.write(ac + ',' + ar + ',' + str(score) + '\n')
minscore = min(score, minscore)
maxscore = max(score, maxscore)
print('Lowest score : ' + str(minscore))
print('Highest score: ' + str(maxscore))
print('Done')
| replacements = {}
filename = 'gonnet.csv'
print('Reading ' + filename)
rows = []
arow = []
acol = []
with open(filename, 'r') as f:
for (k, line) in enumerate(f):
row = line.strip().split(',')
if k < 19:
row = row[:row.index('')]
if k < 20:
arow.append(row[0])
rows.append([float(x) for x in row[1:]])
else:
acol = row[1:]
break
if arow != acol:
print('Warning: Order of acids in rows does not match order in columns')
minscore = float('inf')
maxscore = -minscore
filename = 'gonnet_score.csv'
print('Writing ' + filename)
with open(filename, 'w') as f:
f.write('key1,key2,score\n')
for (i, ar) in enumerate(arow):
for (j, ac) in enumerate(acol):
if ar == ac:
break
score = rows[i][j]
f.write(ar + ',' + ac + ',' + str(score) + '\n')
f.write(ac + ',' + ar + ',' + str(score) + '\n')
minscore = min(score, minscore)
maxscore = max(score, maxscore)
print('Lowest score : ' + str(minscore))
print('Highest score: ' + str(maxscore))
print('Done') |
# rename this file to config.py
# change with your info from adafruit.io
ADAFRUIT_IO_USERNAME = "XXXX"
ADAFRUIT_IO_KEY = "aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
APIURL="https://api.openweathermap.org/data/2.5/weather?lat=41.XXXXXX&lon=-73.XXXXXX&appid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&units=imperial"
| adafruit_io_username = 'XXXX'
adafruit_io_key = 'aio_XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
apiurl = 'https://api.openweathermap.org/data/2.5/weather?lat=41.XXXXXX&lon=-73.XXXXXX&appid=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&units=imperial' |
# Copyright 2018 eBay Inc.
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# 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.
NETFORCE_PLUGIN = 'NETFORCE'
NETFORCE_DESCRIPTION = 'A service plugin that manages the life ' \
'cycle of the resources related to network devices'
HEALTH_STATE_HEALTHY = "healthy"
HEALTH_STATE_ERROR = "error"
HEALTH_STATE_PROBATION = "probation"
HEALTH_STATE_MAINTENANCE = "maintenance"
SUBNET_TYPE_PRIMARY = 'primary'
CMS_ASSET_STATE_DECOMM = 'decomm'
CMS_ASSET_STATE_SACHECK = 'SAcheck'
| netforce_plugin = 'NETFORCE'
netforce_description = 'A service plugin that manages the life cycle of the resources related to network devices'
health_state_healthy = 'healthy'
health_state_error = 'error'
health_state_probation = 'probation'
health_state_maintenance = 'maintenance'
subnet_type_primary = 'primary'
cms_asset_state_decomm = 'decomm'
cms_asset_state_sacheck = 'SAcheck' |
consumer_conf = {
"aws_region":"",
"kinesis_stream":"",
"kinesis_endpoint":"",
"kinesis_app_name":"",
"AWS_ACCESS_KEY":"",
"AWS_SECRET_KEY":"",
"AWS_ACCESS_KEY_ID":"",
"AWS_SECRET_ACCESS_KEY":"",
"MONGO_CONNECTION_STRING":""
} | consumer_conf = {'aws_region': '', 'kinesis_stream': '', 'kinesis_endpoint': '', 'kinesis_app_name': '', 'AWS_ACCESS_KEY': '', 'AWS_SECRET_KEY': '', 'AWS_ACCESS_KEY_ID': '', 'AWS_SECRET_ACCESS_KEY': '', 'MONGO_CONNECTION_STRING': ''} |
'''
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).
The algorithm for myAtoi(string s) is as follows:
Read in and ignore any leading whitespace.
Check if the next character (if not already at the end of the string) is '-' or '+'. Read this character in if it is either. This determines if the final result is negative or positive respectively. Assume the result is positive if neither is present.
Read in next the characters until the next non-digit character or the end of the input is reached. The rest of the string is ignored.
Convert these digits into an integer (i.e. "123" -> 123, "0032" -> 32). If no digits were read, then the integer is 0. Change the sign as necessary (from step 2).
If the integer is out of the 32-bit signed integer range [-231, 231 - 1], then clamp the integer so that it remains in the range. Specifically, integers less than -231 should be clamped to -231, and integers greater than 231 - 1 should be clamped to 231 - 1.
Return the integer as the final result.
Note:
Only the space character ' ' is considered a whitespace character.
Do not ignore any characters other than the leading whitespace or the rest of the string after the digits.
Example 1:
Input: s = "42"
Output: 42
Explanation: The underlined characters are what is read in, the caret is the current reader position.
Step 1: "42" (no characters read because there is no leading whitespace)
^
Step 2: "42" (no characters read because there is neither a '-' nor '+')
^
Step 3: "42" ("42" is read in)
^
The parsed integer is 42.
Since 42 is in the range [-231, 231 - 1], the final result is 42.
'''
class Solution:
def myAtoi(self, s: str) -> int:
digits = set(list('0123456789'))
signs = set(list('-+'))
tmp_list = []
for c in s:
if len(tmp_list) == 0:
if c in digits or c in signs:
tmp_list.append(c)
elif c == ' ':
continue
else:
break
else:
if c in digits:
tmp_list.append(c)
else:
break
if len(tmp_list) == 0 or tmp_list[-1] in signs:
return 0
print(tmp_list)
res = int(''.join(tmp_list[:]))
if res > 2 ** 31 - 1:
return 2 ** 31 - 1
elif res < -2 ** 31:
return -2 ** 31
else:
return res | """
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function).
The algorithm for myAtoi(string s) is as follows:
Read in and ignore any leading whitespace.
Check if the next character (if not already at the end of the string) is '-' or '+'. Read this character in if it is either. This determines if the final result is negative or positive respectively. Assume the result is positive if neither is present.
Read in next the characters until the next non-digit character or the end of the input is reached. The rest of the string is ignored.
Convert these digits into an integer (i.e. "123" -> 123, "0032" -> 32). If no digits were read, then the integer is 0. Change the sign as necessary (from step 2).
If the integer is out of the 32-bit signed integer range [-231, 231 - 1], then clamp the integer so that it remains in the range. Specifically, integers less than -231 should be clamped to -231, and integers greater than 231 - 1 should be clamped to 231 - 1.
Return the integer as the final result.
Note:
Only the space character ' ' is considered a whitespace character.
Do not ignore any characters other than the leading whitespace or the rest of the string after the digits.
Example 1:
Input: s = "42"
Output: 42
Explanation: The underlined characters are what is read in, the caret is the current reader position.
Step 1: "42" (no characters read because there is no leading whitespace)
^
Step 2: "42" (no characters read because there is neither a '-' nor '+')
^
Step 3: "42" ("42" is read in)
^
The parsed integer is 42.
Since 42 is in the range [-231, 231 - 1], the final result is 42.
"""
class Solution:
def my_atoi(self, s: str) -> int:
digits = set(list('0123456789'))
signs = set(list('-+'))
tmp_list = []
for c in s:
if len(tmp_list) == 0:
if c in digits or c in signs:
tmp_list.append(c)
elif c == ' ':
continue
else:
break
elif c in digits:
tmp_list.append(c)
else:
break
if len(tmp_list) == 0 or tmp_list[-1] in signs:
return 0
print(tmp_list)
res = int(''.join(tmp_list[:]))
if res > 2 ** 31 - 1:
return 2 ** 31 - 1
elif res < -2 ** 31:
return -2 ** 31
else:
return res |
# ==========================================================================
# Only for a given set of 10 companies the data is being extracted/collected
# to make predictions as they are independent and are also likely to sample
# lot of variation from engineering, beverages, mdicine, investment banking
# etc and the corresponding ensembles are being used.
# ==========================================================================
selected = [
'GS',
# 'NKE',
# 'MCD',
# 'PFE',
# 'DIS',
# 'INTC',
# 'WMT',
# 'JNJ',
# 'JPM',
# 'AAPL'
]
# ===================================
# Companies to be added in the future
# ===================================
all_companies_list = [
'TRV',
'DOW',
'WBA',
'CAT',
'GS',
'MMM',
'AXP',
'UTX',
'IBM',
'NKE',
'MCD',
'BA',
'CSCO',
'CVX',
'PFE',
'MRK',
'VZ',
'KO',
'DIS',
'HD',
'XOM',
'UNH',
'INTC',
'PG',
'WMT',
'JNJ',
'JPM',
'V',
'AAPL',
'MSFT'
]
# Companies List:
# 1.Travelers ==== TRV
# 2.Dow ==== DOW
# 3.Walgreens Boots Alliance ==== WBA
# 4.Caterpillar ==== CAT
# 5.Goldman Sachs ==== GS
# 6.3M ==== MMM
# 7.American Express ==== AXP
# 8.United Technologies ==== UTX
# 9.IBM ==== IBM
#10.Nike ==== NKE
#11.McDonald's ==== MCD
#12.Boeing ==== BA
#13.Cisco ==== CSCO
#14.Chevron ==== CVX
#15.Pfizer ==== PFE
#16.Merck & Co ==== MRK
#17.Verizon ==== VZ
#18.The Coca-Cola Company ==== KO
#19.Disney ==== DIS
#20.Home Depot ==== HD
#21.Exxon Mobil ==== XOM
#22.UnitedHealth Group ==== UNH
#23.Intel ==== INTC
#24.Procter & Gamble ==== PG
#25.Walmart ==== WMT
#26.Johnson & Johnson ==== JNJ
#27.JPMorgan ==== JPM
#28.Visa ==== V
#29.Apple ==== AAPL
#30.Microsoft ==== MSFT | selected = ['GS']
all_companies_list = ['TRV', 'DOW', 'WBA', 'CAT', 'GS', 'MMM', 'AXP', 'UTX', 'IBM', 'NKE', 'MCD', 'BA', 'CSCO', 'CVX', 'PFE', 'MRK', 'VZ', 'KO', 'DIS', 'HD', 'XOM', 'UNH', 'INTC', 'PG', 'WMT', 'JNJ', 'JPM', 'V', 'AAPL', 'MSFT'] |
def getFix(s):
ret = ""
for i in range(1, len(s) - 1):
if s[i] == '(':
ret += ')'
else:
ret += '('
return ret
def isCorrect(s):
cnt = 0
for c in s:
if c == '(':
cnt += 1
else:
cnt -= 1
if cnt < 0:
return False
return True
def do(s):
if len(s) == 0:
return ""
i, cnt = 0, 0
while True:
if s[i] == '(':
cnt += 1
else:
cnt -= 1
i += 1
if cnt == 0:
break
u, v = s[:i], s[i:]
if isCorrect(u):
return u + do(v)
else:
return '(' + do(v) + ')' + getFix(u)
def solution(p):
return do(p)
| def get_fix(s):
ret = ''
for i in range(1, len(s) - 1):
if s[i] == '(':
ret += ')'
else:
ret += '('
return ret
def is_correct(s):
cnt = 0
for c in s:
if c == '(':
cnt += 1
else:
cnt -= 1
if cnt < 0:
return False
return True
def do(s):
if len(s) == 0:
return ''
(i, cnt) = (0, 0)
while True:
if s[i] == '(':
cnt += 1
else:
cnt -= 1
i += 1
if cnt == 0:
break
(u, v) = (s[:i], s[i:])
if is_correct(u):
return u + do(v)
else:
return '(' + do(v) + ')' + get_fix(u)
def solution(p):
return do(p) |
# https://leetcode.com/problems/subarray-sum-equals-k/
class Solution:
def subarraySum(self, nums: list[int], k: int) -> int:
block_sum = 0
sum_counts = {0: 1} # Pretend sum at the left of nums[0] was 0.
good_subarrays = 0
for num in nums:
block_sum += num
required = block_sum - k
if required in sum_counts:
good_subarrays += sum_counts[required]
sum_counts[block_sum] = sum_counts.get(block_sum, 0) + 1
return good_subarrays
| class Solution:
def subarray_sum(self, nums: list[int], k: int) -> int:
block_sum = 0
sum_counts = {0: 1}
good_subarrays = 0
for num in nums:
block_sum += num
required = block_sum - k
if required in sum_counts:
good_subarrays += sum_counts[required]
sum_counts[block_sum] = sum_counts.get(block_sum, 0) + 1
return good_subarrays |
def const_ver():
return "v8.0"
def is_gpvdm_next():
return False
| def const_ver():
return 'v8.0'
def is_gpvdm_next():
return False |
if True:
pass
elif (banana):
pass
else:
pass | if True:
pass
elif banana:
pass
else:
pass |
other_schema = {
"type": "list",
"items": [
{"type": "string"},
{"type": "integer", "min": 500},
{
"type": "list",
"items": [
{"type": "string"},
{"type": "integer", "name": "nd_int"},
{"type": "integer"},
{"type": "integer", "min": 50},
],
},
],
}
schema = {
"list_of_values": {
"type": "list",
"name": "hello",
"items": [
{"type": "string"},
{"type": "integer", "min": 500},
{
"type": "list",
"items": [
{"type": "string"},
{"type": "integer"},
{"type": "integer", "name": "hi"},
{
"type": "dict",
"schema": {
"field1": {"type": "string", "name": "field01231"},
"field2": {"type": "integer"},
},
},
],
},
],
},
"list_of_values_2": other_schema,
}
| other_schema = {'type': 'list', 'items': [{'type': 'string'}, {'type': 'integer', 'min': 500}, {'type': 'list', 'items': [{'type': 'string'}, {'type': 'integer', 'name': 'nd_int'}, {'type': 'integer'}, {'type': 'integer', 'min': 50}]}]}
schema = {'list_of_values': {'type': 'list', 'name': 'hello', 'items': [{'type': 'string'}, {'type': 'integer', 'min': 500}, {'type': 'list', 'items': [{'type': 'string'}, {'type': 'integer'}, {'type': 'integer', 'name': 'hi'}, {'type': 'dict', 'schema': {'field1': {'type': 'string', 'name': 'field01231'}, 'field2': {'type': 'integer'}}}]}]}, 'list_of_values_2': other_schema} |
# As you already know, the string is one of the most
# important data types in Python. To make working with
# strings easier, Python has many special built-in string
# methods. We are about to learn some of them.
# An important thing to remember, however, is that the
# string is an immutable data type! It means that you
# cannot just change the string in-place, so most string
# methods return a copy of the string (with several
# exceptions). To save the changes made to the string
# for later use you need to create a new variable for the
# copy that you made or assign the same name to the
# copy. So, what to do with the output of the methods
# depends on whenther you are going to use the original
# string or its copy later.
# 1. "Changing" a string
# The first group of string methods consists of the ones that
# "change" the string in a specific way, that is they return the
# copy with some changes made.
# The syntax for calling a method is as follows: a string is
# given first (or the name of a variable that holds a string),
# then comes a period followed by the method name and
# parentheses in whihc arguments are listed.
# Here's a list of common string methods of that kind:
# = str.replace(old, new, count) replaces all
# occurrences of the old string with the new one. The
# count parameter is optional, and if specified, only
# the first count occurrences are replaced in the given
# string.
# - str.upper() converts all characters of the string to
# upper case.
# - str.lower() converts all characters of the string to
# lower case.
# - str.title() converts the first character of each word
# to upper case.
# - str.swapcase() converts upper case to lower case
# and vice versa.
# - str.capitalize() changes the first character of the
# string to title case and the rest to lower case.
# And here's an example of how these methods are used
# (note that we don't save the result of every method):
message = "bonjour and welcome to Paris!"
print(message.upper()) # BONJOUR AND WELCOME TO PARIS!
# 'message' is not changed
print(message) # bonjour and welcoem to Paris!
title_message = message.title()
# 'title_message' contains a new string with all words capitalized
print(title_message) # Bonjour And Welcome To Paris!
print(message.replace("Paris", "Lyon")) # bonjour and welcome to Lyon!
replace_message = message.replace("o", "!", 2)
print(replace_message) # b!nj!ur and welcome to Par!s!
# again, the sounce string is unchanged, only its copy is modified
print(message) # bonjour and welcome to Paris!
# 2. "Editing" a string
# Often, when you read a string from somewhere (a file or
# the input) you need to edit it so that it contains only the
# information you need. For instance, the input string can
# have a lot of unnecessary whitespaces or some trailing
# combinations of characters. The "editing" methods that can
# help with that are strip(), rstrip(), and lstrip().
# - str.lstrip([chars]) removes the leading character
# (i.e. characters from the left side). If the argument
# chars isn't specified, leading whitespaces are
# removed.
# - str.rstrip([chars]) removes the trailing characters
# (i.e. characters from the right side). The default for
# the argument chars is also whitespace.
# - str.strip([chars]) removes both the leading and
# the trailing characters. The default is whitespace.
# The chars argument, when specified, is a string of
# characters that are meant to be removed from the very end
# or beginning of the work (depending on the method you're
# using). See how it works:
whitespace_string = " hey "
normal_string = "incomprehensibilities"
# delete spaces from the left side
whitespace_string.lstrip() # "hey "
# delete all "i" and "s" from the left side
normal_string.lstrip("is") # "ncomprehensibilities"
# delete spaces from the right side
whitespace_string.rstrip() # " hey"
# delete all "i" and "s" from the right side
normal_string.rstrip("is") # "incomprehensibilitie"
# no spaces from the both sides
whitespace_string.strip() # "hey"
# delete all trailing "i" and "s" from the both sides
normal_string.strip("is") # "ncomprehensibilitie"
# Keep in mind that the methods strip(), lstrip() and
# rstrip() get rid of all possible combinations of specified
# characters:
word = "Mississippi"
# starting from the right side, all "i", "p", and "s" are removed:
print(word.rstrip("ips")) # "M"
# the word starts with "M" rather than "i", "p", "s", so no chars are removed from the left side:
print(word.lstrip("ips")) # "Mississippi"
# "M", "i", "p", and "s" are removed from both sides, so nothing is left:
print(word.strip("Mips")) # ""
# Use them carefully, or you may end up with an empty
# string.
# 3. Summary
# To sum up, we have considered the main methods for
# strings. Here is a breif recap:
# - While working with strings, you have to remember
# that strings are immutable, thus all the methods that "change"
# them only return the copy of a string with necessary
# changes.
# - If you want to save the result of a method call for later
# use, you need to assign this result to a variable (either the
# same or the one with a different name).
# - If you want to use this result only once, for example, in
# comparison or just to print the formatted string, you ware
# free to use the result on the spot, as we did within
# print().
| message = 'bonjour and welcome to Paris!'
print(message.upper())
print(message)
title_message = message.title()
print(title_message)
print(message.replace('Paris', 'Lyon'))
replace_message = message.replace('o', '!', 2)
print(replace_message)
print(message)
whitespace_string = ' hey '
normal_string = 'incomprehensibilities'
whitespace_string.lstrip()
normal_string.lstrip('is')
whitespace_string.rstrip()
normal_string.rstrip('is')
whitespace_string.strip()
normal_string.strip('is')
word = 'Mississippi'
print(word.rstrip('ips'))
print(word.lstrip('ips'))
print(word.strip('Mips')) |
class CircularDependency(Exception):
pass
class UnparsedExpressions(Exception):
pass
class UnknownFilter(Exception):
pass
class FilterError(Exception):
pass
| class Circulardependency(Exception):
pass
class Unparsedexpressions(Exception):
pass
class Unknownfilter(Exception):
pass
class Filtererror(Exception):
pass |
#!/usr/bin/env python
data = [i for i in open('day03.input').readlines()]
fabric = [[0]*1000 for i in range(1000)]
def get_x_y_w_h(line):
_, _, coord, dim = line.split()
x, y = map(int, coord[:-1].split(','))
w, h = map(int, dim.split('x'))
return x, y, w, h
for line in data:
x, y, w, h = get_x_y_w_h(line)
for row in range(h):
for col in range(w):
fabric[y+row][x+col] += 1
# part 1
overlap = 0
for strip in fabric:
for inch in strip:
if int(inch) >= 2:
overlap += 1
print(overlap)
# part 2
for line in data:
x, y, w, h = get_x_y_w_h(line)
failed = False
for row in range(h):
for col in range(w):
try:
if fabric[y+row][x+col] != 1:
failed = True
except IndexError:
failed = True
if not failed:
print(line.split()[0])
| data = [i for i in open('day03.input').readlines()]
fabric = [[0] * 1000 for i in range(1000)]
def get_x_y_w_h(line):
(_, _, coord, dim) = line.split()
(x, y) = map(int, coord[:-1].split(','))
(w, h) = map(int, dim.split('x'))
return (x, y, w, h)
for line in data:
(x, y, w, h) = get_x_y_w_h(line)
for row in range(h):
for col in range(w):
fabric[y + row][x + col] += 1
overlap = 0
for strip in fabric:
for inch in strip:
if int(inch) >= 2:
overlap += 1
print(overlap)
for line in data:
(x, y, w, h) = get_x_y_w_h(line)
failed = False
for row in range(h):
for col in range(w):
try:
if fabric[y + row][x + col] != 1:
failed = True
except IndexError:
failed = True
if not failed:
print(line.split()[0]) |
try:
hours = int(input("enter hours :"))
rate=int(input("enter rate :"))
pay = int(hours * rate)
print("pay")
except:
print("Error, enter numeric input!") | try:
hours = int(input('enter hours :'))
rate = int(input('enter rate :'))
pay = int(hours * rate)
print('pay')
except:
print('Error, enter numeric input!') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.