content
stringlengths 7
1.05M
|
|---|
N = int(input())
C = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 18
a = INF
i, j = 0, 0
for y in range(N):
for x in range(N):
if C[y][x] >= a:
continue
i, j = y, x
a = C[y][x]
def f(z):
A = [INF] * N
B = [INF] * N
A[i] = z
for x in range(N):
B[x] = C[i][x] - z
for y in range(N):
A[y] = C[y][0] - B[0]
for y in range(N):
for x in range(N):
if C[y][x] != A[y] + B[x]:
return None
return A, B
for z in range(max(0, a // 2 - 10), min(a // 2 + 10, a + 1)):
result = f(z)
if result is None:
continue
print('Yes')
print(*result[0])
print(*result[1])
break
else:
print('No')
|
{
"targets": [
{
"target_name": "lzh",
"sources": [ "src/binding.cc", "src/lzh.c" ],
"include_dirs": [
"<!(node -e \"require('nan')\")",
"<!(node -e \"require('cpp-debug')\")"
]
}
]
}
|
class TP_Texts:
# __init__()
init_error1 = "Start and End must be of type datetime.datetime!"
init_error2 = "End must be larger than start!"
# start()
start_error1 = "Time must be of type datetime.datetime!"
start_error2 = "start must be smaller than end of Time_Period!"
# end()
end_error1 = "end must be larger than start of TimePeriod!"
# general
general_error1 = "'another' must be of type datetime.datetime or sptemp.zeit.Time_Period!"
general_error2 = "'another' must be of type sptemp.zeit.Time_Period!"
class TS_Texts:
# __init__()
init_error1 = "ts must be of type datetime.datetime or sptemp.zeit.Time_Period!"
# value()
v_error1 = "value must be of same type as old value of the TS_Object!"
class Unit_Texts:
# __init__()
init_error1 = "value must be of type 'types.FunctionType'!"
init_error2 = "ts must be of type sptemp.zeit.Time_Period!"
#interpolate()
i_error1 = "start_ts AND end_ts must be of type sptemp.zeit.TS_Object!"
i_error2 = "Time must be of type datetime.datetime!"
i_error3 = "start_ts.end_time() must be included in self.ts!"
#i_error4 = "end_ts.start_time() must be included in self.ts!"
i_error5 = "time must be included in self.ts!"
class IP_Texts:
# __init__()
init_error1 = "Empty instantiation not possible!"
init_error2 = "ts_unit_list must be list holding objects of type sptemp.zeit.TS_Unit!"
init_error3 = "TS_Unit elements of ts_unit_list must be time-sorted and end_times of units must equal start_times of next unit!"
# setitem()
set_error1 = "Index must be of type integer! Slices not allowed"
set_error2 = "Value must be of type TS_Unit!"
set_error3 = "Index out of range!"
set_error4 = "Value must cover same time_period as the value it replaces!"
# delitem()
del_error1 = "Only first and last item can be deleted!"
del_error2 = "Interpolator object cannot be empty!"
# interpolate()
ip_error1 = "start_ts and end_ts must be of type sptemp.zeit.TS_Object!"
ip_error2 = "time must be of type datetime.datetime!"
ip_error3 = "start_ts.end_time() must be >= self.start_time()!"
ip_error4 = "time must be >= start_ts.end_time() and <= end_ts.start_time()!"
ip_error5 = "time must be >= self.start_time() and <= self.end_time()!"
ip_error6 = "start_ts.end_time() must be < end_ts.start_time()!"
# value()
val_error1 = "time must be of type datetime.datetime!"
# value()
slice_error1 = "time must be of type sptemp.zeit.Time_Period!"
slice_error2 = "slice produces empty Interpolator. Either time.start or time.end must be contained in timespan of Interpolator!"
# append()
app_error1 = "Value must be of type sptemp.zeit.TS_Unit!"
app_error2 = "Value.start_time() must equal Interpolator.end_time()"
# insert()
in_error1 = "Value must be of type sptemp.zeit.TS_Unit!"
in_error2 = "Either value.start_time() or value.end_time() must be >= Interpolator.start_time() and <= Interpolator.end_time()!"
# delete()
delete_error1 = "time must be of type sptemp.zeit.Time_Period!"
delete_error2 = "Interpolator object cannot be empty!"
delete_error3 = "Invalid time. Time must overlap Interpolator.start_time() or Interpolator.end_time()!"
class MO_Texts:
# init()
init_error1 = "Empty instantiation not possible!"
init_error2 = "ts_object_list must be list holding objects of type sptemp.zeit.TS_Object!"
init_error3 = "interpolator must be of type sptemp.zeit.Interpolator!"
init_error4 = "TS_Objects must have same type!"
init_error5 = "ts_object_list must be time-sorted and TS_Objects must be disjoint!"
# setitem()
set_error1 = "Index must be of type integer! Slices not allowed"
set_error2 = "Value must be of type TS_Object!"
set_error3 = "Value.type must be equal to self.type!"
set_error4 = "Index out of range!"
set_error5 = "Value and existing TS_Objects in Moving_Object are not disjoint!"
# delitem()
del_error1 = "key must be of type interger or slice!"
del_error2 = "Moving_Object cannot become empty!"
# interpolate()
i_error1 = "time must be of type datetime.datetime!"
i_error2 = "time must be >= self.start_time() and <= self.end_time()!"
i_error3 = "Interpolator must return TSO_object with same type as self.type!"
# slice()
slice_error1 = "Time must be of type sptemp.zeit.Time_Period!"
slice_error2 = "interpolator must be of type sptemp.zeit.Interpolator!"
slice_error3 = "Slice is empty!"
# resampled_slice()
re_slice_error1 = "Times must be of type slice!"
re_slice_error2 = "Lenght of times must be > 1!"
re_slice_error3 = "interpolator must be of type sptemp.zeit.Interpolator!"
# prev_ts()
prev_error1 = "Time must be of type datetime.datetime!"
# append()
app_error1 = "Value must be of type spetemp.zeit.TS_Object!"
app_error2 = "Value.start_time() must be > Moving_Object.end_time()"
# insert()
in_error1 = "Value must be of type spetemp.zeit.TS_Object!"
in_error2 = "Value.ts and timestamps of esisting TS_Objects in Moving_Object must be disjoint!"
in_error3 = "Value.type must be equal to self.type!"
# delete()
delete_error1 = "Time must be of type sptemp.zeit.Time_Period!"
delete_error2 = "Moving_Object cannot become empty!"
class TS_Geometry_Texts:
# __init__():
init_error1 = "Value must be of type shapely.geometry!"
init_error2 = "Value must not be empty!"
init_error3 = "crs must be of type pyproj.Proj!"
# value()
v_error1 = "value must be equal to self.type!"
v_error2 = "self.has_z and value.has_z must be equal!"
# reproject()
r_error1 = "TS_Geometry has no coordinate reference system!"
r_error2 = "to_crs must be of type pyproj.Proj!"
class TS_Point_Texts:
# __init__():
init_error1 = "Value must be of type shapely.geometry.Point!"
init_error2 = "Point must not be empty!"
init_error3 = "crs must be of type pyproj.Proj!"
# value()
v_error1 = "value must be of type shapey.geometry.Point!"
v_error2 = "self.has_z and value.has_z must be equal!"
# reproject()
r_error1 = "TS_Point has no coordinate reference system!"
r_error2 = "to_crs must be of type pyproj.Proj!"
class MG_Texts:
# within
w_error1 = "another must be of type shapely.geometry or TS_Geometry or Moving_Geometry or Moving_Collection!"
w_error2 = "timedelta must be positive!"
w_error3 = "td1 must be larger or equal to td2!"
class MP_Texts:
# __init__()
init_error1 = "ts_objects_list can only elements of type sptemp.moving_geometry.TS_Points!"
init_error2 = "coordinate reference system of all TS_Points in ts_object_list must be equal!"
init_error3 = "TS_Point.has_z must be equal for all TS_Points in ts_object_list!"
# __setitem__()
set_error1 = "value must be of type sptemp.moving_geometry.TS_Point!"
# __append__()
app_error1 = "value must be of type sptemp.moving_geometry.TS_Point!"
# insert()
in_error1 = "value must be of type sptemp.moving_geometry.TS_Point!"
# reproject()
re_error1 = "Moving_Object has no coorinate reference system!"
class TS_LineString_Texts:
# __init__():
init_error1 = "Value must be of type shapely.geometry.LineString!"
init_error2 = "LineString must not be empty!"
init_error3 = "crs must be of type pyproj.Proj!"
# value()
v_error1 = "value must be of type shapey.geometry.LineString!"
v_error2 = "self.has_z and value.has_z must be equal!"
# reproject()
r_error1 = "TS_LineString has no coordinate reference system!"
r_error2 = "to_crs must be of type pyproj.Proj!"
class ML_Texts:
# __init__()
init_error1 = "ts_objects_list can only elements of type sptemp.moving_geometry.TS_LineString!"
init_error2 = "coordinate reference system of all TS_LineStrings in ts_object_list must be equal!"
init_error3 = "TS_LineSTring.has_z must be equal for all TS_LineStrings in ts_object_list!"
# __setitem__()
set_error1 = "value must be of type sptemp.moving_geometry.TS_LineString!"
# __append__()
app_error1 = "value must be of type sptemp.moving_geometry.TS_LineString!"
# insert()
in_error1 = "value must be of type sptemp.moving_geometry.TS_LineString!"
# reproject()
re_error1 = "Moving_Object has no coordinate reference system!"
class TS_LinearRing_Texts:
# __init__():
init_error1 = "Value must be of type shapely.geometry.LinearRing!"
class MLR_Texts:
# __init__()
init_error1 = "ts_objects_list can only elements of type sptemp.moving_geometry.TS_LinearRing!"
init_error2 = "coordinate reference system of all TS_LinearRings in ts_object_list must be equal!"
init_error3 = "TS_LinearRing.has_z must be equal for all TS_LinearRings in ts_object_list!"
# __setitem__()
set_error1 = "value must be of type sptemp.moving_geometry.TS_LinearRing!"
# __append__()
app_error1 = "value must be of type sptemp.moving_geometry.TS_LinearRing!"
# insert()
in_error1 = "value must be of type sptemp.moving_geometry.TS_LinearRing!"
class MC_Texts:
# __init__()
init_error1 = "moving_list cannot be empty!"
init_error2 = "moving_list must be of type list!"
init_error3 = "moving_list can only contain values of type Moving_Point, Moving_LineString and Moving_Polygon!"
# interpolate()
ip_error1 = "time must be of type datetime.datetime!"
ip_error2 = "args_dict must be of type dict!"
# slice()
slice_error1 = "time must be type sptemp.zeit.TimePeriod!"
slice_error2 = "interpolator_dict must be of type dict!"
# resampled_slice()
re_slice_error1 = "Times must be of type slice!"
re_slice_error2 = "Lenght of times must be > 1!"
re_slice_error3 = "interpolator must be of type dict!"
class MPL_Texts:
# __init__()
init_error1 = "exterior ring must be of type sptemp.moving_geometry.Moving_LinearRing!"
init_error2 = "interior rings must be of type list!"
init_error3 = "interior ring must be of type sptemp.moving_geometry.Moving_LinearRing!"
# interpolate()
ip_error1 = "time must be of type datetime.datetime!"
ip_error2 = "args_dict must be of type dict!"
# slice()
slice_error1 = "time must be of type sptemp.zeit.Time_Period!"
slice_error2 = "interpolator_dict must be of type dict!"
class MMP_Texts:
# __init__()
init_error1 = "moving_list cannot be empty!"
init_error2 = "moving_list must be of type list!"
init_error3 = "moving_list can only contain values of type Moving_Point!"
class MML_Texts:
# __init__()
init_error1 = "moving_list cannot be empty!"
init_error2 = "moving_list must be of type list!"
init_error3 = "moving_list can only contain values of type Moving_LineString!"
class MMPL_Texts:
# __init__()
init_error1 = "moving_list cannot be empty!"
init_error2 = "moving_list must be of type list!"
init_error3 = "moving_list can only contain values of type Moving_Polygon!"
# slice()
slice_error1 = "time must be type sptemp.zeit.TimePeriod!"
slice_error2 = "interpolator_dict must be of type dict!"
class MG_Helper_Texts:
# has_z_equal()
hz_error1 = "has_z and has_z must be consistent!"
# crs_equal()
crs_error1 = "crs must be consistent!"
class IC_Texts:
# linear()
error1 = "start_ts AND end_ts must be of type sptemp.zeit.TS_Object!"
error2 = "Time must be of type datetime.datetime!"
error3 = "start_ts.type must be equal to end_ts.type"
error4 = "start_ts must lay before end_ts on the time_axis"
class IPoint_Texts:
# linear_point()
lp_error1 = "start_ts and end_ts must be of type sptemp.moving_geometry.TS_Point!"
lp_error2 = "time must be of type datetime.datetime!"
lp_error3 = "start_ts.has_z must be equal to end_ts.has_z!"
lp_error4 = "start_ts must lay before end_ts on the time_axis!"
lp_error5 = "time must be >= start_ts.end_time() and <= end_ts.start_time()!"
lp_error6 = "start_ts.crs must be equal to end_ts.crs!"
# curve_point()
c_error1 = "start_ts and end_ts must be of type sptemp.moving_geometry.TS_Point!"
c_error2 = "time must be of type datetime.datetime!"
c_error3 = "curve must be of type shpely.geometry.LineString!"
c_error4 = "start_ts.has_z, end_ts.has_z and curve.has_z must be equal!"
c_error5 = "start_ts.crs must be equal to end_ts.crs!"
c_error6 = "start_ts must lay before end_ts on the time_axis"
c_error7 = "time must be >= start_ts.end_time() and <= end_ts.start_time()!"
c_error8 = "start_ts.value must be equal to start point of curve and end_ts.value must be equal to end point of curve!"
class ICurve_Texts:
# basic_linear()
bl_error1 = "start_ts and end_ts must be of type sptemp.moving_geometry.TS_LineString!"
bl_error2 = "time must be of type datetime.datetime!"
bl_error3 = "start_ts.has_z and end_ts.has_z must be equal!"
bl_error4 = "start_ts.crs must be equal to end_ts.crs!"
bl_error5 = "start_ts must lay before end_ts on the time_axis"
bl_error6 = "time must be >= start_ts.end_time() and <= end_ts.start_time()!"
bl_error7 = "s_type must be in ['angle', 'distance']!"
class IRing_Texts:
# linear_translation()
lt_error1 = "start_ts and end_ts must be of type sptemp.moving_geometry.TS_LinearRing!"
lt_error2 = "time must be of type datetime.datetime!"
lt_error3 = "start_ts.has_z and end_ts.has_z must be equal!"
lt_error4 = "start_ts.crs must be equal to end_ts.crs!"
lt_error5 = "start_ts must lay before end_ts on the time_axis"
lt_error6 = "time must be >= start_ts.end_time() and <= end_ts.start_time()!"
lt_error7 = "s_type must be in ['angle', 'distance']!"
class IHelper_Texts:
# linear_point()
lp_error1 = "invalid coordinate dimensions!"
# angle()
ang_error1 = "invalid coordinate dimensions!"
class SPT_Texts:
# __init__()
init_error1 = "dataframe must be of type pandas.DataFrame!"
init_error2 = "Geometry column must have name 'geometry'!"
#init_error3 = "empty instantiation not possible!"
init_error4 = "crs must be of type pyproj.Proj!"
init_error5 = "Geometry type must be shapely.geometry or Moving_Point, Moving_LineString, Moving_LinearRing or Moving_Collection!"
# interpolate
ip_error1 = "time must be of type datetime.datetime!"
ip_error2 = "args must be stored in dict for Moving_Collections and in list for Moving_Objects!"
# slice
slice_error1 = "time must be of type sptemp.zeit.Time_Period!"
# reproject
re_error1 = "If geometry column holds values of type shapely.geometry SPT_DataFrame.crs has to be set for reprojection!"
re_error2 = "to_crs must be of type pyproj.Proj!"
# read_from_json
rj_error1 = "File does not exist!"
rj_error2 = "interpolator_dict must of type dict!"
rj_error3 = "For empty instantiation, column_names must be defined!"
|
help(input)
print(input.__doc__)
def contador(i, f, p):
"""
-> Faz uma contagem e mostra na tela
:param i: início da contagem
:param f: fim da contagem
:param p: passo da contagem
:return: sem retorno
"""
# Doc_string
c = i
while c <= f:
print(f'{c} ', end='')
c += p
print('FIM!')
help(contador)
def soma(a=0, b=0, c=0):
# Parâmetros Opcionais
s = a + b + c
print(f'A soma vale {s}')
soma(3, 2, 5)
soma(8, 4)
soma()
def teste():
x = 8 # Variável Local
print(f'Na função teste, n vale {n}')
print(f'Na função teste, x val {x}')
n = 2 # Variável Global
print(f'No programa principal, n vale {n}')
teste()
print(f'No programa principal, x vale {x}')
def funcao():
n1 = 4
print(f'N1 dentro vale {n1}')
n1 = 2
funcao()
print(f'N1 global vale {n1}')
def teste(b):
global a
a = 8
b += 4
c = 2
print(f'A dentro vale {a}')
print(f'B dentro vale {b}')
print(f'C dentro vale {c}')
a = 5
teste(a)
print(f'A fora vale {a}')
def soma(a=0, b=0, c=0):
s = a + b + c
return s
r1 = soma(3, 2, 5)
r2 = soma(2, 2)
r3 = soma(6)
print(f'Os resultados foram {r1}, {r2} e {r3}')
def fatorial(num=1):
f = 1
for c in range(num, 0, -1):
f *= c
return f
f1 = fatorial(5)
f2 = fatorial(4)
f3 = fatorial()
print(f'Os resultados são {f1}, {f2} e {f3}')
def par(n=0):
if n % 2 == 0:
return True
else:
return False
num = int(input('Digite um número: '))
if par(num):
print('É par!')
else:
print('Não é par!')
|
#
# PySNMP MIB module CISCO-OTV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-OTV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:09:07 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
Cisco2KVlanList, = mibBuilder.importSymbols("CISCO-TC", "Cisco2KVlanList")
InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero")
InetAddress, InetAddressType, InetAddressPrefixLength = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType", "InetAddressPrefixLength")
VlanIndex, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "VlanIndex")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup")
Bits, IpAddress, Unsigned32, ModuleIdentity, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, TimeTicks, Gauge32, ObjectIdentity, NotificationType, Counter64, iso, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "IpAddress", "Unsigned32", "ModuleIdentity", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "TimeTicks", "Gauge32", "ObjectIdentity", "NotificationType", "Counter64", "iso", "MibIdentifier")
TextualConvention, RowStatus, DisplayString, MacAddress, TruthValue, StorageType = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "DisplayString", "MacAddress", "TruthValue", "StorageType")
ciscoOtvMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 810))
ciscoOtvMIB.setRevisions(('2013-08-05 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ciscoOtvMIB.setRevisionsDescriptions(('Initial version of this MIB module.',))
if mibBuilder.loadTexts: ciscoOtvMIB.setLastUpdated('201308050000Z')
if mibBuilder.loadTexts: ciscoOtvMIB.setOrganization('Cisco Systems, Inc.')
if mibBuilder.loadTexts: ciscoOtvMIB.setContactInfo('Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-snmp@cisco.com')
if mibBuilder.loadTexts: ciscoOtvMIB.setDescription("This MIB module is for configuration & statistic query of Overlay Transport Virtualization (OTV) functionality on Cisco routers and switches. Overlay Transport Virtualization is a Cisco's innovative LAN extension technology. It is an IP-based functionality that provides Layer 2 extension capabilities over any transport infrastructure: Layer 2 based, Layer 3 based, IP switched, label switched, and so on. OTV provides an overlay that enables Layer 2 connectivity between separate Layer 2 domains while keeping these domains independent and preserving the fault- isolation, resiliency, and load-balancing benefits of an IP- based interconnection. OTV introduces the concept of MAC routing, which means a control plane protocol is used to exchange MAC reachability information between network devices providing LAN extension functionality. This is a significant shift from Layer 2 switching that traditionally leverages data plane learning, and it is justified by the need to limit flooding of Layer 2 traffic across the transport infrastructure. OTV also introduces the concept of dynamic encapsulation for Layer 2 flows that need to be sent to remote locations. Each Ethernet frame is individually encapsulated into an IP packet and delivered across the transport network. Finally, OTV provides a native built-in multi-homing capability with automatic detection, critical to increasing high availability of the overall solution. Two or more devices can be leveraged in each data center to provide LAN extension functionality without running the risk of creating an end-to-end loop that would jeopardize the overall stability of the design. The followings detail the OTV specific terminology: Edge Device The edge device performs OTV functions: it receives the Layer 2 traffic for all VLANs that need to be extended to remote locations and dynamically encapsulates the Ethernet frames into IP packets that are then sent across the transport infrastructure. Internal Interfaces To perform OTV functionality, the edge device must receive the Layer 2 traffic for all VLANs that need to be extended to remote locations. The Layer 2 interfaces, where the Layer 2 traffic is usually received, are named internal interfaces. Join Interface The Join interface is used to source the OTV encapsulated traffic and send it to the Layer 3 domain of the data center network. Overlay Interface The Overlay interface is a logical multi-access and multicast- capable interface that must be explicitly defined by the user and where the entire OTV configuration is applied. The following terms are used throughout this MIB: AED Authoritative Edge Device ARP Address Resolution Protocol DNS Domain Name System ISIS Intermediate System to Intermediate System Routing Protocol LSPDB Link State PDU Database OTV Overlay Transport Virtualization VLAN Virtual Local Area Network VPN Virtual Private Network")
ciscoOtvMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 0))
ciscoOtvMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1))
ciscoOtvMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 2))
cotvGlobalObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1))
cotvOverlayObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2))
cotvAdjacencyObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3))
cotvArpNdObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4))
cotvRouteObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5))
cotvSiteObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1, 1))
cotvGlobalStatsObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1, 2))
cotvSiteIdAdmin = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1, 1, 1), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(6, 6), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cotvSiteIdAdmin.setStatus('current')
if mibBuilder.loadTexts: cotvSiteIdAdmin.setDescription('This object specifies OTV site identifier for this device. The OTV site identifier could be either a four octets value or a six octets valid MAC address. If the OTV site identifier is not configured, this object will have four zero octets.')
cotvSiteIdOper = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvSiteIdOper.setStatus('current')
if mibBuilder.loadTexts: cotvSiteIdOper.setDescription('This object indicates OTV site identifier in use for this device. There is no operational OTV site identifier if the value of this object contains all zeros.')
cotvSiteVlan = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1, 1, 3), VlanIndex()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cotvSiteVlan.setStatus('current')
if mibBuilder.loadTexts: cotvSiteVlan.setDescription('This object specifies the OTV site VLAN for this device.')
cotvSiteVlanState = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvSiteVlanState.setStatus('current')
if mibBuilder.loadTexts: cotvSiteVlanState.setDescription("This object indicates the state of OTV site VLAN. 'up' - OTV site VLAN is up 'down' - OTV site VLAN is down")
cotvOverlayTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1), )
if mibBuilder.loadTexts: cotvOverlayTable.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayTable.setDescription('A list of Overlay interfaces configured on this device.')
cotvOverlayEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvOverlayNumber"))
if mibBuilder.loadTexts: cotvOverlayEntry.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayEntry.setDescription('An entry containing management information for a particular Overlay interface.')
cotvOverlayNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: cotvOverlayNumber.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayNumber.setDescription('A unique number to identify an Overlay interface.')
cotvOverlayVpnName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 2), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvOverlayVpnName.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayVpnName.setDescription('This object indicates the name of the Virtual Private Network associated with this Overlay interface.')
cotvOverlayVpnState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("other", 0), ("down", 1), ("up", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvOverlayVpnState.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayVpnState.setDescription("This object indicates the state of Virtual Private Network which is associated with this Overlay interface. 'other' - Any other state not covered by below enumerations. 'up' - The Overlay Virtual Private Network is up 'down' - The Overlay Virtual Private Network is down")
cotvOverlayVpnDownReason = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19))).clone(namedValues=NamedValues(("other", 0), ("configChange", 1), ("missingControlGroup", 2), ("missingDataGroupRange", 3), ("missingJoinOrSourceInterface", 4), ("missingVpnName", 5), ("missingJoinInterfaceAddr", 6), ("joinInterfaceDown", 7), ("adminDown", 8), ("deleteHoldDown", 9), ("reinit", 10), ("missingSiteId", 11), ("siteIdMismatch", 12), ("missingSourceInterfaceAddr", 13), ("sourceInterfaceDown", 14), ("changingSiteId", 15), ("changingControlGroup", 16), ("missingDeviceId", 17), ("changingDeviceId", 18), ("cleanupInProgress", 19)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvOverlayVpnDownReason.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayVpnDownReason.setDescription("This object indicates the reason why this Overlay Virtual Private Network is down. 'other' - Any other reason not covered by below enumerations 'configChange' - Configuration changed 'missingControlGroup' - Control Group information is unavailable 'missingDataGroupRange' - Data Group range information is unavailable 'misssingJoinOrSourceInterface' - Join or Source interface information is unavailable 'missingVpnName' - VPN name is unavailable 'missingJoinInterfaceAddr' - IP address is missing for Join Interface 'joinInterfaceDown' - Join Interface is down 'adminDown' - Overlay is administratively shutdown 'deleteHoldDown' - Overlay is in delete hold down phase 'reinit' - VPN is reinitializing 'missingSiteId' - Site ID information is unavailable 'siteIdMismatch' - Site ID mismatch has occurred 'missingSourceInterfaceAddr' - IP address is missing for Source Interface 'sourceInterfaceDown' - Source interface is down 'changingSiteId' - Changing site identifier 'changingControlGroup' - Changing control group 'missingDeviceId' - Device ID information is unavailable 'changingDeviceId' - Changing device ID 'cleanupInProgress' - Cleanup in progress")
cotvOverlayVlansExtendedFirst2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 5), Cisco2KVlanList()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayVlansExtendedFirst2k.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayVlansExtendedFirst2k.setDescription('This object specifies the list of VLANs extended on this Overlay interface. It is a string of octets containing one bit per VLAN with VlanIndex values of 0 through 2047. If the bit corresponding to a VLAN is set to 1, it indicates that VLAN is being extended on this Overlay interface. If the bit corresponding to a VLAN is set to 0, it indicates that VLAN is not being extended on this Overlay interface.')
cotvOverlayVlansExtendedSecond2k = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 6), Cisco2KVlanList()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayVlansExtendedSecond2k.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayVlansExtendedSecond2k.setDescription('This object specifies the list of VLANs extended on this Overlay interface. It is a string of octets containing one bit per VLAN with VlanIndex values of 2048 through 4095. If the bit corresponding to a VLAN is set to 1, it indicates that VLAN is being extended on this Overlay interface. If the bit corresponding to a VLAN is set to 0, it indicates that VLAN is not being extended on this Overlay interface.')
cotvOverlayControlGroupAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 7), InetAddressType().clone('unknown')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayControlGroupAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayControlGroupAddrType.setDescription('This object specifies the type of Internet address of Control Group.')
cotvOverlayControlGroupAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 8), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayControlGroupAddr.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayControlGroupAddr.setDescription('This object specifies the Internet address of Control Group. The type of this address is determined by cotvOverlayControlGroupAddrType.')
cotvOverlayBroadcastGroupAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 9), InetAddressType().clone('unknown')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayBroadcastGroupAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayBroadcastGroupAddrType.setDescription('This object specifies the type of Internet address to be used as Broadcast Group Address.')
cotvOverlayBroadcastGroupAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 10), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayBroadcastGroupAddr.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayBroadcastGroupAddr.setDescription('This object specifies the Internet address to be used as Broadcast Group Address. The type of this address is determined by cotvOverlayBroadcastGroupAddrType.')
cotvOverlayJoinInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 11), InterfaceIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayJoinInterface.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayJoinInterface.setDescription('This object specifies the OTV Join Interface for this Overlay interface.')
cotvOverlaySourceInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 12), InterfaceIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlaySourceInterface.setStatus('current')
if mibBuilder.loadTexts: cotvOverlaySourceInterface.setDescription('This object specifies the Source Interface for this Overlay interface.')
cotvOverlayAedCapable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 13), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvOverlayAedCapable.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayAedCapable.setDescription("This object indicates AED (Authoritative Edge Device) capability on this Overlay interface. A value of 'true' indicates that the edge device has capability to act as an AED on this Overlay interface. A value of 'false' indicates that the edge device does not have the capability to act as an AED on this Overlay interface.")
cotvOverlayAedIncapableReason = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("other", 0), ("overlayDown", 1), ("siteIdNotConfigured", 2), ("siteIdMismatch", 3), ("versionMismatch", 4), ("siteVlanDown", 5), ("noExtendedVlanUp", 6), ("noOverlayAdjacencyUp", 7), ("lspdbSyncIncomplete", 8), ("overlayDownInProgress", 9), ("isisControlGroupSyncPending", 10)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvOverlayAedIncapableReason.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayAedIncapableReason.setDescription("This object indicates the reason why the overlay is AED-incapable. 'other' - Any other reason not covered by below enumerations 'overlayDown' - Overlay is Down 'siteIdNotConfigured' - Site ID is not configured 'siteIdMismatch' - Site ID mismatch 'versionMismatch' - Version mismatch 'siteVlanDown' - Site VLAN is Down 'noExtendedVlanUp' - No extended VLAN is operationally up 'noOverlayAdjacencyUp' - No Overlay Adjacency is up 'lspdbSyncIncomplete' - LSPDB sync incomplete 'overlayDownInProgress' - Overlay state down event in progress 'isisControlGroupSyncPending' - ISIS control group sync pending")
cotvOverlayAdjServerTransportType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("multicastAndUnicast", 1), ("unicastOnly", 2))).clone('multicastAndUnicast')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayAdjServerTransportType.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayAdjServerTransportType.setDescription("The type of transport OTV control plane can use to exchange Adjacency Server information. 'multicastAndUnicast' - OTV control plane can use both multicast and unicast to exchange Adjacency Server information 'unicastOnly' - OTV control plane can use only unicast to exchange Adjacency Server information. Value of this object can be set to 'unicastOnly' only if the value of cotvOverlayPrimaryAdjServerAddrType is 'unknown'.")
cotvOverlayAdjServerEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 16), TruthValue().clone('false')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayAdjServerEnable.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayAdjServerEnable.setDescription("This object specifies Adjacency Server functionality for this Overlay interface. Setting the object to 'true' enables Adjacency Server functionality. Setting the object to 'false' disables Adjacency Server functionality.")
cotvOverlayPrimaryAdjServerAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 17), InetAddressType().clone('unknown')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayPrimaryAdjServerAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayPrimaryAdjServerAddrType.setDescription('This object specifies the type of Internet address of the Primary Adjacency Server for this Overlay interface.')
cotvOverlayPrimaryAdjServerAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 18), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayPrimaryAdjServerAddr.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayPrimaryAdjServerAddr.setDescription('This object specifies the Internet address of the Primary Adjacency Server for this Overlay interface. The type of this address is determined by the value of cotvOverlayPrimaryAdjServerAddrType.')
cotvOverlaySecondaryAdjServerAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 19), InetAddressType().clone('unknown')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlaySecondaryAdjServerAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvOverlaySecondaryAdjServerAddrType.setDescription('This object specifies the type of Internet address of the Secondary Adjacency Server for this Overlay interface.')
cotvOverlaySecondaryAdjServerAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 20), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlaySecondaryAdjServerAddr.setStatus('current')
if mibBuilder.loadTexts: cotvOverlaySecondaryAdjServerAddr.setDescription('This object specifies the Internet address of the Secondary Adjacency Server for this Overlay interface. The type of this address is determined by cotvOverlaySecondaryAdjServerAddrType.')
cotvOverlaySuppressArpND = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 21), TruthValue().clone('false')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlaySuppressArpND.setStatus('current')
if mibBuilder.loadTexts: cotvOverlaySuppressArpND.setDescription("This object specifies ARP Neighbor Discovery behavior on this Overlay interface. Setting the object to 'true' enables suppression of ARP Neighbor Discovery on this Overlay interface. Setting the object to 'false' disables suppression of ARP Neighbor Discovery on this Overlay interface.")
cotvOverlayStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 22), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayStorageType.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayStorageType.setDescription('This object specifies the storage type for this conceptual row.')
cotvOverlayRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 1, 1, 23), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvOverlayRowStatus.setStatus('current')
if mibBuilder.loadTexts: cotvOverlayRowStatus.setDescription('This object specifies the status of this conceptual row.')
cotvVlansTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2), )
if mibBuilder.loadTexts: cotvVlansTable.setStatus('current')
if mibBuilder.loadTexts: cotvVlansTable.setDescription('A list of VLANs extended on Overlay interfaces.')
cotvVlansEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvOverlayNumber"), (0, "CISCO-OTV-MIB", "cotvVlanId"))
if mibBuilder.loadTexts: cotvVlansEntry.setStatus('current')
if mibBuilder.loadTexts: cotvVlansEntry.setDescription('An entry containing management information for a particular VLAN extended on an Overlay interface.')
cotvVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1, 1), VlanIndex())
if mibBuilder.loadTexts: cotvVlanId.setStatus('current')
if mibBuilder.loadTexts: cotvVlanId.setDescription('This object indicates the VLAN ID of the extended VLAN.')
cotvVlanState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvVlanState.setStatus('current')
if mibBuilder.loadTexts: cotvVlanState.setDescription("This object indicates the state of the extended VLAN. 'active' - OTV is ready to forward traffic for this VLAN 'inactive' - OTV can not forward traffic for this VLAN")
cotvVlanInactiveReason = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("other", 1), ("nonAed", 2), ("vlanDisabled", 3), ("overlayDown", 4), ("deleteHoldDown", 5), ("hwDown", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvVlanInactiveReason.setStatus('current')
if mibBuilder.loadTexts: cotvVlanInactiveReason.setDescription("This object indicates the reason the VLAN is in 'inactive' state. 'other' - Any other reason not covered by the below enumerations 'nonAed' - Device is not an AED on this VLAN 'vlanDisabled' - Vlan is in disabled state 'overlayDown' - Overlay is currently down 'deleteHoldDown' - The VLAN is in delete hold-down state 'hwDown' - An issue with hardware is preventing VLAN from becoming 'active' Value of this object should be ignored if the value of cotvVlanInactiveReason is not 'inactive'.")
cotvVlanAedAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1, 4), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvVlanAedAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvVlanAedAddrType.setDescription('This object indicates the type of Internet address of Authoritative Edge Device (AED) on this VLAN.')
cotvVlanAedAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1, 5), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvVlanAedAddr.setStatus('current')
if mibBuilder.loadTexts: cotvVlanAedAddr.setDescription('This object indicates the Internet address of Authoritative Edge Device (AED) on this VLAN. The type of this address is determined by the value of cotvVlanAedAddrType.')
cotvVlanEdgeDevIsAed = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 2, 1, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvVlanEdgeDevIsAed.setStatus('current')
if mibBuilder.loadTexts: cotvVlanEdgeDevIsAed.setDescription("This object indicates if this device is acting as an AED for the VLAN. A value of 'true' indicates that this device is acting as an AED for the VLAN. A value of 'false' indicates that this device is not acting as an AED for the VLAN.")
cotvDataGroupConfigTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3), )
if mibBuilder.loadTexts: cotvDataGroupConfigTable.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupConfigTable.setDescription('A list of multicast data-group ranges configured for each Overlay interface.')
cotvDataGroupConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvOverlayNumber"), (0, "CISCO-OTV-MIB", "cotvDataGroupMcastRangeAddrType"), (0, "CISCO-OTV-MIB", "cotvDataGroupMcastRangeAddr"), (0, "CISCO-OTV-MIB", "cotvDataGroupMcastRangePrefixLength"))
if mibBuilder.loadTexts: cotvDataGroupConfigEntry.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupConfigEntry.setDescription('An entry containing management information for a particular multicast data-group range configured for an Overlay interface.')
cotvDataGroupMcastRangeAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3, 1, 1), InetAddressType())
if mibBuilder.loadTexts: cotvDataGroupMcastRangeAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupMcastRangeAddrType.setDescription('The type of Internet address of multicast data-group range.')
cotvDataGroupMcastRangeAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3, 1, 2), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvDataGroupMcastRangeAddr.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupMcastRangeAddr.setDescription('The Internet address of multicast data-group range. The type of this address is determined by the value of the cotvDataGroupMcastRangeAddrType object.')
cotvDataGroupMcastRangePrefixLength = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3, 1, 3), InetAddressPrefixLength())
if mibBuilder.loadTexts: cotvDataGroupMcastRangePrefixLength.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupMcastRangePrefixLength.setDescription('The length of the prefix associated with cotvDataGroupMcastRangeAddr. The type of this address prefix is determined by the value of the cotvDataGroupMcastRangeAddrType object.')
cotvDataGroupStorageType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3, 1, 4), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvDataGroupStorageType.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupStorageType.setDescription('This object specifies the storage type for this conceptual row.')
cotvDataGroupRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 3, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: cotvDataGroupRowStatus.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupRowStatus.setDescription('This object specifies the status of this conceptual row.')
cotvDataGroupInfoTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4), )
if mibBuilder.loadTexts: cotvDataGroupInfoTable.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupInfoTable.setDescription('A table listing management information for active multicast sources and multicast groups on each Overlay interface.')
cotvDataGroupInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvOverlayNumber"), (0, "CISCO-OTV-MIB", "cotvDataGroupActiveSrcLocation"), (0, "CISCO-OTV-MIB", "cotvDataGroupVlanId"), (0, "CISCO-OTV-MIB", "cotvDataGroupActiveGroupAddrType"), (0, "CISCO-OTV-MIB", "cotvDataGroupActiveGroupAddr"), (0, "CISCO-OTV-MIB", "cotvDataGroupActiveSrcAddrType"), (0, "CISCO-OTV-MIB", "cotvDataGroupActiveSrcAddr"), (0, "CISCO-OTV-MIB", "cotvDataGroupDeliveryGroupAddrType"), (0, "CISCO-OTV-MIB", "cotvDataGroupDeliveryGroupAddr"), (0, "CISCO-OTV-MIB", "cotvDataGroupDeliverySrcAddrType"), (0, "CISCO-OTV-MIB", "cotvDataGroupDeliverySrcAddr"))
if mibBuilder.loadTexts: cotvDataGroupInfoEntry.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupInfoEntry.setDescription('An entry containing management information for an active multicast data-group.')
cotvDataGroupActiveSrcLocation = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("local", 1), ("remote", 2))))
if mibBuilder.loadTexts: cotvDataGroupActiveSrcLocation.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupActiveSrcLocation.setDescription('The location of Active Multicast source.')
cotvDataGroupVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 2), VlanIndex())
if mibBuilder.loadTexts: cotvDataGroupVlanId.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupVlanId.setDescription('The VLAN associated with Active Multicast data-group.')
cotvDataGroupActiveGroupAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 3), InetAddressType())
if mibBuilder.loadTexts: cotvDataGroupActiveGroupAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupActiveGroupAddrType.setDescription('The type of Internet address of the active multicast group (multicast group of the active multicast source).')
cotvDataGroupActiveGroupAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 4), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvDataGroupActiveGroupAddr.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupActiveGroupAddr.setDescription('The Internet address of the active multicast group of the (multicast group of the active multicast source). The type of this address is determined by the value of cotvDataGroupActiveGroupAddrType.')
cotvDataGroupActiveSrcAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 5), InetAddressType())
if mibBuilder.loadTexts: cotvDataGroupActiveSrcAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupActiveSrcAddrType.setDescription('The type of Internet address of active multicast source.')
cotvDataGroupActiveSrcAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 6), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvDataGroupActiveSrcAddr.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupActiveSrcAddr.setDescription('The Internet address of active multicast source. The type of this address is determined by the value of cotvDataGroupActiveSrcAddrType.')
cotvDataGroupDeliveryGroupAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 7), InetAddressType())
if mibBuilder.loadTexts: cotvDataGroupDeliveryGroupAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupDeliveryGroupAddrType.setDescription('The type of Internet address of the delivery group that is mapped to active multicast group.')
cotvDataGroupDeliveryGroupAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 8), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvDataGroupDeliveryGroupAddr.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupDeliveryGroupAddr.setDescription('The Internet address of delivery group that is mapped to active multicast group. The type of this address is determined by cotvDataGroupDeliveryGroupAddrType.')
cotvDataGroupDeliverySrcAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 9), InetAddressType())
if mibBuilder.loadTexts: cotvDataGroupDeliverySrcAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupDeliverySrcAddrType.setDescription('The type of Internet address of the delivery source that is mapped to the active multicast source.')
cotvDataGroupDeliverySrcAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 10), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvDataGroupDeliverySrcAddr.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupDeliverySrcAddr.setDescription('The Internet address of the delivery source that is mapped to the active multicast source. The type of this address is determined by the value of cotvDataGroupDeliverySrcAddrType.')
cotvDataGroupJoinInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 11), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvDataGroupJoinInterface.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupJoinInterface.setDescription('This object indicates the OTV Join interface on which active multicast source is located.')
cotvDataGroupLocalActiveSrcState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 2, 4, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("local", 2), ("remote", 3), ("orphan", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvDataGroupLocalActiveSrcState.setStatus('current')
if mibBuilder.loadTexts: cotvDataGroupLocalActiveSrcState.setDescription("This object indicates the state of the local Active Multicast source. 'none' - State of the multicast source is not applicable 'local' - multicast source state is local 'remote' - multicast source state is remote 'orphan' - multicast source state is orphan Value of this object should be 'none' if cotvDataGroupActiveSrcLocation is 'remote'.")
cotvAdjacencyDatabaseTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1), )
if mibBuilder.loadTexts: cotvAdjacencyDatabaseTable.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacencyDatabaseTable.setDescription('A table containing OTV adjacency database information.')
cotvAdjacencyDatabaseEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvOverlayNumber"), (0, "CISCO-OTV-MIB", "cotvAdjacentDevAddrType"), (0, "CISCO-OTV-MIB", "cotvAdjacentDevAddr"))
if mibBuilder.loadTexts: cotvAdjacencyDatabaseEntry.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacencyDatabaseEntry.setDescription('An entry containing management information about a particular OTV adjacency.')
cotvAdjacentDevAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1, 1), InetAddressType())
if mibBuilder.loadTexts: cotvAdjacentDevAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacentDevAddrType.setDescription('The type of Internet address of adjacent edge device.')
cotvAdjacentDevAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1, 2), InetAddress().subtype(subtypeSpec=ValueSizeConstraint(1, 64)))
if mibBuilder.loadTexts: cotvAdjacentDevAddr.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacentDevAddr.setDescription('The Internet address of adjacent edge device. The type of this address is determined by the value of cotvAdjacentDevAddrType.')
cotvAdjacentDevSystemID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1, 3), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(6, 6), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvAdjacentDevSystemID.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacentDevSystemID.setDescription('This object indicates the system identifier of the adjacent edge device. The value of this object contains zero length octet, if the system identifier of the adjacent edge devices is not available.')
cotvAdjacentDevName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1, 4), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvAdjacentDevName.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacentDevName.setDescription('This object indicates the DNS name of the adjacent edge device.')
cotvAdjacentDevState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("other", 0), ("up", 1), ("down", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvAdjacentDevState.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacentDevState.setDescription("This object indicates the state of adjacent edge device. 'other' - Any other state not covered by below enumeration. 'up' - The adjacent device is up 'down' - The adjacent device is down.")
cotvAdjacentDevUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 3, 1, 1, 6), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvAdjacentDevUpTime.setStatus('current')
if mibBuilder.loadTexts: cotvAdjacentDevUpTime.setDescription('This object indicates the amount of time for which the adjacent device has been up.')
cotvArpNdCacheTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1), )
if mibBuilder.loadTexts: cotvArpNdCacheTable.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheTable.setDescription('A table containing ARP Neighbor Discovery cache information.')
cotvArpNdCacheEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvOverlayNumber"), (0, "CISCO-OTV-MIB", "cotvVlanId"), (0, "CISCO-OTV-MIB", "cotvArpNdCacheL3AddrType"), (0, "CISCO-OTV-MIB", "cotvArpNdCacheL3Addr"))
if mibBuilder.loadTexts: cotvArpNdCacheEntry.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheEntry.setDescription('An entry containing management information about a particular entry in ARP Neighbor Discovery cache.')
cotvArpNdCacheL3AddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1, 1, 1), InetAddressType())
if mibBuilder.loadTexts: cotvArpNdCacheL3AddrType.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheL3AddrType.setDescription('The type of Internet address (IPv4/IPv6 address) of host discovered using ARP Neighbor discovery.')
cotvArpNdCacheL3Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1, 1, 2), InetAddress().subtype(subtypeSpec=ValueSizeConstraint(0, 64)))
if mibBuilder.loadTexts: cotvArpNdCacheL3Addr.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheL3Addr.setDescription('The Internet address (IPv4/IPv6 address) of the host discovered using ARP Neighbor discovery. The type of this address is determined by the value of cotvArpNdCacheL3AddrType.')
cotvArpNdCacheMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1, 1, 3), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvArpNdCacheMacAddr.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheMacAddr.setDescription('This object indicates the MAC address discovered using ARP Neighbor discovery and cached in this table.')
cotvArpNdCacheAge = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1, 1, 4), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvArpNdCacheAge.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheAge.setDescription('This object indicates the amount of time for which this entry has existed on the system.')
cotvArpNdCacheTimeToExpire = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 4, 1, 1, 5), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvArpNdCacheTimeToExpire.setStatus('current')
if mibBuilder.loadTexts: cotvArpNdCacheTimeToExpire.setDescription('This object indicates the amount of time left for this cache entry to be expired.')
cotvRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1), )
if mibBuilder.loadTexts: cotvRouteTable.setStatus('current')
if mibBuilder.loadTexts: cotvRouteTable.setDescription('A table listing route (unicast) information in OTV Routing Information Base (ORIB).')
cotvRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvRouteVlanId"), (0, "CISCO-OTV-MIB", "cotvRouteMacAddr"))
if mibBuilder.loadTexts: cotvRouteEntry.setStatus('current')
if mibBuilder.loadTexts: cotvRouteEntry.setDescription('An entry containing management information about a particular route (unicast) in ORIB.')
cotvRouteVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 1), VlanIndex())
if mibBuilder.loadTexts: cotvRouteVlanId.setStatus('current')
if mibBuilder.loadTexts: cotvRouteVlanId.setDescription('The object indicates VLAN associated with this route.')
cotvRouteMacAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 2), MacAddress())
if mibBuilder.loadTexts: cotvRouteMacAddr.setStatus('current')
if mibBuilder.loadTexts: cotvRouteMacAddr.setDescription('This object indicates the MAC address to be routed.')
cotvRouteMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvRouteMetric.setStatus('current')
if mibBuilder.loadTexts: cotvRouteMetric.setDescription('This object indicates the metric associated with this route.')
cotvRouteUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 4), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvRouteUpTime.setStatus('current')
if mibBuilder.loadTexts: cotvRouteUpTime.setDescription('This object indicates the amount of time elapsed since the MAC route entry was installed in this table.')
cotvRouteOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 5), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvRouteOwner.setStatus('current')
if mibBuilder.loadTexts: cotvRouteOwner.setDescription('This object indicates the type of owner (source) from where the MAC address was learnt.')
cotvRouteNextHopIf = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 6), InterfaceIndexOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvRouteNextHopIf.setStatus('current')
if mibBuilder.loadTexts: cotvRouteNextHopIf.setDescription("This object indicates the interface on the device through which the MAC address will be routed. Value of this object should be ignored if cotvRouteOwner is other than 'site' or 'static'.")
cotvRouteNextHopAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 7), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvRouteNextHopAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvRouteNextHopAddrType.setDescription("This object indicates the type of Internet address of the edge device through which the MAC address will be routed. Value of this object should be ignored if cotvRouteOwner is other than 'overlay'.")
cotvRouteNextHopAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 1, 1, 8), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvRouteNextHopAddr.setStatus('current')
if mibBuilder.loadTexts: cotvRouteNextHopAddr.setDescription("This object indicates the Internet address of the edge device through which the MAC address will be routed. The type of this address is determined by the value of cotvRouteNextHopAddrType. Value of this object should be ignored if cotvRouteOwner is other than 'overlay'.")
cotvMcastRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2), )
if mibBuilder.loadTexts: cotvMcastRouteTable.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteTable.setDescription('A table listing multicast route information in OTV Routing Information Base (ORIB).')
cotvMcastRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvMcastRouteVlanId"), (0, "CISCO-OTV-MIB", "cotvMcastRouteActiveSrcAddrType"), (0, "CISCO-OTV-MIB", "cotvMcastRouteActiveSrcAddr"), (0, "CISCO-OTV-MIB", "cotvMcastRouteActiveGroupAddrType"), (0, "CISCO-OTV-MIB", "cotvMcastRouteActiveGroupAddr"))
if mibBuilder.loadTexts: cotvMcastRouteEntry.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteEntry.setDescription('An entry containing information about a particular multicast route in ORIB.')
cotvMcastRouteVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 1), VlanIndex())
if mibBuilder.loadTexts: cotvMcastRouteVlanId.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteVlanId.setDescription('The object indicates VLAN associated with this multicast route.')
cotvMcastRouteActiveSrcAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 2), InetAddressType())
if mibBuilder.loadTexts: cotvMcastRouteActiveSrcAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteActiveSrcAddrType.setDescription('The type of Internet address of active multicast source.')
cotvMcastRouteActiveSrcAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 3), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvMcastRouteActiveSrcAddr.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteActiveSrcAddr.setDescription('The Internet address of active multicast source. The type of this address is determined by the value of cotvMcastRouteActiveSrcAddrType.')
cotvMcastRouteActiveGroupAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 4), InetAddressType())
if mibBuilder.loadTexts: cotvMcastRouteActiveGroupAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteActiveGroupAddrType.setDescription('The type of Internet address of the active multicast group (multicast group of the active multicast source).')
cotvMcastRouteActiveGroupAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 5), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvMcastRouteActiveGroupAddr.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteActiveGroupAddr.setDescription('The Internet address of the active multicast group of the (multicast group of the active multicast source). The type of this address is determined by the value of cotvMcastRouteActiveGroupAddrType.')
cotvMcastRouteOwners = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 6), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteOwners.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteOwners.setDescription('This object indicates the type of owner(s) (sources) from where this route was learnt.')
cotvMcastRouteMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteMetric.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteMetric.setDescription('This object indicates the metric associated with this multicast route.')
cotvMcastRouteUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 2, 1, 8), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteUpTime.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteUpTime.setDescription('This object indicates the amount of time elapsed since this multicast route was installed in this table.')
cotvMcastRouteInfoTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3), )
if mibBuilder.loadTexts: cotvMcastRouteInfoTable.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoTable.setDescription('A table listing next-hop information associated with each multicast route in OTV Routing Information Base (ORIB).')
cotvMcastRouteInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1), ).setIndexNames((0, "CISCO-OTV-MIB", "cotvMcastRouteInfoVlanId"), (0, "CISCO-OTV-MIB", "cotvMcastRouteInfoActiveSrcAddrType"), (0, "CISCO-OTV-MIB", "cotvMcastRouteInfoActiveSrcAddr"), (0, "CISCO-OTV-MIB", "cotvMcastRouteInfoActiveGroupAddrType"), (0, "CISCO-OTV-MIB", "cotvMcastRouteInfoActiveGroupAddr"), (0, "CISCO-OTV-MIB", "cotvMcastRouteInfoIf"))
if mibBuilder.loadTexts: cotvMcastRouteInfoEntry.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoEntry.setDescription('An entry containing next-hop information about a particular multicast route in ORIB.')
cotvMcastRouteInfoVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 1), VlanIndex())
if mibBuilder.loadTexts: cotvMcastRouteInfoVlanId.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoVlanId.setDescription('The object indicates VLAN associated with this multicast route.')
cotvMcastRouteInfoActiveSrcAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 2), InetAddressType())
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveSrcAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveSrcAddrType.setDescription('The type of Internet address of active multicast source.')
cotvMcastRouteInfoActiveSrcAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 3), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveSrcAddr.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveSrcAddr.setDescription('The Internet address of active multicast source. The type of this address is determined by the value of cotvMcastRouteInfoActiveSrcAddrType.')
cotvMcastRouteInfoActiveGroupAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 4), InetAddressType())
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveGroupAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveGroupAddrType.setDescription('The type of Internet address of the active multicast group (multicast group of the active multicast source).')
cotvMcastRouteInfoActiveGroupAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 5), InetAddress().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(16, 16), )))
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveGroupAddr.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoActiveGroupAddr.setDescription('The Internet address of the active multicast group of the (multicast group of the active multicast source). The type of this address is determined by the value of cotvMcastRouteInfoActiveGroupAddrType.')
cotvMcastRouteInfoIf = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 6), InterfaceIndexOrZero())
if mibBuilder.loadTexts: cotvMcastRouteInfoIf.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoIf.setDescription('This object indicates the next-hop interface on the device through which the multicast group will be routed.')
cotvMcastRouteInfoHostAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 7), InetAddressType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteInfoHostAddrType.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoHostAddrType.setDescription("This object indicates the type of Internet address of the next-hop edge device through which the multicast group will be routed. Value of this object will be 'unknown' if no next-hop edge device information is associated with this route.")
cotvMcastRouteInfoHostAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 8), InetAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteInfoHostAddr.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoHostAddr.setDescription('This object indicates the Internet address of the next-hop edge device through which the multicast group will be routed. The type of this address is determined by the value of cotvMcastRouteInfoHostAddrType. Value of this object will be a zero length string if no next-hop edge device information is associated with this route.')
cotvMcastRouteInfoProtocolOwners = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 9), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteInfoProtocolOwners.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoProtocolOwners.setDescription('This object indicates the protocols used by multicast route owner to learn this route information.')
cotvMcastRouteInfoMetric = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteInfoMetric.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoMetric.setDescription('This object indicates the metric associated with this multicast route.')
cotvMcastRouteInfoUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 810, 1, 5, 3, 1, 11), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: cotvMcastRouteInfoUpTime.setStatus('current')
if mibBuilder.loadTexts: cotvMcastRouteInfoUpTime.setDescription('This object indicates the amount of time elapsed since this multicast route entry was installed in this table.')
ciscoOtvMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 1))
ciscoOtvMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2))
ciscoOtvMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 1, 1)).setObjects(("CISCO-OTV-MIB", "ciscoOtvSiteGroup"), ("CISCO-OTV-MIB", "ciscoOtvOverlayGroup"), ("CISCO-OTV-MIB", "ciscoOtvVlanGroup"), ("CISCO-OTV-MIB", "ciscoOtvDataGroupConfigGroup"), ("CISCO-OTV-MIB", "ciscoOtvDataGroupInfoGroup"), ("CISCO-OTV-MIB", "ciscoOtvAdjacencyGroup"), ("CISCO-OTV-MIB", "ciscoOtvArpNdCacheGroup"), ("CISCO-OTV-MIB", "ciscoOtvRouteGroup"), ("CISCO-OTV-MIB", "ciscoOtvMcastRouteGroup"), ("CISCO-OTV-MIB", "ciscoOtvMcastRouteInfoGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvMIBCompliance = ciscoOtvMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvMIBCompliance.setDescription('The compliance statement for CISCO-OTV-MIB.')
ciscoOtvSiteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 1)).setObjects(("CISCO-OTV-MIB", "cotvSiteIdAdmin"), ("CISCO-OTV-MIB", "cotvSiteIdOper"), ("CISCO-OTV-MIB", "cotvSiteVlan"), ("CISCO-OTV-MIB", "cotvSiteVlanState"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvSiteGroup = ciscoOtvSiteGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvSiteGroup.setDescription('A collection of objects providing OTV site information.')
ciscoOtvOverlayGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 2)).setObjects(("CISCO-OTV-MIB", "cotvOverlayVpnName"), ("CISCO-OTV-MIB", "cotvOverlayVpnState"), ("CISCO-OTV-MIB", "cotvOverlayVpnDownReason"), ("CISCO-OTV-MIB", "cotvOverlayVlansExtendedFirst2k"), ("CISCO-OTV-MIB", "cotvOverlayVlansExtendedSecond2k"), ("CISCO-OTV-MIB", "cotvOverlayControlGroupAddrType"), ("CISCO-OTV-MIB", "cotvOverlayControlGroupAddr"), ("CISCO-OTV-MIB", "cotvOverlayBroadcastGroupAddrType"), ("CISCO-OTV-MIB", "cotvOverlayBroadcastGroupAddr"), ("CISCO-OTV-MIB", "cotvOverlayJoinInterface"), ("CISCO-OTV-MIB", "cotvOverlaySourceInterface"), ("CISCO-OTV-MIB", "cotvOverlayAedCapable"), ("CISCO-OTV-MIB", "cotvOverlayAedIncapableReason"), ("CISCO-OTV-MIB", "cotvOverlayAdjServerTransportType"), ("CISCO-OTV-MIB", "cotvOverlayAdjServerEnable"), ("CISCO-OTV-MIB", "cotvOverlayPrimaryAdjServerAddrType"), ("CISCO-OTV-MIB", "cotvOverlayPrimaryAdjServerAddr"), ("CISCO-OTV-MIB", "cotvOverlaySecondaryAdjServerAddrType"), ("CISCO-OTV-MIB", "cotvOverlaySecondaryAdjServerAddr"), ("CISCO-OTV-MIB", "cotvOverlaySuppressArpND"), ("CISCO-OTV-MIB", "cotvOverlayStorageType"), ("CISCO-OTV-MIB", "cotvOverlayRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvOverlayGroup = ciscoOtvOverlayGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvOverlayGroup.setDescription('A collection of objects providing OTV overlay information.')
ciscoOtvVlanGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 3)).setObjects(("CISCO-OTV-MIB", "cotvVlanState"), ("CISCO-OTV-MIB", "cotvVlanInactiveReason"), ("CISCO-OTV-MIB", "cotvVlanAedAddrType"), ("CISCO-OTV-MIB", "cotvVlanAedAddr"), ("CISCO-OTV-MIB", "cotvVlanEdgeDevIsAed"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvVlanGroup = ciscoOtvVlanGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvVlanGroup.setDescription('A collection of objects providing OTV extended VLANs.')
ciscoOtvDataGroupConfigGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 4)).setObjects(("CISCO-OTV-MIB", "cotvDataGroupStorageType"), ("CISCO-OTV-MIB", "cotvDataGroupRowStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvDataGroupConfigGroup = ciscoOtvDataGroupConfigGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvDataGroupConfigGroup.setDescription('A collection of objects providing overlay multicast data-group configuration information.')
ciscoOtvDataGroupInfoGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 5)).setObjects(("CISCO-OTV-MIB", "cotvDataGroupJoinInterface"), ("CISCO-OTV-MIB", "cotvDataGroupLocalActiveSrcState"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvDataGroupInfoGroup = ciscoOtvDataGroupInfoGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvDataGroupInfoGroup.setDescription('A collection of objects providing active data-group related information.')
ciscoOtvAdjacencyGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 6)).setObjects(("CISCO-OTV-MIB", "cotvAdjacentDevSystemID"), ("CISCO-OTV-MIB", "cotvAdjacentDevName"), ("CISCO-OTV-MIB", "cotvAdjacentDevState"), ("CISCO-OTV-MIB", "cotvAdjacentDevUpTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvAdjacencyGroup = ciscoOtvAdjacencyGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvAdjacencyGroup.setDescription('A collection of objects providing information about OTV Adjacency Database.')
ciscoOtvArpNdCacheGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 7)).setObjects(("CISCO-OTV-MIB", "cotvArpNdCacheMacAddr"), ("CISCO-OTV-MIB", "cotvArpNdCacheAge"), ("CISCO-OTV-MIB", "cotvArpNdCacheTimeToExpire"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvArpNdCacheGroup = ciscoOtvArpNdCacheGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvArpNdCacheGroup.setDescription('A collection of objects providing ARP/ND cache information.')
ciscoOtvRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 8)).setObjects(("CISCO-OTV-MIB", "cotvRouteMetric"), ("CISCO-OTV-MIB", "cotvRouteUpTime"), ("CISCO-OTV-MIB", "cotvRouteOwner"), ("CISCO-OTV-MIB", "cotvRouteNextHopIf"), ("CISCO-OTV-MIB", "cotvRouteNextHopAddrType"), ("CISCO-OTV-MIB", "cotvRouteNextHopAddr"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvRouteGroup = ciscoOtvRouteGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvRouteGroup.setDescription('A collection of objects providing information about unicast routes in ORIB.')
ciscoOtvMcastRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 9)).setObjects(("CISCO-OTV-MIB", "cotvMcastRouteOwners"), ("CISCO-OTV-MIB", "cotvMcastRouteMetric"), ("CISCO-OTV-MIB", "cotvMcastRouteUpTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvMcastRouteGroup = ciscoOtvMcastRouteGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvMcastRouteGroup.setDescription('A collection of objects providing information about multicast routes in ORIB.')
ciscoOtvMcastRouteInfoGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 810, 2, 2, 10)).setObjects(("CISCO-OTV-MIB", "cotvMcastRouteInfoHostAddrType"), ("CISCO-OTV-MIB", "cotvMcastRouteInfoHostAddr"), ("CISCO-OTV-MIB", "cotvMcastRouteInfoProtocolOwners"), ("CISCO-OTV-MIB", "cotvMcastRouteInfoMetric"), ("CISCO-OTV-MIB", "cotvMcastRouteInfoUpTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoOtvMcastRouteInfoGroup = ciscoOtvMcastRouteInfoGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoOtvMcastRouteInfoGroup.setDescription('A collection of objects providing interface level information for multicast routes in ORIB.')
mibBuilder.exportSymbols("CISCO-OTV-MIB", cotvDataGroupActiveSrcLocation=cotvDataGroupActiveSrcLocation, cotvMcastRouteInfoActiveGroupAddrType=cotvMcastRouteInfoActiveGroupAddrType, cotvMcastRouteInfoTable=cotvMcastRouteInfoTable, cotvArpNdCacheMacAddr=cotvArpNdCacheMacAddr, ciscoOtvMIBNotifs=ciscoOtvMIBNotifs, cotvOverlayBroadcastGroupAddr=cotvOverlayBroadcastGroupAddr, cotvArpNdCacheL3Addr=cotvArpNdCacheL3Addr, cotvOverlayAedCapable=cotvOverlayAedCapable, cotvDataGroupActiveSrcAddrType=cotvDataGroupActiveSrcAddrType, cotvMcastRouteInfoActiveSrcAddrType=cotvMcastRouteInfoActiveSrcAddrType, cotvArpNdCacheEntry=cotvArpNdCacheEntry, cotvVlansTable=cotvVlansTable, cotvRouteEntry=cotvRouteEntry, cotvDataGroupDeliveryGroupAddrType=cotvDataGroupDeliveryGroupAddrType, cotvVlanId=cotvVlanId, PYSNMP_MODULE_ID=ciscoOtvMIB, ciscoOtvMIBGroups=ciscoOtvMIBGroups, cotvOverlayControlGroupAddrType=cotvOverlayControlGroupAddrType, cotvDataGroupDeliverySrcAddr=cotvDataGroupDeliverySrcAddr, cotvDataGroupLocalActiveSrcState=cotvDataGroupLocalActiveSrcState, cotvRouteNextHopAddrType=cotvRouteNextHopAddrType, cotvMcastRouteInfoMetric=cotvMcastRouteInfoMetric, cotvAdjacentDevUpTime=cotvAdjacentDevUpTime, cotvVlanState=cotvVlanState, cotvRouteNextHopIf=cotvRouteNextHopIf, cotvMcastRouteInfoProtocolOwners=cotvMcastRouteInfoProtocolOwners, cotvArpNdCacheTable=cotvArpNdCacheTable, ciscoOtvMcastRouteInfoGroup=ciscoOtvMcastRouteInfoGroup, cotvDataGroupMcastRangeAddrType=cotvDataGroupMcastRangeAddrType, ciscoOtvMIBCompliance=ciscoOtvMIBCompliance, cotvRouteUpTime=cotvRouteUpTime, cotvMcastRouteOwners=cotvMcastRouteOwners, cotvOverlayVpnDownReason=cotvOverlayVpnDownReason, cotvVlansEntry=cotvVlansEntry, cotvDataGroupActiveGroupAddr=cotvDataGroupActiveGroupAddr, cotvOverlayVpnState=cotvOverlayVpnState, cotvOverlaySecondaryAdjServerAddrType=cotvOverlaySecondaryAdjServerAddrType, cotvOverlayAedIncapableReason=cotvOverlayAedIncapableReason, cotvSiteObjects=cotvSiteObjects, ciscoOtvArpNdCacheGroup=ciscoOtvArpNdCacheGroup, cotvAdjacentDevSystemID=cotvAdjacentDevSystemID, cotvMcastRouteEntry=cotvMcastRouteEntry, ciscoOtvMIBObjects=ciscoOtvMIBObjects, cotvMcastRouteTable=cotvMcastRouteTable, cotvVlanAedAddrType=cotvVlanAedAddrType, cotvVlanInactiveReason=cotvVlanInactiveReason, ciscoOtvSiteGroup=ciscoOtvSiteGroup, cotvDataGroupMcastRangeAddr=cotvDataGroupMcastRangeAddr, cotvOverlaySecondaryAdjServerAddr=cotvOverlaySecondaryAdjServerAddr, cotvAdjacentDevName=cotvAdjacentDevName, ciscoOtvMIBConform=ciscoOtvMIBConform, cotvRouteTable=cotvRouteTable, cotvMcastRouteInfoIf=cotvMcastRouteInfoIf, cotvMcastRouteInfoHostAddrType=cotvMcastRouteInfoHostAddrType, cotvDataGroupMcastRangePrefixLength=cotvDataGroupMcastRangePrefixLength, cotvSiteVlanState=cotvSiteVlanState, ciscoOtvDataGroupConfigGroup=ciscoOtvDataGroupConfigGroup, cotvSiteIdOper=cotvSiteIdOper, cotvDataGroupActiveSrcAddr=cotvDataGroupActiveSrcAddr, cotvOverlayControlGroupAddr=cotvOverlayControlGroupAddr, cotvVlanAedAddr=cotvVlanAedAddr, cotvMcastRouteInfoActiveSrcAddr=cotvMcastRouteInfoActiveSrcAddr, cotvDataGroupRowStatus=cotvDataGroupRowStatus, cotvOverlayVlansExtendedSecond2k=cotvOverlayVlansExtendedSecond2k, cotvOverlayJoinInterface=cotvOverlayJoinInterface, cotvMcastRouteMetric=cotvMcastRouteMetric, cotvAdjacentDevAddrType=cotvAdjacentDevAddrType, ciscoOtvMIB=ciscoOtvMIB, cotvDataGroupDeliverySrcAddrType=cotvDataGroupDeliverySrcAddrType, cotvDataGroupStorageType=cotvDataGroupStorageType, cotvOverlayNumber=cotvOverlayNumber, cotvMcastRouteUpTime=cotvMcastRouteUpTime, cotvOverlayRowStatus=cotvOverlayRowStatus, cotvOverlayBroadcastGroupAddrType=cotvOverlayBroadcastGroupAddrType, cotvMcastRouteInfoVlanId=cotvMcastRouteInfoVlanId, cotvDataGroupDeliveryGroupAddr=cotvDataGroupDeliveryGroupAddr, cotvAdjacencyObjects=cotvAdjacencyObjects, cotvOverlayPrimaryAdjServerAddrType=cotvOverlayPrimaryAdjServerAddrType, cotvMcastRouteInfoEntry=cotvMcastRouteInfoEntry, cotvMcastRouteActiveGroupAddrType=cotvMcastRouteActiveGroupAddrType, cotvOverlayAdjServerTransportType=cotvOverlayAdjServerTransportType, cotvRouteMacAddr=cotvRouteMacAddr, ciscoOtvMIBCompliances=ciscoOtvMIBCompliances, cotvOverlayVlansExtendedFirst2k=cotvOverlayVlansExtendedFirst2k, cotvOverlaySourceInterface=cotvOverlaySourceInterface, ciscoOtvVlanGroup=ciscoOtvVlanGroup, cotvArpNdCacheL3AddrType=cotvArpNdCacheL3AddrType, cotvSiteVlan=cotvSiteVlan, cotvDataGroupJoinInterface=cotvDataGroupJoinInterface, ciscoOtvRouteGroup=ciscoOtvRouteGroup, cotvAdjacentDevState=cotvAdjacentDevState, cotvDataGroupVlanId=cotvDataGroupVlanId, cotvOverlayStorageType=cotvOverlayStorageType, cotvArpNdCacheTimeToExpire=cotvArpNdCacheTimeToExpire, cotvMcastRouteActiveSrcAddr=cotvMcastRouteActiveSrcAddr, ciscoOtvAdjacencyGroup=ciscoOtvAdjacencyGroup, cotvMcastRouteVlanId=cotvMcastRouteVlanId, cotvOverlayVpnName=cotvOverlayVpnName, cotvRouteOwner=cotvRouteOwner, ciscoOtvMcastRouteGroup=ciscoOtvMcastRouteGroup, cotvDataGroupInfoEntry=cotvDataGroupInfoEntry, cotvDataGroupActiveGroupAddrType=cotvDataGroupActiveGroupAddrType, cotvRouteObjects=cotvRouteObjects, cotvMcastRouteActiveGroupAddr=cotvMcastRouteActiveGroupAddr, cotvOverlayPrimaryAdjServerAddr=cotvOverlayPrimaryAdjServerAddr, cotvMcastRouteActiveSrcAddrType=cotvMcastRouteActiveSrcAddrType, cotvGlobalStatsObjects=cotvGlobalStatsObjects, cotvAdjacencyDatabaseTable=cotvAdjacencyDatabaseTable, cotvRouteNextHopAddr=cotvRouteNextHopAddr, cotvArpNdObjects=cotvArpNdObjects, cotvGlobalObjects=cotvGlobalObjects, cotvMcastRouteInfoUpTime=cotvMcastRouteInfoUpTime, cotvSiteIdAdmin=cotvSiteIdAdmin, cotvRouteMetric=cotvRouteMetric, cotvOverlayObjects=cotvOverlayObjects, cotvOverlayEntry=cotvOverlayEntry, cotvOverlayTable=cotvOverlayTable, cotvMcastRouteInfoHostAddr=cotvMcastRouteInfoHostAddr, cotvRouteVlanId=cotvRouteVlanId, cotvDataGroupConfigTable=cotvDataGroupConfigTable, cotvOverlaySuppressArpND=cotvOverlaySuppressArpND, cotvVlanEdgeDevIsAed=cotvVlanEdgeDevIsAed, ciscoOtvDataGroupInfoGroup=ciscoOtvDataGroupInfoGroup, cotvArpNdCacheAge=cotvArpNdCacheAge, ciscoOtvOverlayGroup=ciscoOtvOverlayGroup, cotvAdjacencyDatabaseEntry=cotvAdjacencyDatabaseEntry, cotvAdjacentDevAddr=cotvAdjacentDevAddr, cotvOverlayAdjServerEnable=cotvOverlayAdjServerEnable, cotvDataGroupConfigEntry=cotvDataGroupConfigEntry, cotvMcastRouteInfoActiveGroupAddr=cotvMcastRouteInfoActiveGroupAddr, cotvDataGroupInfoTable=cotvDataGroupInfoTable)
|
def menu():
print("")
print(f'''<------ MENU ------>
A - para adição
S - para subtração
D - para divisão
M - para múltiplicação
X - para sair''')
def Aritmetica(a, operacao):
arit = {'A': lambda a, b: a + b,
'S': lambda a, b: a - b,
'D': lambda a, b: a / b,
'M': lambda a, b: a * b}
if operacao == 'A':
for i in range(1, 11):
print(f'{a} + {i} = {arit[operacao](a, i)}')
elif operacao == 'S':
for i in range(1, 11):
print(f'{a} - {i} = {arit[operacao](a, i)}')
elif operacao == 'D':
for i in range(1, 11):
print(f'{a} / {i} = {arit[operacao](a, i)}')
if operacao == 'M':
for i in range(1, 11):
print(f'{a} * {i} = {arit[operacao](a, i)}')
while True:
a = int(input('Número: '))
menu()
while True:
op = input('Operação: ').strip().upper()[0]
if op == 'X':
break
elif op not in 'ASDM':
print('Digite uma operação válida')
else:
Aritmetica(a, op)
if op == 'X':
break
|
class ServerError(Exception):
def __init__(self, details, model, response):
self.details = details
self.model = model
self.response = response
super(ServerError, self).__init__(self.details)
def encode(self):
return {
"details": self.details,
"expected": str(self.model),
"actual": self.response
}
class BadRequest(Exception):
def __init__(self, message, **kwargs):
self.kwargs = kwargs
self.message = message
def encode(self):
encoded ={"details": self.message}
encoded.update(self.kwargs)
return encoded
|
"""
jsonable.py:
Folder with helper methods that allow for seamless conversion of F prime types to JSON types. This allows us to produce
data in JSON format with ease, assuming that the correct encoder is registered.
Note: JSON types must use only the following data types
1. booleans
2. numbers
3. strings
4. lists
5. anonymous objects (dictionaries)
@author mstarch
"""
def fprime_to_jsonable(obj):
"""
Takes an F prime object and converts it to a jsonable type.
:param obj: object to convert
:return: object in jsonable format (can call json.dump(obj))
"""
# Otherwise try and scrape all "get_" getters in a smart way
anonymous = {}
getters = [attr for attr in dir(obj) if attr.startswith("get_")]
for getter in getters:
# Call the get_ functions, and call all non-static methods
try:
func = getattr(obj, getter)
item = func()
# If there is a property named "args" it needs to be handled specifically unless an incoming command
if (
getter == "get_args"
and not "fprime_gds.common.data_types.cmd_data.CmdData"
in str(type(obj))
):
args = []
for arg_spec in item:
arg_dict = {
"name": arg_spec[0],
"description": arg_spec[1],
"value": arg_spec[2].val,
"type": str(arg_spec[2]),
}
if arg_dict["type"] == "Enum":
arg_dict["possible"] = arg_spec[2].keys()
args.append(arg_dict)
# Fill in our special handling
item = args
anonymous[getter.replace("get_", "")] = item
except TypeError:
continue
return anonymous
|
# Ariant Treasure Vault Entrance (915020100) => Ariant Treasure Vault
if 2400 <= chr.getJob() <= 2412 and not sm.hasMobsInField():
sm.warp(915020101, 1)
elif sm.hasMobsInField():
sm.chat("Eliminate all of the intruders first.")
|
# -*- coding: utf-8 -*-
"""
Most of the jokes are from https://viccfaktor.hu/cimke/programozo-viccek/, and https://gremmedia.hu/programozo-viccek
//
A viccek nagy része a https://viccfaktor.hu/cimke/programozo-viccek/ weboldalról és a https://gremmedia.hu/programozo-viccek weboldalról származik
"""
neutral = [
"- Miért keveri a programozó a Halloween-t a Karácsonnyal? - ??? - Mert az egyik oct 31 a másik meg dec 25.",
"Két programozó beszélget: - Milyen a kedved? - Egész változó... - Integer???",
"- Mire táncolnak a programozók a buliban? - Algoritmusra.",
"10-féle ember létezik. Az egyik ismeri a bináris számrendszert, a másik nem.",
"- Hogyan próbálnak meggazdagodni az objektumorientált programozók? - ??? - Öröklődés által.",
"- Mi a teendő tűz esetén? - ??? - 1. `git add .` 2. `git commit` 3. `git push` 4. hagyjuk el az épületet",
"- Mit csinál a backend fejlesztő, amikor sikeresen megváltoztat valamit CSS-ben? - ??? - Beírja az önéletrajzába, hogy full stack fejlesztő",
"- Hogy hívsz nyolc hobbitot? - ??? - Egy hobbyte."
]
chuck = [
"- Miért Chuck Norris a világ legjobb programozója? - ??? - Mert olyan kódot ír, ami saját magát képes optimalizálni."
]
jokes_hu = {
'neutral': neutral,
'chuck': chuck,
'all': neutral + chuck,
}
|
"""This problem was asked by Amazon.
Implement a bit array.
A bit array is a space efficient array that holds a value of 1 or 0 at each index.
• init(size): initialize the array with size
• set(i, val): updates index at i with val where val is either 1 or 0.
• get(i): gets the value at index i.
"""
|
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'libflac',
'product_name': 'flac',
'type': 'static_library',
'sources': [
'include/FLAC/all.h',
'include/FLAC/assert.h',
'include/FLAC/callback.h',
'include/FLAC/export.h',
'include/FLAC/format.h',
'include/FLAC/metadata.h',
'include/FLAC/ordinals.h',
'include/FLAC/stream_decoder.h',
'include/FLAC/stream_encoder.h',
'include/share/alloc.h',
'include/share/compat.h',
'include/share/endswap.h',
'include/share/private.h',
'src/libFLAC/alloc.c',
'src/libFLAC/bitmath.c',
'src/libFLAC/bitreader.c',
'src/libFLAC/bitwriter.c',
'src/libFLAC/cpu.c',
'src/libFLAC/crc.c',
'src/libFLAC/fixed.c',
'src/libFLAC/float.c',
'src/libFLAC/format.c',
'src/libFLAC/lpc.c',
'src/libFLAC/md5.c',
'src/libFLAC/memory.c',
'src/libFLAC/stream_decoder.c',
'src/libFLAC/stream_encoder.c',
'src/libFLAC/stream_encoder_framing.c',
'src/libFLAC/window.c',
'src/libFLAC/include/private/all.h',
'src/libFLAC/include/private/bitmath.h',
'src/libFLAC/include/private/bitreader.h',
'src/libFLAC/include/private/bitwriter.h',
'src/libFLAC/include/private/cpu.h',
'src/libFLAC/include/private/crc.h',
'src/libFLAC/include/private/fixed.h',
'src/libFLAC/include/private/float.h',
'src/libFLAC/include/private/format.h',
'src/libFLAC/include/private/lpc.h',
'src/libFLAC/include/private/macros.h',
'src/libFLAC/include/private/md5.h',
'src/libFLAC/include/private/memory.h',
'src/libFLAC/include/private/metadata.h',
'src/libFLAC/include/private/stream_encoder.h',
'src/libFLAC/include/private/stream_encoder_framing.h',
'src/libFLAC/include/private/window.h',
'src/libFLAC/include/protected/all.h',
'src/libFLAC/include/protected/stream_decoder.h',
'src/libFLAC/include/protected/stream_encoder.h',
],
'defines': [
'FLAC__NO_DLL',
'FLAC__OVERFLOW_DETECT',
'VERSION="1.3.1"',
'HAVE_LROUND',
],
'conditions': [
['OS=="win"', {
'sources': [
'include/share/win_utf8_io.h',
'src/share/win_utf8_io/win_utf8_io.c',
],
'defines!': [
'WIN32_LEAN_AND_MEAN', # win_utf8_io.c defines this itself.
],
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/wd4334', # 32-bit shift converted to 64 bits.
'/wd4267', # Converting from size_t to unsigned on 64-bit.
],
},
},
}, {
'defines': [
'HAVE_INTTYPES_H',
],
}],
],
'include_dirs': [
'include',
'src/libFLAC/include',
],
'direct_dependent_settings': {
'defines': [
'FLAC__NO_DLL',
],
},
'variables': {
'clang_warning_flags': [
# libflac converts between FLAC__StreamDecoderState and
# FLAC__StreamDecoderInitStatus a lot in stream_decoder.c.
'-Wno-conversion',
# libflac contains constants that are only used in certain
# compile-time cases, which triggers unused-const-variable warnings in
# other cases.
'-Wno-unused-const-variable',
],
},
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
|
class LUISEmulator(object):
def __init__(self):
self.name='luis'
def normalise_request_json(self,data):
_data = {}
_data["text"]=data['q'][0]
return _data
def normalise_response_json(self,data):
return {
"query": data["text"],
"topScoringIntent": {
"intent": "inform",
"score": None
},
"entities": [
{
"entity": e[0],
"type": e[1],
"startIndex": None,
"endIndex": None,
"score": None
} for e in data["entities"]
]
}
|
def test_vm_reconfigured(controller, vm_service, vn_service, vmi_service, vrouter_port_service,
vm_reconfigured_update):
controller.handle_update(vm_reconfigured_update)
vm_service.update_vm_models_interfaces.assert_called_once()
vn_service.update_vns.assert_called_once()
vmi_service.update_vmis.assert_called_once()
vrouter_port_service.sync_ports.assert_called_once()
|
"""
Module: 'flowlib.units._adc' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1
ADDRESS = 72
class Adc:
''
def _available():
pass
def _read_u16():
pass
def _write_u8():
pass
def deinit():
pass
def measure_set():
pass
voltage = None
GAIN_EIGHT = 3
GAIN_FOUR = 2
GAIN_ONE = 0
GAIN_TWO = 1
MODE_CONTIN = 0
MODE_SINGLE = 16
OSMODE_STATE = 128
RATE_15 = 12
RATE_240 = 0
RATE_30 = 8
RATE_60 = 4
def const():
pass
i2c_bus = None
struct = None
unit = None
|
with open('lexical.csv') as f:
string=f.read()
arr=string.split('\n')
arr=arr[:10000]
result='\n'.join(arr)
with open('sub.csv','w') as f:
f.write(result)
|
# program to restore the original string by entering the compressed string with this rule. However,
# the # character does not appear in the restored character string.
def restore_original_str(a1):
result = ""
ind = 0
end = len(a1)
while ind < end:
if a1[ind] == "#":
result += a1[ind + 2] * int(a1[ind + 1])
ind += 3
else:
result += a1[ind]
ind += 1
return result
print("Original text:","XY#6Z1#4023")
print(restore_original_str("XY#6Z1#4023"))
print("Original text:","#39+1=1#30")
print(restore_original_str("#39+1=1#30"))
|
# Given an array of integers, every element appears twice except for one. Find that single one.
#
# Note:
# Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
#
# Python, Python3 all accepted.
class SingleNumber:
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
s = 0
if nums is None:
return s
for i in nums:
s ^= i
return s
|
def example2(n):
h = lambda : print(n)
return(h)
ourfunc = example2(5)
ourfunc()
|
# -*- coding: utf-8 -*-
""" Platform specific utility functions, dummy version
This has empty implementation of the platutils functions, used for
unsupported operating systems.
Authors
-------
- Ville Vainio <vivainio@gmail.com>
"""
#*****************************************************************************
# Copyright (C) 2008-2009 The IPython Development Team
# Copyright (C) 2001-2007 Fernando Perez <fperez@colorado.edu>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#*****************************************************************************
# This variable is part of the expected API of the module:
ignore_termtitle = True
def set_term_title(*args,**kw):
"""Dummy no-op."""
pass
def find_cmd(cmd):
"""Find the full path to a command using which."""
return os.popen('which %s' % cmd).read().strip()
def get_long_path_name(path):
"""Dummy no-op."""
return path
|
"""Axes behaviour."""
def lines(
*,
base_width=0.5,
line_base_ratio=2.0,
tick_major_base_ratio=1.0,
tick_minor_base_ratio=0.5,
tick_size_width_ratio=3.0,
tick_major_size_min=3.0,
tick_minor_size_min=2.0,
axisbelow=True,
):
"""Adjust linewidth(s) according to a base width."""
tick_major_width = tick_major_base_ratio * base_width
tick_minor_width = tick_minor_base_ratio * base_width
tick_major_size = max(tick_major_size_min, tick_size_width_ratio * tick_major_width)
tick_minor_size = max(tick_minor_size_min, tick_size_width_ratio * tick_minor_width)
return {
# Set the line-widths appropriately (including the grid)
"axes.linewidth": base_width,
"lines.linewidth": line_base_ratio * base_width,
"xtick.major.width": tick_major_width,
"ytick.major.width": tick_major_width,
"xtick.minor.width": tick_minor_width,
"ytick.minor.width": tick_minor_width,
"xtick.major.size": tick_major_size,
"ytick.major.size": tick_major_size,
"xtick.minor.size": tick_minor_size,
"ytick.minor.size": tick_minor_size,
"grid.linewidth": base_width,
# Legend frame linewidth
"patch.linewidth": base_width,
"legend.edgecolor": "inherit", # inherit color from axes. passing 'color' leads to awkward future warnings.
# Control the zorder of the ticks and gridlines
# This is somewhat out of place in this function, but creating a new function
# seems a bit unnecessary here... suggestions welcome!
"axes.axisbelow": axisbelow,
}
def grid(*, grid_alpha=0.2, grid_linestyle="solid"):
"""Adjust the grid-style."""
return {
# Update the linestyle of the grid
# (it shares a color with the frame, and needs to be distinguishable)
"grid.linestyle": grid_linestyle,
"grid.alpha": grid_alpha,
}
def legend(*, shadow=False, frameon=True, fancybox=False):
"""Adjust the legend-style."""
return {
"legend.shadow": shadow,
"legend.frameon": frameon,
"legend.fancybox": fancybox,
}
def color(*, base="black", face="none"):
"""Adjust the axes' color."""
return {
"text.color": base,
"axes.edgecolor": base,
"axes.labelcolor": base,
"xtick.color": base,
"ytick.color": base,
"grid.color": base,
"axes.facecolor": face,
}
def spines(*, left=True, right=True, top=True, bottom=True):
"""Adjust the visibility of the axes' spines."""
return {
"axes.spines.left": left,
"axes.spines.right": right,
"axes.spines.top": top,
"axes.spines.bottom": bottom,
}
def tick_direction(*, x="inout", y="inout"):
"""Adjust the tick direction."""
return {
"xtick.direction": x,
"ytick.direction": y,
}
|
#!/usr/bin/env python
"""
Base class and common functions for compressor implementations.
"""
# pylint: disable=W0311
class BaseProcessor(object):
"Base class for compression processors."
def __init__(self, options, is_request, params):
self.options = options
self.is_request = is_request
name = self.__module__.split(".")[-1]
if params:
self.name = name + " (" + ", ".join(params) + ")"
else:
self.name = name
self.params = params
def compress(self, in_headers, host):
"""
'in_headers' are the headers that will be processed. They are expected
to be a dictionary whose keys are header names (all lowercase), and
whose values are strings. Multiple instances of a header field will
be delimited by \0 (null) characters.
There are a number of special header names, indicated by ':' as the
first character in the name.
'host' is the host header value for the request (or associated request,
if it is a response).
Return value is the resulting compressed headers.
"""
raise NotImplementedError
def decompress(self, compressed):
"""
'compressed' is the compressed headers.
Return value is a header dictionary, as described above.
"""
raise NotImplementedError
def format_http1(frame,
delimiter="\r\n",
valsep=": ",
host='host',
version="HTTP/1.1"):
"""Take the frame and format it as HTTP/1-ish"""
out_frame = []
top_line = ''
avoid_list = []
if ':method' in frame:
top_line = '%s %s %s%s' % (
frame.get(':method',""), frame.get(':path', ""),
frame.get(':version', version), delimiter)
avoid_list = [':method', ':path', ':version']
else:
top_line = '%s %s %s%s' % (
frame.get(':version', version), frame.get(':status',""),
frame.get(':status-text', '?'), delimiter)
avoid_list = [':version', ':status', ':status-text']
out_frame.append(top_line)
for (key, val) in frame.items():
if key in avoid_list:
continue
if key == ':host':
key = host
for individual_val in val.split('\x00'):
out_frame.append(key)
out_frame.append(valsep)
out_frame.append(individual_val)
out_frame.append(delimiter)
out_frame.append(delimiter)
return ''.join(out_frame)
def parse_http1(message, is_request, host='host'):
"""Take a HTTP1 message and return the header structure for it."""
out = {}
lines = message.strip().split("\n")
top_line = lines.pop(0).split(None, 2)
for line in lines:
if not line:
break
if line[0] == ':':
name, value = line[1:].split(":", 1)
name = ":" + name
else:
name, value = line.split(":", 1)
name = name.lower()
if name in out:
out[name] += "\0" + value.strip()
else:
out[name] = value.strip()
if is_request:
out[':method'] = top_line[0]
out[':path'] = top_line[1]
out[':version'] = top_line[2].strip()
if host in out:
out[':host'] = out[host]
del out[host]
else:
out[':version'] = top_line[0]
out[':status'] = top_line[1]
out[':status-text'] = top_line[2].strip()
return out
|
# Outputs the sum of the range of all numbers from 1 to n.
# Source: https://pynative.com/python-program-to-calculate-sum-and-average-of-numbers/
def main():
print("\n")
input_string = input('Enter numbers separated by space ')
print("\n")
# Take input numbers into list
numbers = input_string.split()
# convert each item to int type
for i in range(len(numbers)):
# convert each item to int type
numbers[i] = int(numbers[i])
# Calculating the sum and average
print("Sum = ", sum(numbers))
print("Average = ", sum(numbers) / len(numbers))
if __name__ == '__main__' :
main()
|
'''
@Author: 咸的
@Date: 2020-03-09 14:35:31
@LastEditTime: 2020-03-10 14:08:05
@Description: In User Settings Edit
'''
txt = '''120 132
261 294
416 429
541 555
680 692
784 799
926 939
1082 1096
1212 1224
1333 1344
1452 1466
1586 1598
1728 1743
1891 1905
2038 2050
2183 2196
2354 2367
2502 2515
2675 2687
2807 2818
2926 2939
3079 3107
3256 3269
3392 3406
3507 3521
3641 3652
3773 3787
3904 3919
4028 4040
4147 4160
4257 4269'''
txt = txt.split('\n')
stfr = [i.split('\t')[0] for i in txt ]
# print(stfr)
se_frame = [i.split('\t') for i in txt]
# print(se_frame)
for i in range(len(txt)):
print(se_frame[i][0],se_frame[i][1], round((i+1)/(len(txt))*100))
|
# https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/
class Solution:
def sumZero(self, n: int) -> List[int]:
res = []
if n % 2 == 0:
for i in range(1, (n // 2) + 1):
res.append(i)
for i in range(-(n // 2), 0):
res.append(i)
return res
else:
for i in range(1, (n // 2) + 1):
res.append(i)
res.append(0)
for i in range(-(n // 2), 0):
res.append(i)
return res
|
# 只有把 5 放中间一种类型解法,并且和等于15,不过还是暴力破解看看吧
def check(a):
"""传入九宫格(列表),判定是否破解"""
#print("a=", a)
if a[0]+a[1]+a[2] == a[3]+a[4]+a[5] == a[6]+a[7]+a[8]\
== a[0]+a[3]+a[6] == a[1]+a[4]+a[7] == a[2]+a[5]+a[8]\
== a[0]+a[4]+a[8] == a[2]+a[4]+a[6]:
print(a)
def permute(a_list):
"""闭包处理, 保存了使用方法 for 循环和两个环境变量"""
outer = [] # 记录每个九宫格排列结果
counted = {"sudo": 0} # 计数器
def extract(n,i):
"""递归处理, 从列表 n 中抽一个出来,剩余的元素再排列"""
outer.append(i)
if len(n) == 1:
counted['sudo'] += 1
check(outer)
else:
m = n[:] # 复制品用于安全迭代
m.remove(i)
for j in m:
extract(m, j)
# 删去本次循环增加的 i ,保持9个元素
outer.remove(i)
for num in a_list:
extract(a_list, num)
print(counted)
a1 = [1,2,3,4,5,6,7,8,9]
permute(a1)
|
#
# PySNMP MIB module ARBOR-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARBOR-SMI
# Produced by pysmi-0.3.4 at Mon Apr 29 17:08:55 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, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, ObjectIdentity, Counter32, Gauge32, enterprises, Integer32, IpAddress, MibIdentifier, Counter64, NotificationType, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, TimeTicks, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "ObjectIdentity", "Counter32", "Gauge32", "enterprises", "Integer32", "IpAddress", "MibIdentifier", "Counter64", "NotificationType", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "TimeTicks", "Bits")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
arbornetworks = ModuleIdentity((1, 3, 6, 1, 4, 1, 9694))
arbornetworks.setRevisions(('2013-08-19 00:00', '2011-07-20 00:00', '2009-03-30 00:00', '2008-11-13 00:00', '2005-09-12 00:00',))
if mibBuilder.loadTexts: arbornetworks.setLastUpdated('201308190000Z')
if mibBuilder.loadTexts: arbornetworks.setOrganization('Arbor Networks, Inc.')
arbornetworksProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 9694, 1))
if mibBuilder.loadTexts: arbornetworksProducts.setStatus('current')
arborExperimental = ObjectIdentity((1, 3, 6, 1, 4, 1, 9694, 2))
if mibBuilder.loadTexts: arborExperimental.setStatus('current')
mibBuilder.exportSymbols("ARBOR-SMI", arborExperimental=arborExperimental, arbornetworks=arbornetworks, arbornetworksProducts=arbornetworksProducts, PYSNMP_MODULE_ID=arbornetworks)
|
# default value from class context
class A:
FOO = 1
def foo(self, param=F<ref>OO):
pass
|
class InfectionObserver:
"""
As the output.hdf table for a distributed run has only one row per run,
this data needs to be saved in wide format
For each step, it will have one column for infection prevalence, and one column for infection incidence
"""
def __init__(self):
self.step = 0
self.data = {'prevalence_0': 0, 'incidence_0': 0} # TODO - make it initial prevalence
def setup(self, builder):
self.population_view = builder.population.get_view(['infected'])
builder.event.register_listener('collect_metrics', self.on_collect_metrics)
builder.value.register_value_modifier('metrics', self.metrics)
def on_collect_metrics(self, event):
self.step += 1
pop = self.population_view.get(event.index)
prevalence = pop.infected.mean() # TODO - should it be absolute or relative?
incidence = prevalence - self.data[f'prevalence_{self.step - 1}'] # TODO - should it be the hazard?
self.data[f'prevalence_{self.step}'] = prevalence
self.data[f'incidence_{self.step}'] = incidence
def metrics(self, index, metrics):
# Recall that metrics is a dictionary
for key in self.data.keys():
value = self.data[key]
metrics[key] = value
return metrics
|
class EvaluationTask:
"""EvaluationTask class, containing EvaluationTask information."""
def __init__(self, json, client):
self._json = json
self.id = json["id"]
self.initial_response = getattr(json, "initial_response", None)
self.expected_response = json["expected_response"]
self._client = client
def __hash__(self):
return hash(self.id)
def __str__(self):
return f"EvaluationTask(id={self.id})"
def __repr__(self):
return f"EvaluationTask({self._json})"
def as_dict(self):
"""Returns all attributes as a dictionary"""
return self._json
|
LOREM_IPSUM = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis
unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab
illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia
voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi
nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non
numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam,
quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem
vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum
fugiat quo voluptas nulla pariatur?
"""
|
class Solution:
def climbStairs(self, n: int) -> int:
if n == 1 or n == 0:
return 1
prev, curr = 1, 1
for i in range(2, n + 1):
temp = curr
curr += prev
prev = temp
return curr
|
#Given two cells of a chessboard. If they are painted in one color, print the word YES, and if in a different color - NO.
r = int(input("Row number of the first cell on Chessboard, r = ?"))
if ((r > 8) or (r < 1)):
print("Invalid row number for a Chessboard!")
exit()
c = int(input("The column number for the first cell on Chessboard, c = ?"))
if((c > 8) or (c <1)):
print("Invalid column number for a Chessboard!")
exit()
R = int(input("THe row number for the second cell on Chessboard, R = ?"))
if ((R > 8) or (R < 1)):
print("Invalid row number for a Chessboard!")
exit()
C = int(input("The column for the second cell on Chessboard, C = ?"))
if ((C > 8) or (C <1 )):
print("Invalid column number for a Chessboard!")
exit()
if ( ( r % 2 == 0) and ( (c % 2 == 0)) )or ( (r % 2 != 0) and (c % 2 != 0)):
if ( ((R %2 == 0)and(C% 2 ==0)) or (( R % 2 != 0)and(C %2 != 0)) ):
print("YES, The two given cells has the SAME color.")
else:
print("NO, The two given cells are NOT the same color")
elif ( ((r % 2 == 0) and(c %2 != 0)) or ((r % 2 != 0) and (c% 2 ==0)) ):
if ( ((R %2 == 0)and(C% 2 !=0)) or (( R % 2 != 0)and(C %2 == 0)) ):
print("YES, The two given cells has the SAME color.")
else:
print("NO, The two given cells are NOT the same color")
exit()
|
[
{
'date': '2022-01-01',
'description': 'Nyårsdagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2022-01-06',
'description': 'Trettondedag jul',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRF'
},
{
'date': '2022-04-15',
'description': 'Långfredagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2022-04-17',
'description': 'Påskdagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2022-04-18',
'description': 'Annandag påsk',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2022-05-01',
'description': 'Första maj',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2022-05-26',
'description': 'Kristi himmelsfärdsdag',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2022-06-05',
'description': 'Pingstdagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2022-06-06',
'description': 'Nationaldagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NF'
},
{
'date': '2022-06-24',
'description': 'Midsommarafton',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NV'
},
{
'date': '2022-06-25',
'description': 'Midsommardagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NV'
},
{
'date': '2022-11-05',
'description': 'Alla helgons dag',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRV'
},
{
'date': '2022-12-24',
'description': 'Julafton',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRF'
},
{
'date': '2022-12-25',
'description': 'Juldagen',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRF'
},
{
'date': '2022-12-26',
'description': 'Annandag jul',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NRF'
},
{
'date': '2022-12-31',
'description': 'Nyårsafton',
'locale': 'sv-SE',
'notes': '',
'region': '',
'type': 'NF'
}
]
|
#!/usr/bin/python3
def sin(x):
"""
sin(x)
"""
return 42
|
# In Python, functions are first class citizens.
# That means that, just like any other value, they can be passed as arguments to functions or assigned to variables.
# Here's a simple (yet not terribly useful) example to illustrate it:
def greet():
print("Hello!")
hello = greet # hello is another name for the greet function now.
hello()
# Let's move on to a more useful example.
# These don't _have_ to be lambdas. They could be normal functions too!
# I'm making them lambdas because they're really short.
avg = lambda seq: sum(seq) / len(seq)
total = lambda seq: sum(seq) # could just be `sum`
top = lambda seq: max(seq) # could just be `max`
students = [
{"name": "Rolf", "grades": (67, 90, 95, 100)},
{"name": "Bob", "grades": (56, 78, 80, 90)},
{"name": "Jen", "grades": (98, 90, 95, 99)},
{"name": "Anne", "grades": (100, 100, 95, 100)},
]
for student in students:
name = student["name"]
grades = student["grades"]
print(f"Student: {name}")
operation = input("Enter 'average', 'total', or 'top': ")
if operation == "average":
print(avg(grades))
elif operation == "total":
print(total(grades))
elif operation == "top":
print(top(grades))
# Here, you can see how we can store functions inside a dictionary—just as we could do with numbers, strings, or any other type of data.
# We're creating a dictionary of what would be user input to the function that we want to run in each case.
operations = {
"average": avg,
"total": total, # could just be `sum`
"top": top, # could just be `max`
}
# The `operations` dictionary could also be defined inline:
operations = {
"average": lambda seq: sum(seq) / len(seq),
"total": lambda seq: sum(seq), # could just be `sum`
"top": lambda seq: max(seq), # could just be `max`
}
# The rest of the code can make use of the `operations` dictionary
for student in students:
name = student["name"]
grades = student["grades"]
print(f"Student: {name}")
operation = input("Enter 'average', 'total', or 'top': ")
operation_function = operations[operation] # This means we don't need an if statement (but could get errors!)
print(operation_function(grades))
|
def extractBinhjamin(item):
"""
# Binhjamin
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (vol or chp or frag or postfix):
return False
if ('SRKJ' in item['title'] or 'SRKJ-Sayonara Ryuu' in item['tags']) and (chp or vol):
return buildReleaseMessageWithType(item, 'Sayonara Ryuusei Konnichiwa Jinsei', vol, chp, frag=frag, postfix=postfix)
if 'Unborn' in item['title']:
return buildReleaseMessageWithType(item, 'Unborn', vol, chp, frag=frag, postfix=postfix)
if 'Bu ni Mi' in item['title'] or '100 Years Of Martial Arts' in item['title']:
return buildReleaseMessageWithType(item, '100 Years Of Martial Arts', vol, chp, frag=frag, postfix=postfix)
return False
|
def int_to_byte(i):
return i.to_bytes(1, byteorder='big')
def byte_to_int(b):
return int.from_bytes(b, byteorder='big', signed=False)
|
class ServicePrincipal:
def __init__(self, client_id=None, tenant_id=None, credential=None):
self.client_id = client_id
self.tenant_id = tenant_id
self.credential = credential
def from_dict(self, service_principal_dict):
self.client_id = service_principal_dict['client_id']
self.tenant_id = service_principal_dict['tenant_id']
self.credential = service_principal_dict['credential']
return self
|
# -*- coding: utf-8 -*-
"""Drive test constants."""
# Data
DRIVE_ROOT_WORKING = [
{
"drivewsid": "FOLDER::com.apple.CloudDocs::root",
"docwsid": "root",
"zone": "com.apple.CloudDocs",
"name": "",
"etag": "31",
"type": "FOLDER",
"assetQuota": 62418076,
"fileCount": 7,
"shareCount": 0,
"shareAliasCount": 0,
"directChildrenCount": 3,
"items": [
{
"dateCreated": "2019-12-12T14:33:55-08:00",
"drivewsid": "FOLDER::com.apple.Keynote::documents",
"docwsid": "documents",
"zone": "com.apple.Keynote",
"name": "Keynote",
"parentId": "FOLDER::com.apple.CloudDocs::root",
"etag": "2m",
"type": "APP_LIBRARY",
"maxDepth": "ANY",
"icons": [
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Keynote&field=icon120x120_iOS",
"type": "IOS",
"size": 120,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Keynote&field=icon80x80_iOS",
"type": "IOS",
"size": 80,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Keynote&field=icon40x40_iOS",
"type": "IOS",
"size": 40,
},
],
"supportedExtensions": [
"pptx",
"ppsx",
"pps",
"pot",
"key-tef",
"ppt",
"potx",
"potm",
"pptm",
"ppsm",
"key",
"kth",
],
"supportedTypes": [
"com.microsoft.powerpoint.pps",
"com.microsoft.powerpoint.pot",
"com.microsoft.powerpoint.ppt",
"org.openxmlformats.presentationml.template.macroenabled",
"org.openxmlformats.presentationml.slideshow.macroenabled",
"com.apple.iwork.keynote.key-tef",
"org.openxmlformats.presentationml.template",
"org.openxmlformats.presentationml.presentation.macroenabled",
"com.apple.iwork.keynote.key",
"com.apple.iwork.keynote.kth",
"org.openxmlformats.presentationml.presentation",
"org.openxmlformats.presentationml.slideshow",
"com.apple.iwork.keynote.sffkey",
"com.apple.iwork.keynote.sffkth",
],
},
{
"dateCreated": "2019-12-12T14:33:55-08:00",
"drivewsid": "FOLDER::com.apple.Numbers::documents",
"docwsid": "documents",
"zone": "com.apple.Numbers",
"name": "Numbers",
"parentId": "FOLDER::com.apple.CloudDocs::root",
"etag": "3k",
"type": "APP_LIBRARY",
"maxDepth": "ANY",
"icons": [
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Numbers&field=icon120x120_iOS",
"type": "IOS",
"size": 120,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Numbers&field=icon80x80_iOS",
"type": "IOS",
"size": 80,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Numbers&field=icon40x40_iOS",
"type": "IOS",
"size": 40,
},
],
"supportedExtensions": [
"hh",
"ksh",
"lm",
"xlt",
"c++",
"f95",
"lid",
"csv",
"numbers",
"php4",
"hp",
"py",
"nmbtemplate",
"lmm",
"jscript",
"php3",
"crash",
"patch",
"java",
"ym",
"xlam",
"text",
"mi",
"exp",
"adb",
"jav",
"ada",
"ii",
"defs",
"mm",
"cpp",
"cxx",
"pas",
"diff",
"pch++",
"javascript",
"panic",
"rb",
"ads",
"tcsh",
"ypp",
"yxx",
"ph3",
"ph4",
"phtml",
"xltx",
"hang",
"rbw",
"f77",
"for",
"js",
"h++",
"mig",
"gpurestart",
"mii",
"zsh",
"m3u",
"pch",
"sh",
"xltm",
"applescript",
"tsv",
"ymm",
"shutdownstall",
"cc",
"xlsx",
"scpt",
"c",
"inl",
"f",
"numbers-tef",
"h",
"i",
"hpp",
"hxx",
"dlyan",
"xla",
"l",
"cp",
"m",
"lpp",
"lxx",
"txt",
"r",
"s",
"xlsm",
"spin",
"php",
"csh",
"y",
"bash",
"m3u8",
"pl",
"f90",
"pm",
"xls",
],
"supportedTypes": [
"org.openxmlformats.spreadsheetml.sheet",
"com.microsoft.excel.xla",
"com.apple.iwork.numbers.template",
"org.openxmlformats.spreadsheetml.sheet.macroenabled",
"com.apple.iwork.numbers.sffnumbers",
"com.apple.iwork.numbers.numbers",
"public.plain-text",
"com.microsoft.excel.xlt",
"org.openxmlformats.spreadsheetml.template",
"com.microsoft.excel.xls",
"public.comma-separated-values-text",
"com.apple.iwork.numbers.numbers-tef",
"org.openxmlformats.spreadsheetml.template.macroenabled",
"public.tab-separated-values-text",
"com.apple.iwork.numbers.sfftemplate",
"com.microsoft.excel.openxml.addin",
],
},
{
"dateCreated": "2019-12-12T14:33:55-08:00",
"drivewsid": "FOLDER::com.apple.Pages::documents",
"docwsid": "documents",
"zone": "com.apple.Pages",
"name": "Pages",
"parentId": "FOLDER::com.apple.CloudDocs::root",
"etag": "km",
"type": "APP_LIBRARY",
"maxDepth": "ANY",
"icons": [
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Pages&field=icon120x120_iOS",
"type": "IOS",
"size": 120,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Pages&field=icon80x80_iOS",
"type": "IOS",
"size": 80,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Pages&field=icon40x40_iOS",
"type": "IOS",
"size": 40,
},
],
"supportedExtensions": [
"hh",
"ksh",
"lm",
"c++",
"f95",
"lid",
"php4",
"hp",
"py",
"lmm",
"jscript",
"php3",
"crash",
"patch",
"pages",
"java",
"ym",
"text",
"mi",
"exp",
"adb",
"jav",
"ada",
"ii",
"defs",
"mm",
"cpp",
"cxx",
"pas",
"pages-tef",
"diff",
"pch++",
"javascript",
"panic",
"rb",
"ads",
"tcsh",
"rtfd",
"ypp",
"yxx",
"doc",
"ph3",
"ph4",
"template",
"phtml",
"hang",
"rbw",
"f77",
"dot",
"for",
"js",
"h++",
"mig",
"gpurestart",
"mii",
"zsh",
"m3u",
"pch",
"sh",
"applescript",
"ymm",
"shutdownstall",
"dotx",
"cc",
"scpt",
"c",
"rtf",
"inl",
"f",
"h",
"i",
"hpp",
"hxx",
"dlyan",
"l",
"cp",
"m",
"lpp",
"lxx",
"docx",
"txt",
"r",
"s",
"spin",
"php",
"csh",
"y",
"bash",
"m3u8",
"pl",
"f90",
"pm",
],
"supportedTypes": [
"com.apple.rtfd",
"com.apple.iwork.pages.sffpages",
"com.apple.iwork.pages.sfftemplate",
"com.microsoft.word.dot",
"com.apple.iwork.pages.pages",
"com.microsoft.word.doc",
"org.openxmlformats.wordprocessingml.template",
"org.openxmlformats.wordprocessingml.document",
"com.apple.iwork.pages.pages-tef",
"com.apple.iwork.pages.template",
"public.rtf",
"public.plain-text",
],
},
{
"dateCreated": "2019-12-12T14:33:55-08:00",
"drivewsid": "FOLDER::com.apple.Preview::documents",
"docwsid": "documents",
"zone": "com.apple.Preview",
"name": "Preview",
"parentId": "FOLDER::com.apple.CloudDocs::root",
"etag": "bv",
"type": "APP_LIBRARY",
"maxDepth": "ANY",
"icons": [
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Preview&field=icon32x32_OSX",
"type": "OSX",
"size": 32,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Preview&field=icon128x128_OSX",
"type": "OSX",
"size": 128,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Preview&field=icon16x16_OSX",
"type": "OSX",
"size": 16,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Preview&field=icon256x256_OSX",
"type": "OSX",
"size": 256,
},
{
"url": "https://p31-drivews.icloud.com/getIcons?id=com.apple.Preview&field=icon64x64_OSX",
"type": "OSX",
"size": 64,
},
],
"supportedExtensions": [
"ps",
"nmbtemplate",
"astc",
"mpkg",
"prefpane",
"pef",
"mos",
"qlgenerator",
"scptd",
"raf",
"saver",
"band",
"dng",
"pict",
"exr",
"kth",
"appex",
"app",
"pages-tef",
"slidesaver",
"pluginkit",
"distz",
"ai",
"png",
"eps",
"raw",
"pvr",
"mpo",
"ktx",
"nrw",
"lpdf",
"pfm",
"3fr",
"template",
"imovielibrary",
"pwl",
"iwwebpackage",
"wdgt",
"tga",
"pgm",
"erf",
"jpeg",
"j2c",
"bundle",
"key",
"j2k",
"abc",
"arw",
"xpc",
"pic",
"ppm",
"menu",
"icns",
"mrw",
"plugin",
"mdimporter",
"bmp",
"numbers",
"dae",
"dist",
"pic",
"rw2",
"nef",
"tif",
"pages",
"sgi",
"ico",
"theater",
"gbproj",
"webplugin",
"cr2",
"fff",
"webp",
"jp2",
"sr2",
"rtfd",
"pbm",
"pkpass",
"jfx",
"fpbf",
"psd",
"xbm",
"tiff",
"avchd",
"gif",
"pntg",
"rwl",
"pset",
"pkg",
"dcr",
"hdr",
"jpe",
"pct",
"jpg",
"jpf",
"orf",
"srf",
"numbers-tef",
"iconset",
"crw",
"fpx",
"dds",
"pdf",
"jpx",
"key-tef",
"efx",
"hdr",
"srw",
],
"supportedTypes": [
"com.adobe.illustrator.ai-image",
"com.kodak.flashpix-image",
"public.pbm",
"com.apple.pict",
"com.ilm.openexr-image",
"com.sgi.sgi-image",
"com.apple.icns",
"public.heifs",
"com.truevision.tga-image",
"com.adobe.postscript",
"public.camera-raw-image",
"public.pvr",
"public.png",
"com.adobe.photoshop-image",
"public.heif",
"com.microsoft.ico",
"com.adobe.pdf",
"public.heic",
"public.xbitmap-image",
"com.apple.localized-pdf-bundle",
"public.3d-content",
"com.compuserve.gif",
"public.avci",
"public.jpeg",
"com.apple.rjpeg",
"com.adobe.encapsulated-postscript",
"com.microsoft.bmp",
"public.fax",
"org.khronos.astc",
"com.apple.application-bundle",
"public.avcs",
"public.webp",
"public.heics",
"com.apple.macpaint-image",
"public.mpo-image",
"public.jpeg-2000",
"public.tiff",
"com.microsoft.dds",
"com.apple.pdf-printer-settings",
"org.khronos.ktx",
"public.radiance",
"com.apple.package",
"public.folder",
],
},
{
"drivewsid": "FOLDER::com.apple.CloudDocs::1C7F1760-D940-480F-8C4F-005824A4E05B",
"docwsid": "1C7F1760-D940-480F-8C4F-005824A4E05B",
"zone": "com.apple.CloudDocs",
"name": "iCloudPy",
"parentId": "FOLDER::com.apple.CloudDocs::root",
"etag": "30",
"type": "FOLDER",
"assetQuota": 42199575,
"fileCount": 2,
"shareCount": 0,
"shareAliasCount": 0,
"directChildrenCount": 1,
},
],
"numberOfItems": 5,
}
]
# App specific folder (Keynote, Numbers, Pages, Preview ...) type=APP_LIBRARY
DRIVE_ROOT_INVALID = [
{"drivewsid": "FOLDER::com.apple.CloudDocs::documents", "status": "ID_INVALID"}
]
DRIVE_FOLDER_WORKING = [
{
"drivewsid": "FOLDER::com.apple.CloudDocs::1C7F1760-D940-480F-8C4F-005824A4E05B",
"docwsid": "1C7F1760-D940-480F-8C4F-005824A4E05B",
"zone": "com.apple.CloudDocs",
"name": "iCloudPy",
"parentId": "FOLDER::com.apple.CloudDocs::root",
"etag": "30",
"type": "FOLDER",
"assetQuota": 42199575,
"fileCount": 2,
"shareCount": 0,
"shareAliasCount": 0,
"directChildrenCount": 1,
"items": [
{
"drivewsid": "FOLDER::com.apple.CloudDocs::D5AA0425-E84F-4501-AF5D-60F1D92648CF",
"docwsid": "D5AA0425-E84F-4501-AF5D-60F1D92648CF",
"zone": "com.apple.CloudDocs",
"name": "Test",
"parentId": "FOLDER::com.apple.CloudDocs::1C7F1760-D940-480F-8C4F-005824A4E05B",
"etag": "2z",
"type": "FOLDER",
"assetQuota": 42199575,
"fileCount": 2,
"shareCount": 0,
"shareAliasCount": 0,
"directChildrenCount": 2,
}
],
"numberOfItems": 1,
}
]
DRIVE_SUBFOLDER_WORKING = [
{
"drivewsid": "FOLDER::com.apple.CloudDocs::D5AA0425-E84F-4501-AF5D-60F1D92648CF",
"docwsid": "D5AA0425-E84F-4501-AF5D-60F1D92648CF",
"zone": "com.apple.CloudDocs",
"name": "Test",
"parentId": "FOLDER::com.apple.CloudDocs::1C7F1760-D940-480F-8C4F-005824A4E05B",
"etag": "2z",
"type": "FOLDER",
"assetQuota": 42199575,
"fileCount": 2,
"shareCount": 0,
"shareAliasCount": 0,
"directChildrenCount": 2,
"items": [
{
"drivewsid": "FILE::com.apple.CloudDocs::33A41112-4131-4938-9691-7F356CE3C51D",
"docwsid": "33A41112-4131-4938-9691-7F356CE3C51D",
"zone": "com.apple.CloudDocs",
"name": "Document scanné 2",
"parentId": "FOLDER::com.apple.CloudDocs::D5AA0425-E84F-4501-AF5D-60F1D92648CF",
"dateModified": "2020-04-27T21:37:36Z",
"dateChanged": "2020-04-27T14:44:29-07:00",
"size": 19876991,
"etag": "2k::2j",
"extension": "pdf",
"hiddenExtension": True,
"lastOpenTime": "2020-04-27T21:37:36Z",
"type": "FILE",
},
{
"drivewsid": "FILE::com.apple.CloudDocs::516C896C-6AA5-4A30-B30E-5502C2333DAE",
"docwsid": "516C896C-6AA5-4A30-B30E-5502C2333DAE",
"zone": "com.apple.CloudDocs",
"name": "Scanned document 1",
"parentId": "FOLDER::com.apple.CloudDocs::D5AA0425-E84F-4501-AF5D-60F1D92648CF",
"dateModified": "2020-05-03T00:15:17Z",
"dateChanged": "2020-05-02T17:16:17-07:00",
"size": 21644358,
"etag": "32::2x",
"extension": "pdf",
"hiddenExtension": True,
"lastOpenTime": "2020-05-03T00:24:25Z",
"type": "FILE",
},
],
"numberOfItems": 2,
}
]
DRIVE_FILE_DOWNLOAD_WORKING = {
"document_id": "516C896C-6AA5-4A30-B30E-5502C2333DAE",
"data_token": {
# pylint: disable=C0301
"url": "https://cvws.icloud-content.com/B/signature1ref_signature1/Scanned+document+1.pdf?o=object1&v=1&x=3&a=token1&e=1588472097&k=wrapping_key1&fl=&r=request&ckc=com.apple.clouddocs&ckz=com.apple.CloudDocs&p=31&s=s1",
"token": "token1",
"signature": "signature1",
"wrapping_key": "wrapping_key1==",
"reference_signature": "ref_signature1",
},
"thumbnail_token": {
# pylint: disable=C0301
"url": "https://cvws.icloud-content.com/B/signature2ref_signature2/Scanned+document+1.jpg?o=object2&v=1&x=3&a=token2&e=1588472097&k=wrapping_key2&fl=&r=request&ckc=com.apple.clouddocs&ckz=com.apple.CloudDocs&p=31&s=s2",
"token": "token2",
"signature": "signature2",
"wrapping_key": "wrapping_key2==",
"reference_signature": "ref_signature2",
},
"double_etag": "32::2x",
}
|
class _MockRouter:
root_viewset_cls = None
class NestedRouteTestCaseMixin:
def wrap_with_parents(self, child_class, *parent_classes):
"""
Wraps the child_class to be a nested route below the given
parent classes, where the last parent class is the "top route"
"""
all_viewsets = [child_class] + list(parent_classes)
all_viewsets.reverse()
most_child = None
for i, viewset in enumerate(all_viewsets):
if i == 0:
most_child = view_class = type(
f'{viewset.__name__}__TestWrapper',
(viewset,), dict(vars(viewset))
)
continue
parent_viewset = most_child
router = _MockRouter()
router.root_viewset_cls = parent_viewset
view_class = type(
f'{viewset.__name__}__NestedTestWrapper',
(viewset,), dict(vars(viewset))
)
view_class.check_parent_permissions = False
view_class.router = router
most_child = view_class
return most_child
def with_request_kwargs(self, view, request, kwargs):
request.parser_context = {'kwargs': kwargs}
return view(request, **request.parser_context['kwargs'])
|
num_inpt = a = 7484
num_inpt_2 = b = 12312
while num_inpt != num_inpt_2: # nod
if num_inpt > num_inpt_2:
num_inpt = num_inpt - num_inpt_2
elif num_inpt_2 > num_inpt:
num_inpt_2 = num_inpt_2 - num_inpt
nok = a * b // num_inpt_2 #nok
print(nok)
|
"""This problem was asked by Dropbox.
Given a list of words, determine whether the words can be chained to form a circle.
A word X can be placed in front of another word Y in a circle if the last character
of X is same as the first character of Y.
For example, the words ['chair', 'height', 'racket', touch', 'tunic'] can form the
following circle: chair --> racket --> touch --> height --> tunic --> chair."""
|
class State:
def __init__(self, element = None):
if element == None:
# create initial state
self.element = self.get_initial_state()
else:
self.element = element
def get_initial_state(self):
"""
Este metodo retorna o estado incial da busca
"""
initial_state = "Default"
return initial_state
def successor_function(self, data):
"""
Esta é a função sucessora. Gera todo os possiveis
elementes que podem ser alcançados a partir do estado atual.
"""
return data[self.element]
def objective_function(self, objective):
"""
Este método verifica se o caminho está no estado objetivo
"""
# verifica que o element atual eh o carregamento
return self.element == objective
|
def count_and_print(f, l):
c=0
for e in l:
f.write(e)
f.write("\n")
c+=1
f.close()
return c
|
def readFlat(filename, delimiter):
f = open(filename)
ans = []
for line in f:
ans.append(map(lambda x:float(x), filter(lambda x:len(x)>0,line.split(delimiter))))
return ans
|
#-*-coding:utf8;-*-
#qpy:console
print(5 * '-', 'CONVERSOR DE MOEDAS', 5 * '-')
print('\n')
r = float(input('DIGITE O VALOR EM REAIS: '))
d = r / 5.29
e = r / 6.41
print('\n')
print(' CONVERSÃO - USS: {:.2f} / EURO: {:.2f}'.format(d, e))
|
"""
test_multi_group.py
Author: Jordan Mirocha
Affiliation: University of Colorado at Boulder
Created on: Sun Mar 24 01:04:54 2013
Description:
"""
|
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
def b(x):
msg = "x is %s" % x
print(msg)
|
class DoubleNode:
def __init__(self, value):
self.value = value
self.next = None
self.previous = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def append(self, value):
if self.head == None:
self.head = DoubleNode(value)
self.tail = self.head
return
new_node = DoubleNode(value)
new_node.previous = self.tail
self.tail.next = new_node
self.tail = self.tail.next
def to_list(self):
#Write a function to convert DoublyLinkedList to Python list
list = []
node = self.head
while node:
list.append(node.value)
node = node.next
return list
def to_list_reverse(self):
list = []
node = self.tail
while node:
list.append(node.value)
node = node.previous
return list
|
# Authors: Soledad Galli <solegalli@protonmail.com>
# License: BSD 3 clause
# functions shared across transformers
def _define_variables(variables):
# Check that variable names are passed in a list.
# Can take None as value
if not variables or isinstance(variables, list):
variables = variables
else:
variables = [variables]
return variables
def _find_numerical_variables(X, variables=None):
# Find numerical variables in a data set or check that
# the variables entered by the user are numerical.
if not variables:
variables = list(X.select_dtypes(include='number').columns)
else:
if len(X[variables].select_dtypes(exclude='number').columns) != 0:
raise TypeError("Some of the variables are not numerical. Please cast them as numerical "
"before calling this transformer")
return variables
def _find_categorical_variables(X, variables=None):
# Find categorical variables in a data set or check that
# the variables entered by user are categorical.
if not variables:
variables = list(X.select_dtypes(include='O').columns)
else:
# variables indicated by user
if len(X[variables].select_dtypes(exclude='O').columns) != 0:
raise TypeError("Some of the variables are not categorical. Please cast them as object "
"before calling this transformer")
return variables
|
K, A, B = map(int, input().split())
if B-A <= 2:
print(K+1)
exit(0)
if 1+(K-2) < A:
print(K+1)
exit(0)
exchange_times, last = divmod(K-(A-1), 2)
profit = B - A
ans = A + exchange_times * profit + last
print(ans)
|
def foo():
"""
Parameters:
a: foo
Returns:
None
"""
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/7/17 8:03 下午
# @Author : Thomas
# @File : URL化.py
# @Description: URL化。编写一种方法,将字符串中的空格全部替换为%20。假定该字符串尾部有足够的空间存放新增字符,并且知道字符串的“真实”长度。
# 示例 1:
#
# 输入:"Mr John Smith ", 13
# 输出:"Mr%20John%20Smith"
# 示例 2:
#
# 输入:" ", 5
# 输出:"%20%20%20%20%20"
#
#
# 提示:
#
# 字符串长度在 [0, 500000] 范围内。
#
#
# 来源:力扣(LeetCode)
# 链接:https://leetcode-cn.com/problems/string-to-url-lcci
# 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
class Solution:
def replaceSpaces(self, S: str, length: int) -> str:
# offer消失法。。。
# 注意replace方法不会改变原始字符串,而是生成一个拷贝
# return S[:length].replace(' ', '%20')
# 字符串拼接性能巨差 !!!
# res = ""
# for i in range(length):
# res += S[i] if S[i] != ' ' else '%20'
# return res
# 字符串join的方式性能要好些
res = []
for c in S[:length]:
if c == ' ':
c = '%20'
res.append(c)
return ''.join(res)
|
"""
Desafio 009
Faça um programa que leia um número inteiro qualquer e mostre
na tela a sua tabuada.
"""
t = int(input('Digite o número para ver sua tabuada: '))
risco = lambda r='-', q=13: print(f"{r}"*q)
risco()
for sla in range(1, 11):
print(f'{t} x {sla:2} = {t*sla}')
risco()
|
m = "sdjlwdd"
c
print(mBytes)
mInt = int.from_bytes(mBytes, byteorder="big")
mBytes2 = mInt.to_bytes(((mInt.bit_length() + 7) // 8), byteorder="big")
m2 = mBytes2.decode("utf-8")
print(m == m2)
|
# Q:编写一个程序,它将找到所有这些数字,可被7整除,但不是5的倍数,2000年至3200年(包括在内)。得到的数字应按逗号分隔的顺序打印在一行上。
# HINT:考虑使用range(#begin, #end)方法
l = []
for i in range(2000,3201):
if (i%7==0) and (i%5!=0):
l.append(str(i))
print (l)
|
"""
Given the names and grades for each student in a Physics class of N students, store them in a nested list
and print the name(s) of any student(s) having the second lowest grade.
Note: If there are multiple students with the same grade, order their names alphabetically and print each name on a new line.
"""
python_students = [['Harry', 37.21], ['Berry', 37.21],
['Tina', 37.2], ['Akriti', 41], ['Harsh', 39]]
new_list = [name for record in python_students for name in record]
print(new_list)
|
# -*- coding: UTF-8 -*-
# vim: ts=4 sts=4 sw=4 tw=100 sta et
class NotInRole(Exception):
pass
def check_role(my_roles, requested_roles):
if not my_roles:
return True
for role in my_roles:
if role in requested_roles:
return True
raise NotInRole()
|
"""Write a program which will find all such numbers which are divisible
by 7 but are not a multiple of 5, between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma-separated sequence on a
single line."""
for num in range(2000, 3201):
if num % 7 == 0 and num % 5 != 0:
print(f"{num}", end=",")
|
# -*- coding: utf-8 -*-
{
'name': "odoo-s3",
'summary': """
Stores attachments in Amazon S3 instead of the local drive""",
'description': """
In large deployments, Odoo workers need to share a distributed
filestore. Amazon S3 can store files (e.g. attachments and
pictures), such that all Odoo workers can access the same files.
This module lets you configure access to an S3 bucket from Odoo,
by settings a System parameter.
""",
'author': "Marc Lijour",
'website': "https://github.com/marclijour/odoo-s3",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Technical Settings',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base'],
# only the admin user should be having access -so default is ok
# 'data': [
# 'security/ir.model.access.csv',
# ],
}
|
class PingError(Exception):
pass
class TimeExceeded(PingError):
pass
class TimeToLiveExpired(TimeExceeded):
def __init__(self, message="Time exceeded: Time To Live expired.", ip_header=None, icmp_header=None):
self.ip_header = ip_header
self.icmp_header = icmp_header
self.message = message
super().__init__(self.message)
class DestinationUnreachable(PingError):
def __init__(self, message="Destination unreachable.", ip_header=None, icmp_header=None):
self.ip_header = ip_header
self.icmp_header = icmp_header
self.message = message if self.ip_header is None else message + " (Host='{}')".format(self.ip_header.get("src_addr"))
super().__init__(self.message)
class DestinationHostUnreachable(DestinationUnreachable):
def __init__(self, message="Destination unreachable: Host unreachable.", ip_header=None, icmp_header=None):
self.ip_header = ip_header
self.icmp_header = icmp_header
self.message = message if self.ip_header is None else message + " (Host='{}')".format(self.ip_header.get("src_addr"))
super().__init__(self.message)
class HostUnknown(PingError):
def __init__(self, message="Cannot resolve: Unknown host.", dest_addr=None):
self.dest_addr = dest_addr
self.message = message if self.dest_addr is None else message + " (Host='{}')".format(self.dest_addr)
super().__init__(self.message)
class Timeout(PingError):
def __init__(self, message="Request timeout for ICMP packet.", timeout=None):
self.timeout = timeout
self.message = message if self.timeout is None else message + " (Timeout={}s)".format(self.timeout)
super().__init__(self.message)
|
# -*- coding: utf-8 -*-
description = 'Sample table'
group = 'lowlevel'
devices = dict(
st_phi = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-50, 116.1),
speed = 1.5,
visibility = (),
),
co_phi = device('nicos.devices.generic.VirtualCoder',
motor = 'st_phi',
visibility = (),
),
phi = device('nicos.devices.generic.Axis',
description = 'Sample scattering angle Two Theta',
motor = 'st_phi',
coder = 'co_phi',
precision = 0.005,
offset = 0.21, #May 2017 done by GE
maxtries = 10,
loopdelay = 1,
jitter = 0.2,
dragerror = 1,
),
st_psi = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-1000, 1000),
userlimits = (5, 355),
speed = 2,
visibility = (),
),
psi_puma = device('nicos.devices.generic.Axis',
description = 'Sample rocking angle Theta',
motor = 'st_psi',
precision = 0.005,
offset = 0,
maxtries = 5,
),
psi = device('nicos.devices.generic.DeviceAlias',
description = 'Sample rocking angle Theta',
alias = 'psi_puma',
# when magnet is on :
# alias = 'sth_m7T5_ccr',
devclass = 'nicos.devices.generic.Axis',
# when magnet is on :
# devclass = 'nicos.devices.taco.Axis',
),
# Tilting
st_sgx = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-15.6, 15.6),
speed = 1,
visibility = (),
),
st_sgy = device('nicos.devices.generic.VirtualMotor',
unit = 'deg',
abslimits = (-15.6, 15.6),
speed = 1,
visibility = (),
),
sgx = device('nicos.devices.generic.Axis',
description = 'Sample tilt around X',
motor = 'st_sgx',
precision = 0.02,
offset = 0,
fmtstr = '%.3f',
maxtries = 5,
),
sgy = device('nicos.devices.generic.Axis',
description = 'Sample tilt around Y',
motor = 'st_sgy',
precision = 0.02,
offset = 0,
fmtstr = '%.3f',
maxtries = 5,
),
# Translation
st_stx = device('nicos.devices.generic.VirtualMotor',
unit = 'mm',
abslimits = (-18.1, 18.1),
speed = 1,
visibility = (),
),
st_sty = device('nicos.devices.generic.VirtualMotor',
unit = 'mm',
abslimits = (-18.1, 18.1),
speed = 1,
visibility = (),
),
st_stz = device('nicos.devices.generic.VirtualMotor',
unit = 'mm',
abslimits = (-20, 20),
speed = 1,
visibility = (),
),
stx = device('nicos.devices.generic.Axis',
description = 'Sample translation along X',
motor = 'st_stx',
precision = 0.05,
offset = 0.0,
fmtstr = '%.3f',
maxtries = 9,
loopdelay = 1,
abslimits = (-18.1, 18.1),
),
sty = device('nicos.devices.generic.Axis',
description = 'Sample translation along Y',
motor = 'st_sty',
precision = 0.05,
offset = 0.0,
fmtstr = '%.3f',
maxtries = 9,
loopdelay = 1,
),
stz = device('nicos.devices.generic.Axis',
description = 'Sample translation along Z',
motor = 'st_stz',
precision = 0.1,
offset = 0,
fmtstr = '%.2f',
maxtries = 10,
loopdelay = 2,
),
vg1 = device('nicos.devices.tas.VirtualGonio',
description = 'Gonio along orient1 reflex',
cell = 'Sample',
gx = 'sgx',
gy = 'sgy',
axis = 1,
unit = 'deg',
),
vg2 = device('nicos.devices.tas.VirtualGonio',
description = 'Gonio along orient2 reflex',
cell = 'Sample',
gx = 'sgx',
gy = 'sgy',
axis = 2,
unit = 'deg',
),
)
alias_config = {
'psi': {'psi_puma': 0},
}
|
# demo of looping through the characters of a string, using the sorted and reversed functions
s = input("Enter a string:")
n = len(s)
print("The first character of", s, "is", s[0])
print("The entered string will appear character wise as:")
for i in range(0, n):
print(s[i])
print("The entered string will appear character wise as:")
for i in s:
print(i)
print("String with its characters sorted is", sorted(s))
print("String in reverse form is", "".join(reversed(s)))
|
# ------------------------------------------------------------------------------------
# Tutorial: How to make a recursive function
# A recursive function is a function that calls itself
# ------------------------------------------------------------------------------------
# find the factorial of a user entered number
# the 'def' keyword is used to declare a function. the structure of a function is:
mul = 1
def fact(num):
if num == 1:
return num
else:
return num * fact(num - 1)
num = int(input('Enter a number to get the factorial of it: '))
if num == 0:
print("Factorial of 0: 1")
else:
print("Factorial of ", num, ":", fact(num))
# -----------------------------------------------------------------------------------
# Challenge: create a recursive function that makes a countdown from a user entered number till zero
# ------------------------------------------------------------------------------------
|
class BaseError(Exception):
"""Base Error Class"""
def __init__(self, code=400, message='', status='', field=None):
Exception.__init__(self)
self.code = code
self.message = message
self.status = status
self.field = field
def to_dict(self):
return {'code': self.code,
'message': self.message,
'status': self.status,
'field': self.field, }
def __str__(self):
return self.message
class NotFoundError(BaseError):
def __init__(self, message='Not found'):
BaseError.__init__(self)
self.code = 404
self.message = message
self.status = 'NOT_FOUND'
class NotAuthorizedError(BaseError):
def __init__(self, message='Unauthorized'):
BaseError.__init__(self)
self.code = 401
self.message = message
self.status = 'NOT_AUTHORIZED'
class PermissionDeniedError(BaseError):
def __init__(self, message='Permission denied'):
BaseError.__init__(self)
self.code = 403
self.message = message
self.status = 'PERMISSION_DENIED'
class ValidationError(BaseError):
def __init__(self, field, message='Invalid field'):
BaseError.__init__(self)
self.code = 400
self.message = message
self.status = 'INVALID_FIELD'
self.field = field
class ServerError(BaseError):
def __init__(self, message='Internal server error'):
BaseError.__init__(self)
self.code = 500
self.message = message
self.status = 'SERVER_ERROR'
|
"""
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary
representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
"""
def count_bits(n):
return sum([int(n) for n in bin(n)[2:]])
print(count_bits(0))
print(count_bits(4))
print(count_bits(7))
print(count_bits(9))
print(count_bits(10))
|
#03_personal-info.py
space= " "
firstName = input("What is your first name?")
lastName = input("What is your last name?")
location = input("What is your location?")
age = input("What is your age?")
print("Hi "+ firstName + space + lastName +"! Your location is "+ location + " and you are "+age + " years old!")
|
class Reply(object):
"""{
"kind": "drive#commentReply",
"replyId": string,
"createdDate": datetime,
"modifiedDate": datetime,
"author": {
"kind": "drive#user",
"displayName": string,
"picture": {
"url": string
},
"isAuthenticatedUser": boolean,
"permissionId": string,
"emailAddress": string
},
"htmlContent": string,
"content": string,
"deleted": boolean,
"verb": string
}"""
def __init__(self, _reply):
self._reply = _reply
class Comment(object):
"""{
"kind": "drive#comment",
"selfLink": string,
"commentId": string,
"createdDate": datetime,
"modifiedDate": datetime,
"author": {
"kind": "drive#user",
"displayName": string,
"picture": {
"url": string
},
"isAuthenticatedUser": boolean,
"permissionId": string,
"emailAddress": string
},
"htmlContent": string,
"content": string,
"deleted": boolean,
"status": string,
"context": {
"type": string,
"value": string
},
"anchor": string,
"fileId": string,
"fileTitle": string,
"replies": [
replies Resource
]
}"""
def __init__(self, _comment):
self._comment = _comment
@property
def text(self):
return self._comment.get("content")
@property
def status(self):
return self._comment.get("status")
@property
def author(self):
return self._comment["author"].get("displayName")
@property
def link(self):
return self._comment.get("selfLink")
@property
def replies(self):
return [Reply(obj) for obj in self._comment.get("replies", []) if not obj.get("deleted")]
|
# Space : O(len(word))
# Time : O(n * len(word))
class Solution:
def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
ans = []
pn = len(pattern)
for word in words:
if len(word) != pn:
continue
mem1, mem2 = {}, {}
defect = False
for i in range(pn):
if word[i] not in mem1:
mem1[word[i]] = pattern[i]
elif mem1[word[i]] != pattern[i]:
defect = True
break
if pattern[i] not in mem2:
mem2[pattern[i]] = word[i]
elif mem2[pattern[i]] != word[i]:
defect = True
break
if defect:
continue
if len(mem1) == len(mem2):
ans.append(word)
return ans
|
def indent(string, level=1, lstrip_first=False):
"""Multiline string indent.
Indent each line of the provided string by the specified level.
Args:
string: The string to indent, possibly containing linebreaks.
level: The level to indent (``level * ' '``). Defaults to 1.
lstrip_first: If this is `True`, then the first line is not indented.
Defaults to `False`.
Returns:
Indented string.
"""
out = '\n'.join((level * ' ') + i for i in string.splitlines())
if lstrip_first:
return out.lstrip()
return out
def is_namedtuple(x):
"""Return whether ``x`` is an instance of a namedtuple."""
return isinstance(x, tuple) and hasattr(x, '_fields')
def print_ast(tree, level=0, inline=False):
"""Recursive function to print the AST.
Args:
tree: An abstract syntax tree consisting of tuples, namedtuples and other objects.
level: The indent level, used for the recursive calls.
inline: Whether or not to indent the first line.
Returns:
Nothing. The AST is printed directly to stdout.
"""
if is_namedtuple(tree):
print(indent('{0.__class__.__name__}('.format(tree), level, inline))
for key, value in tree._asdict().items():
print(indent(key + '=', level + 1), end='')
print_ast(value, level + 1, True)
print(indent(')', level))
elif isinstance(tree, (tuple, list)):
if isinstance(tree, tuple):
braces = '()'
else:
braces = '[]'
if len(tree) == 0:
print(braces)
else:
print(indent(braces[0], level, inline))
for obj in tree:
print_ast(obj, level + 1)
print(indent(braces[1], level))
else:
print(indent(repr(tree), level, inline))
def find_column(input_text, token):
line_start = input_text.rfind('\n', 0, token.lexpos) + 1
return (token.lexpos - line_start) + 1
def find_last_line(input_text):
if not input_text:
return 0
line_no = input_text.count('\n')
return line_no
|
'''Crie um programa que leia idade e sexo de varias pessoas
e pergunte se o usuario quer conrinuar
no final mostre
quantas pessoas tem mais de 18 anos
quantos homens foram cadastrados
e quantas mulheres tem menos de 20 anos'''
pessoas_18 = mulher_20 = homen = 0
while True:
idade = int(input('Digite a Idade: '))
sexo = str(input('Escolha um sexo\n'
'[ M ] / [ F ] : ')).strip().upper()[0]
continuar = str(input('Quer continuar cadastrando?\n'
'[ S ] / [ N ] : ')).upper().strip()[0]
if continuar in 'N':
break
if idade > 18:
pessoas_18 += 1
if sexo in 'M':
homen += 1
if sexo in 'F' and idade < 20:
mulher_20 +=1
print(f'{pessoas_18} tem mais de 18 anos')
print(f'{homen} homens foram cadastrados')
print(f'{mulher_20} Mulher tem menos de 18 anos')
|
class GuidAttribute:
"""
Supplies an explicit System.Guid when an automatic GUID is undesirable.
GuidAttribute(guid: str)
"""
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return GuidAttribute()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,guid):
""" __new__(cls: type,guid: str) """
pass
Value=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the System.Guid of the class.
Get: Value(self: GuidAttribute) -> str
"""
|
# Common use case - File IO
# "Everything not saved will be lost."
#
# Prereq:
# string operations: split(), strip(), format(), join()
# list operations: append()
# built-in functions: len(), open()
#
# Reading:
# open()
# https://docs.python.org/3/library/functions.html#open
# string.strip()
# https://stackoverflow.com/a/13013812/4570438
#
# Advanced topic: the "with" construct
# https://docs.python.org/3/reference/compound_stmts.html#with
#
# Stanley H.I. Lio
# hlio@hawaii.edu
# OCN318, S18, S19
# to write to a file:
f = open('offshore_assets.txt', 'w') # homework: look up the 'r' and 'a' options
f.write('squirrel tail')
f.write('basilisk hide')
f.write('kikimore claw')
f.write('may contain peanut')
f.close()
# Exercise: put the strings on separate lines using the new line character: '\n'
# to read from a file:
f = open('offshore_assets.txt')
while True:
line = f.readline()
if len(line) > 0:
print(line)
else:
break
f.close()
# more succinctly,
for line in open('offshore_assets.txt'):
print(line)
# Exercise: copy THE THIRD column from serial_log.txt into temperature.csv
D = []
for line in open('serial_log.txt'):
line = line.strip().split(',')
if 10 == len(line):
D.append(line[2])
print(len(D))
print(D[:10])
f = open('temperature.csv', 'w')
for d in D:
f.write('{}\n'.format(d))
f.close()
# Homework: extract the FIRST FOUR columns from serial_log.txt and place them in output1.csv
# Hint: you might need the join() method for strings. Try this: ','.join(['a', 'b', 'c'])
# Challenge: merge the first two columns by adding them, write it and the second and thrid columns to output2.csv
# Like so:
# INPUT:
'''
256,0,24.525,103.70,251,270,1382,1573,582,2215
256,20,24.559,103.63,252,272,1381,1570,581,2212
256,40,24.547,103.60,252,272,1380,1569,580,2210
256,60,24.539,103.72,252,271,1379,1569,579,2208
...
'''
# OUTPUT:
'''
256,24.525,103.70
276,24.559,103.63
296,24.547,103.60
316,24.539,103.72
...
'''
# Note:
# The first and second columns are index, which is a proxy of time.
# The third is temperature in Deg.C, and the fourth, pressure in kPa.
|
print("Not Hesaplama.. ")
vize1 = int(input("1.Vize notu:"))
while (vize1 < 0 or vize1 > 100):
vize1 = int(input("Hata! 0-100 arası not giriniz:"))
vize2 = int(input("2.Vize notu:"))
while (vize2 < 0 or vize2 > 100):
vize2 = int(input("Hata! 0-100 arası not giriniz:"))
final = int(input("Final notu(0-100):"))
while (final < 0 or final > 100):
final = int(input("Hata! 0-100 arası not giriniz:"))
ortalama = (vize1 * 3 / 10 + vize2 * 3 / 10 + final * 4 / 10)
if (ortalama >= 90):
print("AA")
elif (ortalama >= 85):
print("BA")
elif (ortalama >= 80):
print("BB")
elif (ortalama >= 75):
print("CB")
elif (ortalama >= 70):
print("CC")
elif (ortalama >= 65):
print("DC")
elif (ortalama >= 60):
print("DD")
elif (ortalama >= 55):
print("FD")
else:
print("FF")
|
class admin():
def __init__(self):
pass
def get_id(self):
pass
|
r1 = float(input('Insira o comprimento da primeira reta:'))
r2 = float(input('Insira o comprimento da segunda reta:'))
r3 = float(input('Insira o coprimento da terceira reta: '))
if r1 + r2 > r3 and r2 + r3 > r1 and r1 + r3 > r2:
if r1 == r2 == r3:
print(f'O seu triângulo é Equilátero.')
elif r1 == r2 or r2 == r3 or r1 == r3:
print('Seu triangulo é Isósceles')
else:
print('Seu triângulo é escaleno.')
else:
print('Não é possível formar um triângulo com essas retas.')
|
def get_hello():
return 'Hello'
class HelloSayer():
def say_hello(self):
print('Hello')
|
####################################
### The router base class
class Router(object):
'''Common superclass of routers'''
pass
|
# Global parameter
examples_root = None
process_type_name_ns_to_clean = None
synopsis_maxlen_function = 120
synopsis_class_list = None
|
sum=0
i=0
while i<=4:
if sum<=5000:
item=int(input("Enter the item amount"))
sum=sum+item
i=i+1
print("Total items",i,"selected and total amount is:",sum)
else:
print("Account limit crossed")
break
|
class Coord(tuple):
def __add__(self, other):
if isinstance(other, Coord) and len(self) == len(other):
return Coord(i+j for i, j in zip(self, other))
def trees(inp, step: tuple):
step = Coord(step)
current = step
while current[0] < len(inp):
yield inp[current[0]][current[1] % len(inp[0])] == "#"
current += step
example_data = """\
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#\
"""
data = """\
....#.#..#.#.#.#......#....##.#
..##..#.#..#.##.....#.....#....
....#..#...#..#..####.##.#.##..
...............#.....##..##..#.
##...####..##.#..#...####...#.#
..#.#....##....##.........#...#
.#..#.##..............#.....###
##..##..#.....#..#...#....#....
.#.........#..#...#.#.#.....#..
......#...#..#.##..#.....#.#...
.#...#.#.#.##.##.....###...#...
..........#.......#...#....#..#
.....##..#.#...#...##.##.......
...#.###.#.#..##...#.#.........
###.###....#...###.#.##...#....
...........#....#.....##....###
#..#.......#.....#.....##....#.
.##.#....#...#....#......#..##.
..#....#..#..#......#..........
#..#.........#.#....#.##...#.#.
#....#.#.......#.#.#.#.......#.
.#....#....#..##.##.#....#.#...
............#....#.#.#........#
#..#..#.....#....#.##.##.#....#
....#......#..##..#....#...#...
.............#.##....####...##.
#.##..##..##.#.....#...........
#.#...#......####.##..#.#......
.......#.#..#...#.#.###.......#
#..#..........#...#....#.......
###...#.....#....#...#..#...#..
...##..#.#.....#..#..#...#.#.##
#.......#......##...##......#..
.....#..#.....#......#.....##..
..#.....###......#.#..###....#.
....##........#...##.#..#..#...
#...#.##...##..#####...##..##..
...#.#.#.#.....#.#.........##..
.............#......#..##...#..
.#..#...##....#......#......#..
#.....#...##......#............
.#.#....##.#.#..##..#####..##..
..#..#.....#..#.##..#.#......##
.......#...#...#..#..##.#..##..
...#.##....#....#..#..#..#.....
.....#......#.....#.....#..#.#.
..........#####.#..#....##...##
....#...#...#....#.......#.....
#.......#........#.##.####..###
.#........#...##...#.....#....#
...#.............#........#.#.#
..##........#..##..##.##...#.#.
......##......#####.........##.
...##.....#.#.##....#####......
.#.#........####.......#.#....#
.....#..#.#.#.......##...#...#.
.....####.#...#.#..#...#..#...#
#..#.....#...#..#..#.#....#..#.
.....#.......#..#.##..#.#.....#
.......#..##..###......#.......
.......##.#.##..##.#.###...##..
..#.....#.....#....##.##.#..#.#
###.#...#..##..#....#.#.#..#.#.
#...#.#.........##........#....
#...#.#..###.....###..##.......
.....##..#.#...#.....#....#...#
##...##..#.#.#..#.#.##..#....##
.#.......#.#.........#.##..#...
....##.#............###.#...##.
#.....##.###.#..#....##.....#..
....#.#......##.####....#....#.
.....#......##.#...#....##.#...
##...#.............#...#.......
..#..#......#.#..#..#.....###..
....#...#.#...#...#.....#..###.
.....#.......#....#...#...#...#
..####......#.#..###...........
..........#....###.#.#.....###.
#.............#...#..#.###.#..#
.......#...#.#.#.#...##...#..#.
...#.#..#..#...###.#.#.........
#.###.#..#...#..#....#..#.#....
...#.#.##..#...#.#......###.##.
.##..#..##..#.....##.##....#.##
..##.........####..............
.#.#..###...#.........#...##.#.
....##.........#.........##...#
...#.#.......#..#...###.#.##.#.
..#....###......#.##...........
.......#...#.....#.#..#.#...#..
.##..#...#..#...#..#...#.#..##.
.##...#..##..##.#.#...##.......
.#.##.#...#..#..#..........#.#.
#.#.#...#......##...##..##.....
.##..#............#.##....#.#..
.##.........##..#.....#...#...#
##.#.#.#.#...#.....##....##.#..
#..##......#..##.........#.#...
...#....#.#.#.##.....##........
...#...#...#.##.#.#.#..#..#....
.......#..#.......##...#....##.
#.....#.#......#.......#.##.#.#
.##..#.....#.....#.#####.#....#
......#.#....#..............##.
##..#...........#.#.#.......#..
..##...###...#.#.........#....#
..##..#.#....##.....#.#.......#
....###...#.###....###.......#.
..#.#.....#..#..#...........##.
.###..#.#........#..#.....##.#.
#.##........###.#..#.....#....#
.#.#.....#.#.#..#...##.#...#...
#.#.#...#.#........#..##..##...
..#.##....###.#.......#.#.#....
.....#...##...................#
#..####.....###.#..........#...
#.##.........###.#........#..#.
..##........#.......#..###..#.#
##..##..#.#..#..#.....#.#..#...
....#......#....#...#.#.#..##.#
.##....#.##.#.#..###..#......##
###....###.##....##......###..#
.##....#..###..##..#.###...##..
.#.......##..##.............##.
.###..#.....#.....#.#.#..#...##
......##.###.#........#..#.....
#####.....##.#.#...#...#.#.#...
##..##.####...##....#...#.#...#
.#.##...#...#..#...............
##.##.#..#........#...#........
..#.##.#....#...#.#.###..#....#
.......#.#..#.....##.#.#...#.#.
..#.##...#...#......#...#.#.#..
.##.......##......#.....#......
.#....................#.#...###
..#.....#..##.#......##..#....#
.....#.#...#...........#.#...##
...#..#....#.#..#.......#..#..#
.#..#.#...#.#.#.....###........
.#.#.....#..#.##..#.#..##......
..##..#..#.....###.##..#.....##
.#..#.#...#.....#..#......##.#.
.##.##.#.#.#.#.#...###..##...#.
......#.##.#..#.##.#...#.#..#.#
..#.....#.##....#......#..#....
.#.....#..###.............#...#
.#.....#...#...#.#.#.#..#.#....
.#.....#......##.....#...#.#..#
.#.#......##...#......#......#.
##....#...#..##.#...#..#.......
....#.#......#.##...#.........#
#.#.##.#..#......#....#.......#
.#..#.##..#..#........#.#...#..
..#..#.#.#...#....#...#..#..###
....#....#..#......#..........#
#.....#.......#..#....#.#.#..#.
....#.#..###.#.....#.####......
##.#.#....##.#.#........#..#..#
#.#...#...#.#...##..#.#..#.#...
##.#......###.##.......#..#....
#..#...#.......##....#.###.....
.####.##....#..#..####.#....#.#
#...#.#..#.....................
..###..#...##.....##...........
..#....#...###.#.........##.##.
......#.....#....#.#....##...##
#..#.....#...#..##.....#....#.#
..#.#..#....##...###.#..##....#
#....#..#..#..#.##.##.....#...#
......#.#..#..##.#.....#.#..###
.....##...##..#...##..#...#....
##....#...#..#...##..#...###..#
.##.####..#......#.#..#.##....#
..###........###..#....##.#....
...#.....##...##..##..##..#....
.#..#.#..##..#..#..##.....#...#
##.#..##...#..#...........##...
....#..#..###.....#....#..#..##
......##..#....##........#.#.##
.#.##....##.#......#..##..#..##
.....##.#..#.#.##.##.##..#...#.
.#..##.#.....#####...#.........
....#....#...#..##.#.#..##...#.
...#..#...#............#..#....
....#.#.#.##....##.###..#.#....
.........#...###.........#..#.#
...........#...##.#..#.#.#..#..
#..#.###..#.#..#..##.....#....#
.#.#....#.#....#...............
...#.#..#.#..##.#.#.#.......#..
.#......#...#.####......#..#...
..##..#.#...#..#.......###.....
.#.....#.#..##....##.####.##.#.
.............##.#.#.....#..#.#.
#.....##.#...#.#.#.######.##...
.##...........#..#..##.####....
#.#............#....#.........#
..#.##.##.#..#....##....#..#.##
#...#.##..##.##.#.....##.#....#
##.#..##.###..#.#.#..........#.
...##...#..#...#.#.#.###.###...
#.....##......#...#.#...#......
#.#.#.#.#.#...#..#....###...#..
...##.#...#.......#..#...##.#..
..#..#..##.....#......##...###.
.............#.##...#.#.###..#.
..#.#.....##..#.##..#...##..#..
..#...#.##..###..........#..#..
#.##.##...###...........#....#.
#.....##...#.#..............#..
##..##.....#...#..####.#...##..
...........#......##.###..####.
#...#..##.##.######.....#.....#
#.##.........##.#.#....##...#..
.##.#.......###.#.....#.....###
###.#.#.#.#.#.##......#..#..#.#
....#.###...#....#.##...##.##..
....#..#.....#.#.#..#..##.#....
....#..#..#.....#.#..##........
..........#..##..##......##..#.
#...##.......#...##.#...###..#.
..#.#.##.....##....#..#.##...#.
.#.#.....#.......##.....##...#.
#......#.........#.#.........#.
.......#...##......#.........#.
..##..........#....#..#.......#
.......#............#..#.#...#.
#..#....#.#..#....##..#........
....#..###.##..#.#..#.##..###..
....###............##.#....#.#.
..#..#.##...#....#..####...#...
..#....#...#...##...#.#.#..#...
..#.........#.#.......#........
.........##.##.#..#.#...#.#..##
#.....#.#....##.#####.......##.
.#..#....#......#.##..#....#...
........#....#...........#...#.
.......#......#..........#..##.
.###.#......#..#.##..#...#.#...
.....#..#..###...........#...#.
..#...##....###......#....#....
...#.#..#.#.#......#.##.###.#.#
.##....#...#..#.#..#........#..
......##.###...##.#.#.........#
.#...#..####..#.#..##........#.
#..#...#..#..#.#...#..##...#..#
..###...###....#.#.#.##....#..#
.#.#....#.#.#......##....#..#.#
##.#.#.####....#........#....#.
...#......#........#...........
#.#............##......#.##....
..##.#...#.....#.#..#.#..#.#.#.
#.......##.....##...#.#.#...###
............#..#..#....#......#
.#.##...###...#...###..#.......
...............#....#...#.#.#..
#..##..##.###...#..##...#.#.##.
..#..#.......#.##......#..#..#.
#.....#............#......#...#
.###.##......##.#...#.#.##..#..
.#..##..#..#..#.............#..
#...#...##..##........#........
...#........#..###...........#.
#.#..#.#...................#.##
#...#.#..#.......##...###..#.#.
..####......#....#.#....#..#..#
....#...........#...#..#.......
...#..#....#.#.##...#.#.#.#....
#...##.#.##..#.......#.....#...
.##....#...#.#....#....#.#...#.
##.#...#.#...##..#..##...##..#.
#..#.#.........#.......#.......
.....##.....#..#......##....#.#
.###...##.#.#.#....#....#....#.
#.#.#.............#.#..#.......
#.......#..............#...#.##
.#.#...#....#.........###...#.#
..##..###..#...#...#.#....##..#
.#..#.#...#..#.....#....#..##..
##.......##....#....###..#.#..#
#.#.#####..........#.#...##..##
......#..#..#...#...##...#....#
#..#......#...#...#..###.......
...####.....#.......#.#...##.#.
......#..#.....##..#...........
#........#..#...#.....#...#.#..
..#.....#..#......#.#.#.....#..
..#.........#..##...#...#...#..
##..##......#.........#........
..#..#....#.##.#....###.#..#.##
..##..#..#.......###....#..#...
...#.#...#.....####.#..........
........#..#..#.#.....#........
...##..........#.#.#.....#..#..
..#....#.......#...............
.#..#.#.#.##..#..#.....#.......
#.##.#.#..#..............#.....
.#.#..#.....##..##....##.....#.
.##.#..#........##.##...##.....
#....##..#............#....#...
...............##.#...#..#.....
..#..##.##...#.#.....#.........
.##..#.#.#.##.....#.#.#..#..##.
......#####.#...#..........##..
..........##.##...#.....#.#....
..##......#..#.###..#...#.##...
.#...........#.....#.#........#
.#...#................#......#.
#...#.#..##.#####..##....#.....
...##...##..#.#..........#.....
##............#......##..##...#
###.#.......#..#...#..#..#...#.
.#..##.....###.#.#............#
##.###.#.........#.......#.#..#
...#..##..#.....#.......#......
......#.#..#.....##..#..##.....
...#........##..###.#....#..#..
..#...##.##....#.##..###......#
..#...#.....#.####.....#...#.##
..........##....###..#...#####.
....#.#.#.#.#.##.............##
.#.#.#.##......#......#....#.#.
.##...##....#...#....#..###.#.#\
"""
|
numero = 0
print('------------------------------------------------')
print("PARA SAIR DO PROGRAMA, DIGITE UM VALOR NEGATIVO!")
print('------------------------------------------------')
while True:
numero = int(input('Que número desejas fazer a tabuada? '))
if(numero < 0):
break
else:
for c in range(0,11,1):
resultado = numero * c
print(f'{numero} X {c} = {resultado}')
print('FIM DO PROGRAMA')
|
DOWNLOAD_CHUNK_SIZE = 32768
FETCH_LIMIT = 200
def count_motions(db, project_ids=None, institution_ids=None, description_filter=None):
count = db.countMotions(None, project_ids, institution_ids, None, None, description_filter)
return count
def fetch_motions(db, project_ids=None, institution_ids=None, description_filter=None, max_subjects=None, max_objects=None):
offset = 0
motions = []
while True:
ms = db.listMotions(None, project_ids, institution_ids, None, None, description_filter, 'id', FETCH_LIMIT, offset)
filtered_ms = ms
if max_subjects is not None:
filtered_ms = [m for m in filtered_ms if len(m.associatedSubjects) <= max_subjects]
if max_objects is not None:
filtered_ms = [m for m in filtered_ms if len(m.associatedObjects) <= max_objects]
motions.extend(filtered_ms)
offset += FETCH_LIMIT
if len(ms) != FETCH_LIMIT:
break
return motions
def read_file(reader):
size = reader.getSize()
data = ''
try:
# We cannot just read the entire file b/c readChunk() seems to have an limit.
remaining_size = size
while remaining_size > 0:
s = min(remaining_size, DOWNLOAD_CHUNK_SIZE)
data += reader.readChunk(s)
remaining_size -= s
except:
data = None
return data
|
# Recursive function to perform pre-order traversal of the tree
def preorder(root):
# return if the current node is empty
if root is None:
return
# Display the data part of the root (or current node)
print(root.data, end=' ')
# Traverse the left subtree
preorder(root.left)
# Traverse the right subtree
preorder(root.right)
|
# defining object file1 to
# open GeeksforGeeks file in
# read mode
file1 = open('GeeksforGeeks.txt',
'r')
# defining object file2 to
# open GeeksforGeeksUpdated file
# in write mode
file2 = open('GeeksforGeeksUpdated.txt',
'w')
# reading each line from original
# text file
for line in file1.readlines():
# reading all lines that do not
# begin with "TextGenerator"
if not (line.startswith('TextGenerator')):
# printing those lines
print(line)
# storing only those lines that
# do not begin with "TextGenerator"
file2.write(line)
# close and save the files
file2.close()
file1.close()
|
template_string = '''#!/bin/bash
#PBS -S /bin/bash
#PBS -N ${jobname}
#PBS -m n
#PBS -l walltime=$walltime
#PBS -l select=${nodes_per_block}:ncpus=${ncpus}${select_options}
#PBS -o ${submit_script_dir}/${jobname}.submit.stdout
#PBS -e ${submit_script_dir}/${jobname}.submit.stderr
${scheduler_options}
${worker_init}
export JOBNAME="${jobname}"
${user_script}
'''
|
number = "7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450"
number = [int(digit) for digit in number]
print(type(number))
highest = 0
i = 0
product = 1
while i < len(number)-12:
for index in range(13):
product = product * number[i + index]
if product > highest:
highest = product
print(highest)
product = 1
i = i + 1
print(highest)
|
# This program demonstrates the use of the == operator using numbers
print (5 == 6)
# Using variables
x = 5
y = 8
print(x == y)
|
class Core:
def gen_range(self, StartNumber, EndNumber, GapNumber):
number_range_result = []
row_number_sp = StartNumber
gap = int(EndNumber) - int(StartNumber)
if gap > GapNumber:
for X in range(int(gap / GapNumber)):
temp = []
temp.append(row_number_sp)
temp.append(row_number_sp + GapNumber)
number_range_result.append(temp)
row_number_sp += GapNumber
temp = []
temp.append(row_number_sp)
temp.append(row_number_sp + int(gap % GapNumber))
number_range_result.append(temp)
row_number_sp += int(gap % GapNumber)
else:
number_range_result.append([StartNumber, EndNumber])
return number_range_result
def byte_to_gb(self, data, round_num=0):
if type(data) is int:
return round(int(data) / 1024 / 1024 / 1024, round_num)
else:
raise TypeError
|
"""
Day 14 - Part 1
https://adventofcode.com/2021/day/14
By NORXND @ 14.12.2021
(C) NORXND 2021 - Under The MIT License
"""
input_file = open("Day14/input.txt", "r")
input_segments = input_file.read().split("\n\n")
template = input_segments[0]
rules = {}
for raw_rule in input_segments[1].splitlines():
rule = raw_rule.split(" -> ")
rules[rule[0]] = rule[1]
new_template = template
for step in range(10):
for i, char in enumerate(template):
# If last
if i+1 >= len(template):
continue
rule = char + template[i+1]
if rule in rules:
to_insert = rules[rule].lower()
start = new_template.find(rule)
end = (start + 2)
new_template = new_template[:start+1] + to_insert + new_template[end-1:]
template = new_template.upper()
new_template = template
chars = {}
for char in template:
if char in chars:
chars[char] = chars[char] + 1
else:
chars[char] = 1
print(max(chars.values())-min(chars.values()))
|
manager_num1 =10
manager_num2 =11
zhangsan_num1 = 22
num3 = 30
pp = 36
ll = 23
nishuia
|
class FilterModule:
def filters(self):
return {
'user_home': self.user_home
}
def user_home(self, d, username):
for user in d["results"]:
if user["item"] == username:
return user["home"]
return ValueError("Cannot find the home directory for user {}".format(username))
|
class Solution:
def depthSumInverse(self, nestedList: List[NestedInteger]) -> int:
dic = {}
level = 0
q = collections.deque()
q.append(nestedList)
res = 0
while q:
size = len(q)
level += 1
sums = 0
for _ in range(size):
nl = q.popleft()
for n in nl:
if n.isInteger():
sums += n.getInteger()
else:
q.append(n.getList())
dic[level] = sums
for k, v in dic.items():
res += (level+1-k)*v
return res
|
class Solution:
def reverseWords(self, s: str) -> str:
# Using Python's built-in string manipulation methods
# Split the string into words at the spaces, reverse and join the
# individual words, then rejoin the words with a space
s = s.split(' ')
for i, word in enumerate(s):
s[i] = ''.join(list(reversed(word)))
return ' '.join(s)
|
KEY_QUESTION_TYPE = 'question_type'
KEY_QUESTION = 'question'
KEY_ANSWER = 'answer'
KEY_OPTIONS = 'options'
KEY_COMPREHENSION = 'comprehension'
KEY_EXPLANATION = 'explanation'
|
def isExistingClassification(t):
pass
def getSrcNodeName(dst):
"""
Get the name of the node connected to the argument dst plug.
"""
pass
def getCollectionsRecursive(parent):
pass
def disconnect(src, dst):
pass
def findVolumeShader(shadingEngine, search='False'):
"""
Returns the volume shader (as MObject) of the given shading engine (as MObject).
"""
pass
def transferPlug(src, dst):
"""
Transfer the connection or value set on plug 'src' on to the plug 'dst'.
"""
pass
def findSurfaceShader(shadingEngine, search='False'):
"""
Returns the surface shader (as MObject) of the given shading engine (as MObject).
"""
pass
def findPlug(userNode, attr):
"""
Return plug corresponding to attr on argument userNode.
If the argument userNode is None, or the attribute is not found, None
is returned.
"""
pass
def disconnectSrc(src):
"""
Disconnect a source (readable) plug from all its destinations.
Note that a single plug can be both source and destination, so this
interface makes the disconnection intent explicit.
"""
pass
def isSurfaceShaderNode(obj):
pass
def getSrcUserNode(dst):
"""
Get the user node connected to the argument dst plug.
Note: Only applies to MPxNode derived nodes
If the dst plug is unconnected, None is returned.
"""
pass
def plugSrc(dstPlug):
"""
Return the source of a connected destination plug.
If the destination is unconnected, returns None.
"""
pass
def getOverridesRecursive(parent):
pass
def nameToUserNode(name):
pass
def isShadingType(typeName):
pass
def canOverrideNode(node):
pass
def createSrcMsgAttr(longName, shortName):
"""
Create a source (a.k.a. output, or readable) message attribute.
"""
pass
def deleteNode(node):
"""
Remove the argument node from the graph.
This function is undoable.
"""
pass
def connect(src, dst):
"""
Connect source plug to destination plug.
If the dst plug is None, the src plug will be disconnected from all its
destinations (if any). If the src plug is None, the dst plug will be
disconnected from its source (if any). If both are None, this function
does nothing. If the destination is already connected, it will be
disconnected.
"""
pass
def isExistingType(t):
pass
def getDstUserNodes(src):
"""
Get the user nodes connected to the argument src plug.
Note: Only applies to MPxNode derived nodes
If the src plug is unconnected, None is returned.
"""
pass
def plugDst(srcPlug):
"""
Return the destinations of a connected source plug.
If the source is unconnected, returns None.
"""
pass
def _recursiveSearch(colList):
"""
# Fonctions to compute the number of operations when layer are switched
"""
pass
def getTotalNumberOperations(model):
pass
def _isDestination(plug):
"""
Returns True if the given plug is a destination plug, and False otherwise.
If the plug is a compond attribute it returns True if any of it's children is a
destination plug.
"""
pass
def isShadingNode(obj):
pass
def disconnectDst(dst):
"""
Disconnect a destination (writable) plug from its source.
Note that a single plug can be both source and destination, so this
interface makes the disconnection intent explicit.
"""
pass
def findDisplacementShader(shadingEngine, search='False'):
"""
Returns the displacement shader (as MObject) of the given shading engine (as MObject).
"""
pass
def _findShader(shadingEngine, attribute, classification='None'):
"""
Returns the shader connected to given attribute on given shading engine.
Optionally search for nodes from input connections to the shading engines
satisfying classification if plug to attribute is not a destination and
a classification string is specified.
"""
pass
def isInheritedType(parentTypeName, childTypeName):
pass
def getSrcNode(dst):
"""
Get the node connected to the argument dst plug.
"""
pass
def createGenericAttr(longName, shortName):
pass
def nameToExistingUserNode(name):
pass
def _transferConnectedPlug(src, dst):
pass
def connectMsgToDst(userNode, dst):
"""
Connect the argument userNode's message attribute to the
argument dst plug.
If the userNode is None the dst plug is disconnected
from its sources.
If the dst plug is None the userNode's message plug
is disconnected from its destinations
"""
pass
def isSurfaceShaderType(typeName):
pass
def notUndoRedoing(f):
"""
Decorator that will call the decorated method only if not currently in undoing or redoing.
Particularly useful to prevent callbacks from generating commands since that would clear the redo stack.
"""
pass
def createDstMsgAttr(longName, shortName):
"""
Create a destination (a.k.a. input, or writable) message attribute.
"""
pass
kNoSuchNode = []
kSupportedVectorTypes = set()
kSupportedSimpleTypes = set()
kPlugTypeMismatch = []
|
# [463] 岛屿的周长
# https://leetcode-cn.com/problems/island-perimeter/description/
# * algorithms
# * Easy (71.50%)
# * Total Accepted: 55.3K
# * Total Submissions: 77.3K
# * Testcase Example: '[[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]]'
# 给定一个包含 0 和 1 的二维网格地图,其中 1 表示陆地 0 表示水域。
# 网格中的格子水平和垂直方向相连(对角线方向不相连)。整个网格被水完全包围,但其中恰好有一个岛屿(或者说,一个或多个表示陆地的格子相连组成的岛屿)。
# 岛屿中没有“湖”(“湖” 指水域在岛屿内部且不和岛屿周围的水相连)。格子是边长为 1 的正方形。网格为长方形,且宽度和高度均不超过 100 。计算这个岛屿的周长。
#
# 示例 :
# 输入:
# [[0,1,0,0],
# [1,1,1,0],
# [0,1,0,0],
# [1,1,0,0]]
# 输出: 16
# 解释: 它的周长是下面图片中的 16 个黄色的边:
class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
c = 0
height = len(grid)
width = len(grid[0])
dx = (0, 1, 0, -1)
dy = (1, 0, -1, 0)
for i in range(height):
for j in range(width):
if grid[i][j]:
for d in range(4):
x = i + dx[d]
y = j + dy[d]
if (x >= height or y >= width or x < 0 or y < 0 or not grid[x][y]):
c += 1
return c
|
# 1. Property-specific details
# Timezone string follows TZ format (see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
PROP_NAME = "Ascott Raffles Place Singapore"
TIMEZONE = "Asia/Singapore"
# 2. Languages expected to be in use at this property
BABEL_LOCALES = ('en', 'zh', 'ms', 'ta')
BABEL_DEFAULT_LOCALE = "en"
# 3. MySQL DB connection details
DEBUG = False
MYSQL_DATABASE_USER = 'root'
MYSQL_DATABASE_PASSWORD = 'classroom'
MYSQL_DATABASE_DB = 'Ascott_InvMgmt'
MYSQL_DATABASE_HOST = 'ascott.coxb3venarbl.ap-southeast-1.rds.amazonaws.com'
# ADVANCED SETTINGS
SECRET_KEY = 'development-key'
UPLOADS_DEFAULT_DEST = 'static/img/items/'
UPLOADS_DEFAULT_URL = 'http://localhost:5000/static/img/items/'
UPLOADED_IMAGES_DEST = 'static/img/items/'
UPLOADED_IMAGES_URL = 'http://localhost:5000/static/img/items/'
|
"""
Ejercicio 17
En un hospital rural existen tres áreas: Ginecología, Pediatría y Traumatología. El presupuesto anual del hospital
se reparte conforme a la siguiente tabla:
Área Porcentaje del presupuesto
Ginecología 40%
Traumatología 30%
Pediatría 30%
Obtener la cantidad de dinero que recibirá cada área, para cualquier monto presupuestado.
Entradas
Presupuesto_Anual --> Float --> P_A
Salidas
Presupuesto_Anual_Ginecología --> Float --> G
Presupuesto_Anual_Traumatologia --> Float --> T
Presupuesto_Anual_Pediatría --> Float --> P
"""
# Instrucciones al usuario
print("Para conocer el presupuesto que recibira cada área del hospítal, escriba lo siguiente: ")
# Entradas
P_A = float(input("Digite el presupuesto anual del hospital: "))
# Caja negra
G = P_A*0.40
T = P_A*0.30
P = P_A*0.30
# Salidas
print(f"A ginecología le corresponde del presupuesto anual: {G}$")
print(f"A traumatología le corresponde del presupuesto anual: {T}$")
print(f"A pediatría le corresponde del presupuesto anual: {P}$")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.